@font-face { font-family: Nunito; font-weight: 400; font-display: swap; src: url(/fonts/nunito-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Nunito; font-weight: 800; font-display: swap; src: url(/fonts/nunito-latin-800-normal.woff2) format('woff2'); }

:root {
  --paper: #f6f1e7;
  --card: #fffdf8;
  --ink: #1f1b16;
  --muted: #5b5346;
  --accent: #c2410c;
  --hit: #166534;
  --line: #d9cfbd;
  --wa: #128c4a;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font: 400 18px/1.4 Nunito, system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app {
  max-width: 560px; min-height: 100dvh; margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
}

.top { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.brand { font-weight: 800; letter-spacing: .3em; color: var(--accent); text-decoration: none; font-size: 20px; padding-left: .3em; }
.challenge { margin: 0; text-align: center; color: var(--muted); }
.challenge strong { color: var(--ink); }

.board { flex: 1; display: flex; align-items: center; justify-content: center; gap: 20px; min-height: 0; }
.gallows svg { display: block; width: auto; height: min(34dvh, 52vw, 300px); }
.side { display: flex; flex-direction: column; gap: 6px; min-width: 120px; }
.lives { margin: 0; color: var(--muted); }
.wrong { margin: 0; min-height: 1.4em; font-weight: 800; letter-spacing: .15em; color: var(--accent); text-decoration: line-through; text-transform: uppercase; }

.word { display: flex; justify-content: center; gap: 6px; margin: 8px 0 12px; flex-wrap: nowrap; }
.slot {
  width: min(calc((100vw - 66px) / 8), 48px); height: min(13vw, 58px);
  display: grid; place-items: center;
  border-bottom: 4px solid var(--ink);
  font-size: min(8vw, 38px); font-weight: 800; text-transform: uppercase;
}
.slot.missed { color: var(--accent); }

.keyboard { display: flex; flex-direction: column; gap: 6px; user-select: none; -webkit-user-select: none; }
.keyrow { display: flex; justify-content: center; gap: 5px; }
.key {
  flex: 1 1 0; max-width: 52px; min-height: 54px; padding: 0;
  border: 0; border-radius: 10px; background: var(--card); box-shadow: 0 2px 0 var(--line);
  font-size: 22px; font-weight: 800; text-transform: uppercase;
  touch-action: manipulation; cursor: pointer;
}
.key:active { transform: translateY(1px); box-shadow: none; }
.key:disabled { cursor: default; box-shadow: none; }
.key.hit { background: var(--hit); color: #fff; }
.key.miss { background: transparent; color: var(--line); }
.key:focus-visible, .btn:focus-visible, .brand:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.end { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 16px; background: var(--card); }
.result { margin: 0; text-align: center; font-size: 22px; font-weight: 800; }
.name { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 16px; }
.name input { padding: 12px; border: 2px solid var(--line); border-radius: 10px; background: #fff; font-size: 18px; }
.name input:focus { outline: none; border-color: var(--ink); }
.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }
.btn {
  display: block; padding: 14px; border: 2px solid var(--ink); border-radius: 12px; background: transparent;
  text-align: center; text-decoration: none; font-weight: 800; cursor: pointer; touch-action: manipulation;
}
.btn.primary { background: var(--wa); border-color: var(--wa); color: #fff; font-size: 20px; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.noscript { text-align: center; }

