@import url("https://fonts.googleapis.com/css2?family=Baloo+2:wght@600&family=Chakra+Petch:wght@500;600&family=Fredoka:wght@600;700&family=Inter:wght@400;600;700&family=Nunito:wght@600;700&family=Noto+Sans+JP:wght@400;600&family=Orbitron:wght@500;700&family=Source+Code+Pro:wght@500;600&family=Source+Sans+Pro:wght@600&family=Space+Grotesk:wght@500;600&family=VT323&family=Zen+Kurenaido&display=swap");

:root {
  --bg: #f3f4f8;
  --surface: #ffffff;
  --border: #d7d9e0;
  --text: #1f2430;
  --muted: #5b6275;
  --accent: #ff6b6b;
  --accent-strong: #ff3d57;
  --accent-shadow: rgba(255, 107, 107, 0.25);
  --p1: #2463eb;
  --p2: #f97316;
  --capture-bg: #eef2ff;
  --capture-bg-p2: #fff4ec;
  --draw-bg: #f2f4f7;
  --cell-bg: #f8f9ff;
  --last-move-glow: rgba(36, 99, 235, 0.3);
  --active-board-border: #00d600;
  --active-board-glow: rgba(0, 214, 0, 0.35);
  --active-board-glow-strong: rgba(0, 214, 0, 0.5);
  --macro-line: rgba(0, 0, 0, 0.35);
  --overlay-scrim: rgba(20, 24, 35, 0.85);
  --radius: 16px;
  --font-body: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --font-heading: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --bg-pattern: none;
  --panel-shadow: none;
  --cell-hover-shadow: none;
  --cell-hover-bg: #f8f9ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  background-color: var(--bg);
  background-image: var(--bg-pattern, none);
  background-attachment: fixed;
  background-size: cover;
  color: var(--text);
  line-height: 1.5;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease;
  background-image: none;
  background-size: cover;
  background-position: center;
  z-index: -1;
}

.app-footer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 1.5rem 1rem 2rem;
}

.app-footer a {
  color: inherit;
  text-decoration: underline;
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem clamp(1rem, 3vw, 2.5rem) 3rem;
}

.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.hero-copy {
  flex: 1;
}

.eyebrow {
  letter-spacing: 0.1em;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.25rem;
}

.app-header h1 {
  margin: 0 0 0.5rem;
  font-family: var(--font-heading, var(--font-body));
}

.lede {
  margin: 0;
  color: var(--muted);
}

.primary-actions {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.theme-picker {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.theme-picker select {
  appearance: none;
  border-radius: 10px;
  border: 2px solid var(--border);
  padding: 0.35rem 0.75rem;
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font-body);
  cursor: pointer;
  margin-top: 0.15rem;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  padding: 0.5rem 1.25rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 8px 20px var(--accent-shadow, rgba(0, 0, 0, 0.2));
}

.status-bar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
  box-shadow: var(--panel-shadow, none);
}

.status-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.status-row p {
  margin: 0;
  font-weight: 600;
}

.status-bar > p {
  margin: 0;
  font-weight: 600;
}

.status-row-secondary {
  align-items: center;
}

.adaptive-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--muted);
  transition: color 0.2s ease;
}

.adaptive-indicator.flash {
  color: var(--accent);
}

.adaptive-indicator[hidden] {
  display: none;
}

.ai-telemetry {
  font-size: 0.9rem;
  color: var(--muted);
}

.ai-telemetry[hidden] {
  display: none;
}

.solo-stats-bar {
  margin: 1rem 0 2rem;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--panel-shadow, none);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  text-align: center;
}

.solo-stats-bar p {
  margin: 0;
  font-size: 0.95rem;
}

.learn-page {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.learn-hero {
  padding: 3rem 1.25rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--panel-shadow, none);
}

.learn-hero__copy {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.learn-hero__copy h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.8rem);
}

.learn-hero__copy p {
  margin: 0;
  font-size: 1.05rem;
  color: var(--muted);
}

