:root {
  color-scheme: dark;
  --ink: #f4f7fa;
  --muted: #aeb9c4;
  --panel: #111a24;
  --line: #314150;
  --gold: #e2b93f;
  --gold-bright: #f4d66e;
  --blue: #0873bd;
  --absent: #3b4651;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #060a0e; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 8%, rgba(8, 115, 189, .24), transparent 28rem),
    radial-gradient(circle at 90% 18%, rgba(226, 185, 63, .13), transparent 24rem),
    #080d12;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

button,
input { font: inherit; }

.game-header {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px max(20px, calc(50vw - 570px));
  background: rgba(5, 9, 13, .86);
  border-bottom: 1px solid rgba(226, 185, 63, .26);
  backdrop-filter: blur(14px);
}

.game-brand img { display: block; width: 136px; height: auto; }

.back-link,
.game-footer a {
  color: var(--gold-bright);
  font-weight: 850;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.game-shell {
  width: min(100% - 32px, 720px);
  margin: 0 auto;
  padding: 44px 0 60px;
}

.game-intro { margin-bottom: 24px; text-align: center; }

.game-kicker {
  color: var(--gold-bright);
  font-size: .82rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.game-intro h1 {
  margin: 8px 0 10px;
  font-size: clamp(3rem, 11vw, 5.4rem);
  line-height: .9;
  letter-spacing: -.06em;
  text-transform: uppercase;
}

.game-intro p { margin: 0; color: var(--muted); font-size: 1.05rem; line-height: 1.6; }

.game-panel {
  padding: clamp(20px, 5vw, 36px);
  background: linear-gradient(145deg, rgba(19, 29, 39, .98), rgba(8, 13, 18, .98));
  border: 1px solid rgba(226, 185, 63, .42);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .42), inset 0 1px rgba(255, 255, 255, .05);
}

.game-progress {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 800;
}

.word-board { display: grid; gap: 8px; width: min(100%, 350px); margin: 0 auto 26px; }

.word-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }

.word-tile,
.legend-tile {
  display: grid;
  place-items: center;
  color: #fff;
  background: #0a1016;
  border: 2px solid var(--line);
  font-weight: 950;
  text-transform: uppercase;
}

.word-tile {
  aspect-ratio: 1;
  border-radius: 10px;
  font-size: clamp(1.5rem, 7vw, 2.15rem);
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.word-tile.filled { border-color: #708293; transform: scale(1.025); }
.word-tile.hint { border-color: var(--gold); box-shadow: inset 0 0 0 1px rgba(226, 185, 63, .32); }
.correct { color: #111820; background: var(--gold); border-color: var(--gold); }
.present { background: var(--blue); border-color: #35a2e8; }
.absent { background: var(--absent); border-color: #5d6a76; }

.guess-form label { display: block; margin-bottom: 8px; font-size: .9rem; font-weight: 850; }

.guess-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }

.guess-controls input {
  min-width: 0;
  min-height: 50px;
  padding: 10px 14px;
  color: #fff;
  background: #070b10;
  border: 1px solid #566675;
  border-radius: 10px;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.guess-controls button,
.new-game {
  min-height: 50px;
  padding: 10px 17px;
  color: #081018;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 950;
}

.guess-controls .secondary-control { color: #fff; background: #283541; }

.letter-keyboard { display: grid; gap: 7px; margin-top: 20px; }

.keyboard-row { display: flex; justify-content: center; gap: 5px; }

.letter-keyboard button {
  min-width: 0;
  height: 45px;
  flex: 1 1 0;
  padding: 0 3px;
  color: #fff;
  background: #2a3743;
  border: 1px solid #526170;
  border-radius: 7px;
  cursor: pointer;
  font-size: clamp(.76rem, 2.7vw, .95rem);
  font-weight: 900;
}

.letter-keyboard button.wide-key { flex-grow: 1.75; font-size: .72rem; }
.letter-keyboard button.correct { color: #111820; background: var(--gold); border-color: var(--gold); }
.letter-keyboard button.present { background: var(--blue); border-color: #35a2e8; }
.letter-keyboard button.absent { background: var(--absent); border-color: #5d6a76; opacity: .72; }

.game-status {
  min-height: 52px;
  margin: 18px 0 0;
  padding: 13px 15px;
  color: #d9e2ea;
  background: rgba(8, 115, 189, .13);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  line-height: 1.55;
}

.new-game { display: block; width: 100%; margin-top: 12px; }
.new-game[hidden] { display: none; }

.game-help { padding: 38px 4px 0; }
.game-help h2 { margin: 0 0 18px; font-size: 1.6rem; }
.legend { display: grid; gap: 10px; }
.legend p { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 0 12px; align-items: center; margin: 0; color: var(--muted); line-height: 1.45; }
.legend strong { display: block; color: #fff; }
.legend-tile { grid-row: 1 / 3; width: 42px; height: 42px; border-radius: 7px; }
.game-note { margin-top: 22px; color: #8e9aa6; font-size: .9rem; line-height: 1.55; }

.game-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px 24px;
  padding: 26px 20px 36px;
  color: #82909d;
  border-top: 1px solid rgba(255, 255, 255, .08);
  font-size: .88rem;
}

.noscript-message { padding: 16px; color: #fff; background: #8d271f; text-align: center; }

@media (max-width: 600px) {
  .game-header { min-height: 70px; }
  .game-brand img { width: 112px; }
  .game-shell { width: min(100% - 20px, 720px); padding-top: 30px; }
  .game-panel { padding-inline: 14px; border-radius: 18px; }
  .word-board { gap: 6px; width: min(100%, 310px); }
  .word-row { gap: 6px; }
  .word-tile { border-radius: 8px; }
  .guess-controls { grid-template-columns: 1fr 1fr; }
  .guess-controls input { grid-column: 1 / -1; }
  .letter-keyboard { gap: 5px; }
  .keyboard-row { gap: 3px; }
  .letter-keyboard button { height: 43px; padding: 0 1px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
