/* style.css — the NEW game's shell (Phase 1 skeleton).
   Mobile-first portrait; the canvas letterboxes on desktop.
   The old game's style.css is untouched (index.legacy.html still uses it). */

* { box-sizing: border-box; margin: 0; padding: 0; }

html { background: #0b0a08; }

html, body {
  height: 100%;
  /* base ink lives on HTML only — body must stay transparent or its background
     paints OVER the fixed negative-z bleed layer (root paint order) */
  background: transparent;
  color: #e8dfce;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

/* ── the letterbox bleed: the game frame is aspect-locked (390×844 — node map
   + battle mapping are calibrated to it), so browser chrome leaves margins.
   Instead of dead black, the margins carry a blurred, dimmed continuation of
   the city — the world reads as extending past the playfield, not cut off. ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  /* tall_b_wide_sq = the SAME plate outpainted wider (gen-map-wide.py), original
     center composited back in, then pre-squashed horizontally by the canvas's own
     plate stretch (390·1376/768·844) — so at height-cover the center region lands
     EXACTLY under the canvas: in the town it IS the whole picture of the map,
     sharp, no blur, no seam. Other scenes are dark rooms, so the backdrop dims. */
  background: url('/assets/gen/map-tall/tall_b_wide_sq.webp') center / cover no-repeat;
  z-index: -1;
  pointer-events: none;
  transition: filter 0.5s ease;
}
/* outside the town the world recedes — dark ambience behind interiors/battle */
body:not([data-scene="town"])::before {
  filter: brightness(0.28) blur(6px);
}
/* LANDSCAPE (desktop/iPad-wide): the continuation math only holds in portrait
   (height-cover). Width-cover would paint a zoomed ECHO of the same map behind
   the playfield — so wide viewports always get the quiet ambience instead. */
@media (min-aspect-ratio: 1/1) {
  body::before, body:not([data-scene="town"])::before {
    filter: brightness(0.3) blur(12px);
  }
}

#app {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* #stage is sized by boot.js resize() to exactly match the canvas CSS size.
   No radius, no shadow ring — in the town the backdrop continues the SAME
   picture, so any frame treatment would re-introduce a "cut off" seam. */
#stage { position: relative; }

#game { display: block; }

/* ── DOM overlay: readable text over the canvas ── */
.ui-panel { position: absolute; left: 0; right: 0; z-index: 2; }

#hud {
  top: 10px;
  display: flex;
  justify-content: flex-start;   /* top-left, clear of the centered dancer */
  flex-wrap: nowrap;             /* ONE row only — never wrap down onto his head */
  gap: 6px;
  padding: 0 10px;
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 12px;
}
#hud .w {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  background: rgba(11, 10, 8, 0.66);
  border: 1px solid rgba(232, 179, 75, 0.22);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
#hud b { font-weight: 700; color: #e8b34b; }
#hud i {
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #9a9079;
}

#dock {
  bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
}

.btn {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.06em;
  color: #12100d;
  background: #e8b34b;
  border: 0;
  border-radius: 999px;
  padding: 12px 34px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(232, 179, 75, 0.35);
}
.btn:active { transform: translateY(1px) scale(0.99); }

.btn.guide {
  background: #61afef;
  box-shadow: 0 4px 18px rgba(97, 175, 239, 0.35);
}

.hidden { display: none !important; }

/* ── town objective banner: readable DOM text over the canvas (HD-text rule).
     pointer-events none so map taps fall through to the ONE input verb. ── */
#banner {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 19%;   /* default: low, but clear of the bottom node row */
  z-index: 2;
  text-align: center;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
  color: #e9dcc0;
  background: rgba(11, 10, 8, 0.74);
  border: 1px solid rgba(232, 179, 75, 0.28);
  border-radius: 12px;
  padding: 9px 14px;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
#banner.show { opacity: 1; }
/* when the destination is a bottom-row node, the banner flips up top (below the
   HUD row) so it never sits on 'Your Place' / 'The Studio' */
#banner.top { top: 44px; bottom: auto; }

/* ── the Stage battle HUD (Phase 3): money / combo / GO OFF — readable DOM
     text over the canvas (HD-text rule). pointer-events none: taps are the
     battle's ONE verb and must fall through to the world. ── */
