:root {
  color-scheme: dark;
  --bg: #050407;
  --text: #f3eef0;
  --muted: #b9b2b8;
  --quiet: #8a8590;
  --accent: #f4c9d6;
  --accent-rgb: 244 201 214;
  --hair: rgb(255 235 245 / 13%);
  --glass: rgb(8 6 12 / 55%);
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", Georgia, serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { min-width: 300px; overflow: hidden; background: var(--bg); }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }

#room {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ---------- top bar: the site's <tipo-bar> (/tipo/tipo.css) over the room, fading while you play ---------- */
tipo-bar {
  --tipo-fg: var(--text);
  --tipo-muted: var(--quiet);
  --tipo-line: var(--hair);
  --tipo-hover: rgb(255 235 245 / 8%);
  --tipo-accent: var(--accent);
  --tipo-accent-bg: rgb(var(--accent-rgb) / 14%);
  --tipo-lab: linear-gradient(100deg, #ffe4ec 10%, #f2b3c6 60%, #d8c9ff);
  position: fixed;
  z-index: 5;
  top: 0;
  left: 0;
  right: 0;
  max-width: none;
  pointer-events: none;
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
tipo-bar > * { pointer-events: auto; }
body.is-idle tipo-bar { opacity: 0; transform: translateY(-6px); }
body.is-idle tipo-bar > * { pointer-events: none; }

.top-actions { display: flex; gap: 8px; margin-left: auto; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--hair);
  border-radius: 50%;
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: border-color 0.3s;
}
.icon-btn:hover { border-color: rgb(var(--accent-rgb) / 45%); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .i-play { display: none; }
#pauseBtn[aria-pressed='true'] .i-pause { display: none; }
#pauseBtn[aria-pressed='true'] .i-play { display: inline; fill: currentColor; }

/* ---------- the card that says what to do, gone once you've done it ---------- */
.card {
  position: fixed;
  z-index: 3;
  left: max(24px, env(safe-area-inset-left));
  bottom: max(26px, env(safe-area-inset-bottom));
  width: min(420px, calc(100vw - 48px));
  padding: 0;
  pointer-events: none;
  transition: opacity 1.4s var(--ease), transform 1.4s var(--ease);
}
.card h1 {
  margin: 0 0 8px;
  font: 500 clamp(26px, 4vw, 34px) / 1.15 var(--serif);
  letter-spacing: 0.06em;
}
html[data-lang='en'] .card h1 { letter-spacing: 0.01em; }
.hint { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; text-wrap: pretty; }
body.has-bloomed .card { opacity: 0; transform: translateY(8px); }
/* A soft pool of dark behind the words, so they read over a bright sky or snow. */
.card::before,
.season::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: -48px -72px -40px -64px;
  background: radial-gradient(closest-side, rgb(8 6 14 / 62%), rgb(8 6 14 / 34%) 55%, transparent);
  pointer-events: none;
}
.season::before { inset: -36px -48px -32px -72px; }

/* ---------- the season's name, shown as it turns ---------- */
.season {
  position: fixed;
  z-index: 3;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(26px, env(safe-area-inset-bottom));
  max-width: min(360px, calc(100vw - 48px));
  margin: 0;
  text-align: right;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 1.6s var(--ease), transform 1.6s var(--ease);
}
.season.is-shown { opacity: 1; transform: none; }
.season-name { display: block; font: 500 20px/1.3 var(--serif); letter-spacing: 0.08em; }
html[data-lang='en'] .season-name { letter-spacing: 0.02em; }
.season-line { display: block; margin-top: 4px; color: var(--muted); font-size: 14px; line-height: 1.5; text-wrap: pretty; }

.fallback {
  position: fixed;
  z-index: 4;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  line-height: 1.6;
}
.fallback p { max-width: 420px; margin: 0; }
.btn { display: inline-block; padding: 10px 20px; border: 1px solid var(--hair); border-radius: 999px; color: var(--text); }

@media (max-width: 640px) {
  tipo-bar { padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); }
  .card { left: 16px; bottom: max(18px, env(safe-area-inset-bottom)); width: calc(100vw - 32px); }
  .hint { font-size: 14px; }
  /* On a phone the season's name sits above the card, so the two never share a line. */
  .season { right: 16px; left: 16px; max-width: none; bottom: calc(max(18px, env(safe-area-inset-bottom)) + 118px); text-align: left; }
  body.has-bloomed .season { bottom: max(18px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  tipo-bar, .card, .season { transition-duration: 0.01s; }
}
