:root {
  --ink: #18171d;
  --paper: #f3f0e7;
  --white: #fffdf7;
  --cream: #eee8d9;
  --forest: #264f45;
  --forest-dark: #173a32;
  --sage: #78998d;
  --lime: #d8ff55;
  --gold: #f0bd55;
  --red: #df5965;
  --blue: #5e7cff;
  --muted: #797580;
  --line: rgba(24,23,29,.14);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--paper); -webkit-text-size-adjust: 100%; }
body { min-width: 320px; min-height: 100vh; min-height: 100dvh; margin: 0; overflow-x: hidden; color: var(--ink); background: var(--paper); font-family: "DM Sans", sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button, a, input { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

.witty-home-link { min-height: 44px; position: fixed; z-index: 10; top: max(10px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left)); display: flex; align-items: center; padding: 0 13px; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; color: white; background: rgba(14,16,19,.72); backdrop-filter: blur(10px); font-size: 8px; font-weight: 800; letter-spacing: .13em; }
.witty-home-link:hover { color: var(--ink); background: var(--lime); }
.eyebrow { margin: 0; color: var(--gold); font-size: 8px; font-weight: 800; letter-spacing: .18em; }

/* Menu */
.menu-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(360px,.86fr) minmax(500px,1.14fr); }
.menu-hero { min-height: 100vh; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: 76px clamp(40px,6vw,92px); color: white; background: radial-gradient(circle at 75% 28%,rgba(216,255,85,.12),transparent 30%), linear-gradient(145deg,#101915,#1c2522 55%,#111613); }
.menu-hero::before { content: ""; position: absolute; inset: 0; opacity: .07; background-image: linear-gradient(rgba(255,255,255,.8) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.8) 1px,transparent 1px); background-size: 50px 50px; }
.menu-hero > * { position: relative; z-index: 1; }
.menu-hero h1 { margin: 10px 0 12px; font: 700 clamp(67px,8vw,118px)/.84 "Space Grotesk"; letter-spacing: -.08em; }
.menu-hero h1 span { color: var(--lime); }
.hero-copy { max-width: 390px; margin: 0; color: rgba(255,255,255,.68); font-size: clamp(14px,1.4vw,18px); line-height: 1.55; }
.hero-board { width: min(390px,75%); aspect-ratio: 1.45; position: relative; margin: 55px 0 44px; border: 1px solid rgba(255,255,255,.2); border-radius: 18px; transform: perspective(700px) rotateX(52deg) rotateZ(-6deg); background: var(--cream); box-shadow: 0 45px 60px rgba(0,0,0,.45); }
.hero-grid { position: absolute; inset: 12px; display: grid; grid-template-columns: repeat(8,1fr); grid-template-rows: repeat(6,1fr); overflow: hidden; border-radius: 8px; background: repeating-conic-gradient(#345d52 0 25%,#d9d3c2 0 50%) 0 0/25% 33.333%; }
.hero-crown { position: absolute; z-index: 3; top: -55px; right: 28px; color: var(--lime); font: 100px/1 Georgia,serif; filter: drop-shadow(0 20px 14px rgba(0,0,0,.45)); transform: rotateZ(6deg) rotateX(-52deg); }
.hero-piece { position: absolute; z-index: 3; font: 62px/1 Georgia,serif; filter: drop-shadow(0 8px 8px rgba(0,0,0,.4)); transform: rotateZ(6deg) rotateX(-52deg); }
.hero-piece.white { left: 25%; bottom: 20%; color: white; }.hero-piece.black { right: 25%; bottom: 37%; color: #111; }
.feature-row { display: flex; flex-wrap: wrap; gap: 18px; color: rgba(255,255,255,.6); font-size: 7px; font-weight: 800; letter-spacing: .12em; }
.feature-row span { display: flex; align-items: center; gap: 7px; }.feature-row i { width: 6px; height: 6px; border-radius: 50%; background: var(--lime); }

.setup-card { width: min(650px,calc(100% - 60px)); align-self: center; justify-self: center; padding: 54px 0; }
.setup-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.setup-heading p { margin: 0 0 5px; color: var(--forest); font-size: 8px; font-weight: 800; letter-spacing: .16em; }
.setup-heading h2 { margin: 0; font: 700 clamp(29px,3vw,40px)/1.05 "Space Grotesk"; letter-spacing: -.045em; }
.text-button { border: 0; padding: 5px; color: var(--muted); background: transparent; font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.text-button:hover { color: var(--forest); }
.mode-tabs { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 22px; }
.setup-card > .witty-player-lockup { margin: -8px 0 14px; }
.mode-tab { min-height: 96px; display: grid; grid-template-columns: 34px 1fr; grid-template-rows: 1fr 1fr; align-items: end; gap: 0 9px; padding: 15px; text-align: left; border: 1px solid var(--line); border-radius: 13px; color: #625e68; background: rgba(255,255,255,.62); }
.mode-tab > span { grid-row: 1/3; width: 34px; height: 34px; align-self: center; display: grid; place-items: center; border-radius: 9px; color: var(--forest); background: #e5ebdf; font-size: 15px; }
.mode-tab b { align-self: end; font-size: 10px; letter-spacing: .08em; }.mode-tab small { align-self: start; color: #918d95; font-size: 8px; }
.mode-tab:hover { border-color: var(--sage); }.mode-tab.selected { color: white; border-color: var(--forest); background: var(--forest); box-shadow: 0 12px 25px rgba(38,79,69,.18); }
.mode-tab.selected > span { color: var(--ink); background: var(--lime); }.mode-tab.selected small { color: rgba(255,255,255,.65); }

.mode-panel { padding: 23px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.7); box-shadow: 0 12px 35px rgba(28,25,34,.05); }
.field-label, .two-fields label > span { display: block; margin: 0 0 7px; color: #696570; font-size: 7px; font-weight: 800; letter-spacing: .14em; }
.text-input { width: 100%; height: 47px; padding: 0 14px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: white; outline: 0; font-size: 12px; font-weight: 600; }
.text-input:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(38,79,69,.1); }
.option-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 19px 0 8px; }
.option-heading span { color: #696570; font-size: 7px; font-weight: 800; letter-spacing: .14em; }.option-heading small { color: #9b979f; font-size: 8px; }
.segmented { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; }
.timer-options { grid-template-columns: repeat(4,1fr); }
.segmented button { height: 37px; border: 1px solid var(--line); border-radius: 8px; color: #6a6670; background: #f4f2ec; font-size: 8px; font-weight: 800; letter-spacing: .07em; }
.segmented button:hover { border-color: var(--sage); }.segmented button.selected { color: white; border-color: var(--forest); background: var(--forest); }
.primary-button { width: 100%; min-height: 49px; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 19px; padding: 0 17px; border: 0; border-radius: 10px; color: var(--ink); background: var(--lime); box-shadow: 0 9px 20px rgba(127,155,38,.16); font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 12px 25px rgba(95,120,22,.25); }.primary-button:disabled { opacity: .5; cursor: default; transform: none; }
.primary-button b { font-size: 15px; }.secondary-button { min-height: 45px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: white; font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.secondary-button:hover { border-color: var(--forest); color: var(--forest); }
.or-divider { position: relative; margin: 20px 0 13px; text-align: center; }.or-divider::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; border-top: 1px solid var(--line); }.or-divider span { position: relative; padding: 0 10px; color: #99959d; background: #fcfbf7; font-size: 7px; font-weight: 800; letter-spacing: .12em; }
.join-row { display: grid; grid-template-columns: 1fr 92px; gap: 8px; }.code-input { text-transform: uppercase; letter-spacing: .18em; }.setup-message { min-height: 17px; margin: 12px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.choice-cards { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }.choice-cards button { min-height: 58px; display: grid; gap: 3px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; color: #625e68; background: #f4f2ec; }.choice-cards button b { font-size: 8px; letter-spacing: .09em; }.choice-cards button small { color: #928e96; font-size: 7px; }.choice-cards button.selected { color: white; border-color: var(--forest); background: var(--forest); }.choice-cards button.selected small { color: rgba(255,255,255,.66); }
.two-fields { display: grid; grid-template-columns: 1fr; gap: 10px; }.two-fields label > span { margin-bottom: 7px; }.local-note { display: flex; align-items: center; gap: 10px; margin-top: 17px; padding: 10px 12px; border-radius: 9px; color: #615d66; background: #e9ede5; }.local-note > span { font-size: 17px; color: var(--forest); }.local-note p { margin: 0; font-size: 8px; line-height: 1.4; }

/* Game */
.game-screen { min-height: 100vh; min-height: 100dvh; background: #eceae4; }
.game-header { height: 66px; display: grid; grid-template-columns: 42px 1fr auto auto auto 42px; align-items: center; gap: 11px; padding: 0 18px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.9); }
.square-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 9px; color: #67636d; background: white; font-size: 15px; }.square-button:hover { color: var(--forest); border-color: var(--forest); }
.game-brand { display: flex; align-items: center; gap: 9px; }.game-brand > span { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 8px; color: var(--lime); background: var(--ink); font: 700 14px "Space Grotesk"; }.game-brand div { display: grid; }.game-brand b { font: 700 11px "Space Grotesk"; letter-spacing: .07em; }.game-brand small { color: #918d96; font-size: 6px; font-weight: 800; letter-spacing: .14em; }
.game-mode-pill, .connection-pill { min-height: 30px; display: flex; align-items: center; gap: 6px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; color: #6a6670; background: white; font-size: 7px; font-weight: 800; letter-spacing: .1em; }.connection-pill i { width: 6px; height: 6px; border-radius: 50%; background: #55bd75; }.connection-pill.offline i { background: var(--red); }
.room-share-button { min-height: 35px; display: flex; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: white; }.room-share-button span { color: #918d95; font-size: 6px; font-weight: 800; letter-spacing: .12em; }.room-share-button b { font-size: 10px; letter-spacing: .14em; }.room-share-button i { color: var(--forest); font-style: normal; }
.game-layout { width: min(1180px,calc(100% - 34px)); margin: 0 auto; padding: 22px 0 28px; display: grid; grid-template-columns: minmax(470px,760px) minmax(270px,330px); justify-content: center; gap: 22px; }
.arena-column { min-width: 0; }.player-card { height: 63px; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 11px; padding: 0 13px; border: 1px solid var(--line); background: rgba(255,255,255,.85); }.opponent-card { border-radius: 13px 13px 0 0; }.active-player-card { border-radius: 0 0 13px 13px; }
.player-card.is-turn { background: white; box-shadow: inset 4px 0 var(--lime); }.player-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: white; background: var(--forest); font-size: 10px; font-weight: 800; }.player-avatar.black { color: white; background: var(--ink); }.player-avatar.white { color: var(--ink); border: 1px solid var(--line); background: white; }
.player-identity { min-width: 0; display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 8px; }.player-identity small { color: #8c8891; font-size: 6px; font-weight: 800; letter-spacing: .13em; }.player-identity strong { grid-column: 1/3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }.captured-pieces { color: #74707a; font: 14px/1 Georgia,serif; letter-spacing: -2px; }
.chess-clock { min-width: 82px; padding: 8px 10px; border-radius: 8px; text-align: center; color: #6f6b74; background: #efede7; font: 700 19px/1 "Space Grotesk"; font-variant-numeric: tabular-nums; }.player-card.is-turn .chess-clock { color: white; background: var(--forest); }.chess-clock.low { color: white !important; background: var(--red) !important; animation: clockPulse 1s infinite; }
.board-stage { position: relative; padding: 17px; background: #252924; box-shadow: 0 22px 45px rgba(28,29,27,.18); }.chess-board { width: 100%; aspect-ratio: 1; display: grid; grid-template-columns: repeat(8,1fr); grid-template-rows: repeat(8,1fr); overflow: hidden; background: var(--cream); }
.board-square { position: relative; min-width: 0; padding: 0; display: grid; place-items: center; border: 0; }.board-square.light { background: #eee8d7; }.board-square.dark { background: #759486; }.board-square:hover { box-shadow: inset 0 0 0 3px rgba(216,255,85,.58); z-index: 2; }.board-square.selected { box-shadow: inset 0 0 0 5px var(--gold); z-index: 2; }.board-square.last-move { background-image: linear-gradient(rgba(216,255,85,.3),rgba(216,255,85,.3)); }.board-square.in-check { background: #d9656d; }
.board-square.valid-move::before { content: ""; position: absolute; z-index: 2; width: 18%; aspect-ratio: 1; border-radius: 50%; background: rgba(25,35,31,.52); }.board-square.valid-capture::before { content: ""; position: absolute; z-index: 2; inset: 7%; border: clamp(3px,.45vw,6px) solid rgba(216,255,85,.8); border-radius: 50%; }
.chess-piece { position: relative; z-index: 1; color: #151513; font: clamp(31px,6.2vw,74px)/1 Georgia,"Times New Roman",serif; user-select: none; filter: drop-shadow(0 3px 2px rgba(0,0,0,.2)); }.chess-piece.white-piece { color: #fff; text-shadow: -1px -1px 0 #151513,1px -1px 0 #151513,-1px 1px 0 #151513,1px 1px 0 #151513; }.coordinate { position: absolute; z-index: 3; color: rgba(18,28,25,.58); font-size: clamp(5px,.7vw,8px); font-weight: 800; pointer-events: none; }.coordinate.file { right: 4px; bottom: 2px; }.coordinate.rank { left: 4px; top: 2px; }.board-square.dark .coordinate { color: rgba(255,255,255,.72); }
.chess-piece.black-piece.pawn-piece { width:.54em; height:.67em; display:block; overflow:hidden; color:transparent; font-size:clamp(43px,6.2vw,74px); filter:drop-shadow(0 3px 2px rgba(0,0,0,.2)); }
.chess-piece.black-piece.pawn-piece::before { content:""; width:31%; aspect-ratio:1; position:absolute; z-index:2; top:1%; left:34.5%; border-radius:50%; background:#151513; }
.chess-piece.black-piece.pawn-piece::after { content:""; position:absolute; inset:20% 2% 1%; background:#151513; clip-path:polygon(38% 0,62% 0,66% 20%,73% 42%,82% 55%,82% 68%,94% 73%,94% 88%,100% 90%,100% 100%,0 100%,0 90%,6% 88%,6% 73%,18% 68%,18% 55%,27% 42%,34% 20%); }
.board-corner { position: absolute; z-index: 3; width: 14px; height: 14px; border-color: var(--gold); opacity: .8; pointer-events: none; }.board-corner.top-left { top: 8px; left: 8px; border-top: 2px solid; border-left: 2px solid; }.board-corner.top-right { top: 8px; right: 8px; border-top: 2px solid; border-right: 2px solid; }.board-corner.bottom-left { bottom: 8px; left: 8px; border-bottom: 2px solid; border-left: 2px solid; }.board-corner.bottom-right { right: 8px; bottom: 8px; border-right: 2px solid; border-bottom: 2px solid; }
.game-sidebar { min-width: 0; display: flex; flex-direction: column; gap: 12px; }.turn-card { position: relative; overflow: hidden; padding: 19px; border-radius: 13px; color: white; background: var(--forest); }.turn-card::after { content: "♔"; position: absolute; right: -4px; bottom: -22px; color: rgba(255,255,255,.08); font: 100px/1 Georgia,serif; }.turn-card.black-turn { background: var(--ink); }.turn-card p { margin: 0 0 6px; color: var(--lime); font-size: 7px; font-weight: 800; letter-spacing: .14em; }.turn-card h2 { margin: 0 0 5px; font: 700 24px/1.05 "Space Grotesk"; letter-spacing: -.04em; }.turn-card > span { color: rgba(255,255,255,.68); font-size: 9px; }.check-badge { width: fit-content; margin-top: 12px; padding: 5px 8px; border-radius: 5px; color: white; background: var(--red); font-size: 7px; font-weight: 800; letter-spacing: .12em; }
.game-controls { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; }.game-controls button { min-height: 42px; display: grid; place-items: center; gap: 3px; padding: 7px; border: 1px solid var(--line); border-radius: 9px; color: #67636c; background: white; font-size: 14px; }.game-controls button span { font-size: 6px; font-weight: 800; letter-spacing: .09em; }.game-controls button:hover { color: var(--forest); border-color: var(--forest); }.game-controls button:disabled { opacity: .35; cursor: default; }.game-controls .danger-control:hover { color: var(--red); border-color: var(--red); }
.moves-card { min-height: 250px; flex: 1; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.78); }.sidebar-heading { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 11px; border-bottom: 1px solid var(--line); color: #706c75; font-size: 7px; font-weight: 800; letter-spacing: .11em; }.sidebar-heading b { color: var(--forest); }.move-history { max-height: 300px; margin: 11px 0 0; padding: 0; overflow: auto; list-style: none; counter-reset: moves; }.move-history li { min-height: 31px; display: grid; grid-template-columns: 24px 1fr; align-items: center; gap: 6px; border-bottom: 1px solid rgba(24,23,29,.07); color: #4f4c55; font-size: 9px; }.move-history li::before { counter-increment: moves; content: counter(moves) "."; color: #a09ca4; font-size: 7px; }.move-history .empty-history { display: block; padding: 18px 0; color: #99959e; text-align: center; border: 0; font-size: 8px; }.move-history .empty-history::before { content: none; }
.rule-reminder { display: flex; align-items: flex-start; gap: 11px; padding: 14px; border-radius: 12px; color: #5d5962; background: #dfe5db; }.rule-reminder > span { color: var(--forest); font: 27px/1 Georgia,serif; }.rule-reminder p { margin: 0; font-size: 8px; line-height: 1.45; }.rule-reminder b { display: block; color: var(--ink); font-size: 8px; }

/* Modals */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(12,17,15,.78); backdrop-filter: blur(7px); }.modal-card { width: min(450px,100%); position: relative; padding: 31px; border-radius: 18px; text-align: center; background: var(--paper); box-shadow: 0 25px 70px rgba(0,0,0,.28); }.modal-card h2 { margin: 7px 0 9px; font: 700 30px/1.05 "Space Grotesk"; letter-spacing: -.045em; }.modal-card > p:not(.eyebrow):not(.modal-note) { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }.modal-close { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; color: #77727d; background: white; font-size: 18px; }.modal-card .eyebrow { color: var(--forest); }
.big-room-code { width: 100%; min-height: 72px; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-items: center; margin: 21px 0; padding: 12px 16px; border: 1px dashed var(--sage); border-radius: 12px; text-align: left; background: white; }.big-room-code span { color: #8d8991; font-size: 7px; font-weight: 800; letter-spacing: .15em; }.big-room-code b { grid-row: 2; font: 700 26px "Space Grotesk"; letter-spacing: .16em; }.big-room-code i { grid-row: 1/3; color: var(--forest); font-size: 18px; font-style: normal; }.lobby-seats { display: grid; grid-template-columns: 1fr 30px 1fr; align-items: center; gap: 8px; }.lobby-seats > div { display: grid; justify-items: center; gap: 6px; }.seat-avatar { width: 45px; height: 45px; display: grid; place-items: center; border-radius: 12px; font-weight: 800; }.seat-avatar.white { border: 1px solid var(--line); background: white; }.seat-avatar.black { color: white; background: var(--ink); }.lobby-seats p { display: grid; gap: 2px; margin: 0; }.lobby-seats b { font-size: 10px; }.lobby-seats small { color: #92909a; font-size: 6px; font-weight: 800; letter-spacing: .09em; }.lobby-seats > i { color: #aaa6ad; font-size: 7px; font-style: normal; font-weight: 800; }.full-button { width: 100%; margin-top: 20px; }.modal-note { margin: 12px 0 0; color: #8b8790; font-size: 8px; }.pass-piece,.winner-piece { margin: 16px 0 2px; color: var(--forest); font: 70px/1 Georgia,serif; }.promotion-options { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-top: 22px; }.promotion-options button { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: white; font: 42px/1 Georgia,serif; }.promotion-options button:hover { border-color: var(--forest); background: var(--lime); }.winner-actions { display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; margin-top: 20px; }.winner-actions .primary-button { margin: 0; }.rematch-status { margin-top: 14px; padding: 9px; border-radius: 8px; color: #5f5b64; background: #e5e9df; font-size: 8px; }.rules-card { width: min(610px,100%); text-align: left; }.rules-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }.rules-grid > div { display: grid; grid-template-columns: 30px 1fr; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: white; }.rules-grid > div > b { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: var(--ink); background: var(--lime); font-size: 10px; }.rules-grid p { margin: 0; color: #6e6a74; font-size: 9px; line-height: 1.45; }.rules-grid strong { display: block; color: var(--ink); }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 22px; max-width: min(390px,calc(100vw - 30px)); padding: 12px 18px; border-radius: 10px; color: white; background: var(--ink); box-shadow: 0 13px 35px rgba(17,21,40,.25); font-size: 9px; font-weight: 700; transform: translate(-50%,130px); transition: transform .2s; }.toast.show { transform: translate(-50%,0); }

@keyframes clockPulse { 50% { opacity: .78; } }
@media (max-width: 980px) {
  .menu-screen { grid-template-columns: 1fr; }.menu-hero { min-height: 560px; padding: 80px 7vw 45px; }.hero-board { width: 330px; margin: 42px 0 34px; }.setup-card { width: min(650px,calc(100% - 34px)); padding: 45px 0 80px; }
  .game-layout { width: min(760px,calc(100% - 24px)); grid-template-columns: 1fr; }.game-sidebar { display: grid; grid-template-columns: 1fr 1fr; }.turn-card,.game-controls,.rule-reminder { grid-column: auto; }.moves-card { grid-column: 1/3; min-height: 180px; }.move-history { max-height: 210px; }
}
@media (max-width: 650px) {
  .menu-hero { min-height: auto; padding: 72px 18px 34px; }.menu-hero h1 { font-size: clamp(54px, 18vw, 70px); }.hero-copy { font-size: 14px; }.hero-board { width: min(250px, 74vw); margin: 27px 0 24px; }.hero-crown { font-size: 72px; }.hero-piece { font-size: 48px; }.feature-row { gap: 10px; }
  .setup-card { width: calc(100% - 28px); padding: 32px 0 max(58px, env(safe-area-inset-bottom)); }.setup-heading { align-items: flex-start; }.text-button { min-height: 44px; padding: 0 6px; }.mode-tab { min-height: 80px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 3px; padding: 11px; }.mode-tab > span { width: 28px; height: 28px; margin-bottom: 4px; }.mode-tab small { display: none; }.mode-panel { padding: 17px; }.segmented button { min-height: 44px; height: auto; }.timer-options { grid-template-columns: repeat(2,1fr); }.join-row { grid-template-columns: minmax(0,1fr) 88px; }.two-fields { grid-template-columns: 1fr; }
  .game-header { height: 60px; grid-template-columns: 44px 1fr auto 44px; gap: 4px; padding: 0 max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left)); }.square-button { width: 44px; height: 44px; }.game-mode-pill,.connection-pill { display: none; }.room-share-button { grid-column: 3; min-height: 44px; padding: 0 8px; }.room-share-button span { display: none; }.game-brand { min-height: 44px; }.game-brand small { display: none; }
  .game-layout { width: 100%; padding-top: 0; gap: 12px; }.player-card { height: 64px; border-radius: 0; border-left: 0; border-right: 0; }.board-stage { padding: 4px; }.chess-board { touch-action: manipulation; }.chess-piece { font-size: clamp(29px,11vw,58px); }.board-corner { display: none; }.game-sidebar { padding: 0 10px max(76px, calc(62px + env(safe-area-inset-bottom))); grid-template-columns: 1fr; }.turn-card,.game-controls,.moves-card,.rule-reminder { grid-column: 1; }.game-controls button { min-height: 48px; }.moves-card { min-height: 150px; }
  .modal-backdrop { align-items: start; overflow-y: auto; padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)); }.modal-card { max-height: calc(100dvh - 28px); overflow-y: auto; padding: 25px 18px; }.modal-close { width: 44px; height: 44px; top: 8px; right: 8px; }.rules-grid { grid-template-columns: 1fr; max-height: none; overflow: visible; }.winner-actions { grid-template-columns: 1fr; }.promotion-options button { font-size: 34px; }
}
@media (max-width: 390px) {
  .mode-tabs { gap: 6px; }.mode-tab { min-width: 0; padding: 9px 7px; }.choice-cards { grid-template-columns: 1fr; }.choice-cards button { min-height: 48px; }.option-heading small { display: none; }.player-card { grid-template-columns: 35px 1fr auto; gap: 7px; padding: 0 8px; }.player-avatar { width: 32px; height: 32px; }.chess-clock { min-width: 67px; font-size: 16px; }.captured-pieces { font-size: 11px; }
}
@media (hover: none) { .primary-button:hover,.mode-tab:hover { transform: none; } }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation: none !important; transition: none !important; } }
