/* ═══════════════════════════════════════════════════════════════════
   FYM Scratchers 3D — «Le Kiosque»
   Every rule is gated on #scratchers-screen.sc3d-on: the class is set
   by scratchers3d.js buildDOM(), so a browser where the module never
   ran (404, JS off) keeps the static placeholder untouched.
   ═══════════════════════════════════════════════════════════════════ */

#scratchers-screen.sc3d-on {
    padding: 0;
    background:
        radial-gradient(120% 90% at 50% 0%, #1a2418 0%, #0c110d 55%, #070a08 100%);
    min-height: 100%;
}

#scratchers-screen.sc3d-on .sc3d-wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 12px 14px calc(96px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── header ── */
#scratchers-screen.sc3d-on .sc3d-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 2px;
}
#scratchers-screen.sc3d-on .sc3d-title { flex: 1; }
#scratchers-screen.sc3d-on .sc3d-eyebrow {
    font-size: 11px;
    letter-spacing: 0.22em;
    color: #d4a54a;
    opacity: 0.85;
}
#scratchers-screen.sc3d-on .sc3d-title h2 {
    margin: 2px 0 0;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 26px;
    color: #f3ead2;
}
#scratchers-screen.sc3d-on .sc3d-stage-title {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    color: #cdb87f;
    opacity: 0;
    transition: opacity 0.25s;
}
#scratchers-screen.sc3d-on .sc3d-stage-title.sc3d-onv { opacity: 0.9; }
#scratchers-screen.sc3d-on .sc3d-iconbtn {
    width: 38px; height: 38px;
    border-radius: 12px;
    border: 1px solid rgba(212, 165, 74, 0.35);
    background: rgba(255, 255, 255, 0.05);
    color: #e8dcbb;
    font-size: 18px;
    cursor: pointer;
}
#scratchers-screen.sc3d-on .sc3d-iconbtn.sc3d-off { opacity: 0.4; }

/* ── kiosque cards ── */
#scratchers-screen.sc3d-on .sc3d-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
@media (max-width: 880px) {
    #scratchers-screen.sc3d-on .sc3d-cards { grid-template-columns: 1fr; }
}
#scratchers-screen.sc3d-on .sc3d-card { perspective: 1400px; }
#scratchers-screen.sc3d-on .sc3d-card-flip {
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.55s cubic-bezier(0.4, 0.1, 0.2, 1);
}
#scratchers-screen.sc3d-on .sc3d-card-flip.sc3d-flipped {
    transform: rotateY(180deg);
}
#scratchers-screen.sc3d-on .sc3d-card-face {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 18px;
    border: 1px solid rgba(212, 165, 74, 0.28);
    background: linear-gradient(180deg, #131a14, #0b0f0c);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
#scratchers-screen.sc3d-on .sc3d-card-back {
    position: absolute;
    inset: 0;
    transform: rotateY(180deg);
    overflow: auto;
    color: #efe6c9;
}
#scratchers-screen.sc3d-on .sc3d-card-back h4 {
    margin: 4px 0 2px;
    font-family: Georgia, serif;
    font-size: 18px;
    color: #ecc76a;
    text-align: center;
}
#scratchers-screen.sc3d-on .sc3d-card-art {
    width: 100%;
    border-radius: 12px;
    display: block;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
}
#scratchers-screen.sc3d-on .sc3d-card-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: #cfc6a8;
}
#scratchers-screen.sc3d-on .sc3d-card-row {
    display: flex;
    align-items: center;
    gap: 7px;
}
#scratchers-screen.sc3d-on .sc3d-lamp {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: #5a4a3a;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3) inset;
}
#scratchers-screen.sc3d-on .sc3d-lamp.sc3d-lamp-on {
    background: #57d97e;
    box-shadow: 0 0 8px rgba(87, 217, 126, 0.8);
}
#scratchers-screen.sc3d-on .sc3d-bar {
    height: 5px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}
