/* ============================================================
   Royal March: Kingdom Conquest — game styles
   ============================================================ */

html,
body {
  height: 100%;
}

body {
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

/* ---------- Stage & screens ---------- */
.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(1100px 560px at 50% -12%, rgba(200, 16, 46, 0.3), transparent 66%),
    radial-gradient(900px 520px at 50% 112%, rgba(245, 197, 66, 0.13), transparent 62%),
    #140e08;
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image:
    repeating-linear-gradient(45deg, rgba(245, 197, 66, 0.16) 0 1px, transparent 1px 22px),
    repeating-linear-gradient(-45deg, rgba(245, 197, 66, 0.1) 0 1px, transparent 1px 22px);
  mask-image: radial-gradient(circle at 50% 40%, #000 20%, transparent 78%);
}

.screen {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  z-index: 1;
}

.screen.is-active {
  display: flex;
}

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  padding: 0.75rem 1.15rem;
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  cursor: pointer;
  text-decoration: none;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 -3px 0 rgba(0, 0, 0, 0.3) inset,
    0 4px 0 rgba(0, 0, 0, 0.35), 0 8px 18px rgba(0, 0, 0, 0.35);
}

.btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 -1px 0 rgba(0, 0, 0, 0.3) inset,
    0 1px 0 rgba(0, 0, 0, 0.35);
}

.btn .icon {
  font-size: 1.1em;
}

