@font-face {
  font-family: "PT Serif";
  src: url("assets/fonts/PTSerif-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

.today-card img {
  filter: brightness(0) saturate(100%);
  opacity: 0.8;
}

[data-theme="dark"] .today-card img {
  filter: brightness(0) invert(1);
}

.next-puzzles-countdown {
  display: block;
  margin: 6px 0 0;
  color: var(--muted);
  font-family: var(--system-fonts);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.compact-progress {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--muted);
  font-family: var(--system-fonts);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.next-puzzles-countdown[hidden] {
  display: none;
}

@font-face {
  font-family: "PT Serif";
  src: url("assets/fonts/PTSerif-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Roboto SemiBold";
  src: url("assets/fonts/Roboto-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fbf4df;
  --paper: #fffdf5;
  --card: #fffdf7;
  --card-soft: #f8f0d8;
  --text: #423826;
  --title: #241f17;
  --muted: #7b6d55;
  --found: #9b8d74;
  --border: #dfcfaa;
  --shadow: rgba(74, 54, 22, 0.14);
  --shadow-soft: rgba(74, 54, 22, 0.08);
  --primary: #2f6f73;
  --primary-soft: #d7ece5;
  --quote-primary: #2f6f73;
  --quote-primary-light: rgba(47, 111, 115, 0.22);
  --secondary-light: rgba(136, 104, 49, 0.14);
  --success: #4d8f60;
  --success-soft: #e4f0d8;
  --error: #c94f5d;
  --delete-soft: rgba(195, 82, 82, 0.09);
  --delete-border: rgba(195, 82, 82, 0.24);
  --delete-text: #a33a3f;
  --overlay-bg: rgba(44, 34, 18, 0.48);
  --system-fonts: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #101820;
  --paper: #17222b;
  --card: #1d2a34;
  --card-soft: #14202a;
  --text: #e8dfca;
  --title: #fff4da;
  --muted: #b7aa91;
  --found: #827964;
  --border: #384653;
  --shadow: rgba(0, 0, 0, 0.42);
  --shadow-soft: rgba(0, 0, 0, 0.24);
  --primary: #72b7a7;
  --primary-soft: #223c3d;
  --quote-primary: #72b7a7;
  --quote-primary-light: rgba(114, 183, 167, 0.26);
  --secondary-light: rgba(232, 223, 202, 0.1);
  --success: #91c783;
  --success-soft: #243d31;
  --delete-soft: rgba(224, 112, 112, 0.12);
  --delete-border: rgba(224, 112, 112, 0.28);
  --delete-text: #f09a9a;
  --overlay-bg: rgba(4, 8, 12, 0.66);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 253, 245, 0.82), transparent 34rem),
    linear-gradient(180deg, var(--bg), var(--card-soft));
  color: var(--text);
  font-family: var(--system-fonts);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="dark"] body {
  background: linear-gradient(180deg, var(--bg), var(--card-soft));
}

button {
  font: inherit;
}

.site-header {
  width: min(1120px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

h1 {
  margin: 0;
  color: var(--title);
  font-size: 1.8rem;
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: 0;
}

.date-line {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  box-shadow: 0 4px 10px var(--shadow);
  font-size: 1rem;
  font-weight: 700;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  display: block;
  margin: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.text-button {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--muted);
  padding: 0 12px;
  cursor: pointer;
  box-shadow: 0 4px 10px var(--shadow-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.text-button:active {
  transform: scale(0.98);
}

.app-shell {
  width: min(1120px, calc(100% - 24px));
  margin: 0 auto 42px;
  display: grid;
  gap: 14px;
}

.game-nav-panel,
.game-panel {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 8px 18px var(--shadow-soft);
}

.game-nav-panel {
  padding: 8px;
}

.game-menu-bar {
  display: none;
}

.game-menu-label {
  color: var(--title);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.menu-toggle {
  box-shadow: none;
  border: 1px solid var(--border);
}

.game-panel {
  padding: 18px;
}

.game-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.tab-button {
  min-height: 50px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 4px 10px var(--shadow-soft);
  transition: opacity 0.2s, transform 0.2s, background-color 0.3s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tab-button:is([aria-current="page"], [data-active="true"]) {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--paper);
}

.tab-button.completed:not([aria-current="page"]):not([data-active="true"]) {
  background: var(--success-soft);
  color: var(--title);
}

.completion-mark,
.title-complete {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--success);
  color: var(--paper);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
}

.title-complete {
  margin-left: 9px;
  vertical-align: 2px;
}

.tab-button:active {
  transform: scale(0.98);
}

.game-stage {
  min-height: 560px;
  border-radius: 16px;
  background: transparent;
  overflow: visible;
  width: 100%;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  width: 100%;
}

.game-info {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 16px 12px;
  border-radius: 16px;
  box-shadow: 0 8px 8px var(--shadow-soft), 0 2px 8px var(--shadow-soft);
  animation: titleFadeIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.game-info h2 {
  margin: 0 0 8px;
  color: var(--title);
  font-size: 1.35rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.game-info p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.42;
}

.primary-action,
.secondary-action {
  min-height: 44px;
  border-radius: 12px;
  padding: 0 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}

.primary-action {
  border: none;
  background: var(--primary);
  color: var(--paper);
}

.primary-action:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.secondary-action {
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text);
}

.primary-action:active,
.secondary-action:active {
  transform: scale(0.96);
}

.loading,
.error-state,
.empty-state,
.empty-tabs {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

.empty-tabs {
  padding: 14px;
  grid-column: 1 / -1;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 1000;
  translate: -50% 16px;
  opacity: 0;
  pointer-events: none;
  max-width: min(460px, calc(100% - 32px));
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--title);
  color: var(--bg);
  font-weight: 700;
  text-align: center;
  transition: opacity 0.2s, translate 0.2s;
}

.toast.show {
  opacity: 1;
  translate: -50% 0;
}

.success-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--overlay-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.success-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.success-panel {
  width: min(420px, 100%);
  padding: 30px 40px;
  border-radius: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}

.success-panel h2 {
  margin: 0 0 8px;
}

.success-panel p {
  margin: 0 0 22px;
  color: var(--muted);
}

.success-panel button {
  min-height: 42px;
  border: none;
  border-radius: 12px;
  padding: 0 24px;
  background: var(--primary);
  color: var(--paper);
  font-weight: 700;
  cursor: pointer;
}

.word-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  margin-top: 18px;
}

.word-chip {
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  position: relative;
  opacity: 0;
  animation: wordPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.word-chip.found {
  color: var(--found);
  opacity: 0.65;
}

.word-chip.found::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  top: 55%;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  animation: strikeIn 0.3s forwards ease-out;
}

.word-search-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  animation: boardIntro 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s forwards;
}

.selection-preview {
  position: sticky;
  top: 0;
  width: 100%;
  min-height: 42px;
  display: grid;
  place-items: center;
  color: var(--title);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  z-index: 5;
}

.selection-preview::before {
  content: "";
  position: absolute;
  width: var(--preview-width, 0);
  height: 34px;
  border-radius: 10px;
  background: var(--preview-color, transparent);
  opacity: 0.35;
  z-index: -1;
  transition: background-color 0.12s ease-out, opacity 0.08s ease-out;
}

.selection-preview span {
  position: relative;
  z-index: 1;
}

.ws-grid-wrap {
  position: relative;
  width: min(100%, calc(var(--ws-grid-max, 352px) + 16px));
  max-width: 100%;
  margin: 0 auto;
  padding: 8px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 8px 24px var(--shadow), 0 2px 8px var(--shadow-soft);
  user-select: none;
  touch-action: none;
}

.ws-grid {
  display: grid;
  gap: 1px;
  width: min(100%, var(--ws-grid-max, 352px));
  max-width: 100%;
  position: relative;
  z-index: 2;
}

.ws-cell {
  width: auto;
  min-width: 0;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--text);
  font-size: 19px;
  font-weight: 600;
  position: relative;
  z-index: 3;
  opacity: 0;
  animation: cellFade 0.3s ease forwards;
}

.ws-selection-line,
.ws-found-line {
  position: absolute;
  height: 34px;
  border-radius: 20px;
  transform-origin: center left;
  pointer-events: none;
  z-index: 1;
  opacity: 0.78;
}

.ws-selection-line {
  display: none;
  background: #7ccaf0;
  transition: width 0.06s ease-out, transform 0.06s ease-out, left 0.06s ease-out, top 0.06s ease-out;
}

.ws-found-line {
  background: #7ccaf0;
  animation: lineSettle 0.3s ease both;
}

.ws-found-line.instant {
  animation: none;
  opacity: 0.78;
}

.ws-cell.locked {
  color: var(--text);
}

.flying-word {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  color: var(--text);
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
  will-change: left, top, width, transform, opacity;
  transition:
    left 0.42s ease-out,
    top 0.42s ease-out,
    width 0.42s ease-out,
    transform 0.42s ease-out,
    opacity 0.36s ease-out,
    font-size 0.42s ease-out;
}

.connections-area {
  display: grid;
  gap: 14px;
  width: min(100%, 680px);
  margin: 0 auto;
}

.solved-groups {
  display: grid;
  gap: 10px;
}

.solved-group {
  padding: 14px;
  border-radius: 14px;
  color: #000000;
  text-align: center;
  animation: pop 0.3s ease;
}

.solved-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.solved-words {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
  font-weight: 600;
}

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

.connection-word {
  min-height: 76px;
  border: none;
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  padding: 12px 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 10px var(--shadow);
  transition: background-color 0.2s, color 0.2s, box-shadow 0.2s, opacity 0.2s, transform 0.2s;
  opacity: 0;
  animation: wordPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.connection-word.selected {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 8px 18px var(--shadow);
  transform: translateY(-1px);
}

.connection-word-label {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  letter-spacing: 0;
}

.connection-word:active {
  transform: scale(0.98);
}

.connection-actions {
  display: flex;
  gap: 10px;
}

.connection-actions .primary-action {
  flex: 1;
}

.quote-board {
  font-family: var(--system-fonts);
  display: grid;
  gap: 14px;
  max-width: 600px;
  margin: 0 auto;
  color: var(--text);
  opacity: 0;
  animation: boardIntro 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.mistake-meter {
  display: flex;
  justify-content: center;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.quote-options {
  display: flex;
  justify-content: center;
}

.toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.toggle-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  width: 38px;
  height: 22px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.toggle-thumb {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--muted);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.toggle-control input:checked + .toggle-track {
  border-color: var(--quote-primary);
  background: var(--quote-primary-light);
}

.toggle-control input:checked + .toggle-track .toggle-thumb {
  background: var(--quote-primary);
  transform: translateX(16px);
}

.toggle-control input:focus-visible + .toggle-track {
  outline: 2px solid var(--quote-primary);
  outline-offset: 3px;
}

.quote-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 30px;
}

.quote-word {
  display: flex;
  gap: 2px;
  align-items: flex-start;
}

.quote-cell {
  width: 28px;
  display: grid;
  justify-items: center;
  cursor: pointer;
  animation: cellFade 0.25s ease both;
}

.quote-letter {
  width: 100%;
  height: 40px;
  display: grid;
  place-items: center;
  border-bottom: 1.5px solid var(--border);
  font-size: 1.4rem;
  font-weight: 600;
}

.quote-number {
  height: 1rem;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 500;
  text-align: center;
}

.quote-cell.active .quote-letter {
  border-bottom: 2.5px solid var(--quote-primary);
  background: var(--quote-primary-light);
}

.quote-cell.same .quote-letter {
  background: var(--secondary-light);
}

.quote-cell.hint .quote-letter {
  color: var(--quote-primary);
}

.quote-cell.wrong .quote-letter {
  color: var(--error);
  border-bottom-color: var(--error);
  animation: shake 0.35s ease-in-out;
}

.quote-cell.punctuation {
  width: auto;
  min-width: 10px;
  padding: 0 1px;
  cursor: default;
}

.quote-cell.punctuation .quote-letter {
  border-bottom-color: transparent;
  font-weight: 500;
}

.keyboard {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  background: var(--secondary-light);
}

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

.key {
  min-width: 0;
  flex: 1;
  height: 48px;
  border: 1px solid var(--border);
  border-bottom: 3px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.key.wide {
  flex: 1.5;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.key.primary {
  background: var(--quote-primary);
  color: #ffffff;
  border-color: var(--quote-primary);
  border-bottom-color: #0369a1;
}

.key.delete-key {
  background: var(--delete-soft);
  color: var(--delete-text);
  border-color: var(--delete-border);
  border-bottom-color: var(--delete-border);
}

.key.solved {
  opacity: 0.3;
  cursor: default;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes strikeIn {
  to {
    transform: scaleX(1);
  }
}

@keyframes titleFadeIn {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes boardIntro {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes wordPop {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes cellFade {
  to {
    opacity: 1;
  }
}

@keyframes lineSettle {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 0.78;
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
}

@media (max-width: 760px) {
  .site-header {
    align-items: flex-start;
  }

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

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

  .connections-grid {
    gap: 7px;
  }

  .connection-word {
    min-height: 58px;
    font-size: 0.82rem;
    padding: 4px;
  }

  .quote-grid {
    gap: 8px 22px;
  }

  .quote-cell {
    width: 24px;
  }

  .quote-letter {
    height: 36px;
    font-size: 1.2rem;
  }

  .key {
    height: 42px;
    font-size: 0.85rem;
    border-radius: 6px;
  }

  .keyboard {
    padding: 8px;
  }
}

@media (max-width: 640px) {
  .game-nav-panel {
    position: relative;
  }

  .game-menu-bar {
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 2px 0 10px;
  }

  .game-nav-panel:not(.menu-open) .game-tabs {
    display: none;
  }

  .game-nav-panel.menu-open .game-tabs {
    display: grid;
    margin-top: 8px;
    grid-template-columns: 1fr;
  }

  .tab-button {
    justify-content: flex-start;
    padding: 0 14px;
  }
}

@media (max-width: 520px) {
  .game-panel {
    padding: 12px;
  }

  .word-search-board {
    gap: 6px;
  }

  .selection-preview {
    min-height: 36px;
    font-size: 16px;
  }

  .selection-preview::before {
    height: 30px;
  }

  .ws-grid-wrap {
    padding: 6px;
    border-radius: 14px;
  }

  .ws-cell {
    font-size: 16px;
  }
}

/* Final cascade layer for the Unity-inspired launch refresh. */
:root {
  --bg: #f8f4ea;
  --paper: #fffdf8;
  --card: #fff9ee;
  --card-soft: #efe8d8;
  --text: #242017;
  --title: #242017;
  --muted: #7b6d55;
  --border: #e2d8c3;
  --shadow: rgba(61, 51, 38, 0.16);
  --shadow-soft: rgba(61, 51, 38, 0.09);
  --primary: #2f6f73;
  --primary-soft: #d8efe9;
  --word-search: #f2c94c;
  --connections: #b8a7e8;
  --quote: #8fd2bf;
  --display-font: "PT Serif", Georgia, serif;
  --ui-font: "Roboto SemiBold", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg: #101820;
  --paper: #18232b;
  --card: #1d2a34;
  --card-soft: #233645;
  --text: #fff4da;
  --title: #fff4da;
  --muted: #b7aa91;
  --border: #384653;
  --primary: #72b7a7;
  --primary-soft: #223c3d;
}

body {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--word-search) 20%, transparent), transparent 32%),
    linear-gradient(225deg, color-mix(in srgb, var(--quote) 20%, transparent), transparent 34%),
    linear-gradient(180deg, var(--bg), var(--card-soft));
  font-family: var(--ui-font);
}

[data-theme="dark"] body {
  background:
    linear-gradient(135deg, rgba(242, 201, 76, 0.11), transparent 30%),
    linear-gradient(225deg, rgba(143, 210, 191, 0.11), transparent 32%),
    linear-gradient(180deg, var(--bg), #0c1319);
}

.site-header {
  padding: 24px 0 14px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    linear-gradient(135deg, var(--word-search) 0 33%, var(--connections) 33% 66%, var(--quote) 66%);
  box-shadow: 0 10px 24px var(--shadow-soft);
}

.brand-mark span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.9);
  color: #242017;
  font-family: var(--display-font);
  font-size: 1.35rem;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1 {
  font-family: var(--display-font);
  font-size: 2.35rem;
  font-weight: 700;
}

.date-line {
  margin-top: 5px;
  font-size: 0.9rem;
}

.icon-button {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--title);
  box-shadow: 0 8px 20px var(--shadow-soft);
}

.app-shell {
  gap: 12px;
}

.today-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.today-card {
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--paper) 92%, var(--primary-soft));
  box-shadow: 0 8px 18px var(--shadow-soft);
}

.today-card img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.metric-label,
.tab-copy small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.today-card strong {
  display: block;
  margin-top: 5px;
  color: var(--title);
  font-size: 1rem;
}

.game-nav-panel,
.game-panel {
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.game-nav-panel {
  padding: 10px;
}

.game-panel {
  padding: 20px;
}

.game-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.tab-button {
  min-height: 68px;
  justify-content: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--card);
  text-align: left;
}

.tab-icon-wrap,
.game-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 12px;
  background: var(--game-accent, var(--primary-soft));
}

.tab-icon-wrap img,
.game-icon img {
  width: 21px;
  height: 21px;
  object-fit: contain;
  filter: brightness(0) saturate(100%);
  opacity: 0.88;
}

.tab-copy {
  min-width: 0;
  flex: 1;
}

.tab-copy span {
  display: block;
  color: var(--title);
  font-size: 0.98rem;
}

.tab-button:is([aria-current="page"], [data-active="true"]) {
  background: var(--game-accent);
  border-color: color-mix(in srgb, var(--game-accent) 78%, #000);
  color: var(--game-on-accent);
}

.tab-button:is([aria-current="page"], [data-active="true"]) .tab-copy span,
.tab-button:is([aria-current="page"], [data-active="true"]) .tab-copy small {
  color: var(--game-on-accent);
}

.tab-button:is([aria-current="page"], [data-active="true"]) .tab-icon-wrap {
  background: rgba(255, 255, 255, 0.36);
}

.completion-mark,
.title-complete {
  background: var(--primary);
  color: #fffdf8;
}

.game-stage {
  min-height: 590px;
}

.game-layout {
  grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
  gap: 22px;
}

.game-info {
  position: sticky;
  top: 14px;
  padding: 18px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--game-accent) 18%, transparent), transparent 76%),
    var(--card);
}

.game-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.game-info h2 {
  font-family: var(--display-font);
  font-size: 1.65rem;
  text-transform: none;
  letter-spacing: 0;
}

.game-info p {
  font-family: var(--system-fonts);
  font-size: 0.94rem;
}

.primary-action {
  background: var(--game-accent, var(--primary));
  color: var(--game-on-accent, #ffffff);
}

.word-chip {
  padding: 5px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--game-accent) 18%, transparent);
  font-family: var(--system-fonts);
  font-weight: 700;
}

.word-chip.found {
  background: transparent;
}

.ws-grid-wrap,
.connection-word,
.keyboard {
  border: 1px solid var(--border);
}

.connections-area,
.quote-board {
  font-family: var(--system-fonts);
  width: min(100%, 700px);
}

.connection-word {
  box-shadow: 0 5px 12px var(--shadow-soft);
  font-weight: 700;
}

.connection-word.selected {
  background: var(--game-accent);
  color: var(--game-on-accent);
}

.key.primary {
  background: var(--game-accent);
  color: var(--game-on-accent);
  border-color: color-mix(in srgb, var(--game-accent) 72%, #000);
  border-bottom-color: color-mix(in srgb, var(--game-accent) 55%, #000);
}

.quote-letter {
  font-family: var(--system-fonts);
}

.success-panel {
  border-radius: 18px;
}

.success-panel h2 {
  font-family: var(--display-font);
  color: var(--title);
}

@media (max-width: 760px) {
  .site-header {
    padding-top: 18px;
  }

  h1 {
    font-size: 1.9rem;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }

  .today-strip {
    grid-template-columns: 1fr;
  }

  .game-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .game-info {
    position: static;
  }
}

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

  .game-menu-bar {
    padding-left: 8px;
  }

  .game-nav-panel.menu-open .game-tabs {
    gap: 8px;
  }

  .tab-button {
    min-height: 58px;
  }
}

@media (max-width: 420px) {
  .site-header {
    width: min(100% - 16px, 1120px);
    gap: 10px;
  }

  .brand-block {
    gap: 10px;
  }

  .brand-mark {
    display: none;
  }

  .app-shell {
    width: min(100% - 16px, 1120px);
  }
}

/* Keep the mobile play surface within its grid track. */
.app-shell > *,
.game-layout > *,
.today-card > div {
  min-width: 0;
}

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

  .today-strip {
    grid-template-columns: minmax(0, 1fr);
  }

  .game-nav-panel {
    position: sticky;
    top: 8px;
    z-index: 20;
    background: var(--paper);
  }

  .game-menu-bar {
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .game-nav-panel:not(.menu-open) .game-tabs {
    display: none;
  }

  .game-nav-panel.menu-open .game-tabs {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    margin-top: 8px;
  }

  .game-panel {
    padding: 12px;
  }

  .game-stage {
    min-height: 0;
  }

  .quote-board {
    position: relative;
  }

  .quote-board .keyboard {
    position: sticky;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 10;
    background: var(--paper);
    border: 1px solid var(--border);
    box-shadow: 0 -4px 16px var(--shadow-soft);
    padding: 6px;
  }

  .keyboard-row {
    gap: 3px;
  }

  .key {
    height: 44px;
    padding: 0;
    touch-action: manipulation;
  }

  .key.wide {
    font-size: 0.65rem;
    letter-spacing: 0;
  }

  .toggle-control {
    min-height: 44px;
  }
}

@media (max-width: 360px) {
  body[data-active-game="connections"] .game-panel {
    padding: 6px;
  }

  .connections-grid {
    gap: 4px;
  }

  .connection-word {
    padding: 2px;
  }
}

@media (min-width: 761px) {
  .game-nav-panel {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .game-tabs {
    flex: 1;
    min-width: 0;
  }

  .game-menu-bar {
    display: flex;
    order: 2;
    padding-right: 4px;
  }

  .game-menu-label,
  .menu-toggle {
    display: none;
  }
}


/* Crawlable navigation and readable rules share the existing game palette. */
.tab-button,
.brand-mark {
  text-decoration: none;
}
[hidden] {
  display: none !important;
}
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  transform: translateY(-200%);
  z-index: 100;
  padding: 12px 18px;
  background: var(--paper);
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 10px;
}
.skip-link:focus {
  transform: none;
}
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}
.puzzle-guide {
  width: 100%;
  justify-self: center;
  margin-inline: auto;
  padding: clamp(20px, 4vw, 36px);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--paper);
  line-height: 1.75;
}
.puzzle-guide h2,
.puzzle-guide h3 {
  color: var(--title);
  line-height: 1.3;
}
.guide-content {
  width: min(100%, 75ch);
  margin-inline: auto;
}
.puzzle-guide h2 {
  margin-top: 0;
  font-family: var(--display-font);
  font-size: 1.6rem;
}
.puzzle-guide h3 {
  margin: 24px 0 8px;
  font-size: 1.08rem;
}
.puzzle-guide li + li {
  margin-top: 8px;
}
.puzzle-guide a,
.site-footer a,
.game-stage a {
  color: var(--primary);
  text-underline-offset: 3px;
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.site-footer {
  width: min(1120px, calc(100% - 24px));
  margin: 0 auto 32px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px 24px;
  font-size: 0.88rem;
  line-height: 1.6;
}
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
}
@media (max-width: 760px) {
  html:not(.js-ready) .game-nav-panel .game-tabs {
    display: grid;
  }
  html:not(.js-ready) .game-menu-bar {
    display: none;
  }
  .guide-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}

.onboarding-example {
  width: min(100%, 440px);
  margin: 20px auto;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
}
.example-label {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.8rem;
}
.example-connections {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  min-height: 94px;
}
.example-tile,
.example-code-cell {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--title);
  background: var(--paper);
  font-size: clamp(0.65rem, 2.5vw, 0.8rem);
  transition: background-color 160ms, color 160ms;
}
.example-tile.is-selected,
.example-code-cell.is-selected {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--paper);
}
.example-solved {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  padding: 8px;
  background: #b8a7e8;
  color: #281f3c;
  border-radius: 8px;
  font-size: 0.75rem;
  line-height: 1.6;
}
.example-connections.is-solved .example-tile.is-selected {
  display: none;
}
.onboarding-example figcaption,
.example-status {
  font-family: var(--system-fonts);
  font-size: 0.9rem;
  line-height: 1.6;
}
.onboarding-example figcaption {
  margin-top: 16px;
}
.example-status {
  margin: 10px 0 0;
  color: var(--muted);
}
.example-quote {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}
.example-code-cell {
  font-size: 1.3rem;
  line-height: 1.4;
}
.example-code-cell:nth-child(3) {
  margin-right: 6px;
}
.example-code-cell:nth-child(4) {
  margin-left: 6px;
}
.example-code-cell small {
  font-family: var(--system-fonts);
  font-size: 0.7rem;
}
@media (prefers-reduced-motion: reduce) {
  .onboarding-example * {
    transition: none;
  }
}

