:root { --game-accent: var(--t-accent); }
.site-header { width: min(960px, calc(100% - 40px)); grid-template-columns: 1fr auto 1fr; }
.site-header nav { justify-self: end; }
.theme-button { padding: 0; width: 38px; min-height: 38px; font-size: 21px; }
.thread-mark { display: inline-grid; place-items: center; width: 23px; height: 25px; border: 1px solid var(--t-line-strong); border-radius: 4px; font: 500 22px Georgia, serif; color: var(--t-ink); }
.thread-shell { width: min(760px, calc(100% - 40px)); margin: 42px auto 0; outline: none; }
.thread-intro { display: flex; align-items: end; justify-content: space-between; gap: 22px; margin-bottom: 32px; }
.thread-intro .eyebrow { margin-top: 0; }
.thread-intro h1 { font-size: clamp(32px, 6vw, 46px); line-height: 1.1; letter-spacing: -.055em; font-weight: 600; margin: 10px 0 0; }
.thread-intro h1 span { color: var(--t-muted); }
.intro-note { color: var(--t-muted); font-size: 13px; line-height: 1.7; margin: 0 0 3px; }
.section-tabs { margin-bottom: 26px; }
#app > .empty-state { margin-top: 22px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 18px; }
.panel-heading h2 { margin: 0 0 4px; font-size: 22px; font-weight: 600; letter-spacing: -.035em; }
.panel-heading p { margin: 0; color: var(--t-muted); font-size: 12px; line-height: 1.5; }
.mode-switch { flex-shrink: 0; }
.mode-switch a { color: var(--t-muted); text-decoration: none; font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 999px; }
.mode-switch a[aria-current="page"] { color: var(--t-bg); background: var(--t-ink); }
.puzzle-card { border: 1px solid var(--t-line); border-radius: var(--t-radius); background: var(--t-panel); overflow: hidden; }
.puzzle-top { display: flex; justify-content: space-between; align-items: center; min-height: 46px; padding: 12px 22px; border-bottom: 1px solid var(--t-line); font-size: 11px; font-weight: 650; color: var(--t-muted); letter-spacing: .02em; }
.timer { font-variant-numeric: tabular-nums; color: var(--t-ink); font-size: 14px; }
.timer.urgent { color: var(--t-warn); }
.clue-heading { text-align: center; padding: 25px 14px 21px; }
.clue-heading p { margin: 0 0 8px; color: var(--t-muted); font-size: 12px; }
.clue-heading h3 { font-size: clamp(28px, 6vw, 38px); letter-spacing: -.03em; font-weight: 600; margin: 0; }
.clue-heading .encode-heading { font-size: clamp(21px, 5vw, 28px); }
.choice-board { margin: 0 22px; }
.choice-row { position: relative; margin-bottom: 6px; }
.choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.choice { position: relative; min-width: 0; min-height: 53px; padding: 11px 5px; border: 1px solid var(--t-line); border-radius: 5px; color: var(--t-ink); background: var(--t-panel-deep); cursor: pointer; font-size: 13px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; display: flex; justify-content: center; align-items: center; gap: 3px; text-align: center; transition: background-color var(--t-speed), border-color var(--t-speed); }
.choice:hover:not(:disabled) { border-color: var(--t-dim); }
.choice[aria-checked="true"], .choice.target, .choice.locked { background: var(--game-accent); color: var(--t-on-accent); border-color: var(--game-accent); }
.choice.locked::after { content: "\2713"; position: absolute; top: 3px; right: 4px; font-size: 8px; }
.choice.target { box-shadow: inset 0 -2px 0 rgb(0 0 0 / 13%); }
.choice.target::before { content: "\2022"; position: absolute; top: 2px; left: 4px; font-size: 8px; }
.choice.chosen:not(.target) { border: 2px solid var(--t-ink); padding: 10px 4px; }
.choice[disabled] { opacity: 1; cursor: default; }
.row-result { min-height: 20px; margin: 4px 2px 0; font-size: 11px; line-height: 1.5; color: var(--t-muted); }
.row-result.matched { color: var(--t-success); }
.choice-row.reveal { animation: reveal-row .25s ease-out both; }
@keyframes reveal-row { from { opacity: .45; transform: translateY(2px); } to { opacity: 1; transform: none; } }
.puzzle-controls { border-top: 1px solid var(--t-line); padding: 20px 22px; margin-top: 11px; }
.puzzle-controls label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.clue-entry { display: flex; gap: 8px; }
.clue-entry input { min-width: 0; flex: 1; width: 100%; height: 46px; border: 1px solid var(--t-line-strong); border-radius: 5px; background: var(--t-bg); padding: 0 12px; font-size: 16px; }
.clue-entry .action-link { white-space: nowrap; }
.input-hint { display: flex; justify-content: space-between; gap: 8px; color: var(--t-muted); font-size: 11px; margin-top: 8px; }
.submit-row { display: flex; gap: 12px; justify-content: space-between; align-items: center; }
.text-button { background: transparent; border: 0; padding: 8px 0; color: var(--t-muted); cursor: pointer; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.text-button:disabled { opacity: .5; cursor: default; }
.feedback { margin: 0 0 13px; font-size: 13px; color: var(--t-muted); min-height: 19px; }
.feedback strong { color: var(--t-ink); }
.result-panel { display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.result-panel h3 { font-size: 22px; font-weight: 600; letter-spacing: -.03em; margin: 0 0 5px; }
.result-panel p { color: var(--t-muted); font-size: 12px; margin: 0; }
.result-panel .actions { display: flex; gap: 7px; flex-wrap: wrap; }
.below-board { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--t-muted); margin-top: 15px; }
.history { margin-top: 22px; border-bottom: 1px solid var(--t-line); }
.history summary { cursor: pointer; color: var(--t-muted); font-size: 13px; padding-bottom: 12px; }
.attempt-item { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; padding: 12px 0; border-top: 1px solid var(--t-line); font-size: 13px; }
.attempt-item p { margin: 0; }
.attempt-item .attempt-words { color: var(--t-muted); grid-column: 1 / -1; font-size: 11px; line-height: 1.5; }
.notice { border: 1px solid var(--t-line-strong); border-left: 3px solid var(--t-warn); border-radius: 5px; padding: 13px 16px; margin-bottom: 18px; display: flex; align-items: center; gap: 15px; justify-content: space-between; }
.notice p { font-size: 13px; line-height: 1.5; margin: 0; }
.thread-footer { padding: 30px 0; margin-top: 32px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 11px; color: var(--t-muted); border-top: 1px solid var(--t-line); }
.thread-footer a { color: var(--t-muted); }
.archive-month { margin: 25px 0 10px; font-size: 14px; font-weight: 600; }
.archive-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; align-items: center; border-top: 1px solid var(--t-line); padding: 14px 0; }
.archive-row time { font-size: 13px; font-weight: 600; }
.archive-link { padding: 10px 12px; background: var(--t-panel); border: 1px solid var(--t-line); border-radius: 5px; text-decoration: none; display: flex; justify-content: space-between; gap: 6px; font-size: 12px; }
.archive-link .done { color: var(--t-success); }
.archive-link.disabled { background: transparent; color: var(--t-dim); border-style: dashed; }
.load-more { margin: 20px 0 0; width: 100%; }
.versus-intro { padding: 27px; border: 1px solid var(--t-line); border-radius: var(--t-radius); background: var(--t-panel); }
.versus-intro h3 { font-size: 28px; margin: 0 0 10px; font-weight: 600; letter-spacing: -.04em; }
.versus-intro p { color: var(--t-muted); line-height: 1.7; font-size: 14px; max-width: 480px; }
.round-strip { display: flex; gap: 8px; margin: 23px 0; align-items: center; }
.round-strip span { padding: 9px 13px; background: var(--t-panel-deep); border: 1px solid var(--t-line); border-radius: 5px; font-size: 12px; font-weight: 600; }
.round-strip i { width: 12px; height: 1px; background: var(--t-line-strong); }
.rules-summary { display: flex; gap: 18px; flex-wrap: wrap; margin: 20px 0; }
.rules-summary div { border-left: 1px solid var(--t-line-strong); padding-left: 12px; }
.rules-summary strong, .rules-summary span { display: block; font-size: 12px; }
.rules-summary span { color: var(--t-muted); margin-top: 5px; }
.challenge-item { padding: 16px 0; border-bottom: 1px solid var(--t-line); display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.challenge-item a { font-size: 13px; text-decoration: none; }
.challenge-item small { color: var(--t-muted); }
.match-table { width: 100%; border-collapse: collapse; margin: 25px 0; font-size: 13px; }
.match-table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--t-muted); padding: 10px 8px; border-bottom: 1px solid var(--t-line); }
.match-table td { padding: 17px 8px; border-bottom: 1px solid var(--t-line); }
.match-table small { display: block; margin-top: 4px; color: var(--t-muted); font-size: 10px; }
.match-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.match-caption { color: var(--t-muted); line-height: 1.7; font-size: 12px; }
.tutorial-step { display: flex; gap: 5px; align-items: center; }
.tutorial-step i { width: 22px; height: 3px; background: var(--t-line); }
.tutorial-step i.active { background: var(--t-ink); }
.tutorial-next { padding: 24px; text-align: center; }
.tutorial-next h3 { font-weight: 600; font-size: 25px; letter-spacing: -.035em; }
.tutorial-next p { line-height: 1.6; color: var(--t-muted); font-size: 14px; }
#share-text { width: 100%; margin-top: 10px; padding: 12px; resize: vertical; border: 1px solid var(--t-line-strong); border-radius: 5px; color: var(--t-ink); background: var(--t-bg); font-size: 14px; }
#about-dialog p { font-size: 14px; line-height: 1.7; color: var(--t-muted); }
@media (max-width: 620px) {
  .thread-shell { margin-top: 26px; }
  .thread-intro { margin-bottom: 26px; }
  .intro-note { display: none; }
  .thread-intro h1 { font-size: 33px; }
  .thread-intro h1 br { display: none; }
  .thread-intro h1 span { display: block; }
  .puzzle-top { padding-inline: 14px; }
  .choice-board { margin-inline: 14px; }
  .choice { font-size: 12px; }
  .puzzle-controls { padding: 17px 14px; }
  .result-panel { align-items: start; flex-direction: column; gap: 15px; }
  .versus-intro { padding: 20px; }
}
@media (max-width: 400px) {
  .site-header { width: calc(100% - 24px); gap: 9px; }
  .site-header .back-link { font-size: 12px; }
  .site-header .header-button { padding-inline: 9px; font-size: 12px; }
  .theme-button { width: 32px; }
  .thread-shell { width: calc(100% - 24px); }
  .section-tabs a { padding: 14px 10px; font-size: 12px; }
  .choice-board { margin-inline: 9px; }
  .choices { gap: 4px; }
  .choice { font-size: 10px; min-height: 48px; padding-inline: 2px; }
  .row-result { font-size: 10px; }
  .panel-heading h2 { font-size: 19px; }
  .mode-switch a { padding: 8px 10px; font-size: 12px; }
  .puzzle-controls { padding-inline: 12px; }
  .clue-entry .action-link { padding: 10px 12px; }
  .round-strip { gap: 4px; }
  .round-strip span { padding: 8px; font-size: 11px; }
  .round-strip i { width: 8px; }
  .archive-row { gap: 6px; grid-template-columns: .75fr 1fr 1fr; }
  .archive-link { padding: 10px 8px; font-size: 11px; }
}

/* Keep the collection escape route visible; generic shell hides it on phones. */
@media (max-width: 600px) {
  .site-header { grid-template-columns: auto 1fr auto; grid-template-rows: auto; padding-inline: 0; }
  .site-header .back-link { display: inline-flex; grid-column: 1; min-height: 40px; align-items: center; }
  .site-header .wordmark { grid-column: 2; justify-self: center; }
  .site-header nav { grid-column: 3; flex-wrap: nowrap; }
}