.btn--gold {
  --btn-bg: linear-gradient(180deg, #ffe9a8 0%, #f5c542 42%, #d99a10 100%);
  --btn-fg: #3a2402;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.btn--crimson {
  --btn-bg: linear-gradient(180deg, #f0575f 0%, #c8102e 55%, #8d0a20 100%);
  --btn-fg: #fff3ee;
}

.btn--ghost {
  --btn-bg: rgba(255, 255, 255, 0.07);
  --btn-fg: var(--ink);
  box-shadow: 0 0 0 1.5px rgba(245, 197, 66, 0.35) inset, 0 3px 0 rgba(0, 0, 0, 0.3);
}

.btn--ghost:hover {
  --btn-bg: rgba(245, 197, 66, 0.14);
}

.btn--lg {
  font-size: 1.15rem;
  padding: 0.95rem 1.7rem;
  min-height: 56px;
}

.btn--small {
  font-size: 0.88rem;
  padding: 0.5rem 0.85rem;
  min-height: 40px;
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  filter: grayscale(0.5);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1.5px solid rgba(245, 197, 66, 0.4);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.15rem;
  transition: background 120ms ease, transform 120ms ease;
}

.icon-btn:hover {
  background: rgba(245, 197, 66, 0.18);
  transform: translateY(-1px);
}

/* ---------- Title screen ---------- */
.screen--title {
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: clamp(14px, 3vw, 40px) clamp(14px, 3vw, 32px);
}

.title-grid {
  width: 100%;
  max-width: 1080px;
  margin: auto;
  display: grid;
  gap: clamp(18px, 3.5vw, 46px);
  grid-template-columns: 1fr;
  align-items: center;
}

@media (min-width: 860px) {
  .title-grid {
    grid-template-columns: 1.04fr 1fr;
  }
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin: 0 0 0.35rem;
}

.logo {
  margin: 0 0 0.7rem;
  line-height: 0.92;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
}

.logo__main {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.7rem, 8.5vw, 4.8rem);
  letter-spacing: -0.015em;
  background: linear-gradient(178deg, #fff6d0 4%, #f7cf5c 42%, #e0a41a 68%, #a86f05 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 #5c3a04) drop-shadow(0 8px 16px rgba(0, 0, 0, 0.55));
}

.logo__sub {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(0.72rem, 2.1vw, 0.95rem);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: #ffe6c9;
  background: linear-gradient(180deg, #d81f38, #8d0a20);
  border: 1.5px solid rgba(245, 197, 66, 0.75);
  border-radius: 999px;
  padding: 0.3rem 0.95rem 0.3rem 1.15rem;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4);
}

.title-blurb {
  color: var(--ink-soft);
  font-size: clamp(0.98rem, 2.4vw, 1.08rem);
  max-width: 46ch;
  margin: 0 0 1.15rem;
}

.title-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-bottom: 1.2rem;
}

.title-feats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.title-feats li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.title-feats .icon {
  color: var(--accent-2);
  font-size: 1rem;
  flex: 0 0 auto;
}

.title-art {
  position: relative;
  border-radius: 26px;
  overflow: hidden;
  border: 2px solid rgba(245, 197, 66, 0.55);
  box-shadow: 0 0 0 6px rgba(20, 14, 8, 0.9), 0 0 0 8px rgba(245, 197, 66, 0.22),
    0 24px 50px rgba(0, 0, 0, 0.55);
  aspect-ratio: 4 / 3;
  order: -1;
}

@media (min-width: 860px) {
  .title-art {
    order: 0;
  }
}

.title-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.title-art__ribbon {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: #3a2402;
  background: linear-gradient(180deg, #ffe9a8, #e8b52c);
  padding: 0.3rem 1.1rem;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.4);
}

/* ---------- Kingdom map ---------- */
.screen--map {
  flex-direction: column;
  padding: clamp(8px, 1.6vw, 18px) clamp(8px, 2vw, 24px) clamp(6px, 1.4vw, 14px);
  gap: clamp(6px, 1.2vw, 12px);
  overflow: hidden;
}

.map-top {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: 0 0 auto;
}

.map-heading {
  flex: 1 1 auto;
  min-width: 0;
}

.map-heading h2 {
  margin: 0;
  font-size: clamp(1.05rem, 3.2vw, 1.5rem);
  color: #ffe9c4;
}

.map-heading p {
  margin: 0;
  font-size: clamp(0.72rem, 2.2vw, 0.85rem);
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-purse {
  display: flex;
  gap: 0.4rem;
  flex: 0 0 auto;
}

.purse {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  border: 1.5px solid rgba(245, 197, 66, 0.4);
  color: #ffe9c4;
}

.purse .icon {
  font-size: 0.95rem;
}

.purse--coin .icon {
  color: #f5c542;
}

.purse--star .icon {
  color: #ffd76a;
}

.map-frame {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  container-type: size;
}

.map-canvas {
  position: relative;
  width: min(100cqw, calc(100cqh * 10 / 7));
  aspect-ratio: 10 / 7;
  max-width: 100%;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 0 0 3px rgba(245, 197, 66, 0.5), 0 0 0 7px rgba(20, 14, 8, 0.85),
    0 22px 44px rgba(0, 0, 0, 0.55);
}

.map-canvas svg {
  display: block;
  width: 100%;
  height: 100%;
}

.map-hint {
  flex: 0 0 auto;
  margin: 0;
  text-align: center;
  font-size: clamp(0.72rem, 2.2vw, 0.85rem);
  color: var(--ink-soft);
  max-width: none;
}

/* Map checkpoint nodes */
.map__layer {
  position: absolute;
  inset: 0;
}

.map-node {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  width: clamp(38px, 7.4%, 62px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 0;
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(0.85rem, 2.4vw, 1.15rem);
  color: #3a2402;
  background: radial-gradient(circle at 34% 26%, #fff3c4, #f5c542 52%, #c98d0c 100%);
  box-shadow: 0 0 0 3px #7d5a08, 0 0 0 6px rgba(255, 243, 196, 0.35), 0 8px 16px rgba(0, 0, 0, 0.45);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.map-node:hover {
  transform: translate(-50%, -50%) scale(1.1);
}

.map-node:active {
  transform: translate(-50%, -50%) scale(0.96);
}

.map-node__pin {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.map-node__num {
  display: grid;
  place-items: center;
  line-height: 1;
}

.map-node__num .icon {
  font-size: 0.95em;
}

.map-node.is-locked {
  background: radial-gradient(circle at 34% 26%, #6a6259, #403a33 60%, #2a251f 100%);
  color: #b9b0a4;
  box-shadow: 0 0 0 3px #2a251f, 0 0 0 6px rgba(0, 0, 0, 0.3), 0 6px 12px rgba(0, 0, 0, 0.45);
  cursor: not-allowed;
}

.map-node.is-locked:hover {
  transform: translate(-50%, -50%);
}

.map-node.is-cleared {
  background: radial-gradient(circle at 34% 26%, #b6f5c8, #35c46a 55%, #127a3c 100%);
  color: #06331a;
  box-shadow: 0 0 0 3px #0b5c2c, 0 0 0 6px rgba(182, 245, 200, 0.3), 0 8px 16px rgba(0, 0, 0, 0.45);
}

.map-node.is-current {
  animation: nodePulse 1.9s ease-in-out infinite;
}

@keyframes nodePulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px #7d5a08, 0 0 0 6px rgba(255, 243, 196, 0.35), 0 8px 16px rgba(0, 0, 0, 0.45);
  }
  50% {
    box-shadow: 0 0 0 3px #7d5a08, 0 0 0 12px rgba(255, 243, 196, 0.12), 0 8px 22px rgba(245, 197, 66, 0.5);
  }
}

.map-node__stars {
  display: flex;
  justify-content: center;
  gap: 1px;
  font-size: clamp(0.5rem, 1.5vw, 0.68rem);
  line-height: 1;
  white-space: nowrap;
}

.map-node__star {
  color: rgba(120, 90, 40, 0.35);
}

.map-node__star.is-on {
  color: #d99a10;
}

.map-node__plate {
  position: absolute;
  top: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 0.12em 0.5em 0.18em;
  border-radius: 10px;
  background: rgba(255, 250, 235, 0.92);
  box-shadow: 0 2px 6px rgba(60, 35, 5, 0.35);
  white-space: nowrap;
  pointer-events: none;
}

.map-node__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(0.44rem, 1.25vw, 0.66rem);
  letter-spacing: 0.01em;
  color: #4a3320;
  line-height: 1.2;
  max-width: 9em;
  overflow-wrap: anywhere;
}

.map-chest {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  width: clamp(30px, 5.6%, 48px);
  aspect-ratio: 1;
  border-radius: 12px;
  border: 0;
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: clamp(0.85rem, 2.4vw, 1.15rem);
  color: #3a2402;
  background: linear-gradient(180deg, #ffe9a8, #d99a10);
  box-shadow: 0 0 0 2.5px #7d5a08, 0 6px 12px rgba(0, 0, 0, 0.45);
  transition: transform 140ms ease;
}

.map-chest:hover {
  transform: translate(-50%, -50%) scale(1.1);
}

.map-chest__box {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.map-chest__box svg {
  display: block;
  width: 100%;
  height: 100%;
}

.map-chest__label {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(0.46rem, 1.35vw, 0.66rem);
  color: #4a3320;
  background: rgba(255, 250, 235, 0.92);
  padding: 0 0.4em;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
}

.map-chest.is-locked {
  background: linear-gradient(180deg, #6a6259, #3a342c);
  color: #b9b0a4;
  box-shadow: 0 0 0 2.5px #2a251f, 0 4px 10px rgba(0, 0, 0, 0.45);
  cursor: not-allowed;
}

.map-chest.is-locked:hover {
  transform: translate(-50%, -50%);
}

.map-chest.is-ready {
  animation: chestBob 1.6s ease-in-out infinite;
}

.map-chest.is-open {
  opacity: 0.4;
  cursor: default;
}

@keyframes chestBob {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -58%) scale(1.06);
  }
}

/* ---------- Play screen ---------- */
.screen--play {
  flex-direction: column;
  padding: clamp(6px, 1.4vw, 14px) clamp(8px, 2vw, 22px) clamp(6px, 1.2vw, 12px);
  gap: clamp(5px, 1.1vw, 10px);
  overflow: hidden;
}

.play-top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 0 0 auto;
}

.play-heading {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.play-heading strong {
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 2.8vw, 1.2rem);
  color: #ffe9c4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.play-heading span {
  font-size: clamp(0.66rem, 2vw, 0.78rem);
  color: var(--ink-soft);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.play-stats {
  display: flex;
  gap: 0.4rem;
  flex: 0 0 auto;
}

.stat {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.24rem 0.6rem;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.45);
  border: 1.5px solid rgba(245, 197, 66, 0.35);
}

.stat__label {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.stat__value {
  font-family: var(--font-display);
  font-size: clamp(1rem, 3vw, 1.25rem);
  color: #ffe9c4;
  line-height: 1;
}

.stat--moves.is-low .stat__value {
  color: #ff8a8c;
}

.stat--moves.is-low {
  border-color: rgba(252, 102, 104, 0.7);
  animation: lowPulse 1.1s ease-in-out infinite;
}

@keyframes lowPulse {
  0%,
  100% {
    background: rgba(0, 0, 0, 0.45);
  }
  50% {
    background: rgba(200, 16, 46, 0.35);
  }
}

.stat--coins .icon {
  color: #f5c542;
  font-size: 1rem;
}

/* ---------- Parade track ---------- */
.parade {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.3rem 0.55rem 0.35rem;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(60, 30, 20, 0.85), rgba(26, 16, 12, 0.9));
  border: 1.5px solid rgba(245, 197, 66, 0.3);
}

.parade__rail {
  position: relative;
  height: clamp(30px, 6.4vw, 42px);
  border-radius: 999px;
  background: repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.05) 0 8px,
      transparent 8px 16px
    ),
    #241a12;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7);
  overflow: visible;
}

.parade__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #8d0a20, #d81f38 55%, #f5c542 100%);
  box-shadow: 0 0 12px rgba(245, 197, 66, 0.55);
  transition: width 420ms cubic-bezier(0.3, 1.2, 0.5, 1);
}

.parade__flag {
  position: absolute;
  top: 50%;
  width: 2px;
  height: 62%;
  transform: translate(-50%, -50%);
  background: rgba(245, 197, 66, 0.55);
  border-radius: 2px;
}

.parade__gate {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 88%;
  border-radius: 4px;
  background: repeating-linear-gradient(90deg, #6b4a1e 0 2px, #3a2a12 2px 4px);
  box-shadow: 0 0 0 1.5px rgba(245, 197, 66, 0.6);
}

.parade__king {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -58%);
  transition: left 420ms cubic-bezier(0.3, 1.2, 0.5, 1);
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.6));
  pointer-events: none;
}

