:root {
  --ink: #17213d;
  --ink-soft: #5d6782;
  --glass: rgba(255, 255, 255, .48);
  --glass-strong: rgba(255, 255, 255, .68);
  --line: rgba(255, 255, 255, .72);
  --line-dark: rgba(62, 67, 108, .22);
  --purple: #7669f7;
  --purple-dark: #4e45bf;
  --cyan: #54d8e8;
  --pink: #ff79b6;
  --yellow: #ffd86a;
  --turn-color: #5ccf78;
  font-family: Inter, ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: #efeefe;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 222, 164, .88), transparent 34%),
    radial-gradient(circle at 88% 12%, rgba(170, 232, 255, .92), transparent 32%),
    radial-gradient(circle at 78% 88%, rgba(255, 186, 221, .78), transparent 34%),
    linear-gradient(135deg, #e9e8ff 0%, #f7f1ff 42%, #e8fbff 100%);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(77, 71, 190, .26);
  outline-offset: 2px;
}

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

[hidden] {
  display: none !important;
}

.pastel-field {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.pastel-orb {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, .68);
  border-radius: 50%;
  opacity: .62;
}

.pastel-orb--one {
  width: 26vw;
  height: 26vw;
  min-width: 220px;
  min-height: 220px;
  left: -8vw;
  top: 18vh;
  background: linear-gradient(145deg, rgba(255, 255, 255, .34), rgba(255, 150, 198, .18));
}

.pastel-orb--two {
  width: 18vw;
  height: 18vw;
  min-width: 170px;
  min-height: 170px;
  right: 4vw;
  top: 8vh;
  background: linear-gradient(145deg, rgba(255, 255, 255, .34), rgba(87, 216, 234, .16));
}

.pastel-orb--three {
  width: 30vw;
  height: 30vw;
  min-width: 260px;
  min-height: 260px;
  right: -10vw;
  bottom: -15vw;
  background: linear-gradient(145deg, rgba(255, 255, 255, .3), rgba(123, 107, 247, .14));
}

.glass-outline {
  border: 1px solid var(--line);
  outline: 1px solid rgba(62, 67, 108, .09);
  outline-offset: -2px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .66), rgba(255, 255, 255, .34));
  backdrop-filter: blur(22px) saturate(135%);
  -webkit-backdrop-filter: blur(22px) saturate(135%);
}

.eyebrow {
  display: inline-block;
  color: #5d54c8;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.splash-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #eceaff, #fff1fa 54%, #e8fbff);
}

.splash-card {
  width: min(390px, 100%);
  padding: 34px;
  border-radius: 34px;
  text-align: center;
}

.splash-gate__logo {
  width: 150px;
  height: 150px;
  object-fit: contain;
}

.splash-card h1 {
  margin: 4px 0 8px;
  font-size: clamp(2.2rem, 8vw, 3.2rem);
  letter-spacing: -.06em;
}

.splash-card p {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 750;
}

.splash-gate__track {
  height: 8px;
  margin-top: 24px;
  overflow: hidden;
  border: 1px solid rgba(72, 66, 160, .16);
  border-radius: 999px;
  background: rgba(255, 255, 255, .52);
}

.splash-gate__bar {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--purple), var(--pink), var(--cyan));
}

.splash-gate__percent {
  display: block;
  margin-top: 9px;
  color: #574fc1;
  font-size: .78rem;
}

.arena-app {
  position: relative;
  z-index: 2;
  width: min(1540px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px;
}

.arena-header {
  min-height: 72px;
  padding: 10px 12px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.brand-lockup img {
  width: 51px;
  height: 51px;
  object-fit: contain;
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
}

.brand-lockup strong {
  font-size: 1.02rem;
  letter-spacing: -.03em;
}

.brand-lockup small {
  margin-top: 1px;
  color: var(--ink-soft);
  font-size: .72rem;
  font-weight: 700;
}

.arena-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.line-button,
.round-button,
.outline-action,
.solid-action,
.segmented-choice button {
  border: 1px solid rgba(76, 72, 145, .2);
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.line-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .42);
  font-weight: 850;
}

.round-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, .5);
  font-size: 1.05rem;
  font-weight: 900;
}

.outline-action {
  min-height: 50px;
  padding: 0 19px;
  border-radius: 17px;
  background: rgba(255, 255, 255, .4);
  font-weight: 900;
}

