/* Game root. Standalone: <html class="cp-standalone"><body class="cp-standalone"><div id="coinpusher" class="cp cp-fullscreen">.
   Embedded in another page: give the wrapper element class "cp" and a size (e.g. width:100%; aspect-ratio:16/10).
   Every rule below is scoped under .cp; positions are relative to the root and sizes use container-query units,
   so the game stays inside its box and never touches the host page's styles. */
.cp {
  position: relative; display: block; width: 100%; overflow: hidden; container-type: size;
  font-family: "Segoe UI", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif; font-size: 14px; line-height: 1.4;
  color: var(--text); background: var(--bg); text-align: left;
}
.cp.cp-fullscreen { position: fixed; inset: 0; width: auto; }
/* touch devices: "manipulation" keeps scrolling/pinch but removes the double-tap-to-zoom delay and gesture (rapid
   taps on the drop button no longer zoom the page); no text selection / callout menu on long presses */
.cp, .cp * { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.cp input, .cp textarea { -webkit-user-select: text; user-select: text; }
.cp:not(.cp-fullscreen) { aspect-ratio: 16 / 10; min-height: 480px; }
.cp * { box-sizing: border-box; }

.cp {
  /* pastel theme: white translucent panels, soft pink borders, purple-grey text */
  --bg: #fff4f8;
  --panel: rgba(255, 255, 255, 0.85);
  --panel-border: rgba(255, 140, 200, 0.75);
  --gold: #f59e0b;
  --gold-dim: #e0b03a;
  --text: #6b2f55;
  --muted: #b3809c;
  --accent: #ff4fae;
  --danger: #ff5f8f;
  --ok: #3cc98a;
  font-family: "Segoe UI", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
}

.cp * { box-sizing: border-box; }
html.cp-standalone, body.cp-standalone { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
.cp #app { position: absolute; inset: 0; }
.cp #app canvas { display: block; width: 100%; height: 100%; touch-action: none; }

.cp .hidden { display: none !important; }

.cp .panel {
  position: absolute;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(255, 120, 190, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* ---------- HUD ---------- */
.cp #hud { top: 16px; left: 16px; padding: 14px 18px; min-width: 250px; user-select: none; }
.cp #hud .title { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.cp .logo {
  font-weight: 900; letter-spacing: 0.08em; font-size: 20px;
  background: linear-gradient(180deg, #ffb347, #ff5fb0 60%, #ff2f9e);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.cp .logo-sub { font-size: 11px; letter-spacing: 0.3em; color: var(--gold); font-weight: 700; }
.cp .dot { margin-left: auto; width: 10px; height: 10px; border-radius: 50%; background: #f0c8da; box-shadow: 0 0 8px #f0c8da; transition: all 0.3s; }
.cp .dot.on { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.cp .dot.off { background: var(--danger); box-shadow: 0 0 10px var(--danger); }

.cp .mode {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; margin-bottom: 10px;
}
.cp .mode.free { background: rgba(60, 201, 138, 0.14); color: var(--ok); border: 1px solid rgba(60, 201, 138, 0.5); }
.cp .mode.play { background: rgba(255, 190, 90, 0.2); color: var(--gold); border: 1px solid rgba(255, 190, 90, 0.6); animation: pulse 1.6s ease-in-out infinite; }
.cp .mode.spectate { background: rgba(255, 79, 174, 0.12); color: var(--accent); border: 1px solid rgba(255, 79, 174, 0.5); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 rgba(255, 212, 90, 0); } 50% { box-shadow: 0 0 14px rgba(255, 212, 90, 0.55); } }

.cp #hud .row { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; line-height: 1.75; }
.cp #hud .row.small { font-size: 12px; color: var(--muted); }
.cp #hud .k { color: var(--muted); }
.cp #hud .v { font-weight: 700; }
.cp #hud .v.num { font-variant-numeric: tabular-nums; color: var(--gold); }
.cp #hud .row.small .v.num { color: var(--text); }
.cp .v.bump { animation: bump 0.35s ease-out; }
.cp .lamps { display: inline-flex; gap: 5px; align-items: center; }
.cp .lamps i { width: 12px; height: 12px; border-radius: 50%; background: #ffe1ec; border: 1px solid #ffb8d0; display: inline-block; transition: all 0.25s; }
.cp .lamps i.on { background: #2f7cff; box-shadow: 0 0 10px #2f7cff, 0 0 20px rgba(47, 124, 255, 0.55); border-color: #8ab4ff; }
.cp .lamps.full i.on { animation: lampblink 0.5s ease-in-out infinite alternate; }
@keyframes lampblink { from { filter: brightness(0.7); } to { filter: brightness(1.4); } }
.cp #slot.spin { color: var(--accent); animation: pulse 0.8s ease-in-out infinite; }
.cp #banner.jp { background: linear-gradient(180deg, #fff8c7, #ffd045 35%, #ff3b5c 70%, #ff6ad5 100%); -webkit-background-clip: text; background-clip: text; }
@keyframes bump { 0% { transform: scale(1.45); color: #ff5fb0; } 100% { transform: scale(1); } }

/* ---------- controls ---------- */
.cp #controls { left: 50%; bottom: 18px; transform: translateX(-50%); padding: 12px 16px; max-width: calc(100cqw - 24px); }
.cp .ctl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.cp .hint { font-size: 11px; color: var(--muted); width: 100%; text-align: center; }

.cp button {
  font: inherit; font-weight: 700; color: var(--text); border: 1px solid #ffc2dc;
  background: linear-gradient(180deg, #ffffff, #ffe6f0); border-radius: 12px; padding: 10px 16px; cursor: pointer;
  transition: transform 0.08s, filter 0.2s, box-shadow 0.2s; user-select: none; -webkit-tap-highlight-color: transparent;
}
.cp button:hover { filter: brightness(1.15); }
.cp button:active { transform: translateY(1px) scale(0.98); }
.cp button:disabled { opacity: 0.45; cursor: not-allowed; }
.cp button.soft-disabled { opacity: 0.45; cursor: not-allowed; }
.cp button.primary {
  background: linear-gradient(180deg, #fff1b0, #ffcf5a 60%, #ffb347); color: #7a4b00; border-color: #ffe6a8;
  box-shadow: 0 6px 18px rgba(255, 190, 80, 0.4);
}
.cp button.primary.big { padding: 14px 28px; font-size: 18px; position: relative; }
/* KP rate: a small separate line hanging centred under the drop button (the panel gets extra bottom padding for it) */
.cp button.primary.big .rate { position: absolute; left: 50%; bottom: -17px; transform: translateX(-50%); white-space: nowrap; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: 0.02em; pointer-events: none; }
.cp #controls.has-rate { padding-bottom: 26px; }
.cp #controls.has-rate .ctl { row-gap: 24px; } /* if the row wraps (medium widths) the next row clears the rate line */
.cp button.danger { background: linear-gradient(180deg, #ffe0e9, #ffc2d3); border-color: #ffb3c6; color: #c8355e; }
.cp button.icon { width: 52px; height: 52px; font-size: 20px; padding: 0; }
.cp button.icon.held { filter: brightness(1.5); box-shadow: 0 0 14px var(--accent); }
.cp input[type="text"] {
  font: inherit; padding: 10px 12px; border-radius: 12px; border: 1px solid #ffc2dc;
  background: rgba(255, 255, 255, 0.85); color: var(--text); width: 160px; outline: none;
}
.cp input[type="text"]:focus { border-color: var(--gold); }
.cp .spectate-badge { font-weight: 800; color: var(--accent); font-size: 16px; letter-spacing: 0.05em; }

/* ---------- log ---------- */
.cp #log { position: absolute; right: 16px; top: 16px; width: 260px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.cp .cp-toast {
  display: block; opacity: 1;
  background: var(--panel); border: 1px solid rgba(255, 170, 210, 0.4); border-left: 3px solid var(--accent); box-shadow: 0 6px 18px rgba(255, 150, 200, 0.2);
  padding: 8px 12px; border-radius: 10px; font-size: 13px; animation: slidein 0.25s ease-out; backdrop-filter: blur(8px);
}
.cp .cp-toast.win { border-left-color: var(--gold); }
.cp .cp-toast.lose { border-left-color: #cfc6e0; color: var(--muted); }
.cp .cp-toast.start { border-left-color: var(--ok); }
.cp .cp-toast.end { border-left-color: var(--danger); }
.cp .cp-toast.jackpot { border-left-color: #ff7ad9; font-weight: 800; }
.cp .cp-toast.cp-fade { opacity: 0; transition: opacity 0.6s; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- banner ---------- */
.cp #banner {
  position: absolute; left: 50%; top: 24%; transform: translate(-50%, -50%); text-align: center; pointer-events: none;
  font-size: clamp(36px, 8cqw, 96px); font-weight: 900; letter-spacing: 0.1em;
  background: linear-gradient(180deg, #fff8c7, #ffd045 45%, #ff6ad5 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 24px rgba(255, 200, 80, 0.8));
  animation: bannerin 2.8s ease-out forwards;
}
.cp #banner small { display: block; font-size: 0.3em; letter-spacing: 0.3em; color: #c2185b; -webkit-text-fill-color: #c2185b; }
@keyframes bannerin {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
  12% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  20% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------- roulette overlay ---------- */
.cp #roulette {
  position: absolute; inset: 0; z-index: 8; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: radial-gradient(ellipse at center, rgba(255, 245, 210, 0.35), rgba(255, 220, 236, 0.85)); pointer-events: none;
  animation: rlfade 0.4s ease-out;
}
@keyframes rlfade { from { opacity: 0; } to { opacity: 1; } }
.cp .rl-title {
  font-size: clamp(28px, 6cqw, 64px); font-weight: 900; letter-spacing: 0.35em;
  background: linear-gradient(180deg, #fff8c7, #ffd045 50%, #b8811a); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 200, 80, 0.6)); animation: pulse 1s ease-in-out infinite;
}
.cp .rl-wheel-wrap { position: relative; width: min(70cqmin, 560px); height: min(70cqmin, 560px); }
.cp .rl-canvas { width: 100%; height: 100%; display: block; filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.7)); }
.cp .rl-pointer {
  position: absolute; left: 50%; top: -6px; transform: translateX(-50%); width: 0; height: 0; z-index: 2;
  border-left: 18px solid transparent; border-right: 18px solid transparent; border-top: 44px solid #ff3b5c;
  filter: drop-shadow(0 0 10px #ff3b5c);
}
.cp .rl-hub {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 14%; height: 14%; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff3b0, #d9a520 60%, #8a5e10); display: grid; place-items: center;
  font-size: 2.2em; color: #5a2a00; box-shadow: 0 0 20px rgba(255, 200, 80, 0.6);
}
.cp .rl-result {
  min-height: 1.4em; font-size: clamp(30px, 7cqw, 80px); font-weight: 900; letter-spacing: 0.08em; color: #ff5fb0; opacity: 0;
  text-shadow: 0 0 20px #fff, 0 3px 4px rgba(120, 80, 160, 0.4); transition: opacity 0.3s;
}
.cp .rl-result.show { opacity: 1; animation: bump 0.5s ease-out; }
.cp .rl-result.jp {
  background: linear-gradient(180deg, #fff8c7, #ffd045 35%, #ff3b5c 70%, #ff6ad5 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 30px rgba(255, 200, 80, 0.9)); animation: bump 0.6s ease-out, pulse 0.8s ease-in-out infinite;
}
.cp #roulette.rl-done .rl-title { animation: none; }
.cp #free.spin { color: var(--gold); animation: pulse 0.6s ease-in-out infinite; }
/* roulette intro: white flash, spinning rays, "CHANCE!!" burst, confetti */
.cp .rl-flashlayer { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cp #roulette.rl-start .rl-flashlayer { animation: rlFlash 0.7s ease-out forwards; }
@keyframes rlFlash { 0% { opacity: 0.95; } 100% { opacity: 0; } }
.cp .rl-rays {
  position: absolute; left: 50%; top: 50%; width: 200cqmax; height: 200cqmax; transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg, rgba(255, 210, 90, 0.16) 0 9deg, transparent 9deg 18deg);
  animation: rlRays 8s linear infinite; pointer-events: none;
}
@keyframes rlRays { to { transform: translate(-50%, -50%) rotate(360deg); } }
.cp .rl-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.cp .rl-intro { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0; }
.cp #roulette.rl-start .rl-intro { opacity: 1; }
.cp .rl-intro .txt {
  font-size: clamp(48px, 13cqw, 150px); font-weight: 900; letter-spacing: 0.08em; text-align: center; line-height: 1;
  background: linear-gradient(180deg, #fff8c7, #ffd045 45%, #ff3b5c 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 30px rgba(255, 200, 80, 0.9)); animation: rlIntro 1.5s ease-out forwards;
}
.cp .rl-intro .txt small { display: block; font-size: 0.32em; letter-spacing: 0.4em; -webkit-text-fill-color: #c2185b; color: #c2185b; }
.cp #roulette.rl-super .rl-intro .txt { background: linear-gradient(180deg, #fff8c7, #ff6ad5 45%, #ff3fb8 100%); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 40px rgba(255, 106, 213, 0.95)); }
.cp #roulette.rl-super .rl-rays { background: repeating-conic-gradient(from 0deg, rgba(255, 106, 213, 0.2) 0 9deg, transparent 9deg 18deg); animation-duration: 4s; }
@keyframes rlIntro {
  0% { transform: scale(0.2) rotate(-12deg); opacity: 0; }
  18% { transform: scale(1.35) rotate(3deg); opacity: 1; }
  32% { transform: scale(1) rotate(0); }
  75% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0; transform: scale(1.8); }
}
.cp .rl-wheel-wrap { transition: opacity 0.35s, transform 0.35s; }
.cp #roulette.rl-start .rl-wheel-wrap { opacity: 0; transform: scale(0.5); }
.cp .confetti { position: absolute; top: -24px; width: 10px; height: 18px; border-radius: 2px; opacity: 0.95; pointer-events: none; animation: confettiFall linear forwards; }
@keyframes confettiFall { 0% { transform: translateY(0) rotate(0deg); } 100% { transform: translateY(115cqh) rotate(900deg); } }

/* ---------- free coin counter ---------- */
/* transparent strip across the top of the screen so the coin shower itself stays visible */
.cp #freecounter {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 6; pointer-events: none; text-align: center;
  padding: 0 24px; min-width: 320px; background: none; border: 0; animation: rlfade 0.3s ease-out;
}
.cp #freecounter .fc-title { font-size: clamp(24px, 3.4cqw, 40px); font-weight: 900; letter-spacing: 0.3em; color: #ff2f9e; paint-order: stroke fill; -webkit-text-stroke: 8px #fff; text-shadow: 0 0 16px #fff, 0 4px 8px rgba(120, 40, 90, 0.35); margin-top: -4px; }
.cp #freecounter .fc-source { font-size: 14px; font-weight: 800; color: #c2185b; letter-spacing: 0.1em; paint-order: stroke fill; -webkit-text-stroke: 4px #fff; text-shadow: 0 0 8px #fff; margin-top: 2px; }
.cp #freecounter .fc-num { font-size: clamp(64px, 11cqw, 128px); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; font-family: Impact, "Arial Black", "Segoe UI", sans-serif; letter-spacing: 0.02em;
  background: linear-gradient(180deg, #fff6b0, #ffc400 50%, #ff8a00); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 2px #fff) drop-shadow(0 4px 0 #ff2f9e) drop-shadow(0 8px 10px rgba(120, 40, 90, 0.45)); }
.cp #freecounter .fc-num small { font-size: 0.55em; color: #ff2f9e; -webkit-text-fill-color: #ff2f9e; margin: 0 10px; }
.cp #freecounter .fc-num .total { font-size: 0.62em; color: #ff2f9e; -webkit-text-fill-color: #ff2f9e; }
.cp #freecounter .fc-label { font-size: 12px; color: var(--gold); letter-spacing: 0.3em; text-shadow: 0 0 10px #fff, 0 1px 2px #fff; animation: pulse 0.7s ease-in-out infinite; }
.cp #freecounter.done .fc-title { color: var(--ok); }
.cp #freecounter.paused .fc-title { color: #c2185b; font-size: clamp(16px, 2.2cqw, 24px); letter-spacing: 0.1em; animation: pulse 1s ease-in-out infinite; }
.cp #freecounter.paused .fc-num { filter: grayscale(0.6) opacity(0.75) drop-shadow(0 0 2px #fff); }

/* ---------- ball announcement ---------- */
.cp #rlball {
  position: absolute; left: 50%; top: 24%; transform: translate(-50%, -50%); z-index: 7; pointer-events: none; text-align: center;
  font-weight: 900; color: #ff2f9e; paint-order: stroke fill; -webkit-text-stroke: 10px #fff;
  text-shadow: 0 0 18px #fff, 0 6px 10px rgba(120, 40, 90, 0.35); animation: ballpop 1.3s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}
.cp #rlball small { display: block; font-size: clamp(14px, 2cqw, 22px); letter-spacing: 0.3em; color: #c2185b; -webkit-text-stroke: 5px #fff; }
.cp #rlball span { display: block; font-size: clamp(40px, 7cqw, 84px); line-height: 1.05; letter-spacing: 0.05em; }
.cp #rlball span b { font-size: 1.4em; color: #ff8a00; }
@keyframes ballpop { 0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; } 15% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; } 25% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.1); } }

/* ---------- roulette result card ---------- */
.cp #rlresult {
  position: absolute; left: 50%; top: 19%; transform: translateX(-50%); z-index: 7; pointer-events: none; text-align: center;
  padding: 14px 26px 16px; border-radius: 22px; min-width: 320px; max-width: min(92cqw, 720px);
  background: rgba(255, 255, 255, 0.9); border: 3px solid #ff8fc8; box-shadow: 0 14px 40px rgba(255, 100, 180, 0.35);
  animation: rlcard 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.cp #rlresult.jp { border-color: #ff2fa8; box-shadow: 0 0 40px rgba(255, 47, 168, 0.6); }
.cp #rlresult .head { font-size: 13px; font-weight: 900; letter-spacing: 0.35em; color: #c2185b; }
.cp #rlresult .chips { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 8px; }
.cp #rlresult .chip {
  display: inline-flex; flex-direction: column; align-items: center; min-width: 76px; padding: 6px 12px; border-radius: 14px;
  font-size: 26px; font-weight: 900; line-height: 1.1; color: #fff; background: #ff8fc8; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12);
  animation: chipin 0.45s cubic-bezier(0.2, 1.5, 0.4, 1) backwards;
}
.cp #rlresult .chip small { font-size: 11px; font-weight: 700; letter-spacing: 0.15em; opacity: 0.9; }
.cp #rlresult .chip.win { background: linear-gradient(180deg, #ffd93f, #ff9f1c); color: #5a2a00; }
.cp #rlresult .chip.jp { background: linear-gradient(180deg, #ff5fc8, #ff1f9e); color: #fff; animation: chipin 0.45s cubic-bezier(0.2, 1.5, 0.4, 1) backwards, pulse 0.8s ease-in-out infinite; }
.cp #rlresult .chip.miss { background: #eadff0; color: #a08cb0; }
.cp #rlresult .chip:nth-child(2) { animation-delay: 0.08s; } .cp #rlresult .chip:nth-child(3) { animation-delay: 0.16s; }
.cp #rlresult .chip:nth-child(4) { animation-delay: 0.24s; } .cp #rlresult .chip:nth-child(5) { animation-delay: 0.32s; }
.cp #rlresult .total { font-size: clamp(22px, 3.6cqw, 34px); font-weight: 900; color: #e86a00; }
.cp #rlresult .total b { font-size: 1.45em; color: #ff2f9e; }
.cp #rlresult .total small { display: block; font-size: 12px; letter-spacing: 0.25em; color: #c2185b; }
.cp #rlresult .total.jp { color: #ff1f9e; animation: pulse 0.8s ease-in-out infinite; }
.cp #rlresult .total.miss { color: #a08cb0; }
@keyframes rlcard { 0% { transform: translateX(-50%) scale(0.4); opacity: 0; } 100% { transform: translateX(-50%) scale(1); opacity: 1; } }
@keyframes chipin { 0% { transform: scale(0.2) rotate(-10deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.cp .flabel.big { font-size: 40px; color: #ff5fb0; text-shadow: 0 0 18px #fff, 0 0 4px #fff, 0 3px 3px rgba(120, 80, 160, 0.4); }

/* ---------- cheat panel ---------- */
.cp #cheats { left: 12px; top: 52px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; z-index: 6; border-color: #ff5fb0; }
.cp #cheats .ch-title { font-size: 12px; font-weight: 900; letter-spacing: 0.15em; color: #ff2f9e; margin-bottom: 2px; cursor: pointer; }
.cp #cheats.collapsed button { display: none; }
.cp #cheats.collapsed .ch-title { margin-bottom: 0; }
.cp #cheats button { padding: 6px 10px; font-size: 12px; text-align: left; }

/* ---------- idle countdown ---------- */
.cp #idle {
  position: absolute; right: 14px; bottom: 12px; z-index: 5; pointer-events: none; font-size: 12px; font-weight: 700;
  color: var(--muted); background: rgba(255, 255, 255, 0.75); border: 1px solid rgba(255, 140, 200, 0.5); border-radius: 999px;
  padding: 4px 12px; letter-spacing: 0.05em;
}
.cp #idle b { color: var(--text); font-variant-numeric: tabular-nums; }
.cp #idle.busy b { color: var(--ok); }
.cp #idle.soon { color: var(--danger); border-color: var(--danger); animation: pulse 0.8s ease-in-out infinite; }
.cp #idle.soon b { color: var(--danger); }

/* ---------- floating labels ---------- */
.cp #labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.cp .flabel {
  position: absolute; transform: translate(-50%, -50%); font-weight: 900; font-size: 22px; color: var(--gold);
  text-shadow: 0 0 10px #fff, 0 0 3px #fff, 0 2px 2px rgba(120, 80, 160, 0.4); animation: floatup 1.3s ease-out forwards;
}
.cp .flabel.lose { color: #b3809c; font-size: 15px; text-shadow: 0 1px 2px #fff; }
@keyframes floatup { 0% { opacity: 0; margin-top: 10px; } 15% { opacity: 1; } 100% { opacity: 0; margin-top: -70px; } }

/* ---------- overlay ---------- */
.cp .overlay { position: absolute; inset: 0; background: rgba(255, 240, 246, 0.9); display: grid; place-items: center; z-index: 10; transition: opacity 0.4s; }
.cp .overlay.hidden-soft { opacity: 0; pointer-events: none; }
.cp .overlay-box { text-align: center; color: var(--muted); font-size: 15px; }
.cp .spinner { width: 44px; height: 44px; border-radius: 50%; margin: 0 auto 14px; border: 4px solid rgba(255, 150, 200, 0.25); border-top-color: #ff5fb0; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- viewers (top-left) / balance (bottom-left) / slot queue bubble ---------- */
.cp #viewers-pill { top: 12px; left: 12px; padding: 6px 12px; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; user-select: none; }
.cp #viewers-pill .k { color: var(--muted); }
.cp #viewers-pill b { color: var(--text); font-variant-numeric: tabular-nums; font-size: 15px; }
.cp #viewers-pill .dot { margin-left: 0; }
/* --bal-scale (set by main.js) shrinks the whole pill when the name / balance would make it too wide */
.cp #balance { --bal-scale: 1; left: 12px; bottom: 12px; padding: 8px 14px; display: flex; align-items: center; gap: calc(10px * var(--bal-scale)); font-size: calc(13px * var(--bal-scale)); user-select: none; white-space: nowrap; }
.cp #balance .who { font-weight: 800; color: #ff2f9e; max-width: 16em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp #balance .k { color: var(--muted); font-weight: 700; }
.cp #balance .k:empty { display: none; }
.cp #balance b { font-size: calc(20px * var(--bal-scale)); color: var(--gold); font-variant-numeric: tabular-nums; }
.cp #balance b .unit { font-size: 0.6em; font-weight: 800; color: var(--muted); margin-left: 0.3em; letter-spacing: 0.05em; }
.cp #slotqueue {
  position: absolute; transform: translate(-25%, -115%); pointer-events: none; z-index: 5;
  background: #fff; color: #ff2f9e; border: 2px solid #ff5fb0; border-radius: 14px; padding: 2px 10px;
  font-size: 14px; font-weight: 900; white-space: nowrap; box-shadow: 0 4px 12px rgba(255, 100, 180, 0.35); animation: rlfade 0.25s ease-out;
}
.cp #slotqueue b { font-size: 20px; margin-left: 2px; }
.cp #slotqueue::after { content: ''; position: absolute; left: 14px; bottom: -8px; border: 6px solid transparent; border-top-color: #ff5fb0; border-bottom: 0; }

/* ---------- rare coin reveal ---------- */
.cp #rarecoin { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 8; pointer-events: none; text-align: center; animation: rcfade 0.3s ease-out; }
.cp #rarecoin .rc-coin {
  width: clamp(120px, 22cqw, 220px); height: clamp(120px, 22cqw, 220px); margin: 0 auto 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd6ee, #ff8fd0 55%, #e0479f 100%); border: 6px solid #fff;
  box-shadow: 0 0 40px rgba(255, 120, 200, 0.9), 0 0 120px rgba(255, 200, 240, 0.8);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: clamp(60px, 11cqw, 120px);
  animation: rcflip 1.1s cubic-bezier(0.2, 0.9, 0.3, 1.1) forwards;
}
.cp #rarecoin .rc-title { font-size: clamp(22px, 4.5cqw, 44px); font-weight: 900; color: #ff2f9e; letter-spacing: 0.08em; text-shadow: 0 2px 0 #fff, 0 0 18px rgba(255, 120, 200, 0.8); opacity: 0; }
.cp #rarecoin.open .rc-title { animation: rcpop 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.cp #rarecoin .rc-effect { margin-top: 6px; display: inline-block; padding: 8px 22px; border-radius: 999px; background: #fff; border: 3px solid #ff8fc8; color: #c2185b; font-size: clamp(18px, 3.6cqw, 34px); font-weight: 900; box-shadow: 0 10px 30px rgba(255, 100, 180, 0.4); opacity: 0; }
.cp #rarecoin.open .rc-effect { animation: rcpop 0.4s 0.25s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.cp #rarecoin .rc-effect small { display: block; font-size: 0.55em; color: #a55; font-weight: 700; }
@keyframes rcflip { 0% { transform: rotateY(0) scale(0.4); opacity: 0; } 20% { opacity: 1; transform: rotateY(360deg) scale(1); } 60% { transform: rotateY(1080deg) scale(1); filter: brightness(1); } 75% { transform: rotateY(1080deg) scale(1.35); filter: brightness(1.8); } 100% { transform: rotateY(1080deg) scale(1.1); filter: brightness(1.05); } }
@keyframes rcpop { 0% { transform: scale(0.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes rcfade { from { opacity: 0; } to { opacity: 1; } }
/* slot reach: the window frame blinks */
.cp #banner.reach { background: linear-gradient(180deg, #fff, #ff3b5c 50%, #ff6ad5 100%); -webkit-background-clip: text; background-clip: text; }


.cp #rarecoin .rc-coin.rainbow { background: conic-gradient(#ff5f5f, #ffd45a, #5fff8f, #5fb0ff, #d45fff, #ff5f5f); box-shadow: 0 0 50px rgba(255, 255, 255, 0.95), 0 0 140px rgba(255, 200, 255, 0.9); }

/* ---------- blackout ---------- */
.cp #blackout { position: absolute; inset: 0; background: #000; z-index: 9; pointer-events: none; opacity: 0; }
.cp #blackout.on { opacity: 1; transition: opacity 0.08s; }
.cp #blackout.off { opacity: 0; transition: opacity 0.6s; }

/* ---------- small screens (smartphones) ----------
   the container is the game box itself, so this also applies when the game is embedded in a narrow page.
   layout: top row = viewers (left) + balance (right); one full-width control bar at the bottom with the idle
   countdown and the toasts stacked above it (the bar height is published by main.js as --cp-ctl-h) */
@container (max-width: 640px) {
  .cp #viewers-pill { top: 8px; left: 8px; padding: 5px 10px; font-size: 12px; gap: 5px; }
  .cp #viewers-pill b { font-size: 14px; }
  .cp #balance { left: auto; right: 8px; top: 8px; bottom: auto; padding: 5px 10px; font-size: calc(12px * var(--bal-scale)); gap: calc(6px * var(--bal-scale)); }
  .cp #balance .who { max-width: 12em; }
  .cp #balance b { font-size: calc(16px * var(--bal-scale)); }
  .cp button.primary.big .rate { font-size: 10px; bottom: -14px; }
  .cp #controls.has-rate { padding-bottom: 22px; }
  /* toasts sit above the idle pill at the bottom right, so the top stays free for the free-coin counter */
  .cp #log { top: auto; bottom: calc(var(--cp-ctl-h, 64px) + 44px); right: 8px; width: min(64cqw, 240px); gap: 4px; }
  .cp .cp-toast { font-size: 11px; padding: 6px 9px; }
  .cp #log .cp-toast:nth-child(n + 4) { display: none; }
  .cp #controls { left: 8px; right: 8px; bottom: 8px; transform: none; max-width: none; padding: 8px 10px; border-radius: 16px; }
  .cp .ctl { gap: 8px; }
  .cp .hint { display: none; }
  .cp #ctl-play { display: grid; grid-template-columns: 48px 1fr 48px auto; align-items: stretch; }
  .cp button { padding: 9px 12px; }
  .cp button.icon { width: 48px; height: 48px; font-size: 18px; }
  .cp button.primary.big { padding: 10px 8px; font-size: 16px; width: 100%; min-height: 48px; }
  .cp #btn-stop { padding: 6px 10px; font-size: 12px; }
  .cp .spectate-badge { font-size: 14px; }
  .cp #idle { right: 8px; bottom: calc(var(--cp-ctl-h, 64px) + 14px); font-size: 11px; padding: 3px 10px; }
  .cp #freecounter { top: 44px; min-width: 0; padding: 0 8px; }
  .cp #freecounter .fc-num { font-size: clamp(44px, 15cqw, 128px); }
  .cp #freecounter .fc-title { font-size: clamp(16px, 5.5cqw, 40px); letter-spacing: 0.2em; -webkit-text-stroke: 6px #fff; }
  .cp #freecounter .fc-source { font-size: 12px; }
  .cp #rlresult { min-width: 0; width: 92cqw; padding: 10px 12px 12px; }
  .cp #rlresult .chip { min-width: 60px; font-size: 20px; padding: 4px 8px; }
  .cp #cheats { top: 44px; left: 8px; width: 148px; padding: 6px 8px; gap: 4px; max-height: calc(100cqh - var(--cp-ctl-h, 64px) - 70px); overflow-y: auto; }
  .cp #cheats button { padding: 4px 8px; font-size: 11px; }
}
/* short boxes (phone landscape, or a small embed): tighter chrome so the table stays visible */
@container (max-height: 480px) {
  .cp #controls { bottom: 6px; padding: 6px 10px; }
  .cp button.primary.big { padding: 8px 16px; font-size: 14px; min-height: 40px; }
  .cp button.icon { width: 40px; height: 40px; font-size: 16px; }
  .cp #btn-stop { padding: 6px 10px; font-size: 12px; }
  .cp .hint { display: none; }
  .cp #cheats { max-height: calc(100cqh - 100px); overflow-y: auto; padding: 6px 8px; gap: 3px; }
  .cp #cheats button { padding: 3px 8px; font-size: 11px; }
  .cp #log .cp-toast:nth-child(n + 4) { display: none; }
}