.learn-hero__actions {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.learn-tip {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.learn-content {
  padding: 2rem 1.25rem 3rem;
  max-width: 1100px;
  margin: 0 auto;
}

.learn-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  justify-content: center;
}

.learn-grid .learn-card {
  flex: 1 1 260px;
  max-width: min(100%, 320px);
  min-width: min(100%, 240px);
}

.learn-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--panel-shadow, none);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.learn-card h2 {
  margin: 0;
  font-size: 1.2rem;
}

.learn-card p {
  margin: 0;
  color: var(--muted);
  flex: 1;
}

.learn-card a {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.learn-card a:hover {
  text-decoration: underline;
}

.solo-stats-bar.solo-stats-empty {
  opacity: 0.75;
  font-weight: 500;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 1.5rem;
}

.board-panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--panel-shadow, none);
}

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

.super-board::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(
      90deg,
      transparent calc(33.333% - 2px),
      var(--macro-line) calc(33.333% - 2px),
      var(--macro-line) calc(33.333% + 2px),
      transparent calc(33.333% + 2px)
    ),
    linear-gradient(
      90deg,
      transparent calc(66.666% - 2px),
      var(--macro-line) calc(66.666% - 2px),
      var(--macro-line) calc(66.666% + 2px),
      transparent calc(66.666% + 2px)
    ),
    linear-gradient(
      0deg,
      transparent calc(33.333% - 2px),
      var(--macro-line) calc(33.333% - 2px),
      var(--macro-line) calc(33.333% + 2px),
      transparent calc(33.333% + 2px)
    ),
    linear-gradient(
      0deg,
      transparent calc(66.666% - 2px),
      var(--macro-line) calc(66.666% - 2px),
      var(--macro-line) calc(66.666% + 2px),
      transparent calc(66.666% + 2px)
    );
}

.super-board.board-locked {
  pointer-events: none;
  opacity: 0.6;
}

.mini-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  padding: 0.75rem;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--surface);
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s;
  position: relative;
  z-index: 1;
}

.mini-board.active-board {
  border-color: var(--active-board-border);
  box-shadow: 0 0 0 3px var(--active-board-glow);
}

.mini-board.captured-p1 {
  border-color: var(--p1);
  background: var(--capture-bg);
}

.mini-board.captured-p2 {
  border-color: var(--p2);
  background: var(--capture-bg-p2, var(--capture-bg));
}

.mini-board.captured-p1 .cell {
  background: var(--capture-bg);
}

.mini-board.captured-p2 .cell {
  background: var(--capture-bg-p2, var(--capture-bg));
}

.mini-board.drawn {
  border-color: var(--border);
  background: var(--draw-bg);
}

.mini-board.active-board.captured-p1,
.mini-board.active-board.captured-p2,
.mini-board.active-board.drawn {
  border-color: var(--active-board-border);
  box-shadow: 0 0 0 4px var(--active-board-glow-strong);
}

.mini-board.disabled {
  opacity: 0.5;
}

.cell {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--cell-bg);
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition:
    transform 0.1s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.2s ease;
  box-shadow: none;
}

.cell:hover:not(:disabled) {
  transform: scale(1.05);
  border-color: var(--accent);
  box-shadow: var(--cell-hover-shadow, none);
  background: var(--cell-hover-bg, var(--cell-bg));
}

.cell:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.cell.p1 {
  color: var(--p1);
}

.cell.p2 {
  color: var(--p2);
}

.cell.last-move {
  box-shadow: 0 0 0 3px var(--last-move-glow);
}

.info-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.info-panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--panel-shadow, none);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.panel-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-family: var(--font-heading, var(--font-body));
}

.panel-toggle {
  border: none;
  background: transparent;
  color: var(--accent-strong);
  font-weight: 600;
  cursor: pointer;
}

.panel-body {
  padding: 1rem 1.25rem 1.25rem;
}

.info-panel[data-expanded="false"] .panel-body {
  display: none;
}

.history-list {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.95rem;
  max-height: calc(1.6rem * 20);
  overflow-y: auto;
  padding-right: 0.5rem;
}

.history-list.compact-history {
  max-height: calc(1.6rem * 6);
}

.history-list li {
  padding-left: 0.25rem;
}

#illegal-move-dialog {
  border: none;
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 30px 60px rgba(10, 10, 15, 0.25);
  max-width: 360px;
}