.solid-action {
  min-height: 52px;
  padding: 0 20px;
  border-color: rgba(67, 59, 166, .28);
  border-radius: 18px;
  background: linear-gradient(135deg, #6e64ef, #8e72f7 52%, #5fcde5);
  color: #fff;
  font-weight: 950;
  letter-spacing: -.01em;
}

.solid-action b {
  font-size: 1.25rem;
}

.solid-action:active,
.outline-action:active,
.line-button:active,
.round-button:active,
.segmented-choice button:active {
  transform: scale(.98);
}

.view-panel {
  display: none;
  padding-top: 14px;
}

.view-panel--active {
  display: block;
  animation: viewIn .32s ease both;
}

.lobby-stage {
  min-height: calc(100vh - 116px);
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(350px, .62fr);
  overflow: hidden;
  border-radius: 32px;
}

.lobby-preview {
  position: relative;
  min-width: 0;
  padding: clamp(22px, 4vw, 58px);
  display: grid;
  grid-template-columns: minmax(240px, .64fr) minmax(360px, 1fr);
  align-items: center;
  gap: clamp(16px, 3vw, 46px);
  border-right: 1px solid rgba(255, 255, 255, .74);
  background:
    radial-gradient(circle at 10% 15%, rgba(255, 216, 106, .34), transparent 35%),
    radial-gradient(circle at 90% 12%, rgba(83, 216, 232, .22), transparent 31%),
    linear-gradient(135deg, rgba(255, 255, 255, .25), rgba(255, 255, 255, .08));
}

.play-intro h1 {
  margin: 11px 0 15px;
  font-size: clamp(1rem, 3.2vw, 4rem);
  line-height: .92;
  letter-spacing: -.075em;
}

.play-intro h1 em {
  color: #6659d5;
  font-style: normal;
}

.play-intro p {
  max-width: 520px;
  margin: 0;
  color: var(--ink-soft);
  font-size: clamp(.98rem, 1.2vw, 1.12rem);
  line-height: 1.65;
}

.preview-frame {
  position: relative;
  width: min(100%, 690px);
  margin: auto;
  padding: clamp(9px, 1.2vw, 15px);
  border: 1px solid rgba(255, 255, 255, .84);
  border-radius: 34px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .58), rgba(255, 255, 255, .24));
}

.preview-frame::before {
  content: "";
  position: absolute;
  inset: 7px;
  z-index: 0;
  border: 1px solid rgba(70, 66, 132, .12);
  border-radius: 27px;
  pointer-events: none;
}

.preview-frame canvas {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  display: block;
  border-radius: 24px;
}

.preview-chip {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, .86);
  border-radius: 999px;
  background: rgba(255, 255, 255, .73);
  color: #3f4660;
  font-size: .78rem;
  font-weight: 900;
  backdrop-filter: blur(12px);
}

.preview-chip span {
  color: #675dd7;
}

.preview-chip--ai {
  top: 8%;
  right: -12px;
}

.preview-chip--save {
  bottom: 8%;
  left: -12px;
}

.match-builder {
  align-self: stretch;
  padding: clamp(24px, 3.4vw, 48px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(160deg, rgba(255, 255, 255, .48), rgba(255, 255, 255, .2));
}

.section-title h2 {
  margin: 8px 0 6px;
  font-size: clamp(2rem, 3.4vw, 3.25rem);
  line-height: 1;
  letter-spacing: -.055em;
}

.section-title p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.choice-block {
  margin-top: 23px;
}

.choice-block>label,
.choice-block__label-row label {
  font-size: .84rem;
  font-weight: 900;
}

.choice-block__label-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 9px;
}

.choice-block__label-row small {
  color: #777f99;
  font-size: .72rem;
  font-weight: 750;
}

.segmented-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.segmented-choice button {
  min-height: 54px;
  padding: 0 12px;
  border-radius: 17px;
  background: rgba(255, 255, 255, .36);
  color: #4c5570;
  font-weight: 850;
}

.segmented-choice button span {
  display: inline-grid;
  place-items: center;
  min-width: 25px;
  height: 25px;
  margin-right: 5px;
  border: 1px solid rgba(72, 65, 157, .16);
  border-radius: 9px;
  background: rgba(255, 255, 255, .5);
  color: #6258d0;
}

.segmented-choice button.is-selected {
  border-color: rgba(77, 68, 183, .38);
  background: linear-gradient(135deg, rgba(115, 103, 240, .17), rgba(91, 211, 229, .16));
  color: #332d80;
}

.profile-fields {
  display: grid;
  gap: 9px;
}

.profile-field {
  min-height: 52px;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(76, 72, 145, .17);
  border-radius: 17px;
  background: rgba(255, 255, 255, .38);
}