.parade__king svg {
  width: clamp(34px, 8vw, 46px);
  height: auto;
  display: block;
}

.parade__king.is-arriving {
  animation: kingHop 620ms ease-out;
}

@keyframes kingHop {
  0% {
    transform: translate(-50%, -58%);
  }
  35% {
    transform: translate(-50%, -105%) rotate(-6deg);
  }
  70% {
    transform: translate(-50%, -50%) rotate(3deg);
  }
  100% {
    transform: translate(-50%, -58%);
  }
}

.parade__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: clamp(0.6rem, 1.9vw, 0.72rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-inline: 0.2rem;
}

.parade__meta strong {
  font-family: var(--font-display);
  font-size: clamp(0.72rem, 2.2vw, 0.85rem);
  color: #ffe9c4;
  letter-spacing: 0.02em;
}

/* ---------- Objectives strip ---------- */
.objectives {
  display: flex;
  gap: 0.4rem;
  flex: 0 0 auto;
}

.obj {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.55rem;
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.4);
  border: 1.5px solid rgba(245, 197, 66, 0.24);
  min-width: 0;
}

.obj__icon {
  font-size: 1.05rem;
  flex: 0 0 auto;
  color: var(--accent-2);
}

.obj__body {
  min-width: 0;
  flex: 1 1 auto;
  line-height: 1.1;
}

