/* ============================================================================
   Panelômetro — design system
   Dark "live telemetry instrument" aesthetic + warm civic-protest accent.
   System font stack (platform CSP blocks remote fonts); personality comes
   from weight, tracking, and a monospace telemetry readout.
   ========================================================================== */

:root {
  --bg: #0E0E11;
  --bg-2: #14141A;
  --surface: #1B1B22;
  --surface-2: #23232C;
  --border: #2A2A33;
  --border-2: #3A3A46;

  --text: #F2F1EC;
  --text-2: #B7B4AC;
  --text-3: #8E8C82;

  --accent: #FF4A1C;
  --accent-2: #FF6B3D;
  --ok: #3DDC97;
  --warn: #FFC53D;
  --danger: #FF4A1C;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 10px 34px rgba(0,0,0,.45);

  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --ease-spring: cubic-bezier(.22,.8,.3,1.25);

  /* Home hero backdrop bleed: how far the sound-field background reaches above
     the hero content (up under the sticky topbar) and below it (past the
     sub-text) so it fades out instead of ending on the copy. */
  --hero-rise: 120px;
  --hero-bottom-pad: 72px;
}

* { box-sizing: border-box; }
/* Author styles set explicit `display` values (e.g. .btn → inline-flex), which
   beat the UA stylesheet's [hidden]{display:none}.  Force the attribute to win. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  background-image:
    radial-gradient(1200px 500px at 50% -10%, rgba(255,74,28,.05), transparent 60%);
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, p { margin: 0; }

/* ------------------------------------------------------------------ Boot */
.boot {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  align-items: center;
  justify-content: center;
}
.boot-mark { font-size: 42px; animation: boot-bob 1.4s var(--ease-spring) infinite; }
.boot-bar {
  width: 120px; height: 3px; border-radius: 3px;
  background: var(--surface-2); overflow: hidden;
}
.boot-bar span {
  display: block; width: 40%; height: 100%;
  background: var(--accent); border-radius: 3px;
  animation: boot-slide 1.1s ease-in-out infinite;
}
@keyframes boot-slide { 0%{transform:translateX(-120%)} 100%{transform:translateX(320%)} }
@keyframes boot-bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-7px)} }

/* ---------------------------------------------------------------- Topbar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background .2s, border-color .2s;
}
.topbar.is-scrolled {
  background: rgba(14,14,17,.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
}
.topbar-inner {
  max-width: 860px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 12px 16px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; }
.brand-emoji { font-size: 22px; }
.brand-name {
  font-weight: 800; font-size: 18px; letter-spacing: -.02em;
}
.brand-name::after { content: ""; display: none; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* Language switch */
.lang-switch {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-pill);
}
.lang-btn {
  appearance: none; border: 0; background: transparent; color: var(--text-2);
  font-size: 12px; font-weight: 700; letter-spacing: .03em;
  padding: 6px 11px; min-height: 32px; border-radius: var(--radius-pill);
  transition: background .15s, color .15s;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active { background: var(--surface-2); color: var(--text); }

/* --------------------------------------------------------------- Buttons */
.btn {
  appearance: none; border: 0; border-radius: var(--radius-pill);
  font-weight: 700; font-size: 14.5px; letter-spacing: -.01em;
  padding: 0 18px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .1s var(--ease-spring), background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #150C06; box-shadow: 0 6px 20px rgba(255,74,28,.28); }
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost {
  background: transparent; color: var(--text-2);
  border: 1px solid var(--border-2); min-height: 36px; padding: 0 14px; font-size: 13.5px;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-3); background: var(--surface); }
.btn-icon {
  width: 40px; height: 40px; min-height: 40px; padding: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-2);
}
.btn-icon:hover { color: var(--text); border-color: var(--border-2); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }

.ic { display: inline-flex; width: 18px; height: 18px; flex: none; }
.ic svg { width: 100%; height: 100%; }

/* ------------------------------------------------------------ Layout wrap */
.wrap { max-width: 860px; margin: 0 auto; padding: 28px 16px 72px; }

