/* =====================================================================
   BJJ Connections — Design System
   Sections: reset & tokens / typography / layout / navigation / hero /
   cards & sections / buttons & controls / forms / tables / footer /
   puzzle game / technique explorer / checklists / training / utilities /
   focus & a11y / dark mode / responsive / reduced-motion
   ===================================================================== */

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

:root {
  /* Core palette — black/white foundation with combat-sports feel */
  --black: #0a0a0a;
  --white: #ffffff;
  --ink: #1a1a1a;
  --bg: #f5f5f3;
  --bg-alt: #ececea;
  --surface: #ffffff;
  --muted: #6b6b6b;
  --muted-light: #999;
  --border: #ddd;
  --border-strong: #bbb;
  --accent: #c8102e;
  --accent-hover: #a50d26;
  --accent-soft: #fce8eb;

  /* Puzzle group colors (preserved from original) */
  --green: #d7ead2;
  --yellow: #f5e6a9;
  --blue: #cfe1ef;
  --purple: #ded4e8;
  --danger: #c0392b;

  /* Belt colors */
  --belt-white: #f8f8f8;
  --belt-blue: #2563eb;
  --belt-purple: #7c3aed;
  --belt-brown: #8b5e3c;
  --belt-black: #1a1a1a;

  /* Typography */
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: var(--font-body);
  --max-width: 1100px;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow: 0 2px 8px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.12);
  --transition: 180ms cubic-bezier(.16,1,.3,1);
}

/* ---- Base ---- */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; }
h1 { font-size: clamp(28px, 5vw, 44px); }
h2 { font-size: clamp(22px, 3.5vw, 30px); }
h3 { font-size: clamp(18px, 2.5vw, 22px); }
p { margin-bottom: 1em; }
ul { list-style: none; }

/* ---- Layout ---- */
.container {
  width: min(var(--max-width), 92%);
  margin-inline: auto;
}
.section { padding: 48px 0; }
.section-alt { background: var(--bg-alt); }
.section-tight { padding: 32px 0; }

/* ---- Skip link ---- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--black);
  color: var(--white);
  padding: 12px 20px;
  z-index: 1000;
  font-weight: 700;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---- Navigation ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--black);
  color: var(--white);
  border-bottom: 3px solid var(--accent);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--white);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.nav-logo:hover { color: var(--white); }
.nav-logo { min-width:44px; min-height:44px; justify-content:center; }
.nav-logo img { width: 44px; height: 44px; }
.nav-logo .logo-text { white-space: nowrap; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
}
.nav-links a {
  color: rgba(255,255,255,.8);
  font-weight: 700;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.nav-links a:hover, .nav-links a.active {
  color: var(--white);
  background: rgba(255,255,255,.12);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--white);
  cursor: pointer;
  padding: 8px;
  font-size: 24px;
  line-height: 1;
}

/* ---- Hero ---- */
.hero {
  background: var(--black);
  color: var(--white);
  padding: 64px 0 56px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent);
}
.hero-eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.hero h1 { color: var(--white); margin-bottom: 16px; }
.hero p { color: rgba(255,255,255,.75); font-size: 18px; max-width: 620px; margin-bottom: 28px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---- Page header (non-home pages) ---- */
.page-header {
  background: var(--black);
  color: var(--white);
  padding: 48px 0 40px;
  border-bottom: 4px solid var(--accent);
}
.page-header h1 { color: var(--white); margin-bottom: 8px; }
.page-header p { color: rgba(255,255,255,.7); font-size: 17px; max-width: 620px; }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover { box-shadow: var(--shadow); }
.card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--black);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
  font-weight: 800;
}
.card h3 { margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 15px; margin-bottom: 0; }
.card-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: 14px;
  margin-top: 16px;
}

/* Grid */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

/* ---- Feature list ---- */
.feature-list { display: flex; flex-direction: column; gap: 12px; }
.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 15px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
}
.feature-list li::before {
  content: "✓";
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 15px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); color: var(--white); border-color: var(--accent-hover); }
.btn-secondary {
  background: transparent;
  color: var(--white);
  border-color: rgba(255,255,255,.3);
}
.btn-secondary:hover { background: rgba(255,255,255,.1); color: var(--white); border-color: rgba(255,255,255,.5); }
.btn-dark { background: var(--black); color: var(--white); border-color: var(--black); }
.btn-dark:hover { background: #2a2a2a; color: var(--white); }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--bg-alt); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-alt); color: var(--ink); }
.btn-sm { padding: 8px 16px; font-size: 14px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---- Forms ---- */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.search-input {
  flex: 1;
  min-width: 200px;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 16px;
  background: var(--surface);
  color: var(--ink);
  transition: border-color var(--transition);
}
.search-input:focus { outline: none; border-color: var(--accent); }

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.chip {
  padding: 8px 14px;
  border: 2px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--ink);
}
.chip:hover { border-color: var(--border-strong); }
.chip.active { background: var(--black); color: var(--white); border-color: var(--black); }

/* ---- Tables ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  text-align: left;
  padding: 12px 16px;
  background: var(--black);
  color: var(--white);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.data-table tr:hover td { background: var(--bg-alt); }

/* ---- Footer ---- */
.site-footer {
  background: var(--black);
  color: rgba(255,255,255,.7);
  padding: 40px 0 24px;
  margin-top: auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}
.footer-brand { font-weight: 800; font-size: 16px; color: var(--white); margin-bottom: 8px; }
.footer-links a {
  display: block;
  color: rgba(255,255,255,.6);
  font-size: 14px;
  padding: 4px 0;
}
.footer-links a:hover { color: var(--white); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: 20px;
  font-size: 13px;
  color: rgba(255,255,255,.5);
}

/* =====================================================================
   PUZZLE GAME (preserved + improved from original)
   ===================================================================== */
.puzzle-wrap { width: min(760px, 94vw); margin: 0 auto; padding: 24px 0 48px; }

.puzzle-header { text-align: center; margin-bottom: 20px; }
.puzzle-eyebrow { font-size: 12px; font-weight: 800; letter-spacing: 1.2px; color: var(--muted); text-transform: uppercase; }
.puzzle-title { font-size: clamp(26px, 5vw, 38px); margin: 4px 0; }
.puzzle-creator { font-size: 12px; font-weight: 700; color: var(--muted); }
.puzzle-sub { color: var(--muted); margin: 10px auto 8px; max-width: 560px; font-size: 15px; }

.puzzle-tabs, .puzzle-buttons { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.puzzle-tabs { margin: 16px 0; }
.tab, .ctrl {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  border-radius: 22px;
  padding: 10px 16px;
  font-family: var(--font-body);
  font-weight: 800;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 14px;
}
.tab:hover, .ctrl:hover { border-color: var(--ink); }
.tab.active, #submit:not(:disabled) { background: var(--black); color: var(--white); border-color: var(--black); }
#submit:disabled { opacity: .5; cursor: default; }
.ctrl:disabled { opacity: .5; cursor: default; }

.puzzle-status { display: flex; justify-content: space-between; gap: 10px; font-weight: 800; margin: 14px 0 10px; font-size: 15px; }
.puzzle-meta { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 12px; }

/* Puzzle grid & tiles */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.word {
  min-height: 84px;
  border: 0;
  border-radius: 9px;
  background: var(--bg-alt);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 800;
  font-size: clamp(10px, 2.6vw, 14px);
  padding: 8px 6px;
  cursor: pointer;
  line-height: 1.15;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  transition: filter var(--transition), transform var(--transition);
}
.word:hover { filter: brightness(.95); }
.word.sel { background: var(--black); color: var(--white); }
.word:disabled { cursor: default; }

/* Solved groups */
.solved { color: #111; padding: 13px 15px; border-radius: 9px; margin-bottom: 8px; text-align: center; font-size: 14px; font-weight: 700; }
.solved:nth-child(4n+1) { background: var(--green); }
.solved:nth-child(4n+2) { background: var(--yellow); }
.solved:nth-child(4n+3) { background: var(--blue); }
.solved:nth-child(4n) { background: var(--purple); }
.solved b { display: block; margin-bottom: 4px; }
.solved-0 { background: var(--green) !important; }
.solved-1 { background: var(--yellow) !important; }
.solved-2 { background: var(--blue) !important; }
.solved-3 { background: var(--purple) !important; }
.result-summary {
  display: flex;
  justify-content: center;
  gap: 8px 18px;
  flex-wrap: wrap;
  margin: 16px 0 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}
.result-summary span { color: var(--muted); }
.share-copy-fallback {
  position: fixed;
  inset: auto 16px 16px;
  z-index: 1000;
  min-height: 150px;
  padding: 12px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
}
.share-copy-close {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1001;
}

#msg { text-align: center; min-height: 26px; font-weight: 800; margin: 14px; }

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 16px 0;
}
.panel h2 { margin: 0 0 10px; font-size: 18px; }
.panel p { font-size: 15px; line-height: 1.5; }

.learn { font-size: 14px; line-height: 1.45; }
.learn p { margin: 0 0 10px; }
.learn b { display: block; margin-bottom: 2px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.stat { background: var(--bg-alt); border-radius: 8px; padding: 14px 10px; font-size: 12px; }
.stat b { display: block; font-size: 22px; margin-bottom: 2px; }

.difficulty-bar { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 10px 0; }
.difficulty-bar button {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  border-radius: 18px;
  padding: 7px 12px;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-body);
  transition: all var(--transition);
}
.difficulty-bar button:hover { border-color: var(--ink); }
.difficulty-bar button.active { background: var(--black); color: var(--white); border-color: var(--black); }

/* Archive */
.archiveNote { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.archiveList { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.archiveItem {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: 9px;
  padding: 12px 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  transition: border-color var(--transition);
}
.archiveItem:hover { border-color: var(--border-strong); }
.archiveDate { font-size: 14px; }
.archiveTag { font-size: 12px; color: var(--muted); font-weight: 700; }

/* Belt badge */
.belt-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.belt-badge::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.2);
}
.belt-white { background: var(--belt-white); color: var(--ink); border: 1px solid var(--border-strong); }
.belt-white::before { background: var(--belt-white); }
.belt-blue { background: #dbeafe; color: #1e40af; }
.belt-blue::before { background: var(--belt-blue); }
.belt-purple { background: #ede9fe; color: #5b21b6; }
.belt-purple::before { background: var(--belt-purple); }
.belt-brown { background: #ede0d4; color: #6b3410; }
.belt-brown::before { background: var(--belt-brown); }
.belt-black { background: var(--ink); color: var(--white); }
.belt-black::before { background: var(--belt-black); border-color: rgba(255,255,255,.3); }

/* =====================================================================
   TECHNIQUE EXPLORER
   ===================================================================== */
.tech-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.tech-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  border-left: 3px solid var(--accent);
  transition: box-shadow var(--transition);
}
.tech-card:hover { box-shadow: var(--shadow); }
.tech-card h3 { font-size: 17px; margin-bottom: 6px; }
.tech-card .tech-category { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.tech-card .tech-desc { font-size: 14px; color: var(--muted); line-height: 1.5; margin: 0; }
.tech-card .belt-badge { margin-top: 12px; }
.no-results { text-align: center; padding: 48px 20px; color: var(--muted); font-size: 16px; }

/* =====================================================================
   CHECKLISTS (Competition & Training)
   ===================================================================== */
.checklist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.checklist-item:hover { background: var(--bg-alt); }
.checklist-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}
.checklist-item label { cursor: pointer; font-size: 15px; line-height: 1.5; }
.checklist-item.checked { opacity: .55; }
.checklist-item.checked label { text-decoration: line-through; }
.checklist-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  font-weight: 700;
  font-size: 14px;
}
.checklist-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-alt);
  border-radius: 4px;
  overflow: hidden;
}
.checklist-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width var(--transition);
}

