﻿/* =====================================================================
   DailyTarotSpin - the Wheel of Fate machine (Spin.aspx)
   ===================================================================== */

.spin-page { padding-top: .25rem; }
.spin-intro { text-align: center; margin-bottom: clamp(1rem, 3vw, 1.75rem); }
.spin-intro h1 { margin-bottom: .35rem; }
.spin-intro p { color: var(--dts-muted); margin: 0; }

/* ---------- stage: machine + lever ---------- */
.spin-stage {
    position: relative;
    /* shrink on short screens so the whole machine fits without scrolling */
    max-width: min(860px, max(340px, calc(150vh - 560px)));
    margin-inline: auto;
}
@media (min-width: 768px) and (max-height: 940px) {
    .spin-intro { margin-bottom: .75rem; }
    .spin-intro h1 { font-size: 1.8rem; }
    .spin-intro p { display: none; }
}

/* ---------- the machine cabinet ---------- */
.machine {
    --chase: 1.8s;
    position: relative;
    border-radius: 30px;
    padding: clamp(18px, 4vw, 34px) clamp(12px, 3.4vw, 34px) clamp(16px, 3.4vw, 28px);
    background:
        radial-gradient(120% 70% at 50% 0%, rgba(124, 58, 237, .35), transparent 60%),
        radial-gradient(90% 60% at 50% 110%, rgba(217, 70, 239, .18), transparent 60%),
        linear-gradient(180deg, #221a4d 0%, #170f38 55%, #120b2c 100%);
    border: 2px solid rgba(232, 193, 90, .55);
    box-shadow:
        0 0 0 6px #0f0a26,
        0 0 0 8px rgba(232, 193, 90, .35),
        0 30px 80px rgba(0, 0, 0, .65),
        0 0 90px rgba(124, 58, 237, .25),
        inset 0 1px 0 rgba(255, 255, 255, .08),
        inset 0 0 60px rgba(0, 0, 0, .45);
    isolation: isolate;
}
.machine.spinning { --chase: .42s; }
.machine.win { --chase: .5s; }

/* marquee bulbs (placed by reels.js around the edge) */
.machine-lights { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.bulb {
    position: absolute;
    width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px;
    border-radius: 50%;
    background: #6b5420;
    box-shadow: inset 0 -1px 2px rgba(0, 0, 0, .5);
    animation: bulb-chase var(--chase) linear infinite;
    animation-delay: calc(var(--phase) * var(--chase) / -3);
}
@keyframes bulb-chase {
    0%, 30%  { background: #fff4c9; box-shadow: 0 0 6px 2px rgba(255, 220, 120, .95), 0 0 16px 4px rgba(232, 193, 90, .55); }
    34%, 100% { background: #6b5420; box-shadow: inset 0 -1px 2px rgba(0, 0, 0, .5); }
}
.machine.win .bulb { animation-name: bulb-blink; animation-delay: 0s; }
@keyframes bulb-blink {
    0%, 49%  { background: #fff4c9; box-shadow: 0 0 8px 3px rgba(255, 220, 120, 1), 0 0 20px 6px rgba(217, 70, 239, .5); }
    50%, 100% { background: #8a6a28; box-shadow: none; }
}

/* crown / title plate */
.machine-crown {
    display: flex; align-items: center; justify-content: center; gap: .7rem;
    margin-bottom: clamp(12px, 2.6vw, 22px);
    position: relative; z-index: 3;
}
.machine-crown img { width: clamp(34px, 7vw, 52px); height: auto; filter: drop-shadow(0 0 10px rgba(232, 193, 90, .4)); }
.machine-crown .crown-title {
    font-family: var(--dts-font-display);
    font-weight: 700;
    font-size: clamp(1.05rem, 3.6vw, 1.75rem);
    letter-spacing: .08em;
    text-transform: uppercase;
    background: var(--dts-gold-grad);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    white-space: nowrap;
}
.machine-crown .crown-rule {
    flex: 1 1 0; max-width: 110px; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(232, 193, 90, .7));
}
.machine-crown .crown-rule:last-child { background: linear-gradient(270deg, transparent, rgba(232, 193, 90, .7)); }

/* sound toggles */
.machine-sound {
    position: absolute; top: clamp(10px, 2vw, 16px); right: clamp(12px, 2.6vw, 22px);
    display: flex; gap: 4px; z-index: 4;
}
.machine-sound button {
    width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center;
    border: 1px solid rgba(232, 193, 90, .3);
    background: rgba(11, 10, 31, .55);
    color: var(--dts-gold-light);
    font-size: 1rem;
    transition: background .2s, color .2s, opacity .2s;
}
.machine-sound button:hover { background: rgba(232, 193, 90, .14); }
.machine-sound button[aria-pressed="false"] { color: var(--dts-muted); opacity: .7; }
@media (max-width: 575.98px) {
    .machine-sound { top: 8px; right: 10px; gap: 2px; }
    .machine-sound button { width: 28px; height: 28px; font-size: .85rem; }
    .machine-crown { padding-right: 52px; padding-left: 52px; }
    .machine-crown .crown-rule { display: none; }
}

/* ---------- reel bay ---------- */
.reel-bay {
    position: relative; z-index: 3;
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: clamp(8px, 2.2vw, 20px);
    padding: clamp(10px, 2.2vw, 18px);
    border-radius: 20px;
    background: linear-gradient(180deg, #07061a, #0d0a26);
    box-shadow:
        inset 0 0 0 1px rgba(232, 193, 90, .28),
        inset 0 10px 30px rgba(0, 0, 0, .8),
        0 1px 0 rgba(255, 255, 255, .06);
}

.reel { position: relative; min-width: 0; }

.reel-window {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: radial-gradient(120% 60% at 50% 50%, #1b1442 0%, #0a0820 100%);
    box-shadow: inset 0 0 0 1px rgba(232, 193, 90, .22), inset 0 0 22px rgba(0, 0, 0, .7);
    transition: box-shadow .35s ease;
}
.reel-strip { position: absolute; top: 0; left: 0; right: 0; will-change: transform; }
.reel-cell { position: relative; }
.reel-card {
    position: absolute; left: 7%; right: 7%;
    border-radius: 8px;
    background-color: #000;
    background-repeat: no-repeat;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .6), 0 0 0 1px rgba(232, 193, 90, .25);
}
.reel-card.face { background-image: url("/Images/Cards/sprite.jpg"); background-size: 1300% 600%; }
.reel-card.back { background-image: url("/Images/Cards/back.jpg"); background-size: cover; background-position: center; }

/* curved-glass shading + sheen on top of the strip */
.reel-glass {
    position: absolute; inset: 0; pointer-events: none; z-index: 2;
    background:
        linear-gradient(180deg, rgba(5, 4, 16, .92) 0%, rgba(5, 4, 16, .25) 17%, transparent 30%, transparent 70%, rgba(5, 4, 16, .25) 83%, rgba(5, 4, 16, .92) 100%),
        linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .06) 45%, transparent 60%);
}

/* the card that flips over after the reel stops */
.flip-card {
    position: absolute; left: 7%; right: 7%; z-index: 3;
    perspective: 900px;
}
.flip-inner {
    position: relative; width: 100%; height: 100%;
    transform-style: preserve-3d;
    transition: transform .75s cubic-bezier(.2, .8, .25, 1.15);
}
.flip-card.flipped .flip-inner { transform: rotateY(180deg); }
.flip-face {
    position: absolute; inset: 0;
    border-radius: 8px; overflow: hidden;
    backface-visibility: hidden; -webkit-backface-visibility: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .6), 0 0 0 1px rgba(232, 193, 90, .35);
    background: #000;
}
.flip-face img { display: block; width: 100%; height: 100%; object-fit: cover; }
.flip-front { transform: rotateY(180deg); }
.flip-front img { transition: transform .6s ease .55s; }
.flip-card.reversed .flip-front img { transform: rotate(180deg); }
.flip-card.flipped .flip-face.flip-front { box-shadow: 0 6px 18px rgba(0, 0, 0, .6), 0 0 0 1px rgba(232, 193, 90, .6), 0 0 26px rgba(232, 193, 90, .45); }

/* states */
.reel.anticipate .reel-window {
    animation: anticipate .5s ease-in-out infinite alternate;
}
@keyframes anticipate {
    from { box-shadow: inset 0 0 0 1px rgba(232, 193, 90, .4), inset 0 0 22px rgba(0, 0, 0, .7), 0 0 12px rgba(217, 70, 239, .35); }
    to   { box-shadow: inset 0 0 0 2px rgba(247, 227, 161, .9), inset 0 0 22px rgba(0, 0, 0, .7), 0 0 34px rgba(217, 70, 239, .8); }
}
.reel.landed .reel-window { animation: landed .7s ease-out; }
@keyframes landed {
    0%   { box-shadow: inset 0 0 0 2px rgba(247, 227, 161, 1), 0 0 36px rgba(232, 193, 90, .9); }
    100% { box-shadow: inset 0 0 0 1px rgba(232, 193, 90, .22), inset 0 0 22px rgba(0, 0, 0, .7); }
}
.reel.revealed .reel-window { box-shadow: inset 0 0 0 1px rgba(232, 193, 90, .45), 0 0 26px rgba(232, 193, 90, .22); }

/* label plate under each reel */
.reel-label { text-align: center; margin-top: .55rem; min-height: 2.9em; line-height: 1.25; }
.reel-label .pos {
    display: block;
    font-family: var(--dts-font-display);
    font-size: clamp(.68rem, 1.9vw, .85rem);
    letter-spacing: .2em; text-transform: uppercase;
    color: var(--dts-gold);
}
.reel-label .name {
    display: block; margin-top: .15rem;
    font-size: clamp(.72rem, 2.1vw, .95rem); font-weight: 600; color: #fff;
    opacity: 0; transform: translateY(4px);
    transition: opacity .4s, transform .4s;
}
.reel-label .name.show { opacity: 1; transform: none; }
.reel-label .name .rev { color: var(--dts-magenta); font-weight: 600; font-size: .85em; }

/* ---------- controls ---------- */
.machine-controls { position: relative; z-index: 3; margin-top: clamp(14px, 3vw, 24px); }
.controls-grid {
    display: grid; gap: .6rem;
    grid-template-areas: "q" "chips" "btn";
    max-width: 560px; margin: 0 auto;
}
.question-field { grid-area: q; }
.question-field .form-control { text-align: center; }
.question-chips { grid-area: chips; display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; }
.controls-grid .btn-spin { grid-area: btn; }
@media (min-width: 768px) {
    .controls-grid {
        max-width: 660px;
        grid-template-columns: 1fr auto;
        grid-template-areas: "q btn" "chips chips";
        align-items: center;
    }
    .question-field .form-control { text-align: left; padding-block: .85rem; }
    .controls-grid .btn-spin { width: auto; margin: 0; padding: .85rem 1.6rem; font-size: 1.05rem; white-space: nowrap; }
}
.question-chips button {
    border: 1px solid rgba(124, 58, 237, .45);
    background: rgba(124, 58, 237, .14);
    color: #ddd6fe;
    border-radius: 999px;
    padding: .25rem .75rem;
    font-size: .8rem;
}
.question-chips button:hover { background: rgba(124, 58, 237, .3); color: #fff; }
.sign-chip { position: relative; margin: 0; }
.sign-chip[hidden] { display: none; }
.sign-chip select {
    appearance: none; -webkit-appearance: none; cursor: pointer;
    border: 1px solid var(--dts-border-strong);
    background: rgba(232, 193, 90, .12);
    color: var(--dts-gold-light);
    border-radius: 999px;
    padding: .25rem .8rem;
    font-size: .8rem; line-height: 1.5;
}
.sign-chip select:hover, .sign-chip select:focus { background: rgba(232, 193, 90, .22); outline: none; box-shadow: 0 0 0 2px rgba(232, 193, 90, .3); }
.sign-chip select option { background: #1a153a; color: #ece8fb; }

.btn-spin {
    display: block;
    width: min(100%, 360px);
    margin: .9rem auto 0;
    padding: 1rem 1.5rem;
    font-family: var(--dts-font-display);
    font-size: clamp(1.1rem, 3.6vw, 1.35rem);
    font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    color: #2a1a00;
    border: 0; border-radius: 999px;
    background: var(--dts-gold-grad);
    box-shadow: 0 0 0 3px rgba(11, 10, 31, .9), 0 0 0 5px rgba(232, 193, 90, .6), 0 10px 30px rgba(232, 193, 90, .3);
    transition: transform .12s, filter .2s, box-shadow .2s;
    position: relative; overflow: hidden;
}
.btn-spin::after {
    content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
    transform: skewX(-20deg);
    animation: spin-sheen 3.2s ease-in-out infinite;
}
@keyframes spin-sheen { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.btn-spin:hover { filter: brightness(1.07); }
.btn-spin:active { transform: scale(.98); }
.btn-spin:disabled { filter: saturate(.5) brightness(.75); cursor: default; }
.btn-spin:disabled::after { animation: none; }
.btn-spin.idle-pulse { animation: spin-pulse 2.4s ease-in-out infinite; }
@keyframes spin-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(11, 10, 31, .9), 0 0 0 5px rgba(232, 193, 90, .6), 0 10px 30px rgba(232, 193, 90, .3); }
    50%      { box-shadow: 0 0 0 3px rgba(11, 10, 31, .9), 0 0 0 5px rgba(247, 227, 161, .95), 0 10px 44px rgba(232, 193, 90, .6); }
}
.spin-note { text-align: center; color: var(--dts-muted); font-size: .85rem; margin: .7rem 0 0; }
.spin-note a { font-weight: 600; }

/* out-of-credits panel */
.need-credits {
    display: none;
    max-width: 560px; margin: 1rem auto 0;
    padding: 1rem 1.1rem;
    border-radius: var(--dts-radius);
    border: 1px solid var(--dts-border-strong);
    background: rgba(11, 10, 31, .6);
    text-align: center;
}
.need-credits.show { display: block; animation: dts-toast-in .3s ease; }

/* ---------- lever (desktop) ---------- */
.lever {
    display: none;
    position: absolute; top: 26%; right: -58px; width: 52px; height: 230px;
    z-index: 1; cursor: grab; touch-action: none;
    background: none; border: 0; padding: 0;
}
@media (min-width: 992px) { .lever { display: block; } }
.lever-mount {
    position: absolute; left: 0; bottom: 34px; width: 22px; height: 70px;
    border-radius: 0 10px 10px 0;
    background: linear-gradient(90deg, #8a6a28, #e8c15a 45%, #8a6a28);
    box-shadow: 0 4px 10px rgba(0, 0, 0, .5);
}
.lever-arm {
    position: absolute; left: 26px; bottom: 60px; width: 10px; height: 150px; margin-left: -5px;
    transform-origin: 50% 100%;
    transform: perspective(400px) rotateX(0deg);
    transition: transform .45s cubic-bezier(.3, 1.6, .5, 1);
    border-radius: 6px;
    background: linear-gradient(90deg, #6d6d78, #f0f0f5 45%, #85858f);
}
.lever-hub {
    position: absolute; left: 14px; bottom: 50px; width: 24px; height: 24px; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fff4c9, #e8c15a 45%, #8a6a28);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .6);
}
.lever-knob {
    position: absolute; left: 50%; top: -20px; width: 38px; height: 38px; margin-left: -19px;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 28%, #ffd6ff, #d946ef 40%, #6b21a8 85%);
    box-shadow: 0 6px 14px rgba(0, 0, 0, .55), 0 0 18px rgba(217, 70, 239, .55);
}
.lever:hover .lever-knob { box-shadow: 0 6px 14px rgba(0, 0, 0, .55), 0 0 28px rgba(217, 70, 239, .9); }
.lever.pulled .lever-arm { transform: perspective(400px) rotateX(-155deg); transition: transform .22s ease-in; }
.lever:disabled { cursor: default; }
.lever:focus-visible { outline: none; }
.lever:focus-visible .lever-knob { outline: 2px solid var(--dts-gold); outline-offset: 3px; }

/* ---------- sparkle canvas ---------- */
.fx-canvas { position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); pointer-events: none; z-index: 5; }

/* ---------- results ---------- */
.spin-results { display: none; margin-top: clamp(1.5rem, 5vw, 3rem); }
.spin-results.show { display: block; animation: results-in .6s ease; }
@keyframes results-in { from { opacity: 0; transform: translateY(14px); } }

.result-grid { display: grid; gap: 1rem; }
@media (min-width: 768px) { .result-grid { grid-template-columns: repeat(3, 1fr); } }
.result-card {
    display: grid; grid-template-columns: 96px 1fr; gap: 1rem; align-items: start;
    padding: 1rem;
}
@media (min-width: 768px) {
    .result-card { grid-template-columns: 1fr; text-align: center; padding: 1.25rem; }
    .result-card .dts-tarot { max-width: 170px; margin-inline: auto; }
    .result-card .dts-keywords { justify-content: center; }
}
.result-card h3 { margin: .1rem 0 .35rem; }
.result-card p { margin-bottom: .6rem; color: var(--dts-text); }

.reading-panel { margin-top: 1.25rem; }
.reading-panel .reading-text p { font-size: 1.04rem; line-height: 1.75; }
.reading-panel .reading-text p:first-child::first-letter {
    font-family: var(--dts-font-display); font-size: 2.6em; float: left; line-height: .9;
    margin: .1em .12em 0 0; color: var(--dts-gold);
}

/* ---------- short screens: tighten the fixed parts so the reels keep their size ---------- */
@media (max-height: 760px) {
    .machine { padding-top: 14px; padding-bottom: 14px; }
    .machine-crown { margin-bottom: 8px; }
    .machine-crown img { width: 30px; }
    .machine-crown .crown-title { font-size: 1.05rem; }
    .reel-label { margin-top: .35rem; min-height: 2.5em; }
    .machine-controls { margin-top: 10px; }
    .question-chips button { display: none; }            /* short screens: keep only the sign prompt */
    .spin-note { margin-top: .4rem; font-size: .8rem; }
}
@media (max-width: 575.98px) and (max-height: 760px) {
    .controls-grid .btn-spin { padding-block: .8rem; margin-top: .3rem; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .bulb, .btn-spin::after, .btn-spin.idle-pulse, .reel.anticipate .reel-window { animation: none !important; }
    .flip-inner { transition-duration: .3s; }
}
