/* The rooms of light share this page: the room full screen, the site's bar over it fading while you play, the card
   that says what to do, and the fallback. Each room's style.css sets the colours below. */
:root {
  color-scheme: dark;
  --bg: #050407;
  --text: #f3eef0;
  --muted: #b9b2b8;
  --quiet: #8a8590;
  --accent: #f4c9d6;
  --accent-rgb: 244 201 214;
  --hair: rgb(255 255 255 / 13%);
  --hover: rgb(255 255 255 / 8%);
  --glass: rgb(8 6 12 / 55%);
  --lab: linear-gradient(100deg, #ffffff 10%, var(--accent) 70%);
  --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: var(--hover);
  --tipo-accent: var(--accent);
  --tipo-accent-bg: rgb(var(--accent-rgb) / 14%);
  --tipo-lab: var(--lab);
  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(440px, calc(100vw - 48px));
  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-played .card { opacity: 0; transform: translateY(8px); }

/* ---------- a line the room says now and then (bottom right) ---------- */
.say {
  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);
}
.say.is-shown { opacity: 1; transform: none; }
.say-name { display: block; font: 500 20px/1.3 var(--serif); letter-spacing: 0.08em; }
html[data-lang='en'] .say-name { letter-spacing: 0.02em; }
.say-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 room's line sits under the bar, so it never meets the card at the bottom. */
  .say { top: calc(max(8px, env(safe-area-inset-top)) + 58px); bottom: auto; right: 16px; left: 16px; max-width: none; text-align: left; }
}

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