/* ---- Info callout ---- */
.callout {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 20px 0;
  font-size: 14px;
}
.callout strong { color: var(--accent-hover); }
.callout-info {
  background: #eef4fc;
  border-left-color: #2563eb;
}
.callout-info strong { color: #1e40af; }
.callout-warn {
  background: #fef9e7;
  border-left-color: #d4a017;
}
.callout-warn strong { color: #92710c; }

/* ---- About page ---- */
.about-hero { text-align: center; padding: 20px 0; }
.about-hero .belt-icon { font-size: 48px; margin-bottom: 16px; }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 32px 0; }
.about-stat { text-align: center; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.about-stat .num { font-size: 32px; font-weight: 800; color: var(--accent); }
.about-stat .label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

/* ---- Resources / Glossary ---- */
.glossary { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.glossary-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
}
.glossary-item dt { color: var(--accent); font-weight: 800; font-size: 15px; margin-bottom: 4px; }
.glossary-item dd { font-size: 14px; color: var(--muted); margin: 0; }

/* ---- Link cards (resources) ---- */
.link-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.link-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.link-card .link-icon { font-size: 24px; flex-shrink: 0; }
.link-card .link-info { flex: 1; }
.link-card .link-info h3 { font-size: 16px; margin-bottom: 2px; }
.link-card .link-info p { font-size: 13px; color: var(--muted); margin: 0; }
.link-card .link-arrow { color: var(--muted); flex-shrink: 0; }

/* ---- Training drills ---- */
.drill-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.drill-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  border-left: 3px solid var(--black);
}
.drill-item h3 { font-size: 16px; margin-bottom: 4px; }
.drill-item .drill-meta { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.drill-item p { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.5; }

/* ---- Utilities ---- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.section-title { margin-bottom: 8px; }
.section-sub { color: var(--muted); margin-bottom: 28px; font-size: 17px; }

/* ---- Focus visibility ---- */
a:focus-visible, button:focus-visible, input:focus-visible,
.chip:focus-visible, .tab:focus-visible, .ctrl:focus-visible,
.word:focus-visible, .archiveItem:focus-visible,
.difficulty-bar button:focus-visible, .checklist-item:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Dark mode ---- */
:root[data-theme="dark"] {
    --black: #050505;
    --white: #f0f0ee;
    --ink: #e8e8e6;
    --bg: #0e0e0d;
    --bg-alt: #1a1a18;
    --surface: #1a1a18;
    --muted: #9a9a9a;
    --muted-light: #6a6a6a;
    --border: #2e2e2c;
    --border-strong: #444;
    --accent: #ff6b6b;
    --accent-hover: #ff9292;
    --accent-soft: #2a1518;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
    --shadow: 0 2px 8px rgba(0,0,0,.4);
    --shadow-lg: 0 8px 30px rgba(0,0,0,.5);
    --accent-soft: #2a1518;
  }
  :root[data-theme="dark"] .callout { background: var(--accent-soft); }
  :root[data-theme="dark"] .callout-info { background: #14202e; }
  :root[data-theme="dark"] .callout-warn { background: #2a2410; }
  :root[data-theme="dark"] .stat, :root[data-theme="dark"] .word, :root[data-theme="dark"] .archiveItem { background: var(--bg-alt); }
  :root[data-theme="dark"] .word.sel { background: var(--white); color: var(--black); }
  :root[data-theme="dark"] .tab.active, :root[data-theme="dark"] #submit:not(:disabled), :root[data-theme="dark"] .difficulty-bar button.active {
    background: var(--white); color: var(--black); border-color: var(--white);
  }
  :root[data-theme="dark"] .belt-badge.belt-white { background: #2a2a28; color: var(--ink); border-color: var(--border-strong); }
  :root[data-theme="dark"] .belt-badge.belt-blue { background: #1a2a4a; color: #6b9eff; }
  :root[data-theme="dark"] .belt-badge.belt-purple { background: #2a1a4a; color: #b07eff; }
  :root[data-theme="dark"] .belt-badge.belt-brown { background: #3a2a1a; color: #d4a070; }
  :root[data-theme="dark"] .belt-badge.belt-black { background: var(--ink); color: var(--black); }
  :root[data-theme="dark"] .checklist-item:hover { background: var(--bg-alt); }
  :root[data-theme="dark"] .tech-card, :root[data-theme="dark"] .card, :root[data-theme="dark"] .drill-item, :root[data-theme="dark"] .glossary-item, :root[data-theme="dark"] .link-card, :root[data-theme="dark"] .panel, :root[data-theme="dark"] .checklist-item {
    background: var(--surface);
  }
  :root[data-theme="dark"] .search-input { background: var(--surface); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--black);
    padding: 8px;
    gap: 0;
    border-bottom: 3px solid var(--accent);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 14px 16px; width: 100%; border-radius: 0; }
  .nav-links a:hover { background: rgba(255,255,255,.1); }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .about-grid { grid-template-columns: 1fr; }
  .hero { padding: 48px 0 40px; }
  .hero p { font-size: 16px; }
}

@media (max-width: 560px) {
  .section { padding: 32px 0; }
  .grid-cards { grid-template-columns: 1fr; }
  .tech-results { grid-template-columns: 1fr; }
  .drill-list { grid-template-columns: 1fr; }
  .glossary { grid-template-columns: 1fr; }
  .puzzle-wrap { width: min(96vw, 760px); padding-top: 16px; }
  .word { min-height: 78px; padding: 6px 4px; }
  .grid { gap: 6px; }
  .puzzle-status { font-size: 13px; }
  .ctrl, .tab { padding: 10px 12px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .archiveItem { padding: 10px 12px; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; }
  .search-bar { flex-direction: column; }
  .search-input { width: 100%; }
  .data-table { font-size: 13px; }
  .data-table th, .data-table td { padding: 8px 10px; }
}

@media (max-width: 380px) {
  .word { min-height: 68px; font-size: 10px; }
  .grid { gap: 4px; }
  .puzzle-tabs { gap: 4px; }
  .tab { padding: 8px 10px; font-size: 13px; }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
.site-footer {
  width: 100%;
  margin-top: 50px;
  padding: 30px 20px;
  text-align: center;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.footer-title {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
}

.footer-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0;
}
.footer-grid { text-align: left; }

.footer-links a {
  color: inherit;
  text-decoration: none;
  font-size: 14px;
}

.footer-links a:hover {
  text-decoration: underline;
}
.creator-contact {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,.1);
}

.creator-title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,.8);
}

.creator-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.creator-links a {
  color: #e53935;
  text-decoration: none;
}

.creator-links a:hover {
  color: #fff;
  text-decoration: underline;
}

.contact-card {
  scroll-margin-top: 82px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.contact-card h2 { margin-bottom: 8px; }
.contact-card p { color: var(--muted); margin-bottom: 16px; }
.contact-actions { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 560px) {
  .contact-actions .btn { width: 100%; justify-content: center; }
}


/* ---- Game-first homepage ---- */
.game-hero { padding-bottom: 56px; }
.game-hero .hero-lead { max-width: 720px; margin-left: auto; margin-right: auto; }
.hero-game-card {
  max-width: 620px;
  margin: 28px auto 22px;
  padding: 22px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 16px;
  box-shadow: 0 12px 36px rgba(0,0,0,.18);
}
.hero-game-top { display:flex; justify-content:space-between; gap:12px; align-items:center; margin-bottom:14px; flex-wrap:wrap; }
.hero-game-label { font-size:12px; font-weight:900; letter-spacing:1px; }
.hero-game-meta { font-size:12px; color:rgba(255,255,255,.65); }
.hero-mini-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:7px; margin-bottom:16px; }
.hero-mini-grid span { min-height:54px; display:flex; align-items:center; justify-content:center; text-align:center; padding:6px; border-radius:8px; background:rgba(255,255,255,.9); color:#111; font-size:11px; font-weight:900; }
.btn-game { width:100%; justify-content:center; }
.game-feature { display:flex; align-items:center; justify-content:space-between; gap:24px; padding:28px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow-sm); }
.game-feature h2 { margin:4px 0 8px; }
.game-feature p { margin:0; color:var(--muted); max-width:650px; }

/* ---- Technique Explorer upgrades ---- */
.tech-favorite { display:block; margin-top:12px; border:1px solid var(--border); background:transparent; color:var(--muted); border-radius:18px; padding:7px 11px; font:700 12px var(--font-body); cursor:pointer; }
.tech-favorite:hover, .tech-favorite.is-favorite { color:var(--accent); border-color:var(--accent); }
.random-highlight { box-shadow:0 0 0 3px var(--accent), var(--shadow); transform:translateY(-2px); }

/* ---- Game Plan ---- */
.gameplan-grid { display:grid; grid-template-columns:1fr 1fr; gap:20px; }
.gameplan-grid label { display:block; font-size:14px; margin:0 0 6px; }
.gameplan-grid select { width:100%; margin-bottom:14px; }
.gameplan-preview { position:sticky; top:20px; align-self:start; }
.gameplan-eyebrow { font-size:11px; font-weight:900; letter-spacing:1px; color:var(--muted); text-transform:uppercase; margin-bottom:12px; }
.gameplan-step { display:flex; align-items:center; gap:12px; padding:11px 0; border-bottom:1px solid var(--border); }
.gameplan-step:last-of-type { border-bottom:0; }
.gameplan-number { width:28px; height:28px; border-radius:50%; display:flex; align-items:center; justify-content:center; background:var(--black); color:var(--white); font-size:12px; font-weight:900; flex-shrink:0; }
.gameplan-step small { display:block; color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:.4px; }
.gameplan-step strong { display:block; margin-top:2px; }
.gameplan-saved { color:var(--accent); font-size:13px; font-weight:800; margin:14px 0 0; }

@media (max-width: 700px) {
  .game-feature, .gameplan-grid { grid-template-columns:1fr; display:grid; }
  .game-feature { padding:22px; }
  .game-feature .btn { width:100%; }
  .gameplan-preview { position:static; }
}
@media (max-width: 560px) {
  .hero-game-card { padding:14px; }
  .hero-mini-grid { gap:5px; }
  .hero-mini-grid span { min-height:48px; font-size:9px; }
}


/* ---- Interactive daily puzzle on homepage ---- */
.hero-game-card { max-width: 720px; }
.hero-game-date { display:block; margin-top:3px; font-size:13px; font-weight:700; color:rgba(255,255,255,.72); }
.home-focus {
  display:inline-flex;
  margin:0 0 14px;
  padding:5px 10px;
  border-radius:999px;
  background:rgba(255,255,255,.1);
  border:1px solid rgba(255,255,255,.16);
  color:rgba(255,255,255,.78);
  font-size:11px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.6px;
}
.home-mini-grid { margin-bottom:12px; }
.hero-mini-tile {
  min-height:58px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:6px;
  border:0;
  border-radius:8px;
  background:rgba(255,255,255,.94);
  color:#111;
  font-size:11px;
  font-weight:900;
  line-height:1.1;
  cursor:pointer;
  transition:transform var(--transition), background var(--transition), color var(--transition);
}
.hero-mini-tile:hover { transform:translateY(-2px); }
.hero-mini-tile.selected {
  background:var(--accent);
  color:#fff;
  transform:translateY(-2px);
}
.hero-mini-tile:disabled { cursor:default; }
.home-game-status {
  display:flex;
  justify-content:space-between;
  gap:12px;
  min-height:24px;
  margin:8px 0 12px;
  color:rgba(255,255,255,.72);
  font-size:12px;
  font-weight:800;
}
.home-game-controls { display:flex; gap:8px; }
.home-game-btn { flex:1; min-height:42px; }
.home-solved { display:flex; flex-direction:column; gap:6px; margin-top:10px; }
.home-solved-group {
  padding:9px 11px;
  border-radius:8px;
  color:#111;
  font-size:11px;
  text-align:center;
}
.home-solved-group strong { display:block; margin-bottom:2px; }
.home-solved-0 { background:var(--green); }
.home-solved-1 { background:var(--yellow); }
.home-solved-2 { background:var(--blue); }
.home-solved-3 { background:var(--purple); }
.home-game-footer {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-top:14px;
  padding-top:12px;
  border-top:1px solid rgba(255,255,255,.12);
  color:rgba(255,255,255,.58);
  font-size:12px;
  font-weight:700;
}
.home-game-footer a { color:var(--white); }
@media (max-width:560px) {
  .hero-mini-tile { min-height:58px; font-size:11px; overflow-wrap:anywhere; }
  .home-game-status { font-size:11px; }
}


.nav-install-btn {
  border: 1px solid rgba(255,255,255,.28);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 7px 11px;
  border-radius: 6px;
}
.nav-install-btn:hover {
  background: rgba(255,255,255,.1);
}
.nav-install-btn[hidden] {
  display: none;
}
#homeInstall[hidden] { display: none; }
.install-dialog {
  width: min(440px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 16px;
  background: #171717;
  color: #fff;
  padding: 24px;
  box-shadow: 0 24px 70px rgba(0,0,0,.5);
}
.install-dialog::backdrop { background: rgba(0,0,0,.72); }
.install-dialog h2 { font-size: 23px; line-height: 1.2; margin: 0 0 16px; }
.install-dialog ol { padding-left: 22px; line-height: 1.55; }
.install-dialog li { margin-bottom: 12px; }
.install-dialog p { color: rgba(255,255,255,.72); }
.install-dialog-close { margin-top: 6px; }
@media (max-width: 800px) {
  .nav-install-btn {
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    border: 0;
    border-radius: 0;
  }
}

/* Searchable answers */
.faq-label { display: block; font-weight: 700; margin: 24px 0 8px; }
.faq-search { width: 100%; max-width: 620px; }
.faq-count { color: var(--muted); font-size: 14px; margin: 10px 0 18px; }
.faq-list { display: grid; gap: 20px; max-width: 900px; }
.faq-group { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.faq-topic { font-size: 14px; color: var(--muted); margin: 0; padding: 16px 20px; letter-spacing: .04em; text-transform: uppercase; }
.faq-item { border-top: 1px solid var(--border); }
.faq-item summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; min-height: 56px; font-size: 16px; font-weight: 600; line-height: 1.5; cursor: pointer; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; flex-shrink: 0; font-size: 22px; line-height: 1; color: var(--accent); font-weight: 400; }
.faq-item[open] summary::after { content: "−"; }
.faq-item summary:hover { color: var(--accent); }
.faq-item summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; border-radius: 6px; }
.faq-answer { padding: 0 20px 20px; }
.faq-answer p { margin: 0; max-width: 72ch; line-height: 1.7; }
.faq-item[hidden], .faq-group[hidden], #noQuestionResults[hidden] { display: none; }
@media (max-width: 600px) {
  .faq-topic { padding: 14px 16px; }
  .faq-item summary { padding: 16px; }
  .faq-answer { padding: 0 16px 18px; }
}

/* Persistent theme switch stays fixed across every page. */
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
.theme-toggle { position:fixed; right:calc(18px + env(safe-area-inset-right, 0px)); bottom:calc(18px + env(safe-area-inset-bottom, 0px)); z-index:200; display:grid; place-items:center; width:56px; height:56px; padding:0; border:1px solid var(--border-strong); border-radius:50%; background:var(--surface); color:var(--ink); box-shadow:var(--shadow-lg); cursor:pointer; }
.theme-toggle:hover { background:var(--bg-alt); }
.theme-toggle svg { display:block; width:26px; height:26px; }
.site-footer { padding-bottom:calc(90px + env(safe-area-inset-bottom, 0px)); }
.nav-toggle { margin-left:auto; }
.nav-links { margin-left:12px; }
@media (min-width:769px) and (max-width:1000px) {
  .nav-toggle { display:block; }
  .nav-links { display:none; position:absolute; top:60px; left:0; right:0; flex-direction:column; background:var(--black); padding:8px; gap:0; border-bottom:3px solid var(--accent); }
  .nav-links.open { display:flex; }
  .nav-links a { padding:14px 16px; width:100%; border-radius:0; }
}
@media (max-width:1000px) { .nav-links { margin-left:0; } }

/* Let the game hero and navigation follow the chosen theme too. */
:root[data-theme="light"] .site-header,
:root[data-theme="light"] .site-footer,
:root[data-theme="light"] .hero,
:root[data-theme="light"] .page-header { background:var(--surface); color:var(--ink); }
:root[data-theme="light"] .nav-logo,
:root[data-theme="light"] .nav-toggle,
:root[data-theme="light"] .nav-links a,
:root[data-theme="light"] .hero h1,
:root[data-theme="light"] .page-header h1,
:root[data-theme="light"] .footer-brand,
:root[data-theme="light"] .home-game-footer a { color:var(--ink); }
:root[data-theme="light"] .nav-links a:hover,
:root[data-theme="light"] .nav-links a.active { background:var(--bg-alt); }
:root[data-theme="light"] .hero p,
:root[data-theme="light"] .page-header p,
:root[data-theme="light"] .hero-game-meta,
:root[data-theme="light"] .hero-game-date,
:root[data-theme="light"] .home-focus,
:root[data-theme="light"] .home-game-status,
:root[data-theme="light"] .home-game-footer,
:root[data-theme="light"] .footer-links a,
:root[data-theme="light"] .footer-bottom { color:var(--muted); }
:root[data-theme="light"] .hero-game-card { background:var(--surface); border-color:var(--border); }
:root[data-theme="light"] .home-focus { background:var(--surface); border-color:var(--border-strong); }
:root[data-theme="light"] .home-game-footer,
:root[data-theme="light"] .footer-bottom { border-color:var(--border); }
:root[data-theme="light"] .btn-secondary { color:var(--ink); border-color:var(--border-strong); }
:root[data-theme="light"] .btn-secondary:hover { background:var(--surface); }
:root[data-theme="light"] .theme-toggle { color:var(--ink); border-color:var(--border-strong); }
@media (max-width:1000px) { :root[data-theme="light"] .nav-links { background:var(--surface); } }

/* Daily game controls and optional learning help. */
.home-instructions { color:var(--muted); font-size:14px; margin:0 0 10px; }
.home-hint, .home-learn { color:var(--ink); font-size:13px; margin:0 0 14px; }
.home-hint summary, .home-learn summary { cursor:pointer; font-weight:700; padding:8px 0; }
.home-hint p { margin:4px 0 10px; }
.home-learn { margin:14px 0 0; padding:12px; background:var(--surface); border-radius:8px; }
.home-learn p { margin:12px 0; line-height:1.6; }
.home-game-btn { min-height:44px; padding:10px 8px; }
.hero-mini-tile:focus-visible, .home-hint summary:focus-visible, .home-learn summary:focus-visible { outline:3px solid var(--accent); outline-offset:3px; }
@media (max-width:380px) {
  .home-game-controls { flex-wrap:wrap; }
  #homeSubmit { flex-basis:100%; }
}

/* Clearer game hierarchy, selections, and completed results. */
.game-hero > .container > .hero-eyebrow,
.game-hero > .container > h1 { text-align:center; }
.game-hero .hero-actions { justify-content:center; max-width:720px; margin-inline:auto; }
.hero-mini-grid, .grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
.hero-mini-tile, .word {
  position:relative; min-height:84px; padding:16px 8px;
  border:2px solid transparent; font-size:clamp(12px,2.8vw,16px);
  line-height:1.25; overflow-wrap:anywhere; hyphens:none;
}
.hero-mini-tile.selected, .word.sel {
  border-color:var(--accent); box-shadow:inset 0 0 0 2px currentColor;
}
.hero-mini-tile.selected::after, .word.sel::after {
  content:"✓"; position:absolute; right:6px; top:2px; font-size:12px; line-height:1;
}
.home-solved { margin:0 0 8px; }
.home-solved-group { font-size:14px; padding:16px 12px; line-height:1.5; }
.home-solved-group strong, .solved b { font-size:15px; }
.group-enter { animation:group-arrive 280ms ease-out both; }
@keyframes group-arrive {
  from { opacity:0; transform:translateY(-10px) scale(.98); }
  to { opacity:1; transform:translateY(0) scale(1); }
}
.home-result, .result-summary {
  background:var(--surface); border:1px solid var(--border-strong);
  border-top:4px solid var(--accent); border-radius:14px;
  padding:24px; margin:18px 0; color:var(--ink); text-align:center;
}
.result-summary { display:flex; flex-direction:column; gap:8px; }
.result-summary strong, .home-result h2 { font-size:clamp(22px,4vw,28px); line-height:1.2; }
.result-eyebrow { display:block; color:var(--accent); font-size:11px; font-weight:800; letter-spacing:1.4px; margin-bottom:10px; }
.home-result h2 { margin:0 0 10px; }
.home-result p { color:var(--muted); font-size:14px; margin:0 0 18px; }
.home-result-actions { display:flex; justify-content:center; flex-wrap:wrap; gap:10px; }
.home-result-actions .btn { min-height:44px; }
#share, #next { min-height:46px; padding:12px 22px; border-radius:10px; }
#share { background:var(--accent); color:#fff; border-color:var(--accent); }
.home-copy { width:100%; margin-top:10px; padding:12px; border:1px solid var(--border-strong); border-radius:8px; background:var(--bg); color:var(--ink); }
#homeCopyLabel { display:block; margin-top:16px; font-size:13px; }
.home-game-controls[hidden], .home-result[hidden], .home-copy[hidden], #homeCopyLabel[hidden] { display:none; }
@media (max-width:560px) {
  .hero-mini-tile, .word { min-height:78px; padding:14px 4px; font-size:12px; }
  .home-result, .result-summary { padding:20px 14px; }
  .home-result-actions .btn { flex:1; white-space:nowrap; }
  .home-solved-group { font-size:12px; }
}
@media (prefers-reduced-motion:reduce) {
  .group-enter { animation:none; }
  .hero-mini-tile:hover, .hero-mini-tile.selected { transform:none; }
}

/* A quieter frame for the game and the tools around it. */
body { text-rendering:optimizeLegibility; }
button, a, input, select, summary { -webkit-tap-highlight-color:transparent; }
button, .btn { touch-action:manipulation; }
[id] { scroll-margin-top:88px; }
.footer-description { font-size:14px; color:#b6b6b6; margin:0; max-width:460px; }
:root[data-theme="light"] .footer-description { color:var(--muted); }
.site-footer { border-top:1px solid var(--border); }
.nav-links a { font-size:13px; }
.nav-links a.active { box-shadow:inset 0 -2px var(--accent); }
.page-header { padding:40px 0 32px; border-bottom:1px solid var(--border); }
.page-header h1 { letter-spacing:-.045em; }
.page-header p { margin-bottom:0; }
.hero.game-hero { padding:42px 0; background:var(--bg); color:var(--ink); }
:root[data-theme="light"] .hero.game-hero { background:var(--bg); color:var(--ink); }
.game-hero::after { display:none; }
.game-layout { display:grid; grid-template-columns:minmax(0,.78fr) minmax(0,1.5fr); gap:44px; align-items:center; }
.hero-intro { padding:16px 0; }
.hero-intro .hero-eyebrow { font-size:10px; letter-spacing:1.5px; }
.hero .hero-intro h1 { color:var(--ink); font-size:clamp(36px,4.5vw,58px); line-height:1.02; letter-spacing:-.06em; margin:0 0 22px; }
.title-dot { color:var(--accent); }
.hero .hero-description { color:var(--muted); font-size:17px; line-height:1.65; margin:0; max-width:310px; }
.connection-stripes { display:flex; gap:5px; width:104px; margin:25px 0; }
.connection-stripes i { height:6px; flex:1; border-radius:2px; background:var(--green); }
.connection-stripes i:nth-child(2) { background:var(--yellow); }
.connection-stripes i:nth-child(3) { background:var(--blue); }
.connection-stripes i:nth-child(4) { background:var(--purple); }
.game-shortcuts { display:grid; margin-bottom:22px; }
.game-shortcuts a { display:grid; grid-template-columns:1fr auto; padding:13px 0; border-bottom:1px solid var(--border); color:var(--ink); }
.game-shortcuts span { font-size:15px; font-weight:750; }
.game-shortcuts small { color:var(--muted); font-size:12px; grid-row:2; }
.game-shortcuts b { grid-column:2; grid-row:1 / 3; align-self:center; color:var(--accent); font-size:19px; transition:transform var(--transition); }
.game-shortcuts a:hover b { transform:translate(2px,-2px); }
.game-shortcuts a:hover span { color:var(--accent); }
.game-hero .hero-game-card { width:100%; margin:0; padding:24px; background:var(--surface); border:1px solid var(--border); box-shadow:0 12px 40px #00000009; color:var(--ink); border-radius:20px; }
.game-hero .hero-game-label { color:var(--accent); font-size:10px; letter-spacing:1.5px; }
.game-hero .hero-game-date { font-size:14px; color:var(--ink); }
.game-hero .hero-game-meta { color:var(--muted); font-size:10px; }
.game-hero .home-instructions { color:var(--muted); font-size:13px; line-height:1.6; margin:0 0 3px; }
.game-hero .home-hint { margin-bottom:8px; }
.game-hero .home-hint p { font-size:13px; margin:0 0 10px; color:var(--muted); }
.game-hero .home-game-status, .game-hero .home-game-footer { color:var(--muted); }
.game-hero .home-game-footer { border-color:var(--border); }
.game-hero .home-game-footer a { color:var(--ink); }
.game-hero .hero-mini-tile { background:var(--bg-alt); color:var(--ink); }
.game-hero .hero-mini-tile.selected { background:var(--ink); color:var(--surface); border-color:var(--ink); }
.game-hero .btn-secondary { color:var(--ink); border-color:var(--border-strong); }
.game-hero .btn-secondary:hover { background:var(--bg-alt); }
.hero-mini-tile, .word { min-height:76px; font-size:clamp(12px,1.4vw,15px); transition:background 120ms,color 120ms,border-color 120ms; }
.hero-mini-tile:hover, .hero-mini-tile.selected { transform:none; }
.home-game-status { align-items:flex-start; }
#homeMistakes { flex-shrink:0; }
#homeMessage { text-align:right; }
.tools-section { border-top:1px solid var(--border); padding:48px 0 0; }
.section-heading { display:flex; gap:28px; justify-content:space-between; align-items:end; margin-bottom:26px; }
.section-heading .hero-eyebrow { font-size:10px; }
.section-heading h2 { font-size:clamp(24px,3vw,32px); letter-spacing:-.035em; margin:0; }
.section-heading > p { max-width:290px; color:var(--muted); font-size:14px; margin:0; }
.tool-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; }
.tool-card { display:flex; flex-direction:column; padding:24px 20px; background:var(--surface); border:1px solid var(--border); border-radius:14px; color:var(--ink); transition:border-color var(--transition),box-shadow var(--transition); }
.tool-card:hover { color:var(--ink); border-color:var(--accent); box-shadow:var(--shadow); }
.tool-number { font-size:10px; letter-spacing:1.3px; font-weight:800; color:var(--accent); margin-bottom:32px; }
.tool-card h3 { font-size:21px; line-height:1.2; margin-bottom:12px; }
.tool-card p { color:var(--muted); font-size:14px; line-height:1.65; margin-bottom:24px; }
.tool-card .card-link { margin-top:auto; display:flex; justify-content:space-between; gap:8px; font-size:12px; }
.creator-note { display:flex; justify-content:space-between; align-items:center; gap:20px; margin-top:30px; padding:26px 0; border-top:1px solid var(--border); font-size:13px; }
.creator-note p { margin:0; color:var(--muted); }
.creator-note a { white-space:nowrap; font-weight:700; }
.puzzle-header { display:flex; justify-content:space-between; align-items:center; text-align:left; gap:16px; }
.puzzle-header .puzzle-sub { margin:0; font-size:13px; max-width:470px; }
.puzzle-header .ctrl { flex-shrink:0; }
.puzzle-tabs { padding:5px; background:var(--bg-alt); border-radius:12px; }
.puzzle-tabs .tab { border:0; border-radius:8px; }
.puzzle-tabs .tab.active { box-shadow:var(--shadow-sm); }
.tech-toolbar { border:1px solid var(--border); background:var(--surface); border-radius:16px; padding:22px; margin-bottom:24px; }
.tech-toolbar .search-bar { margin-top:0; }
.tech-results-bar { display:flex; align-items:center; justify-content:space-between; gap:12px; border-top:1px solid var(--border); padding-top:16px; margin-top:16px; color:var(--muted); font-size:13px; }
.tech-results-actions { display:flex; align-items:center; flex-wrap:wrap; gap:12px; }
.text-button { border:0; background:none; color:var(--accent); font:600 13px var(--font-body); min-height:44px; cursor:pointer; }
.tech-card { border-radius:14px; }
.tech-favorite { min-height:40px; }
@media (max-width:1000px) {
  .game-layout { gap:28px; grid-template-columns:minmax(0,.7fr) minmax(0,1.3fr); }
  .hero .hero-intro h1 { font-size:40px; }
  .game-hero .hero-game-card { padding:18px; }
  .tool-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:760px) {
  .hero.game-hero { padding:26px 0 32px; }
  .game-layout { grid-template-columns:1fr; gap:20px; }
  .hero-intro { padding:0; text-align:center; }
  .hero .hero-intro h1 { font-size:36px; margin-bottom:10px; }
  .hero-intro h1 br { display:none; }
  .hero-intro h1 br::after { content:" "; }
  .hero .hero-description { max-width:400px; margin:auto; font-size:14px; }
  .connection-stripes { display:none; }
  .game-shortcuts { grid-template-columns:repeat(3,1fr); gap:8px; margin:18px 0 0; }
  .game-shortcuts a { display:block; border:1px solid var(--border); padding:9px 6px; border-radius:8px; }
  .game-shortcuts small, .game-shortcuts b { display:none; }
  .game-shortcuts span { font-size:13px; }
  #homeInstall { margin-top:14px; }
  .game-hero .hero-game-card { padding:16px; }
  .hero-mini-tile, .word { font-size:12px; min-height:72px; }
  .section-heading { display:block; }
  .section-heading > p { max-width:none; margin-top:12px; }
  .tools-section { padding-top:32px; }
  .creator-note { align-items:flex-start; flex-direction:column; gap:10px; }
  .tech-toolbar { padding:16px; }
}
@media (max-width:440px) {
  .hero .hero-intro h1 { font-size:32px; }
  .game-hero .hero-game-meta { display:none; }
  .tool-grid { grid-template-columns:1fr; }
  .tool-number { margin-bottom:18px; }
  .tool-card { padding:22px; }
  .tech-results-bar { align-items:flex-start; flex-direction:column; gap:8px; }
  .puzzle-header { align-items:flex-start; }
}
@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after { scroll-behavior:auto !important; }
  .game-shortcuts a:hover b { transform:none; }
}

/* Learning, preparation, and personal training tools. */
.section-nav { display:flex; flex-wrap:wrap; gap:8px; padding:22px 0; }
.section-nav a { color:var(--ink); font-size:13px; font-weight:650; background:var(--surface); border:1px solid var(--border); border-radius:999px; padding:9px 15px; }
.section-nav a:hover { border-color:var(--accent); color:var(--accent); }
.tool-dashboard { display:flex; justify-content:space-between; align-items:center; gap:24px; background:var(--surface); border:1px solid var(--border); border-left:4px solid var(--accent); padding:26px; border-radius:16px; }
.tool-dashboard .hero-eyebrow { display:block; font-size:10px; }
.tool-dashboard h2 { font-size:26px; margin-bottom:8px; }
.tool-dashboard p { font-size:14px; color:var(--muted); margin:0; }
.dashboard-actions { display:flex; gap:10px; flex-wrap:wrap; }
.dashboard-actions .btn { min-height:44px; }
.prep-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; align-items:start; }
.prep-panel { padding:24px; border:1px solid var(--border); border-radius:16px; background:var(--surface); }
.prep-panel h2 { font-size:22px; margin:0 0 16px; }
.prep-panel .callout { font-size:13px; padding:14px; }
.prep-panel .checklist-item { border:0; border-bottom:1px solid var(--border); border-radius:0; background:transparent; padding:12px 0; box-shadow:none; }
.prep-panel .checklist-item:last-child { border-bottom:0; }
.prep-panel .checklist-item label { line-height:1.5; cursor:pointer; padding:2px 0; }
.checklist-item[hidden] { display:none; }
.filter-caption { color:var(--muted); font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:1.2px; margin:16px 0 8px; }
.sort-label { display:flex; align-items:center; gap:8px; font-size:12px; }
.sort-label select { padding:8px; border:1px solid var(--border); border-radius:8px; background:var(--surface); color:var(--ink); font:inherit; min-height:40px; }
.tech-card { display:flex; flex-direction:column; padding:24px; border-left:1px solid var(--border); border-top:3px solid var(--accent); }
.tech-card .tech-desc { flex:1; margin-bottom:8px; }
.tech-card .belt-badge, .tech-card .tech-favorite { align-self:flex-start; }
.tech-card h3 { font-size:19px; line-height:1.3; }
.session-fields { display:grid; grid-template-columns:1.2fr 1fr 1fr; gap:14px; margin-bottom:16px; }
.session-fields label, .field-label { display:block; font-size:13px; font-weight:700; color:var(--muted); }
.session-fields .search-input { display:block; width:100%; max-width:none !important; margin-top:6px; }
.field-label { margin-bottom:6px; }
.save-status { font-size:13px; margin:12px 0 0; color:var(--muted); min-height:21px; }
.empty-hint { font-size:14px; padding:20px 0 4px; margin:0; color:var(--muted); }
.empty-hint[hidden] { display:none; }
.session-card { display:flex; justify-content:space-between; gap:16px; padding:22px; border:1px solid var(--border); border-radius:14px; background:var(--surface); }
.session-card > div { min-width:0; }
.session-meta { display:flex; flex-wrap:wrap; gap:8px 16px; align-items:center; }
.session-meta strong { font-size:15px; }
.session-meta span { font-size:12px; color:var(--muted); }
.session-card p { margin:12px 0 0; font-size:14px; overflow-wrap:anywhere; }
.session-notes { color:var(--muted); white-space:pre-wrap; }
.gameplan-preview { top:84px; }
.gameplan-step a { display:block; margin-top:3px; font-weight:700; font-size:16px; }
.about-layout { display:grid; grid-template-columns:300px minmax(0,1fr); gap:64px; align-items:start; }
.creator-profile { position:sticky; top:88px; border:1px solid var(--border); border-radius:20px; padding:32px; background:var(--surface); }
.creator-profile img { margin-bottom:28px; border-radius:20px; }
.creator-profile .hero-eyebrow { display:block; font-size:10px; }
.creator-profile h2 { font-size:28px; margin:0 0 12px; }
.creator-profile p { color:var(--muted); font-size:15px; }
.profile-detail { border-top:1px solid var(--border); padding:20px 0; margin-top:24px; display:flex; justify-content:space-between; align-items:center; gap:12px; }
.profile-detail strong { font-size:25px; }
.profile-detail span { color:var(--muted); font-size:12px; }
.creator-profile .btn { width:100%; }
.about-story > h2 { font-size:34px; letter-spacing:-.04em; margin-bottom:20px; }
.about-story > p { color:var(--muted); font-size:16px; line-height:1.8; }
.about-story .story-lead { font-size:20px; color:var(--ink); line-height:1.7; }
.about-principles { margin-top:32px; }
.about-principles article { position:relative; padding:22px 0 22px 44px; border-top:1px solid var(--border); }
.about-principles span { position:absolute; left:0; top:25px; font-size:11px; color:var(--accent); font-weight:800; }
.about-principles h3 { font-size:20px; margin-bottom:8px; }
.about-principles p { color:var(--muted); font-size:14px; margin:0; }
.local-data-note { background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:24px; margin-top:28px; }
.local-data-note h3 { font-size:18px; margin-bottom:10px; }
.local-data-note p { font-size:14px; color:var(--muted); }
.local-data-note a { font-size:13px; font-weight:700; }
.contact-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:18px; }
.contact-link-card { color:var(--ink); background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:24px; }
.contact-link-card:hover { border-color:var(--accent); }
.contact-link-card .tool-number { display:block; margin-bottom:26px; }
.contact-link-card h3 { font-size:20px; margin-bottom:10px; }
.contact-link-card p { color:var(--muted); font-size:14px; margin:0; overflow-wrap:anywhere; }
.project-footer { display:grid; grid-template-columns:1fr 1fr; gap:60px; align-items:center; }
.project-footer h2 { margin-bottom:14px; }
.project-footer p { color:var(--muted); font-size:14px; }
.project-note { padding:24px; border-left:2px solid var(--border); margin:0; }
@media (max-width:800px) {
  .prep-grid, .about-layout, .project-footer { grid-template-columns:1fr; gap:24px; }
  .tool-dashboard { align-items:flex-start; flex-direction:column; padding:22px; }
  .creator-profile { position:static; }
  .contact-grid { grid-template-columns:1fr; }
  .about-story > h2 { font-size:28px; }
  .about-story .story-lead { font-size:18px; }
  .creator-profile img { width:72px; height:72px; }
  .session-fields { grid-template-columns:1fr; }
  .tech-results { grid-template-columns:repeat(auto-fill,minmax(min(100%,280px),1fr)); }
}
@media print {
  .site-header, .site-footer, .theme-toggle, .section-nav, .dashboard-actions, #resetChecklists { display:none !important; }
  html, body, .page-header, .prep-panel, .tool-dashboard { background:#fff !important; color:#111 !important; }
  .container { width:100%; }
  .section { padding:16px 0; }
  .prep-grid { display:block; }
  .prep-panel { break-inside:avoid; margin-bottom:18px; }
  .checklist-item[hidden] { display:flex !important; }
  .checklist-item, .checklist-item label, .tool-dashboard p { color:#111 !important; }
}

/* Keep practice choices readable and gameplay controls within reach. */
.training-tools { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin:12px 0 18px; padding:14px; border:1px solid var(--border); border-radius:12px; background:var(--bg-alt); }
.training-tools.hidden { display:none; }
.training-tools label { font-weight:800; font-size:13px; }
.training-tools select { min-height:44px; max-width:100%; padding:8px 12px; border:1px solid var(--border-strong); border-radius:8px; background:var(--bg); color:var(--ink); font:inherit; }
#trainingSummary { width:100%; margin:0; font-size:13px; color:var(--muted); }
.grid, .home-mini-grid { grid-auto-rows:1fr; }
.word, .hero-mini-tile { min-width:0; overflow-wrap:anywhere; }
.ctrl, .tab, .difficulty-bar button, .home-game-btn { min-height:44px; }
@media (max-width:640px) {
  .puzzle-buttons, .home-game-controls { position:sticky; bottom:12px; z-index:20; padding:10px; border:1px solid var(--border-strong); border-radius:14px; background:var(--bg); box-shadow:0 6px 24px rgba(0,0,0,.15); margin-top:14px; }
  .puzzle-buttons .ctrl, .home-game-controls .btn { flex:1; padding:10px 6px; min-height:48px; font-size:12px; }
  .puzzle-buttons { bottom:calc(86px + env(safe-area-inset-bottom, 0px)); }
  .home-game-controls { bottom:calc(86px + env(safe-area-inset-bottom, 0px)); }
  .word, .hero-mini-tile { min-height:84px; padding:10px 4px; line-height:1.2; }
  .puzzle-status { position:sticky; top:74px; z-index:10; background:var(--bg); padding:8px 0; }
}
.connection-explanation { margin-top:8px; font-size:12px; font-weight:500; line-height:1.5; text-transform:none; }
.connection-explanation summary { cursor:pointer; font-weight:700; padding:6px 0; }
.connection-explanation p { margin:6px 0 0; }

.practice-section-title { margin:28px 0 12px; font-size:18px; }
.practice-progress-row { display:grid; grid-template-columns:60px minmax(0,1fr) 48px; align-items:center; gap:12px; margin:12px 0; font-size:14px; }
.practice-progress-row progress { width:100%; accent-color:var(--accent); height:12px; }
.practice-history { display:grid; gap:8px; }
.practice-history-item { min-height:48px; text-align:left; padding:14px; border:1px solid var(--border-strong); border-radius:10px; background:var(--bg-alt); color:var(--ink); font:inherit; font-size:14px; line-height:1.5; cursor:pointer; }
.practice-history-item:hover { border-color:var(--accent); }
.practice-history-item:focus-visible { outline:3px solid var(--accent); outline-offset:3px; }

/* Phone visual review: keep the board unobscured and labels intact. */
.site-footer .container { width:100%; max-width:var(--max-width); }
@media (max-width:640px) {
  .puzzle-buttons, .home-game-controls {
    position:relative; bottom:auto; z-index:auto; box-shadow:none;
    padding-right:74px;
  }
  .word, .hero-mini-tile { overflow-wrap:normal; word-break:normal; padding-inline:0; }
  .game-hero .hero-game-card { padding:16px 10px; }
  .home-mini-grid { margin-inline:-8px; }
  .puzzle-status { position:relative; top:auto; z-index:auto; }
  .puzzle-wrap { width:calc(100% - 24px); }
}

/* Training at a glance and a readable timer, including small phones. */
.training-overview { padding-block:32px; }
.training-summary-heading { display:flex; justify-content:space-between; align-items:center; gap:16px; margin-bottom:18px; }
.training-summary-heading .hero-eyebrow { font-size:10px; }
.training-summary-heading h2 { font-size:24px; }
.training-summary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.training-summary > div { padding:20px; border:1px solid var(--border); border-radius:var(--radius-lg); background:var(--surface); }
.training-summary strong { display:block; font-size:clamp(22px,4vw,34px); line-height:1.2; font-variant-numeric:tabular-nums; letter-spacing:-1px; }
.training-summary span { display:block; margin-top:8px; color:var(--muted); font-size:12px; }
.training-overview .empty-hint { margin-top:12px; }
.round-timer { max-width:760px; margin-inline:auto; }
.timer-settings { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; }
.timer-settings label { display:grid; gap:8px; font-size:12px; font-weight:700; min-width:0; }
.timer-settings select { width:100%; min-width:0; padding:12px 8px; }
.timer-settings select:disabled { opacity:.65; }
.timer-presets { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-top:16px; padding-top:14px; border-top:1px solid var(--border); }
.timer-presets > span { color:var(--muted); font-size:11px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; margin-right:4px; }
.timer-presets .chip { min-height:40px; padding:8px 12px; }
.timer-face { padding:32px 0 24px; text-align:center; }
.timer-phase { font-size:12px; font-weight:800; text-transform:uppercase; letter-spacing:1.5px; color:var(--accent); }
.timer-display { font-size:clamp(72px,16vw,112px); font-weight:800; line-height:1.25; letter-spacing:-4px; font-variant-numeric:tabular-nums; }
.timer-face progress { display:block; width:100%; height:8px; margin-top:14px; accent-color:var(--accent); }
.round-timer[data-phase="rest"] .timer-phase { color:var(--muted); }
.round-timer[data-phase="complete"] .timer-display { color:var(--accent); }
.timer-actions { display:flex; justify-content:center; gap:12px; }
.timer-actions button { min-height:48px; min-width:120px; }
@media(max-width:640px) {
  .training-summary-heading { align-items:flex-start; }
  .training-summary-heading .text-button { font-size:12px; text-align:right; }
  .training-summary { gap:8px; }
  .training-summary > div { padding:16px 10px; }
  .training-summary strong { font-size:23px; letter-spacing:-.5px; }
  .timer-settings { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
  .timer-settings label:last-child { grid-column:1/-1; }
  .timer-settings label:last-child select { max-width:50%; }
  .timer-presets > span { flex-basis:100%; }
  .timer-actions { padding-right:54px; }
  .timer-actions button { flex:1; min-width:0; padding-inline:10px; }
}

.tech-resource-link { display:block; margin:12px 0; font-weight:700; color:var(--accent); }
.glossary-item .resource-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:14px; }
.resource-actions a { display:inline-flex; align-items:center; min-height:44px; padding:8px 12px; border:1px solid var(--border-strong); border-radius:8px; font-size:13px; font-weight:700; text-decoration:none; }
.resource-actions .resource-watch { background:var(--ink); color:var(--bg); border-color:var(--ink); }
.resource-video-title { display:block; margin-top:10px; font-size:12px; line-height:1.5; color:var(--muted); }
.glossary-item:target { outline:2px solid var(--accent); outline-offset:3px; }

/* Compact video browsing and long-page navigation. */
.resource-browse { display:flex; align-items:flex-end; flex-wrap:wrap; gap:12px; margin:18px 0 10px; }
.resource-browse label { display:grid; gap:7px; flex:1 1 260px; font-size:12px; font-weight:700; }
.resource-browse select { width:100%; min-width:0; min-height:46px; padding:10px 12px; border:1px solid var(--border-strong); border-radius:8px; background:var(--surface); color:var(--ink); font:inherit; font-size:14px; }
.resource-browse .btn { min-height:46px; }
.resource-browse-hint { margin:0 0 18px; font-size:12px; color:var(--muted); }
.back-to-top { position:fixed; right:calc(22px + env(safe-area-inset-right, 0px)); bottom:calc(84px + env(safe-area-inset-bottom, 0px)); z-index:199; width:48px; height:48px; display:grid; place-items:center; padding:0; border:1px solid var(--border-strong); border-radius:50%; background:var(--surface); color:var(--ink); box-shadow:var(--shadow-lg); cursor:pointer; }
.back-to-top[hidden] { display:none; }
.back-to-top svg { width:22px; height:22px; }
.back-to-top:hover { background:var(--bg-alt); }
@media print { .back-to-top, .resource-browse, .resource-browse-hint { display:none !important; } }


.game-development-entry { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin:18px 0 12px; }
.game-development-entry span { color:#d63437; font-size:.82rem; letter-spacing:.04em; }
.game-feature-card { border-color:rgba(214,52,55,.45); }
.game-feature-card:hover { border-color:#d63437; }
.card-status { display:inline-block; margin-left:6px; color:#d63437; font-size:.62em; letter-spacing:.08em; vertical-align:middle; }

/* Keep the Medal Run entry prominent without letting it overpower the daily puzzle. */
.game-development-entry{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin:18px 0 12px;padding:10px 12px;border-left:3px solid #d63437;background:rgba(214,52,55,.07);max-width:max-content}.game-development-entry .btn{width:auto!important;min-width:0;padding:10px 18px;font-size:14px}.game-development-entry span{font-size:.78rem}.game-development-entry::before{content:'8-BIT SIDE QUEST';color:#d63437;font-size:10px;font-weight:800;letter-spacing:.12em}@media(max-width:600px){.game-development-entry{max-width:100%;gap:8px;padding:10px}.game-development-entry::before{flex-basis:100%}.game-development-entry .btn{width:auto!important}}

/* Shared polish: shorter navigation, readable callouts and useful next steps. */
:root[data-theme="dark"] .callout-info strong { color: #93c5fd; }
:root[data-theme="dark"] .callout-warn strong { color: #fcd34d; }
.section-nav a { font-size: 14px; min-height: 44px; display: inline-flex; align-items: center; }
.footer-links a { min-height: 44px; display: inline-flex; align-items: center; }
.site-footer { padding-bottom: calc(105px + env(safe-area-inset-bottom, 0px)); }
.next-steps { border-top: 1px solid var(--border); }
.next-steps h2 { font-size: clamp(22px, 3vw, 28px); margin-bottom: 20px; }
.next-steps-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.next-step { position: relative; padding: 24px 56px 24px 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); }
.next-step h3 { font-size: 18px; margin-bottom: 8px; }
.next-step p { font-size: 15px; color: var(--muted); margin: 0; }
.next-step > span { position: absolute; right: 22px; top: 24px; color: var(--accent); font-size: 22px; }
.next-step:hover { border-color: var(--accent); color: var(--ink); background: var(--bg-alt); }
@media (max-width: 1000px) {
  .nav-toggle { min-width: 44px; min-height: 44px; }
  .nav-links { padding: 12px; gap: 6px; max-height: calc(100dvh - 72px); overflow-y: auto; box-shadow: var(--shadow-lg); }
  .nav-links.open { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-links a { min-height: 48px; padding: 14px; border-radius: 8px; font-size: 14px; }
  .nav-links a.active { background: var(--accent-soft); color: var(--accent); box-shadow: inset 3px 0 var(--accent); }
  .nav-install-btn { min-height: 44px; grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { font-size: 16px; }
  .next-steps-grid { grid-template-columns: 1fr; }
  .next-step { padding: 20px 52px 20px 20px; }
  .data-table { font-size: 14px; }
}
@media print { .next-steps { display: none; } }

/* Oct 2026 experience pass: make navigation and long pages feel native on phones. */
html { scrollbar-gutter: stable; }
body.menu-open { overflow: hidden; }
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 60px 0 0;
  z-index: 98;
  border: 0;
  background: rgba(0,0,0,.48);
  cursor: pointer;
}
.nav-backdrop.open { display: block; }
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 110;
  height: 3px;
  pointer-events: none;
  background: transparent;
}
.reading-progress span {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: var(--accent);
  will-change: transform;
}
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.nav-toggle { position: relative; z-index: 101; min-width: 44px; min-height: 44px; }
.nav-links { z-index: 101; }
.tool-card, .next-step, .tech-card, .glossary-item, .prep-panel, .training-summary > div {
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.tool-card:hover, .next-step:hover { transform: translateY(-2px); }
.tech-card:hover, .glossary-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.tech-card h3, .glossary-item dt { text-wrap: balance; }
.glossary-item dd { line-height: 1.6; }
.home-desk-section { padding-top: 36px; padding-bottom: 8px; }
.home-desk-heading { margin-bottom: 18px; }
.home-desk-heading .section-title { font-size: clamp(22px, 3vw, 30px); }
.home-desk-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.home-desk-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 82px;
  padding: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.home-desk-card:hover { color: var(--ink); border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.home-desk-card > span:nth-child(2) { display: grid; gap: 3px; min-width: 0; }
.home-desk-card strong { font-size: 15px; line-height: 1.25; }
.home-desk-card small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.home-desk-card > b { color: var(--accent); font-size: 18px; }
.home-desk-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.event-bar { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.4fr); gap: 22px; align-items: end; margin: 22px 0 4px; padding: 20px; border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 14px; background: var(--surface); }
.event-bar h2 { font-size: 21px; margin: 0 0 6px; }
.event-bar p { color: var(--muted); font-size: 13px; margin: 0; }
.event-fields { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(150px, .8fr) auto; gap: 10px; align-items: end; }
.event-fields label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.event-fields input { width: 100%; min-height: 44px; }
.event-fields .btn { min-height: 44px; white-space: nowrap; }
@media (max-width: 1000px) {
  .nav-backdrop.open { display: block; }
  .nav-links.open { position: absolute; z-index: 101; }
}
@media (max-width: 640px) {
  .home-desk-section { padding-top: 28px; }
  .home-desk-grid { grid-template-columns: 1fr; }
  .event-bar { grid-template-columns: 1fr; gap: 16px; padding: 16px; }
  .event-fields { grid-template-columns: 1fr 1fr; }
  .event-fields label:first-child { grid-column: 1 / -1; }
  .event-fields .btn { grid-column: 1 / -1; width: 100%; }
  .reading-progress { height: 2px; }
  .next-steps-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .tool-card:hover, .next-step:hover { transform: none; }
  .home-desk-card:hover { transform: none; }
}

/* Search-first libraries: compact controls and small, accessible result batches. */
[hidden] { display:none !important; }
body { padding-inline:env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px); }
.site-header { padding-top:env(safe-area-inset-top, 0px); }
[id] { scroll-margin-top:calc(88px + env(safe-area-inset-top, 0px)); }
.nav-backdrop { inset:calc(63px + env(safe-area-inset-top, 0px)) 0 0; }
.library-stats { display:flex; flex-wrap:wrap; gap:10px 24px; margin-top:24px; color:var(--muted); font-size:13px; }
.library-stats strong { color:var(--ink); font-size:18px; margin-right:4px; }
.library-heading { display:flex; justify-content:space-between; align-items:center; gap:20px; margin:14px 0 22px; }
.library-heading .section-title { margin-bottom:6px; }
.library-heading p { color:var(--muted); font-size:14px; margin:0; }
.library-heading > a { flex-shrink:0; }
.library-toolbar { border:1px solid var(--border); border-radius:16px; background:var(--surface); padding:22px; margin-bottom:28px; }
.library-toolbar > .search-input { width:100%; max-width:none; }
.library-toolbar .resource-browse { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:end; gap:14px; margin:16px 0 8px; }
.library-toolbar .resource-browse select { font-size:16px; }
.library-toolbar .resource-browse-hint { margin-bottom:14px; }
.library-results-bar { display:flex; align-items:center; flex-wrap:wrap; justify-content:space-between; gap:8px; padding-top:14px; border-top:1px solid var(--border); }
.library-results-bar p { margin:0; font-weight:700; font-size:13px; color:var(--muted); }
.glossary-section { margin-top:32px; }
.glossary-section:first-child { margin-top:0; }
.glossary-category-title { font-size:22px; margin-bottom:18px; }
.glossary { grid-template-columns:repeat(auto-fill,minmax(min(100%,300px),1fr)); }
.glossary-item { padding:22px; border-radius:12px; }
.glossary-item dt { font-size:18px; line-height:1.35; margin-bottom:10px; }
.glossary-item .resource-actions { gap:8px 12px; }
.resource-actions a:not(.resource-watch) { border-color:transparent; padding-inline:0; font-weight:500; font-size:12px; }
.library-pagination { display:flex; flex-direction:column; align-items:center; gap:12px; margin-top:28px; }
.library-pagination p { margin:0; color:var(--muted); font-size:13px; }
.library-pagination .btn { min-width:220px; min-height:48px; }
.tech-filter-panel { border-block:1px solid var(--border); padding-block:12px; margin-bottom:16px; }
.tech-filter-panel summary { cursor:pointer; font-size:14px; font-weight:750; min-height:32px; padding-block:4px; }
.tech-filter-panel summary span { display:block; color:var(--muted); font-size:12px; font-weight:500; padding-top:4px; }
.tech-filter-panel .filter-chips { margin-bottom:12px; }
.tech-filter-panel .chip { min-height:44px; }
.tech-results-actions { flex-wrap:wrap; }
.tech-results-actions .chip, .sort-label select { min-height:44px; }
.tech-card-actions { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px; margin-top:16px; }
.tech-card-actions .tech-resource-link { margin:0; padding-block:10px; font-size:13px; }
.tech-card-actions .tech-favorite { margin:0; min-height:44px; }
#favoriteStatus:empty { display:none; }
#favoriteStatus { margin:0 0 16px; }
.faq-filters { display:flex; align-items:end; gap:14px; margin:0 0 24px; flex-wrap:wrap; }
.faq-filters label { display:grid; gap:6px; font-size:12px; font-weight:700; color:var(--muted); }
.faq-filters select { min-height:44px; max-width:100%; padding:10px; font:inherit; font-size:16px; border:1px solid var(--border); border-radius:8px; color:var(--ink); background:var(--surface); }
.timer-total { margin:18px 0 0; text-align:center; font-size:13px; color:var(--muted); }
.timer-presets .chip { min-height:44px; }
.timer-presets .chip:disabled { opacity:.55; cursor:not-allowed; }
.event-bar { grid-template-columns:1fr; }
.event-fields { grid-template-columns:minmax(0,1.5fr) minmax(0,1fr) auto; }
.event-fields > .save-status { grid-column:1/-1; margin:0; }
.event-actions { display:flex; gap:12px; align-items:center; }
.offline-notice { padding:12px 20px; margin:0; font-size:13px; color:var(--ink); background:var(--accent-soft); border-bottom:1px solid var(--border); text-align:center; }
@media (max-width:1000px) {
  .nav-links, .nav-links.open { top:calc(60px + env(safe-area-inset-top, 0px)); max-height:calc(100dvh - 72px - env(safe-area-inset-top, 0px)); }
  .nav-links { overscroll-behavior:contain; }
}
@media (max-width:640px) {
  .library-heading { display:block; }
  .library-heading > a { display:inline-flex; margin-top:10px; }
  .library-toolbar { padding:16px; }
  .library-toolbar .resource-browse { grid-template-columns:minmax(0,1fr); gap:10px; }
  .library-toolbar .resource-browse .btn { justify-self:start; }
  .library-stats { gap:8px 16px; }
  .library-stats span { font-size:12px; }
  .library-stats strong { font-size:16px; }
  .event-fields { grid-template-columns:minmax(0,1fr); }
  .event-actions { flex-wrap:wrap; }
  .event-fields .event-actions .btn { width:auto; }
  .event-fields input { min-width:0; }
  .faq-filters { align-items:start; }
  .faq-filters label { width:100%; }
  .timer-actions { padding-right:0; }
}
@media print {
  .library-toolbar, .library-pagination, .faq-filters, .offline-notice, .reading-progress, .event-actions, #eventStatus { display:none !important; }
}

/* Final phone review: keep the first useful control closer to the page title. */
.tech-card h3 { color:var(--accent); }
:root[data-theme="dark"] .btn-primary,
:root[data-theme="dark"] #share,
:root[data-theme="dark"] .hero-mini-tile.selected { background:#c8102e; border-color:#c8102e; color:#fff; }
:root[data-theme="dark"] .btn-primary:hover { background:#a50d26; border-color:#a50d26; color:#fff; }
.resources-page #glossary { padding-top:0; }
@media (max-width:640px) {
  .page-header { padding:28px 0 24px; }
  .page-header p { font-size:16px; }
  .section-nav { flex-wrap:nowrap; overflow-x:auto; padding-block:16px; scrollbar-width:thin; }
  .section-nav a { flex-shrink:0; white-space:nowrap; }
  .library-stats { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-top:18px; }
  .library-stats span { line-height:1.4; }
  .library-stats strong { display:block; font-size:20px; margin-bottom:3px; }
  .library-heading { margin:8px 0 14px; }
  .library-heading > a { margin-top:4px; }
  .library-toolbar { margin-bottom:22px; }
}
