/* Bear mode (dark) is the default; Bull mode (light) follows the system
   setting unless the visitor picks one with the header toggle. */
:root {
  color-scheme: dark;
  --bg: #0d0f14;
  --panel: rgba(30, 34, 48, .52);
  --panel-solid: #161a22;
  --inset: rgba(6, 8, 14, .38);
  --line: rgba(255, 255, 255, .09);
  --edge: rgba(255, 255, 255, .13);
  --hi: rgba(255, 255, 255, .10);
  --blob1: rgba(255, 196, 40, .42);
  --blob2: rgba(124, 77, 255, .55);
  --blob3: rgba(20, 220, 190, .32);
  --blob4: rgba(255, 72, 120, .38);
  --text: #f2f4f8;
  --muted: #8b93a7;
  --gold: #ffd23f;      /* accent fills: buttons, bars, borders */
  --gold-ink: #ffd23f;  /* accent text */
  --on-gold: #1a1500;
  --gold-soft: #2a2410;
  --glow: #2a2410;
  --up: #3ddc84;
  --on-up: #062b14;
  --down: #ff5c7a;
  --overlay: rgba(13, 15, 20, .88);
  --shadow: rgba(0, 0, 0, .45);
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Geist", system-ui, sans-serif;
  --font-num: "Geist Mono", ui-monospace, monospace;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f3ea;
  --panel: rgba(255, 255, 255, .55);
  --panel-solid: #ffffff;
  --inset: rgba(255, 255, 255, .55);
  --line: rgba(60, 45, 10, .11);
  --edge: rgba(255, 255, 255, .85);
  --hi: rgba(255, 255, 255, .9);
  --blob1: rgba(255, 190, 20, .55);
  --blob2: rgba(150, 110, 255, .45);
  --blob3: rgba(30, 200, 170, .38);
  --blob4: rgba(255, 110, 150, .42);
  --text: #1b1d24;
  --muted: #676b78;
  --gold: #ffc61a;
  --gold-ink: #9a6a00;
  --on-gold: #1a1500;
  --gold-soft: #fff3c4;
  --glow: #ffe58a;
  --up: #12994a;
  --on-up: #ffffff;
  --down: #dc2650;
  --overlay: rgba(246, 243, 234, .92);
  --shadow: rgba(40, 35, 20, .16);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f6f3ea;
    --panel: rgba(255, 255, 255, .55);
    --panel-solid: #ffffff;
    --inset: rgba(255, 255, 255, .55);
    --line: rgba(60, 45, 10, .11);
    --edge: rgba(255, 255, 255, .85);
    --hi: rgba(255, 255, 255, .9);
    --blob1: rgba(255, 190, 20, .55);
    --blob2: rgba(150, 110, 255, .45);
    --blob3: rgba(30, 200, 170, .38);
    --blob4: rgba(255, 110, 150, .42);
    --text: #1b1d24;
    --muted: #676b78;
    --gold: #ffc61a;
    --gold-ink: #9a6a00;
    --on-gold: #1a1500;
    --gold-soft: #fff3c4;
    --glow: #ffe58a;
    --up: #12994a;
    --on-up: #ffffff;
  --on-up: #ffffff;
    --down: #dc2650;
    --overlay: rgba(246, 243, 234, .92);
    --shadow: rgba(40, 35, 20, .16);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: radial-gradient(1000px 500px at 50% -10%, var(--glow) 0%, var(--bg) 60%) var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--gold-ink); }
/* Headings and big moments use the display face; prices and scores use mono so digits line up. */
h1, h2, h3, .logo, .big, .mood-label, .grade, .emoji-title, .hl-text, .roast, .nav-heading, .card.tool b, dialog h2 {
  font-family: var(--font-display); font-optical-sizing: auto;
}
h1 { font-weight: 800; }
.num, .coins .px, .coins .chg, .stat b, .legend-list b, .sats b, .tc-top b, .count, #score, .hud b, kbd { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.big { font-variant-numeric: tabular-nums; }

.logo { font-weight: 700; font-size: 1.5rem; color: var(--text); text-decoration: none; }
.logo span { color: var(--gold-ink); }

/* ---------- App shell ----------
   Phone: sticky top app bar + bottom tab bar. Desktop (1000px+): fixed left sidebar. */
.top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.top-actions { display: flex; gap: 8px; }
.mute, .theme, .find {
  width: 40px; height: 40px; margin: 0; padding: 0; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; font-size: 1.1rem;
}
.mute:hover, .theme:hover, .find:hover { border-color: var(--gold); filter: none; }
#nav { display: none; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px max(6px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.tab {
  margin: 0; padding: 6px 2px; width: auto; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: 0; border-radius: 12px; color: var(--muted); font-size: .72rem; font-weight: 600; text-decoration: none;
}
.tab span { font-size: 1.35rem; line-height: 1.1; filter: grayscale(.6); opacity: .8; }
.tab:hover { filter: none; color: var(--text); }
.tab[aria-current="page"] { color: var(--text); background: var(--gold-soft); }
.tab[aria-current="page"] span { filter: none; opacity: 1; }
body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
#toasts { bottom: calc(84px + env(safe-area-inset-bottom)) !important; }

.sheet {
  width: 100%; max-width: 560px; max-height: 80vh; margin: auto auto 0; padding: 8px 8px max(14px, env(safe-area-inset-bottom));
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0;
  box-shadow: 0 -20px 60px var(--shadow);
}
.sheet[open] { animation: sheet-up .22s ease-out; }
.sheet::backdrop { background: rgba(0, 0, 0, .5); }
.sheet h2 { font-size: 1.1rem; margin: 6px 12px 4px; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 6px; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet[open] { animation: none; } }

@media (min-width: 1000px) {
  body { padding: 0 0 0 264px; }
  .tabbar { display: none; }
  #toasts { bottom: 24px !important; left: calc(50% + 132px) !important; }
  .top {
    position: fixed; left: 0; top: 0; bottom: 0; width: 264px; z-index: 30;
    flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 6px;
    padding: 24px 14px 16px; border-bottom: 0; border-right: 1px solid var(--line);
    background: var(--panel); -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .logo { padding: 0 10px 10px; font-size: 1.6rem; }
  /* Sidebar menu: dense rows, quiet emojis (color on hover/active), collapsible sections. */
  #nav { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; flex: 1; margin: 0 -6px; padding: 0 6px 8px; scrollbar-width: thin; }
  #nav a {
    display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; min-height: 34px;
    color: var(--muted); text-decoration: none; font-size: .9rem; white-space: nowrap;
  }
  #nav a:hover { color: var(--text); background: var(--inset); }
  #nav a[aria-current="page"] { color: var(--text); background: var(--gold-soft); font-weight: 600; }
  .nav-emoji { width: 20px; text-align: center; font-size: .95rem; filter: grayscale(1); opacity: .55; transition: filter .15s, opacity .15s; }
  #nav a:hover .nav-emoji, #nav a[aria-current="page"] .nav-emoji { filter: none; opacity: 1; }
  .nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
  .side-search {
    display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 8px 10px; width: 100%;
    background: var(--inset); color: var(--muted); border: 1px solid var(--line); border-radius: 10px;
    font-size: .88rem; font-weight: 400; text-align: left;
  }
  .side-search:hover { border-color: var(--gold); color: var(--text); filter: none; }
  .side-search span { filter: grayscale(1); opacity: .7; }
  .side-search kbd { margin-left: auto; font: inherit; font-size: .75rem; padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; }
  .nav-heading {
    display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; margin: 10px 0 0; padding: 6px 10px;
    background: none; border: 0; border-radius: 8px; color: var(--text); text-align: left;
    font-size: .9rem; font-weight: 700;
  }
  button.nav-heading:hover { background: var(--inset); filter: none; }
  .chev { width: 20px; height: 14px; flex: none; color: var(--muted); transition: transform .15s; }
  .nav-group.open .chev { transform: rotate(90deg); }
  .count {
    margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; text-align: center;
    font-size: .75rem; font-weight: 600; color: var(--muted); background: var(--inset);
  }
  .nav-today > .nav-heading .chev { text-align: center; font-size: .85rem; line-height: 14px; filter: grayscale(1); opacity: .6; }
  .nav-items { display: none; flex-direction: column; gap: 1px; }
  .nav-group.open .nav-items { display: flex; }
  .nav-today { display: flex; flex-direction: column; gap: 1px; }
  .nav-today .nav-heading { margin-top: 12px; }
  #nav .trophy-card {
    flex-direction: column; align-items: stretch; gap: 6px; margin-top: 14px; padding: 10px 12px;
    border: 1px solid var(--line); background: var(--inset);
  }
  #nav .trophy-card:hover { border-color: var(--gold); }
  .tc-top { display: flex; justify-content: space-between; font-size: .85rem; }
  .tc-top b { color: var(--text); }
  .tc-bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
  .tc-bar span { display: block; height: 100%; background: var(--gold); border-radius: 999px; }
  .top-actions .find { display: none; }
  .top-actions { padding: 14px 4px 0; border-top: 1px solid var(--line); margin-top: 8px; }
}

