:root {
  color-scheme: dark;
  --bg: #111816;
  --panel: #1d2a24;
  --panel-2: #26362e;
  --ink: #f4f1e8;
  --muted: #b7c1b0;
  --line: #405246;
  --accent: #f2b84b;
  --accent-2: #74c69d;
  --token-blue: #3fa7d6;
  --token-red: #d85f3f;
  --token-purple: #a36be8;
  --token-gold: #e1a83a;
  --danger: #e66f51;
  --good: #94d2bd;
  --shadow: 0 22px 60px rgb(0 0 0 / 35%);
  --header-art: url("assets/art/header-salvage-arcade.png");
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgb(242 184 75 / 15%), transparent 28rem),
    radial-gradient(circle at 86% 8%, rgb(63 167 214 / 11%), transparent 24rem),
    linear-gradient(135deg, #0f1815 0%, #1a211d 48%, #111816 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.app-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 162px;
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid rgb(244 241 232 / 14%);
  border-radius: 8px;
  padding: 20px;
  background:
    linear-gradient(90deg, rgb(9 14 12 / 86%), rgb(9 14 12 / 48) 52%, rgb(9 14 12 / 72)),
    linear-gradient(180deg, rgb(9 14 12 / 14%), rgb(9 14 12 / 50)),
    var(--header-art) center / cover no-repeat;
  box-shadow: var(--shadow);
}

.brand-mark {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 1px solid rgb(244 241 232 / 18%);
  border-radius: 18px;
  background: linear-gradient(160deg, #2e4438, #141e1a);
  box-shadow: var(--shadow);
  z-index: 1;
}

.brand-mark img {
  width: 48px;
  height: 48px;
}

.header-copy {
  position: relative;
  z-index: 1;
  max-width: min(560px, 100%);
  text-shadow: 0 2px 18px rgb(0 0 0 / 65%);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3.9rem);
  line-height: 0.98;
}

h2 {
  margin-bottom: 0;
  font-size: 1.15rem;
}

.app-main {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(320px, 1.08fr);
  gap: 18px;
  align-items: start;
}

.control-panel,
.result-panel {
  border: 1px solid rgb(244 241 232 / 14%);
  border-radius: 8px;
  background: linear-gradient(180deg, rgb(29 42 36 / 96%), rgb(20 30 26 / 96%));
  box-shadow: var(--shadow);
}

.control-panel {
  padding: 18px;
}

.result-panel {
  padding: 18px;
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.data-pill,
.tag-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid rgb(244 241 232 / 16%);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--muted);
  background: rgb(0 0 0 / 18%);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.category-pill {
  color: #1f1708;
  border-color: rgb(255 218 130 / 48%);
  background:
    linear-gradient(180deg, rgb(255 211 104 / 95%), rgb(214 137 46 / 95%));
}

.condition-pill {
  color: #e7fff3;
  border-color: rgb(116 198 157 / 34%);
  background:
    linear-gradient(180deg, rgb(58 117 96 / 72%), rgb(20 52 43 / 88%));
}

.field-label,
.range-field {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.combo-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.combo-input,
.text-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--ink);
  background: #101916;
  outline: none;
}

.combo-input:focus,
.text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(242 184 75 / 18%);
}

.ghost-button,
.secondary-button {
  border: 1px solid rgb(244 241 232 / 18%);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: rgb(255 255 255 / 5%);
}

.help-text {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.location-list,
.search-results {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}

.location-option,
.search-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  width: 100%;
  border: 1px solid rgb(244 241 232 / 12%);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  background: rgb(255 255 255 / 4%);
  text-align: left;
}

.location-option strong,
.search-option strong {
  display: block;
}

.location-option span,
.search-option span {
  color: var(--muted);
  font-size: 0.82rem;
}

.location-option.active {
  border-color: var(--accent);
  background: rgb(242 184 75 / 14%);
}

.tweaks-panel,
.private-details {
  margin-top: 16px;
  border: 1px solid rgb(244 241 232 / 12%);
  border-radius: 8px;
  background: rgb(0 0 0 / 18%);
}

.tweaks-panel summary,
.private-details summary {
  padding: 13px 14px;
  color: var(--accent);
  font-weight: 900;
}