.profile-field__dot {
  position: relative;
  width: 21px;
  height: 21px;
  border: 2px solid rgba(255, 255, 255, .82);
  border-radius: 50% 50% 46% 46%;
}

.profile-field__dot::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: -5px;
  height: 8px;
  border: 1px solid rgba(53, 58, 93, .25);
  border-radius: 50%;
  background: inherit;
}

.profile-field input {
  width: 100%;
  min-width: 0;
  padding: 13px 2px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 850;
}

.profile-field input::placeholder {
  color: #8c93aa;
}

.profile-field input:disabled {
  color: #686f86;
}

.inline-alert {
  min-height: 19px;
  margin: 7px 0 0;
  color: #c63961;
  font-size: .78rem;
  font-weight: 800;
}

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

.builder-actions .solid-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.match-head {
  min-height: 76px;
  padding: 10px 13px;
  border-radius: 24px;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr);
  align-items: center;
  gap: 14px;
}

.turn-readout {
  display: flex;
  align-items: center;
  gap: 11px;
}

.turn-readout__color {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255, 255, 255, .82);
  border-radius: 15px;
  background: var(--turn-color);
}

.turn-readout small,
.turn-readout strong {
  display: block;
}

.turn-readout small,
.match-head__stats small,
.mobile-dock small {
  color: var(--ink-soft);
  font-size: .7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.turn-readout strong {
  margin-top: 2px;
  font-size: 1.08rem;
}

.match-head__stats {
  display: flex;
  align-items: center;
  border: 1px solid rgba(77, 72, 144, .13);
  border-radius: 17px;
  background: rgba(255, 255, 255, .34);
}

.match-head__stats span {
  min-width: 86px;
  padding: 8px 15px;
  text-align: center;
}

.match-head__stats span+span {
  border-left: 1px solid rgba(77, 72, 144, .12);
}

.match-head__stats small,
.match-head__stats strong {
  display: block;
}

.match-head__stats strong {
  margin-top: 2px;
  font-size: 1.05rem;
}

.match-head__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.play-grid {
  display: grid;
  grid-template-columns: 210px minmax(420px, 1fr) 230px;
  gap: 14px;
  align-items: start;
  margin-top: 14px;
}

.player-rail,
.control-rail {
  padding: 13px;
  border-radius: 24px;
}

.player-rail {
  display: grid;
  gap: 9px;
}

.player-card {
  min-height: 70px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid rgba(76, 72, 145, .14);
  border-radius: 18px;
  background: rgba(255, 255, 255, .31);
}

.player-card.is-turn {
  border-color: color-mix(in srgb, var(--player-color) 62%, white);
  background: linear-gradient(135deg, color-mix(in srgb, var(--player-color) 13%, white), rgba(255, 255, 255, .52));
}

.player-card__token {
  position: relative;
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, .82);
  border-radius: 50% 50% 44% 44%;
  color: #fff;
  font-weight: 950;
}

.player-card__token::after {
  content: "";
  position: absolute;
  width: 32px;
  height: 12px;
  left: 2px;
  bottom: -4px;
  z-index: -1;
  border: 1px solid rgba(39, 46, 78, .22);
  border-radius: 50%;
  background: inherit;
}

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

.player-card small {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: .72rem;
  font-weight: 750;
}

.player-card__home {
  min-width: 35px;
  text-align: right;
  color: #58607a;
  font-size: .82rem;
  font-weight: 900;
}

.board-zone {
  min-width: 0;
  text-align: center;
}

.board-shell {
  width: min(100%, 820px);
  margin: 0 auto;
  padding: 9px;
  border-radius: 29px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .78), rgba(255, 255, 255, .34));
}

.board-shell canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 21px;
  touch-action: manipulation;
}

.move-message {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin: 10px auto 0;
  padding: 8px 18px;
  border-radius: 999px;
  color: #424d69;
  font-size: .9rem;
  font-weight: 850;
}

.control-rail {
  text-align: center;
}

.control-heading strong {
  display: block;
  margin-top: 4px;
  font-size: 1.22rem;
}

