:root {
  --ink: #fbf8f2;
  --ink-dim: rgba(251, 248, 242, 0.62);
  --pill: rgba(20, 18, 15, 0.38);
  --pill-line: rgba(255, 255, 255, 0.14);
  --bg: #1a1712;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
}
#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: none; }

.veil {
  position: fixed; inset: 0; background: var(--bg); pointer-events: none;
  transition: opacity 1.2s ease;
}
.veil.gone { opacity: 0; }

.hud {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: max(16px, env(safe-area-inset-top)) 20px 0;
  pointer-events: none;
}
.brand { font-weight: 600; letter-spacing: -0.01em; font-size: 17px; text-shadow: 0 1px 12px rgba(0,0,0,.35); }
.score {
  display: flex; gap: 8px; align-items: center;
  font-size: 13px; color: var(--ink-dim);
  padding: 7px 12px; border-radius: 999px;
  background: var(--pill); border: 1px solid var(--pill-line);
  backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  font-variant-numeric: tabular-nums;
}
.score b { color: var(--ink); font-weight: 600; }
.score .dot { opacity: .5; }

.hint {
  position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  font-size: 13px; color: var(--ink); white-space: nowrap;
  padding: 8px 14px; border-radius: 999px;
  background: var(--pill); border: 1px solid var(--pill-line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: opacity .6s ease; pointer-events: none;
}
.hint.gone { opacity: 0; }
.k-touch { display: none; }
@media (hover: none) { .k-touch { display: inline; } .k-mouse { display: none; } }

.toast {
  position: fixed; left: 50%; top: 22%; transform: translate(-50%, 8px);
  font-size: clamp(22px, 4vw, 34px); font-weight: 700; letter-spacing: -0.02em;
  text-shadow: 0 2px 24px rgba(0,0,0,.45);
  opacity: 0; transition: opacity .25s ease, transform .35s cubic-bezier(.2,.9,.3,1.3);
  pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.foot {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px max(14px, env(safe-area-inset-bottom));
}
.swatches { display: flex; gap: 8px; }
.sw {
  width: 28px; height: 28px; border-radius: 50%; padding: 3px; cursor: pointer;
  background: transparent; border: 1.5px solid transparent;
}
.sw i { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25), 0 1px 6px rgba(0,0,0,.3); }
.sw.active { border-color: var(--ink); }
.sound {
  font: inherit; font-size: 12px; color: var(--ink); cursor: pointer;
  padding: 6px 11px; border-radius: 999px;
  background: var(--pill); border: 1px solid var(--pill-line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.fine { margin: 0 0 0 auto; font-size: 11px; color: var(--ink-dim); text-shadow: 0 1px 8px rgba(0,0,0,.4); }
.xlink { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.xlink:visited { color: var(--ink); }
@media (max-width: 520px) {
  .fine { display: none; }
  .xlink { margin-left: auto; }
  .hud { padding-left: 16px; padding-right: 16px; }
  .foot { padding-left: 16px; padding-right: 16px; }
}
