:root {
  color-scheme: dark;
  --black: #060605;
  --panel: #10110d;
  --green: #0b2a13;
  --green-2: #123f1d;
  --gold: #f4c85a;
  --gold-2: #9f6f1f;
  --cream: #fff1bd;
  --blue: #1f8cff;
  --orange: #ff7a1a;
  --red: #d7352a;
  --muted: #c9b16d;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--cream);
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 10%, rgba(244, 200, 90, 0.16), transparent 34rem),
    linear-gradient(135deg, #020302 0%, #0c160d 50%, #010201 100%);
}

button {
  font: inherit;
}

.app-shell {
  width: min(100%, 980px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.title-band {
  min-height: 118px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  border: 3px solid var(--gold-2);
  background:
    linear-gradient(90deg, transparent, rgba(244, 200, 90, 0.14), transparent),
    linear-gradient(#15140f, #080806);
  box-shadow: 0 0 0 2px #2f210c inset, 0 16px 35px rgba(0, 0, 0, 0.45);
}

.crest {
  width: clamp(70px, 16vw, 112px);
  height: clamp(70px, 16vw, 112px);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 3px solid var(--gold);
  background: radial-gradient(circle, #25231b, #050504 70%);
  box-shadow: 0 0 18px rgba(244, 200, 90, 0.32);
}

.crest svg {
  width: 84%;
  height: 84%;
  filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.65));
}

.lion-mane {
  fill: #1a1308;
  stroke: var(--gold);
  stroke-width: 4;
  stroke-linejoin: round;
}

.lion-face,
.lion-crown {
  fill: var(--gold);
  stroke: #fff0b8;
  stroke-width: 2.6;
  stroke-linejoin: round;
}

.lion-mark {
  fill: none;
  stroke: #271504;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kicker,
.mode-label,
.tiny-label {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 800;
}

.kicker {
  font-size: clamp(0.78rem, 2.5vw, 1.05rem);
}

h1 {
  margin: 2px 0 0;
  color: var(--gold);
  font-size: clamp(2rem, 7.5vw, 5rem);
  line-height: 0.95;
  text-transform: uppercase;
  text-shadow: 0 3px 0 #4b2c09, 0 8px 20px rgba(0, 0, 0, 0.8);
}

.subtitle {
  margin: 6px 0 0;
  color: #f7d981;
  font-size: clamp(0.86rem, 2.7vw, 1.2rem);
  font-weight: 800;
  text-transform: uppercase;
}

.screen {
  display: none;
  min-height: 0;
}

.screen-active {
  display: grid;
}

#menu,
#difficulty,
#adBreak {
  place-items: center;
}

.menu-panel {
  width: min(100%, 430px);
  padding: 26px;
  display: grid;
  gap: 14px;
  border: 2px solid var(--gold-2);
  background:
    linear-gradient(145deg, rgba(18, 63, 29, 0.88), rgba(7, 8, 5, 0.96)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 8px);
  box-shadow: 0 24px 55px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(244, 200, 90, 0.28) inset;
}

.brand-line {
  margin: 4px 0 0;
  color: rgba(255, 241, 189, 0.74);
  text-align: center;
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
}

.bank-card {
  padding: 10px;
  display: grid;
  gap: 4px;
  border: 1px solid rgba(244, 200, 90, 0.42);
  background: rgba(0, 0, 0, 0.28);
  text-align: center;
}

.bank-card strong {
  color: var(--cream);
  font-size: 1.02rem;
}

.table-select {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stake-button {
  min-height: 42px;
  border: 1px solid rgba(244, 200, 90, 0.72);
  border-radius: 8px;
  color: var(--cream);
  background: linear-gradient(#16140e, #060605);
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.stake-button.selected {
  color: #211400;
  background: linear-gradient(#ffe594, #d19a2f 48%, #805016);
}

.stake-button:disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

.menu-panel.compact {
  width: min(100%, 380px);
}

.ad-panel {
  width: min(100%, 470px);
  min-height: 520px;
  padding: 28px;
  display: grid;
  place-items: center;
  gap: 16px;
  text-align: center;
  border: 2px solid var(--gold);
  background:
    radial-gradient(circle at 50% 28%, rgba(244, 200, 90, 0.28), transparent 15rem),
    linear-gradient(145deg, rgba(18, 63, 29, 0.92), rgba(7, 8, 5, 0.98));
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.56), 0 0 0 1px rgba(255, 241, 189, 0.22) inset;
}

.ad-mark {
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 4px solid var(--gold);
  color: var(--gold);
  background: radial-gradient(circle, #1d1a10, #050504 70%);
  box-shadow: 0 0 34px rgba(244, 200, 90, 0.36);
  font-size: 2.4rem;
  font-weight: 900;
  text-shadow: 0 3px 0 #4b2c09;
}

.ad-panel h2 {
  margin: 0;
  color: var(--gold);
  font-size: clamp(1.8rem, 6vw, 3rem);
  line-height: 0.98;
  text-transform: uppercase;
  text-shadow: 0 3px 0 #4b2c09, 0 8px 20px rgba(0, 0, 0, 0.72);
}

.ad-copy {
  max-width: 34ch;
  margin: 0;
  color: #f7d981;
  font-weight: 800;
  line-height: 1.35;
}

.ad-countdown {
  width: 118px;
  height: 118px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 3px solid rgba(255, 241, 189, 0.82);
  color: var(--cream);
  background: rgba(0, 0, 0, 0.42);
  box-shadow: 0 0 0 6px rgba(244, 200, 90, 0.18), 0 16px 32px rgba(0, 0, 0, 0.34);
}

.ad-countdown span {
  display: block;
  color: #ffffff;
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 0.82;
}

.ad-countdown small {
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 900;
}

.menu-button,
.small-button {
  min-height: 54px;
  border-radius: 8px;
  border: 2px solid var(--gold);
  color: #211400;
  background: linear-gradient(#ffe594, #d19a2f 48%, #805016);
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 5px 0 #4d2b08, 0 12px 24px rgba(0, 0, 0, 0.34);
}

.menu-button:hover,
.small-button:hover {
  filter: brightness(1.08);
}

.menu-button:active,
.small-button:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 #4d2b08, 0 8px 16px rgba(0, 0, 0, 0.34);
}

.ghost {
  color: var(--cream);
  background: linear-gradient(#1b1a14, #070706);
}

#game {
  min-height: 0;
  gap: 12px;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.hud,
.status-panel {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(244, 200, 90, 0.55);
  background: rgba(3, 5, 3, 0.78);
}

.hud-brand {
  min-height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gold);
  border: 1px solid rgba(244, 200, 90, 0.36);
  background: rgba(17, 19, 13, 0.78);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.score-board {
  min-height: 42px;
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 8px;
  align-items: center;
}

.score-board > div {
  min-width: 84px;
  padding: 5px 9px;
  border: 1px solid rgba(244, 200, 90, 0.38);
  background: rgba(17, 19, 13, 0.78);
  text-align: center;
}

.score-name {
  display: block;
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
}

.blue-score {
  color: #70c9ff;
}

.orange-score {
  color: #ffac61;
}

.score-board strong {
  display: block;
  color: var(--cream);
  font-size: 0.86rem;
}

.chip-bank {
  min-height: 42px;
  min-width: 166px;
  padding: 5px 9px;
  border: 1px solid rgba(244, 200, 90, 0.38);
  background: rgba(17, 19, 13, 0.78);
  text-align: center;
}

.chip-bank strong,
.chip-bank small {
  display: block;
}

.chip-bank strong {
  color: var(--cream);
  font-size: 0.82rem;
}

.chip-bank small {
  color: var(--gold);
  font-weight: 900;
  text-transform: uppercase;
}

.mini-crest {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #1b1001;
  background: linear-gradient(#ffe594, #d19a2f 48%, #805016);
  border: 1px solid #fff1bd;
  font-size: 0.62rem;
  box-shadow: 0 0 10px rgba(244, 200, 90, 0.35);
}

.turn-card {
  min-height: 42px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(244, 200, 90, 0.44);
  background: #11130d;
  font-weight: 900;
}

.turn-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow: 0 0 12px currentColor;
}

.turn-dot.blue {
  color: var(--blue);
  background: var(--blue);
}

.turn-dot.orange {
  color: var(--orange);
  background: var(--orange);
}

.small-button {
  min-width: 118px;
  min-height: 42px;
  font-size: 0.86rem;
}

.game-table {
  width: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(92px, 136px) minmax(420px, 660px) minmax(92px, 136px);
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vw, 16px);
}

.player-panel {
  align-self: stretch;
  min-height: 0;
  padding: 14px 10px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  border: 2px solid rgba(244, 200, 90, 0.68);
  background:
    linear-gradient(180deg, rgba(244, 200, 90, 0.12), transparent 18%, rgba(0, 0, 0, 0.24)),
    linear-gradient(145deg, rgba(11, 42, 19, 0.92), rgba(4, 5, 4, 0.94));
  box-shadow: 0 0 0 1px rgba(255, 241, 189, 0.18) inset, 0 18px 34px rgba(0, 0, 0, 0.42);
  text-align: center;
}

.player-panel-orange {
  background:
    linear-gradient(180deg, rgba(244, 200, 90, 0.12), transparent 18%, rgba(0, 0, 0, 0.24)),
    linear-gradient(145deg, rgba(65, 16, 8, 0.92), rgba(4, 5, 4, 0.94));
}

.player-panel.active-player {
  border-color: #fff1bd;
  box-shadow: 0 0 0 1px rgba(255, 241, 189, 0.32) inset, 0 0 24px rgba(244, 200, 90, 0.34);
}

.panel-title,
.panel-motto {
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.player-panel strong {
  color: var(--cream);
  font-size: 1.25rem;
  text-transform: uppercase;
}

.player-panel-blue strong {
  color: #78cfff;
}

.player-panel-orange strong {
  color: #ffae65;
}

.panel-motto {
  max-width: 96px;
  line-height: 1.55;
}

.chip-stack {
  width: 100%;
  max-width: 104px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid rgba(244, 200, 90, 0.5);
  background: rgba(0, 0, 0, 0.34);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.24) inset;
}

.play-chip {
  position: relative;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background:
    radial-gradient(circle at 33% 25%, rgba(255, 255, 255, 0.9), transparent 0.55rem),
    radial-gradient(circle at 50% 56%, var(--chip-light), var(--chip-main) 48%, var(--chip-dark) 76%);
  box-shadow: 0 0 0 3px rgba(255, 241, 189, 0.2) inset, 0 6px 12px rgba(0, 0, 0, 0.48);
}

.play-chip::before {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  border: 1px solid rgba(255, 241, 189, 0.74);
  background: rgba(0, 0, 0, 0.16);
}

.play-chip::after {
  content: "P";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff1bd;
  font-size: 0.9rem;
  font-weight: 900;
  text-shadow: 0 2px 2px #000;
}

.king-chip::after {
  content: "K";
  color: var(--gold);
}

.blue-chip {
  --chip-light: #8fdaff;
  --chip-main: #176ed2;
  --chip-dark: #052453;
}

.orange-chip {
  --chip-light: #ffd18b;
  --chip-main: #df5614;
  --chip-dark: #641804;
}

.board-frame {
  width: min(660px, calc(100dvh - 292px), calc(100vw - 330px));
  min-width: 420px;
  margin: 0 auto;
  aspect-ratio: 1;
  padding: clamp(10px, 2.5vw, 18px);
  border: 5px solid var(--gold-2);
  background:
    linear-gradient(90deg, #060605, #1d170d 50%, #060605),
    #090806;
  box-shadow: 0 0 0 2px #e9bd52 inset, 0 30px 55px rgba(0, 0, 0, 0.5);
}

.board-surface {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 2px solid rgba(244, 200, 90, 0.72);
  background:
    radial-gradient(circle at 50% 52%, rgba(244, 200, 90, 0.16), transparent 18%),
    repeating-linear-gradient(30deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 7px),
    linear-gradient(145deg, var(--green-2), #071308);
}

.board-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.65));
}

.board-lines line {
  stroke: var(--gold);
  stroke-width: 1.35;
  stroke-linecap: round;
}

.watermark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(244, 200, 90, 0.1);
  font-size: clamp(5rem, 22vw, 11rem);
  font-weight: 900;
  pointer-events: none;
}

.board-nodes {
  position: absolute;
  inset: 0;
}

.node {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: clamp(58px, 11.5vw, 86px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 4px solid var(--gold);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, #2b2b2b, #030303 72%);
  color: var(--cream);
  cursor: pointer;
  box-shadow: 0 0 0 3px #5d390e inset, 0 10px 18px rgba(0, 0, 0, 0.55);
}

.node::before {
  content: "";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 4.4vw, 2.35rem);
  font-weight: 900;
  text-shadow: 0 2px 4px #000, 0 0 12px rgba(255, 255, 255, 0.35);
}

.node.occupied-blue,
.node.occupied-orange {
  border-width: 3px;
}

.node.occupied-blue {
  background: radial-gradient(circle at 35% 25%, #123255, #05080d 72%);
  box-shadow: 0 0 0 4px #183a68 inset, 0 0 24px rgba(31, 140, 255, 0.6);
}

.node.occupied-orange {
  background: radial-gradient(circle at 35% 25%, #4d1b10, #0d0503 72%);
  box-shadow: 0 0 0 4px #773014 inset, 0 0 24px rgba(255, 122, 26, 0.6);
}

.game-piece {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 118%;
  height: 118%;
  transform: translate(-50%, -58%);
  pointer-events: none;
  color: var(--piece-main);
  filter: drop-shadow(0 9px 5px rgba(0, 0, 0, 0.62));
}

.image-piece {
  overflow: visible;
  border: 0;
  background: transparent;
}

.image-piece img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}

.blue-piece {
  --piece-main: #1f8cff;
  --piece-dark: #042a63;
  --piece-mid: #0d63c5;
  --piece-light: #d8f6ff;
  --piece-glow: rgba(91, 190, 255, 0.78);
}

.orange-piece {
  --piece-main: #ff7a1a;
  --piece-dark: #671703;
  --piece-mid: #d64e0d;
  --piece-light: #ffe0a5;
  --piece-glow: rgba(255, 177, 83, 0.78);
}

.king-piece {
  width: 128%;
  height: 128%;
}

.king-piece img {
  object-position: center bottom;
}

.piece-body,
.piece-head,
.piece-neck,
.piece-rim,
.piece-crown,
.piece-cross,
.piece-collar,
.piece-base-gold {
  stroke: rgba(255, 244, 194, 0.72);
  stroke-width: 2.5;
  stroke-linejoin: round;
  fill: var(--piece-main);
}

.piece-body {
  fill: var(--piece-mid);
  stroke: var(--gold);
  stroke-width: 2.8;
}

.piece-rim {
  fill: var(--piece-dark);
  stroke: var(--gold);
  stroke-width: 4;
}

.piece-base-gold {
  fill: url("#gold");
  fill: var(--gold);
  stroke: #fff1bd;
  stroke-width: 2.5;
}

.piece-head,
.piece-crown,
.piece-cross {
  fill: var(--piece-main);
  filter: drop-shadow(0 0 6px var(--piece-glow));
}

.piece-collar {
  fill: var(--piece-dark);
  stroke: var(--gold);
  stroke-width: 3;
}

.piece-highlight {
  fill: var(--piece-light);
  opacity: 0.72;
}

.piece-line {
  fill: none;
  stroke: rgba(255, 245, 209, 0.74);
  stroke-width: 2.6;
  stroke-linecap: round;
}

.piece-shadow {
  fill: rgba(0, 0, 0, 0.48);
}

.piece-gem {
  fill: var(--gold);
  stroke: #fff3bd;
  stroke-width: 2;
}

.piece-crown-gem {
  fill: #fff1bd;
  stroke: var(--gold);
  stroke-width: 2;
}

.node.selected {
  outline: 4px solid #ffffff;
  outline-offset: 5px;
}

.node.legal {
  animation: pulse 1.05s infinite alternate;
}

.node.winning {
  border-color: #ffffff;
  box-shadow: 0 0 0 4px var(--gold) inset, 0 0 32px rgba(255, 255, 255, 0.75);
}

.node.victory-dance .game-piece {
  animation: royalDance 0.72s ease-in-out infinite;
  transform-origin: 50% 90%;
}

.node.victory-dance:nth-child(2n) .game-piece {
  animation-delay: 0.14s;
}

.node.victory-dance:nth-child(3n) .game-piece {
  animation-delay: 0.28s;
}

@keyframes royalDance {
  0% {
    transform: translate(-50%, -58%) rotate(-5deg) scale(1);
  }
  25% {
    transform: translate(-50%, -67%) rotate(5deg) scale(1.06);
  }
  50% {
    transform: translate(-50%, -58%) rotate(0deg) scale(1);
  }
  75% {
    transform: translate(-50%, -66%) rotate(-6deg) scale(1.05);
  }
  100% {
    transform: translate(-50%, -58%) rotate(-5deg) scale(1);
  }
}

.status-panel {
  grid-template-columns: minmax(120px, auto) 1fr;
}

.status-panel p {
  margin: 0;
  color: #f2d98b;
}

.taunt-text {
  grid-column: 1 / -1;
  min-height: 30px;
  padding: 7px 10px;
  color: #fff1bd !important;
  text-align: center;
  border: 1px solid rgba(244, 200, 90, 0.32);
  background: rgba(8, 10, 6, 0.7);
  font-weight: 900;
}

.game-brand {
  grid-column: 1 / -1;
  color: rgba(255, 241, 189, 0.62) !important;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.dialog-card {
  width: min(92vw, 460px);
  padding: 24px;
  border: 2px solid var(--gold);
  color: var(--cream);
  text-align: center;
  background: linear-gradient(145deg, #132e16, #060605);
  box-shadow: 0 24px 60px #000;
}

.victory-dialog .dialog-card {
  width: min(94vw, 560px);
  border-width: 3px;
  background:
    radial-gradient(circle at 50% 8%, rgba(244, 200, 90, 0.28), transparent 12rem),
    linear-gradient(145deg, #183d1b, #060605 74%);
  box-shadow: 0 0 0 2px rgba(255, 241, 189, 0.18) inset, 0 30px 80px #000;
}

.victory-emblem {
  width: 92px;
  height: 92px;
  margin: -2px auto 10px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #211400;
  border: 3px solid #fff1bd;
  background:
    radial-gradient(circle at 35% 25%, #fff3b5, var(--gold) 46%, #805016 78%);
  box-shadow: 0 0 28px rgba(244, 200, 90, 0.48), 0 0 0 8px rgba(0, 0, 0, 0.28);
  font-size: 1.4rem;
  font-weight: 900;
  animation: victoryPulse 1.1s ease-in-out infinite alternate;
}

.dialog-card h2 {
  margin: 6px 0 8px;
  color: var(--gold);
  font-size: 2rem;
}

.auth-card {
  width: min(92vw, 500px);
}

.auth-card p {
  margin: 0 auto 8px;
  max-width: 34rem;
}

.auth-field {
  margin: 16px 0 8px;
  display: grid;
  gap: 7px;
  text-align: left;
  color: var(--cream);
  font-weight: 900;
}

.auth-field span {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.78rem;
}

.auth-field input {
  width: 100%;
  min-height: 50px;
  border: 2px solid rgba(244, 200, 90, 0.72);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--cream);
  background: rgba(0, 0, 0, 0.42);
  font: inherit;
}

.auth-field input:focus {
  outline: 3px solid rgba(255, 241, 189, 0.34);
  outline-offset: 2px;
}

.auth-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.victory-dialog .dialog-card h2 {
  font-size: clamp(2.25rem, 8vw, 4rem);
  line-height: 0.95;
  text-transform: uppercase;
  text-shadow: 0 3px 0 #4b2c09, 0 10px 24px rgba(0, 0, 0, 0.8);
}

.victory-stats {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.victory-stats > div {
  min-height: 70px;
  padding: 10px;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid rgba(244, 200, 90, 0.48);
  background: rgba(0, 0, 0, 0.32);
}

.victory-stats strong {
  color: var(--cream);
}

.settings-actions {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.dialog-actions {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

@keyframes pulse {
  from {
    box-shadow: 0 0 0 3px #5d390e inset, 0 0 10px rgba(244, 200, 90, 0.4);
  }
  to {
    box-shadow: 0 0 0 3px #5d390e inset, 0 0 24px rgba(244, 200, 90, 0.9);
  }
}

@keyframes victoryPulse {
  from {
    transform: scale(1);
    box-shadow: 0 0 22px rgba(244, 200, 90, 0.4), 0 0 0 8px rgba(0, 0, 0, 0.28);
  }
  to {
    transform: scale(1.07);
    box-shadow: 0 0 40px rgba(244, 200, 90, 0.72), 0 0 0 8px rgba(0, 0, 0, 0.28);
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    gap: 8px;
  }

  .title-band {
    min-height: 112px;
    padding: 10px;
  }

  body[data-screen="game"] .title-band {
    min-height: 58px;
    padding: 6px 8px;
  }

  body[data-screen="game"] .crest {
    width: 44px;
    height: 44px;
  }

  body[data-screen="game"] h1 {
    font-size: clamp(1.25rem, 7vw, 2rem);
    line-height: 0.9;
  }

  body[data-screen="game"] .kicker,
  body[data-screen="game"] .subtitle {
    display: none;
  }

  .menu-panel {
    padding: 20px;
  }

  .hud {
    grid-template-columns: 1fr auto;
    gap: 6px;
    padding: 7px;
  }

  .hud-brand {
    grid-column: 1 / -1;
    justify-content: center;
    order: 3;
    min-height: 30px;
    padding: 0 8px;
    font-size: 0.68rem;
  }

  .score-board {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 34px;
  }

  .score-board > div {
    min-width: 0;
    padding: 4px 7px;
  }

  .chip-bank {
    grid-column: 1 / -1;
    min-height: 34px;
    min-width: 0;
  }

  .small-button {
    grid-column: 1 / -1;
    min-height: 34px;
  }

  .board-frame {
    width: min(100%, calc(100dvh - 248px));
    min-width: 0;
    padding: 8px;
  }

  .game-table {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .player-panel {
    align-self: auto;
    min-height: 0;
    padding: 6px 8px;
    grid-template-columns: auto auto 1fr;
    justify-items: start;
    gap: 6px;
  }

  .player-panel strong {
    font-size: 0.9rem;
  }

  .panel-title,
  .panel-motto {
    display: none;
  }

  .chip-stack {
    width: auto;
    max-width: none;
    margin-left: auto;
    padding: 3px;
    grid-template-columns: repeat(3, 24px);
    gap: 4px;
  }

  .play-chip::after {
    font-size: 0.62rem;
  }

  .node {
    width: clamp(45px, 15vw, 62px);
  }

  .status-panel {
    padding: 7px;
    gap: 5px;
  }

  .status-panel p {
    font-size: 0.82rem;
    line-height: 1.2;
  }
}

@media (max-width: 980px) {
  body[data-screen="game"] .game-table {
    grid-template-columns: 1fr;
  }

  body[data-screen="game"] .player-panel {
    display: none;
  }

  body[data-screen="game"] .board-frame {
    width: min(100%, 660px, calc(100dvh - 248px));
    min-width: 0;
  }
}

@media (max-width: 430px) {
  .title-band {
    gap: 10px;
    align-items: center;
  }

  .kicker {
    font-size: 0.68rem;
  }

  .subtitle {
    font-size: 0.72rem;
  }

  .menu-button {
    min-height: 52px;
  }

  body[data-screen="game"] .app-shell {
    gap: 6px;
  }

  body[data-screen="game"] #game {
    gap: 6px;
  }

  body[data-screen="game"] .title-band {
    min-height: 48px;
  }

  body[data-screen="game"] .crest {
    width: 36px;
    height: 36px;
  }

  body[data-screen="game"] h1 {
    font-size: clamp(1.08rem, 7vw, 1.6rem);
  }

  .turn-card {
    min-height: 34px;
    padding: 0 8px;
    font-size: 0.82rem;
  }

  .score-board strong {
    font-size: 0.78rem;
  }

  .mini-crest {
    width: 22px;
    height: 22px;
    font-size: 0.5rem;
  }

  .board-frame {
    width: min(100%, calc(100dvh - 218px));
    min-width: 0;
    padding: 6px;
  }

  .chip-stack {
    grid-template-columns: repeat(3, 20px);
  }

  .status-panel {
    grid-template-columns: 1fr;
  }

  .game-brand {
    display: none;
  }

  .victory-stats {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 720px) {
  body[data-screen="game"] .title-band {
    min-height: 44px;
    padding: 5px 8px;
  }

  body[data-screen="game"] .crest {
    width: 34px;
    height: 34px;
  }

  body[data-screen="game"] h1 {
    font-size: 1.25rem;
  }

  .board-frame {
    width: min(100%, calc(100dvh - 214px));
    min-width: 0;
  }

  .hud-brand,
  .game-brand,
  .taunt-text {
    display: none;
  }

  .score-board {
    display: none;
  }

  .chip-bank {
    display: none;
  }

  .player-panel {
    display: none;
  }
}

body[data-screen="game"] .game-table {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 0;
}

body[data-screen="game"] .player-panel {
  display: none;
}

body[data-screen="game"] .board-frame {
  width: min(72vmin, 720px);
  min-width: 420px;
}

@media (max-width: 680px), (max-height: 720px) {
  body[data-screen="game"] .board-frame {
    width: min(94vw, calc(100dvh - 214px));
    min-width: 0;
  }
}
