:root { color-scheme: light; --ink: #183b3b; --muted: #51676b; --paper: #fffdf8; --page: #f2f4ef; --line: #cbd7cd; --accent: #1d6860; --soft: #e5f0e6; --warning: #9b3426; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--ink); font: 16px/1.5 system-ui, sans-serif; }
button, input, select { font: inherit; }
button, select { min-height: 44px; }
button { cursor: pointer; border: 1px solid var(--accent); border-radius: 9px; padding: 9px 14px; background: var(--accent); color: #fff; font-weight: 650; touch-action: manipulation; }
button.secondary { background: var(--soft); color: var(--ink); border-color: #adc8b7; }
button.quiet { background: var(--paper); color: var(--ink); border-color: var(--line); }
button:disabled { opacity: .48; cursor: default; }
button:hover:not(:disabled) { filter: brightness(.94); }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 3px solid #b46b17; outline-offset: 3px; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.2; }
h1 { font: 750 clamp(2rem, 4vw, 3rem)/1.1 Georgia, serif; margin: 8px 0 12px; }
h2 { font-size: 1.35rem; margin: 0 0 10px; }
h3 { font-size: 1.15rem; margin: 0 0 10px; }
p { margin: 0 0 12px; }
.game-nav { display: flex; gap: 18px; align-items: center; padding: 12px max(16px, calc((100% - 1440px) / 2)); color: #fff; background: #173f3c; }
.game-nav a { color: #fff; padding: 4px 0; }
.game-nav span { font-weight: 700; }
.game-nav a:last-child { margin-left: auto; }
.hero { text-align: center; padding: 24px 16px 12px; }
.hero > p:last-child { color: var(--muted); }
.eyebrow { color: var(--accent); font-size: .75rem; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; margin-bottom: 6px; }
.page-shell { width: min(calc(100% - 32px), 1440px); margin: 0 auto 32px; }
.session-status { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin-bottom: 14px; }
.session-status p { margin: 0; font-size: .9rem; }
#progress-text { font-weight: 650; }
#save-status { color: var(--muted); }
#storage-warning, .notice { padding: 12px 16px; border: 1px solid #cfaa65; border-radius: 9px; background: #fff3d9; color: #68410a; }
.panel { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 15px; padding: 18px; box-shadow: 0 8px 22px #183b3b08; }
.workbench { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; }
summary { min-height: 44px; cursor: pointer; font-weight: 700; }
.summary-note { display: block; font-size: .8rem; font-weight: 400; color: var(--muted); margin-top: 4px; }
.control-note { color: var(--muted); font-size: .8rem; line-height: 1.5; }
.clue-list { list-style: none; margin: 12px 0 0; padding: 0; }
.clue-item { display: flex; align-items: flex-start; gap: 4px; border-top: 1px solid var(--line); padding: 6px 0; }
.reviewed-label { flex: 0 0 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.reviewed-label input { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; }
.reviewed-label span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.clue-pick { flex: 1; min-width: 0; text-align: left; background: transparent; color: var(--ink); font-size: .9rem; font-weight: 450; border-color: transparent; padding: 6px; line-height: 1.5; user-select: text; }
.clue-pick[aria-pressed="true"] { background: var(--soft); border-color: #adc8b7; font-weight: 650; }
.clue-pick.is-hinted { background: #fff4cf; border-color: #c5a85c; }
.clue-item.reviewed .clue-pick { color: var(--muted); }
.worksheet-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.worksheet-intro { font-size: .9rem; color: var(--muted); }
.worksheet-context { position: sticky; top: 0; z-index: 5; background: var(--paper); padding: 10px 0; border-bottom: 1px solid var(--line); margin: 0 0 16px; }
.pinned-clue { background: var(--soft); border: 1px solid #adc8b7; border-radius: 11px; padding: 10px 12px; }
.clue-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#clue-number { color: var(--accent); font-size: .8rem; }
.clue-controls > div { display: flex; gap: 6px; }
button.icon-button { min-width: 44px; padding: 4px 10px; font-size: 1.1rem; background: var(--paper); color: var(--ink); border-color: #adc8b7; }
#pinned-clue { margin: 4px 0 0; line-height: 1.4; font-weight: 600; scroll-margin-block: 20px; }
.house-nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; margin-top: 10px; }
.house-nav button { padding: 7px 3px; background: #fff; color: var(--ink); border-color: var(--line); }
.house-nav button[aria-pressed="true"] { color: #fff; background: var(--accent); border-color: var(--accent); }
.house-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; align-items: start; }
.house-card { --house-color: #a9bdb6; min-width: 0; margin: 0; padding: 12px 8px 8px; border: 1px solid var(--line); border-top: 6px solid var(--house-color); border-radius: 10px; background: #fff; }
.house-card[data-active="true"] { box-shadow: 0 0 0 2px #1d686033; }
.house-card[data-color="Red"] { --house-color: #b95147; }
.house-card[data-color="Green"] { --house-color: #548653; }
.house-card[data-color="White"] { --house-color: #b7c6cf; }
.house-card[data-color="Yellow"] { --house-color: #cda633; }
.house-card[data-color="Blue"] { --house-color: #427fa3; }
.house-card-title { float: none; padding: 0 4px; font-size: 1rem; font-weight: 750; }
.answer-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 3px 4px; padding-bottom: 10px; }
.answer-row > label { grid-column: 1; grid-row: 1; font-size: .8rem; font-weight: 650; }
.answer-row > select { grid-column: 1 / -1; grid-row: 2; display: block; min-width: 0; width: 100%; border: 1px solid #9aaca7; border-radius: 7px; padding: 7px 4px; background: #fff; color: var(--ink); font-size: .85rem; }
.answer-row > select[aria-invalid="true"] { border: 2px solid var(--warning); background: #fff0e9; }
.answer-row .notes-toggle { grid-column: 2; grid-row: 1; padding: 5px 3px; color: var(--accent); background: transparent; border-color: transparent; font-size: .72rem; text-decoration: underline; text-underline-offset: 3px; }
.notes-list { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0; }
.note-chip { flex: 1 1 auto; min-height: 44px; padding: 6px 7px; background: #f1f5ef; color: var(--ink); border-color: var(--line); font-size: .75rem; font-weight: 450; }
.note-chip[aria-pressed="true"] { text-decoration: line-through; background: #f9e9df; border-color: #c7967a; color: #6a3c28; }
.game-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.primary-actions, .secondary-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.secondary-actions button { font-size: .85rem; padding-inline: 12px; }
.game-status { margin: 14px 0 8px; padding: 10px 12px; border-left: 3px solid var(--accent); background: #edf4ed; font-size: .9rem; scroll-margin-block: 18px; }
.game-status:empty { display: none; }
.completion-panel { margin-top: 12px; padding: 16px; border: 1px solid #8cb69c; border-radius: 10px; background: #e5f3de; font-weight: 700; }
.hint-panel { margin-top: 16px; padding: 16px; border: 1px solid #cdbb8b; border-radius: 12px; background: #fff7df; }
.hint-panel p { font-size: .95rem; }
#hint-explanation { margin-top: 14px; }
.comparison { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; }
.comparison table { min-width: 650px; font-size: .8rem; }
th, td { border: 1px solid var(--line); padding: 9px 7px; text-align: left; }
th { background: #edf3eb; font-weight: 650; }
.guide { max-width: 900px; margin: 26px auto; }
.guide details { border-top: 1px solid var(--line); padding: 12px 0; }
.guide summary { padding-top: 7px; }
.guide details p { margin: 10px 0; }
.site-related { color: var(--ink); }
dialog { width: min(calc(100% - 32px), 460px); padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); box-shadow: 0 24px 80px #0004; }
dialog::backdrop { background: #102d2a99; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 22px; }
#print-sheet { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 1099px) {
  .workbench { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .clue-panel { padding-block: 10px; }
  .clue-panel .summary-note { display: inline; margin-left: 6px; }
  .clue-panel summary { padding-top: 9px; }
  .house-cards { grid-template-columns: minmax(0, 1fr); }
  .house-card:not([data-active="true"]) { display: none; }
  .house-card { padding: 12px 16px; }
  .answer-row { gap: 4px 10px; padding-bottom: 6px; }
  .answer-row > label { font-size: .9rem; }
  .answer-row > select { padding-inline: 12px; font-size: 1rem; }
  .answer-row .notes-toggle { font-size: .85rem; padding-inline: 8px; }
  .note-chip { font-size: .85rem; }
  .worksheet-context { padding-top: 6px; }
}
@media (max-width: 600px) {
  .page-shell { width: calc(100% - 20px); }
  .game-nav { padding: 10px 12px; gap: 12px; font-size: .8rem; }
  .hero { padding: 14px 16px 4px; }
  .hero .eyebrow, .hero > p:last-child { display: none; }
  .session-status { margin-bottom: 12px; }
  .session-status p { font-size: .8rem; }
  .panel { padding: 12px; }
  .clue-panel { padding-block: 8px; }
  .clue-panel .summary-note { display: block; margin-left: 0; }
  .worksheet-heading { gap: 10px; }
  .worksheet-heading h2 { font-size: 1.2rem; }
  .worksheet-intro { font-size: .8rem; }
  .pinned-clue { padding: 8px 10px; }
  #pinned-clue { font-size: .9rem; }
  .house-nav { gap: 5px; }
  .house-nav button { font-size: .8rem; }
  .house-card { padding-inline: 10px; }
  .primary-actions { width: 100%; }
  .primary-actions button { flex: 1 1 100px; font-size: .85rem; padding-inline: 8px; }
  .secondary-actions { gap: 6px; }
  .secondary-actions button { padding-inline: 9px; }
}
@media (max-height: 520px) { .worksheet-context { position: static; } }
@media print {
  @page { size: portrait; margin: 12mm; }
  body { background: #fff; color: #000; font: 10pt/1.35 Georgia, serif; }
  .site-header, .page-shell > :not(#print-sheet), dialog { display: none !important; }
  .page-shell { width: auto; margin: 0; }
  #print-sheet { display: block; }
  #print-sheet .print-title { font-size: 20pt; margin: 0 0 7mm; }
  #print-sheet h2 { font-size: 13pt; margin: 7mm 0 3mm; }
  #print-sheet table { table-layout: fixed; font-size: 9pt; }
  #print-sheet th, #print-sheet td { border: 1px solid #555; padding: 3mm 1.5mm; overflow-wrap: anywhere; }
  #print-sheet .print-notes { display: block; margin-top: 2mm; font-size: 7pt; line-height: 1.25; }
  #print-clues { columns: 2; column-gap: 8mm; padding-left: 5mm; }
  #print-clues li { break-inside: avoid; margin: 0 0 3mm; }
  .print-source { margin-top: 6mm; font-size: 8pt; }
}
