/* Visual skins only. Viewport sizing, game geometry and responsive layouts remain in their owning stylesheets. */
html[data-design="core"] {
  --cc-bg:light-dark(#ffffff,#11151b); --cc-panel:light-dark(#f4f6f8,#191e26);
  --cc-ink:light-dark(#18202c,#ecf0f6); --cc-muted:light-dark(#667183,#a1adbe);
  --cc-line:light-dark(#d7dde5,#353e4b); --cc-accent:light-dark(#1d2634,#e4eaf3);
  --cc-accent-ink:light-dark(#ffffff,#17202e); --cc-cell:light-dark(#f6f8fb,#222b37);
  --cc-cell-line:light-dark(#aebdce,#60748e);
  --design-radius:6px; --design-panel-radius:9px;
  --design-highlight:light-dark(#315ed0,#9ab5ff);
  --design-alt:light-dark(#315ed0,#9ab5ff); --design-alt-ink:light-dark(#ffffff,#162748);
  --design-shadow:0 1px 2px light-dark(#1422350a,#00000028);
  --design-inset:inset 0 1px 2px light-dark(#1422350b,#00000030);
  --design-bridge-fill:#91a7b9; --design-bridge-edge:#40566c; --design-bridge-light:#deedf8;
}
html[data-design="flow"] {
  --cc-bg:light-dark(#eff9f4,#10231d); --cc-panel:light-dark(#ffffff,#1a332a);
  --cc-ink:light-dark(#153d2e,#eefbf5); --cc-muted:light-dark(#537366,#a4c2b3);
  --cc-line:light-dark(#cee5d9,#355347); --cc-accent:light-dark(#087d50,#6be0ad);
  --cc-accent-ink:light-dark(#ffffff,#092d1d); --cc-cell:light-dark(#ffffff,#244336);
  --cc-cell-line:light-dark(#b7d5c5,#678674);
  --design-radius:18px; --design-panel-radius:22px; --design-highlight:var(--cc-accent);
  --design-alt:light-dark(#326daa,#a3c6ff); --design-alt-ink:light-dark(#ffffff,#102f4c);
  --design-shadow:0 5px 18px light-dark(#235c3c0b,#00000024);
  --design-inset:inset 0 1px 2px light-dark(#235c3c09,#00000022);
  --design-bridge-fill:#458975; --design-bridge-edge:#204d40; --design-bridge-light:#c3efe1;
}
html[data-design="glass"] {
  --cc-bg:light-dark(#edf0fa,#121527); --cc-panel:light-dark(#f9faff,#1f243c);
  --cc-ink:light-dark(#24283d,#f0f2ff); --cc-muted:light-dark(#69728c,#a8b2d1);
  --cc-line:light-dark(#d2d8ee,#373f61); --cc-accent:light-dark(#6e53d8,#b7a4ff);
  --cc-accent-ink:light-dark(#ffffff,#211842); --cc-cell:light-dark(#fcfcff,#202944);
  --cc-cell-line:light-dark(#bcc8e4,#526183);
  --design-radius:13px; --design-panel-radius:18px; --design-highlight:var(--cc-accent);
  --design-alt:light-dark(#365bab,#9fbaff); --design-alt-ink:light-dark(#ffffff,#16264a);
  --design-shadow:0 5px 16px light-dark(#454f7710,#00000028),inset 0 1px 0 light-dark(#ffffff,#ffffff12);
  --design-inset:inset 0 1px 3px light-dark(#454f770d,#00000024);
  --design-bridge-fill:#a49bcf; --design-bridge-edge:#60547d; --design-bridge-light:#f0e7ff;
}
html[data-design="neon"] {
  --cc-bg:light-dark(#edf6fa,#080d19); --cc-panel:light-dark(#f9fdff,#101a2d);
  --cc-ink:light-dark(#142c3d,#edf4ff); --cc-muted:light-dark(#536c80,#95a8c4);
  --cc-line:light-dark(#c3d9e3,#293a56); --cc-accent:light-dark(#087c86,#58f2f1);
  --cc-accent-ink:light-dark(#ffffff,#052327); --cc-cell:light-dark(#f8fcff,#101d30);
  --cc-cell-line:light-dark(#9dbbce,#45617f);
  --design-radius:6px; --design-panel-radius:10px; --design-highlight:var(--cc-accent);
  --design-alt:light-dark(#a92b98,#ec8ce9); --design-alt-ink:light-dark(#ffffff,#310d35);
  --neon-lime:light-dark(#718d13,#d6ff59); --neon-pink:light-dark(#a92b98,#ed6dfa);
  --design-shadow:0 0 0 1px light-dark(#087c8607,#58f2f108);
  --design-inset:inset 0 1px 2px light-dark(#1738500c,#00000038);
  --design-bridge-fill:#152739; --design-bridge-edge:#265972; --design-bridge-light:#acfff7;
}

/* Map the existing game's public tokens to the selected design. */
html:root[data-design] {
  color-scheme:light;
  --background:var(--cc-bg); --foreground:var(--cc-ink); --surface:var(--cc-panel);
  --muted:color-mix(in srgb,var(--cc-line) 76%,var(--cc-panel)); --muted-foreground:var(--cc-muted);
  --edge:color-mix(in srgb,var(--cc-cell-line) 62%,var(--cc-line)); --panel-edge:var(--cc-line);
  --hover:color-mix(in srgb,var(--cc-accent) 7%,var(--cc-panel));
  --primary:var(--cc-accent); --primary-text:var(--cc-accent-ink);
  --primary-hover:color-mix(in srgb,var(--cc-accent) 90%,var(--cc-bg));
  --clock-track:var(--cc-line); --clock-progress:var(--design-highlight);
  --error:light-dark(#a82f49,#ffadbd); --design-warning:light-dark(#8e5c09,#ffd17d);
  --design-success:light-dark(#16694a,#8ce0b5);
  --design-overlay:light-dark(#13223b80,#040916bd);
  font-family:Inter,Pretendard,-apple-system,BlinkMacSystemFont,"Segoe UI","Malgun Gothic",sans-serif;
}
html:root[data-design][data-theme="dark"] {color-scheme:dark}
html:root[data-design] body {background:var(--cc-bg);color:var(--cc-ink)}
html:root[data-design] :is(.btn,.gl-menu-tab,.sp-color,.mh-match) {
  border-color:var(--edge);border-radius:var(--design-radius);font-weight:600;
  transition:background-color .14s ease,border-color .14s ease,box-shadow .14s ease;
}
html:root[data-design] :is(.btn,.gl-menu-tab):not(.btn-primary):not(.btn-danger):not([aria-selected="true"]) {
  background-color:var(--cc-panel);color:var(--cc-ink);
}
html:root[data-design] :is(button,input,select,textarea,summary):focus-visible {
  outline:2px solid var(--design-highlight);outline-offset:3px;
}
html:root[data-design] :is(button,input,select):disabled {box-shadow:none;cursor:default}
html:root[data-design] :is(.btn-primary,.sp-primary,.round-settings-close,.gl-menu-tab[aria-selected="true"]) {
  border-color:var(--cc-accent);background:var(--cc-accent);color:var(--cc-accent-ink);
  box-shadow:var(--design-shadow);font-weight:700;
}
html:root[data-design] .btn.btn-danger {
  background:var(--error);border-color:var(--error);color:light-dark(#ffffff,#38131e);
}
html:root[data-design] :is(input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),select,textarea) {
  border-color:var(--edge);border-radius:var(--design-radius);
  background:var(--cc-bg);color:var(--cc-ink);box-shadow:var(--design-inset);
}
html:root[data-design] :is(input,textarea)::placeholder {color:var(--cc-muted);opacity:1}
html:root[data-design] input:is([type="range"],[type="checkbox"],[type="radio"]) {accent-color:var(--design-highlight)}
html:root[data-design] :is(.setting-btn,.gl-menu-tab) {box-shadow:none}
html:root[data-design] .gl-menu-tab[aria-selected="true"] {background:var(--cc-accent);color:var(--cc-accent-ink)}
html:root[data-design] :is(.gl-menu-button,.gl-leave-button,.gl-color-button,.gl-dialog-close) {border-radius:var(--design-radius)}
html:root[data-design] .gl-leave-button {color:var(--error)!important;border-color:color-mix(in srgb,var(--error) 42%,var(--cc-line))}

/* Entry surfaces use the same materials as the live game. */
html:root[data-design] :is(.panel,.lobby-panel,.room-invite,.match-group,.tutorial-entry,.solver-entry,#lobby .bot-entry) {
  border-color:var(--cc-line);border-radius:var(--design-panel-radius);background:var(--cc-panel);box-shadow:var(--design-shadow);
}
html:root[data-design] :is(.match-group,.room-invite) {background:color-mix(in srgb,var(--cc-panel) 60%,var(--cc-bg));box-shadow:none}
html:root[data-design] :is(.tutorial-entry,.solver-entry,#lobby .bot-entry) {
  background:linear-gradient(115deg,color-mix(in srgb,var(--cc-accent) 6%,var(--cc-panel)),var(--cc-panel));
}
html:root[data-design] :is(.tutorial-entry-button,#lobby .bot-entry-art,.solver-entry-art,.quiz-entry .solver-entry-art) {color:var(--design-highlight)}
html:root[data-design] :is(.bot-entry-copy p,.solver-entry p,.header-label) {color:var(--cc-muted)}
html:root[data-design] #lobby .bot-entry-button {
  border-color:var(--edge);color:var(--cc-ink);background:var(--cc-panel);box-shadow:var(--design-shadow);
}
html:root[data-design] :is(.lobby-eyebrow,.sp-eyebrow,.mh-eyebrow,.mh-analysis-label) {color:var(--design-highlight)}
html:root[data-design] :is(#seat,#connection) {border-radius:var(--design-radius)}
html:root[data-design] .brand-hero {
  border:1px solid var(--cc-line);border-radius:var(--design-panel-radius);
  color:var(--cc-ink);background:var(--cc-panel);box-shadow:var(--design-shadow);
}
html:root[data-design] .brand-title {letter-spacing:-.065em}
html:root[data-design] .brand-title span:last-child {color:var(--design-highlight)}
html:root[data-design] .brand-hero p.brand-kicker {color:var(--cc-muted)}
html:root[data-design] .brand-hero p.brand-tagline {color:var(--cc-ink)}
html:root[data-design] .hero-grid {
  background-image:linear-gradient(color-mix(in srgb,var(--cc-cell-line) 23%,transparent) 1px,transparent 1px),linear-gradient(90deg,color-mix(in srgb,var(--cc-cell-line) 23%,transparent) 1px,transparent 1px);
}
html:root[data-design] .header-dot {background:var(--design-highlight);box-shadow:0 0 0 3px color-mix(in srgb,var(--design-highlight) 12%,transparent)}

/* The preview stays outside the entrance flow, so later-injected modes need no row bookkeeping. */
html:root[data-design] main:has(> #lobby:not([hidden])) {max-width:1160px}
html:root[data-design] .site-header {margin-bottom:16px}
html:root[data-design] .brand-hero {
  min-height:70px;padding:15px 20px;display:flex;align-items:center;gap:13px;
}
html:root[data-design] .brand-title {
  display:flex;align-items:baseline;gap:.25em;font-size:clamp(1.3rem,2.6vw,1.9rem);line-height:1;letter-spacing:-.05em;
}
/* Brand mark: three coloured routes on a dark board (one image for every theme). */
html:root[data-design] .brand-mark {display:block;width:32px;height:32px;flex:none}
html:root[data-design] .brand-mark svg {display:block;width:100%;height:100%;border-radius:22%;box-shadow:0 1px 3px light-dark(#14223a30,#00000060)}
html:root[data-design] .header-controls {margin:0}
html:root[data-design] .display-settings {align-items:center}
html:root[data-design] #lobby:not([hidden]) {position:relative}
html:root[data-design] .lobby-board-preview {
  --cc-preview-cell:var(--cc-cell);--cc-preview-edge:var(--cc-cell-line);
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;
  min-width:0;margin:0 0 18px;padding:0 0 16px;border-bottom:1px solid var(--cc-line);
}
html:root[data-design] .lobby-board-preview svg {display:block;width:min(100%,240px);height:auto;max-height:215px;overflow:visible}
html:root[data-design] #lobby .lobby-heading h2 {font-size:1.1rem;margin:0 0 14px}
html:root[data-design] #lobby :is(.tutorial-entry,.bot-entry,.solver-entry) {margin:0 0 9px;padding:9px 12px;gap:9px}
html:root[data-design] #lobby :is(.bot-entry-copy p,.solver-entry p,.mh-entry p,.match-group p) {display:none}
html:root[data-design] #lobby :is(.bot-entry-copy strong,.solver-entry strong,.mh-entry strong) {font-size:.86rem}
html:root[data-design] #lobby :is(.bot-entry,.solver-entry) {grid-template-columns:30px minmax(0,1fr) auto}
html:root[data-design] #lobby :is(.bot-entry-art,.solver-entry-art) {width:30px;height:30px;font-size:1.55rem}
/* Lobby entry buttons (tutorial, bot, solver, quiz, history) share one size so the right column lines up. */
html:root[data-design] #lobby .mh-entry {padding-right:13px}
html:root[data-design] #lobby :is(.tutorial-entry-button,.bot-entry-button,.solver-entry .btn,#history-open) {box-sizing:border-box;width:112px;min-width:112px;min-height:40px;padding:7px 10px;font-size:.83rem;justify-content:center;text-align:center;white-space:nowrap}
html:root[data-design] #lobby .match-group {padding:0;margin:14px 0;gap:9px;border:0;background:transparent;box-shadow:none}
html:root[data-design] #lobby .match-buttons {width:100%}
html:root[data-design] #lobby .match-buttons .btn {font-size:.9rem;font-weight:750}
:is(#match-start,.league-weapon) {
  --match-metal:light-dark(#c7d6e3,#a4bed5);--match-edge:light-dark(#485e73,#426078);
  --match-shine:light-dark(#ffffff,#e2f4ff);--match-grip:light-dark(#334457,#203247);
  --match-aura:color-mix(in srgb,var(--design-highlight) 6%,transparent);--match-ring:color-mix(in srgb,var(--design-highlight) 24%,var(--cc-line));
}
html:root[data-design] #lobby #match-start {
  display:grid;justify-items:center;align-content:center;gap:7px;width:100%;min-height:166px;padding:14px;
  border:1px solid color-mix(in srgb,var(--design-highlight) 27%,var(--cc-line));border-radius:var(--design-panel-radius);
  background:linear-gradient(145deg,var(--cc-panel),color-mix(in srgb,var(--design-highlight) 5%,var(--cc-panel)));color:var(--cc-ink);box-shadow:var(--design-shadow);
}
#match-start .match-emblem {display:none;width:112px;height:112px;filter:drop-shadow(0 2px 2px light-dark(#182d4620,#00000040))}
:root:is(:not([data-design]),[data-design="core"]) #match-start [data-match-emblem="core"],
:root[data-design="flow"] #match-start [data-match-emblem="flow"],
:root[data-design="glass"] #match-start [data-match-emblem="glass"],
:root[data-design="neon"] #match-start [data-match-emblem="neon"] {display:block}
html:root[data-design] #match-start .match-start-label {font-size:1.1rem;line-height:1.2;font-weight:750;letter-spacing:-.025em}
html:root[data-design] #lobby .match-wait {padding:12px;border:1px solid var(--cc-line);border-radius:var(--design-radius);background:var(--cc-panel)}
html:root[data-design] #match-choice-dialog {
  --match-choice-width:min(512px,calc(100vw - 32px),calc((100dvh - 24px) * 1.618));
  box-sizing:border-box;width:var(--match-choice-width);height:calc(var(--match-choice-width) / 1.618);aspect-ratio:1.618 / 1;
  max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);overflow:auto;overscroll-behavior:contain;
  padding:18px;border:1px solid var(--cc-cell-line);border-radius:var(--design-panel-radius);background:var(--cc-panel);color:var(--cc-ink);box-shadow:0 20px 60px light-dark(#17213335,#00000070);
}
html:root[data-design] #match-choice-dialog[open] {display:grid;grid-template-rows:44px minmax(44px,1fr);row-gap:14px}
html:root[data-design] #match-choice-dialog::backdrop {background:var(--design-overlay);backdrop-filter:blur(4px)}
html:root[data-design] .match-choice-toolbar {display:flex;align-items:center;justify-content:flex-end;min-width:0;margin:0}
html:root[data-design] #match-choice-close {min-width:60px;min-height:44px}
html:root[data-design] .match-choice-actions {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;min-width:0;min-height:0;align-items:stretch}
html:root[data-design] .match-choice-actions .btn {min-width:44px;min-height:44px;padding:14px 10px;font-size:1rem;font-weight:750;white-space:normal;line-height:1.5}
html:root[data-design] #lobby .lobby-actions {gap:14px;margin:14px 0 0;padding-top:14px;border-top:1px solid var(--cc-line)}
html:root[data-design] #lobby .mh-entry {margin-top:14px;padding-top:14px}

/* A newly created friend room chooses its player count before entering the game. */
html:root[data-design] body:not(.game-screen-active) #room:has(> .friend-room-setup:not([hidden])) {width:min(100%,600px);margin:22px auto;padding:22px}
html:root[data-design] #room:has(> .friend-room-setup:not([hidden])) .room-header {padding-bottom:14px;border-bottom:1px solid var(--cc-line)}
html:root[data-design] #friend-room-setup {display:grid;gap:13px;padding:8px 0 12px}
html:root[data-design] #friend-room-setup h2 {margin:0;font-size:1.25rem;letter-spacing:-.025em}
html:root[data-design] #friend-room-setup .friend-room-setup-label {margin:0;color:var(--cc-muted);font-size:.88rem}
html:root[data-design] .friend-room-seat-options {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
html:root[data-design] #friend-room-setup [data-room-seats] {display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:7px;min-width:0;min-height:100px;padding:18px;border:1px solid var(--cc-cell-line);border-radius:var(--design-radius);background:var(--cc-bg);color:var(--cc-ink);text-align:left;white-space:normal;box-shadow:var(--design-shadow)}
html:root[data-design] #friend-room-setup [data-room-seats] strong {font-size:1.12rem;font-weight:750}
html:root[data-design] #friend-room-setup [data-room-seats] span {color:var(--cc-muted);font-size:.78rem;font-weight:500}
html:root[data-design] #friend-room-setup-error {margin:0;min-height:0;font-size:.85rem;overflow-wrap:anywhere}
html:root[data-design] #friend-room-setup-error:empty {display:none}
@media(min-width:900px) {
  html:root[data-design] #lobby:not([hidden]) {min-height:560px;padding:24px 24px 24px calc(44% + 24px)}
  html:root[data-design] #lobby .lobby-board-preview {
    position:absolute;left:0;top:0;bottom:0;width:44%;margin:0;padding:28px;
    border-bottom:0;border-right:1px solid var(--cc-line);
    background:linear-gradient(145deg,var(--cc-bg),color-mix(in srgb,var(--cc-cell) 70%,var(--cc-bg)));
    border-radius:var(--design-panel-radius) 0 0 var(--design-panel-radius);
  }
  html:root[data-design] #lobby .lobby-board-preview svg {width:100%;max-height:480px}
}

/* Keep all board measurements and hit targets controlled by game-layout.css. */
html:root[data-design] body.game-screen-active #colorlink-game :is(.gl-board-stage,.gl-controls) {
  border-color:var(--cc-line);border-radius:var(--design-panel-radius);box-shadow:var(--design-shadow);
}
html:root[data-design] body.game-screen-active #colorlink-game .gl-controls {background:var(--cc-panel)}
html:root[data-design] :is(.sp-stage,.gl-board-stage) {background:var(--cc-bg);border-color:var(--cc-line);border-radius:var(--design-panel-radius)}
html:root[data-design] #colorlink-game .board.hex-board > .viz-tile {background-color:var(--cc-cell)}
html:root[data-design] #colorlink-game .board.hex-board > .viz-tile::before {
  background-image:none;background-color:var(--cc-cell-line);
  -webkit-mask:center / 100% 100% no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 115' preserveAspectRatio='none'%3E%3Cpolygon points='50,2 98,29 98,86 50,113 2,86 2,29' fill='none' stroke='white' stroke-width='1.5' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  mask:center / 100% 100% no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 115' preserveAspectRatio='none'%3E%3Cpolygon points='50,2 98,29 98,86 50,113 2,86 2,29' fill='none' stroke='white' stroke-width='1.5' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
}
html:root[data-design] #colorlink-game .board .endpoint-cell {background:var(--cc-cell)!important}
html:root[data-design] #colorlink-game .board .endpoint-disc {border-color:light-dark(#27384a,#d0ddeb);box-shadow:0 1px 2px #0004}
html:root[data-design] .sp-board.is-hex .sp-cell {background:var(--cc-cell-line)}
html:root[data-design] .sp-board.is-hex .sp-cell::before {background:var(--sp-paint,var(--cc-cell))}
html:root[data-design] #colorlink-game #cl-palette .btn {
  border-radius:var(--design-radius);box-shadow:inset 0 0 0 1px #ffffff24;
}
html:root[data-design] #colorlink-game #cl-palette .btn[aria-pressed="true"] {
  outline:3px solid #ffd84c;outline-offset:-3px;box-shadow:inset 0 0 0 5px #273039;
}
html:root[data-design] :is(.sp-color,.tu-color)[aria-pressed="true"] {outline-color:#ffd84c}
html:root[data-design] #colorlink-game #cl-actions .btn[data-action="give-up"] {
  color:var(--error);border-color:color-mix(in srgb,var(--error) 35%,var(--cc-line));
  background:color-mix(in srgb,var(--error) 7%,var(--cc-panel));box-shadow:none;
}
html:root[data-design] #colorlink-game .turn-badge {
  border-radius:var(--design-radius);border-color:var(--cc-line);background:var(--cc-panel);color:var(--cc-muted);
}
html:root[data-design] #colorlink-game .turn-badge.is-mine {
  --turn-icon-surface:var(--design-highlight);color:light-dark(#ffffff,#102033);
  border-color:var(--design-highlight);background:var(--design-highlight);box-shadow:0 2px 8px color-mix(in srgb,var(--design-highlight) 15%,transparent);
}
html:root[data-design] #colorlink-game .turn-badge.is-waiting {
  --turn-icon-surface:var(--cc-panel);border-color:var(--cc-cell-line);background:var(--cc-panel);color:var(--cc-ink);box-shadow:none;
}
html:root[data-design] body.game-screen-active #colorlink-game[data-turn="mine"] .gl-board-stage {
  border-color:var(--design-highlight);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--design-highlight) 16%,transparent),var(--design-shadow);
}
html:root[data-design] body.game-screen-active #colorlink-game[data-turn="opponent"] .gl-board-stage {border-color:var(--cc-cell-line);box-shadow:var(--design-shadow)}
html:root[data-design] #colorlink-game :is(.bridge-info,.gl-selected-color) {border-color:var(--cc-line);color:var(--cc-muted)}
html:root[data-design] #colorlink-game .bridge-info {border-radius:var(--design-radius);background:var(--cc-bg)}
html:root[data-design] #colorlink-game #cl-clock .timer-track {
  background:var(--cc-line);border-color:color-mix(in srgb,var(--cc-cell-line) 55%,transparent);border-radius:var(--design-radius);
}
html:root[data-design] #colorlink-game #cl-clock .timer-fill {background:var(--design-highlight)}
html:root[data-design] #colorlink-game #cl-clock[data-timer-state="warning"] {color:var(--design-warning)}
html:root[data-design] #colorlink-game #cl-clock[data-timer-state="warning"] .timer-fill {background:var(--design-warning)}
html:root[data-design] #colorlink-game #cl-clock:is([data-timer-state="urgent"],[data-timer-state="expired"]) {color:var(--error)}
html:root[data-design] #colorlink-game #cl-clock:is([data-timer-state="urgent"],[data-timer-state="expired"]) .timer-fill {background:var(--error)}
html:root[data-design] #colorlink-game #cl-clock[data-timer-state="preparing"] .timer-fill {background:var(--cc-muted)}

/* Shared dialogs and practice screens inherit the same skin without changing their layout. */
html:root[data-design] :is(.gl-dialog,.sp-dialog,.bot-dialog,.mh-dialog,.ba-history,.leave-confirm,.round-settings-card,.bridge-round-card,.match-complete-card,.round-result-card,.proof-success-card) {
  border-color:var(--cc-line);border-radius:var(--design-panel-radius);background:var(--cc-panel);color:var(--cc-ink);
  box-shadow:0 18px 60px light-dark(#17213330,#00000070),inset 0 1px 0 light-dark(#ffffffc0,#ffffff0a);
}
html:root[data-design] #colorlink-game .gl-dialog {background:var(--cc-panel);color:var(--cc-ink);border-color:var(--cc-line);border-radius:var(--design-panel-radius)}
html:root[data-design] :is(.gl-dialog,.sp-dialog,.bot-dialog,.mh-dialog,.ba-history,.leave-confirm)::backdrop {background:var(--design-overlay)}
html:root[data-design] :is(.round-settings-popup,.bridge-round-popup,.match-complete) {background:var(--design-overlay)}
html:root[data-design] :is(.round-settings-eyebrow,.bridge-round-eyebrow,.round-result-eyebrow,.match-complete-card>span,.bridge-round-count b) {color:var(--design-highlight)}
html:root[data-design] :is(.round-settings-card small,.bridge-round-card p,.bridge-round-card small,.match-complete-card p) {color:var(--cc-muted)}
html:root[data-design] .round-settings-list {background:var(--cc-bg);border-radius:var(--design-radius)}
html:root[data-design] .round-settings-list>div {border-color:var(--cc-line)}
html:root[data-design] .round-settings-list dt {color:var(--cc-muted)}
html:root[data-design] .round-settings-list dd {color:var(--cc-ink)}
html:root[data-design] :is(.sp-status,.quiz-summary,.mh-round,.mh-match,.bot-choice-body,#tutorial .tu-panel) {
  border-color:var(--cc-line);border-radius:var(--design-panel-radius);background-color:var(--cc-panel);color:var(--cc-ink);
}
html:root[data-design] :is(.sp-status,.mh-match,.bot-choice-body) {border-radius:var(--design-radius)}
html:root[data-design] :is(.sp-status[data-status="optimal"],.quiz-card.is-correct,.quiz-status.is-correct) {
  background:color-mix(in srgb,var(--design-success) 7%,var(--cc-panel));border-color:var(--design-success);
}
html:root[data-design] :is(.sp-status[data-status="optimal"] strong,.quiz-card.is-correct .quiz-card-mark) {color:var(--design-success)}
html:root[data-design] :is(.sp-status[data-status="impossible"],.sp-status[data-status="error"],.quiz-card.is-wrong,.quiz-status.is-wrong) {
  background:color-mix(in srgb,var(--error) 7%,var(--cc-panel));border-color:var(--error);
}
html:root[data-design] :is(.sp-status[data-status="running"],.mh-match[aria-pressed="true"]) {border-color:var(--design-highlight)}
html:root[data-design] .mh-match[aria-pressed="true"] {
  box-shadow:inset 0 0 0 1px var(--design-highlight);background:var(--hover);
}
html:root[data-design] .bot-dialog .bot-difficulty-card input:checked+.bot-choice-body {background:var(--hover);border-color:var(--design-highlight);box-shadow:inset 0 0 0 1px var(--design-highlight)}
html:root[data-design] #tutorial .tu-progress {color:var(--design-highlight);background:var(--hover)}
html:root[data-design] :is(.bot-dialog-header,.mh-header,.mh-footer,.mh-list-panel) {border-color:var(--cc-line);background-color:var(--cc-panel)}

/* Bridge materials also cover the existing drop animation and fallback junction. */
html:root[data-design] :is(.bridge-junction,.sp-bridge) {filter:drop-shadow(0 1px 1px #06132360)}
html:root[data-design] #colorlink-game #cl-board .bridge-junction-outline,
html:root[data-design] #quiz .bridge-junction-outline {stroke:var(--design-bridge-edge)}
html:root[data-design] #colorlink-game #cl-board .bridge-junction-deck,
html:root[data-design] #quiz .bridge-junction-deck {stroke:var(--design-bridge-fill)}
html:root[data-design] #colorlink-game #cl-board .bridge-junction-planks,
html:root[data-design] #quiz .bridge-junction-planks {stroke:var(--design-bridge-edge)}
html:root[data-design] #colorlink-game #cl-board .bridge-junction-hub,
html:root[data-design] #quiz .bridge-junction-hub {fill:var(--design-bridge-fill);stroke:var(--design-bridge-light)}
html:root[data-design] :is(.bridge-colors,.cc-bridge-label) {background:var(--cc-panel);color:var(--cc-ink)}
html:root[data-design] :is(.bridge-planks,.bridge-round-deck) {
  border-color:var(--design-bridge-edge);border-radius:var(--design-radius);
  background:repeating-linear-gradient(90deg,var(--design-bridge-fill) 0 10px,var(--design-bridge-edge) 10px 12px);
}
html:root[data-design] :is(.bridge-rail,.bridge-round-rail) {border-color:var(--design-bridge-edge);background:var(--design-bridge-light)}

/* Material-specific finishes retain the original concepts' character. */
html:root[data-design="core"] :is(.brand-hero,.gl-controls,.round-settings-card) {box-shadow:0 1px 2px light-dark(#1422350a,#00000028)}
html:root[data-design="core"] :is(.gl-brand,.brand-title) {font-weight:760}
html:root[data-design="flow"] .brand-hero {background:radial-gradient(ellipse at 75% 40%,color-mix(in srgb,var(--cc-accent) 10%,var(--cc-panel)),var(--cc-panel) 78%)}
html:root[data-design="flow"] .brand-mark {transform:rotate(-8deg)}
html:root[data-design="flow"] :is(.btn-primary,.sp-primary,.round-settings-close) {box-shadow:0 3px 0 color-mix(in srgb,var(--cc-accent) 65%,#123b2b)}
html:root[data-design="flow"] :is(.setting-btn,.gl-menu-tab) {border-radius:12px}
html:root[data-design="glass"] :is(.brand-hero,.gl-controls,.gl-dialog,.sp-dialog,.bot-dialog,.round-settings-card) {
  background:linear-gradient(145deg,color-mix(in srgb,var(--cc-panel) 94%,#ffffff),var(--cc-panel));
}
html:root[data-design="glass"] .brand-mark {transform:rotate(-7deg)}
html:root[data-design="glass"] :is(.btn-primary,.sp-primary,.round-settings-close) {
  box-shadow:0 3px 8px light-dark(#5c4f9c20,#00000040),inset 0 1px 0 #ffffff45,inset 0 -2px 0 #00000015;
}
html:root[data-design="glass"] :is(.gl-toolbar,.bot-dialog-header) {box-shadow:inset 0 1px 0 light-dark(#ffffff,#ffffff10)}
html:root[data-design="glass"] #cl-palette .btn {box-shadow:inset 0 1px 0 #ffffff55,0 2px 4px #00000012}
html:root[data-design="neon"] .brand-mark svg {box-shadow:0 0 10px color-mix(in srgb,var(--cc-accent) 35%,transparent)}
html:root[data-design="neon"] .brand-title span:last-child {text-shadow:0 0 9px color-mix(in srgb,var(--cc-accent) 32%,transparent),0 0 22px color-mix(in srgb,var(--cc-accent) 14%,transparent)}
html:root[data-design="neon"] :is(.btn-primary,.sp-primary,.round-settings-close) {box-shadow:0 0 0 1px color-mix(in srgb,var(--cc-accent) 12%,transparent),0 0 13px color-mix(in srgb,var(--cc-accent) 21%,transparent);font-weight:800}
html:root[data-design="neon"] #lobby #match-start {box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--cc-accent) 6%,transparent),0 0 16px color-mix(in srgb,var(--cc-accent) 12%,transparent)}
html:root[data-design="neon"] #match-start .match-emblem {filter:none}
html:root[data-design="neon"] :is(.game-route-layer path,.game-route-layer circle,.cc-bridge-route) {filter:drop-shadow(0 0 1.5px color-mix(in srgb,var(--route-glow,currentColor) 75%,transparent)) drop-shadow(0 0 4px color-mix(in srgb,var(--route-glow,currentColor) 34%,transparent))}
html:root[data-design="neon"] .lobby-board-preview :is(polyline,circle) {filter:drop-shadow(0 0 1px color-mix(in srgb,var(--route-glow,currentColor) 70%,transparent)) drop-shadow(0 0 2.5px color-mix(in srgb,var(--route-glow,currentColor) 32%,transparent))}
html:root[data-design="neon"] :is(.lobby-board-preview text,.bridge-colors) {filter:none;text-shadow:none}
html:root[data-design="neon"] #colorlink-game .board .endpoint-disc {box-shadow:0 0 0 1px #142334,0 0 8px color-mix(in srgb,var(--route-glow,var(--cc-accent)) 53%,transparent);text-shadow:none}
html:root[data-design="neon"] .sp-marker {box-shadow:0 0 0 1px #142334,0 0 6px color-mix(in srgb,var(--route-glow,var(--cc-accent)) 45%,transparent)}
html:root[data-design="neon"] .cc-bridge {filter:drop-shadow(0 0 1.4px light-dark(#087c8670,#58f2f17a))}
html:root[data-design="neon"] :is(.bridge-junction,.sp-bridge,.tu-bridge-junction) {filter:drop-shadow(0 1px 1px #06132380)}
html:root[data-design="neon"] #colorlink-game .turn-badge.is-mine {color:var(--cc-accent-ink);box-shadow:0 0 14px color-mix(in srgb,var(--cc-accent) 15%,transparent)}

/* Header controls stay in one movable settings wrapper; its panel becomes static in the game menu. */
html:root[data-design] .site-header .brand-hero {display:grid;grid-template-columns:auto minmax(0,1fr) auto auto;gap:12px;align-items:center;overflow:visible;isolation:auto;min-height:70px;padding:12px 16px}
html:root[data-design] .site-header .brand-mark {grid-column:1;grid-row:1}
html:root[data-design] .site-header .brand-title {grid-column:2;grid-row:1;min-width:0}
html:root[data-design] .staging-badge {grid-column:3;grid-row:1;justify-self:end;display:inline-flex;align-items:center;min-height:27px;padding:4px 8px;border:1px solid color-mix(in srgb,var(--design-warning) 38%,var(--cc-line));border-radius:6px;background:color-mix(in srgb,var(--design-warning) 8%,var(--cc-panel));color:var(--design-warning);font-size:.68rem;font-weight:750;line-height:1.2;white-space:nowrap}
html:root[data-design] .site-header .header-controls {grid-column:4;grid-row:1;position:relative;display:flex;align-items:center;justify-content:flex-end;gap:8px;min-width:0;margin:0;flex-wrap:nowrap}
html:root[data-design] .site-header .display-settings {display:flex;align-items:center;justify-content:flex-end;gap:7px;min-width:0;margin:0;flex:0 1 auto;flex-wrap:nowrap}
html:root[data-design] .lobby-icon-button {display:inline-grid;place-items:center;flex:0 0 44px;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;border-radius:var(--design-radius);line-height:1}
html:root[data-design] .lobby-icon-button svg {display:block;width:20px;height:20px}
html:root[data-design] .lobby-icon-button[aria-expanded="true"] {border-color:var(--design-highlight);background:var(--hover);color:var(--design-highlight)}
html:root[data-design] .lobby-audio {display:flex;align-items:center;gap:6px}
html:root[data-design] .audio-toggle[aria-pressed="true"] .audio-off,html:root[data-design] .audio-toggle[aria-pressed="false"] .audio-on {display:none}
html:root[data-design] .audio-toggle[aria-pressed="false"] {color:var(--cc-muted)}
html:root[data-design] .site-header .lobby-settings-panel {position:absolute;right:0;top:calc(100% + 10px);z-index:90;width:min(360px,calc(100vw - 40px));max-height:min(70dvh,480px);overflow:auto;overscroll-behavior:contain;padding:16px;border:1px solid var(--cc-cell-line);border-radius:var(--design-panel-radius);background:var(--cc-panel);color:var(--cc-ink);box-shadow:0 12px 35px light-dark(#17213326,#00000070)}
html:root[data-design] .appearance-settings {display:grid;gap:12px;min-width:0}
html:root[data-design] .site-header .appearance-settings .design-picker {display:grid;grid-template-columns:90px minmax(0,1fr);gap:10px;align-items:center;min-width:0}
html:root[data-design] .appearance-settings .theme-setting {display:grid;grid-template-columns:90px minmax(0,1fr);gap:10px;align-items:center;min-width:0}
html:root[data-design] .appearance-settings .theme-setting>span {color:var(--cc-muted);font-size:.8rem}
html:root[data-design] .appearance-settings .design-picker select {width:100%;min-width:0;min-height:44px}
html:root[data-design] .appearance-settings #theme-toggle {width:100%;min-height:44px;font-size:.85rem}
html:root[data-design] .appearance-settings .music-volume-control {display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:8px;width:100%;padding:4px 0;margin:0;font-size:.75rem}
html:root[data-design] .appearance-settings .music-volume-control input {width:100%;min-width:0;padding:0}
html:root[data-design] .appearance-settings .music-volume-control output {font-variant-numeric:tabular-nums}
html:root[data-design] .gl-dialog .lobby-settings-panel {position:static;width:100%;padding:0;border:0;background:transparent;box-shadow:none}
html:root[data-design] .gl-dialog .appearance-settings {width:100%}
html:root[data-design] .design-picker {display:flex;align-items:center;gap:7px;min-width:0;color:var(--cc-muted);font-size:.8rem}
html:root[data-design] .design-picker span {white-space:nowrap}
html:root[data-design] .design-picker select {min-width:0;max-width:100%;font-size:.8rem}
@media(hover:hover) {
  html:root[data-design] #lobby #match-start:hover:not(:disabled) {border-color:var(--design-highlight);background:linear-gradient(145deg,var(--cc-panel),color-mix(in srgb,var(--design-highlight) 9%,var(--cc-panel)))}
  html:root[data-design] #friend-room-setup [data-room-seats]:hover:not(:disabled) {background:var(--hover);border-color:var(--design-highlight)}
  html:root[data-design] .btn:not(.btn-primary):not(.btn-danger):hover:not(:disabled) {background-color:var(--hover);border-color:var(--cc-cell-line)}
  html:root[data-design] :is(.btn-primary,.sp-primary,.round-settings-close):hover:not(:disabled) {background:var(--primary-hover);border-color:var(--primary-hover)}
  html:root[data-design] #lobby .bot-entry-button:hover:not(:disabled) {background:var(--hover);border-color:var(--design-highlight)}
  html:root[data-design] #colorlink-game #cl-actions .btn[data-action="give-up"]:hover:not(:disabled) {background:color-mix(in srgb,var(--error) 12%,var(--cc-panel));border-color:var(--error)}
}
@media(max-width:520px) {
  html:root[data-design] #lobby #match-start {min-height:160px;padding:11px}
  html:root[data-design] #match-choice-dialog {padding:14px}
  html:root[data-design] #match-choice-dialog[open] {row-gap:10px}
  html:root[data-design] .match-choice-actions {gap:9px}
  html:root[data-design] .match-choice-actions .btn {font-size:.88rem;padding:12px 8px}
  html:root[data-design] body:not(.game-screen-active) #room:has(> .friend-room-setup:not([hidden])) {padding:17px;margin:16px auto}
  html:root[data-design] .friend-room-seat-options {gap:9px}
  html:root[data-design] #friend-room-setup [data-room-seats] {min-height:94px;padding:13px 11px}
  html:root[data-design] #friend-room-setup [data-room-seats] strong {font-size:1rem}
  html:root[data-design] .design-picker {flex-wrap:wrap;gap:4px 7px}
  html:root[data-design] .brand-hero {min-height:60px;padding:13px 15px;gap:10px}
  html:root[data-design] .brand-mark {width:26px;height:26px}
  html:root[data-design] #lobby .lobby-board-preview svg {max-height:160px;width:min(100%,180px)}
  html:root[data-design] #lobby :is(.bot-entry,.solver-entry) {grid-template-columns:26px minmax(0,1fr) auto}
  html:root[data-design] #lobby :is(.bot-entry-art,.solver-entry-art) {width:26px;height:26px}
  html:root[data-design] #lobby .solver-entry .btn {grid-column:auto}
  html:root[data-design] #lobby .mh-entry {padding-right:10px;flex-direction:row;align-items:center;flex-wrap:nowrap}
  html:root[data-design] #lobby .bot-entry-button {grid-column:auto}
  html:root[data-design] #lobby :is(.tutorial-entry-button,.bot-entry-button,.solver-entry .btn,#history-open) {width:96px;min-width:96px;font-size:.78rem}
  html:root[data-design] #lobby :is(.tutorial-entry,.bot-entry,.solver-entry) {padding:9px;gap:7px}
  html:root[data-design] :is(.gl-controls,.gl-board-stage) {--design-panel-radius:10px}
  html:root[data-design="flow"] :is(.gl-controls,.gl-board-stage) {--design-panel-radius:14px}
  html:root[data-design="neon"] .cc-bridge {filter:drop-shadow(0 0 1px light-dark(#087c8666,#58f2f16b))}
}
@media(max-width:700px) {
  html:root[data-design] .site-header .brand-hero {grid-template-columns:auto minmax(0,1fr) auto;gap:10px;min-height:60px;padding:12px 13px}
  html:root[data-design] .site-header .brand-title {font-size:clamp(1rem,3.5vw,1.35rem);gap:.22em;letter-spacing:-.055em}
  html:root[data-design] .site-header .header-controls {grid-column:2/-1;grid-row:2;position:static}
  html:root[data-design] .site-header .lobby-settings-panel {right:12px;width:min(360px,calc(100% - 24px))}
  html:root[data-design] .site-header .display-settings {width:auto;gap:7px;flex:0 1 auto}
  html:root[data-design] .site-header .staging-badge {font-size:.61rem;padding:4px 6px}
  html:root[data-design] .site-header .appearance-settings .design-picker {grid-template-columns:78px minmax(0,1fr)}
  html:root[data-design] .appearance-settings .theme-setting {grid-template-columns:78px minmax(0,1fr)}
}
@media(max-height:260px) {
  html:root[data-design] #match-choice-dialog {padding:10px}
  html:root[data-design] #match-choice-dialog[open] {row-gap:8px}
  html:root[data-design] .match-choice-actions {gap:9px}
  html:root[data-design] .match-choice-actions .btn {padding:10px 8px;font-size:.85rem}
}
/* Very short windows keep readable full-width choices inside a scrollable dialog. */
@media(max-height:180px) {
  html:root[data-design] #match-choice-dialog {--match-choice-width:min(512px,calc(100vw - 32px));height:min(calc(var(--match-choice-width) / 1.618),calc(100dvh - 24px));padding:10px}
  html:root[data-design] #match-choice-dialog[open] {display:block}
  html:root[data-design] .match-choice-toolbar {margin-bottom:8px}
  html:root[data-design] .match-choice-actions {min-height:64px;gap:9px}
  html:root[data-design] .match-choice-actions .btn {padding:10px 8px;font-size:.85rem}
}
@media(prefers-reduced-motion:reduce) {
  html:root[data-design] :is(.btn,.gl-menu-tab,.sp-color,.mh-match) {transition:none}
}

/* Rated-match heraldry and rating summaries. */
.league-roster { display:flex; justify-content:center; align-items:start; gap:clamp(8px,3vw,20px); }
.league-roster[hidden], .league-result[hidden] { display:none; }
.league-player { min-width:0; width:96px; display:grid; justify-items:center; gap:2px; }
:is(.league-player,.match-mode-card) {
  --league-metal:#b9cada; --league-midtone:#6a8195; --league-shade:#30445a;
  --league-ink:light-dark(color-mix(in srgb,var(--league-shade) 82%,#0b1526),color-mix(in srgb,var(--league-metal) 75%,#fff));
}
:is(.league-player,.match-mode-card)[data-league="1"] { --league-metal:#f19b67; --league-midtone:#a64a29; --league-shade:#552419; }
:is(.league-player,.match-mode-card)[data-league="2"] { --league-metal:#71e0af; --league-midtone:#2c9661; --league-shade:#123c36; }
:is(.league-player,.match-mode-card)[data-league="3"] { --league-metal:#7cb3ff; --league-midtone:#3d65bf; --league-shade:#23366b; }
:is(.league-player,.match-mode-card)[data-league="4"] { --league-metal:#c998ff; --league-midtone:#8556c3; --league-shade:#3b246c; }
:is(.league-player,.match-mode-card)[data-league="5"] { --league-metal:#ffcf64; --league-midtone:#cd8725; --league-shade:#673a1e; }
:is(.league-player,.match-mode-card)[data-league="6"] { --league-metal:#ff729c; --league-midtone:#bc3b67; --league-shade:#661c3b; }
.league-crest { position:relative; display:block; width:var(--league-size,84px); height:var(--league-size,84px); }
.league-frame { position:absolute; inset:0; width:100%; height:100%; overflow:visible; }
.league-metal-shine { stop-color:color-mix(in srgb,var(--league-metal) 76%,#fff); }
.league-metal-color { stop-color:var(--league-midtone); }
.league-metal-shade { stop-color:var(--league-shade); }
.league-shield { stroke:var(--league-metal); stroke-width:3; stroke-linejoin:round; }
.league-shield-inset { fill:color-mix(in srgb,var(--league-shade) 48%,#071020); stroke:var(--league-metal); stroke-opacity:.8; stroke-width:1.25; stroke-linejoin:round; }
.league-surround { stroke:var(--league-midtone); stroke-width:3; stroke-linecap:round; stroke-linejoin:round; }
.league-ornament { stroke:var(--league-metal); stroke-width:1.6; stroke-linejoin:round; }
.league-jewel { fill:var(--league-metal); stroke:var(--league-shade); stroke-width:1.5; stroke-linejoin:round; }
.league-weapon { position:absolute; top:22%; left:19%; width:62%; height:62%; overflow:visible; }
[data-league="unrated"] .league-crest { opacity:.64; }
.league-player-name { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.8rem; color:inherit; }
.league-player-rating { white-space:nowrap; font-size:.72rem; color:var(--league-ink); font-weight:800; }
.league-result { display:flex; flex-wrap:wrap; justify-content:center; gap:5px 12px; font-size:.78rem; font-weight:750; }
.league-result-title { width:100%; }
.league-result-gain { color:#b8f5c8; color:light-dark(#116941,#b8f5c8); }
.league-result-loss { color:#ffd1d1; color:light-dark(#9e2843,#ffd1d1); }
@media (max-width:420px) {
  .league-player { width:85px; --league-size:66px; }
}
