/* ── Variables ──────────────────────────────────────────────────────────── */
:root {
  --bg:        #010d1a;
  --bg-panel:  rgba(0, 8, 22, 0.92);
  --bg-card:   rgba(0, 14, 30, 0.88);
  --pink:      #EE005A;
  --cyan:      #00B4DC;
  --text:      #dff0f8;
  --text-dim:  #6a90a8;
  --hp:        #00dd66;
  --hp-low:    #ff4400;
  --mana:      #3388ff;
  --gold:      #ffd700;
  --border:    rgba(0,180,220,.2);
  --glow-c:    0 0 12px rgba(0,180,220,.4);
  --glow-p:    0 0 12px rgba(238,0,90,.4);
  --r-common:  #aaaaaa;
  --r-rare:    #4499ff;
  --r-epic:    #bb44ff;

  --s-hemomancy:    #e03333;
  --s-necromancy:   #bb33ff;
  --s-shadowmancy:  #778899;
  --s-swordsmanship:#ffd700;
  --s-lumomancy:    #eeeebb;
  --s-gravimancy:   #6644ee;
  --s-earthmancy:   #55aa44;
}

/* ── Reset & Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; overflow: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
}

#app { height: 100%; }

/* ── Common: btn ────────────────────────────────────────────────────────── */
.btn {
  background: transparent;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  border-radius: 6px;
  padding: 7px 16px;
  font-size: .85rem;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .1s;
  white-space: nowrap;
  font-family: inherit;
}
.btn:hover  { background: rgba(0,180,220,.14); box-shadow: var(--glow-c); }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .38; cursor: not-allowed; pointer-events: none; }
.btn-pink  { border-color: var(--pink); color: var(--pink); }
.btn-pink:hover { background: rgba(238,0,90,.14); box-shadow: var(--glow-p); }
.btn-gold  { border-color: var(--gold); color: var(--gold); }
.btn-gold:hover { background: rgba(255,215,0,.1); }
.btn-big   { padding: 11px 32px; font-size: 1rem; letter-spacing: .05em; }

