/* ============================================================
   三十夜 · THIRTY NIGHTS
   极简塔防幸存者 — 全手绘 UI
   ============================================================ */

:root {
  --bg: #080e10;
  --bg-deep: #050a0b;
  --panel: #0f1a1c;
  --panel-2: #142326;
  --panel-3: #182b2d;
  --text: #d9e7e0;
  --text-soft: #b8c9c2;
  --muted: #7d938b;
  --dim: #4b615a;
  --accent: #8fe3c0;
  --accent-2: #5fb89a;
  --accent-dark: #173c34;
  --danger: #ff8f7a;
  --danger-dark: #4a201c;
  --gold: #ffcf7a;
  --wood: #c79b6d;
  --stone: #9fb3b8;
  --iron: #8fd8ff;
  --violet: #c79bff;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  --font: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Source Han Sans SC", sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

button { font-family: inherit; color: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
::selection { background: rgba(143, 227, 192, 0.28); color: #fff; }

.hidden { display: none !important; }

#app { position: fixed; inset: 0; }

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: var(--bg);
}

#vignette {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 48%, transparent 40%, rgba(2, 6, 7, 0.38) 78%, rgba(2, 6, 7, 0.7) 100%);
}

#damage-flash {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 25%, rgba(255, 82, 62, 0.4) 100%);
}
#damage-flash.hit { animation: damageFlash 0.45s ease-out; }

#ui-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}
#ui-layer > * { pointer-events: auto; }

/* ---------------- boot ---------------- */

#boot {
  position: absolute;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--bg);
  transition: opacity 0.5s ease, visibility 0.5s;
}
#boot.done { opacity: 0; visibility: hidden; }
.boot-mark { display: flex; gap: 5px; align-items: flex-end; height: 34px; }
.boot-mark span {
  display: block;
  width: 4px;
  height: 12px;
  border-radius: 2px;
  background: var(--accent);
  animation: bootBar 1s ease-in-out infinite;
}
.boot-mark span:nth-child(2) { height: 26px; background: var(--danger); animation-delay: 0.15s; }
.boot-mark span:nth-child(3) { height: 18px; animation-delay: 0.3s; }
.boot-text { font-size: 13px; letter-spacing: 0.6em; color: var(--muted); }

/* ---------------- universal ---------------- */

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-soft);
  line-height: 1;
}

.btn {
  border: 1px solid var(--line);
  background: rgba(19, 33, 36, 0.9);
  border-radius: var(--r-sm);
  min-height: 40px;
  padding: 9px 18px;
  font-size: 13px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, transform 0.16s, color 0.16s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:hover { background: var(--panel-3); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, #256d5b, #1a4f43);
  border-color: rgba(143, 227, 192, 0.6);
  color: #effff7;
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), 0 8px 30px rgba(95, 184, 154, 0.18);
}
.btn.primary:hover { background: linear-gradient(180deg, #2d7f6a, #1f5e50); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 30px; padding: 5px 11px; font-size: 12px; }
.btn.danger { border-color: rgba(255, 143, 122, 0.35); color: var(--danger); }
.btn.danger:hover { background: rgba(255, 143, 122, 0.12); border-color: var(--danger); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn:disabled:hover { background: rgba(19, 33, 36, 0.9); border-color: var(--line); }

.icon-slot { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; flex: 0 0 auto; }
.icon-slot svg { width: 100%; height: 100%; }
.item-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.item-icon svg { width: 100%; height: 100%; display: block; }
.bag-slot .item-icon { width: 100% !important; height: 100% !important; }

/* ---------------- menu ---------------- */

.screen {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: clamp(18px, 3.4vh, 38px) clamp(22px, 4.5vw, 68px);
  overflow: auto;
}
.screen.menu-screen {
  background:
    linear-gradient(180deg, rgba(5, 10, 11, 0.5) 0%, rgba(5, 10, 11, 0.08) 28%, rgba(5, 10, 11, 0.42) 78%, rgba(5, 10, 11, 0.82) 100%);
  animation: screenIn 0.35s ease both;
}

.menu-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  animation: fadeDown 0.5s 0.05s ease both;
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(143, 227, 192, 0.25);
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background: radial-gradient(circle, rgba(143, 227, 192, 0.1), transparent 70%);
}
.brand-mark::before, .brand-mark::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(143, 227, 192, 0.18);
}
.brand-mark::before { inset: 4px; }
.brand-mark::after { inset: -6px; opacity: .5; }
.brand-mark svg { width: 24px; height: 24px; }
.brand h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: 0.24em; }
.brand p { margin: 2px 0 0; font-size: 9px; letter-spacing: 0.42em; color: var(--dim); text-transform: uppercase; }
.menu-head-right { display: flex; align-items: center; gap: 16px; }
.menu-head-right .btn { min-height: 30px; padding: 5px 11px; font-size: 11px; color: var(--muted); }
.journey { text-align: right; font-size: 11px; color: var(--muted); letter-spacing: 0.12em; }
.journey b { display: block; margin-top: 4px; color: var(--text-soft); font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em; }

.hero {
  text-align: center;
  margin-top: clamp(10px, 2.2vh, 28px);
  animation: fadeUp 0.6s 0.1s ease both;
}
.hero h1 {
  margin: 0;
  font-size: clamp(46px, 7.2vh, 82px);
  font-weight: 600;
  letter-spacing: 0.18em;
  line-height: 1.08;
  text-shadow: 0 0 70px rgba(143, 227, 192, 0.16);
  padding-left: 0.18em;
}
.hero .en {
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.62em;
  color: var(--accent-2);
  text-transform: uppercase;
}
.hero .tagline {
  margin: 14px auto 0;
  max-width: 560px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.1em;
}
.hero .tagline em { font-style: normal; color: var(--text-soft); }

.map-row {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: clamp(12px, 2vw, 28px);
  margin: clamp(16px, 2.6vh, 32px) 0 clamp(14px, 2vh, 24px);
  flex: 1;
  min-height: 0;
  animation: fadeUp 0.6s 0.18s ease both;
}
.map-card {
  position: relative;
  flex: 0 1 356px;
  min-width: 0;
  height: min(100%, 442px);
  max-height: 442px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(18, 33, 35, 0.94), rgba(9, 17, 18, 0.97));
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  display: flex;
  flex-direction: column;
}
.map-card:hover { transform: translateY(-5px); border-color: rgba(143, 227, 192, 0.3); box-shadow: 0 26px 60px rgba(0, 0, 0, 0.4); }
.map-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(143, 227, 192, 0.85), 0 28px 70px rgba(0, 0, 0, 0.5); }
.map-card.selected .map-art { filter: saturate(1.15) brightness(1.08); }
.map-card.locked { cursor: not-allowed; }
.map-card.locked:hover { transform: none; border-color: var(--line); box-shadow: none; }
.map-card.locked .map-art { filter: brightness(0.62) saturate(0.4); }
.map-card.locked .map-body { opacity: 0.52; }

