/* ============================================================
   Cryptic Companion — stylesheet
   ============================================================ */

/* ---- Design tokens ---- */

:root {
  /* V1 palette (still used by some components) */
  --color-ink:          #2b2b2b;
  --color-ink-light:    #5a5a5a;
  --color-ink-faint:    #8a8a8a;
  --color-paper:        #f5f0e8;
  --color-paper-dark:   #ede7db;
  --color-paper-edge:   #e0d8c8;
  --color-white:        #fffdf8;
  --color-pencil:       #6b6b6b;
  --color-pencil-light: #b0a898;
  --color-accent:       #8b4513;
  --color-success:      #3d6b3d;
  --color-danger:       #9b2c2c;

  /* V2 palette */
  --paper: #F4EDE4;
  --paper-dark: #E8DFD2;
  --ink: #1C1917;
  --ink-soft: #44403C;
  --ink-muted: #78716C;
  --pencil: #6B6560;
  --pencil-light: #8C857D;
  --pencil-faint: #D6D3D1;
  --highlighter: rgba(252, 232, 58, 0.45);
  --highlighter-strong: rgba(252, 232, 58, 0.6);
  --warm: #8B6914;
  --warm-light: #C49B2A;
  --warm-bg: rgba(180, 140, 40, 0.06);
  --cell-bg: #FDFBF7;
  --correct-ink: #365130;
  --error-ink: #8B2020;
  --biro-red: #B83230;

  /* Typography */
  --font-hand:  'Caveat', 'Segoe Print', cursive;
  --font-serif: 'Lora', 'Georgia', 'Times New Roman', serif;
  --font-news: 'Source Serif 4', 'Newsreader', Georgia, serif;

  /* Letter boxes */
  --letter-box-size:    52px;
  --letter-box-size-lg: 58px;
}

/* ---- Reset ---- */

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

body {
  font-family: var(--font-news);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- Paper texture overlay ---- */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.3;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* ============================================================
   Navigation — Page topbar, home, archive, puzzle list
   ============================================================ */

/* ---- Page topbar ---- */

.page-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--pencil-faint);
  position: relative;
  z-index: 1;
}

.topbar-brand {
  font-family: var(--font-hand);
  font-size: 19px;
  font-weight: 500;
  color: var(--pencil);
  text-decoration: none;
}

.topbar-right {
  font-family: var(--font-hand);
  font-size: 18px;
  color: var(--pencil);
}

/* ---- Back link ---- */

.back-link {
  font-family: var(--font-hand);
  font-size: 19px;
  font-weight: 500;
  color: var(--pencil);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--ink);
}

/* Hide page topbar when clue detail is active */
body:has(#clue-detail) .page-topbar {
  display: none;
}

/* ---- Main content container ---- */

.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 28px 112px;
  position: relative;
  z-index: 1;
}

/* ============================================================
   Home page
   ============================================================ */

.home-header {
  text-align: center;
  padding: 28px 0 10px;
  margin-bottom: 36px;
}

