:root {
  --bg: #f3eadb;
  --bg-accent: #dfc6a6;
  --panel: rgba(255, 248, 238, 0.86);
  --ink: #1e1d1a;
  --muted: #675e52;
  --gold: #d68f2d;
  --gold-deep: #8a5812;
  --sage: #7e9b76;
  --sage-deep: #53684d;
  --rose: #b85f48;
  --double-letter: #d7e8f8;
  --triple-letter: #98c4f0;
  --double-word: #efd2c7;
  --triple-word: #dd8d73;
  --tile: #f2c05d;
  --tile-edge: #8b5d1f;
  --shadow: 0 18px 38px rgba(79, 56, 22, 0.13);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(38, 28, 16, 0.48);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}

.modal-panel {
  width: min(780px, 100%);
  max-height: min(82vh, 900px);
  overflow: auto;
  background: linear-gradient(180deg, rgba(255, 250, 242, 0.98), rgba(252, 243, 229, 0.96));
  border: 1px solid rgba(120, 88, 27, 0.14);
  border-radius: 16px;
  box-shadow: 0 26px 60px rgba(79, 56, 22, 0.22);
  padding: 20px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.modal-header h2 {
  margin: 0;
  font-family: "Space Mono", monospace;
  font-size: 1.5rem;
}

.modal-close {
  min-width: 88px;
}

.modal-body {
  display: grid;
  gap: 14px;
}

.result-comparison {
  padding: 14px 0;
  border-top: 1px solid rgba(138, 88, 18, 0.14);
}

.result-comparison:first-child {
  border-top: 0;
  padding-top: 0;
}

.result-comparison h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
}

.result-comparison p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Sora", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.8), transparent 30%),
    radial-gradient(circle at 85% 15%, rgba(255, 233, 198, 0.38), transparent 20%),
    radial-gradient(circle at bottom right, rgba(214, 143, 45, 0.14), transparent 28%),
    linear-gradient(145deg, #f5ecde, #ead9bf 48%, var(--bg-accent));
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(107, 90, 59, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(107, 90, 59, 0.035) 1px, transparent 1px);
  background-size: 52px 52px;
  pointer-events: none;
  opacity: 0.35;
}

.app-shell {
  width: min(1380px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 24px;
}

.hero {
  padding: 8px 0 16px;
  border: 0;
  border-radius: 0;
  clip-path: none;
  background: none;
  box-shadow: none;
  margin-bottom: 18px;
}

.panel-kicker {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--gold-deep);
}

.hero h1,
.panel-header h2 {
  margin: 0;
  font-family: "Space Mono", monospace;
  line-height: 1;
}

.hero h1 {
  max-width: none;
  font-size: clamp(2.6rem, 5vw, 4.4rem);
  text-shadow: none;
}

.brand-mark {
  display: block;
  font-family: "Sora", sans-serif;
  font-size: clamp(2.6rem, 5vw, 4.4rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--ink);
}

.hero-copy {
  max-width: 54ch;
  margin: 10px 0 0;
  font-size: 0.98rem;
  line-height: 1.45;
  color: var(--muted);
}

