@font-face{font-family:'Nunito';font-style:normal;font-weight:600;font-display:swap;src:url('fonts/nunito-latin-600-5.3.0.woff2') format('woff2');}
@font-face{font-family:'Nunito';font-style:normal;font-weight:700;font-display:swap;src:url('fonts/nunito-latin-700-5.3.0.woff2') format('woff2');}
@font-face{font-family:'Nunito';font-style:normal;font-weight:800;font-display:swap;src:url('fonts/nunito-latin-800-5.3.0.woff2') format('woff2');}
@font-face{font-family:'Fredoka';font-style:normal;font-weight:600;font-display:swap;src:url('fonts/fredoka-latin-600-5.3.0.woff2') format('woff2');}
@font-face{font-family:'Fredoka';font-style:normal;font-weight:700;font-display:swap;src:url('fonts/fredoka-latin-700-5.3.0.woff2') format('woff2');}
/* ── DESIGN SYSTEM ── */
:root {
  /* Root Cellar: a sunny farm. Meadow ground, parchment panels, soil-brown ink,
     leaf green for money and growth, harvest amber for warnings and rewards.
     Colours with a -rgb twin are used inside rgba() for glows and tints. */
  --bg:       #e7f0d8;   /* meadow (changes with the background tier) */
  --bg2:      #dbe8c6;
  --bg3:      #d0e0b8;
  --surface:  #fffdf7;   /* cards */
  --surface2: #f7efdc;   /* panels, parchment */
  --surface3: #efe2c4;
  --border:   #6b4a2b26;
  --border2:  #6b4a2b4d;
  --sky:      #bfe3f2;
  --soil:     #6b4a2b;

  --green:    #3a8a26;  --green-rgb: 58,138,38;
  --green2:   #2d6e1c;
  --green3:   #5aa63c55;
  --red:      #c8452f;  --red-rgb: 200,69,47;
  --red2:     #a3361f;
  --amber:    #d98a1c;  --amber-rgb: 217,138,28;
  --amber2:   #b86e10;
  --blue:     #2f74c0;  --blue-rgb: 47,116,192;
  --blue2:    #1f5aa0;
  --purple:   #7a55c7;  --purple-rgb: 122,85,199;
  --teal:     #1f9c86;  --teal-rgb: 31,156,134;
  --gold:     #b8860b;

  /* Ink */
  --t1: #3b2a1a;
  --t2: #3b2a1acc;
  --t3: #3b2a1a99;
  --t4: #3b2a1a33;
  --ink-rgb: 59,42,26;     /* replaces white overlays from the old dark theme */
  --shade-rgb: 45,32,18;   /* shadows and modal backdrops */
  --bg-rgb: 231,240,216;
  --on-accent: #ffffff;    /* text on green, red, blue buttons */
  --on-amber: #3b2a1a;     /* text on amber buttons */

  /* Typography: Nunito for text and numbers (tabular digits), Fredoka for titles and buttons */
  --display: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --heading: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --mono:    'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Type scale: every text size in the game uses one of these six steps.
     (Icon and display sizes of 34px and up, and responsive clamp() sizes, are separate.) */
  --fs-xs: 11px;
  --fs-sm: 12.5px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 26px;

  /* Spacing */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;

  /* Layout */
  --hud-h: 60px;
  --nav-h: 60px; /* mobile bottom nav */
  --left-w: 210px;
  --right-w: 290px;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; touch-action: manipulation; }
/* No double-tap zoom anywhere (pinch zoom still works). touch-action does not reach elements inside a
   scrolling area from html, and fast taps often land on the floating "+$12" numbers and ripples over
   the potato, so iOS Safari zoomed in while you tapped. */
*, *::before, *::after { touch-action: manipulation; }
body {
  font-family: var(--display);
  background: var(--bg);
  color: var(--t1);
  user-select: none;
  font-size: var(--fs-md);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

/* ── NOISE OVERLAY ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  opacity: .025;
  pointer-events: none;
  z-index: 9998;
}

/* ── HUD (top bar) ── */
#hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--hud-h);
  z-index: 200;
  background: rgba(var(--bg-rgb),.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0;
}

/* Net worth (left) */
#hud-nw {
  flex: 1;
  padding: 0 8px 0 12px;
  min-width: 0;
  overflow: hidden;
}
#hud-nw-lbl { font-size: var(--fs-xs); color: var(--t3); letter-spacing: .12em; text-transform: uppercase; font-family: var(--mono); margin-bottom: 1px; }
#net-worth-val {
  font-family: var(--mono);
  font-size: clamp(13px, 3.5vw, 22px);
  font-weight: 700;
  line-height: 1;
  transition: color .4s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Center: FIRE bar */
#hud-center {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
}
#fire-label { font-size: var(--fs-xs); color: var(--t3); letter-spacing: .12em; text-transform: uppercase; font-family: var(--mono); display: flex; align-items: center; gap: 5px; white-space: nowrap; }
#fire-wrap { width: clamp(80px, 18vw, 140px); height: 4px; background: var(--surface3); border-radius: 99px; overflow: hidden; }
#fire-bar { height: 100%; background: linear-gradient(90deg, var(--green2), var(--green)); border-radius: 99px; width: 0%; transition: width 1.2s cubic-bezier(.4,0,.2,1); }
#fire-pct { font-family: var(--mono); font-size: var(--fs-xs); color: var(--green); font-weight: 700; }
/* Prestige available pulse */
#hud-center.prestige-ready { animation: prestigePulse 1.6s ease-in-out infinite; border-radius: 8px; padding: 2px 6px; }
@keyframes prestigePulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(var(--amber-rgb),0); background: transparent; }
  50%      { box-shadow: 0 0 14px 3px rgba(var(--amber-rgb),.25); background: rgba(var(--amber-rgb),.06); }
}

/* Income (right) */
#hud-income {
  flex: 1;
  padding: 0 46px 0 8px;
  text-align: right;
  min-width: 0;
  overflow: hidden;
}
#hud-income-lbl { font-size: var(--fs-xs); color: var(--t3); letter-spacing: .12em; text-transform: uppercase; font-family: var(--mono); margin-bottom: 1px; }
#passive-val {
  font-family: var(--mono);
  font-size: clamp(11px, 2.8vw, 16px);
  font-weight: 700;
  color: var(--green);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── TICKER STRIP ── */
#ticker-strip {
  position: fixed;
  top: var(--hud-h);
  left: 0; right: 0;
  height: 26px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  z-index: 199;
  display: flex;
  align-items: center;
}
#ticker-track {
  display: inline-flex;
  white-space: nowrap;
  animation: tickerScroll 30s linear infinite;
  will-change: transform;
}
@keyframes tickerScroll { 0% { transform: translateX(0) } 100% { transform: translateX(-50%) } }
.tick-item {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--t3);
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-right: 1px solid var(--border);
}
.tick-label { color: var(--t3); }
.ti-up  { color: var(--green); }
.ti-dn  { color: var(--red); }
.ti-neu { color: var(--amber); }

