/* ============================================
   UNBLOCKED CHESS — SHARED STYLESHEET
   All pages link to this file. Change colors,
   fonts, or layout here and it updates the whole site.
   ============================================ */

:root {
  /* LIGHT (default) — reviewers and most visitors see this */
  --bg: #faf8f4;
  --surface: #ffffff;
  --surface-2: #f3efe8;
  --border: #e2dcd0;
  --text: #1b1814;
  --text-dim: #4a453e;
  --text-mute: #6b665e;
  --accent: #8a6a28;
  --accent-hover: #6e5420;
  --on-accent: #ffffff;
  --header-bg: rgba(250,248,244,0.88);
  --board-light: #f0d9b5;
  --board-dark: #b58863;
  --success: #3f8a4a;
  --danger: #b83a3a;
  --shadow: 0 20px 60px rgba(30,20,10,0.10);
  --shadow-sm: 0 4px 20px rgba(30,20,10,0.06);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --max-w: 1280px;
  --content-w: 760px;
  color-scheme: light;
}

html[data-theme="dark"] {
  /* DARK — the original design, available via the toggle */
  --bg: #0d0d0f;
  --surface: #16161a;
  --surface-2: #1d1d22;
  --border: #2a2a30;
  --text: #efece4;
  --text-dim: #9b9690;
  --text-mute: #858179;
  --accent: #c9a961;
  --accent-hover: #d8b876;
  --on-accent: #14100c;
  --header-bg: rgba(13,13,15,0.85);
  --success: #7fb069;
  --danger: #d05353;
  --shadow: 0 20px 60px rgba(0,0,0,0.4);
  --shadow-sm: 0 4px 20px rgba(0,0,0,0.2);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(201,169,97,0.04), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(201,169,97,0.03), transparent 40%);
  pointer-events: none;
  z-index: 0;
}

main, header, footer { position: relative; z-index: 1; }

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; display: block; }

/* ============================================
   HEADER + NAVIGATION
   ============================================ */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.02em;
}
.logo:hover { color: var(--text); }
.logo-mark {
  color: var(--accent);
  font-size: 28px;
  line-height: 1;
}
.nav-links { display: flex; gap: 28px; list-style: none; align-items: center; }
.nav-links a {
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-cta {
  background: var(--accent);
  color: var(--bg) !important;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
}
.nav-cta:hover { background: var(--accent-hover); color: var(--bg) !important; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

/* ============================================
   GENERIC TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -0.02em; line-height: 1.15; color: var(--text); }
h1 { font-weight: 800; font-size: clamp(36px, 6vw, 60px); margin-bottom: 20px; }
h2 { font-weight: 700; font-size: clamp(26px, 4vw, 36px); margin-bottom: 16px; margin-top: 40px; }
h3 { font-weight: 600; font-size: clamp(20px, 3vw, 24px); margin-bottom: 12px; margin-top: 32px; }
h4 { font-weight: 600; font-size: 18px; margin-bottom: 8px; margin-top: 24px; }

p { margin-bottom: 16px; color: var(--text-dim); }
p strong { color: var(--text); font-weight: 600; }

ul, ol { margin: 0 0 20px 24px; color: var(--text-dim); }
li { margin-bottom: 8px; }

blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 20px;
  margin: 24px 0;
  color: var(--text);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
}

code {
  font-family: var(--font-mono);
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--accent);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* ============================================
   PAGE LAYOUTS
   ============================================ */
.page-hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 56px 24px 32px;
  text-align: center;
}
.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 6px 12px;
  border: 1px solid rgba(201,169,97,0.25);
  border-radius: 999px;
  margin-bottom: 24px;
}
.page-hero p.lead {
  font-size: 18px;
  color: var(--text-dim);
  max-width: 640px;
  margin: 0 auto;
}

.content-wrap {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 32px 24px 80px;
}
.content-wrap h2:first-child { margin-top: 0; }