.map-art {
  position: relative;
  height: 39%;
  min-height: 132px;
  overflow: hidden;
  background: var(--map-bg, #142724);
  transition: filter 0.3s;
  flex-shrink: 0;
}
.map-art svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.map-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 48%, rgba(11, 20, 21, 0.9) 100%);
}
.map-art-top {
  position: absolute;
  z-index: 2;
  top: 13px;
  left: 15px;
  right: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: rgba(255, 255, 255, 0.72);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
}
.map-tier { display: flex; gap: 4px; align-items: center; }
.map-tier i { display: block; width: 7px; height: 3px; background: currentColor; opacity: 0.35; }
.map-tier i.on { opacity: 1; color: var(--map-accent, var(--accent)); }
.map-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 99px;
  background: rgba(8, 14, 16, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
}
.map-status.cleared { color: var(--accent); border-color: rgba(143, 227, 192, 0.22); }
.map-status.locked { color: var(--muted); }

.map-body { padding: 0 19px 18px; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.map-name-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: -3px; }
.map-name { margin: 0; font-size: clamp(20px, 2.3vh, 26px); font-weight: 600; letter-spacing: 0.08em; }
.map-sub { font-size: 10px; letter-spacing: 0.16em; color: var(--muted); white-space: nowrap; }
.map-desc { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; min-height: 38px; }
.map-mods { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.map-mods span {
  font-size: 10px;
  padding: 3px 7px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-soft);
  white-space: nowrap;
}
.map-card-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.055);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.06em;
}
.map-card-foot .enter { color: var(--map-accent, var(--accent)); display: inline-flex; align-items: center; gap: 6px; }
.map-card-foot .enter::after { content: "→"; font-family: var(--mono); }
.map-card.locked .map-card-foot .enter::after { content: ""; }
.map-lock-veil {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 39%;
  min-height: 132px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: linear-gradient(180deg, rgba(4, 9, 10, 0.5), rgba(4, 9, 10, 0.76));
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-align: center;
  padding: 0 18px;
}
.map-lock-veil svg { width: 30px; height: 30px; opacity: 0.6; }

.menu-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: clamp(12px, 2vh, 20px);
  border-top: 1px solid var(--line);
  animation: fadeUp 0.6s 0.26s ease both;
  flex-wrap: wrap;
}
.loadout-summary { display: flex; align-items: center; gap: clamp(12px, 2vw, 26px); flex-wrap: wrap; }
.summary-item { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.summary-item b { color: var(--text); font-family: var(--mono); font-weight: 500; font-size: 13px; }
.summary-item .icon-slot { color: var(--muted); }
.legacy-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; min-height: 20px; }
.legacy-empty { font-size: 9px; letter-spacing: 0.08em; color: var(--dim); }
.legacy-chip { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border: 1px solid var(--line); border-radius: 99px; font-size: 9px; letter-spacing: 0.06em; background: rgba(255,255,255,0.02); }
.legacy-chip svg { width: 10px; height: 10px; }
.menu-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.menu-actions .btn.primary { min-width: 220px; min-height: 48px; font-size: 14px; letter-spacing: 0.06em; }
.menu-hint { width: 100%; text-align: center; color: var(--dim); font-size: 10px; letter-spacing: 0.16em; margin-top: 12px; }

/* ---------------- HUD ---------------- */

#hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; animation: hudIn 0.4s ease both; }
#hud .hud-btn, #hud .interactive { pointer-events: auto; }
#hud::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 340px;
  height: 260px;
  pointer-events: none;
  background: radial-gradient(circle at 0 0, rgba(3, 8, 9, 0.5), transparent 72%);
}
#hud .day-label, #hud .vital-head, #hud .vital-sub, #hud .hud-stat, #hud .controls-hint {
  text-shadow: 0 2px 8px rgba(2, 6, 7, 0.75);
}

.hud-top {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  min-width: 260px;
}
.day-label { font-size: 19px; font-weight: 600; letter-spacing: 0.14em; line-height: 1.2; }
.day-label small { font-size: 9px; font-family: var(--mono); letter-spacing: 0.3em; color: var(--muted); margin-left: 8px; }
.phase-row { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 5px; color: var(--muted); font-size: 10px; letter-spacing: 0.2em; }
.phase-row .phase-icon { width: 12px; height: 12px; display: inline-flex; }
.phase-row .phase-icon svg { width: 100%; height: 100%; }
.phase-row .timer { font-family: var(--mono); letter-spacing: 0.08em; color: var(--text-soft); }
.phase-track {
  width: 226px;
  height: 2px;
  margin: 8px auto 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  overflow: hidden;
}
.phase-track i { display: block; height: 100%; width: 100%; background: var(--accent); border-radius: inherit; transition: width 0.2s linear; }
.phase-forecast { margin-top: 5px; min-height: 12px; font-size: 9px; letter-spacing: 0.08em; color: var(--muted); }
#hud.night .phase-track i { background: var(--iron); }
#hud.night .day-label { color: #dcefff; }
.night-toggle {
  margin-top: 9px;
  background: rgba(10, 18, 20, 0.65);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 99px;
  font-size: 10px;
  letter-spacing: 0.12em;
  padding: 4px 12px;
  cursor: pointer;
  pointer-events: auto;
  transition: 0.2s;
}
.night-toggle:hover { color: var(--text); border-color: var(--line-strong); }
.night-toggle:disabled { opacity: 0.28; cursor: default; }

