/* ============================================================
   FOOD FIGHT — Design System v2
   Dark palette, Bangers headlines, Nunito body
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:          #0f0a1a;
  --surface:     #1a1230;
  --surface2:    #241a42;
  --border:      rgba(255,255,255,.08);
  --accent:      #ff4757;
  --gold:        #ffd32a;
  --text:        #f0eaff;
  --muted:       #8878aa;
  --hp-high:     #2ed573;
  --hp-mid:      #ffd32a;
  --hp-low:      #ff4757;

  --role-tank:        #2ed573;
  --role-frontline:   #ffa502;
  --role-damage:      #ff4757;
  --role-glassCannon: #eccc68;
  --role-support:     #a29bfe;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: 'Bangers', cursive; letter-spacing: .04em; }

/* ── Screen system ─────────────────────────────────────────── */
.screen {
  display: none;
  position: fixed;
  inset: 0;
  overflow-y: auto;
}
.screen.active { display: flex; flex-direction: column; }

/* ── Overlay (round result) ────────────────────────────────── */
.screen-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.78);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.screen-overlay[style*="display: flex"],
.screen-overlay[style*="display:flex"] { display: flex; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  font-family: 'Bangers', cursive;
  letter-spacing: .06em;
  font-size: 1.05rem;
  padding: .45em 1.1em;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform .1s, filter .1s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.12); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── HP bars ───────────────────────────────────────────────── */
.hp-bar {
  background: rgba(255,255,255,.10);
  border-radius: 6px;
  overflow: hidden;
  height: 7px;
  width: 100%;
}
.hp-bar-mini  { height: 5px; }
.hp-bar-fight { height: 8px; margin-top: 3px; }

.hp-fill { height: 100%; border-radius: 6px; transition: width .28s ease; }
.hp-fill[data-hp="high"]  { background: var(--hp-high); }
.hp-fill[data-hp="mid"]   { background: var(--hp-mid); }
.hp-fill[data-hp="low"]   { background: var(--hp-low); box-shadow: 0 0 6px var(--hp-low); }


/* ══════════════════════════════════════════════════════════════
   TITLE SCREEN
══════════════════════════════════════════════════════════════ */
#screen-title {
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #2a1560 0%, var(--bg) 70%);
  overflow: hidden;
}

.title-deco { position: absolute; inset: 0; pointer-events: none; }
.deco {
  position: absolute;
  font-size: 3.5rem;
  opacity: .18;
  animation: floatDeco 6s ease-in-out infinite;
}
.deco-tl { top: 8%;  left: 6%;  animation-delay: 0s; }
.deco-tr { top: 6%;  right: 5%; animation-delay: 1.2s; }
.deco-bl { bottom: 10%; left: 5%;  animation-delay: 2.4s; }
.deco-br { bottom: 8%;  right: 6%; animation-delay: .8s; }
.deco-ml { top: 42%; left: 3%;  font-size: 2.5rem; animation-delay: 1.8s; }
.deco-mr { top: 38%; right: 4%; font-size: 2.5rem; animation-delay: 3s; }

@keyframes floatDeco {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50%       { transform: translateY(-18px) rotate(5deg); }
}

.title-content {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 1.4rem;
  text-align: center; padding: 2rem;
}

.title-logo { display: flex; gap: .3rem; line-height: 1; }
.logo-food {
  font-family: 'Bangers', cursive;
  font-size: 6rem;
  color: var(--gold);
  text-shadow: 4px 4px 0 #7a5e00, 0 0 30px rgba(255,211,42,.4);
}
.logo-fight {
  font-family: 'Bangers', cursive;
  font-size: 6rem;
  color: var(--accent);
  text-shadow: 4px 4px 0 #7a0010, 0 0 30px rgba(255,71,87,.4);
}

.title-tagline {
  font-family: 'Bangers', cursive; font-size: 1.6rem;
  letter-spacing: .15em; color: var(--muted);
}