/* --------------------------------------------------------- Home — hero */
.hero {
  position: relative;
  /* Negative margin raises the whole hero (and its backdrop) above `.wrap`'s
     top padding and under the header; the matching top padding keeps the text
     in its original position. Bottom padding gives the fade room to breathe.
     overflow is intentionally NOT hidden here: the sound-field backdrop layers
     below bleed to full viewport width via the 50vw negative-margin trick, and
     would be clipped by a hero-level overflow rule. */
  margin-top: calc(-1 * var(--hero-rise));
  padding: calc(22px + var(--hero-rise)) 0 var(--hero-bottom-pad);
}
.kicker {
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--accent);
  display: inline-flex; align-items: center; gap: 7px;
}
.kicker::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(255,74,28,.5); animation: pulse 2s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(255,74,28,.5)} 70%{box-shadow:0 0 0 7px rgba(255,74,28,0)} 100%{box-shadow:0 0 0 0 rgba(255,74,28,0)} }

.hero-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 16px; margin-top: 14px; }
.hero-title {
  font-size: clamp(28px, 6.5vw, 44px); font-weight: 800;
  line-height: 1.05; letter-spacing: -.03em; max-width: 16ch;
  text-wrap: pretty;
}
.hero-sub { color: var(--text-2); font-size: 15.5px; margin-top: 12px; max-width: 46ch; }
.hero .btn-primary { justify-self: center; font-size: 16.5px; min-height: 52px; padding: 0 26px; }

/* Live sound-field backdrop behind the hero copy: an accent glow, a looping
   shockwave pulse, and an animated audio-spectrum equalizer along the bottom.
   All layers sit at z-index 0, under the copy. */
.hero::before {
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  left: 50%; right: 50%; top: 0; bottom: 0;
  margin-left: -50vw; margin-right: -50vw;
  background: radial-gradient(640px 320px at 78% 34%, rgba(255,74,28,.16), transparent 68%);
}
.hero-bg {
  position: absolute; z-index: 0; pointer-events: none; color: var(--accent);
  left: 50%; right: 50%; top: 0; bottom: 0;
  margin-left: -50vw; margin-right: -50vw;
}
.hero-bg svg { display: block; width: 100%; height: 100%; }
.hero > :not(.hero-bg):not(.hero-eq) { position: relative; z-index: 1; }

/* Shockwave rings — a looping "bang" pulse from the upper-right focal point. */
.hero-ring {
  transform-box: fill-box; transform-origin: center;
  animation: hero-ring 4.2s cubic-bezier(.16,.7,.3,1) infinite;
  opacity: 0;
}
.hero-ring--2 { animation-delay: 1.4s; }
.hero-ring--3 { animation-delay: 2.8s; }
@keyframes hero-ring {
  0% { transform: scale(.12); opacity: .5; }
  65% { opacity: .16; }
  100% { transform: scale(9); opacity: 0; }
}

/* Audio-spectrum equalizer — a live loudness readout along the bottom. */
.hero-eq {
  position: absolute; bottom: 0; z-index: 0;
  left: 50%; right: 50%; margin-left: -50vw; margin-right: -50vw;
  height: 88px; display: flex; align-items: flex-end; gap: 3px;
  padding: 0 clamp(14px, 6vw, 84px);
  pointer-events: none; opacity: .34;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 72%);
  mask-image: linear-gradient(180deg, transparent, #000 72%);
}
.hero-eq span {
  flex: 1; min-width: 2px; border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, var(--accent-2), var(--accent) 58%, transparent);
  transform-origin: bottom;
  animation: hero-eq 1.4s ease-in-out infinite alternate;
}
@keyframes hero-eq { from { transform: scaleY(.08); } to { transform: scaleY(1); } }

@media (max-width: 480px) {
  .hero-eq { height: 56px; gap: 2px; opacity: .26; }
  .hero-eq span { min-width: 1px; }
}

/* ----------------------------------------------------- Home — list head */
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 34px 0 12px;
}
.panel-title {
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--text-3);
}

/* ----------------------------------------------------------- Topic list */
.topic-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.topic-row {
  display: grid; grid-template-columns: 40px 52px 1fr; gap: 14px; align-items: center;
  width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; color: var(--text);
  transition: border-color .15s, background .15s, transform .1s;
}
.topic-row:hover { border-color: var(--border-2); background: var(--surface-2); }
.topic-row:active { transform: scale(.995); }