/* ============================================
   BREADCRUMBS
   ============================================ */
.breadcrumbs {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 24px 24px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-mute);
  letter-spacing: 0.05em;
}
.breadcrumbs a { color: var(--text-mute); }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs .sep { margin: 0 8px; opacity: 0.5; }

/* ============================================
   CARDS + GRIDS
   ============================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 32px 0;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  transition: border-color 0.2s, transform 0.2s;
  color: var(--text);
  display: block;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); color: var(--text); }
.card .label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 8px;
}
.card .title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.card .desc { font-size: 14px; color: var(--text-dim); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.btn:hover { background: var(--border); color: var(--text); }
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--bg); }

/* ============================================
   AD SLOTS
   ============================================ */

/* ============================================
   FAQ
   ============================================ */
.faq-list { margin-top: 24px; }
.faq-item { border-top: 1px solid var(--border); padding: 24px 0; }
.faq-item:last-child { border-bottom: 1px solid var(--border); }
.faq-q { font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--text); margin-bottom: 10px; letter-spacing: -0.01em; }
.faq-a { color: var(--text-dim); }

/* ============================================
   TABLES
   ============================================ */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}
td { color: var(--text-dim); }
tr:last-child td { border-bottom: none; }

/* ============================================
   CALLOUTS
   ============================================ */
.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 20px 24px;
  margin: 24px 0;
}
.callout h4 { margin-top: 0; color: var(--accent); font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 8px; }
.callout p:last-child { margin-bottom: 0; }

/* ============================================
   PIECE GRID (chess piece movement diagrams)
   ============================================ */
.piece-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 32px 0;
}
.piece-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
}
.piece-glyph { font-size: 72px; line-height: 1; color: var(--accent); margin-bottom: 12px; }
.piece-card h4 { margin: 0 0 8px; }
.piece-card p { font-size: 14px; }

/* ============================================
   AUTHOR BOX
   ============================================ */
.author-info p { margin-bottom: 4px; }
.author-info .contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--accent); }
.contact-form textarea { min-height: 140px; resize: vertical; }

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 48px 24px 32px;
  background: var(--surface);
  margin-top: 80px;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
}
.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin: 0 0 16px;
  font-weight: 600;
}
.footer-col ul { list-style: none; margin: 0; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { color: var(--text-dim); font-size: 14px; }
.footer-col a:hover { color: var(--text); }
.footer-about p { color: var(--text-dim); font-size: 14px; max-width: 320px; }
.footer-bottom {
  max-width: var(--max-w);
  margin: 40px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-mute);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 960px) {
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 32px; }
}
@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-toggle { display: block; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    gap: 16px;
  }
  .page-hero { padding: 40px 20px 24px; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: 8px; }
}

/* Selection */
::selection { background: var(--accent); color: var(--bg); }

/* =============================================
   Dropdown Navigation
   ============================================= */
.nav-links li.has-dropdown { position: relative; }
.nav-links li.has-dropdown > a { display: inline-flex; align-items: center; gap: 4px; }
.nav-links li.has-dropdown > a::after {
  content: '';
  display: inline-block;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  opacity: 0.5;
  margin-left: 4px;
  transition: transform 0.2s;
}
.nav-links li.has-dropdown:hover > a::after { transform: rotate(180deg); }

.nav-dropdown {
  list-style: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 0;
  min-width: 240px;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.18s, visibility 0.18s, transform 0.18s;
  z-index: 200;
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
}
.nav-links li.has-dropdown:hover .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.nav-dropdown li { display: block; }
.nav-dropdown a {
  display: block;
  padding: 8px 18px;
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
  border-radius: 0;
  text-decoration: none;
}
.nav-dropdown a:hover { background: var(--bg); color: var(--accent); }
.nav-dropdown a strong { color: var(--accent); }
.nav-dropdown .group-label {
  display: block;
  padding: 10px 18px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  font-weight: 600;
  font-family: var(--font-mono);
}
.nav-dropdown .divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
  padding: 0;
}

