/* Crown Coins v2 — single fixed screen, red cabinet + crown crest, purple royal field.
   Presentation only; layout contract: 360x640, no page scroll, SPIN on first screen. */
:root {
  --purple0: #160826;
  --purple1: #2a1052;
  --purple2: #3d1a6e;
  --cabinet0: #4d0603;
  --cabinet1: #8f120f;
  --cabinet2: #c2271c;
  --gold: #f6c84e;
  --gold-hi: #ffe98a;
  --gold-lo: #c47f0a;
  --gold-dark: #7a4d02;
  --ink: #fff7e0;
  --panel: rgba(22, 8, 38, 0.72);
  --cellh: clamp(58px, 9.95dvh, 88px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
button:focus { outline: none; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(120% 55% at 50% 108%, rgba(246, 200, 78, 0.20) 0%, rgba(246, 200, 78, 0) 55%),
    radial-gradient(90% 40% at 50% -6%, rgba(122, 60, 220, 0.35) 0%, rgba(122, 60, 220, 0) 60%),
    linear-gradient(180deg, var(--purple2) 0%, var(--purple1) 45%, var(--purple0) 100%);
  overflow: hidden;
}
.layout {
  height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  padding: 5px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* ---- top bar ---- */
.topbar { display: flex; align-items: center; gap: 5px; min-height: 26px; }
.pill {
  background: var(--panel);
  border: 1px solid rgba(246, 200, 78, 0.45);
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}
.net-pill { font-size: 11px; color: #9ae6b4; flex: none; }
.balance-pill { font-weight: 700; color: var(--gold-hi); margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.lang-toggle { margin-left: 0; cursor: pointer; font: inherit; }

/* ---- brand strip ---- */
.brand-strip { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 26px; }
.crown-crest { width: 46px; height: 28px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.5)); }
.brand-strip h1 {
  margin: 0;
  font-size: 21px;
  letter-spacing: 2px;
  font-weight: 900;
  background: linear-gradient(180deg, var(--gold-hi) 20%, var(--gold) 55%, var(--gold-lo));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 0 rgba(0,0,0,.18);
}

/* ---- tier plaques: a faceted gem set into a dark, gold-bevelled plaque;
   the ETB value sits in a recessed window, like a real cabinet ---- */
.tiers { text-align: center; }
.tiers-label { font-size: 10px; letter-spacing: 1.6px; color: #d9c7ff; opacity: .9; margin-bottom: 1px; }
.tier-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 16px; }
.tier {
  position: relative;
  border-radius: 10px;
  padding: 4px 2px 5px;
  color: #fff;
  background: linear-gradient(180deg, #2b1450, #170a2c);
  border: 2px solid #8a5a02;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), inset 0 0 0 2px rgba(0,0,0,.45), 0 3px 6px rgba(0,0,0,.5);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.tier-gem {
  width: 31px; height: 31px; margin-top: -24px; margin-bottom: 1px;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.55));
}
.tier.ultra { border-color: #d99a16; }
.tier.ultra::after {
  content: ""; position: absolute; top: -12px; right: 5px;
  width: 13px; height: 9px;
  background: linear-gradient(180deg, #ffe98a, #d99a16);
  clip-path: polygon(0 100%, 0 35%, 25% 65%, 50% 0, 75% 65%, 100% 35%, 100% 100%);
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.5));
}
.tier-name { font-size: 9.5px; letter-spacing: 1.6px; font-weight: 700; color: #d9c7ff; }
.tier b {
  font-size: 17px; line-height: 1.05; font-weight: 900;
  background: linear-gradient(180deg, #fff3c4, #f6c84e 60%, #d99a16);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.65));
}
.tier strong {
  font-size: 9.5px; font-weight: 600; color: #ffe9a8;
  background: rgba(0,0,0,.42); border-radius: 4px; padding: 1px 5px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.8), inset 0 -1px 0 rgba(255,255,255,.08);
}

/* ---- cabinet ---- */
.cabinet {
  position: relative;
  border-radius: 16px;
  padding: 4px 8px 3px;
  background: linear-gradient(180deg, var(--cabinet2) 0%, var(--cabinet1) 30%, var(--cabinet0) 100%);
  border: 3px solid var(--gold-lo);
  box-shadow: 0 0 0 2px rgba(255, 233, 138, .55), 0 10px 24px rgba(0,0,0,.5), inset 0 2px 0 rgba(255,255,255,.25);
}
.cabinet::before {
  content: ""; position: absolute; inset: 4px; z-index: 3; pointer-events: none; border-radius: 12px;
  background-image:
    radial-gradient(circle, #ffe98a 0 2.6px, #c8890a 3.4px, #6e4a00 4.6px, transparent 5.6px),
    radial-gradient(circle, #ffe98a 0 2.6px, #c8890a 3.4px, #6e4a00 4.6px, transparent 5.6px),
    radial-gradient(circle, #ffe98a 0 2.6px, #c8890a 3.4px, #6e4a00 4.6px, transparent 5.6px),
    radial-gradient(circle, #ffe98a 0 2.6px, #c8890a 3.4px, #6e4a00 4.6px, transparent 5.6px);
  background-size: 15px 15px; background-repeat: no-repeat;
  background-position: 0 0, 100% 0, 0 100%, 100% 100%;
}
.crown-rail {
  display: flex; justify-content: center; align-items: center;
  background: rgba(0,0,0,.28);
  border: 1px solid rgba(246,200,78,.4);
  border-radius: 10px;
  padding: 3px 8px;
  margin-bottom: 3px;
}
.coin-pile-wrap { display: flex; align-items: center; gap: 10px; width: 100%; }
/* The tray: a recessed trough with a gold rim that physically holds the coins */
.coin-pile {
  position: relative; width: 96px; height: 34px; flex: none;
  border-radius: 9px;
  background: linear-gradient(180deg, #20030a, #3d0606 70%, #4d0808);
  border: 2px solid var(--gold-dark);
  box-shadow: inset 0 4px 9px rgba(0,0,0,.88), inset 0 -1px 0 rgba(246,200,78,.28), 0 1px 0 rgba(255,255,255,.06);
}
.coin-pile.armed { animation: trayPulse .7s ease-in-out infinite alternate; }
@keyframes trayPulse {
  from { box-shadow: inset 0 4px 9px rgba(0,0,0,.88), inset 0 -1px 0 rgba(246,200,78,.28), 0 0 2px rgba(246,200,78,.15); }
  to   { box-shadow: inset 0 4px 9px rgba(0,0,0,.88), inset 0 -1px 0 rgba(246,200,78,.28), 0 0 15px rgba(246,200,78,.9); }
}
.pile-coin {
  position: absolute; width: 27px; height: 27px; border-radius: 50%;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.55));
}
.pile-extra {
  position: absolute; right: 3px; bottom: 1px; z-index: 5;
  font-size: 9px; font-weight: 800; color: var(--gold-hi);
  text-shadow: 0 1px 2px #000;
}
/* The label sits on a brass plate with engraved type; progress is coin pips */
.coin-meter {
  margin-left: auto;
  display: flex; align-items: center; gap: 7px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .8px; color: #4a2c00;
  background: linear-gradient(180deg, #eec96a, #c1912a);
  border: 1px solid #7a5200; border-radius: 6px; padding: 4px 8px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65), inset 0 -1px 0 rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.45);
  text-shadow: 0 1px 0 rgba(255,255,255,.35);
  white-space: nowrap;
}
.coin-meter strong { display: inline-flex; gap: 4px; align-items: center; }
.pip {
  width: 13px; height: 13px; border-radius: 50%;
  border: 1.5px solid rgba(74,44,0,.6);
  background: rgba(0,0,0,.16);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.35);
}
.pip.on {
  background: radial-gradient(circle at 35% 30%, #ffe98a, #f6c84e 55%, #c8890a);
  border-color: #7a5200;
  box-shadow: 0 0 6px rgba(246,200,78,.85), inset 0 1px 1px rgba(255,255,255,.7);
}
.slot-frame { border-radius: 10px; }
.reels-wrap { overflow: hidden; border-radius: 10px; background: #1c0b33; border: 2px solid rgba(0,0,0,.55); box-shadow: inset 0 0 0 2px rgba(246,200,78,.35), inset 0 6px 14px rgba(0,0,0,.6); }
.reels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; }
.reel-col { overflow: hidden; border-radius: 7px; background: linear-gradient(180deg, #2b1150, #1c0b33); height: calc(var(--cellh) * 3); }
.reel-strip { will-change: transform; }
/* No blur on the spinning strip: removing the class at the stop snapped
   the blur off in one frame — a second visible twitch at every landing. */
.cell {
  height: var(--cellh);
  display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid rgba(246,200,78,.14);
}
.cell img { width: min(84px, 10.3dvh); height: min(84px, 10.3dvh); pointer-events: none; filter: drop-shadow(0 3px 3px rgba(0,0,0,.45)); }
.cell.win { background: radial-gradient(circle at 50% 50%, rgba(246,200,78,.4), rgba(246,200,78,0) 72%); box-shadow: inset 0 0 0 2px rgba(246,200,78,.85), inset 0 0 18px rgba(246,200,78,.35); border-radius: 6px; }
.cell.win img { filter: drop-shadow(0 0 7px rgba(246,200,78,.95)); }
.cell.near img, .cell.anticipate img { filter: drop-shadow(0 0 9px rgba(246,200,78,1)); animation: coinPulse .5s ease-in-out infinite alternate; }
@keyframes coinPulse { from { transform: scale(1); } to { transform: scale(1.1); } }
.win-line { display: flex; justify-content: center; gap: 10px; align-items: baseline; padding-top: 2px; font-size: 12px; letter-spacing: 1.4px; color: #ffd9d0; }
.win-line strong { font-size: 15px; color: var(--gold-hi); }
.win-banner, .near-banner {
  position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%);
  background: linear-gradient(180deg, #ffe98a, #f6c84e);
  color: #5c3402; font-weight: 900; letter-spacing: 1px;
  padding: 10px 18px; border-radius: 999px; border: 2px solid var(--gold-dark);
  box-shadow: 0 8px 22px rgba(0,0,0,.5); font-size: 16px; white-space: nowrap; z-index: 5;
}
.near-banner { background: linear-gradient(180deg, #3d1a6e, #2a1052); color: var(--gold-hi); border-color: var(--gold); font-size: 12px; max-width: 92%; white-space: normal; text-align: center; }

/* ---- controls ---- */
.controls { display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.round-btn {
  width: 58px; height: 58px; border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #5a2f8f, #2a1052 68%, #1c0b33);
  border: 2px solid rgba(246,200,78,.65);
  color: var(--ink); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,.45), inset 0 2px 3px rgba(255,255,255,.28), inset 0 -3px 6px rgba(0,0,0,.5);
}
.round-btn .rb-icon { font-size: 19px; font-weight: 900; line-height: 1; color: var(--gold-hi); }
.round-btn .rb-label { font-size: 9px; letter-spacing: 1px; }
.round-btn.active { background: radial-gradient(circle at 35% 30%, #ffe98a, #c47f0a 75%); color: #4d2c00; }
.round-btn.active .rb-icon { color: #4d2c00; }
.spin {
  width: 86px; height: 86px; border-radius: 50%;
  border: 3px solid var(--gold-dark);
  background: radial-gradient(circle at 35% 28%, var(--gold-hi) 0%, var(--gold) 45%, var(--gold-lo) 100%);
  color: #5c3402; font-size: 21px; font-weight: 900; letter-spacing: 1.5px; cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,.5), inset 0 2px 3px rgba(255,255,255,.7);
  display: flex; align-items: center; justify-content: center;
  white-space: nowrap; padding: 0 4px; text-align: center;
}
#spinBtn { letter-spacing: .5px; }
.spin:active { transform: scale(.96); }
.spin.spinning { filter: saturate(.75) brightness(.94); }

/* ---- bet row ---- */
.bet-row { display: flex; align-items: stretch; gap: 6px; }
.step-btn {
  width: 44px; border-radius: 10px; font-size: 22px; font-weight: 900;
  background: var(--panel); color: var(--gold-hi);
  border: 1px solid rgba(246,200,78,.55); cursor: pointer;
}
.bet-box {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid rgba(246,200,78,.55); border-radius: 10px; padding: 4px 10px;
}
.bet-box label { font-size: 11px; letter-spacing: 1.2px; color: #d9c7ff; }
.bet-box select {
  flex: 1; background: transparent; border: 0; color: var(--gold-hi);
  font-size: 17px; font-weight: 800; text-align: center; appearance: none; -webkit-appearance: none; cursor: pointer;
}
.bet-box select option { color: #222; }
.alt {
  border-radius: 10px; padding: 0 12px;
  background: var(--panel); color: var(--ink);
  border: 1px solid rgba(246,200,78,.45); font-size: 12px; letter-spacing: 1px; cursor: pointer;
}
.alt.active { background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo)); color: #4d2c00; font-weight: 800; }
.alt:disabled { opacity: .45; cursor: default; }
.bet-chips { display: flex; gap: 5px; justify-content: stretch; flex-wrap: nowrap; width: 100%; }
.chip {
  flex: 1 1 0; min-width: 0; padding: 4px 1px; border-radius: 999px; font-size: 10px; letter-spacing: 0; font-weight: 700;
  background: rgba(22,8,38,.6); color: #e9defc; border: 1px solid rgba(246,200,78,.35); cursor: pointer; white-space: nowrap;
  outline: 1px dashed rgba(246,200,78,.30); outline-offset: -4px;
}
.chip.active { background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo)); color: #4d2c00; border-color: var(--gold-dark); outline-color: rgba(77,44,0,.45); box-shadow: 0 0 9px rgba(246,200,78,.5); }
.chip.anchor { border-color: #e0485e; }

/* ---- bottom strip ---- */
.bottom-strip { margin-top: auto; display: flex; align-items: center; gap: 8px; min-height: 27px; }
.player-chip { font-size: 11px; color: #cdbcf5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.tap-hint { font-size: 10px; color: #b7a6e3; flex: 1; text-align: center; }
.info-btn {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: var(--panel); border: 1px solid rgba(246,200,78,.6);
  color: var(--gold-hi); font-weight: 900; font-style: italic; font-size: 15px; cursor: pointer;
}

/* ---- info overlay ---- */
.info-panel {
  position: fixed; inset: 0; z-index: 40; display: none;
  background: rgba(10, 3, 22, .78); padding: 14px 10px;
}
.info-panel.open { display: block; }
.info-card {
  max-width: 430px; margin: 0 auto; max-height: 100%; overflow-y: auto;
  background: linear-gradient(180deg, #341a63, #1d0c3a);
  border: 2px solid var(--gold-lo); border-radius: 14px; padding: 14px 14px 18px; position: relative;
}
.info-card h2 { margin: 0 24px 4px 0; font-size: 19px; letter-spacing: 1.5px; color: var(--gold-hi); }
.info-close {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%;
  background: rgba(0,0,0,.35); color: #fff; border: 1px solid rgba(246,200,78,.5); cursor: pointer; font-size: 14px;
}
.coin-rule { font-size: 12px; color: #e9defc; margin: 4px 0 10px; }
.panel { background: rgba(0,0,0,.25); border: 1px solid rgba(246,200,78,.3); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.panel h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: 1.2px; color: var(--gold-hi); }
.panel table { width: 100%; border-collapse: collapse; font-size: 13px; }
.panel th { text-align: left; color: #cdbcf5; font-weight: 600; padding: 3px 0; }
.panel td { padding: 3px 0; border-top: 1px solid rgba(246,200,78,.15); }
.panel ul { margin: 0; padding-left: 16px; font-size: 12.5px; line-height: 1.55; }
.pay-symbol { display: inline-flex; align-items: center; gap: 8px; }
.pay-symbol img { width: 26px; height: 26px; }
.recent-wins, .recent-results { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.social-win, .result-chip { font-size: 11px; background: rgba(246,200,78,.14); border: 1px solid rgba(246,200,78,.3); padding: 3px 8px; border-radius: 999px; }
.social-win.mine { background: rgba(47,191,113,.25); }
.result-chip.win { background: rgba(47,191,113,.25); }
.result-chip.bonus { background: rgba(224,72,94,.3); }

/* ---- modals ---- */
.bonus-modal {
  position: fixed; inset: 0; z-index: 50; display: none;
  align-items: center; justify-content: center; background: rgba(10,3,22,.8); padding: 18px;
  pointer-events: none; /* celebrations never block the BET button */
}
.bonus-modal.open { display: flex; }
.bonus-card {
  pointer-events: auto;
  text-align: center; max-width: 320px; width: 100%;
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--cabinet2), var(--cabinet0));
  border: 3px solid var(--gold-lo); border-radius: 16px; padding: 22px 18px;
  box-shadow: 0 0 0 2px rgba(255,233,138,.5), 0 18px 40px rgba(0,0,0,.6);
}
.bonus-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 95% 55% at 50% -12%, rgba(255,233,138,.42), transparent 70%);
}
.bonus-emblem { width: 76px; margin: 0 auto 2px; position: relative; }
.bonus-emblem svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 3px 5px rgba(0,0,0,.5)); }
.bonus-card h2 { margin: 0 0 6px; color: var(--gold-hi); letter-spacing: 1.5px; font-size: 20px; }
.bonus-sub { margin: 0 0 8px; font-size: 13px; color: #ffd9d0; }
.bonus-amount { font-size: 40px; font-weight: 900; color: #fff; margin: 6px 0 14px; text-shadow: 0 0 18px rgba(246,200,78,.55); }
.bonus-card .spin { width: auto; height: auto; border-radius: 999px; padding: 12px 34px; font-size: 16px; }

.coin-fly { position: fixed; width: 40px; height: 40px; z-index: 30; pointer-events: none; }
.spark { position: fixed; width: 9px; height: 9px; z-index: 31; pointer-events: none; border-radius: 50%;
  background: radial-gradient(circle, #fff8d6 0 1.6px, rgba(246,200,78,.9) 2.6px, transparent 4.4px); }

/* ---- perf-lite ---- */
body.perf-lite .reel-strip.spinning { filter: none; }
body.perf-lite .cabinet { box-shadow: 0 6px 14px rgba(0,0,0,.5); }
body.perf-lite .cell.win img { filter: none; }
body.perf-lite .cell.near img, body.perf-lite .cell.anticipate img { animation: none; filter: none; }
body.perf-lite .coin-pile.armed { animation: none; box-shadow: inset 0 4px 9px rgba(0,0,0,.88), inset 0 -1px 0 rgba(246,200,78,.28), 0 0 12px rgba(246,200,78,.8); }
body.perf-lite .tier b { filter: none; }
body.perf-lite .cell img { filter: none; }
body.perf-lite .cabinet::before { display: none; }