/* ── APP SHELL ── */
#app {
  position: fixed;
  top: calc(var(--hud-h) + 26px);
  left: 0; right: 0;
  bottom: 0;
  display: flex;
  overflow: hidden;
}
/* Desktop: leave room for bottom bar; Mobile: leave room for nav */
@media(min-width:900px) { #app { bottom: 36px; } }
@media(max-width:899px)  { #app { bottom: var(--nav-h); } }

/* ── LEFT PANEL (desktop) ── */
#left-col {
  width: var(--left-w);
  min-width: var(--left-w);
  flex-shrink: 0;
  display: none;
  flex-direction: column;
  height: 100%;
  background: var(--bg2);
  border-right: 1px solid var(--border);
}
@media(min-width:900px) { #left-col { display: flex; } }

#lc-header {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#lc-title { font-size: var(--fs-xs); color: var(--t3); letter-spacing: .12em; text-transform: uppercase; font-family: var(--mono); }
#lc-total-ps { font-family: var(--mono); font-size: var(--fs-xs); color: var(--green); font-weight: 700; }
#acol-scroll { flex: 1; min-height: 0; overflow-y: scroll; overflow-x: hidden; }
#acol-scroll::-webkit-scrollbar { width: 2px; }
#acol-scroll::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }

.acol-row {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0;
  border-bottom: 1px solid var(--border);
  min-height: 52px;
  transition: background .15s;
  cursor: default;
  overflow: hidden;
}
.acol-row:hover { background: var(--surface); }
.acol-swatch {
  width: 48px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 52px;
  gap: 3px;
  position: relative;
}
.acol-emoji { font-size: var(--fs-xl); line-height: 1; }
.acol-badge {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  font-weight: 700;
  background: var(--surface3);
  color: var(--t2);
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid var(--border2);
}
.acol-body { flex: 1; padding: 8px 6px 8px 4px; min-width: 0; }
.acol-sell { flex-shrink: 0; display: flex; align-items: center; padding-right: 8px; }
.acol-sellbtn { padding: 4px 8px !important; font-size: var(--fs-md) !important; }
.acol-name { font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--t2); margin-bottom: 2px; }
.acol-ps { font-family: var(--mono); font-size: var(--fs-xs); color: var(--green); font-weight: 700; }
/* Asset color strips */
.ac-0 .acol-swatch { background: linear-gradient(180deg,#d0f1df,transparent); }
.ac-1 .acol-swatch { background: linear-gradient(180deg,#cfe0f5,transparent); }
.ac-2 .acol-swatch { background: linear-gradient(180deg,#f1e6d0,transparent); }
.ac-3 .acol-swatch { background: linear-gradient(180deg,#d6d6f5,transparent); }
.ac-4 .acol-swatch { background: linear-gradient(180deg,#f1d0d9,transparent); }
.ac-5 .acol-swatch { background: linear-gradient(180deg,#d0f1d0,transparent); }
.ac-6 .acol-swatch { background: linear-gradient(180deg,#e6d0f1,transparent); }
.ac-7 .acol-swatch { background: linear-gradient(180deg,#d0f1f1,transparent); }
.ac-8 .acol-swatch { background: linear-gradient(180deg,#f1e1d0,transparent); }

/* ── CENTER COLUMN ── */
#center-col {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: scroll;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
  position: relative;
}
#center-col::-webkit-scrollbar { width: 2px; }
#center-col::-webkit-scrollbar-thumb { background: var(--border2); }

/* Ambient glow behind tap button */
#center-col::before {
  content: '';
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(var(--green-rgb),.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  flex-shrink: 0;
}

#center-top {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  padding: 0 0 16px;
  position: relative;
  z-index: 1;
}
@media(min-width:900px) {
  #center-col { justify-content: flex-start; padding-top: 10px; }
}

/* Portfolio name */
#fund-name {
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--t1);
  cursor: pointer;
  padding: 12px 0 4px;
  letter-spacing: -.01em;
  transition: color .2s, text-shadow .2s;
  text-align: center;
}
#fund-name:hover { color: var(--green); text-shadow: 0 0 20px rgba(var(--green-rgb),.3); }
#fund-name span { border-bottom: 2px dashed rgba(var(--green-rgb),.3); padding-bottom: 1px; }

/* Flavor text */
#hud-flavor-inline {
  font-size: var(--fs-sm);
  color: var(--green);
  font-style: italic;
  text-align: center;
  padding: 2px 16px 12px;
  width: 100%;
  font-family: var(--mono);
  letter-spacing: .01em;
  opacity: .9;
  transition: opacity .6s, transform .6s;
  line-height: 1.5;
  white-space: normal;
  background: linear-gradient(90deg, transparent, rgba(var(--green-rgb),.04), transparent);
  border-radius: 8px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#hud-flavor-inline::before {
  content: '"';
  color: var(--green);
  opacity: .4;
  font-size: var(--fs-xl);
  margin-right: 4px;
  line-height: 1;
}
#hud-flavor-inline::after {
  content: '"';
  color: var(--green);
  opacity: .4;
  font-size: var(--fs-xl);
  margin-left: 4px;
  line-height: 1;
}

/* Cash display */
#cash-wrap {
  text-align: center;
  padding: 4px 16px 8px;
  width: 100%;
  position: relative;
}
#cash-big {
  font-family: var(--mono);
  font-weight: 700;
  line-height: 1;
  color: var(--t1);
  font-size: clamp(32px, 7vw, 52px);
  letter-spacing: -.02em;
  transition: color .3s;
}
#cash-big.bump { animation: bump .1s ease-out; }
@keyframes bgFlash { 0%{opacity:1} 100%{opacity:0} }
@keyframes bump { 0% { transform: scale(1.04) } 100% { transform: scale(1) } }
#cash-ps-line {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  margin-top: 5px;
  transition: color .3s;
  letter-spacing: .01em;
}

/* ── TAP ARENA ── */
#arena-wrap {
  position: relative;
  width: 260px;
  height: 260px;
  flex-shrink: 0;
  margin: 4px 0;
}
#pcanvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  width: 260px;
  height: 260px;
}
#arena {
  position: relative;
  width: 260px;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
#orbit-ring {
  position: absolute;
  inset: 10px;
  border: 1px dashed rgba(var(--green-rgb),.08);
  border-radius: 50%;
  pointer-events: none;
}
#orbit-ring-2 {
  position: absolute;
  inset: 30px;
  border: 1px dashed rgba(var(--green-rgb),.04);
  border-radius: 50%;
  pointer-events: none;
}
/* Extra orbit rings for asset layers */
.orbit-ring-asset {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  border: 1px dashed rgba(var(--green-rgb),.035);
}
#orbit-wrap { position: absolute; inset: 0; pointer-events: none; }
.obot { position: absolute; font-size: var(--fs-md); line-height: 1; }
.oasset { position: absolute; line-height: 1; pointer-events: none; }

#tap-btn {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  outline: none;
  border: none;
  -webkit-appearance: none;
  touch-action: manipulation;
  /* Layered bg for depth */
  background:
    radial-gradient(circle at 35% 30%, rgba(var(--green-rgb),.08) 0%, transparent 60%),
    radial-gradient(circle at 65% 70%, rgba(var(--green-rgb),.06) 0%, transparent 50%),
    conic-gradient(from 180deg at 50% 50%, #d0f1e0 0deg, #d0def1 120deg, #dcd3ee 240deg, #d0f1e0 360deg);
  box-shadow:
    0 0 0 1px rgba(var(--green-rgb),.15),
    0 0 0 8px rgba(var(--green-rgb),.04),
    0 0 60px rgba(var(--green-rgb),.08),
    inset 0 1px 0 rgba(var(--ink-rgb),.06);
  transition: transform .08s, box-shadow .2s;
}
#tap-btn:hover {
  box-shadow:
    0 0 0 1px rgba(var(--green-rgb),.3),
    0 0 0 12px rgba(var(--green-rgb),.07),
    0 0 80px rgba(var(--green-rgb),.14),
    inset 0 1px 0 rgba(var(--ink-rgb),.08);
}
#tap-btn:active { transform: scale(.93); }
#tap-btn.daily-active {
  background:
    radial-gradient(circle at 35% 30%, rgba(var(--amber-rgb),.1) 0%, transparent 60%),
    conic-gradient(from 180deg, #f1e7d0 0deg, #f1e4d0 120deg, #f1dfd0 360deg);
  box-shadow:
    0 0 0 1px rgba(var(--amber-rgb),.3),
    0 0 0 8px rgba(var(--amber-rgb),.06),
    0 0 60px rgba(var(--amber-rgb),.12),
    inset 0 1px 0 rgba(var(--ink-rgb),.06);
}
/* Outer pulse ring */
#tap-btn::before {
  content: '';
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  border: 1px solid rgba(var(--green-rgb),.1);
  animation: pulseRing 3s ease-in-out infinite;
  pointer-events: none;
}
#tap-btn::after {
  content: '';
  position: absolute;
  inset: -32px;
  border-radius: 50%;
  border: 1px solid rgba(var(--green-rgb),.05);
  animation: pulseRing 3s ease-in-out infinite .8s;
  pointer-events: none;
}
@keyframes pulseRing {
  0%, 100% { opacity: .3; transform: scale(1); }
  50% { opacity: .8; transform: scale(1.03); }
}
#tap-icon { font-size: 52px; line-height: 1; pointer-events: none; filter: drop-shadow(0 0 12px rgba(var(--amber-rgb),.3)); }
#tap-lbl { font-size: var(--fs-xs); color: rgba(var(--green-rgb),.5); letter-spacing: .1em; text-transform: uppercase; margin-top: 6px; pointer-events: none; font-family: var(--mono); }
#tap-val { font-family: var(--mono); font-size: var(--fs-md); color: var(--green); font-weight: 700; pointer-events: none; margin-top: 2px; }
#daily-badge { font-size: var(--fs-xs); font-weight: 700; color: var(--amber); margin-top: 2px; display: none; animation: dailyPulse 1.8s ease infinite; pointer-events: none; font-family: var(--mono); }
@keyframes dailyPulse { 0%,100% { opacity: 1 } 50% { opacity: .5 } }

/* Tap float text */
.ft {
  position: fixed;
  font-family: var(--mono);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--green);
  pointer-events: none;
  z-index: 999;
  text-shadow: 0 0 20px rgba(var(--green-rgb),.6);
  animation: ftup 1.1s cubic-bezier(.2,.6,.2,1) forwards;
}
.ft.daily { color: var(--amber); text-shadow: 0 0 20px rgba(var(--amber-rgb),.6); }
@keyframes ftup { 0% { opacity:1; transform: translateY(0) scale(1.2) } 100% { opacity:0; transform: translateY(-70px) scale(.7) } }

/* Ripple */
.ripple { position: absolute; border-radius: 50%; background: rgba(var(--green-rgb),.2); transform: scale(0); animation: rip .6s ease-out forwards; pointer-events: none; }
@keyframes rip { to { transform: scale(3.5); opacity: 0; } }

/* Job label */
#job-lbl { font-size: var(--fs-xs); color: var(--t3); margin-top: 6px; text-align: center; flex-shrink: 0; font-family: var(--mono); letter-spacing: .02em; }

/* ── MOBILE QUICK STATS BAR ── */
#quick-stats {
  display: none;
  width: 100%;
  padding: 8px 12px;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}
@media(max-width:899px) { #quick-stats { display: flex; } }
.qs {
  font-size: var(--fs-xs);
  font-family: var(--mono);
  padding: 3px 9px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  gap: 5px;
  align-items: center;
}
.qs-l { color: var(--t3); }

/* ── MOBILE ACCORDION SECTIONS ── */
.mob-section { display: none; width: 100%; padding: 0 12px; }
@media(max-width:899px) { .mob-section { display: block; } }

.mob-hdr {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--t2);
  padding: 13px 0 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  margin-top: 2px;
  cursor: pointer;
  letter-spacing: .01em;
}
.mob-hdr .mh-left { display: flex; align-items: center; gap: 9px; }
.mob-hdr .mh-icon { font-size: var(--fs-lg); }
.mob-hdr .mh-arrow { font-size: var(--fs-xs); color: var(--t3); transition: transform .2s; }
.mob-hdr.collapsed .mh-arrow { transform: rotate(-90deg); }
.mob-body { max-height: 4000px; overflow: hidden; transition: max-height .35s ease; padding-bottom: 6px; }
.mob-body.hidden { max-height: 0 !important; padding-bottom: 0; }
#center-col::after { content: ''; display: block; height: 24px; flex-shrink: 0; }

/* ── RIGHT PANEL (desktop) ── */
#right-col {
  width: var(--right-w);
  min-width: var(--right-w);
  flex-shrink: 0;
  display: none;
  flex-direction: column;
  height: 100%;
  background: var(--bg2);
  border-left: 1px solid var(--border);
}
@media(min-width:900px) { #right-col { display: flex; } }

#rtabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg2);
}
.rtab {
  flex: 1;
  padding: 0;
  height: 44px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--t3);
  text-align: center;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  letter-spacing: .04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  gap: 4px;
}
.rtab.active { color: var(--green); border-bottom-color: var(--green); }
.rtab:hover:not(.active) { color: var(--t2); }
.rtab-icon { font-size: var(--fs-md); }
#right-scroll { flex: 1; min-height: 0; overflow-y: scroll; overflow-x: hidden; padding: 12px 12px 24px; }
#right-scroll::-webkit-scrollbar { width: 2px; }
#right-scroll::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }

/* ── DESKTOP BOTTOM STATUS BAR ── */
#save-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 36px;
  background: rgba(var(--bg-rgb),.97);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 200;
}
@media(max-width:899px) { #save-bar { display: none; } }
#save-status { font-size: var(--fs-xs); color: var(--t3); font-family: var(--mono); }
#save-status.saved { color: var(--green); }
.save-btns { display: flex; gap: 6px; align-items: center; }
.sbtn {
  padding: 4px 12px;
  border-radius: 5px;
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--t2);
  font-family: var(--mono);
  transition: border-color .15s, color .15s;
}
.sbtn:hover { border-color: var(--green); color: var(--green); }
.hud-pill {
  font-size: var(--fs-xs);
  font-family: var(--mono);
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.hp-lbl { color: var(--t3); font-size: var(--fs-xs); letter-spacing: .06em; text-transform: uppercase; }
.hp-val { font-weight: 700; }
.hp-rate { color: var(--blue); }
.hp-inf { color: var(--amber); }

/* ── MOBILE BOTTOM NAV ── */
#mob-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(var(--bg-rgb),.97);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 200;
  align-items: stretch;
}
@media(max-width:899px) { #mob-nav { display: flex; } }
.mnav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  color: var(--t3);
  border: none;
  background: none;
  font-family: var(--display);
  transition: color .15s;
  position: relative;
}
.mnav-btn.active { color: var(--green); }
.mnav-btn.active::before {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 2px;
  background: var(--green);
  border-radius: 0 0 3px 3px;
}
.mnav-icon { font-size: var(--fs-xl); line-height: 1; }
.mnav-lbl { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-family: var(--mono); }

/* ── SECTION LABELS ── */
.sec-t {
  font-size: var(--fs-xs);
  color: var(--t3);
  letter-spacing: .12em;
  text-transform: uppercase;
  font-family: var(--mono);
  margin: 12px 0 7px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sec-t::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── BUY CARDS ── */
.buy-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 11px 12px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color .15s, background .15s;
  position: relative;
  overflow: hidden;
}
.buy-card:hover:not(.locked) { border-color: var(--border2); background: var(--surface2); }
.buy-card.locked { opacity: .25; }
.buy-card.afford {
  border-color: rgba(var(--green-rgb),.2);
  background: linear-gradient(135deg, rgba(var(--green-rgb),.03), var(--surface));
}
.buy-card.afford::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(var(--green-rgb),.05), transparent);
  background-size: 200% 100%;
  animation: shim 2.5s infinite;
}
@keyframes shim { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }

.bi { font-size: var(--fs-xl); width: 28px; text-align: center; flex-shrink: 0; line-height: 1; }
.binfo { flex: 1; min-width: 0; }
.bname { font-size: var(--fs-sm); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; color: var(--t1); letter-spacing: .01em; }
.bsub { font-size: var(--fs-xs); color: var(--t3); font-family: var(--mono); }
.block-msg { font-size: var(--fs-xs); color: var(--t3); font-family: var(--mono); }
.bright { text-align: right; flex-shrink: 0; min-width: 70px; }
.binc { font-family: var(--mono); font-size: var(--fs-xs); color: var(--green); font-weight: 700; margin-bottom: 2px; }
.bown { font-size: var(--fs-xs); color: var(--t3); font-family: var(--mono); margin-bottom: 3px; }
.bbtns-row { display: flex; gap: 4px; align-items: center; justify-content: flex-end; margin-top: 3px; }

