/* ── TOKENS ─────────────────────────────────────────────── */
:root {
  --ink:        #0e0d0c;
  --paper:      #f7f3ec;
  --crimson:    #8b1a1a;
  --gold:       #c9a84c;
  --gold-light: #e8d49a;
  --slate:      #1c2433;
  --slate-mid:  #2e3d55;
  --fog:        #8a8f98;
  --white:      #ffffff;
  --font-display: 'Cinzel', serif;
  --font-body:    'Crimson Pro', serif;
  --font-ui:      'Inter', sans-serif;
  --radius:     4px;
  --transition: 0.2s ease;
}

/* ── RESET ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: clamp(16px, 1.1vw, 18px);
  line-height: 1.7;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

/* ── NAVIGATION ─────────────────────────────────────────── */
#navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(14,13,12,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(201,168,76,0.15);
}
.nav-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.4rem 2rem;
}
.nav-logo {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.15em;
  color: var(--gold);
  text-transform: uppercase;
  word-spacing: 0.2em;
}
.nav-toggle {
  display: none;
  background: none; border: none;
  color: var(--paper); font-size: 1.4rem;
  cursor: pointer; padding: 0.25rem;
}
.nav-links {
  display: flex; gap: 2rem; list-style: none; align-items: center;
}
.nav-links a {
  font-family: var(--font-ui);
  font-size: 0.78rem; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
  text-align: center; line-height: 1.1;
  color: var(--paper); opacity: 0.8;
  transition: opacity var(--transition), color var(--transition);
}
.nav-links a:hover,
.nav-links a.active { opacity: 1; color: var(--gold); }
.nav-admin {
  color: var(--gold) !important; opacity: 1 !important;
  border: 1px solid rgba(201,168,76,0.4);
  padding: 0.4rem 1rem; border-radius: var(--radius);
}
.nav-admin:hover { background: rgba(201,168,76,0.1); }

/* ── PAGE WRAPPER ───────────────────────────────────────── */
.page-wrap {
  min-height: 100vh;
  padding-top: 4rem;
}

/* ── HERO ───────────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: grid; place-items: center;
  position: relative; overflow: hidden;
  padding: 8rem 2rem 6rem;
  text-align: center;
}
.hero-bg {
  position: absolute; inset: 0;
  background:
    linear-gradient(to bottom, rgba(14,13,12,0.55) 0%, rgba(14,13,12,0.25) 40%, rgba(14,13,12,0.8) 100%),
    url('https://images.unsplash.com/photo-1528360983277-13d401cdc186?w=1600&q=80') center/cover no-repeat;
  filter: saturate(0.65);
}
.hero-content { position: relative; z-index: 1; max-width: 780px; margin: 0 auto; }
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 7vw, 5.5rem);
  font-weight: 900; line-height: 1.05;
  color: var(--white); margin-bottom: 0.5rem;
}
.crimson { color: var(--crimson); }
.hero-subtitle {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2vw, 1.4rem);
  letter-spacing: 0.15em; color: var(--gold-light);
  margin-bottom: 1.5rem;
}
.hero-desc {
  font-size: 1.1rem; font-weight: 300;
  color: rgba(247,243,236,0.82);
  max-width: 540px; margin: 0 auto 2.5rem;
}
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ── PAGE HEADER ────────────────────────────────────────── */
.page-header {
  background: var(--slate);
  padding: 3rem 2rem 2.5rem;
  border-bottom: 1px solid rgba(201,168,76,0.15);
}
.page-header-inner { max-width: 1100px; margin: 0 auto; }
.page-eyebrow {
  font-family: var(--font-ui);
  font-size: 0.7rem; font-weight: 500;
  letter-spacing: 0.35em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 0.5rem;
}
.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 700; color: var(--white);
  line-height: 1.2;
}
.pt-clock {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--fog);
  margin-top: 0.6rem;
  letter-spacing: 0.02em;
}

/* ── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.8rem; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.85rem 2rem; border-radius: var(--radius);
  border: 2px solid transparent; cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--crimson); color: var(--white); border-color: var(--crimson); }
.btn-primary:hover { background: transparent; color: var(--crimson); }
.btn-outline { background: transparent; color: var(--gold); border-color: var(--gold); }
.btn-outline:hover { background: var(--gold); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--fog); border-color: rgba(138,143,152,0.3); }
.btn-ghost:hover { color: var(--white); border-color: var(--white); }
.btn-sm { padding: 0.6rem 1.2rem; font-size: 0.72rem; }

/* ── SECTIONS ───────────────────────────────────────────── */
.section { padding: 4rem 2rem; }
.section-dark { background: var(--slate); }
.section-inner { max-width: 1100px; margin: 0 auto; }
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 700; color: var(--white);
  margin-bottom: 0.75rem; line-height: 1.2;
}
.section-lead {
  font-size: 1.05rem; font-weight: 300;
  color: rgba(247,243,236,0.72);
  max-width: 560px; margin: 0 auto 2.5rem; line-height: 1.8;
  text-align: center;
}

/* ── BOOKS GRID ─────────────────────────────────────────── */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}
.book-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(201,168,76,0.12);
  border-radius: var(--radius); overflow: hidden;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.book-card:hover {
  transform: translateY(-4px);
  border-color: rgba(201,168,76,0.35);
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}
.book-cover { position: relative; overflow: hidden; }
.book-cover-img { width: 100%; height: auto; display: block; }
.book-info { padding: 1.1rem 1.25rem 1.4rem; }
.book-lang {
  font-family: var(--font-ui);
  font-size: 0.62rem; font-weight: 500;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 0.3rem;
}
.book-title {
  font-family: var(--font-display);
  font-size: 0.9rem; font-weight: 700;
  color: var(--white); line-height: 1.3; margin-bottom: 0.9rem;
}
.book-markets { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.market-link {
  font-family: var(--font-ui);
  font-size: 0.62rem; font-weight: 500;
  color: var(--paper);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 0.22rem 0.55rem; border-radius: 2px;
  transition: background var(--transition), border-color var(--transition);
}
.market-link:hover { background: var(--crimson); border-color: var(--crimson); }

/* ── SCORER ─────────────────────────────────────────────── */
.scorer-wrap { max-width: 480px; margin: 0 auto; }
.scorer-instructions {
  font-size: 1rem; font-weight: 300;
  color: rgba(247,243,236,0.75);
  line-height: 1.8; margin-bottom: 1.5rem;
}
.sudoku-grid {
  display: grid;
  grid-template-columns: repeat(9, 48px);
  border: 3px solid var(--gold);
  border-radius: 2px; overflow: hidden;
  background: var(--slate);
  box-shadow: 0 0 40px rgba(201,168,76,0.12);
  width: fit-content; margin: 0 auto;
}
.sudoku-cell {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 1.3rem; font-weight: 700; color: var(--white);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.07);
  cursor: pointer; outline: none;
  -webkit-appearance: none;
  text-align: center; caret-color: var(--gold);
  transition: background var(--transition);
}
.sudoku-cell:focus { background: rgba(201,168,76,0.1); color: var(--gold); }
.sudoku-cell.given { color: var(--gold-light); background: rgba(201,168,76,0.06); cursor: default; }
.sudoku-cell.cell-error { color: #e05555; background: rgba(224,85,85,0.12); }
.sudoku-cell:nth-child(3n) { border-right: 2px solid rgba(201,168,76,0.35); }
.sudoku-cell:nth-child(9n) { border-right: none; }
.sudoku-cell:nth-child(n+19):nth-child(-n+27) { border-bottom: 2px solid rgba(201,168,76,0.35); }
.sudoku-cell:nth-child(n+46):nth-child(-n+54) { border-bottom: 2px solid rgba(201,168,76,0.35); }
.grid-controls {
  display: flex; gap: 0.6rem;
  margin-top: 0.9rem; flex-wrap: wrap; justify-content: center;
}
.puzzle-id-display {
  font-family: var(--font-display);
  font-size: 1rem; font-weight: 700; color: var(--gold);
  text-align: center; margin-bottom: 0.5rem; letter-spacing: 0.05em;
}
.scorer-fields { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.scorer-field-row {
  display: flex; gap: 0.6rem;
  margin-bottom: 0.75rem; align-items: center;
}
.scorer-field-row .email-input { flex: 1; }
.scorer-status {
  font-family: var(--font-ui); font-size: 0.82rem;
  color: var(--gold-light); min-height: 1.2rem; margin-bottom: 0.5rem;
}
.email-input {
  font-family: var(--font-ui); font-size: 0.85rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius); color: var(--white);
  padding: 0.65rem 0.9rem; outline: none;
  transition: border-color var(--transition);
}
.email-input::placeholder { color: var(--fog); }
.email-input:focus { border-color: var(--gold); }
.privacy-note {
  font-family: var(--font-ui); font-size: 0.66rem;
  color: var(--fog); margin-top: 0.6rem;
}

/* ── SOCIAL ─────────────────────────────────────────────── */
.social-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  max-width: 800px; margin: 0 auto;
}
.social-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(201,168,76,0.12);
  border-radius: var(--radius); padding: 1.75rem 1.25rem;
  text-align: center;
  transition: transform var(--transition), border-color var(--transition);
  display: block;
}
.social-card:hover { transform: translateY(-3px); border-color: rgba(201,168,76,0.35); }
.social-card-soon { cursor: default; opacity: 0.55; }
.social-card-soon:hover { transform: none; }
.social-icon { font-size: 1.8rem; margin-bottom: 0.6rem; }
.social-name {
  font-family: var(--font-display); font-size: 0.9rem;
  font-weight: 700; color: var(--white); margin-bottom: 0.2rem;
}
.social-handle { font-family: var(--font-ui); font-size: 0.72rem; color: var(--gold); }
.social-soon {
  font-family: var(--font-ui); font-size: 0.62rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--fog); margin-top: 0.25rem;
}