.title-steps { display: flex; align-items: center; gap: .6rem; }
.title-step {
  display: flex; flex-direction: column; align-items: center; gap: .25rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: .7rem 1rem;
}
.step-icon { font-size: 2rem; }
.step-label { font-family: 'Bangers', cursive; font-size: 1rem; color: var(--muted); }
.title-step-arrow { font-size: 1.4rem; color: var(--muted); }

.btn-start {
  background: var(--accent); color: #fff; font-size: 1.4rem;
  padding: .6em 2.4em; border-radius: 12px;
  box-shadow: 0 4px 20px rgba(255,71,87,.4);
}
.title-hint { color: var(--muted); font-size: .85rem; }


/* ══════════════════════════════════════════════════════════════
   SHOP SCREEN
══════════════════════════════════════════════════════════════ */
#screen-shop {
  background: var(--bg);
  height: 100vh;
  overflow: hidden;
}

/* Header */
.shop-header {
  display: flex; align-items: center; gap: .8rem;
  padding: .55rem .9rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.shop-round-badge {
  font-family: 'Bangers', cursive; font-size: 1.4rem; color: var(--gold);
  white-space: nowrap;
}
.shop-header-gold {
  display: flex; align-items: center; gap: .35rem;
  background: rgba(255,211,42,.10);
  border: 1px solid rgba(255,211,42,.22);
  border-radius: 8px;
  padding: .3rem .65rem;
  white-space: nowrap;
}
.gold-icon { font-size: 1.1rem; }
.gold-val  { font-family: 'Bangers', cursive; font-size: 1.25rem; color: var(--gold); }
.gold-income { font-size: .72rem; color: var(--hp-high); font-weight: 700; }
.shop-header-right { margin-left: auto; }

/* HP mini-bar in header */
.shop-player-hp-bar { display: flex; flex-direction: column; gap: 2px; }
.shop-player-hp-row {
  display: flex; align-items: center; gap: 5px; font-size: .72rem;
  min-width: 180px;
}
.shop-player-hp-icon { font-size: .85rem; }
.shop-player-hp-name { width: 44px; font-weight: 700; }
.shop-player-hp-num  { width: 46px; text-align: right; color: var(--muted); font-size: .68rem; }
.shop-player-eliminated { opacity: .35; }

/* Body layout */
.shop-body {
  display: flex;
  flex: 1;
  min-height: 0;
  height: calc(100vh - 44px - 52px); /* viewport - header - footer */
}
.shop-section-label {
  font-family: 'Bangers', cursive; font-size: .95rem;
  letter-spacing: .05em; color: var(--muted); text-transform: uppercase;
}

/* Left column — shop offers */
.shop-offers-col {
  display: flex; flex-direction: column; gap: .45rem;
  padding: .65rem;
  border-right: 1px solid var(--border);
  width: 320px; flex-shrink: 0;
  overflow-y: auto;
}
.shop-offers-header {
  display: flex; align-items: center; justify-content: space-between;
}
.shop-offers { display: flex; flex-direction: column; gap: .4rem; }

.shop-offer {
  display: flex; align-items: center; gap: .6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 9px;
  padding: .45rem .6rem;
  transition: border-color .15s;
}
.shop-offer:hover { border-color: rgba(255,211,42,.3); }
.shop-offer[data-role="tank"]        { border-left-color: var(--role-tank); }
.shop-offer[data-role="frontline"]   { border-left-color: var(--role-frontline); }
.shop-offer[data-role="damage"]      { border-left-color: var(--role-damage); }
.shop-offer[data-role="glassCannon"] { border-left-color: var(--role-glassCannon); }
.shop-offer[data-role="support"]     { border-left-color: var(--role-support); }

.shop-offer-sold {
  justify-content: center; opacity: .3; height: 58px;
}
.shop-offer-sold-label {
  font-family: 'Bangers', cursive; font-size: .9rem; color: var(--muted);
}
.shop-offer-img-wrap {
  width: 46px; height: 46px; border-radius: 7px; overflow: hidden;
  background: var(--surface2); flex-shrink: 0;
}
.shop-offer-img { width: 100%; height: 100%; object-fit: cover; }
.shop-offer-name   { font-family: 'Bangers', cursive; font-size: .9rem; line-height: 1; }
.shop-offer-stats  { font-size: .68rem; color: var(--muted); display: flex; gap: .4rem; }
.shop-offer-ability { font-size: .62rem; color: var(--muted); font-style: italic; flex: 1; min-width: 0; }

.btn-buy {
  background: var(--gold); color: #1a1a00;
  font-size: .8rem; padding: .3em .65em;
  border-radius: 6px; white-space: nowrap; flex-shrink: 0;
}
.btn-buy-disabled { background: var(--surface2); color: var(--muted); cursor: not-allowed; }
.btn-reroll {
  background: var(--surface2); color: var(--gold);
  border: 1px solid rgba(255,211,42,.22); font-size: .8rem;
}

/* Center column — team */
.shop-team-col {
  flex: 1; display: flex; flex-direction: column; gap: .5rem;
  padding: .65rem; overflow-y: auto; min-width: 0;
}
.shop-field-section, .shop-bench-section, .shop-combo-section {
  display: flex; flex-direction: column; gap: .35rem;
}

/* Field grid */
.shop-field {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem;
}
.shop-slot {
  border-radius: 9px; border: 2px dashed rgba(255,255,255,.10);
  background: var(--surface); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  padding: .4rem .25rem; min-height: 100px;
  transition: border-color .15s, background .15s;
}
.shop-slot:hover { border-color: rgba(255,211,42,.35); background: var(--surface2); }
.shop-slot-empty { justify-content: center; }
.shop-slot-empty-text { font-size: .68rem; color: var(--muted); }
.shop-slot-label {
  font-family: 'Bangers', cursive; font-size: .7rem;
  letter-spacing: .04em; color: var(--muted);
}
.shop-slot-filled { border-style: solid; }
.shop-slot-filled[data-role="tank"]        { border-color: var(--role-tank); }
.shop-slot-filled[data-role="frontline"]   { border-color: var(--role-frontline); }
.shop-slot-filled[data-role="damage"]      { border-color: var(--role-damage); }
.shop-slot-filled[data-role="glassCannon"] { border-color: var(--role-glassCannon); }
.shop-slot-filled[data-role="support"]     { border-color: var(--role-support); }

.shop-slot-img { width: 50px; height: 50px; object-fit: cover; border-radius: 5px; }
.shop-slot-num  { font-size: .65rem; color: var(--muted); }
.shop-slot-name { font-family: 'Bangers', cursive; font-size: .78rem; }
.shop-slot-stats { font-size: .62rem; color: var(--muted); }

.btn-sell-small {
  background: rgba(255,71,87,.12); color: var(--accent);
  border: 1px solid rgba(255,71,87,.22);
  font-size: .62rem; padding: .12em .45em; border-radius: 4px;
  margin-top: auto;
}
.btn-sell-small:hover { background: rgba(255,71,87,.25); }

/* Bench grid */
.shop-bench {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: .35rem;
}
.bench-slot {
  border-radius: 8px; border: 2px dashed rgba(255,255,255,.08);
  background: var(--surface); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: .18rem;
  padding: .3rem .18rem; min-height: 80px;
  transition: border-color .15s;
}
.bench-slot:hover { border-color: rgba(255,255,255,.22); }
.bench-slot-empty { justify-content: center; }
.bench-slot-empty-text { font-size: .62rem; color: var(--muted); }
.bench-slot-filled[data-role="tank"]        { border-color: var(--role-tank);        border-style: solid; }
.bench-slot-filled[data-role="frontline"]   { border-color: var(--role-frontline);   border-style: solid; }
.bench-slot-filled[data-role="damage"]      { border-color: var(--role-damage);      border-style: solid; }
.bench-slot-filled[data-role="glassCannon"] { border-color: var(--role-glassCannon); border-style: solid; }
.bench-slot-filled[data-role="support"]     { border-color: var(--role-support);     border-style: solid; }
.bench-slot-img { width: 38px; height: 38px; object-fit: cover; border-radius: 5px; }
.bench-slot-name  { font-family: 'Bangers', cursive; font-size: .68rem; }
.bench-slot-stats { font-size: .58rem; color: var(--muted); }

/* Combos */
.shop-combo-hint { display: flex; flex-direction: column; gap: .2rem; }
.combo-active  { font-size: .76rem; color: var(--gold); font-weight: 700; }
.combo-partial { font-size: .72rem; color: var(--muted); }
.combo-none    { font-size: .72rem; color: var(--muted); }

/* Footer */
.shop-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: .8rem;
  padding: .55rem .9rem;
  background: var(--surface); border-top: 1px solid var(--border);
  flex-shrink: 0;
  height: 52px;
}
.shop-toast {
  font-size: .82rem; color: var(--accent); font-weight: 700;
  opacity: 0; transition: opacity .2s; flex: 1;
}
.shop-toast.toast-visible { opacity: 1; }
.btn-ready {
  background: var(--accent); color: #fff; font-size: 1.05rem;
  padding: .42em 1.5em; border-radius: 10px;
  box-shadow: 0 3px 14px rgba(255,71,87,.32);
}