.dice-display {
  width: 116px;
  height: 116px;
  margin: 18px auto;
  padding: 17px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 7px;
  border: 2px solid rgba(56, 58, 104, .48);
  border-radius: 30px;
  background: linear-gradient(145deg, #ffffff 0%, #f4f1ff 55%, #dffaff 100%);
  transform: rotate(-2deg);
}

.dice-display span {
  width: 15px;
  height: 15px;
  place-self: center;
  border: 1px solid rgba(34, 38, 77, .25);
  border-radius: 50%;
  background: linear-gradient(145deg, #38406d, #7167d8);
  opacity: 0;
}

.dice-display[data-face="1"] span:nth-child(5),
.dice-display[data-face="2"] span:nth-child(1),
.dice-display[data-face="2"] span:nth-child(9),
.dice-display[data-face="3"] span:nth-child(1),
.dice-display[data-face="3"] span:nth-child(5),
.dice-display[data-face="3"] span:nth-child(9),
.dice-display[data-face="4"] span:nth-child(1),
.dice-display[data-face="4"] span:nth-child(3),
.dice-display[data-face="4"] span:nth-child(7),
.dice-display[data-face="4"] span:nth-child(9),
.dice-display[data-face="5"] span:nth-child(1),
.dice-display[data-face="5"] span:nth-child(3),
.dice-display[data-face="5"] span:nth-child(5),
.dice-display[data-face="5"] span:nth-child(7),
.dice-display[data-face="5"] span:nth-child(9),
.dice-display[data-face="6"] span:nth-child(1),
.dice-display[data-face="6"] span:nth-child(3),
.dice-display[data-face="6"] span:nth-child(4),
.dice-display[data-face="6"] span:nth-child(6),
.dice-display[data-face="6"] span:nth-child(7),
.dice-display[data-face="6"] span:nth-child(9) {
  opacity: 1;
}

.dice-display.is-rolling {
  animation: diceRoll .18s linear infinite;
}

.solid-action--roll {
  width: 100%;
  min-height: 56px;
  font-size: 1.02rem;
}

.tip-card {
  margin-top: 13px;
  padding: 14px;
  border: 1px solid rgba(76, 72, 145, .14);
  border-radius: 17px;
  background: rgba(255, 255, 255, .3);
  text-align: left;
}

.tip-card span {
  color: #645acb;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.tip-card p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: .84rem;
  line-height: 1.48;
}

.control-rail .outline-action {
  width: 100%;
  margin-top: 10px;
}

.mobile-dock {
  display: none;
}

.pause-sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(237, 235, 255, .55);
  backdrop-filter: blur(18px);
}

.pause-sheet__card {
  width: min(430px, 100%);
  padding: 30px;
  border-radius: 30px;
  text-align: center;
}

.modal-logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
}

.pause-sheet__card h2 {
  margin: 8px 0;
  font-size: 2rem;
  letter-spacing: -.045em;
}

.pause-sheet__card p {
  margin: 0 0 20px;
  color: var(--ink-soft);
}

.pause-sheet__card button {
  width: 100%;
  margin-top: 8px;
}

.glass-dialog,
.winner-dialog {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.glass-dialog::backdrop,
.winner-dialog::backdrop {
  background: rgba(233, 231, 255, .58);
  backdrop-filter: blur(16px);
}

.glass-dialog__panel,
.winner-dialog__panel {
  width: min(540px, calc(100vw - 24px));
  max-height: min(760px, calc(100vh - 24px));
  overflow: auto;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, .82);
  outline: 1px solid rgba(63, 61, 112, .12);
  outline-offset: -2px;
  border-radius: 30px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .86), rgba(250, 247, 255, .68));
  backdrop-filter: blur(24px);
}

.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.dialog-heading h2 {
  margin: 5px 0 0;
  font-size: 2rem;
  letter-spacing: -.05em;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  border-top: 1px solid rgba(76, 72, 145, .12);
}

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

.setting-row small {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: .78rem;
}

.range-row {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 14px;
  align-items: center;
  padding: 3px 0 14px;
  color: #59627e;
  font-size: .8rem;
  font-weight: 800;
}

.range-row input {
  width: 100%;
  accent-color: var(--purple);
}

.switch {
  position: relative;
  width: 52px;
  height: 30px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch span {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(76, 72, 145, .22);
  border-radius: 999px;
  background: rgba(89, 94, 127, .14);
}

.switch span::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 5px;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(76, 72, 145, .18);
  border-radius: 50%;
  background: linear-gradient(145deg, #fff, #e9e7f8);
  transition: transform .18s ease;
}

.switch input:checked+span {
  background: linear-gradient(90deg, #7367f0, #61d0e4);
}

.switch input:checked+span::after {
  transform: translateX(22px);
}

.glass-dialog__panel>.solid-action {
  width: 100%;
  margin-top: 14px;
}

.guide-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.guide-list li {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: start;
  padding: 13px;
  border: 1px solid rgba(76, 72, 145, .13);
  border-radius: 17px;
  background: rgba(255, 255, 255, .4);
}

.guide-list li>span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(76, 72, 145, .24);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(115, 103, 240, .13), rgba(84, 216, 232, .14));
  color: #574dc4;
  font-weight: 950;
}