.resources {
  position: absolute;
  top: 22px;
  left: 26px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.resource-bar { display: flex; align-items: center; gap: 6px; }
.res-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  border-radius: 7px;
  background: rgba(8, 15, 16, 0.64);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-soft);
  min-width: 58px;
}
.res-chip .icon-slot { width: 13px; height: 13px; opacity: 0.9; }
.day-buff-strip { display: flex; flex-wrap: wrap; gap: 4px; max-width: 230px; }
.day-buff-strip:empty { display: none; }
.special-day-chip {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  align-self: flex-start;
  max-width: 360px;
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 10px;
  line-height: 1.45;
  letter-spacing: 0.06em;
  pointer-events: auto;
  cursor: help;
}
.special-day-chip span { color: var(--muted); font-family: var(--mono); }
.special-day-chip b { font-weight: 600; white-space: nowrap; }
.special-day-chip i { flex-basis: 100%; color: var(--text-soft); font-style: normal; font-size: 9px; line-height: 1.5; }
.map-mechanic-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  align-self: flex-start;
  max-width: 360px;
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 9px;
  line-height: 1.45;
  letter-spacing: 0.04em;
  pointer-events: none;
}
.map-mechanic-chip span { font-family: var(--mono); font-weight: 600; white-space: nowrap; }
.map-mechanic-chip i { color: var(--text-soft); font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-buff {
  padding: 2px 6px;
  border-radius: 99px;
  border: 1px solid currentColor;
  background: rgba(8, 15, 17, 0.72);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.35;
  letter-spacing: 0.03em;
  opacity: 0.9;
}
.res-chip.gold { color: var(--gold); }
.res-chip.wood { color: var(--wood); }
.res-chip.stone { color: var(--stone); }
.res-chip.iron { color: var(--iron); }

.vitals {
  position: absolute;
  top: 132px;
  left: 26px;
  width: 216px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vital-block { display: flex; flex-direction: column; gap: 4px; }
.vital-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 10px; letter-spacing: 0.12em; color: var(--muted); }
.vital-head b { font-family: var(--mono); font-weight: 400; color: var(--text-soft); font-size: 11px; }
.vital-bar { height: 5px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.vital-bar i { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, #5fb89a, #8fe3c0); transition: width 0.18s ease; }
.vital-block.core .vital-bar i { background: linear-gradient(90deg, #c07a52, #ffcf7a); }
.vital-block.low .vital-bar i { background: linear-gradient(90deg, #a63c2e, #ff8f7a); }
.vital-block.low .vital-head b { color: var(--danger); }
.vital-sub { font-size: 9px; color: var(--dim); letter-spacing: 0.06em; }
.vital-sub span { color: var(--text-soft); }

.hud-right {
  position: absolute;
  top: 22px;
  right: 26px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.hud-stat { display: flex; gap: 8px; align-items: center; }
.hud-stat b { font-family: var(--mono); font-weight: 400; color: var(--text-soft); font-size: 11px; }

.archetype-strip {
  position: absolute;
  top: 126px;
  right: 26px;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
  width: 160px;
}
.arch-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border: 1px solid color-mix(in srgb, var(--arch-color) 28%, transparent);
  border-radius: 99px;
  color: color-mix(in srgb, var(--arch-color) 72%, var(--muted));
  background: color-mix(in srgb, var(--arch-color) 7%, transparent);
  font-size: 9px;
  letter-spacing: 0.06em;
}
.arch-chip b { font-weight: 600; color: var(--arch-color); }
.arch-chip.active { border-color: color-mix(in srgb, var(--arch-color) 60%, transparent); background: color-mix(in srgb, var(--arch-color) 13%, transparent); box-shadow: 0 0 12px color-mix(in srgb, var(--arch-color) 12%, transparent); }

.skill-chip {
  position: absolute;
  right: 26px;
  bottom: 132px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 15, 16, 0.76);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  cursor: pointer;
  pointer-events: auto;
}
.skill-chip:hover { border-color: var(--line-strong); color: var(--text); }
.skill-chip .kbd { height: 17px; min-width: 17px; font-size: 9px; }
.skill-chip b { font-weight: 500; color: var(--text-soft); }
.skill-chip i { font-style: normal; font-family: var(--mono); font-size: 9px; color: var(--dim); }
.skill-chip.ready { border-color: rgba(143, 227, 192, 0.42); box-shadow: 0 0 14px rgba(143, 227, 192, 0.09); }
.skill-chip.ready i { color: var(--accent); }

.weapon-chips {
  position: absolute;
  right: 26px;
  bottom: 92px;
  display: flex;
  gap: 7px;
}
.weapon-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px 0 8px;
  border-radius: 8px;
  background: rgba(8, 15, 16, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 10px;
  color: var(--muted);
  max-width: 170px;
}
.weapon-chip .icon-slot { width: 17px; height: 17px; flex: 0 0 auto; }
.weapon-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.weapon-chip.empty { opacity: 0.4; }
.weapon-chip .rarity-dot { width: 4px; height: 4px; border-radius: 50%; flex: 0 0 auto; }

.hud-actions {
  position: absolute;
  right: 26px;
  bottom: 26px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.hud-btn {
  height: 34px;
  padding: 0 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(11, 20, 22, 0.78);
  color: var(--text-soft);
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: 0.16s;
}
.hud-btn:hover { background: var(--panel-3); border-color: var(--line-strong); color: var(--text); }
.hud-btn .kbd { height: 17px; min-width: 17px; font-size: 9px; }

.controls-hint {
  position: absolute;
  left: 26px;
  bottom: 26px;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.9;
  letter-spacing: 0.06em;
}
.controls-hint .kbd { height: 17px; min-width: 17px; font-size: 9px; margin-right: 4px; }

.prompt {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translate(-50%, 8px);
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 16px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(7, 13, 14, 0.78);
  font-size: 12px;
  color: var(--text-soft);
  opacity: 0;
  transition: opacity 0.18s, transform 0.18s;
  pointer-events: none;
  white-space: nowrap;
}
.prompt.show { opacity: 1; transform: translate(-50%, 0); }
.prompt .kbd { border-color: rgba(143, 227, 192, 0.4); color: var(--accent); }
.prompt .cost { color: var(--gold); font-family: var(--mono); font-size: 11px; }
.prompt .already { color: var(--dim); }
.prompt .gather-bar {
  display: inline-block;
  width: 72px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  vertical-align: middle;
}
.prompt .gather-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.1s linear;
}

.banner {
  position: absolute;
  top: 21%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.6);
  z-index: 15;
}
.banner.show { animation: bannerShow 3s ease forwards; }
.banner .big { font-size: clamp(32px, 5vh, 52px); font-weight: 600; letter-spacing: 0.24em; padding-left: 0.24em; }
.banner .sub { margin-top: 7px; font-size: 10px; letter-spacing: 0.38em; color: var(--muted); text-transform: uppercase; }
.banner.danger .big { color: var(--danger); }
.banner.good .big { color: var(--accent); }

.toasts {
  position: absolute;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  pointer-events: none;
  z-index: 18;
}
.modal-toasts {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 600;
  pointer-events: none !important;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(7, 13, 14, 0.9);
  color: var(--text-soft);
  font-size: 11px;
  animation: toastIn 0.25s ease both;
  max-width: 320px;
}
.toast.rarity { border-color: currentColor; }
.toast .icon-slot { width: 15px; height: 15px; }
.toast.fade { animation: toastOut 0.35s ease forwards; }

.boss-wrap {
  position: absolute;
  top: 116px;
  left: 50%;
  transform: translateX(-50%);
  width: min(380px, 60vw);
  opacity: 0;
  transition: opacity 0.3s;
  text-align: center;
}
.boss-wrap.show { opacity: 1; }
.boss-name { font-size: 10px; letter-spacing: 0.3em; color: var(--danger); margin-bottom: 5px; }
.boss-hp { height: 4px; background: rgba(255, 255, 255, 0.08); border-radius: 99px; overflow: hidden; }
.boss-hp i { display: block; height: 100%; background: linear-gradient(90deg, #a63c2e, #ff8f7a); border-radius: inherit; transition: width 0.2s; }

/* ---------------- modal basics ---------------- */

.modal-root { position: absolute; inset: 0; z-index: 200; display: none; }
.modal-root.open { display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3, 7, 8, 0.74); backdrop-filter: blur(7px); }
.modal {
  position: relative;
  width: min(1220px, 95vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--r-lg);
  background:
    radial-gradient(circle at 20% 0%, rgba(143, 227, 192, 0.055), transparent 42%),
    linear-gradient(180deg, #111f21, #0a1315);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: modalIn 0.22s ease both;
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 28px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.modal-title { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: 0.1em; }
.modal-sub { margin-top: 4px; color: var(--muted); font-size: 11px; letter-spacing: 0.06em; }
.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
  transition: 0.16s;
  flex-shrink: 0;
}
.modal-close:hover { color: var(--text); border-color: var(--line-strong); background: rgba(255, 255, 255, 0.05); }
.modal-body { overflow: auto; flex: 1; min-height: 0; }
.modal-foot {
  padding: 15px 28px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.1);
}

/* ---------------- save slots ---------------- */

.save-modal { width: min(980px, 95vw); }
.save-body { padding: 22px 28px; }
.save-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.save-slot-card {
  min-height: 160px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.018);
}
.save-slot-card.active {
  border-color: rgba(143, 227, 192, 0.38);
  background: rgba(143, 227, 192, 0.045);
}
.save-slot-card.empty {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.008);
}
.save-slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.save-slot-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text);
}
.save-slot-badge {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
}
.save-slot-badge.active { color: var(--accent); border-color: rgba(143, 227, 192, 0.32); }
.save-slot-meta { color: var(--muted); font-size: 10px; line-height: 1.6; }
.save-slot-time { color: var(--dim); font-size: 9px; margin-top: 1px; }
.save-slot-empty {
  margin: 12px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}
.save-slot-empty span { color: var(--dim); font-size: 9px; }
.save-slot-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
  flex-wrap: wrap;
}
.save-slot-actions .btn { flex: 1; min-width: 88px; }

/* ---------------- inventory ---------------- */

.inv-body {
  display: grid;
  grid-template-columns: 474px minmax(0, 1fr);
  gap: 30px;
  padding: 24px 28px;
  overflow: auto;
}
.paperdoll {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, 120px);
  gap: 10px;
  align-content: start;
}
.item-slot {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.018);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 6px;
  transition: border-color 0.16s, background 0.16s, box-shadow 0.16s;
  overflow: hidden;
  min-width: 0;
}
.item-slot:hover { background: rgba(255, 255, 255, 0.04); border-color: var(--line-strong); }
.item-slot.filled { background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)); }
.item-slot.selected { box-shadow: 0 0 0 1px var(--accent), 0 0 24px rgba(143, 227, 192, 0.08); border-color: rgba(143, 227, 192, 0.55); }
.item-slot .item-icon { width: 50px; height: 50px; flex-shrink: 0; }
.item-slot .slot-placeholder { width: 38px; height: 38px; border: 1px dashed rgba(255, 255, 255, 0.1); border-radius: 50%; display: grid; place-items: center; color: var(--dim); font-size: 14px; }
.item-slot .slot-kind { position: absolute; top: 5px; left: 7px; font-size: 8px; letter-spacing: 0.16em; color: var(--dim); text-transform: uppercase; }
.item-slot .slot-name { width: 100%; text-align: center; font-size: 10px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-slot.empty .slot-name { color: var(--dim); }
.item-slot .rarity-bar { position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; opacity: 0.9; }

.stats-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: radial-gradient(circle at 50% 0%, rgba(143, 227, 192, 0.06), transparent 65%), rgba(255, 255, 255, 0.018);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}
.stats-card h4 { margin: 0 0 4px; font-size: 9px; letter-spacing: 0.2em; color: var(--dim); font-weight: 500; }
.stat-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 10px; color: var(--muted); }
.stat-row b { font-family: var(--mono); font-weight: 400; font-size: 11px; color: var(--text); }
.stat-row.hl b { color: var(--accent); }
.doll-center-label { text-align: center; font-size: 9px; letter-spacing: 0.24em; color: var(--dim); margin-bottom: 2px; }