#illegal-move-dialog::backdrop {
  background: rgba(10, 10, 15, 0.55);
}

#illegal-move-message {
  margin: 0 0 1rem;
  font-weight: 600;
}

.mode-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 2.5rem);
  z-index: 30;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.mode-overlay[data-visible="false"] {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.overlay-card {
  width: min(520px, 100%);
  background: var(--surface);
  border-radius: 20px;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  box-shadow: 0 35px 70px rgba(15, 18, 28, 0.35);
  text-align: left;
}

.overlay-panel {
  display: none;
}

.overlay-card[data-card="result"] [data-panel="result"] {
  display: block;
}

.mode-overlay[data-step="players"] [data-panel="players"],
.mode-overlay[data-step="difficulty"] [data-panel="difficulty"] {
  display: block;
}

.overlay-card h2 {
  margin: 0 0 0.4rem;
  font-family: var(--font-heading, var(--font-body));
}

.overlay-copy {
  margin: 0 0 1rem;
  color: var(--muted);
}

.adaptive-toggle-group {
  margin-top: 0.5rem;
}

.adaptive-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
}

.adaptive-toggle input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.overlay-footnote {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0.35rem 0 0;
}

.overlay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

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

.difficulty-grid .overlay-choice {
  flex: unset;
  width: 100%;
}

.overlay-choice {
  flex: 1 1 120px;
  justify-content: center;
}

.overlay-choice[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.overlay-link {
  margin-top: 1rem;
  background: none;
  border: none;
  color: var(--accent-strong);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.choice-group {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  font-weight: 600;
  color: var(--text);
}

.choice-group p {
  margin: 0;
  width: 100%;
  font-size: 0.9rem;
  color: var(--muted);
}

.choice-group label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
}

.solo-only {
  display: flex;
  width: 100%;
}

.overlay-footer {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.overlay-footer {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.overlay-start {
  margin-top: 0;
  display: none;
}

/* Theme-specific flourishes */
body[data-theme="default"]::before {
  opacity: 0.25;
  background-image:
    radial-gradient(circle at 10% 15%, rgba(255, 255, 255, 0.5) 0, transparent 40%),
    radial-gradient(circle at 80% 5%, rgba(173, 194, 255, 0.3) 0, transparent 35%);
}

body[data-theme="krayon"]::before {
  opacity: 0.28;
  background-image:
    radial-gradient(circle at 5% 10%, rgba(255, 255, 255, 0.65) 0, transparent 40%),
    radial-gradient(circle at 90% 0, rgba(255, 214, 153, 0.6) 0, transparent 35%),
    repeating-linear-gradient(
      120deg,
      rgba(255, 210, 140, 0.15) 0,
      rgba(255, 210, 140, 0.15) 4px,
      transparent 4px,
      transparent 12px
    );
}

body[data-theme="krayon"] .mini-board {
  border-style: dashed;
}

body[data-theme="krayon"] {
  font-size: 1.07em;
}

body[data-theme="krayon"] .app-header h1 {
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  letter-spacing: 0.01em;
}

body[data-theme="krayon"] #turn-label,
body[data-theme="krayon"] #constraint-label,
body[data-theme="krayon"] #result-label {
  font-size: 1.05em;
}

body[data-theme="krayon"] .btn {
  border-width: 3px;
  font-size: 1.05rem;
  padding: 0.65rem 1.5rem;
}

body[data-theme="krayon"] .cell {
  font-size: clamp(1.6rem, 3.8vw, 2.4rem);
  border-width: 3px;
  text-transform: uppercase;
}

body[data-theme="vibewave"]::before {
  opacity: 0.55;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255, 78, 205, 0.35) 0, transparent 45%),
    radial-gradient(circle at 80% 0, rgba(98, 244, 255, 0.25) 0, transparent 40%);
}

body[data-theme="vibewave"] .mini-board {
  filter: drop-shadow(0 10px 25px rgba(255, 78, 205, 0.25));
}