.guide-list p {
  margin: 3px 0 0;
  color: var(--ink-soft);
  line-height: 1.5;
}

.winner-dialog__panel {
  text-align: center;
}

.winner-dialog__panel img {
  width: 128px;
  height: 128px;
  object-fit: contain;
}

.winner-dialog__panel h2 {
  margin: 8px 0;
  font-size: 2.3rem;
  letter-spacing: -.05em;
}

.winner-dialog__panel p {
  margin: 0 0 20px;
  color: var(--ink-soft);
}

.winner-dialog__panel button {
  width: 100%;
  margin-top: 8px;
}

@keyframes viewIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes diceRoll {
  0% {
    transform: rotate(-7deg) scale(.98);
  }

  50% {
    transform: rotate(7deg) scale(1.01);
  }

  100% {
    transform: rotate(-7deg) scale(.98);
  }
}

@media (hover: hover) {
  .solid-action:hover {
    background: linear-gradient(135deg, #6257e6, #846af0 52%, #51c5dc);
  }

  .outline-action:hover,
  .line-button:hover,
  .round-button:hover,
  .segmented-choice button:not(.is-selected):hover {
    border-color: rgba(76, 68, 181, .34);
    background: rgba(255, 255, 255, .6);
  }
}

@media (max-width: 1250px) {
  .lobby-stage {
    grid-template-columns: 1fr 390px;
  }

  .lobby-preview {
    grid-template-columns: 1fr;
  }

  .play-intro h1 {
    font-size: clamp(3rem, 6vw, 5.2rem);
  }

  .preview-frame {
    width: min(76vh, 640px);
  }

  .play-grid {
    grid-template-columns: 190px minmax(390px, 1fr);
  }

  .control-rail {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(130px, .6fr) 100px minmax(180px, 240px) minmax(220px, 1fr) 150px;
    align-items: center;
    gap: 13px;
    text-align: left;
  }

  .dice-display {
    width: 92px;
    height: 92px;
    margin: 0;
    padding: 13px;
    border-radius: 24px;
  }

  .dice-display span {
    width: 12px;
    height: 12px;
  }

  .tip-card,
  .control-rail .outline-action {
    margin-top: 0;
  }
}

@media (max-width: 900px) {
  .lobby-stage {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .lobby-preview {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .72);
  }

  .preview-frame {
    width: min(100%, 560px);
  }

  .match-builder {
    min-height: 0;
  }

  .match-head {
    grid-template-columns: 1fr auto;
  }

  .match-head__stats {
    display: none;
  }
}

@media (max-width: 760px) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .arena-app {
    padding: 9px 9px 92px;
  }

  .arena-header {
    min-height: 62px;
    padding: 7px 9px;
    border-radius: 20px;
  }

  .brand-lockup img {
    width: 44px;
    height: 44px;
  }

  .brand-lockup small {
    display: none;
  }

  .arena-header .line-button {
    display: none;
  }

  .lobby-stage {
    border-radius: 24px;
  }

  .lobby-preview {
    padding: 22px 17px 27px;
    gap: 18px;
  }

  .play-intro {
    text-align: center;
  }

  .play-intro h1 {
    font-size: clamp(2.7rem, 14vw, 4.4rem);
  }

  .play-intro p {
    font-size: .92rem;
  }

  .preview-chip {
    display: none;
  }

  .preview-frame {
    padding: 7px;
    border-radius: 25px;
  }

  .preview-frame canvas {
    border-radius: 18px;
  }

  .match-builder {
    padding: 24px 18px 28px;
  }

  .section-title h2 {
    font-size: 2.35rem;
  }

  .match-head {
    display: none;
  }

  .play-grid {
    display: block;
    margin-top: 9px;
  }

  .player-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 8px;
    padding: 8px;
    border-radius: 20px;
  }

  .player-card {
    min-height: 57px;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 7px;
    padding: 7px;
    border-radius: 14px;
  }

  .player-card__token {
    width: 30px;
    height: 30px;
  }

  .player-card__token::after {
    width: 24px;
    height: 9px;
    bottom: -3px;
  }

  .player-card__home {
    display: none;
  }

  .board-shell {
    width: min(100%, 340px);
    padding: 6px;
    border-radius: 22px;
  }

  .board-shell canvas {
    border-radius: 16px;
  }

  .move-message {
    display: none;
  }

  .control-rail {
    display: none;
  }

  .mobile-dock {
    position: fixed;
    left: 9px;
    right: 9px;
    bottom: max(9px, env(safe-area-inset-bottom));
    z-index: 20;
    min-height: 66px;
    display: grid;
    grid-template-columns: 1fr minmax(115px, 1.15fr) 44px;
    gap: 8px;
    align-items: center;
    padding: 9px;
    border-radius: 21px;
  }

  .mobile-dock strong {
    display: block;
    max-width: 105px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-dock__status {
    min-width: 0;
  }

  .mobile-dock__status span {
    display: block;
    max-width: 118px;
    margin-top: 1px;
    overflow: hidden;
    color: var(--ink-soft);
    font-size: .64rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-dock .solid-action {
    min-height: 46px;
    border-radius: 15px;
  }

  .glass-dialog__panel,
  .winner-dialog__panel {
    padding: 20px;
    border-radius: 25px;
  }
}

@media (max-width: 430px) {
  .segmented-choice {
    gap: 7px;
  }

  .segmented-choice button {
    min-height: 51px;
    padding: 0 8px;
    font-size: .82rem;
  }

  .profile-field {
    min-height: 49px;
  }

  .range-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .player-rail {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {

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


/* ==========================================================
   Mobile play-fit upgrade - v1.3.0
   The board uses the full safe width in portrait and also
   respects available height on short/landscape screens.
   ========================================================== */
@media (max-width: 760px) {
  body.is-match-view {
    min-height: 100svh;
    overscroll-behavior-y: contain;
  }

  .arena-app {
    padding: 7px 6px calc(82px + env(safe-area-inset-bottom));
  }

  .arena-header {
    min-height: 56px;
    padding: 6px 8px;
    border-radius: 18px;
  }

  body.is-match-view .arena-header {
    position: sticky;
    top: 5px;
    z-index: 18;
  }

  .brand-lockup img {
    width: 40px;
    height: 40px;
  }

  .brand-lockup strong {
    font-size: .96rem;
  }

  .arena-header .round-button {
    width: 40px;
    height: 40px;
    border-radius: 13px;
  }

  #gameView {
    padding-top: 6px;
  }

  #gameView .play-grid {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
    margin-top: 0;
  }

  #gameView .player-rail {
    width: 100%;
    max-width: 100%;
    display: flex;
    gap: 5px;
    align-items: stretch;
    margin: 0;
    padding: 5px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    border-radius: 17px;
  }

  #gameView .player-rail::-webkit-scrollbar {
    display: none;
  }

  #gameView .player-card {
    min-height: 48px;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 6px;
    padding: 5px 7px;
    border-radius: 12px;
  }

  #gameView .player-rail[data-player-count="2"] .player-card {
    flex: 1 1 0;
    min-width: 0;
  }

  #gameView .player-rail[data-player-count="4"] .player-card {
    flex: 0 0 clamp(126px, 38vw, 154px);
  }

  #gameView .player-card__token {
    width: 27px;
    height: 27px;
    font-size: .82rem;
  }

  #gameView .player-card__token::after {
    width: 21px;
    height: 7px;
    bottom: -2px;
  }

  #gameView .player-card strong {
    font-size: .87rem;
  }

  #gameView .player-card small {
    margin-top: 1px;
    font-size: .62rem;
  }

  #gameView .board-zone {
    width: 100%;
    display: grid;
    place-items: center;
    min-width: 0;
  }

  #gameView .board-shell {
    width: clamp(220px, min(calc(100vw - 12px), calc(100svh - 188px)), calc(100vw - 12px));
    max-width: none;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    padding: 4px;
    border-radius: 18px;
  }

  #gameView .board-shell canvas {
    width: 100%;
    height: 100%;
    border-radius: 14px;
  }

  .mobile-dock {
    left: 6px;
    right: 6px;
    bottom: max(6px, env(safe-area-inset-bottom));
    min-height: 62px;
    grid-template-columns: minmax(0, .82fr) minmax(96px, 1.1fr) 42px;
    gap: 6px;
    padding: 7px;
    border-radius: 18px;
  }

  .mobile-dock strong {
    max-width: none;
    font-size: .92rem;
  }

  .mobile-dock__status span {
    max-width: none;
    font-size: .6rem;
  }

  .mobile-dock .solid-action {
    min-height: 44px;
    padding: 0 12px;
    border-radius: 14px;
  }

  .mobile-dock .round-button {
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }
}