.bag-panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.bag-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.bag-head h3 { margin: 0; font-size: 13px; letter-spacing: 0.12em; font-weight: 500; color: var(--text-soft); }
.bag-head h3 span { color: var(--dim); font-family: var(--mono); font-size: 11px; margin-left: 4px; }
.bag-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.bag-tools .btn { min-height: 28px; padding: 4px 9px; font-size: 10px; }
.bag-grid {
  display: grid;
  grid-template-columns: repeat(6, 72px);
  grid-auto-rows: 72px;
  gap: 8px;
  overflow: auto;
  align-content: start;
  padding-right: 4px;
  min-height: 0;
}
.bag-slot {
  position: relative;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  background: rgba(255, 255, 255, 0.014);
  cursor: default;
  display: grid;
  place-items: center;
  padding: 5px;
  transition: 0.15s;
  min-width: 0;
}
.bag-slot.filled { cursor: pointer; background: rgba(255, 255, 255, 0.028); }
.bag-slot.filled:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.055); }
.bag-slot.selected { box-shadow: 0 0 0 1px var(--accent); border-color: rgba(143, 227, 192, 0.5); }
.bag-slot .item-icon { width: 100%; height: 100%; }
.bag-slot .rarity-bar { position: absolute; left: 6px; right: 6px; bottom: 4px; height: 2px; border-radius: 2px; }
.bag-slot .bp-mark { position: absolute; right: 4px; top: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--violet); opacity: 0.8; }
.bag-empty { color: var(--dim); font-size: 9px; letter-spacing: 0.1em; }
.bag-tip { margin-top: 10px; color: var(--dim); font-size: 10px; letter-spacing: 0.04em; }

.inv-selected {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.inv-selected .item-icon { width: 38px; height: 38px; flex: 0 0 auto; }
.inv-selected-name { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-selected-sub { font-size: 10px; color: var(--muted); margin-top: 2px; }
.inv-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

/* ---------------- tooltip ---------------- */

.item-tooltip {
  position: fixed;
  z-index: 500;
  width: 338px;
  max-width: calc(100vw - 24px);
  padding: 15px 17px 13px;
  border-radius: var(--r-md);
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(8, 15, 17, 0.97);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-soft);
  backdrop-filter: blur(12px);
}
.item-tooltip .tt-name { font-size: 17px; font-weight: 600; line-height: 1.35; }
.item-icon svg { filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.05)); }
.item-tooltip .tt-meta { font-size: 10px; color: var(--muted); letter-spacing: 0.05em; margin-top: 2px; }
.item-tooltip .tt-desc { color: var(--muted); font-size: 11px; margin-top: 8px; line-height: 1.65; }
.item-tooltip .tt-sep { height: 1px; background: rgba(255, 255, 255, 0.075); margin: 9px 0; }
.item-tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; font-size: 11px; }
.item-tooltip .tt-row span { color: var(--muted); }
.item-tooltip .tt-row b { font-family: var(--mono); font-weight: 400; color: var(--text); }
.item-tooltip .tt-affixes { display: flex; flex-direction: column; gap: 2px; }
.item-tooltip .tt-affix { color: #82d99b; font-size: 11px; }
.item-tooltip .tt-cost { color: var(--gold); font-size: 11px; }
.item-tooltip .tt-value { color: var(--dim); font-size: 10px; margin-top: 7px; letter-spacing: 0.04em; }
.item-tooltip .tt-bonus { color: var(--violet); font-size: 11px; }
.item-tooltip .tt-hint { color: var(--dim); font-size: 9px; margin-top: 5px; letter-spacing: 0.05em; }
.item-tooltip .tt-progress {
  height: 4px;
  margin: 5px 0 7px;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}
.item-tooltip .tt-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(128, 227, 192, 0.35);
}
.item-tooltip .tt-queue { display: flex; flex-direction: column; gap: 2px; margin-top: 3px; }
.item-tooltip .tt-queue-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-tooltip .tt-queue-row b { flex-shrink: 0; color: var(--accent); }
.item-tooltip .tt-rule { color: var(--dim); font-size: 9px; line-height: 1.55; margin-top: 7px; }

/* ---------------- build ---------------- */

