/* Star Box. Layout is driven by --k (px per 750-wide design unit) and --board, both set by main.js
   from the measured container (see view.js). The stage is never mirrored; the HUD and panels follow dir. */
:root {
  color-scheme: dark;
  --gold: #ffd77a;
  --gold-deep: #c8862a;
  --cream: #fff0c8;
  --ink: #2a0d08;
  --red: #b3261c;
  --game-h: 100dvh;
  --k: 0.52px;
  --board: 360px;
  --dragon-top: 0px;
  --dragon-h: 400px;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--cream);
  background: transparent;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #fff4be;
  outline-offset: 3px;
}
button:disabled {
  cursor: default;
}
img {
  -webkit-user-drag: none;
  user-select: none;
}
#game {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 500px);
  height: var(--game-h);
  min-height: 0;
  padding: max(2px, env(safe-area-inset-top)) calc(var(--k) * 14)
    max(4px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--k) * 8);
  overflow: hidden;
  background: #1a0805;
  isolation: isolate;
}
.bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(#1a080599, #1a080522 40%, #1a080577),
    url(assets/art/bg.webp?v=2ab444fbdec84a690c3daeb20e73c36114c6eded8af2c0b8081769dde5729c9d) center/cover;
}
.dragon {
  position: absolute;
  top: var(--dragon-top);
  height: var(--dragon-h);
  width: auto;
  z-index: -1;
  pointer-events: none;
  filter: drop-shadow(0 4px 10px #000a);
}
.dragon-l {
  left: calc(var(--k) * -34);
}
.dragon-r {
  right: calc(var(--k) * -34);
}
body.no-dragons .dragon {
  display: none;
}

/* ---------- HUD (follows document direction) ---------- */
.hud {
  display: flex;
  align-items: center;
  gap: calc(var(--k) * 8);
  width: 100%;
  height: calc(var(--k) * 84);
  flex: none;
}
.round-btn {
  width: calc(var(--k) * 70);
  height: calc(var(--k) * 70);
  min-width: 34px;
  min-height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: radial-gradient(circle at 35% 30%, #7a3a1c, #2e0f07 75%);
  box-shadow:
    inset 0 0 0 2px #0006,
    0 2px 6px #000a;
  color: #ffe9a8;
  font-size: calc(var(--k) * 40);
  line-height: 1;
}
[dir="rtl"] #exit span {
  display: inline-block;
  transform: scaleX(-1);
}
.title {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.title img {
  height: calc(var(--k) * 78);
  width: auto;
  flex: none;
  filter: drop-shadow(0 2px 3px #000a);
}
.round-no {
  font-size: calc(var(--k) * 24);
  color: #ffe2a0;
  text-shadow: 0 1px 2px #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.view-control {
  display: flex;
  flex: none;
  border: 2px solid var(--gold);
  border-radius: 999px;
  overflow: hidden;
  background: #2a0d08;
  height: calc(var(--k) * 58);
  min-height: 30px;
}
.view-control button {
  border: 0;
  padding: 0 calc(var(--k) * 14);
  background: transparent;
  font-size: calc(var(--k) * 24);
  font-weight: 700;
  color: #e9c984;
  min-width: 34px;
}
.view-control button[aria-pressed="true"] {
  background: linear-gradient(#ffd77a, #c8862a);
  color: #3a1306;
}

/* ---------- pool plaque + bonus medals ---------- */
.top {
  position: relative;
  width: 100%;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--k) * 8);
  height: calc(var(--k) * (130 + 8 + 110));
}
.combo .top {
  flex-direction: row;
  justify-content: center;
  gap: calc(var(--k) * 14);
  height: calc(var(--k) * 118);
}
.pool {
  position: relative;
  height: calc(var(--k) * 130);
  aspect-ratio: 640 / 238;
  flex: none;
}
.combo .pool {
  height: calc(var(--k) * 118);
}
.pool img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.pool-text {
  position: absolute;
  inset: 27% 16% 23%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
}
.pool-text small {
  font-size: calc(var(--k) * 20);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffd98f;
}
.pool-text b {
  font-size: calc(var(--k) * 44);
  color: #ffe27a;
  text-shadow:
    0 2px 0 #7a3a07,
    0 0 12px #ff9a1f88;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pool.hit {
  animation: pool-hit 0.7s ease-in-out 3;
}
.medals {
  display: flex;
  gap: calc(var(--k) * 26);
  height: calc(var(--k) * 110);
  direction: ltr;
}
.combo .medals {
  gap: calc(var(--k) * 12);
  height: calc(var(--k) * 96);
}
.medal {
  position: relative;
  height: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
.medal img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 3px 4px #000a);
}
.medal b {
  position: relative;
  font-size: calc(var(--k) * 40);
  color: #fff6d6;
  text-shadow:
    0 2px 0 #3a0d06,
    0 0 6px #000a;
}
.medal.spin {
  animation: medal-spin 0.18s linear infinite;
}
.medal.hit img {
  filter: drop-shadow(0 0 10px #ffd35a) brightness(1.25);
}
.medal.hit {
  animation: medal-pop 0.5s ease-out 2;
}

/* ---------- countdown banner (stretched plaque) ---------- */
.banner {
  flex: none;
  height: calc(var(--k) * 74);
  min-width: calc(var(--k) * 440);
  max-width: 100%;
  display: grid;
  place-items: center;
  padding: 0 calc(var(--k) * 70);
  border-style: solid;
  border-width: 0 calc(var(--k) * 64);
  border-image: url(assets/art/banner.webp?v=2ab444fbdec84a690c3daeb20e73c36114c6eded8af2c0b8081769dde5729c9d) 0 90 fill / 0 calc(var(--k) * 64) / 0 stretch;
}
.banner p {
  margin: 0;
  display: flex;
  gap: 0.5em;
  align-items: baseline;
  font-size: calc(var(--k) * 34);
  font-weight: 800;
  color: #fff0c0;
  text-shadow: 0 2px 0 #4a1308;
  white-space: nowrap;
}
.banner b {
  color: #ffd35a;
  font-variant-numeric: tabular-nums;
}
.no-banner .banner {
  display: none;
}

/* ---------- board ---------- */
.board {
  position: relative;
  width: 100%;
  height: var(--board);
  flex: none;
}
/* the frame is a little larger than its slot; neighbouring rows sit above the overlap */
.frame-wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  height: calc(var(--board) * 1.12);
  aspect-ratio: 960 / 949;
  transform: translate(-50%, -50%);
}
.hud,
.top,
.banner,
.strip,
.chips,
.bottom {
  position: relative;
  z-index: 3;
}
.frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(0 6px 10px #000b);
}
.grid {
  position: absolute;
  left: 16.56%;
  top: 17.7%;
  width: 66.88%;
  height: 65.44%;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  gap: 1.2%;
  z-index: 1;
  direction: ltr;
}
.cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  border-radius: 8%;
  background:
    radial-gradient(circle at 50% 38%, #4a1c0f, #1d0907 85%);
  box-shadow:
    inset 0 0 0 1px #d9a14a66,
    inset 0 0 14px #000c;
}
button.chest {
  padding: 0;
  border: 0;
  color: inherit;
  display: block;
}
.chest img.box {
  position: absolute;
  left: 50%;
  bottom: 6%;
  width: 112%;
  transform: translateX(-50%);
  pointer-events: none;
  transition: filter 0.2s;
}
.chest img.open {
  opacity: 0;
}
.chest.open img.closed {
  opacity: 0;
}
.chest.open img.open {
  opacity: 1;
  animation: chest-open 0.55s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.chest .tag {
  position: absolute;
  right: 4%;
  bottom: 3%;
  padding: 0 0.35em;
  min-width: 2.6em;
  text-align: center;
  font-size: max(12px, calc(var(--board) * 0.036));
  font-weight: 800;
  line-height: 1.4;
  color: #ffe9a4;
  background: linear-gradient(#7a1d12, #3d0d08);
  border: 1.5px solid #e9b44f;
  border-radius: 999px;
  box-shadow: 0 2px 3px #000a;
  z-index: 2;
}
.chest .mine {
  position: absolute;
  left: 3%;
  top: 3%;
  max-width: 94%;
  padding: 0 0.4em;
  font-size: max(12px, calc(var(--board) * 0.034));
  font-weight: 800;
  line-height: 1.4;
  color: #2a1204;
  background: linear-gradient(#ffe38a, #e0a02c);
  border-radius: 999px;
  box-shadow: 0 1px 3px #000a;
  z-index: 2;
}
.chest.selected {
  box-shadow:
    inset 0 0 0 2px #ffd35a,
    inset 0 0 14px #000c;
}
.chest.lit {
  z-index: 3;
  box-shadow:
    inset 0 0 0 3px #fff2a8,
    0 0 18px 4px #ffb62e;
  animation: chest-lit 0.35s ease-out;
}
.chest.lit img.box {
  filter: brightness(1.3) saturate(1.2) drop-shadow(0 0 8px #ffd35a);
}
.revealing .chest:not(.lit):not(.open) img.box {
  filter: brightness(0.5) saturate(0.7);
}
.chest.open {
  z-index: 3;
  box-shadow:
    inset 0 0 0 3px #ffd35a,
    0 0 20px 5px #ff9f1c;
}
.chest.extra::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8%;
  box-shadow: 0 0 0 2px #7dd8ff;
  pointer-events: none;
}
.chest:disabled .tag {
  filter: none;
}
.chest.pending {
  animation: pending 0.5s ease-in-out infinite alternate;
}
.hub {
  display: grid;
  place-items: center;
  background: none;
  box-shadow: none;
}
.hub img {
  position: absolute;
  inset: -4%;
  width: 108%;
  height: 108%;
  object-fit: contain;
  filter: drop-shadow(0 0 10px #ff7a1a99);
}
.hub-info {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}
.hub-info b {
  font-size: calc(var(--board) * 0.16);
  color: #ffe27a;
  text-shadow:
    0 2px 0 #7a3a07,
    0 0 14px #ff9a1f;
  font-variant-numeric: tabular-nums;
}
.hub-info small {
  display: none;
}

.hub.urgent .hub-info b {
  color: #ff7e5c;
  animation: urgent 0.5s ease-in-out infinite alternate;
}
.hub.reveal .hub-info b {
  animation: spin-star 1.4s linear infinite;
}
.burst {
  position: absolute;
  left: 16.56%;
  top: 17.7%;
  width: 66.88%;
  height: 65.44%;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4%;
  pointer-events: none;
  background: radial-gradient(circle, #ffb83a66, #0000 70%);
  animation: burst 2s ease-out forwards;
}
.burst[hidden] {
  display: none;
}
.burst-medal {
  position: relative;
  width: 30%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 0 16px #ffd35a);
}
.burst-medal img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.burst-medal b {
  position: relative;
  font-size: calc(var(--board) * 0.1);
  color: #fff6d6;
  text-shadow:
    0 2px 0 #3a0d06,
    0 0 6px #000a;
}
.burst p {
  margin: 0;
  max-width: 92%;
  padding: 0.15em 0.8em;
  text-align: center;
  font-size: calc(var(--board) * 0.052);
  font-weight: 900;
  color: #fff3b8;
  background: #2a0d08dd;
  border: 2px solid var(--gold);
  border-radius: 14px;
  text-shadow: 0 2px 0 #6a2308;
}

/* ---------- recent strip ---------- */
.strip {
  flex: none;
  position: relative;
  width: 100%;
  height: calc(var(--k) * 80);
  padding: 0 calc(var(--k) * 70);
  display: flex;
  align-items: center;
  gap: calc(var(--k) * 8);
  border-style: solid;
  border-width: 0 calc(var(--k) * 62);
  border-image: url(assets/art/strip.webp?v=2ab444fbdec84a690c3daeb20e73c36114c6eded8af2c0b8081769dde5729c9d) 0 100 fill / 0 calc(var(--k) * 62) / 0 stretch;
  background-color: transparent;
}
.strip-badge {
  position: absolute;
  inset-inline-start: calc(var(--k) * 10);
  top: 50%;
  height: calc(var(--k) * 50);
  transform: translateY(-50%);
}
.strip-items {
  display: flex;
  flex: 1;
  justify-content: flex-start;
  gap: calc(var(--k) * 22);
  padding-inline-start: calc(var(--k) * 70);
  align-items: center;
  direction: ltr;
}
.strip-items img {
  height: calc(var(--k) * 58);
  width: auto;
}
.strip-items img:first-child {
  filter: drop-shadow(0 0 6px #ffd35a);
  transform: scale(1.12);
}
/* a result row/box the client cannot show (unknown or missing data): a visible stand-in instead of a blank */
.ph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6em;
  height: 1.6em;
  border: 1px dashed currentColor;
  border-radius: 6px;
  color: #ffe27a;
  font-weight: 800;
}
.strip-items .ph {
  height: calc(var(--k) * 58);
  min-width: calc(var(--k) * 58);
  font-size: calc(var(--k) * 28);
}
.result-boxes .ph {
  height: 56px;
  min-width: 56px;
  font-size: 24px;
}
.no-strip .strip {
  display: none;
}

/* ---------- key chips ---------- */
.chips {
  flex: none;
  width: 100%;
  height: calc(var(--k) * 104);
  display: flex;
  justify-content: space-around;
  align-items: center;
  direction: ltr;
}
.chips button {
  position: relative;
  height: 100%;
  aspect-ratio: 223 / 170;
  padding: 0;
  border: 0;
  background: none;
  transition: transform 0.15s;
}
.chips button img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 3px 4px #000a);
}
.chips button b {
  position: absolute;
  left: 3%;
  top: 11%;
  width: 41%;
  height: 54%;
  display: grid;
  place-items: center;
  font-size: calc(var(--k) * 26);
  color: #fff;
  text-shadow: 0 1px 2px #000;
}
.chips button[aria-pressed="true"] {
  transform: scale(1.14) translateY(-3%);
}
.chips button[aria-pressed="true"] img {
  filter: drop-shadow(0 0 8px #ffd35a) brightness(1.2);
}

/* ---------- bottom row ---------- */
.bottom {
  flex: none;
  width: 100%;
  height: calc(var(--k) * 92);
  display: flex;
  align-items: center;
  gap: calc(var(--k) * 10);
}
.pill {
  position: relative;
  flex: 1;
  min-width: 0;
  height: calc(var(--k) * 72);
  padding: 0;
  display: flex;
  align-items: center;
  border-style: solid;
  border-width: 0 calc(var(--k) * 28);
  border-image: url(assets/art/btn-pill.webp?v=2ab444fbdec84a690c3daeb20e73c36114c6eded8af2c0b8081769dde5729c9d) 0 70 fill / 0 calc(var(--k) * 28) / 0 stretch;
  background: none;
  color: #fff4cf;
}
.pill-in {
  display: flex;
  align-items: center;
  gap: calc(var(--k) * 8);
  min-width: 0;
  width: 100%;
  direction: ltr;
}
.pill-icon {
  height: calc(var(--k) * 34);
  width: auto;
  flex: none;
}
.pill b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: max(12px, calc(var(--k) * 24));
  font-variant-numeric: tabular-nums;
}
.pill b.long {
  font-size: max(12px, calc(var(--k) * 20));
}
.pill-cap {
  position: absolute;
  top: calc(var(--k) * -16);
  inset-inline-start: 0;
  width: 100%;
  text-align: center;
  font-size: calc(var(--k) * 15);
  color: #ffd98f;
  text-shadow: 0 1px 2px #000;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.auto {
  position: relative;
  flex: none;
  height: calc(var(--k) * 92);
  aspect-ratio: 520 / 153;
  padding: 0;
  border: 0;
  background: none;
  transition: transform 0.15s;
}
.auto img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 3px 4px #000a);
}
.auto-in {
  position: absolute;
  inset: 12% 14%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
}
.auto b {
  font-size: calc(var(--k) * 40);
  color: #fff;
  text-shadow: 0 2px 0 #5a0d08;
}
.auto small {
  font-size: calc(var(--k) * 20);
  color: #ffe9a4;
  font-weight: 700;
}
.auto[aria-pressed="true"] img {
  filter: drop-shadow(0 0 10px #ffd35a) brightness(1.18);
  animation: auto-on 1.2s ease-in-out infinite alternate;
}
.auto:active {
  transform: scale(0.96);
}

/* ---------- feedback ---------- */
.feedback {
  position: absolute;
  top: calc(var(--k) * 90);
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
.connection,
.notice {
  pointer-events: auto;
  max-width: 92%;
  padding: 8px 14px;
  border-radius: 14px;
  border: 2px solid var(--gold);
  background: #2a0d08ee;
  box-shadow: 0 6px 16px #000b;
  font-size: 14px;
  text-align: center;
}
.notice {
  display: flex;
  align-items: center;
  gap: 10px;
}
.notice[hidden],
.connection[hidden] {
  display: none;
}
.notice p {
  margin: 0;
}
.notice button {
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: #5b2210;
  padding: 3px 12px;
}

/* ---------- result card ---------- */
.result-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  width: min(86%, 360px);
  max-height: 92%;
  overflow: auto;
  padding: 18px 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  border: 3px solid var(--gold);
  border-radius: 20px;
  background: linear-gradient(#4a1a0e, #230907);
  box-shadow:
    0 0 0 2px #0008,
    0 12px 36px #000d,
    inset 0 0 28px #ff8a1a44;
  animation: card-in 0.35s cubic-bezier(0.2, 1.3, 0.4, 1);
}
.result-card[hidden] {
  display: none;
}
.result-boxes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  min-height: 52px;
  direction: ltr;
}
.result-boxes img {
  height: 56px;
  width: auto;
}
.result-event {
  margin: 0;
  color: #ffe27a;
  font-weight: 800;
}
.result-card strong {
  font-size: 16px;
  color: #ffd98f;
}
#result-reward {
  font-size: 34px;
  color: #ffe27a;
  text-shadow: 0 2px 0 #7a3a07;
  font-variant-numeric: tabular-nums;
}
.result-values {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 14px;
  width: 100%;
  font-size: 14px;
}
.result-values b {
  text-align: end;
  font-variant-numeric: tabular-nums;
}
.result-close {
  position: absolute;
  top: 6px;
  inset-inline-end: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: #3a130a;
  font-size: 18px;
  line-height: 1;
}
#result-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
#result-next {
  width: 100%;
  min-height: 40px;
  border: 2px solid var(--gold);
  border-radius: 999px;
  background: linear-gradient(#d33a2c, #8f1a12);
  font-weight: 800;
}
#result-auto {
  margin: 0;
  font-size: 12px;
  color: #d9b878;
}

/* ---------- loading / exited ---------- */
.loading {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background:
    linear-gradient(#1a0805cc, #1a0805ee),
    url(assets/art/bg.webp?v=2ab444fbdec84a690c3daeb20e73c36114c6eded8af2c0b8081769dde5729c9d) center/cover;
}
.loading[hidden] {
  display: none;
}
.loading > img {
  width: min(52%, 220px);
  height: auto;
  filter: drop-shadow(0 6px 14px #000c);
  animation: logo-float 2.4s ease-in-out infinite alternate;
}
.loading p {
  margin: 0;
}
.loading progress {
  width: 60%;
  height: 8px;
  accent-color: #ffb62e;
}
.loading button {
  min-height: 40px;
  padding: 0 22px;
  border: 2px solid var(--gold);
  border-radius: 999px;
  background: linear-gradient(#d33a2c, #8f1a12);
  font-weight: 800;
}
.loading button[hidden] {
  display: none;
}
.loading small {
  color: #b99a62;
}
.loading.failed progress {
  display: none;
}

/* ---------- panels (scoped to the game container, never a page-wide mask) ---------- */
#panel-mask {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: #000a;
}
#panel-mask[hidden] {
  display: none;
}
dialog#panel {
  position: absolute;
  inset: auto 0 0 0;
  margin: 0 auto;
  width: min(100%, 500px);
  max-width: 100%;
  max-height: 88%;
  min-height: 0;
  padding: 0;
  z-index: 51;
  color: var(--cream);
  background: linear-gradient(#3b150b, #1f0906);
  border: 3px solid var(--gold);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  overflow: hidden;
  flex-direction: column;
}
dialog#panel[open] {
  display: flex;
  animation: sheet-in 0.25s ease-out;
}
dialog#panel header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #d9a14a55;
}
dialog#panel h2 {
  margin: 0;
  font-size: 18px;
  color: #ffd98f;
}
#panel-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: #3a130a;
  font-size: 20px;
  line-height: 1;
}
#panel-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 10px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#panel-body label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
}
#panel-body input[type="range"] {
  flex: 1;
  accent-color: #ffb62e;
}
#panel-body output {
  min-width: 3.4em;
  text-align: end;
}
#panel-body select {
  background: #3a130a;
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 6px;
}
#panel-body ol {
  margin: 0;
  padding-inline-start: 1.3em;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  line-height: 1.4;
}
.tabs {
  display: flex;
  gap: 6px;
}
.tabs button {
  flex: 1;
  min-height: 36px;
  border: 1px solid #d9a14a88;
  border-radius: 999px;
  background: #3a130a;
  font-size: 13px;
}
.tabs button[aria-selected="true"] {
  background: linear-gradient(#ffd77a, #c8862a);
  color: #3a1306;
  font-weight: 800;
}
.record {
  padding: 8px 10px;
  border-radius: 12px;
  background: #ffffff10;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.record > div {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.record img {
  height: 30px;
  width: auto;
}
.record .row {
  justify-content: space-between;
}
.record-values {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  font-size: 12px;
}
.record-values span {
  display: block;
  color: #d9b878;
}
.rule-box {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rule-box span {
  flex: 1;
}
.rule-box img {
  height: 34px;
  width: auto;
}
.list-caption,
.my-ranking {
  margin: 0;
  font-size: 13px;
  color: #d9b878;
}
.panel-retry {
  align-self: center;
  min-height: 38px;
  padding: 0 20px;
  border: 2px solid var(--gold);
  border-radius: 999px;
  background: linear-gradient(#d33a2c, #8f1a12);
}

/* ---------- reduced effects ---------- */
.low-motion *,
.low-motion *::before,
.low-motion *::after {
  animation-duration: 0.001s !important;
  animation-iteration-count: 1 !important;
  transition: none !important;
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
  }
}

@keyframes chest-lit {
  from {
    transform: scale(1.12);
  }
  to {
    transform: scale(1);
  }
}
@keyframes chest-open {
  from {
    transform: translateX(-50%) scale(0.86);
  }
  to {
    transform: translateX(-50%) scale(1);
  }
}
@keyframes pending {
  to {
    opacity: 0.7;
  }
}
@keyframes urgent {
  to {
    transform: scale(1.14);
  }
}
@keyframes spin-star {
  50% {
    transform: scale(1.12);
    opacity: 0.7;
  }
}
@keyframes medal-spin {
  50% {
    transform: scale(1.08);
  }
}
@keyframes medal-pop {
  50% {
    transform: scale(1.22);
  }
}
@keyframes pool-hit {
  50% {
    transform: scale(1.08);
    filter: brightness(1.4);
  }
}
@keyframes burst {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  14% {
    opacity: 1;
    transform: scale(1.08);
  }
  80% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
  }
}
@keyframes auto-on {
  to {
    filter: drop-shadow(0 0 16px #ffd35a) brightness(1.3);
  }
}
@keyframes card-in {
  from {
    opacity: 0;
    transform: translate(-50%, -46%) scale(0.9);
  }
}
@keyframes sheet-in {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
}
@keyframes logo-float {
  to {
    transform: translateY(-6px);
  }
}

/* The server-stage wait hint never intercepts gameplay or panel actions. */
#next-open {
  pointer-events: none;
}

/* Reserve disjoint touch targets even when the artwork scales down. */
.hud {
  min-height: 48px;
}
.hud button {
  min-width: 44px;
  min-height: 44px;
}

.hud .title {
  overflow: hidden;
}
.hud .title img {
  max-width: 100%;
  object-fit: contain;
}

.view-control {
  height: 48px;
}
.view-control button {
  width: 44px;
  padding: 0 2px;
  font-size: 12px;
}

.chest .mine {
  top: 0;
  padding-inline: 1px;
  line-height: 1.1;
  overflow-wrap: anywhere;
  white-space: normal;
}
.pool-text b {
  max-width: 100%;
  font-size: max(12px, calc(var(--k) * 30));
  overflow-wrap: anywhere;
  white-space: normal;
  text-align: center;
}

.pool-text {
  inset: 22% 12% 15%;
}
.hud .round-btn {
  position: relative;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.hud .round-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #7a3a1c, #2e0f07 75%);
  box-shadow: inset 0 0 0 2px #0006, 0 2px 6px #000a;
  pointer-events: none;
}
.hud .round-btn span {
  position: relative;
}

/* Keep complete formatted amounts readable inside the money pills. */
.pill b {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.05;
}

/* The board gives space back when the touch-sized HUD exceeds its design row. */
.board {
  flex-shrink: 1;
}
.frame-wrap {
  height: 112%;
}

.chest .tag {
  line-height: 1;
}