@supports (height: 100dvh) {
  @media (max-width: 760px) {
    #gameView .board-shell {
      width: clamp(220px, min(calc(100vw - 12px), calc(100dvh - 188px)), calc(100vw - 12px));
    }
  }
}

@media (max-width: 360px) {
  body.is-match-view .brand-lockup span {
    display: none;
  }

  body.is-match-view .arena-header {
    min-height: 50px;
  }

  #gameView .player-card small,
  .mobile-dock__status span {
    display: none;
  }

  #gameView .board-shell {
    width: clamp(216px, min(calc(100vw - 10px), calc(100svh - 168px)), calc(100vw - 10px));
  }

  .mobile-dock {
    grid-template-columns: minmax(64px, .72fr) minmax(100px, 1.15fr) 40px;
  }
}

@supports (height: 100dvh) {
  @media (max-width: 360px) {
    #gameView .board-shell {
      width: clamp(216px, min(calc(100vw - 10px), calc(100dvh - 168px)), calc(100vw - 10px));
    }
  }
}

@media (max-width: 960px) and (max-height: 560px) {
  body.is-match-view .arena-app {
    padding: 5px 74px 5px 5px;
  }

  body.is-match-view .arena-header {
    position: fixed;
    top: 5px;
    left: 5px;
    width: 52px;
    min-height: 52px;
    padding: 5px;
  }

  body.is-match-view .brand-lockup img {
    width: 40px;
    height: 40px;
  }

  body.is-match-view .brand-lockup span,
  body.is-match-view .arena-header__actions {
    display: none;
  }

  #gameView {
    padding-top: 0;
  }

  .match-head,
  .control-rail,
  .move-message {
    display: none;
  }

  #gameView .play-grid {
    display: grid;
    grid-template-columns: minmax(112px, 25vw) minmax(0, 1fr);
    gap: 6px;
    align-items: center;
    min-height: calc(100dvh - 10px);
    margin-top: 0;
  }

  #gameView .player-rail {
    max-height: calc(100dvh - 10px);
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
  }

  #gameView .player-rail[data-player-count] .player-card {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
  }

  #gameView .board-shell {
    width: min(calc(100vw - 202px), calc(100dvh - 20px));
  }

  .mobile-dock {
    position: fixed;
    top: 5px;
    right: 5px;
    bottom: 5px;
    left: auto;
    width: 64px;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 6px;
  }

  .mobile-dock__status {
    display: none;
  }

  .mobile-dock .solid-action {
    width: 52px;
    min-height: 98px;
    padding: 4px;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
  }

  .mobile-dock .round-button {
    flex: 0 0 auto;
  }
}