body[data-theme="insomniac"]::before {
  opacity: 0.35;
  background-image:
    radial-gradient(circle at 40% 0%, rgba(61, 214, 140, 0.25) 0, transparent 55%),
    radial-gradient(circle at 85% 20%, rgba(29, 140, 248, 0.2) 0, transparent 45%),
    radial-gradient(circle at 10% 30%, rgba(49, 75, 124, 0.35) 0, transparent 50%);
  animation: starDrift 60s linear infinite;
}

body[data-theme="twotone"]::before {
  opacity: 0;
}

body[data-theme="sakura"]::before {
  opacity: 0.35;
  background-image:
    radial-gradient(circle at 0% 20%, rgba(255, 255, 255, 0.6) 0, transparent 40%),
    radial-gradient(circle at 80% 10%, rgba(255, 181, 206, 0.65) 0, transparent 45%),
    radial-gradient(circle at 30% 70%, rgba(255, 222, 236, 0.4) 0, transparent 35%);
  animation: petalFloat 24s linear infinite;
}

body[data-theme="sakura"] .mini-board {
  border-radius: 20px;
}

/* WOPR (1980s Beige Box Computer) theme */
body[data-theme="wopr"]::before {
  opacity: 0.15;
  background-image: var(--bg-pattern);
}

body[data-theme="wopr"] {
  font-size: 1.05em;
}