/* ── CONTACT ────────────────────────────────────────────── */
.contact-wrap {
  display: grid; grid-template-columns: 1fr 1.3fr;
  gap: 4rem; align-items: start;
  max-width: 860px; margin: 0 auto;
}
.contact-email { margin-top: 1rem; }
.contact-email a { color: var(--gold); text-decoration: underline; }
.contact-form { display: flex; flex-direction: column; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-label {
  font-family: var(--font-ui); font-size: 0.68rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold);
}
.form-input, .form-textarea {
  font-family: var(--font-body); font-size: 1rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.11);
  border-radius: var(--radius); color: var(--white);
  padding: 0.7rem 0.9rem; outline: none; resize: vertical;
  transition: border-color var(--transition);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--fog); }
.form-input:focus, .form-textarea:focus { border-color: var(--gold); }
.form-textarea { min-height: 130px; }
.form-checkbox { display: flex; align-items: flex-start; gap: 0.7rem; }
.form-checkbox input { margin-top: 0.25rem; accent-color: var(--gold); }
.form-checkbox label {
  font-family: var(--font-ui); font-size: 0.78rem;
  color: rgba(247,243,236,0.65); line-height: 1.5;
}
.form-success {
  display: none;
  background: rgba(201,168,76,0.08);
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: var(--radius); padding: 0.9rem 1.25rem;
  font-size: 0.95rem; color: var(--gold-light); text-align: center;
}

/* ── FOOTER ─────────────────────────────────────────────── */
footer {
  background: rgba(0,0,0,0.5);
  border-top: 1px solid rgba(201,168,76,0.1);
  padding: 2.5rem 2rem;
}
.footer-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center;
  justify-content: center;
}
.footer-copy { font-family: var(--font-ui); font-size: 0.7rem; color: var(--fog); text-align: center; }
.footer-link { color: var(--fog); text-decoration: none; transition: color var(--transition); }
.footer-link:hover { color: var(--gold); }


