:root {
  --ink: #fffdf3;
  --ink-deep: #183453;
  --muted: #d9eaf0;
  --night: #061d38;
  --navy: #0b2b52;
  --teal: #1ec9b7;
  --mint: #8df1d4;
  --sun: #ffdb61;
  --coral: #ff705f;
  --pink: #fb6faf;
  --violet: #8e66ed;
  --sky: #50c8ff;
  --glass: rgba(7, 31, 61, 0.82);
  --glass-soft: rgba(21, 57, 89, 0.7);
  --edge: rgba(255, 255, 255, 0.2);
  --shadow: 0 22px 55px rgba(1, 15, 38, 0.38);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--night);
}

body {
  color: var(--ink);
  font-family: ui-rounded, "Avenir Next Rounded", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  user-select: none;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  min-height: 44px;
}

button {
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 4px solid #fff8a8;
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.25);
  opacity: 0.55;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.lifequest-app {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.logo-gem {
  position: relative;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 3px solid #fff5a8;
  border-radius: 17px 21px 15px 22px;
  color: #294267;
  background: linear-gradient(145deg, #fff8a8 4%, #ffc945 64%, #ec8f28);
  box-shadow: inset 0 4px 8px rgba(255, 255, 255, 0.72), 0 6px 0 #9c5524, 0 11px 24px rgba(1, 14, 35, 0.36);
  font-size: 27px;
  font-weight: 1000;
  transform: rotate(-4deg);
}

.logo-gem::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 12px 16px 10px 16px;
}

.logo-copy strong,
.logo-copy small {
  display: block;
}

.logo-copy strong {
  font-size: 23px;
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.logo-copy small {
  margin-top: 5px;
  color: var(--sun);
  font-size: 9px;
  font-weight: 1000;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.glass-button,
.icon-button {
  border: 1px solid var(--edge);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.065));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.2), 0 10px 25px rgba(0, 16, 41, 0.22);
  backdrop-filter: blur(14px) saturate(1.15);
}

.glass-button {
  padding: 0 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 950;
}

.icon-button {
  width: 46px;
  height: 46px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 15px;
  font-size: 20px;
  font-weight: 1000;
}

.primary-button {
  min-height: 54px;
  padding: 0 24px;
  border: 2px solid #fff0a1;
  border-radius: 18px;
  color: #263257;
  background: linear-gradient(180deg, #fff579, #ffc43f 68%, #f49b2d);
  box-shadow: inset 0 3px rgba(255, 255, 255, 0.74), 0 7px 0 #ad5c27, 0 16px 30px rgba(2, 18, 42, 0.35);
  font-weight: 1000;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: transform 160ms var(--ease), filter 160ms var(--ease);
}

.primary-button:hover:not(:disabled) {
  filter: brightness(1.06) saturate(1.07);
  transform: translateY(-2px);
}

.primary-button:active:not(:disabled) {
  box-shadow: inset 0 3px rgba(255, 255, 255, 0.6), 0 3px 0 #ad5c27, 0 9px 18px rgba(2, 18, 42, 0.32);
  transform: translateY(3px);
}

/* ---------- Setup ---------- */

.setup-screen {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: auto;
  background:
    linear-gradient(90deg, rgba(5, 24, 48, 0.82), rgba(5, 27, 53, 0.22) 52%, rgba(5, 24, 48, 0.72)),
    linear-gradient(180deg, rgba(2, 21, 46, 0.04), rgba(2, 17, 40, 0.86)),
    url("assets/lifequest/lifequest-world.webp") center / cover,
    radial-gradient(circle at 75% 20%, #78e2d2, #1f7794 40%, #0a3158 78%);
}

.setup-screen::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 72% 18%, rgba(255, 240, 132, 0.26), transparent 18%),
    linear-gradient(112deg, transparent 0 49%, rgba(255, 255, 255, 0.04) 50%, transparent 51%);
  background-size: auto, 68px 68px;
  mix-blend-mode: screen;
}

.setup-header,
.game-header {
  position: relative;
  z-index: 50;
  min-height: 76px;
  padding: max(10px, env(safe-area-inset-top)) clamp(14px, 2.6vw, 42px) 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, rgba(5, 27, 57, 0.94), rgba(5, 28, 55, 0.72));
  box-shadow: 0 15px 38px rgba(0, 15, 37, 0.25);
  backdrop-filter: blur(18px) saturate(1.2);
}

.setup-header-actions,
.game-header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.setup-main {
  position: relative;
  z-index: 2;
  width: min(1480px, calc(100% - 36px));
  margin: 0 auto;
  padding: clamp(24px, 3vh, 42px) 0 36px;
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(620px, 1.45fr);
  gap: clamp(22px, 3vw, 48px);
  align-items: start;
}

.setup-intro {
  padding: 24px 0 0;
  text-shadow: 0 6px 24px rgba(0, 18, 42, 0.6);
}

.setup-kicker,
.panel-kicker,
.modal-kicker,
.console-kicker {
  margin: 0 0 8px;
  color: #fff084;
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.setup-intro h1 {
  max-width: 650px;
  margin: 0;
  font-size: clamp(46px, 6.2vw, 88px);
  line-height: 0.88;
  letter-spacing: -0.07em;
}

.setup-intro h1 span {
  display: block;
  color: #fff083;
  font-size: 0.5em;
  letter-spacing: -0.045em;
}

.setup-intro > p:last-of-type {
  max-width: 560px;
  margin: 17px 0 23px;
  color: #e3f3f2;
  font-size: clamp(15px, 1.5vw, 20px);
  font-weight: 850;
  line-height: 1.45;
}

.feature-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.feature-ribbon span {
  min-height: 38px;
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(3, 29, 57, 0.62);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.16);
  font-size: 12px;
  font-weight: 900;
  backdrop-filter: blur(12px);
}

.setup-panel {
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 30px;
  background: linear-gradient(145deg, rgba(12, 52, 84, 0.92), rgba(5, 31, 65, 0.89));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.2), 0 30px 80px rgba(0, 14, 37, 0.45);
  backdrop-filter: blur(22px) saturate(1.14);
  overflow: hidden;
}

.setup-panel-head {
  padding: 20px 22px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.setup-panel-head h2 {
  margin: 0;
  font-size: clamp(22px, 2vw, 30px);
  letter-spacing: -0.04em;
}

.player-count {
  display: flex;
  gap: 7px;
}

.count-button {
  width: 47px;
  min-height: 47px;
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 1000;
}

.count-button.is-selected {
  color: #203c59;
  border-color: #fff4a0;
  background: linear-gradient(180deg, #fff17b, #ffc84d);
  box-shadow: 0 5px 0 #9d5a27, 0 8px 20px rgba(0, 15, 38, 0.3);
}

.setup-player-tabs {
  padding: 13px 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  background: rgba(2, 24, 52, 0.28);
}

.player-tab {
  min-width: 0;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
}

.player-tab.is-active {
  border-color: var(--player-color, #fff084);
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px var(--player-color, #fff084), 0 8px 20px rgba(0, 16, 40, 0.22);
}

.player-tab img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 5px 5px rgba(0, 12, 35, 0.42));
}

.player-tab span {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-editor {
  padding: 19px 22px 22px;
}

.name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.name-field label,
.choice-label {
  display: block;
  margin: 0 0 7px;
  color: #cde9eb;
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.name-field input {
  width: 100%;
  min-height: 51px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 15px;
  color: var(--ink);
  background: rgba(2, 24, 53, 0.72);
  box-shadow: inset 0 2px 8px rgba(0, 10, 30, 0.25);
  font-size: 17px;
  font-weight: 900;
  user-select: text;
}

.random-name-button {
  align-self: end;
  min-height: 51px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.11);
  font-size: 12px;
  font-weight: 950;
}

.editor-section {
  margin-top: 18px;
}

.character-picker {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.character-choice {
  position: relative;
  min-height: 88px;
  padding: 7px 5px 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.character-choice::before {
  content: "";
  position: absolute;
  inset: auto 8px 6px;
  height: 13px;
  border-radius: 50%;
  background: var(--character-color);
  filter: blur(7px);
  opacity: 0.45;
}

.character-choice img {
  position: relative;
  z-index: 1;
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 7px 6px rgba(0, 13, 35, 0.42));
  transition: transform 180ms var(--ease);
}

.character-choice span {
  position: relative;
  z-index: 1;
  display: block;
  overflow: hidden;
  font-size: 9px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-choice:hover img {
  transform: translateY(-4px) scale(1.08);
}

.character-choice.is-selected {
  border-color: var(--character-color);
  background: linear-gradient(145deg, color-mix(in srgb, var(--character-color) 32%, transparent), rgba(255, 255, 255, 0.1));
  box-shadow: inset 0 0 0 2px var(--character-color), 0 8px 20px rgba(0, 14, 35, 0.22);
}

.math-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.math-choice {
  min-height: 74px;
  padding: 9px 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
  text-align: left;
}

.math-choice strong,
.math-choice small {
  display: block;
}

.math-choice strong {
  margin-bottom: 5px;
  font-size: 13px;
}

.math-choice small {
  color: #cce6e8;
  font-size: 9px;
  font-weight: 850;
  line-height: 1.25;
}

.math-choice.is-selected {
  color: #1f3956;
  border-color: #fff2a1;
  background: linear-gradient(180deg, #fff18a, #ffc954);
  box-shadow: 0 5px 0 #986026;
}

.math-choice.is-selected small {
  color: #31506b;
}

.setup-footer {
  padding: 16px 22px 21px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(1, 21, 49, 0.35);
}

.setup-footer p {
  margin: 0;
  color: #cce8eb;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.4;
}

/* ---------- Main game shell ---------- */

.game-screen {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: #061d38;
}

.game-header {
  min-height: 70px;
  padding-top: max(8px, env(safe-area-inset-top));
  padding-bottom: 8px;
}

.game-header .logo-gem {
  width: 44px;
  height: 44px;
  border-radius: 15px 18px 14px 18px;
  font-size: 23px;
}

.game-header .logo-copy strong {
  font-size: 20px;
}

.now-playing {
  min-width: 230px;
  padding: 5px 17px 5px 7px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--player-color) 70%, white 15%);
  border-radius: 999px;
  background: linear-gradient(100deg, color-mix(in srgb, var(--player-color) 24%, rgba(5, 29, 57, 0.88)), rgba(5, 29, 57, 0.75));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.18), 0 9px 22px rgba(0, 13, 34, 0.3);
}

.now-playing-avatar {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 2px solid var(--player-color);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.28), transparent 68%);
  box-shadow: 0 0 17px color-mix(in srgb, var(--player-color) 60%, transparent);
}

.now-playing-avatar img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  filter: drop-shadow(0 5px 5px rgba(0, 13, 35, 0.42));
}