#scratchers-screen.sc3d-on .sc3d-bar i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #d4a54a, #f0dc9a);
    border-radius: 4px;
}
#scratchers-screen.sc3d-on .sc3d-card-sub {
    font-size: 11.5px;
    color: #a89f83;
}
#scratchers-screen.sc3d-on .sc3d-seed {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 10.5px;
    opacity: 0.75;
    text-align: center;
}
#scratchers-screen.sc3d-on .sc3d-card-actions {
    display: flex;
    gap: 8px;
}

/* ── buttons ── */
#scratchers-screen.sc3d-on .sc3d-btn {
    flex: 1;
    padding: 11px 12px;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    font-size: 13.5px;
    cursor: pointer;
    background: linear-gradient(180deg, #f0d488, #cba14a);
    color: #241a05;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    transition: transform 0.12s, filter 0.12s;
}
#scratchers-screen.sc3d-on .sc3d-btn:active { transform: scale(0.97); }
#scratchers-screen.sc3d-on .sc3d-btn:disabled { opacity: 0.5; }
#scratchers-screen.sc3d-on .sc3d-btn-ghost {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(212, 165, 74, 0.4);
    color: #e8dcbb;
}

/* ── ladder table on card verso ── */
#scratchers-screen.sc3d-on .sc3d-ladder {
    width: 100%;
    border-collapse: collapse;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12.5px;
}
#scratchers-screen.sc3d-on .sc3d-ladder td {
    padding: 4.5px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
#scratchers-screen.sc3d-on .sc3d-ladder td:last-child {
    text-align: right;
    color: #ecc76a;
}

/* ── my tickets ── */
#scratchers-screen.sc3d-on .sc3d-mine h3 {
    margin: 4px 0 8px;
    font-size: 14px;
    color: #e8dcbb;
    font-family: Georgia, serif;
}
#scratchers-screen.sc3d-on .sc3d-mine-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
#scratchers-screen.sc3d-on .sc3d-chip {
    border: 1px solid rgba(212, 165, 74, 0.4);
    background: rgba(212, 165, 74, 0.1);
    color: #efe6c9;
    border-radius: 999px;
    padding: 7px 13px;
    font-size: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    cursor: pointer;
}
#scratchers-screen.sc3d-on .sc3d-chip b {
    font-family: Georgia, serif;
    margin-right: 6px;
    color: #ecc76a;
}
#scratchers-screen.sc3d-on .sc3d-fair {
    font-size: 11.5px;
    color: #8f8a76;
    line-height: 1.55;
    text-align: center;
    max-width: 560px;
    margin: 4px auto 0;
}
#scratchers-screen.sc3d-on .sc3d-err {
    grid-column: 1 / -1;
    text-align: center;
    color: #b9b092;
    padding: 40px 10px;
    font-size: 14px;
}

/* ── the stage (3D or flat) ── */
#scratchers-screen.sc3d-on .sc3d-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-height: 62vh;
}
#scratchers-screen.sc3d-on .sc3d-scene {
    width: 100%;
    height: min(68vh, 640px);
    /* A viewport that reports 0 height — some in-app webviews do, and
       the automation pane always does — collapses a vh-only stage to
       nothing and the ticket vanishes. The floor keeps it on screen. */
    min-height: 320px;
    display: block;
    touch-action: none;
    cursor: grab;
}
#scratchers-screen.sc3d-on .sc3d-scene:active { cursor: grabbing; }

/* flat fallback */
#scratchers-screen.sc3d-on .sc3d-flat {
    perspective: 1500px;
    width: min(78vw, 380px);
    margin: 8px auto;
}
#scratchers-screen.sc3d-on .sc3d-flat-card {
    position: relative;
    transform-style: preserve-3d;
    touch-action: none;
    filter: drop-shadow(0 22px 30px rgba(0, 0, 0, 0.55));
}
#scratchers-screen.sc3d-on .sc3d-flat-tex,
#scratchers-screen.sc3d-on .sc3d-flat-back {
    width: 100%;
    display: block;
    border-radius: 16px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
