:root {
  --bg: #f5efe1;
  --bg-accent: #e5d5b6;
  --panel: rgba(255, 251, 242, 0.86);
  --text: #1d1e22;
  --muted: #655f53;
  --line: rgba(29, 30, 34, 0.12);
  --hit: #2d6a4f;
  --near: #c67c2e;
  --miss: #7d7f7e;
  --key: #ece4d2;
  --shadow: 0 18px 50px rgba(50, 36, 14, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(198, 124, 46, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(45, 106, 79, 0.17), transparent 24%),
    linear-gradient(135deg, var(--bg), #f8f5ef 50%, var(--bg-accent));
}

a {
  color: inherit;
}

.site-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.nav-link {
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
}

.nav-link.active {
  background: var(--text);
  color: white;
}

.shell {
  width: min(900px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 22px 0 36px;
}

.hero,
.status-panel,
.game-panel,
.notes {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 24px;
}

.eyebrow,
.label,
.hint,
.notes p,
.message {
  font-family: "IBM Plex Mono", monospace;
}

.eyebrow,
.label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  color: var(--muted);
  margin: 0 0 8px;
}

h1 {
  margin: 0;
  font-size: clamp(2.6rem, 6vw, 5rem);
  line-height: 0.94;
}

.lede {
  margin: 12px 0 0;
  font-size: 1.05rem;
  max-width: 40rem;
  color: var(--muted);
}

.status-panel {
  margin-top: 18px;
  padding: 16px 18px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.value {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.game-panel {
  margin-top: 18px;
  padding: 18px;
}

.board {
  display: grid;
  gap: 6px;
  justify-content: center;
}

.board-row {
  display: grid;
  gap: 5px;
  justify-content: center;
}

.board-cell {
  width: clamp(24px, 2.3vw, 34px);
  height: clamp(30px, 3vw, 40px);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: clamp(1rem, 2.3vw, 1.35rem);
  line-height: 1;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.45);
}

.board-cell.fixed {
  border-style: dashed;
  color: var(--muted);
  background: transparent;
}

.board-cell.hit {
  background: var(--hit);
  color: white;
  border-color: var(--hit);
}

.board-cell.near {
  background: var(--near);
  color: white;
  border-color: var(--near);
}

.board-cell.miss {
  background: var(--miss);
  color: white;
  border-color: var(--miss);
}

.guess-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.guess-input,
.submit-button,
.ghost-button {
  border-radius: 16px;
  border: 1px solid var(--line);
  font: inherit;
}

.guess-input {
  width: min(100%, var(--board-width, 100%));
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.74);
  font-size: 1.05rem;
}

.submit-button,
.ghost-button {
  padding: 14px 18px;
  font-weight: 700;
  cursor: pointer;
}

.submit-button {
  width: min(100%, var(--board-width, 100%));
  background: var(--text);
  color: white;
}

.ghost-button {
  background: transparent;
}

.meta-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hint,
.message {
  color: var(--muted);
}

.message {
  min-height: 1.2em;
  margin-top: 12px;
}

.keyboard {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

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

.key {
  min-width: 50px;
  height: 56px;
  border: 0;
  border-radius: 14px;
  background: var(--key);
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}

.key.wide {
  min-width: 96px;
}

.key.hit {
  background: var(--hit);
  color: white;
}

.key.near {
  background: var(--near);
  color: white;
}

.key.miss {
  background: var(--miss);
  color: white;
}

.notes {
  margin-top: 18px;
  padding: 16px 18px;
}

.notes p {
  margin: 0;
}

.notes p + p {
  margin-top: 8px;
}

.boggle-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.boggle-left {
  min-width: 0;
}

.grid-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 320px);
  margin: 0 auto;
}

.grid-cell {
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.3rem, 4vw, 2rem);
  font-weight: 700;
}

.boggle-right {
  display: grid;
  gap: 14px;
}

.stat-card,
.word-column {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
  padding: 14px;
}

.score-value {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
}

.word-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.word-chip {
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(29, 30, 34, 0.08);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
}

.word-list.compact .word-chip {
  font-size: 0.74rem;
  padding: 6px 8px;
}

.hidden {
  display: none;
}

.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;
}

@media (max-width: 760px) {
  .status-panel {
    grid-template-columns: 1fr;
  }

  .guess-form,
  .meta-row {
    flex-direction: column;
    align-items: stretch;
  }

  .boggle-layout {
    grid-template-columns: 1fr;
  }

  .grid-board {
    width: min(100%, 280px);
  }

  .key {
    min-width: 34px;
    height: 46px;
    padding: 0 8px;
    font-size: 0.92rem;
  }

  .key.wide {
    min-width: 72px;
  }
}