#battle-hud {
  position: absolute;
  top: 46px;
  left: 0;
  right: 0;
  z-index: 2;
  text-align: center;
  pointer-events: none;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
}
#b-money {
  font-size: 34px;
  font-weight: 800;
  color: #f4d488;
  text-shadow: 0 2px 0 #0b0a08, 0 0 18px rgba(207, 162, 83, 0.45);
  transition: transform 0.08s ease;
}
#b-money.bump { transform: scale(1.12); }
#b-combo {
  margin-top: 2px;
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #e9dcc0;
  text-shadow: 0 1px 0 #0b0a08;
}
#b-combo.hot { color: #f4d488; }
#b-combo b { font-size: 17px; }
#b-fever {
  margin-top: 4px;
  display: inline-block;
  padding: 2px 12px;
  border-radius: 999px;
  background: rgba(138, 47, 44, 0.85);
  border: 1px solid #f4d488;
  color: #f4d488;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.18em;
  animation: feverPulse 0.4s ease-in-out infinite alternate;
}
@keyframes feverPulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

/* ── the lesson sheet (Phase 4): Bank / Tax Office / Studio interior.
     A focused modal over the interior — readable text = DOM (HD-text rule).
     Owns its own taps (boot ignores clicks inside .sheet). ── */
.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 0 12px 76px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}
.sheet.show { opacity: 1; pointer-events: auto; }