/* Use the actual Unity app icon, rather than recreating the brand in CSS. */
.site-header .brand-mark {
  display: block;
  width: 54px;
  height: 54px;
  border: 0;
  background: none;
  overflow: hidden;
}
.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
}
.site-title {
  color: inherit;
  text-decoration: none;
}
.puzzle-guide {
  font-family: var(--system-fonts);
}
@media (max-width: 420px) {
  .site-header .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }
  .site-header h1 {
    font-size: 1.6rem;
  }
}

/* Landing content follows the existing serif headings, UI type and game colors. */
.landing-card > p,
.landing-notes p {
  font-family: var(--system-fonts);
  font-size: 1rem;
  line-height: 1.7;
}
.landing-games {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 8px 0 24px;
}
.landing-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--game-accent) 15%, transparent), transparent 65%), var(--paper);
  box-shadow: 0 8px 18px var(--shadow-soft);
}
.landing-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
}
.landing-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  border-radius: 16px;
  background: var(--game-accent);
}
.landing-icon img {
  filter: brightness(0) saturate(100%);
  opacity: 0.88;
}
.landing-card-top h2 {
  flex: 1;
  min-width: 0;
  font-size: clamp(1.25rem, 2.3vw, 1.65rem);
}
.landing-card-top .completion-mark {
  flex: 0 0 auto;
}
.landing-card h2,
.landing-notes h2 {
  margin: 0;
  color: var(--title);
  font-family: var(--display-font);
  font-size: 1.65rem;
  line-height: 1.25;
}
.landing-card > p {
  margin: 14px 0 24px;
  flex: 1;
}
.landing-play {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 12px;
  font-family: var(--ui-font);
  font-size: 0.88rem;
  text-decoration: none;
}
.landing-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
}
.landing-notes h2 {
  font-size: 1.25rem;
}
.landing-notes p {
  margin-bottom: 0;
}
.puzzle-guide h3 {
  font-family: var(--ui-font);
}
@media (max-width: 760px) {
  .landing-games,
  .landing-notes {
    grid-template-columns: minmax(0, 1fr);
  }
  .landing-card {
    padding: 22px;
  }
}
@media (max-width: 960px) {
  .landing-games {
    grid-template-columns: minmax(0, 1fr);
  }
}