.home-title {
  font-family: var(--font-hand);
  font-size: 43px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.home-tagline {
  font-family: var(--font-news);
  font-size: 18px;
  font-style: italic;
  color: var(--pencil);
  margin-top: 7px;
  line-height: 1.5;
}

/* Today callout card */

.today-callout {
  margin-bottom: 36px;
  padding: 22px 24px;
  background: var(--cell-bg);
  border: 1.5px solid var(--pencil-faint);
  border-radius: 2px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: all 0.2s ease;
}

.today-callout:hover {
  border-color: var(--pencil);
  background: rgba(28, 25, 23, 0.02);
}

.today-label {
  font-family: var(--font-hand);
  font-size: 18px;
  font-weight: 600;
  color: var(--warm);
  margin-bottom: 4px;
}

.today-puzzle-date {
  font-family: var(--font-news);
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.today-meta {
  font-family: var(--font-hand);
  font-size: 18px;
  color: var(--pencil-light);
  margin-top: 2px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

/* Recent puzzles */

.recent-section {
  margin-bottom: 12px;
}

.recent-label {
  font-family: var(--font-hand);
  font-size: 20px;
  font-weight: 600;
  color: var(--pencil);
  letter-spacing: 0.04em;
  padding-bottom: 9px;
  border-bottom: 1.5px solid var(--pencil-faint);
  margin-bottom: 0;
}

/* Colophon */

.colophon {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px dashed var(--pencil-faint);
  text-align: center;
}

.colophon p {
  font-family: var(--font-news);
  font-size: 15px;
  line-height: 1.65;
  color: var(--pencil-light);
  max-width: 420px;
  margin: 0 auto;
}

.colophon p + p {
  margin-top: 9px;
}

/* ============================================================
   Shared archive/recent rows
   ============================================================ */

.archive-row {
  display: flex;
  align-items: baseline;
  gap: 18px;
  padding: 15px 0;
  border-bottom: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
}

.archive-row:hover {
  background: rgba(28, 25, 23, 0.02);
  border-bottom-color: var(--pencil-faint);
}

.archive-date {
  font-family: var(--font-news);
  font-size: 18px;
  color: var(--ink-soft);
  min-width: 112px;
}

.archive-date .day-name {
  color: var(--ink-muted);
  font-size: 16px;
}

.archive-number {
  font-family: var(--font-hand);
  font-size: 18px;
  color: var(--pencil-light);
}

.archive-setter {
  font-family: var(--font-hand);
  font-size: 18px;
  color: var(--pencil-light);
  margin-left: auto;
}

.more-link {
  display: block;
  text-align: center;
  padding: 18px 0;
  font-family: var(--font-hand);
  font-size: 19px;
  font-weight: 500;
  color: var(--pencil);
  text-decoration: none;
  transition: color 0.2s;
}

.more-link:hover {
  color: var(--ink);
}

/* ============================================================
   Archive page
   ============================================================ */

.archive-page-title {
  font-family: var(--font-news);
  font-size: 29px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 32px;
}

.month-group {
  margin-bottom: 32px;
}

.month-label {
  font-family: var(--font-hand);
  font-size: 20px;
  font-weight: 600;
  color: var(--pencil);
  letter-spacing: 0.04em;
  padding-bottom: 9px;
  border-bottom: 1.5px solid var(--pencil-faint);
  margin-bottom: 0;
}

/* ============================================================
   Puzzle page — header and clue list
   ============================================================ */

.puzzle-header {
  margin-bottom: 36px;
}

.puzzle-date {
  font-family: var(--font-news);
  font-size: 29px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.puzzle-meta-line {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-top: 4px;
}

.puzzle-setter {
  font-family: var(--font-hand);
  font-size: 20px;
  color: var(--pencil);
}

.puzzle-number {
  font-family: var(--font-hand);
  font-size: 18px;
  color: var(--pencil-light);
}

.puzzle-meta-line .puzzle-number::before {
  content: '\00b7';
  margin-right: 8px;
}

/* Clue columns (two-column grid) */

.clue-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 54px;
}

.clue-section {
  margin-bottom: 40px;
}

.section-label {
  font-family: var(--font-hand);
  font-size: 22px;
  font-weight: 600;
  color: var(--pencil);
  letter-spacing: 0.04em;
  padding-bottom: 9px;
  border-bottom: 1.5px solid var(--pencil-faint);
  margin-bottom: 4px;
}

/* Clue rows */

.clue-row {
  display: flex;
  align-items: baseline;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
}

.clue-row:hover {
  background: rgba(28, 25, 23, 0.02);
  border-bottom-color: var(--pencil-faint);
}

.clue-number {
  font-family: var(--font-hand);
  font-size: 25px;
  font-weight: 600;
  color: var(--pencil);
  min-width: 36px;
  text-align: right;
  flex-shrink: 0;
}

.clue-text-preview {
  font-family: var(--font-news);
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.clue-text-preview .enumeration {
  color: var(--ink-muted);
  font-size: 16px;
}

/* ============================================================
   Responsive — Navigation pages
   ============================================================ */

@media (max-width: 720px) {
  .clue-columns {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

@media (max-width: 520px) {
  .main {
    padding: 28px 22px 90px;
  }

  .page-topbar {
    padding: 14px 22px;
  }

  .puzzle-date {
    font-size: 25px;
  }

  .home-title {
    font-size: 36px;
  }

  .archive-page-title {
    font-size: 25px;
  }

  .archive-date {
    min-width: 90px;
  }
}

/* ============================================================
   Legacy V1 components (still used by clue detail)
   ============================================================ */

/* ---- Letter boxes — crossword grid ---- */

.letter-boxes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0px;
  margin-bottom: 1.7rem;
}

.letter-box {
  width: var(--letter-box-size);
  height: var(--letter-box-size);
  border: 2px solid var(--color-ink);
  border-radius: 0;
  text-align: center;
  font-family: var(--font-hand);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-ink);
  background: var(--color-white);
  padding: 0;
  text-transform: uppercase;
  caret-color: transparent;
  margin-right: -2px;
}

.letter-box:focus {
  outline: none;
  background: var(--color-paper-dark);
  box-shadow: inset 0 0 0 2px var(--color-pencil-light);
  position: relative;
  z-index: 1;
}

.letter-box--revealed {
  background: var(--color-white);
  color: var(--color-pencil);
  font-style: italic;
}

.box-gap {
  display: inline-block;
  width: 18px;
  margin-left: 2px;
}

.box-gap + .letter-box {
  margin-left: 0;
}

.box-hyphen {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-ink);
  margin-left: 2px;
}

.box-hyphen + .letter-box {
  margin-left: 0;
}

/* ---- Hint buttons — pencil annotations ---- */

.hint-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.hint-btn {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  background: transparent;
  color: var(--color-ink);
  border: 1.5px solid var(--color-ink);
  border-radius: 0;
  font-family: var(--font-hand);
  font-size: 1.1rem;
  font-weight: 400;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
}

.hint-btn::before {
  content: '';
  position: absolute;
  inset: -1px;
  border: 1.5px solid var(--color-ink);
  transform: rotate(-0.3deg);
  pointer-events: none;
  opacity: 0.25;
}

.hint-btn:hover,
.hint-btn:focus {
  background: var(--color-paper-dark);
  outline: none;
}

.hint-btn:active {
  background: var(--color-paper-edge);
}

.hint-btn--danger {
  background: transparent;
  color: var(--color-danger);
  border-color: var(--color-danger);
  border-style: dashed;
}

.hint-btn--danger::before {
  border-color: var(--color-danger);
  border-style: dashed;
}

.hint-btn--danger:hover,
.hint-btn--danger:focus {
  background: rgba(155, 44, 44, 0.05);
}

.hint-btn--used {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
  text-decoration: line-through;
  text-decoration-color: var(--color-ink-faint);
}

/* Mild tier hints */

.hint-tier--mild {
  display: flex;
  gap: 0.5rem;
}

.hint-btn--mild {
  background: transparent;
  color: var(--color-ink-light);
  border: 1px dashed var(--color-pencil-light);
  font-size: 0.95rem;
  padding: 0.55rem 0.75rem;
}

.hint-btn--mild::before {
  border: 1px dashed var(--color-pencil-light);
}

.hint-btn--mild:hover,
.hint-btn--mild:focus {
  background: var(--color-paper-dark);
  border-color: var(--color-ink);
  color: var(--color-ink);
}

.hint-btn--mild:active {
  background: var(--color-paper-edge);
}

/* Show answer confirmation */

.hint-btn--confirming {
  border-color: var(--color-danger);
  border-style: solid;
  color: var(--color-danger);
  background: rgba(155, 44, 44, 0.05);
  font-weight: 700;
}

.hint-btn--confirming::before {
  border-color: var(--color-danger);
  border-style: solid;
}

.hint-btn--confirming:hover,
.hint-btn--confirming:focus {
  background: rgba(155, 44, 44, 0.08);
}

/* ---- Definition position hint — pencil bracket ---- */

.definition-position {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0.75rem 1rem 0.75rem 1.5rem;
  font-family: var(--font-hand);
  font-size: 1.05rem;
  color: var(--color-pencil);
  margin-bottom: 1rem;
  position: relative;
  font-style: italic;
}

.definition-position::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 8px;
  border: 1.5px solid var(--color-pencil);
  border-right: none;
  border-radius: 4px 0 0 4px;
}

/* ---- Definition highlight — wavy pencil underline ---- */

mark {
  background: transparent;
  padding: 0;
  border-radius: 0;
  text-decoration: underline wavy var(--color-accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  color: inherit;
}

@supports not (text-decoration-style: wavy) {
  mark {
    background: rgba(139, 69, 19, 0.1);
    border-bottom: 2px solid var(--color-accent);
  }
}

/* ---- Check button ---- */

.check-button {
  display: block;
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--color-white);
  color: var(--color-ink);
  border: 2px solid var(--color-ink);
  border-radius: 0;
  font-family: var(--font-hand);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
  margin-bottom: 1rem;
  position: relative;
}

.check-button::before {
  content: '';
  position: absolute;
  inset: -1px;
  border: 2px solid var(--color-ink);
  transform: rotate(0.4deg);
  pointer-events: none;
  opacity: 0.2;
}

.check-button:hover,
.check-button:focus {
  background: var(--color-paper-dark);
  outline: none;
}

.check-button:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

/* ---- Success message ---- */

.success-message {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--color-success);
  margin-bottom: 1rem;
}

/* ---- Shake animation ---- */

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.shake {
  animation: shake 0.4s ease-in-out;
}

/* ---- Explanation ---- */

details.explanation {
  border: 1px dashed var(--color-paper-edge);
  border-radius: 0;
  padding: 0.75rem;
}

details.explanation summary {
  cursor: pointer;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-ink-light);
  user-select: none;
}