/* Buttons */
.bbtn {
  padding: 5px 11px;
  border-radius: 7px;
  font-size: var(--fs-xs);
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: var(--mono);
  white-space: nowrap;
  transition: transform .08s, filter .15s;
  touch-action: manipulation;
  letter-spacing: .02em;
}
.bbtn:active { transform: scale(.92); }
.bbtn.on { background: var(--green); color: var(--on-accent); }
.bbtn.on:hover { filter: brightness(1.1); }
.bbtn.off { background: var(--surface3); color: var(--t3); cursor: not-allowed; }
.bbtn.sell {
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(var(--red-rgb),.3);
  padding: 5px 9px;
  font-size: var(--fs-md);
  min-width: 30px;
}
.bbtn.sell:hover { background: rgba(var(--red-rgb),.1); border-color: var(--red); }
.bbtn.loan { background: var(--blue); color: #fff; }

/* ── UPGRADE CARDS ── */
.upg-cat-hdr {
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  font-family: var(--mono); margin: 12px 0 6px; padding: 0 2px;
  display: flex; align-items: center; gap: 8px;
}
.upg-cat-hdr::after { content:''; flex:1; height:1px; background:var(--border); }
.upg-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 10px 12px;
  margin-bottom: 5px;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: start;
  gap: 9px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
  overflow: hidden;
}
.upg-card:hover:not(.bought):not(.locked-u) { border-color: var(--border2); background: var(--surface2); }
.upg-card.bought { opacity: .35; pointer-events: none; }
.upg-card.locked-u { opacity: .25; pointer-events: none; }
.upg-card.afford-u { border-color: rgba(var(--amber-rgb),.3); background: linear-gradient(135deg, rgba(var(--amber-rgb),.04), var(--surface)); }
.ui { font-size: var(--fs-xl); padding-top: 1px; }
.uinfo { min-width: 0; }
.uname { font-size: var(--fs-sm); font-weight: 700; margin-bottom: 2px; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.udesc { font-size: var(--fs-xs); color: var(--t2); line-height: 1.45; font-family: var(--mono); }
.urisk { font-size: var(--fs-xs); color: var(--amber); margin-top: 3px; font-family: var(--mono); opacity: .8; }
.urisk::before { content: '⚠ '; }
.uright { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; min-width: 70px; }
.ucost { font-family: var(--mono); font-size: var(--fs-xs); color: var(--amber); font-weight: 700; }
.utag { font-size: var(--fs-xs); font-weight: 700; padding: 2px 6px; border-radius: 4px; background: rgba(var(--amber-rgb),.12); color: var(--amber); font-family: var(--mono); letter-spacing: .04em; white-space: nowrap; }
.utag.done { background: rgba(var(--green-rgb),.12); color: var(--green); }
.utag.locked-tag { background: rgba(var(--ink-rgb),.05); color: var(--t3); }

/* ── DEBT CARDS ── */
.dcard {
  background: var(--surface);
  border: 1px solid rgba(var(--red-rgb),.15);
  border-radius: var(--r-lg);
  padding: 12px;
  margin-bottom: 8px;
}
.dhdr { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; gap: 8px; }
.dname { font-size: var(--fs-sm); font-weight: 700; letter-spacing: .01em; }
.dapr { font-size: var(--fs-xs); color: var(--red); font-family: var(--mono); text-align: right; }
.dbar-wrap { background: var(--surface3); border-radius: 99px; height: 4px; margin-bottom: 8px; overflow: hidden; }
.dbar { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--red2), var(--red)); transition: width .5s; }
.dfooter { display: flex; justify-content: space-between; align-items: flex-end; }
.dbal { font-family: var(--mono); font-size: var(--fs-lg); color: var(--red); font-weight: 700; }
.dauto { font-size: var(--fs-xs); color: var(--t3); font-family: var(--mono); margin-top: 2px; }
.dbtns { display: flex; gap: 5px; flex-direction: column; align-items: flex-end; }
.dbtn { padding: 5px 11px; border-radius: 6px; font-size: var(--fs-xs); font-weight: 700; cursor: pointer; border: none; font-family: var(--mono); touch-action: manipulation; transition: filter .15s; }
.dbtn:hover { filter: brightness(1.1); }
.dbtn.chunk { background: var(--green); color: var(--on-accent); }
.dbtn.full { background: var(--red); color: #fff; }

/* ── STATS GRID ── */
.sgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.scard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; }
.slbl { font-size: var(--fs-xs); color: var(--t3); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; font-family: var(--mono); }
.sval { font-family: var(--mono); font-size: var(--fs-md); font-weight: 700; }
.sg { color: var(--green); } .sr { color: var(--red); } .sb { color: var(--blue); } .sgold { color: var(--amber); }

/* Credit score */
#cr-bar { height: 6px; border-radius: 99px; background: linear-gradient(90deg,var(--red),var(--amber),var(--green)); position: relative; margin: 8px 0 5px; }
#cr-needle { position: absolute; top: -5px; width: 16px; height: 16px; background: var(--t1); border-radius: 50%; transform: translateX(-50%); border: 2px solid var(--bg); transition: left .5s cubic-bezier(.4,0,.2,1); box-shadow: 0 0 8px rgba(var(--ink-rgb),.3); }
#cr-score-num { font-family: var(--mono); font-size: var(--fs-2xl); font-weight: 700; color: var(--blue); text-align: center; }

/* ── BADGES ── */
.badge-grid { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.badge {
  width: 42px; height: 42px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  position: relative;
  transition: border-color .15s;
}
.badge.earned { border-color: rgba(var(--amber-rgb),.4); background: rgba(var(--amber-rgb),.05); }
.badge.locked { opacity: .15; filter: grayscale(1); }
.badge-tt { position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%); background: var(--surface2); border: 1px solid var(--border2); border-radius: 6px; padding: 4px 9px; font-size: var(--fs-xs); white-space: nowrap; display: none; z-index: 10; color: var(--t2); font-family: var(--mono); }
.badge:hover .badge-tt { display: block; }


/* ── NOTIFICATION INBOX ── */
#inbox-btn {
  position: fixed;
  top: 14px;
  right: 8px;
  z-index: 300;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-lg);
  touch-action: manipulation;
  transition: border-color .15s;
}
#inbox-btn:hover { border-color: var(--green); }
#inbox-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--red); color: #fff;
  font-size: var(--fs-xs); font-weight: 800;
  width: 16px; height: 16px; border-radius: 50%;
  display: none; align-items: center; justify-content: center;
  font-family: var(--mono);
}
#inbox-panel {
  position: fixed;
  top: 56px; right: 4px;
  width: 300px; max-height: 420px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 16px;
  z-index: 500;
  display: none;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(var(--shade-rgb),0.44);
  overflow: hidden;
}
#inbox-panel.open { display: flex; }
#inbox-hdr {
  padding: 12px 14px 10px;
  font-size: var(--fs-xs); font-weight: 700; color: var(--t2);
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  flex-shrink: 0;
}
#inbox-hdr button { background: none; border: none; color: var(--t3); cursor: pointer; font-size: var(--fs-xs); font-family: var(--mono); }
#inbox-list {
  flex: 1; overflow-y: auto; padding: 6px 0;
}
#inbox-list::-webkit-scrollbar { width: 2px; }
#inbox-list::-webkit-scrollbar-thumb { background: var(--border2); }
.inbox-item {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-xs);
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 6px;
  align-items: start;
}
.inbox-item:last-child { border-bottom: none; }
.inbox-item.unread { background: rgba(var(--green-rgb),.03); }
.ii-icon { font-size: var(--fs-md); }
.ii-body { min-width: 0; }
.ii-title { font-weight: 700; color: var(--t1); margin-bottom: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ii-desc { color: var(--t3); font-family: var(--mono); line-height: 1.4; font-size: var(--fs-xs); }
.ii-amt { font-family: var(--mono); font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; }
.ii-amt.pos { color: var(--green); }
.ii-amt.neg { color: var(--red); }
.ii-time { font-size: var(--fs-xs); color: var(--t3); font-family: var(--mono); margin-top: 2px; }

/* ── GENERIC TOOLTIP ── */
#gen-tooltip {
  position: fixed;
  z-index: 600;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  padding: 9px 13px;
  max-width: 240px;
  pointer-events: none;
  display: none;
  font-size: var(--fs-xs);
  color: var(--t2);
  font-family: var(--mono);
  line-height: 1.55;
  box-shadow: 0 12px 40px rgba(var(--shade-rgb),0.413), 0 0 0 1px rgba(var(--ink-rgb),.04);
  white-space: pre-wrap;
  word-break: break-word;
}
@media(max-width:899px) { #gen-tooltip { display: none !important; } }

/* ── ASSET TOOLTIP ── */
#asset-tooltip {
  position: fixed;
  z-index: 100;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  max-width: 230px;
  pointer-events: none;
  display: none;
  box-shadow: 0 16px 48px rgba(var(--shade-rgb),0.44), 0 0 0 1px rgba(var(--ink-rgb),.04);
  /* Keep tooltip away from the buy button area by capping its position */
  max-height: 220px;
  overflow: hidden;
}
/* Disable tooltip on mobile */
@media(max-width:899px) { #asset-tooltip { display: none !important; } }
#asset-tooltip .tt-name { font-size: var(--fs-md); font-weight: 700; margin-bottom: 5px; letter-spacing: .01em; }
#asset-tooltip .tt-desc { font-size: var(--fs-xs); color: var(--t2); line-height: 1.5; margin-bottom: 8px; font-family: var(--mono); }
#asset-tooltip .tt-stat { font-size: var(--fs-xs); font-family: var(--mono); display: flex; justify-content: space-between; gap: 12px; margin-bottom: 3px; }
#asset-tooltip .tt-stat span:first-child { color: var(--t3); }
#asset-tooltip .tt-stat span:last-child { font-weight: 700; color: var(--green); }
#asset-tooltip .tt-flavor { font-size: var(--fs-xs); color: var(--t3); font-style: italic; margin-top: 7px; border-top: 1px solid var(--border); padding-top: 6px; line-height: 1.5; }

/* ── MODALS ── */
.modal-bg { position: fixed; inset: 0; background: rgba(var(--shade-rgb),0.468); display: none; align-items: center; justify-content: center; z-index: 800; padding: 20px; backdrop-filter: blur(4px); }
.mbox {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 80px rgba(var(--shade-rgb),0.44);
}
#ev-icon { font-size: 48px; margin-bottom: 12px; display: block; }
#ev-title { font-size: var(--fs-xl); font-weight: 800; margin-bottom: 6px; letter-spacing: -.01em; }
#ev-desc { font-size: var(--fs-md); color: var(--t2); line-height: 1.6; margin-bottom: 10px; }
#ev-amt { font-family: var(--mono); font-size: var(--fs-xl); font-weight: 700; margin-bottom: 18px; display: block; }
#ev-ok { width: 100%; padding: 13px; border-radius: 10px; font-size: var(--fs-lg); font-weight: 800; cursor: pointer; border: none; background: var(--green); color: var(--on-accent); font-family: var(--display); letter-spacing: -.01em; transition: filter .15s; }
#ev-ok:hover { filter: brightness(1.1); }

/* Celebrate overlay */
#celebrate { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 900; cursor: pointer; }
#cel-box {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 22px;
  padding: 30px 28px;
  text-align: center;
  max-width: 300px;
  animation: popin .35s cubic-bezier(.175,.885,.32,1.275);
  box-shadow: 0 0 0 1px rgba(var(--green-rgb),.1), 0 24px 80px rgba(var(--shade-rgb),0.495), 0 0 60px rgba(var(--green-rgb),.05);
  pointer-events: none;
}
@keyframes popin { 0% { transform: scale(.3); opacity: 0 } 100% { transform: scale(1); opacity: 1 } }
#cel-icon { font-size: 54px; margin-bottom: 10px; display: block; }
#cel-title { font-size: var(--fs-xl); font-weight: 800; color: var(--green); margin-bottom: 6px; letter-spacing: -.02em; }
#cel-sub { font-size: var(--fs-md); color: var(--t2); line-height: 1.5; }
#cel-dismiss { font-size: var(--fs-xs); color: var(--t3); margin-top: 10px; font-family: var(--mono); letter-spacing: .06em; }

/* Confetti */
.cf { position: fixed; pointer-events: none; z-index: 950; border-radius: 2px; animation: cfall linear forwards; margin-left: -17px; } /* pieces start at 0-100vw and are up to 12px wide (17px across when turned 45 degrees): never past the right edge */
@keyframes cfall { 0% { transform: translateY(-10px) rotate(0deg); opacity: 1 } 100% { transform: translateY(100vh) rotate(720deg); opacity: 0 } }

/* Prestige modal */
#prestige-modal { position: fixed; inset: 0; background: rgba(var(--shade-rgb),0.522); display: none; align-items: center; justify-content: center; z-index: 1100; padding: 16px; backdrop-filter: blur(10px); }
#prest-box {
  background: linear-gradient(160deg,#f1e7d0,#f1ead0);
  border: 1px solid rgba(var(--amber-rgb),.3);
  border-radius: 22px;
  padding: 30px 24px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  animation: popin .5s cubic-bezier(.175,.885,.32,1.275);
  box-shadow: 0 0 80px rgba(var(--amber-rgb),.1), 0 24px 80px rgba(var(--shade-rgb),0.495);
}
#prest-box h2 { font-size: var(--fs-2xl); font-weight: 800; color: var(--amber); margin-bottom: 5px; letter-spacing: -.02em; }
.prest-sub { font-size: var(--fs-md); color: var(--t2); margin-bottom: 18px; }
.prest-stats { text-align: left; margin-bottom: 16px; background: var(--surface); border-radius: var(--r-md); padding: 12px; }
.prest-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.prest-row:last-child { border-bottom: none; }
.pr-lbl { color: var(--t2); font-family: var(--mono); }
.pr-val { font-family: var(--mono); font-weight: 700; color: var(--amber); }
#prest-mult { font-size: var(--fs-md); color: var(--green); margin: 12px 0; font-weight: 700; font-family: var(--mono); }
.prest-btns { display: flex; gap: 8px; }
#prest-go { flex: 2; padding: 14px; border-radius: 11px; font-size: var(--fs-lg); font-weight: 800; cursor: pointer; border: none; background: var(--amber); color: var(--on-amber); font-family: var(--display); transition: filter .15s; }
#prest-go:hover { filter: brightness(1.1); }
#prest-stay { flex: 1; padding: 14px; border-radius: 11px; font-size: var(--fs-sm); cursor: pointer; border: 1px solid var(--border2); background: transparent; color: var(--t2); font-family: var(--display); }