.build-panel {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  width: min(1180px, 96vw);
  z-index: 25;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: rgba(8, 15, 17, 0.96);
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.62);
  padding: 14px;
  animation: buildIn 0.18s ease both;
}
.build-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 2px 10px; }
.build-head > div { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.build-head b { font-size: 14px; font-weight: 500; letter-spacing: 0.12em; color: var(--text-soft); white-space: nowrap; }
.build-head span { font-size: 10px; color: var(--dim); }
.build-close {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.build-close:hover { color: var(--text); border-color: var(--line-strong); background: rgba(255, 255, 255, 0.05); }
.build-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.018);
}
.build-filters { display: flex; flex-wrap: wrap; gap: 4px; }
.build-filter {
  border: 1px solid transparent;
  border-radius: 99px;
  background: transparent;
  color: var(--muted);
  padding: 4px 10px;
  font-size: 10px;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.build-filter:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.build-filter.active { color: var(--accent); border-color: rgba(143, 227, 192, 0.3); background: rgba(143, 227, 192, 0.08); }
.build-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-left: auto; }
.build-select,
.build-search,
.build-reset {
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(8, 15, 17, 0.9);
  color: var(--text-soft);
  font-size: 10px;
  font-family: inherit;
  padding: 0 8px;
}
.build-select { cursor: pointer; }
.build-search { width: 170px; outline: none; }
.build-search::placeholder { color: var(--dim); }
.build-search:focus, .build-select:focus { border-color: rgba(143, 227, 192, 0.45); }
.build-reset { cursor: pointer; color: var(--muted); }
.build-reset:hover { color: var(--text); border-color: var(--line-strong); }
.build-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 9px;
  overflow-y: auto;
  overscroll-behavior: contain;
  max-height: min(52vh, 470px);
  min-height: 190px;
  padding: 1px 4px 5px 1px;
}
.build-empty { grid-column: 1 / -1; color: var(--muted); font-size: 12px; padding: 48px 8px; text-align: center; line-height: 1.8; }
.bp-card {
  position: relative;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.022);
  padding: 10px 12px 10px 48px;
  cursor: pointer;
  transition: 0.16s;
  min-height: 108px;
  color: var(--text-soft);
  font-family: inherit;
}
.bp-card:hover { background: rgba(255, 255, 255, 0.055); border-color: var(--line-strong); transform: translateY(-1px); }
.bp-card .icon-slot { position: absolute; left: 10px; top: 10px; width: 30px; height: 30px; }
.bp-key { position: absolute; top: 6px; right: 7px; font-family: var(--mono); font-size: 9px; color: var(--dim); border: 1px solid var(--line); border-radius: 4px; padding: 1px 3px; }
.bp-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.bp-infinite { margin-left: 5px; color: #ffad66; font-family: var(--mono); font-size: 11px; }
.bp-tags { font-size: 9px; letter-spacing: 0.05em; margin-top: 2px; color: var(--muted); }
.bp-stats { font-size: 9px; color: var(--muted); margin-top: 4px; line-height: 1.65; }
.bp-cost { font-size: 9px; color: var(--dim); margin-top: 4px; }
.bp-cost span { color: var(--gold); font-family: var(--mono); }
.bp-cost .no { color: var(--danger); }
.build-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 9px; padding: 0 3px; font-size: 9px; color: var(--dim); }
.build-foot .kbd { margin-right: 3px; }

.placement-hint {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 24;
  display: flex;
  gap: 12px;
  align-items: center;
  border-radius: 99px;
  padding: 7px 15px;
  border: 1px solid var(--line);
  background: rgba(7, 13, 14, 0.82);
  backdrop-filter: blur(8px);
  font-size: 11px;
  color: var(--text-soft);
  pointer-events: none;
}
.placement-hint .invalid { color: var(--danger); }
.placement-hint .valid { color: var(--accent); }