/* ══════════════════════════════════════════════════════════════
   FIGHT SCREEN  (Slay the Spire side-scroll)
══════════════════════════════════════════════════════════════ */
#screen-fight {
  background: linear-gradient(180deg, #0d0a20 0%, #0f0a1a 100%);
  height: 100vh;
  overflow: hidden;
}

.fight-header {
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  padding: .45rem .9rem;
  background: var(--surface); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.fight-round-label  { font-family: 'Bangers', cursive; font-size: 1.1rem; color: var(--gold); }
.fight-matchup-label { font-family: 'Bangers', cursive; font-size: 1.45rem; color: var(--text); }

/* Arena */
.fight-arena {
  display: grid;
  grid-template-columns: 1fr 220px 1fr;
  flex: 1;
  min-height: 0;
  height: calc(100vh - 42px - 52px);
}

/* Team columns */
.fight-team {
  display: flex; flex-direction: column; justify-content: center;
  gap: .55rem; padding: .9rem; overflow-y: auto;
}
.fight-team-left  { background: rgba(255,99,72,.03); border-right: 1px solid var(--border); }
.fight-team-right { background: rgba(255,99,72,.03); border-left:  1px solid var(--border); }

/* Fighter row */
.fight-fighter {
  display: flex; flex-direction: column; align-items: center; gap: .22rem;
  padding: .5rem .4rem;
  border-radius: 10px; background: var(--surface); border: 1px solid var(--border);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .3s, background .15s;
}
.fight-fighter-dead { opacity: .28; filter: grayscale(1); }

/* Attacker slides toward center */
.fight-team-left  .fight-fighter.fighter-attacking { transform: translateX( 24px); }
.fight-team-right .fight-fighter.fighter-attacking { transform: translateX(-24px); }

/* Hit reaction (nudge away + flash) */
.fight-team-left  .fight-fighter.fighter-hit {
  transform: translateX(-10px);
  background: rgba(255,71,87,.15);
}
.fight-team-right .fight-fighter.fighter-hit {
  transform: translateX( 10px);
  background: rgba(255,71,87,.15);
}

/* Buff / heal flash */
.fight-fighter.fighter-buffed { background: rgba(46,213,115,.12); border-color: var(--hp-high); }

.fight-fighter-img-wrap {
  width: 90px; height: 90px;
  display: flex; align-items: center; justify-content: center;
}
.fight-fighter-img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.65));
}
.fight-fighter-name {
  font-family: 'Bangers', cursive; font-size: .88rem; color: var(--text);
}
.fight-fighter-hp-text { font-size: .68rem; color: var(--muted); }

