@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Noto+Sans+SC:wght@400;500;600;700;800;900&display=swap");

:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-2: #0b1727;
  --surface: #0e1b2c;
  --surface-2: #142338;
  --surface-3: #1a2b42;
  --line: rgba(169, 199, 232, 0.16);
  --line-strong: rgba(169, 199, 232, 0.3);
  --text: #f3f7fb;
  --muted: #8da2ba;
  --accent: #ffd45a;
  --accent-2: #42c8ff;
  --danger: #ff6478;
  --success: #5be3a1;
  --cell: 34px;
  --cell-covered: #1d3049;
  --cell-covered-hover: #294361;
  --cell-open: #0b1726;
  --cell-border-light: #405977;
  --cell-border-dark: #07111d;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
  font-family: "Noto Sans SC", system-ui, sans-serif;
  font-synthesis: none;
}

body[data-theme="classic"] {
  --bg: #1c2228;
  --bg-2: #242b31;
  --surface: #30373e;
  --surface-2: #3a424a;
  --surface-3: #48515a;
  --line: rgba(255, 255, 255, 0.13);
  --line-strong: rgba(255, 255, 255, 0.25);
  --text: #fff;
  --muted: #bac2c9;
  --accent: #ffe64d;
  --accent-2: #68d4ff;
  --cell-covered: #aeb7be;
  --cell-covered-hover: #c5cdd2;
  --cell-open: #d7dce0;
  --cell-border-light: #eff2f4;
  --cell-border-dark: #68747d;
}

body[data-theme="chocolate"] {
  --bg: #1d100d;
  --bg-2: #2a1712;
  --surface: #351e18;
  --surface-2: #46271f;
  --surface-3: #5c3429;
  --line: rgba(255, 221, 187, 0.14);
  --line-strong: rgba(255, 221, 187, 0.28);
  --text: #fff6e9;
  --muted: #c4a58e;
  --accent: #ffcc6c;
  --accent-2: #ff8f70;
  --cell-covered: #643d31;
  --cell-covered-hover: #7c4c3c;
  --cell-open: #2a1712;
  --cell-border-light: #976553;
  --cell-border-dark: #21100d;
}

body[data-theme="paper"] {
  color-scheme: light;
  --bg: #e9edf0;
  --bg-2: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #f1f4f6;
  --surface-3: #e4e9ed;
  --line: rgba(21, 37, 51, 0.13);
  --line-strong: rgba(21, 37, 51, 0.25);
  --text: #132331;
  --muted: #667785;
  --accent: #e4ae00;
  --accent-2: #007db5;
  --cell-covered: #d7e0e6;
  --cell-covered-hover: #e2e9ed;
  --cell-open: #f8fafb;
  --cell-border-light: #ffffff;
  --cell-border-dark: #91a1ac;
  --shadow: 0 28px 80px rgba(32, 46, 57, 0.16);
}

* { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 15%, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 28rem),
    radial-gradient(circle at 89% 2%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 30rem),
    var(--bg);
}

button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}

[hidden] { display: none !important; }
.page-shell { width: min(1500px, 100%); min-height: 100vh; margin: 0 auto; padding: 0 42px; }

.site-header {
  height: 94px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 42px; height: 48px; display: grid; place-items: center;
  color: var(--bg); background: var(--accent); font: 900 31px/1 sans-serif;
  clip-path: polygon(28% 0, 91% 0, 66% 38%, 100% 38%, 31% 100%, 43% 55%, 6% 55%);
}
.brand strong { display: block; font-size: 18px; font-weight: 800; letter-spacing: .08em; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font: 500 9px/1.2 "DM Mono", monospace; letter-spacing: .16em; }
.header-actions { display: flex; gap: 10px; }
.account-button { min-height: 40px; padding: 5px 13px; border: 1px solid var(--line); color: var(--text); background: transparent; cursor: pointer; font-size: 11px; }
.account-button small { display: block; margin-top: 2px; color: var(--accent); font: 500 8px "DM Mono", monospace; }
.account-button:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.icon-button {
  width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%;
  color: var(--muted); background: transparent; cursor: pointer; transition: .2s ease;
}
.icon-button:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface-2); transform: translateY(-1px); }

.hero { padding: 58px 0 42px; }
.hero .eyebrow, .panel-heading p, .dialog-head p {
  margin: 0 0 12px; color: var(--accent-2); font: 500 11px/1 "DM Mono", monospace; letter-spacing: .22em;
}
.hero h1 { margin: 0; max-width: 900px; font-size: clamp(40px, 5.1vw, 76px); line-height: 1.04; font-weight: 900; letter-spacing: -.055em; }
.hero h1 em { color: var(--accent); font-style: normal; }
.hero > p:last-child { max-width: 660px; margin: 22px 0 0; color: var(--muted); font-size: 15px; line-height: 1.8; }

.mode-tabs { display: flex; gap: 0; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.mode-tabs::-webkit-scrollbar { display: none; }
.mode-tab {
  position: relative; flex: 0 0 auto; min-width: 138px; padding: 16px 18px 18px;
  border: 0; color: var(--muted); background: transparent; cursor: pointer; font-weight: 600; transition: color .2s ease;
}
.mode-tab span { display: block; margin-bottom: 7px; color: color-mix(in srgb, var(--muted) 65%, transparent); font: 500 9px "DM Mono", monospace; }
.mode-tab.is-locked span::after { content: " · 需登录"; color: var(--danger); }
.mode-tab::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: -1px; height: 2px; background: var(--accent); transform: scaleX(0); transition: transform .2s ease; }
.mode-tab:hover, .mode-tab.is-active { color: var(--text); }
.mode-tab.is-active::after { transform: scaleX(1); }