.building-panel {
  position: absolute;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  width: 330px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: rgba(8, 15, 17, 0.94);
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  z-index: 26;
  animation: buildIn 0.16s ease both;
}
.building-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.building-panel-name { font-size: 14px; font-weight: 600; }
.building-panel-sub { margin-top: 2px; font-size: 10px; color: var(--muted); }
.building-panel .modal-close { width: 26px; height: 26px; font-size: 14px; }
.building-hp { height: 3px; border-radius: 99px; background: rgba(255,255,255,0.08); overflow: hidden; margin: 10px 0 9px; }
.building-hp i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.building-recycle-status {
  margin: 7px 0 9px;
  padding: 8px 9px;
  border: 1px solid rgba(143, 227, 192, 0.16);
  border-radius: 8px;
  background: rgba(143, 227, 192, 0.035);
}
.building-recycle-line { display: flex; justify-content: space-between; gap: 10px; font-size: 10px; line-height: 1.55; color: var(--muted); }
.building-recycle-line b { font-family: var(--mono); font-weight: 400; color: var(--text); }
.building-recycle-bar { height: 4px; margin: 5px 0 6px; }
.building-recycle-yield { font-size: 9px; color: var(--accent); line-height: 1.5; }
.building-recycle-list {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  max-height: 82px;
  overflow: auto;
  font-size: 9px;
  line-height: 1.6;
}
.building-recycle-list div { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.building-recycle-list span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.building-recycle-list b { flex: 0 0 auto; font-family: var(--mono); font-weight: 400; color: var(--accent); }
.building-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.building-actions .btn { flex: 1; min-height: 30px; padding: 4px 8px; font-size: 11px; }

/* ---------------- blacksmith ---------------- */

.forge-modal { width: min(880px, 94vw); }
.forge-body { max-height: min(66vh, 680px); overflow: auto; padding: 18px 24px 22px; }
.forge-wallet {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 173, 102, 0.18);
  border-radius: 9px;
  background: rgba(255, 173, 102, 0.045);
  font-size: 10px;
  color: var(--muted);
}
.forge-wallet b { color: #ffad66; font-family: var(--mono); font-weight: 500; }
.forge-wallet-tip { margin-left: auto; color: var(--dim); }
.forge-list { display: flex; flex-direction: column; gap: 7px; }
.forge-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 66px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.018);
}
.forge-item:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.03); }
.forge-icon { flex: 0 0 auto; display: inline-flex; }
.forge-main { min-width: 0; flex: 1; }
.forge-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.forge-sub { margin-top: 2px; font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.forge-cost { margin-top: 3px; font-family: var(--mono); font-size: 9px; color: var(--dim); }
.forge-actions { display: flex; flex: 0 0 auto; gap: 6px; align-items: center; }
.forge-item .btn { flex: 0 0 auto; min-height: 30px; font-size: 10px; }
.forge-item.active { border-color: rgba(255, 173, 102, 0.42); background: rgba(255, 173, 102, 0.055); }
.forge-fodder-panel {
  margin-bottom: 12px;
  padding: 11px;
  border: 1px solid rgba(255, 173, 102, 0.24);
  border-radius: 10px;
  background: rgba(255, 173, 102, 0.04);
}
.forge-fodder-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.forge-fodder-head > div:first-child { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.forge-fodder-head b { font-size: 11px; color: var(--text-soft); font-weight: 600; }
.forge-fodder-head span { font-size: 9px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.forge-fodder-count { flex: 0 0 auto; font-family: var(--mono); font-size: 10px; color: #ffad66; }
.forge-fodder-tip { margin-top: 4px; font-size: 9px; color: var(--dim); line-height: 1.5; }
.forge-xp-bar { height: 4px; margin-top: 6px; border-radius: 99px; overflow: hidden; background: rgba(255,255,255,0.07); }
.forge-xp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ff8f7a, #ffe38f); border-radius: inherit; }
.forge-fodder-preview { margin-top: 6px; font-size: 9px; color: #ffad66; }
.forge-fodder-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 5px;
  max-height: 170px;
  overflow: auto;
  margin-top: 8px;
  padding-right: 3px;
}
.forge-fodder-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.018);
  color: var(--text-soft);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}
.forge-fodder-row:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.04); }
.forge-fodder-row.selected { border-color: rgba(255, 173, 102, 0.55); background: rgba(255, 173, 102, 0.1); }
.forge-fodder-row .item-icon { flex: 0 0 auto; }
.forge-fodder-name { flex: 1; min-width: 0; font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.forge-fodder-meta { flex: 0 0 auto; font-size: 8px; color: var(--dim); white-space: nowrap; }
.forge-fodder-xp { flex: 0 0 auto; font-size: 8px; color: #ffcf7a; font-family: var(--mono); white-space: nowrap; }
.forge-fodder-check { flex: 0 0 auto; width: 24px; font-size: 8px; color: #ffad66; text-align: right; }
.forge-fodder-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.forge-fodder-actions .btn { min-height: 28px; font-size: 9px; }

/* ---------------- orb gacha ---------------- */

.gacha-modal { width: min(960px, 95vw); }
.gacha-body { max-height: min(70vh, 720px); overflow: auto; padding: 18px 24px 22px; }
.gacha-wallet {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(199, 155, 255, 0.18);
  border-radius: 9px;
  background: rgba(199, 155, 255, 0.045);
  font-size: 10px;
  color: var(--muted);
}
.gacha-wallet b { color: var(--violet); font-family: var(--mono); font-weight: 500; }
.gacha-wallet-tip { margin-left: auto; color: var(--dim); }
.gacha-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 224px;
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid rgba(199, 155, 255, 0.14);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 48%, rgba(199, 155, 255, 0.14), transparent 38%),
    radial-gradient(circle at 50% 48%, rgba(143, 216, 255, 0.05), transparent 62%),
    rgba(5, 11, 13, 0.62);
}
.gacha-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(199,155,255,0.045) 0deg 2deg, transparent 2deg 14deg);
  opacity: 0.6;
}
.gacha-core {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 94px;
  height: 94px;
  border: 1px solid rgba(207, 180, 255, 0.58);
  border-radius: 50%;
  color: #e8d8ff;
  background: radial-gradient(circle at 38% 32%, rgba(255,255,255,0.25), rgba(199,155,255,0.15) 34%, rgba(10,18,20,0.96) 72%);
  box-shadow: 0 0 42px rgba(199, 155, 255, 0.26), inset 0 0 22px rgba(199, 155, 255, 0.18);
}
.gacha-stage.spinning .gacha-core { animation: gachaCoreSpin 0.9s cubic-bezier(.2,.7,.25,1) infinite; }
.gacha-orbit {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  width: 180px;
  height: 180px;
  margin: -90px 0 0 -90px;
  border: 1px solid rgba(143, 216, 255, 0.18);
  border-radius: 50%;
  border-right-color: rgba(255, 241, 168, 0.75);
  transform: rotate(25deg) skewX(-8deg);
}
.gacha-orbit.orbit-b {
  width: 244px;
  height: 118px;
  margin: -59px 0 0 -122px;
  border-color: rgba(199, 155, 255, 0.12);
  border-top-color: rgba(199, 155, 255, 0.8);
  transform: rotate(-18deg);
}
.gacha-stage.spinning .orbit-a { animation: gachaOrbitA 1.1s linear infinite; }
.gacha-stage.spinning .orbit-b { animation: gachaOrbitB 1.35s linear infinite; }
.gacha-stage.revealed { height: 62px; background: rgba(199, 155, 255, 0.035); }
.gacha-stage-text {
  position: relative;
  z-index: 2;
  margin-top: 12px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
}
.gacha-stage.revealed .gacha-stage-text { margin-top: 0; color: var(--violet); }
.gacha-results {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.gacha-results.single { grid-template-columns: minmax(0, 220px); justify-content: center; }
.gacha-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--gacha-color) 45%, transparent);
  border-radius: 10px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--gacha-color) 12%, transparent), rgba(6, 12, 14, 0.8));
  box-shadow: 0 0 24px color-mix(in srgb, var(--gacha-color) 12%, transparent);
  animation: gachaCardIn 0.42s cubic-bezier(.16,1,.3,1) both;
}
.gacha-card-top { display: flex; justify-content: space-between; gap: 6px; font-family: var(--mono); font-size: 8px; color: var(--gacha-color); letter-spacing: 0.08em; }
.gacha-card-top b { color: var(--dim); font-weight: 400; }
.gacha-card-orb { display: flex; justify-content: center; margin: 8px 0 5px; color: var(--gacha-color); filter: drop-shadow(0 0 8px var(--gacha-color)); }
.gacha-card-name { text-align: center; font-size: 11px; font-weight: 600; color: var(--gacha-color); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gacha-card-desc { margin-top: 4px; min-height: 32px; font-size: 8px; line-height: 1.45; color: var(--muted); }
.gacha-note { margin-top: 10px; font-size: 9px; color: var(--dim); line-height: 1.5; }
.gacha-foot { align-items: center; }
.gacha-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@keyframes gachaCoreSpin {
  0% { transform: rotate(0deg) scale(0.94); filter: brightness(0.9); }
  50% { transform: rotate(180deg) scale(1.08); filter: brightness(1.5); }
  100% { transform: rotate(360deg) scale(0.94); filter: brightness(0.9); }
}
@keyframes gachaOrbitA { from { transform: rotate(25deg) skewX(-8deg); } to { transform: rotate(385deg) skewX(-8deg); } }
@keyframes gachaOrbitB { from { transform: rotate(-18deg); } to { transform: rotate(-378deg); } }
@keyframes gachaCardIn {
  from { opacity: 0; transform: translateY(14px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 760px) {
  .gacha-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gacha-results.single { grid-template-columns: minmax(0, 200px); }
  .forge-wallet-tip, .gacha-wallet-tip { margin-left: 0; width: 100%; }
  .gacha-actions { width: 100%; justify-content: stretch; }
  .gacha-actions .btn { flex: 1; }
}

/* ---------------- shop ---------------- */

.shop-modal { width: min(1000px, 95vw); }
.recycler-queue {
  margin-bottom: 16px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.018);
}
.recycler-queue-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  font-size: 10px;
  color: var(--muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.recycler-queue-row:last-child { border-bottom: 0; }
.recycler-queue-row span {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recycler-queue-row b { font-family: var(--mono); font-weight: 400; color: var(--accent); white-space: nowrap; }
.recycler-queue-row .btn { flex: 0 0 auto; min-height: 24px; padding: 2px 8px; font-size: 9px; }
.shop-top { display: flex; align-items: center; gap: 16px; }
.shop-wallet { margin-left: auto; display: flex; align-items: center; gap: 7px; color: var(--gold); font-family: var(--mono); font-size: 14px; padding: 5px 12px; border: 1px solid rgba(255, 207, 122, 0.2); border-radius: 99px; background: rgba(255, 207, 122, 0.05); }
.shop-tabs { display: flex; gap: 4px; padding: 12px 28px 0; border-bottom: 1px solid var(--line); }
.shop-tab { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 8px 14px 11px; font-size: 12px; cursor: pointer; letter-spacing: 0.08em; }
.shop-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.shop-body { padding: 20px 28px 24px; overflow: auto; }
.shop-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.shop-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 11px 12px;
  transition: 0.16s;
}
.shop-item:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.035); }
.shop-mood-banner { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; padding: 9px 12px; border: 1px solid color-mix(in srgb, var(--mood-color) 28%, transparent); border-radius: 8px; background: color-mix(in srgb, var(--mood-color) 6%, transparent); }
.shop-mood-banner b { color: var(--mood-color); font-size: 11px; letter-spacing: 0.08em; white-space: nowrap; }
.shop-mood-banner span { color: var(--muted); font-size: 10px; line-height: 1.5; }
.shop-mood-banner .shop-special-day { margin-left: auto; max-width: 52%; border-left: 1px solid rgba(255, 255, 255, 0.1); padding-left: 10px; }
.shop-reroll-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; color: var(--dim); font-size: 9px; }
.shop-item.deal { border-color: color-mix(in srgb, var(--gold) 35%, transparent); background: color-mix(in srgb, var(--gold) 4%, transparent); }
.deal-badge { display: inline-block; margin-left: 4px; padding: 1px 4px; border-radius: 3px; background: rgba(255,207,122,0.14); color: var(--gold); font-size: 8px; letter-spacing: 0.04em; vertical-align: middle; }
.shop-offer { border-style: dashed; }
.shop-item .item-icon { width: 42px; height: 42px; }
.shop-item-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-item-sub { font-size: 10px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-buy { text-align: right; }
.shop-price { color: var(--gold); font-family: var(--mono); font-size: 12px; margin-bottom: 5px; white-space: nowrap; }
.shop-price.poor { color: var(--danger); }
.shop-empty { color: var(--muted); font-size: 12px; padding: 30px 6px; text-align: center; }
.warehouse-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; color: var(--muted); font-size: 11px; }
.socket-target { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,0.02); }
.socket-target > div { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.socket-target b { font-size: 13px; font-weight: 500; }
.socket-target span { color: var(--muted); font-size: 10px; line-height: 1.6; }
.shop-section-label { font-size: 10px; color: var(--dim); letter-spacing: 0.16em; margin: 0 0 10px; }
.shop-filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.filter-chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  border-radius: 99px;
  padding: 4px 11px;
  font-size: 10px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: 0.16s;
}
.filter-chip:hover { color: var(--text); border-color: var(--line-strong); }
.filter-chip.active { color: var(--accent); border-color: rgba(143, 227, 192, 0.4); background: rgba(143, 227, 192, 0.07); }
.rarity-sell-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 8px 0 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.rarity-sell {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid color-mix(in srgb, var(--rarity-color) 35%, transparent);
  background: color-mix(in srgb, var(--rarity-color) 6%, transparent);
  color: var(--rarity-color);
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 10px;
  cursor: pointer;
  transition: 0.16s;
}
.rarity-sell:hover { background: color-mix(in srgb, var(--rarity-color) 14%, transparent); }
.rarity-sell.empty { opacity: 0.22; cursor: default; }
.rarity-sell i { width: 4px; height: 12px; border-radius: 2px; background: var(--rarity-color); }
.rarity-sell b { font-family: var(--mono); font-weight: 400; opacity: 0.65; margin-left: 2px; }

