:root {
  color-scheme: dark;
  --page-bg: #07131f;
  --page-bg-soft: #0f2740;
  --panel: rgba(10, 28, 46, 0.86);
  --panel-strong: #102a42;
  --line: rgba(184, 214, 232, 0.18);
  --text: #f3f8fb;
  --muted: #a9bfcd;
  --accent: #58d4ff;
  --accent-strong: #13aee5;
  --gold: #ffd27a;
  --felt: #116449;
  --felt-dark: #0b4738;
  --felt-light: #208464;
  --danger: #ff8d88;
  --success: #70e4aa;
  --card-w: clamp(70px, 7.45vw, 102px);
  --card-h: calc(var(--card-w) * 1.4);
  --column-gap: clamp(7px, 0.7vw, 12px);
  --radius-lg: 28px;
  --radius-md: 18px;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  height: 100vh;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: var(--text);
  background:
    radial-gradient(circle at 82% 5%, rgba(33, 105, 156, 0.3), transparent 30rem),
    radial-gradient(circle at 8% 28%, rgba(20, 118, 94, 0.14), transparent 28rem),
    linear-gradient(145deg, var(--page-bg-soft), var(--page-bg) 55%);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button,
input,
textarea,
select {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  color: #07131f;
  background: #fff;
  border-radius: 10px;
  font-weight: 700;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 19, 31, 0.75);
  backdrop-filter: blur(16px);
}