.obj__label {
  display: block;
  font-size: clamp(0.56rem, 1.8vw, 0.66rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.obj__value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(0.82rem, 2.5vw, 0.98rem);
  color: #ffe9c4;
}

.obj.is-done {
  border-color: rgba(53, 196, 106, 0.65);
  background: rgba(18, 122, 60, 0.25);
}

.obj.is-done .obj__icon {
  color: #6ff0a0;
}

.obj__bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin-top: 2px;
}

.obj__bar > i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #d81f38, #f5c542);
  transition: width 300ms ease;
}

/* ---------- Play layout ---------- */
.play-main {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "objectives" "board";
  gap: clamp(5px, 1.1vw, 10px);
}

.objectives {
  grid-area: objectives;
}

.board-col {
  grid-area: board;
  display: flex;
  flex-direction: column;
  gap: clamp(5px, 1.1vw, 10px);
  min-height: 0;
}

.side-col {
  display: none;
}

@media (min-width: 900px) {
  .play-main {
    grid-template-columns: minmax(0, 1fr) 296px;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "board objectives"
      "board side";
    align-items: stretch;
    max-width: 1180px;
    width: 100%;
    margin-inline: auto;
  }

  .objectives {
    flex-direction: column;
  }

  .side-col {
    grid-area: side;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    overflow-y: auto;
    padding-right: 2px;
  }
}

.play-foot {
  flex: 0 0 auto;
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Board ---------- */
.board-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  container-type: size;
}

.board {
  position: relative;
  width: 100%;
  width: min(100cqw, 100cqh);
  aspect-ratio: 1;
  border-radius: 20px;
  background: radial-gradient(circle at 50% 0%, #3d2340, #1c1020 72%);
  box-shadow: inset 0 0 0 3px #6b4a1e, inset 0 0 0 6px #2a1a10,
    inset 0 10px 30px rgba(0, 0, 0, 0.6), 0 16px 34px rgba(0, 0, 0, 0.5);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.board__inner {
  position: absolute;
  inset: 3.2%;
}

.board__cells,
.board__tiles,
.board__fx {
  position: absolute;
  inset: 0;
}

.board__fx {
  pointer-events: none;
  z-index: 6;
}

.cellbg {
  position: absolute;
  width: 12.5%;
  height: 12.5%;
  transform: translate(calc(var(--c) * 100%), calc(var(--r) * 100%));
  padding: 1.5%;
}

.cellbg::after {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
}

.cellbg.is-alt::after {
  background: rgba(255, 255, 255, 0.075);
}

/* ---------- Tiles ---------- */
.tile {
  position: absolute;
  width: 12.5%;
  height: 12.5%;
  transform: translate(calc(var(--c) * 100%), calc(var(--r) * 100%));
  transition: transform 190ms cubic-bezier(0.34, 1.3, 0.5, 1);
  will-change: transform;
  z-index: 2;
}

.tile__body {
  position: absolute;
  inset: 5%;
  border-radius: 12px;
  display: grid;
  place-items: center;
  transition: transform 160ms ease, opacity 160ms ease, filter 160ms ease;
  cursor: grab;
}

.tile__body svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45));
}

.tile.is-selected .tile__body {
  transform: scale(1.12);
  filter: brightness(1.2);
}

.tile.is-selected .tile__body::after {
  content: "";
  position: absolute;
  inset: -8%;
  border-radius: 14px;
  border: 2.5px solid rgba(255, 243, 196, 0.95);
  box-shadow: 0 0 14px rgba(245, 197, 66, 0.8);
  animation: selPulse 900ms ease-in-out infinite;
}

@keyframes selPulse {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

.tile.is-hint .tile__body {
  animation: hintBounce 700ms ease-in-out infinite;
}

@keyframes hintBounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-12%) scale(1.08);
  }
}

.tile.is-clearing .tile__body {
  transform: scale(0.1) rotate(28deg);
  opacity: 0;
}

.tile.is-spawn .tile__body {
  animation: spawnPop 260ms cubic-bezier(0.3, 1.6, 0.5, 1);
}