/* ---------------- pause ---------------- */

/* ---------------- enhancement ---------------- */

.enhance-modal { width: min(1180px, 95vw); }
.enhance-body {
  display: grid;
  grid-template-columns: 440px minmax(0, 1fr);
  gap: 24px;
  padding: 22px 28px;
  overflow: auto;
}
.orb-pane, .gear-pane { display: flex; flex-direction: column; min-height: 0; }
.orb-pane h3, .gear-pane h3 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--text-soft);
}
.orb-pane h3 span, .gear-pane h3 span { color: var(--dim); font-family: var(--mono); margin-left: 6px; }
.orb-list, .enhance-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow: auto;
  max-height: 48vh;
  padding-right: 4px;
}
.orb-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 10px 12px;
  cursor: pointer;
  transition: 0.16s;
  width: 100%;
}
.orb-card:hover { border-color: var(--line-strong); background: rgba(255,255,255,0.04); }
.orb-card.selected { border-color: rgba(143,227,192,0.55); box-shadow: inset 0 0 0 1px rgba(143,227,192,0.25); background: rgba(143,227,192,0.06); }
.orb-gem {
  width: 22px;
  height: 22px;
  margin: 3px 4px 0 5px;
  flex: 0 0 auto;
  transform: rotate(45deg);
  background: var(--orb-color, var(--accent));
  border: 2px solid rgba(255,255,255,0.5);
  box-shadow: 0 0 18px var(--orb-color, var(--accent));
  border-radius: 3px;
}
.orb-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.orb-name { font-size: 12px; }
.orb-name b { font-family: var(--mono); font-weight: 400; opacity: 0.7; margin-left: 4px; }
.orb-desc { font-size: 10px; line-height: 1.55; color: var(--muted); }
.orb-target { font-size: 9px; color: var(--dim); letter-spacing: 0.08em; }
.enhance-note { margin: 10px 0 0; font-size: 10px; line-height: 1.7; color: var(--dim); }
.enhance-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  padding: 9px 12px;
  cursor: pointer;
  transition: 0.16s;
  width: 100%;
}
.enhance-item:hover { border-color: var(--line-strong); background: rgba(255,255,255,0.04); }
.enhance-item.disabled { opacity: 0.35; cursor: not-allowed; }
.enhance-item-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.enhance-item-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.enhance-item-sub { font-size: 9px; color: var(--muted); }
.enhance-item-ups { font-size: 9px; color: var(--accent-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upgrade-slots { display: flex; align-items: center; gap: 3px; flex: 0 0 auto; }
.upgrade-slots i { display: block; width: 6px; height: 16px; border-radius: 2px; background: rgba(255,255,255,0.08); }
.upgrade-slots i.on { background: var(--accent); box-shadow: 0 0 6px rgba(143,227,192,0.5); }
.upgrade-slots em { font-style: normal; font-family: var(--mono); font-size: 9px; color: var(--muted); margin-left: 4px; }
.enhance-selected { font-size: 10px; color: var(--muted); line-height: 1.6; }
.enhance-selected b { font-weight: 500; }
.enhance-item-wrap { display: flex; flex-direction: column; gap: 4px; }
.enhance-detach-row { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 4px 2px; }
.orb-detach {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255,255,255,0.018);
  color: var(--muted);
  padding: 3px 7px;
  font-size: 9px;
  cursor: pointer;
  transition: 0.15s;
}
.orb-detach:hover { border-color: var(--line-strong); color: var(--text-soft); background: rgba(255,255,255,0.04); }
.orb-detach b { font-weight: 500; }
.socket-installed { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 5px; }
.socket-installed-label { width: 100%; font-size: 9px; color: var(--dim); letter-spacing: 0.08em; margin-bottom: 1px; }

.pause-modal { width: min(460px, 92vw); }
.pause-body { padding: 22px 28px 26px; display: flex; flex-direction: column; gap: 16px; }
.pause-note { color: var(--muted); font-size: 11px; text-align: center; line-height: 1.8; }
.pause-buttons { display: flex; flex-direction: column; gap: 8px; }
.pause-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.pause-row:last-child { border-bottom: 0; }
.pause-row .btn { min-height: 30px; padding: 4px 10px; font-size: 11px; }
.speed-pill { display: inline-flex; gap: 4px; }
.speed-pill button { min-width: 36px; }
.speed-pill button.active { border-color: var(--accent); color: var(--accent); }

/* ---------------- end screen ---------------- */

.end-screen {
  position: absolute;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 32px;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(143, 227, 192, 0.09), transparent 55%),
    linear-gradient(180deg, rgba(5, 10, 11, 0.88), rgba(5, 10, 11, 0.97));
  backdrop-filter: blur(8px);
  animation: screenIn 0.5s ease both;
  text-align: center;
}
.end-screen.defeat { background: radial-gradient(ellipse at 50% 40%, rgba(255, 143, 122, 0.08), transparent 55%), linear-gradient(180deg, rgba(5, 10, 11, 0.9), rgba(5, 10, 11, 0.98)); }
.end-kicker { font-size: 10px; letter-spacing: 0.5em; color: var(--accent-2); text-transform: uppercase; }
.end-screen.defeat .end-kicker { color: var(--danger); }
.end-screen h1 { margin: 0; font-size: clamp(34px, 5.4vh, 58px); font-weight: 600; letter-spacing: 0.16em; padding-left: 0.16em; }
.end-reason { color: var(--muted); font-size: 12px; letter-spacing: 0.08em; margin-top: -6px; }
.end-stats { display: flex; gap: clamp(14px, 3vw, 40px); flex-wrap: wrap; justify-content: center; margin: 6px 0 2px; }
.end-stat { min-width: 92px; }
.end-stat b { display: block; font-family: var(--mono); font-size: 22px; font-weight: 400; color: var(--text); line-height: 1.2; }
.end-stat span { display: block; margin-top: 4px; font-size: 9px; letter-spacing: 0.16em; color: var(--dim); }
.end-loot { width: min(620px, 90vw); border: 1px solid var(--line); border-radius: var(--r-md); background: rgba(255, 255, 255, 0.02); padding: 14px 18px; font-size: 11px; color: var(--muted); line-height: 1.8; }
.end-loot b { color: var(--text-soft); }
.end-loot-icons { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.end-loot-icon {
  width: 44px;
  height: 44px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  display: grid;
  place-items: center;
  padding: 4px;
}
.end-loot-icon .item-icon { width: 100% !important; height: 100% !important; }
.end-loot .warn { color: var(--danger); }
.end-loot .good { color: var(--accent); }
.end-actions { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; justify-content: center; }
.end-actions .btn { min-width: 150px; min-height: 44px; }
.end-hint { color: var(--dim); font-size: 10px; letter-spacing: 0.12em; margin-top: 2px; }

/* ---------------- scrollbars ---------------- */

* { scrollbar-width: thin; scrollbar-color: rgba(143, 227, 192, 0.18) transparent; }
*::-webkit-scrollbar { width: 7px; height: 7px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(143, 227, 192, 0.15); border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(143, 227, 192, 0.28); }

/* ---------------- animations ---------------- */

@keyframes bootBar { 0%, 100% { transform: scaleY(0.55); opacity: .5; } 50% { transform: scaleY(1); opacity: 1; } }
@keyframes screenIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes hudIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes buildIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toastIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(14px); } }
@keyframes bannerShow {
  0% { opacity: 0; transform: translate(-50%, 12px); letter-spacing: 0.32em; }
  14% { opacity: 1; transform: translate(-50%, 0); }
  76% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -12px); }
}
@keyframes damageFlash { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes pulseGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(143, 227, 192, 0.2); } 50% { box-shadow: 0 0 0 6px rgba(143, 227, 192, 0); } }