.mode-tabs {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.mode-tab {
  padding: 10px 14px;
  border: 1px solid rgba(138, 88, 18, 0.14);
  background: rgba(255, 255, 255, 0.48);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 999px;
}

.mode-tab.active {
  background: linear-gradient(135deg, var(--gold), #b66b18);
  color: #fff7eb;
  box-shadow: 0 12px 24px rgba(177, 103, 22, 0.16);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(138, 88, 18, 0.14);
}

.difficulty-picker {
  display: grid;
  gap: 8px;
  min-width: 190px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.difficulty-select {
  appearance: none;
  padding: 12px 42px 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(82, 60, 21, 0.12);
  background:
    linear-gradient(45deg, transparent 50%, rgba(89, 100, 83, 0.95) 50%) calc(100% - 20px) calc(50% - 3px) / 8px 8px no-repeat,
    linear-gradient(135deg, rgba(89, 100, 83, 0.95) 50%, transparent 50%) calc(100% - 14px) calc(50% - 3px) / 8px 8px no-repeat,
    rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: none;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary-button,
.secondary-button,
.ghost-button {
  padding: 12px 18px;
  font-weight: 800;
}

.primary-button {
  color: #fff7eb;
  background: linear-gradient(135deg, var(--gold), #b66b18);
  box-shadow: 0 12px 24px rgba(177, 103, 22, 0.22);
}

.secondary-button {
  color: var(--sage-deep);
  background: rgba(126, 155, 118, 0.18);
}

.ghost-button {
  color: var(--rose);
  background: rgba(184, 95, 72, 0.13);
}

.wide-button {
  width: 100%;
  margin-top: 14px;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(180px, 0.42fr) minmax(0, 1.7fr) minmax(260px, 0.72fr);
  gap: 20px;
  align-items: start;
}

.board-column {
  display: grid;
  gap: 10px;
}

.board-panel,
.card {
  background:
    linear-gradient(180deg, rgba(255, 250, 242, 0.92), rgba(252, 243, 229, 0.88));
  backdrop-filter: blur(14px);
  border: 1px solid rgba(120, 88, 27, 0.08);
  box-shadow: var(--shadow);
}

.board-panel {
  border-radius: 22px;
  padding: 16px;
}

.card {
  background: none;
  backdrop-filter: none;
  border: 0;
  border-radius: 0;
  clip-path: none;
  box-shadow: none;
  padding: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 10px;
}

.panel-header.compact {
  margin-bottom: 14px;
}

.panel-header h2 {
  font-size: 1.8rem;
  letter-spacing: -0.02em;
}

.board-brief-list {
  max-width: 42ch;
}

.board-instructions {
  padding: 6px 0 0;
  border-bottom: 0;
}

.puzzle-summary {
  padding: 2px 0 6px;
  color: var(--sage-deep);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
}

.daily-selector {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding-top: 4px;
}

.daily-dot {
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(138, 88, 18, 0.16);
  background: rgba(255, 255, 255, 0.52);
  position: relative;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 18px rgba(106, 72, 19, 0.09);
}

.daily-dot-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.daily-dot.active {
  background: linear-gradient(135deg, var(--gold), #b66b18);
  border-color: rgba(138, 88, 18, 0.28);
}

.daily-dot.active .daily-dot-label {
  color: #fff7eb;
}

.daily-dot-crown {
  display: none;
}

.board {
  display: grid;
  grid-template-columns: repeat(15, minmax(0, 1fr));
  gap: 4px;
}

.cell {
  appearance: none;
  padding: 0;
  aspect-ratio: 1;
  border-radius: 14px;
  border: 1px solid rgba(82, 60, 21, 0.08);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  background-clip: padding-box;
}

.cell:hover {
  transform: none;
}

.cell::before {
  content: attr(data-bonus);
  opacity: 0.72;
}

.cell.playable-preview {
  box-shadow: inset 0 0 0 3px rgba(209, 141, 43, 0.58);
}

.cell.occupied::before {
  content: "";
}

.cell[data-type="normal"] {
  background: rgba(255, 251, 244, 0.95);
}

.cell[data-type="DL"] {
  background: var(--double-letter);
}

.cell[data-type="TL"] {
  background: var(--triple-letter);
}

.cell[data-type="DW"] {
  background: var(--double-word);
}

.cell[data-type="TW"] {
  background: var(--triple-word);
}

.cell.occupied {
  background: linear-gradient(180deg, #f8d88a, var(--tile));
  border-color: rgba(136, 90, 23, 0.26);
  box-shadow:
    inset 0 -4px 0 rgba(158, 106, 26, 0.2),
    0 7px 14px rgba(106, 72, 19, 0.12);
  color: #3f2f16;
}

.cell.seeded {
  cursor: default;
}

.cell.placed {
  cursor: grab;
  box-shadow:
    inset 0 -4px 0 rgba(158, 106, 26, 0.2),
    0 0 0 3px rgba(214, 143, 45, 0.38),
    0 6px 12px rgba(106, 72, 19, 0.16);
}

.cell.solution-tile {
  box-shadow:
    inset 0 -4px 0 rgba(158, 106, 26, 0.2),
    0 0 0 4px rgba(209, 141, 43, 0.62),
    0 6px 12px rgba(106, 72, 19, 0.16);
}

.cell.submitted-tile {
  box-shadow:
    inset 0 -4px 0 rgba(158, 106, 26, 0.2),
    0 0 0 4px rgba(126, 155, 118, 0.62),
    0 6px 12px rgba(106, 72, 19, 0.16);
}

.cell-letter {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-top: 2px;
  font-size: clamp(0.8rem, 1.2vw, 1.1rem);
  font-weight: 800;
  line-height: 1;
}

.cell-value {
  position: absolute;
  right: 5px;
  bottom: 4px;
  font-size: 0.52rem;
  font-weight: 800;
  line-height: 1;
  opacity: 0.84;
}

.sidebar {
  display: grid;
  gap: 18px;
}

.rack {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  min-height: 88px;
  padding: 14px 0 0;
  border-radius: 0;
  background: none;
  border: 0;
  border-top: 1px solid rgba(82, 60, 21, 0.18);
}

.rack-tile {
  aspect-ratio: 0.92;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8d88a, var(--tile));
  border: 1px solid rgba(136, 90, 23, 0.26);
  box-shadow: inset 0 -4px 0 rgba(158, 106, 26, 0.2);
  position: relative;
  display: block;
  color: #3f2f16;
}

.rack-letter {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-top: 2px;
  font-size: clamp(0.8rem, 1.2vw, 1.1rem);
  font-weight: 800;
  line-height: 1;
}

.rack-value {
  position: absolute;
  right: 5px;
  bottom: 4px;
  font-size: 0.52rem;
  line-height: 1;
  font-weight: 800;
  opacity: 0.84;
}

.rack-instructions,
.move-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.rack-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 12px;
}

.rack-action-button {
  flex: 1;
  padding: 10px 14px;
  font-size: 0.88rem;
}

.rack.drag-target {
  background: rgba(126, 155, 118, 0.14);
  border-color: rgba(78, 106, 70, 0.36);
}

.rack-tile[draggable="true"],
.cell.placed[draggable="true"] {
  cursor: grab;
}

.rack-tile.dragging,
.cell.placed.dragging {
  opacity: 0.45;
}

.cell.drop-target {
  box-shadow: inset 0 0 0 3px rgba(78, 106, 70, 0.55);
}

.instruction-grid {
  display: grid;
  gap: 12px;
}

.instruction-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
}

.instruction-index {
  min-width: 34px;
  padding-top: 2px;
  color: var(--gold-deep);
  font-family: "Space Mono", monospace;
  font-size: 0.82rem;
  font-weight: 700;
}

.instruction-step h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.instruction-step p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.92rem;
}

.feedback {
  min-height: 120px;
  padding: 0;
  border-radius: 0;
  background: none;
  color: var(--ink);
  line-height: 1.65;
  border-left: 0;
}

.feedback strong {
  color: var(--gold-deep);
}

.definition-card {
  margin-top: 8px;
  padding: 0;
  border-radius: 0;
  background: none;
  color: var(--muted);
  line-height: 1.6;
  border-left: 0;
  padding-top: 8px;
  border-top: 1px solid rgba(126, 155, 118, 0.2);
}

.rack-card,
.move-card,
.feedback-card {
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(138, 88, 18, 0.14);
}

.definition-card strong {
  color: var(--ink);
}

@media (max-width: 960px) {
  .game-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-left: 8px;
    padding-right: 8px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 18px, 1200px);
  }

  .board-panel {
    border-radius: 22px;
  }

  .card,
  .hero {
    clip-path: none;
    border-radius: 0;
  }

  .board {
    gap: 3px;
  }

  .cell {
    border-radius: 10px;
  }

  .rack {
    gap: 8px;
  }

  .rack-tile {
    border-radius: 14px;
  }

  .rack-actions {
    flex-direction: column;
  }

  .daily-selector {
    justify-content: flex-start;
  }
}
.site-footer {
  width: min(1320px, calc(100vw - 48px));
  margin: 0 auto 28px;
  padding: 8px 0 0;
}

.site-footer p {
  margin: 0;
  color: rgba(82, 60, 21, 0.72);
  font-size: 0.85rem;
  line-height: 1.5;
}