details.explanation p {
  margin-top: 0.75rem;
  font-family: var(--font-serif);
  font-size: 0.9rem;
  color: var(--color-ink);
  line-height: 1.7;
}

/* ---- Error page ---- */

.error-page {
  text-align: center;
  padding: 3rem 1rem;
}

.error-page h2 {
  font-family: var(--font-hand);
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
  color: var(--color-ink);
}

.error-page p {
  color: var(--color-ink-light);
  margin-bottom: 1.5rem;
}

/* ---- Clue full text (used in highlighted clue) ---- */

.clue-full-text {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--color-ink);
}

/* ---- Desktop letter boxes ---- */

@media (min-width: 721px) {
  .letter-box {
    width: var(--letter-box-size-lg);
    height: var(--letter-box-size-lg);
    font-size: 2.0rem;
  }
}

/* ---- Small mobile ---- */

@media (max-width: 400px) {
  :root {
    --letter-box-size: 42px;
  }

  .letter-box {
    font-size: 1.45rem;
  }

  .clue-full-text {
    font-size: 1.15rem;
  }
}

/* ============================================================
   V2 Clue Detail — "Pencil on Newspaper" redesign
   ============================================================ */

/* ---- Clue detail topbar ---- */

.clue-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--pencil-faint);
}

.clue-topbar .back-link {
  font-family: var(--font-hand);
  font-size: 19px;
  font-weight: 500;
  color: var(--pencil);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: none;
  padding: 0;
  transition: color 0.2s;
}

