@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('fonts/bricolage-latin.woff2') format('woff2');
  font-weight: 400 800;
  font-style: normal;
  font-stretch: 100%;
  font-display: swap;
}

@font-face {
  font-family: 'Instrument Sans';
  src: url('fonts/instrument-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-stretch: 100%;
  font-display: swap;
}

:root {
  --paper: #f4efe4;
  --paper-2: #e9e0ce;
  --card: #fffcf5;
  --ink: #17140f;
  --ink-soft: #5e5647;
  --ink-20: rgba(23, 20, 15, 0.2);
  --red: #ce3227;
  --red-ink: #a0241b;
  --blue: #2049d6;
  --green: #1f7a52;
  --green-soft: #dff3e7;
  --amber: #8a5a00;
  --amber-soft: #fcebc4;
  --shadow: 0 4px 0 var(--ink);
  --shadow-sm: 0 3px 0 var(--ink);
  --shadow-xs: 0 2px 0 var(--ink);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font-display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(120% 70% at 50% 0%, rgba(255, 255, 255, 0.5), transparent 62%);
}

h1,
h2,
h3,
p,
ul,
ol {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

svg {
  display: block;
}

::selection {
  background: var(--red);
  color: #fff;
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg__l {
  position: absolute;
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1;
  color: rgba(23, 20, 15, 0.05);
  user-select: none;
}

.bg__l--1 { font-size: 46vw; left: -14vw; top: -12vw; transform: rotate(-14deg); }
.bg__l--2 { font-size: 30vw; right: -8vw; top: 18vh; transform: rotate(9deg); color: rgba(225, 60, 47, 0.06); }
.bg__l--3 { font-size: 38vw; left: -6vw; bottom: -10vw; transform: rotate(6deg); }
.bg__l--4 { font-size: 24vw; right: -4vw; bottom: 12vh; transform: rotate(-12deg); color: rgba(32, 73, 214, 0.06); }
.bg__l--5 { font-size: 18vw; left: 34vw; top: 44vh; transform: rotate(18deg); color: rgba(23, 20, 15, 0.03); }

.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 468px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(22px + var(--safe-t)) clamp(18px, 5vw, 26px) calc(18px + var(--safe-b));
}

.screen {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 18px;
  animation: screen-in 0.22s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.screen--loading {
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.hero {
  margin-top: clamp(8px, 3.5vh, 30px);
}

.hero__kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.hero__kicker::before {
  content: '';
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: var(--red);
}

.logo {
  margin: 10px 0 12px;
  font-family: var(--font-display);
  font-size: clamp(56px, 20.5vw, 92px);
  font-weight: 800;
  line-height: 0.86;
  letter-spacing: -0.035em;
}

.logo--sm {
  margin: 0;
  font-size: 44px;
}

.logo__mark {
  color: var(--red);
  display: inline-block;
  transform: translateY(-0.02em);
}

.hero__sub {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: clamp(16px, 4vh, 34px);
}

.tile-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 86px;
  padding: 15px;
  border: 2px solid var(--ink);
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: left;
  transition: transform 0.13s ease, box-shadow 0.13s ease;
}

.tile-btn:active {
  transform: translate(2px, 3px);
  box-shadow: 0 0 0 var(--ink);
}

.tile-btn--red {
  background: var(--red);
  color: #fff6e9;
}

.tile-btn__icon {
  display: grid;
  flex: 0 0 46px;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--ink);
  color: var(--paper);
}

.tile-btn--red .tile-btn__icon {
  border-color: rgba(255, 246, 233, 0.45);
  background: rgba(255, 246, 233, 0.14);
  color: #fff6e9;
}

.tile-btn__icon svg {
  width: 22px;
  height: 22px;
}

.tile-btn__text {
  min-width: 0;
}

.tile-btn__text b {
  display: block;
  font-size: 17.5px;
  font-weight: 700;
  line-height: 1.2;
}

.tile-btn__text small {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.3;
}

.tile-btn--red .tile-btn__text small {
  color: #fff6e9;
}

.tile-btn__arrow {
  margin-left: auto;
  opacity: 0.85;
}

.tile-btn__arrow svg {
  width: 20px;
  height: 20px;
}

.continue {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border: 2px dashed var(--ink-20);
  border-radius: 14px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
}

.continue b {
  color: var(--ink);
  font-family: var(--font-display);
  letter-spacing: 0.08em;
}

.text-btn {
  align-self: center;
  padding: 10px;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 22px;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.install {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1.5px solid var(--ink-20);
  border-radius: 999px;
  background: var(--card);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
}

.install svg {
  width: 14px;
  height: 14px;
}

.back {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: -4px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow-xs);
  font-size: 19px;
}

.title {
  font-family: var(--font-display);
  font-size: clamp(30px, 9vw, 36px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

.lead {
  max-width: 36ch;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.45;
}

form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field label,
.block__label,
.block > legend {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.input {
  width: 100%;
  min-height: 54px;
  padding: 0 15px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow-xs);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.2;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder {
  color: rgba(23, 20, 15, 0.32);
}

.input:focus {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 3px rgba(32, 73, 214, 0.16), var(--shadow-xs);
}

.input--code {
  padding-left: 0.22em;
  font-family: var(--font-display);
  font-size: clamp(26px, 8vw, 32px);
  font-weight: 800;
  letter-spacing: 0.22em;
  text-align: center;
  text-transform: uppercase;
}

.input--code::placeholder {
  letter-spacing: 0.22em;
  color: rgba(23, 20, 15, 0.2);
}

.field__hint {
  display: none;
  color: var(--red-ink);
  font-size: 11.5px;
  font-weight: 600;
}

.field.is-mismatch .field__hint {
  display: block;
}

.block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.block > legend {
  margin-bottom: 7px;
  padding: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 9px 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow-xs);
  font-size: 13.5px;
  font-weight: 600;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s;
}

.chip:active {
  transform: translate(1px, 2px);
  box-shadow: 0 0 0 var(--ink);
}

.chip.is-on {
  background: var(--ink);
  color: var(--paper);
}

.hint {
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.4;
}

.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.seg {
  display: flex;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow-xs);
}

.seg button {
  flex: 1;
  min-height: 42px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
}

.seg button + button {
  border-left: 2px solid var(--ink);
}

.seg button.is-on {
  background: var(--ink);
  color: var(--paper);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 20px;
  border: 2px solid var(--ink);
  border-radius: 15px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s;
}

.btn:active:not(:disabled) {
  transform: translate(2px, 3px);
  box-shadow: 0 0 0 var(--ink);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn svg {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
}

.btn--primary {
  background: var(--red);
  color: #fff6e9;
}

.btn--blue {
  background: var(--blue);
  color: #eef2ff;
}

.btn--wa {
  background: #177a43;
  color: #f0fff5;
}

.btn--ghost {
  min-height: 46px;
  border-color: var(--ink-20);
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font-size: 13.5px;
}

.btn--ghost:active:not(:disabled) {
  transform: none;
}

.btn--sm {
  min-height: 44px;
  font-size: 13px;
}

.btn--lg {
  min-height: 60px;
  border-radius: 17px;
  font-size: 17px;
}

.btn--stop {
  width: 100%;
  min-height: 66px;
  border-radius: 20px;
  background: var(--red);
  color: #fff6e9;
  box-shadow: 0 5px 0 var(--ink);
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: 0.01em;
}

.btn--stop:not(:disabled) {
  animation: stop-glow 2.6s ease-in-out infinite;
}

.lobby-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.code {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 8px;
  border: 0;
  border-bottom: 3px dashed var(--ink-20);
  background: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(40px, 12vw, 54px);
  font-weight: 800;
  letter-spacing: 0.09em;
  line-height: 1;
}

.code small {
  padding: 4px 7px;
  border: 1.5px solid var(--ink-20);
  border-radius: 999px;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lobby-head__status {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-top: 6px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 82, 0.15);
}

.share {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.share__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.players {
  padding: 16px;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.players__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.players__head h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.player-list {
  display: flex;
  flex-direction: column;
}

.player {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 0;
  border-top: 1.5px dashed rgba(23, 20, 15, 0.12);
  font-size: 15px;
}

.player:first-child {
  padding-top: 2px;
  border-top: 0;
}

.avatar {
  display: grid;
  flex: 0 0 34px;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--ink);
  border-radius: 11px;
  background: var(--paper-2);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

.player:nth-child(4n + 1) .avatar,
.res-list > :nth-child(4n + 1) .avatar { background: #ffe0d9; }
.player:nth-child(4n + 2) .avatar,
.res-list > :nth-child(4n + 2) .avatar { background: #dde6ff; }
.player:nth-child(4n + 3) .avatar,
.res-list > :nth-child(4n + 3) .avatar { background: #e1f2e7; }
.player:nth-child(4n + 4) .avatar,
.res-list > :nth-child(4n + 4) .avatar { background: #fbeccb; }

.player__name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player__meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
}

.badge-host {
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.you-tag {
  padding: 3px 6px;
  border: 1.5px solid rgba(32, 73, 214, 0.35);
  border-radius: 6px;
  color: var(--blue);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.empty {
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.4;
}

.setup {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  padding: 6px 10px;
  border: 1.5px solid var(--ink-20);
  border-radius: 999px;
  background: rgba(255, 252, 245, 0.55);
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.tag--ink {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sticky-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
  background: linear-gradient(to top, var(--paper) 58%, rgba(244, 239, 228, 0));
}

.waiting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 54px;
  padding: 0 14px;
  border: 2px dashed var(--ink-20);
  border-radius: 15px;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
}

.waiting__dots {
  display: inline-flex;
  gap: 4px;
}

.waiting__dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-soft);
  animation: blink 1.2s infinite;
}

.waiting__dots i:nth-child(2) { animation-delay: 0.18s; }
.waiting__dots i:nth-child(3) { animation-delay: 0.36s; }

.screen--play {
  gap: 14px;
}

.play-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.clock {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.timer {
  height: 8px;
  margin-top: -4px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
}

.timer i {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--blue);
  transition: width 0.25s linear, background 0.3s;
}

.timer.is-low i {
  background: var(--red);
}

.letter-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 0 2px;
}

.letter-tile {
  display: grid;
  flex: 0 0 86px;
  place-items: center;
  width: 86px;
  height: 102px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--red);
  box-shadow: 0 5px 0 var(--ink);
  color: #fff6e9;
  font-family: var(--font-display);
  font-size: 62px;
  font-weight: 800;
  line-height: 1;
  transform: rotate(-2.5deg);
  animation: tile-in 0.38s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.letter-copy {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.35;
}

.letter-copy b {
  color: var(--ink);
  font-weight: 700;
}

.letter-copy .eyebrow {
  color: var(--ink);
}

.progress {
  display: flex;
  gap: 7px;
  margin: 0 -4px;
  padding: 0 4px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.progress::-webkit-scrollbar {
  display: none;
}

.pchip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 5px 9px 5px 5px;
  border: 1.5px solid rgba(23, 20, 15, 0.18);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.pchip i {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 10.5px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.pchip__name {
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pchip b {
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pchip.is-you {
  border-color: var(--ink);
  background: #fff7e4;
}

.fields {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.screen--play .field {
  gap: 4px;
}

.screen--play .input {
  min-height: 50px;
  scroll-margin-block: 90px;
}

.play-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  padding-bottom: 4px;
  background: linear-gradient(to top, var(--paper) 62%, rgba(244, 239, 228, 0));
}

.play-foot__hint {
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
}

.grace-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: #ffe9e4;
  box-shadow: var(--shadow-xs);
}

.grace-banner__num {
  display: grid;
  flex: 0 0 30px;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--red);
  color: #fff6e9;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
}

.grace-banner p {
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.3;
}

.grace-banner b {
  color: var(--ink);
}

.grace-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  border: 2px dashed var(--ink-20);
  border-radius: 16px;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 600;
}

.timer.is-grace i {
  background: var(--red);
}

.input:disabled {
  opacity: 0.75;
}

.screen--stopped {
  justify-content: center;
  gap: 22px;
  padding-bottom: 20px;
  text-align: center;
}

.stop-flash {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.stop-flash__word {
  color: var(--red);
  font-family: var(--font-display);
  font-size: clamp(64px, 20vw, 92px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 0.9;
  animation: slam 0.3s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.stop-flash__count {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-top: 6px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow-xs);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.stop-preview {
  padding: 8px 16px;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: left;
}

.stop-preview div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-top: 1.5px dashed rgba(23, 20, 15, 0.12);
  font-size: 14px;
}

.stop-preview div:first-child {
  border-top: 0;
}

.stop-preview span {
  align-self: center;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stop-preview b {
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.res-head {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.res-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}

.letter-chip {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 2px solid var(--ink);
  border-radius: 11px;
  background: var(--red);
  box-shadow: 0 3px 0 var(--ink);
  color: #fff6e9;
  font-size: 26px;
  transform: rotate(-3deg);
}

.res-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.res-card {
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.res-card.is-you {
  box-shadow: 0 0 0 3px var(--blue), var(--shadow);
}

.res-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  border-bottom: 2px solid var(--ink);
  background: rgba(244, 239, 228, 0.5);
}

.res-card__head h3 {
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.res-card__pts {
  margin-left: auto;
  color: var(--green);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.res-card__pts.is-zero {
  color: var(--ink-soft);
}

.res-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 15px;
  border-top: 1.5px dashed rgba(23, 20, 15, 0.1);
  font-size: 14px;
}

.res-card__head + .res-row {
  border-top: 0;
}

.res-cat {
  flex: 0 0 76px;
  width: 76px;
  color: var(--ink-soft);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.res-val {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.res-val.is-empty {
  color: rgba(23, 20, 15, 0.35);
}

.badge {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.badge--10 { background: var(--green-soft); color: var(--green); }
.badge--5 { background: var(--amber-soft); color: var(--amber); }
.badge--0 { background: rgba(23, 20, 15, 0.06); color: var(--ink-soft); }

.res-card__foot {
  display: flex;
  justify-content: space-between;
  padding: 9px 15px;
  border-top: 2px solid var(--ink);
  background: rgba(244, 239, 228, 0.5);
  color: var(--ink-soft);
  font-size: 11.5px;
}

.res-card__foot b {
  color: var(--ink);
  font-size: 13px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.screen--finished {
  position: relative;
  justify-content: flex-start;
  gap: 14px;
  overflow: hidden;
}

.winner {
  font-family: var(--font-display);
  font-size: clamp(34px, 10vw, 46px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 0.98;
}

.winner span {
  display: block;
  color: var(--red);
  font-size: clamp(46px, 14vw, 66px);
  overflow-wrap: anywhere;
}

.winner__pts {
  margin-top: -6px;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 600;
}

.podium {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.podium li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow-xs);
  font-size: 15px;
}

.podium li:first-child {
  background: #fff6d8;
  box-shadow: var(--shadow);
}

.podium__rank {
  flex: 0 0 26px;
  width: 26px;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
}

.podium li:first-child .podium__rank {
  color: var(--ink);
}

.podium__name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium__score {
  margin-left: auto;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.confetti {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.confetti span {
  position: absolute;
  top: -8%;
  color: var(--red);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  opacity: 0;
  animation: fall 3.2s linear forwards;
}

.confetti span:nth-child(3n) { color: var(--blue); }
.confetti span:nth-child(4n) { color: var(--ink); font-size: 15px; }

.toast {
  position: fixed;
  bottom: calc(18px + var(--safe-b));
  left: 50%;
  z-index: 60;
  max-width: min(90vw, 380px);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--ink);
  box-shadow: 0 8px 24px rgba(23, 20, 15, 0.25);
  color: var(--paper);
  font-size: 13.5px;
  font-weight: 500;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.2s, transform 0.2s;
}

.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.offline {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 70;
  padding: calc(8px + var(--safe-t)) 12px 8px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-align: center;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(23, 20, 15, 0.15);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.sheet {
  width: 100%;
  max-width: 520px;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.sheet::backdrop {
  background: rgba(23, 20, 15, 0.45);
  backdrop-filter: blur(3px);
}

.sheet__card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 20px calc(22px + var(--safe-b));
  border: 2px solid var(--ink);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  background: var(--paper);
}

.sheet__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet__title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}

.sheet__close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow-xs);
  font-size: 20px;
  line-height: 1;
}

.rules {
  display: flex;
  flex-direction: column;
  gap: 11px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.45;
  counter-reset: rule;
}

.rules li {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  counter-increment: rule;
}

.rules li > span {
  display: block;
}

.rules li::before {
  content: counter(rule);
  color: var(--red);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
}

.rules b {
  color: var(--ink);
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes tile-in {
  from { opacity: 0; transform: rotate(-9deg) scale(0.86); }
  to { opacity: 1; transform: rotate(-2.5deg) scale(1); }
}

@keyframes slam {
  from { opacity: 0; transform: scale(1.22); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes stop-glow {
  0%, 100% { box-shadow: 0 5px 0 var(--ink), 0 0 0 0 rgba(225, 60, 47, 0); }
  50% { box-shadow: 0 5px 0 var(--ink), 0 0 0 10px rgba(225, 60, 47, 0.09); }
}

@keyframes fall {
  0% { opacity: 0; transform: translateY(-10vh) rotate(0deg); }
  10% { opacity: 0.9; }
  100% { opacity: 0; transform: translateY(105vh) rotate(320deg); }
}

@media (max-height: 700px) {
  .logo { font-size: clamp(48px, 16vw, 72px); }
  .screen--play { gap: 10px; }
  .letter-row { gap: 12px; padding: 0; }
  .letter-tile { flex-basis: 64px; width: 64px; height: 76px; font-size: 44px; }
  .letter-copy { font-size: 12.5px; }
  .letter-copy__more { display: none; }
  .screen--play .field { gap: 2px; }
  .screen--play .input { min-height: 44px; font-size: 16px; }
  .fields { gap: 8px; }
  .play-foot { padding-top: 8px; }
  .btn--stop { min-height: 56px; font-size: 26px; }
}

@media (min-width: 560px) {
  .sheet {
    margin: auto;
    border-radius: 24px;
  }
  .sheet__card {
    border-bottom: 2px solid var(--ink);
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

.center { text-align: center; }



.home-main,
.lobby-main,
.finish-main {
  display: flex;
  flex-direction: column;
}

.home-main {
  gap: 16px;
  padding: 8px 0;
}

.home-main .hero {
  margin-top: 0;
}

.home-main .home-actions {
  margin-top: 4px;
}



.lobby-main {
  gap: 18px;
  padding: 8px 0;
}



.finish-main {
  gap: 14px;
  padding: 8px 0;
  margin: auto 0;
}

.screen--finished .sticky-foot {
  margin-top: 0;
}

.btn--stop:disabled {
  opacity: 0.55;
  box-shadow: 0 5px 0 rgba(23, 20, 15, 0.35);
}

.howto {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 2px;
  padding: 0 2px;
}

.howto__step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.35;
}

.howto__step p {
  margin: 2px 0 0;
}

.howto__step b {
  color: var(--ink);
  font-weight: 700;
}

.howto__num {
  display: grid;
  flex: 0 0 22px;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
}

.lobby-teaser {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 2px 0;
}

.lobby-teaser__copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.4;
}

.lobby-teaser__copy b {
  color: var(--ink);
}

.lobby-teaser .letter-tile {
  flex: 0 0 64px;
  width: 64px;
  height: 76px;
  border-color: var(--ink-20);
  background: var(--card);
  box-shadow: 0 4px 0 var(--ink-20);
  color: var(--ink-soft);
  font-size: 42px;
  animation: none;
}

.finish-letters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.mini-letters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-letters span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 38px;
  border: 1.5px solid var(--ink);
  border-radius: 9px;
  background: var(--card);
  box-shadow: 0 2px 0 var(--ink);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
}