.site-header__inner,
.game-intro {
  width: min(1480px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header__inner {
  min-height: 70px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 1.03rem;
  font-weight: 760;
  letter-spacing: 0.01em;
}

.brand__mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: #082134;
  background: linear-gradient(145deg, #8ce6ff, #29b8eb);
  border-radius: 11px;
  box-shadow: 0 8px 20px rgba(19, 174, 229, 0.25);
  font-size: 1.25rem;
}

.site-nav a {
  padding: 9px 13px;
  color: var(--muted);
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 650;
  transition: color 160ms ease, background 160ms ease;
}

.site-nav {
  justify-self: end;
}

.header-title {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.05rem, 2vw, 1.4rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-align: center;
  white-space: nowrap;
}

.site-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

main {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.game-intro {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-block: clamp(14px, 2.6vh, 28px);
}

.eyebrow {
  margin: 0 0 8px;
  color: #74d8fa;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h2,
p {
  margin-top: 0;
}

.game-shell {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px rgba(0, 7, 15, 0.48);
}

.game-toolbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 16px clamp(14px, 2vw, 26px);
  background: linear-gradient(180deg, rgba(20, 52, 80, 0.96), rgba(12, 36, 58, 0.96));
  border-bottom: 1px solid var(--line);
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nickname-form {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.nickname-form label {
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 700;
}

.nickname-form input {
  width: 140px;
  min-width: 0;
  min-height: 41px;
  padding: 9px 10px;
  border: 1px solid rgba(204, 231, 246, 0.2);
  border-radius: 11px;
  color: var(--text);
  background: rgba(3, 18, 29, 0.34);
  font-size: 0.83rem;
}

.nickname-form input::placeholder {
  color: var(--muted);
}

.control-button {
  min-height: 41px;
  padding: 9px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.065);
  border: 1px solid rgba(204, 231, 246, 0.2);
  border-radius: 11px;
  font-size: 0.83rem;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 8, 18, 0.12);
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.control-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(204, 231, 246, 0.36);
  transform: translateY(-1px);
}

.control-button:active:not(:disabled) {
  transform: translateY(1px);
}

.control-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.control-button--primary {
  color: #062033;
  background: linear-gradient(145deg, #7de1ff, var(--accent-strong));
  border-color: rgba(153, 233, 255, 0.72);
  box-shadow: 0 10px 24px rgba(19, 174, 229, 0.22);
}

.control-button--primary:hover:not(:disabled) {
  color: #031621;
  background: linear-gradient(145deg, #a0ebff, #38c3f4);
}

.control-button--sound {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.sound-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #092237;
  background: var(--accent);
  font-size: 0.8rem;
}

.control-button--sound[aria-pressed="false"] .sound-icon {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.09);
}

.game-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(66px, auto));
  gap: 4px;
  margin: 0;
}

.game-stats > div {
  min-width: 70px;
  padding: 7px 10px;
  text-align: center;
  border-left: 1px solid var(--line);
}

.game-stats dt {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.game-stats dd {
  margin: 2px 0 0;
  color: #fff;
  font-size: 1.02rem;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
}

.game-message {
  flex: 0 0 auto;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  color: #d8edf6;
  background: rgba(2, 17, 27, 0.66);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  font-size: 0.83rem;
  transition: color 180ms ease, background 180ms ease;
}

.game-message[data-tone="error"] {
  color: #ffe0de;
  background: rgba(117, 35, 39, 0.58);
}

.game-message[data-tone="success"] {
  color: #d8ffeb;
  background: rgba(11, 88, 61, 0.62);
}

.board-viewport {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior-x: contain;
  scrollbar-color: rgba(133, 216, 196, 0.75) rgba(5, 43, 34, 0.55);
  scrollbar-width: thin;
  background: #0b4b39;
}

.board-viewport::-webkit-scrollbar {
  height: 10px;
}

.board-viewport::-webkit-scrollbar-track {
  background: rgba(5, 43, 34, 0.66);
}

.board-viewport::-webkit-scrollbar-thumb {
  background: rgba(133, 216, 196, 0.66);
  border: 2px solid rgba(5, 43, 34, 0.66);
  border-radius: 999px;
}

.game-board {
  position: relative;
  width: 100%;
  min-width: 900px;
  min-height: 100%;
  overflow: hidden;
  padding: clamp(17px, 2vw, 30px);
  isolation: isolate;
  background:
    radial-gradient(circle at 18% 8%, rgba(114, 224, 171, 0.13), transparent 22rem),
    radial-gradient(circle at 86% 78%, rgba(0, 30, 22, 0.22), transparent 30rem),
    repeating-linear-gradient(22deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 5px),
    linear-gradient(145deg, var(--felt-light), var(--felt) 42%, var(--felt-dark));
  box-shadow: inset 0 0 90px rgba(1, 25, 18, 0.44);
}

.game-board::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.1'/%3E%3C/svg%3E");
}

.board-top {
  min-height: calc(var(--card-h) + 14px);
  display: grid;
  grid-template-columns: minmax(132px, 1fr) auto;
  align-items: start;
  gap: 24px;
  margin-bottom: clamp(18px, 2.5vw, 34px);
}

.stock-zone {
  display: flex;
  align-items: center;
  gap: 17px;
}

.stock-pile {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  flex: 0 0 auto;
  padding: 0;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease;
}

.stock-pile:hover:not(:disabled) {
  transform: translateY(-3px) rotate(-0.4deg);
  filter: brightness(1.08);
}

.stock-pile.is-hint {
  animation: stock-hint 760ms ease-in-out 2;
}

.stock-pile:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.stock-pile.is-empty .card-back,
.stock-pile.is-empty .stock-shadow {
  opacity: 0;
}

.stock-pile.is-empty::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(219, 255, 240, 0.7);
  border: 2px dashed rgba(219, 255, 240, 0.36);
  border-radius: 9px;
  font-size: 1.5rem;
}

.stock-shadow,
.card-back {
  position: absolute;
  inset: 0;
  display: block;
  border: 1px solid rgba(240, 249, 255, 0.82);
  border-radius: 9px;
  box-shadow: 0 6px 14px rgba(0, 24, 17, 0.28);
  transition: opacity 180ms ease;
}

.stock-shadow {
  background: #dfeaf0;
}

.stock-shadow--one {
  transform: translate(4px, -4px);
}

.stock-shadow--two {
  transform: translate(8px, -8px);
}

.card-back {
  overflow: hidden;
  padding: 5px;
  background: #eef7fb;
}

.card-back__pattern,
.playing-card--down::after {
  display: block;
  width: 100%;
  height: 100%;
  border: 2px solid #72b8e2;
  border-radius: 5px;
  background:
    linear-gradient(45deg, transparent 43%, rgba(255, 255, 255, 0.55) 44% 48%, transparent 49%),
    linear-gradient(-45deg, transparent 43%, rgba(255, 255, 255, 0.38) 44% 48%, transparent 49%),
    radial-gradient(circle at center, #9bd9f4 0 10%, transparent 11%),
    repeating-conic-gradient(from 45deg, #1268a1 0 10deg, #2687bd 10deg 20deg);
  background-size: 18px 18px, 18px 18px, 36px 36px, 28px 28px;
  box-shadow: inset 0 0 0 2px rgba(2, 43, 80, 0.34);
}

.stock-caption {
  min-width: 70px;
  color: rgba(231, 255, 245, 0.82);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.foundations {
  display: grid;
  grid-template-columns: repeat(8, var(--card-w));
  gap: var(--column-gap);
}

.foundation-slot {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  display: grid;
  place-items: center;
  color: rgba(220, 255, 239, 0.42);
  border: 2px dashed rgba(218, 255, 238, 0.28);
  border-radius: 9px;
  box-shadow: inset 0 4px 15px rgba(0, 37, 25, 0.18);
}

.foundation-slot::before {
  content: attr(data-symbol);
  font-size: calc(var(--card-w) * 0.24);
}

.foundation-slot.is-filled {
  color: #101b23;
  background: #f8fbfd;
  border: 1px solid #dce8ee;
  box-shadow: 0 7px 18px rgba(0, 29, 21, 0.28);
}

.foundation-slot.is-filled::before {
  content: "K\A" attr(data-symbol);
  position: absolute;
  top: 7px;
  left: 8px;
  white-space: pre;
  font-size: calc(var(--card-w) * 0.17);
  line-height: 0.82;
  font-weight: 800;
}

.foundation-slot.is-filled::after {
  content: attr(data-symbol);
  font-size: calc(var(--card-w) * 0.42);
}

.foundation-slot.is-new {
  animation: foundation-pop 520ms cubic-bezier(0.2, 0.9, 0.24, 1.25);
}

.tableau {
  position: relative;
  min-height: 250px;
  display: grid;
  grid-template-columns: repeat(10, var(--card-w));
  justify-content: center;
  align-items: start;
  gap: var(--column-gap);
}

.tableau-column {
  position: relative;
  width: var(--card-w);
  min-height: 240px;
  border-radius: 10px;
  transition: background 140ms ease, box-shadow 140ms ease;
}

.tableau-column::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  width: var(--card-w);
  height: var(--card-h);
  border: 2px dashed rgba(218, 255, 238, 0.22);
  border-radius: 9px;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.tableau-column.is-valid-drop::before,
.tableau-column.is-hint-target::before {
  border-color: rgba(137, 255, 199, 0.94);
  background: rgba(103, 232, 172, 0.13);
  box-shadow: 0 0 0 4px rgba(76, 222, 154, 0.16), 0 0 28px rgba(76, 222, 154, 0.25);
}

.tableau-column.is-invalid-drop::before {
  border-color: rgba(255, 141, 136, 0.9);
  background: rgba(209, 56, 56, 0.13);
}

.playing-card {
  --face-gradient: linear-gradient(145deg, #254967, #102536);
  position: absolute;
  z-index: var(--card-index, 1);
  top: var(--card-top, 0px);
  left: 0;
  width: var(--card-w);
  height: var(--card-h);
  margin: 0;
  padding: 0;
  overflow: hidden;
  color: #0c1720;
  background: #fbfdfe;
  border: 1px solid #d7e1e7;
  border-radius: 9px;
  box-shadow: 0 5px 12px rgba(0, 33, 24, 0.26), 0 1px 2px rgba(0, 11, 8, 0.2);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transform-origin: center top;
  transition: transform 100ms ease;
}

.playing-card:active {
  cursor: grabbing;
}

.playing-card--down {
  padding: 5px;
  background: #eef7fb;
  cursor: default;
}

.playing-card--down::after {
  content: "";
}

.playing-card--up:hover {
  filter: brightness(1.025);
  box-shadow: 0 7px 17px rgba(0, 26, 18, 0.35), 0 0 0 2px rgba(123, 225, 255, 0.46);
}

.playing-card.is-selected {
  box-shadow: 0 7px 18px rgba(0, 26, 18, 0.37), 0 0 0 4px #7ae2ff;
  transform: none;
}

.playing-card.is-settling {
  transition: none;
}

.playing-card.is-hint-source {
  animation: hint-pulse 760ms ease-in-out 2;
}

.playing-card.is-just-dealt {
  animation: deal-card 330ms cubic-bezier(0.22, 0.84, 0.36, 1) both;
  animation-delay: var(--deal-delay, 0ms);
}

.playing-card.is-just-flipped {
  animation: flip-card 420ms ease both;
}

.playing-card.is-rejected {
  animation: reject-card 320ms ease;
}

.card-corner {
  position: absolute;
  top: 6px;
  left: 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: calc(var(--card-w) * 0.19);
  font-weight: 800;
  line-height: 0.82;
  letter-spacing: -0.04em;
}

.card-corner--bottom {
  inset: auto 7px 6px auto;
  transform: rotate(180deg);
}

.card-corner__suit {
  margin-top: 3px;
  font-size: 0.92em;
}

.card-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-top: 5px;
  font-size: calc(var(--card-w) * 0.45);
  line-height: 1;
  opacity: 0.92;
}

.playing-card[data-rank="11"] .card-center,
.playing-card[data-rank="12"] .card-center,
.playing-card[data-rank="13"] .card-center {
  width: 49%;
  height: 36%;
  inset: 34% auto auto 25.5%;
  padding: 0;
  color: #f8fbfd;
  background: var(--face-gradient);
  border: 2px solid #c3d9e4;
  border-radius: 50% 50% 42% 42%;
  box-shadow: 0 0 0 2px #edf4f7, 0 2px 5px rgba(4, 17, 25, 0.26);
  font-size: calc(var(--card-w) * 0.22);
  font-weight: 900;
}

.playing-card[data-rank="11"] .card-center::after,
.playing-card[data-rank="12"] .card-center::after,
.playing-card[data-rank="13"] .card-center::after {
  content: attr(data-symbol);
  margin-left: 2px;
  font-size: 0.72em;
}

.drag-layer {
  position: fixed;
  z-index: 999;
  inset: 0;
  pointer-events: none;
}

.drag-stack {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--drag-card-w);
  height: var(--drag-stack-h);
  will-change: transform;
  contain: layout style;
}

.drag-stack .playing-card {
  width: var(--drag-card-w);
  height: calc(var(--drag-card-w) * 1.4);
  top: var(--drag-top, 0px);
  transform: none;
  transition: none;
  animation: none;
  filter: none;
  box-shadow: 0 2px 4px rgba(0, 20, 14, 0.25);
}

.game-board.is-dragging .tableau-column::before {
  transition: none;
  box-shadow: none;
}

.game-board.is-dragging .playing-card--up:hover {
  filter: none;
}

.tableau-column.is-hover-drop::before {
  border-color: #e5fff2;
  background: rgba(103, 232, 172, 0.3);
}

.game-board.is-dragging .playing-card.is-drag-source {
  opacity: 0.18;
}

.completion-flight {
  position: fixed;
  z-index: 1001;
  width: var(--flight-w);
  height: calc(var(--flight-w) * 1.4);
  display: grid;
  place-items: center;
  color: #10202b;
  background: #f8fbfd;
  border: 1px solid #d9e6ed;
  border-radius: 9px;
  box-shadow: 0 12px 30px rgba(0, 20, 14, 0.4);
  font-weight: 850;
  pointer-events: none;
}

.playing-card[data-suit="hearts"],
.playing-card[data-suit="diamonds"],
.foundation-slot.is-filled[data-suit="hearts"],
.foundation-slot.is-filled[data-suit="diamonds"],
.completion-flight[data-suit="hearts"],
.completion-flight[data-suit="diamonds"] {
  color: #b51f35;
  --face-gradient: linear-gradient(145deg, #c52e46, #85172a);
}

.board-help {
  display: none;
  margin: 0;
  padding: 11px 16px;
  color: var(--muted);
  background: rgba(3, 18, 29, 0.88);
  border-top: 1px solid var(--line);
  font-size: 0.76rem;
  line-height: 1.45;
}

.board-help span {
  margin-right: 5px;
  color: var(--accent);
  font-weight: 900;
}

.no-script {
  margin: 0;
  padding: 16px;
  color: #ffe3df;
  background: #702d31;
  text-align: center;
}

.game-dialog {
  width: min(440px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  padding: 0;
  overflow: hidden;
  color: var(--text);
  background: linear-gradient(155deg, #173d5d, #0b2135);
  border: 1px solid rgba(196, 230, 248, 0.24);
  border-radius: 24px;
  box-shadow: 0 32px 90px rgba(0, 6, 13, 0.7);
  text-align: center;
}

.game-dialog::backdrop {
  background: rgba(1, 9, 15, 0.75);
  backdrop-filter: blur(6px);
}

.game-dialog form,
.victory-content {
  position: relative;
  z-index: 2;
  margin: 0;
  padding: 30px;
}

.game-dialog--wide {
  width: min(650px, calc(100% - 28px));
}

.dialog-scroll {
  max-height: calc(100dvh - 30px);
  overflow-y: auto;
  padding: clamp(23px, 4vw, 34px);
}

.help-copy {
  color: #c3d5df;
  text-align: left;
}

.help-copy p {
  margin-bottom: 14px !important;
  line-height: 1.6 !important;
}

.help-copy ul {
  display: grid;
  gap: 8px;
  margin: 4px 0 24px;
  padding-left: 1.25rem;
  line-height: 1.5;
}

.help-copy li::marker {
  color: var(--accent);
}

.dialog-close {
  min-width: 150px;
}

.dialog-symbol--ranking {
  color: #392803;
  background: linear-gradient(145deg, #fff2ad, #ffc64f);
}

.ranking-note {
  margin-bottom: 18px !important;
}

.ranking-table-wrap {
  overflow-x: auto;
  margin-bottom: 22px;
  border: 1px solid rgba(207, 232, 245, 0.15);
  border-radius: 14px;
}

.ranking-table {
  width: 100%;
  min-width: 470px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.ranking-table th,
.ranking-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(207, 232, 245, 0.12);
  text-align: right;
  white-space: nowrap;
}

.ranking-table th {
  color: #9eb8c7;
  background: rgba(3, 18, 29, 0.34);
  font-size: 0.67rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ranking-table th:first-child,
.ranking-table td:first-child {
  width: 42px;
  color: var(--gold);
  text-align: center;
  font-weight: 800;
}

.ranking-table tbody tr:last-child td {
  border-bottom: 0;
}

.ranking-table th:nth-child(2),
.ranking-table td:nth-child(2) {
  max-width: 180px;
  overflow-wrap: anywhere;
  white-space: normal;
  text-align: left;
}

#victory-ranking-status[data-status="error"] {
  color: var(--danger);
}

#retry-ranking-save {
  margin-bottom: 12px;
}

.ranking-empty {
  margin: 0 !important;
  padding: 22px;
  color: var(--muted);
}

.dialog-symbol {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin: 0 auto 17px;
  color: #062338;
  background: linear-gradient(145deg, #a1ebff, #33bde9);
  border-radius: 17px;
  box-shadow: 0 12px 26px rgba(18, 176, 226, 0.24);
  font-size: 1.75rem;
}

.game-dialog h2 {
  margin-bottom: 10px;
  font-size: clamp(1.35rem, 5vw, 1.85rem);
  line-height: 1.2;
}

.game-dialog p:not(.eyebrow) {
  margin-bottom: 24px;
  color: var(--muted);
  line-height: 1.55;
}

.dialog-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.game-dialog--victory {
  width: min(510px, calc(100% - 28px));
  background: linear-gradient(150deg, #174b46, #0b2632 66%);
}

.dialog-symbol--victory {
  color: #2e2709;
  background: linear-gradient(145deg, #fff0a9, #ffc756);
  box-shadow: 0 12px 32px rgba(255, 204, 93, 0.24);
  animation: victory-symbol 1.2s ease-in-out infinite alternate;
}

.victory-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 22px 0 25px;
}

.victory-stats > div {
  padding: 14px 8px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 13px;
}

.victory-stats dt {
  color: #a8c7c4;
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.victory-stats dd {
  margin: 4px 0 0;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.victory-rays {
  position: absolute;
  inset: -60%;
  z-index: 0;
  opacity: 0.17;
  background: repeating-conic-gradient(from 0deg, #ffefab 0 9deg, transparent 9deg 21deg);
  animation: rotate-rays 18s linear infinite;
}

.celebration-piece {
  position: absolute;
  z-index: 20;
  top: -24px;
  left: var(--x);
  width: 9px;
  height: 15px;
  background: var(--color);
  border-radius: 2px;
  pointer-events: none;
  animation: confetti-fall var(--duration) var(--delay) cubic-bezier(0.18, 0.75, 0.4, 1) forwards;
}

@keyframes foundation-pop {
  0% { transform: scale(0.82) rotate(-3deg); opacity: 0.35; }
  65% { transform: scale(1.06) rotate(1deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}

@keyframes deal-card {
  from { opacity: 0; transform: translate(-30vw, -120px) rotate(-5deg); }
  to { opacity: 1; transform: translate(0, 0) rotate(0); }
}

@keyframes flip-card {
  0% { transform: rotateY(88deg); }
  100% { transform: rotateY(0); }
}

@keyframes hint-pulse {
  0%, 100% { box-shadow: 0 5px 12px rgba(0, 33, 24, 0.26); }
  45% { box-shadow: 0 7px 18px rgba(0, 26, 18, 0.36), 0 0 0 5px rgba(255, 215, 107, 0.94), 0 0 28px rgba(255, 208, 76, 0.48); }
}

@keyframes stock-hint {
  0%, 100% { transform: translateY(0); filter: none; }
  45% { transform: translateY(-7px) rotate(-1deg); filter: drop-shadow(0 0 10px rgba(255, 220, 111, 0.85)); }
}

@keyframes reject-card {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  70% { transform: translateX(6px); }
}

@keyframes victory-symbol {
  from { transform: translateY(0) rotate(-2deg); }
  to { transform: translateY(-5px) rotate(2deg); }
}

@keyframes rotate-rays {
  to { transform: rotate(360deg); }
}

@keyframes confetti-fall {
  0% { transform: translate3d(0, 0, 0) rotate(0); opacity: 1; }
  100% { transform: translate3d(var(--drift), 760px, 0) rotate(var(--spin)); opacity: 0.18; }
}

@media (max-width: 1180px) {
  .game-toolbar {
    grid-template-columns: 1fr;
  }

  .game-stats {
    order: -1;
    width: 100%;
  }

  .game-stats > div:first-child {
    border-left: 0;
  }
}

@media (max-width: 760px) {
  .site-header__inner,
  .game-intro {
    width: min(100% - 20px, 1480px);
  }

  .site-header__inner {
    min-height: 60px;
    grid-template-columns: auto 1fr;
  }

  .brand__mark {
    width: 32px;
    height: 32px;
  }

  .site-nav {
    display: none;
  }

  .game-intro {
    padding-block: 12px;
  }

  .header-title {
    justify-self: end;
    font-size: clamp(1rem, 4.5vw, 1.25rem);
  }

  .game-shell {
    border-radius: 20px;
  }

  .game-toolbar {
    padding: 12px;
    gap: 12px;
  }

  .game-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nickname-form {
    grid-column: 1 / -1;
  }

  .nickname-form input {
    flex: 1;
    font-size: 1rem;
  }

  .control-button {
    padding-inline: 9px;
  }

  .game-stats {
    grid-template-columns: repeat(5, 1fr);
  }

  .game-stats > div {
    min-width: 0;
    padding-inline: 4px;
  }

  .game-stats dt {
    font-size: 0.55rem;
  }

  .game-stats dd {
    font-size: 0.86rem;
  }

  .game-message {
    justify-content: flex-start;
    min-height: 43px;
    text-align: left;
  }

  .board-help {
    display: block;
  }

}

@media (max-width: 430px) {
  .brand > span:last-child {
    display: none;
  }

  .game-actions .control-button--sound {
    justify-content: center;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-delay: 0ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