/* Wide dropdown for openings (two-column friendly) */
.nav-dropdown.wide { min-width: 260px; }

/* Mobile dropdown behavior */
@media (max-width: 960px) {
  .nav-links li.has-dropdown > a::after { margin-left: auto; }
  .nav-dropdown {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 0 0 0 16px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    min-width: 0;
    margin-top: 0;
  }
  .nav-links li.has-dropdown.mobile-open > .nav-dropdown {
    max-height: 1200px;
    padding: 8px 0 8px 16px;
  }
  .nav-links li.has-dropdown.mobile-open > a::after { transform: rotate(180deg); }
  .nav-dropdown a { padding: 8px 0; font-size: 14px; }
  .nav-dropdown .group-label { padding: 8px 0 4px; }
  .nav-dropdown .divider { display: none; }
}

/* ============================================
   Dropdown navigation
   ============================================ */
.has-dropdown { position: relative; }
.has-dropdown > a .caret { display: inline-block; margin-left: 4px; font-size: 10px; opacity: 0.7; transition: transform 0.2s; }
.has-dropdown:hover > a .caret { transform: rotate(180deg); }

.dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 0;
  min-width: 220px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 100;
  display: none;
  list-style: none;
  margin: 0;
}

.has-dropdown:hover .dropdown,
.has-dropdown:focus-within .dropdown { display: block; }

.dropdown li { display: block; margin: 0; padding: 0; }