.clue-topbar .back-link:hover {
  color: var(--ink);
  border-bottom: none;
}

.clue-topbar .puzzle-meta {
  font-family: var(--font-hand);
  font-size: 18px;
  color: var(--pencil);
  text-align: right;
  font-style: normal;
  margin-top: 0;
}

/* ---- Clue body container ---- */

.clue-body {
  max-width: 600px;
  margin: 0 auto;
  padding: 40px 28px 90px;
  position: relative;
  z-index: 1;
}

/* ---- Clue label ---- */

.clue-label {
  font-family: var(--font-hand);
  font-size: 20px;
  font-weight: 600;
  color: var(--pencil);
  margin-bottom: 14px;
}

/* ---- Clue text (v2 with word spans) ---- */

.clue-text-v2 {
  font-family: var(--font-news);
  font-size: 29px;
  line-height: 1.55;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 4px;
}

.clue-text-v2 .enumeration {
  color: var(--ink-muted);
  font-size: 22px;
}

.clue-text-v2 .word {
  transition: all 0.4s ease;
  position: relative;
  padding: 0 1px;
}

/* Definition highlight: highlighter pen effect */
.clue-text-v2.show-definition .word.definition {
  background: linear-gradient(
    to bottom,
    transparent 0%,
    transparent 25%,
    var(--highlighter) 25%,
    var(--highlighter-strong) 85%,
    transparent 85%,
    transparent 100%
  );
  border-radius: 1px;
  padding: 0 3px;
  margin: 0 -2px;
}

