/* ===================== Tokens ===================== */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #111318;
  --muted: #646b78;
  --border: #e5e7ec;
  --accent: #2560f0; /* a touch darker than #2f6bff so blue text passes 4.5:1 on white and on --accent-soft */
  --accent-soft: #e9f0ff;
  --accent-text: #ffffff;
  --ok: #18a058;
  --warn: #d38b00;
  --over: #e5484d;
  --stage-bg: #ffffff;
  --shadow: 0 1px 2px rgb(16 24 40 / .04), 0 8px 24px rgb(16 24 40 / .06);
  --radius: 20px;
  --nav-h: 64px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0d10; --surface: #15171c; --surface-2: #1d2027; --text: #eceef2; --muted: #9097a3; --border: #262a33;
    --accent: #6b93ff; --accent-soft: #1b2440; --accent-text: #0c0d10; --ok: #3ccf7e; --warn: #f2b84b; --over: #ff6369;
    --stage-bg: #111317; --shadow: 0 0 0 1px rgb(255 255 255 / .02); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0d10; --surface: #15171c; --surface-2: #1d2027; --text: #eceef2; --muted: #9097a3; --border: #262a33;
  --accent: #6b93ff; --accent-soft: #1b2440; --accent-text: #0c0d10; --ok: #3ccf7e; --warn: #f2b84b; --over: #ff6369;
  --stage-bg: #111317; --shadow: 0 0 0 1px rgb(255 255 255 / .02); color-scheme: dark;
}

/* ===================== Base ===================== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.65 var(--font);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  word-break: keep-all; /* Korean: break between words, not inside them */
  overflow-wrap: anywhere;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
/* Japanese and Chinese have no spaces: let lines break between characters, following kinsoku rules */
:lang(ja) body, :lang(zh-Hant) body, body:lang(ja), body:lang(zh-Hant) { word-break: normal; line-break: strict; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
kbd {
  font: 600 .78em/1 var(--font); padding: 3px 6px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
}
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* ===================== Header ===================== */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.site-header .wrap { display: flex; align-items: center; gap: 4px; height: 60px; }
.logo { font-weight: 800; font-size: 1.12rem; color: var(--text); letter-spacing: -0.035em; margin-right: auto; }
.lang-switch {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 10px;
  color: var(--muted); font-size: .88rem; font-weight: 600;
}
.lang-switch:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.lang-menu { position: relative; }
.lang-menu > summary { list-style: none; cursor: pointer; min-height: 40px; height: 40px; }
.lang-menu > summary::-webkit-details-marker { display: none; }
.lang-menu[open] > summary { background: var(--surface-2); color: var(--text); }
.lang-menu ul {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 160px; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
}
.lang-menu li a, .lang-menu li button {
  display: flex; align-items: center; width: 100%; min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px;
  background: none; color: var(--text); font: inherit; font-size: .95rem; text-align: left; cursor: pointer;
}
.lang-menu li a:hover, .lang-menu li button:hover { background: var(--surface-2); text-decoration: none; }
.lang-menu [aria-current="true"] { font-weight: 700; color: var(--accent); }
:lang(ja) { --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, "Noto Sans JP", system-ui, sans-serif; }
:lang(zh-Hant) { --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif; }
.lang-hint {
  display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 44px 8px 16px; position: relative;
  background: var(--accent-soft); color: var(--text); font-size: .9rem; text-align: center;
}
.lang-hint a { font-weight: 650; }
.lang-hint button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 8px; font-size: 1rem; }
.lang-hint button:hover { background: var(--surface); }
.logo:hover { text-decoration: none; }
.logo span { color: var(--accent); }
.icon-btn {
  background: transparent; border: 0; border-radius: 12px; color: var(--muted);
  width: 40px; height: 40px; cursor: pointer; display: inline-grid; place-items: center; font-size: 1.05rem;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ===================== Tool ===================== */
.tool { margin: 28px auto 8px; }
.tool h1 { font-size: clamp(1.55rem, 4.2vw, 2.1rem); line-height: 1.25; font-weight: 750; margin: 0 0 6px; letter-spacing: -0.035em; }
.tool .tagline { margin: 0 0 20px; color: var(--muted); font-size: 1.02rem; }

.stage {
  position: relative;
  background: var(--stage-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 20px 26px;
  text-align: center;
  transition: background-color .4s, border-color .4s;
}
/* The timer display is always a dark panel (also on the light site), so the colour fill and the characters stand out.
   Themed rooms keep their own dark colours. */
body:not([data-room-theme]) .stage, body[data-room-theme="classic"] .stage {
  --stage-bg: #121829; --text: #f3f5fa; --muted: #a3acbf; --surface-2: #262f47; --border: #232b42;
  --accent: #6b93ff; --accent-soft: #1b2440; --accent-text: #0c0d10; --ok: #3ccf7e; --warn: #f2b84b; --over: #ff6369;
  color: var(--text); color-scheme: dark;
}
/* Background fill: as time passes, colour seeps up from the bottom with a soft, blurred edge until it fills the stage
   (--left: 1 → 0, set by timer.js / room.js). Colour follows the state: accent while running, amber in the warning
   period, red once time is up. */
@property --left { syntax: "<number>"; inherits: true; initial-value: 1; }
.stage { isolation: isolate; --left: 1; --fill: var(--accent); transition: background-color .4s, border-color .4s, --left .25s linear; }
.stage::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  --gone: calc(1 - var(--left));
  opacity: clamp(0, calc(var(--gone) * 30), 1); /* nothing at all before the start */
  background: linear-gradient(to top,
    color-mix(in srgb, var(--fill) 46%, transparent) 0,
    color-mix(in srgb, var(--fill) 27%, transparent) calc(var(--gone) * 80%),
    transparent calc(var(--gone) * 80% + 20%));
}
.stage[data-state="warn"] { --fill: var(--warn); }
.stage[data-state="over"], .stage[data-state="done"] { --fill: var(--over); }
/* time is up: the whole stage is washed red */
.stage[data-state="over"]::before, .stage[data-state="done"]::before { opacity: 1; background: linear-gradient(to top, color-mix(in srgb, var(--fill) 40%, transparent), color-mix(in srgb, var(--fill) 22%, transparent)); }
.stage-label { min-height: 1.5em; font-weight: 600; color: var(--muted); font-size: clamp(1rem, 2.6vw, 1.25rem); letter-spacing: -0.02em; }
.stage-seg { min-height: 1.4em; font-size: .92rem; color: var(--muted); margin-top: 12px; }
.time {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "ss01" 1;
  font-weight: 650;
  font-size: clamp(68px, 19vw, 196px);
  line-height: 1;
  letter-spacing: -0.045em;
  margin: 10px 0 20px;
  transition: color .3s;
}
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; max-width: 560px; margin: 0 auto; }
.progress > div { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .25s linear, background-color .3s; }

