:root {
  --bg: #0d0d0d;
  --ink: #f5f5f7;
  --muted: #a1a1aa;
  --line: rgba(255, 255, 255, .1);
  --red: #ff3b30;
  --panel: rgba(255, 255, 255, .045);
  --sans: ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
}

body {
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 82% 8%, rgba(255, 148, 64, .18), transparent 28%),
    radial-gradient(ellipse at 48% 62%, rgba(255, 32, 24, .12), transparent 36%),
    var(--bg);
}

body:has(.sheet),
html.is-live body { overflow: auto; }

::selection { background: var(--red); color: white; }

button, input, a { font: inherit; color: inherit; }

.sr, .skip {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip:focus {
  position: fixed;
  left: 16px;
  top: 16px;
  width: auto;
  height: auto;
  margin: 0;
  clip: auto;
  z-index: 20;
  padding: 8px 12px;
  background: #fff;
  color: #000;
  border-radius: 8px;
}

html:not(.is-live) body:not(:has(.sheet)) .panel,
html:not(.is-live) body:not(:has(.sheet)) .reveal,
html:not(.is-live) body:not(:has(.sheet)) .after,
html:not(.is-live) body:not(:has(.sheet)) .share-row,
html:not(.is-live) body:not(:has(.sheet)) .count,
html:not(.is-live) body:not(:has(.sheet)) #mute,
html:not(.is-live) body:not(:has(.sheet)) #logout {
  display: none;
}

html.is-account .login { display: none; }

html.is-account .core { grid-column: 2; }
html.is-account .board-panel { grid-column: 3; }

html:not(.is-live) body:not(:has(.sheet)) .stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 96px 40px 88px;
}

html:not(.is-live) body:not(:has(.sheet)) .core {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 0;
  width: min(1080px, 100%);
}

html:not(.is-live) body:not(:has(.sheet)) .copy {
  text-align: center;
  margin: 0;
}

.top {
  position: fixed;
  z-index: 6;
  top: 0;
  left: 0;
  right: 0;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(22px, env(safe-area-inset-right)) 0 max(22px, env(safe-area-inset-left));
  background: linear-gradient(var(--bg), transparent);
  pointer-events: none;
}

.mark, .tools, .textbtn, .legal { pointer-events: auto; }

.mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.logo {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #ff6b5b, #e10600 64%, #8a0000);
  box-shadow: 0 0 0 4px rgba(225, 6, 0, .18);
}