/* Export modal */
#export-modal { position: fixed; inset: 0; background: rgba(var(--shade-rgb),0.484); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 16px; backdrop-filter: blur(4px); }
#exp-box { background: var(--surface); border: 1px solid var(--border2); border-radius: 18px; padding: 24px; max-width: 380px; width: 100%; box-shadow: 0 24px 80px rgba(var(--shade-rgb),0.44); }
#exp-box h3 { font-size: var(--fs-lg); font-weight: 700; margin-bottom: 6px; }
#exp-box p { font-size: var(--fs-xs); color: var(--t2); margin-bottom: 8px; font-family: var(--mono); }
#exp-code, #imp-code { width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; color: var(--t2); font-family: var(--mono); font-size: var(--fs-xs); padding: 9px; resize: none; }
#exp-code { height: 58px; margin-bottom: 8px; }
#imp-code { height: 48px; margin-bottom: 6px; }
.exp-btns { display: flex; gap: 6px; justify-content: flex-end; margin-top: 6px; }
.dl { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* Name modal */
#name-modal { position: fixed; inset: 0; background: rgba(var(--shade-rgb),0.451); display: none; align-items: center; justify-content: center; z-index: 900; padding: 20px; backdrop-filter: blur(4px); }
#name-box { background: var(--surface); border: 1px solid var(--border2); border-radius: 18px; padding: 26px; max-width: 320px; width: 100%; text-align: center; box-shadow: 0 24px 80px rgba(var(--shade-rgb),0.44); }
#name-box h3 { font-size: var(--fs-lg); font-weight: 700; margin-bottom: 6px; }
#name-box p { font-size: var(--fs-sm); color: var(--t2); margin-bottom: 16px; font-family: var(--mono); }
#name-input { width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: 9px; color: var(--t1); font-family: var(--mono); font-size: var(--fs-lg); padding: 12px; margin-bottom: 14px; text-align: center; outline: none; transition: border-color .2s; }
#name-input:focus { border-color: var(--green); }
.name-btns { display: flex; gap: 8px; }



/* ── ASSET PURCHASE BURST ── */
.asset-burst {
  position: absolute;
  font-size: var(--fs-xl);
  pointer-events: none;
  z-index: 50;
  animation: burstOrbit 1.8s cubic-bezier(.15,.85,.35,1) forwards;
  transform-origin: 50% 50%;
}
@keyframes burstOrbit {
  0%   { opacity: 1; transform: translate(0,0) scale(1.4); }
  30%  { opacity: 1; transform: var(--burst-mid) scale(1.1); }
  70%  { opacity: .9; transform: var(--burst-end) scale(.9); }
  100% { opacity: 0; transform: var(--burst-end) scale(.5); }
}

/* ── PRESTIGE COSMETIC BADGES ── */
.prestige-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 14px 0;
}
.pb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--t3);
  font-family: var(--mono);
  min-width: 60px;
  transition: border-color .2s;
}
.pb.earned {
  border-color: rgba(var(--amber-rgb),.5);
  background: linear-gradient(135deg, rgba(var(--amber-rgb),.07), var(--surface));
  color: var(--amber);
}
.pb.earned .pb-icon { filter: none; }
.pb-icon { font-size: var(--fs-2xl); filter: grayscale(1) opacity(.3); }
.pb.earned .pb-icon { filter: none; }
.pb-name { text-align: center; line-height: 1.3; }

/* Share panel */
#share-panel {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 14px;
  margin-top: 12px;
}
#share-panel h4 { font-size: var(--fs-sm); font-weight: 700; margin-bottom: 10px; color: var(--t2); letter-spacing: .04em; text-transform: uppercase; font-family: var(--mono); }
.share-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.share-btn {
  flex: 1;
  min-width: 80px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: var(--fs-xs);
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--t2);
  font-family: var(--mono);
  transition: border-color .15s, color .15s, background .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  touch-action: manipulation;
}
.share-btn:hover { border-color: var(--green); color: var(--green); background: rgba(var(--green-rgb),.05); }
.share-btn.copied { border-color: var(--green); color: var(--green); }

#fire-streak-lbl { font-size: var(--fs-xs); color: var(--t3); font-family: var(--mono); text-align: center; }

/* ── PWA INSTALL BANNER ── */
#pwa-banner {
  position: fixed;
  bottom: calc(var(--nav-h) + 10px);
  left: 12px; right: 12px;
  z-index: 1200;
  animation: pwaSlideUp .4s cubic-bezier(.175,.885,.32,1.275);
}
@media(min-width:900px) {
  #pwa-banner { bottom: 46px; left: auto; right: 14px; width: 330px; }
}
@keyframes pwaSlideUp {
  0% { opacity:0; transform:translateY(24px); }
  100% { opacity:1; transform:translateY(0); }
}
#pwa-banner-inner {
  background: var(--surface2);
  border: 1px solid rgba(var(--green-rgb),.3);
  border-radius: 16px;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 32px rgba(var(--shade-rgb),0.413), 0 0 0 1px rgba(var(--green-rgb),.06);
}
#pwa-b-icon { font-size: var(--fs-2xl); flex-shrink:0; line-height:1; }
#pwa-b-text { flex:1; min-width:0; }
#pwa-b-title { font-size:var(--fs-md); font-weight:800; color:var(--t1); letter-spacing:-.01em; }
#pwa-b-sub { font-size:var(--fs-xs); color:var(--t3); font-family:var(--mono); margin-top:1px; }#pwa-install-btn {
  flex-shrink:0; padding:7px 13px; border-radius:8px;
  background:var(--green); color:var(--on-accent); font-family:var(--mono);
  font-size:var(--fs-sm); font-weight:700; border:none; cursor:pointer;
  touch-action:manipulation; transition:filter .15s; white-space:nowrap;
}
#pwa-install-btn:hover { filter:brightness(1.1); }
#pwa-dismiss-btn {
  flex-shrink:0; background:none; border:none; color:var(--t3);
  font-size:var(--fs-lg); cursor:pointer; padding:4px 2px;
  touch-action:manipulation; transition:color .15s; line-height:1;
}
#pwa-dismiss-btn:hover { color:var(--t1); }

/* ── iOS instruction sheet ── */
#pwa-ios-sheet {
  position:fixed; inset:0;
  background:rgba(var(--shade-rgb),0.451);
  backdrop-filter:blur(6px);
  z-index:2100;
  display:flex; align-items:flex-end; justify-content:center;
  padding:0 12px 16px;
}
#pwa-ios-box {
  background:var(--surface2);
  border:1px solid var(--border2);
  border-radius:22px;
  padding:28px 22px 22px;
  width:100%; max-width:380px;
  text-align:center;
  animation:pwaSlideUp .35s cubic-bezier(.175,.885,.32,1.275);
  box-shadow:0 0 80px rgba(var(--green-rgb),.08), 0 24px 80px rgba(var(--shade-rgb),0.495);
}
.pwa-ios-step {
  display:flex; align-items:flex-start; gap:12px;
  text-align:left; margin-bottom:12px;
  font-size:var(--fs-md); color:var(--t2); line-height:1.55;
  font-family:var(--mono);
}
.pwa-ios-num {
  flex-shrink:0; width:22px; height:22px; border-radius:50%;
  background:var(--green); color:var(--on-accent); font-size:var(--fs-xs); font-weight:800;
  display:flex; align-items:center; justify-content:center; margin-top:2px;
}
/* ── ONBOARDING COACH CARD ── */
#onb-card{position:fixed;left:50%;bottom:64px;transform:translateX(-50%);width:min(420px,calc(100vw - 24px));z-index:900;
  background:var(--surface2);border:1px solid var(--green);border-radius:14px;padding:14px 16px;box-shadow:0 10px 40px rgba(var(--shade-rgb),.3);
  font-family:inherit;color:var(--t1);animation:onbIn .35s ease-out;}
@keyframes onbIn{from{opacity:0;transform:translate(-50%,12px)}to{opacity:1;transform:translate(-50%,0)}}
#onb-card .onb-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;}
#onb-card .onb-count{font-family:var(--mono);font-size:var(--fs-xs);letter-spacing:.12em;color:var(--green);}
#onb-card .onb-skip{background:none;border:0;color:var(--t3);font-size:var(--fs-xs);cursor:pointer;padding:2px 0;}
#onb-card .onb-skip:hover{color:var(--t1);}
#onb-card .onb-title{font-weight:700;font-size:var(--fs-lg);margin-bottom:4px;}
#onb-card .onb-text{font-size:var(--fs-md);line-height:1.5;color:var(--t2);}
#onb-card .onb-text b{color:var(--green);font-family:var(--mono);}
#onb-card .onb-next{margin-top:10px;background:var(--green);color:var(--on-accent);border:0;border-radius:8px;padding:7px 14px;font-weight:700;font-size:var(--fs-md);cursor:pointer;}
@media (max-width:768px){#onb-card{bottom:84px;}}
/* Highlights: classes on <body>, so re-rendered cards stay highlighted. */
@keyframes onbPulse{0%,100%{box-shadow:0 0 0 0 var(--green3)}50%{box-shadow:0 0 0 8px transparent}}
body.onb-tap #tap-btn{animation:onbPulse 1.4s infinite;}
body.onb-buy [data-asset="hysa"]{outline:2px solid var(--green);outline-offset:2px;animation:onbPulse 1.4s infinite;}
body.onb-income #hud-income{outline:2px solid var(--green);outline-offset:4px;border-radius:8px;}
body.onb-goal #hud-center{outline:2px solid var(--green);outline-offset:4px;border-radius:8px;}
/* A calm first screen: during the first two steps (tap, then buy a first asset) the
   market ticker, inbox, daily-bonus badge, event countdown, quote and auto-earner
   wait until the first asset is bought (the listings board too: 36-listings.js).
   The ticker, inbox and badge keep their space, so nothing moves when they appear. */
body.onb-tap #ticker-track, body.onb-buy #ticker-track,
body.onb-tap #inbox-btn, body.onb-buy #inbox-btn,
body.onb-tap #daily-badge, body.onb-buy #daily-badge { visibility: hidden; }
body.onb-tap #season-banner, body.onb-buy #season-banner,
body.onb-tap #hud-flavor-inline, body.onb-buy #hud-flavor-inline,
body.onb-tap [data-asset="bot"], body.onb-buy [data-asset="bot"] { display: none; }

/* ── ROOT CELLAR COMPONENT LAYER ──
   Loaded last: refines the legacy component rules for the illustrated farm look.
   Sky across the top, meadow in the middle, parchment side panels with soil
   edges, chunky "press me" buttons, Fredoka for titles. */

/* Sky band across the top */
#hud {
  background: linear-gradient(180deg, #cfeaf6 0%, #e3f2f4 100%);
  border-bottom: 3px solid var(--soil);
}
#ticker-strip {
  background: var(--surface2);
  border-bottom: 2px solid var(--border2);
}
body::before { opacity: .035; } /* paper grain */

/* Parchment side panels */
#left-col, #right-col {
  background: var(--surface2);
  border-color: var(--border2);
}
#left-col { border-right: 3px solid var(--soil); }
#right-col { border-left: 3px solid var(--soil); }
#rtabs { background: var(--surface3); }
.rtab { font-family: var(--heading); font-weight: 600; letter-spacing: .02em; }

/* Titles in Fredoka */
#fund-name-text, .bname, .upg-card .uname, .mob-hdr, #ev-title, .cel-title,
#prestige-modal h2, .modal-title, #onb-card .onb-title {
  font-family: var(--heading);
  font-weight: 600;
  letter-spacing: 0;
}