.stage[data-state="warn"] .time { color: var(--warn); }
.stage[data-state="warn"] .progress > div { background: var(--warn); }
.stage[data-state="over"] .time, .stage[data-state="done"] .time { color: var(--over); }
.stage[data-state="over"] .progress > div, .stage[data-state="done"] .progress > div { background: var(--over); }
.stage[data-state="done"] .time { animation: blink 1s steps(2, start) 6; }
@keyframes blink { to { visibility: hidden; } }
/* End alarm off button (shown while the alarm repeats) */
.ring-stop { position: relative; z-index: 5; display: inline-flex; margin-top: 16px; min-height: 48px; padding: 0 22px; font-size: 1.05rem; animation: ring-pulse 1.2s ease-in-out infinite; }
.ring-stop[hidden] { display: none; }
.stage:fullscreen .ring-stop, .stage.pseudo-fs .ring-stop { min-height: 64px; padding: 0 32px; font-size: 1.4rem; }
@keyframes ring-pulse { 50% { transform: scale(1.06); } }

.stage.tint[data-state="run"] { background: color-mix(in srgb, var(--ok) 14%, var(--stage-bg)); border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.stage.tint[data-state="run"] .progress > div { background: var(--ok); }
.stage.tint[data-state="warn"] { background: color-mix(in srgb, var(--warn) 16%, var(--stage-bg)); border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.stage.tint[data-state="over"], .stage.tint[data-state="done"] { background: color-mix(in srgb, var(--over) 15%, var(--stage-bg)); border-color: color-mix(in srgb, var(--over) 45%, var(--border)); }

.stage-tools { position: absolute; top: 12px; right: 12px; display: flex; gap: 4px; }

/* Fullscreen */
.stage:fullscreen, .stage.pseudo-fs {
  border-radius: 0; border: 0; box-shadow: none; display: flex; flex-direction: column; justify-content: center; align-items: stretch;
  width: 100vw; height: 100vh; padding: 4vh 4vw;
}
.stage.pseudo-fs { position: fixed; inset: 0; z-index: 1000; height: 100dvh; }
.stage:fullscreen .time, .stage.pseudo-fs .time { font-size: min(30vw, 55vh); }
.stage:fullscreen .stage-label, .stage.pseudo-fs .stage-label { font-size: min(5vw, 6vh); }
.stage:fullscreen .stage-seg, .stage.pseudo-fs .stage-seg { font-size: min(3.2vw, 3.6vh); }
.stage:fullscreen .progress, .stage.pseudo-fs .progress { max-width: none; width: 78%; height: 1.2vh; }

/* Animal friends: a strip below the clock where little animals stroll, eat, play ball and nap (timer.js → pets()) */
.pets { position: relative; z-index: -1; height: 1.6em; margin: 14px 1.5em 0 0; font-size: clamp(26px, 7vw, 36px); line-height: 1; pointer-events: none; user-select: none; -webkit-user-select: none; }
.pets[hidden] { display: none; }
.pet, .pet-item { position: absolute; bottom: 0; left: 0; white-space: nowrap; }
.pet { animation: pet-in .45s cubic-bezier(.3, 1.5, .5, 1) backwards; animation-delay: var(--d, 0s); }
.pet-f, .pet-b { display: block; }
.pet svg { display: block; width: 1.5em; height: 1.5em; overflow: visible; }
.pet .pc { display: none; }
.pet .pe { transform-box: fill-box; transform-origin: 50% 50%; animation: pet-blink 4.6s infinite; animation-delay: var(--d, 0s); }
.pet.p-nap .pe, .pet-b.p-roll .pe, .pet-b.p-loll .pe { display: none; }
.pet.p-nap .pc, .pet-b.p-roll .pc, .pet-b.p-loll .pc { display: block; }
.pet-b.p-walk .pf1 { animation: pet-foot .34s ease-in-out infinite alternate; }
.pet-b.p-walk .pf2 { animation: pet-foot .34s ease-in-out infinite alternate-reverse; }
.pet-b.p-run .pf1, .pet-b.p-run .pf2 { animation-duration: .2s; }
.pet-b.p-roll { transform-origin: 50% 58%; animation: pet-roll var(--t, 1.5s) linear; }
.pet-b.p-loll { transform-origin: 50% 62%; animation: pet-loll 4.6s; }
.pet-item svg { display: block; width: 1.1em; height: 1.1em; }
.pet-b { transform-origin: 50% 100%; }
.pet-b.p-walk { animation: pet-walk .34s ease-in-out infinite alternate; }
.pet-b.p-run { animation-duration: .2s; }
.pet-b.p-munch { animation: pet-munch .28s ease-in-out infinite alternate; }
.pet-b.p-hop { animation: pet-hop .6s ease-in-out 2; }
.pet-b.p-kick { animation: pet-kick .35s ease-out; }
.pet.p-nap .pet-b { animation: pet-liedown .6s ease-out both, pet-snooze 2.6s ease-in-out .6s infinite alternate; }
.pet.p-nap::after { content: "💤"; position: absolute; left: 70%; bottom: 72%; font-size: .42em; animation: pet-zzz 2.2s ease-in-out infinite; }
.pets[data-mode="party"] .pet-b { animation: pet-hop .7s ease-in-out infinite; animation-delay: var(--d, 0s); }
.pet-item { font-size: .58em; animation: pet-in .35s cubic-bezier(.3, 1.5, .5, 1) backwards; }
.pet-item.p-gone { transform: scale(0); transform-origin: 50% 100%; transition: transform 2.2s ease-in .2s; }
.pet-item.p-ball { transition: left 1.2s cubic-bezier(.15, .7, .3, 1), transform 1.2s cubic-bezier(.15, .7, .3, 1); }
/* arms (paws) rest at the sides; the poses below move them */
.pet-b { position: relative; }
.pet .pa1, .pet .pa2 { transform-box: fill-box; transform-origin: 50% 50%; }
.pet-b.p-walk .pa1 { animation: pet-swing .34s ease-in-out infinite alternate; }
.pet-b.p-walk .pa2 { animation: pet-swing .34s ease-in-out infinite alternate-reverse; }
.pet-b.p-munch .pa1 { transform: translate(14px, -8px); }
.pet-b.p-munch .pa2 { transform: translate(-22px, -8px); }
.pet-b.p-strain { animation: pet-strain 1.7s ease-in-out; }
.pet-b.p-ear { animation: pet-tilt 2.8s ease-in-out; }
.pet-b.p-ear .pa1 { animation: pet-earpick 2.8s ease-in-out; }
.pet-b.p-wash .pa1 { animation: pet-wash1 3s ease-in-out; }
.pet-b.p-wash .pa2 { animation: pet-wash2 3s ease-in-out; }
.pet-b.p-wash::before, .pet-b.p-wash::after { content: ""; position: absolute; top: 46%; left: 14%; width: .13em; height: .16em; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; background: #6ec6ff; opacity: 0; animation: pet-drop .6s ease-out .4s 4; }
.pet-b.p-wash::after { left: 72%; --dx: .5em; animation-delay: .7s; }
.pet-b.p-stretch { animation: pet-stretch 2s ease-in-out; }
.pet-b.p-stretch .pa1, .pet-b.p-stretch .pa2 { animation: pet-armsup 2s ease-in-out; }
.pet-b.p-dance { animation: pet-dance 3.2s ease-in-out; }
.pet-b.p-dance .pa1 { animation: pet-armup 3.2s ease-in-out; }
.pet-b.p-dance .pa2 { animation: pet-armup2 3.2s ease-in-out; }
.pet-b.p-dance::before { content: "♪"; position: absolute; left: 78%; top: -6%; font-size: .5em; font-weight: 700; color: var(--accent); animation: pet-note 1.6s ease-out infinite; }
.pet-b.p-wave .pa1 { animation: pet-wave 2s ease-in-out; }
.pets[data-mode="party"] .pa1, .pets[data-mode="party"] .pa2 { transform: translateY(-22px); }
.pet-b.p-strain .pe, .pet-b.p-ear .pe, .pet-b.p-wash .pe, .pet-b.p-stretch .pe { display: none; }
.pet-b.p-strain .pc, .pet-b.p-ear .pc, .pet-b.p-wash .pc, .pet-b.p-stretch .pc { display: block; }
.pet-item.p-poop svg { width: .9em; height: .9em; }
.pet-item.p-poop { transition: opacity .6s, transform .6s; transform-origin: 50% 100%; }
.pet-item.p-poop.p-fade { opacity: 0; transform: scale(.4); }
.pet-item.p-fly { bottom: .9em; font-size: .5em; animation: pet-flutter .5s ease-in-out infinite alternate; transition: left 2s linear, opacity .6s, bottom 1s ease-in; }
.pet-item.p-fly.p-away { bottom: 3.2em; opacity: 0; }
@keyframes pet-swing { from { transform: translateY(-3px); } to { transform: translateY(3px); } }
@keyframes pet-strain { 0%, 100% { transform: none; } 15%, 85% { transform: scale(1.07, .88); } 30%, 50%, 70% { transform: scale(1.07, .88) translateX(-1.5%); } 40%, 60%, 80% { transform: scale(1.09, .85) translateX(1.5%); } }
@keyframes pet-tilt { 0%, 100% { transform: rotate(0); } 12%, 88% { transform: rotate(-8deg); } }
@keyframes pet-earpick { 0%, 100% { transform: none; } 14%, 32%, 50%, 68%, 86% { transform: translate(3px, -31px); } 23%, 41%, 59%, 77% { transform: translate(7px, -36px); } }
@keyframes pet-wash1 { 0%, 100% { transform: none; } 12%, 36%, 60%, 84% { transform: translate(11px, -14px); } 24%, 48%, 72% { transform: translate(15px, -24px); } }
@keyframes pet-wash2 { 0%, 100% { transform: none; } 12%, 36%, 60%, 84% { transform: translate(-25px, -24px); } 24%, 48%, 72% { transform: translate(-21px, -14px); } }
@keyframes pet-drop { from { opacity: .9; transform: translate(0, 0); } to { opacity: 0; transform: translate(var(--dx, -.5em), -.35em); } }
@keyframes pet-stretch { 0%, 100% { transform: none; } 30% { transform: scale(1.14, .86); } 60%, 80% { transform: scale(.93, 1.1); } }
@keyframes pet-armsup { 0%, 30%, 100% { transform: none; } 60%, 80% { transform: translateY(-26px); } }
@keyframes pet-dance { 0%, 100% { transform: none; } 12%, 37%, 62%, 87% { transform: rotate(-9deg) translateY(-.04em); } 25%, 50%, 75% { transform: rotate(9deg) translateY(-.04em); } }
@keyframes pet-armup { 0%, 25%, 50%, 75%, 100% { transform: none; } 12%, 37%, 62%, 87% { transform: translateY(-24px); } }
@keyframes pet-armup2 { 0%, 12%, 37%, 62%, 87%, 100% { transform: none; } 25%, 50%, 75% { transform: translateY(-24px); } }
@keyframes pet-note { from { opacity: 0; transform: translate(0, .2em); } 30% { opacity: 1; } to { opacity: 0; transform: translate(.3em, -.6em) rotate(15deg); } }
@keyframes pet-wave { 0%, 100% { transform: none; } 15%, 45%, 75% { transform: translate(-5px, -26px) rotate(-10deg); } 30%, 60%, 88% { transform: translate(-9px, -30px) rotate(20deg); } }
@keyframes pet-flutter { from { transform: translateY(-.25em) scaleX(1); } to { transform: translateY(.25em) scaleX(.55); } }
/* smooth joins: turning round, paws going back to the sides, a gentle breath while standing */
.pet-f { transition: transform .3s ease-in-out; }
.pet .pa1, .pet .pa2 { transition: transform .3s ease-in-out; }
.pet-b { animation: pet-breathe 2.8s ease-in-out infinite alternate; }
.pet-b.p-wake { animation: pet-wake .55s ease-out; }
.pet-b.p-trip { animation: pet-trip 1.9s; }
.pet-b.p-trip::before { content: "💫"; position: absolute; left: 30%; top: -14%; font-size: .5em; opacity: 0; animation: pet-stars 1.9s; }
.pet-b.p-scratch { animation: pet-tilt2 2.4s ease-in-out; }
.pet-b.p-scratch .pa2 { animation: pet-scratch 2.4s ease-in-out; }
.pet-b.p-scratch::after { content: "💦"; position: absolute; left: 4%; top: 6%; font-size: .36em; animation: pet-note 1.2s ease-out 2; }
.pet-b.p-trip .pe, .pet-b.p-scratch .pe { display: none; }
.pet-b.p-trip .pc, .pet-b.p-scratch .pc { display: block; }
@keyframes pet-breathe { from { transform: none; } to { transform: scale(1.015, .972); } }
@keyframes pet-liedown { from { transform: none; } to { transform: scale(1.05, .86); } }
@keyframes pet-wake { from { transform: scale(1.04, .88); } 60% { transform: scale(.97, 1.05); } to { transform: none; } }
@keyframes pet-trip { 0% { transform: none; animation-timing-function: ease-in; } 9% { transform: rotate(-14deg); animation-timing-function: ease-in; } 25% { transform: translateY(-.44em) rotate(-92deg); animation-timing-function: ease-out; } 32% { transform: translateY(-.53em) rotate(-84deg); animation-timing-function: ease-in; } 39%, 66% { transform: translateY(-.44em) rotate(-92deg); animation-timing-function: ease-in-out; } 88% { transform: rotate(7deg); } 100% { transform: none; } }
@keyframes pet-stars { 0%, 24% { opacity: 0; transform: scale(.4); } 30% { opacity: 1; transform: scale(1.2); } 62% { opacity: 1; transform: scale(1) rotate(40deg); } 74%, 100% { opacity: 0; transform: scale(.6) rotate(60deg); } }
@keyframes pet-tilt2 { 0%, 100% { transform: none; } 14%, 86% { transform: rotate(6deg); } }
@keyframes pet-scratch { 0%, 100% { transform: none; } 16%, 36%, 56%, 76% { transform: translate(-14px, -35px); } 26%, 46%, 66%, 86% { transform: translate(-20px, -39px); } }
.pet .pprop { transform-box: fill-box; transform-origin: 50% 50%; animation: pet-prop .5s linear infinite; }
@keyframes pet-prop { 50% { transform: scaleX(.15); } }
/* Scene "build": the skyline behind the builders */
.pets.pets-build { height: 2.5em; }
.city { position: absolute; left: 0; right: -1.5em; bottom: 0; display: flex; justify-content: space-around; align-items: flex-end; }
.bld { position: relative; flex: none; width: 1.05em; height: 2.1em; }
.bld svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.bld-plan { opacity: .1; filter: grayscale(1) brightness(1.6); transition: opacity .4s; }
.bld.now .bld-plan { opacity: .26; }
.bld-real { clip-path: inset(var(--clip, 100%) 0 0 0); transition: clip-path .5s linear; }
.bld .win { fill: #3a4563; transition: fill .8s; }
.pet-b.p-hammer .pa1 { animation: pet-hammer-arm 1.6s ease-in-out; }
.pet-b.p-hammer::before { content: "🔨"; position: absolute; left: -24%; top: 20%; font-size: .5em; transform-origin: 85% 85%; opacity: 0; animation: pet-hammer 1.6s ease-in-out; }
@keyframes pet-hammer-arm { 0%, 100% { transform: none; } 12%, 36%, 60%, 84% { transform: translate(-3px, -20px); } 24%, 48%, 72% { transform: translate(-6px, -8px); } }
@keyframes pet-hammer { 0%, 100% { opacity: 0; transform: rotate(0); } 12%, 36%, 60%, 84% { opacity: 1; transform: rotate(35deg); } 24%, 48%, 72% { opacity: 1; transform: rotate(-35deg); } }
/* Scene "soccer": pitch, goals and scoreboard behind the players */
.pets.pets-soccer { height: 2.15em; }
.pitch { position: absolute; left: 0; right: -1.5em; bottom: 0; height: 100%; }
.pitch::after { content: ""; position: absolute; left: 0; right: 0; bottom: -.06em; height: .14em; border-radius: 99px; background: #3fa86b; }
.goal { position: absolute; bottom: 0; left: 0; width: .8em; height: 1.15em; }
.goal svg { display: block; width: 100%; height: 100%; }
.goal-r { left: auto; right: 0; transform: scaleX(-1); }
.score { position: absolute; left: 50%; top: 0; transform: translateX(-50%); display: flex; align-items: center; gap: .45em; font-size: .4em; font-weight: 700; line-height: 1; padding: .3em .7em; border-radius: 99px; background: rgb(0 0 0 / .4); color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap; }
.score i { width: .7em; height: .7em; border-radius: 50%; background: #ef4444; }
.score .dot-b { background: #3b82f6; }
.score.p-flash { animation: pet-goal 1.2s ease-out; }
@keyframes pet-goal { 0%, 100% { transform: translateX(-50%) scale(1); } 20%, 60% { transform: translateX(-50%) scale(1.5); background: #f5c542; color: #1a1400; } 40% { transform: translateX(-50%) scale(1.25); } }
.pets-soccer .pet-item.p-ball { transition-property: left, transform, opacity; transition-timing-function: cubic-bezier(.15, .7, .3, 1); }
.pets-soccer .pet-item svg { width: .95em; height: .95em; }
/* Scenes "space", "farm" and "dino" reuse the skyline: parts go up (or grow) one by one */
.pets.pets-dino, .pets.pets-ocean { height: 2.3em; }
.bld.done .win { fill: var(--c, #ffe27a); }
.pets-farm .bld .win { fill: #6fbf73; }
.pets-farm .bld.done .win { fill: var(--c, #ffd43b); }
.pets-farm .city::after, .pets-dino .city::after, .pets-space .city::after, .pets-ocean .city::after { content: ""; position: absolute; left: 0; right: 0; bottom: -.06em; height: .14em; border-radius: 99px; background: #8a6a45; }
.pets-dino .city::after { background: #4c9a57; }
.pets-space .city::after { background: #7f8a9c; }
.pets-dino .bld, .pets-ocean .bld { opacity: .85; }
.pets-ocean .city::after { background: #e9c46a; }
.pets-winter .city::after { content: ""; position: absolute; left: 0; right: 0; bottom: -.06em; height: .14em; border-radius: 99px; background: #e8f1fb; }
.pets-winter .bld-xtree.done .win { animation: bk-twinkle .8s ease-in-out infinite alternate; } /* the tree lights blink once it is finished */
.pets-winter .bld-xtree.done .win:nth-child(2n) { animation-delay: -.4s; }
.pets-winter .bld-xtree { width: 1.25em; height: 2.5em; }
.bld-rocket { width: 1.25em; height: 2.5em; }
.pets[data-mode="party"] .bld-rocket { animation: pet-launch 3s cubic-bezier(.5, 0, .9, .4) .4s forwards; }
.pets[data-mode="party"] .bld-rocket::after { content: "🔥"; position: absolute; left: 50%; top: 92%; font-size: .6em; transform: translateX(-50%) rotate(180deg); animation: pet-flame .16s linear infinite alternate; }
@keyframes pet-launch { 0% { transform: translate(0, 0); } 8% { transform: translate(-.03em, 0); } 16% { transform: translate(.03em, -.05em); } 90% { opacity: 1; } 100% { transform: translate(0, -7.5em); opacity: 0; } }
@keyframes pet-flame { from { transform: translateX(-50%) rotate(180deg) scale(.85); } to { transform: translateX(-50%) rotate(180deg) scale(1.15); } }
.pet-b.p-water .pa1 { animation: pet-waterarm 1.6s ease-in-out; }
.pet-b.p-water::before, .pet-b.p-water::after { content: ""; position: absolute; left: -6%; top: 50%; width: .11em; height: .15em; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; background: #6ec6ff; opacity: 0; animation: pet-pour .45s ease-in .25s 3; }
.pet-b.p-water::after { left: -18%; animation-delay: .45s; }
@keyframes pet-waterarm { 0%, 100% { transform: none; } 15%, 85% { transform: translate(-7px, -12px); } }
@keyframes pet-pour { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(.55em); } }
/* Scene "battle": castles at both ends, knights duel in the middle (cartoon: stars and tumbles, nobody is hurt) */
.pets.pets-battle { height: 2.3em; }
.castle { position: absolute; bottom: 0; left: -.1em; width: 1.05em; height: 2.1em; transform-origin: 50% 100%; }
.castle svg { display: block; width: 100%; height: 100%; }
.castle-r { left: auto; right: -.1em; transform: scaleX(-1); }
.castle-l .flag { fill: #3b82f6; }
.castle-r .flag { fill: #ef4444; }
.castle-l.p-shake { animation: pet-shake .6s ease-in-out; }
.castle-r.p-shake { animation: pet-shake-r .6s ease-in-out; }
@keyframes pet-shake { 20%, 60% { transform: rotate(-4deg); } 40%, 80% { transform: rotate(4deg); } }
@keyframes pet-shake-r { 0%, 100% { transform: scaleX(-1); } 20%, 60% { transform: scaleX(-1) rotate(-4deg); } 40%, 80% { transform: scaleX(-1) rotate(4deg); } }
.pet-b.p-swing .pa1 { animation: pet-swing-arm .9s ease-in-out; }
.pet-b.p-swing::before { content: ""; position: absolute; left: -34%; top: 2%; width: 1.15em; height: 1.15em; font-size: .56em; background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><defs><linearGradient id='b' x1='0' x2='1'><stop offset='0' stop-color='%23f8fafc'/><stop offset='.5' stop-color='%23cbd5e1'/><stop offset='.5' stop-color='%2394a3b8'/><stop offset='1' stop-color='%2364748b'/></linearGradient><linearGradient id='g' x1='0' y1='0' x2='0' y2='1'><stop offset='0' stop-color='%23fff3b0'/><stop offset='1' stop-color='%23a86b12'/></linearGradient></defs><g transform='rotate(-45 50 50)'><path d='M50 2L57 14V70H43V14Z' fill='url(%23b)' stroke='%23475569' stroke-width='1.5' stroke-linejoin='round'/><path d='M50 9V67' stroke='%23fff' stroke-opacity='.7' stroke-width='1.4'/><rect x='33' y='68' width='34' height='7' rx='3.5' fill='url(%23g)' stroke='%237c4a0e' stroke-width='1.2'/><rect x='46' y='75' width='8' height='15' rx='2' fill='%235b3a24'/><circle cx='50' cy='93' r='5.5' fill='url(%23g)' stroke='%237c4a0e' stroke-width='1.2'/></g></svg>") center / contain no-repeat; filter: drop-shadow(0 .04em .05em rgb(0 0 0 / .4)); transform-origin: 90% 90%; opacity: 0; animation: pet-sword .9s ease-in-out; } /* a drawn, shaded sword */
@keyframes pet-swing-arm { 0%, 100% { transform: none; } 30% { transform: translate(-2px, -24px); } 55%, 70% { transform: translate(-9px, -8px); } }
@keyframes pet-sword { 0%, 100% { opacity: 0; transform: rotate(0); } 15% { opacity: 1; transform: rotate(0); } 30% { opacity: 1; transform: rotate(50deg); } 55%, 70% { opacity: 1; transform: rotate(-45deg); } 88% { opacity: 1; transform: rotate(0); } }
.pet-b.p-knock { animation: pet-knock 1.9s; }
.pet-b.p-knock::before { content: "💫"; position: absolute; left: 30%; top: -14%; font-size: .5em; opacity: 0; animation: pet-stars 1.9s; }
.pet-b.p-knock .pe { display: none; }
.pet-b.p-knock .pc { display: block; }
@keyframes pet-knock { 0% { transform: none; animation-timing-function: ease-in; } 22% { transform: translateY(-.44em) rotate(92deg); animation-timing-function: ease-out; } 30% { transform: translateY(-.53em) rotate(84deg); animation-timing-function: ease-in; } 38%, 66% { transform: translateY(-.44em) rotate(92deg); animation-timing-function: ease-in-out; } 88% { transform: rotate(-7deg); } 100% { transform: none; } }
.pet-item.p-spark { bottom: .5em; font-size: .6em; animation: pet-spark .45s ease-out both; }
@keyframes pet-spark { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
.pet-item.p-rock { transition: left 1.3s linear; animation: pet-arc 1.3s both; }
.pet-item.p-rock svg { width: .7em; height: .7em; }
@keyframes pet-arc { 0% { transform: translateY(-1.6em); animation-timing-function: cubic-bezier(.2, .6, .5, 1); } 50% { transform: translateY(-3.6em) rotate(180deg); animation-timing-function: cubic-bezier(.5, 0, .8, .4); } 100% { transform: translateY(-.6em) rotate(360deg); } }
/* Scene backdrops (petBack() in timer.js): a landscape behind the clock, anchored to the bottom of the stage */
.scene-back { position: absolute; inset: 0; z-index: -1; border-radius: inherit; overflow: hidden; pointer-events: none; opacity: .9;
  /* the sky (sun, moon, clouds, smoke) fades out behind the digits and progress bar so they stay easy to read */
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.15) 0, rgba(0,0,0,.15) 50%, #000 80%); mask-image: linear-gradient(to bottom, rgba(0,0,0,.15) 0, rgba(0,0,0,.15) 50%, #000 80%); }
.scene-back[hidden] { display: none; }
.scene-back svg { position: absolute; left: 0; bottom: 0; display: block; width: 100%; height: 62%; overflow: visible; } /* never taller than the lower part of the stage, so wide screens keep the landscape below the digits */
.bk-sway, .bk-swing, .bk-spin, .bk-flap, .bk-flag, .bk-smoke, .bk-bob, .bk-glow { transform-box: fill-box; }
.bk-sway { transform-origin: 50% 100%; animation: bk-sway 3.6s ease-in-out infinite alternate; }
.bk-swing { transform-origin: 50% 0; animation: bk-sway 2.8s ease-in-out infinite alternate; }
.bk-spin { transform-origin: 50% 50%; animation: bk-spin 9s linear infinite; }
.bk-flap { transform-origin: 50% 50%; animation: bk-flap .5s ease-in-out infinite alternate; }
.bk-flag { transform-origin: 0 50%; animation: bk-flag .9s ease-in-out infinite alternate; }
.bk-smoke { transform-origin: 50% 50%; opacity: 0; animation: bk-smoke 5s ease-out infinite; }
.bk-glow { transform-origin: 50% 100%; animation: bk-twinkle 1.6s ease-in-out infinite alternate; }
.bk-bob { animation: bk-bob 1.2s ease-in-out infinite alternate; }
.bk-twinkle { animation: bk-twinkle 3s ease-in-out infinite alternate; }
.bk-drift { animation: bk-drift 70s linear infinite; }
.bk-fly { animation: bk-fly 24s linear infinite; }
.bk-snow { animation: bk-snow 8s linear infinite; }
.bk-rise { animation: bk-rise 7s ease-in infinite; }
.bk-shoot { opacity: 0; animation: bk-shoot 9s ease-in infinite; }
@keyframes bk-sway { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
@keyframes bk-spin { to { transform: rotate(360deg); } }
@keyframes bk-flap { from { transform: scaleY(1); } to { transform: scaleY(.35); } }
@keyframes bk-flag { from { transform: skewY(-9deg) scaleX(1); } to { transform: skewY(9deg) scaleX(.86); } }
@keyframes bk-smoke { 0% { opacity: 0; transform: translate(0, 0) scale(.5); } 15% { opacity: .5; } 100% { opacity: 0; transform: translate(-16px, -60px) scale(2.2); } }
@keyframes bk-bob { from { transform: translateY(0); } to { transform: translateY(-3px); } }
@keyframes bk-twinkle { from { opacity: .25; } to { opacity: 1; } }
@keyframes bk-drift { from { transform: translateX(-260px); } to { transform: translateX(260px); } }
@keyframes bk-fly { from { transform: translateX(-160px); } to { transform: translateX(560px); } }
@keyframes bk-snow { from { transform: translateY(0); } to { transform: translateY(212px); } }
@keyframes bk-rise { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: .7; } 100% { transform: translateY(-190px); opacity: 0; } }
@keyframes bk-shoot { 0%, 86% { opacity: 0; transform: translate(120px, 20px); } 88% { opacity: 1; } 100% { opacity: 0; transform: translate(240px, 66px); } }
@keyframes pet-in { from { transform: scale(0); opacity: 0; } }
@keyframes pet-walk { from { transform: translateY(0) rotate(-4deg); } to { transform: translateY(-.08em) rotate(4deg); } }
@keyframes pet-munch { to { transform: rotate(-10deg) translateY(.03em); } }
@keyframes pet-hop { 0%, 100% { transform: translateY(0) scaleY(1); } 12% { transform: translateY(0) scaleY(.88); } 45% { transform: translateY(-.5em) scaleY(1.04); } }
@keyframes pet-blink { 0%, 93%, 100% { transform: scaleY(1); } 96.5% { transform: scaleY(.1); } }
@keyframes pet-foot { to { transform: translateY(-5px); } }
@keyframes pet-roll { to { transform: rotate(calc(var(--n, 1) * -360deg)); } }
@keyframes pet-loll { 0%, 100% { transform: none; } 7% { transform: scale(1.05, .93); } 20% { transform: translateX(-.16em) rotate(-100deg); } 32% { transform: translateX(-.04em) rotate(-66deg); } 47% { transform: translateX(-.42em) rotate(-196deg); } 60% { transform: translateX(-.1em) rotate(-74deg); } 73% { transform: translateX(-.3em) rotate(-150deg); } 84% { transform: translateX(-.12em) rotate(-96deg); } 95% { transform: rotate(7deg); } }
@keyframes pet-snooze { from { transform: scale(1.05, .86); } to { transform: scale(1.03, .9); } }
@keyframes pet-kick { 40% { transform: rotate(-16deg); } }
@keyframes pet-zzz { 0% { opacity: 0; transform: translate(0, .2em) scale(.7); } 40% { opacity: 1; } 100% { opacity: 0; transform: translate(.3em, -.5em) scale(1.1); } }
.stage:fullscreen .pets, .stage.pseudo-fs .pets { position: absolute; left: 4vw; right: calc(4vw + 1.5em); bottom: 3vh; margin: 0; font-size: min(9vh, 9vw); }
.stage.tv:fullscreen .pets, .stage.tv.pseudo-fs .pets { right: min(46vh, 55%); }

/* ===================== Buttons ===================== */
.controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 20px 0 14px; }
.btn {
  min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; font-weight: 600; font-size: 1rem; letter-spacing: -0.015em;
  display: inline-flex; align-items: center; gap: 8px; justify-content: center; white-space: nowrap;
  transition: background-color .15s, border-color .15s, transform .1s, filter .15s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; min-width: 120px; }
.btn.primary:hover { filter: brightness(1.07); background: var(--accent); }
.btn.share { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.btn.share:hover { filter: brightness(.98); background: var(--accent-soft); }
.btn[hidden] { display: none; }

.presets {
  display: flex; gap: 6px; justify-content: safe center; margin: 0 -16px 14px; padding: 2px 16px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.presets::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 40px; padding: 0 16px; border-radius: 99px; border: 0;
  background: var(--surface-2); color: var(--text); cursor: pointer; font-weight: 600; font-size: .94rem;
  transition: background-color .15s, color .15s;
}
.chip:hover { background: color-mix(in srgb, var(--surface-2) 70%, var(--border)); }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

/* ===================== Panels & forms ===================== */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 4px 18px; margin-top: 14px;
}
.panel[open] { padding-bottom: 16px; }
.panel summary {
  cursor: pointer; font-weight: 600; min-height: 48px; display: flex; align-items: center; justify-content: space-between;
  list-style: none; color: var(--text);
}
.panel summary::-webkit-details-marker { display: none; }
.panel summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s; margin-right: 4px; }
.panel[open] summary::after { transform: rotate(-135deg); }
form.panel { padding: 20px; }
.field-row { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end; margin-top: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: .86rem; font-weight: 500; color: var(--muted); }
.field input, .field select, .field textarea {
  min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 1rem; font-weight: 400;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.field input[type="number"] { width: 96px; }
.field input[type="checkbox"] { min-height: 0; width: 18px; height: 18px; accent-color: var(--accent); }
.field textarea { width: 100%; min-height: 140px; font-family: inherit; line-height: 1.6; }
.field.grow { flex: 1 1 260px; }
.hint { font-size: .85rem; color: var(--muted); margin: 8px 0 0; }

/* Agenda */
.agenda { list-style: none; padding: 0; margin: 16px auto 0; max-width: 520px; text-align: left; }
.agenda li { display: flex; justify-content: space-between; padding: 9px 14px; border-radius: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.agenda li.current { background: var(--accent-soft); color: var(--text); font-weight: 650; }
.agenda li.past { text-decoration: line-through; opacity: .55; }
.stage:fullscreen .agenda, .stage.pseudo-fs .agenda { display: none; }

/* ===================== Dialogs ===================== */
dialog {
  border: 1px solid var(--border); border-radius: 22px; background: var(--surface); color: var(--text);
  padding: 24px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 24px 64px rgb(0 0 0 / .22);
}
dialog::backdrop { background: rgb(10 12 16 / .45); backdrop-filter: blur(3px); }
dialog h2 { margin: 0 0 6px; font-size: 1.22rem; font-weight: 700; letter-spacing: -0.03em; }
.share-link { display: flex; gap: 8px; margin: 16px 0 10px; }
.share-link input { flex: 1; min-width: 0; min-height: 46px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); font-size: .92rem; color: var(--muted); }
.qr { display: grid; place-items: center; margin: 10px 0; min-height: 40px; }
.qr svg { width: 196px; height: 196px; background: #fff; border-radius: 14px; padding: 4px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }

/* ===================== Content ===================== */
.content { margin: 56px auto; }
.content > * { max-width: 720px; }
.content > .related, .content > .faq { max-width: none; }
.content h1 { font-size: clamp(1.55rem, 4vw, 2rem); letter-spacing: -0.035em; line-height: 1.3; }
.content h2 { font-size: 1.32rem; font-weight: 700; margin: 48px 0 12px; letter-spacing: -0.03em; line-height: 1.35; }
.content h2:first-child { margin-top: 0; }
.content h3 { font-size: 1.04rem; font-weight: 650; margin: 26px 0 6px; letter-spacing: -0.02em; }
.content p, .content li { color: color-mix(in srgb, var(--text) 86%, var(--muted)); line-height: 1.78; }
.content p { margin: 0 0 14px; }
.content ol, .content ul { padding-left: 1.25em; margin: 0 0 14px; }
.content li { margin-bottom: 8px; }
.content li::marker { color: var(--muted); }
.content strong { color: var(--text); font-weight: 650; }
.content .faq { display: grid; gap: 8px; }
.content .faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 0 18px; }
.content .faq summary { cursor: pointer; font-weight: 600; min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 12px; list-style: none; }
.content .faq summary::-webkit-details-marker { display: none; }
.content .faq summary::after { content: "+"; font-size: 1.3rem; font-weight: 400; color: var(--muted); transition: transform .2s; }
.content .faq details[open] summary::after { transform: rotate(45deg); }
.content .faq details p { margin: 0 0 16px; color: var(--muted); }
.related { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 14px; }
.related a {
  display: block; padding: 16px 18px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.related a:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow); transform: translateY(-1px); }
.related a strong { display: block; color: var(--text); font-weight: 650; margin-bottom: 2px; letter-spacing: -0.02em; }
.related a span { font-size: .9rem; color: var(--muted); line-height: 1.55; }

/* ===================== Footer & tab bar ===================== */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0 36px; color: var(--muted); font-size: .86rem; }
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 8px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar ul { list-style: none; margin: 0 auto; padding: 0; display: flex; max-width: 560px; }
.tabbar li { flex: 1; }
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: var(--nav-h); color: var(--muted); font-size: .72rem; font-weight: 600; letter-spacing: 0;
}
.tabbar a:hover { text-decoration: none; color: var(--text); }
.tabbar a svg { width: 22px; height: 22px; stroke-width: 1.8; }
.tabbar a[aria-current="page"] { color: var(--accent); }

/* ===================== Shared viewer page ===================== */
.viewer-body { padding-bottom: 0; }
.viewer { min-height: 100dvh; display: flex; flex-direction: column; }
.viewer .stage { flex: 1; border: 0; border-radius: 0; box-shadow: none; display: flex; flex-direction: column; justify-content: center; }
.viewer .time { font-size: min(28vw, 50vh); }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface); font-size: .88rem; flex-wrap: wrap; color: var(--muted); }
.sound-gate { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); z-index: 20; box-shadow: 0 10px 30px rgb(0 0 0 / .25); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: .92rem;
  opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 2000;
}
.toast.show { opacity: 1; }

/* Ad slots (see assets/ads.js) */
.ad-slot { min-height: 120px; margin: 28px auto; display: grid; place-items: center; max-width: 970px; overflow: hidden; }
.ad-slot.ad-preview { border: 1.5px dashed var(--border); border-radius: 16px; color: var(--muted); font-size: .86rem; background: color-mix(in srgb, var(--surface) 60%, transparent); }
@media (max-width: 600px) { .ad-slot { min-height: 100px; } }

@media (max-width: 480px) {
  .stage { padding: 30px 14px 22px; }
  .btn { padding: 0 16px; }
  .btn.primary { min-width: 104px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
