:root {
  color-scheme: dark;
  --ink: #f5f0e5;
  --muted: #aeb9b0;
  --deep: #0c1713;
  --surface: rgba(24, 42, 34, 0.82);
  --line: rgba(226, 238, 226, 0.12);
  --accent: #e8bb68;
  --accent-strong: #f7cd7c;
  --green: #3c9b70;
  --light-square: #d8c8a9;
  --dark-square: #68806b;
  --board-size: min(68vh, 690px, calc(100vw - 670px));
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 52% 18%, rgba(55, 117, 87, 0.22), transparent 34rem),
    linear-gradient(135deg, #08110e 0%, #12241c 48%, #09130f 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

button, input { font: inherit; }
button { color: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

.app-shell { width: min(1530px, calc(100% - 48px)); margin: 0 auto; }

.topbar {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 43px; height: 43px; display: grid; place-items: center;
  border: 1px solid rgba(247, 205, 124, 0.55); border-radius: 13px;
  color: #122219; background: var(--accent); font-family: "Bahnschrift", "Segoe UI", sans-serif;
  box-shadow: 0 8px 28px rgba(232, 187, 104, 0.18);
}
.brand strong { display: block; font-family: "Bahnschrift", "Segoe UI", sans-serif; font-size: 17px; letter-spacing: 0.02em; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; letter-spacing: 0.09em; text-transform: uppercase; }

.header-actions { display: flex; align-items: center; gap: 12px; }
.about-button, .sound-toggle { min-height: 34px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; color: #cbd5cd; cursor: pointer; background: rgba(255,255,255,.035); font-size: 10px; font-weight: 600; white-space: nowrap; }
.about-button:hover, .sound-toggle:hover { color: var(--accent-strong); border-color: rgba(232,187,104,.4); }
.sound-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.sound-toggle.active { color: #17221b; border-color: rgba(232,187,104,.7); background: var(--accent); }
.language-switch { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: rgba(0,0,0,.16); }
.language-switch button { min-width: 34px; padding: 5px 7px; border: 0; border-radius: 7px; color: #839187; background: transparent; cursor: pointer; font-size: 10px; font-weight: 700; letter-spacing: .06em; }
.language-switch button.active { color: #17221b; background: var(--accent); }
.runtime-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.runtime-badges span, .turn-pill {
  padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px;
  color: #ccd7cf; background: rgba(255,255,255,0.035); font-size: 11px; letter-spacing: 0.04em;
}
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #63d39e; box-shadow: 0 0 10px rgba(99,211,158,.7); }

.game-layout {
  display: grid;
  grid-template-columns: 270px minmax(460px, var(--board-size)) 270px;
  justify-content: center;
  align-items: start;
  gap: clamp(22px, 3vw, 48px);
  padding: 34px 0 52px;
}

.panel {
  margin-top: 62px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(31, 53, 43, 0.82), rgba(15, 28, 23, 0.88));
  box-shadow: 0 28px 70px rgba(0,0,0,.22);
  backdrop-filter: blur(18px);
}

.control-card { padding: 24px; }
.panel-heading h1 { margin: 7px 0 10px; font-size: 25px; line-height: 1.1; letter-spacing: -0.035em; }
.panel-heading > p:last-child { margin: 0 0 26px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.eyebrow { margin: 0; color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }

fieldset { min-width: 0; margin: 0 0 21px; padding: 0; border: 0; }
legend, .field label { display: block; margin-bottom: 9px; color: #cbd5cd; font-size: 11px; font-weight: 600; letter-spacing: .05em; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(0,0,0,.18); }
.segmented button, .color-options button { border: 0; cursor: pointer; transition: .18s ease; }
.segmented button:disabled, .color-options button:disabled, input:disabled { cursor: wait; opacity: .58; }
.segmented button { padding: 9px 7px; border-radius: 8px; color: var(--muted); background: transparent; font-size: 12px; }
.segmented button.active { color: #182018; background: #e3d8bc; box-shadow: 0 5px 18px rgba(0,0,0,.18); }

.field { margin-bottom: 21px; }
.inline-field { display: grid; grid-template-columns: 1fr 40px; gap: 8px; }
input { width: 100%; padding: 10px 12px; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; outline: 0; background: rgba(0,0,0,.2); }
input:focus { border-color: rgba(232,187,104,.7); box-shadow: 0 0 0 3px rgba(232,187,104,.1); }
.icon-button { border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: rgba(255,255,255,.05); }

.color-options { display: grid; gap: 7px; }
.color-options button { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid transparent; border-radius: 10px; color: var(--muted); text-align: left; background: rgba(0,0,0,.12); font-size: 12px; }
.color-options button.active { color: var(--ink); border-color: rgba(232,187,104,.36); background: rgba(232,187,104,.09); }
.piece-dot { width: 13px; height: 13px; border-radius: 50%; }
.piece-dot.white { background: #f3ead5; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }
.piece-dot.black { background: #17201c; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }

.primary-button { width: 100%; padding: 13px; border: 0; border-radius: 11px; cursor: pointer; color: #142119; background: linear-gradient(135deg, var(--accent-strong), #dba95a); font-weight: 700; box-shadow: 0 10px 28px rgba(232,187,104,.16); transition: transform .18s, filter .18s; }
.primary-button:hover { transform: translateY(-1px); filter: brightness(1.05); }
.primary-button:disabled { cursor: wait; filter: saturate(.45); opacity: .76; transform: none; }
.model-facts { margin: 22px 0 0; padding-top: 17px; border-top: 1px solid var(--line); }
.model-facts div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 10px; }
.model-facts dt { color: #85948a; }
.model-facts dd { margin: 0; color: #c7d1c9; text-align: right; }

.board-column { width: 100%; min-width: 0; }
.player-strip { min-height: 48px; display: flex; align-items: center; gap: 11px; padding: 0 4px; }
.player-strip.opponent { margin-bottom: 13px; }
.player-strip.human { margin-top: 13px; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(232,187,104,.38); border-radius: 12px; color: #1b261e; background: var(--accent); font-family: "Bahnschrift", "Segoe UI", sans-serif; font-size: 13px; font-weight: 700; }
.human-avatar { color: #d8e4db; border-color: var(--line); background: #263c32; }
.player-strip strong { display: block; font-size: 13px; }
.player-strip small { display: block; margin-top: 2px; color: #839187; font-size: 10px; }
.turn-pill { margin-left: auto; }

.board-frame { padding: 8px; border: 1px solid rgba(232,187,104,.22); border-radius: 15px; background: #18261f; box-shadow: 0 35px 85px rgba(0,0,0,.38), 0 0 0 4px rgba(0,0,0,.14); }
.chessboard {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  overflow: hidden;
  border-radius: 9px;
}
.square {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: "Segoe UI Symbol", "DejaVu Sans", sans-serif;
  font-size: clamp(31px, calc(var(--board-size) / 10.7), 66px);
  font-weight: 400;
  line-height: 1;
  user-select: none;
  touch-action: manipulation;
  -webkit-user-select: none;
}
.square.light { background: var(--light-square); }
.square.dark { background: var(--dark-square); }
.square .piece {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  transform: translateY(-1%);
  filter: drop-shadow(0 3px 1px rgba(0,0,0,.26));
}
.piece-svg {
  display: block;
  width: 82%;
  height: 82%;
  overflow: visible;
  pointer-events: none;
}
.piece-svg .piece-fill { fill: currentColor; stroke: var(--piece-outline); stroke-width: 1.35; stroke-linejoin: round; }
.piece-svg .piece-line, .piece-svg .piece-detail { fill: none; stroke: var(--piece-detail); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.piece-svg .piece-detail-fill { fill: var(--piece-detail); stroke: none; }
.square .white-piece {
  color: #fff8e8;
  --piece-outline: #26342c;
  --piece-detail: #26342c;
}
.square .black-piece {
  color: #15221c;
  --piece-outline: rgba(255,248,229,.8);
  --piece-detail: rgba(255,248,229,.82);
}
.coordinate { position: absolute; z-index: 3; color: rgba(25,38,30,.62); font-family: "Segoe UI", sans-serif; font-size: clamp(7px, 1vw, 10px); font-weight: 700; }
.coordinate.rank { top: 4px; left: 5px; }
.coordinate.file { right: 5px; bottom: 3px; }
.square.dark .coordinate { color: rgba(242,236,215,.7); }
.square.selected::after { position: absolute; inset: 0; content: ""; background: rgba(242,197,97,.44); }
.square.legal::before { position: absolute; z-index: 3; width: 22%; aspect-ratio: 1; content: ""; border-radius: 50%; background: rgba(18,49,35,.42); }
.square.capture::before { width: 78%; background: transparent; border: clamp(3px, .7vw, 6px) solid rgba(18,49,35,.36); }
.square.last-move { box-shadow: inset 0 0 0 999px rgba(242, 197, 97, .32); }
.square.last-from { box-shadow: inset 0 0 0 999px rgba(242, 197, 97, .32), inset 0 0 0 2px rgba(255, 235, 177, .68); }
.square.last-to { z-index: 1; box-shadow: inset 0 0 0 999px rgba(242, 197, 97, .46), inset 0 0 0 4px rgba(30, 52, 40, .76); }
.square.in-check { box-shadow: inset 0 0 0 999px rgba(184, 53, 45, .55); }
.square:focus-visible { z-index: 5; outline: 3px solid var(--accent-strong); outline-offset: -3px; }

.board-hint { margin: 12px 0 0; color: #78877d; font-size: 11px; text-align: center; }
.moves-card { min-height: 470px; display: flex; flex-direction: column; overflow: hidden; }
.moves-header { display: flex; justify-content: space-between; align-items: center; padding: 22px 22px 17px; border-bottom: 1px solid var(--line); }
.moves-header h2 { margin: 6px 0 0; font-size: 20px; }
.moves-actions { display: flex; align-items: center; gap: 13px; }
.text-button { padding: 0; border: 0; color: var(--accent); cursor: pointer; background: none; font-size: 11px; }
.text-button.danger { color: #ef8f82; }
.text-button:disabled { color: #647169; cursor: default; }
.pgn-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: rgba(0,0,0,.08); }
.pgn-button { min-width: 0; padding: 8px 7px; border: 1px solid rgba(232,187,104,.2); border-radius: 8px; color: #d9e2db; cursor: pointer; background: rgba(232,187,104,.06); font-size: 9px; font-weight: 600; white-space: nowrap; transition: .15s ease; }
.pgn-button:hover { color: var(--accent-strong); border-color: rgba(232,187,104,.42); background: rgba(232,187,104,.11); }
.pgn-button:disabled { color: #647169; cursor: default; border-color: var(--line); background: transparent; }
.review-controls { display: grid; grid-template-columns: 32px 32px minmax(110px, 1fr) 32px 32px; gap: 5px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); background: rgba(232,187,104,.035); }
.review-controls[hidden] { display: none; }
.review-button { width: 32px; height: 29px; padding: 0; border: 1px solid rgba(232,187,104,.2); border-radius: 7px; color: #d9e2db; cursor: pointer; background: rgba(232,187,104,.06); font-size: 11px; }
.review-button:hover:not(:disabled) { color: var(--accent-strong); border-color: rgba(232,187,104,.42); }
.review-button:disabled { color: #5e6b63; cursor: default; border-color: var(--line); background: transparent; }
.review-position { overflow: hidden; color: #a9b7ad; font-size: 9px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.empty-moves { min-height: 310px; display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; padding: 30px; color: var(--muted); text-align: center; }
.empty-icon { margin-bottom: 12px; color: rgba(232,187,104,.42); font-size: 38px; }
.empty-moves strong { color: #d7dfd8; font-size: 12px; }
.empty-moves p { max-width: 190px; margin: 8px 0 0; font-size: 10px; line-height: 1.5; }
.moves-list { min-height: 310px; max-height: 430px; display: block; flex: 1; overflow-y: auto; padding: 13px 14px 18px; text-align: left; scrollbar-color: #53685c transparent; scrollbar-width: thin; }
.move-row { display: grid; grid-template-columns: 29px 1fr 1fr; gap: 5px; align-items: center; min-height: 34px; border-radius: 8px; }
.move-row:nth-child(odd) { background: rgba(255,255,255,.025); }
.move-number { color: #6f8075; font-size: 10px; text-align: right; }
.move-san { min-width: 0; padding: 7px 8px; overflow: hidden; border: 1px solid transparent; border-radius: 6px; color: #d9e2db; cursor: default; background: transparent; font-size: 12px; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.move-san.computer { color: var(--accent-strong); }
.move-san.latest { color: #fff0c3; border-color: rgba(232,187,104,.62); background: rgba(232,187,104,.24); box-shadow: inset 3px 0 0 var(--accent); font-weight: 700; }
.moves-list.review-enabled .move-san { cursor: pointer; }
.moves-list.review-enabled .move-san:hover { border-color: rgba(232,187,104,.25); background: rgba(232,187,104,.07); }
.move-san.review-current { border-color: rgba(232,187,104,.55); background: rgba(232,187,104,.15); box-shadow: 0 0 0 1px rgba(232,187,104,.08); }
.move-time { display: block; color: #6f8075; font-size: 8px; }
.engine-note { display: flex; align-items: flex-start; gap: 3px; padding: 15px 18px; border-top: 1px solid var(--line); color: #78877d; background: rgba(0,0,0,.13); font-size: 9px; line-height: 1.45; }
.engine-note strong { display: block; color: #a9b7ad; font-size: 10px; }
.turn-pill.thinking, #model-status.thinking { color: var(--accent-strong); border-color: rgba(232,187,104,.28); }
.turn-pill.thinking::before { display: inline-block; width: 6px; height: 6px; margin-right: 6px; content: ""; border-radius: 50%; background: var(--accent); animation: pulse 1s ease-in-out infinite; }

.site-footer { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 0 0 30px; color: #839187; font-size: 10px; text-align: center; }
.site-footer p { margin: 0; }
.site-footer a, .about-footer a { color: var(--accent); text-decoration: none; }
.site-footer a:hover, .about-footer a:hover { text-decoration: underline; }
.nmatika-link { display: inline-flex; align-items: center; gap: 7px; }
.nmatika-logo { width: 24px; height: 24px; display: inline-grid; place-items: center; border-radius: 7px; color: #f7f3e9; background: #148b7f; font-size: 11px; font-weight: 800; line-height: 1; box-shadow: 0 5px 16px rgba(20,139,127,.2); }
.nmatika-link:hover { text-decoration: none !important; }
.nmatika-link:hover > span:last-child { text-decoration: underline; }

body.modal-open { overflow: hidden; }
.modal-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; overflow-y: auto; background: rgba(4,10,7,.78); backdrop-filter: blur(8px); }
.modal-backdrop[hidden] { display: none; }
.about-dialog { position: relative; width: min(760px, 100%); max-height: calc(100vh - 40px); padding: 32px; overflow-y: auto; border: 1px solid rgba(232,187,104,.32); border-radius: 22px; background: linear-gradient(155deg, #1a3026, #101e18); box-shadow: 0 30px 100px rgba(0,0,0,.66); }
.about-dialog h2 { margin: 7px 42px 12px 0; font-size: clamp(23px, 4vw, 32px); letter-spacing: -.025em; }
.about-dialog > p { color: #b4c0b7; font-size: 13px; line-height: 1.65; }
.about-dialog .about-lead { max-width: 660px; color: #e5e9e5; font-size: 15px; }
.modal-close { position: absolute; top: 20px; right: 20px; width: 35px; height: 35px; border: 1px solid var(--line); border-radius: 10px; color: #b9c5bc; cursor: pointer; background: rgba(255,255,255,.04); font-size: 23px; line-height: 1; }
.modal-close:hover { color: var(--accent-strong); border-color: rgba(232,187,104,.4); }
.about-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin: 24px 0; }
.about-facts div { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(0,0,0,.14); }
.about-facts strong { display: block; overflow-wrap: anywhere; color: var(--accent-strong); font-size: 15px; }
.about-facts span { display: block; margin-top: 5px; color: #87958b; font-size: 9px; line-height: 1.4; }
.quality-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 18px; margin: 21px 0; padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: rgba(0,0,0,.12); }
.quality-facts div { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; }
.quality-facts dt { color: #8c9b90; }
.quality-facts dd { margin: 0; color: #e3e9e4; font-weight: 600; }
.about-dialog .about-limit { color: #839187; font-size: 11px; }
.about-footer { display: flex; justify-content: space-between; gap: 16px; margin-top: 25px; padding-top: 17px; border-top: 1px solid var(--line); color: #95a299; font-size: 10px; }

.promotion-backdrop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: rgba(4,10,7,.7); backdrop-filter: blur(7px); }
.promotion-backdrop[hidden] { display: none; }
.promotion-dialog { width: min(390px, 100%); padding: 28px; border: 1px solid rgba(232,187,104,.32); border-radius: 20px; background: #172a21; box-shadow: 0 30px 100px rgba(0,0,0,.6); text-align: center; }
.promotion-dialog h2 { margin: 8px 0 22px; font-size: 22px; }
.promotion-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 20px; }
.promotion-piece { aspect-ratio: 1; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; color: #fff8e8; background: rgba(255,255,255,.045); transition: .15s ease; }
.promotion-piece.white-piece { --piece-outline: #26342c; --piece-detail: #26342c; }
.promotion-piece.black-piece { color: #15221c; --piece-outline: rgba(255,248,229,.8); --piece-detail: rgba(255,248,229,.82); }
.promotion-piece-svg { width: 80%; height: 80%; }
.promotion-piece:hover { border-color: var(--accent); background: rgba(232,187,104,.13); transform: translateY(-2px); }

@keyframes pulse { 50% { opacity: .35; transform: scale(.72); } }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 20; translate: -50% 0; padding: 11px 16px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #172820; box-shadow: 0 12px 40px rgba(0,0,0,.35); font-size: 12px; }

@media (max-width: 1120px) {
  :root { --board-size: min(63vw, 650px); }
  .game-layout { grid-template-columns: 245px minmax(450px, var(--board-size)); }
  .moves-card { grid-column: 1 / -1; width: min(100%, 650px); min-height: 250px; margin: 0 auto; }
  .empty-moves { min-height: 150px; }
}

@media (max-width: 780px) {
  :root { --board-size: calc(100vw - 28px); }
  .app-shell { width: min(100% - 24px, 620px); }
  .topbar { min-height: 76px; flex-wrap: wrap; padding: 12px 0; }
  .about-button { padding: 6px 8px; }
  .runtime-badges span:not(:first-child) { display: none; }
  .header-actions { gap: 7px; }
  .game-layout { display: flex; flex-direction: column; padding-top: 18px; }
  .control-card { order: 1; width: 100%; margin: 0; }
  .board-column { order: 2; }
  .moves-card { order: 3; width: 100%; margin: 0; }
  .panel-heading h1 { font-size: 23px; }
  .site-footer { flex-direction: column; gap: 6px; }
  .about-dialog { padding: 25px 19px; }
  .about-facts { grid-template-columns: 1fr 1fr; }
  .quality-facts { grid-template-columns: 1fr; }
  .about-footer { flex-direction: column; }
}

@media (max-width: 520px) {
  :root { --board-size: calc(100vw - 20px); }
  .app-shell { width: calc(100% - 16px); }
  .topbar { gap: 10px; }
  .brand-mark { width: 39px; height: 39px; border-radius: 11px; }
  .brand strong { font-size: 15px; }
  .brand small { font-size: 9px; }
  .header-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr auto; gap: 7px; }
  .about-button, .sound-toggle { min-height: 40px; }
  .language-switch button { min-width: 38px; min-height: 32px; }
  .runtime-badges { grid-column: 1 / -1; justify-content: flex-start; }
  .runtime-badges span:first-child { width: 100%; text-align: center; }
  .game-layout { gap: 18px; padding-bottom: 34px; }
  .board-frame { padding: 5px; border-radius: 12px; }
  .chessboard { border-radius: 7px; }
  .player-strip { min-height: 43px; }
  .avatar { width: 34px; height: 34px; border-radius: 10px; }
  .control-card { padding: 19px; }
  .panel { border-radius: 17px; }
  .segmented button, .color-options button, .primary-button { min-height: 44px; }
  .moves-header { padding: 18px 17px 14px; }
  .text-button { min-height: 40px; padding: 0 3px; }
  .pgn-button { min-height: 40px; white-space: normal; }
  .review-controls { grid-template-columns: 38px 38px minmax(80px, 1fr) 38px 38px; padding: 8px; }
  .review-button { width: 38px; height: 38px; }
  .move-san { min-height: 42px; }
  .toast { width: calc(100% - 24px); bottom: max(12px, env(safe-area-inset-bottom)); text-align: center; }
  .site-footer { padding-bottom: max(22px, env(safe-area-inset-bottom)); }
  .modal-backdrop { padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
  .about-dialog { max-height: calc(100svh - 24px); border-radius: 17px; }
}

@media (pointer: coarse) {
  .about-button, .sound-toggle, .language-switch button, .icon-button,
  .segmented button, .color-options button, .primary-button,
  .text-button, .pgn-button, .review-button { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
