:root {
  --ink: #07080c;
  --paper: #f3efe6;
  --muted: #9aa0ae;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 420px at 50% -10%, #1a1424 0%, transparent 60%),
    var(--ink);
  color: var(--paper);
  font-family: "Segoe UI", sans-serif;
}

header {
  padding: 28px 7vw 18px;
}

.top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 16px;
  margin-bottom: 6px;
}

.top .kicker,
.top .back,
.top .who {
  margin: 0;
}

.kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.who {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.who a {
  color: var(--paper);
  text-decoration: none;
}

.who a:hover,
.who a:focus-visible {
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 64px);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 0.95;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.game {
  flex: 1;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
  min-height: 128px;
  padding: 22px 7vw;
  color: inherit;
  text-decoration: none;
  border-top: 1px solid rgba(243, 239, 230, 0.08);
  position: relative;
  overflow: hidden;
}

.game::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 8px;
  background: var(--accent);
}

.game::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--wash), transparent 55%);
  opacity: 0.9;
  pointer-events: none;
}

.mark,
.copy,
.play {
  position: relative;
  z-index: 1;
}

.mark {
  width: 64px;
  height: 64px;
  color: var(--accent);
}

.mark svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.index {
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.18em;
}

.name {
  font-size: clamp(26px, 3vw, 40px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.line {
  max-width: 38rem;
  color: #d5d0c6;
  font-size: 17px;
  line-height: 1.35;
}

.holder:empty { display: none; }

.holder {
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.play {
  padding: 12px 26px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--play-ink);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.game:hover .play,
.game:focus-visible .play {
  transform: translateX(4px);
}

.game:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: -6px;
}

.moon {
  --accent: #e23b32;
  --wash: rgba(120, 18, 22, 0.55);
  --play-ink: #1a0608;
}

.shooter {
  --accent: #ffba54;
  --wash: rgba(120, 72, 18, 0.42);
  --play-ink: #1a1006;
}

.pong {
  --accent: #1cbe8c;
  --wash: rgba(12, 90, 64, 0.55);
  --play-ink: #04140e;
}

.guess {
  --accent: #f4efe4;
  --wash: rgba(90, 70, 40, 0.38);
  --play-ink: #1a140c;
}

.back {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
}

.back:hover,
.back:focus-visible {
  color: var(--paper);
}

.sheet {
  padding: 8px 7vw 72px;
  max-width: 860px;
}

.record {
  margin: 8px 0 28px;
}

.score {
  margin: 0;
  color: var(--accent);
  font-size: clamp(72px, 14vw, 148px);
  font-weight: 750;
  letter-spacing: -0.05em;
  line-height: 0.85;
}

.score-note,
.doom {
  max-width: 38rem;
  color: #d5d0c6;
  font-size: 17px;
  line-height: 1.45;
}

.score-note { margin: 10px 0 0; }

.score-note a {
  color: var(--paper);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 18px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.field input {
  width: min(100%, 360px);
  padding: 14px 16px;
  border: 1px solid rgba(243, 239, 230, 0.2);
  border-radius: 12px;
  background: #100e14;
  color: var(--paper);
  font: inherit;
  font-size: 18px;
}

.field input:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 3px;
}

button.go {
  border: 0;
  cursor: pointer;
  font-family: inherit;
}

button.go:disabled {
  opacity: 0.55;
  cursor: wait;
}

.linkish {
  display: inline-block;
  margin-left: 18px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.linkish:hover,
.linkish:focus-visible {
  color: var(--paper);
}

#back-name {
  display: block;
  margin: 16px 0 0;
}

.session {
  margin: 0 0 22px;
  color: #d5d0c6;
  font-size: 17px;
}

.session strong {
  color: var(--paper);
}

.form-error {
  min-height: 1.4em;
  margin: 16px 0 0;
  color: #e23b32;
  font-size: 16px;
}

.log,
.board {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.log li,
.board li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: baseline;
  padding: 12px 0;
  border-top: 1px solid rgba(243, 239, 230, 0.1);
  color: #d5d0c6;
  font-size: 17px;
}

.log li:last-child,
.board li:last-child {
  border-bottom: 1px solid rgba(243, 239, 230, 0.1);
}

.log li {
  grid-template-columns: 1fr;
}

.quiet {
  color: var(--muted);
}

.rank {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.board .mine .who-name,
.board .mine .pts {
  color: var(--paper);
  font-weight: 700;
}

.who-name {
  min-width: 0;
}

.wins {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.06em;
}

.pts {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.doom { margin: 0 0 8px; }

.levels {
  list-style: none;
  margin: 28px 0 36px;
  padding: 0;
}

.levels li {
  padding: 16px 0;
  border-top: 1px solid rgba(243, 239, 230, 0.1);
  color: #d5d0c6;
  font-size: 16px;
  line-height: 1.45;
}

.levels li:last-child {
  border-bottom: 1px solid rgba(243, 239, 230, 0.1);
}

.levels strong {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 18px;
  letter-spacing: -0.02em;
}

.go {
  display: inline-block;
  padding: 14px 28px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--play-ink);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
}

.go:hover,
.go:focus-visible {
  transform: translateX(4px);
}

.go:focus-visible,
.back:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 4px;
}

@media (max-width: 720px) {
  header { padding: 16px 20px 8px; }

  h1 { font-size: 34px; }

  .game {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "mark copy"
      "play play";
    gap: 8px 14px;
    min-height: 0;
    padding: 14px 18px 14px 24px;
  }

  .mark { grid-area: mark; width: 44px; height: 44px; }
  .copy { grid-area: copy; }
  .name { font-size: 24px; }
  .line { font-size: 15px; }
  .play {
    grid-area: play;
    justify-self: start;
    padding: 9px 20px;
  }

  .sheet { padding: 4px 20px 48px; }
  .score { font-size: 84px; }
  .doom, .score-note, .levels li { font-size: 15px; }
}