/* ── SOLVE YOUR PUZZLE - VIEWER GRID ────────────────────── */
.viewer-grid {
  display: grid;
  grid-template-columns: repeat(9, 48px);
  border: 3px solid var(--gold);
  border-radius: 2px; overflow: hidden;
  background: var(--slate);
  box-shadow: 0 0 40px rgba(201,168,76,0.12);
  width: fit-content; margin: 0 auto;
}
.viewer-cell {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 1.3rem; font-weight: 700;
  border: 1px solid rgba(255,255,255,0.07);
  color: var(--white); background: transparent;
}
.viewer-cell:nth-child(3n) { border-right: 2px solid rgba(201,168,76,0.35); }
.viewer-cell:nth-child(9n) { border-right: none; }
.viewer-cell:nth-child(n+19):nth-child(-n+27) { border-bottom: 2px solid rgba(201,168,76,0.35); }
.viewer-cell:nth-child(n+46):nth-child(-n+54) { border-bottom: 2px solid rgba(201,168,76,0.35); }
.viewer-cell.cell-given   { color: var(--gold-light); background: rgba(201,168,76,0.08); }
.viewer-cell.cell-placed  { color: var(--white); background: rgba(201,168,76,0.18); font-weight: 900; }
.viewer-cell.cell-solved  { color: rgba(247,243,236,0.5); background: transparent; font-weight: 400; }
.viewer-cell.cell-highlight { background: rgba(201,168,76,0.25); }
.viewer-cell.cell-cands {
  font-size: 0.4rem; flex-wrap: wrap;
  align-items: center; justify-content: center;
  gap: 0; padding: 2px;
}
.cand-num {
  width: 14px; height: 14px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-ui); font-size: 0.55rem;
  color: rgba(247,243,236,0.45);
}
.cand-num.cand-active { color: var(--gold-light); }



/* ── LANGUAGE SELECTOR ──────────────────────────────────── */
.nav-lang-wrap {
  display: flex; align-items: center;
}
.nav-lang-select {
  font-family: var(--font-ui); font-size: 0.72rem;
  font-weight: 500; letter-spacing: 0.08em;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: var(--radius);
  color: var(--gold); padding: 0.35rem 0.6rem;
  outline: none; cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  appearance: none;
}
.nav-lang-select:hover { border-color: var(--gold); background: rgba(201,168,76,0.08); }
.nav-lang-select option { background: var(--slate); color: var(--white); }
.nav-lang-mobile { display: none; }
.nav-lang-select-mobile {
  font-family: var(--font-ui); font-size: 0.82rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: var(--radius);
  color: var(--gold); padding: 0.5rem 0.8rem;
  outline: none; cursor: pointer; width: 100%;
  appearance: none;
}
.nav-lang-select-mobile option { background: var(--slate); color: var(--white); }