.now-playing-copy small,
.now-playing-copy strong {
  display: block;
}

.now-playing-copy small {
  color: #fff08d;
  font-size: 9px;
  font-weight: 1000;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.now-playing-copy strong {
  max-width: 180px;
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-stage-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.board-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  background:
    radial-gradient(circle at 50% 10%, rgba(78, 218, 211, 0.3), transparent 45%),
    linear-gradient(160deg, #174e70, #071f3f 70%);
}

.board-viewport.is-dragging {
  cursor: grabbing;
}

.board-viewport::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  box-shadow: inset 0 0 90px rgba(1, 13, 35, 0.7), inset 0 0 0 1px rgba(255, 255, 255, 0.13);
}

.board-canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 2100px;
  height: 1350px;
  overflow: hidden;
  border: 22px solid #f6e5a8;
  border-radius: 70px;
  background:
    linear-gradient(180deg, rgba(14, 76, 102, 0.05), rgba(7, 47, 70, 0.34)),
    url("assets/lifequest/lifequest-world.webp") center / cover,
    radial-gradient(circle at 72% 15%, #a5f3d5, #52b8a8 36%, #277a8b 76%, #1b486f);
  box-shadow:
    inset 0 0 0 8px #45638b,
    inset 0 0 0 14px #172f58,
    inset 0 0 75px rgba(6, 26, 53, 0.48),
    0 44px 90px rgba(0, 10, 28, 0.56);
  transform-origin: 0 0;
  will-change: transform;
}

.board-canvas::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 88%, rgba(255, 211, 76, 0.2), transparent 14%),
    radial-gradient(circle at 83% 52%, rgba(115, 249, 218, 0.18), transparent 18%),
    linear-gradient(115deg, transparent 0 49%, rgba(255, 255, 255, 0.04) 50% 51%, transparent 52%);
  background-size: auto, auto, 78px 78px;
  mix-blend-mode: screen;
}

.board-title-plaque {
  position: absolute;
  z-index: 7;
  left: 760px;
  top: 32px;
  width: 580px;
  height: 105px;
  padding: 15px 28px;
  border: 4px solid #fff0a5;
  border-radius: 35px 42px 32px 45px;
  color: #20415d;
  background: linear-gradient(165deg, rgba(255, 251, 206, 0.97), rgba(255, 211, 87, 0.97));
  box-shadow: inset 0 5px rgba(255, 255, 255, 0.76), 0 9px 0 #b5672d, 0 20px 36px rgba(4, 34, 57, 0.33);
  text-align: center;
  transform: rotate(-1deg);
}

.board-title-plaque strong,
.board-title-plaque small {
  display: block;
}

.board-title-plaque strong {
  font-size: 36px;
  line-height: 1;
  letter-spacing: -0.05em;
}

.board-title-plaque small {
  margin-top: 7px;
  color: #42627a;
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.path-svg {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.path-shadow {
  fill: none;
  stroke: rgba(12, 43, 62, 0.42);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 46;
  transform: translateY(11px);
}

.path-ribbon {
  fill: none;
  stroke: rgba(255, 246, 192, 0.84);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 38;
}

.path-stitch {
  fill: none;
  stroke: rgba(76, 117, 124, 0.4);
  stroke-dasharray: 5 15;
  stroke-linecap: round;
  stroke-width: 4;
}

.branch-ribbon {
  fill: none;
  stroke: rgba(255, 239, 165, 0.68);
  stroke-linecap: round;
  stroke-width: 30;
  stroke-dasharray: 10 7;
}

.board-space {
  --tile: #5cd9c1;
  --tile-dark: #248c85;
  --rotation: 0deg;
  position: absolute;
  z-index: 8;
  width: 112px;
  height: 78px;
  padding: 8px 8px 10px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr auto;
  align-items: center;
  gap: 2px 5px;
  border: 4px solid rgba(255, 255, 255, 0.8);
  border-radius: 23px 29px 21px 27px;
  color: #153a55;
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.92) 0 4px, transparent 5px),
    linear-gradient(155deg, color-mix(in srgb, var(--tile) 72%, white), var(--tile));
  box-shadow:
    inset 0 4px 8px rgba(255, 255, 255, 0.54),
    inset 0 -8px 12px color-mix(in srgb, var(--tile-dark) 48%, transparent),
    0 8px 0 var(--tile-dark),
    0 17px 22px rgba(5, 36, 54, 0.28);
  transform: translate(-50%, -50%) rotate(var(--rotation));
  transition: filter 200ms var(--ease), transform 200ms var(--ease), box-shadow 200ms var(--ease);
}

.board-space::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: inherit;
  pointer-events: none;
}

.board-space:hover {
  z-index: 15;
  filter: brightness(1.1) saturate(1.05);
  transform: translate(-50%, -58%) rotate(var(--rotation)) scale(1.08);
}

.board-space.is-current {
  z-index: 14;
  box-shadow:
    inset 0 4px 8px rgba(255, 255, 255, 0.6),
    inset 0 -8px 12px color-mix(in srgb, var(--tile-dark) 42%, transparent),
    0 8px 0 var(--tile-dark),
    0 0 0 10px rgba(255, 249, 145, 0.52),
    0 0 36px 15px rgba(255, 229, 80, 0.58);
  animation: current-space-pulse 1.15s ease-in-out infinite alternate;
}

@keyframes current-space-pulse {
  to { filter: brightness(1.12); transform: translate(-50%, -55%) rotate(var(--rotation)) scale(1.05); }
}