/* Battle log */
.fight-log-panel {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface);
}
.fight-log-header {
  font-family: 'Bangers', cursive; font-size: .88rem; color: var(--muted);
  padding: .35rem .55rem; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.fight-log-feed {
  flex: 1; overflow-y: auto; padding: .45rem .55rem;
  display: flex; flex-direction: column; gap: .18rem;
  font-size: .68rem; line-height: 1.4;
}
.fight-log-entry { padding: .08rem 0; border-bottom: 1px solid rgba(255,255,255,.035); }

/* Controls */
.fight-controls {
  display: flex; gap: .65rem; justify-content: center; padding: .55rem;
  background: var(--surface); border-top: 1px solid var(--border); flex-shrink: 0;
  height: 52px; align-items: center;
}
.btn-fight-next    { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-fight-auto    { background: var(--accent); color: #fff; }
.btn-fight-results { background: var(--gold); color: #1a1a00; }


/* ══════════════════════════════════════════════════════════════
   ROUND RESULT OVERLAY
══════════════════════════════════════════════════════════════ */
.round-result-panel {
  background: var(--surface2);
  border: 1px solid rgba(255,211,42,.22);
  border-radius: 16px;
  padding: 1.8rem;
  max-width: 480px; width: 92vw;
  display: flex; flex-direction: column; gap: 1.1rem;
  box-shadow: 0 10px 50px rgba(0,0,0,.65);
}
.round-result-title {
  font-size: 2rem; color: var(--gold); text-align: center;
}
.round-result-fights { display: flex; flex-direction: column; gap: .4rem; }
.round-result-fight {
  background: var(--surface); border-radius: 8px;
  padding: .5rem .75rem; font-size: .82rem; border: 1px solid var(--border);
}
.round-result-fight b { color: var(--gold); }
.round-result-hp-list { display: flex; flex-direction: column; gap: .42rem; }
.round-result-hp-row {
  display: flex; align-items: center; gap: .45rem; font-size: .78rem;
}
.result-eliminated { opacity: .38; }
.btn-continue {
  background: var(--accent); color: #fff; font-size: 1.12rem;
  padding: .5em 1.8em; border-radius: 10px; align-self: center;
}


/* ══════════════════════════════════════════════════════════════
   FINAL RESULTS SCREEN
══════════════════════════════════════════════════════════════ */
#screen-results {
  align-items: center; justify-content: center; gap: 1.5rem;
  background: radial-gradient(ellipse at 50% 40%, #2a1560 0%, var(--bg) 70%);
  padding: 2rem;
}
.results-header { text-align: center; }
.results-title {
  font-size: 3rem; color: var(--gold);
  text-shadow: 3px 3px 0 #7a5e00;
}
.results-subtitle { color: var(--muted); font-size: .93rem; margin-top: .3rem; }
.results-podium {
  display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center;
}
.podium-place {
  background: var(--surface); border: 2px solid var(--border); border-radius: 14px;
  padding: 1.3rem 1.1rem;
  display: flex; flex-direction: column; align-items: center; gap: .45rem;
  min-width: 115px; transition: transform .2s;
}
.podium-place:hover { transform: translateY(-3px); }
.podium-winner {
  border-color: var(--gold);
  background: rgba(255,211,42,.07);
  box-shadow: 0 0 24px rgba(255,211,42,.18);
}
.podium-rank        { font-size: 2.1rem; }
.podium-icon        { font-size: 1.7rem; }
.podium-team-name   { font-family: 'Bangers', cursive; font-size: 1.35rem; }
.podium-hp          { font-size: .72rem; color: var(--muted); }
.podium-winner-label { font-family: 'Bangers', cursive; font-size: .95rem; color: var(--gold); }
.results-footer { text-align: center; }
.btn-playagain {
  background: var(--accent); color: #fff; font-size: 1.15rem;
  padding: .5em 2em; border-radius: 12px;
  box-shadow: 0 4px 18px rgba(255,71,87,.32);
}
