:root {
  color-scheme: light;
  --page: #eaf0f7;
  --white: #fbfcfe;
  --ink: #202c3a;
  --subtle: #526274;
  --line: #c9d5e2;
  --wash: #e0e9f3;
  --accent: #7b512e;
  --brass: #edd5ad;
  --mint: #e1eaf5;
  --mono: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --sans: 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
::selection { background: var(--brass); color: var(--ink); }
body { margin: 0; background: var(--page); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: inherit; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #96703f; outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; z-index: 1; top: 10px; left: 10px; padding: 12px 16px; background: var(--white); border-radius: 8px; }

.site-shell { width: min(1136px, calc(100% - 80px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 76px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 23px; font-weight: 700; letter-spacing: -.035em; text-decoration: none; }
.brand img { flex: none; }
nav { display: flex; align-items: center; gap: 14px; }
.header-action { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 5px 8px; border: 0; background: transparent; color: var(--ink); font-size: 13px; font-weight: 650; border-radius: 9px; white-space: nowrap; }
.header-action svg { width: 18px; height: 18px; }
.header-action:hover { background: var(--wash); }
.stats-action { border: 1px solid var(--line); background: var(--white); padding-inline: 12px; }

.edition { display: flex; align-items: center; gap: 10px; margin: 36px 0 17px; font: 700 11px/1.4 var(--mono); letter-spacing: .13em; }
.meta-dot { border-radius: 50%; background: #6d819a; flex: none; }
.edition-line { width: 23px; height: 1px; background: #a6b4c4; }
.edition time { color: var(--subtle); letter-spacing: .05em; text-transform: uppercase; }
.play-layout { display: grid; grid-template-columns: minmax(300px, .72fr) minmax(0, 1.35fr); align-items: start; gap: clamp(30px, 5.7vw, 82px); }
.intro { padding-top: 30px; }
h1 { margin: 0 0 20px; font-size: clamp(50px, 5.3vw, 79px); letter-spacing: -.038em; line-height: .98; font-weight: 700; }
h1 em { font-family: Georgia, 'Times New Roman', serif; font-size: .93em; font-weight: 400; letter-spacing: -.035em; color: #795132; white-space: nowrap; }
.lede { max-width: 310px; margin: 0; color: var(--subtle); font-size: 18px; line-height: 1.6; }

.text-button { display: inline-flex; align-items: center; gap: 7px; min-height: 37px; padding: 3px 0; border: 0; background: transparent; color: var(--accent); font-weight: 700; font-size: 13px; text-align: left; }
.text-button:hover:not(:disabled) { text-decoration: underline; text-underline-offset: 3px; }
.text-button:disabled { color: var(--subtle); }
.text-button svg { width: 17px; height: 17px; }
.free-modes { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 15px; margin-top: 19px; }
.unlimited-button { display: inline-flex; align-items: center; text-decoration: none; min-height: 43px; padding: 0 12px; border: 1px solid #c3d0df; border-radius: 7px; background: var(--wash); color: var(--ink); font-size: 13px; font-weight: 700; }
.unlimited-button:hover { background: #d5e2ef; border-color: #9aafc4; }
.lock-entry { display: flex; flex-wrap: wrap; gap: 0 15px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); max-width: 325px; }
.lock-entry .text-button { min-height: 40px; text-underline-offset: 3px; }

.game { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 17px; background: var(--white); scroll-margin-top: 12px; }
.game-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 15px; color: var(--subtle); font: 700 11px/1.25 var(--mono); letter-spacing: .08em; }
.game-meta > span:first-child { display: inline-flex; align-items: center; gap: 7px; }
.game-meta strong { color: var(--accent); }
.meta-dot { width: 7px; height: 7px; }
.progress { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 4px; margin: 0 0 17px; border: 1px solid #dae4ef; border-radius: 12px; background: #edf2f8; }
.progress li { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 35px; color: var(--subtle); border-radius: 8px; font-size: 13px; font-weight: 650; }
.progress li > span { display: grid; place-items: center; width: 19px; height: 19px; border: 1px solid #c8d4e1; border-radius: 50%; font: 700 11px/1 var(--mono); }
.progress li.current { color: var(--white); background: var(--ink); }
.progress li.current > span { border-color: #ffffff45; background: #ffffff17; }
.progress li.done > span { background: var(--mint); color: #294963; border-color: #c1d5e8; }
.progress svg { width: 12px; height: 12px; stroke-width: 2.4; }
.board-area {
  min-width: 0;
  padding: 24px 19px 16px;
  border: 1px solid #27384c;
  border-radius: 11px;
  background: radial-gradient(ellipse at 50% 4%, #354861 0%, #263549 60%, #1b2635 100%);
  color: #f7faff;
  text-align: center;
}
.board-area h2 { margin: 0 0 5px; font-size: clamp(22px, 2.6vw, 32px); font-weight: 700; letter-spacing: -.035em; line-height: 1.12; text-wrap: balance; }
.board-area > p { margin: 0; color: #d2deed; font-size: 13px; text-wrap: pretty; }
.relay-step { margin-top: 10px; color: #ddc095; font: 700 11px/1.2 var(--mono); letter-spacing: .12em; }

.word-chain { width: min(100%, 560px); margin: 6px auto 0; }
.chain-art { display: block; width: 100%; height: auto; overflow: visible; }
.chain-body { --metal: url(#chain-steel); }
.metal-solved { --metal: url(#chain-brass); }
.metal-revealed { --metal: url(#chain-patina); }
.tube-shadow { stroke: #101a28; stroke-width: 24; opacity: .58; }
.tube-rim { stroke: #27384b; stroke-width: 20; }
.tube-metal { stroke: var(--metal); stroke-width: 16; }
.tube-glint { stroke: #fff8df; stroke-width: 1.2; opacity: .53; }
.metal-missing { stroke: #ddad71; stroke-width: 1.8; stroke-dasharray: 5 5; }
.metal-locked { stroke: #8c9eb6; stroke-width: 1.4; stroke-dasharray: 2 5; }
.chain-body.link-drop { animation: link-drop 550ms cubic-bezier(.22,.73,.28,1) both; }
.chain-body.link-tug-left, .chain-body.link-tug-right { animation: link-tug 550ms ease-out both; }
.link-tug-left { --pull: 5px; }
.link-tug-right { --pull: -5px; }
.chain-body.link-miss { animation: link-miss 250ms ease-out; }
@keyframes link-drop {
  0% { transform: translateY(-23px) rotate(-8deg) scaleY(1.55); opacity: .55; }
  50% { transform: translateY(3px) rotate(1deg); opacity: 1; }
  75% { transform: translateY(-1.5px) rotate(-.6deg); }
  100% { transform: none; }
}
@keyframes link-tug {
  0%, 39% { transform: none; }
  56% { transform: translateX(var(--pull)); }
  76% { transform: translateX(calc(var(--pull) * -.23)); }
  100% { transform: none; }
}
@keyframes link-miss {
  25% { transform: translateX(-4px); }
  55% { transform: translateX(3px); }
  78% { transform: translateX(-1px); }
}
@media (prefers-reduced-motion: reduce) {
  .chain-body.link-drop, .chain-body.link-tug-left, .chain-body.link-tug-right, .chain-body.link-miss { animation: none; }
}

.word-labels { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; padding-inline: 5%; }
.relay .word-labels { padding-inline: 4%; }
.word-tile { min-width: 0; min-height: 59px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 3px; border: 1px solid #71839b; border-radius: 6px; background: #2c3b4f; color: #f6f9ff; }
.word-tile > span { color: #d5dfed; font-size: 11px; line-height: 1.25; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.word-tile strong { font-size: clamp(14px, 2vw, 22px); font-weight: 750; line-height: 1.12; letter-spacing: -.025em; text-transform: uppercase; overflow-wrap: anywhere; }
.word-tile.missing { border-color: #d9aa72; background: #3e3928; color: #ffe1af; }
.word-tile.missing > span, .word-tile.solved > span { color: #f2cf9c; }
.word-tile.missing strong { font-size: 25px; }
.word-tile.solved { border-color: #bd915a; background: #483c2a; color: #ffe1af; }
.word-tile.revealed { border-color: #927c60; background: #38362d; color: #ede1ca; }
.word-tile.locked { border-color: #71839b; background: #273548; color: #d8e3f2; }
.word-tile.locked strong { display: flex; }
.word-tile.locked svg { width: 16px; height: 16px; }
.relay .word-tile { min-height: 67px; }
.relay .word-tile small { color: #d8e3f2; font-size: 11px; font-weight: 650; line-height: 1.2; white-space: nowrap; }
.relay .word-tile.missing small { color: #edd4aa; }
.relay .word-tile strong { font-size: clamp(13px, 1.8vw, 20px); }
.relay .word-tile.missing strong { font-size: 22px; }

#guess-form { display: flex; gap: 9px; margin-top: 17px; }
#guess { min-width: 0; flex: 1; min-height: 52px; padding: 0 14px; border: 1px solid #c4d1df; border-radius: 10px; color: var(--ink); background: #fff; caret-color: var(--accent); font-weight: 620; }
#guess::placeholder { color: #56677a; font-weight: 500; }
.primary { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 16px; border: 1px solid var(--ink); border-radius: 10px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 760; white-space: nowrap; }
.primary:hover { border-color: #354a65; background: #354a65; }
.board-tools { display: flex; align-items: center; flex-wrap: wrap; column-gap: 14px; margin-top: 6px; }
.reveal-button { font-weight: 650; color: var(--subtle); }
.tries { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--subtle); font-size: 12px; font-weight: 650; white-space: nowrap; }
.tries > span { margin-left: 4px; }
.tries i { width: 7px; height: 7px; border-radius: 50%; background: #94663b; }
.tries .spent { background: #d8e1eb; }
.feedback { color: var(--accent); font-size: 13px; margin: 0; }
.feedback:not(:empty) { padding-top: 6px; }
.feedback.error { color: #923941; }
.link-hint { margin: 10px 0 0; padding: 8px 11px; border-radius: 7px; background: #f6ead5; color: #654420; font-size: 13px; }
.link-hint strong { margin-right: 4px; }
.round-result { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 17px; padding: 11px; border-radius: 11px; color: #294d69; background: #e6eff8; }
.round-result p { margin: 2px 0 0; font-size: 13px; }
.round-revealed { color: #795218; background: #f6ead5; }
.end-screen { padding-bottom: 17px; }
.end-screen .chain-art { max-width: 530px; margin: 4px auto 0; }
.end-score { font-size: 52px; font-weight: 800; letter-spacing: -.06em; line-height: 1.08; }
.end-score span { color: #ddc095; font-size: 22px; letter-spacing: -.04em; }
.result-links { display: flex; justify-content: center; gap: 6px; margin-top: 0; }
.result-links span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--brass); color: #4a331d; }
.result-links .shown { color: #e4eaf2; background: #33445c; }
.result-links svg { width: 16px; height: 16px; }
.result-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 15px; margin-top: 16px; }
.result-recap { margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--line); }
.result-recap h3 { margin: 0 0 6px; font-size: 15px; }
.result-recap ol { margin: 0; padding-inline-start: 22px; font-size: 13px; }
.result-recap li { padding: 5px 0; }
.result-recap li::marker, .result-recap small { color: var(--subtle); }
.result-recap li strong { text-transform: uppercase; }
.result-recap li p { margin: 2px 0 0; color: var(--subtle); }
.back-today { display: inline-flex; text-decoration: none; margin-top: 13px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--white); color: var(--accent); font-size: 13px; font-weight: 650; }
.back-today:hover { background: var(--wash); }

.site-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 9px 20px; padding: 23px 0; margin-top: 20px; color: var(--subtle); font-size: 12px; }
.site-footer nav { display: flex; flex-wrap: wrap; column-gap: 14px; }
.site-footer .text-button { min-height: 44px; }

dialog { width: min(490px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 23px; border: 0; border-radius: 15px; background: var(--white); color: var(--ink); box-shadow: 0 12px 32px #19294333; }
dialog::backdrop { background: #192439d0; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dialog-head h2 { margin: 0; font-size: 27px; letter-spacing: -.035em; }
.close-button { width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--wash); color: var(--ink); font-size: 24px; line-height: 1; }
.close-button:hover { background: #d5e2ef; }
#dialog-body p, #dialog-body li { font-size: 14px; }
#dialog-body > p:last-child { margin-bottom: 0; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stats-grid > div { padding: 10px 4px; border-radius: 8px; background: var(--wash); text-align: center; }
.stats-grid dt { font-size: 12px; }
.stats-grid dd { margin: 3px 0 0; font: 800 25px/1 var(--mono); }
.share-text { width: 100%; min-height: 100px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); }
.no-script { margin: 0; }

@media (max-width: 960px) {
  .site-shell { width: min(100% - 48px, 1136px); }
  .play-layout { grid-template-columns: minmax(248px, .67fr) minmax(0, 1.2fr); gap: 28px; }
  .game { padding: 17px; }
  .board-area { padding-inline: 13px; }
}

@media (max-width: 740px) {
  .site-shell { width: min(100% - 36px, 550px); }
  .header-inner { min-height: 63px; }
  nav { gap: 3px; }
  .edition { margin: 12px 0 6px; }
  .play-layout { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .intro { padding-top: 0; }
  h1 { margin-bottom: 8px; font-size: clamp(40px, 8.2vw, 60px); }
  h1 br { display: none; }
  .intro h1 { margin: 0; font-size: clamp(26px, 6.8vw, 38px); }
  .intro .lede, .intro .free-modes, .intro .lock-entry { display: none; }
  .game { border-radius: 17px; }
  .site-footer { margin-top: 16px; padding-block: 15px; }
}

@media (max-width: 440px) {
  .site-shell { width: calc(100% - 28px); }
  .brand { gap: 6px; font-size: 21px; }
  .brand img { width: 32px; height: 32px; }
  .header-action { width: 44px; min-height: 44px; padding: 0; }
  .header-action > span { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  .edition { gap: 7px; }
  .edition-line { width: 12px; }
  h1 { font-size: clamp(33px, 9vw, 44px); }
  .game { padding: 13px; }
  .game-meta { margin-bottom: 9px; }
  .progress { margin-bottom: 9px; }
  .progress li { gap: 5px; font-size: 12px; }
  .board-area { padding: 17px 8px 12px; }
  .board-area > p { font-size: 12px; }
  .word-chain { margin-top: 4px; }
  .word-tile { min-height: 52px; }
  .relay .word-tile { min-height: 60px; }
  .word-tile > span { letter-spacing: 0; overflow-wrap: anywhere; }
  .primary { padding-inline: 10px; font-size: 13px; }
  #guess { min-height: 48px; padding-inline: 10px; }
  #guess-form { margin-top: 11px; }
  .board-tools { column-gap: 8px; }
  .round-result { padding: 8px; }
  .round-result p { font-size: 12px; }
}

@media (max-width: 365px) {
  .header-inner { gap: 7px; }
  .brand { font-size: 19px; }
  .brand img { width: 30px; height: 30px; }
  .header-action { width: 36px; }
}

.main-nav { flex: 1; flex-wrap: wrap; justify-content: flex-end; gap: 2px 6px; }
.main-nav a { display: inline-flex; align-items: center; min-height: 40px; padding-inline: 8px; border-radius: 6px; color: var(--ink); font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.main-nav a:hover { text-decoration: underline; text-underline-offset: 3px; }
.main-nav a[aria-current="page"] { background: var(--wash); color: var(--accent); }

.play-rules { margin-top: clamp(28px, 5vw, 56px); padding: 22px 0 4px; border-top: 1px solid var(--line); }
.play-rules h2 { margin: 0 0 16px; font-size: clamp(23px, 3vw, 30px); letter-spacing: -.025em; line-height: 1.15; }
.play-rules ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 28px; margin: 0; padding-inline-start: 23px; }
.play-rules li { padding-inline-start: 3px; }
.play-rules li::marker { color: var(--accent); font-weight: 750; }
.play-rules h3 { margin: 0 0 5px; font-size: 16px; line-height: 1.3; }
.play-rules p { margin: 0; color: var(--subtle); font-size: 14px; }
.play-rules .rules-intro { max-width: 78ch; margin-bottom: 16px; }
.play-rules .rules-note { max-width: 78ch; margin-top: 16px; }

@media (max-width: 960px) {
  .header-inner { flex-wrap: wrap; padding-block: 10px 7px; row-gap: 2px; }
  .header-inner .stats-action { margin-left: auto; }
  .main-nav { order: 1; flex: 1 0 100%; justify-content: flex-start; gap: 1px 3px; }
  .main-nav a { min-height: 38px; padding-inline: 7px; }
}

@media (max-width: 640px) {
  .play-rules ol { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 440px) {
  .main-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px 2px; }
  .main-nav a { justify-content: center; min-height: 44px; padding-inline: 0; font-size: 12px; }
}
