:root {
  --bg: #0b1412;
  --surface: #111e1b;
  --surface-2: #172824;
  --surface-3: #1d332d;
  --line: rgba(172, 210, 194, 0.14);
  --text: #edf5ef;
  --muted: #9bb0a7;
  --lime: #c8f44c;
  --lime-dark: #96bd25;
  --orange: #ff9f43;
  --red: #ff646f;
  --blue: #62b5ff;
  --cell-size: 46px;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(63, 113, 89, 0.22), transparent 32rem),
    radial-gradient(circle at 90% 100%, rgba(156, 189, 37, 0.08), transparent 36rem),
    var(--bg);
}

button, input { font: inherit; }
button { color: inherit; }

.app-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 44px 0 64px; }

.hero { display: flex; align-items: center; justify-content: space-between; gap: 32px; margin-bottom: 34px; }
.eyebrow, .step-label { margin: 0 0 10px; color: var(--lime); font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-family: "Arial Black", "Segoe UI", sans-serif; font-size: clamp(38px, 6vw, 68px); line-height: .98; letter-spacing: -.055em; }
h1 span { color: var(--lime); }
.subtitle { max-width: 710px; margin-bottom: 0; color: var(--muted); font-size: 16px; line-height: 1.65; }
.hero-tools { display: flex; align-items: center; gap: 14px; }
.language-switch { display: grid; gap: 5px; padding: 5px; border: 1px solid var(--line); border-radius: 13px; background: rgba(8, 16, 14, .55); }
.language-button { min-width: 42px; padding: 7px 9px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; font-size: 11px; font-weight: 900; letter-spacing: .08em; }
.language-button[aria-pressed="true"] { color: #0b1412; background: var(--lime); }
.brand-mark { display: grid; flex: 0 0 110px; width: 110px; height: 110px; place-items: center; border: 1px solid rgba(200, 244, 76, .28); border-radius: 32px; color: var(--lime); background: linear-gradient(145deg, rgba(200, 244, 76, .12), rgba(200, 244, 76, .02)); box-shadow: inset 0 0 0 8px rgba(11, 20, 18, .55); font-family: "Arial Black", sans-serif; font-size: 48px; transform: rotate(4deg); }

.panel { border: 1px solid var(--line); border-radius: 24px; background: rgba(17, 30, 27, .9); box-shadow: 0 24px 80px rgba(0, 0, 0, .26); backdrop-filter: blur(12px); }
.mode-panel, .network-panel { padding: 34px; }
.mode-intro, .network-intro { max-width: 720px; margin: 12px 0 26px; color: var(--muted); line-height: 1.6; }
.mode-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.mode-card { display: grid; min-height: 190px; padding: 26px; place-items: center; border: 1px solid var(--line); border-radius: 18px; color: var(--text); background: rgba(8, 16, 14, .45); cursor: pointer; text-align: center; transition: transform .16s, border-color .16s, background .16s; }
.mode-card[hidden] { display: none; }
.mode-card:hover { border-color: rgba(200, 244, 76, .42); background: rgba(200, 244, 76, .06); transform: translateY(-2px); }
.mode-card strong { margin: 12px 0 6px; font-family: "Arial Black", "Segoe UI", sans-serif; font-size: 20px; }
.mode-card small { color: var(--muted); }
.mode-icon { display: grid; width: 54px; height: 54px; place-items: center; border-radius: 16px; color: var(--lime); background: rgba(200, 244, 76, .12); font-size: 25px; }
.network-forms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.network-card { padding: 22px; border: 1px solid var(--line); border-radius: 17px; background: rgba(8, 16, 14, .42); }
.network-card h3, .network-waiting h3 { margin: 0 0 18px; font-family: "Arial Black", "Segoe UI", sans-serif; }
.network-field { width: 100%; margin-bottom: 13px; }
.network-card .button-primary { width: 100%; margin-top: 4px; }
.room-code-input { text-transform: uppercase; letter-spacing: .22em; font-weight: 900; }
.network-waiting { padding: 24px; border: 1px solid rgba(98, 181, 255, .25); border-radius: 17px; background: rgba(98, 181, 255, .06); }
.network-waiting > p:not(.step-label) { color: var(--muted); }
.room-settings-preview-section { margin: 18px 0; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: rgba(8, 16, 14, .42); }
.room-settings-preview-section h4 { margin: 0 0 12px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.room-settings-preview { display: grid; gap: 8px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.room-setting-line { display: grid; grid-template-columns: minmax(105px, .45fr) 1fr; gap: 10px; }
.room-setting-line strong { color: var(--text); font-weight: 800; }
.network-players { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0 20px; }
.network-players.compact { margin: 0; }
.network-player { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 11px; font-weight: 800; }
.network-player::before { width: 8px; height: 8px; border-radius: 50%; background: var(--player-color); content: ""; }
.network-room-bar, .network-game-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 13px; padding: 13px 15px; border: 1px solid rgba(98, 181, 255, .25); color: #b9ddff; background: rgba(98, 181, 255, .07); }
.network-room-bar { margin: 22px 0 0; border-radius: 14px; }
.network-room-bar > div:first-child { display: grid; }
.network-room-bar span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.network-room-bar strong, .network-game-bar strong { letter-spacing: .16em; }
.network-room-bar p { flex: 1; margin: 0; color: var(--muted); font-size: 11px; }
.setup-panel.read-only-settings input,
.setup-panel.read-only-settings button:not(#leaveHostRoomButton) { cursor: not-allowed; }
.setup-panel.read-only-settings input:disabled,
.setup-panel.read-only-settings button:disabled { opacity: .82; }
.network-game-bar { justify-content: space-between; border-width: 0 0 1px; }
.room-settings-details { position: relative; }
.room-settings-details summary { cursor: pointer; font-size: 11px; font-weight: 800; }
.room-settings-details[open] .compact-preview { position: absolute; z-index: 10; top: calc(100% + 10px); right: 0; width: min(430px, calc(100vw - 32px)); padding: 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: var(--surface); box-shadow: 0 18px 48px rgba(0, 0, 0, .38); }
.setup-panel { padding: 34px; }
.section-heading, .mine-config-header, .setup-footer, .game-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
h2 { margin-bottom: 0; font-family: "Arial Black", "Segoe UI", sans-serif; font-size: 22px; letter-spacing: -.035em; }
.heading-note { margin: 0; color: var(--muted); font-size: 13px; }
.heading-note::before { content: "✓"; margin-right: 7px; color: var(--lime); }
.file-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 28px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(8, 16, 14, .34); }
.file-actions .button { flex: 1; min-width: 170px; }
.button-tutorial { border-color: rgba(98, 181, 255, .35); color: #b9ddff; background: rgba(98, 181, 255, .1); }
.button-tutorial:hover { border-color: rgba(98, 181, 255, .65); background: rgba(98, 181, 255, .16); }

.dimensions { display: flex; align-items: flex-end; gap: 14px; margin: 26px 0 40px; }
.field { display: grid; gap: 9px; width: 150px; color: var(--muted); font-size: 12px; font-weight: 700; }
input { width: 100%; height: 50px; padding: 0 15px; border: 1px solid var(--line); border-radius: 12px; outline: none; color: var(--text); background: #0c1714; transition: border-color .18s, box-shadow .18s; }
input:hover { border-color: rgba(172, 210, 194, .28); }
input:focus { border-color: var(--lime-dark); box-shadow: 0 0 0 3px rgba(200, 244, 76, .09); }
.dimension-cross { padding-bottom: 14px; color: #61736b; font-size: 20px; }
.logic-settings { display: flex; align-items: stretch; flex-wrap: wrap; gap: 10px; margin: -17px 0 38px; }
.logic-toggle { display: flex; align-items: center; gap: 13px; min-height: 72px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; background: rgba(10, 20, 17, .48); cursor: pointer; }
.logic-toggle input, .counts-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.toggle-track { position: relative; flex: 0 0 42px; width: 42px; height: 24px; border-radius: 20px; background: #30423b; transition: background .18s; }
.toggle-track i { position: absolute; top: 4px; left: 4px; width: 16px; height: 16px; border-radius: 50%; background: #82958d; transition: transform .18s, background .18s; }
.logic-toggle input:checked + .toggle-track, .counts-toggle input:checked + .toggle-track { background: rgba(200, 244, 76, .25); }
.logic-toggle input:checked + .toggle-track i, .counts-toggle input:checked + .toggle-track i { background: var(--lime); transform: translateX(18px); }
.logic-toggle input:focus-visible + .toggle-track, .counts-toggle input:focus-visible + .toggle-track { outline: 2px solid var(--lime); outline-offset: 3px; }
.toggle-copy strong, .toggle-copy small { display: block; }
.toggle-copy strong { font-size: 12px; }
.toggle-copy small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.attempts-field { display: grid; grid-template-columns: 130px 84px; align-items: center; gap: 3px 10px; min-width: 270px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 13px; color: var(--muted); background: rgba(10, 20, 17, .48); font-size: 10px; font-weight: 700; }
.attempts-field input { grid-column: 2; grid-row: 1 / span 2; height: 48px; text-align: center; }
.attempts-field small { grid-column: 1; color: #667a71; font-size: 9px; font-weight: 500; line-height: 1.35; }
.attempts-field:has(input:disabled) { opacity: .45; }
.attempts-field input:disabled { cursor: not-allowed; }
.counts-toggle { display: flex; align-items: center; gap: 13px; min-height: 72px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; background: rgba(10, 20, 17, .48); cursor: pointer; }
.counts-toggle:has(input:disabled) { opacity: .45; }
.vision-settings { display: flex; align-items: center; justify-content: space-between; gap: 28px; margin: 0 0 38px; padding: 22px; border: 1px solid var(--line); border-radius: 17px; background: rgba(8, 16, 14, .34); }
.vision-copy { max-width: 450px; }
.vision-copy > p:not(.step-label) { margin: 10px 0 16px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.vision-solver-note { min-height: 18px; color: var(--orange) !important; font-weight: 700; }
.vision-grid { display: grid; flex: 0 0 auto; grid-template-columns: repeat(7, 34px); gap: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: #0a1512; }
.vision-cell { display: grid; width: 34px; height: 34px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 7px; color: transparent; background: var(--surface-2); cursor: pointer; transition: background .12s, border-color .12s, transform .12s; }
.vision-cell:hover:not(.center) { border-color: rgba(200, 244, 76, .5); transform: translateY(-1px); }
.vision-cell.selected { border-color: rgba(200, 244, 76, .5); background: rgba(200, 244, 76, .24); box-shadow: inset 0 0 0 2px rgba(200, 244, 76, .09); }
.vision-cell.center { color: #15200f; background: var(--lime); cursor: default; font-size: 15px; font-weight: 900; }

.button { min-height: 44px; padding: 0 17px; border: 1px solid transparent; border-radius: 11px; cursor: pointer; font-size: 13px; font-weight: 800; transition: transform .15s, background .15s, border-color .15s; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button-ghost { border-color: var(--line); color: #d6e2dc; background: var(--surface-2); }
.button-ghost:hover { border-color: rgba(200, 244, 76, .32); background: var(--surface-3); }
.button-primary { min-width: 180px; color: #14200d; background: var(--lime); box-shadow: 0 8px 24px rgba(200, 244, 76, .14); }
.button-primary:hover { background: #d7ff65; }
.button-primary span { margin-left: 8px; }

.mine-config-header, .flag-config-header { padding-top: 30px; border-top: 1px solid var(--line); }
.flag-config-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-top: 30px; }
.config-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.mine-table { margin-top: 22px; }
.mine-table-head, .mine-row { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(130px, 1fr) 42px; gap: 12px; align-items: center; }
.mine-table-head { padding: 0 13px 9px; color: #758a81; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.mine-types { display: grid; gap: 10px; }
.mine-row { padding: 11px 12px; border: 1px solid var(--line); border-radius: 15px; background: rgba(10, 20, 17, .55); }
.mine-row input { height: 46px; }
.remove-type-button { width: 38px; height: 38px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; cursor: pointer; font-size: 23px; }
.remove-type-button:hover { color: var(--red); background: rgba(255, 100, 111, .09); }
.flag-types { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 12px; margin-top: 22px; }
.flag-type-card { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(10, 20, 17, .55); }
.flag-main-fields { display: grid; grid-template-columns: 50px 1fr 38px; gap: 11px; align-items: end; }
.color-field { display: block; }
.flag-color-input { width: 50px; height: 50px; padding: 4px; cursor: pointer; }
.flag-color-input::-webkit-color-swatch-wrapper { padding: 0; }
.flag-color-input::-webkit-color-swatch { border: 0; border-radius: 8px; }
.flag-name-field { display: grid; gap: 7px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.flag-name-field input { height: 50px; color: var(--text); letter-spacing: 0; text-transform: none; }
.remove-flag-button { width: 38px; height: 38px; margin-bottom: 6px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; cursor: pointer; font-size: 23px; }
.remove-flag-button:hover { color: var(--red); background: rgba(255, 100, 111, .09); }
.flag-matches { min-width: 0; margin: 15px 0 0; padding: 13px; border: 1px solid var(--line); border-radius: 11px; }
.flag-matches legend { padding: 0 6px; color: #758a81; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.flag-match-options { display: flex; flex-wrap: wrap; gap: 7px; }
.match-option { position: relative; cursor: pointer; }
.match-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.match-option span { display: block; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--surface); font-size: 11px; font-weight: 700; transition: all .15s; }
.match-option input:checked + span { border-color: rgba(200, 244, 76, .35); color: var(--lime); background: rgba(200, 244, 76, .08); }
.match-option input:focus-visible + span { outline: 2px solid var(--lime); outline-offset: 2px; }
.error-message { min-height: 22px; padding-top: 12px; color: #ff949c; font-size: 13px; }
.error-message.success { color: var(--lime); }
.setup-footer { margin-top: 9px; padding-top: 22px; border-top: 1px solid var(--line); }
.mine-summary { display: flex; align-items: baseline; gap: 9px; color: var(--muted); font-size: 13px; }
.mine-summary strong { color: var(--lime); font-family: "Arial Black", sans-serif; font-size: 24px; }

.is-hidden { display: none !important; }
.game-panel { overflow: hidden; }
.game-toolbar { padding: 24px 26px; border-bottom: 1px solid var(--line); }
.stats { display: flex; gap: 8px; }
.stat { min-width: 72px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(9, 18, 15, .4); }
.stat span { display: block; margin-bottom: 2px; color: #72867d; font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.stat strong { font-variant-numeric: tabular-nums; font-size: 15px; }
.toolbar-actions { display: flex; gap: 8px; }
.button-debug { border-color: rgba(255, 159, 67, .22); color: #ffc287; background: rgba(255, 159, 67, .08); }
.button-debug[aria-pressed="true"] { color: #1d160d; background: var(--orange); }
.eye-icon { margin-right: 5px; }
.game-message { display: none; margin: 20px 26px 0; padding: 13px 16px; border: 1px solid var(--line); border-radius: 12px; font-size: 14px; }
.game-message.visible { display: block; }
.game-message.win { border-color: rgba(200, 244, 76, .3); color: var(--lime); background: rgba(200, 244, 76, .07); }
.game-message.loss { border-color: rgba(255, 100, 111, .3); color: #ff929a; background: rgba(255, 100, 111, .07); }
.game-message.info { border-color: rgba(98, 181, 255, .28); color: #9ed2ff; background: rgba(98, 181, 255, .07); }

.board-scroller { overflow: auto; padding: 30px; }
.board { display: grid; width: max-content; margin: auto; gap: 4px; user-select: none; }
.cell { position: relative; display: grid; width: var(--cell-size); height: var(--cell-size); padding: 0; place-items: center; border: 1px solid rgba(172, 210, 194, .13); border-radius: 8px; color: var(--text); background: #1b302a; box-shadow: inset 0 1px 0 rgba(255,255,255,.035), 0 2px 5px rgba(0,0,0,.16); cursor: pointer; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; transition: background .1s, transform .1s, border-color .1s; }
.cell-marker { position: absolute; z-index: 5; left: 50%; top: calc(-10px + var(--marker-order, 0) * 14px); max-width: 110px; padding: 3px 6px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--marker-color) 75%, white); border-radius: 999px; color: #0a1210; background: var(--marker-color); box-shadow: 0 3px 10px rgba(0,0,0,.35); font-size: 8px; font-weight: 900; line-height: 1; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; transform: translateX(-50%); }
.cell:hover:not(.revealed) { z-index: 1; border-color: rgba(200, 244, 76, .42); background: #254139; transform: translateY(-1px); }
.cell.revealed { border-color: rgba(172, 210, 194, .07); background: #0f1c19; box-shadow: none; cursor: default; }
.cell.empty { color: transparent; }
.cell.flagged { color: var(--flag-color, var(--lime)); background: color-mix(in srgb, var(--flag-color, var(--lime)) 10%, #172824); font-size: 20px; }
.cell.mine { color: #20160c; background: var(--orange); font-size: 12px; }
.cell.exploded { color: #fff; border-color: #ff8d96; background: var(--red); animation: pulse .5s ease-out; }
.cell.debug-mine:not(.revealed) { border-color: rgba(255,159,67,.62); color: #ffc17d; background: repeating-linear-gradient(135deg, #362c1d, #362c1d 5px, #2d261b 5px, #2d261b 10px); }
.cell.debug-mine.flagged { color: #ffc17d; }
.cell[data-sign="positive"] { color: var(--blue); }
.cell[data-sign="negative"] { color: #e99cff; }
.cell[data-sign="zero"] { color: #779086; }
@keyframes pulse { 40% { transform: scale(1.12); } }
.flag-legend-section { padding: 24px 26px; border-top: 1px solid var(--line); background: rgba(8, 16, 14, .28); }
.flag-legend-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.flag-legend-heading h3 { margin: 0; font-family: "Arial Black", "Segoe UI", sans-serif; font-size: 17px; }
.flag-legend-heading p:last-child { margin: 0; color: var(--muted); font-size: 11px; }
.flag-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 9px; }
.flag-choice { display: grid; grid-template-columns: 34px 1fr; gap: 11px; align-items: center; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; text-align: left; background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.flag-choice:hover { border-color: color-mix(in srgb, var(--flag-color) 55%, transparent); transform: translateY(-1px); }
.flag-choice.selected { border-color: var(--flag-color); background: color-mix(in srgb, var(--flag-color) 9%, var(--surface)); box-shadow: inset 3px 0 0 var(--flag-color); }
.flag-symbol { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; color: var(--flag-color); background: color-mix(in srgb, var(--flag-color) 12%, var(--surface-2)); font-size: 21px; }
.flag-choice-copy { min-width: 0; }
.flag-choice strong { display: block; overflow: hidden; color: var(--text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.flag-choice small { display: block; overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.game-help { display: flex; justify-content: center; flex-wrap: wrap; gap: 24px; padding: 17px 24px; border-top: 1px solid var(--line); color: #758a81; font-size: 11px; }
.game-help span { display: flex; align-items: center; gap: 7px; }
.mouse-left { position: relative; width: 12px; height: 16px; overflow: hidden; border: 1px solid #60756b; border-radius: 6px; }
.mouse-left::before { position: absolute; top: -1px; left: -1px; width: 6px; height: 7px; border: 1px solid var(--lime); border-radius: 6px 0 2px; background: rgba(200, 244, 76, .38); content: ""; }
.flag-small, .sum-small, .marker-small { color: var(--lime); font-style: normal; font-weight: 800; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.tutorial-overlay { position: fixed; z-index: 1000; inset: 0; }
.tutorial-overlay[hidden] { display: none; }
.tutorial-backdrop { position: absolute; inset: 0; background: rgba(2, 8, 7, .78); }
.tutorial-overlay.has-target .tutorial-backdrop { background: transparent; }
.tutorial-spotlight { position: fixed; z-index: 1001; border: 2px solid var(--lime); border-radius: 16px; box-shadow: 0 0 0 5px rgba(200, 244, 76, .16), 0 16px 50px rgba(0, 0, 0, .42); pointer-events: none; transition: left .18s, top .18s, width .18s, height .18s; }
.tutorial-overlay.has-target .tutorial-spotlight { box-shadow: 0 0 0 9999px rgba(2, 8, 7, .78), 0 0 0 5px rgba(200, 244, 76, .16), 0 16px 50px rgba(0, 0, 0, .42); }
.tutorial-card { position: fixed; z-index: 1002; right: 24px; bottom: 24px; width: min(460px, calc(100vw - 48px)); padding: 24px; border: 1px solid rgba(200, 244, 76, .28); border-radius: 18px; outline: none; background: #13221e; box-shadow: 0 28px 90px rgba(0, 0, 0, .5); }
.tutorial-card.is-top { top: 24px; bottom: auto; }
.tutorial-progress { margin: 0 0 9px; color: var(--lime); font-size: 10px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.tutorial-card h2 { margin-bottom: 10px; font-size: 24px; }
.tutorial-text { min-height: 70px; margin-bottom: 22px; color: #bed0c8; font-size: 14px; line-height: 1.65; }
.tutorial-actions, .tutorial-actions > div { display: flex; align-items: center; gap: 8px; }
.tutorial-actions { justify-content: space-between; }
.tutorial-actions .button { min-width: 100px; }
.tutorial-actions .button-primary { min-width: 120px; }

@media (max-width: 850px) {
  .game-toolbar { align-items: flex-start; flex-wrap: wrap; }
  .stats { order: 3; width: 100%; }
  .stat { flex: 1; }
}
@media (max-width: 620px) {
  :root { --cell-size: 40px; }
  .app-shell { width: min(100% - 20px, 1180px); padding-top: 25px; }
  .brand-mark { display: none; }
  .hero { margin-bottom: 24px; }
  .setup-panel { padding: 22px 16px; }
  .mode-panel, .network-panel { padding: 24px 17px; }
  .mode-actions, .network-forms { grid-template-columns: 1fr; }
  .mode-card { min-height: 150px; }
  .section-heading { align-items: flex-start; }
  .heading-note { max-width: 110px; text-align: right; }
  .dimensions .field { width: min(39vw, 150px); }
  .logic-settings { align-items: stretch; flex-direction: column; }
  .attempts-field { width: 100%; min-width: 0; }
  .vision-settings { align-items: flex-start; flex-direction: column; }
  .vision-grid { align-self: center; grid-template-columns: repeat(7, 30px); }
  .vision-cell { width: 30px; height: 30px; }
  .mine-config-header { align-items: flex-end; }
  .flag-config-header { align-items: flex-end; }
  .mine-config-header .button { padding: 0 12px; }
  .mine-table-head, .mine-row { grid-template-columns: minmax(80px, 1fr) minmax(80px, 1fr) 38px; gap: 7px; }
  .mine-row { padding: 8px; }
  .setup-footer { align-items: stretch; flex-direction: column; }
  .mine-summary { justify-content: center; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions .button { flex: 1; padding: 0 9px; }
  .board-scroller { padding: 20px 12px; }
  .flag-types { grid-template-columns: 1fr; }
  .flag-legend-heading { align-items: flex-start; flex-direction: column; }
  .flag-legend { grid-template-columns: 1fr; }
  .tutorial-card { right: 10px; bottom: 10px; width: calc(100vw - 20px); padding: 19px; }
  .tutorial-card.is-top { top: 10px; bottom: auto; }
  .tutorial-text { min-height: 0; }
  .tutorial-actions { align-items: stretch; flex-direction: column-reverse; }
  .tutorial-actions > div, .tutorial-actions > .button { width: 100%; }
  .tutorial-actions > div .button { flex: 1; min-width: 0; }
}