.dropdown a {
  display: block;
  padding: 8px 16px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.dropdown a:hover {
  background: var(--bg);
  color: var(--accent);
}

.dropdown .dropdown-section {
  padding: 10px 16px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  font-family: var(--font-mono);
  font-weight: 600;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.dropdown .dropdown-section:first-child { border-top: none; margin-top: 0; }

@media (max-width: 960px) {
  .dropdown {
    position: static;
    display: block;
    box-shadow: none;
    border: none;
    border-radius: 0;
    padding: 4px 0 12px;
    background: transparent;
    min-width: 0;
  }
  .has-dropdown > a .caret { display: none; }
  .has-dropdown > a { font-weight: 600; pointer-events: auto; }
  .dropdown a { padding: 6px 24px; font-size: 14px; }
  .dropdown .dropdown-section { padding: 10px 24px 4px; border-top: 1px solid var(--border); }
}

/* ============================================
   Interactive puzzle board
   ============================================ */
.ucp {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  margin: 28px 0 36px;
}
.ucp-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.ucp-count { color: var(--text-mute); }
.ucp-goal  { color: var(--accent); font-weight: 600; }

.ucp-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  border: 2px solid #3a2f24;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.ucp-sq {
  all: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  font-size: clamp(20px, 6.4vw, 34px);
  line-height: 1;
  cursor: pointer;
  position: relative;
  transition: box-shadow .12s ease;
  user-select: none;
}
.ucp-sq.lt { background: #d9cbb0; }
.ucp-sq.dk { background: #6b5a45; }
.ucp-sq.wp { color: #fbf8f2; text-shadow: 0 1px 0 #6b5a45, 0 0 3px rgba(0,0,0,.55); }
.ucp-sq.bp { color: #14100c; text-shadow: 0 1px 0 rgba(255,255,255,.22); }
.ucp-sq.sel  { box-shadow: inset 0 0 0 3px var(--accent); }
.ucp-sq.last { box-shadow: inset 0 0 0 3px rgba(201,169,97,.45); }
.ucp-sq.target::after {
  content: "";
  position: absolute;
  width: 26%;
  height: 26%;
  border-radius: 50%;
  background: rgba(20,16,12,.34);
}
.ucp-sq:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.ucp-sq:disabled { cursor: default; }

.ucp-status {
  margin: 14px 0 0;
  min-height: 1.4em;
  font-size: 15px;
  color: var(--text-dim);
}
.ucp-status.good { color: #7fc98a; }
.ucp-status.bad  { color: #e08a7a; }
.ucp-status.warn { color: var(--accent); }

.ucp-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.ucp-btn {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 9px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.ucp-btn:hover { border-color: var(--accent); color: var(--accent); }
.ucp-btn.ucp-primary { border-color: var(--accent); color: var(--accent); }
.ucp-btn.ucp-primary:hover { background: var(--accent); color: var(--on-accent); }

.ucp-line {
  margin: 12px 0 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  opacity: 0;
  transition: opacity .2s;
}
.ucp-line.show { opacity: 1; }

.ucp-solved .ucp-board { box-shadow: 0 0 0 3px var(--accent), 0 10px 30px rgba(0,0,0,.45); }

@keyframes ucpShake {
  0%,100% { transform: translateX(0); }
  25%     { transform: translateX(-5px); }
  75%     { transform: translateX(5px); }
}
.ucp-board.shake { animation: ucpShake .28s ease; }

@media (prefers-reduced-motion: reduce) {
  .ucp-board.shake { animation: none; }
  .ucp-sq, .ucp-line, .ucp-btn { transition: none; }
}

/* ============================================
   Board diagrams
   ============================================ */
.chess-figure {
  margin: 0 0 32px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
}
.chess-diagram {
  width: 100%;
  max-width: 340px;
  height: auto;
  display: block;
  margin: 0 auto;
}
.chess-figure .diagram-moves {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  margin: 14px 0 4px;
}
.chess-figure figcaption {
  font-size: 14px;
  color: var(--text-mute);
  margin-top: 6px;
}

/* ============================================
   Page notes (replaces the uniform author box)
   ============================================ */
.page-note {
  margin: 48px 0 0;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.page-note h3 {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 600;
}
.page-note p {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.65;
}
.page-note p:last-child { margin-bottom: 0; }
.page-note__meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-mute);
}
.page-note--check { border-left: 3px solid var(--accent); }
.page-note--check h3 { color: var(--accent); }
.page-note--byline { border-left: 3px solid var(--border); }

/* ============================================
   Main game board (self-hosted, no sprites)
   ============================================ */
.ucb { width: 100%; }
.ucb-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 2px solid #3a2f24;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
  touch-action: manipulation;
}
.ucb-grid.dragging { cursor: grabbing; }
.ucb-sq {
  all: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  font-size: clamp(22px, 7vw, 40px);
  line-height: 1;
  cursor: pointer;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}
.ucb-sq.lt { background: #d9cbb0; }
.ucb-sq.dk { background: #6b5a45; }
.ucb-sq.wp { color: #fbf8f2; text-shadow: 0 1px 0 #6b5a45, 0 0 3px rgba(0,0,0,.55); }
.ucb-sq.bp { color: #14100c; text-shadow: 0 1px 0 rgba(255,255,255,.22); }
.ucb-sq.sel  { box-shadow: inset 0 0 0 3px var(--accent); }
.ucb-sq.last { box-shadow: inset 0 0 0 3px rgba(201,169,97,.45); }
.ucb-sq.target::after {
  content: ""; position: absolute; width: 26%; height: 26%;
  border-radius: 50%; background: rgba(20,16,12,.32);
}
.ucb-sq.capture { box-shadow: inset 0 0 0 4px rgba(224,138,122,.75); }
.ucb-sq:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

/* ============================================
   Cookie consent banner
   ============================================ */
.uc-consent {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 9999;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 30px rgba(0,0,0,.45);
  transform: translateY(110%);
  transition: transform .22s ease;
}
.uc-consent.show { transform: translateY(0); }
.uc-consent__inner {
  max-width: 1024px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}
.uc-consent__text { flex: 1 1 340px; }
.uc-consent__text strong {
  display: block;
  font-family: var(--font-display);
  font-size: 16px;
  margin-bottom: 4px;
  color: var(--text);
}
.uc-consent__text p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-dim);
}
.uc-consent__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.uc-btn {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 10px 16px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
}
.uc-btn:hover { border-color: var(--accent); color: var(--accent); }
.uc-btn--primary { border-color: var(--accent); color: var(--accent); }
.uc-btn--primary:hover { background: var(--accent); color: var(--on-accent); }
@media (prefers-reduced-motion: reduce) { .uc-consent { transition: none; } }
.ucp-solved { color: var(--text-mute); }
.ucp-solved.done { color: var(--accent); font-weight: 600; }
.ucp-btn.ucp-reset { margin-left: auto; opacity: .65; }
.ucp-btn.ucp-reset:hover { opacity: 1; }
.page-note__byline { font-size: 14px; color: var(--text); }
.page-note__byline a { color: var(--accent); }

/* ============================================
   Language switcher
   ============================================ */
.lang-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.lang-bar__inner {
  max-width: 1024px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.lang-bar__icon { color: var(--accent); font-size: 11px; margin-right: 4px; }
.lang-pill {
  font-size: 13px;
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
  transition: border-color .15s, color .15s;
}
.lang-pill:hover { border-color: var(--accent); color: var(--accent); }
.lang-pill.active {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
@media (max-width: 640px) {
  .lang-bar__inner { padding: 8px 16px; gap: 6px; }
  .lang-pill { font-size: 12px; padding: 4px 10px; }
}

/* ============================================
   Page hero images
   ============================================ */
.page-hero-img {
  margin: 0 0 32px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  line-height: 0;
  background: var(--surface);
}
.page-hero-img img {
  width: 100%;
  height: auto;
  display: block;
}
.content-wrap > .page-hero-img,
.container > .page-hero-img { margin-top: 8px; }
@media (max-width: 640px) {
  .page-hero-img { border-radius: 8px; margin-bottom: 22px; }
}

/* Skip link — visible only when focused by keyboard */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  background: var(--accent);
  color: var(--on-accent);
  padding: 10px 18px;
  border-radius: 0 0 8px 0;
  font-family: var(--font-mono);
  font-size: 13px;
  text-decoration: none;
}
.skip-link:focus { left: 0; }
main:focus { outline: none; }


/* ============================================
   GAME BOARD (moved from index.html inline style)
   so the translated homepages get it too
   ============================================ */
/* Homepage-specific styles for the chess game */
.hero-game { max-width: var(--max-w); margin: 0 auto; padding: 56px 24px 32px; text-align: center; }
.hero-game h1 { max-width: 880px; margin-left: auto; margin-right: auto; }
.hero-game h1 em { font-style: italic; color: var(--accent); font-weight: 400; }
.hero-game .lead { font-size: 18px; color: var(--text-dim); max-width: 640px; margin: 0 auto; line-height: 1.55; }

.game-section { max-width: var(--max-w); margin: 0 auto; padding: 32px 24px 80px; }
.game-board-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
.board-stage { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 28px; box-shadow: var(--shadow); }
.board-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-mute); }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 4px; background: var(--surface-2); color: var(--text); font-weight: 600; }
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-pill.danger .dot { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.status-pill.danger { color: var(--danger); }

#board { width: 100%; max-width: 560px; margin: 0 auto; }

.control-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.panel-section h3 { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--text-mute); margin: 0 0 12px; font-weight: 600; }
.mode-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--bg); padding: 4px; border-radius: 8px; border: 1px solid var(--border); }
.mode-toggle button { background: transparent; border: none; padding: 10px 8px; color: var(--text-dim); font-family: var(--font-body); font-size: 13px; font-weight: 500; border-radius: 6px; cursor: pointer; transition: all 0.2s; }
.mode-toggle button.active { background: var(--surface-2); color: var(--text); }

.difficulty-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.difficulty-row label { font-size: 14px; color: var(--text-dim); }
.difficulty-row select { background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 6px; font-family: var(--font-body); font-size: 13px; cursor: pointer; min-width: 120px; }

.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.panel-section .btn { padding: 10px 14px; font-size: 13px; }

.move-history { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 12px; height: 180px; overflow-y: auto; font-family: var(--font-mono); font-size: 13px; }
.move-history:empty::before { content: 'No moves yet — make your first move to begin.'; color: var(--text-mute); font-size: 12px; }
.move-row { display: grid; grid-template-columns: 32px 1fr 1fr; gap: 8px; padding: 3px 0; color: var(--text); }
.move-row .num { color: var(--text-mute); }

.features { max-width: var(--max-w); margin: 0 auto; padding: 24px 24px 60px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 24px; }
.feature-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: rgba(201,169,97,0.1); color: var(--accent); border-radius: 8px; font-size: 18px; margin-bottom: 16px; }
.feature h3 { font-family: var(--font-display); font-size: 19px; font-weight: 600; margin: 0 0 6px; letter-spacing: -0.01em; }
.feature p { color: var(--text-dim); font-size: 14px; line-height: 1.55; margin: 0; }

.content-block { max-width: 800px; margin: 0 auto; padding: 0 24px 60px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 32px; }

@media (max-width: 960px) {
  .game-board-grid { grid-template-columns: 1fr; }
  .control-panel { order: 2; }
  .features { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .board-stage, .control-panel { padding: 18px; }
}

/* ============================================
   Legacy template (9 tactic/reference pages)
   These use .hero / .content / .container / .faq
   rather than .page-hero / .content-wrap.
   Without these rules they render edge-to-edge.
   ============================================ */
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px;
}
section.hero {
  padding: 48px 0 24px;
}
section.hero .container { text-align: center; }
section.content {
  padding: 0 0 48px;
}
.keyfact-answers { margin-bottom: 8px; }

/* details/summary FAQ used on those pages */
.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 10px;
}
.faq details[open] { border-color: var(--accent); }
.faq summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  float: right;
  color: var(--accent);
  font-family: var(--font-mono);
}
.faq details[open] summary::after { content: "\2212"; }
.faq details p {
  margin: 12px 0 0;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.65;
}
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  section.hero { padding: 32px 0 18px; }
}