body[data-theme="wopr"] .btn {
  border-radius: 4px;
  border-width: 2px;
  border-style: solid;
  border-top-color: #f8f8f8;
  border-left-color: #f8f8f8;
  border-right-color: #8b7355;
  border-bottom-color: #8b7355;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: linear-gradient(to bottom, #f0e8d0 0%, #e6d8b5 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

body[data-theme="wopr"] .btn:hover {
  background: linear-gradient(to bottom, #f5edd5 0%, #eaddc0 100%);
}

body[data-theme="wopr"] .btn:active {
  border-top-color: #8b7355;
  border-left-color: #8b7355;
  border-right-color: #f8f8f8;
  border-bottom-color: #f8f8f8;
  background: linear-gradient(to bottom, #e0d0a0 0%, #d4c4a4 100%);
  transform: translateY(1px);
}

body[data-theme="wopr"] .btn.accent {
  background: linear-gradient(to bottom, #ff6b33 0%, #ff4500 100%);
  border-top-color: #ff8844;
  border-left-color: #ff8844;
  border-right-color: #cc3300;
  border-bottom-color: #cc3300;
  color: white;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}

body[data-theme="wopr"] .mini-board {
  border-radius: 6px;
  border-width: 1px;
  border-style: solid;
  border-color: #002200;
  background: #000000;
  box-shadow: inset 0 0 2px rgba(65, 255, 0, 0.2);
}

body[data-theme="wopr"] .mini-board.active-board {
  border-color: #41ff00;
  border-width: 2px;
  box-shadow: 0 0 0 1px rgba(65, 255, 0, 0.4), inset 0 0 4px rgba(65, 255, 0, 0.3);
}

body[data-theme="wopr"] .cell {
  border-radius: 2px;
  border-width: 1px;
  border-style: solid;
  border-color: #002200;
  font-family: "VT323", "IBM Plex Mono", monospace;
  font-weight: 400;
  font-size: 1.3em;
  background: #000000;
  color: #41ff00;
  text-shadow: 0 0 4px rgba(65, 255, 0, 0.6);
}

body[data-theme="wopr"] .cell:hover:not(:disabled) {
  background: #001a00;
  border-color: #004400;
  transform: none;
  box-shadow: var(--cell-hover-shadow);
}

body[data-theme="wopr"] .cell:disabled {
  background: #000000;
  border-color: #001100;
  color: #226622;
  text-shadow: none;
  opacity: 0.4;
}

body[data-theme="wopr"] .cell.p1 {
  color: var(--p1);
  text-shadow: 0 0 4px rgba(65, 255, 0, 0.6);
}

body[data-theme="wopr"] .cell.p2 {
  color: var(--p2);
  text-shadow: 0 0 4px rgba(0, 255, 136, 0.6);
}

/* Board panel styled as CRT monitor screen */
body[data-theme="wopr"] .board-panel {
  border-radius: 12px;
  border-width: 8px;
  border-style: solid;
  border-top-color: #f8f8f8;
  border-left-color: #f8f8f8;
  border-right-color: #8b7355;
  border-bottom-color: #8b7355;
  background: #000000;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8), var(--panel-shadow);
  padding: 2rem;
}

/* Other panels keep beige computer case styling */
body[data-theme="wopr"] .info-panel,
body[data-theme="wopr"] .status-bar {
  border-radius: 8px;
  border-width: 2px;
  border-style: solid;
  border-top-color: #f8f8f8;
  border-left-color: #f8f8f8;
  border-right-color: #8b7355;
  border-bottom-color: #8b7355;
  background: linear-gradient(to bottom, #ebe1c8 0%, #e0d0a0 100%);
  box-shadow: var(--panel-shadow);
}

body[data-theme="wopr"] .theme-picker select {
  border-radius: 4px;
  border-width: 1px;
  border-style: solid;
  border-top-color: #8b7355;
  border-left-color: #8b7355;
  border-right-color: #f8f8f8;
  border-bottom-color: #f8f8f8;
  background: linear-gradient(to bottom, #ffffff 0%, #f0e8d0 100%);
  font-family: "VT323", monospace;
}

body[data-theme="wopr"] .overlay-card {
  border-radius: 8px;
  background: linear-gradient(to bottom, #ebe1c8 0%, #e0d0a0 100%);
  border: 2px solid #8b7355;
  box-shadow: 0 8px 32px rgba(139, 115, 85, 0.4);
}

body[data-theme="wopr"] .super-board {
  filter: drop-shadow(0 4px 8px rgba(139, 115, 85, 0.2));
}

/* WOPR startup effect */
@keyframes woprStartup {
  0% {
    opacity: 0;
    transform: scale(0.95);
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

body[data-theme="wopr"] .super-board {
  animation: woprStartup 1.2s ease-out;
}

/* WOPR phosphor glow effect */
@keyframes phosphorBlink {
  0%, 100% {
    text-shadow: 0 0 4px currentColor;
  }
  50% {
    text-shadow: 0 0 8px currentColor, 0 0 12px currentColor;
  }
}

body[data-theme="wopr"] .cell.p1:not(:disabled) {
  animation: phosphorBlink 3s ease-in-out infinite;
}

body[data-theme="wopr"] .cell.p2:not(:disabled) {
  animation: phosphorBlink 3s ease-in-out infinite 1.5s;
}

/* Enhanced terminal-style focus effects */
body[data-theme="wopr"] .btn.accent::after {
  content: "";
  position: absolute;
  inset: -2px;
  background: linear-gradient(45deg, transparent, rgba(255, 191, 0, 0.1), transparent);
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

body[data-theme="wopr"] .btn.accent:hover::after {
  opacity: 1;
}

body[data-theme="sunset"]::before {
  opacity: 0.4;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.35) 0, transparent 45%),
    radial-gradient(circle at 80% 0, rgba(255, 94, 109, 0.4) 0, transparent 40%);
  animation: sunsetGlow 18s ease-in-out infinite alternate;
}

body[data-theme="sunset"] .turn-label {
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

@keyframes neonDrift {
  0% {
    background-position: 0 0, 0 0;
  }
  100% {
    background-position: 400px 200px, -300px 250px;
  }
}

@keyframes starDrift {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: -400px -200px;
  }
}

@keyframes petalFloat {
  0% {
    background-position: 0 0, 0 0, 0 0;
  }
  100% {
    background-position: 200px 400px, -150px 380px, 150px 260px;
  }
}

@keyframes sunsetGlow {
  0% {
    filter: saturate(1);
  }
  100% {
    filter: saturate(1.35);
  }
}

/* Redmond (Windows 95) theme */
body[data-theme="redmond"] .btn {
  border-style: solid;
  border-width: 2px;
  border-top-color: #ffffff;
  border-left-color: #ffffff;
  border-right-color: #808080;
  border-bottom-color: #808080;
  border-radius: 0;
  font-weight: 400;
  letter-spacing: 0.02em;
}

body[data-theme="redmond"] .btn:active {
  border-top-color: #808080;
  border-left-color: #808080;
  border-right-color: #ffffff;
  border-bottom-color: #ffffff;
  transform: none;
}

body[data-theme="redmond"] .btn.accent {
  background: var(--accent);
  border-top-color: #4080ff;
  border-left-color: #4080ff;
  border-right-color: #000040;
  border-bottom-color: #000040;
}

body[data-theme="redmond"] .mini-board {
  border-radius: 0;
  border-style: solid;
  border-width: 2px;
  border-top-color: #ffffff;
  border-left-color: #ffffff;
  border-right-color: #808080;
  border-bottom-color: #808080;
}

body[data-theme="redmond"] .mini-board.active-board {
  border-top-color: var(--active-board-border);
  border-left-color: var(--active-board-border);
  border-right-color: #004040;
  border-bottom-color: #004040;
  border-width: 3px;
}

body[data-theme="redmond"] .cell {
  border-radius: 0;
  border-style: solid;
  border-width: 1px;
  border-top-color: #ffffff;
  border-left-color: #ffffff;
  border-right-color: #808080;
  border-bottom-color: #808080;
  font-family: "Courier New", monospace;
  font-weight: bold;
  text-transform: uppercase;
}

body[data-theme="redmond"] .cell:hover:not(:disabled) {
  border-top-color: #e0e0e0;
  border-left-color: #e0e0e0;
  border-right-color: #606060;
  border-bottom-color: #606060;
  transform: none;
}

body[data-theme="redmond"] .cell:disabled {
  border-top-color: #d0d0d0;
  border-left-color: #d0d0d0;
  border-right-color: #a0a0a0;
  border-bottom-color: #a0a0a0;
}

body[data-theme="redmond"] .info-panel,
body[data-theme="redmond"] .board-panel,
body[data-theme="redmond"] .status-bar {
  border-radius: 0;
  border-style: solid;
  border-width: 2px;
  border-top-color: #ffffff;
  border-left-color: #ffffff;
  border-right-color: #808080;
  border-bottom-color: #808080;
}

body[data-theme="redmond"] .theme-picker select {
  border-radius: 0;
  border-style: solid;
  border-width: 1px;
  border-top-color: #808080;
  border-left-color: #808080;
  border-right-color: #ffffff;
  border-bottom-color: #ffffff;
  appearance: none;
}

/* Cupertino (Mac OS 8-9 Platinum) theme */
body[data-theme="cupertino"]::before {
  opacity: 0.25;
  background-image: var(--bg-pattern);
}

body[data-theme="cupertino"] .btn {
  border-radius: 6px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-width: 1px;
  border-style: solid;
  border-top-color: #f5f5f5;
  border-left-color: #f5f5f5;
  border-right-color: #777777;
  border-bottom-color: #777777;
  background: linear-gradient(to bottom, #f2f0ed 0%, #e3e1dc 100%);
}

body[data-theme="cupertino"] .btn:hover {
  background: linear-gradient(to bottom, #f5f3f0 0%, #e6e4df 100%);
}

body[data-theme="cupertino"] .btn:active {
  border-top-color: #777777;
  border-left-color: #777777;
  border-right-color: #f5f5f5;
  border-bottom-color: #f5f5f5;
  background: linear-gradient(to bottom, #e0ded9 0%, #d1cfc8 100%);
}

body[data-theme="cupertino"] .btn.accent {
  background: linear-gradient(to bottom, #4a9eff 0%, #0066cc 100%);
  border-top-color: #7bb3ff;
  border-left-color: #7bb3ff;
  border-right-color: #003d7a;
  border-bottom-color: #003d7a;
  color: white;
}

body[data-theme="cupertino"] .mini-board {
  border-radius: 8px;
  border-width: 1px;
  border-style: solid;
  border-top-color: #f8f8f8;
  border-left-color: #f8f8f8;
  border-right-color: #999999;
  border-bottom-color: #999999;
  background: linear-gradient(to bottom, #f4f2ee 0%, #eae7e2 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

body[data-theme="cupertino"] .mini-board.active-board {
  border-top-color: #66b3ff;
  border-left-color: #66b3ff;
  border-right-color: #0033aa;
  border-bottom-color: #0033aa;
  border-width: 2px;
  background: linear-gradient(to bottom, #f0f6ff 0%, #e6f1ff 100%);
}

body[data-theme="cupertino"] .cell {
  border-radius: 4px;
  border-width: 1px;
  border-style: solid;
  border-top-color: #ffffff;
  border-left-color: #ffffff;
  border-right-color: #bbbbbb;
  border-bottom-color: #bbbbbb;
  font-family: "Charcoal", "Chicago", "Geneva", sans-serif;
  font-weight: 600;
  background: linear-gradient(to bottom, #fdfcfa 0%, #f7f5f1 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

body[data-theme="cupertino"] .cell:hover:not(:disabled) {
  transform: none;
  background: linear-gradient(to bottom, #ffffff 0%, #faf8f4 100%);
  border-top-color: #e6e6e6;
  border-left-color: #e6e6e6;
  border-right-color: #aaaaaa;
  border-bottom-color: #aaaaaa;
}

body[data-theme="cupertino"] .cell:disabled {
  background: linear-gradient(to bottom, #ebe9e5 0%, #ddd9d5 100%);
  border-top-color: #dddddd;
  border-left-color: #dddddd;
  border-right-color: #999999;
  border-bottom-color: #999999;
}

body[data-theme="cupertino"] .info-panel,
body[data-theme="cupertino"] .board-panel,
body[data-theme="cupertino"] .status-bar {
  border-radius: 6px;
  border-width: 1px;
  border-style: solid;
  border-top-color: #f8f8f8;
  border-left-color: #f8f8f8;
  border-right-color: #999999;
  border-bottom-color: #999999;
  background: linear-gradient(to bottom, #f0ede9 0%, #e6e3de 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

body[data-theme="cupertino"] .theme-picker select {
  border-radius: 4px;
  border-width: 1px;
  border-style: solid;
  border-top-color: #999999;
  border-left-color: #999999;
  border-right-color: #f8f8f8;
  border-bottom-color: #f8f8f8;
  background: linear-gradient(to bottom, #ffffff 0%, #f2f0ed 100%);
}

body[data-theme="cupertino"] .overlay-card {
  border-radius: 8px;
  background: linear-gradient(to bottom, #f0ede9 0%, #e6e3de 100%);
  border: 1px solid #999999;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

body[data-theme="cupertino"] .super-board {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

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

  .board-panel {
    order: 1;
  }

  .info-column {
    order: 2;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 1.5rem 1rem 2.5rem;
  }

  .super-board {
    gap: 0.7rem;
  }

  .mini-board {
    padding: 0.6rem;
    gap: 0.3rem;
  }
}

/* Learn lesson layout */
.learn-lesson {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  padding: 2rem 1rem 4rem;
}

.lesson-shell {
  max-width: 760px;
  margin: 0 auto;
}

.lesson-header {
  margin-bottom: 2rem;
  text-align: left;
}

.lesson-header h1 {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin-bottom: 0.5rem;
}

.lesson-header p {
  color: var(--muted);
  margin: 0.25rem 0 0;
}

.lesson-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--accent);
}

.lesson-back:hover {
  color: var(--accent-strong);
}

.lesson-body {
  background: var(--surface);
  border-radius: 1.25rem;
  box-shadow: var(--panel-shadow);
  padding: clamp(1.5rem, 2vw, 2.5rem);
}

.lesson-article h1,
.lesson-article h2,
.lesson-article h3 {
  font-family: var(--font-heading);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.lesson-article h1:first-child {
  margin-top: 0;
}

.lesson-article p {
  line-height: 1.7;
  margin: 0.75rem 0;
}

.lesson-article ul,
.lesson-article ol {
  margin: 0.5rem 0 1.5rem 1.5rem;
  line-height: 1.7;
}

.lesson-article blockquote {
  border-left: 4px solid var(--accent);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.03);
}

.lesson-footer {
  margin: 2rem auto 0;
  max-width: 760px;
  text-align: left;
}

.lesson-footer a {
  font-weight: 600;
  color: var(--accent);
}

.lesson-footer a:hover {
  color: var(--accent-strong);
}