/* Cards: warm paper with a soft edge */
.buy-card, .upg-card, .debt-card {
  background: var(--surface);
  border: 2px solid #e2d3b2;
  border-radius: 14px;
}
.buy-card:hover:not(.locked), .upg-card:hover:not(.bought):not(.locked-u) {
  background: #fffaf0;
  border-color: #d5bf92;
}
.buy-card.afford { border-color: rgba(var(--green-rgb), .45); }
.bsub, .udesc { font-family: var(--display); font-weight: 600; color: var(--t2); }

/* Chunky buttons with a pressed state */
.bbtn, .dbtn, #ev-ok, #prest-go, #onb-card .onb-next {
  font-family: var(--heading);
  font-weight: 600;
  border-radius: 10px;
  letter-spacing: .01em;
}
.bbtn.on, .dbtn.chunk, #ev-ok { box-shadow: 0 3px 0 var(--green2); }
.dbtn.full { box-shadow: 0 3px 0 var(--red2); }
.bbtn.loan { box-shadow: 0 3px 0 var(--blue2); }
.bbtn.on:active, .dbtn:active, #ev-ok:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--green2); }
.bbtn.off { background: var(--surface3); color: var(--t3); box-shadow: none; }

/* Holdings rows in the left panel */
.acol-row { border-bottom: 1px dashed var(--border2); }
.acol-row:hover { background: #fffaf0; }

/* Mobile accordion headers read as wooden shelf labels */
.mob-hdr { background: var(--surface2); border-bottom: 2px solid var(--border2); }

/* Modals use .mbox inside each overlay */
.mbox {
  background: var(--surface);
  border: 3px solid var(--soil);
  box-shadow: 0 20px 60px rgba(var(--shade-rgb), .35);
}

/* Readable cards: titles wrap instead of truncating, small text at least 11px */
.uname { white-space: normal; overflow: visible; text-overflow: clip; font-size: var(--fs-md); line-height: 1.2; }
.udesc { font-size: var(--fs-sm); line-height: 1.45; }
.urisk { font-size: var(--fs-sm); font-family: var(--display); opacity: 1; color: var(--amber2); }
/* Upgrade cards: icon | text, with the effect tag and price on a row underneath */
.upg-card { grid-template-columns: 32px 1fr; }
.uright { grid-column: 2; min-width: 0; flex-direction: row; justify-content: space-between; align-items: center; margin-top: 6px; }
.utag { font-size: var(--fs-xs); white-space: normal; text-align: left; font-family: var(--display); font-weight: 800; }
.ucost { font-size: var(--fs-md); }
.bname { font-size: var(--fs-md); line-height: 1.2; }
.bsub { font-size: var(--fs-sm); line-height: 1.4; }
.binc, .bown { font-size: var(--fs-sm); }

/* Drawn icons (see game/icons.svg). Sized by the surrounding font-size, like the emoji they replace. */
.ic { display: inline-block; width: 1.15em; height: 1.15em; vertical-align: -.22em; flex-shrink: 0; overflow: visible; }
.bi { font-size: var(--fs-2xl); width: 36px; }
.ui { font-size: var(--fs-2xl); }
.bname { white-space: normal; overflow: visible; text-overflow: clip; }

/* HUD and cash hierarchy */
#cash-lbl { font-size: var(--fs-xs); font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--t3); text-align: center; margin-bottom: -2px; }
#cash-ps-line { font-weight: 700; }
#hud-nw-lbl, #hud-income-lbl, #fire-label { font-weight: 800; color: var(--t3); }
#net-worth-val { font-size: clamp(17px, 4.4vw, 26px); font-weight: 800; text-overflow: clip; }
.tick-item { font-weight: 700; }
/* Ticker text on parchment: darker shades of the label and market colours, so the
   small bold values pass WCAG AA contrast (4.5:1 on --surface2). */
.tick-label { color: var(--t2); }
.ti-up { color: #2c6e1c; } .ti-dn { color: #a3341f; } .ti-neu { color: #8a5a0e; }
#hud-nw-lbl, #hud-income-lbl, .hud-nw-lbl, .hud-income-lbl { white-space: nowrap; letter-spacing: .08em; }

/* The news headline sits on its own backing so it never overprints the ticker values. */
#news-ticker-text { padding: 0 10px 0 28px; background: linear-gradient(to right, transparent, var(--bg2) 22px); z-index: 1; }
#news-ticker-text:empty { display: none; }

/* Desktop status bar: leave room for the sound button and volume slider at the bottom left. */
#save-bar { padding-left: 170px; }

/* Reset is a quiet link, well away from Export, so it is never tapped by mistake. */
.reset-link { display: block; margin: 22px auto 4px; background: none; border: 0; color: var(--red); font-size: var(--fs-xs); font-family: var(--mono); text-decoration: underline; cursor: pointer; opacity: .8; }
.reset-link:hover { opacity: 1; }

/* Return, payback and tax on every buy card (phones have no hover tooltip). */
.bstats { font-size: var(--fs-xs); color: var(--t3); font-family: var(--mono); margin-top: 2px; line-height: 1.35; }

/* Retirement perk picker */
#prest-perks:empty { display: none; }
#prest-perks { margin: 10px 0 4px; }
.perk-t { font-size: var(--fs-xs); color: var(--t2); text-align: center; margin-bottom: 6px; font-weight: 700; }
.perk-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.perk { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left; padding: 8px 10px; border-radius: 10px; border: 1.5px solid var(--border2); background: var(--surface); color: var(--t1); cursor: pointer; font-family: inherit; }
.perk b { font-size: var(--fs-sm); }
.perk span:last-child { font-size: var(--fs-xs); color: var(--t2); }
.perk-i { font-size: var(--fs-lg); }
.perk.on { border-color: var(--green); background: rgba(var(--green-rgb), .1); }

/* Registered accounts (06b-accounts.js) */
.acct-panel { margin-bottom: 8px; }
.acct-wallet { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 6px; }
.acct-wl { font-size: var(--fs-xs); color: var(--t3); font-family: var(--mono); margin-right: 2px; }
.acct-wb { border: 1.5px solid var(--border2); background: var(--surface); color: var(--t1); border-radius: 999px; padding: 4px 9px; font-size: var(--fs-xs); font-weight: 700; cursor: pointer; font-family: inherit; }
.acct-wb small { color: var(--t3); font-weight: 400; font-size: inherit; }
.acct-wb.on { border-color: var(--green); background: rgba(var(--green-rgb), .12); }
.acct-det { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 6px 10px; }
.acct-det summary { cursor: pointer; font-size: var(--fs-sm); font-weight: 700; }
.acct-card { border-top: 1px dashed var(--border); padding: 8px 0; }
.acct-h { display: flex; justify-content: space-between; font-size: var(--fs-sm); }
.acct-h span { font-family: var(--mono); color: var(--green); }
.acct-l, .acct-r { font-size: var(--fs-xs); color: var(--t3); font-family: var(--mono); margin-top: 2px; }
.acct-r { font-family: inherit; color: var(--t2); }
.acct-b { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.acct-b .bbtn { font-size: var(--fs-xs); padding: 4px 9px; }
.acol-acct { font-size: var(--fs-xs); color: var(--blue); font-family: var(--mono); }

/* Insurance (15b-insurance.js) */
.ins-panel { margin-top: 12px; }
.ins-tot { float: right; font-family: var(--mono); color: var(--t2); font-weight: 400; }
.ins-row { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); margin-bottom: 5px; }
.ins-row.on { border-color: var(--green); background: rgba(var(--green-rgb), .06); }
.ins-i { font-size: var(--fs-lg); }
.ins-b { flex: 1; font-size: var(--fs-sm); }
.ins-p { font-family: var(--mono); font-size: var(--fs-xs); color: var(--t3); }
.ins-d { font-size: var(--fs-xs); color: var(--t2); margin-top: 2px; }
.ins-warn { font-size: var(--fs-xs); color: var(--amber); font-weight: 700; margin-top: 2px; }
.ins-row .bbtn { font-size: var(--fs-xs); padding: 4px 9px; white-space: nowrap; }

/* UX pass (2026-10-25) */
#next-move { display: block; margin: 6px auto 0; max-width: min(560px, 94%); padding: 7px 12px; border-radius: 12px; border: 1.5px dashed var(--border2); background: var(--surface); color: var(--t1); font: inherit; font-size: var(--fs-sm); line-height: 1.35; cursor: default; text-align: center; }
#next-move.ready { border: 2px solid var(--green); background: rgba(var(--green-rgb), .08); cursor: pointer; }
#next-move.ready:hover { background: rgba(var(--green-rgb), .15); }
#next-move .nm-l { display: block; font-size: var(--fs-xs); color: var(--t3); text-transform: uppercase; letter-spacing: .08em; font-family: var(--mono); }
#next-move .nm-g { color: var(--green2); }
#next-move .nm-go { display: block; font-size: var(--fs-xs); font-weight: 700; color: var(--green2); font-family: var(--mono); }
#next-move:not(.ready) .nm-go { color: var(--t3); }
.ins-rec { font-size: var(--fs-xs); font-weight: 700; color: var(--green2); background: rgba(var(--green-rgb), .12); border-radius: 999px; padding: 1px 7px; }
.ins-more summary { cursor: pointer; font-size: var(--fs-sm); font-weight: 700; color: var(--t2); margin: 6px 0; }
@media (pointer: coarse) { .acct-det summary, .ins-more summary { padding: 6px 0; } }
.bbtn.worn { background: var(--surface2); color: var(--green2); border: 1.5px solid var(--green); }
/* Desktop: a wider right panel so labels and buttons stop wrapping. */
@media (min-width: 900px) { :root { --right-w: clamp(320px, 26vw, 420px); } }
/* Upgrade prices look like buttons. */
/* Toasts: hidden while the inbox is open; on phones they sit above the bottom tabs. */
body:has(#inbox-panel.open) #toasts { display: none; }
/* Toasts sit at the bottom, clear of the cash number and the HUD. */
body #toasts { top: auto; bottom: 48px; flex-direction: column-reverse; }
@media (max-width: 899px) { body #toasts { bottom: calc(var(--nav-h) + 10px); } }
/* Phones: room under Potato Town for the sound button and the bottom tabs. */
@media (max-width: 899px) { #town { padding-bottom: 64px; } }
/* Fingers need 44px targets. */
@media (pointer: coarse) {
  .bbtn, .dbtn, .acct-wb, .onb-skip, #inbox-btn, #sfx-btn, .sbtn, .perk, .reset-link, .mp-link { min-height: 44px; }
  .bbtn, .dbtn, #inbox-btn, #sfx-btn { min-width: 44px; }
  #inbox-hdr button { min-height: 32px; padding: 0 10px; }
  .guide-link { display: inline-flex; align-items: center; min-height: 32px; }
  #hud-income { padding-right: 58px; } /* the 44px bell sits over the income otherwise */
}
.urisk { color: var(--t3); font-style: italic; } .urisk::before { content: ''; }

/* Goals and money cards (29-goals.js) */
#goal-card { display: block; margin: 6px auto 0; max-width: min(560px, 94%); padding: 6px 12px; border-radius: 12px; border: 1.5px solid var(--amber); background: rgba(var(--amber-rgb), .1); color: var(--t1); font: inherit; font-size: var(--fs-sm); line-height: 1.35; cursor: pointer; text-align: center; }
#goal-card[hidden] { display: none; }
#goal-card .gc-l { display: block; font-size: var(--fs-xs); color: var(--amber2); text-transform: uppercase; letter-spacing: .08em; font-family: var(--mono); }
#goal-card .gc-r { display: block; font-size: var(--fs-xs); color: var(--t2); font-family: var(--mono); }
.town-btns { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.town-btns .mp-open { margin: 2px 0 8px; }
.goal-list { list-style: none; padding: 0; margin: 8px 0 0; }
.goal-list li { display: flex; gap: 10px; padding: 8px 6px; border-bottom: 1px dashed var(--border); opacity: .55; }
.goal-list li.done { opacity: .8; }
.goal-list li.now { opacity: 1; background: rgba(var(--amber-rgb), .1); border-radius: 8px; }
.goal-list small { display: block; color: var(--t2); font-size: var(--fs-xs); }
.card-grid-g { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 8px; }
.mcard { display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 2px solid var(--soil); border-radius: 12px; background: var(--surface); color: var(--t1); text-decoration: none; box-shadow: 0 3px 0 rgba(var(--shade-rgb), .15); }
.mcard small { font-size: var(--fs-xs); color: var(--t2); }
.mcard.locked { border-style: dashed; opacity: .55; box-shadow: none; }
.mc-i { font-size: 26px; }
.mc-more { font-size: var(--fs-xs); color: var(--green2); font-weight: 700; margin-top: auto; }
/* Seasonal events (15c-seasons.js) */
#season-banner { margin: 6px auto 0; max-width: min(560px, 94%); font-size: var(--fs-sm); text-align: center; border-radius: 12px; }
#season-banner:empty { display: none; }
#season-banner.soon { font-size: var(--fs-xs); color: var(--t3); }
#season-banner.on { padding: 7px 12px; background: rgba(var(--blue-rgb), .1); border: 1.5px solid var(--blue); }
#season-banner small { display: block; color: var(--t2); font-size: var(--fs-xs); margin-top: 2px; }
#season-banner .bbtn { margin-left: 6px; font-size: var(--fs-xs); padding: 3px 9px; }
/* Tap combo (09-actions.js) */
#tap-btn { position: relative; }
#combo { position: absolute; left: 50%; top: -10px; transform: translate(-50%, -100%) scale(.8); opacity: 0; pointer-events: none; padding: 3px 10px; border-radius: 999px; font: 800 var(--fs-sm) var(--heading); color: #fff; background: linear-gradient(90deg, var(--amber) calc(var(--combo, 0) * 100%), var(--green) 0); box-shadow: 0 3px 0 rgba(var(--shade-rgb), .2); transition: opacity .2s, transform .2s; white-space: nowrap; }
#combo.on { opacity: 1; transform: translate(-50%, -100%) scale(1); }
/* Stocks and quiz */
.stock-det { margin: 8px 0; }
.stock-det .buy-card { margin-top: 6px; }
.stock-info { font-size: var(--fs-xs); color: var(--t3); font-family: var(--mono); margin-top: 2px; }
.stock-info a { color: var(--green2); }
.quiz-q { font-weight: 700; margin: 8px 0 10px; }
.quiz-a { display: flex; flex-direction: column; gap: 6px; }
.quiz-a .sbtn { text-align: left; padding: 10px 12px; font-size: var(--fs-sm); }
.quiz-res.ok { color: var(--green2); font-weight: 700; }
.quiz-res.no { color: var(--red); font-weight: 700; }
.quiz-why { font-size: var(--fs-sm); color: var(--t2); }
.mp-open.pulse { border-color: var(--amber); box-shadow: 0 3px 0 rgba(var(--amber-rgb), .4); }
#prest-career:empty { display: none; } #prest-career { margin: 10px 0 4px; }
/* Phones: net worth needs more room than income ("−$563.9k", "NET WORTH"); the FIRE
   streak timer widens the centre, which clipped both. */
@media (max-width: 600px) {
  #hud-nw { flex: 1.5 1 0; padding-left: 10px; }
  #hud-income { flex: 1 1 0; }
  #hud-center { padding: 0 2px; }
  #fire-label { letter-spacing: .03em; gap: 3px; }
  #net-worth-val { font-size: clamp(15px, 4.6vw, 20px); }
}
/* Phones: the four wallet chips in one swipeable row instead of wrapping FHSA onto its own line. */
@media (max-width: 600px) {
  .acct-wallet { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .acct-wallet::-webkit-scrollbar { display: none; }
  .acct-wb { flex: 0 0 auto; }
}
/* Buy-list groups (10-render.js BUY_GROUPS) */
.buy-grp { margin-top: 8px; padding: 6px 8px; }
.buy-grp > summary { padding: 4px 2px; list-style-position: inside; }
.buy-grp > summary small { color: var(--t3); font-weight: 400; margin-left: 4px; }
.buy-grp[open] > summary { margin-bottom: 6px; }
.buy-grp .buy-card { margin-bottom: 8px; }

/* ── SPUD: the tap button ── */
#tap-btn {
  background: radial-gradient(circle at 50% 36%, #fffaf0 0%, #f6e7c6 55%, #e6cd9c 100%);
  border: 4px solid var(--soil);
  box-shadow: 0 6px 0 #4a3220, 0 14px 30px rgba(var(--shade-rgb), .22);
}
#tap-btn:hover { box-shadow: 0 6px 0 #4a3220, 0 0 0 10px rgba(var(--green-rgb), .12), 0 14px 30px rgba(var(--shade-rgb), .22); }
#tap-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #4a3220, 0 8px 20px rgba(var(--shade-rgb), .2); }
#tap-btn.daily-active {
  background: radial-gradient(circle at 50% 36%, #fff6dd 0%, #fbe1a6 55%, #f0c46a 100%);
  box-shadow: 0 6px 0 #4a3220, 0 0 0 8px rgba(var(--amber-rgb), .25), 0 14px 30px rgba(var(--shade-rgb), .22);
}
#tap-btn::before, #tap-btn::after { display: none; }
#tap-icon { font-size: 0; line-height: 0; margin-bottom: 2px; }
#spud { display: block; overflow: visible; margin-top: -18px; }
#tap-lbl { color: var(--soil); font-family: var(--heading); font-weight: 600; letter-spacing: .08em; }
#tap-val { color: var(--green2); font-family: var(--heading); font-weight: 700; }

/* Moods */
#spud .sp-m-happy, #spud .sp-m-worried, #spud .sp-brows, #spud .sp-sweat, #spud .sp-hat { display: none; }
#tap-btn.mood-happy #spud .sp-m-neutral { display: none; }
#tap-btn.mood-happy #spud .sp-m-happy { display: inline; }
#tap-btn.mood-worried #spud .sp-m-neutral { display: none; }
#tap-btn.mood-worried #spud .sp-m-worried,
#tap-btn.mood-worried #spud .sp-brows,
#tap-btn.mood-worried #spud .sp-sweat { display: inline; }
#tap-btn.has-hat #spud .sp-hat { display: inline; }
#tap-btn.has-hat #spud .sp-sprout { display: none; }

@media (prefers-reduced-motion: no-preference) {
  #spud { animation: spudBob 3.2s ease-in-out infinite; transform-origin: 50% 95%; }
  #spud .sp-eyes { animation: spudBlink 4.6s infinite; transform-box: fill-box; transform-origin: center; }
  #spud .sp-sweat { animation: spudSweat 1.6s ease-in infinite; }
  #spud.squish { animation: spudSquish .28s ease-out, spudBob 3.2s ease-in-out .28s infinite; }
}
@keyframes spudBob { 50% { transform: translateY(-4px) rotate(-1.5deg); } }
@keyframes spudBlink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@keyframes spudSweat { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(10px); opacity: 0; } }
@keyframes spudSquish { 0% { transform: scale(1.14, .84); } 55% { transform: scale(.94, 1.07); } 100% { transform: scale(1); } }

/* ── MOBILE TABS ──
   body[data-mob-view] is set by mobNav (19-mobile-nav.js). Each tab shows
   only its sections; Spud's tap area shows on the Tap tab only. */
@media (max-width: 899px) {
  body[data-mob-view] .mob-section { display: none; }
  body[data-mob-view="tap"] .mob-section[data-tab="tap"],
  body[data-mob-view="buy"] .mob-section[data-tab="buy"],
  body[data-mob-view="debt"] .mob-section[data-tab="debt"],
  body[data-mob-view="stats"] .mob-section[data-tab="stats"],
  body[data-mob-view="save"] .mob-section[data-tab="save"] { display: block; }
  body[data-mob-view]:not([data-mob-view="tap"]) #center-top,
  body[data-mob-view]:not([data-mob-view="tap"]) #quick-stats { display: none; }
  body[data-mob-view]:not([data-mob-view="tap"]) #center-col { padding-top: 12px; }
}

/* ── EVENTS AS WEATHER ──
   The event card gets a sky header: storm for losses, sun for gains, clouds
   for news. #event-modal[data-weather] is set by showEv. */
#event-modal .mbox { overflow: hidden; padding-top: 0; }
#ev-sky { height: 96px; margin: 0 -24px 0; background: linear-gradient(180deg, #cfe6f2, #eef6f0); background-repeat: no-repeat; background-size: cover; border-bottom: 3px solid var(--soil); }
#event-modal[data-weather="storm"] #ev-sky { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 400 100%22 preserveAspectRatio=%22xMidYMid slice%22%3E%3Cg fill=%22%237d8ea3%22%3E%3Ccircle cx=%2270%22 cy=%2240%22 r=%2226%22/%3E%3Ccircle cx=%22105%22 cy=%2230%22 r=%2232%22/%3E%3Ccircle cx=%22145%22 cy=%2244%22 r=%2224%22/%3E%3Crect x=%2260%22 y=%2240%22 width=%22100%22 height=%2226%22 rx=%2213%22/%3E%3C/g%3E%3Cg fill=%22%236a7b90%22%3E%3Ccircle cx=%22270%22 cy=%2234%22 r=%2224%22/%3E%3Ccircle cx=%22305%22 cy=%2226%22 r=%2230%22/%3E%3Ccircle cx=%22340%22 cy=%2240%22 r=%2222%22/%3E%3Crect x=%22260%22 y=%2236%22 width=%2296%22 height=%2224%22 rx=%2212%22/%3E%3C/g%3E%3Cg stroke=%22%238fd3ff%22 stroke-width=%224%22 stroke-linecap=%22round%22%3E%3Cpath d=%22M80 78l-6 14M110 78l-6 14M140 78l-6 14M280 72l-6 14M310 72l-6 14M340 72l-6 14%22/%3E%3C/g%3E%3Cpath d=%22M205 18l-14 30h14l-8 26 24-36h-14l8-20z%22 fill=%22%23f6c94a%22 stroke=%22%236b4a2b%22 stroke-width=%223%22 stroke-linejoin=%22round%22/%3E%3C/svg%3E"), linear-gradient(180deg, #a9b8c8, #d3dde6); }
#event-modal[data-weather="sun"] #ev-sky { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 400 100%22 preserveAspectRatio=%22xMidYMid slice%22%3E%3Cg stroke=%22%23f6b73c%22 stroke-width=%225%22 stroke-linecap=%22round%22%3E%3Cpath d=%22M200 2v12M200 86v12M150 50h12M238 50h12M165 15l8 8M227 77l8 8M165 85l8-8M227 23l8-8%22/%3E%3C/g%3E%3Ccircle cx=%22200%22 cy=%2250%22 r=%2226%22 fill=%22%23f6c94a%22 stroke=%22%23d98a1c%22 stroke-width=%223%22/%3E%3Cg fill=%22%23fff%22%3E%3Ccircle cx=%2260%22 cy=%2258%22 r=%2216%22/%3E%3Ccircle cx=%2282%22 cy=%2250%22 r=%2220%22/%3E%3Ccircle cx=%22104%22 cy=%2260%22 r=%2214%22/%3E%3Crect x=%2250%22 y=%2258%22 width=%2264%22 height=%2216%22 rx=%228%22/%3E%3Ccircle cx=%22320%22 cy=%2240%22 r=%2213%22/%3E%3Ccircle cx=%22338%22 cy=%2234%22 r=%2216%22/%3E%3Ccircle cx=%22356%22 cy=%2242%22 r=%2211%22/%3E%3Crect x=%22310%22 y=%2240%22 width=%2254%22 height=%2213%22 rx=%226.5%22/%3E%3C/g%3E%3C/svg%3E"), linear-gradient(180deg, #bfe3f2, #fff3cf); }
#event-modal[data-weather="cloud"] #ev-sky { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 400 100%22 preserveAspectRatio=%22xMidYMid slice%22%3E%3Cg fill=%22%23fff%22%3E%3Ccircle cx=%2290%22 cy=%2252%22 r=%2218%22/%3E%3Ccircle cx=%22116%22 cy=%2242%22 r=%2224%22/%3E%3Ccircle cx=%22142%22 cy=%2254%22 r=%2216%22/%3E%3Crect x=%2276%22 y=%2252%22 width=%2280%22 height=%2218%22 rx=%229%22/%3E%3Ccircle cx=%22280%22 cy=%2244%22 r=%2215%22/%3E%3Ccircle cx=%22302%22 cy=%2236%22 r=%2220%22/%3E%3Ccircle cx=%22324%22 cy=%2246%22 r=%2213%22/%3E%3Crect x=%22268%22 y=%2244%22 width=%2268%22 height=%2215%22 rx=%227.5%22/%3E%3C/g%3E%3C/svg%3E"), linear-gradient(180deg, #cfe6f2, #eef6f0); }
#ev-icon { position: relative; display: inline-grid; place-items: center; width: 64px; height: 64px; margin: -34px auto 10px; border-radius: 50%; background: var(--surface); border: 3px solid var(--soil); font-size: 34px; line-height: 1; }
@media (prefers-reduced-motion: no-preference) {
  #event-modal[data-weather] #ev-sky { animation: skyDrift 9s linear infinite alternate; }
}
@keyframes skyDrift { from { background-position: 0 0, 0 0; } to { background-position: 24px 0, 0 0; } }

/* ── POTATO TOWN ── */
/* The town replaces the old orbit of emoji around Spud. */
#orbit-wrap, #orbit-ring, #orbit-ring-2, .orbit-ring-asset { display: none; }

#town { width: 100%; max-width: 460px; margin: 6px auto 0; }
.town-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 10px; }
.town-title { font-family: var(--heading); font-weight: 700; font-size: var(--fs-lg); color: var(--soil); }
#town-count { font-size: var(--fs-sm); font-weight: 700; color: var(--t3); }
#town-svg { display: block; width: 100%; height: auto; overflow: visible; }
#town-svg .tb { cursor: default; }

@media (prefers-reduced-motion: no-preference) {
  #town-svg .tb-new, #town-peek .tb-new { animation: townPop .6s cubic-bezier(.3, 1.6, .5, 1) both; transform-box: fill-box; transform-origin: 50% 100%; }
  #town-svg .tb-grow, #town-peek .tb-grow { animation: townGrow .7s cubic-bezier(.3, 1.6, .5, 1) both; transform-box: fill-box; transform-origin: 50% 100%; }
  #town-svg .tb-plus, #town-peek .tb-plus { animation: townPlus 1.4s ease-out both; }
}
@keyframes townGrow { 0% { transform: scale(1, .82); } 55% { transform: scale(1.06, 1.16); } 100% { transform: scale(1); } }
@keyframes townPlus { 0% { opacity: 0; transform: translateY(8px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-16px); } }
.tb-plus { font-family: var(--heading); font-weight: 800; font-size: 13px; fill: var(--green2, #2f6b1f); stroke: #fff; stroke-width: 3px; paint-order: stroke; opacity: 0; }

/* Town peek after a purchase when the town is off screen (23-town.js townPeek) */
#town-peek { position: fixed; left: 50%; bottom: 20px; z-index: 850; display: flex; align-items: center; gap: 10px;
  width: min(360px, calc(100vw - 24px)); padding: 6px 14px 6px 6px; border-radius: 16px; border: 2px solid var(--soil);
  background: var(--surface, #fffbf0); box-shadow: 0 10px 30px rgba(var(--shade-rgb, 45,32,18), .28); text-align: left; cursor: pointer;
  transform: translate(-50%, 140%); opacity: 0; pointer-events: none; transition: transform .35s cubic-bezier(.3, 1.4, .5, 1), opacity .25s; }
#town-peek.on { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
#town-peek svg { width: 132px; height: 92px; flex: 0 0 auto; overflow: visible; }
#town-peek .tp-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
#town-peek b { font-size: var(--fs-sm); color: var(--t1); }
#town-peek small { font-size: var(--fs-xs); color: var(--t3); }
#town-peek .tp-bar { height: 6px; border-radius: 99px; background: var(--surface3, #eee3c8); overflow: hidden; }
#town-peek .tp-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green2), var(--green)); border-radius: 99px; }
@media (max-width: 899px) { #town-peek { bottom: 84px; } } /* above the bottom tabs */
@media (prefers-reduced-motion: reduce) { #town-peek { transition: opacity .2s; } }
@keyframes townPop { from { transform: scale(.2) translateY(12px); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* With the orbit gone the tap area only needs room for Spud and his hat. */
#arena-wrap, #arena, #pcanvas { height: 222px; }
#arena-wrap { margin: 18px 0 0; }

/* Tiers and the next goal */
.town-tier { font-size: var(--fs-sm); font-weight: 800; color: var(--green2); }
.town-next { text-align: center; font-size: var(--fs-sm); font-weight: 700; color: var(--t2); padding: 2px 10px 6px; }

/* ── CELEBRATIONS AND PRESTIGE (Root Cellar) ── */
#cel-box {
  background: var(--surface);
  border: 3px solid var(--soil);
  padding: 0 24px 22px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(var(--shade-rgb), .4);
}
/* Golden sunburst header */
#cel-box::before {
  content: '';
  display: block;
  height: 78px;
  margin: 0 -24px;
  background:
    radial-gradient(circle at 50% 100%, #fff3cf 0 22px, transparent 23px),
    repeating-conic-gradient(from 0deg at 50% 100%, #f6c94a 0deg 9deg, #fbe3a0 9deg 18deg);
  border-bottom: 3px solid var(--soil);
}
#cel-icon {
  display: inline-grid; place-items: center;
  width: 64px; height: 64px; margin: -34px auto 10px;
  border-radius: 50%; background: var(--surface); border: 3px solid var(--soil);
  font-size: 34px; line-height: 1; position: relative;
}
#cel-title { font-family: var(--heading); font-weight: 700; font-size: var(--fs-xl); color: var(--green2); letter-spacing: 0; }
#cel-sub { font-size: var(--fs-md); font-weight: 600; }
#cel-dismiss { font-family: var(--display); font-weight: 700; font-size: var(--fs-xs); }

/* FIRE / prestige: sunrise over the farm with Spud */
#prest-box {
  background: var(--surface);
  border: 3px solid var(--soil);
  padding: 0 24px 22px;
  overflow: hidden auto; /* the career and perk pickers make it taller than a phone screen */
  max-height: calc(100dvh - 32px);
  box-shadow: 0 24px 70px rgba(var(--shade-rgb), .4);
}
#prest-sky {
  height: 120px; margin: 0 -24px 14px; position: relative;
  background:
    linear-gradient(180deg, transparent 72%, #93ca72 72% 86%, #b7814c 86%),
    radial-gradient(circle at 50% 74%, #f6c94a 0 34px, #fbe3a0 35px 46px, transparent 47px),
    repeating-conic-gradient(from 0deg at 50% 74%, rgba(246,201,74,.35) 0deg 8deg, transparent 8deg 16deg),
    linear-gradient(180deg, #fbd9a8, #fff3cf);
  border-bottom: 3px solid var(--soil);
}
.prest-spud { position: absolute; left: 50%; bottom: 14px; width: 58px; height: 58px; transform: translateX(-50%); }
@media (prefers-reduced-motion: no-preference) {
  .prest-spud { animation: spudBob 2.4s ease-in-out infinite; }
}
#prest-box h2 { font-family: var(--heading); font-weight: 700; font-size: var(--fs-2xl); color: var(--green2); letter-spacing: 0; }
.prest-stats { background: var(--surface2); border: 2px solid #e2d3b2; }
.pr-lbl, .pr-val, #prest-mult { font-family: var(--display); }
#prest-go { font-family: var(--heading); color: var(--on-amber); box-shadow: 0 3px 0 var(--amber2); }
#prest-stay { font-family: var(--heading); font-weight: 600; background: var(--surface2); color: var(--t2); }

/* Toasts: small wins that never block play */
#toasts { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 950; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 24px)); pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: center; background: var(--surface); border: 2px solid var(--soil); border-radius: 14px; padding: 9px 12px; box-shadow: 0 8px 24px rgba(var(--shade-rgb), .22); animation: toastIn .35s cubic-bezier(.3, 1.5, .5, 1) both; }
.toast.out { opacity: 0; transform: translateY(-8px); transition: all .35s; }
.toast-icon { font-size: 26px; line-height: 1; flex-shrink: 0; }
.toast b { display: block; font-family: var(--heading); font-weight: 700; font-size: var(--fs-md); color: var(--green2); }
.toast span { font-size: var(--fs-sm); color: var(--t2); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(.96); } }
.prest-explain { font-size: var(--fs-sm); color: var(--t2); margin: -8px 4px 14px; line-height: 1.5; }

/* ── MULTIPLAYER: league panel and friends' towns (25-multiplayer.js) ── */
.mp-open { display: block; margin: 2px auto 8px; padding: 7px 16px; border-radius: 999px; border: 2px solid var(--soil); background: var(--surface); color: var(--t1); font-family: var(--heading); font-weight: 700; font-size: var(--fs-md); cursor: pointer; box-shadow: 0 3px 0 rgba(var(--shade-rgb), .18); }
.mp-open:hover { background: var(--surface2); }
.mp-open:active { transform: translateY(2px); box-shadow: none; }

.mp-box { position: relative; max-width: 440px; max-height: calc(100vh - 40px); overflow-y: auto; text-align: left; padding: 22px 18px 18px; }
.mp-x { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 26px; line-height: 1; color: var(--t3); cursor: pointer; padding: 4px 8px; }
.mp-title { font-family: var(--heading); font-size: var(--fs-xl); margin: 0 0 12px; text-align: center; }
.mp-note { font-size: var(--fs-sm); color: var(--t2); line-height: 1.5; margin: 8px 2px; }
.mp-err { font-size: var(--fs-sm); color: var(--red); margin: 4px 2px; min-height: 0; }
.mp-link { border: 0; background: none; color: var(--t3); font-size: var(--fs-sm); text-decoration: underline; cursor: pointer; padding: 0; font-family: inherit; }

.mp-join { display: flex; gap: 8px; }
.mp-join input { flex: 1; min-width: 0; padding: 9px 11px; border: 2px solid var(--border2); border-radius: 10px; font: 700 var(--fs-md) var(--display); background: #fff; color: var(--t1); }
.mp-join input:focus { outline: none; border-color: var(--green); }
.mp-join .bbtn { padding: 9px 14px; border-radius: 10px; font-size: var(--fs-md); white-space: nowrap; }

.mp-me-row { display: flex; align-items: center; gap: 10px; background: var(--surface2); border: 2px dashed var(--border2); border-radius: 12px; padding: 8px 10px; }
.mp-me-lbl { font-size: var(--fs-sm); color: var(--t2); }
.mp-code { font: 800 var(--fs-lg) var(--mono); letter-spacing: .12em; color: var(--green2); }
.mp-share { margin-left: auto; padding: 7px 12px; border-radius: 9px; font-size: var(--fs-sm); }
.mp-me-sub { display: flex; justify-content: space-between; align-items: center; font-size: var(--fs-sm); color: var(--t2); margin: 6px 2px 0; }

.mp-tabs { display: flex; gap: 4px; margin: 14px 0 6px; border-bottom: 2px solid var(--border2); }
.mp-tabs button { flex: 1; border: 0; background: none; padding: 8px 2px; font: 700 var(--fs-sm) var(--heading); color: var(--t3); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.mp-tabs button.on { color: var(--green2); border-bottom-color: var(--green); }

.mp-body { min-height: 120px; }
.mp-list { list-style: none; margin: 0; padding: 0; }
.mp-row { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; padding: 8px 6px; border-bottom: 1px dashed var(--border2); cursor: pointer; border-radius: 8px; }
.mp-row:hover, .mp-row:focus { background: #fffaf0; outline: none; }
.mp-row.me { background: rgba(var(--green-rgb), .1); }
/* Practice rivals (computer-run, server/league.js): no town to visit, a plainer row. */
.mp-row.rival { cursor: default; }
.mp-row.rival:hover { background: none; }
.mp-row.rival b { font-weight: 600; color: var(--t2); }
.mp-rank { font: 800 var(--fs-md) var(--heading); color: var(--t3); text-align: center; }
.mp-row:nth-child(1) .mp-rank { color: var(--gold); }
.mp-who { min-width: 0; }
.mp-who b { display: block; font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-who small { font-size: var(--fs-xs); color: var(--t3); }
.mp-val { font: 800 var(--fs-md) var(--mono); color: var(--green2); }

.mp-back { margin: 6px 0 4px; }
.mp-visit-name { font: 700 var(--fs-xl) var(--heading); text-align: center; }
.mp-visit-sub { font-size: var(--fs-sm); color: var(--t2); text-align: center; margin-top: 2px; }
.mp-town { display: block; width: 100%; height: auto; max-height: 260px; margin: 6px 0; }
.mp-acts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.mp-acts .bbtn, .mp-acts .sbtn { padding: 9px 16px; border-radius: 10px; font-size: var(--fs-md); }
.mp-acts .bbtn:disabled { opacity: .7; cursor: default; }
body.mp-on #onb-card { display: none; } /* the tutorial waits while the league is open */
.mp-random { display: block; margin: 0 auto 8px; }

/* Chat (28-chat.js) */
#mp-tabs { flex-wrap: wrap; }
.mp-open[data-unread]:not([data-unread=""])::after { content: attr(data-unread); display: inline-block; margin-left: 6px; min-width: 18px; padding: 1px 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: var(--fs-xs); }
.chat-gate { text-align: center; padding: 10px; }
.chat-gate p { font-size: var(--fs-sm); color: var(--t2); margin-bottom: 10px; }
.chat-rules { margin-top: 0; }
.chat-with { font: 700 var(--fs-md) var(--heading); text-align: center; margin: 4px 0 8px; }
.chat-list { list-style: none; margin: 0; padding: 4px; max-height: min(46vh, 360px); min-height: 160px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface2); }
.chat-msg { padding: 6px 9px; margin: 4px 0; border-radius: 10px; background: var(--surface); max-width: 85%; cursor: pointer; position: relative; }
.chat-msg.mine { margin-left: auto; background: rgba(var(--green-rgb), .12); cursor: default; }
.chat-msg.reported { opacity: .45; }
.chat-head { display: flex; gap: 8px; align-items: baseline; font-size: var(--fs-xs); }
.chat-head small { color: var(--t3); }
.chat-text { font-size: var(--fs-sm); overflow-wrap: anywhere; }
.chat-menu { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.chat-form { display: flex; gap: 6px; margin-top: 8px; }
.chat-form input { flex: 1; min-width: 0; padding: 9px 11px; border-radius: 10px; border: 1.5px solid var(--border2); font: inherit; background: var(--surface); color: var(--t1); }
.chat-err { min-height: 1em; }

/* Divisions and clans (30-league.js) */
.mp-sub { display: flex; gap: 4px; justify-content: center; margin: 0 0 8px; }
.mp-sub button { border: 1.5px solid var(--border2); background: var(--surface); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: var(--fs-xs); cursor: pointer; color: var(--t2); }
.mp-sub button.on { border-color: var(--green); color: var(--green2); font-weight: 700; }
.div-head { text-align: center; margin-bottom: 8px; }
.div-head b { display: block; font: 700 var(--fs-lg) var(--heading); }
.div-head small { color: var(--t3); font-size: var(--fs-xs); }
.mp-row.zone-up { box-shadow: inset 4px 0 0 var(--green); }
.mp-row.zone-down { box-shadow: inset 4px 0 0 var(--red); }
.clan-goal { margin: 6px 0 10px; }
.clan-goal small { display: block; text-align: center; color: var(--t2); font-size: var(--fs-xs); margin-bottom: 14px; }
.clan-bar { position: relative; height: 12px; border-radius: 999px; background: var(--surface2); border: 1.5px solid var(--border2); }
.clan-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--green), var(--amber)); }
.clan-mark { position: absolute; top: -16px; transform: translateX(-100%); font-size: var(--fs-xs); color: var(--t3); font-family: var(--mono); }
.clan-mark::after { content: ''; position: absolute; right: 0; top: 14px; width: 2px; height: 14px; background: var(--soil); }
.chat-msg.gone { opacity: 0; transition: opacity .6s; }
.chat-empty { list-style: none; text-align: center; padding: 20px 0; }

/* Raids and the Potato Exchange (35-raids-market.js) */
.mkt-tag { font-size: var(--fs-xs); font-weight: 700; padding: 1px 5px; border-radius: 6px; white-space: nowrap; }
.mkt-tag.up { color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); }
.mkt-tag.dn { color: var(--red, #c8452f); background: color-mix(in srgb, var(--red, #c8452f) 12%, transparent); }
.mkt-body { padding: 4px 10px 8px; }
.mkt-row { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border, rgba(0,0,0,.08)); }
.mkt-row small { opacity: .7; margin-left: auto; }
.raid-list { list-style: none; padding: 0; margin: 0 0 8px; }
.raid-list li { padding: 6px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.raid-list .sbtn { padding: 4px 10px; }
.raid-def { margin-top: 6px; font-size: var(--fs-sm); }

/* Listings board (36-listings.js) */
.lst-body { padding: 4px 6px 8px; }
.lst-row { display: flex; gap: 8px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--border, rgba(0,0,0,.08)); }
.lst-row .bi { font-size: 22px; }
.lst-row .binfo { flex: 1; min-width: 0; }
.lst-row.gone { opacity: .55; }
.lst-row.hot .bname { color: var(--red, #c8452f); }

/* League invite card (37-league-invite.js), under "Best next move" */
.league-invite { max-width: min(560px, 94%); margin: 8px auto 4px; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--green); background: var(--surface); box-shadow: 0 3px 0 rgba(var(--shade-rgb), .14); text-align: center; }
.league-invite .li-h { display: block; font-family: var(--heading); font-size: var(--fs-md); color: var(--t1); }
.league-invite .li-p { margin: 4px 0 0; font-size: var(--fs-sm); color: var(--t2); line-height: 1.4; }
.league-invite .li-lead { margin: 6px 0 0; font-size: var(--fs-sm); font-weight: 700; color: var(--green); }
.league-invite .li-acts { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: center; align-items: center; margin-top: 10px; }
.league-invite .li-acts .bbtn { min-height: 40px; padding: 8px 16px; }
.league-invite .li-acts .mp-link { min-height: 32px; }
.league-invite .li-fine { display: block; margin-top: 6px; font-size: var(--fs-xs); color: var(--t3); }
@media (max-width: 480px) {
  .league-invite { padding: 10px 12px; margin-top: 6px; }
  .league-invite .li-acts { gap: 4px 10px; margin-top: 8px; }
  .league-invite .li-fine { margin-top: 4px; }
}

/* Money Mash card (38-mash-promo.js), under "Best next move" */
.mash-promo { position: relative; max-width: min(560px, 94%); margin: 8px auto 4px; }
.mash-promo .mp-go { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; min-height: 48px; padding: 8px 64px 8px 12px; border-radius: 14px; border: 2px solid var(--green); background: var(--surface); box-shadow: 0 3px 0 rgba(var(--shade-rgb), .14); color: var(--t1); text-decoration: none; text-align: left; }
.mash-promo .mp-go:hover { background: var(--surface2); }
.mash-promo .mp-new { font-size: var(--fs-xs); font-weight: 800; color: var(--on-accent); background: var(--green); border-radius: 99px; padding: 1px 8px; letter-spacing: .04em; text-transform: uppercase; }
.mash-promo b { font-family: var(--heading); font-size: var(--fs-md); }
.mash-promo .mp-sub { flex-basis: 100%; font-size: var(--fs-sm); color: var(--t2); line-height: 1.35; }
.mash-promo .mp-arrow { position: absolute; right: 40px; top: 50%; transform: translateY(-50%); color: var(--green); font-weight: 800; }
.mash-promo .mp-x { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; border-radius: 10px; background: none; color: var(--t3); font-size: var(--fs-md); cursor: pointer; }
.mash-promo .mp-x:hover { background: var(--surface2); color: var(--t1); }

/* ── COSMETICS (27-cosmetics.js) ── */
#tap-btn.wears-hat #spud .sp-hat, #tap-btn.wears-hat #spud .sp-sprout { display: none; }
.cosm-open { margin-top: 6px; }
#cosm-modal { z-index: 900; }
.cosm-box { position: relative; background: var(--surface); border: 2px solid var(--soil); border-radius: 18px; padding: 18px 16px 16px; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; box-shadow: 0 6px 0 rgba(var(--shade-rgb), .25); }
.cosm-box h2 { font-family: var(--heading); font-size: var(--fs-xl); text-align: center; margin: 0 0 4px; }
.cosm-sub { font-size: var(--fs-xs); color: var(--t2); text-align: center; margin: 0 0 10px; }
.cosm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-top: 10px; }
.cosm-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 8px; border: 1.5px solid var(--border2); border-radius: 12px; background: var(--surface2, var(--surface)); text-align: center; }
.cosm-item.worn { border-color: var(--green); background: rgba(var(--green-rgb), .08); }
.cosm-item.premium { border-style: dashed; }
.cosm-item .bbtn { width: 100%; }
.cosm-prev { height: 64px; display: flex; align-items: center; justify-content: center; }
.cosm-prev svg { height: 64px; width: auto; overflow: visible; }
.cosm-name { font-size: var(--fs-sm); font-weight: 700; }
.cosm-tag { font-size: var(--fs-xs); color: var(--amber); font-family: var(--mono); }
.mp-visit-head { display: flex; align-items: center; justify-content: center; gap: 8px; }
.mp-spud { width: 40px; height: 48px; overflow: visible; }

/* Retirement planner (34-retire.js) */
.ret-q { font-weight: 700; margin: 12px 0 4px; }
.ret-seg { display: flex; gap: 6px; flex-wrap: wrap; }
.ret-seg .sbtn { flex: 1; min-width: 60px; }
.ret-seg .sbtn.on { border-color: var(--green); color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); font-weight: 700; }
.ret-n { font-size: var(--fs-sm); opacity: .85; margin: 4px 0; }
.ret-go { margin-top: 12px; }
.ret-age { font-weight: 800; font-size: var(--fs-md); }
.ret-chart { width: 100%; height: auto; margin: 6px 0; }
.ret-chart polyline { stroke: var(--green); stroke-width: 3; stroke-linejoin: round; }
.ret-axis { stroke: currentColor; opacity: .3; }

/* Loading: the game area stays invisible until the first full render
   (game/src/99-ready.js adds body.game-ready). Without this, a slow phone paints
   the empty placeholder layout first and the tap button, "Best next move" and the
   mobile sections jump when the game fills them in (Lighthouse CLS 0.38 on mobile,
   2026-11-01). Elements that only become visible are not layout shifts. */
body:not(.game-ready) #center-col { visibility: hidden; }
/* Pinch zoom is allowed (the viewport no longer blocks it, for accessibility);
   this keeps double-tap zoom off, so tapping fast never zooms the page. */
html { touch-action: manipulation; }

/* "Our games" bar (top of the centre column) and the home section under the game
   (end of the TAP view on phones), both generated by scripts/build-game.mjs from
   src/data/games.mjs and tools.mjs. */
#games-bar { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 2px auto 8px; font-size: var(--fs-sm); }
#games-bar .gb-lbl { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--t3); font-family: var(--mono); }
#games-bar .gb-chip, #games-bar .gb-more { display: inline-flex; align-items: center; min-height: 28px; padding: 0 11px; border-radius: 99px; font-weight: 700; text-decoration: none; }
#games-bar .gb-chip { border: 1.5px solid var(--border2); background: var(--surface); color: var(--t1); }
#games-bar .gb-chip.on { background: var(--green); border-color: var(--green); color: var(--on-accent); }
#games-bar a.gb-chip:hover { border-color: var(--green); }
#games-bar .gb-more { color: var(--green); }

#home-hub { width: 100%; max-width: 560px; margin: 18px auto 24px; padding: 16px 14px 6px; border-top: 1px dashed var(--border2); }
#home-hub h2 { font-family: var(--heading); font-size: var(--fs-lg); color: var(--t1); text-align: center; margin: 0 0 4px; }
#home-hub h3 { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--t3); font-family: var(--mono); margin: 14px 0 8px; }
#home-hub ul { list-style: none; margin: 0; padding: 0; }
.hh-games { display: grid; gap: 8px; }
.hh-game { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface); border: 1.5px solid var(--border2); border-radius: 14px; }
.hh-game.on { border-color: var(--green); }
.hh-game img { flex: none; width: 44px; height: 44px; border-radius: 12px; }
.hh-game div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hh-game b { font-family: var(--heading); font-size: var(--fs-md); color: var(--t1); }
.hh-game span { font-size: var(--fs-sm); color: var(--t2); line-height: 1.35; }
.hh-game small { font-size: var(--fs-xs); color: var(--t3); margin-top: 2px; }
.hh-game em { flex: none; font-style: normal; font-size: var(--fs-xs); font-weight: 700; color: var(--green); text-align: right; max-width: 76px; }
.hh-play { flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 12px; background: var(--green); color: var(--on-accent); font-weight: 800; text-decoration: none; }
.hh-play:hover { filter: brightness(1.08); }
.hh-links { display: flex; flex-wrap: wrap; gap: 6px; }
.hh-links a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 10px; background: var(--surface2); color: var(--t1); font-size: var(--fs-sm); font-weight: 600; text-decoration: none; }
.hh-links a:hover { color: var(--green); }
/* On phones the home section belongs to the TAP view only. */
@media (max-width: 899px) { body[data-mob-view]:not([data-mob-view="tap"]) #home-hub { display: none; } #home-hub { padding-left: 12px; padding-right: 12px; } }
/* A calm first session (13-onboarding.css): no bar while the tutorial points at tap and buy. */
body.onb-tap #games-bar, body.onb-buy #games-bar, body.onb-tap #home-hub, body.onb-buy #home-hub { display: none; }