/* ---------------- responsive ---------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}

@media (max-width: 1180px) {
  .map-card { flex-basis: 300px; }
  .inv-body { grid-template-columns: 420px minmax(0, 1fr); gap: 20px; padding: 20px; }
  .paperdoll { grid-template-rows: repeat(3, 108px); }
  .bag-grid { grid-template-columns: repeat(6, 64px); grid-auto-rows: 64px; gap: 6px; }
  .item-slot .item-icon { width: 42px; height: 42px; }
  .build-list { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}

@media (max-width: 900px) {
  .screen { padding: 16px; }
  .enhance-body { grid-template-columns: 1fr; }
  .hero h1 { font-size: 42px; }
  .hero .tagline { display: none; }
  .map-row { flex-wrap: wrap; overflow: auto; justify-content: flex-start; }
  .map-card { flex: 0 0 calc(50% - 8px); height: 340px; max-height: none; }
  .menu-foot { flex-direction: column; align-items: stretch; }
  .menu-actions { justify-content: stretch; }
  .menu-actions .btn { flex: 1; }
  .inv-body { grid-template-columns: 1fr; }
  .paperdoll { grid-template-rows: repeat(3, 102px); }
  .bag-grid { grid-template-columns: repeat(6, 1fr); }
  .resources { top: 14px; left: 14px; }
  .vitals { top: 112px; left: 14px; width: 180px; }
  .hud-right { top: 14px; right: 14px; }
  .hud-actions { right: 14px; bottom: 14px; }
  .weapon-chips { right: 14px; bottom: 78px; }
  .controls-hint { display: none; }
  .hud-top { top: 12px; }
  .shop-grid { grid-template-columns: 1fr; }
  .toasts { right: 14px; }
  .build-panel { width: 96vw; bottom: 8px; padding: 10px; }
  .build-head { align-items: flex-start; }
  .build-head > div { flex-direction: column; gap: 2px; }
  .build-controls { width: 100%; margin-left: 0; }
  .build-search { flex: 1; min-width: 130px; width: auto; }
  .build-list { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); max-height: 48vh; }
}

@media (max-width: 560px) {
  .map-card { flex-basis: 100%; }
  .brand p, .journey { display: none; }
  .day-label { font-size: 16px; }
  .phase-track { width: 160px; }
  .resources .res-chip { min-width: 0; padding: 0 7px; font-size: 10px; }
  .resources .res-chip:nth-child(4) { display: none; }
  .vitals { top: 102px; width: 156px; }
  .weapon-chips { display: none; }
  .hud-actions .btn-label { display: none; }
  .item-tooltip { width: 280px; }
  .inv-body { padding: 14px; }
  .paperdoll { grid-template-rows: repeat(3, 88px); gap: 6px; }
  .item-slot .item-icon { width: 32px; height: 32px; }
  .item-slot .slot-name { display: none; }
  .bag-grid { grid-template-columns: repeat(5, 52px); grid-auto-rows: 52px; }
  .build-list { grid-template-columns: 1fr; max-height: 44vh; }
  .build-toolbar { padding: 7px; }
  .build-filter { padding: 3px 8px; }
  .build-foot { display: none; }
  .build-panel { bottom: 4px; padding: 8px; }
}