#scratchers-screen.sc3d-on .sc3d-flat-back {
    position: absolute;
    inset: 0;
    height: 100%;
    transform: rotateY(180deg);
}
#scratchers-screen.sc3d-on .sc3d-flat-coin {
    position: fixed;
    font-size: 30px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    transform: rotate(-18deg);
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
    z-index: 30;
}
#scratchers-screen.sc3d-on .sc3d-fleck {
    position: fixed;
    width: 5px; height: 8px;
    background: linear-gradient(160deg, #dfe3ea, #9aa0ac);
    pointer-events: none;
    z-index: 29;
    animation: sc3d-fleck-fall 0.9s ease-in forwards;
}
@keyframes sc3d-fleck-fall {
    to {
        transform: translate(var(--dx, 20px), 120px) rotate(var(--rot, 200deg));
        opacity: 0;
    }
}

/* stage controls */
#scratchers-screen.sc3d-on .sc3d-stage-ui {
    display: flex;
    gap: 10px;
    width: min(92vw, 460px);
}

/* ── result plaque ── */
#scratchers-screen.sc3d-on .sc3d-plaque {
    position: absolute;
    left: 50%;
    top: 42%;
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
    pointer-events: none;
    min-width: min(84vw, 380px);
    text-align: center;
    padding: 26px 28px 20px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(19, 26, 20, 0.97), rgba(9, 12, 10, 0.97));
    border: 1px solid rgba(212, 165, 74, 0.5);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
    transition: opacity 0.3s, transform 0.3s cubic-bezier(0.2, 1.4, 0.4, 1);
    z-index: 25;
}
#scratchers-screen.sc3d-on .sc3d-plaque.sc3d-show {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}
#scratchers-screen.sc3d-on .sc3d-plaque-title {
    font-size: 13px;
    letter-spacing: 0.28em;
    color: #d4a54a;
}
#scratchers-screen.sc3d-on .sc3d-plaque-amt {
    font-family: Georgia, serif;
    font-size: 44px;
    font-weight: 800;
    color: #f5e6b8;
    margin: 8px 0 4px;
    text-shadow: 0 2px 18px rgba(212, 165, 74, 0.4);
}
#scratchers-screen.sc3d-on .sc3d-plaque-note {
    font-size: 13px;
    color: #cfc6a8;
    line-height: 1.5;
    margin-bottom: 16px;
}
#scratchers-screen.sc3d-on .sc3d-plaque-btns {
    display: flex;
    gap: 10px;
}
#scratchers-screen.sc3d-on .sc3d-plaque-big {
    border-color: #f0c869;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65),
                0 0 60px rgba(240, 200, 105, 0.25);
}
#scratchers-screen.sc3d-on .sc3d-plaque-special {
    border-color: #8f9dff;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65),
                0 0 60px rgba(143, 157, 255, 0.3);
}
#scratchers-screen.sc3d-on .sc3d-plaque-special .sc3d-plaque-title { color: #a9b4ff; }
#scratchers-screen.sc3d-on .sc3d-plaque-lose .sc3d-plaque-amt {
    color: #9a9484;
    text-shadow: none;
    font-size: 32px;
}

/* ── toast ── */
#scratchers-screen.sc3d-on .sc3d-toast {
    position: fixed;
    left: 50%;
    bottom: calc(104px + env(safe-area-inset-bottom));
    transform: translateX(-50%) translateY(8px);
    background: rgba(15, 18, 15, 0.95);
    border: 1px solid rgba(212, 165, 74, 0.45);
    color: #efe6c9;
    border-radius: 12px;
    padding: 10px 18px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 60;
}
#scratchers-screen.sc3d-on .sc3d-toast.sc3d-onv {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

#scratchers-screen.sc3d-on .sc3d-hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
    #scratchers-screen.sc3d-on .sc3d-card-flip { transition: none; }
    #scratchers-screen.sc3d-on .sc3d-plaque { transition: opacity 0.2s; }
    #scratchers-screen.sc3d-on .sc3d-fleck { animation: none; opacity: 0; }
}
