:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f3eee5;
  background: #080d11;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --bg: #080d11;
  --bg-2: #0b1217;
  --panel: #10181e;
  --panel-2: #141e25;
  --panel-soft: rgba(18, 27, 34, .92);
  --text: #f3eee5;
  --text-soft: #d3cabd;
  --muted: #b7aea2;
  --muted-2: #999187;
  --gold: #c1a474;
  --gold-bright: #d4b984;
  --gold-soft: rgba(193, 164, 116, .12);
  --line: rgba(239, 226, 200, .14);
  --line-strong: rgba(221, 197, 151, .30);
  --danger: #c97b7b;
  --danger-bg: rgba(178, 74, 74, .12);
  --green: #78a77c;
  --blue: #779bb2;
  --board-light: #f3e2c2;
  --board-light-2: #e8cea2;
  --board-dark: #765944;
  --board-dark-2: #5b4232;
  --focus: #f2cf86;
  --shadow-lg: 0 28px 80px rgba(0, 0, 0, .40);
}

* { box-sizing: border-box; }
html, body, #app { min-height: 100%; margin: 0; }
html { color-scheme: dark; }
body {
  min-width: 320px;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 17% -8%, rgba(72, 94, 104, .20), transparent 38rem),
    radial-gradient(circle at 89% 7%, rgba(133, 103, 57, .10), transparent 35rem),
    linear-gradient(145deg, #070c10 0%, #0b1217 48%, #080d11 100%);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .11;
  background-image: linear-gradient(115deg, transparent 0 49%, rgba(255,255,255,.017) 50%, transparent 51%);
  background-size: 88px 88px;
}
button, input { font: inherit; }
button { color: inherit; }
button, input, [role="button"] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
input[aria-invalid="true"] { border-color: rgba(201,123,123,.8) !important; box-shadow: 0 0 0 1px rgba(201,123,123,.18); }
button:disabled { opacity: .46; cursor: not-allowed !important; transform: none !important; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Shared typography and controls */
.eyebrow, .section-kicker {
  color: #c9ae7f;
  letter-spacing: .16em;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}
.section-kicker { display: block; margin-bottom: 9px; }
.primary-action, .subtle-action, .ghost-btn, .controls button, .analysis-actions button,
.draw-offer button, .network-lobby button, .player-resign, .danger-action, .chat-compose button {
  min-height: 40px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.primary-action {
  border: 1px solid rgba(221, 199, 156, .58);
  color: #17120d;
  background: linear-gradient(180deg, #eadbbd, #cdb487);
  font-weight: 800;
  box-shadow: 0 10px 28px rgba(0,0,0,.22), inset 0 1px rgba(255,255,255,.35);
}
.primary-action:hover { transform: translateY(-1px); background: linear-gradient(180deg, #f0e3c8, #d7bf91); }
.subtle-action, .ghost-btn, .controls button, .analysis-actions button, .draw-offer button,
.network-lobby button, .player-resign, .chat-compose button {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.026);
  color: #e0d8cc;
}
.subtle-action:hover, .ghost-btn:hover, .controls button:hover, .analysis-actions button:hover,
.draw-offer button:hover, .network-lobby button:hover, .chat-compose button:hover {
  border-color: var(--line-strong);
  background: rgba(255,255,255,.055);
}

/* Portal */
.portal-shell { min-height: 100vh; display: flex; flex-direction: column; }
.portal-topbar {
  min-height: 78px;
  display: grid;
  grid-template-columns: minmax(260px,1fr) auto minmax(260px,1fr);
  align-items: center;
  gap: 22px;
  padding: 12px clamp(18px,4vw,58px);
  border-bottom: 1px solid var(--line);
  background: rgba(7,12,16,.90);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 40;
}
.portal-brand, .profile-chip {
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px;
  min-height: 44px;
}
.portal-brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border: 1px solid rgba(193,164,116,.45); border-radius: 9px;
  color: #d9c091; font-family: Georgia, serif; font-size: 25px;
}
.portal-brand b { display: block; font-family: Georgia,"Times New Roman",serif; font-size: 18px; letter-spacing: .10em; font-weight: 500; }
.portal-brand small { display: block; color: var(--muted-2); font-size: 14px; letter-spacing: .13em; margin-top: 3px; }
.portal-nav { display: flex; gap: 4px; padding: 4px; border: 1px solid rgba(255,255,255,.07); border-radius: 12px; background: rgba(255,255,255,.018); }
.portal-nav-btn { min-height: 40px; border: 0; background: transparent; color: var(--muted); padding: 9px 14px; border-radius: 8px; font-size: 14px; letter-spacing: .025em; cursor: pointer; }
.portal-nav-btn.active { color: #f1e8d8; background: rgba(234,215,182,.09); box-shadow: inset 0 -2px rgba(190,164,118,.55); }
.profile-chip { justify-self: end; }
.profile-chip-avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(145deg,#e7d8bb,#9b8062); color: #1a1510; font-family: Georgia,serif; font-weight: 700; }
.profile-chip b { display: block; font-size: 14px; }
.profile-chip small { display: block; color: var(--muted-2); font-size: 14px; margin-top: 2px; }
.portal-content { width: min(1420px,calc(100% - 36px)); margin: 0 auto; flex: 1; padding: clamp(34px,5vw,68px) 0; }
.hub-view { display: none; }
.hub-view.active { display: block; animation: hubIn .20s ease; }
@keyframes hubIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.play-heading, .hub-heading { display: flex; justify-content: space-between; align-items: end; gap: 40px; margin-bottom: 30px; }
.play-heading > div:first-child, .hub-heading { max-width: 850px; }
.play-heading h1, .hub-heading h2 { font-family: Georgia,"Times New Roman",serif; font-weight: 400; letter-spacing: -.025em; margin: 3px 0 11px; }
.play-heading h1 { font-size: clamp(42px,6vw,74px); line-height: .98; }
.play-heading h1 span { font-style: italic; color: #d6bd91; }
.play-heading p, .hub-heading p { color: var(--muted); line-height: 1.65; margin: 0; max-width: 740px; font-size: 15px; }
.fairplay-seal { width: 132px; height: 132px; border: 1px solid rgba(190,164,118,.36); border-radius: 50%; display: grid; place-items: center; align-content: center; text-align: center; box-shadow: inset 0 0 0 7px rgba(190,164,118,.028); }
.fairplay-seal span, .fairplay-seal small { font-size: 14px; letter-spacing: .12em; color: #bda67e; }
.fairplay-seal strong { font-family: Georgia,serif; font-size: 40px; font-weight: 400; line-height: 1.05; color: #f0e2c5; }
.play-grid { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 20px; }
.competition-card, .tournament-card { border: 1px solid var(--line); background: linear-gradient(145deg,rgba(19,28,35,.97),rgba(11,17,22,.97)); box-shadow: 0 22px 60px rgba(0,0,0,.23); border-radius: 16px; }
.play-card-main { padding: clamp(24px,3vw,36px); }
.section-title-row { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.section-title-row h2, .event-card h3, .philosophy-card h3, .profile-main h3, .account-card h3, .analysis-box h3 { font-family: Georgia,serif; font-weight: 400; margin: 2px 0 0; }
.rated-pill, .provisional-tag, .provisional-mini { border: 1px solid rgba(193,164,116,.32); color: #cbb287; background: rgba(193,164,116,.06); border-radius: 999px; padding: 5px 9px; font-size: 14px; letter-spacing: .10em; text-transform: uppercase; white-space: nowrap; }
.mode-switch { display: grid; grid-template-columns: repeat(auto-fit,minmax(130px,1fr)); gap: 7px; margin: 25px 0 18px; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: #0a1014; }
.mode-btn { min-height: 42px; border: 0; background: transparent; color: var(--muted); border-radius: 8px; padding: 10px; cursor: pointer; font-size: 14px; font-weight: 700; }
.mode-btn.active { color: #f0e2c8; background: rgba(237,219,187,.09); box-shadow: inset 0 -2px #aa8d61; }
.preset-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 9px; margin: 18px 0; }
.preset { min-height: 70px; border: 1px solid var(--line); background: rgba(255,255,255,.022); border-radius: 10px; padding: 12px 8px; cursor: pointer; transition: .17s ease; }
.preset:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.preset.active { border-color: rgba(191,164,116,.54); background: rgba(191,164,116,.09); box-shadow: inset 0 0 0 1px rgba(191,164,116,.09); }
.preset strong { display: block; font-family: Georgia,serif; font-size: 20px; font-weight: 400; }
.preset span { display: block; color: var(--muted-2); font-size: 14px; margin-top: 4px; }
.custom-time { margin: 8px 0 19px; }
.custom-time-toggle { width: 100%; min-height: 40px; border: 1px dashed var(--line); background: transparent; color: var(--muted); border-radius: 9px; padding: 9px; cursor: pointer; font-size: 14px; }
.custom-time-toggle.active { border-style: solid; border-color: rgba(190,164,118,.45); color: #dec8a2; background: rgba(190,164,118,.05); }
.custom-time-fields { margin-top: 8px; display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #0a1014; }
.custom-time-fields label span, .setup-pane label span, .single-field span, .account-card label span { display: block; color: var(--muted); font-size: 14px; margin: 0 0 6px 2px; }
.custom-time-fields input, .setup-row input, .single-field input, .account-card input, .chat-compose input { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 9px; background: #0b1217; color: #f0e8da; padding: 10px 12px; }
.time-plus { color: #b69a6c; padding-bottom: 10px; }
.setup-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.setup-pane { display: none; }
.setup-pane.active { display: block; }
.full-action { width: 100%; margin-top: 14px; padding: 12px; min-height: 46px; }
.setup-note { text-align: center; color: var(--muted-2); font-size: 14px; margin: 12px 0 0; }
.setup-error { margin-top: 12px; padding: 11px 13px; border: 1px solid rgba(187,91,91,.38); border-radius: 9px; background: rgba(167,77,77,.10); color: #e3adad; font-size: 14px; }
.play-side-stack { display: flex; flex-direction: column; gap: 18px; }
.event-card, .philosophy-card { padding: 26px; }
.event-card h3, .philosophy-card h3 { font-size: 27px; }
.event-card > p, .philosophy-card > p { color: var(--muted); line-height: 1.6; font-size: 14px; }
.event-meta { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding: 12px 0; font-size: 14px; }
.event-meta span { color: var(--muted-2); }
.event-meta b { font-weight: 650; }
.event-card .subtle-action, .account-card .subtle-action { width: 100%; padding: 10px; margin-top: 8px; }
.score-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 18px; }
.score-pair span { border: 1px solid var(--line); border-radius: 10px; padding: 13px; }
.score-pair small, .profile-score-grid small { display: block; color: var(--muted-2); font-size: 14px; letter-spacing: .10em; }
.score-pair strong { font-family: Georgia,serif; font-size: 30px; font-weight: 400; }
.hub-heading { display: block; }
.hub-heading h2 { font-size: clamp(36px,5vw,58px); }
.tournament-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 15px; }
.tournament-card { padding: 24px; min-height: 250px; display: flex; flex-direction: column; }
.tournament-card > span { color: #c3a779; letter-spacing: .13em; font-size: 14px; }
.tournament-card h3 { font-family: Georgia,serif; font-weight: 400; font-size: 26px; margin: 30px 0 8px; }
.tournament-card p { color: var(--muted); line-height: 1.55; font-size: 14px; flex: 1; }
.tournament-card .subtle-action { padding: 9px; }
.ranking-card { overflow: hidden; }
.ranking-head, .ranking-row { display: grid; grid-template-columns: 50px 1fr 130px 150px; gap: 12px; align-items: center; padding: 15px 19px; }
.ranking-head { font-size: 14px; letter-spacing: .10em; color: var(--muted-2); border-bottom: 1px solid var(--line); }
.ranking-row { border-bottom: 1px solid rgba(255,255,255,.045); font-size: 14px; }
.ranking-row .r0 { color: var(--muted-2); }
.ranking-row .r1 { font-family: Georgia,serif; font-size: 17px; }
.ranking-row .r3 { color: #dac295; }
.ranking-note { padding: 15px 19px; color: var(--muted-2); font-size: 14px; margin: 0; }
.profile-layout { display: grid; grid-template-columns: 1.35fr .65fr; gap: 16px; }
.profile-main, .account-card { padding: 28px; }
.profile-identity { display: flex; gap: 16px; align-items: center; }
.profile-big-avatar { width: 80px; height: 80px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(145deg,#e8d9bc,#806a55); color: #18130e; font-family: Georgia,serif; font-size: 36px; }
.profile-identity h3 { font-size: 34px; margin: 7px 0 2px; }
.profile-identity p, .account-card p { color: var(--muted); font-size: 14px; line-height: 1.6; }
.profile-score-grid { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 9px; margin-top: 24px; }
.profile-score-grid > div { border: 1px solid var(--line); border-radius: 11px; padding: 15px; }
.profile-score-grid strong { display: block; font-family: Georgia,serif; font-size: 34px; font-weight: 400; }
.profile-score-grid span { display: block; color: var(--muted); font-size: 14px; margin-top: 3px; }
.profile-score-grid .fair { border-color: rgba(190,164,118,.26); }
.account-card h3 { font-size: 28px; }
.account-card label { display: block; margin-top: 20px; }
.settings-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; }
.setting-card { padding: 23px; }
.setting-card span { color: #c5aa7d; font-size: 14px; letter-spacing: .10em; text-transform: uppercase; }
.setting-card b { display: block; margin: 12px 0 7px; font-family: Georgia,serif; font-size: 19px; font-weight: 400; }
.setting-card p { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 0; }
.portal-footer { width: min(1420px,calc(100% - 36px)); margin: 0 auto; display: flex; justify-content: space-between; gap: 20px; padding: 19px 0 24px; border-top: 1px solid var(--line); color: var(--muted-2); font-size: 14px; letter-spacing: .12em; }

/* Match shell */
.game-shell { min-height: 100vh; padding: 12px 18px 20px; }
.game-topbar { max-width: 1540px; margin: 0 auto 11px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 8px 2px; }
.mini-brand { display: flex; align-items: center; gap: 10px; }
.mini-brand > span { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid rgba(193,164,116,.43); border-radius: 8px; color: #d9c091; font-size: 21px; }
.mini-brand b { display: block; font-family: Georgia,serif; font-size: 15px; letter-spacing: .10em; font-weight: 400; }
.mini-brand small { display: block; color: var(--muted-2); font-size: 14px; letter-spacing: .13em; margin-top: 2px; }
.match-title { text-align: center; }
.match-title small { display: block; color: var(--muted-2); font-size: 14px; letter-spacing: .13em; }
.match-title b { display: block; font-family: Georgia,serif; font-size: 20px; font-weight: 400; color: #ddccb0; margin-top: 2px; }
.top-actions { justify-self: end; display: flex; gap: 8px; }
.ghost-btn { padding: 8px 11px; font-size: 14px; }
.network-lobby { max-width: 1540px; margin: 0 auto 10px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 13px; border: 1px solid rgba(193,164,116,.27); border-radius: 10px; background: rgba(193,164,116,.045); }
.network-lobby > div { display: flex; gap: 8px; align-items: center; }
.network-lobby span { color: var(--muted); font-size: 14px; letter-spacing: .12em; }
.network-lobby strong { color: #dec9a3; letter-spacing: .14em; font-variant-numeric: tabular-nums; font-size: 14px; }
.network-lobby button { padding: 7px 10px; font-size: 14px; }
.connection-banner { max-width: 1540px; margin: 0 auto 10px; min-height: 42px; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 9px 13px; border: 1px solid rgba(203,173,116,.34); border-radius: 10px; background: rgba(203,173,116,.07); color: #e7d6b7; font-size: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.13); }
.connection-banner[hidden] { display: none; }
.connection-pulse { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 5px rgba(203,173,116,.08); }
.game-shell[data-connection="reconnecting"] .connection-pulse, .game-shell[data-connection="connecting"] .connection-pulse { animation: connectionPulse 1.1s ease-in-out infinite; }
@keyframes connectionPulse { 50% { opacity: .35; transform: scale(.82); } }
.result-strip { max-width: 1540px; margin: 0 auto 10px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid rgba(193,164,116,.30); border-radius: 11px; background: linear-gradient(90deg,rgba(193,164,116,.085),rgba(255,255,255,.022)); box-shadow: 0 12px 30px rgba(0,0,0,.15); }
.result-strip-mark { font-size: 23px; color: #d3ba86; }
.result-strip small { display: block; color: var(--muted); font-size: 14px; letter-spacing: .13em; }
.result-strip strong { font-family: Georgia,serif; font-size: 20px; font-weight: 400; }
.result-strip > span:last-child { color: var(--text-soft); font-size: 14px; }

.arena { max-width: 1540px; margin: auto; display: grid; grid-template-columns: 230px minmax(560px,1fr) 330px; gap: 18px; align-items: center; }
.player-rail { display: flex; flex-direction: column; gap: 11px; }
.player-card, .status-card, .side-panel { border: 1px solid var(--line); background: linear-gradient(145deg,rgba(18,27,34,.96),rgba(10,16,21,.97)); box-shadow: 0 18px 44px rgba(0,0,0,.21); }
.player-card { border-radius: 14px; padding: 16px; transition: .18s ease; position: relative; }
.player-card.active { border-color: rgba(200,173,124,.45); box-shadow: 0 0 0 1px rgba(200,173,124,.08),0 18px 44px rgba(0,0,0,.27); }
.player-identity { display: flex; align-items: center; gap: 11px; }
.player-avatar { width: 46px; height: 46px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(145deg,#554a3f,#201d1a); border: 1px solid rgba(255,255,255,.10); font-family: Georgia,serif; font-size: 21px; color: #dcc9a6; }
.player-avatar.light-avatar { background: linear-gradient(145deg,#eadfc9,#a99070); color: #211a12; }
.player-meta { min-width: 0; }
.player-meta b { display: block; font-family: Georgia,serif; font-size: 18px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-meta small { display: block; color: var(--muted); font-size: 14px; margin-top: 3px; }
.player-color-line { display: flex; align-items: center; gap: 7px; margin-top: 11px; color: var(--muted); font-size: 14px; }
.player-color-line .provisional-mini { margin-left: auto; padding: 4px 7px; font-size: 14px; }
.color-dot { width: 9px; height: 9px; border-radius: 50%; border: 1px solid rgba(255,255,255,.2); }
.player-card.white .color-dot { background: #eee4d2; }
.player-card.black .color-dot { background: #1d1c1a; }
.clock { margin-top: 11px; padding: 13px 0 8px; border-top: 1px solid rgba(255,255,255,.055); font-variant-numeric: tabular-nums; font-family: ui-monospace,SFMono-Regular,Consolas,monospace; font-size: clamp(36px,4vw,50px); line-height: 1; letter-spacing: -.05em; color: #ddd6ca; }
.player-card.active .clock { color: #f2dfbc; }
.player-card.active::after { content: "AU TRAIT"; display: block; margin-top: 8px; color: #c9ad79; font-size: 14px; letter-spacing: .13em; font-weight: 800; }
.player-resign { width: 100%; margin-top: 9px; padding: 8px; color: #d39a9a; font-size: 14px; }
.status-card { border-radius: 11px; padding: 12px 13px; display: grid; grid-template-columns: 8px 1fr; column-gap: 9px; }
.status-card > span { width: 7px; height: 7px; border-radius: 50%; background: #c0a36f; margin-top: 6px; box-shadow: 0 0 10px rgba(192,163,111,.5); }
.status-card b { font-size: 14px; font-weight: 650; }
.status-card small { grid-column: 2; color: var(--muted-2); font-size: 14px; margin-top: 2px; }

/* Board */
.board-wrap { display: grid; place-items: center; min-width: 0; }
.board-frame {
  width: min(100%,calc(100vh - 112px));
  aspect-ratio: 1;
  padding: 16px;
  border-radius: 16px;
  background:
    linear-gradient(91deg,rgba(255,255,255,.038),transparent 18%,rgba(0,0,0,.085) 56%,transparent 80%),
    repeating-linear-gradient(4deg,rgba(255,255,255,.018) 0 1px,transparent 1px 6px),
    linear-gradient(145deg,#83654e 0%,#49372a 48%,#745741 100%);
  border: 1px solid rgba(239,221,189,.26);
  box-shadow: 0 34px 88px rgba(0,0,0,.50), inset 0 0 0 2px rgba(19,12,8,.44), inset 0 1px rgba(255,255,255,.13);
}
.board { width: 100%; height: 100%; display: grid; grid-template-columns: repeat(8,1fr); grid-template-rows: repeat(8,1fr); position: relative; overflow: hidden; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(43,29,19,.55),0 1px 0 rgba(255,255,255,.05); user-select: none; touch-action: none; }
.square { position: relative; border: 0; padding: 0; min-width: 0; min-height: 0; cursor: pointer; }
.square.light { background-color: var(--board-light); background-image: repeating-linear-gradient(7deg,rgba(113,78,42,.027) 0 1px,transparent 1px 7px),linear-gradient(100deg,rgba(255,255,255,.095),transparent 30%,rgba(116,79,43,.025) 72%,transparent); }
.square.dark { background-color: var(--board-dark); background-image: repeating-linear-gradient(7deg,rgba(33,21,14,.06) 0 1px,transparent 1px 7px),linear-gradient(100deg,rgba(255,255,255,.03),transparent 30%,rgba(32,20,13,.07) 72%,transparent); }
.square:focus-visible { z-index: 4; outline: 3px solid var(--focus); outline-offset: -3px; }
.square.last::after { content: ""; position: absolute; inset: 0; background: rgba(199,154,67,.29); box-shadow: inset 0 0 0 1px rgba(231,190,110,.25); }
.square.selected::after { content: ""; position: absolute; inset: 3px; box-shadow: inset 0 0 0 3px rgba(88,137,167,.88),0 0 14px rgba(84,127,157,.22); background: rgba(84,127,157,.13); }
.square.legal::before { content: ""; position: absolute; width: 17%; aspect-ratio: 1; border-radius: 50%; background: rgba(66,125,72,.88); left: 41.5%; top: 41.5%; z-index: 2; box-shadow: 0 0 0 3px rgba(246,231,201,.20); }
.square.capture::before { content: ""; position: absolute; inset: 8%; border: 4px solid rgba(142,52,49,.80); border-radius: 50%; z-index: 2; box-shadow: 0 0 12px rgba(135,50,47,.22); }
.square.check::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle,rgba(154,48,53,.70),rgba(113,35,38,.24) 54%,transparent 76%); box-shadow: inset 0 0 0 2px rgba(164,58,61,.46); }
.coord { position: absolute; z-index: 3; font-size: 14px; font-weight: 800; opacity: .88; pointer-events: none; }
.coord.file { right: 4px; bottom: 2px; }
.coord.rank { left: 4px; top: 2px; }
.light .coord { color: #705640; }
.dark .coord { color: #f8e5c2; }
.pieces-layer { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.piece { position: absolute; width: 12.5%; height: 12.5%; display: grid; place-items: center; pointer-events: auto; cursor: grab; transition: left 165ms cubic-bezier(.22,.78,.23,1),top 165ms cubic-bezier(.22,.78,.23,1),opacity 140ms ease,transform 140ms ease; will-change: left,top,transform; z-index: 6; }
.piece:hover { transform: translateY(-1px) scale(1.022); }
.piece.dragging { z-index: 30; cursor: grabbing; transform: scale(1.08); }
.piece.captured { opacity: 0; transform: scale(.72); pointer-events: none; }
.piece-svg { width: 94%; height: 94%; display: block; object-fit: contain; pointer-events: none; user-select: none; transform: translateY(-1%); filter: drop-shadow(0 1px 1px rgba(42,25,13,.32)) drop-shadow(0 6px 5px rgba(17,10,6,.18)); }
.black-piece .piece-svg { filter: drop-shadow(0 2px 1px rgba(0,0,0,.46)) drop-shadow(0 7px 6px rgba(0,0,0,.23)); }
.piece:hover .piece-svg { filter: drop-shadow(0 3px 2px rgba(22,14,9,.32)) drop-shadow(0 8px 7px rgba(0,0,0,.20)); }
.board-caption { width: 100%; display: flex; justify-content: space-between; margin-top: 10px; color: var(--muted-2); font-size: 14px; letter-spacing: .10em; }

/* Right panel */
.side-panel { height: min(calc(100vh - 112px),780px); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; min-height: 610px; }
.result-summary { padding: 17px; border-bottom: 1px solid var(--line); background: linear-gradient(120deg,rgba(193,164,116,.09),rgba(255,255,255,.012)); }
.result-summary h3 { font-family: Georgia,serif; font-weight: 400; font-size: 28px; margin: 0 0 5px; }
.result-summary > p { color: var(--muted); font-size: 14px; margin: 0 0 13px; }
.result-score-line { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid rgba(255,255,255,.055); padding: 9px 0; font-size: 14px; }
.result-score-line span { color: var(--muted-2); }
.result-score-line b { font-weight: 600; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 9px; }
.result-actions button { padding: 8px; font-size: 14px; }
.tabs { display: grid; grid-template-columns: repeat(4,1fr); border-bottom: 1px solid var(--line); }
.tab { min-height: 44px; border: 0; background: transparent; color: var(--muted-2); padding: 11px 5px; font-size: 14px; font-weight: 800; letter-spacing: .08em; cursor: pointer; }
.tab.active { color: #dec7a0; box-shadow: inset 0 -2px #b89b68; background: rgba(193,164,116,.025); }
.panel-stack { flex: 1; min-height: 0; position: relative; }
.panel-view { display: none; height: 100%; }
.panel-view.active { display: flex; flex-direction: column; }
.moves { flex: 1; overflow: auto; padding: 10px 12px; scrollbar-width: thin; }
.empty-moves, .chat-empty { color: var(--muted-2); display: grid; place-items: center; text-align: center; height: 100%; padding: 20px; font-size: 14px; line-height: 1.6; }
.move-row { display: grid; grid-template-columns: 30px 1fr 1fr; gap: 6px; align-items: center; min-height: 36px; border-bottom: 1px solid rgba(255,255,255,.035); }
.move-row > span:first-child { color: var(--muted-2); font-size: 14px; text-align: right; padding-right: 4px; }
.move-san { color: #e2dbcf; padding: 6px 7px; text-align: left; font-family: Georgia,serif; font-size: 14px; }
.chat-stream { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 9px; }
.chat-message { max-width: 90%; align-self: flex-start; }
.chat-message.own { align-self: flex-end; text-align: right; }
.chat-message span { display: block; color: var(--muted-2); font-size: 14px; margin: 0 4px 4px; }
.chat-message p { margin: 0; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.03); font-size: 14px; line-height: 1.5; color: #e0d8cc; }
.chat-message.own p { background: rgba(193,164,116,.08); border-color: rgba(193,164,116,.20); }
.chat-compose { border-top: 1px solid var(--line); padding: 10px; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.chat-compose > div { position: relative; }
.chat-compose input { padding: 9px 58px 9px 10px; font-size: 14px; }
.chat-compose small { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); color: var(--muted-2); font-size: 14px; }
.chat-compose button { padding: 0 12px; font-size: 14px; }
.game-info-list { padding: 14px; }
.game-info-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,.045); font-size: 14px; }
.game-info-list span { color: var(--muted-2); }
.game-info-list b { font-weight: 600; text-align: right; }
.analysis-box { padding: 18px; }
.analysis-box h3 { font-size: 26px; }
.analysis-box p { color: var(--muted); font-size: 14px; line-height: 1.65; }
.analysis-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 15px; }
.analysis-actions button { padding: 9px; font-size: 14px; }
.draw-offer { margin: 8px 10px; padding: 10px; border: 1px solid rgba(193,164,116,.23); border-radius: 9px; background: rgba(193,164,116,.05); font-size: 14px; }
.draw-offer div { display: flex; gap: 6px; margin-top: 8px; }
.draw-offer button { padding: 6px 9px; font-size: 14px; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.controls button { font-size: 14px; padding: 8px 7px; line-height: 1.25; }
.controls button:last-child { grid-column: 1/-1; }
.controls button.active { border-color: rgba(193,164,116,.44); color: #dec7a0; background: rgba(193,164,116,.09); }

/* Feedback / modals */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%,18px); background: #111a20; border: 1px solid var(--line-strong); box-shadow: 0 16px 50px rgba(0,0,0,.36); padding: 11px 15px; border-radius: 10px; color: #ece3d5; opacity: 0; pointer-events: none; transition: .2s ease; z-index: 100; max-width: min(560px,90vw); text-align: center; font-size: 14px; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.promotion-modal, .confirm-modal { position: fixed; inset: 0; z-index: 125; display: grid; place-items: center; background: rgba(3,7,9,.74); backdrop-filter: blur(9px); padding: 18px; }
.promotion-card, .confirm-card { width: min(480px,100%); border: 1px solid var(--line-strong); border-radius: 16px; background: #111a20; box-shadow: 0 35px 100px rgba(0,0,0,.52); padding: 26px; text-align: center; }
.promotion-card h2, .confirm-card h2 { font-family: Georgia,serif; font-weight: 400; margin: 0 0 6px; font-size: 30px; }
.promotion-card p, .confirm-card p { color: var(--muted); font-size: 14px; }
.promotion-card .eyebrow, .confirm-card .eyebrow { margin: 0 0 7px; }
#promotion-options { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin: 20px 0 12px; }
.promotion-piece { border: 1px solid var(--line); border-radius: 10px; background: #151e24; aspect-ratio: 1; cursor: pointer; display: grid; place-items: center; padding: 7px; min-width: 56px; }
.promotion-piece:hover { border-color: var(--line-strong); background: #19242b; }
.promotion-piece .piece-svg { width: 88%; height: 88%; }
#promotion-cancel { min-height: 40px; border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 8px 14px; }
.confirm-card > div { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }
.danger-action { border: 1px solid rgba(193,92,92,.48); background: var(--danger-bg); color: #e4abab; padding: 9px 13px; }

/* Orientation follows the player, including player cards. */
.game-shell[data-orientation="b"] .player-rail .player-card.black { order: 3; }
.game-shell[data-orientation="b"] .player-rail .status-card { order: 2; }
.game-shell[data-orientation="b"] .player-rail .player-card.white { order: 1; }

@media (max-width: 1240px) {
  .portal-topbar { grid-template-columns: 1fr auto; }
  .portal-nav { grid-row: 2; grid-column: 1/-1; justify-self: center; }
  .profile-chip { grid-column: 2; }
  .play-grid { grid-template-columns: 1fr; }
  .play-side-stack { display: grid; grid-template-columns: 1fr 1fr; }
  .tournament-grid, .settings-grid { grid-template-columns: repeat(2,1fr); }
  .arena { grid-template-columns: 195px minmax(480px,1fr); gap: 14px; }
  .side-panel { grid-column: 1/-1; height: 340px; min-height: 340px; display: grid; grid-template-columns: minmax(0,1fr) 330px; grid-template-rows: auto 1fr auto; }
  .result-summary { grid-column: 1/-1; }
  .tabs { grid-column: 1; }
  .panel-stack { grid-column: 1; grid-row: 2/4; }
  .draw-offer { grid-column: 2; grid-row: 2; margin: 10px; }
  .controls { grid-column: 2; grid-row: 3; border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
  .board-frame { width: min(100%,calc(100vh - 124px)); }
}

@media (max-width: 760px) {
  body { font-size: 14px; }
  .portal-topbar { display: flex; flex-wrap: wrap; gap: 9px; padding: 10px 12px; }
  .portal-brand { flex: 1; }
  .profile-chip { display: none; }
  .portal-nav { order: 3; width: 100%; overflow: auto; justify-content: flex-start; border-radius: 9px; scrollbar-width: none; }
  .portal-nav-btn { white-space: nowrap; min-height: 42px; padding: 9px 12px; }
  .portal-content { width: calc(100% - 20px); padding: 28px 0; }
  .play-heading { display: block; }
  .fairplay-seal { width: 96px; height: 96px; margin-top: 22px; }
  .fairplay-seal strong { font-size: 30px; }
  .play-heading h1 { font-size: 44px; }
  .play-grid, .play-side-stack, .profile-layout, .settings-grid, .tournament-grid { grid-template-columns: 1fr; }
  .preset-grid { grid-template-columns: repeat(4,1fr); }
  .setup-row { grid-template-columns: 1fr; }
  .profile-score-grid { grid-template-columns: 1fr 1fr; }
  .profile-score-grid .fair { grid-column: 1/-1; }
  .ranking-head, .ranking-row { grid-template-columns: 34px 1fr 64px 86px; padding: 12px 9px; gap: 6px; }
  .portal-footer { flex-direction: column; align-items: center; text-align: center; }

  .game-shell { padding: 7px; }
  .game-topbar { display: flex; justify-content: space-between; padding: 5px 2px; }
  .match-title { display: none; }
  .top-actions .ghost-btn:first-child { display: none; }
  .mini-brand small { display: none; }
  .network-lobby { align-items: stretch; flex-direction: column; }
  .network-lobby > div { justify-content: space-between; }
  .result-strip { grid-template-columns: auto 1fr; padding: 9px; }
  .result-strip > span:last-child { grid-column: 2; }
  .arena { display: flex; flex-direction: column; gap: 8px; }
  .player-rail { display: contents; }
  .game-shell[data-orientation="w"] .player-card.black { order: 0; }
  .game-shell[data-orientation="w"] .board-wrap { order: 1; }
  .game-shell[data-orientation="w"] .player-card.white { order: 2; }
  .game-shell[data-orientation="b"] .player-card.white { order: 0; }
  .game-shell[data-orientation="b"] .board-wrap { order: 1; }
  .game-shell[data-orientation="b"] .player-card.black { order: 2; }
  .status-card { order: 3; width: 100%; }
  .side-panel { order: 4; width: 100%; height: min(46vh,410px); min-height: 330px; display: flex; position: sticky; bottom: 7px; z-index: 35; border-radius: 17px 17px 11px 11px; box-shadow: 0 -18px 54px rgba(0,0,0,.34), 0 18px 44px rgba(0,0,0,.21); overflow: hidden; }
  .side-panel::before { content: ''; position: absolute; top: 5px; left: 50%; width: 44px; height: 4px; transform: translateX(-50%); border-radius: 999px; background: rgba(233,218,192,.24); z-index: 3; pointer-events: none; }
  .side-panel .tabs { padding-top: 9px; }
  .connection-banner { margin: 0 0 8px; }
  .player-card { width: 100%; padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .player-identity { grid-column: 1; }
  .player-color-line { grid-column: 1; margin-top: 5px; }
  .clock { grid-column: 2; grid-row: 1/3; margin: 0; padding: 0 0 0 12px; border-top: 0; font-size: 31px; }
  .player-resign { display: none; }
  .player-card.active::after { display: none; }
  .board-frame { width: 100%; padding: 9px; border-radius: 11px; }
  .coord { font-size: 14px; }
  .piece-svg { width: 94%; height: 94%; }
  .board-caption { font-size: 14px; }
  .tabs { grid-template-columns: repeat(4,1fr); }
  .panel-stack { flex: 1; }
  .controls { grid-template-columns: repeat(3,1fr); padding: 8px; }
  .controls button:last-child { grid-column: auto; }
  .result-summary { padding: 12px; }
  .result-summary h3 { font-size: 22px; }
  .result-score-line { display: none; }
  .result-actions { max-width: 340px; }
  .promotion-card, .confirm-card { padding: 21px; }
}

@media (max-width: 460px) {
  .preset-grid { grid-template-columns: repeat(2,1fr); }
  .play-card-main { padding: 18px; }
  .play-heading h1 { font-size: 38px; }
  .board-caption span:nth-child(2) { display: none; }
  .player-avatar { width: 36px; height: 36px; font-size: 18px; }
  .player-meta b { font-size: 15px; }
  .clock { font-size: 28px; }
  .controls { grid-template-columns: 1fr 1fr; }
  .controls button:last-child { grid-column: 1/-1; }
  .tab { font-size: 14px; }
}

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

/* RC5 audited icon consistency */
.portal-brand-mark img, .mini-brand > span img { width: 78%; height: 78%; object-fit: contain; display: block; filter: drop-shadow(0 2px 2px rgba(0,0,0,.28)); }
.result-strip-mark { width: 34px; height: 34px; display: grid; place-items: center; }
.result-strip-mark img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); }

/* RC6 post-game replay controls */
.replay-controls { display: grid; grid-template-columns: auto auto minmax(110px,1fr) auto auto; gap: 6px; align-items: center; margin-top: 15px; }
.replay-controls button { min-width: 38px; min-height: 38px; padding: 7px 9px; font-size: 14px; }
.replay-controls span { text-align: center; color: var(--text-soft); font-size: 14px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 460px) { .replay-controls { grid-template-columns: auto auto 1fr auto auto; gap: 4px; } .replay-controls button { min-width: 34px; padding: 6px; } }

/* Public product settings — all user-customizable presentation is tokenized here. */
body { font-size: calc(15px * var(--ui-scale, 1)); }
button, input, select, textarea { font: inherit; }
select, .auth-card input, .setting-control input:not([type="checkbox"]):not([type="range"]), .setting-control select {
  width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--bg-2); color: var(--text); padding: 9px 11px;
}
select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.auth-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.auth-card, .history-card, .recovery-notice { padding: 24px; }
.auth-card form { display: grid; gap: 12px; }
.auth-card label, .setting-control label { display: grid; gap: 6px; color: var(--muted); font-size: .94em; }
.auth-card label span, .setting-control label span { color: var(--text-soft); }
.auth-card input { margin: 0; }
.form-help { color: var(--muted-2); font-size: .88em; line-height: 1.5; }
.interactive-settings .setting-control { padding: 22px; display: grid; align-content: start; gap: 14px; min-height: 150px; }
.setting-control small { color: var(--muted-2); line-height: 1.45; }
.switch-row { display: flex !important; align-items: center; justify-content: space-between; gap: 14px; }
.switch-row input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--gold); flex: 0 0 auto; }
.setting-control input[type="range"] { width: 100%; accent-color: var(--gold); }
.settings-actions { grid-column: 1/-1; display: flex; justify-content: flex-end; gap: 10px; }
.settings-actions button { padding: 10px 16px; }
.setup-row.three-fields { grid-template-columns: repeat(3,1fr); }
.quick-match-card { margin-top: 14px; padding: 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.quick-match-card p { margin: 4px 0 0; color: var(--muted); }
.ranking-toolbar { display: flex; justify-content: flex-end; gap: 8px; margin: 0 0 12px; }
.ranking-toolbar select { width: min(240px,100%); }
.empty-state { padding: 24px; color: var(--muted); text-align: center; }
.error-state { color: #e3adad; }
.profile-error { max-width: 760px; }
.history-card { margin-top: 16px; }
.history-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 16px; padding: 15px 0; border-top: 1px solid var(--line); }
.history-row:first-child { border-top: 0; }
.history-row b { font-weight: 650; }
.history-row b span { color: var(--gold-bright); padding: 0 7px; }
.history-row small { display: block; color: var(--muted-2); margin-top: 5px; }
.history-ratings { display: grid; gap: 3px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.recovery-notice { margin-top: 16px; border-color: rgba(193,164,116,.36); }
.recovery-notice code { display: block; overflow-wrap: anywhere; margin: 12px 0; padding: 12px; border: 1px dashed var(--line-strong); border-radius: 8px; background: var(--bg-2); color: var(--gold-bright); user-select: all; }

/* The board palette is controlled by a single data attribute; engine state is unaffected. */
html[data-board-style="walnut"] { --board-light: #d5b07c; --board-light-2: #c69962; --board-dark: #6e432b; --board-dark-2: #4e2f20; }
html[data-board-style="contrast"] { --board-light: #f7f4e8; --board-light-2: #e9e4d3; --board-dark: #3c4b58; --board-dark-2: #27343f; }
html[data-coordinates="hide"] .coord { display: none !important; }
html[data-motion="none"] *, html[data-motion="none"] *::before, html[data-motion="none"] *::after {
  scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important;
}
html[data-motion="reduced"] *, html[data-motion="reduced"] *::before, html[data-motion="reduced"] *::after {
  transition-duration: .08s !important; animation-duration: .08s !important;
}

/* Light appearance deliberately reuses the same semantic tokens. */
html[data-theme-preference="light"] {
  color-scheme: light; --bg: #f2eee7; --bg-2: #e9e3d9; --panel: #fffdf9; --panel-2: #f4eee5;
  --panel-soft: rgba(255,253,249,.94); --text: #201b17; --text-soft: #443a32; --muted: #675d54; --muted-2: #7c7167;
  --gold: #8b693b; --gold-bright: #725127; --gold-soft: rgba(139,105,59,.10); --line: rgba(62,47,35,.17); --line-strong: rgba(95,68,40,.34);
  --focus: #7b5425; --shadow-lg: 0 28px 80px rgba(71,52,34,.15);
}
html[data-theme-preference="light"] body { background: radial-gradient(circle at 17% -8%,rgba(155,173,178,.22),transparent 38rem),radial-gradient(circle at 89% 7%,rgba(183,148,90,.13),transparent 35rem),linear-gradient(145deg,#f8f5ef 0%,#eee8df 50%,#f4efe8 100%); }
html[data-theme-preference="light"] .portal-topbar { background: rgba(248,245,239,.92); }
html[data-theme-preference="light"] .competition-card,
html[data-theme-preference="light"] .tournament-card { background: linear-gradient(145deg,rgba(255,253,249,.98),rgba(241,235,226,.98)); box-shadow: 0 22px 60px rgba(79,58,37,.12); }
html[data-theme-preference="light"] .mode-switch,
html[data-theme-preference="light"] .custom-time-fields,
html[data-theme-preference="light"] .custom-time-fields input,
html[data-theme-preference="light"] .setup-row input,
html[data-theme-preference="light"] .single-field input,
html[data-theme-preference="light"] .account-card input,
html[data-theme-preference="light"] .chat-compose input { background: var(--bg-2); color: var(--text); }
html[data-theme-preference="light"] .subtle-action,
html[data-theme-preference="light"] .ghost-btn,
html[data-theme-preference="light"] .controls button,
html[data-theme-preference="light"] .analysis-actions button,
html[data-theme-preference="light"] .draw-offer button,
html[data-theme-preference="light"] .network-lobby button,
html[data-theme-preference="light"] .player-resign,
html[data-theme-preference="light"] .chat-compose button { color: var(--text-soft); background: rgba(255,255,255,.42); }

@media (prefers-color-scheme: light) {
  html[data-theme-preference="system"] {
    color-scheme: light; --bg: #f2eee7; --bg-2: #e9e3d9; --panel: #fffdf9; --panel-2: #f4eee5;
    --panel-soft: rgba(255,253,249,.94); --text: #201b17; --text-soft: #443a32; --muted: #675d54; --muted-2: #7c7167;
    --gold: #8b693b; --gold-bright: #725127; --gold-soft: rgba(139,105,59,.10); --line: rgba(62,47,35,.17); --line-strong: rgba(95,68,40,.34); --focus: #7b5425;
  }
  html[data-theme-preference="system"] body { background: linear-gradient(145deg,#f8f5ef,#eee8df 52%,#f4efe8); }
  html[data-theme-preference="system"] .portal-topbar { background: rgba(248,245,239,.92); }
  html[data-theme-preference="system"] .competition-card, html[data-theme-preference="system"] .tournament-card { background: linear-gradient(145deg,rgba(255,253,249,.98),rgba(241,235,226,.98)); }
}

@media (max-width: 900px) { .auth-grid { grid-template-columns: 1fr; } .setup-row.three-fields { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .quick-match-card, .settings-actions { flex-direction: column; align-items: stretch; } .history-row { grid-template-columns: 1fr; } .history-ratings { text-align: left; } }
.blocked-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.blocked-row:first-child { border-top: 0; }
.blocked-row span { min-width: 0; }
.blocked-row b { display: block; overflow: hidden; text-overflow: ellipsis; }
.blocked-row small { display: block; color: var(--muted-2); margin-top: 3px; }
.blocked-row button { padding: 8px 11px; flex: 0 0 auto; }
.safety-tools { margin: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--gold-soft); }
.safety-tools label { display: grid; gap: 6px; color: var(--muted); font-size: .9em; }
.safety-tools select { width: 100%; }
.safety-tools > div { display: grid; grid-template-columns: 1fr; gap: 7px; margin-top: 9px; }
.safety-tools button { min-height: 38px; }
.danger-zone { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(201,123,123,.28); }
.danger-zone summary { cursor: pointer; color: var(--danger); font-weight: 700; }
.danger-zone form { display: grid; gap: 8px; margin-top: 12px; }
.danger-zone .danger-action { min-height: 42px; border: 1px solid rgba(201,123,123,.55); border-radius: 9px; background: var(--danger-bg); color: var(--danger); cursor: pointer; }
.danger-zone p { color: var(--muted-2); }
.portal-footer nav { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.portal-footer a { color: var(--text-soft); text-decoration: none; letter-spacing: .04em; }
.portal-footer a:hover, .portal-footer a:focus-visible { color: var(--gold-bright); text-decoration: underline; }
.legal-page { width: min(860px,calc(100% - 32px)); margin: 0 auto; padding: 48px 0 72px; }
.legal-page h1 { font: 400 clamp(42px,7vw,68px)/1 Georgia,serif; margin: 18px 0 32px; }
.legal-page h2 { font: 400 27px/1.2 Georgia,serif; color: var(--text); }
.legal-page section { padding: 22px 0; border-top: 1px solid var(--line); }
.legal-page p { color: var(--muted); line-height: 1.7; }
.legal-back { display: inline-flex; align-items: center; padding: 8px 12px; text-decoration: none; }