/* ---- Answer grid ---- */

.grid-area {
  margin: 32px 0 0;
}

.answer-grid {
  display: flex;
  gap: 0;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
  position: relative;
}

.grid-cell {
  width: 58px;
  height: 58px;
  background: var(--cell-bg);
  border: 2px solid var(--ink);
  margin-right: -2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-hand);
  font-size: 34px;
  font-weight: 700;
  color: var(--ink);
  cursor: text;
  transition: background 0.15s ease;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  text-transform: uppercase;
  /* Override Caveat ascender metrics to visually centre */
  line-height: 0;
  padding-top: 3px;
}

.grid-cell:last-child {
  margin-right: 0;
}

/* Active cell */
.grid-cell.active {
  background: rgba(28, 25, 23, 0.06);
}

.grid-cell.active::after {
  content: '';
  position: absolute;
  bottom: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 1.5px;
  background: var(--ink);
  opacity: 0.4;
  animation: v2-blink 1s ease infinite;
}

@keyframes v2-blink {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0; }
}

/* Hint-filled: red biro, italic */
.grid-cell.hint-filled {
  color: var(--biro-red);
  font-style: italic;
  animation: v2-pencilIn 0.3s ease;
}

/* User-filled */
.grid-cell.user-filled {
  color: var(--ink);
}

/* Incorrect: shake per-cell */
.grid-cell.incorrect {
  color: var(--error-ink);
  animation: v2-shake 0.35s ease;
}

/* Revealed-all (completion) */
.grid-cell.revealed-all {
  color: var(--ink);
  font-style: normal;
}

@keyframes v2-pencilIn {
  0% { opacity: 0; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes v2-shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-2px); }
  40%, 60% { transform: translateX(2px); }
}

/* Grid separators (keep old class names for test compat) */
#clue-detail .box-gap {
  display: inline-block;
  width: 14px;
  margin-left: 2px;
}

#clue-detail .box-hyphen {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  margin-left: 2px;
}

/* Hidden input for mobile keyboard */
.grid-hidden-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

/* ---- Grid actions ---- */

.grid-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 16px;
}

.check-btn,
.clear-btn {
  font-family: var(--font-hand);
  font-size: 20px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.check-btn {
  color: var(--ink-soft);
  background: var(--cell-bg);
  border: 1.5px solid var(--pencil-light);
  border-radius: 2px;
  padding: 7px 24px;
}

.check-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
  background: rgba(28, 25, 23, 0.04);
}

.check-btn:disabled {
  opacity: 0.25;
  cursor: default;
  pointer-events: none;
}

.clear-btn {
  color: var(--pencil-light);
  background: transparent;
  border: none;
  padding: 7px 14px;
}

.clear-btn:hover {
  color: var(--pencil);
}

/* Check feedback */
.check-feedback {
  text-align: center;
  margin-top: 6px;
  font-family: var(--font-hand);
  font-size: 21px;
  min-height: 27px;
}

.check-feedback.correct {
  color: var(--correct-ink);
}

.check-feedback.incorrect {
  color: var(--error-ink);
}

