:root {
  color-scheme: dark;
  --bg: #0d1220;
  --panel: #151d30;
  --line: #2b3850;
  --text: #f3f5fc;
  --muted: #aab8d2;
  --gold: #f5cd79;
  --mint: #91efd0;
  --danger: #ff947e;
  --primary-bg: #f5cd79;
  --primary-hover: #ffdf97;
  --page-glow: #171f33;
  --table-glow: #314778;
  --table-middle: #1c2a48;
  --table-edge: #18243e;
  --table-line: #4b5e81;
  --table-rule: #a0b6df49;
  --table-text-subtle: #c4d2ec;
  --play-label-bg: #111d35;
  --draw-bg: #1d2b46;
  --draw-hover: #283a57;
  --draw-line: #5b6b88;
  --draw-count-bg: #141d32;
  --draw-count-ink: #f5e5bb;
  --deck-ink: #f5cd79;
  --deck-border: #bda06a;
  --deck-base: #2a3558;
  --deck-shine: #435479;
  --deck-pattern: #e8f1ff16;
  font-family: "Segoe UI", system-ui, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #fff;
  --line: #c8d3e2;
  --text: #192742;
  --muted: #435571;
  --gold: #79500e;
  --mint: #005b57;
  --primary-bg: #f5cd79;
  --primary-hover: #ffdf97;
  --page-glow: #e8effa;
  --table-glow: #e4edf9;
  --table-middle: #cedbef;
  --table-edge: #c0d0e7;
  --table-line: #91a6c4;
  --table-rule: #758ca83d;
  --table-text-subtle: #364d70;
  --play-label-bg: #edf4ff;
  --draw-bg: #f7faff;
  --draw-hover: #eaf2fe;
  --draw-line: #a6b8d2;
  --draw-count-bg: #e3ecf9;
  --draw-count-ink: #203d65;
  --deck-ink: #234a7a;
  --deck-border: #7291b5;
  --deck-base: #dae7f8;
  --deck-shine: #f1f6ff;
  --deck-pattern: #5077aa25;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--text); background: radial-gradient(ellipse at 50% 0%, var(--page-glow), var(--bg) 42rem); }
.screen-reader-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
:where(button, a, input):focus-visible { outline: 2px solid var(--mint); outline-offset: 4px; }

.shell { width: min(100% - 48px, 980px); min-height: 100svh; margin-inline: auto; }
.site-header { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.brand-word { font-size: 1.12rem; font-weight: 900; font-style: italic; letter-spacing: .095em; }
.brand-mark { display: grid; place-items: center; position: relative; isolation: isolate; flex: 0 0 38px; width: 38px; height: 38px; }
.brand-mark::before, .brand-face { width: 22px; height: 30px; border-radius: 5px; }
.brand-mark::before { content: ''; position: absolute; z-index: -1; transform: translateX(-6px) rotate(-17deg); border: 1px solid #bd9556; background: #304161; }
.brand-face { display: grid; place-items: center; transform: translateX(4px) rotate(12deg); border: 1px solid #d39e50; background: linear-gradient(155deg, #fff1bd, #f1bc61); color: #23324f; box-shadow: 0 3px 6px #10192b48; }
.stress-bolt { display: block; width: 48%; height: 62%; background: currentColor; clip-path: polygon(53% 0, 98% 0, 72% 38%, 98% 38%, 28% 100%, 41% 58%, 4% 58%); }
.header-actions { display: flex; align-items: center; gap: 6px; }
.flag-art { position: absolute; width: 0; height: 0; overflow: hidden; }
.language-picker { position: relative; }
.language-picker summary { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 54px; min-height: 44px; padding: 5px 7px; border: 1px solid var(--draw-line); border-radius: 8px; background: var(--draw-bg); color: var(--text); cursor: pointer; list-style: none; }
.language-picker summary::-webkit-details-marker { display: none; }
.language-picker summary::after { content: ''; width: 6px; height: 6px; margin-top: -3px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg); }
.language-picker summary:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
.language-flag { display: block; flex: 0 0 24px; width: 24px; height: 16px; border-radius: 2px; box-shadow: 0 0 0 1px #8f9db45c; }
.language-options { position: absolute; z-index: 4; top: calc(100% + 6px); left: 0; display: grid; gap: 2px; min-width: max-content; padding: 4px; border: 1px solid var(--draw-line); border-radius: 10px; background: var(--panel); box-shadow: 0 8px 18px #131c3336; }
.language-options button { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 6px 9px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text); font-size: .86rem; text-align: left; }
.language-options button:hover, .language-options button[aria-pressed="true"] { border-color: var(--draw-line); background: var(--draw-hover); }
.quiet { display: inline-flex; justify-content: center; align-items: center; gap: 7px; padding: 6px 12px; min-height: 44px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: .87rem; font-weight: 650; }
.quiet:hover { background: #ffffff10; color: var(--text); }
.question { display: grid; place-items: center; width: 17px; height: 17px; border: 1px solid; border-radius: 50%; font-size: .72rem; }
.settings-icon { font: 1.13rem/1 "Segoe UI Symbol", sans-serif; }
.theme-switch { position: relative; display: grid; align-items: center; width: 54px; min-height: 44px; cursor: pointer; }
.theme-switch input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.theme-track { position: relative; display: grid; grid-template-columns: repeat(2, 1fr); align-items: center; height: 29px; padding: 2px; border: 1px solid var(--draw-line); border-radius: 18px; background: var(--draw-bg); color: var(--muted); font: 1rem/1 "Segoe UI Symbol", sans-serif; text-align: center; }
.theme-track::before { content: ''; position: absolute; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--primary-bg); transition: transform 160ms ease; }
.theme-track span { position: relative; }
.theme-switch input:not(:checked) + .theme-track span:first-child, .theme-switch input:checked + .theme-track span:last-child { color: #273149; }
.theme-switch input:checked + .theme-track::before { transform: translateX(24px); }
.theme-switch input:focus-visible + .theme-track { outline: 2px solid var(--mint); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .theme-track::before { transition: none; } }
main { padding-bottom: max(24px, env(safe-area-inset-bottom)); }

.hero { position: relative; isolation: isolate; overflow: hidden; display: grid; grid-template-columns: 1fr 1fr; min-height: 345px; align-items: center; padding-inline: clamp(24px, 5vw, 63px); margin-block: 22px 16px; border: 1px solid #384765; border-radius: 22px; background: radial-gradient(ellipse at 74% 40%, #344671, #1d2b48 44%, #161f33 77%); }
.hero::before { content: ''; position: absolute; z-index: -1; inset: -20% -6% -39% 45%; background: repeating-radial-gradient(ellipse at 60% 48%, transparent 0 29px, #94add522 30px 31px); transform: rotate(-22deg); mask-image: radial-gradient(ellipse, #000 21%, transparent 74%); }
.hero-copy { z-index: 1; padding-block: 24px; }
.eyebrow { color: var(--gold); font-size: .78rem; font-weight: 750; letter-spacing: .18em; margin: 0; }
.hero h1 { font-family: Georgia, serif; font-weight: 700; font-size: clamp(5.2rem, 11vw, 8.6rem); letter-spacing: -.075em; line-height: .99; margin: 3px 0 13px -.055em; }
.hero h1 span { color: var(--gold); }
.hero-description { color: #d3ddf2; font-size: 1.05rem; line-height: 1.55; max-width: 290px; margin: 0; }
.hero-art { position: relative; height: clamp(265px, 35vw, 320px); width: 100%; }
.intro-card { position: absolute; top: 16%; left: 35%; width: 36%; max-width: 150px; transform: rotate(-8deg); box-shadow: 0 13px 15px #10162ba0; }
.intro-back { left: 15%; top: 18%; transform: rotate(-27deg); }
.intro-heart { left: 55%; top: 14%; transform: rotate(16deg); }
.intro-card .card-rank { font-size: 56cqw; }
.intro-card .card-pip { font-size: 94cqw; }

.modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.mode { padding: clamp(15px, 3vw, 25px); border: 1px solid var(--line); border-radius: 14px; background: var(--panel); display: flex; flex-direction: column; gap: 13px; }
.online-mode { border-color: #726144; background: linear-gradient(145deg, #24273a, var(--panel) 64%); }
.mode-heading { display: flex; align-items: flex-start; gap: 12px; }
.mode h2 { margin: 0 0 4px; font-size: 1.24rem; letter-spacing: -.024em; }
.mode p, .lobby p { margin: 0; color: var(--muted); line-height: 1.48; }
.mode-icon { flex: 0 0 auto; display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid #526280; border-radius: 10px; background: #253350; color: #cfddf6; }
.online-mode .mode-icon, .lobby-card .mode-icon { color: var(--gold); background: #f5cd7915; border-color: #ae8c545c; }
.bot-icon i { position: relative; width: 22px; height: 16px; border: 1.5px solid currentColor; border-radius: 4px; }
.bot-icon i::before { content: ''; position: absolute; width: 3px; height: 3px; background: currentColor; left: 4px; top: 5px; box-shadow: 8px 0 currentColor; }
.bot-icon i::after { content: ''; position: absolute; width: 1.5px; height: 5px; background: currentColor; left: 9px; top: -5px; }
.link-icon i { position: relative; width: 25px; height: 15px; transform: rotate(-39deg); }
.link-icon i::before, .link-icon i::after { content: ''; position: absolute; top: 2px; width: 15px; height: 10px; border-radius: 6px; border: 1.5px solid currentColor; }
.link-icon i::before { left: 0; }
.link-icon i::after { right: 0; }
.levels { margin: 0; min-width: 0; padding: 3px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); }
.levels label { position: relative; cursor: pointer; }
.levels input { position: absolute; opacity: 0; pointer-events: none; }
.levels label span { display: grid; place-items: center; min-height: 40px; padding: 4px; border-radius: 6px; color: var(--muted); font-weight: 650; font-size: .9rem; }
.levels input:checked + span { background: #31415f; color: var(--text); }
.levels input:focus-visible + span { outline: 2px solid var(--mint); }
.button { min-height: 46px; padding: 8px 14px; border-radius: 9px; border: 1px solid transparent; font-weight: 750; display: inline-flex; justify-content: center; align-items: center; gap: 6px; text-align: center; }
.mode .button { margin-top: auto; width: 100%; }
.primary { color: #20192a; background: var(--primary-bg); }
.primary:hover:not(:disabled) { background: var(--primary-hover); }
.secondary { color: var(--text); background: #27344e; border-color: #495c7d; }
.secondary:hover:not(:disabled) { background: #354867; }
.button:disabled { opacity: .63; }
.error { margin: 8px 0 0; color: #ffbbab; }
.error:empty { display: none; }

.lobby { min-height: 65svh; display: grid; place-items: center; padding-top: 20px; }
.lobby-card { text-align: center; width: min(100%, 500px); padding: clamp(20px, 6vw, 37px); border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.lobby-card .mode-icon { margin: auto; }
.lobby h1 { font-size: clamp(1.7rem, 4vw, 2.45rem); letter-spacing: -.042em; margin: 15px 0 7px; }
.lobby .button { margin-top: 12px; width: 100%; }
.lobby input { margin-top: 20px; width: 100%; padding: 10px; min-height: 46px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); text-overflow: ellipsis; }
.lobby p.error { margin-top: 8px; color: #ffbbab; }
.text-link { display: inline-flex; min-height: 44px; align-items: center; margin-top: 8px; color: var(--muted); text-underline-offset: 4px; }
.profile-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 11px; margin-bottom: 14px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.profile-bar label, .lobby-profile label { color: var(--text); font-weight: 650; font-size: .9rem; }
.profile-bar label span, .lobby-profile label span { color: var(--muted); font-weight: 400; }
.profile-bar input, .lobby .lobby-profile input { width: 100%; min-width: 0; min-height: 42px; margin: 0; padding: 7px 10px; border: 1px solid #435170; border-radius: 8px; color: var(--text); background: var(--bg); }
.profile-bar .quiet { border-color: #435170; }
.lobby-profile { display: grid; gap: 7px; margin-top: 16px; text-align: left; }

.match-bar { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin: 5px 0; }
.match-bar .quiet, .mode-label { white-space: nowrap; }
.mode-label { padding-inline: 8px; color: var(--table-text-subtle); font-weight: 700; font-size: .88rem; }
.table {
  position: relative;
  display: grid;
  grid-template-areas: "rival" "center" "own";
  justify-items: center;
  align-items: center;
  overflow: clip;
  gap: 9px;
  padding: clamp(10px, 2vw, 23px);
  border: 1px solid var(--table-line);
  border-radius: 19px;
  background: radial-gradient(ellipse at 50% 45%, var(--table-glow), var(--table-middle) 69%, var(--table-edge));
  box-shadow: 0 14px 40px #06091157, inset 0 0 0 4px #a5baff0d;
}
.player-panel { width: min(100%, 430px); min-width: 0; }
.rival-panel { grid-area: rival; }
.own-panel { grid-area: own; }
.player-info { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 7px; }
.player-info strong { font-size: .97rem; }
.player-info span { font-size: .83rem; color: var(--table-text-subtle); text-align: right; font-variant-numeric: tabular-nums; }
.hand-notice {
  margin: 0 0 7px;
  padding: 4px 8px;
  border-left: 2px solid var(--gold);
  border-radius: 4px;
  background: var(--play-label-bg);
  color: var(--gold);
  font-size: .77rem;
  font-weight: 700;
  line-height: 1.26;
}
.card-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(6px, 2vw, 11px); }
.rival-panel .card-row { width: min(100%, 285px); margin-inline: auto; }

.playing-card {
  --card-ink: #1b2949;
  --card-pip: #2d477831;
  --paper: #e6ecfa;
  container-type: inline-size;
  display: grid;
  isolation: isolate;
  place-items: center;
  aspect-ratio: 5 / 7;
  border: 1px solid #ffffffeb;
  border-radius: clamp(8px, 2vw, 13px);
  background: linear-gradient(143deg, #fffdfa 29%, var(--paper));
  color: var(--card-ink);
  padding: 0;
  user-select: none;
}
.playing-card.red { --card-ink: #a0293e; --card-pip: #ab314930; --paper: #f6e5e9; }
.playing-card.club { --card-ink: #1f4858; --card-pip: #2152643b; --paper: #e4eff0; }
.playing-card.diamond { --card-ink: #993e2e; --card-pip: #ac502f38; --paper: #f6e8df; }
.playing-card:not(.empty, .back, .intro-back)::before { content: ''; position: absolute; inset: 3px; z-index: -1; border-radius: inherit; border: 1px solid var(--card-pip); pointer-events: none; }
.card-index { position: absolute; top: 10%; left: 10%; display: grid; justify-items: start; gap: 1px; }
.card-rank { display: block; font: 800 clamp(1.28rem, 57cqw, 4.4rem)/.87 "Segoe UI", system-ui, sans-serif; font-variant-numeric: lining-nums tabular-nums; letter-spacing: -.07em; }
.card-suit { margin-inline-start: .065em; font: 700 clamp(.85rem, 24cqw, 1.9rem)/1 Georgia, serif; }
.card-pip { position: absolute; inset: auto 8% 7% auto; z-index: -1; color: var(--card-pip); font: 400 min(89cqw, 7rem)/.8 Georgia, serif; pointer-events: none; }
.table-card { position: relative; width: 100%; box-shadow: 0 3px 7px #080f247d; }
.rival-panel .card-index { top: 10%; }
.rival-panel .card-rank { font-size: clamp(1.1rem, 51cqw, 2.25rem); }
.rival-panel .card-suit { font-size: clamp(.74rem, 21cqw, 1rem); }
.rival-panel .card-pip { font-size: 72cqw; }
.table-card.empty { color: #c2d6f7; background: #141e376b; border: 1px dashed #7b94c284; box-shadow: none; }
.playing-card.back, .intro-back { background: repeating-linear-gradient(45deg, #2c3661 0 4px, #394773 4px 5px), #2c3661; border: 1px solid #8295c3; }
.back-emblem { display: grid; place-items: center; width: 46%; aspect-ratio: 1; border: 1px solid #bda06a; border-radius: 15%; color: #f5cd79; background: #242d52; rotate: 45deg; }
.back-emblem .stress-bolt, .draw-back .stress-bolt { rotate: -45deg; }
.table-card.stacked { box-shadow: 0 2px #cbd6ef, 0 4px #8792af, 0 6px 6px #10183184; }
.table-card.selected { translate: 0 -3px; box-shadow: 0 5px 10px #080f24a0; }
.table-card.over { box-shadow: 0 5px 12px #080f24a0; }
.table-card:focus-visible { outline-color: var(--text); }
.table-card.source { opacity: .45; }
.table-card.drag-ghost { position: fixed; top: 0; left: 0; z-index: 4; pointer-events: none; box-shadow: 0 12px 26px #050912bc; }
#match:not([data-controls="tap"]) #own-cards button:enabled { touch-action: none; cursor: grab; }
.stack-count { position: absolute; bottom: 5px; right: 5px; min-width: 17px; padding: 2px 3px; border-radius: 4px; background: #253451; color: #f5f7fc; text-align: center; font: 700 .66rem/1 system-ui, sans-serif; }

.center { position: relative; grid-area: center; display: grid; justify-items: center; width: 100%; padding-block: 6px 8px; border-block: 1px solid var(--table-rule); }
.piles { display: grid; width: min(92%, 310px); grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(29px, 11vw, 54px); }
.pile-stack { --depth: 0; --lean: 1; --stack-side: 1.25px; --stack-angle: 1deg; position: relative; isolation: isolate; min-width: 0; }
.pile-stack:nth-child(2) { --lean: -1; }
#own-cards .pile-stack { --stack-side: .75px; --stack-angle: .65deg; }
#own-cards .pile-stack:nth-child(even) { --lean: -1; }
.pile-depth-1 { --depth: 1; }
.pile-depth-2 { --depth: 2; }
.pile-depth-3 { --depth: 3; }
.pile-depth-4 { --depth: 4; }
.pile-depth-5 { --depth: 5; }
.pile-stack::before, .pile-stack::after { position: absolute; inset: 1px; border: 1px solid #fff9ec; border-radius: clamp(8px, 2vw, 13px); background: linear-gradient(145deg, #fefbf3, #ded7c9); pointer-events: none; }
.pile-stack:not(.pile-depth-0)::before {
  content: '';
  z-index: -2;
  transform: translate(calc(var(--lean) * var(--depth) * var(--stack-side)), calc(2px + var(--depth) * 1.4px)) rotate(calc(var(--lean) * (1deg + var(--depth) * var(--stack-angle))));
  box-shadow: 0 calc(var(--depth) * .5px) #b0a896, 0 calc(var(--depth) * 1px) #e3dac8, 0 calc(2px + var(--depth) * 1px) 5px #080f247d;
}
.pile-stack:is(.pile-depth-2, .pile-depth-3, .pile-depth-4, .pile-depth-5)::after {
  content: '';
  z-index: -1;
  transform: translate(calc(var(--lean) * var(--depth) * -.5px), calc(1px + var(--depth) * .8px)) rotate(calc(var(--lean) * var(--depth) * -.7deg));
}
.play-band { display: grid; place-items: end center; min-height: 31px; width: 100%; margin-bottom: 5px; }
.last-play {
  max-width: 100%;
  padding: 2px 8px 3px;
  border-radius: 20px;
  background: var(--play-label-bg);
  color: var(--text);
  font-size: .74rem;
  font-weight: 720;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stress-button { position: relative; overflow: hidden; min-width: 146px; min-height: 44px; padding: 5px 15px; border: 1px solid #597198; border-radius: 8px; background: #182440; color: #e7eefb; font-weight: 900; letter-spacing: .12em; }
.stress-button:enabled:not([data-confirmed]) { border-color: #9cacc9; }
.stress-button[data-confirmed] { background: var(--danger); color: #2e151b; border-color: #ffd4c8; box-shadow: 0 0 20px #ff947e65; }
.stress-button[data-cooling]::after {
  content: '';
  position: absolute;
  inset: auto 5px 4px;
  height: 3px;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 0 0 1px #38262268;
  transform-origin: left center;
  animation: stress-cooldown var(--cooldown-duration, 1500ms) linear both;
}
@keyframes stress-cooldown { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) {
  .stress-button[data-cooling]::after { animation: none; }
}
.game-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.game-actions .button { font-size: .87rem; }
.draw-button { gap: 10px; padding: 3px 9px 10px 8px; background: var(--draw-bg); color: var(--text); border-color: var(--draw-line); }
.draw-button:hover:not(:disabled) { background: var(--draw-hover); border-color: var(--gold); }
.draw-button:disabled .draw-label { color: var(--muted); }
.draw-deck {
  display: grid;
  place-items: center;
  position: relative;
  width: 42px;
  aspect-ratio: 5 / 7;
  flex: 0 0 auto;
  isolation: isolate;
  border: 1px solid var(--deck-border);
  border-radius: 6px;
  background: repeating-linear-gradient(45deg, transparent 0 3px, var(--deck-pattern) 3px 4px), linear-gradient(150deg, var(--deck-shine), var(--deck-base));
  box-shadow: 2px 2px #f4ead6, 3px 4px #8f887e, 4px 5px #ded2bd, 5px 7px #7f7b76, 6px 8px 7px #0a112355;
  rotate: -6deg;
  translate: 0 -2px;
}
.draw-deck::before { content: ''; position: absolute; inset: 3px; z-index: -1; border: 1px solid var(--deck-border); border-radius: 3px; }
.draw-back { display: grid; place-items: center; width: 48%; aspect-ratio: 1; border: 1px solid var(--deck-border); border-radius: 15%; color: var(--deck-ink); background: var(--deck-base); rotate: 45deg; }
.draw-button[data-empty] .draw-deck { background: transparent; border-style: dashed; box-shadow: none; }
.draw-button[data-empty] .draw-deck::before { content: none; }
.draw-button[data-empty] .draw-back { visibility: hidden; }
.draw-count { min-width: 26px; padding: 4px 5px; border-radius: 5px; background: var(--draw-count-bg); color: var(--draw-count-ink); font: 750 .78rem/1.1 system-ui, sans-serif; text-align: center; font-variant-numeric: tabular-nums; }
.game-announcement { position: absolute; inset: 0 0 60px; z-index: 1; display: grid; place-items: center; padding: 8px; pointer-events: none; }
.announcement-card {
  display: grid;
  gap: 4px;
  width: min(100%, 350px);
  padding: 14px 12px;
  border: 1px solid var(--table-line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  text-align: center;
  box-shadow: 0 5px 28px #08122575;
}
.announcement-card strong { font-size: clamp(1.25rem, 5.3vw, 2rem); letter-spacing: -.025em; overflow-wrap: anywhere; }
.announcement-card span { font-size: .86rem; color: var(--muted); line-height: 1.3; }
.announcement-card span:empty { display: none; }
.game-announcement[data-kind="stress"] .announcement-card { border: 2px solid #c9755a; box-shadow: 0 5px 28px #08122575, 0 0 0 4px #ff947e45; }
.game-announcement[data-kind="move"] { inset: 0 0 auto; padding: 4px; }
.game-announcement[data-kind="move"] .announcement-card { padding: 6px; }
.game-announcement[data-kind="move"] .announcement-card strong { font-size: .96rem; }
.result { position: absolute; inset: 0; z-index: 2; background: #0a1123df; display: grid; place-items: safe center; overflow: auto; border-radius: inherit; padding: 12px; }
.result-card { width: min(100%, 330px); text-align: center; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); padding: 20px; }
.result-card > span { color: var(--gold); font-size: 2rem; }
.result-card h2 { margin: 3px 0; font-size: 1.9rem; }
.result-card p { color: var(--muted); line-height: 1.4; }
.result-card .button { width: 100%; margin-top: 5px; }
.result-series { padding: 9px 0; margin-bottom: 5px; border-block: 1px solid var(--line); }
.result-series h3 { margin: 0 0 8px; font-size: .92rem; overflow-wrap: anywhere; }
.result-series p { margin: 7px 0 0; font-size: .85rem; }
.scoreline { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; margin: 0; }
.scoreline dt { color: var(--muted); font-size: .76rem; }
.scoreline dd { color: var(--gold); font-weight: 750; margin: 3px 0 0; font-variant-numeric: tabular-nums; }
#statistics h3 { margin: 16px 0 7px; font-size: 1rem; }
#stats-feedback { color: var(--muted); }
#stats-feedback:empty { display: none; }
#statistics table { width: 100%; border-collapse: collapse; font-size: .84rem; }
#statistics thead { color: var(--muted); }
#statistics :is(th, td) { padding: 8px 4px; text-align: center; border-bottom: 1px solid var(--line); }
#statistics :is(th, td):first-child { text-align: left; overflow-wrap: anywhere; }

dialog { width: min(calc(100% - 24px), 580px); max-height: 88svh; overflow: auto; border: 1px solid #4c5f81; border-radius: 15px; padding: clamp(16px, 4vw, 29px); background: var(--panel); color: var(--text); }
dialog::backdrop { background: #080d1ac9; }
.dialog-header { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.dialog-header h2 { margin: 0; }
.close-dialog { font-size: 1.4rem; }
#controls { max-width: 420px; }
.input-options { display: grid; gap: 8px; padding: 0; margin: 15px 0 0; min-width: 0; border: 0; }
.input-options legend { margin-bottom: 11px; color: var(--muted); }
.input-options label { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.input-options label:has(input:checked) { background: #2a3c56; border-color: #8db4c4; }
.input-options input { flex-shrink: 0; width: 17px; height: 17px; accent-color: var(--mint); margin: 0; }
.input-options small { display: block; margin-top: 3px; color: var(--muted); font-size: .86rem; }
dialog ol { padding-left: 1.5em; margin: 14px 0 0; }
dialog li { margin-bottom: 10px; line-height: 1.48; padding-left: 4px; }
dialog li::marker { color: var(--gold); font-weight: 750; }

[data-theme="light"] .quiet:hover { background: #dbe5f5; }
[data-theme="light"] .hero { border-color: #a7b9d1; background: radial-gradient(ellipse at 74% 40%, #bfcfea, #e1e9f8 55%, #f7f9fd 84%); }
[data-theme="light"] .hero::before { background: repeating-radial-gradient(ellipse at 60% 48%, transparent 0 29px, #4a679140 30px 31px); }
[data-theme="light"] .hero-description { color: var(--muted); }
[data-theme="light"] .online-mode { border-color: #ceb887; background: linear-gradient(145deg, #fcf3dc, var(--panel) 64%); }
[data-theme="light"] .mode-icon { border-color: #a2b3ce; background: #e6edf9; color: #335783; }
[data-theme="light"] :is(.online-mode, .lobby-card) .mode-icon { color: var(--gold); background: #fff1cd; border-color: #c9a868; }
[data-theme="light"] .levels input:checked + span { background: #d8e5f7; }
[data-theme="light"] .secondary { background: #e7eefb; border-color: #a1b5d3; }
[data-theme="light"] .secondary:hover:not(:disabled) { background: #d5e4fa; }
[data-theme="light"] :is(.error, .lobby p.error) { color: #8b332c; }
[data-theme="light"] :is(.profile-bar input, .profile-bar .quiet, .lobby .lobby-profile input) { border-color: #a1b5d3; }
[data-theme="light"] .table { box-shadow: 0 12px 32px #40597c27, inset 0 0 0 4px #f4f8ff66; }
[data-theme="light"] .table-card.empty { color: #40587c; background: #eff5ff58; border-color: #6a85ad; }
[data-theme="light"] .result { background: #c2d4ebed; }
[data-theme="light"] dialog { border-color: #9fb3d0; }
[data-theme="light"] dialog::backdrop { background: #15284e75; }
[data-theme="light"] .input-options label:has(input:checked) { background: #e2eff1; border-color: #588f90; }

@media (min-width: 830px) {
  .table { grid-template-columns: 1fr minmax(220px, .87fr) 1fr; grid-template-areas: "rival center own"; min-height: 365px; gap: 16px; }
  .center { min-height: 270px; align-content: center; padding-block: 6px; border-block: 0; border-inline: 1px solid var(--table-rule); }
  .piles { width: 90%; gap: clamp(23px, 3.6vw, 43px); }
}

@media (max-width: 650px) {
  .shell { width: calc(100% - 24px); }
  .site-header { min-height: 58px; }
  .hero { border-radius: 15px; margin-block: 13px 11px; min-height: 0; padding-inline: clamp(14px, 5vw, 26px); grid-template-columns: 1fr .93fr; }
  .hero h1 { font-size: clamp(3.55rem, 11.6vw, 5.2rem); margin-block: 4px 8px; }
  .eyebrow { font-size: .64rem; letter-spacing: .12em; }
  .hero-description { font-size: .91rem; }
  .hero-art { min-width: 0; height: clamp(128px, 44vw, 240px); }
  .intro-card { width: 56%; left: 21%; top: 23%; }
  .intro-back { left: 5%; top: 24%; }
  .intro-heart { left: 40%; top: 21%; }
  .modes { grid-template-columns: 1fr; gap: 9px; }
  .mode h2 { font-size: 1.14rem; }
  .mode p { font-size: .92rem; }
  .table { border-radius: 13px; }
}

@media (max-width: 520px) {
  .header-actions { gap: 3px; }
  .header-actions .quiet { min-width: 44px; padding-inline: 8px; }
  .header-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

@media (max-width: 380px) {
  .site-header { gap: 3px; }
  .brand { gap: 3px; }
  .brand-word { font-size: .99rem; }
  .brand-mark { flex-basis: 33px; width: 33px; }
  .header-actions { gap: 2px; }
  .header-actions .quiet { min-width: 34px; padding-inline: 4px; }
  .language-picker summary { min-width: 47px; padding-inline: 5px; }
  .theme-switch { width: 48px; }
  .theme-track::before { width: 19px; height: 19px; }
  .theme-switch input:checked + .theme-track::before { transform: translateX(21px); }
  .hero-copy { padding-block: 17px; }
  .profile-bar { grid-template-columns: minmax(0, 1fr) auto; gap: 5px 8px; }
  .profile-bar label { grid-column: 1 / -1; }
}

@media (max-height: 735px) and (max-width: 650px) {
  .table { gap: 6px; padding-block: 9px; }
  .rival-panel .card-row { max-width: 176px; }
  .own-panel .card-row { max-width: 276px; margin-inline: auto; }
  .piles { max-width: 188px; }
}

@media (max-height: 620px) and (max-width: 650px) {
  .rival-panel .card-row { max-width: 154px; }
  .own-panel .card-row { max-width: 238px; }
  .piles { max-width: 164px; }
  .center { padding-block: 5px 7px; }
  .play-band { min-height: 28px; margin-bottom: 3px; }
  .draw-deck { width: 34px; }
  .game-actions { margin-top: 6px; }
}

@media (min-width: 660px) and (max-width: 829px) and (max-height: 520px) {
  .table { grid-template-columns: 1fr minmax(168px, .8fr) 1fr; grid-template-areas: "rival center own"; gap: 10px; }
  .piles { width: 96%; gap: 24px; }
}

@media (min-width: 660px) and (max-height: 520px) {
  .site-header { min-height: 52px; }
  .table { min-height: 235px; padding-block: 8px; }
  .center { min-height: 0; }
}