.lesson-card {
  width: 100%;
  max-width: 340px;
  background: rgba(15, 13, 10, 0.94);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-top: 3px solid var(--accent);
  border-radius: 18px;
  padding: 18px 18px 16px;
  box-shadow: 0 -6px 40px rgba(0, 0, 0, 0.5);
  text-align: center;
  animation: sheetRise 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes sheetRise { from { transform: translateY(18px); } to { transform: translateY(0); } }

.lesson-ic { font-size: 34px; line-height: 1; margin-bottom: 4px; }
.lesson-card h3 {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 800; font-size: 20px; color: #f2e8d4; margin-bottom: 6px;
}
.lesson-blurb {
  font-size: 13.5px; line-height: 1.45; color: #cabfa6; margin-bottom: 12px;
}
.lesson-blurb b { color: var(--accent); font-weight: 700; }

.lesson-mini {
  display: flex; justify-content: center; gap: 14px; flex-wrap: wrap;
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 12px; color: #b6ac93; margin-bottom: 14px;
}
.lesson-mini b { color: #e8dfce; font-weight: 700; }

.lesson-act {
  width: 100%;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 800; font-size: 16px; letter-spacing: 0.02em;
  color: #12100d; background: var(--accent);
  border: 0; border-radius: 999px; padding: 13px 20px; cursor: pointer;
  box-shadow: 0 4px 20px color-mix(in srgb, var(--accent) 40%, transparent);
}
.lesson-act:active { transform: translateY(1px) scale(0.99); }
.lesson-act:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.lesson-ok {
  font-weight: 700; font-size: 14.5px; color: var(--accent);
  padding: 11px 8px; border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 12px;
}

.lesson-card .learn {
  display: block; margin-top: 10px;
  font-size: 12.5px; color: #61afef; text-decoration: none;
}
.lesson-card .learn:hover { text-decoration: underline; }

.lesson-back {
  display: block; margin: 12px auto 0;
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 12.5px; color: #9a9079; background: none; border: 0; cursor: pointer;
}
.lesson-back:hover { color: #e9dcc0; }

/* ── the choice: the amount slider + live trade-off readout ── */
.lesson-readout {
  font-size: 13px; line-height: 1.5; color: #cabfa6; margin-bottom: 10px; min-height: 20px;
}
.lesson-readout b { color: var(--accent); font-weight: 800; }
.lesson-warn { color: #e0894f; font-weight: 700; white-space: nowrap; }
.lesson-safe { color: #8fae72; font-weight: 700; white-space: nowrap; }

/* (the slider left with the fiddling — the lesson is a one-tap CHOICE now) */

/* ── the season-end cards (Phase 6): the life-shock + the Taxman reckoning.
     Same modal chassis as the lesson sheet, its own drama. ── */
.season-card, .grade-card {
  width: 100%;
  max-width: 340px;
  background: rgba(15, 13, 10, 0.95);
  border: 1px solid color-mix(in srgb, var(--accent, #cfa253) 55%, transparent);
  border-top: 3px solid var(--accent, #cfa253);
  border-radius: 18px;
  padding: 18px 18px 16px;
  box-shadow: 0 -6px 40px rgba(0, 0, 0, 0.5);
  text-align: center;
  animation: sheetRise 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.season-card.bad { animation: cardJolt 0.4s ease; }
@keyframes cardJolt {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); } 40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); } 80% { transform: translateX(3px); }
}
.season-card.good { animation: cardPop 0.42s cubic-bezier(0.2, 1.3, 0.35, 1); }
@keyframes cardPop {
  0% { transform: scale(0.86); }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); }
}
.season-card.good .season-ic, .season-card.bad .season-ic { animation: icPop 0.5s cubic-bezier(0.2, 1.4, 0.3, 1); }
@keyframes icPop { 0% { transform: scale(0.4) rotate(-12deg); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }

.season-ic { font-size: 40px; line-height: 1; margin-bottom: 2px; }
.season-kicker {
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 11px; font-weight: 700; letter-spacing: 0.18em;
  color: var(--accent, #cfa253); margin-bottom: 4px;
}
.season-card h3 {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 800; font-size: 20px; color: #f2e8d4; margin-bottom: 6px;
}
.season-blurb { font-size: 13.5px; line-height: 1.45; color: #cabfa6; margin-bottom: 14px; }
.season-blurb b { color: var(--accent, #cfa253); font-weight: 700; }
.season-mini {
  display: flex; justify-content: center; gap: 14px; flex-wrap: wrap;
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 12px; color: #b6ac93; margin-bottom: 14px;
}
.season-mini b { color: #e8dfce; font-weight: 700; }
.season-slam {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 800; font-size: 30px; color: var(--accent, #cfa253);
  text-shadow: 0 2px 0 #0b0a08; margin: 2px 0 10px;
}
.season-act {
  width: 100%;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 800; font-size: 16px; color: #12100d; background: var(--accent, #cfa253);
  border: 0; border-radius: 999px; padding: 13px 20px; cursor: pointer;
  box-shadow: 0 4px 20px color-mix(in srgb, var(--accent, #cfa253) 40%, transparent);
}
.season-act:active { transform: translateY(1px) scale(0.99); }

/* ── the grade card (Phase 6 ending): the 10-year reveal + the guide funnel. ── */
.grade-card { max-width: 348px; padding: 20px 20px 16px; }
.end-title {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 800; font-size: 24px; color: var(--grade, #f4d488); margin-bottom: 10px;
}
.end-line {
  font-size: 13px; line-height: 1.45; color: #cabfa6; margin-bottom: 5px;
  opacity: 0; animation: lineIn 0.5s ease forwards;
}
@keyframes lineIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.grade-row {
  display: flex; align-items: center; gap: 14px; justify-content: center;
  margin: 14px 0; padding: 12px; border-radius: 14px; background: rgba(0, 0, 0, 0.28);
}
.grade-badge {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 800; font-size: 46px; line-height: 1;
  width: 66px; height: 66px; display: flex; align-items: center; justify-content: center;
  color: #12100d; background: var(--grade, #f4d488); border-radius: 14px;
  box-shadow: 0 0 24px color-mix(in srgb, var(--grade, #f4d488) 45%, transparent);
}
.grade-meta { text-align: left; font-family: "Space Mono", ui-monospace, monospace; font-size: 12px; }
.grade-meta div { color: #9a9079; margin: 2px 0; }
.grade-meta b { color: #e8dfce; font-weight: 700; margin-left: 8px; }

.grade-verdict {
  margin: 4px 0 14px;
  padding: 11px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--grade, #f4d488) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--grade, #f4d488) 40%, transparent);
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 700; font-size: 13.5px; line-height: 1.4; color: #f2e8d4;
}

.grade-guide {
  display: block; width: 100%; box-sizing: border-box;
  text-align: center; text-decoration: none;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 800; font-size: 16px; letter-spacing: 0.02em;
  color: #12100d; background: #61afef;
  border: 0; border-radius: 999px; padding: 13px 20px; cursor: pointer;
  box-shadow: 0 4px 20px rgba(97, 175, 239, 0.4);
}
.grade-guide:active { transform: translateY(1px) scale(0.99); }
.grade-replay {
  display: block; margin: 12px auto 0;
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 12.5px; color: #9a9079; background: none; border: 0; cursor: pointer;
}
.grade-replay:hover { color: #e9dcc0; }

/* ── the drip shop (Phase 5): the fit wall. Same modal chassis, its own grid. ── */
.shop-panel {
  width: 100%;
  max-width: 352px;
  max-height: 68vh;
  display: flex; flex-direction: column;
  background: rgba(15, 13, 10, 0.96);
  border: 1px solid rgba(198, 120, 221, 0.5);
  border-top: 3px solid #c678dd;
  border-radius: 18px;
  padding: 14px 14px 12px;
  box-shadow: 0 -6px 40px rgba(0, 0, 0, 0.5);
  animation: sheetRise 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.shop-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid rgba(198, 120, 221, 0.22);
}
.shop-title { font-family: "Bricolage Grotesque", system-ui, sans-serif; font-weight: 800; font-size: 16px; color: #f2e8d4; }
.shop-wallet { font-family: "Space Mono", ui-monospace, monospace; font-size: 12px; color: #e8b34b; }

.shop-bait {
  text-align: center; margin-bottom: 10px;
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 11.5px; color: #e0894f;
}
.shop-bait b { color: #f4d488; font-weight: 700; }

.shop-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 9px;
  overflow-y: auto; padding: 2px; -webkit-overflow-scrolling: touch;
}
.shop-card {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 3px; padding: 11px 8px 9px;
  background: rgba(28, 23, 16, 0.9);
  border: 1px solid rgba(207, 162, 83, 0.2); border-radius: 13px;
  color: #e9dcc0; font-family: "Bricolage Grotesque", system-ui, sans-serif;
  cursor: pointer;
}
.shop-card:not(:disabled):active { transform: translateY(1px) scale(0.98); }
.shop-card:not(.locked):not(.owned):not(.cant) { border-color: rgba(198, 120, 221, 0.45); }
.shop-ic { font-size: 30px; line-height: 1; }
.shop-ic svg { color: var(--brass, #c9a24b); display: block; margin: 0 auto; }
.shop-ic.dim { opacity: 0.4; }
.shop-nm { font-weight: 800; font-size: 12.5px; letter-spacing: 0.02em; }
.shop-copy { font-size: 10.5px; line-height: 1.3; color: #9a9079; min-height: 27px; }
.shop-foot {
  margin-top: 3px; font-family: "Space Mono", ui-monospace, monospace;
  font-size: 12px; font-weight: 700; color: #c678dd;
}
.shop-card.owned { border-color: rgba(143, 174, 114, 0.6); opacity: 0.9; }
.shop-card.owned .shop-foot { color: #8fae72; }
.shop-card.cant { opacity: 0.5; }
.shop-card.cant .shop-foot { color: #9a9079; }
.shop-card.locked { cursor: default; opacity: 0.55; border-style: dashed; }
.shop-lock { font-family: "Space Mono", ui-monospace, monospace; font-size: 11px; font-weight: 700; color: #d1a35c; }
.shop-tease { font-size: 10px; line-height: 1.3; color: #7d745f; font-style: italic; }
.shop-card.shake { animation: cardJolt 0.4s ease; }

.shop-broke {
  margin: 8px 0 2px; font-size: 12.5px; font-weight: 700; color: #c96f4a;
  font-family: "Space Mono", ui-monospace, monospace;
}
.shop-back {
  margin-top: 10px;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 800; font-size: 15px; color: #12100d; background: #c678dd;
  border: 0; border-radius: 999px; padding: 12px 20px; cursor: pointer;
  box-shadow: 0 4px 20px rgba(198, 120, 221, 0.35);
}
.shop-back:active { transform: translateY(1px) scale(0.99); }

/* desktop: give the portrait cabinet some air */
@media (min-width: 820px) {
  #game { border: 1px solid rgba(232, 179, 75, 0.18); }
}