main { flex: 1; max-width: 760px; width: 100%; margin: 0 auto; padding: 0 16px 40px; }
@media (min-width: 1000px) {
  main, main.wide { max-width: 1180px; padding: 8px 40px 48px; }
  main > * { max-width: 860px; margin-left: auto !important; margin-right: auto !important; }
  /* These spread across the full width. */
  main > .tools, main > h2.group, main > .home-hero, main > .today-grid, main > .popular, main > #terms, main > #list, main > .trophies, main > .board,
  main > .shop, main > .feed, main > .bingo, main > .search, main > .big-progress, main > .dict-tools, main > .wotd, main > .meme-layout { max-width: none; }
  .hero { padding: 36px 0 32px; }
  footer { padding-bottom: 32px; }
}
.hero { text-align: center; padding: 24px 0 28px; }
.hero h1 { font-size: clamp(2rem, 7vw, 3.2rem); margin: 0 0 8px; letter-spacing: -.02em; }
.hero p { color: var(--muted); margin: 0; font-size: 1.1rem; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 24px; margin-bottom: 20px;
}
.row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: .9rem; }
input, select, textarea, button { font: inherit; }
input, select, textarea {
  background: var(--inset); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; font-size: 1.05rem; width: 100%; min-width: 0;
  color-scheme: dark;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.money { position: relative; }
.money span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.money input { padding-left: 26px; }

button {
  background: var(--gold); color: var(--on-gold); border: 0; border-radius: 12px;
  padding: 14px 20px; font-weight: 700; font-size: 1.05rem; cursor: pointer;
  margin-top: 18px; width: 100%;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: .6; cursor: wait; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.hint { color: var(--muted); font-size: .8rem; margin: 12px 0 0; text-align: center; }

.result { text-align: center; }
.emoji { font-size: 3.5rem; line-height: 1; }
.line { color: var(--muted); margin: 14px 0 4px; }
.big { font-size: clamp(2.4rem, 10vw, 4rem); font-weight: 700; letter-spacing: -.02em; }
.multi { font-weight: 600; font-size: 1.2rem; margin-top: 4px; }
.multi.up { color: var(--up); }
.multi.down { color: var(--down); }
.roast { font-size: 1.2rem; margin: 18px auto 0; max-width: 520px; }
.fine { color: var(--muted); font-size: .8rem; margin-top: 14px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.actions button + button { margin-top: 18px; }
@media (max-width: 600px) { .actions button + button { margin-top: 10px; } }

.error { color: var(--down); text-align: center; }
footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 20px 16px 28px; }

/* Cope-o-Meter */
.gauge { display: block; width: 100%; max-width: 440px; margin: 0 auto; }
.gauge .needle { transition: transform 1s cubic-bezier(.3, 1.4, .5, 1); transform-origin: 200px 200px; }
.mood-label { font-size: clamp(1.6rem, 6vw, 2.2rem); font-weight: 700; margin: 8px 0 2px; }
.mood-sub { color: var(--muted); margin: 0; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stat { background: var(--inset); border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-align: left; }
.stat small { color: var(--muted); display: block; margin-bottom: 4px; }
.stat b { font-size: 1.2rem; }
.coins { list-style: none; margin: 0; padding: 0; }
.coins li {
  display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.coins li:last-child { border-bottom: 0; }
.coins .sym { font-weight: 600; }
.coins .sym small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.coins .px { color: var(--muted); font-variant-numeric: tabular-nums; }
.coins .chg { font-weight: 600; min-width: 72px; text-align: right; font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
.updated { color: var(--muted); font-size: .8rem; text-align: center; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }

/* Home */
a.card { display: block; color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--gold); transform: translateY(-2px); }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tools .card { margin: 0; padding: 20px; }
.tool .emoji { font-size: 2rem; display: block; margin-bottom: 8px; }
.tool b { display: block; font-size: 1.15rem; margin-bottom: 4px; }
.tool span:last-child { color: var(--muted); font-size: .95rem; }

/* Quiz */
.progress { height: 6px; background: var(--inset); border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.progress div { height: 100%; width: 0; background: var(--gold); transition: width .3s; }
.qnum { color: var(--muted); font-size: .85rem; margin: 0 0 6px; }
.question { font-size: 1.5rem; margin: 0 0 18px; }
.answers { display: grid; gap: 10px; }
.answer {
  margin: 0; text-align: left; font-weight: 600; background: var(--inset); color: var(--text);
  border: 1px solid var(--line);
}
.answer:hover { border-color: var(--gold); filter: none; }
.traits { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.result > #again { margin-top: 12px; }

/* Excuses */
.excuse-text { font-size: clamp(1.3rem, 4.5vw, 1.7rem); font-weight: 600; line-height: 1.4; margin: 16px auto 6px; max-width: 560px; min-height: 3em; }

/* Dictionary */
.search {
  width: 100%; margin-bottom: 20px; padding: 14px 16px; font-size: 1.05rem;
  background: var(--panel); border-radius: 12px;
}
.term h3 { margin: 0 0 6px; font-size: 1.3rem; }
.term h3 a { color: var(--text); text-decoration: none; }
.term h3 a:hover { color: var(--gold-ink); }
.term p { margin: 0 0 8px; line-height: 1.5; }
.term .moral { color: var(--muted); font-style: italic; margin: 0; }
.term:target { border-color: var(--gold); }

/* Loss Converter */
.big-input input { font-size: 1.6rem; padding: 14px 14px 14px 30px; font-weight: 700; }
.presets { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.presets button {
  width: auto; margin: 0; padding: 8px 14px; font-size: .9rem;
  background: var(--inset); color: var(--text); border: 1px solid var(--line);
}
.items { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 4px; text-align: left; }
.item { display: flex; align-items: center; gap: 12px; background: var(--inset); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.item .emoji { font-size: 1.8rem; line-height: 1; }
.item b { font-size: 1.15rem; }
a.button {
  display: block; text-align: center; text-decoration: none; margin-top: 18px;
  padding: 14px 20px; border-radius: 12px; font-weight: 700; font-size: 1.05rem;
}
a.button.ghost { color: var(--text); border: 1px solid var(--line); }
a.button.primary { background: var(--gold); color: var(--on-gold); }
a.button.ghost:hover { border-color: var(--gold); }

/* Oracle */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.orb {
  width: min(280px, 72vw); aspect-ratio: 1; margin: 6px auto 22px; padding: 40px; display: flex;
  align-items: center; justify-content: center; border-radius: 50%; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #4b3d8f 0%, #1d1640 55%, #0b0919 100%);
  box-shadow: 0 0 60px rgba(124, 92, 255, .35), inset 0 -12px 40px rgba(0,0,0,.6);
  color: #efeaff; font-size: 1.15rem; font-weight: 600; line-height: 1.35; border: 0;
}
.orb:hover { filter: brightness(1.1); }
.orb.shaking { animation: shake .55s ease-in-out 2; }
.orb.shaking span { opacity: .4; }
@keyframes shake {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  20% { transform: translate(-8px, 2px) rotate(-4deg); }
  40% { transform: translate(7px, -3px) rotate(3deg); }
  60% { transform: translate(-5px, 3px) rotate(-2deg); }
  80% { transform: translate(4px, -1px) rotate(2deg); }
}
@media (prefers-reduced-motion: reduce) { .orb.shaking { animation: none; } }

/* Candle Catcher */
.game { position: relative; padding: 0; overflow: hidden; }
.hud { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.hud b { color: var(--text); font-size: 1.1rem; margin-left: 4px; }
canvas#board { display: block; width: 100%; height: min(520px, 62vh); touch-action: none; cursor: none; }
.overlay {
  position: absolute; inset: 49px 0 0 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: 20px; background: var(--overlay);
}
.overlay h2 { font-size: 1.6rem; margin: 6px 0 10px; }
.overlay .big { margin: 0; }
.overlay button { width: auto; min-width: 200px; }
.overlay .actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.legend { list-style: none; padding: 0; margin: 0 0 6px; text-align: left; display: grid; gap: 6px; }
.legend li { display: flex; align-items: center; gap: 10px; }
.swatch { display: inline-block; width: 10px; height: 20px; border-radius: 2px; }
.up-bg { background: var(--up); }
.down-bg { background: var(--down); }

/* Home groups */
h2.group { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 28px 0 12px; }

/* Diamond Hands Challenge */
.chart-wrap { position: relative; }
canvas#chart { display: block; width: 100%; height: min(320px, 40vh); }
.bubble {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%); margin: 0; max-width: 90%;
  background: var(--inset); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
  font-weight: 600; text-align: center; box-shadow: 0 8px 24px var(--shadow);
}
.fake-sell {
  position: absolute; width: auto; margin: 0; padding: 10px 14px; font-size: .95rem;
  background: var(--down); color: #fff; animation: pulse .6s ease-in-out infinite alternate;
}
@keyframes pulse { to { transform: scale(1.08); } }
.hold-zone { padding: 16px; border-top: 1px solid var(--line); text-align: center; }
.hold-btn {
  margin: 0; padding: 22px; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; gap: 10px;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none;
}
.hold-btn .emoji { font-size: 1.6rem; }
.hold-btn.holding { background: var(--up); color: #062b16; transform: scale(.98); }
.hold-game .overlay { inset: 49px 0 0 0; }
.hold-game .roast { margin-top: 6px; font-size: 1.05rem; }
@media (prefers-reduced-motion: reduce) { .fake-sell { animation: none; } }

/* Horoscope */
.signs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 20px; }
.signs button {
  margin: 0; padding: 10px 6px; font-size: .9rem; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
}
.signs button span { font-size: 1.4rem; }
.signs button[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-soft); }
.reading .meta { display: flex; align-items: center; gap: 14px; }
.reading .meta .emoji { font-size: 2.6rem; }
.reading h2 { margin: 0; font-size: 1.6rem; }
.reading small { color: var(--muted); }
.reading .trait { color: var(--muted); font-style: italic; margin: 12px 0 0; }
.reading .outlook { font-size: 1.3rem; font-weight: 600; line-height: 1.45; margin: 14px 0 18px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Bingo */
main.wide { max-width: 900px; }
@media (min-width: 1000px) { main > .bingo { max-width: 1000px; } }
.bingo { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.cell {
  margin: 0; aspect-ratio: 1; padding: 6px; font-size: clamp(.62rem, 1.9vw, .9rem); font-weight: 600; line-height: 1.2;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; text-align: center; overflow-wrap: anywhere; hyphens: auto;
}
.cell:hover { border-color: var(--gold); filter: none; }
.cell.marked { background: var(--gold-soft); border-color: var(--gold); color: var(--gold-ink); }
.cell.win { background: var(--gold); color: var(--on-gold); }
.cell.free { cursor: default; opacity: 1; }
.bingo-banner { text-align: center; font-size: 1.3rem; font-weight: 700; color: var(--gold-ink); margin: 0 0 14px; }
.bingo-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }
.bingo-actions button { width: auto; margin: 0; padding: 12px 18px; }

/* Trophies */
#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: min(360px, calc(100% - 32px)); }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px;
  background: var(--gold-soft); border: 1px solid var(--gold); box-shadow: 0 10px 30px var(--shadow);
  animation: toast-in .35s ease-out; transition: opacity .4s, transform .4s;
}
.toast.out { opacity: 0; transform: translateY(10px); }
.toast .emoji { font-size: 1.8rem; }
.toast small { display: block; color: var(--gold-ink); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.toast b { font-size: 1.05rem; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
.big-progress { height: 10px; margin: 0 0 8px; }
.trophies { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.trophy { display: flex; align-items: center; gap: 14px; margin: 0; padding: 16px; }
.trophy .emoji { font-size: 2rem; }
.trophy b { display: block; }
.trophy small { display: block; color: var(--muted); font-size: .85rem; margin-top: 2px; }
.trophy .when { color: var(--gold-ink); }
.trophy.locked { opacity: .55; }
.trophy.locked b { color: var(--muted); }

/* Paper Trading Panic */
.news {
  margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--line); font-weight: 600; min-height: 1.5em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.news.good { color: var(--up); }
.news.bad { color: var(--down); }
.trade-game canvas#chart { display: block; width: 100%; height: min(300px, 38vh); }
.trade-zone { padding: 14px 16px 16px; border-top: 1px solid var(--line); text-align: center; }
.position { margin: 0 0 4px; font-weight: 600; }
.trade-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.trade-btns button { margin-top: 10px; font-size: 1.15rem; }
.trade-btns small { opacity: .6; font-size: .8rem; }
button.buy { background: var(--up); color: #062b16; }
button.sell { background: var(--down); color: #2b0610; }
.trade-game .overlay { inset: 49px 0 0 0; }

/* Daily Call */
.label { color: var(--muted); }

/* Memecoin Maker */
.coin-form { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.coin-form button { margin: 0; width: auto; padding: 13px 20px; }
.coin-head { display: flex; align-items: center; gap: 18px; }
.coin-logo {
  width: 96px; height: 96px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 3.2rem; box-shadow: 0 8px 24px var(--shadow), inset 0 -6px 14px rgba(0,0,0,.2);
}
.coin h2 { margin: 0; font-size: clamp(1.4rem, 5vw, 2rem); overflow-wrap: anywhere; }
.ticker { margin: 2px 0 0; color: var(--gold-ink); font-weight: 700; font-size: 1.2rem; }
.tagline { font-size: 1.15rem; font-style: italic; color: var(--muted); margin: 14px 0; }
.coin-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.coin h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 0 10px; }
.tokenomics { display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: center; }
.donut { width: 150px; height: 150px; }
.legend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.legend-list li { display: flex; align-items: center; gap: 8px; }
.legend-list b { margin-left: auto; font-variant-numeric: tabular-nums; }
.dot { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.roadmap, .audit { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.roadmap li, .audit li { background: var(--inset); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; gap: 10px; }
.roadmap b { color: var(--gold-ink); }

/* Hodlgotchi */
.pet-name { margin: 16px auto 0; max-width: 320px; text-align: left; }
.pet-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pet-top h2 { margin: 0; font-size: 1.5rem; }
.pet-stage { text-align: center; padding: 10px 0 4px; }
.pet-bubble { position: static; transform: none; display: inline-block; margin: 6px auto 4px; max-width: 100%; }
.pet-body { position: relative; display: inline-block; font-size: 6rem; line-height: 1.1; animation: bob 2.4s ease-in-out infinite; user-select: none; }
.pet-acc { position: absolute; left: 50%; top: -.25em; transform: translateX(-50%); font-size: .45em; }
.pet-body.sad, .pet-body.hungry { filter: saturate(.4); animation-duration: 4s; }
.pet-body.dumping { filter: saturate(.5) hue-rotate(-25deg); animation: shiver .25s linear infinite; }
.pet-body.pumping { animation: bob .9s ease-in-out infinite; }
.pet-body.boing { animation: boing .45s ease-out; }
@keyframes bob { 50% { transform: translateY(-8px); } }
@keyframes shiver { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
@keyframes boing { 30% { transform: scale(1.18, .85); } 60% { transform: scale(.92, 1.1); } }
@media (prefers-reduced-motion: reduce) { .pet-body, .pet-body.boing { animation: none; } }
.meters { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 0 4px; }
.meters label { gap: 4px; }
meter { width: 100%; height: 14px; }
.pet-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pet-actions button { margin-top: 12px; font-size: .95rem; padding: 12px 8px; }

/* Soundboard */
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pad {
  margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 8px; font-size: .95rem;
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
}
.pad .emoji { font-size: 1.8rem; }
.pad:hover { border-color: var(--gold); filter: none; }
.pad.hit { animation: press .25s ease-out; }
@keyframes press { 40% { transform: scale(.93); background: var(--gold-soft); } }
.voice-controls { display: grid; gap: 12px; }
.pitch-row { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; }
.pitch-row input { flex: 1; padding: 0; accent-color: var(--gold); }
.say-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.say-form button { margin: 0; width: auto; padding: 12px 16px; }

/* Quick finder */
.finder {
  width: min(560px, calc(100% - 32px)); max-height: min(640px, calc(100% - 64px)); padding: 0; margin: 8vh auto auto;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 20px 60px var(--shadow); display: none; flex-direction: column;
}
.finder[open] { display: flex; }
.finder::backdrop { background: rgba(0, 0, 0, .55); }
.finder-head { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.finder-head input { flex: 1; }
.finder-head button { width: auto; margin: 0; padding: 8px 12px; font-size: .85rem; }
.finder-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.finder-list a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; }
.finder-list [aria-selected="true"] a, .finder-list a:hover { background: var(--gold-soft); }
.finder-list .emoji { font-size: 1.5rem; }
.finder-list b { display: block; }
.finder-list small { color: var(--muted); }
.finder-list .empty { padding: 20px; text-align: center; color: var(--muted); }
.surprise { margin: 0; border-radius: 0 0 16px 16px; }

/* Cryptle */
.cryptle-msg { text-align: center; font-weight: 700; min-height: 1.4em; margin: 0 0 10px; }
.cryptle-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; width: min(330px, 100%); margin: 0 auto 16px; }
.tile {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; font-weight: 700;
  border: 2px solid var(--line); border-radius: 8px; text-transform: uppercase; user-select: none;
}
.tile.filled { border-color: var(--muted); animation: pop-in .1s ease-out; }
.tile.correct { background: var(--up); border-color: var(--up); color: #fff; }
.tile.present { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.tile.absent { background: var(--line); border-color: var(--line); color: var(--muted); }
.tile.shake { animation: tile-shake .35s; }
@keyframes pop-in { 50% { transform: scale(1.08); } }
@keyframes tile-shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.keyboard { display: grid; gap: 6px; margin: 0 auto 10px; max-width: 500px; user-select: none; }
.kb-row { display: flex; gap: 5px; justify-content: center; }
.key {
  flex: 1; max-width: 44px; width: auto; margin: 0; padding: 14px 0; font-size: .95rem; border-radius: 7px;
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
}
.key.wide { max-width: 68px; flex: 1.5; font-size: .8rem; }
.key.correct { background: var(--up); border-color: var(--up); color: #fff; }
.key.present { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.key.absent { background: var(--line); color: var(--muted); }
.cryptle-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0 4px; }
.cryptle-stats b { display: block; font-size: 1.5rem; }
.cryptle-stats small { color: var(--muted); font-size: .8rem; }

/* Satoshi Clicker */
.clicker-main { position: relative; overflow: hidden; }
.sats { font-size: clamp(2rem, 8vw, 3rem); color: var(--muted); }
.sats b { color: var(--text); font-variant-numeric: tabular-nums; }
.clicker-main .hint { margin: 2px 0; }
.event { margin: 10px auto 0; padding: 8px 12px; border-radius: 10px; background: var(--gold-soft); border: 1px solid var(--gold); font-weight: 600; max-width: 460px; }
.mine {
  width: 150px; height: 150px; margin: 18px auto 6px; border-radius: 50%; font-size: 4.2rem; display: block; padding: 0;
  background: radial-gradient(circle at 35% 30%, #ffe27a, #ffc61a 60%, #e8a800); box-shadow: 0 10px 30px var(--shadow);
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.mine:active { transform: scale(.94); }
.lost-btc {
  position: absolute; width: 56px; height: 56px; margin: 0; padding: 0; border-radius: 50%; font-size: 2.2rem;
  background: transparent; animation: drift 2.5s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate(18px, -12px) rotate(25deg); } }
.float { position: fixed; pointer-events: none; font-weight: 700; color: var(--gold-ink); z-index: 40; animation: float-up .9s ease-out forwards; }
@keyframes float-up { to { transform: translateY(-50px); opacity: 0; } }
.shop { display: grid; gap: 8px; }
.shop-item {
  margin: 0; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; text-align: left;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); padding: 12px 14px;
}
.shop-item:not(:disabled):hover { border-color: var(--gold); filter: none; }
.shop-item:disabled { opacity: .5; cursor: not-allowed; }
.shop-item .emoji { font-size: 1.8rem; }
.shop-item b { display: block; font-size: 1rem; }
.shop-item em { font-style: normal; color: var(--muted); font-weight: 600; }
.shop-item small { color: var(--muted); font-weight: 400; font-size: .85rem; }
.shop-item .price { font-weight: 700; color: var(--gold-ink); white-space: nowrap; }
.shop-item .price::after { content: " sats"; font-weight: 400; color: var(--muted); font-size: .8rem; }
@media (prefers-reduced-motion: reduce) { .lost-btc, .float { animation: none; } }

/* Whale Watch */
.wm-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.wm-top b { font-size: 1.25rem; }
.wm-bar { height: 14px; border-radius: 999px; background: var(--down); overflow: hidden; }
.wm-buy { height: 100%; width: 50%; background: var(--up); transition: width .6s; }
.wm-legend { display: flex; justify-content: space-between; margin-top: 8px; font-size: .9rem; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.whale {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 12px;
  animation: slide-in .3s ease-out;
}
.whale.buy { border-left-color: var(--up); }
.whale.sell { border-left-color: var(--down); }
.whale .emoji { font-size: 1.8rem; }
.whale small { display: block; color: var(--muted); font-size: .85rem; }
.w-side { text-align: right; white-space: nowrap; }
.whale.empty { display: block; text-align: center; color: var(--muted); border-left-width: 1px; }
@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } }

/* Panic Button */
.panic {
  width: 200px; height: 200px; margin: 10px auto 18px; display: block; border-radius: 50%; padding: 0;
  font-size: 2rem; font-weight: 700; letter-spacing: .06em; color: #fff;
  background: radial-gradient(circle at 35% 30%, #ff8fa3, #e8203f 60%, #a3001c);
  box-shadow: 0 12px 0 #7a0015, 0 18px 40px var(--shadow); transition: transform .08s, box-shadow .08s;
}
.panic:active { transform: translateY(10px); box-shadow: 0 2px 0 #7a0015, 0 8px 20px var(--shadow); }
body.shake { animation: screen-shake .4s; }
@keyframes screen-shake { 20% { transform: translate(-6px, 2px); } 40% { transform: translate(6px, -3px); } 60% { transform: translate(-4px, 3px); } 80% { transform: translate(3px, -1px); } }
.breath-ring { width: 220px; height: 220px; margin: 10px auto 18px; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 2px dashed var(--line); }
.breath-circle { width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #9be9c0, var(--up)); transition: transform 4s ease-in-out; }
.breath-circle.in, .breath-circle.hold { transform: scale(2.2); }
.breath-circle.out, .breath-circle.rest { transform: scale(1); }
@media (prefers-reduced-motion: reduce) { body.shake { animation: none; } .breath-circle { transition: none; } }

/* "Not done today" dots (sidebar, tab bar, sheets) */
.todo-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: none; margin-left: auto; box-shadow: 0 0 0 3px var(--gold-soft); }
.tab { position: relative; }
.tab .todo-dot { position: absolute; top: 6px; right: calc(50% - 16px); margin: 0; box-shadow: 0 0 0 2px var(--bg); }
.finder-list a .todo-dot { margin-left: auto; }

/* Dictionary */
.term { cursor: pointer; transition: border-color .15s, transform .15s; }
.term:hover, .term:focus-visible { border-color: var(--gold); transform: translateY(-2px); outline: none; }
.wotd { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center; background: var(--gold-soft); border-color: var(--gold); }
.wotd small { grid-column: 1 / -1; color: var(--gold-ink); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.wotd b { font-size: 1.5rem; }
.wotd span { grid-column: 1; color: var(--muted); }
.wotd button { grid-column: 2; grid-row: 2 / span 2; width: auto; margin: 0; padding: 10px 16px; }
.dict-tools { display: flex; gap: 10px; margin-bottom: 20px; }
.dict-tools .search { margin: 0; flex: 1; }
.dict-tools button { width: auto; margin: 0; padding: 0 18px; white-space: nowrap; }
.term-card {
  width: min(560px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 20px;
  background: var(--panel); color: var(--text); box-shadow: 0 30px 80px var(--shadow);
}
.term-card::backdrop { background: rgba(0, 0, 0, .6); }
.term-card[open] { animation: card-pop .2s ease-out; }
@keyframes card-pop { from { transform: scale(.96); opacity: 0; } }
.tc-inner { position: relative; padding: 28px; }
.tc-kicker { color: var(--gold-ink); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.term-card h2 { font-size: clamp(2rem, 8vw, 2.8rem); margin: 8px 0 12px; letter-spacing: -.02em; }
.term-card p { font-size: 1.1rem; line-height: 1.5; margin: 0 0 12px; }
.term-card .moral { color: var(--gold-ink); font-style: italic; font-weight: 600; }
.tc-actions { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; margin-top: 18px; }
.tc-actions button { margin: 0; padding: 12px 8px; font-size: .92rem; }
.tc-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.tc-nav button { width: 52px; margin: 0; padding: 8px 0; }
.tc-nav .hint { margin: 0; }
.tc-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; margin: 0; padding: 0; background: var(--inset); color: var(--muted); border: 1px solid var(--line); border-radius: 50%; font-size: .9rem; }
@media (max-width: 600px) {
  .tc-actions { grid-template-columns: 1fr; }
  .wotd { grid-template-columns: 1fr; }
  .wotd button { grid-column: 1; grid-row: auto; width: 100%; margin-top: 8px; }
}
@media (prefers-reduced-motion: reduce) { .term:hover { transform: none; } .term-card[open] { animation: none; } }

/* Wide (desktop) grids */
@media (min-width: 1000px) {
  .tools { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  #terms { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
  #terms .card { margin: 0; }
  #list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; align-items: start; }
  #list > .card { margin: 0; }
  #list > .card.result:only-child { grid-column: 1 / -1; }
  .trophies { grid-template-columns: repeat(3, 1fr); }
  .board { grid-template-columns: repeat(5, 1fr); }
  .shop { grid-template-columns: repeat(2, 1fr); }
  .feed { grid-template-columns: repeat(2, 1fr); align-items: start; }
}
@media (min-width: 1400px) {
  .tools { grid-template-columns: repeat(4, 1fr); }
  .trophies { grid-template-columns: repeat(4, 1fr); }
}

/* Money rain (secret) */
.rain { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 60; }
.rain span { position: absolute; top: -60px; font-size: 2rem; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
.poked { display: inline-block; animation: wobble .4s ease-in-out; cursor: pointer; }
@keyframes wobble { 25% { transform: rotate(-18deg) scale(1.15); } 75% { transform: rotate(14deg) scale(1.1); } }
@media (prefers-reduced-motion: reduce) { .rain { display: none; } .poked { animation: none; } }

/* Confession Wall */
textarea { resize: vertical; min-height: 88px; line-height: 1.45; }
#confess > label { margin-bottom: 14px; }
.count { align-self: flex-end; font-size: .8rem; }
.confession .story { font-size: 1.1rem; line-height: 1.5; margin: 0 0 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.confession .meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--muted); font-size: .85rem; }
.coin-tag { border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; color: var(--text); font-weight: 600; }
.confession .damage { color: var(--down); font-weight: 600; }
.feel {
  width: auto; margin: 0 0 0 auto; padding: 6px 12px; font-size: .95rem;
  background: var(--inset); color: var(--text); border: 1px solid var(--line);
}
.feel[aria-pressed="true"] { border-color: var(--gold); color: var(--gold-ink); opacity: 1; cursor: default; }

/* Hall of Shame */
.filters { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 20px; }
.filters button {
  width: auto; margin: 0; padding: 8px 14px; font-size: .9rem; font-weight: 600;
  background: var(--panel); color: var(--muted); border: 1px solid var(--line);
}
.filters button[aria-pressed="true"] { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.shame { position: relative; }
.shame .meta { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: .85rem; margin-bottom: 6px; }
.shame .kind { border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.shame h3 { margin: 0 0 8px; font-size: 1.35rem; }
.shame p { margin: 0 0 10px; line-height: 1.5; }
.shame .damage { color: var(--down); font-weight: 600; }
.shame .today { color: var(--gold-ink); font-weight: 600; }
.shame .moral { color: var(--muted); font-style: italic; margin: 0; }

@media (max-width: 600px) {
  .row { grid-template-columns: 1fr; }
  .actions { grid-template-columns: 1fr; }
  .tools { grid-template-columns: 1fr; }
  .traits { grid-template-columns: 1fr; }
  .items { grid-template-columns: 1fr; }
  .signs { grid-template-columns: repeat(3, 1fr); }
  .facts { grid-template-columns: 1fr; }
  .trophies { grid-template-columns: 1fr; }
  .tokenomics { grid-template-columns: 1fr; justify-items: center; }
  .legend-list { width: 100%; }
  .coin-form { grid-template-columns: 1fr; }
  .pet-actions { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(2, 1fr); }
  .mine { width: 130px; height: 130px; font-size: 3.6rem; }
  .panic { width: 170px; height: 170px; }
  .key { padding: 13px 0; font-size: .85rem; }
  .bingo { gap: 4px; }
  .cell { padding: 3px; border-radius: 8px; }
  .coins .px { display: none; }
  .coins li { grid-template-columns: 1fr auto; }
}

/* Meme Generator */
.meme-layout { display: grid; gap: 20px; align-items: start; }
@media (min-width: 1000px) { .meme-layout { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } }
.meme-preview { padding: 12px; }
canvas#meme { display: block; width: 100%; height: auto; aspect-ratio: 1; border-radius: 12px; background: #000; }
.meme-controls { display: grid; gap: 14px; }
.meme-controls h2 { margin: 0; }
.templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.tpl { margin: 0; padding: 0; border-radius: 10px; background: var(--inset); color: var(--muted); border: 2px solid var(--line); overflow: hidden; display: flex; flex-direction: column; }
.tpl canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.tpl span { font-size: .68rem; font-weight: 600; padding: 4px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 30%, transparent); }
.meme-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.meme-row button { margin-top: 0; }
.meme-controls .actions button { margin-top: 0; }
label.upload-btn {
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 12px; font-weight: 700; font-size: 1.05rem; text-align: center;
}
label.upload-btn:hover { border-color: var(--gold); }
label.upload-btn:focus-within { outline: 2px solid var(--gold); }

/* Bag Roaster */
.roast-form .meme-row { margin-top: 12px; }
.roast-head, .roast-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 48px; gap: 8px; align-items: center; }
.roast-head { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.roast-row { margin-bottom: 8px; }
.roast-row .remove { margin: 0; padding: 12px 0; height: 100%; }
.grade { font-size: clamp(4.5rem, 20vw, 7rem); font-weight: 700; line-height: 1; letter-spacing: -.04em; color: var(--gold-ink); }
.grade[data-grade="A"] { color: var(--up); }
.grade[data-grade="D"], .grade[data-grade="F"] { color: var(--down); }
.roast-result .roast { margin-top: 8px; }
.roast-chart { display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: center; margin: 22px auto 0; max-width: 520px; text-align: left; }
.roast-lines { list-style: none; padding: 0; margin: 22px auto 0; max-width: 560px; text-align: left; display: grid; gap: 10px; }
.roast-lines li { display: flex; gap: 12px; background: var(--inset); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; line-height: 1.45; }
.roast-lines li span { flex: none; font-size: 1.3rem; }

/* Real or Fake? */
.hl-top { display: flex; justify-content: space-between; color: var(--muted); font-size: .9rem; margin-bottom: 10px; }
.hl-top b { color: var(--text); }
.combo { color: #ff8a3d; font-weight: 800; }
.combo:not(:empty) { animation: r-bounce .4s ease-out; }
.hl-text { font-size: clamp(1.35rem, 4.5vw, 1.9rem); font-weight: 700; line-height: 1.3; min-height: 4.2em; display: flex; align-items: center; justify-content: center; margin: 10px 0; overflow-wrap: anywhere; }
.headline-game { transition: box-shadow .2s; }
.headline-game.right { box-shadow: 0 0 0 2px var(--up); }
.headline-game.wrong { box-shadow: 0 0 0 2px var(--down); }

@media (max-width: 600px) {
  .roast-chart { grid-template-columns: 1fr; justify-items: center; }
  .roast-chart .legend-list { width: 100%; }
  .roast-head, .roast-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; }
  .meme-row { grid-template-columns: 1fr; }
}

/* ---------- Homepage ---------- */
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--muted); font-size: .8rem; font-weight: 600; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 0 var(--up); animation: live 1.8s infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.home-hero { display: grid; gap: 24px; padding: 28px 0 8px; }
.home-hero h1 { font-size: clamp(2.3rem, 8.5vw, 4.4rem); line-height: 1; letter-spacing: -.025em; margin: 0 0 14px; }
.nowrap { white-space: nowrap; }
.hh-sub { color: var(--muted); font-size: 1.12rem; line-height: 1.5; margin: 0; max-width: 480px; }
.hh-ctas { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.hh-ctas .button { margin: 0; flex: 1 1 200px; }
.hh-side { position: relative; }
.mascot {
  position: absolute; z-index: 2; top: -44px; right: 4px; width: 88px; height: 88px; margin: 0; padding: 0;
  font-size: 3.4rem; line-height: 1; background: none; border: 0; cursor: pointer; filter: drop-shadow(0 8px 16px var(--shadow));
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.mascot:hover { filter: drop-shadow(0 8px 16px var(--shadow)); }
a.card.ticker { display: block; margin: 0; padding: 18px 20px 14px; color: var(--text); text-decoration: none; transition: border-color .15s; }
a.card.ticker:hover { border-color: var(--gold); }
.ticker-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; padding-right: 84px; font-size: 1.05rem; }
.ticker-head > span:first-child { font-size: 1.5rem; }
.ticker-head .chg { margin-left: auto; font-weight: 700; }
#ticker { list-style: none; margin: 0; padding: 0; }
#ticker li { display: grid; grid-template-columns: 1fr auto 82px; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); font-size: .95rem; }
#ticker li b { font-weight: 500; }
#ticker li i { font-style: normal; text-align: right; font-weight: 700; }
#ticker .ticker-off { display: block; color: var(--muted); }
.ticker-more { display: block; margin-top: 8px; color: var(--muted); font-size: .82rem; }
.cope-quote { margin: 14px 4px 0; color: var(--muted); font-style: italic; line-height: 1.45; }
.cope-quote small { display: block; font-style: normal; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; margin-bottom: 4px; color: var(--gold-ink); }

.today-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
a.card.daily { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; margin: 0; padding: 20px 16px 16px; color: var(--text); text-decoration: none; transition: transform .15s, border-color .15s; }
a.card.daily:hover { border-color: var(--gold); transform: translateY(-2px); }
.daily-icon { display: grid; place-items: center; width: 60px; height: 60px; margin-bottom: 8px; border-radius: 16px; font-size: 1.9rem; background: color-mix(in srgb, var(--tile) 22%, var(--panel)); border: 2px solid color-mix(in srgb, var(--tile) 55%, transparent); }
a.card.daily > b { font-family: var(--font-display); font-size: 1.25rem; }
a.card.daily small { color: var(--muted); font-size: .82rem; }
.daily-status { margin-top: 8px; font-size: .88rem; font-weight: 600; color: var(--gold-ink); }
.daily-status[data-done="true"] { color: var(--up); }
.daily-status[data-done="lost"] { color: var(--down); }
a.card.daily .daily-btn { display: block; width: 100%; margin-top: auto; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; font-weight: 700; font-size: .9rem; }
.daily-status { margin-bottom: 12px; }
a.card.daily:hover .daily-btn { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
a.card.daily-stats { align-items: stretch; text-align: left; gap: 10px; }
.daily-stats > b { margin-bottom: 4px; }
.ds-row { display: flex; justify-content: space-between; font-size: .92rem; color: var(--muted); }
.ds-row b { color: var(--text); }

.popular { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
a.card.pop { display: flex; flex-direction: column; margin: 0; padding: 12px 12px 16px; color: var(--text); text-decoration: none; transition: transform .15s, border-color .15s; }
a.card.pop:hover { border-color: var(--gold); transform: translateY(-2px); }
a.card.pop > b { font-family: var(--font-display); font-size: 1.2rem; margin: 12px 6px 2px; }
a.card.pop > span:last-child { color: var(--muted); font-size: .9rem; margin: 0 6px; }
.pop-art { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 140px; border-radius: 12px; overflow: hidden; }
.art-roast { background: linear-gradient(135deg, #3a1610, #1d0f12); }
.art-roast svg { width: 104px; height: 104px; }
.art-grade { position: absolute; font-family: var(--font-display); font-weight: 800; font-size: 2.2rem; color: #ff5c7a; }
.art-news { background: linear-gradient(135deg, #f6f1e3, #e9e1cb); color: #1b1d24; padding: 14px; gap: 10px; }
.news-line { font-family: var(--font-display); font-weight: 700; font-size: .98rem; line-height: 1.2; text-align: center; }
.news-btns { display: flex; gap: 6px; }
.news-btns span { white-space: nowrap; padding: 4px 9px; border-radius: 999px; font-size: .72rem; font-weight: 700; color: #fff; }
.news-btns .yes { background: #12994a; } .news-btns .no { background: #dc2650; }
.art-hold { background: linear-gradient(180deg, #11151d, #1b1220); justify-content: flex-end; }
.art-hold svg { position: absolute; inset: 14px 0 34px; width: 100%; height: calc(100% - 48px); }
.art-badge { position: relative; margin-bottom: 10px; padding: 4px 12px; border-radius: 999px; background: #ffd23f; color: #1a1500; font-weight: 800; font-size: .78rem; }
.art-meme { background: linear-gradient(180deg, #ffb347, #ff6a3d); gap: 2px; }
.meme-top, .meme-bot { font-family: Impact, "Arial Black", sans-serif; font-size: 1.05rem; color: #fff; letter-spacing: .02em; text-shadow: -1.5px -1.5px 0 #000, 1.5px -1.5px 0 #000, -1.5px 1.5px 0 #000, 1.5px 1.5px 0 #000; }
.meme-face { font-size: 2.4rem; line-height: 1.2; }

/* Tool cards: emoji sits on a soft tile */
.tool .emoji { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--inset); border: 1px solid var(--line); font-size: 1.6rem; margin-bottom: 12px; }
.card.tool { transition: transform .15s, border-color .15s; }
.card.tool:hover { transform: translateY(-2px); }

@media (min-width: 700px) {
  .today-grid, .popular { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1000px) {
  .home-hero { grid-template-columns: 1.25fr 1fr; align-items: center; gap: 48px; padding: 40px 0 16px; }
}
@media (max-width: 600px) {
  /* Long tool lists become compact rows on phones. */
  .tools { gap: 8px; }
  .tools .card.tool { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 12px 14px; }
  .tools .card.tool .emoji { grid-row: 1 / 3; width: 44px; height: 44px; font-size: 1.4rem; margin: 0; }
  .tools .card.tool b { margin: 0; font-size: 1.02rem; }
  .tools .card.tool span:last-child { font-size: .85rem; }
}
@media (max-width: 420px) {
  .news-line { font-size: .85rem; }
  .today-grid, .popular { gap: 10px; }
  .news-btns span { padding: 3px 7px; font-size: .66rem; }
  a.card.daily { padding: 16px 10px 12px; }
  .daily-icon { width: 50px; height: 50px; font-size: 1.6rem; }
  .pop-art { height: 116px; }
  #ticker li { grid-template-columns: 1fr auto 70px; font-size: .88rem; }
}
@media (prefers-reduced-motion: reduce) { .mascot, .live-dot { animation: none; } a.card.daily:hover, a.card.pop:hover, .card.tool:hover { transform: none; } }

/* ---------- Shared results screen (Duolingo-style) ---------- */
dialog.results {
  width: min(440px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; padding: 32px 24px 24px; margin: auto;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 24px; text-align: center;
  box-shadow: 0 30px 80px var(--shadow); --tone: var(--gold);
}
dialog.results[data-tone="good"] { --tone: var(--up); }
dialog.results[data-tone="bad"] { --tone: var(--down); }
dialog.results::backdrop { background: rgba(0, 0, 0, .55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
dialog.results[open] { animation: r-pop .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes r-pop { from { transform: scale(.85) translateY(20px); opacity: 0; } }
.r-burst { position: absolute; inset: 0 0 auto; height: 180px; pointer-events: none; background: radial-gradient(220px 140px at 50% 0, color-mix(in srgb, var(--tone) 28%, transparent), transparent 70%); }
.r-emoji { position: relative; font-size: 5rem; line-height: 1.1; animation: r-bounce .9s .15s ease-out both; }
@keyframes r-bounce { 0% { transform: scale(0) rotate(-20deg); } 60% { transform: scale(1.18) rotate(6deg); } 100% { transform: none; } }
.r-kicker { position: relative; margin: 10px 0 0; font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--tone); }
.r-title { position: relative; font-family: var(--font-display); font-size: clamp(1.6rem, 6vw, 2rem); line-height: 1.1; margin: 6px 0 8px; color: var(--tone); }
.r-line { color: var(--muted); margin: 0 auto; max-width: 340px; line-height: 1.45; }
.r-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.r-tile { border: 2px solid var(--c); border-radius: 14px; overflow: hidden; animation: r-tile .4s ease-out both; }
.r-tile:nth-child(2) { animation-delay: .1s; } .r-tile:nth-child(3) { animation-delay: .2s; }
@keyframes r-tile { from { transform: translateY(12px); opacity: 0; } }
.r-tile span { display: block; padding: 4px 4px; background: var(--c); color: #111; font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.r-tile b { display: block; padding: 10px 4px 12px; font-family: var(--font-num); font-size: 1.15rem; color: var(--text); overflow-wrap: anywhere; }
.r-actions { display: grid; gap: 10px; margin-top: 22px; }
.r-actions button { margin: 0; }

/* ---------- Answer bar ---------- */
.answer-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 18px 16px max(18px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--up) 18%, var(--panel)); border-top: 2px solid var(--up);
}
.answer-bar[data-right="false"] { background: color-mix(in srgb, var(--down) 16%, var(--panel)); border-top-color: var(--down); }
.answer-bar.show { animation: ab-up .25s ease-out; }
@keyframes ab-up { from { transform: translateY(100%); } }
.ab-inner { max-width: 860px; margin: 0 auto; display: grid; gap: 12px; }
.ab-text b { font-family: var(--font-display); font-size: 1.35rem; color: var(--up); }
.answer-bar[data-right="false"] .ab-text b { color: var(--down); }
.ab-text p { margin: 4px 0 0; color: var(--text); line-height: 1.45; font-size: .95rem; }
.ab-inner button { margin: 0; background: var(--up); color: var(--on-up); }
.answer-bar[data-right="false"] .ab-inner button { background: var(--down); color: #fff; }
@media (min-width: 700px) {
  .ab-inner { grid-template-columns: 1fr 220px; align-items: center; gap: 24px; }
}
@media (min-width: 1000px) { .answer-bar { left: 264px; padding: 22px 40px; } }
@media (prefers-reduced-motion: reduce) { dialog.results[open], .r-emoji, .r-tile, .answer-bar.show { animation: none; } }

/* ---------- Pto the mascot ---------- */
.pto { display: block; width: 100%; height: 100%; overflow: visible; }
.pto .pto-body { transform-origin: 60px 110px; animation: pto-bob 2.6s ease-in-out infinite; }
.pto .pto-shadow { transform-origin: 60px 112px; animation: pto-shadow 2.6s ease-in-out infinite; }
.pto-laugh .pto-body { animation: pto-laugh .5s ease-in-out infinite alternate; }
.pto-cry .pto-tears { animation: pto-drip 1.2s ease-in infinite; }
.pto-shock .pto-body { animation: pto-shake .35s ease-in-out 3; }
@keyframes pto-bob { 50% { transform: translateY(-5px); } }
@keyframes pto-shadow { 50% { transform: scaleX(.85); opacity: .12; } }
@keyframes pto-laugh { from { transform: rotate(-4deg) translateY(0); } to { transform: rotate(4deg) translateY(-3px); } }
@keyframes pto-drip { 0% { transform: translateY(-2px); opacity: 1; } 100% { transform: translateY(5px); opacity: .6; } }
@keyframes pto-shake { 25% { transform: translateX(-3px) rotate(-3deg); } 75% { transform: translateX(3px) rotate(3deg); } }
@media (prefers-reduced-motion: reduce) { .pto .pto-body, .pto .pto-shadow, .pto .pto-tears { animation: none; } }
.r-mascot { position: relative; width: 120px; height: 120px; margin: 0 auto; animation: r-bounce .7s .1s ease-out both; }
.r-badge { position: absolute; right: -14px; bottom: 2px; display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; background: var(--panel); border: 3px solid var(--tone); font-size: 1.6rem; box-shadow: 0 4px 12px var(--shadow); }
.page-mascot { width: 130px; height: 130px; margin: 0 auto 6px; }
.r-facts { display: grid; gap: 8px; margin: 18px 0 0; text-align: left; }
.r-facts div { background: var(--inset); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.r-facts dt { font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--tone); }
.r-facts dd { margin: 2px 0 0; line-height: 1.4; }
.r-tiles:empty { display: none; }

/* ---------- Trophy case ---------- */
.trophy-head { display: grid; grid-template-columns: 110px 1fr; gap: 20px; align-items: center; margin-top: 24px; }
.th-mascot { width: 110px; height: 110px; }
.th-info small { color: var(--gold-ink); font-weight: 700; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; }
.th-info h1 { margin: 2px 0 10px; font-size: clamp(1.7rem, 6vw, 2.4rem); line-height: 1.05; }
.th-bar { height: 12px; border-radius: 999px; background: var(--inset); border: 1px solid var(--line); overflow: hidden; }
.th-bar span { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #ffd23f, #ff8a3d); transition: width .5s; }
.th-info p { margin: 8px 0 0; color: var(--muted); font-size: .92rem; }
.th-info .th-next { color: var(--text); font-weight: 600; margin-top: 2px; }
.seg { display: flex; gap: 4px; padding: 4px; margin: 6px 0 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.seg button { flex: 1; margin: 0; padding: 9px 8px; border-radius: 10px; background: none; color: var(--muted); font-size: .92rem; }
.seg button span { font-family: var(--font-num); font-size: .78rem; opacity: .7; margin-left: 2px; }
.seg button[aria-selected="true"] { background: var(--gold); color: var(--on-gold); }
.seg button:hover { filter: none; color: var(--text); }
.seg button[aria-selected="true"]:hover { color: var(--on-gold); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 22px 14px; margin-bottom: 8px; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
.hex {
  position: relative; display: grid; place-items: center; width: 92px; height: 104px; margin-bottom: 8px;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: var(--line);
}
.hex::before { content: ""; position: absolute; inset: 4px; clip-path: inherit; background: var(--inset); }
.hex span { position: relative; font-size: 2.3rem; filter: grayscale(1); opacity: .45; }
.badge.got .hex { background: linear-gradient(160deg, hsl(var(--h) 85% 62%), hsl(calc(var(--h) + 40) 75% 42%)); filter: drop-shadow(0 6px 10px var(--shadow)); }
.badge.got .hex::before { background: radial-gradient(circle at 50% 30%, hsl(var(--h) 90% 82%), hsl(var(--h) 70% 55%)); inset: 5px; }
.badge.got .hex span { filter: none; opacity: 1; }
.badge.got:hover .hex { transform: rotate(-6deg) scale(1.05); transition: transform .15s; }
.badge.secret:not(.got) .hex { background: repeating-linear-gradient(45deg, var(--line) 0 6px, transparent 6px 12px); }
.badge b { font-family: var(--font-display); font-size: .98rem; line-height: 1.15; }
.badge:not(.got) b { color: var(--muted); }
.badge small { color: var(--muted); font-size: .78rem; line-height: 1.35; }
.badge .when { color: var(--gold-ink); font-weight: 600; margin-top: 2px; }
@media (max-width: 420px) {
  .trophy-head { grid-template-columns: 80px 1fr; gap: 14px; padding: 18px; }
  .th-mascot { width: 80px; height: 80px; }
  .badges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ==========================================================
   Glass theme: frosted surfaces floating over a slow aurora.
   Surfaces use --panel (translucent) + backdrop blur; inner wells use --inset.
   ========================================================== */
body { background: var(--bg); }
body::before {
  content: ""; position: fixed; inset: -25vmax; z-index: -1; pointer-events: none;
  background:
    radial-gradient(34vmax 28vmax at 38% 30%, var(--blob1), transparent 70%),
    radial-gradient(36vmax 30vmax at 78% 38%, var(--blob2), transparent 70%),
    radial-gradient(34vmax 28vmax at 62% 72%, var(--blob3), transparent 70%),
    radial-gradient(30vmax 26vmax at 30% 66%, var(--blob4), transparent 70%);
  animation: aurora 38s ease-in-out infinite alternate;
}
@keyframes aurora {
  0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  50% { transform: translate3d(4vmax, -3vmax, 0) rotate(8deg) scale(1.06); }
  100% { transform: translate3d(-3vmax, 3vmax, 0) rotate(-6deg) scale(1.02); }
}
/* Subtle grain so the gradients don't band. */
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.card, .sheet, dialog.results, .term-card, .finder, .seg, .eyebrow, .mute, .theme, .find, #toasts > *, .answer-bar, dialog {
  -webkit-backdrop-filter: blur(22px) saturate(160%); backdrop-filter: blur(22px) saturate(160%);
}
.card {
  border-color: var(--edge); border-radius: 22px;
  box-shadow: inset 0 1px 0 var(--hi), 0 12px 40px -12px var(--shadow);
}
a.card:hover, .card.tool:hover { border-color: color-mix(in srgb, var(--gold) 70%, var(--edge)); box-shadow: inset 0 1px 0 var(--hi), 0 18px 50px -14px var(--shadow), 0 0 0 1px color-mix(in srgb, var(--gold) 35%, transparent); }
dialog.results, .sheet { background: var(--panel); border-color: var(--edge); box-shadow: inset 0 1px 0 var(--hi), 0 30px 80px var(--shadow); }
.mute, .theme, .find, .eyebrow, .seg { border-color: var(--edge); box-shadow: inset 0 1px 0 var(--hi); }
button.ghost, a.button.ghost, label.upload-btn { background: color-mix(in srgb, var(--panel) 60%, transparent); border-color: var(--edge); box-shadow: inset 0 1px 0 var(--hi); }
button:not([class]):not([aria-pressed]):not([role="tab"]):not([data-v]), button[type="submit"]:not(.ghost), a.button.primary { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 8px 22px -8px color-mix(in srgb, var(--gold) 70%, transparent); }
input, select, textarea { border-color: var(--edge); }

/* Phone: glass top bar + floating pill tab bar */
.top { background: color-mix(in srgb, var(--panel) 70%, transparent); border-bottom-color: var(--edge); -webkit-backdrop-filter: blur(22px) saturate(160%); backdrop-filter: blur(22px) saturate(160%); }
.tabbar {
  left: 12px; right: 12px; bottom: max(10px, env(safe-area-inset-bottom)); padding: 6px;
  border: 1px solid var(--edge); border-radius: 26px; background: var(--panel);
  box-shadow: inset 0 1px 0 var(--hi), 0 16px 40px -10px var(--shadow);
  -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%);
}
.tab { border-radius: 20px; }
.tab[aria-current="page"] { background: color-mix(in srgb, var(--gold) 22%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold) 40%, transparent); }
body { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
#toasts { bottom: calc(100px + env(safe-area-inset-bottom)) !important; }
.answer-bar { z-index: 45; }

/* Desktop: the sidebar floats as a glass panel */
@media (min-width: 1000px) {
  body { padding-bottom: 0; padding-left: 280px; }
  .top {
    top: 14px; left: 14px; bottom: 14px; width: 252px; padding: 22px 12px 14px;
    background: var(--panel); border: 1px solid var(--edge); border-radius: 24px;
    box-shadow: inset 0 1px 0 var(--hi), 0 20px 60px -20px var(--shadow);
    -webkit-backdrop-filter: blur(26px) saturate(160%); backdrop-filter: blur(26px) saturate(160%);
  }
  #nav a[aria-current="page"] { background: color-mix(in srgb, var(--gold) 20%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold) 35%, transparent); }
  #nav a:hover, button.nav-heading:hover { background: var(--inset); }
  #toasts { left: calc(50% + 140px) !important; }
  .answer-bar { left: 280px; right: 14px; bottom: 14px; border-radius: 22px; border: 2px solid var(--up); }
  .answer-bar[data-right="false"] { border-color: var(--down); }
}

/* Anyone who asked for less transparency gets solid surfaces. */
@media (prefers-reduced-transparency: reduce) {
  :root { --panel: var(--panel-solid) !important; }
  body::before, body::after { display: none; }
}
@media (prefers-reduced-motion: reduce) { body::before { animation: none; } }
