:root {
  color-scheme: light;
  --ink: #171b23;
  --paper: #f1f1ec;
  --paper-2: #e5e5df;
  --rule: rgba(23, 27, 35, .2);
  --red: #e53b2c;
  --cyan: #26a6c5;
  --violet: #6f65c9;
  --green: #35a36f;
  --yellow: #e5c835;
  --display: "Arial Black", "PingFang SC", "Microsoft YaHei", sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--body);
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(23,27,35,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23,27,35,.035) 1px, transparent 1px);
  background-size: 24px 24px;
  overscroll-behavior: none;
}
.boot { margin: 45vh 0 0; text-align: center; font-family: var(--display); font-size: 42px; }
.boot-copy { margin: 8px 0 0; text-align: center; font-size: 13px; font-weight: 800; }
button, input { font: inherit; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }

.shell { width: min(1180px, 100%); min-height: 100vh; margin: 0 auto; padding: 24px clamp(16px, 4vw, 44px) 18px; display: grid; grid-template-rows: auto 1fr auto; }
.topbar { min-height: 62px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-bottom: 2px solid var(--ink); }
.brand { display: flex; align-items: baseline; font-family: var(--display); font-size: clamp(29px, 4vw, 42px); letter-spacing: -.045em; line-height: .9; user-select: none; }
.brand .fold { color: var(--red); }
.brand-mark { margin-left: 7px; font-size: .28em; letter-spacing: 0; }
.season-line { font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.top-actions { justify-self: end; display: flex; gap: 6px; }
.icon-btn, .quiet-btn, .solid-btn, .mode-btn, .leader-link { border: 0; color: inherit; cursor: pointer; }
.icon-btn { width: 34px; height: 32px; padding: 0; border: 1px solid var(--ink); border-radius: 1px; background: var(--paper); font-size: 12px; font-weight: 900; }
.icon-btn:hover { background: var(--ink); color: #fff; }

.game-layout { display: grid; grid-template-columns: minmax(190px, 215px) minmax(340px, 520px) minmax(160px, 190px); justify-content: center; align-items: center; gap: clamp(22px, 3.8vw, 50px); padding: 28px 0 22px; }
.left-rail, .right-rail { min-width: 0; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--ink); margin-bottom: 22px; }
.mode-btn { min-height: 36px; padding: 7px 8px; background: transparent; font-size: 13px; font-weight: 800; }
.mode-btn + .mode-btn { border-left: 1px solid var(--ink); }
.mode-btn.active { background: var(--ink); color: #fff; }
.stat { display: grid; grid-template-columns: 54px 1fr; align-items: end; border-top: 1px solid var(--ink); padding: 7px 0 9px; }
.stat-label { padding-bottom: 4px; font-size: 11px; font-weight: 800; }
.stat-value { text-align: right; font-family: var(--display); font-size: clamp(28px, 3.4vw, 40px); font-variant-numeric: tabular-nums; line-height: 1; }
.daily-note { min-height: 32px; margin: 6px 0 16px; font-size: 11px; line-height: 1.4; }
.daily-sheet { border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); padding: 10px 0 8px; }
.daily-sheet.inactive { opacity: .48; }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.sheet-head h2 { margin: 0; font-size: 15px; }
.sheet-head strong { color: var(--red); font-family: var(--display); font-size: 18px; }
.mission-list { list-style: none; margin: 0; padding: 0; }
.mission-list li { display: flex; justify-content: space-between; padding: 5px 0; border-top: 1px dotted var(--rule); font-size: 12px; }
.mission-list li b { font-size: 13px; }
/* deslop-ignore-next-line 09 — a completed task is genuinely crossed out */
.mission-list li.done span { text-decoration: line-through; text-decoration-thickness: 1px; opacity: .55; }
.mission-list li.done b { color: var(--red); }
.streak-line { display: flex; justify-content: space-between; margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--ink); font-size: 12px; }
.streak-line strong { font-variant-numeric: tabular-nums; }
.daily-nudge { margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--ink); }
.daily-nudge[hidden] { display: none; }
.daily-nudge span { display: block; margin-bottom: 7px; font-size: 11px; line-height: 1.4; }
.daily-nudge button { width: 100%; min-height: 32px; padding: 6px 8px; border: 1px solid var(--ink); border-radius: 1px; background: var(--yellow); color: var(--ink); font-size: 11px; font-weight: 900; cursor: pointer; }
.rail-actions { display: grid; gap: 7px; margin-top: 12px; }
.solid-btn, .quiet-btn { min-height: 43px; padding: 9px 13px; border-radius: 1px; font-weight: 900; }
.solid-btn { background: var(--red); color: #fff; border: 1px solid #a82017; box-shadow: 0 2px 0 #a82017; }
.solid-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 #a82017; }
.quiet-btn { background: var(--paper); border: 1px solid var(--ink); }
.quiet-btn:hover { background: #fff; }
.quiet-btn:disabled { cursor: default; opacity: .46; }
#submitBtn.attention { border-color: var(--red); color: var(--red); box-shadow: inset 4px 0 0 var(--red); opacity: 1; }

.play-area { width: 100%; }
.game-line { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 10px; }
.game-line h1 { margin: 0; font-family: var(--display); font-size: clamp(28px, 4vw, 43px); letter-spacing: -.035em; line-height: .95; }
.game-line p { margin: 0 1px 2px; font-size: 11px; font-weight: 700; text-align: right; }
.board-wrap { position: relative; }
.board { width: 100%; aspect-ratio: 1; padding: clamp(8px, 2.2vw, 14px); display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(6px, 1.7vw, 10px); background: var(--ink); border: 2px solid var(--ink); border-radius: 2px; touch-action: none; user-select: none; }
.cell { position: relative; min-width: 0; aspect-ratio: 1; overflow: hidden; border-radius: 1px; background: rgba(255,255,255,.08); }
.tile { position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit; color: var(--ink); font-family: var(--display); font-size: clamp(25px, 7vw, 49px); font-variant-numeric: tabular-nums; letter-spacing: -.045em; box-shadow: inset 0 -3px rgba(23,27,35,.14); animation: tile-in 110ms ease-out; }
.v1, .v9 { background: var(--red); color: #fff; }
.v2, .v8 { background: var(--cyan); }
.v3, .v7 { background: var(--violet); color: #fff; }
.v4, .v6 { background: var(--green); }
.v5 { background: var(--yellow); }
.tier1 { background: #f5f0da; color: var(--red); }
.tier2 { background: #e9cc42; }
.tier3 { background: #e5953b; }
.tier4 { background: #e64b34; color: #fff; }
.tier5 { background: #765dbd; color: #fff; }
.tier6 { background: #31a7bd; }
.tier7 { background: #afd641; }
.tier8 { background: #fff; box-shadow: inset 0 0 0 4px var(--yellow); }
.board.moved { animation: board-nudge 140ms ease-out; }
.toast { position: absolute; left: 50%; bottom: 14px; z-index: 8; transform: translate(-50%, 8px); padding: 8px 12px; border: 2px solid var(--ink); border-radius: 1px; background: #fff; font-size: 12px; font-weight: 900; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .16s ease, transform .16s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.match-slip { border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); padding: 12px 0; }
.match-slip h2 { margin: 0 0 10px; font-family: var(--display); font-size: 18px; }
.match-slip dl { margin: 0 0 12px; }
.match-slip dl div { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px dotted var(--rule); }
.match-slip dt { font-size: 11px; }
.match-slip dd { margin: 0; font-family: var(--display); font-size: 15px; font-variant-numeric: tabular-nums; }
.pair-key { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--ink); padding-top: 9px; gap: 4px 12px; }
.pair-key span { font-size: 12px; font-weight: 900; }
.pair-key span:last-child { grid-column: 1 / -1; }
.match-slip p { margin: 12px 0; font-size: 12px; line-height: 1.45; }
.leader-link { padding: 0 0 2px; border-bottom: 2px solid var(--red); background: none; font-weight: 900; }
.foot { display: flex; justify-content: center; gap: 18px; border-top: 1px solid var(--ink); padding-top: 12px; font-size: 11px; }
.foot button { border: 0; padding: 0; background: none; color: inherit; cursor: pointer; }
.foot button:hover { color: var(--red); }

.overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 18px; background: rgba(17,20,26,.8); }
.overlay[hidden] { display: none; }
.modal { width: min(430px, 100%); max-height: 92vh; overflow: auto; padding: 26px; border: 2px solid var(--ink); border-radius: 2px; background: var(--paper); box-shadow: 7px 7px 0 rgba(0,0,0,.3); text-align: center; }
.modal h2 { margin: 0 0 5px; font-family: var(--display); font-size: 34px; letter-spacing: -.03em; }
.modal-context { margin: 0 0 12px; color: var(--red); font-size: 11px; font-weight: 800; }
.modal-context:empty { display: none; }
.modal p { line-height: 1.5; }
/* deslop-ignore-next-line 11 — this is a short numeric score, not a sentence headline */
.modal-score { margin: 12px 0 18px; font-family: var(--display); font-size: 56px; font-variant-numeric: tabular-nums; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.full-action { grid-column: 1 / -1; }
.modal.share-modal { width: min(470px, 100%); padding: 18px; }
.share-modal h2 { margin-bottom: 10px; font-size: 28px; }
.share-modal .modal-score { display: none; }
.share-canvas { display: block; width: min(100%, 330px); height: auto; margin: 0 auto 16px; border: 1px solid var(--ink); background: var(--paper); }

.modal.leader-modal { width: min(560px, 100%); padding: 22px; text-align: left; }
.leader-modal .modal-context, .leader-modal h2 { text-align: center; }
.leader-modal .modal-score { display: none; }
.leader-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 10px; border: 1px solid var(--ink); }
.leader-community { min-height: 16px; margin: 0 0 8px !important; text-align: center; font-size: 10px; opacity: .6; }
.leader-list { min-height: 230px; max-height: min(42vh,390px); overflow: auto; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.leader-row { min-height: 52px; display: grid; grid-template-columns: 32px minmax(0,1fr) auto 46px; align-items: center; gap: 9px; padding: 5px 3px; border-bottom: 1px solid var(--rule); }
.leader-row:last-child { border-bottom: 0; }
.leader-row.podium { background: rgba(229,200,53,.16); }
.leader-row .rank { text-align: center; font-family: var(--display); }
.leader-row.p1 .rank { color: var(--red); font-size: 20px; }
.leader-name { min-width: 0; overflow: hidden; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.leader-name small { display: block; font-size: 10px; font-weight: 600; opacity: .55; }
.leader-row strong { font-family: var(--display); font-size: 17px; }
.leader-max { padding: 3px; background: var(--ink); color: #fff; text-align: center; font-size: 10px; font-weight: 900; }
.leader-empty { min-height: 230px; display: grid; place-items: center; margin: 0; text-align: center; opacity: .6; }
.leader-submit { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; margin-top: 12px; }
.leader-submit input { min-width: 0; padding: 8px 10px; border: 2px solid var(--ink); border-radius: 1px; background: #fff; color: var(--ink); font-weight: 800; }
.leader-submit button:disabled, .season-modal button:disabled { cursor: wait; opacity: .55; }
.leader-proof { margin: 8px 0 14px; text-align: center; font-size: 10px; opacity: .55; }

.modal.season-modal { width: min(560px,100%); text-align: left; }
.season-modal .modal-context, .season-modal h2 { text-align: center; }
.season-modal .modal-score { display: none; }
.season-summary { display: grid; grid-template-columns: repeat(3,1fr); border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.season-summary div { padding: 11px 8px; text-align: center; }
.season-summary div + div { border-left: 1px solid var(--ink); }
.season-summary span { display: block; font-size: 10px; }
.season-summary strong { font-family: var(--display); font-size: 34px; }
.season-summary small { margin-left: 2px; }
.stamp-strip { display: grid; grid-template-columns: repeat(7,1fr); margin: 16px 0 20px; border: 1px solid var(--ink); }
.stamp-day { min-width: 0; padding: 7px 2px; border-right: 1px solid var(--ink); text-align: center; }
.stamp-day:last-child { border-right: 0; }
.stamp-day b { display: block; font-size: 10px; }
.stamp-day i { display: block; min-height: 24px; margin-top: 4px; color: var(--rule); font-family: var(--display); font-size: 20px; font-style: normal; }
.stamp-day.done i { color: var(--red); }
.club-offer { margin-bottom: 18px; padding: 13px 0; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.club-offer h3 { margin: 0 0 4px; font-family: var(--display); font-size: 17px; }
.club-offer p { margin: 0; font-size: 13px; }
.club-email { display: block; margin-top: 14px; }
.club-email span { display: block; margin-bottom: 5px; font-size: 11px; font-weight: 900; }
.club-email input { width: 100%; min-height: 40px; padding: 8px 10px; border: 2px solid var(--ink); border-radius: 1px; background: #fff; color: var(--ink); }
.club-consent { display: grid; grid-template-columns: 18px 1fr; align-items: start; gap: 8px; margin-top: 10px; font-size: 11px; line-height: 1.45; }
.club-consent input { width: 16px; height: 16px; margin: 0; accent-color: var(--red); }
.club-offer small { display: block; margin: 8px 0 0 26px; opacity: .56; font-size: 10px; }
.club-remove { margin: 10px 0 0 26px; padding: 0 0 2px; border: 0; border-bottom: 1px solid var(--ink); background: transparent; color: inherit; font-size: 10px; cursor: pointer; }

.seo-content { width: min(1080px, calc(100% - 32px)); margin: 0 auto 72px; padding-top: 46px; border-top: 2px solid var(--ink); }
.seo-intro { display: grid; grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr); column-gap: 42px; align-items: start; }
.seo-kicker { grid-column: 1 / -1; margin: 0 0 12px; color: var(--red); font-size: 11px; font-weight: 900; letter-spacing: .12em; }
.seo-intro h2 { margin: 0; font-family: var(--display); font-size: clamp(28px, 4.4vw, 51px); letter-spacing: -.04em; line-height: .98; }
.seo-intro > p:last-child { margin: 2px 0 0; font-size: 17px; line-height: 1.65; }
.seo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 42px; border-top: 1px solid var(--ink); border-left: 1px solid var(--ink); }
.seo-grid article { min-width: 0; padding: 25px 28px 28px; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.seo-grid h3 { margin: 0 0 12px; font-family: var(--display); font-size: 20px; }
.seo-grid p, .seo-grid li, .seo-faq dd { font-size: 14px; line-height: 1.65; }
.seo-grid p, .seo-grid ol { margin: 0; }
.seo-grid ol { padding-left: 21px; }
.seo-faq { margin: 0; }
.seo-faq dt { margin-top: 11px; font-size: 13px; font-weight: 900; }
.seo-faq dt:first-child { margin-top: 0; }
.seo-faq dd { margin: 3px 0 0; }
.seo-faq a { color: var(--red); font-weight: 800; text-underline-offset: 3px; }

@keyframes tile-in { from { transform: scale(.78); opacity: .35; } }
@keyframes board-nudge { 50% { transform: translateY(1px); } }
.celebration-canvas { position: fixed; inset: 0; z-index: 60; width: 100%; height: 100%; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } .celebration-canvas { display: none; } }

@media (max-width: 880px) {
  .shell { display: block; padding-top: 14px; }
  .topbar { margin-bottom: 18px; }
  .game-layout { display: flex; flex-direction: column; gap: 18px; padding-top: 0; }
  .play-area { order: 1; width: min(520px,100%); }
  .left-rail { order: 2; width: min(520px,100%); display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; }
  .mode-switch, .daily-note, .daily-sheet, .rail-actions { grid-column: 1 / -1; }
  .mode-switch { margin-bottom: 12px; }
  .daily-sheet { margin-top: 10px; }
  .rail-actions { grid-template-columns: 1fr 1fr; }
  .rail-actions #submitBtn { grid-column: 1 / -1; }
  .right-rail { order: 3; width: min(520px,100%); }
  .match-slip { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; }
  .match-slip h2, .match-slip p, .match-slip .leader-link { grid-column: 1 / -1; }
  .foot { margin-top: 22px; }
  .seo-content { padding-top: 34px; }
  .seo-intro { grid-template-columns: 1fr; }
  .seo-intro > p:last-child { margin-top: 18px; }
}

@media (max-width: 540px) {
  .shell { padding: 11px 12px 16px; }
  .topbar { grid-template-columns: 1fr auto; min-height: 54px; }
  .season-line { display: none; }
  .brand { font-size: 29px; }
  .top-actions { gap: 4px; }
  .icon-btn { width: 31px; height: 30px; }
  .game-line h1 { font-size: 31px; }
  .game-line p { max-width: 130px; }
  .tile { font-size: clamp(24px,11.5vw,44px); }
  .right-rail { display: none; }
  .modal { padding: 21px 16px; }
  .modal.share-modal, .modal.leader-modal { padding: 16px 12px; }
  .share-canvas { width: min(100%,285px); }
  .leader-submit { grid-template-columns: 1fr; }
  .leader-row { grid-template-columns: 29px minmax(0,1fr) auto 40px; gap: 6px; }
  .foot { gap: 14px; }
  .seo-content { width: calc(100% - 24px); margin-bottom: 44px; }
  .seo-grid { grid-template-columns: 1fr; margin-top: 28px; }
  .seo-grid article { padding: 21px 19px 23px; }
}