/* ---- Scoreboard ---- */

.scoreboard {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 28px;
  padding: 12px 0;
  border-top: 1px dashed var(--pencil-faint);
  border-bottom: 1px dashed var(--pencil-faint);
}

.score-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-hand);
  font-size: 20px;
  color: var(--pencil-light);
}

.score-count {
  font-weight: 700;
  font-size: 22px;
  color: var(--pencil);
}

/* ---- Hints section ---- */

.hints-section {
  margin-top: 28px;
}

.hints-label {
  font-family: var(--font-hand);
  font-size: 19px;
  font-weight: 600;
  color: var(--pencil-light);
  margin-bottom: 12px;
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

.hint-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Hint card buttons */
#clue-detail .hint-btn {
  padding: 16px 18px;
  font-family: var(--font-news);
  font-size: 17px;
  background: var(--cell-bg);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
  border: 1.5px solid var(--pencil-faint);
  border-radius: 2px;
  width: 100%;
}

#clue-detail .hint-btn::before {
  display: none;
}

#clue-detail .hint-btn:hover {
  border-color: var(--pencil);
  background: rgba(28, 25, 23, 0.02);
}

#clue-detail .hint-btn:active {
  background: rgba(28, 25, 23, 0.04);
}

#clue-detail .hint-btn.used {
  border-color: var(--warm-light);
  background: var(--warm-bg);
  cursor: default;
  opacity: 1;
  text-decoration: none;
  pointer-events: none;
}

#clue-detail .hint-btn.used::after {
  content: '\2713';
  position: absolute;
  top: 8px;
  right: 10px;
  font-family: var(--font-hand);
  font-size: 16px;
  color: var(--warm-light);
}

.hint-title {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
}

.hint-desc {
  font-family: var(--font-hand);
  font-size: 18px;
  color: var(--pencil-light);
  transition: color 0.2s;
}

#clue-detail .hint-btn.used .hint-desc {
  color: var(--warm);
  font-weight: 500;
}

#clue-detail .hint-btn:disabled:not(.used) {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.reveal-letter-btn .letter-count {
  font-family: var(--font-hand);
}

/* ---- Last resort ---- */

.last-resort {
  margin-top: 18px;
}

.last-resort-btn {
  width: 100%;
  padding: 16px 28px;
  font-family: var(--font-hand);
  font-size: 21px;
  font-weight: 500;
  background: transparent;
  color: var(--pencil-light);
  border: 1.5px dashed var(--pencil-faint);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.last-resort-btn:hover {
  color: var(--pencil);
  border-color: var(--pencil-light);
  background: rgba(28, 25, 23, 0.02);
}

.last-resort-btn.confirming {
  color: var(--error-ink);
  border-color: var(--error-ink);
  border-style: solid;
}

/* ---- Explanation (post-solve) ---- */

#clue-detail .explanation {
  margin-top: 32px;
  padding: 22px 0 0;
  border: none;
  border-radius: 0;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

#clue-detail .explanation.visible {
  opacity: 1;
  transform: translateY(0);
}

.explanation-title {
  font-family: var(--font-hand);
  font-size: 18px;
  font-weight: 600;
  color: var(--pencil);
  margin-bottom: 9px;
}

.explanation-text {
  font-family: var(--font-news);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink-soft);
}

.explanation-text strong {
  color: var(--ink);
  font-weight: 600;
}

/* ---- V2 Responsive ---- */

@media (max-width: 520px) {
  .clue-body {
    padding: 32px 22px 68px;
  }

  .clue-text-v2 {
    font-size: 26px;
  }

  .grid-cell {
    width: 52px;
    height: 52px;
    font-size: 29px;
  }

  .clue-topbar {
    padding: 14px 22px;
  }

  #clue-detail .hint-btn {
    padding: 14px 16px;
  }

  .hint-title {
    font-size: 15px;
  }
}

@media (max-width: 360px) {
  .grid-cell {
    width: 44px;
    height: 44px;
    font-size: 27px;
  }
}