.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px 190px; gap: 18px; padding: 28px 0 56px; align-items: start; }
.game-card, .control-panel, .recent-panel { border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: var(--shadow); }
.game-card { min-width: 0; }
.game-toolbar { height: 84px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 24px; border-bottom: 1px solid var(--line); }
.counter { display: flex; flex-direction: column; align-items: flex-start; }
.counter-right { align-items: flex-end; }
.counter span { color: var(--muted); font: 500 9px/1 "DM Mono", monospace; letter-spacing: .17em; }
.counter strong { margin-top: 6px; font: 500 27px/1 "DM Mono", monospace; letter-spacing: .08em; }
.restart-button { width: 74px; height: 60px; border: 0; color: var(--accent); background: transparent; cursor: pointer; transition: transform .2s ease; }
.restart-button:hover { transform: scale(1.08); }
.restart-button > img { display: block; width: 38px; height: 38px; margin: 0 auto; border-radius: 10px; }
.restart-button small { display: block; margin-top: 6px; color: var(--muted); font: 500 8px/1 "DM Mono", monospace; letter-spacing: .13em; }
.restart-button.is-fail { color: var(--danger); }
.restart-button.is-win { color: var(--success); }

.board-frame { position: relative; min-height: 444px; display: grid; place-items: center; background: var(--bg-2); overflow: hidden; }
.board-frame::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .28;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle, black, transparent 78%);
}
.board-scroll { position: relative; z-index: 1; width: 100%; max-width: 100%; max-height: min(66vh, 720px); overflow: auto; padding: 34px; scrollbar-color: var(--surface-3) transparent; }
.board { display: grid; width: max-content; margin: auto; padding: 5px; background: var(--cell-border-dark); box-shadow: 0 12px 32px rgba(0,0,0,.28); user-select: none; touch-action: pan-x pan-y; }
.cell {
  position: relative; width: var(--cell); height: var(--cell); display: grid; place-items: center; padding: 0;
  border: 1px solid color-mix(in srgb, var(--cell-border-dark) 72%, transparent); border-radius: 0;
  color: var(--text); background: var(--cell-open); font: 900 calc(var(--cell) * .55)/1 "DM Mono", monospace;
  cursor: default; -webkit-tap-highlight-color: transparent;
}
.cell.is-covered {
  border-style: solid; border-width: 3px; border-color: var(--cell-border-light) var(--cell-border-dark) var(--cell-border-dark) var(--cell-border-light);
  background: var(--cell-covered); cursor: pointer;
}
.cell.is-covered.is-pressed-preview,
.cell.is-blindfold-gray.is-pressed-preview {
  border: 1px solid var(--cell-border-dark);
  background-color: var(--cell-open);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.cell.is-flagged { font-size: calc(var(--cell) * .48); text-shadow: 0 2px 3px rgba(0,0,0,.3); }
.cell.is-mine { font-size: calc(var(--cell) * .5); background: color-mix(in srgb, var(--danger) 24%, var(--cell-open)); }
.cell.is-design-mine { color: var(--bg); background: var(--accent); cursor: pointer; }
.cell.is-exploded { background: var(--danger); }
.cell.is-wrong { color: var(--danger); }
.cell.is-target:not(.is-open)::after {
  content: ""; position: absolute; inset: 1px; border: 2px solid var(--accent-2); pointer-events: none;
  box-shadow: inset 0 0 9px color-mix(in srgb, var(--accent-2) 35%, transparent);
}
.cell[data-number="1"] { color: #4aa8ff; }
.cell[data-number="2"] { color: #46d18c; }
.cell[data-number="3"] { color: #ff6575; }
.cell[data-number="4"] { color: #a888ff; }
.cell[data-number="5"] { color: #f2a34b; }
.cell[data-number="6"] { color: #36d4dd; }
.cell[data-number="7"] { color: color-mix(in srgb, var(--text) 88%, transparent); }
.cell[data-number="8"] { color: var(--muted); }
body[data-theme="classic"] .cell.is-open, body[data-theme="paper"] .cell.is-open { color: #202d36; }
body[data-theme="classic"] .cell[data-number="1"], body[data-theme="paper"] .cell[data-number="1"] { color: #064cc7; }
body[data-theme="classic"] .cell[data-number="2"], body[data-theme="paper"] .cell[data-number="2"] { color: #087a38; }
body[data-theme="classic"] .cell[data-number="3"], body[data-theme="paper"] .cell[data-number="3"] { color: #d12c34; }
.cell.has-skin { border: 0; background-position: center; background-repeat: no-repeat; background-size: 100% 100%; }
.cell.has-skin.is-pressed-preview { filter: none; }
.cell.is-blind-fading {
  filter: grayscale(var(--blind-fade));
}
.cell.is-blind-fading::after,
.cell.is-blind-timed::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background: rgba(116,116,116,var(--blind-fade));
}
.cell.is-blind-timed { animation: blind-cell-gray var(--blind-duration) linear var(--blind-delay) forwards; }
.cell.is-blind-timed::after { animation: blind-cell-cover var(--blind-duration) linear var(--blind-delay) forwards; }
@keyframes blind-cell-gray { to { filter: grayscale(1); } }
@keyframes blind-cell-cover { to { background: rgba(116,116,116,1); } }
.cell.is-blind-hidden,
.cell.has-skin.is-blind-hidden {
  border: 1px solid #5e5e5e;
  color: transparent;
  background: #747474;
  background-image: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
  text-shadow: none;
  cursor: pointer;
}
.cell.is-blindfold-gray,
.cell.has-skin.is-blindfold-gray {
  border: 1px solid #5e5e5e;
  color: transparent;
  background: #747474;
  background-image: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
  text-shadow: none;
  cursor: pointer;
}
.cell.is-blindfold-all { border-color: #666; }
.cell.is-blindfold-gray.is-baby-hint-red,
.cell.has-skin.is-blindfold-gray.is-baby-hint-red {
  border-color: #ff596b;
  background: color-mix(in srgb, #ff4058 58%, #5f353a);
  background-image: none;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.13), 0 0 10px rgba(255,64,88,.28);
}
.cell.is-blindfold-gray.is-baby-hint-green,
.cell.has-skin.is-blindfold-gray.is-baby-hint-green {
  border-color: #4ee09a;
  background: color-mix(in srgb, #2acb7d 58%, #315847);
  background-image: none;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.13), 0 0 10px rgba(42,203,125,.25);
}
.cell.is-blindfold-gray.is-baby-hint-red.is-pressed-preview,
.cell.is-blindfold-gray.is-baby-hint-green.is-pressed-preview {
  border: 1px solid var(--cell-border-dark);
  background: var(--cell-open);
  box-shadow: none;
}

.result-overlay { position: absolute; z-index: 4; inset: 0; display: grid; place-content: center; text-align: center; background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(5px); animation: fade-in .25s ease; }
.result-overlay p { margin: 0 0 8px; color: var(--success); font: 500 11px "DM Mono", monospace; letter-spacing: .24em; }
.result-overlay.is-fail p { color: var(--danger); }
.result-overlay h2 { margin: 0; font-size: 36px; }
.result-overlay button { margin: 24px auto 0; padding: 11px 18px; border: 1px solid var(--line-strong); background: var(--surface-2); cursor: pointer; }
.result-overlay button span { margin-left: 14px; color: var(--accent); }
@keyframes fade-in { from { opacity: 0; } }
.no-result-animation .result-overlay { animation: none; }

.replay-bar { min-height: 54px; display: grid; grid-template-columns: auto auto auto minmax(110px, 1fr) auto auto; align-items: center; gap: 9px; padding: 9px 14px; border-top: 1px solid var(--line); background: var(--surface-2); }
.replay-bar button, .replay-bar select { min-height: 34px; border: 1px solid var(--line); color: var(--text); background: transparent; cursor: pointer; }
.replay-bar button { padding: 0 11px; }
.replay-bar .replay-toggle { width: 38px; padding: 0; color: var(--bg); border-color: var(--accent); background: var(--accent); }
.replay-bar output { color: var(--muted); font: 500 9px "DM Mono", monospace; white-space: nowrap; }
.replay-bar input { width: 100%; accent-color: var(--accent); }
.replay-bar select { padding: 0 7px; }

.game-footer { min-height: 62px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 15px; padding: 12px 20px; border-top: 1px solid var(--line); }
.game-footer p { grid-column: 1; margin: 0; color: var(--muted); font-size: 12px; }
.pulse-dot { display: inline-block; width: 7px; height: 7px; margin-right: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px color-mix(in srgb, var(--success) 12%, transparent); }
.flag-mode { grid-column: 2; padding: 8px 11px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.flag-mode[aria-pressed="true"] { color: var(--text); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.flag-mode:disabled { opacity: .42; cursor: not-allowed; }
.board-zoom { grid-column: 3; display: flex; align-items: center; justify-self: end; border: 1px solid var(--line); }
.board-zoom button { width: 34px; height: 34px; padding: 0; border: 0; color: var(--text); background: transparent; font: 500 20px/1 "DM Mono", monospace; cursor: pointer; }
.board-zoom button:hover:not(:disabled) { color: var(--bg); background: var(--accent); }
.board-zoom button:disabled { color: color-mix(in srgb, var(--muted) 45%, transparent); cursor: not-allowed; }
.board-zoom output { min-width: 48px; color: var(--muted); text-align: center; font: 500 9px/1 "DM Mono", monospace; }

.control-panel { min-height: 520px; padding: 26px; }
.recent-panel { min-height: 180px; padding: 22px 18px; }
.recent-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.recent-heading p { margin: 0 0 7px; color: var(--accent); font: 500 8px "DM Mono", monospace; letter-spacing: .16em; }
.recent-heading h2 { margin: 0; font-size: 17px; }
.recent-heading button { padding: 7px 8px; border: 1px solid var(--line); color: var(--muted); background: transparent; cursor: pointer; font-size: 9px; }
.recent-heading button:hover { color: var(--accent); border-color: var(--accent); }
.recent-rounds { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.recent-rounds li { display: grid; grid-template-columns: 19px minmax(0, 1fr); gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.recent-rounds li:last-child { border-bottom: 0; }
.recent-index { color: color-mix(in srgb, var(--muted) 58%, transparent); font: 500 8px "DM Mono", monospace; }
.recent-round { min-width: 0; }
.recent-round strong { display: block; font: 500 13px "DM Mono", monospace; letter-spacing: .03em; }
.recent-round small { display: block; overflow: hidden; margin-top: 4px; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.recent-round .is-loss { color: var(--danger); }
.recent-empty { display: block !important; color: var(--muted); font-size: 10px; line-height: 1.6; }
.panel-heading { display: flex; justify-content: space-between; align-items: start; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.panel-heading p { margin-bottom: 8px; }
.panel-heading h2 { margin: 0; font-size: 22px; }
.panel-heading > span { color: color-mix(in srgb, var(--muted) 50%, transparent); font: 500 34px/1 "DM Mono", monospace; }
.control-group { padding: 22px 0; border-bottom: 1px solid var(--line); }
.field-label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 12px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.segmented-four { grid-template-columns: repeat(2, 1fr); }
.segmented-two { grid-template-columns: repeat(2, 1fr); margin-bottom: 18px; }
.custom-find-label { margin-top: 18px; }
.no-guess-board-label { margin-top: 18px; }
.no-guess-note, .layout-note { margin: 12px 0 0; color: var(--muted); font-size: 10px; line-height: 1.65; }
.blind-board-label { margin-top: 18px; }
.blind-flag-option { margin: 14px 0 2px; }
.blind-deaf-option { margin: 14px 0 2px; }
.layout-build-option { margin: 14px 0 2px; }
.blind-reveal-button { display: flex; align-items: center; justify-content: center; gap: 8px; }
.blind-reveal-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.blind-quick-start-button { display: flex; align-items: center; justify-content: center; gap: 8px; }
.blind-quick-start-button:disabled { opacity: .45; cursor: not-allowed; }
.blind-status { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 11px 12px; border: 1px solid var(--line); background: var(--surface-2); font: 500 10px "DM Mono", monospace; }
.blind-status span { color: var(--accent-2); }
.blind-status strong { color: var(--muted); font-weight: 500; }
.layout-status { display: flex; justify-content: space-between; gap: 10px; margin-top: 13px; padding: 11px 12px; border: 1px solid var(--line); background: var(--surface-2); font: 500 10px "DM Mono", monospace; }
.layout-status span { color: var(--accent); }
.layout-status strong { color: var(--muted); font-weight: 500; }
.segmented button { padding: 11px 3px 9px; border: 1px solid var(--line); background: var(--surface-2); font-size: 12px; cursor: pointer; }
.segmented button small { display: block; margin-top: 5px; color: var(--muted); font: 400 8px "DM Mono", monospace; }
.segmented button.is-active { border-color: var(--accent); color: var(--bg); background: var(--accent); }
.segmented button.is-active small { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.secondary-button, .primary-button { width: 100%; min-height: 43px; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; transition: .2s ease; }
.secondary-button { margin-top: 14px; }
.secondary-button span { float: right; margin-right: 12px; color: var(--accent); }
.secondary-button:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.button-row .secondary-button { margin-top: 8px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-grid label, .dialog-fields label, .settings-list > label:not(.check-row) { color: var(--muted); font-size: 11px; }
.field-grid input, .field-grid select, .dialog-fields input, .settings-list select {
  display: block; width: 100%; height: 39px; margin-top: 6px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: 0; color: var(--text); background: var(--surface-2);
}
.field-grid input[type="range"] { height: 24px; padding: 0; accent-color: var(--accent); }
.field-grid output { float: right; color: var(--text); font-family: "DM Mono", monospace; }
.field-wide { grid-column: 1 / -1; }
.check-row { display: flex; align-items: center; gap: 9px; margin-top: 13px; color: var(--muted); font-size: 12px; cursor: pointer; }
.check-row input { position: absolute; opacity: 0; pointer-events: none; }
.check-row > span { width: 29px; height: 16px; padding: 2px; border-radius: 20px; background: var(--surface-3); transition: .2s ease; }
.check-row > span::before { content: ""; display: block; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); transition: .2s ease; }
.check-row input:checked + span { background: color-mix(in srgb, var(--accent) 75%, var(--surface-3)); }
.check-row input:checked + span::before { transform: translateX(13px); background: var(--bg); }
.training-note { margin-top: 18px; padding: 14px; border-left: 2px solid var(--accent-2); background: color-mix(in srgb, var(--accent-2) 7%, transparent); }
.training-note span { color: var(--accent-2); font: 500 8px "DM Mono", monospace; letter-spacing: .18em; }
.training-note p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.session-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 22px; background: var(--line); }
.session-stats div { padding: 15px; background: var(--surface-2); }
.session-stats span { display: block; color: var(--muted); font-size: 10px; }
.session-stats strong { display: block; margin-top: 7px; font: 500 22px "DM Mono", monospace; }
.average-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin-top: 1px; background: var(--line); }
.average-stats div { padding: 10px 15px; background: var(--surface-2); }
.average-stats span { color: var(--muted); font: 500 9px "DM Mono", monospace; text-transform: uppercase; }
.average-stats strong { float: right; font: 500 10px "DM Mono", monospace; }
.average-stats .is-dnf { color: var(--danger); }
.endless-level { display: grid; gap: 5px; padding: 16px; border-left: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.endless-level span, .endless-level small { color: var(--muted); font-size: 10px; }
.endless-level strong { font: 700 28px "DM Mono", monospace; color: var(--accent); }
.endless-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 10px; }
.endless-level-select { width: 100%; min-height: 42px; padding: 0 10px; border: 1px solid var(--line); color: var(--text); background: var(--surface-2); font: 500 10px "DM Mono", monospace; }
.endless-unlocked { margin: 8px 0 0; color: var(--muted); font: 500 9px "DM Mono", monospace; }
.keyboard-tip { margin: 17px 0 0; text-align: center; color: var(--muted); font-size: 10px; }
kbd { padding: 2px 5px; border: 1px solid var(--line-strong); background: var(--surface-2); font: inherit; }

.site-footer { min-height: 76px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); color: var(--muted); font: 500 9px "DM Mono", monospace; letter-spacing: .15em; }

dialog { width: min(500px, calc(100% - 28px)); padding: 0; border: 1px solid var(--line-strong); color: var(--text); background: var(--surface); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(2, 7, 13, .74); backdrop-filter: blur(4px); }
dialog form { padding: 28px; }
.dialog-head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 24px; }
.dialog-head h2 { margin: 0; font-size: 25px; }
.dialog-head button { width: 34px; height: 34px; border: 1px solid var(--line); color: var(--muted); background: transparent; cursor: pointer; font-size: 20px; }
.dialog-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.primary-button { margin-top: 23px; border: 0; color: #07111f; background: var(--accent); font-weight: 700; }
.primary-button:hover { filter: brightness(1.08); }
.form-error { min-height: 20px; margin: 10px 0 -10px; color: var(--danger); font-size: 12px; }
.settings-list { display: grid; gap: 16px; }
.settings-list .check-row { margin-top: 2px; }
.cell-size-setting { color: var(--muted); font-size: 11px; }
.cell-size-setting output { float: right; color: var(--text); font-family: "DM Mono", monospace; }
.cell-size-setting input { display: block; width: 100%; margin-top: 10px; accent-color: var(--accent); }
.skin-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: -7px; }
.skin-actions button { min-height: 38px; border: 1px solid var(--line); color: var(--text); background: var(--surface-2); cursor: pointer; font-size: 11px; }
.skin-actions button:hover:not(:disabled) { border-color: var(--accent); }
.skin-actions button:disabled { opacity: .4; cursor: not-allowed; }
.skin-import-note { margin: -9px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.help-dialog { width: min(680px, calc(100% - 28px)); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 18px; }
.auth-tabs button { min-height: 40px; border: 1px solid var(--line); color: var(--muted); background: var(--surface-2); cursor: pointer; }
.auth-tabs button.is-active { color: var(--bg); border-color: var(--accent); background: var(--accent); }
.auth-fields { grid-template-columns: 1fr 1fr; }
.profile-card { display: grid; gap: 7px; padding: 20px; border-left: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.profile-card span, .profile-card small { color: var(--muted); font-size: 11px; }
.profile-card strong { font-size: 24px; }
.account-note { color: var(--muted); font-size: 11px; line-height: 1.7; }
.leaderboard-dialog { width: min(560px, calc(100% - 28px)); }
.leaderboard-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.leaderboard-filters select { height: 40px; padding: 0 10px; border: 1px solid var(--line); color: var(--text); background: var(--surface-2); }
.leaderboard-variant { color: var(--muted); font: 500 10px "DM Mono", monospace; }
.leaderboard-list { max-height: 50vh; overflow: auto; margin: 0; padding: 0; list-style: none; }
.leaderboard-list li { display: grid; grid-template-columns: 42px 1fr auto; gap: 10px; padding: 12px 6px; border-bottom: 1px solid var(--line); }
.leaderboard-list li span { color: var(--accent); font: 500 10px "DM Mono", monospace; }
.leaderboard-list li strong { font-size: 12px; }
.leaderboard-list li em { font: 500 11px "DM Mono", monospace; font-style: normal; }
.recordings-dialog { width: min(680px, calc(100% - 28px)); }
.recordings-note { margin: -8px 0 16px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.recordings-list { max-height: 52vh; overflow: auto; margin: 0; padding: 0; list-style: none; }
.recordings-list li { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--line); }
.recordings-list .recording-index { color: var(--accent); font: 500 10px "DM Mono", monospace; }
.recording-detail { min-width: 0; }
.recording-detail strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.recording-detail small { display: block; margin-top: 5px; color: var(--muted); font: 500 9px "DM Mono", monospace; }
.recordings-list button { min-height: 34px; padding: 0 12px; border: 1px solid var(--accent); color: var(--accent); background: transparent; cursor: pointer; }
.help-content { display: grid; gap: 18px; max-height: 56vh; overflow-y: auto; }
.help-content section { padding-left: 15px; border-left: 1px solid var(--line-strong); }
.help-content h3 { margin: 0 0 8px; font-size: 14px; }
.help-content p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.help-content b { color: var(--text); }
.toast-region { position: fixed; z-index: 20; right: 24px; bottom: 24px; display: grid; gap: 8px; }
.toast { padding: 11px 16px; border: 1px solid var(--line-strong); background: var(--surface-2); box-shadow: var(--shadow); font-size: 12px; animation: toast-in .2s ease; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 1180px) {
  .page-shell { padding: 0 24px; }
  .game-layout { grid-template-columns: 1fr; }
  .control-panel { min-height: auto; }
  .recent-panel { min-height: auto; }
  .recent-rounds { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 18px; }
}

@media (max-width: 650px) {
  .page-shell { padding: 0 14px; }
  .site-header { height: 76px; }
  .header-actions .account-button:first-child { display: none; }
  .account-button { padding-inline: 8px; }
  .hero { padding: 42px 0 30px; }
  .hero h1 { font-size: 42px; }
  .mode-tab { min-width: 122px; padding-inline: 10px; }
  .game-layout { padding-top: 18px; }
  .game-toolbar { height: 72px; padding: 0 15px; }
  .counter strong { font-size: 22px; }
  .restart-button { height: 54px; }
  .board-frame { min-height: 380px; }
  .board-scroll { padding: 22px 12px; }
  .game-footer { align-items: flex-start; }
  .game-footer p { max-width: 230px; line-height: 1.5; }
  .flag-mode span { display: none; }
  .replay-bar { grid-template-columns: auto auto 1fr auto; }
  .replay-bar output { display: none; }
  .replay-bar input { grid-column: 1 / -1; grid-row: 2; }
  .replay-bar #replay-exit { grid-column: 4; grid-row: 1; }
  .board-zoom output { display: none; }
  .board-zoom button { width: 32px; }
  .control-panel { padding: 20px; }
  .recent-rounds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dialog-fields { grid-template-columns: 1fr; }
  .auth-fields { grid-template-columns: 1fr; }
  .site-footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Multi-page shell — structure inspired by pku2048, retaining Lightning colors. */
.topbar { height: 88px; gap: 24px; }
.primary-nav { display: flex; align-items: center; justify-content: center; gap: 4px; margin-left: auto; }
.primary-nav a,
.primary-nav button {
  min-height: 40px; padding: 10px 13px; border: 0; border-radius: 11px;
  color: var(--muted); background: transparent; text-decoration: none; font-size: 13px; font-weight: 700; cursor: pointer;
  transition: color .16s ease, background .16s ease, transform .16s ease;
}
.primary-nav a:hover,
.primary-nav button:hover,
.primary-nav a.is-active { color: var(--text); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.primary-nav a.is-active { color: var(--accent); }
.header-actions { align-items: center; }
.header-link-button {
  min-height: 40px; padding: 0 12px; border: 0; border-radius: 11px;
  color: var(--muted); background: transparent; font-weight: 700; cursor: pointer;
}
.header-link-button:hover { color: var(--text); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.account-button { border-radius: 11px; background: var(--surface); }
.site-main { min-height: calc(100vh - 164px); }
.site-view { animation: page-enter .24s ease both; }
@keyframes page-enter { from { opacity: 0; transform: translateY(7px); } }

.home-view,
.modes-view,
.guides-view { width: min(1180px, 100%); margin: 0 auto; padding: 24px 0 64px; }
.home-hero { min-height: 470px; display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(360px, .88fr); align-items: center; gap: 68px; padding: 50px 0 42px; }
.home-hero-copy .eyebrow,
.page-header .eyebrow,
.library-hero .eyebrow,
.section-heading > div > span { color: var(--accent-2); }
.home-hero-copy .eyebrow span { display: inline-block; width: 28px; height: 2px; margin-right: 8px; vertical-align: middle; background: var(--accent); }
.home-hero h1,
.page-header h1,
.library-hero h1 {
  margin: 0; font-size: clamp(45px, 6.2vw, 78px); line-height: .99; letter-spacing: -.055em; font-weight: 900;
}
.home-hero h1 em { display: block; color: var(--accent); font-style: normal; }
.home-hero-copy > p:last-of-type,
.page-header > p:last-child,
.library-hero > div > p:last-child { max-width: 610px; margin: 20px 0 0; color: var(--muted); font-size: 15px; line-height: 1.8; }
.home-actions { display: flex; gap: 10px; margin-top: 30px; }
.portal-button {
  display: inline-flex; min-height: 47px; align-items: center; justify-content: center; gap: 22px; padding: 0 19px;
  border: 1px solid var(--line-strong); border-radius: 5px; color: var(--text); background: var(--surface); text-decoration: none; font-weight: 750;
}
.portal-button.is-primary { border-color: var(--accent); color: var(--bg); background: var(--accent); }
.portal-button:hover { transform: translateY(-1px); border-color: var(--accent); }
.home-board-art { position: relative; display: grid; justify-items: center; gap: 18px; padding: 30px; }
.home-board-art::before { content: ""; position: absolute; inset: 4% 2%; border-radius: 50%; background: color-mix(in srgb, var(--accent-2) 12%, transparent); filter: blur(42px); }
.art-board {
  position: relative; display: grid; grid-template-columns: repeat(5, 62px); gap: 6px; padding: 12px;
  border-radius: 8px; background: var(--cell-border-dark); box-shadow: 0 34px 80px rgba(0,0,0,.35); transform: rotate(2.5deg);
}
.art-board i {
  width: 62px; height: 62px; display: grid; place-items: center; border: 4px solid;
  border-color: var(--cell-border-light) var(--cell-border-dark) var(--cell-border-dark) var(--cell-border-light);
  color: var(--text); background: var(--cell-covered); font: 900 28px "DM Mono", monospace; font-style: normal;
}
.art-board i.is-open { border: 1px solid var(--cell-border-dark); background: var(--cell-open); }
.art-board .n1 { color: #4aa8ff; }.art-board .n2 { color: #46d18c; }.art-board .n3 { color: #ff6575; }
.art-board .is-bolt { color: var(--bg); border-color: var(--accent); background: var(--accent); }
.art-board .is-flag { color: var(--accent); }
.home-board-art > span { position: relative; color: var(--muted); font: 500 9px "DM Mono", monospace; letter-spacing: .24em; }

.news-strip {
  min-height: 58px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px; padding: 0 20px;
  border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 5px; background: var(--surface);
}
.news-strip b { color: var(--accent); font-size: 12px; }
.news-strip span { color: var(--muted); font-size: 12px; }
.news-strip a { color: var(--text); text-decoration: none; font-size: 11px; font-weight: 700; }
.home-section { padding: 72px 0 22px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 22px; }
.section-heading span { font: 500 9px "DM Mono", monospace; letter-spacing: .2em; }
.section-heading h2 { margin: 8px 0 0; font-size: 30px; }
.section-heading > a { color: var(--muted); text-decoration: none; font-size: 12px; }
.explore-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.explore-card {
  position: relative; min-height: 290px; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; padding: 24px;
  border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--surface); text-decoration: none;
  transition: transform .2s ease, border-color .2s ease;
}
.explore-card:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.explore-no { position: absolute; top: 20px; right: 22px; color: var(--muted); font: 500 10px "DM Mono", monospace; }
.explore-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 7px; color: var(--bg); background: var(--accent); font-size: 26px; font-weight: 900; }
.card-modes .explore-icon { background: var(--accent-2); }.card-guides .explore-icon { color: var(--text); background: var(--surface-3); }
.explore-card h3 { margin: 23px 0 9px; font-size: 22px; }
.explore-card p { flex: 1; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.72; }
.explore-card > b { margin-top: 24px; color: var(--accent); font-size: 12px; }
.home-feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 42px; }
.home-feature-grid article { padding: 28px; border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--surface) 94%, transparent); }
.home-feature-grid article > span { color: var(--accent-2); font: 500 9px "DM Mono", monospace; letter-spacing: .18em; }
.home-feature-grid h2 { margin: 12px 0 8px; }
.home-feature-grid p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.home-feature-grid button { margin-top: 20px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 4px; background: transparent; cursor: pointer; }
.home-feature-grid button:hover { border-color: var(--accent); }

.game-view { padding-bottom: 10px; }
.page-hero { display: flex; justify-content: space-between; align-items: end; gap: 30px; padding: 46px 0 28px; }
.page-hero h1 { font-size: clamp(38px, 5vw, 60px); }
.page-hero > div > p:last-child { max-width: 620px; margin: 14px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.page-help-button { flex: 0 0 auto; padding: 11px 15px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: var(--surface); cursor: pointer; }
.page-help-button span { margin-left: 10px; color: var(--accent); }
.game-card, .control-panel, .recent-panel { border-radius: 7px; overflow: hidden; box-shadow: 0 16px 44px rgba(0,0,0,.18); }
.mode-tabs { border: 1px solid var(--line); border-radius: 7px 7px 0 0; background: color-mix(in srgb, var(--surface) 92%, transparent); }

.page-header { padding: 54px 0 32px; }
.page-header h1 { font-size: clamp(42px, 6vw, 68px); }
.mode-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.mode-launch-card {
  position: relative; min-height: 300px; display: flex; flex-direction: column; align-items: flex-start; overflow: hidden; padding: 24px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.mode-card-index { position: absolute; right: 22px; top: 20px; color: var(--muted); font: 500 10px "DM Mono", monospace; }
.mode-card-icon { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 7px; color: var(--bg); background: var(--accent); font-size: 27px; font-weight: 900; }
.mode-launch-card:nth-child(2) .mode-card-icon { background: var(--accent-2); }
.mode-launch-card:nth-child(3) .mode-card-icon { color: var(--text); background: #8d6cab; }
.mode-launch-card:nth-child(4) .mode-card-icon { color: var(--text); background: #3c8c91; }
.mode-launch-card:nth-child(6) .mode-card-icon { color: var(--text); background: #4f7f66; }
.mode-launch-card:nth-child(7) .mode-card-icon { color: var(--text); background: var(--surface-3); }
.mode-launch-card.is-accent { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.mode-launch-card h2 { margin: 20px 0 9px; font-size: 22px; }
.mode-launch-card p { flex: 1; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.mode-launch-card button,
.mode-help-strip button { width: 100%; min-height: 43px; margin-top: 22px; border: 0; border-radius: 4px; color: var(--bg); background: var(--accent); font-weight: 750; cursor: pointer; }
.mode-launch-card button:hover { filter: brightness(1.07); }
.mode-help-strip { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 18px; padding: 24px 28px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.mode-help-strip h2 { margin: 7px 0 0; font-size: 22px; }
.mode-help-strip button { width: auto; min-width: 150px; margin: 0; padding: 0 18px; }

.library-hero { display: flex; align-items: end; justify-content: space-between; gap: 35px; padding: 54px 0 38px; border-bottom: 1px solid var(--line); }
.library-mark { display: flex; align-items: end; gap: 13px; color: var(--muted); }
.library-mark strong { color: var(--accent); font-size: 58px; line-height: .9; }
.library-mark span { font: 500 9px/1.4 "DM Mono", monospace; letter-spacing: .14em; }
.guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 34px 0; }
.guide-card { min-height: 330px; display: flex; flex-direction: column; align-items: flex-start; padding: 25px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--surface); text-decoration: none; transition: transform .2s ease; }
.guide-card:hover { transform: translateY(-4px); }
.guide-card > span { color: var(--accent-2); font: 500 9px "DM Mono", monospace; letter-spacing: .13em; }
.guide-glyph { width: 64px; height: 64px; display: grid; place-items: center; margin-top: 23px; border-radius: 50%; color: var(--bg); background: var(--accent); font-size: 25px; font-weight: 900; }
.guide-card:nth-child(2) .guide-glyph { background: var(--accent-2); }.guide-card:nth-child(3) .guide-glyph { color: var(--text); background: var(--surface-3); }
.guide-card h2 { margin: 20px 0 10px; font-size: 22px; }
.guide-card p { flex: 1; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.75; }
.guide-card b { margin-top: 22px; color: var(--accent); font-size: 12px; }
.resource-links { display: grid; grid-template-columns: minmax(220px, .7fr) 1.3fr; gap: 30px; align-items: center; padding: 28px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.resource-links h2 { margin: 7px 0 0; }
.resource-links > div:last-child { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.resource-links a { min-height: 48px; display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 5px; color: var(--text); background: var(--surface-2); text-decoration: none; font-size: 11px; }
.resource-links a:hover { border-color: var(--accent); }

.site-footer { width: min(1180px, 100%); margin: 0 auto; }
.site-footer > div { display: grid; gap: 5px; }
.site-footer strong { color: var(--text); font-size: 12px; letter-spacing: .08em; }
.site-footer nav { display: flex; gap: 20px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.mobile-nav { display: none; }

@media (max-width: 1260px) {
  .primary-nav a, .primary-nav button { padding-inline: 9px; font-size: 12px; }
  .header-link-button { display: none; }
  .home-hero { gap: 30px; }
  .art-board { transform: scale(.9) rotate(2.5deg); }
}

@media (max-width: 900px) {
  .primary-nav { display: none; }
  .site-header { justify-content: space-between; }
  .header-actions { margin-left: auto; }
  .home-hero { grid-template-columns: 1fr; min-height: auto; padding-top: 48px; }
  .home-board-art { display: none; }
  .mode-card-grid, .guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .resource-links { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  body { padding-bottom: 70px; }
  .page-shell { padding-inline: 14px; }
  .site-header { height: 72px; }
  .brand-mark { width: 36px; height: 41px; font-size: 26px; }
  .brand strong { font-size: 15px; }.brand small { font-size: 7px; }
  .header-actions .account-button { min-width: 92px; padding-inline: 8px; }
  .home-view, .modes-view, .guides-view { padding-top: 12px; }
  .home-hero { padding: 36px 0 28px; }
  .home-hero h1, .page-header h1, .library-hero h1 { font-size: 43px; }
  .home-actions { flex-direction: column; align-items: stretch; }
  .news-strip { grid-template-columns: 1fr; gap: 7px; padding: 14px 16px; }
  .explore-grid, .home-feature-grid, .mode-card-grid, .guide-grid { grid-template-columns: 1fr; }
  .explore-card { min-height: 250px; }
  .page-hero { align-items: flex-start; flex-direction: column; padding-top: 34px; }
  .page-help-button { align-self: stretch; }
  .mode-help-strip, .library-hero { align-items: flex-start; flex-direction: column; }
  .mode-help-strip button { width: 100%; }
  .library-mark { display: none; }
  .resource-links > div:last-child { grid-template-columns: 1fr; }
  .site-footer { padding-bottom: 12px; }
  .site-footer nav { display: none; }
  .mobile-nav {
    position: fixed; z-index: 18; left: 0; right: 0; bottom: 0; min-height: 64px; display: grid; grid-template-columns: repeat(5, 1fr);
    border-top: 1px solid var(--line-strong); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(16px);
  }
  .mobile-nav a, .mobile-nav button { display: grid; place-items: center; align-content: center; gap: 4px; padding: 7px 2px; border: 0; color: var(--muted); background: transparent; text-decoration: none; font-size: 9px; }
  .mobile-nav b { font-size: 16px; }
  .mobile-nav a.is-active { color: var(--accent); }
}

/* Focused play screen — centered board with symmetrical side information. */
.game-view {
  width: 100%;
  padding: 28px 0 62px;
}
.game-view .game-layout {
  display: grid;
  grid-template-columns: minmax(210px, 240px) minmax(540px, 900px) minmax(210px, 240px);
  justify-content: center;
  align-items: start;
  gap: 18px;
  padding: 0;
}
.game-view .game-card {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
}
.game-view .control-panel {
  grid-column: 1;
  grid-row: 1;
  min-height: 0;
  margin-top: 72px;
  padding: 20px;
}
.game-view .recent-panel {
  grid-column: 3;
  grid-row: 1;
  min-height: 0;
  margin-top: 72px;
}
.game-view .board-frame { min-height: 0; }
.game-view .board-scroll {
  max-height: min(72vh, 780px);
  padding: 0 40px;
}
.panel-heading-actions { display: flex; align-items: center; gap: 8px; }
.panel-heading-actions > button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.panel-heading-actions > button:hover { color: var(--accent); border-color: var(--accent); }

@media (max-width: 1100px) {
  .game-view .game-layout { grid-template-columns: minmax(0, 820px); }
  .game-view .game-card,
  .game-view .control-panel,
  .game-view .recent-panel { grid-column: 1; width: 100%; margin-top: 0; }
  .game-view .game-card { grid-row: 1; }
  .game-view .control-panel { grid-row: 2; }
  .game-view .recent-panel { grid-row: 3; }
}

@media (max-width: 700px) {
  .game-view { padding-top: 16px; }
  .game-view .board-frame { min-height: 0; }
  .game-view .board-scroll { padding: 0 12px; }
}