/* Ludo Ninja v1.3.0 board and mobile fixes */
.player-card {
  position: relative;
  overflow: hidden;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease, background .2s ease
}

.player-card.is-turn {
  z-index: 1;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--player-color) 34%, white), 0 10px 28px color-mix(in srgb, var(--player-color) 22%, transparent);
  animation: ninjaTurnCardPulse 1.35s ease-in-out infinite
}

.player-card.is-turn::before {
  content: "TURN";
  position: absolute;
  top: 4px;
  right: 5px;
  z-index: 2;
  padding: 3px 6px;
  border: 1px solid color-mix(in srgb, var(--player-color) 55%, white);
  border-radius: 999px;
  background: color-mix(in srgb, var(--player-color) 18%, rgba(255, 255, 255, .9));
  color: color-mix(in srgb, var(--player-color) 76%, #18223d);
  font-size: .52rem;
  font-weight: 950;
  letter-spacing: .08em;
  line-height: 1
}

.player-card.is-turn .player-card__home {
  transform: translateY(10px)
}

body.is-match-view .board-shell {
  box-shadow: 0 14px 42px rgba(57, 45, 128, .14), 0 0 0 2px color-mix(in srgb, var(--turn-color) 18%, transparent)
}

@keyframes ninjaTurnCardPulse {

  0%,
  100% {
    transform: translateY(0)
  }

  50% {
    transform: translateY(-2px)
  }
}

@media(max-width:760px) {
  #gameView .player-rail {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    overflow: visible;
    padding: 6px
  }

  #gameView .player-rail[data-player-count="2"],
  #gameView .player-rail[data-player-count="4"] {
    grid-template-columns: repeat(2, minmax(0, 1fr))
  }

  #gameView .player-rail[data-player-count] .player-card {
    width: auto;
    min-width: 0;
    flex: none;
    min-height: 50px;
    padding: 6px 7px
  }

  #gameView .player-card.is-turn::before {
    top: 3px;
    right: 4px;
    padding: 2px 4px;
    font-size: .46rem
  }

  #gameView .board-shell {
    width: clamp(260px, min(calc(100vw - 12px), calc(100svh - 230px)), calc(100vw - 12px));
    padding: 3px;
    border-radius: 16px
  }

  #gameView .board-shell canvas {
    border-radius: 13px
  }
}

