:root {
  color-scheme: dark;
  --bg: hsl(225 18% 8%);
  --surface: hsl(225 14% 13%);
  --surface-strong: hsl(225 12% 18%);
  --text: hsl(45 22% 94%);
  --muted: hsl(220 12% 70%);
  --line: hsl(220 10% 28%);
  --accent: hsl(152 54% 53%);
  --accent-strong: hsl(153 64% 40%);
  --warning: hsl(42 92% 58%);
  --danger: hsl(355 70% 62%);
  --blue: hsl(211 78% 61%);
  --purple: hsl(270 54% 64%);
  --shadow: hsl(225 30% 3% / 0.32);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, hsl(225 22% 10%), var(--bg) 38rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

button,
textarea {
  font: inherit;
}

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  padding: 1rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-weight: 760;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2.4rem;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 850;
}

.nav {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: hsl(225 14% 10% / 0.72);
}

.nav a,
.text-link {
  color: var(--muted);
  text-decoration: none;
}

.nav a {
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  font-size: 0.92rem;
}

.nav a:hover,
.text-link:hover {
  color: var(--text);
  background: var(--surface-strong);
}

main {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.game-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1rem;
  align-items: start;
  min-height: calc(100svh - 9rem);
  padding: 1rem 0 2rem;
}

.game-shell,
.side-panel,
.page-body {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: hsl(225 14% 12% / 0.92);
  box-shadow: 0 20px 70px var(--shadow);
}

.game-shell {
  padding: clamp(1rem, 2vw, 1.5rem);
}

.game-heading {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.eyebrow,
.status-label,
.slot-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  max-width: 780px;
  font-size: clamp(2rem, 6vw, 4.8rem);
}

h2 {
  font-size: clamp(1.25rem, 2.6vw, 2rem);
}

h3 {
  font-size: 1rem;
}

.subhead,
.page-lede,
.seo-band p,
.panel-section p,
.message {
  color: var(--muted);
  line-height: 1.6;
}

.subhead {
  max-width: 42rem;
  margin: 0;
  font-size: 1.02rem;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: hsl(225 14% 9% / 0.7);
}

.mistake-dots {
  display: inline-flex;
  gap: 0.35rem;
  margin-left: 0.55rem;
  vertical-align: middle;
}

.mistake-dot {
  width: 0.7rem;
  aspect-ratio: 1;
  border-radius: 999px;
  background: var(--warning);
}

.mistake-dot.used {
  background: var(--line);
}

.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.25rem;
  margin-left: 0.5rem;
  padding: 0.24rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-strong);
  font-weight: 780;
}

.solved-groups {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.8rem;
}

.solved-card {
  display: grid;
  gap: 0.25rem;
  min-height: 4.6rem;
  padding: 0.85rem;
  border-radius: 8px;
  color: hsl(220 18% 8%);
}

.solved-card.easy {
  background: var(--accent);
}

.solved-card.medium {
  background: var(--warning);
}

.solved-card.hard {
  background: var(--blue);
}

.solved-card.tricky {
  background: var(--purple);
}

.solved-card strong {
  text-transform: uppercase;
}

.solved-card span {
  font-weight: 650;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(5.2rem, 1fr));
  gap: 0.55rem;
}

.word-tile {
  display: grid;
  min-height: 4.6rem;
  place-items: center;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-strong);
  font-size: clamp(0.78rem, 2.2vw, 1rem);
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.word-tile:hover {
  transform: translateY(-1px);
  border-color: hsl(220 10% 44%);
}

.word-tile.selected {
  border-color: var(--accent);
  background: hsl(152 45% 23%);
}

.word-tile:disabled {
  cursor: default;
  opacity: 0.45;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
}

.button {
  min-height: 2.65rem;
  padding: 0.68rem 1rem;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  font-weight: 790;
  cursor: pointer;
}

.button.primary {
  background: var(--accent-strong);
}

.button.secondary {
  border-color: var(--line);
  background: hsl(225 14% 10%);
}

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

.message {
  min-height: 1.8rem;
  margin: 0.85rem 0 0;
}

.side-panel {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  position: sticky;
  top: 1rem;
}

.panel-section {
  display: grid;
  gap: 0.55rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: hsl(225 14% 10%);
}

.panel-section p {
  margin: 0;
}

.affiliate-slot a {
  display: block;
  padding: 0.65rem 0;
  color: var(--text);
  text-decoration: none;
  border-top: 1px solid var(--line);
}

.ad-slot {
  min-height: 11rem;
  place-content: center;
  text-align: center;
}

.seo-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--line);
}

.seo-band p {
  max-width: 48rem;
  margin: 0.6rem 0 0;
}

.site-footer {
  padding: 2rem 0 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: hsl(225 24% 5% / 0.72);
}

.modal[hidden] {
  display: none;
}

.modal-panel {
  width: min(520px, 100%);
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 90px var(--shadow);
}

.modal-panel p {
  color: var(--muted);
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 8rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: hsl(225 14% 9%);
}

.page-hero {
  padding: 2rem 0 1rem;
}

.page-body {
  display: grid;
  gap: 1rem;
  margin-bottom: 3rem;
  padding: clamp(1rem, 2vw, 1.5rem);
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.info-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: hsl(225 14% 10%);
}

.info-card p,
.info-card li {
  color: var(--muted);
  line-height: 1.6;
}

.archive-list {
  display: grid;
  gap: 0.65rem;
}

.archive-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: hsl(225 14% 10%);
}

a.archive-item {
  color: var(--text);
  text-decoration: none;
}

a.archive-item:hover {
  border-color: hsl(220 10% 44%);
  background: var(--surface-strong);
}

@media (max-width: 860px) {
  .site-header,
  .site-footer,
  .seo-band {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    width: 100%;
    justify-content: space-between;
  }

  .game-hero {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: static;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  main,
  .site-header,
  .site-footer {
    width: min(100% - 1rem, 1120px);
  }

  .game-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .word-tile {
    min-height: 4rem;
  }

  .actions .button {
    flex: 1 1 calc(50% - 0.55rem);
  }
}