@keyframes spawnPop {
  from {
    transform: scale(0.4);
    opacity: 0.2;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* emblem badge on a tile */
.tile__emblem {
  position: absolute;
  right: -6%;
  bottom: -6%;
  width: 46%;
  height: 46%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  background: radial-gradient(circle at 35% 30%, #fff6d8, #f5c542 60%, #b8860b);
  box-shadow: 0 0 0 1.5px #6b4a0a, 0 2px 4px rgba(0, 0, 0, 0.5);
  color: #3a2402;
  pointer-events: none;
  z-index: 3;
}

.tile__emblem svg {
  width: 74%;
  height: 74%;
  filter: none;
}

/* booster glow */
.tile--booster .tile__body::before {
  content: "";
  position: absolute;
  inset: -12%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 236, 160, 0.55), transparent 68%);
  animation: boosterGlow 1.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes boosterGlow {
  0%,
  100% {
    opacity: 0.4;
    transform: scale(0.92);
  }
  50% {
    opacity: 0.95;
    transform: scale(1.08);
  }
}

/* ---------- Obstacles ---------- */
.obstacle {
  position: absolute;
  width: 12.5%;
  height: 12.5%;
  transform: translate(calc(var(--c) * 100%), calc(var(--r) * 100%));
  padding: 3%;
  z-index: 3;
  transition: transform 160ms ease;
}

.obstacle__body {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  display: grid;
  place-items: center;
  transition: transform 160ms ease, opacity 160ms ease;
}

.obstacle--barricade .obstacle__body {
  background: repeating-linear-gradient(
      100deg,
      #8a5a2b 0 6px,
      #6b4320 6px 12px
    ),
    #6b4320;
  box-shadow: inset 0 0 0 2px #3d2410, inset 0 3px 0 rgba(255, 210, 150, 0.28),
    0 3px 6px rgba(0, 0, 0, 0.5);
}

.obstacle--barricade .obstacle__body::after {
  content: "";
  position: absolute;
  inset: 12% 8%;
  border-radius: 4px;
  border-top: 3px solid rgba(255, 220, 170, 0.35);
  border-bottom: 3px solid rgba(0, 0, 0, 0.35);
}

.obstacle--gate .obstacle__body {
  background: linear-gradient(180deg, #7d7a86, #4a4753 60%, #2f2d36);
  box-shadow: inset 0 0 0 2px #26242c, inset 0 3px 0 rgba(255, 255, 255, 0.22),
    0 3px 6px rgba(0, 0, 0, 0.5);
  border-radius: 10px 10px 4px 4px;
}

.obstacle--gate .obstacle__body::before {
  content: "";
  position: absolute;
  inset: 16% 20%;
  border-radius: 50% 50% 6px 6px;
  background: var(--gate-color, #3d8bfd);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35), 0 0 10px var(--gate-color, #3d8bfd);
  opacity: 0.9;
}

.obstacle__hp {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 999px;
  background: #c8102e;
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  z-index: 2;
}

.obstacle.is-hit .obstacle__body {
  animation: obHit 260ms ease-out;
}

@keyframes obHit {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(0.86) rotate(-4deg);
    filter: brightness(1.7);
  }
  100% {
    transform: scale(1);
  }
}

.obstacle.is-broken .obstacle__body {
  animation: obBreak 320ms ease-in forwards;
}

@keyframes obBreak {
  to {
    transform: scale(1.35) rotate(12deg);
    opacity: 0;
  }
}

/* ---------- Board FX ---------- */
.fx-spark {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  pointer-events: none;
  animation: sparkFly 620ms ease-out forwards;
}

@keyframes sparkFly {
  from {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  to {
    transform: translate(var(--dx), var(--dy)) scale(0.2);
    opacity: 0;
  }
}

.fx-ring {
  position: absolute;
  border-radius: 50%;
  border: 3px solid rgba(255, 236, 160, 0.9);
  pointer-events: none;
  animation: ringOut 520ms ease-out forwards;
}

@keyframes ringOut {
  from {
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 1;
  }
  to {
    transform: translate(-50%, -50%) scale(2.6);
    opacity: 0;
  }
}

.fx-text {
  position: absolute;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(0.7rem, 2.4vw, 1rem);
  color: #fff3c4;
  text-shadow: 0 2px 0 #7d0a1c, 0 0 10px rgba(245, 197, 66, 0.9);
  pointer-events: none;
  white-space: nowrap;
  animation: floatUp 900ms ease-out forwards;
  z-index: 8;
}

@keyframes floatUp {
  from {
    transform: translate(-50%, 0) scale(0.7);
    opacity: 0;
  }
  25% {
    transform: translate(-50%, -30%) scale(1.1);
    opacity: 1;
  }
  to {
    transform: translate(-50%, -160%) scale(1);
    opacity: 0;
  }
}

/* ---------- Side panels ---------- */
.panel {
  background: linear-gradient(180deg, rgba(46, 30, 24, 0.9), rgba(26, 17, 13, 0.92));
  border: 1.5px solid rgba(245, 197, 66, 0.28);
  border-radius: 16px;
  padding: 0.7rem 0.8rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.panel__title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.panel__title .icon {
  font-size: 1rem;
}

.orders {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.orders li {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
  line-height: 1.35;
}

.orders li b {
  color: var(--ink);
}

.orders .icon {
  color: var(--accent-2);
  font-size: 0.95rem;
  margin-top: 0.12rem;
  flex: 0 0 auto;
}

.codex-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.codex-list li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  line-height: 1.3;
}

.codex-list b {
  color: #ffe9c4;
  font-weight: 700;
}

.fuse-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
  flex: 0 0 auto;
}

.fuse-chip i {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.4);
}

.fuse-chip i.a {
  background: radial-gradient(circle at 34% 30%, #fff, #b9e6ff 45%, #4aa8d8);
}

.fuse-chip i.b {
  background: radial-gradient(circle at 34% 30%, #ffe9a8, #f5a623 55%, #b35c00);
}

.fuse-chip i.c {
  background: radial-gradient(circle at 34% 30%, #ffd0a0, #e05a1a 55%, #8a2a00);
}

.fuse-chip span {
  color: var(--ink-soft);
  font-size: 0.72rem;
}

/* ---------- Modals ---------- */
.screen--modal {
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  background: rgba(10, 6, 4, 0.72);
  backdrop-filter: blur(3px);
}

.modal {
  position: relative;
  width: min(100%, 430px);
  margin: auto;
  text-align: center;
  padding: 1.5rem 1.25rem 1.35rem;
  border-radius: 26px;
  background: linear-gradient(180deg, #3a2318, #1d130e 78%);
  border: 2px solid rgba(245, 197, 66, 0.6);
  box-shadow: 0 0 0 6px rgba(20, 14, 8, 0.9), 0 0 0 8px rgba(245, 197, 66, 0.2),
    0 26px 60px rgba(0, 0, 0, 0.7);
  animation: modalIn 320ms cubic-bezier(0.2, 1.3, 0.5, 1);
}

@keyframes modalIn {
  from {
    transform: scale(0.86) translateY(14px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.modal__crest {
  width: 62px;
  height: 62px;
  margin: -2.6rem auto 0.5rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  color: #3a2402;
  background: radial-gradient(circle at 34% 28%, #fff6d8, #f5c542 55%, #b8860b);
  box-shadow: 0 0 0 3px #6b4a0a, 0 0 0 7px rgba(245, 197, 66, 0.25), 0 8px 18px rgba(0, 0, 0, 0.55);
}

.modal__crest--dim {
  background: radial-gradient(circle at 34% 28%, #8a8078, #4a443c 55%, #2a251f);
  color: #d8cfc2;
  box-shadow: 0 0 0 3px #2a251f, 0 0 0 7px rgba(255, 255, 255, 0.08), 0 8px 18px rgba(0, 0, 0, 0.55);
}

.modal__title {
  font-size: clamp(1.5rem, 5.5vw, 2rem);
  margin: 0 0 0.25rem;
  color: #ffe9c4;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
}

.modal__sub {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 0 auto 0.9rem;
  max-width: 34ch;
}

.stars {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
  font-size: 2.1rem;
  color: rgba(255, 255, 255, 0.18);
}

.stars .icon {
  transition: transform 300ms cubic-bezier(0.2, 1.6, 0.5, 1), color 300ms ease;
}

.stars .icon.is-on {
  color: #ffd76a;
  filter: drop-shadow(0 0 10px rgba(255, 215, 106, 0.85));
  animation: starPop 460ms cubic-bezier(0.2, 1.6, 0.5, 1) backwards;
}

.stars .icon.is-on:nth-child(2) {
  animation-delay: 140ms;
}

.stars .icon.is-on:nth-child(3) {
  animation-delay: 280ms;
}

@keyframes starPop {
  from {
    transform: scale(0) rotate(-60deg);
  }
  to {
    transform: scale(1) rotate(0);
  }
}

.reward-row {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

.reward {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.4);
  border: 1.5px solid rgba(245, 197, 66, 0.35);
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.reward .icon {
  color: #f5c542;
  font-size: 1rem;
}

.reward strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: #ffe9c4;
}

.modal__actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.over-progress {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
  text-align: left;
}

.over-progress div {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.3rem 0.6rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
}

.over-progress b {
  color: #ffe9c4;
  font-family: var(--font-display);
}

.modal--win {
  width: min(100%, 470px);
  padding-top: 0.9rem;
}

.win-art {
  width: 100%;
  border-radius: 18px;
  margin-bottom: 0.8rem;
  border: 2px solid rgba(245, 197, 66, 0.5);
  display: block;
}

/* ---------- Dialogs ---------- */
.dlg {
  width: min(100% - 24px, 560px);
  max-height: min(86dvh, 720px);
  padding: 1.2rem 1.25rem 1.1rem;
  border-radius: 22px;
  border: 2px solid rgba(245, 197, 66, 0.55);
  background: linear-gradient(180deg, #2e1d15, #170f0b 85%);
  color: var(--ink);
  box-shadow: 0 0 0 6px rgba(20, 14, 8, 0.9), 0 26px 60px rgba(0, 0, 0, 0.7);
  overflow-y: auto;
}

.dlg::backdrop {
  background: rgba(10, 6, 4, 0.75);
  backdrop-filter: blur(3px);
}

.dlg h2 {
  margin: 0 0 0.6rem;
  font-size: clamp(1.3rem, 4.5vw, 1.7rem);
  color: #ffe9c4;
}

.dlg h3 {
  margin: 0.9rem 0 0.3rem;
  font-size: 0.95rem;
  color: var(--accent-2);
  letter-spacing: 0.04em;
}

.dlg p {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin: 0 0 0.5rem;
  max-width: none;
}

.dlg__lead {
  font-size: 0.88rem;
}

.dlg__body {
  max-height: 56dvh;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 0.8rem;
}

.dlg__close-form {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  margin: 0;
}

.dlg__close {
  width: 34px;
  height: 34px;
  font-size: 0.9rem;
}

.rule-list {
  margin: 0 0 0.5rem;
  padding-left: 1.1rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
  display: grid;
  gap: 0.3rem;
}

.rule-list b {
  color: var(--ink);
}

.codex-list--full {
  gap: 0.55rem;
  font-size: 0.86rem;
  margin-bottom: 0.9rem;
}

.codex-list--full li {
  padding: 0.45rem 0.6rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(245, 197, 66, 0.18);
}

.codex-list--full .fuse-chip i {
  width: 20px;
  height: 20px;
}

/* ---------- Confetti ---------- */
.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  overflow: hidden;
}

.confetti {
  position: absolute;
  top: -20px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: confFall linear forwards;
}

@keyframes confFall {
  to {
    transform: translateY(105vh) rotate(720deg);
    opacity: 0.2;
  }
}

/* ---------- Small screens ---------- */
@media (max-width: 420px) {
  .play-heading span {
    display: none;
  }

  .stat__label {
    display: none;
  }

  .parade__meta span {
    font-size: 0.58rem;
  }
}

@media (max-height: 620px) and (max-width: 899px) {
  .parade {
    padding-block: 0.15rem;
  }

  .parade__rail {
    height: 22px;
  }

  .play-foot .btn--small {
    min-height: 34px;
    font-size: 0.78rem;
    padding: 0.35rem 0.6rem;
  }
}
/* ============================================================
   Objectives + fusion codex (markup built by js/game/flow.js)
   ============================================================ */
.objective {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.55rem;
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.42);
  border: 1.5px solid rgba(245, 197, 66, 0.24);
  min-width: 0;
}

.objective__icon {
  font-size: 1.05rem;
  flex: 0 0 auto;
  color: var(--accent-2);
}

.objective__body {
  min-width: 0;
  flex: 1 1 auto;
  line-height: 1.1;
}

.objective__label {
  display: block;
  font-size: clamp(0.56rem, 1.8vw, 0.66rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.objective__sub {
  display: block;
  font-size: 0.62rem;
  color: var(--ink-soft);
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.objective__value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(0.82rem, 2.5vw, 0.98rem);
  color: #ffe9c4;
  flex: 0 0 auto;
}

.objective.is-done {
  border-color: rgba(53, 196, 106, 0.65);
  background: rgba(18, 122, 60, 0.25);
}

.objective.is-done .objective__icon {
  color: #6ff0a0;
}

.objective__bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin-top: 3px;
}

.objective__bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #d81f38, #f5c542);
  transition: width 300ms ease;
}

/* ---------- codex ---------- */
.codex-item {
  display: grid;
  gap: 0.2rem;
  padding: 0.42rem 0;
  border-bottom: 1px solid rgba(245, 197, 66, 0.12);
}

.codex-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.codex-item__pair {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.codex-chip {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(245, 197, 66, 0.16);
  border: 1px solid rgba(245, 197, 66, 0.4);
  color: #ffe9c4;
  white-space: nowrap;
}

.codex-plus {
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 700;
}

.codex-item__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  color: #ffe9c4;
  line-height: 1.2;
}

.codex-item__desc {
  font-size: 0.7rem;
  line-height: 1.35;
  color: var(--ink-soft);
}

/* ---------- parade polish ---------- */
.parade__fill {
  background: linear-gradient(90deg, #8d0a20, #d81f38 45%, #f5c542 100%);
  box-shadow: 0 0 14px rgba(245, 197, 66, 0.45);
}

.parade__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.parade__meta strong {
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  color: #ffe9c4;
}

/* ---------- jewel legend ---------- */
.jewel-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 0.4rem;
  margin: 0.5rem 0 0.2rem;
  padding: 0;
  list-style: none;
}

.jewel-legend li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.74rem;
  color: var(--ink-soft);
}

.jewel-legend i {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.5);
}

.jewel-legend i[data-gem="ruby"] {
  background: radial-gradient(circle at 34% 28%, #ff9aa6, #e63950 55%, #a3122c);
}
.jewel-legend i[data-gem="sapphire"] {
  background: radial-gradient(circle at 34% 28%, #8fc0ff, #3d8bfd 55%, #1b4bb8);
}
.jewel-legend i[data-gem="emerald"] {
  background: radial-gradient(circle at 34% 28%, #8ff0b4, #35c46a 55%, #127a3c);
}
.jewel-legend i[data-gem="topaz"] {
  background: radial-gradient(circle at 34% 28%, #ffe9a0, #ffc93c 55%, #d98a06);
}
.jewel-legend i[data-gem="amethyst"] {
  background: radial-gradient(circle at 34% 28%, #dcb4ff, #a86bf0 55%, #6a2fb0);
}
.jewel-legend i[data-gem="pearl"] {
  background: radial-gradient(circle at 34% 28%, #ffffff, #c8eef8 55%, #7fd4e8);
}
/* ============================================================
   Glossy jewel depth + parade contrast
   ============================================================ */
.tile__body svg {
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.55));
}

.tile__body {
  transition: transform 120ms ease;
}

.tile.is-selected .tile__body {
  transform: scale(1.12);
}

/* brighter board well so the checker reads */
.board {
  background:
    radial-gradient(circle at 50% 0%, #4a2c52, #241428 62%, #170d1c 100%);
}

.cellbg::after {
  background: rgba(255, 255, 255, 0.055);
}

/* parade rail: lift it off the band */
.parade__rail {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.07) 0 10px,
      transparent 10px 20px
    ),
    linear-gradient(180deg, #4a3420, #2a1e14);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.7),
    inset 0 0 0 1.5px rgba(245, 197, 66, 0.35);
}

.parade__fill {
  min-width: 8px;
}

.parade__king svg {
  width: clamp(40px, 9vw, 54px);
}

/* combo callout */
.combo-pop {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%) scale(0.6);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.1rem, 4vw, 1.7rem);
  letter-spacing: 0.02em;
  color: #fff3c4;
  text-shadow: 0 2px 0 #8a5600, 0 6px 18px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  opacity: 0;
  z-index: 40;
}

.combo-pop.is-on {
  animation: comboPop 900ms cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}

@keyframes comboPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  25% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.12);
  }
  70% {
    opacity: 1;
    transform: translate(-50%, -60%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -85%) scale(0.95);
  }
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, 20px);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: rgba(20, 14, 8, 0.94);
  border: 1.5px solid rgba(245, 197, 66, 0.5);
  color: #ffe9c4;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
  z-index: 200;
}

.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* confetti */
.confetti-piece {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  opacity: 0.95;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0.9;
  }
}

@media (prefers-reduced-motion: reduce) {
  .confetti-piece,
  .combo-pop.is-on,
  .parade__king.is-arriving {
    animation: none !important;
  }
}
/* ============================================================
   Obstacle clarity, mobile orders panel, touch targets
   ============================================================ */
.obstacle__body {
  border-radius: 9px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.22),
    inset 0 -3px 0 rgba(0, 0, 0, 0.35),
    0 3px 7px rgba(0, 0, 0, 0.55);
}

.obstacle__hp {
  font-size: 0.62rem;
  font-weight: 800;
}

/* mobile: expedition orders sit under the board so the screen is not half empty */
@media (max-width: 899px) {
  .play-main {
    grid-template-areas: "objectives" "board" "side";
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .side-col {
    grid-area: side;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    overflow-y: auto;
    padding-right: 2px;
  }

  .side-col .panel--codex {
    display: none;
  }

  .side-col .panel {
    padding: 0.45rem 0.6rem;
  }

  .side-col .orders {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.15rem;
    font-size: 0.72rem;
  }
}

/* touch targets */
.skip,
.brand {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.nav-toggle {
  background: rgba(245, 197, 66, 0.14);
  border: 1.5px solid rgba(245, 197, 66, 0.45);
  color: #ffe9c4;
  border-radius: 999px;
  padding: 0 0.9rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

@media (max-width: 719px) {
  .nav-toggle {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}
/* ============================================================
   Parade track legibility
   ============================================================ */
.parade__rail {
  height: clamp(34px, 8vw, 44px);
  border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.07) 0 9px, transparent 9px 18px),
    linear-gradient(180deg, #4d3620, #291d13);
  box-shadow:
    inset 0 2px 7px rgba(0, 0, 0, 0.75),
    inset 0 0 0 1.5px rgba(245, 197, 66, 0.42),
    0 2px 8px rgba(0, 0, 0, 0.4);
}

.parade__fill {
  min-width: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #8d0a20, #d81f38 45%, #f5c542);
  box-shadow: 0 0 14px rgba(245, 197, 66, 0.55);
}

.parade__king svg {
  width: clamp(38px, 10vw, 54px);
  height: auto;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.75));
}

.parade__flag {
  box-shadow: 0 0 0 2px rgba(20, 14, 8, 0.7), 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* ============================================================
   Touch targets
   ============================================================ */
.nav-toggle,
#btn-leave,
#btn-hint,
#btn-codex,
#btn-mute,
#btn-play,
#btn-howto {
  min-height: 44px;
}

#btn-leave {
  min-width: 44px;
}

/* ============================================================
   Combo callout
   ============================================================ */
.combo-pop {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%) scale(0.6);
  z-index: 9;
  pointer-events: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.1rem, 4.5vw, 1.9rem);
  letter-spacing: 0.02em;
  color: #fff3c4;
  text-shadow: 0 2px 0 #8d0a20, 0 4px 14px rgba(0, 0, 0, 0.8);
  opacity: 0;
}

.combo-pop.is-on {
  animation: comboPop 900ms cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}

@keyframes comboPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5) rotate(-6deg);
  }
  25% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.15) rotate(2deg);
  }
  70% {
    opacity: 1;
    transform: translate(-50%, -60%) scale(1) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -90%) scale(0.95);
  }
}
[1553 bytes written earlier; removed from this conversation to save room. The file is on disk. Read it again only if you need its text for an edit.]