/* Coin Pusher (/coin-pusher). The page frame, panels and buttons are Plinko's (garam_plinko.css);
   this file adds the 3D stage and the coin pusher's own controls. */
.coin-pusher {max-width:1080px;}
.cp-game {grid-template-columns:minmax(230px,1fr) minmax(0,2.6fr);align-items:start;}
.cp-board {padding:10px;}
.cp-values {grid-column:2;}

/* The machine. The canvas fills it; a finger can still scroll the page up and down over it. */
.cp-stage {
    position:relative;aspect-ratio:10 / 9;border-radius:14px;overflow:hidden;cursor:pointer;
    background:linear-gradient(180deg,
        color-mix(in oklab,var(--garam-theme-accent,#087cce) 10%,white),
        color-mix(in oklab,var(--garam-theme-accent,#087cce) 30%,white));
    touch-action:pan-y;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent;
}
.cp-stage canvas {position:absolute;inset:0;display:block;width:100%;height:100%;}
.cp-stage:focus-visible {outline:3px solid var(--garam-theme-ui-accent,#087cce);outline-offset:2px;}
html[data-garam-mode="dark"] .cp-stage {
    background:linear-gradient(180deg,
        color-mix(in oklab,var(--garam-theme-accent,#087cce) 16%,#17181d),
        color-mix(in oklab,var(--garam-theme-accent,#087cce) 6%,#0c0d10));
}

/* "+20" where a coin fell. Only transform and opacity move (smooth on phones). */
.cp-pops {position:absolute;inset:0;overflow:hidden;pointer-events:none;}
.cp-pop {
    position:absolute;display:inline-flex;align-items:center;gap:4px;padding:3px 9px;border-radius:999px;
    background:rgb(255 255 255 / .94);color:#181818;font-size:15px;font-weight:700;white-space:nowrap;
    box-shadow:0 3px 10px rgb(0 0 0 / .16);transform:translate(-50%,-50%);
    animation:cp-rise 1.25s cubic-bezier(.23,1,.32,1) forwards;
}
.cp-pop .plinko-currency {width:16px;height:16px;}
.cp-pop-big {font-size:20px;padding:5px 12px;}
@keyframes cp-rise {
    0% {opacity:0;transform:translate(-50%,-10%) scale(.7);}
    18% {opacity:1;transform:translate(-50%,-90%) scale(1.06);}
    70% {opacity:1;}
    100% {opacity:0;transform:translate(-50%,-260%) scale(1);}
}
@media (prefers-reduced-motion:reduce) {
    .cp-pop {animation-name:cp-fade;}
    @keyframes cp-fade {0%,70% {opacity:1;} 100% {opacity:0;}}
}

/* The speed meter (only with ?debug in the address): how fast the machine runs on this device. */
.cp-meter {
    position:absolute;top:6px;left:6px;z-index:2;padding:5px 8px;border-radius:8px;pointer-events:none;
    background:rgb(0 0 0 / .68);color:#fff;font:12px/1.35 ui-monospace,Menlo,Consolas,monospace;white-space:pre;
}

/* Phones only: the coins in hand and the buy button, on the machine itself. */
.cp-quick {
    position:absolute;inset:auto 8px 8px;display:none;align-items:center;justify-content:space-between;gap:8px;
    pointer-events:none;
}
.cp-quick > * {
    pointer-events:auto;display:inline-flex;align-items:center;gap:6px;min-height:44px;padding:0 14px;
    border-radius:999px;background:rgb(255 255 255 / .94);color:#181818;
    font:inherit;font-size:15px;font-weight:600;font-variant-numeric:tabular-nums;box-shadow:0 3px 10px rgb(0 0 0 / .16);
}
.cp-quick button {border:0;background:var(--garam-theme-ui-accent,#087cce);color:white;cursor:pointer;}
.cp-quick button:disabled {opacity:.55;cursor:default;}
.cp-quick .plinko-currency {width:17px;height:17px;}
.cp-quick .cp-coin {width:24px;height:24px;}
html[data-garam-mode="dark"] .cp-quick button {background:var(--garam-dark-accent-fill);color:var(--garam-dark-on-accent);}

/* Over the machine when the game was opened in another tab or device. */
.cp-elsewhere {
    position:absolute;inset:0;display:grid;place-content:center;justify-items:center;gap:14px;padding:24px;
    background:rgb(255 255 255 / .8);color:#181818;text-align:center;cursor:default;
}
.cp-elsewhere[hidden] {display:none;}
.cp-elsewhere p {margin:0;max-width:22em;font-size:17px;font-weight:600;line-height:1.35;}
.cp-elsewhere button {
    min-height:46px;padding:0 22px;border:0;border-radius:999px;background:var(--garam-theme-ui-accent,#087cce);color:white;
    font:inherit;font-weight:600;cursor:pointer;
}
html[data-garam-mode="dark"] .cp-elsewhere {background:rgb(12 13 16 / .82);color:var(--garam-dark-text);}
html[data-garam-mode="dark"] .cp-elsewhere button {background:var(--garam-dark-accent-fill);color:var(--garam-dark-on-accent);}

/* Coin price: three pills, one chosen. */
.cp-prices {margin:0;padding:0;border:0;min-width:0;}
.cp-prices legend {padding:0;margin-bottom:6px;}
.cp-price-options {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;}
.cp-price-options label {position:relative;display:block;cursor:pointer;}
.cp-controls .cp-price-options input {position:absolute;inset:0;width:100%;height:100%;margin:0;padding:0;opacity:0;cursor:pointer;}
.cp-price-options span {
    display:flex;align-items:center;justify-content:center;gap:4px;min-height:44px;padding:0 4px;
    border:1px solid var(--garam-c-bbdef5,#bbdef5);border-radius:10px;background:var(--garam-c-ffffff,#fff);
    font-weight:600;font-variant-numeric:tabular-nums;
}
.cp-price-options .plinko-currency {width:16px;height:16px;}
.cp-price-options input:checked + span {
    border-color:var(--garam-theme-ui-accent,#087cce);box-shadow:inset 0 0 0 1px var(--garam-theme-ui-accent,#087cce);
    background:color-mix(in oklab,var(--garam-theme-ui-accent,#087cce) 12%,var(--garam-c-ffffff,#fff));
}
html[data-garam-mode="dark"] .cp-price-options span {
    background:transparent;border-color:var(--garam-dark-border);color:var(--garam-dark-text);
}
html[data-garam-mode="dark"] .cp-price-options input:checked + span {
    border-color:var(--garam-theme-ui-accent,#6fb6ec);box-shadow:inset 0 0 0 1px var(--garam-theme-ui-accent,#6fb6ec);
    background:color-mix(in srgb,var(--garam-theme-ui-accent,#6fb6ec) 20%,transparent);
}
.cp-price-options input:focus-visible + span {outline:2px solid var(--garam-theme-ui-accent,#087cce);outline-offset:2px;}
.cp-price-options input:disabled + span {opacity:.55;cursor:default;}

/* The coins in the player's hand, and the next ones to drop. */
.cp-hand p {display:flex;justify-content:space-between;align-items:baseline;}
.cp-hand strong {font-size:20px;font-variant-numeric:tabular-nums;}
.cp-next {display:flex;align-items:center;gap:4px;min-height:28px;margin-top:6px;font-size:13px;font-weight:600;}
.cp-coin {width:26px;height:26px;flex:none;border-radius:50%;box-shadow:0 1px 2px rgb(0 0 0 / .18);}
.cp-next .cp-coin:first-child {width:30px;height:30px;}

.cp-controls button {display:flex;align-items:center;justify-content:center;gap:5px;min-height:46px;}
.cp-controls button .plinko-currency {width:18px;height:18px;}
.cp-controls .cp-drop {
    background:transparent;color:var(--garam-theme-ui-accent,#087cce);border-color:var(--garam-theme-ui-accent,#087cce);
}
.cp-controls .cp-cash-out {min-height:40px;padding:8px 12px;font-size:14px;}
.cp-controls .cp-cash-out.is-armed {background:var(--garam-theme-ui-accent,#087cce);color:white;}
html[data-garam-mode="dark"] .cp-controls .cp-cash-out.is-armed {
    background:var(--garam-dark-accent-fill);border-color:var(--garam-dark-accent-fill);color:var(--garam-dark-on-accent);
}
.cp-controls label:has(input[type="checkbox"]) {display:flex;align-items:center;gap:8px;line-height:1.3;cursor:pointer;}
html[data-garam-mode="dark"] .cp-controls #cpBuy {
    background:var(--garam-dark-accent-fill);border-color:var(--garam-dark-accent-fill);color:var(--garam-dark-on-accent);
}

.cp-totals {display:grid;gap:6px;margin:0;}
.cp-totals div {display:flex;justify-content:space-between;align-items:baseline;gap:10px;}
.cp-totals dt {font-size:14px;}
.cp-totals dd {margin:0;font-weight:600;font-variant-numeric:tabular-nums;white-space:nowrap;}
#cpStatus {min-height:1.5em;font-size:14px;}

/* What each coin pays. */
.cp-values {padding:16px 18px;}
.cp-values h2 {margin:0 0 10px;font-size:16px;font-weight:600;}
.cp-legend {display:grid;grid-template-columns:repeat(auto-fill,minmax(132px,1fr));gap:8px 14px;margin:0;padding:0;list-style:none;}
.cp-legend li {display:flex;align-items:center;gap:7px;min-width:0;}
.cp-legend strong {font-weight:600;font-variant-numeric:tabular-nums;white-space:nowrap;}
.cp-legend .plinko-currency {width:15px;height:15px;}
.cp-legend small {margin-left:auto;font-size:12px;opacity:.72;font-variant-numeric:tabular-nums;}
.cp-silver {display:flex;align-items:center;gap:8px;margin:12px 0 0;font-size:13px;line-height:1.4;}

/* Phones: the machine first, then its controls, then the coin values. */
@media(max-width:740px) {
    .cp-game {grid-template-columns:1fr;gap:10px;}
    .cp-board {order:1;padding:6px;}
    .cp-controls {order:2;}
    .cp-values {order:3;grid-column:auto;padding:14px;}
    .cp-stage {aspect-ratio:5 / 6;}
    .cp-quick {display:flex;}
    /* On a phone the machine itself is the button: tap it to drop. */
    .cp-controls .cp-drop:not(.cp-cash-out) {display:none;}
}