@supports(height:100dvh) {
  @media(max-width:760px) {
    #gameView .board-shell {
      width: clamp(260px, min(calc(100vw - 12px), calc(100dvh - 230px)), calc(100vw - 12px))
    }
  }
}

@media(max-width:340px) {
  #gameView .board-shell {
    width: calc(100vw - 10px)
  }

  #gameView .player-card strong {
    font-size: .8rem
  }
}

@media(max-width:760px) and (max-height:560px) and (orientation:landscape) {

  #gameView .player-rail,
  #gameView .player-rail[data-player-count="2"],
  #gameView .player-rail[data-player-count="4"] {
    display: grid;
    grid-template-columns: 1fr;
    align-content: center;
    overflow-y: auto
  }

  #gameView .board-shell {
    width: min(calc(100vw - 202px), calc(100dvh - 20px))
  }
}

html.reduce-game-motion .player-card.is-turn {
  animation: none
}

@media(prefers-reduced-motion:reduce) {
  .player-card.is-turn {
    animation: none
  }
}

/* ==========================================================
   Ludo Ninja v1.3.0 — responsive dialogs and clearer stacks
   ========================================================== */
.glass-dialog[open],
.winner-dialog[open] {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 16px;
  overflow: hidden;
}

.glass-dialog__panel,
.winner-dialog__panel {
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.dialog-heading {
  position: sticky;
  top: -24px;
  z-index: 4;
  margin: -24px -24px 14px;
  padding: 20px 24px 12px;
  border-bottom: 1px solid rgba(76, 72, 145, .10);
  background: linear-gradient(180deg, rgba(255, 255, 255, .98) 72%, rgba(255, 255, 255, .86));
  backdrop-filter: blur(18px);
}

.pause-sheet__card {
  max-height: calc(100dvh - 32px);
  overflow: auto;
  overscroll-behavior: contain;
}

@media (max-width: 600px) {

  .glass-dialog[open],
  .winner-dialog[open] {
    padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
    align-items: center;
  }

  .glass-dialog__panel,
  .winner-dialog__panel {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - max(16px, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
    padding: 16px;
    border-radius: 21px;
  }

  .dialog-heading {
    top: -16px;
    margin: -16px -16px 12px;
    padding: 14px 16px 10px;
    gap: 10px;
  }

  .dialog-heading h2 {
    margin-top: 3px;
    font-size: clamp(1.45rem, 8vw, 1.9rem);
  }

  .dialog-heading .round-button {
    flex: 0 0 42px;
  }

  .setting-row {
    gap: 10px;
    padding: 11px 0;
  }

  .setting-row>div {
    min-width: 0;
  }

  .setting-row strong {
    font-size: .92rem;
  }

  .setting-row small {
    font-size: .72rem;
    line-height: 1.35;
  }

  .range-row {
    grid-template-columns: 1fr;
    gap: 5px;
    padding-bottom: 11px;
  }

  .guide-list {
    gap: 8px;
  }

  .guide-list li {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 9px;
    padding: 10px;
    border-radius: 14px;
  }

  .guide-list li>span {
    width: 30px;
    height: 30px;
    border-radius: 10px;
  }

  .guide-list p {
    margin-top: 1px;
    font-size: .86rem;
    line-height: 1.42;
  }

  .winner-dialog__panel img,
  .modal-logo {
    width: 86px;
    height: 86px;
  }

  .winner-dialog__panel h2,
  .pause-sheet__card h2 {
    font-size: 1.75rem;
  }

  .pause-sheet {
    padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
  }

  .pause-sheet__card {
    width: 100%;
    max-height: calc(100dvh - 16px);
    padding: 19px 16px;
    border-radius: 22px;
  }
}

@media (max-width: 360px),
(max-height: 520px) {

  .glass-dialog[open],
  .winner-dialog[open] {
    align-items: stretch;
  }

  .glass-dialog__panel,
  .winner-dialog__panel {
    max-height: 100%;
    border-radius: 17px;
  }

  .winner-dialog__panel img,
  .modal-logo {
    width: 68px;
    height: 68px;
  }
}