/* Callout box label — was an <h4>, now a paragraph so it stays out of the
   heading outline. Visual appearance is unchanged. */
.callout-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.35;
}
/* Control-panel heading — promoted from h3 to h2 for heading order,
   styled to look exactly as it did before. */
.panel-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 600;
  margin: 0 0 10px;
}

/* Promoted from h3/h4 for correct heading order — appearance unchanged */
.mistake-title {
  color: var(--accent);
  font-family: var(--font-display);
  margin-top: 0;
  font-size: 22px;
}
.piece-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  margin: 6px 0 4px;
  color: var(--text);
}


/* ============================================
   Theme toggle
   ============================================ */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 999px;
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; line-height: 1;
  margin-left: 10px; flex-shrink: 0;
  transition: border-color .15s, color .15s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle .ico-sun { display: none; }
html[data-theme="dark"] .theme-toggle .ico-sun { display: inline; }
html[data-theme="dark"] .theme-toggle .ico-moon { display: none; }
/* keep the toggle visible on mobile even when nav-links collapse */
@media (max-width: 640px) {
  .theme-toggle { margin-left: 8px; order: 3; }
  .nav-toggle { order: 2; }
}

/* ============================================
   More-games page — external site cards
   ============================================ */
.xsite-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  margin: 28px 0;
}
.xsite-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  transition: border-color .15s;
}
.xsite-card:hover { border-color: var(--accent); }
.xsite-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 12px;
}
.xsite-name {
  font-size: 19px;
  margin: 0 0 8px;
  line-height: 1.35;
}
.xsite-name a { color: var(--text); text-decoration: none; }
.xsite-name a:hover { color: var(--accent); text-decoration: underline; }
.xsite-card p { margin: 0; color: var(--text-dim); font-size: 14.5px; line-height: 1.6; }