.rank {
  font-family: var(--font-mono); font-size: 20px; font-weight: 700; color: var(--text-3);
  text-align: center;
}
.topic-row:nth-child(1) .rank { color: var(--accent); }
.topic-emoji {
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; font-size: 26px;
  background: rgba(var(--accent-rgb, 255,74,28), .13);
  border: 1px solid rgba(var(--accent-rgb, 255,74,28), .28);
}
.topic-main { min-width: 0; }
.topic-title { font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topic-chant { color: var(--text-3); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topic-meter-row { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.mini-meter { display: flex; gap: 2px; flex: 1; height: 6px; min-width: 0; }
.mini-seg { flex: 1; height: 6px; border-radius: 2px; background: var(--surface-2); transition: background .1s; }
.mini-seg.lit { box-shadow: 0 0 6px hsla(var(--hue), 90%, 55%, .5); }
.beating { display: inline-flex; align-items: baseline; gap: 4px; font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.beating-n { color: var(--text); font-size: 12px; }

/* ------------------------------------------------------- Home — news */
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  gap: 36px;
  align-items: start;
}
.home-col { min-width: 0; }

.news-list { display: flex; flex-direction: column; gap: 10px; }
.news-card-wrap { display: flex; flex-direction: column; }
.news-card {
  display: flex; gap: 12px; align-items: stretch;
  background: var(--surface); border: 1px solid var(--border);
  border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0;
  padding: 12px; color: var(--text);
  transition: border-color .15s, background .15s;
}
.news-card:hover { border-color: var(--border-2); background: var(--surface-2); }
.news-bang {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface); color: var(--accent);
  font-family: var(--font-mono); font-size: 11px; font-weight: 800;
  letter-spacing: .05em; text-transform: uppercase;
  padding: 8px 12px; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.news-bang:hover { background: var(--surface-2); border-color: var(--border-2); }
.news-bang .ic { width: 14px; height: 14px; }
.news-thumb {
  width: 84px; min-height: 84px; flex: none; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center; overflow: hidden;
}
.news-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-thumb-fallback { font-weight: 800; font-size: 20px; color: var(--text-3); }
.news-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.news-meta { display: flex; align-items: center; gap: 8px; }
.news-source {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase;
}
.news-time { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.news-title {
  font-size: 14px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.news-desc {
  color: var(--text-2); font-size: 12.5px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

@media (max-width: 720px) {
  .home-grid { grid-template-columns: 1fr; gap: 0; }
  .news-thumb { width: 64px; min-height: 64px; }
}

/* ----------------------------------------------------- Empty / skeleton */
.empty { text-align: center; padding: 64px 20px; color: var(--text-2); }
.empty-emoji { font-size: 44px; margin-bottom: 14px; }
.empty-title { font-size: 19px; font-weight: 800; color: var(--text); }
.empty-body { margin-top: 6px; font-size: 15px; }
.empty .btn { margin-top: 20px; }

.skeleton { display: flex; flex-direction: column; gap: 10px; }
.sk {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  height: 80px; position: relative; overflow: hidden;
}
.sk::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.04) 50%, transparent 80%);
  transform: translateX(-100%); animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

.error-state { text-align: center; padding: 60px 20px; color: var(--text-2); }
.error-state .btn { margin-top: 18px; }

/* ================================================================== Pot */
.pot-page { margin-top: -14px; }
.pot-topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.pot-topbar .group { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pot-topbar .group-left { flex: 1; min-width: 0; }

.pot-title {
  flex: 1; min-width: 0;
  font-size: clamp(18px, 4.6vw, 24px); font-weight: 800; letter-spacing: -.02em;
  line-height: 1.1; text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pot-desc { color: var(--text-2); font-size: 13.5px; margin: 0; text-align: left; }

.btn-share { min-height: 36px; padding: 0 12px; font-size: 13px; gap: 6px; }

.chant {
  margin: 10px auto 0; padding: 4px 16px; text-align: center;
  font-weight: 800; font-size: 16px; letter-spacing: -.01em;
  color: rgba(var(--accent-rgb, 255,74,28), 1);
  text-shadow: 0 0 24px rgba(var(--accent-rgb, 255,74,28), .35);
  min-height: 1.1em;
}

/* Pot stage — the big clickable pot */
.stage-wrap { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 6px 0 10px; }
.pot-stage {
  --accent: #FF4A1C; --accent-rgb: 255, 74, 28;
  position: relative; appearance: none; border: 0;
  width: min(46vw, 200px); aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center; padding: 0;
  background:
    radial-gradient(circle at 50% 32%, rgba(var(--accent-rgb), .18), transparent 64%),
    radial-gradient(circle at 50% 55%, var(--surface-2), var(--bg-2));
  border: 1px solid rgba(var(--accent-rgb), .32);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 24px 70px rgba(0,0,0,.55);
  transition: box-shadow .35s, border-color .35s, transform .1s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  overflow: visible;
}
.pot-stage:hover { border-color: rgba(var(--accent-rgb), .55); }
.pot-stage.is-loud {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 0 0 2px rgba(var(--accent-rgb), .28),
    0 0 72px rgba(var(--accent-rgb), .28),
    0 24px 70px rgba(0,0,0,.55);
}
.pot-stage.shaking { animation: shake .5s ease; }

.pot-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.pot-emoji { font-size: clamp(54px, 14vw, 80px); line-height: 1; filter: drop-shadow(0 8px 18px rgba(0,0,0,.5)); }
.pot-cta {
  font-family: var(--font-mono); font-size: 10px; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text);
  background: rgba(var(--accent-rgb), .18); border: 1px solid rgba(var(--accent-rgb), .35);
  padding: 5px 12px; border-radius: var(--radius-pill);
  white-space: nowrap;
}
.pot-stage.banging .pot-emoji { animation: bang .3s var(--ease-spring); }
@keyframes bang {
  0% { transform: scale(1) rotate(0); }
  35% { transform: scale(.9) rotate(-3deg); }
  70% { transform: scale(1.07) rotate(2.5deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes shake {
  0%,100%{transform:translate(0,0) rotate(0)} 20%{transform:translate(-3px,2px) rotate(-.5deg)}
  40%{transform:translate(3px,-2px) rotate(.5deg)} 60%{transform:translate(-2px,-2px)}
  80%{transform:translate(2px,2px)}
}
.shockwave {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(var(--accent-rgb), .7); pointer-events: none;
  animation: ripple .55s ease-out forwards;
}
@keyframes ripple { from { transform: scale(.55); opacity: .9; } to { transform: scale(1.3); opacity: 0; } }

.pot-hint {
  color: var(--text); font-size: 14px; font-weight: 700; letter-spacing: -.01em;
  margin-top: 8px; text-align: center;
  appearance: none; border: 0; background: none; padding: 0;
  display: block; width: 100%; font-family: inherit;
  cursor: pointer; transition: color .15s;
}
.pot-hint-share:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* --------------------------------------------------------- Celebration */
.celebrate-banner {
  position: absolute; left: 50%; top: 6%;
  transform: translate(-50%, -50%);
  z-index: 6;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border-2);
  color: var(--text); font-weight: 800; font-size: 15px;
  padding: 8px 16px; border-radius: var(--radius-pill);
  box-shadow: var(--shadow-2);
  pointer-events: none; white-space: nowrap;
  animation: celebrate-pop 1.7s var(--ease-spring) forwards;
}
.celebrate-emoji { font-size: 20px; }
@keyframes celebrate-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.14); }
  22% { transform: translate(-50%, -50%) scale(1); }
  78% { opacity: 1; transform: translate(-50%, -58%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -82%) scale(.9); }
}
.confetti {
  position: absolute; left: 50%; top: 42%;
  width: var(--size); height: var(--size);
  background: hsl(var(--hue), 90%, 60%);
  border-radius: 2px;
  pointer-events: none; z-index: 5;
  animation: confetti-burst var(--dur) cubic-bezier(.18,.68,.3,1) forwards;
}
@keyframes confetti-burst {
  0% { opacity: 1; transform: translate(-50%, -50%) translate(0, 0) rotate(0deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) rotate(var(--rot)); }
}

/* --------------------------------------------------------- Milestones */
/* All badges sit in one row under the pot; the next-badge progress bar sits
   to the pot's right. Compact on mobile, single row on desktop. */
.milestone-side {
  flex: none; width: 44px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.stage-spacer { display: none; }
.badge-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; }
.badge {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  width: 19px; min-width: 0; padding: 2px 0;
  border-radius: var(--radius-sm); background: var(--surface);
  border: 1px solid var(--border);
  transition: transform .12s var(--ease-spring), border-color .15s, background .15s, opacity .15s;
}
.badge.earned { border-color: rgba(255,197,61,.5); background: rgba(255,197,61,.09); }
.badge.locked { opacity: .4; filter: grayscale(.8); }
.badge-emoji { font-size: 14px; line-height: 1; }
.badge-n { display: none; }  /* number is desktop-only; too wide for mobile cells */
.badge.pop { animation: badge-pop .45s var(--ease-spring); }
@keyframes badge-pop { 0%{transform:scale(.3)} 60%{transform:scale(1.28)} 100%{transform:scale(1)} }

.milestone-bottom { display: flex; justify-content: center; margin-top: 2px; }

.badge-progress { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.badge-goal {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  font-family: var(--font-mono); color: var(--text-2); line-height: 1; text-align: center;
}
.goal-emoji { font-size: 18px; }
.goal-n { font-size: 9px; font-weight: 700; }
.badge-goal.done { color: var(--accent); }
.badge-bar {
  width: 10px; height: 90px; border-radius: var(--radius-pill);
  background: var(--surface-2); overflow: hidden;
  display: flex; align-items: flex-end;
}
.badge-fill {
  width: 100%; height: 0%;
  background: linear-gradient(180deg, #FFC53D, var(--accent));
  border-radius: var(--radius-pill); transition: height .18s ease;
}

@media (min-width: 641px) {
  /* Desktop: pot centered, progress to its far right, badges in one row below. */
  .stage-wrap { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 6px 0 6px; }
  .stage-spacer { display: block; }
  .milestone-side { width: 52px; }
  .milestone-side.milestone-right { justify-self: end; }
  .badge-row { flex-wrap: nowrap; gap: 6px; }
  .badge { width: 44px; padding: 4px 0; gap: 1px; }
  .badge-emoji { font-size: 22px; }
  .badge-n { display: block; font-family: var(--font-mono); font-size: 9px; font-weight: 700; color: var(--text-3); }
  .badge.earned .badge-n { color: var(--accent); }
  .badge-bar { width: 12px; height: 150px; }
  .goal-emoji { font-size: 24px; }
  .goal-n { font-size: 10px; }
  .milestone-bottom { margin-top: 6px; }
}

/* ----------------------------------------------------------------- Meter */
.meter { margin: 2px 0 0; }
.meter-readout { display: flex; align-items: baseline; justify-content: center; gap: 10px; }
.meter-num {
  font-family: var(--font-mono); font-size: clamp(34px, 8.5vw, 44px); font-weight: 800;
  letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums;
}
.meter-unit { font-family: var(--font-mono); color: var(--text-3); font-size: 13px; font-weight: 700; }
.meter-tier {
  font-weight: 800; font-size: 13px; letter-spacing: .02em; text-transform: uppercase;
  color: rgba(var(--accent-rgb, 255,74,28), 1); transition: color .3s;
  text-shadow: 0 0 20px rgba(var(--accent-rgb, 255,74,28), .35);
}

.meter-track { position: relative; max-width: 420px; margin: 8px auto 0; }
.meter-segments { display: flex; gap: 3px; height: 16px; }
.meter-seg { flex: 1; border-radius: 3px; background: var(--surface-2); transition: background .1s, box-shadow .1s; }
.meter-seg.lit { box-shadow: 0 0 8px hsla(var(--hue), 90%, 55%, .4); }
.meter-peak {
  position: absolute; top: -3px; bottom: -3px; width: 2px; border-radius: 2px;
  background: var(--text); transform: translateX(-1px); transition: left .08s linear;
}
/* Pot stats */
.pot-stats {
  display: flex; justify-content: center; gap: 8px; margin-top: 12px; flex-wrap: wrap;
}
.stat {
  min-width: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 14px; text-align: center;
}
.stat-value { font-family: var(--font-mono); font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--text-3); font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin-top: 1px; }

/* Permalink */
.permalink {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 12px auto 0; max-width: 460px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
}
.permalink-label { font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.permalink-url { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.permalink .btn { min-height: 36px; padding: 0 14px; font-size: 13px; }

/* ------------------------------------------------------------- Customize */
.customize {
  margin-top: 28px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
}
.customize-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.customize-title { font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.field { margin-bottom: 18px; }
.field-label { display: block; font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); margin-bottom: 8px; }

.emoji-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.emoji-opt {
  width: 48px; height: 48px; font-size: 24px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  display: grid; place-items: center; transition: border-color .15s, background .15s, transform .1s;
}
.emoji-opt:hover { border-color: var(--border-2); }
.emoji-opt.active { border-color: var(--accent); background: rgba(255,74,28,.14); }
.emoji-opt:active { transform: scale(.94); }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.swatch {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent;
  outline: 2px solid transparent; outline-offset: 2px; padding: 0;
  transition: outline-color .15s, transform .1s;
}
.swatch.active { outline-color: var(--text-3); }
.swatch:active { transform: scale(.92); }
.color-input {
  width: 34px; height: 34px; padding: 0; border: 1px solid var(--border);
  border-radius: 50%; background: var(--surface-2); cursor: pointer;
}

.field-input, .field-textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  padding: 11px 13px; font-size: 16px; font-family: inherit;
  transition: border-color .15s;
}
.field-textarea { resize: vertical; min-height: 76px; }
.field-input:focus, .field-textarea:focus { outline: none; border-color: var(--accent); }
.field-input::placeholder, .field-textarea::placeholder { color: var(--text-3); }

.customize-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ----------------------------------------------------------------- Modal */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(6,6,8,.7); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 460px; max-height: 88vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-2);
  animation: rise .22s var(--ease-spring);
}
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.modal-title { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.modal-close { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.form-error { color: var(--danger); font-size: 13.5px; margin-top: 12px; display: flex; align-items: center; gap: 6px; }

/* ----------------------------------------------------------------- Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  z-index: 120; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-2); border-radius: var(--radius-pill);
  padding: 11px 20px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-2); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ------------------------------------------------------------ Focus ring */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.pot-stage:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }

/* ----------------------------------------------------------- Responsive */
@media (min-width: 641px) {
  /* Desktop goes full width — drop the centered 860px column. */
  :root { --hero-bottom-pad: 92px; }
  .topbar-inner { max-width: none; padding: 14px clamp(22px, 4vw, 64px); }
  .wrap { max-width: none; padding: 34px clamp(22px, 4vw, 64px) 88px; }
  .brand-name { font-size: 19px; }
  .topic-row { padding: 16px 18px; grid-template-columns: 44px 56px 1fr; }
  .topic-emoji { width: 56px; height: 56px; font-size: 28px; }
  .topic-title { font-size: 17px; }
  .stat { min-width: 0; padding: 10px 18px; }
}

@media (max-width: 480px) {
  .hero-row { grid-template-columns: 1fr; }
  .hero-row .btn-primary { width: 100%; justify-self: stretch; }
  .btn { min-height: 44px; }
  .topic-row { grid-template-columns: 30px 46px 1fr; gap: 11px; padding: 13px 13px; }
  .topic-emoji { width: 46px; height: 46px; font-size: 23px; }
  .rank { font-size: 17px; }
  .stat { flex: 1 1 40%; min-width: 0; }
}

@media (max-width: 359px) {
  .topic-chant, .pot-hint { display: none; }
  .brand-name { font-size: 16px; }
  .btn-share .share-label { display: none; }
}

/* ---------------------------------------------------------- Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .kicker::before { animation: none; box-shadow: none; }
  .pot-stage.shaking, .pot-stage.banging .pot-emoji { animation: none; }
}