.accent { color: #ff2418; }

.short { display: none; }

.count {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 12px var(--red);
}

.tools {
  display: flex;
  align-items: center;
  gap: 16px;
}

.textbtn, .legal {
  border: 0;
  background: none;
  padding: 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
}

.textbtn:hover, .legal:hover { color: var(--ink); }

.textbtn[aria-pressed="true"] { color: var(--ink); }

.stage {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 96px 20px 92px;
}

.login { justify-self: end; }
.board-panel { justify-self: start; }

.core {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.copy { margin-bottom: 18px; }

.hint, .reveal, .after-lead {
  margin: 0;
}

.hero-title {
  margin: 0 0 14px;
  font-size: clamp(2.6rem, 5.6vw, 5.1rem);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: .95;
}

.hint {
  margin: 0;
  color: #c8c8ce;
  font-size: clamp(1.15rem, 2vw, 1.7rem);
  font-weight: 500;
}

html.is-live .hero-title,
html.is-live .hint { display: none; }

.reveal {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.04em;
}

.knopf {
  position: relative;
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  width: min(520px, 44vw);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

html:not(.is-live) .knopf { width: min(680px, 52vw); }

.knopf:focus { outline: none; }

.knopf:focus-visible .device {
  outline: 2px solid #fff;
  outline-offset: 8px;
}

.device {
  display: block;
  width: 100%;
  height: auto;
  mask-image: radial-gradient(ellipse 72% 68% at 50% 56%, #000 68%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 72% 68% at 50% 56%, #000 68%, transparent 80%);
}

.cap {
  position: absolute;
  left: 25.8%;
  top: 11.6%;
  width: 49%;
  height: auto;
  pointer-events: none;
  transform-origin: 50% 86%;
  transition: transform .12s cubic-bezier(.2, .8, .2, 1), filter .12s ease;
}

.knopf.is-down .cap {
  transform: scaleY(.9);
  filter: brightness(.78);
}

.after { margin-top: 18px; }

.after-lead {
  color: var(--muted);
  font-size: 14px;
}

.mine {
  margin: 8px 0 0;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.share-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.share-row a,
.share-row button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}

.share-row a:hover,
.share-row button:hover { color: var(--ink); border-color: rgba(255, 255, 255, .28); }

#story {
  color: var(--ink);
  border-color: rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .06);
}

.panel {
  align-self: center;
  width: min(100%, 380px);
  max-height: min(72dvh, 640px);
  overflow: auto;
  padding: 18px;
  border-radius: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.panel-title {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.say {
  display: grid;
  gap: 10px;
}

.field-label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

.hp {
  position: absolute;
  left: -999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.say input {
  width: 100%;
  min-width: 0;
  background: rgba(0, 0, 0, .35);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font-size: 16px;
  padding: 12px 14px;
  outline: none;
}

.say input::placeholder { color: #71717a; }

.say input:focus {
  border-color: rgba(255, 59, 48, .8);
  box-shadow: 0 0 0 3px rgba(255, 59, 48, .2);
}

.say input[readonly] { color: var(--muted); }

.say button {
  border: 0;
  border-radius: 12px;
  background: var(--red);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 14px;
  cursor: pointer;
}

.textbtn[hidden] { display: none; }

.say button:focus-visible,
.share-row button:focus-visible,
.share-row a:focus-visible,
.textbtn:focus-visible,
.legal:focus-visible,
.mark:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.form-status {
  min-height: 1.3em;
  margin: 12px 0 0;
  font-size: 14px;
  font-weight: 650;
}

.fine {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.board {
  list-style: none;
  margin: 0;
  padding: 0;
}

.board li {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: 2px 10px;
  align-items: baseline;
  margin: 0;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  border-radius: 10px;
  font-weight: 600;
}

.board li:last-child { border-bottom: 0; }

.board .rank,
.board .score {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.board .is-you { background: rgba(255, 59, 48, .16); }

.board .is-you .rank,
.board .is-you .score { color: var(--ink); }

.board li:has(+ .is-outside) { border-bottom: 0; }

.board .is-outside {
  margin-top: 8px;
  border-top: 1px solid var(--line);
}

.legalbar {
  position: fixed;
  z-index: 7;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 10px 16px max(10px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 40%);
  font-size: 12px;
  font-weight: 650;
}

.legalbar a {
  color: var(--muted);
  text-decoration: none;
}

.legalbar a:hover { color: var(--ink); }

.sheet {
  max-width: 40rem;
  margin: 0 auto;
  padding: 120px 24px 80px;
}

.sheet h1 {
  margin: 0 0 1.2rem;
  font-size: clamp(2.4rem, 6vw, 4rem);
  letter-spacing: -0.045em;
  line-height: .95;
}

.sheet h2 {
  margin: 1.8rem 0 .4rem;
  font-size: .8rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.sheet .lead { margin: 0 0 1rem; font-weight: 650; }

.sheet p,
.sheet li { line-height: 1.5; color: #e4e4e7; }

.sheet dt {
  margin-top: 1.2rem;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.sheet dd { margin: .25rem 0 0; }

.sheet a { color: inherit; }

.back { margin-top: 2.4rem; }

.back a {
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, .35);
}

body:has(.sheet) {
  background: var(--bg);
}

body:has(.sheet) .top {
  background: rgba(7, 8, 13, .9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

@media (min-width: 1200px) {
  html:not(.is-live) .knopf { width: min(760px, 48vw); }
  .hero-title { font-size: clamp(2.6rem, 3.4vw, 4rem); }
}

@media (max-width: 760px) {
  .stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 88px;
  }
  .core { order: 0; width: 100%; }
  .login { order: 1; }
  .board-panel { order: 2; }
  .panel {
    max-height: none;
    width: min(440px, 100%);
  }
  html:not(.is-live) body:not(:has(.sheet)) .core {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0;
  }
  html:not(.is-live) body:not(:has(.sheet)) .stage {
    padding-left: 16px;
    padding-right: 16px;
  }
  html:not(.is-live) body:not(:has(.sheet)) .copy { text-align: center; }
  html:not(.is-live) .knopf,
  .knopf { width: min(420px, calc(100vw - 32px)); }
}

@media (max-width: 680px) {
  .short { display: inline; }
  .full { display: none; }
  .top .legal { display: none; }
  .count {
    position: static;
    translate: none;
    font-size: 12px;
  }
  .legal, .textbtn { font-size: 12px; }
  .tools { gap: 10px; }
}
