/* LIGHT LASSO — a moonlit field, a single luminous thread. */
:root {
  color-scheme: dark;
  --ground: #101d26;
  --panel: #172b32;
  --raised: #1e353b;
  --ink: #e5e9d8;
  --muted: #a4b9b8;
  --mint: #a6e4c8;
  --lime: #d0eaa2;
  --gold: #e5c785;
  --coral: #f19a87;
  --line: #3b5156;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --board-height: max(365px, calc(100vh - 360px));
  --board-height: max(365px, calc(100svh - 360px));
}
* { box-sizing: border-box; }
html { min-width: 280px; min-height: 100%; background: var(--ground); }
body { margin: 0; color: var(--ink); font: 16px/1.5 var(--sans); background: radial-gradient(ellipse at 86% 34%, #243f3926 0, transparent 58%), radial-gradient(ellipse at 0 80%, #2a464126 0, transparent 55%); -webkit-tap-highlight-color: transparent; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .18; background-image: radial-gradient(#a6e4c8 0.55px, transparent .75px); background-size: 7px 7px; mask-image: linear-gradient(100deg, #000, transparent 75%); }
button, a { touch-action: manipulation; }
button { font: inherit; }
button, a, canvas { -webkit-tap-highlight-color: #a6e4c830; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, canvas:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
button:focus:not(:focus-visible), a:focus:not(:focus-visible), canvas:focus:not(:focus-visible) { outline: none; }
button, a { transition: background-color .16s ease, border-color .16s ease, color .16s ease; }
a { color: inherit; }
p, h1, h2 { margin: 0; }
[hidden] { display: none !important; }
.site-shell { width: min(1176px, 100%); min-height: 100vh; min-height: 100svh; margin: 0 auto; padding: max(22px, env(safe-area-inset-top)) max(40px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(40px, env(safe-area-inset-left)); display: flex; flex-direction: column; }
.site-header { min-height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.home-link { display: inline-flex; align-items: center; gap: 10px; min-height: 36px; text-decoration: none; font-size: 14px; font-weight: 600; letter-spacing: -.015em; }
.home-link > span { color: var(--mint); font-size: 22px; font-weight: 400; }
.home-link:hover { color: var(--mint); }
.edition, .eyebrow, .section-label, .meadow-label, .stat-label, .panel-eyebrow, .site-footer { font-family: var(--mono); font-size: 12px; line-height: 1.5; letter-spacing: .065em; }
.edition { color: var(--muted); display: flex; align-items: center; gap: 10px; }
.edition-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 15px #e5c78535; }
.game-layout { flex: 1; display: grid; grid-template-columns: minmax(260px, 338px) minmax(0, 1fr); gap: clamp(40px, 7vw, 94px); align-items: center; padding-block: 16px 14px; }
.editorial { position: relative; align-self: center; padding: 2px 0; }
.eyebrow { color: var(--gold); margin-bottom: 20px; }
h1 { font-size: clamp(78px, 7.2vw, 100px); font-weight: 850; letter-spacing: -.075em; line-height: .84; }
h1 > span { display: block; width: max-content; }
h1 > span:first-child { color: var(--ink); }
.title-lasso { color: var(--mint); position: relative; margin-top: 8px; }
.title-loop { position: absolute; width: 117%; height: 160%; top: -32%; left: -8%; pointer-events: none; stroke: var(--mint); stroke-width: 1; opacity: .4; transform: rotate(-10deg); }
.tagline { font-family: var(--serif); font-size: clamp(22px, 2.2vw, 28px); font-style: italic; line-height: 1.3; margin-top: 28px; color: #cbd8c9; }
.field-notes { margin-top: clamp(22px, 3.6vh, 38px); }
.section-label { display: flex; justify-content: space-between; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }
.section-label > span:last-child { color: var(--gold); }
.instructions { font-size: 15px; line-height: 1.55; margin-top: 14px; color: var(--ink); }
.steps { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 15px; }
.steps li { display: flex; gap: 13px; align-items: center; }
.step-mark { flex: 0 0 37px; height: 37px; color: var(--mint); }
.step-mark svg { display: block; width: 100%; height: 100%; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.step-mark circle:not([stroke-dasharray]) { fill: currentColor; stroke: none; }
.ember-mark { color: var(--coral); }
.steps strong, .steps li > span > span { display: block; }
.steps strong { font-size: 14px; font-weight: 600; }
.steps li > span > span { color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: 2px; }
.scoring-note { margin-top: 27px; font-size: 24px; font-family: var(--serif); line-height: 1.22; letter-spacing: -.02em; }
.scoring-note em { color: var(--gold); font-weight: 400; }
.sidebar-note { font-size: 12px; color: var(--muted); margin-top: 27px; }
.sidebar-note > span { color: var(--gold); padding-right: 5px; }
.play-area { width: min(100%, calc(var(--board-height) * 720 / 820)); min-width: 0; justify-self: center; }
.meadow-label { display: flex; justify-content: space-between; gap: 12px; align-items: center; color: var(--muted); margin-bottom: 9px; min-height: 20px; }
#daily-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-label { color: var(--mint); font-size: 12px; white-space: nowrap; }
.live-label > span { font-size: 15px; padding-right: 3px; }
.scoreboard { display: grid; grid-template-columns: 1.15fr 1fr 1fr 1.15fr; background: var(--panel); border: 1px solid var(--line); border-bottom: 0; border-radius: 13px 13px 0 0; min-height: 69px; padding: 10px 0 11px; }
.stat { display: flex; flex-direction: column; padding-inline: 18px 10px; gap: 1px; border-left: 1px solid var(--line); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat-label { color: var(--muted); font-size: 12px; line-height: 1.25; }
.stat-value { font-family: var(--mono); font-size: clamp(23px, 2.5vw, 30px); line-height: 1.2; letter-spacing: -.07em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stat-score .stat-value { color: var(--lime); }
.stat-best .stat-value { color: var(--gold); }
.stat-unit { font-size: 15px; color: var(--muted); margin-left: 3px; }
.board { position: relative; isolation: isolate; aspect-ratio: 720 / 820; width: 100%; background: radial-gradient(ellipse at 50% 25%, #203d37 0, #172d30 45%, #122730 100%); border: 1px solid var(--line); border-radius: 0 0 3px 3px; overflow: hidden; box-shadow: 0 24px 60px #071b212b; }
#field { display: block; position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; cursor: crosshair; }
#field:focus-visible { outline-offset: -5px; }
.board-corner { position: absolute; z-index: 2; width: 14px; height: 14px; pointer-events: none; opacity: .7; }
.corner-top { left: 12px; top: 12px; border-left: 1px solid var(--mint); border-top: 1px solid var(--mint); }
.corner-bottom { right: 12px; bottom: 12px; border-right: 1px solid var(--mint); border-bottom: 1px solid var(--mint); }
.overlay { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; padding: clamp(16px, 3vw, 32px); background: #14282feF; overflow-y: auto; }
.intro-overlay { background: radial-gradient(ellipse at 50% 20%, #263f3875, transparent 55%), #14292fe8; }
.panel { flex: 0 0 auto; width: 100%; max-width: 310px; margin-block: auto; text-align: center; }
.intro-art { width: min(200px, 70%); height: auto; display: block; margin: -12px auto 5px; }
.art-orbit, .art-tail { stroke: var(--mint); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.art-orbit { stroke-dasharray: 3 4 180; }
.art-halo { fill: var(--lime); opacity: .045; }
.art-light { fill: var(--lime); }
.small-light { fill: var(--gold); }
.art-ember { stroke: var(--coral); stroke-width: 2; stroke-linecap: round; }
.art-twinkle { stroke: var(--mint); stroke-width: 1; opacity: .7; }
.panel-eyebrow { font-size: 12px; color: var(--gold); margin-bottom: 12px; letter-spacing: .04em; }
h2 { font-size: clamp(25px, 2.65vw, 34px); line-height: 1.13; font-weight: 600; letter-spacing: -.045em; }
h2 em { display: inline-block; color: var(--mint); font-family: var(--serif); font-weight: 400; letter-spacing: -.035em; }
.panel-copy { margin-top: 15px; font-size: 14px; line-height: 1.5; color: #c5d4c9; }
.ember-symbol { color: var(--coral); font-size: 20px; line-height: 0; font-weight: 600; }
.panel-actions { display: grid; gap: 9px; margin-top: 26px; }
.button { display: flex; align-items: center; justify-content: center; gap: 20px; width: 100%; min-height: 46px; border: 1px solid transparent; border-radius: 5px; padding: 11px 18px; font-size: 15px; font-weight: 650; line-height: 1.3; }
.button > span { font-weight: 400; font-size: 21px; line-height: 1; }
.primary-button { color: #19302d; background: var(--lime); border-color: var(--lime); box-shadow: 0 2px 0 #13262c; }
.primary-button:hover { background: #e0f4be; border-color: #e0f4be; }
.primary-button:active { background: #b9d68b; }
.secondary-button { color: var(--ink); background: #1e353b; border-color: #536d6d; font-weight: 500; }
.secondary-button:hover { background: #29464b; border-color: var(--mint); }
.panel-footnote { margin-top: 17px; font-size: 12px; line-height: 1.4; color: var(--muted); }
.result-star { display: block; color: var(--gold); font-size: 43px; line-height: 1; margin-bottom: 14px; }
.result-points { display: grid; justify-content: center; margin-top: 16px; gap: 0; }
.result-points > span:first-child { color: var(--lime); font: 500 clamp(40px, 6vw, 68px)/1.05 var(--mono); letter-spacing: -.08em; }
.result-points > span:last-child { font: 12px/1.5 var(--mono); color: var(--muted); letter-spacing: .16em; margin-top: 5px; }
.result-best { margin-top: 8px; font-size: 13px; color: var(--gold); }
.result-panel .panel-copy { margin-top: 13px; }
.result-panel .panel-actions { margin-top: 20px; }
.pause-moon { display: block; font-family: var(--serif); color: var(--gold); font-size: 64px; line-height: 1; margin-bottom: 20px; }
.help-panel { text-align: left; max-width: 350px; }
.help-panel h2 br { display: none; }
.help-notes { display: grid; gap: 14px; margin-block: 22px; }
.help-notes dt { font-size: 14px; font-weight: 650; color: var(--ink); }
.help-notes dd { margin: 4px 0 0; color: #bdcdc7; font-size: 13px; line-height: 1.45; }
.thread-meter { display: flex; align-items: center; gap: 10px; min-height: 26px; }
.thread-track { flex: 1; height: 3px; background: var(--line); overflow: hidden; border-radius: 4px; }
#thread-fill { display: block; height: 100%; width: 100%; background: var(--mint); transform-origin: left center; }
#thread-label { color: var(--muted); font: 12px/1.4 var(--mono); white-space: nowrap; }
.board-toolbar { display: grid; grid-template-columns: .8fr .9fr 1fr 1.2fr; gap: 6px; }
.tool-button { min-width: 0; min-height: 40px; padding: 8px 5px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 4px; font-size: 13px; line-height: 1.2; }
.tool-button:disabled { color: #94aaa9; background: transparent; border-color: #34484d; }
.tool-button:hover:not(:disabled) { border-color: var(--mint); background: #243f43; }
.tool-button[aria-pressed="true"] { color: var(--lime); border-color: #9aba82; }
.status-row { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.status { color: #bccfc6; font-size: 12px; line-height: 1.35; flex: 1; }
.keyboard-button { flex: 0 0 auto; display: inline-flex; gap: 6px; align-items: center; justify-content: center; padding: 7px 0 7px 7px; min-height: 36px; border: 0; border-radius: 3px; background: transparent; color: var(--muted); font-size: 12px; }
.keyboard-button svg { width: 20px; height: 15px; stroke: currentColor; stroke-width: 1.25; stroke-linecap: round; }
.keyboard-button[aria-pressed="true"], .keyboard-button:hover { color: var(--mint); }
.keyboard-instructions { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.4; }
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--muted); letter-spacing: 0; padding-top: 10px; border-top: 1px solid #33474c; }
.site-footer > span:first-child { font-size: 12px; letter-spacing: .04em; }
.site-footer > span:last-child { text-align: right; font: 12px/1.5 var(--sans); }
.skip-link { position: fixed; z-index: 20; left: 16px; top: -100px; padding: 12px 18px; border-radius: 4px; background: var(--lime); color: #19302d; font-size: 15px; }
.skip-link:focus { top: max(12px, env(safe-area-inset-top)); }
.no-script { position: fixed; inset: 0; z-index: 30; display: grid; align-content: center; gap: 24px; padding: 36px; background: var(--ground); text-align: center; }
.no-script p { max-width: 470px; margin-inline: auto; }
.no-script a { color: var(--mint); padding: 12px; }

@media (min-width: 801px) and (max-height: 860px) {
  :root { --board-height: max(365px, calc(100vh - 345px)); --board-height: max(365px, calc(100svh - 345px)); }
  .site-shell { padding-top: 15px; padding-bottom: 12px; }
  .game-layout { gap: 44px; padding-top: 8px; padding-bottom: 10px; }
  .editorial { padding-block: 0; }
  .eyebrow { margin-bottom: 16px; }
  h1 { font-size: 78px; }
  .tagline { font-size: 23px; margin-top: 23px; }
  .field-notes { margin-top: 20px; }
  .steps { gap: 10px; margin-top: 16px; }
  .scoring-note { font-size: 22px; margin-top: 20px; }
  .sidebar-note { display: none; }
  .intro-art { width: 120px; margin-top: -8px; }
  .intro-panel .panel-actions { margin-top: 16px; }
  .intro-panel .panel-footnote { margin-top: 11px; }
  .panel-eyebrow { margin-bottom: 8px; }
  .result-star { font-size: 28px; margin-bottom: 9px; }
  .result-panel h2 { font-size: 25px; }
  .result-points { margin-top: 10px; }
  .result-points > span:first-child { font-size: 42px; }
  .result-panel .panel-actions { margin-top: 12px; }
}

@media (max-width: 800px) {
  :root { --board-height: calc(100vh - 335px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); --board-height: calc(100svh - 335px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .site-shell { width: min(540px, 100%); padding: max(8px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
  .site-header { min-height: 32px; gap: 8px; }
  .home-link { min-height: 32px; font-size: 12px; gap: 6px; }
  .home-link > span { font-size: 19px; }
  .edition { font-size: 12px; letter-spacing: 0; }
  .edition-dot { display: none; }
  .game-layout { display: flex; flex-direction: column; justify-content: center; gap: 14px; padding-block: 8px 10px; }
  .editorial { width: 100%; padding: 0; }
  .title-block { display: flex; justify-content: space-between; align-items: center; gap: 15px; }
  .eyebrow, .field-notes, .sidebar-note { display: none; }
  h1 { display: flex; gap: .16em; font-size: clamp(31px, 7.4vw, 40px); line-height: 1; white-space: nowrap; }
  .title-lasso { margin-top: 0; }
  .title-loop { width: 116%; height: 160%; top: -29%; }
  .tagline { font-size: 14px; line-height: 1.17; margin: 0; text-align: right; }
  .play-area { width: min(100%, calc(var(--board-height) * 720 / 820)); }
  .meadow-label { font-size: 12px; margin-bottom: 6px; gap: 6px; }
  .live-label { font-size: 12px; letter-spacing: 0; }
  .scoreboard { min-height: 61px; padding-block: 9px; border-radius: 9px 9px 0 0; }
  .stat { padding-inline: 13px 8px; }
  .stat-label { font-size: 12px; }
  .stat-value { font-size: 26px; }
  .stat-unit { font-size: 14px; }
  .overlay { padding: 20px; }
  .panel { max-width: 280px; }
  .intro-art { display: none; }
  .panel-eyebrow { font-size: 12px; margin-bottom: 9px; }
  h2 { font-size: 28px; }
  .panel-copy { font-size: 13px; margin-top: 12px; }
  .panel-actions { margin-top: 20px; gap: 8px; }
  .button { min-height: 44px; padding-block: 10px; font-size: 14px; }
  .panel-footnote { margin-top: 12px; font-size: 12px; }
  .thread-meter { min-height: 25px; }
  .tool-button { min-height: 44px; font-size: 12px; }
  .status-row { min-height: 44px; gap: 6px; }
  .keyboard-button { min-height: 44px; }
  .status { font-size: 12px; }
  .keyboard-instructions { font-size: 12px; line-height: 1.35; }
  .site-footer { flex-wrap: wrap; justify-content: center; gap: 3px; padding-top: 8px; text-align: center; }
  .site-footer > span:first-child { display: none; }
  .site-footer > span:last-child { text-align: center; font-size: 12px; }
  .result-star { font-size: 28px; margin-bottom: 9px; }
  .result-points { margin-top: 12px; }
  .result-points > span:first-child { font-size: 45px; }
  .result-panel .panel-actions { margin-top: 16px; }
  .result-best { font-size: 12px; }
  .help-panel h2 { font-size: 27px; }
  .help-notes { gap: 12px; margin-block: 18px; }
}

/* Compact phones: keep the complete field, controls and HUD in view. */
@media (max-width: 800px) and (max-height: 760px) {
  :root { --board-height: calc(100vh - 330px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); --board-height: calc(100svh - 330px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .game-layout { gap: 10px; padding-block: 5px 8px; }
  .site-header { min-height: 28px; }
  .edition { font-size: 12px; }
  .tagline { display: none; }
  .title-block { justify-content: center; }
  h1 { font-size: 32px; }
  .scoreboard { min-height: 55px; padding-block: 7px; }
  .stat-value { font-size: 24px; }
  .keyboard-instructions { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .intro-art { display: none; }
  h2 { font-size: 25px; }
  .panel-eyebrow { margin-bottom: 7px; }
  .panel-copy { margin-top: 10px; }
  .panel-actions { margin-top: 16px; }
  .panel-footnote { margin-top: 10px; }
  .result-panel h2 { font-size: 24px; }
  .result-star { display: none; }
  .result-points > span:first-child { font-size: 39px; }
  .result-panel .panel-copy { margin-top: 9px; }
  .result-panel .panel-actions { margin-top: 13px; }
  .help-panel h2 { font-size: 25px; }
  .help-panel .panel-eyebrow { display: none; }
  .help-notes { gap: 10px; margin-block: 14px; }
  .help-notes dt { font-size: 13px; }
  .help-notes dd { font-size: 12px; line-height: 1.35; }
  .site-footer { padding-top: 5px; }
}

/* At browser zoom or very short heights, allow natural page scrolling. */
@media (max-height: 590px) {
  :root { --board-height: 365px; }
  .site-shell { min-height: 100vh; }
  .game-layout { flex: 0 0 auto; align-items: start; }
  .play-area { width: min(100%, calc(var(--board-height) * 720 / 820)); }
  .intro-art { display: none; }
  .intro-panel .panel-actions { margin-top: 16px; }
  .overlay { padding: 18px; }
  .result-star { display: none; }
  .help-panel { align-self: start; }
}
@media (max-width: 360px) {
  .site-shell { padding-inline: max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-right)); }
  .edition { font-size: 12px; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stat { padding-inline: 11px 5px; }
  .overlay { padding: 16px; }
  .panel-eyebrow { font-size: 12px; letter-spacing: 0; }
  .live-label { font-size: 12px; }
  .live-label > span { display: none; }
  .status { font-size: 12px; }
  .keyboard-button { gap: 4px; }
  .storage-note { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (prefers-contrast: more) {
  :root { --muted: #c1d2ce; --line: #8baca5; }
  .title-loop { opacity: .75; }
  .overlay { background: var(--panel); }
  .tool-button:disabled { color: #b3c5c0; border-style: dashed; }
}
@media (forced-colors: active) {
  body::before, .title-loop, .intro-art, .board-corner { display: none; }
  .board, .scoreboard, .tool-button, .button { border: 1px solid CanvasText; }
  .overlay, .no-script { background: Canvas; }
  .stat { border-color: CanvasText; }
  .thread-track { background: GrayText; }
  #thread-fill { background: Highlight; }
  .primary-button { background: ButtonFace; color: ButtonText; }
  button:focus-visible, a:focus-visible, canvas:focus-visible { outline-color: Highlight; }
}

.stat-chain { position: relative; }
.chain-track { position: absolute; left: 18px; right: 16px; bottom: -5px; height: 2px; background: #3b5156; overflow: hidden; }
#chain-fill { display: block; width: 0%; height: 100%; background: var(--gold); }
@media (max-width: 800px) { .chain-track { left: 13px; right: 12px; bottom: -3px; } }

@media (min-width: 801px) and (max-height: 760px) { .intro-art { display: none; } }
