:root {
  color-scheme: light;
  --page: #f5f4ee;
  --paper: #fffef8;
  --ink: #172b25;
  --muted: #52635a;
  --green: #205c49;
  --line: #d9ded3;
  --brand-red: #a33d3a;
  --brand-blue: #3a6bac;
  --dg-ink: var(--ink);
}
body.live-page { display: block; height: auto; overflow: auto; margin: 0; background: var(--page); color: var(--ink); font-family: system-ui, sans-serif; }
body.live-page, .live-page :is(button, select, a, .maia-chessboard, #event-moves, #round-rail) { touch-action: manipulation; }
.live-page [hidden] { display: none !important; }
.event-nav { display: flex; align-items: center; gap: .65rem; padding: .35rem max(.8rem, calc((100% - 1136px) / 2)); border-bottom: 1px solid var(--line); white-space: nowrap; }
.event-brand { color: var(--green); font-size: 1.1rem; font-weight: 800; }
.event-nav-link { font-size: .83rem; font-weight: 600; text-decoration: none; padding: .2rem .5rem; border-radius: 6px; border: 1px solid var(--line); background: var(--paper); }
.event-nav-link:hover { border-color: var(--green); }
.event-nav a, .event-source a { color: var(--green); }
.event-main { max-width: 1160px; margin: 0 auto; padding: .45rem .8rem 1rem; }
.event-nav h1 { min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; font-size: .98rem; font-weight: 720; line-height: 1.2; }
.event-nav h1::before { content: '·'; margin-right: .48rem; color: var(--muted); }
.event-status { color: var(--green); font-weight: 650; }
.event-status[data-state="stale"] { color: #874818; }
.match-score { display: flex; gap: .38rem; align-items: center; margin-left: auto; color: var(--muted); font-size: .85rem; }
.match-score strong { color: var(--ink); font-size: 1.08rem; font-variant-numeric: tabular-nums; }
.match-score .score-short, #mobile-gauge-score, .toolbar-icon, #mobile-moment-slot { display: none; }
.round-rail { display: flex; gap: .35rem; overflow-x: auto; padding: .18rem 18px .32rem 2px; margin-bottom: .25rem; scrollbar-width: thin; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 16px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 16px), transparent); }
.round-rail:empty { display: none; }
.live-page .round-rail button { flex: 0 0 auto; display: inline-flex; align-items: center; gap: .35rem; min-height: 28px; padding: .18rem .55rem; border-radius: 999px; font-variant-numeric: tabular-nums; }
.round-rail button span { color: var(--muted); font-size: .75rem; }
.round-rail button strong { white-space: nowrap; font-size: .76rem; }
.live-page .round-rail button[aria-current="true"] { background: #e1eee5; border-color: #789a87; color: #164532; }
.round-rail button[data-status="live"] strong::before { content: ''; display: inline-block; width: .46rem; height: .46rem; margin-right: .32rem; border-radius: 50%; background: #268353; }
.event-layout { display: grid; grid-template-columns: minmax(0, min(60%, clamp(280px, calc(100dvh - 197px), 690px))) minmax(0, 1fr); gap: 1rem; }
.live-page .board-column { min-width: 0; max-width: none; gap: 2px; }
.round-strip { display: flex; align-items: center; gap: .5rem; min-height: 1.65rem; white-space: nowrap; font-size: .81rem; color: var(--muted); }
.round-strip h2 { flex: 0 0 auto; font-size: .89rem; color: var(--ink); }
.round-strip .event-status { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.round-strip time { margin-left: auto; }
.round-strip strong { color: var(--green); font-size: .88rem; font-variant-numeric: tabular-nums; }
.workbench-game { display: inline-block; margin-top: .65rem; color: var(--green); }
.seat { display: flex; align-items: center; justify-content: space-between; gap: .55rem; min-height: 38px; padding: .2rem 0 .2rem 2rem; font-weight: 650; }
.seat time { display: inline-flex; align-items: center; justify-content: flex-end; min-width: 5.9rem; padding: .22rem .52rem; background: #e6eae0; color: var(--ink); border-radius: 5px; font: 750 1.4rem/1.05 var(--dg-mono, monospace); font-variant-numeric: tabular-nums; }
.seat time[data-low="true"] { background: #f5dfd5; color: #872f28; }
.seat[data-to-move="true"] { background: #e0ebdf; border-radius: 5px; }
.seat[data-to-move="true"] time { background: var(--green); color: white; }
.seat[data-to-move="true"] time[data-low="true"] { background: #9a3c30; color: white; }
.seat[data-to-move="true"] time::before { content: ''; width: .43rem; height: .43rem; margin-right: .45rem; border-radius: 50%; background: currentColor; animation: clock-pulse 1.8s ease-in-out infinite; }
@keyframes clock-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .seat[data-to-move="true"] time::before { animation: none; } }
.live-page .board-with-evaluation { grid-template-columns: 34px minmax(0, 1fr); gap: 5px; }
.live-page .evaluation-gauge { font-size: 10px; }
#event-board { width: 100%; max-width: none; aspect-ratio: 1; --board-light: #e4e9da; --board-dark: #92ae94; box-shadow: 0 7px 22px #263e3124; touch-action: pan-y pinch-zoom; }
#event-board .maia-chessboard { width: 100%; height: 100%; }
:is(#event-board, #trend-board) .maia-chessboard { touch-action: pan-y pinch-zoom; }
.round-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; margin-top: .25rem; }
.board-share { display: flex; gap: .25rem; margin-left: auto; }
.live-page button, .live-page select { font: inherit; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 5px; min-height: 36px; padding: .3rem .6rem; }
.event-nav button, .round-controls button, .engine-controls button { min-height: 31px; padding: .18rem .45rem; font-size: .83rem; }
.event-nav .btn-settings { width: 36px; height: 36px; padding: 0; }
.live-page .round-controls .btn-nav { width: 32px; height: 32px; padding: 0; border: 0; background: transparent; border-radius: 6px; }
.live-page .round-controls .btn-nav:hover:not(:disabled) { background: #e1eee5; }
.round-controls .btn-nav[aria-pressed="true"]:not(#sound) { color: var(--green); background: #e1eee5; }
.board-share #moment { background: var(--green); color: white; border-color: var(--green); }
.live-page button:disabled { opacity: .45; cursor: default; }
.live-page button:focus-visible, .live-page select:focus-visible, .live-page a:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.event-panel { display: flex; flex-direction: column; align-self: start; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.moves-heading, .engine-pane header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.moves-heading, .engine-pane { padding: .7rem .8rem; }
.live-page h2 { font-size: 1.04rem; line-height: 1.25; margin: 0; }
#ply-note { margin-left: auto; color: var(--muted); font-size: .83rem; }
.live-page #return-game { min-height: 28px; padding: .1rem .5rem; font-size: .76rem; color: var(--green); white-space: nowrap; }
.event-moves { overflow: auto; max-height: min(14rem, 32dvh); min-height: 4.75rem; border-block: 1px solid var(--line); }
.event-moves:empty::before { display: block; content: "—"; padding: 1rem; color: var(--muted); }
.move-row { display: grid; grid-template-columns: 2.35rem repeat(2, minmax(0, 1fr)); gap: .4rem; align-items: center; padding: .2rem .7rem; }
.move-row:nth-child(odd) { background: #f2f4ed; }
.move-row > span { color: var(--muted); font-variant-numeric: tabular-nums; }
.move-row > button { text-align: left; background: transparent; border-color: transparent; }
.move-row > button[aria-current="step"] { background: var(--green); color: white; }
.live-page .update-button { border: 0; border-radius: 0; background: #dcece1; color: #134936; min-height: 42px; }
.engine-pane p { margin: .55rem 0; color: var(--muted); }
#engine-note:empty { display: none; }
.intuition-tag { display: inline-block; font-size: .78rem; font-weight: 720; color: #133f30; background: #dcece1; padding: .17rem .34rem; border-radius: 4px; }
.engine-controls { display: flex; gap: .3rem; }
#show-lines { display: none; }
.engine-lines { display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem; margin-top: .35rem; }
.live-engine-group { min-width: 0; }
.live-engine-group .candidate-heading { justify-content: flex-start; margin: 0; color: var(--green); }
.live-engine-group .candidate-heading::before { content: ''; width: .43rem; height: .43rem; border-radius: 50%; background: currentColor; }
.maia-group .candidate-heading { color: #8b5819; }
.live-engine-group .candidate-line { grid-template-columns: 52px minmax(0, 1fr); padding: 3px 0; border-bottom: 1px solid var(--line); }
.live-engine-group .candidate-line:last-child { border-bottom: 0; }
.live-engine-group.maia-group .candidate-line { grid-template-columns: 52px minmax(0, 1fr) 64px; }
.maia-group .candidate-probability { color: #87551b; text-align: right; font: 700 12px/1.7 var(--dg-mono, monospace); }
.live-engine-group .candidate-score { font: 12px/1.7 var(--dg-mono, monospace); }
.live-engine-group .candidate-score.approximate { color: var(--muted); white-space: nowrap; }
.live-engine-group .candidate-variation { gap: .36rem; max-height: none; align-items: baseline; }
.live-engine-group .candidate-variation > * { font: 12px/1.7 var(--dg-mono, monospace); color: var(--muted); }
.live-engine-group .candidate-variation strong { color: var(--ink); font-weight: 750; }
.engine-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
#trend-mobile-slot { display: none; }
.live-engine-settings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; margin-top: .65rem; }
.live-engine-settings label { display: grid; gap: .2rem; min-width: 0; font-size: .8rem; color: var(--muted); }
.live-engine-settings select { width: 100%; }
.live-arrow-prefs { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin: .8rem 0; font-size: .9rem; }
.live-arrow-prefs label { display: flex; align-items: center; gap: .35rem; }
.live-arrow-prefs input { accent-color: var(--green); }
.engine-hint { margin: .5rem 0 0; color: var(--muted); font-size: .79rem; white-space: pre-line; }
.engine-hint:empty, .live-link-status:empty { display: none; }
.engine-health { margin: .65rem 0 0; padding-left: 1rem; font-size: .77rem; color: var(--muted); }
.engine-downloads:has(progress:not([hidden])) { display: flex; gap: .5rem; margin-top: .45rem; }
.engine-downloads progress { flex: 1; width: 100%; height: .34rem; accent-color: var(--green); }
#maia-progress { accent-color: #a66e20; }
.live-link-field { width: 100%; padding: .45rem; margin-top: .45rem; border: 1px solid var(--line); border-radius: 4px; font: inherit; }
.live-link-status { margin: .35rem 0 0; color: var(--muted); font-size: .8rem; }
.live-page :is(.share-card-dialog, .live-settings, .live-trend) { width: min(690px, calc(100vw - 24px)); max-height: 94dvh; overflow: auto; margin: auto; padding: clamp(.75rem, 3vw, 1.25rem); border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); }
.live-page .live-settings { width: min(490px, calc(100vw - 24px)); }
.live-page :is(.share-card-dialog, .live-settings, .live-trend)::backdrop { background: #172a24aa; }
.live-share-heading, .share-card-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; }
.live-share-heading { justify-content: space-between; }
.share-card-actions { justify-content: center; margin-top: .65rem; }
.share-card-preview-wrap { display: grid; place-items: center; margin-top: .4rem; padding: .4rem; background: var(--page); border-radius: 6px; }
.poster-progress { height: 3px; border-radius: 3px; overflow: hidden; background: #e7eadf; margin-top: .45rem; }
.poster-progress span { display: block; height: 100%; width: 0; background: var(--green); transition: width .35s ease; }
.poster-placeholder { display: grid; gap: 5%; align-content: start; width: min(100%, 41dvh); aspect-ratio: 1080 / 1560; border-radius: 8px; padding: 7%; background: var(--paper); border: 1px solid var(--line); }
.poster-placeholder span { display: block; border-radius: 5px; background: #eaece4; height: .9rem; width: 82%; }
.poster-placeholder span:nth-child(2) { width: 96%; height: auto; aspect-ratio: 1; }
.poster-placeholder span:last-child { width: 96%; height: 2rem; }
#share-card-canvas { display: block; max-width: 100%; max-height: 60dvh; width: auto; height: auto; animation: poster-reveal .28s ease-out; }
@keyframes poster-reveal { from { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { #share-card-canvas, .poster-progress span { animation: none; transition: none; } }
#trend-board { width: min(100%, 300px, 52dvh); aspect-ratio: 1; margin: .5rem auto .75rem; --board-light: #e4e9da; --board-dark: #92ae94; box-shadow: none; border-radius: 6px; touch-action: pan-y pinch-zoom; }
#trend-board .maia-chessboard { width: 100%; height: 100%; }
.trend-subtitle { margin-bottom: .12rem; font-size: .95rem; }
#trend-conclusion { margin-bottom: .55rem; font-size: .86rem; color: var(--green); }
#trend-status { margin-top: .38rem; font-size: .8rem; }
.trend-views, #trend-legend { display: flex; flex-wrap: wrap; gap: .4rem; }
.trend-views button[aria-pressed="true"] { background: var(--green); color: white; }
#trend-legend { list-style: none; margin: .45rem 0; padding: 0; }
#trend-legend button { display: inline-flex; gap: .3rem; align-items: center; min-height: 34px; font-size: .86rem; }
#trend-legend button[aria-pressed="true"] { border-color: var(--trend-color); background: var(--page); }
.live-trend :is(.trend-sf, .trend-consensus) { --trend-color: #276a4b; --trend-dash: none; }
.live-trend .trend-maia { --trend-color: #996119; --trend-dash: 8 4; }
.live-trend .trend-neutral { --trend-color: #555c70; --trend-dash: 1 4; }
.live-trend .trend-teal { --trend-color: #266f7a; --trend-dash: 7 3 1 3; }
.live-trend .trend-muted { opacity: .28; }
#trend-chart svg { display: block; width: 100%; }
#trend-chart svg text { font: 11px system-ui, sans-serif; fill: var(--muted); }
.live-trend .maia-trend-grid { stroke: var(--line); }
.live-trend .maia-trend-current { stroke: var(--muted); stroke-dasharray: 4 4; }
.live-trend .maia-trend-series path { fill: none; stroke: var(--trend-color); stroke-width: 1.8; stroke-dasharray: var(--trend-dash); stroke-linecap: round; }
.live-trend .maia-trend-series circle { fill: var(--paper); stroke: var(--trend-color); stroke-width: 1.5; }
.live-trend .maia-trend-data { overflow-x: auto; }
.live-trend table { width: 100%; border-collapse: collapse; text-align: right; font-size: .82rem; font-variant-numeric: tabular-nums; }
.live-trend :is(td, th) { padding: .3rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.event-source { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1.1rem 0 0; font-size: .86rem; color: var(--muted); }
@media (max-width: 720px) {
  .event-main { padding: 0 0 1rem; }
  .event-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .live-page .board-column, .event-panel, .engine-pane { display: contents; }
  .event-nav { gap: .25rem; padding-inline: .45rem; }
  .event-nav h1 { font-size: .85rem; min-width: 0; flex: 1 1 auto; }
  .event-nav-link { padding: .15rem .4rem; font-size: .75rem; flex-shrink: 0; }
  .event-brand { font-size: .92rem; flex-shrink: 0; }
  .settings-label, .match-score .score-full { display: none; }
  .match-score { gap: .25rem; font-size: .74rem; }
  .match-score .score-short { display: inline; }
  .match-score strong { font-size: .95rem; }
  .round-rail { margin: 0; padding: 2px 8px 3px; }
  .round-rail, .event-moves { scrollbar-width: none; overscroll-behavior-inline: contain; }
  .event-moves { order: 0; display: flex; min-height: 30px; max-height: 30px; padding-inline: 8px; gap: .16rem; white-space: nowrap; overflow: auto hidden; background: var(--paper); }
  .event-moves:empty::before { content: attr(data-placeholder); align-self: center; padding: 0; font-size: .77rem; }
  .move-row { display: flex; flex: 0 0 auto; gap: .08rem; padding: 0; }
  .move-row:nth-child(odd) { background: transparent; }
  .move-row > span { font-size: .72rem; }
  .live-page .move-row > button { min-height: 28px; min-width: 30px; padding: .13rem .24rem; font-size: .84rem; text-align: center; }
  .moves-heading { order: 9; padding: .25rem .55rem; }
  .moves-heading h2, .moves-heading #ply-note:empty { display: none; }
  #ply-note { font-size: .72rem; }
  .moves-heading:has(#ply-note[data-following="true"]) { display: none; }
  .round-strip { order: 2; min-height: 20px; padding-inline: .52rem; gap: .35rem; }
  .round-strip h2, .round-strip strong { font-size: .78rem; }
  .live-page .round-strip .update-button { min-height: 20px; margin-left: auto; padding: 0 .35rem; border-radius: 4px; font-size: .73rem; }
  .seat { order: 3; min-height: 32px; padding: 1px .5rem; font-size: .83rem; }
  .seat > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .seat time { flex-shrink: 0; min-width: 5.75rem; padding-block: .16rem; }
  #white-seat, .board-column[data-orientation="black"] #black-seat { order: 5; }
  .board-column[data-orientation="black"] #white-seat { order: 3; }
  .live-page .board-with-evaluation { order: 4; grid-template-columns: minmax(0, 1fr) 36px; gap: 0 3px; grid-template-rows: 10px auto; align-items: center; }
  .live-page .evaluation-gauge { flex-direction: row; height: 6px; border-radius: 0; }
  .evaluation-gauge .gauge-white { order: -1; flex: 0 0 var(--white-share, 50%); background: #fcfcf5; box-shadow: inset 0 0 0 1px #ccd6ca; }
  .evaluation-gauge .gauge-black { flex: 1; }
  .evaluation-gauge :is(.gauge-white, .gauge-black) { height: 100% !important; transition: flex-basis .18s ease; }
  .evaluation-gauge span { display: none; }
  #mobile-gauge-score { display: block; font: 700 10px/1 var(--dg-mono, monospace); text-align: center; }
  #event-board { grid-column: 1 / -1; border-radius: 0; }
  .engine-summary { order: 6; padding: 1px .5rem .2rem; background: var(--paper); }
  .engine-summary header { min-height: 24px; gap: .25rem; }
  .engine-summary h2 { font-size: .78rem; white-space: nowrap; }
  #mobile-moment-slot { display: block; min-width: 0; }
  #mobile-moment-slot .intuition-tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; font-size: .69rem; }
  .engine-controls button { min-height: 24px; padding: 0 .36rem; font-size: .73rem; }
  #show-lines { display: inline-block; }
  #engine-note { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .engine-lines { gap: .4rem; margin: 0; }
  .engine-lines:not(.expanded) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .engine-lines:not(.expanded) .live-engine-group { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .22rem; align-items: center; min-height: 26px; }
  .engine-lines:not(.expanded) .candidate-heading { font-size: .68rem; white-space: nowrap; }
  .engine-lines:not(.expanded) .candidate-heading::before { width: .32rem; height: .32rem; }
  .engine-lines:not(.expanded) .candidate-line { grid-template-columns: 43px minmax(0, 1fr); gap: .15rem; min-height: 0; padding: 0; border: 0; }
  .engine-lines:not(.expanded) .maia-group .candidate-line { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .engine-lines:not(.expanded) .candidate-score.approximate { font-size: 10px; }
  .engine-lines:not(.expanded) .candidate-probability { font-size: 10px; }
  .engine-lines:not(.expanded) .candidate-score { font-size: 11px; }
  .engine-lines:not(.expanded) :is(.candidate-line:nth-child(n+2), .candidate-variation span) { display: none; }
  .engine-lines #load-maia { min-height: 22px; padding: 0 .26rem; border-color: #b88641; color: #723f17; font-size: .72rem; white-space: nowrap; }
  .engine-downloads:has(progress:not([hidden])) { margin: 0 0 2px; }
  .engine-downloads progress { height: 3px; }
  .round-controls { order: 7; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .25rem; margin: 0; padding: .18rem .5rem; }
  .round-controls button { min-height: 42px; padding: .08rem; font-size: 1.1rem; }
  .live-nav { display: contents; }
  #trend-mobile-slot { display: contents; }
  .live-page .round-controls .btn-nav { width: 100%; background: var(--paper); border: 1px solid var(--line); }
  .round-controls .desktop-control { display: none; }
  .toolbar-text, #copy-live-link { display: none; }
  .toolbar-icon { display: block; width: 20px; height: 20px; margin: auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .board-share { display: contents; }
  .engine-actions, .live-link-field, .live-link-status, .workbench-game { order: 10; margin-inline: .5rem; }
  .event-source { margin-inline: .5rem; }
}

@media (max-width: 480px) {
  .round-strip[data-counting-down="true"] .event-status:not([data-state="stale"]) { display: none; }
}

@media (max-width: 380px) {
  .event-nav-link { display: none; }
  .event-nav .btn-settings { width: 32px; height: 32px; }
  .event-nav button { min-height: 30px; padding: .15rem .35rem; font-size: .78rem; }
}