/* ── ACCORDION ──────────────────────────────────────────── */
.accordion { margin-bottom: 2rem; }
.accordion-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; background: rgba(255,255,255,0.03);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: var(--radius); padding: 0.85rem 1.25rem;
  cursor: pointer; color: var(--gold);
  font-family: var(--font-ui); font-size: 0.78rem;
  font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
  transition: background var(--transition), border-color var(--transition);
}
.accordion-toggle:hover {
  background: rgba(201,168,76,0.06);
  border-color: rgba(201,168,76,0.4);
}
.accordion-body {
  padding: 1.25rem 0.25rem 0;
}

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .contact-wrap { grid-template-columns: 1fr; gap: 2.5rem; }
}
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-lang-wrap { display: none; }
  .nav-lang-mobile { display: block; }
  .nav-links {
    display: none; flex-direction: column;
    position: absolute; top: 100%; left: 0; right: 0;
    background: rgba(14,13,12,0.98);
    padding: 1.5rem 2rem; gap: 1.25rem;
    border-bottom: 1px solid rgba(201,168,76,0.15);
  }
  .nav-links.open { display: flex; }
  #navbar { position: relative; }
  .page-wrap { padding-top: 0; }
  .footer-inner { flex-direction: column; text-align: center; }
}
@media (max-width: 480px) {
  .sudoku-grid { grid-template-columns: repeat(9, 36px); }
  .sudoku-cell { width: 36px; height: 36px; font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--slate) inset !important;
  -webkit-text-fill-color: var(--white) !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* ── HALL OF FAME MODAL ────────────────────────────────────
   Extracted from challenge.html (2026-09-25) into this shared
   stylesheet so results.html can reuse the identical modal via
   buildHallOfFameModal()/openHallOfFameModal() in main.js, instead
   of duplicating this markup/CSS. */
#hallOfFameModal {
  display:none; position:fixed; top:0; left:0; width:100%; height:100%;
  background:rgba(0,0,0,0.85); z-index:1000;
  align-items:center; justify-content:center;
}
.hof-card {
  background:#1a1a2e; border:1px solid var(--gold); border-radius:8px;
  padding:2rem; max-width:760px; width:94%; max-height:85vh;
  display:flex; flex-direction:column; overflow:hidden;
}
.hof-title {
  font-family:var(--font-display); color:var(--gold);
  margin:0 0 1.25rem; text-align:center; flex-shrink:0;
}
.hof-tabs {
  display:grid; grid-template-columns:1fr 1fr; gap:0.5rem;
  margin-bottom:1.25rem; flex-shrink:0;
}
.hof-tab {
  padding:0.6rem 0.5rem;
  font-family:var(--font-ui); font-size:0.68rem; line-height:1.3;
  letter-spacing:0.04em; text-transform:uppercase;
  border:1px solid rgba(201,168,76,0.35); border-radius:var(--radius);
  cursor:pointer; background:transparent; color:var(--fog);
  transition:all 0.2s; text-align:center;
}
.hof-tab.active {
  background:rgba(201,168,76,0.12); border-color:var(--gold); color:var(--gold);
}
#hofContent {
  /* Fixed to fit exactly 1 header row + the max 10 ranked records
     (see lib/hallOfFame.js TOP_N=10) so the popup never grows or
     shrinks depending on how many records a section actually has —
     it's always sized as if it were full. Row height below is
     pinned with an explicit line-height (not just padding), since
     the CSS `height` on a table cell is only a floor — the browser
     still grows a row past it to fit the default line-height.
     11 rows x 2.2rem + a small buffer for border-collapse rounding.
     overflow-y:auto stays on only as a safety net; it should never
     actually need to scroll. */
  flex:0 0 auto; height:24.5rem; overflow-y:auto;
}
.hof-results-table {
  width:100%; border-collapse:collapse;
  font-family:var(--font-ui); font-size:0.82rem;
}
.hof-results-table th {
  font-size:0.62rem; letter-spacing:0.15em; text-transform:uppercase;
  color:var(--gold); padding:0.4rem 0.5rem; text-align:center;
  white-space:nowrap; border-bottom:1px solid rgba(201,168,76,0.2);
  height:2.2rem; line-height:1.2; box-sizing:border-box;
}
.hof-results-table td {
  padding:0.4rem 0.5rem; color:var(--fog); text-align:center;
  white-space:nowrap; border-bottom:1px solid rgba(255,255,255,0.05);
  height:2.2rem; line-height:1.2; box-sizing:border-box;
}
.hof-results-table tr:hover td { background:rgba(255,255,255,0.02); }
.hof-results-table tbody tr:nth-child(even) td { background:rgba(255,255,255,0.06); }
.hof-rank-1 td { color:var(--gold); }
.hof-rank-2 td { color:#c0c0c0; }
.hof-rank-3 td { color:#cd7f32; }
.hof-results-table .rank-badge { font-family:var(--font-display); font-weight:700; }
.hof-empty {
  height:100%; display:flex; align-items:center; justify-content:center;
  font-family:var(--font-body); font-style:italic; color:var(--fog);
}
.hof-close-row { text-align:center; margin-top:1.5rem; flex-shrink:0; }