.board-space.has-player::before {
  content: "";
  position: absolute;
  inset: -12px;
  border: 4px solid var(--occupant-color, #fff384);
  border-radius: inherit;
  box-shadow: 0 0 22px var(--occupant-color, #fff384);
  animation: occupant-ring 1.3s ease-in-out infinite alternate;
}

@keyframes occupant-ring {
  to { inset: -17px; opacity: 0.45; }
}

.space-number {
  align-self: start;
  grid-row: 1 / span 2;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  font-size: 11px;
  font-weight: 1000;
}

.space-icon {
  align-self: end;
  font-size: 22px;
  line-height: 1;
  filter: drop-shadow(0 2px rgba(255, 255, 255, 0.4));
}

.space-name {
  align-self: start;
  overflow: hidden;
  font-size: 9px;
  font-weight: 1000;
  line-height: 1.05;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.tile-learn { --tile: #55d8d0; --tile-dark: #197f89; }
.tile-build { --tile: #ffba58; --tile-dark: #b5652a; }
.tile-community { --tile: #85dc74; --tile-dark: #3d8c57; }
.tile-adventure { --tile: #a180f4; --tile-dark: #5a459c; }
.tile-surprise { --tile: #fb78ad; --tile-dark: #aa3e70; }
.tile-payday { --tile: #ffe272; --tile-dark: #a86b25; width: 124px; }
.tile-career { --tile: #6dd7ff; --tile-dark: #2c79a2; width: 128px; }
.tile-home { --tile: #ff9c69; --tile-dark: #a44d37; width: 130px; }
.tile-vehicle { --tile: #9cf0c5; --tile-dark: #3d8a71; width: 130px; }
.tile-milestone { --tile: #fff08d; --tile-dark: #9a7131; width: 132px; height: 84px; }
.tile-finish { --tile: #ffe36a; --tile-dark: #9f5f27; width: 150px; height: 94px; border-radius: 48% 48% 25px 25px; }

.shape-circle {
  width: 88px;
  height: 88px;
  border-radius: 50%;
}

.shape-gem {
  width: 100px;
  height: 88px;
  border-radius: 32px 12px 32px 12px;
}

.shape-ticket {
  width: 124px;
  border-radius: 13px 27px 13px 27px;
}

.shape-shield {
  width: 103px;
  height: 91px;
  border-radius: 38px 38px 48% 48%;
}

.branch-badge {
  position: absolute;
  z-index: 7;
  padding: 8px 15px;
  border: 3px solid #fff1a1;
  border-radius: 999px;
  color: #173d59;
  background: linear-gradient(180deg, #fffbd3, #ffd35d);
  box-shadow: 0 5px 0 #95612b, 0 12px 22px rgba(4, 32, 52, 0.3);
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.landmark {
  position: absolute;
  z-index: 5;
  width: 185px;
  text-align: center;
  filter: drop-shadow(0 18px 13px rgba(3, 31, 49, 0.3));
  pointer-events: none;
}

.landmark-icon {
  position: relative;
  z-index: 2;
  display: block;
  font-size: 76px;
  line-height: 1;
  transform: perspective(240px) rotateX(-8deg);
  animation: landmark-float 3.5s ease-in-out infinite alternate;
}

.landmark:nth-of-type(even) .landmark-icon {
  animation-delay: -1.7s;
}

@keyframes landmark-float {
  to { transform: perspective(240px) rotateX(-8deg) translateY(-8px); }
}

.landmark::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: 30px;
  right: 30px;
  bottom: 34px;
  height: 29px;
  border: 3px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: linear-gradient(180deg, #86e8d7, #28788c);
  box-shadow: 0 8px 0 #174863, 0 16px 24px rgba(2, 30, 51, 0.3);
}

.landmark span:last-child {
  position: relative;
  z-index: 3;
  margin-top: 5px;
  padding: 7px 11px;
  display: inline-block;
  border: 2px solid #fff1a5;
  border-radius: 12px;
  color: #24435d;
  background: linear-gradient(180deg, #fffbd4, #ffd65d);
  box-shadow: 0 4px 0 #9c632c;
  font-size: 11px;
  font-weight: 1000;
  text-transform: uppercase;
}

.physical-decks {
  position: absolute;
  z-index: 6;
  left: 530px;
  top: 680px;
  width: 540px;
  padding: 16px 17px 19px;
  border: 5px solid rgba(255, 246, 190, 0.88);
  border-radius: 30px;
  background: linear-gradient(155deg, rgba(26, 79, 100, 0.91), rgba(11, 52, 82, 0.93));
  box-shadow: inset 0 4px rgba(255, 255, 255, 0.2), 0 12px 0 #143653, 0 24px 38px rgba(3, 30, 48, 0.3);
  transform: perspective(600px) rotateX(5deg) rotateZ(-1deg);
}

.deck-rack-title {
  margin: 0 0 13px;
  color: #fff1a0;
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: 0.15em;
  text-align: center;
  text-transform: uppercase;
}

.deck-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 11px;
}

.deck-stack {
  --deck-color: #56d7cf;
  position: relative;
  height: 112px;
  padding: 18px 7px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(255, 255, 255, 0.8);
  border-radius: 14px 20px 14px 20px;
  color: #173a55;
  background:
    radial-gradient(circle at 24% 15%, rgba(255, 255, 255, 0.72), transparent 9%),
    linear-gradient(145deg, color-mix(in srgb, var(--deck-color) 65%, white), var(--deck-color));
  box-shadow: 3px 4px 0 #f9e7b5, 6px 8px 0 color-mix(in srgb, var(--deck-color) 55%, #244a63), 0 16px 20px rgba(0, 19, 42, 0.3);
  transform: rotate(var(--deck-rotation, 0deg));
}

.deck-stack:nth-child(2) { --deck-rotation: 1.5deg; }
.deck-stack:nth-child(3) { --deck-rotation: -1deg; }
.deck-stack:nth-child(4) { --deck-rotation: 1deg; }
.deck-stack:nth-child(5) { --deck-rotation: -1.5deg; }
.deck-stack[data-deck="Build"] { --deck-color: #ffb858; }
.deck-stack[data-deck="Community"] { --deck-color: #85dc74; }
.deck-stack[data-deck="Adventure"] { --deck-color: #a582ef; }
.deck-stack[data-deck="Surprise"] { --deck-color: #fb78ad; }

.deck-stack b {
  font-size: 26px;
  line-height: 1;
}

.deck-stack span {
  margin-top: 8px;
  font-size: 9px;
  font-weight: 1000;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.board-spinner {
  position: absolute;
  z-index: 11;
  left: 1115px;
  top: 655px;
  width: 275px;
  height: 275px;
  padding: 24px;
  border: 8px solid #fff0a0;
  border-radius: 50%;
  background: linear-gradient(145deg, #438aa1, #163f6c);
  box-shadow: inset 0 5px 8px rgba(255, 255, 255, 0.28), 0 13px 0 #173350, 0 28px 45px rgba(3, 28, 47, 0.38);
  transform: perspective(700px) rotateX(8deg);
}

.spinner-wheel {
  position: relative;
  width: 100%;
  height: 100%;
  border: 5px solid #fff8c0;
  border-radius: 50%;
  background: conic-gradient(
    #ff725f 0 45deg,
    #ffd75a 45deg 90deg,
    #63d8cc 90deg 135deg,
    #7ecf69 135deg 180deg,
    #64c8ff 180deg 225deg,
    #9a79ee 225deg 270deg,
    #fa78b1 270deg 315deg,
    #ffad54 315deg 360deg
  );
  box-shadow: inset 0 0 0 8px rgba(21, 54, 83, 0.35), inset 0 7px 11px rgba(255, 255, 255, 0.35), 0 7px 14px rgba(2, 22, 42, 0.3);
  transition: transform 1.45s cubic-bezier(0.12, 0.72, 0.17, 1);
}

.spinner-wheel::after {
  content: "✦";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 61px;
  height: 61px;
  display: grid;
  place-items: center;
  border: 5px solid #fff5ae;
  border-radius: 50%;
  color: #294260;
  background: linear-gradient(145deg, #fffbd1, #ffc842);
  box-shadow: inset 0 4px rgba(255, 255, 255, 0.62), 0 7px 0 #9b5929, 0 9px 15px rgba(2, 23, 42, 0.3);
  font-size: 25px;
  transform: translate(-50%, -50%);
}

.spinner-number {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: #17364f;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 3px 6px rgba(4, 30, 50, 0.24);
  font-size: 15px;
  font-weight: 1000;
  transform: translate(-50%, -50%) rotate(var(--number-angle)) translateY(-83px) rotate(calc(-1 * var(--number-angle)));
}

.spinner-pointer {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: -14px;
  width: 0;
  height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 42px solid #fff08a;
  filter: drop-shadow(0 5px 1px #81492e) drop-shadow(0 8px 6px rgba(2, 19, 38, 0.4));
  transform: translateX(-50%);
}

.spinner-plaque {
  position: absolute;
  left: 50%;
  bottom: -48px;
  min-width: 178px;
  padding: 8px 13px;
  border: 3px solid #fff2a1;
  border-radius: 12px;
  color: #21405a;
  background: linear-gradient(180deg, #fffbd0, #ffd258);
  box-shadow: 0 5px 0 #96582a;
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
  transform: translateX(-50%);
}

.player-token {
  --player-color: #ff6e86;
  position: absolute;
  z-index: 25;
  width: 92px;
  height: 92px;
  pointer-events: none;
  transform: translate(-50%, -81%);
  transition: left 270ms var(--ease), top 270ms var(--ease), filter 180ms var(--ease);
  filter: drop-shadow(0 12px 7px rgba(2, 24, 42, 0.38));
}

.player-token.is-current-token {
  z-index: 29;
  filter: drop-shadow(0 0 13px var(--player-color)) drop-shadow(0 13px 8px rgba(2, 24, 42, 0.42));
}

.player-token.is-moving {
  animation: token-hop 320ms ease-in-out infinite alternate;
}

@keyframes token-hop {
  to { transform: translate(-50%, -94%) rotate(-4deg) scale(1.05); }
}

.token-character {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: -7px;
  width: 63px;
  height: 63px;
  object-fit: contain;
  transform: translateX(-50%);
}

.token-vehicle {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 4px;
  height: 39px;
  border: 4px solid rgba(255, 255, 255, 0.78);
  border-radius: 24px 29px 14px 14px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--player-color) 58%, white), var(--player-color) 65%, #204b6a);
  box-shadow: inset 0 5px rgba(255, 255, 255, 0.45), 0 7px 0 color-mix(in srgb, var(--player-color) 48%, #163a55), 0 9px 14px rgba(2, 23, 42, 0.34);
}

.token-vehicle::before,
.token-vehicle::after {
  content: "";
  position: absolute;
  bottom: -10px;
  width: 20px;
  height: 20px;
  border: 4px solid #dffaff;
  border-radius: 50%;
  background: #17354f;
  box-shadow: inset 0 0 0 3px var(--player-color);
}

.token-vehicle::before { left: 8px; }
.token-vehicle::after { right: 8px; }

.vehicle-wonder-wagon .token-vehicle {
  height: 44px;
  border-radius: 20px 28px 12px 12px;
}

.vehicle-cloud-cart .token-vehicle::after {
  box-shadow: inset 0 0 0 3px #fff, 12px -15px 0 -2px rgba(255, 255, 255, 0.8);
}

.vehicle-rocket-roller .token-vehicle {
  background: linear-gradient(160deg, #fff09a, var(--player-color) 58%, #2f4f71);
}

.token-name {
  position: absolute;
  left: 50%;
  bottom: -28px;
  max-width: 110px;
  padding: 4px 8px;
  overflow: hidden;
  border: 2px solid var(--player-color);
  border-radius: 999px;
  color: #fff;
  background: rgba(6, 31, 58, 0.88);
  box-shadow: 0 4px 10px rgba(2, 19, 38, 0.3);
  font-size: 9px;
  font-weight: 1000;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateX(-50%);
}

.roster-panel {
  position: absolute;
  z-index: 35;
  left: max(12px, env(safe-area-inset-left));
  top: 14px;
  width: 265px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 23px;
  background: rgba(4, 28, 58, 0.84);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px) saturate(1.16);
}

.roster-panel-title {
  margin: 0 5px 9px;
  color: #fff18a;
  font-size: 9px;
  font-weight: 1000;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.roster-player {
  --player-color: #fff08a;
  min-height: 61px;
  padding: 6px 8px 6px 5px;
  display: grid;
  grid-template-columns: 49px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.055);
}

.roster-player + .roster-player {
  margin-top: 6px;
}

.roster-player.is-current {
  border-color: var(--player-color);
  background: linear-gradient(90deg, color-mix(in srgb, var(--player-color) 24%, transparent), rgba(255, 255, 255, 0.08));
  box-shadow: inset 0 0 0 1px var(--player-color), 0 7px 16px rgba(0, 15, 35, 0.22);
}

.roster-player img {
  width: 49px;
  height: 49px;
  object-fit: contain;
  filter: drop-shadow(0 6px 5px rgba(0, 13, 35, 0.42));
}

.roster-copy {
  min-width: 0;
}

.roster-copy strong,
.roster-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-copy strong {
  font-size: 12px;
}

.roster-copy small {
  margin-top: 3px;
  color: #cce8e9;
  font-size: 8px;
  font-weight: 850;
}

.roster-score {
  text-align: right;
}

.roster-score b,
.roster-score small {
  display: block;
}

.roster-score b {
  color: #fff08a;
  font-size: 13px;
}

.roster-score small {
  color: #cde7e9;
  font-size: 8px;
  font-weight: 850;
}

.camera-controls {
  position: absolute;
  z-index: 35;
  right: max(12px, env(safe-area-inset-right));
  top: 14px;
  padding: 7px;
  display: flex;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  background: rgba(4, 28, 58, 0.83);
  box-shadow: var(--shadow);
  backdrop-filter: blur(15px);
}

.camera-controls .icon-button {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.15);
}

.camera-controls .tool-wide {
  width: auto;
  padding: 0 12px;
  font-size: 11px;
}

.turn-console {
  position: absolute;
  z-index: 38;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  width: min(620px, calc(100% - 590px));
  min-width: 390px;
  padding: 11px 13px 11px 11px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 25px;
  background: linear-gradient(145deg, rgba(7, 42, 75, 0.94), rgba(4, 26, 59, 0.95));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.2), 0 22px 55px rgba(0, 12, 33, 0.44);
  backdrop-filter: blur(20px) saturate(1.15);
  transform: translateX(-50%);
}

.console-avatar {
  position: relative;
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border: 3px solid var(--player-color);
  border-radius: 22px;
  background: radial-gradient(circle, color-mix(in srgb, var(--player-color) 26%, transparent), rgba(255, 255, 255, 0.06));
  box-shadow: 0 0 18px color-mix(in srgb, var(--player-color) 52%, transparent), inset 0 2px rgba(255, 255, 255, 0.2);
}

.console-avatar img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  filter: drop-shadow(0 7px 5px rgba(0, 13, 35, 0.45));
}

.console-avatar span {
  position: absolute;
  right: -6px;
  bottom: -5px;
  min-width: 26px;
  height: 26px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border: 2px solid #fff4a3;
  border-radius: 999px;
  color: #213d5c;
  background: linear-gradient(180deg, #fff68c, #ffc84a);
  box-shadow: 0 3px 0 #93562b;
  font-size: 11px;
  font-weight: 1000;
}

.console-copy {
  min-width: 0;
}

.console-copy h2 {
  margin: 0;
  overflow: hidden;
  font-size: 19px;
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.console-message {
  margin: 4px 0 0;
  overflow: hidden;
  color: #d8edee;
  font-size: 10px;
  font-weight: 850;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.console-stats {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.console-stats span {
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: #e9f5ef;
  background: rgba(255, 255, 255, 0.075);
  font-size: 8px;
  font-weight: 900;
}

.spin-button {
  min-width: 138px;
}

.spin-button small,
.spin-button strong {
  display: block;
}

.spin-button small {
  font-size: 8px;
  letter-spacing: 0.12em;
}

.spin-button strong {
  margin-top: 2px;
  font-size: 15px;
}

.status-toast {
  position: absolute;
  z-index: 42;
  left: 50%;
  top: 18px;
  max-width: min(560px, calc(100% - 650px));
  padding: 10px 18px;
  border: 2px solid rgba(255, 245, 158, 0.78);
  border-radius: 999px;
  color: #24415c;
  background: linear-gradient(180deg, #fffbd1, #ffd55d);
  box-shadow: 0 6px 0 #98602c, 0 16px 28px rgba(0, 16, 38, 0.34);
  font-size: 11px;
  font-weight: 1000;
  text-align: center;
  transform: translateX(-50%);
  animation: toast-arrive 350ms var(--ease) both;
}

@keyframes toast-arrive {
  from { opacity: 0; transform: translate(-50%, -18px) scale(0.9); }
}

/* ---------- Modals and physical cards ---------- */

.modal-layer {
  position: fixed;
  z-index: 200;
  inset: 0;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  display: grid;
  place-items: center;
  overflow: auto;
  background: rgba(1, 16, 39, 0.7);
  backdrop-filter: blur(14px) saturate(0.92);
  animation: modal-fade 220ms ease-out both;
}

@keyframes modal-fade {
  from { opacity: 0; }
}

.modal-card {
  position: relative;
  width: min(680px, 100%);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  padding: clamp(21px, 3vw, 34px);
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 31px;
  background: linear-gradient(145deg, rgba(17, 66, 96, 0.98), rgba(6, 32, 65, 0.99));
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.22), 0 34px 90px rgba(0, 9, 29, 0.56);
  animation: modal-rise 340ms var(--ease) both;
}

@keyframes modal-rise {
  from { opacity: 0; transform: translateY(25px) scale(0.92); }
}

.modal-card h2 {
  margin: 0;
  font-size: clamp(27px, 4vw, 42px);
  line-height: 1;
  letter-spacing: -0.05em;
}

.modal-lead {
  margin: 10px 0 0;
  color: #d6ecec;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
}

.modal-close {
  position: absolute;
  right: 16px;
  top: 15px;
}

.choice-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.choice-card {
  --choice-color: #56d8cf;
  min-height: 185px;
  padding: 17px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 3px solid color-mix(in srgb, var(--choice-color) 65%, white);
  border-radius: 22px 30px 20px 28px;
  color: #193c55;
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 255, 255, 0.82), transparent 9%),
    linear-gradient(145deg, color-mix(in srgb, var(--choice-color) 52%, white), var(--choice-color));
  box-shadow: inset 0 4px rgba(255, 255, 255, 0.48), 0 8px 0 color-mix(in srgb, var(--choice-color) 58%, #3d5265), 0 17px 28px rgba(0, 15, 35, 0.3);
  text-align: left;
  transition: transform 180ms var(--ease), filter 180ms var(--ease);
}

.choice-card:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-5px) rotate(-0.5deg);
}

.choice-card:nth-child(even):hover:not(:disabled) {
  transform: translateY(-5px) rotate(0.5deg);
}

.choice-icon {
  font-size: 39px;
  line-height: 1;
}

.choice-card strong {
  margin-top: 12px;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.choice-card p {
  margin: 6px 0 10px;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.35;
}

.choice-card small {
  margin-top: auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  font-size: 9px;
  font-weight: 1000;
}

.choice-card.is-unaffordable {
  opacity: 0.55;
}

.safe-choice {
  margin-top: 16px;
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.09);
  font-size: 12px;
  font-weight: 950;
}

.math-problem {
  margin: 22px 0 17px;
  padding: 24px 18px;
  border: 2px solid rgba(255, 242, 153, 0.75);
  border-radius: 23px;
  color: #203d59;
  background: linear-gradient(155deg, #fffbd5, #ffe377);
  box-shadow: inset 0 4px rgba(255, 255, 255, 0.7), 0 8px 0 #a6692d;
  font-size: clamp(35px, 7vw, 58px);
  font-weight: 1000;
  letter-spacing: -0.03em;
  text-align: center;
}

.math-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 11px;
}

.math-form input {
  min-width: 0;
  min-height: 58px;
  padding: 0 17px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 17px;
  color: #fff;
  background: rgba(1, 21, 50, 0.64);
  font-size: 22px;
  font-weight: 1000;
  text-align: center;
  user-select: text;
}

.math-feedback {
  min-height: 22px;
  margin: 12px 0 0;
  color: #ffe986;
  font-size: 12px;
  font-weight: 950;
  text-align: center;
}

.physical-card-modal {
  width: min(520px, 100%);
  padding: 19px;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.drawn-card {
  --card-color: #59d7cf;
  position: relative;
  min-height: 530px;
  padding: 35px 31px 29px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 7px solid #fff5bd;
  border-radius: 31px 42px 30px 40px;
  color: #173c57;
  background:
    radial-gradient(circle at 18% 9%, rgba(255, 255, 255, 0.92) 0 9px, transparent 10px),
    linear-gradient(145deg, color-mix(in srgb, var(--card-color) 52%, white), var(--card-color));
  box-shadow: inset 0 7px 12px rgba(255, 255, 255, 0.55), 9px 12px 0 color-mix(in srgb, var(--card-color) 55%, #294d62), 0 34px 70px rgba(0, 8, 27, 0.55);
  text-align: center;
  transform: perspective(900px) rotateX(2deg) rotateZ(-1.5deg);
  animation: card-draw 650ms cubic-bezier(0.16, 0.82, 0.18, 1.12) both;
}

@keyframes card-draw {
  from { opacity: 0; transform: perspective(900px) translateY(110px) rotateX(45deg) rotateZ(8deg) scale(0.65); }
}

.drawn-card::before,
.drawn-card::after {
  content: "";
  position: absolute;
  inset: 15px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 20px 31px 20px 31px;
  pointer-events: none;
}

.drawn-card::after {
  inset: 23px;
  border-style: dashed;
  opacity: 0.42;
}

.card-deck-label {
  position: relative;
  z-index: 2;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.card-big-icon {
  position: relative;
  z-index: 2;
  margin-top: 32px;
  font-size: 85px;
  line-height: 1;
  filter: drop-shadow(0 8px 5px rgba(33, 67, 79, 0.25));
}

.drawn-card h2 {
  position: relative;
  z-index: 2;
  margin-top: 24px;
  font-size: 38px;
}

.drawn-card p {
  position: relative;
  z-index: 2;
  max-width: 340px;
  margin: 15px auto;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.4;
}

.card-reward {
  position: relative;
  z-index: 2;
  margin-top: auto;
  padding: 11px 18px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  font-weight: 1000;
}

.drawn-card .primary-button {
  position: relative;
  z-index: 2;
  width: 100%;
  margin-top: 23px;
}

.settings-players {
  margin-top: 19px;
  display: grid;
  gap: 9px;
}

.settings-player {
  padding: 9px 11px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) minmax(170px, auto);
  align-items: center;
  gap: 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.065);
}

.settings-player img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.settings-player strong,
.settings-player small {
  display: block;
}

.settings-player small {
  color: #cce8e8;
  font-size: 9px;
  font-weight: 850;
}

.settings-player select {
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 13px;
  color: #fff;
  background: #143c68;
  font-size: 11px;
  font-weight: 900;
}

.toggle-row {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.toggle-button {
  min-height: 52px;
  padding: 8px 13px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 950;
}

.toggle-button[aria-pressed="true"] {
  color: #193a55;
  background: linear-gradient(180deg, #fff18a, #ffc952);
  box-shadow: 0 5px 0 #925a2a;
}

.score-table {
  margin-top: 20px;
  display: grid;
  gap: 8px;
}

.score-row {
  padding: 9px 12px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) repeat(5, auto);
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.065);
}

.score-row.is-winner {
  color: #173b57;
  border-color: #fff5aa;
  background: linear-gradient(145deg, #fff6a3, #ffc952);
  box-shadow: 0 6px 0 #995d2b;
}

.score-row img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.score-row strong,
.score-row small {
  display: block;
}

.score-row small {
  font-size: 8px;
  font-weight: 850;
}

.score-cell {
  min-width: 45px;
  text-align: center;
  font-size: 10px;
  font-weight: 900;
}

.score-cell b {
  display: block;
  font-size: 15px;
}

.modal-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---------- Responsive ---------- */

@media (max-width: 1050px) {
  .setup-main {
    grid-template-columns: 1fr;
    width: min(820px, calc(100% - 28px));
    padding-top: 20px;
  }

  .setup-intro {
    padding-top: 4px;
  }

  .setup-intro h1 {
    font-size: clamp(43px, 8vw, 70px);
  }

  .setup-intro > p:last-of-type {
    margin-bottom: 14px;
  }

  .game-header .logo-copy,
  .game-header .game-header-center {
    display: none;
  }

  .turn-console {
    width: min(590px, calc(100% - 28px));
    min-width: 0;
  }

  .roster-panel {
    width: min(470px, calc(100% - 160px));
    padding: 7px;
    display: flex;
    gap: 5px;
    overflow-x: auto;
  }

  .roster-panel-title {
    display: none;
  }

  .roster-player {
    min-width: 105px;
    min-height: 53px;
    grid-template-columns: 41px minmax(0, 1fr);
    padding: 4px;
  }

  .roster-player img {
    width: 41px;
    height: 41px;
  }

  .roster-score {
    display: none;
  }

  .status-toast {
    top: 78px;
    max-width: calc(100% - 28px);
  }
}

@media (max-width: 760px) {
  .setup-header,
  .game-header {
    min-height: 62px;
    padding-inline: 10px;
  }

  .setup-header .logo-copy,
  .setup-header .header-label,
  .game-header-actions .button-label {
    display: none;
  }

  .logo-gem,
  .game-header .logo-gem {
    width: 42px;
    height: 42px;
    font-size: 22px;
  }

  .setup-main {
    width: min(100% - 20px, 680px);
  }

  .setup-intro h1 {
    font-size: clamp(39px, 13vw, 59px);
  }

  .setup-intro > p:last-of-type {
    font-size: 14px;
  }

  .feature-ribbon span:nth-child(n + 4) {
    display: none;
  }

  .setup-panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .setup-player-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .character-picker {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .math-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .setup-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .setup-footer .primary-button {
    width: 100%;
  }

  .now-playing {
    min-width: 0;
    padding-right: 10px;
  }

  .now-playing-avatar {
    width: 42px;
    height: 42px;
  }

  .now-playing-avatar img {
    width: 41px;
    height: 41px;
  }

  .now-playing-copy strong {
    max-width: 95px;
    font-size: 13px;
  }

  .game-header-actions .glass-button {
    width: 44px;
    padding: 0;
    display: grid;
    place-items: center;
  }

  .roster-panel {
    top: 9px;
    width: calc(100% - 122px);
  }

  .camera-controls {
    top: 8px;
    flex-direction: column;
  }

  .camera-controls .tool-wide {
    width: 44px;
    padding: 0;
    font-size: 0;
  }

  .camera-controls .tool-wide::before {
    content: attr(data-short);
    font-size: 14px;
  }

  .turn-console {
    grid-template-columns: 55px minmax(0, 1fr) 104px;
    gap: 8px;
    padding: 8px;
    border-radius: 20px;
  }

  .console-avatar {
    width: 54px;
    height: 54px;
    border-radius: 17px;
  }

  .console-avatar img {
    width: 57px;
    height: 57px;
  }

  .console-copy h2 {
    font-size: 15px;
  }

  .console-message {
    font-size: 9px;
  }

  .console-stats span:nth-child(n + 4) {
    display: none;
  }

  .spin-button {
    min-width: 0;
    min-height: 55px;
    padding: 0 9px;
    border-radius: 15px;
  }

  .spin-button strong {
    font-size: 12px;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }

  .choice-card {
    min-height: 148px;
  }

  .settings-player {
    grid-template-columns: 45px minmax(0, 1fr);
  }

  .settings-player img {
    width: 45px;
    height: 45px;
  }

  .settings-player select {
    grid-column: 1 / -1;
    width: 100%;
  }

  .score-row {
    grid-template-columns: 42px minmax(0, 1fr) repeat(2, auto);
  }

  .score-row img {
    width: 42px;
    height: 42px;
  }

  .score-cell:nth-last-child(n + 3) {
    display: none;
  }

  .drawn-card {
    min-height: min(520px, calc(100dvh - 50px));
  }
}

@media (max-width: 430px) {
  .setup-panel,
  .modal-card {
    border-radius: 23px;
  }

  .player-editor,
  .setup-panel-head,
  .setup-footer {
    padding-inline: 15px;
  }

  .name-row {
    grid-template-columns: 1fr;
  }

  .random-name-button {
    width: 100%;
  }

  .turn-console {
    grid-template-columns: 47px minmax(0, 1fr) 92px;
  }

  .console-avatar {
    width: 47px;
    height: 47px;
  }

  .console-avatar img {
    width: 50px;
    height: 50px;
  }

  .console-kicker,
  .console-stats {
    display: none;
  }

  .drawn-card {
    padding: 28px 22px 24px;
  }

  .card-big-icon {
    margin-top: 25px;
    font-size: 69px;
  }

  .drawn-card h2 {
    font-size: 32px;
  }

  .math-form {
    grid-template-columns: 1fr;
  }

  .toggle-row {
    grid-template-columns: 1fr;
  }
}

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

/* ========================================================================== */
/* Clarity pass: the board is one connected journey; play controls live in a */
/* dedicated console instead of competing with the route.                    */
/* ========================================================================== */

.quest-purpose {
  max-width: 600px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.quest-purpose span {
  min-height: 44px;
  padding: 8px 11px 8px 8px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  background: rgba(3, 29, 57, 0.7);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.14);
  font-size: 11px;
  font-weight: 950;
  backdrop-filter: blur(12px);
}

.quest-purpose b {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  color: #1e405d;
  background: linear-gradient(145deg, #fff7a5, #ffc94d);
  box-shadow: 0 3px 0 #925a2c;
}

.resume-banner {
  padding: 13px 15px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(100deg, rgba(75, 215, 194, 0.2), rgba(255, 210, 82, 0.1));
}

.resume-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 2px solid #fff3a2;
  border-radius: 15px;
  color: #1c405e;
  background: linear-gradient(145deg, #fff7a4, #ffc74b);
  box-shadow: 0 4px 0 #925a2c;
  font-size: 25px;
  font-weight: 1000;
}

.resume-copy {
  min-width: 0;
}

.resume-copy strong,
.resume-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resume-copy strong {
  font-size: 14px;
}

.resume-copy small {
  margin-top: 3px;
  color: #cce9e8;
  font-size: 9px;
  font-weight: 850;
}

.resume-button {
  min-height: 46px;
  padding-inline: 17px;
  font-size: 11px;
}

.game-stage-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 26vw, 360px);
  overflow: hidden;
  background: #061d38;
}

.board-pane {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.board-pane .board-viewport {
  position: absolute;
  inset: 0;
}

.board-canvas::before {
  z-index: 1;
  background:
    linear-gradient(rgba(9, 67, 77, 0.14), rgba(8, 49, 74, 0.18)),
    radial-gradient(circle at 12% 88%, rgba(255, 221, 99, 0.16), transparent 14%),
    radial-gradient(circle at 83% 52%, rgba(144, 255, 225, 0.12), transparent 18%);
  mix-blend-mode: normal;
}

.board-title-plaque {
  left: 805px;
  top: 39px;
  width: 490px;
  height: 82px;
  padding: 12px 24px;
  border-width: 3px;
  border-radius: 28px 34px 26px 36px;
  box-shadow: inset 0 4px rgba(255, 255, 255, 0.72), 0 7px 0 #a9632e, 0 15px 28px rgba(4, 34, 57, 0.28);
}

.board-title-plaque strong {
  font-size: 29px;
}

.board-title-plaque small {
  margin-top: 5px;
  font-size: 9px;
}

.path-shadow {
  stroke: rgba(15, 47, 58, 0.58);
  stroke-width: 58;
  transform: translateY(8px);
}

.path-ribbon {
  stroke: rgba(255, 249, 213, 0.96);
  stroke-width: 46;
}

.path-stitch {
  stroke: rgba(39, 96, 97, 0.5);
  stroke-dasharray: 6 14;
  stroke-width: 5;
}

.path-ribbon.branch-learn { stroke: #c9fbf2; }
.path-ribbon.branch-build { stroke: #ffe0a3; }
.path-ribbon.branch-community { stroke: #d3f8bd; }
.path-ribbon.branch-adventure { stroke: #e4d6ff; }
.path-stitch.branch-learn { stroke: #289a9a; }
.path-stitch.branch-build { stroke: #bd7136; }
.path-stitch.branch-community { stroke: #4c945b; }
.path-stitch.branch-adventure { stroke: #7456aa; }

.board-space {
  width: 78px;
  height: 56px;
  padding: 5px 6px 7px;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr;
  gap: 4px;
  border-width: 3px;
  border-radius: 17px 21px 16px 20px;
  box-shadow:
    inset 0 3px 6px rgba(255, 255, 255, 0.5),
    inset 0 -6px 9px color-mix(in srgb, var(--tile-dark) 42%, transparent),
    0 5px 0 var(--tile-dark),
    0 10px 14px rgba(5, 36, 54, 0.23);
}

.board-space::after {
  inset: 5px;
}

.board-space:hover {
  transform: translate(-50%, -59%) rotate(var(--rotation)) scale(1.14);
}

.space-number {
  grid-row: auto;
  align-self: center;
  padding: 2px 5px;
  font-size: 10px;
}

.space-icon {
  align-self: center;
  justify-self: center;
  font-size: 19px;
}

.space-name {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: calc(100% + 9px);
  max-width: 128px;
  padding: 5px 8px;
  border: 2px solid rgba(255, 244, 168, 0.9);
  border-radius: 999px;
  color: #fff;
  background: rgba(5, 38, 65, 0.94);
  box-shadow: 0 5px 10px rgba(2, 23, 41, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -4px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.board-space:hover .space-name,
.board-space.is-current .space-name,
.board-space.has-player .space-name {
  opacity: 1;
  transform: translate(-50%, 0);
}

.tile-payday,
.tile-career,
.tile-home,
.tile-vehicle,
.tile-milestone {
  width: 101px;
  height: 64px;
}

.tile-finish {
  width: 125px;
  height: 78px;
}

.tile-payday .space-name,
.tile-career .space-name,
.tile-home .space-name,
.tile-vehicle .space-name,
.tile-milestone .space-name,
.tile-finish .space-name {
  position: static;
  max-width: none;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  color: #163a55;
  background: none;
  box-shadow: none;
  opacity: 1;
  text-overflow: ellipsis;
  transform: none;
}

.tile-payday,
.tile-career,
.tile-home,
.tile-vehicle,
.tile-milestone,
.tile-finish {
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr auto;
}

.tile-payday .space-number,
.tile-career .space-number,
.tile-home .space-number,
.tile-vehicle .space-number,
.tile-milestone .space-number,
.tile-finish .space-number {
  grid-row: 1 / span 2;
  align-self: start;
}

.shape-circle {
  width: 62px;
  height: 62px;
}

.shape-gem {
  width: 72px;
  height: 60px;
  border-radius: 23px 10px 23px 10px;
}

.shape-ticket {
  width: 84px;
  border-radius: 10px 19px 10px 19px;
}

.shape-shield {
  width: 68px;
  height: 64px;
  border-radius: 26px 26px 44% 44%;
}

.branch-badge {
  z-index: 10;
  padding: 6px 11px;
  border-width: 2px;
  box-shadow: 0 4px 0 #8f5b2d, 0 9px 16px rgba(4, 32, 52, 0.24);
  font-size: 8px;
}

.landmark {
  width: 140px;
  opacity: 0.9;
}

.landmark-icon {
  font-size: 55px;
}

.landmark::before {
  left: 28px;
  right: 28px;
  bottom: 29px;
  height: 22px;
}

.landmark span:last-child {
  margin-top: 3px;
  padding: 5px 8px;
  border-width: 1px;
  font-size: 8px;
}

.physical-decks,
.board-spinner {
  display: none;
}

.player-token {
  width: 150px;
  height: 150px;
  transform: translate(-50%, -78%);
  filter: drop-shadow(0 16px 10px rgba(2, 24, 42, 0.42));
}

.player-token.is-current-token {
  z-index: 31;
  filter: drop-shadow(0 0 18px var(--player-color)) drop-shadow(0 18px 11px rgba(2, 24, 42, 0.48));
  transform: translate(-50%, -78%) scale(1.23);
}

.token-character {
  top: -11px;
  width: 105px;
  height: 105px;
}

.token-vehicle {
  left: 10px;
  right: 10px;
  bottom: 7px;
  height: 61px;
  border-width: 5px;
  border-radius: 34px 42px 20px 20px;
  box-shadow: inset 0 7px rgba(255, 255, 255, 0.45), 0 9px 0 color-mix(in srgb, var(--player-color) 48%, #163a55), 0 12px 18px rgba(2, 23, 42, 0.34);
}

.token-vehicle::before,
.token-vehicle::after {
  bottom: -14px;
  width: 29px;
  height: 29px;
  border-width: 5px;
}

.token-vehicle::before { left: 14px; }
.token-vehicle::after { right: 14px; }

.token-name {
  bottom: -39px;
  max-width: 145px;
  padding: 6px 10px;
  font-size: 11px;
}

.player-token.is-moving {
  animation: token-hop-large 320ms ease-in-out infinite alternate;
}

.player-token.is-current-token.is-moving {
  animation: token-hop-current 320ms ease-in-out infinite alternate;
}

@keyframes token-hop-large {
  to { transform: translate(-50%, -90%) rotate(-3deg) scale(1.05); }
}

@keyframes token-hop-current {
  to { transform: translate(-50%, -91%) rotate(-3deg) scale(1.29); }
}

.side-console {
  position: relative;
  z-index: 40;
  min-width: 0;
  min-height: 0;
  padding: 11px 12px 16px;
  overflow: auto;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  background:
    radial-gradient(circle at 50% 10%, color-mix(in srgb, var(--player-color) 14%, transparent), transparent 29%),
    linear-gradient(165deg, rgba(10, 47, 78, 0.99), rgba(4, 27, 58, 0.99));
  box-shadow: -18px 0 45px rgba(0, 14, 36, 0.28), inset 1px 0 rgba(255, 255, 255, 0.08);
  scrollbar-width: thin;
}

.console-collapse {
  display: none;
}

.goal-card {
  min-height: 70px;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(255, 238, 142, 0.55);
  border-radius: 17px;
  color: #24415a;
  background: linear-gradient(145deg, #fffbd2, #ffdc68);
  box-shadow: inset 0 3px rgba(255, 255, 255, 0.62), 0 5px 0 #925c2d, 0 12px 22px rgba(0, 18, 39, 0.25);
}

.goal-card > span {
  font-size: 33px;
}

.goal-card small,
.goal-card strong,
.goal-card p {
  display: block;
}

.goal-card small {
  font-size: 8px;
  font-weight: 1000;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.goal-card strong {
  font-size: 13px;
  line-height: 1.1;
}

.goal-card p {
  margin: 3px 0 0;
  font-size: 8px;
  font-weight: 850;
  line-height: 1.25;
}

.side-current {
  min-height: 102px;
  margin-top: 10px;
  padding: 7px 8px 7px 5px;
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid color-mix(in srgb, var(--player-color) 70%, white 12%);
  border-radius: 21px;
  background: linear-gradient(110deg, color-mix(in srgb, var(--player-color) 20%, rgba(255, 255, 255, 0.06)), rgba(255, 255, 255, 0.055));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.17), 0 10px 22px rgba(0, 17, 40, 0.2);
}

.side-avatar {
  position: relative;
  width: 90px;
  height: 90px;
  display: grid;
  place-items: center;
  border: 3px solid var(--player-color);
  border-radius: 28px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.04));
  box-shadow: 0 0 19px color-mix(in srgb, var(--player-color) 48%, transparent), inset 0 2px rgba(255, 255, 255, 0.2);
}

.side-avatar img {
  width: 94px;
  height: 94px;
  object-fit: contain;
  filter: drop-shadow(0 8px 6px rgba(0, 13, 35, 0.45));
}

.side-avatar span {
  position: absolute;
  right: -5px;
  bottom: -4px;
  min-width: 29px;
  height: 29px;
  padding-inline: 5px;
  display: grid;
  place-items: center;
  border: 2px solid #fff4a3;
  border-radius: 999px;
  color: #213d5c;
  background: linear-gradient(180deg, #fff68c, #ffc84a);
  box-shadow: 0 3px 0 #93562b;
  font-size: 11px;
  font-weight: 1000;
}

.side-current-copy {
  min-width: 0;
}

.side-current-copy h2 {
  margin: 0;
  overflow: hidden;
  font-size: 21px;
  letter-spacing: -0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-current-copy p:last-child {
  margin: 4px 0 0;
  display: -webkit-box;
  overflow: hidden;
  color: #d8edee;
  font-size: 9px;
  font-weight: 850;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.journey-progress {
  margin-top: 9px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
}

.journey-progress > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 9px;
  font-weight: 950;
}

.journey-progress > div span {
  color: #cce7e8;
}

.progress-track {
  height: 9px;
  margin-top: 6px;
  display: block;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(0, 16, 39, 0.52);
}

.progress-track i {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--player-color), #fff081);
  box-shadow: 0 0 10px var(--player-color);
  transition: width 350ms var(--ease);
}

.side-spinner-wrap {
  margin-top: 8px;
  padding: 8px;
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 19px;
  background: rgba(2, 24, 52, 0.38);
}

.console-spinner {
  position: relative;
  width: 148px;
  height: 148px;
  min-height: 148px;
  padding: 11px;
  border: 5px solid #fff0a0;
  border-radius: 50%;
  color: inherit;
  background: linear-gradient(145deg, #438aa1, #163f6c);
  box-shadow: inset 0 4px 6px rgba(255, 255, 255, 0.26), 0 7px 0 #173350, 0 15px 24px rgba(3, 28, 47, 0.34);
}

.console-spinner .spinner-wheel {
  border-width: 3px;
}

.console-spinner .spinner-wheel::after {
  width: 42px;
  height: 42px;
  border-width: 3px;
  box-shadow: inset 0 3px rgba(255, 255, 255, 0.62), 0 4px 0 #9b5929, 0 6px 10px rgba(2, 23, 42, 0.28);
  font-size: 18px;
}

.console-spinner .spinner-number {
  width: 23px;
  height: 23px;
  font-size: 10px;
  transform: translate(-50%, -50%) rotate(var(--number-angle)) translateY(-50px) rotate(calc(-1 * var(--number-angle)));
}

.console-spinner .spinner-pointer {
  top: -9px;
  border-left-width: 11px;
  border-right-width: 11px;
  border-top-width: 27px;
}

.console-spinner .spinner-plaque {
  bottom: -18px;
  min-width: 114px;
  padding: 4px 8px;
  border-width: 2px;
  font-size: 7px;
}

.side-spinner-wrap .spin-button {
  min-width: 0;
  min-height: 72px;
  padding-inline: 8px;
  border-radius: 16px;
}

.side-spinner-wrap .spin-button strong {
  font-size: 13px;
}

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

.console-stats span {
  min-height: 37px;
  padding: 5px 7px;
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 11px;
  color: #d7ecec;
  background: rgba(255, 255, 255, 0.06);
  font-size: 8px;
  font-weight: 850;
}

.console-stats b {
  color: #fff18a;
  font-size: 11px;
}

.side-section-heading {
  margin-bottom: 7px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.side-section-heading strong {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.side-section-heading small {
  color: #bcdde0;
  font-size: 7px;
  font-weight: 850;
}

.side-decks {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.mini-deck-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.mini-deck {
  min-width: 0;
  min-height: 57px;
  padding: 5px 2px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 9px 13px 9px 13px;
  color: #153950;
  background: linear-gradient(145deg, color-mix(in srgb, var(--deck-color) 55%, white), var(--deck-color));
  box-shadow: 2px 3px 0 color-mix(in srgb, var(--deck-color) 48%, #244a63), 0 7px 10px rgba(0, 18, 38, 0.22);
  transition: transform 150ms var(--ease), filter 150ms var(--ease);
}

.mini-deck:hover {
  filter: brightness(1.06);
  transform: translateY(-3px) rotate(-1deg);
}

.mini-deck b,
.mini-deck span {
  display: block;
}

.mini-deck b {
  font-size: 16px;
}

.mini-deck span {
  margin-top: 4px;
  overflow: hidden;
  font-size: 6px;
  font-weight: 1000;
  text-overflow: ellipsis;
  text-transform: uppercase;
}

.latest-card {
  --card-color: #7adacb;
  min-height: 55px;
  margin-top: 9px;
  padding: 7px 9px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 2px solid rgba(255, 255, 255, 0.65);
  border-radius: 13px 18px 13px 18px;
  color: #173a55;
  background: linear-gradient(145deg, color-mix(in srgb, var(--card-color) 55%, white), var(--card-color));
  box-shadow: 3px 4px 0 color-mix(in srgb, var(--card-color) 45%, #274d65), 0 9px 15px rgba(0, 18, 38, 0.23);
}

.latest-card.empty {
  color: #d9eeee;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: none;
}

.latest-card > span {
  font-size: 28px;
  text-align: center;
}

.latest-card strong,
.latest-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.latest-card strong {
  font-size: 10px;
}

.latest-card small {
  margin-bottom: 2px;
  font-size: 7px;
  font-weight: 900;
  text-transform: uppercase;
}

.console-roster {
  margin-top: 11px;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.console-roster .roster-player {
  min-height: 46px;
  grid-template-columns: 39px minmax(0, 1fr) auto;
  padding: 3px 6px 3px 3px;
  border-radius: 12px;
}

.console-roster .roster-player + .roster-player {
  margin-top: 4px;
}

.console-roster .roster-player img {
  width: 39px;
  height: 39px;
}

.console-roster .roster-copy strong {
  font-size: 10px;
}

.console-roster .roster-copy small,
.console-roster .roster-score small {
  font-size: 7px;
}

.console-roster .roster-score b {
  font-size: 10px;
}

.board-pane .camera-controls {
  right: 12px;
  top: 12px;
}

.board-pane .status-toast {
  top: 15px;
  max-width: calc(100% - 470px);
}

.deck-preview-row {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.deck-preview-row span {
  min-height: 110px;
  padding: 14px 9px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  border: 3px solid rgba(255, 255, 255, 0.7);
  border-radius: 17px 23px 17px 23px;
  color: #193b55;
  background: linear-gradient(145deg, color-mix(in srgb, var(--deck-color) 55%, white), var(--deck-color));
  box-shadow: 4px 5px 0 color-mix(in srgb, var(--deck-color) 45%, #284d64);
  text-align: center;
}

.deck-preview-row b {
  font-size: 32px;
}

.deck-preview-row small {
  font-size: 9px;
  font-weight: 950;
}

@media (max-width: 1100px) {
  .game-stage-wrap {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) 225px;
  }

  .side-console {
    height: 225px;
    padding: 8px 10px 10px;
    display: grid;
    grid-template-columns: 220px minmax(180px, 1fr) 230px 205px;
    grid-template-rows: 56px minmax(0, 1fr);
    gap: 7px 9px;
    overflow: hidden;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-left: 0;
    box-shadow: 0 -16px 38px rgba(0, 14, 36, 0.3);
  }

  .goal-card {
    grid-column: 1 / 4;
    grid-row: 1;
    min-height: 54px;
    grid-template-columns: 31px minmax(0, 1fr);
    padding: 6px 9px;
  }

  .goal-card > span { font-size: 25px; }
  .goal-card strong { font-size: 11px; }
  .goal-card p { white-space: nowrap; }

  .side-current {
    grid-column: 1;
    grid-row: 2;
    min-height: 0;
    height: 141px;
    margin: 0;
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .side-avatar {
    width: 80px;
    height: 80px;
  }

  .side-avatar img {
    width: 84px;
    height: 84px;
  }

  .journey-progress {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
    margin: 0;
  }

  .console-stats {
    grid-column: 2;
    grid-row: 2;
    align-self: end;
    margin: 0;
  }

  .side-decks {
    grid-column: 3;
    grid-row: 2;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .mini-deck-row {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .mini-deck-row::-webkit-scrollbar {
    display: none;
  }

  .mini-deck {
    min-width: 44px;
    flex: 1 0 44px;
  }

  .latest-card {
    grid-column: 3;
    grid-row: 2;
    align-self: end;
    margin: 0;
    min-height: 51px;
  }

  .console-roster {
    display: none;
  }

  .side-spinner-wrap {
    grid-column: 4;
    grid-row: 1 / 3;
    margin: 0;
    padding: 5px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
  }

  .console-spinner {
    width: 125px;
    height: 125px;
    min-height: 125px;
    padding: 9px;
  }

  .console-spinner .spinner-number {
    transform: translate(-50%, -50%) rotate(var(--number-angle)) translateY(-41px) rotate(calc(-1 * var(--number-angle)));
  }

  .console-spinner .spinner-plaque {
    display: none;
  }

  .side-spinner-wrap .spin-button {
    width: 100%;
    min-height: 48px;
  }

  .board-pane .status-toast {
    top: 72px;
    max-width: calc(100% - 28px);
  }
}

@media (max-width: 900px) and (min-width: 761px) {
  .side-console {
    grid-template-columns: 195px minmax(170px, 1fr) 195px 170px;
  }

  .side-section-heading small,
  .goal-card p,
  .latest-card small {
    display: none;
  }

  .mini-deck span {
    display: none;
  }
}

@media (max-width: 760px) {
  .game-stage-wrap {
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .side-console {
    position: relative;
    height: min(54vh, 470px);
    padding: 9px 10px max(10px, env(safe-area-inset-bottom));
    display: block;
    overflow-y: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
  }

  .console-collapse {
    position: sticky;
    z-index: 8;
    float: right;
    right: 0;
    top: 0;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 20px;
    font-weight: 1000;
  }

  .goal-card {
    margin-right: 50px;
  }

  .side-current {
    clear: both;
    min-height: 96px;
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .side-avatar {
    width: 80px;
    height: 80px;
  }

  .side-avatar img {
    width: 84px;
    height: 84px;
  }

  .side-spinner-wrap {
    display: grid;
    grid-template-columns: 125px minmax(0, 1fr);
  }

  .console-spinner {
    width: 116px;
    height: 116px;
    min-height: 116px;
  }

  .console-spinner .spinner-number {
    transform: translate(-50%, -50%) rotate(var(--number-angle)) translateY(-37px) rotate(calc(-1 * var(--number-angle)));
  }

  .console-roster {
    display: block;
  }

  .side-console.is-collapsed {
    height: 145px;
    padding: 7px 8px max(8px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
    grid-template-rows: 93px 31px;
    gap: 5px 7px;
    overflow: hidden;
  }

  .side-console.is-collapsed .console-collapse {
    position: absolute;
    right: 5px;
    top: 4px;
    width: 44px;
    height: 38px;
  }

  .side-console.is-collapsed .goal-card,
  .side-console.is-collapsed .console-stats,
  .side-console.is-collapsed .side-decks,
  .side-console.is-collapsed .latest-card,
  .side-console.is-collapsed .console-roster {
    display: none;
  }

  .side-console.is-collapsed .side-current {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    height: 93px;
    min-height: 0;
    margin: 0;
    padding: 4px;
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .side-console.is-collapsed .side-avatar {
    width: 80px;
    height: 80px;
  }

  .side-console.is-collapsed .side-avatar img {
    width: 84px;
    height: 84px;
  }

  .side-console.is-collapsed .side-current-copy {
    padding-right: 31px;
  }

  .side-console.is-collapsed .side-current-copy h2 {
    font-size: 16px;
  }

  .side-console.is-collapsed .journey-progress {
    grid-column: 1;
    grid-row: 2;
    margin: 0;
    padding: 3px 7px;
  }

  .side-console.is-collapsed .journey-progress > div {
    font-size: 7px;
  }

  .side-console.is-collapsed .progress-track {
    height: 6px;
    margin-top: 2px;
  }

  .side-console.is-collapsed .side-spinner-wrap {
    grid-column: 2;
    grid-row: 1 / 3;
    height: 129px;
    margin: 0;
    padding: 4px;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
  }

  .side-console.is-collapsed .console-spinner {
    display: none;
  }

  .side-console.is-collapsed .spin-button {
    min-height: 78px;
    margin-top: 35px;
    padding: 5px;
  }

  .board-pane .camera-controls {
    top: 8px;
  }

  .resume-banner {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .resume-banner .resume-button,
  .resume-banner > .glass-button {
    grid-column: span 1;
    width: 100%;
  }
}

@media (max-width: 430px) {
  .quest-purpose {
    grid-template-columns: 1fr;
  }

  .quest-purpose span:nth-child(n + 4) {
    display: none;
  }

  .resume-banner {
    grid-template-columns: 1fr;
  }

  .resume-icon {
    display: none;
  }

  .resume-copy strong,
  .resume-copy small {
    white-space: normal;
  }
}

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