.tweaks-grid {
  display: grid;
  gap: 12px;
  padding: 0 14px 14px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 700;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.scavenge-button {
  width: 100%;
  min-height: 68px;
  margin-top: 18px;
  border: 0;
  border-radius: 8px;
  color: #1f1708;
  background: linear-gradient(180deg, #ffd06b, #e29b31);
  box-shadow: 0 18px 36px rgb(226 155 49 / 24%);
  font-size: 1.35rem;
  font-weight: 1000;
}

.result-card {
  display: grid;
  gap: 16px;
  min-height: 276px;
  align-content: start;
  border: 1px solid rgb(255 218 130 / 22%);
  border-radius: 8px;
  padding: 16px;
  background:
    radial-gradient(circle at 20% 18%, rgb(242 184 75 / 17%), transparent 15rem),
    linear-gradient(150deg, rgb(116 198 157 / 14%), transparent 42%),
    linear-gradient(180deg, #2c3b32, #15201b);
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 5%),
    0 22px 54px rgb(0 0 0 / 24%);
}

.result-card.empty {
  opacity: 0.88;
}

.result-card-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.result-icon {
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid rgb(255 218 130 / 72%);
  border-radius: 50%;
  color: #fff6d6;
  background:
    radial-gradient(circle at 34% 24%, rgb(255 255 255 / 22%), transparent 30%),
    linear-gradient(180deg, #3b7f68, #173d34);
  box-shadow:
    inset 0 -8px 14px rgb(0 0 0 / 26%),
    0 10px 24px rgb(0 0 0 / 24%);
  font-size: 1.75rem;
  font-weight: 1000;
  line-height: 1;
  text-transform: uppercase;
}

.result-card[data-category="food"] .result-icon {
  background: linear-gradient(180deg, #c75b3f, #6f2b20);
}

.result-card[data-category="medical"] .result-icon {
  background: linear-gradient(180deg, #9a63d7, #4a2a70);
}

.result-card[data-category="tools"] .result-icon,
.result-card[data-category="hardware"] .result-icon {
  background: linear-gradient(180deg, #d69b3b, #6e4318);
}

.result-card[data-category="electronics"] .result-icon {
  background: linear-gradient(180deg, #3f92d6, #194667);
}

.result-card[data-category="emergency"] .result-icon {
  background: linear-gradient(180deg, #d85539, #66271e);
}

.result-card[data-category="vehicle"] .result-icon {
  background: linear-gradient(180deg, #89929c, #303942);
}

.result-card[data-category="clothing"] .result-icon,
.result-card[data-category="travel"] .result-icon {
  background: linear-gradient(180deg, #4a9b97, #1e5351);
}

.result-card[data-category="weapons"] .result-icon,
.result-card[data-category="ammunition"] .result-icon {
  background: linear-gradient(180deg, #7f6350, #2f2722);
}

.result-card[data-category="military"] .result-icon,
.result-card[data-category="security"] .result-icon {
  background: linear-gradient(180deg, #66745b, #283223);
}

.result-card[data-category="optics"] .result-icon {
  background: linear-gradient(180deg, #6ba1b8, #274957);
}

.result-card[data-category="outdoor"] .result-icon,
.result-card[data-category="sports"] .result-icon {
  background: linear-gradient(180deg, #75a957, #304820);
}

.result-kicker {
  margin-bottom: 6px;
  color: var(--accent-2);
  font-size: 0.85rem;
  font-weight: 900;
  text-transform: uppercase;
}

.result-copy {
  min-width: 0;
}

.result-copy h3 {
  margin-bottom: 0;
  overflow-wrap: anywhere;
  font-size: clamp(1.65rem, 4.6vw, 3rem);
  line-height: 1;
}

.result-card-body {
  display: grid;
  gap: 12px;
  min-width: 0;
  border: 1px solid rgb(244 241 232 / 10%);
  border-radius: 8px;
  padding: 14px;
  background: rgb(0 0 0 / 14%);
}

.result-card-body p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.result-card-footer {
  min-height: 34px;
  border: 1px solid rgb(244 241 232 / 10%);
  border-radius: 8px;
  padding: 8px 10px;
  color: #d7e9dd;
  background:
    linear-gradient(90deg, rgb(242 184 75 / 12%), rgb(116 198 157 / 8%));
  font-size: 0.84rem;
  font-weight: 800;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.find-roll-panel {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  border: 1px solid rgb(255 218 130 / 20%);
  border-radius: 8px;
  padding: 14px;
  background:
    radial-gradient(circle at 12% 0%, rgb(242 184 75 / 13%), transparent 13rem),
    linear-gradient(180deg, rgb(17 28 24 / 96%), rgb(8 14 12 / 92%));
}

.find-roll-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.find-roll-head h3 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

.find-roll-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 7px;
}

.find-roll-stats span {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 5px;
  border: 1px solid rgb(244 241 232 / 12%);
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--muted);
  background: rgb(0 0 0 / 20%);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.find-roll-stats output {
  color: var(--accent);
}

.find-roll-controls {
  display: grid;
  grid-template-columns: 42px minmax(84px, 0.7fr) 42px auto;
  gap: 8px;
  align-items: stretch;
}

.step-button,
.roll-find-button {
  border: 1px solid rgb(244 241 232 / 18%);
  border-radius: 8px;
  color: var(--ink);
}

.step-button {
  min-height: 42px;
  background: rgb(255 255 255 / 6%);
  font-size: 1.2rem;
  font-weight: 1000;
}

.percent-input-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding-right: 10px;
  color: var(--accent);
  background: #101916;
  font-weight: 900;
}

.percent-input {
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 10px 4px 10px 12px;
  color: var(--ink);
  background: transparent;
  font-weight: 900;
  outline: none;
}

.find-chance-slider {
  width: 100%;
  accent-color: var(--accent);
}

.roll-find-button {
  min-height: 50px;
  color: #1f1708;
  background: linear-gradient(180deg, #ffd06b, #d88d2f);
  box-shadow: 0 12px 24px rgb(226 155 49 / 18%);
  font-weight: 1000;
}

.step-button:disabled,
.secondary-button:disabled,
.roll-find-button:disabled,
.percent-input:disabled,
.find-chance-slider:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.mechanics-details {
  padding: 0 14px 14px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  max-width: min(360px, calc(100% - 32px));
  border: 1px solid rgb(244 241 232 / 14%);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--ink);
  background: #26362e;
  box-shadow: var(--shadow);
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 680px);
    padding-top: 16px;
  }

  .app-main {
    grid-template-columns: 1fr;
  }

  .app-header {
    align-items: start;
    min-height: 132px;
    padding: 16px;
  }

  .brand-mark {
    width: 54px;
    height: 54px;
  }

  .brand-mark img {
    width: 40px;
    height: 40px;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .find-roll-head {
    display: grid;
  }

  .find-roll-stats {
    justify-content: start;
  }

  .find-roll-controls {
    grid-template-columns: 42px minmax(86px, 1fr) 42px;
  }

  .reset-button {
    grid-column: 1 / -1;
  }

  .result-card {
    min-height: 0;
  }

  .result-card-top {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }

  .result-icon {
    width: 72px;
    height: 72px;
    font-size: 1.25rem;
  }
}