/* ── Common: bars ───────────────────────────────────────────────────────── */
.bar-wrap  { position: relative; height: 13px; background: rgba(255,255,255,.07); border-radius: 7px; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 7px; transition: width .35s ease; }
.bar-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .65rem; font-weight: 600; text-shadow: 0 1px 3px #000; }
.bar-hp   .bar-fill { background: linear-gradient(90deg, #005520, var(--hp)); }
.bar-hp.low .bar-fill { background: linear-gradient(90deg, #771100, var(--hp-low)); }
.bar-mana .bar-fill { background: linear-gradient(90deg, #001055, var(--mana)); }

/* ── Common: effect badges ──────────────────────────────────────────────── */
.effects { display: flex; flex-wrap: wrap; gap: 3px; }
.eff-badge { font-size: .63rem; padding: 1px 6px; border-radius: 10px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); }
.eff-Poison        { border-color: #44cc44; color: #44cc44; }
.eff-Burn          { border-color: #ff6600; color: #ff6600; }
.eff-Bleed         { border-color: #cc2222; color: #cc2222; }
.eff-Stun          { border-color: #ffdd00; color: #ffdd00; }
.eff-Weakness      { border-color: #cc66cc; color: #cc66cc; }
.eff-Strength      { border-color: #66aaff; color: #66aaff; }
.eff-Resistance    { border-color: #44aaff; color: #44aaff; }
.eff-Vulnerability { border-color: #ff4444; color: #ff4444; }

/* ── Common: rarity ────────────────────────────────────────────────────── */
.rarity-Common  { color: var(--r-common); }
.rarity-Rare    { color: var(--r-rare); }
.rarity-Epic    { color: var(--r-epic); }
.rarity-border-Common { border-color: var(--r-common) !important; }
.rarity-border-Rare   { border-color: var(--r-rare)   !important; }
.rarity-border-Epic   { border-color: var(--r-epic)   !important; box-shadow: 0 0 6px rgba(187,68,255,.25); }

/* ── Common: school text colors ─────────────────────────────────────────── */
.school-Hemomancy    { color: var(--s-hemomancy); }
.school-Necromancy   { color: var(--s-necromancy); }
.school-Shadowmancy  { color: var(--s-shadowmancy); }
.school-Swordsmanship{ color: var(--s-swordsmanship); }
.school-Lumomancy    { color: var(--s-lumomancy); }
.school-Gravimancy   { color: var(--s-gravimancy); }
.school-Earthmancy   { color: var(--s-earthmancy); }

/* ── Utility: panel / card ──────────────────────────────────────────────── */
.panel {
  background: rgba(0, 8, 22, 0.88);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.card {
  background: rgba(0, 14, 30, 0.88);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  transition: border-color .2s, box-shadow .2s;
}
.card:hover { border-color: var(--cyan); box-shadow: var(--glow-c); }

/* ── Toast ──────────────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--bg-panel); border: 1px solid var(--cyan); border-radius: 8px;
  padding: 9px 16px; font-size: .82rem;
  box-shadow: var(--glow-c); opacity: 0; transform: translateY(8px);
  transition: opacity .2s, transform .2s; pointer-events: none; z-index: 200; max-width: 300px;
}
#toast.show  { opacity: 1; transform: translateY(0); }
#toast.error { border-color: var(--pink); box-shadow: var(--glow-p); }

/* ── Screen transition ──────────────────────────────────────────────────── */
@keyframes screenFadeIn {
  from { opacity: 0; transform: scale(.99) translateY(4px); }
  to   { opacity: 1; transform: scale(1)   translateY(0);   }
}
#app.screen-enter { animation: screenFadeIn .25s ease forwards; }

/* ═══════════════════════════════════════════════════════════════════════════
   MENU
═══════════════════════════════════════════════════════════════════════════ */
.menu-screen {
  height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 36px; padding: 40px 20px;
  background: url('/assets/background.png') center/cover no-repeat;
}
.menu-screen::before {
  content: ''; position: fixed; inset: 0;
  background: rgba(0,5,15,.55); pointer-events: none;
}
.menu-title { text-align: center; line-height: 1; position: relative; z-index: 1; }
.menu-title .dusk    { font-size: 4.2rem; color: var(--pink); letter-spacing: .08em; font-weight: 700; text-shadow: var(--glow-p); }
.menu-title .and     { font-size: 1.2rem; color: var(--text-dim); margin: 4px 0; letter-spacing: .3em; }
.menu-title .dawn    { font-size: 4.2rem; color: var(--cyan);  letter-spacing: .08em; font-weight: 700; text-shadow: var(--glow-c); }
.menu-title .tagline { font-size: .8rem; color: var(--text-dim); letter-spacing: .2em; margin-top: 10px; }

.menu-box { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 12px; position: relative; z-index: 1; }
.pseudo-input {
  background: rgba(0,180,220,.07); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 1rem; padding: 11px 14px;
  outline: none; transition: border-color .2s; width: 100%;
}
.pseudo-input:focus { border-color: var(--cyan); box-shadow: var(--glow-c); }
.pseudo-input::placeholder { color: var(--text-dim); }
.menu-error { color: var(--pink); font-size: .83rem; text-align: center; min-height: 1.2em; }

.scores-panel { width: 100%; max-width: 400px; background: rgba(0,8,22,.82); border: 1px solid var(--border); border-radius: 10px; padding: 14px; position: relative; z-index: 1; }
.scores-panel h3 { color: var(--cyan); margin-bottom: 10px; font-size: .85rem; letter-spacing: .1em; }
.score-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,.04); font-size: .84rem; }
.score-row:last-child { border-bottom: none; }
.score-rank  { color: var(--text-dim); width: 26px; }
.score-pseudo{ flex: 1; }
.score-value { color: var(--gold); font-weight: 600; }
.score-empty { color: var(--text-dim); font-style: italic; text-align: center; padding: 10px; font-size: .82rem; }

.keybindings-panel { width: 100%; max-width: 400px; background: rgba(0,8,22,.82); border: 1px solid var(--border); border-radius: 10px; padding: 14px; position: relative; z-index: 1; }
.keybindings-panel h3 { color: var(--cyan); margin-bottom: 10px; font-size: .85rem; letter-spacing: .1em; }
.binding-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.binding-row:last-of-type { border-bottom: none; }
.binding-label { font-size: .84rem; }
.bind-btn { min-width: 48px; font-size: .82rem; font-weight: 700; padding: 5px 12px; text-align: center; }
.bind-btn.awaiting { border-style: dashed; animation: bindPulse .7s ease infinite alternate; }
@keyframes bindPulse { from { opacity: .5; } to { opacity: 1; } }
.binding-hint { margin-top: 6px; font-size: .7rem; color: var(--text-dim); text-align: center; }

/* ═══════════════════════════════════════════════════════════════════════════
   SHARED GAME WRAPPER  (combat + shop + qte)
═══════════════════════════════════════════════════════════════════════════ */
.game-wrapper {
  display: flex;
  height: 100%;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR  (left column, shared)
═══════════════════════════════════════════════════════════════════════════ */
.sidebar {
  width: 188px;
  flex-shrink: 0;
  background: rgba(0, 5, 18, 0.96);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  gap: 10px;
  overflow-y: auto;
  z-index: 2;
}

.sidebar-logo { font-size: .78rem; font-weight: 700; letter-spacing: .12em; }
.sidebar-logo .s-dusk { color: var(--pink); }
.sidebar-logo .s-dawn { color: var(--cyan); }

.sidebar-info { font-size: .78rem; color: var(--text-dim); }
.sidebar-info strong { color: var(--text); }

.sidebar-gold { font-size: .88rem; color: var(--gold); }

.sidebar-hr { height: 1px; background: var(--border); }

/* stat rows with diamond icon */
.stat-row { display: flex; align-items: center; gap: 7px; margin: 1px 0; }
.stat-diamond {
  width: 13px; height: 13px; flex-shrink: 0;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}
.sd-hp   { background: var(--hp); }
.sd-mana { background: var(--mana); }
.sd-def  { background: var(--gold); }
.stat-bar { flex: 1; }
.stat-val { font-size: .76rem; color: var(--text-dim); white-space: nowrap; }

/* schools list: pentagon + name + level */
.sidebar-section-title {
  font-size: .64rem; color: var(--text-dim); letter-spacing: .14em;
  text-transform: uppercase; margin-bottom: 2px;
}

.schools-list { display: flex; flex-direction: column; gap: 4px; }

.school-row {
  display: flex; align-items: center; gap: 7px;
  font-size: .74rem; padding: 2px 0;
}

.school-pentagon {
  width: 20px; height: 20px; flex-shrink: 0;
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
}
.sp-Hemomancy    { background: var(--s-hemomancy); }
.sp-Necromancy   { background: var(--s-necromancy); }
.sp-Shadowmancy  { background: var(--s-shadowmancy); }
.sp-Swordsmanship{ background: var(--s-swordsmanship); }
.sp-Lumomancy    { background: var(--s-lumomancy); }
.sp-Gravimancy   { background: var(--s-gravimancy); }
.sp-Earthmancy   { background: var(--s-earthmancy); }

.school-name  { flex: 1; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.school-level { font-weight: 700; font-size: .78rem; color: var(--text); }

/* effects in sidebar */
.sidebar-effects { display: flex; flex-wrap: wrap; gap: 3px; }

/* ═══════════════════════════════════════════════════════════════════════════
   COMBAT SCREEN
═══════════════════════════════════════════════════════════════════════════ */
.combat-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Items bar (top of center) ── */
.items-bar {
  flex-shrink: 0;
  background: rgba(0, 6, 18, 0.92);
  border-bottom: 1px solid var(--border);
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.items-bar-label {
  font-size: .64rem; color: var(--text-dim);
  letter-spacing: .1em; text-transform: uppercase; white-space: nowrap;
  margin-right: 4px;
}
.item-chip {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 9px;
  font-size: .7rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 130px;
}
.item-chip.empty { border-style: dashed; opacity: .3; color: var(--text-dim); }

/* ── Battle arena ── */
.battle-arena {
  flex: 1;
  position: relative;
  background: url('/assets/battle.png') center bottom / cover no-repeat;
  overflow: hidden;
  min-height: 0;
}

.arena-darken {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.25) 0%, transparent 40%, rgba(0,0,0,.3) 100%);
  pointer-events: none;
}

/* action log overlay (top of arena) */
.log-overlay {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 8px 14px;
  background: linear-gradient(to bottom, rgba(0,0,0,.72) 60%, transparent);
  display: flex; flex-direction: column; gap: 2px;
  pointer-events: none; z-index: 5;
}
.log-line {
  font-size: .73rem; color: var(--text);
  text-shadow: 0 1px 4px #000;
  opacity: .9;
}
.log-line:first-child { opacity: 1; font-weight: 600; }

/* hero sprite */
.hero-sprite {
  position: absolute;
  bottom: 0; left: 8%;
  height: 68%;
  object-fit: contain;
  filter: drop-shadow(0 4px 24px rgba(0,0,0,.8)) drop-shadow(0 0 18px rgba(0,180,220,.18));
  pointer-events: none;
  z-index: 3;
}

/* enemies area: bottom-right of arena */
.enemies-area {
  position: absolute;
  bottom: 0; right: 0;
  width: 62%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 16px;
  padding: 0 18px 10px;
  z-index: 4;
}

.enemy-slot {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  cursor: pointer;
  transition: transform .15s;
  min-width: 80px; max-width: 110px;
}
.enemy-slot:hover { transform: translateY(-5px); }

.enemy-hp-card {
  background: rgba(0, 5, 18, 0.88);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 9px;
  width: 100%;
  transition: border-color .18s, box-shadow .18s;
}
.enemy-slot.targeted .enemy-hp-card {
  border-color: var(--pink);
  box-shadow: var(--glow-p);
}

.enemy-hp-name {
  font-size: .74rem; font-weight: 600; margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; justify-content: space-between; align-items: center;
}
.enemy-type-tag { font-size: .6rem; opacity: .7; }
.mutation-tag { font-size: .58rem; color: var(--pink); }

.enemy-figure {
  width: 60px; height: 72px;
  background: rgba(255,255,255,.03);
  border: 1px dashed rgba(255,255,255,.08);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
}

/* ── Attack section (bottom) ── */
.attack-section {
  flex-shrink: 0;
  height: 152px;
  background: rgba(0, 5, 18, 0.95);
  border-top: 1px solid var(--border);
  display: flex;
}

/* school picker: left strip with colored circles */
.school-picker {
  width: 72px; flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 5px; padding: 8px 0;
}

.school-circle {
  width: 26px; height: 26px;
  border-radius: 50%; border: 2px solid;
  cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; background: transparent;
  transition: transform .12s, box-shadow .12s, background .12s;
}
.school-circle:hover { transform: scale(1.2); }
.school-circle.active {
  box-shadow: 0 0 10px currentColor, 0 0 4px currentColor;
  transform: scale(1.12);
}

.sc-Hemomancy    { border-color: var(--s-hemomancy);    color: var(--s-hemomancy); }
.sc-Hemomancy.active    { background: rgba(224,51,51,.25); }
.sc-Necromancy   { border-color: var(--s-necromancy);   color: var(--s-necromancy); }
.sc-Necromancy.active   { background: rgba(187,51,255,.25); }
.sc-Shadowmancy  { border-color: var(--s-shadowmancy);  color: var(--s-shadowmancy); }
.sc-Shadowmancy.active  { background: rgba(119,136,153,.25); }
.sc-Swordsmanship{ border-color: var(--s-swordsmanship);color: var(--s-swordsmanship); }
.sc-Swordsmanship.active{ background: rgba(255,215,0,.18); }
.sc-Lumomancy    { border-color: var(--s-lumomancy);    color: var(--s-lumomancy); }
.sc-Lumomancy.active    { background: rgba(238,238,187,.15); }
.sc-Gravimancy   { border-color: var(--s-gravimancy);   color: var(--s-gravimancy); }
.sc-Gravimancy.active   { background: rgba(102,68,238,.25); }
.sc-Earthmancy   { border-color: var(--s-earthmancy);   color: var(--s-earthmancy); }
.sc-Earthmancy.active   { background: rgba(85,170,68,.25); }

/* attack panel: right of picker */
.attack-panel {
  flex: 1;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
}

.attack-panel-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 2px;
}
.attack-school-name { font-size: .78rem; font-weight: 700; }
.attack-hint { font-size: .64rem; color: var(--text-dim); margin-left: auto; }

.atk-btn {
  font-size: .82rem;
  padding: 9px 14px;
  border-radius: 6px;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  font-family: inherit;
  cursor: pointer;
  transition: background .12s, box-shadow .12s, transform .08s;
}
.atk-btn:active { transform: scale(.98); }
.atk-btn.no-mana { opacity: .32; cursor: not-allowed; pointer-events: none; }

.atk-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atk-tags { display: flex; align-items: center; gap: 5px; flex-shrink: 0; font-size: .68rem; opacity: .8; }
.atk-mana { color: var(--mana); }
.atk-aoe  { color: var(--cyan); }

/* per-school atk-btn colors */
.atk-Hemomancy    { border-color: var(--s-hemomancy);    color: var(--s-hemomancy); }
.atk-Hemomancy:hover    { background: rgba(224,51,51,.14); box-shadow: 0 0 8px rgba(224,51,51,.25); }
.atk-Necromancy   { border-color: var(--s-necromancy);   color: var(--s-necromancy); }
.atk-Necromancy:hover   { background: rgba(187,51,255,.14); box-shadow: 0 0 8px rgba(187,51,255,.25); }
.atk-Shadowmancy  { border-color: var(--s-shadowmancy);  color: var(--s-shadowmancy); }
.atk-Shadowmancy:hover  { background: rgba(119,136,153,.14); }
.atk-Swordsmanship{ border-color: var(--s-swordsmanship);color: var(--s-swordsmanship); }
.atk-Swordsmanship:hover{ background: rgba(255,215,0,.1); }
.atk-Lumomancy    { border-color: var(--s-lumomancy);    color: var(--s-lumomancy); }
.atk-Lumomancy:hover    { background: rgba(238,238,187,.1); }
.atk-Gravimancy   { border-color: var(--s-gravimancy);   color: var(--s-gravimancy); }
.atk-Gravimancy:hover   { background: rgba(102,68,238,.14); box-shadow: 0 0 8px rgba(102,68,238,.25); }
.atk-Earthmancy   { border-color: var(--s-earthmancy);   color: var(--s-earthmancy); }
.atk-Earthmancy:hover   { background: rgba(85,170,68,.14); }

/* ── Combat end banner ── */
.combat-end-overlay {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,5,18,.7);
  padding: 20px;
}
.combat-result-card {
  background: rgba(0,8,22,.96);
  border: 1px solid var(--cyan);
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 560px; width: 100%;
  box-shadow: var(--glow-c);
  text-align: center;
}
.combat-result-card h2 { font-size: 1.6rem; color: var(--cyan); margin-bottom: 18px; }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.result-item { background: rgba(255,255,255,.04); border-radius: 7px; padding: 10px 8px; }
.result-item .val { font-size: 1.2rem; font-weight: 700; color: var(--gold); }
.result-item .lbl { font-size: .7rem; color: var(--text-dim); margin-top: 2px; }
.gold-breakdown { font-size: .78rem; color: var(--text-dim); margin-bottom: 16px; line-height: 1.8; }
.gold-breakdown span { color: var(--gold); }

/* ═══════════════════════════════════════════════════════════════════════════
   QTE SCREEN
═══════════════════════════════════════════════════════════════════════════ */
.qte-center {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 22px; padding: 24px 20px;
  background:
    url('/assets/battle.png') center bottom / cover no-repeat,
    rgba(0,0,0,.55);
  position: relative;
  overflow: hidden;
}
.qte-center::before {
  content: ''; position: absolute; inset: 0;
  background: rgba(0,0,0,.52);
  pointer-events: none;
}
.qte-body {
  position: relative; z-index: 1;
  width: 100%; max-width: 640px;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
}

.qte-attack-info { text-align: center; display: flex; flex-direction: column; gap: 6px; }
.qte-incoming-label { font-size: .68rem; letter-spacing: .18em; color: var(--text-dim); text-transform: uppercase; }
.qte-attack-name { font-size: 1.7rem; font-weight: 700; color: var(--pink); text-shadow: var(--glow-p); letter-spacing: .04em; }
.qte-enemy-label { font-size: .88rem; color: var(--text-dim); }
.qte-enemy-label strong { color: var(--text); }
.qte-type-badge { display: inline-block; font-size: .82rem; font-weight: 700; letter-spacing: .08em; padding: 3px 14px; border-radius: 20px; margin-top: 3px; }
.type-physical { color: var(--s-swordsmanship); background: rgba(255,215,0,.1); border: 1px solid rgba(255,215,0,.35); }
.type-magic    { color: var(--cyan); background: rgba(0,180,220,.1); border: 1px solid rgba(0,180,220,.35); }
.qte-risky { font-size: .76rem; color: #f39c12; background: rgba(243,156,18,.09); border: 1px solid rgba(243,156,18,.3); border-radius: 6px; padding: 3px 12px; }
.qte-stun-block { text-align: center; display: flex; flex-direction: column; gap: 6px; }

.qte-bar-wrap { width: 100%; display: flex; flex-direction: column; gap: 5px; }
.qte-zone-labels { display: flex; justify-content: space-between; font-size: .63rem; font-weight: 600; letter-spacing: .06em; padding: 0 2px; }
.zone-miss    { color: #c0392b; }
.zone-counter { color: var(--cyan); }
.qte-bar {
  position: relative; height: 50px; border-radius: 10px; overflow: visible;
  box-shadow: 0 0 16px rgba(0,0,0,.5), inset 0 0 8px rgba(0,0,0,.3);
  border: 1px solid rgba(255,255,255,.1);
}
.qte-cursor {
  position: absolute; top: -6px; bottom: -6px; width: 8px;
  transform: translateX(-50%);
  background: #fff; border-radius: 4px;
  box-shadow: 0 0 14px rgba(255,255,255,.9), 0 0 4px #fff;
  z-index: 10; pointer-events: none;
}
.qte-buttons { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.qte-btn-type {
  min-width: 180px; padding: 12px 22px; font-size: .95rem; letter-spacing: .06em;
  position: relative; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.qte-key-hint { font-size: .62rem; opacity: .5; position: absolute; bottom: 4px; right: 8px; }
.btn-physical { border-color: var(--s-swordsmanship); color: var(--s-swordsmanship); }
.btn-physical:hover { background: rgba(255,215,0,.12); box-shadow: 0 0 12px rgba(255,215,0,.3); }
.btn-physical:active { transform: scale(.94); }
.btn-magic { border-color: var(--cyan); color: var(--cyan); }
.btn-magic:hover { background: rgba(0,180,220,.12); box-shadow: var(--glow-c); }
.btn-magic:active { transform: scale(.94); }
.qte-counter-num { font-size: .76rem; color: var(--text-dim); letter-spacing: .1em; }

.qte-result {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5rem; font-weight: 800; letter-spacing: .1em;
  padding: 8px 24px; border-radius: 8px;
  pointer-events: none; animation: qteResultPop .8s ease forwards; z-index: 20; white-space: nowrap;
}
.qte-result-perfect { color: #27ae60; text-shadow: 0 0 20px rgba(39,174,96,.8); background: rgba(39,174,96,.15); border: 2px solid rgba(39,174,96,.5); }
.qte-result-good    { color: #f39c12; text-shadow: 0 0 20px rgba(243,156,18,.8); background: rgba(243,156,18,.15); border: 2px solid rgba(243,156,18,.5); }
.qte-result-miss    { color: #c0392b; text-shadow: 0 0 20px rgba(192,57,43,.8);  background: rgba(192,57,43,.15);  border: 2px solid rgba(192,57,43,.5); }
.qte-result-stunned { color: #a0a8b0; background: rgba(160,168,176,.1); border: 2px solid rgba(160,168,176,.3); }
@keyframes qteResultPop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.6); }
  30%  { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  70%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.05); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SHOP SCREEN
═══════════════════════════════════════════════════════════════════════════ */
.shop-center {
  flex: 1;
  display: flex; flex-direction: column;
  overflow: hidden; min-width: 0;
  position: relative;
}
.shop-bg {
  position: absolute; inset: 0;
  background: url('/assets/shop.png') center / cover no-repeat;
  z-index: 0;
}
.shop-bg::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(0, 4, 14, 0.62);
}
.shop-inner {
  position: relative; z-index: 1;
  flex: 1;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* Inventory bar (top) */
.shop-inv-bar {
  flex-shrink: 0;
  background: rgba(0,5,18,.9);
  border-bottom: 1px solid var(--border);
  padding: 7px 14px;
  display: flex; align-items: center; gap: 6px;
}
.shop-inv-label {
  font-size: .64rem; color: var(--text-dim);
  letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; margin-right: 4px;
}
.inv-chip {
  background: rgba(255,255,255,.05); border: 1px solid var(--border);
  border-radius: 5px; padding: 4px 10px;
  font-size: .72rem; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; min-width: 120px;
  transition: border-color .15s;
}
.inv-chip.empty { border-style: dashed; opacity: .3; color: var(--text-dim); justify-content: center; min-width: 80px; }
.inv-chip:hover:not(.empty) { border-color: var(--pink); }

/* Scrollable body */
.shop-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}

/* Main panel: reroll circle + items for sale */
.shop-main-panel {
  background: rgba(0,5,18,.86);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex; gap: 14px; align-items: center;
}

.reroll-btn {
  width: 74px; height: 74px; flex-shrink: 0;
  border-radius: 50%; border: 2px solid var(--cyan);
  background: rgba(0,180,220,.07);
  color: var(--cyan);
  font-family: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  transition: background .15s, box-shadow .15s, transform .1s;
  align-self: center;
}
.reroll-btn:hover  { background: rgba(0,180,220,.18); box-shadow: var(--glow-c); }
.reroll-btn:active { transform: scale(.94); }
.reroll-btn:disabled { opacity: .38; cursor: not-allowed; }
.reroll-icon { font-size: 1.3rem; }
.reroll-label { font-size: .62rem; letter-spacing: .06em; }
.reroll-cost  { font-size: .65rem; color: var(--gold); }

.for-sale-col { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.for-sale-title { font-size: .66rem; color: var(--text-dim); letter-spacing: .12em; text-transform: uppercase; }
.for-sale-grid  { display: flex; flex-wrap: wrap; gap: 7px; }

/* Bottom row: best-seller + chests */
.shop-bottom-row {
  display: flex; gap: 10px;
}

.best-seller-panel {
  width: 210px; flex-shrink: 0;
  background: rgba(0,5,18,.88);
  border: 1px solid var(--gold);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 0 12px rgba(255,215,0,.08);
}

.chests-panel {
  flex: 1;
  background: rgba(0,0,0,.88);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  padding: 12px;
}

.shop-section-title {
  font-size: .66rem; color: var(--text-dim);
  letter-spacing: .12em; text-transform: uppercase; margin-bottom: 8px;
}
.bs-badge {
  display: inline-block;
  background: var(--gold); color: #000;
  font-size: .58rem; font-weight: 700; padding: 1px 7px; border-radius: 8px;
  margin-bottom: 6px;
}

.chests-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Item cards in shop */
.item-card-s {
  background: rgba(255,255,255,.05); border: 1px solid var(--border);
  border-radius: 7px; padding: 9px 11px;
  min-width: 115px; max-width: 155px;
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color .15s, transform .1s, box-shadow .15s;
}
.item-card-s:hover { transform: translateY(-2px); }
.item-card-s .ic-name  { font-size: .8rem; font-weight: 600; }
.item-card-s .ic-price { font-size: .74rem; color: var(--gold); }
.item-card-s .ic-bonus { font-size: .68rem; color: var(--text-dim); line-height: 1.4; }
.item-card-s .ic-btn   { margin-top: 4px; width: 100%; font-size: .74rem; padding: 4px; }

/* Chest cards */
.chest-card-s {
  background: rgba(255,255,255,.04); border: 1px solid var(--border);
  border-radius: 7px; padding: 10px 12px; min-width: 110px;
  text-align: center; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.chest-card-s .cc-title { font-size: .88rem; font-weight: 700; margin-bottom: 3px; }
.chest-card-s .cc-cost  { font-size: .76rem; color: var(--gold); margin-bottom: 7px; }
.chest-items-list { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.chest-pick-btn { font-size: .74rem; padding: 4px 8px; text-align: left; width: 100%; }

/* Shop footer */
.shop-footer {
  flex-shrink: 0;
  background: rgba(0,5,18,.95);
  border-top: 1px solid var(--border);
  padding: 9px 16px;
  display: flex; gap: 10px; align-items: center;
}
.gold-display { margin-right: auto; font-size: .95rem; }
.gold-display span { color: var(--gold); font-weight: 700; font-size: 1.05rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   GAME OVER
═══════════════════════════════════════════════════════════════════════════ */
.gameover-screen {
  height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 26px; padding: 40px 20px; text-align: center;
  background: url('/assets/background.png') center/cover no-repeat;
}
.gameover-screen::before { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.65); pointer-events: none; }
.gameover-title    { font-size: 3.2rem; color: var(--pink); text-shadow: var(--glow-p); letter-spacing: .1em; position: relative; }
.gameover-subtitle { font-size: 1rem; color: var(--text-dim); position: relative; }
.gameover-stats    { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 460px; position: relative; }
.go-stat { background: rgba(0,8,22,.88); border: 1px solid var(--border); border-radius: 8px; padding: 14px 10px; }
.go-stat .val { font-size: 1.6rem; font-weight: 700; color: var(--cyan); }
.go-stat .lbl { font-size: .75rem; color: var(--text-dim); margin-top: 3px; }
.gameover-actions  { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; position: relative; }

/* ── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,180,220,.25); border-radius: 3px; }
