/* slot-machine.css — Premium Japanese cyberpunk slot machine */

/* ===== WRAPPER (responsive root) ===== */
.sm-wrapper {
    --symbol-size: min(80px, 15vw);
    --reel-gap: min(8px, 1.5vw);
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}
/* Hide symbol images until preloaded, fade in */
.sm-wrapper .sm-symbol img {
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sm-wrapper.sm-ready .sm-symbol img {
    opacity: 1;
}

/* ===== TOP FRAME ===== */
.sm-frame-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px 24px;
    background: linear-gradient(180deg, #2a1a0a 0%, #1a0a00 100%);
    border: 3px solid #c9a227;
    border-bottom: none;
    border-radius: 16px 16px 0 0;
    position: relative;
}
.sm-frame-top::before {
    content: '';
    position: absolute;
    inset: 3px;
    border: 1px solid rgba(201,162,39,0.3);
    border-radius: 12px 12px 0 0;
    pointer-events: none;
}
.sm-slot-title {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    font-weight: 700;
    color: #fbbf24;
    text-shadow: 0 0 10px rgba(251,191,36,0.5);
    letter-spacing: 0.1em;
}
.sm-frame-ornament {
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, #fbbf24 0%, #c9a227 50%, transparent 70%);
    opacity: 0.6;
    flex-shrink: 0;
}

/* ===== MAIN MACHINE ===== */
.sm-machine {
    position: relative;
    background: linear-gradient(180deg, #0f0f0f 0%, #1a1a1a 50%, #0a0a0a 100%);
    border-left: 3px solid #c9a227;
    border-right: 3px solid #c9a227;
    padding: 20px;
    box-shadow: inset 0 0 100px rgba(0,0,0,0.8), inset 0 0 30px rgba(201,162,39,0.1);
}

/* ===== JACKPOT DISPLAY ===== */
.sm-jackpot-bar {
    text-align: center;
    margin-bottom: 16px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #1a0a00 0%, #2a1a0a 50%, #1a0a00 100%);
    border: 2px solid #c9a227;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(251,191,36,0.2), inset 0 0 20px rgba(0,0,0,0.5);
}
.sm-jackpot-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #c9a227;
    letter-spacing: 0.3em;
    margin-bottom: 4px;
    font-family: 'Orbitron', sans-serif;
}
.sm-jackpot-val {
    display: block;
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 900;
    color: #fbbf24;
    text-shadow: 0 0 20px rgba(251,191,36,0.8);
    animation: sm-jp-glow 2s ease-in-out infinite;
    font-family: 'Orbitron', sans-serif;
}
@keyframes sm-jp-glow {
    0%, 100% { text-shadow: 0 0 20px rgba(251,191,36,0.8); }
    50% { text-shadow: 0 0 40px rgba(251,191,36,1), 0 0 60px rgba(251,191,36,0.5); }
}

/* ===== REELS CONTAINER ===== */
.sm-reels {
    position: relative;
    display: flex;
    gap: var(--reel-gap);
    justify-content: center;
    background: #000;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #333;
    box-shadow: inset 0 0 50px rgba(0,0,0,0.9), 0 4px 20px rgba(0,0,0,0.5);
}
/* Top/bottom shadow overlays for depth */
.sm-reels::before, .sm-reels::after {
    content: '';
    position: absolute;
    left: 12px;
    right: 12px;
    height: 40px;
    z-index: 10;
    pointer-events: none;
}
.sm-reels::before {
    top: 12px;
    background: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, transparent 100%);
}
.sm-reels::after {
    bottom: 12px;
    background: linear-gradient(0deg, rgba(0,0,0,0.9) 0%, transparent 100%);
}

/* ===== INDIVIDUAL REEL ===== */
.sm-reel-viewport {
    width: var(--symbol-size);
    height: calc(var(--symbol-size) * 3);
    overflow: hidden;
    position: relative;
    border-radius: 4px;
}

/* Scrolling strip */
.sm-reel-strip {
    display: flex;
    flex-direction: column;
    will-change: transform;
}

/* ===== SYMBOL (IMAGE-BASED) ===== */
.sm-symbol {
    width: var(--symbol-size);
    height: var(--symbol-size);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2a 0%, #0a0a1a 100%);
    border: 1px solid rgba(201,162,39,0.2);
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.sm-symbol img {
    width: 90%;
    height: 90%;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    pointer-events: none;
}

/* Tier-based backgrounds */
.sm-symbol.tier-low {
    background: linear-gradient(135deg, #1a1a2a 0%, #0a0a1a 100%);
}
.sm-symbol.tier-mid {
    background: linear-gradient(135deg, #2a1a1a 0%, #1a0a0a 100%);
    border-color: rgba(201,162,39,0.3);
}
.sm-symbol.tier-high {
    background: linear-gradient(135deg, #2a1a00 0%, #1a0a00 100%);
    border-color: rgba(201,162,39,0.5);
}
.sm-symbol.tier-special {
    background: linear-gradient(135deg, #1a0a2a 0%, #0a001a 100%);
    border-color: rgba(147,51,234,0.5);
    animation: sm-glow-special 2s ease-in-out infinite;
}
@keyframes sm-glow-special {
    0%, 100% { box-shadow: 0 0 10px rgba(147,51,234,0.3); }
    50% { box-shadow: 0 0 25px rgba(147,51,234,0.6); }
}

/* ===== REEL SEPARATORS ===== */
.sm-reel-sep {
    position: absolute;
    top: 12px;
    bottom: 12px;
    width: 2px;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(201,162,39,0.3) 20%,
        rgba(201,162,39,0.5) 50%,
        rgba(201,162,39,0.3) 80%,
        transparent 100%
    );
    z-index: 5;
    pointer-events: none;
}

/* ===== WIN LINES (SVG) ===== */
.sm-win-lines {
    position: absolute;
    inset: 12px;
    pointer-events: none;
    z-index: 20;
}
.sm-win-line-svg {
    width: 100%;
    height: 100%;
}
.sm-win-line {
    fill: none;
    stroke: #fbbf24;
    stroke-width: 4;
    stroke-linecap: round;
    opacity: 0;
    filter: drop-shadow(0 0 8px rgba(251,191,36,0.8));
}
.sm-win-line.active {
    opacity: 1;
    animation: sm-line-pulse 0.5s ease-in-out 3;
}
@keyframes sm-line-pulse {
    0%, 100% { stroke-width: 4; opacity: 1; }
    50% { stroke-width: 8; opacity: 0.8; }
}

/* ===== WINNING SYMBOL GLOW ===== */
.sm-symbol.win-glow {
    z-index: 15;
    position: relative;
    animation: sm-win-glow 0.5s ease-in-out 3;
}
.sm-symbol.win-glow::after {
    content: '';
    position: absolute;
    inset: -4px;
    border: 2px solid #fbbf24;
    border-radius: 8px;
    animation: sm-border-glow 0.5s ease-in-out 3;
    pointer-events: none;
}
@keyframes sm-win-glow {
    0%, 100% { box-shadow: 0 0 15px rgba(251,191,36,0.5); transform: scale(1); }
    50% { box-shadow: 0 0 40px rgba(251,191,36,0.9); transform: scale(1.08); }
}
@keyframes sm-border-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== WIN OVERLAY ===== */
.sm-win-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 30;
    border-radius: 8px;
}
.sm-win-overlay.show {
    opacity: 1;
}
.sm-win-overlay .sm-win-amt {
    font-size: clamp(2rem, 8vw, 3.5rem);
    font-weight: 900;
    color: #fbbf24;
    text-shadow: 0 0 30px rgba(251,191,36,0.9);
    font-family: 'Orbitron', sans-serif;
}
.sm-win-overlay .sm-win-lbl {
    font-size: 1rem;
    color: #fff;
    margin-top: 8px;
}

/* ===== BOTTOM FRAME ===== */
.sm-frame-bottom {
    display: flex;
    justify-content: space-around;
    padding: 16px 24px;
    background: linear-gradient(180deg, #1a0a00 0%, #2a1a0a 100%);
    border: 3px solid #c9a227;
    border-top: none;
    border-radius: 0 0 16px 16px;
}
.sm-frame-bottom > div { text-align: center; }
.sm-frame-bottom .sm-info-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    color: #888;
    letter-spacing: 0.2em;
    margin-bottom: 4px;
    font-family: 'Orbitron', sans-serif;
}
.sm-frame-bottom .sm-info-value {
    display: block;
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    font-weight: 700;
    color: #fbbf24;
    font-family: 'Orbitron', sans-serif;
}

/* ===== JACKPOT CELEBRATION OVERLAY ===== */
.sm-jackpot-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: sm-jackpot-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.sm-jackpot-overlay.sm-jackpot-fade {
    animation: sm-jackpot-out 0.6s ease-out forwards;
}
.sm-jackpot-text {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(3rem, 10vw, 4.5rem);
    font-weight: 900;
    color: #fbbf24;
    text-shadow: 0 0 30px rgba(251,191,36,0.8);
    animation: sm-jackpot-pulse 0.5s ease-in-out infinite;
}
.sm-jackpot-sub {
    font-size: 2.5rem;
    margin-top: 0.75rem;
}
.sm-jackpot-amount {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    margin-top: 1rem;
}
@keyframes sm-jackpot-in {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes sm-jackpot-out {
    from { opacity: 1; }
    to { opacity: 0; }
}
@keyframes sm-jackpot-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Screen shake during jackpot */
body.sm-jackpot-shake {
    animation: sm-screen-shake 0.5s ease-in-out;
}
@keyframes sm-screen-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Confetti particles */
body.sm-jackpot-shake::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle, #fbbf24 1px, transparent 1px),
        radial-gradient(circle, #dc2626 1px, transparent 1px),
        radial-gradient(circle, #fff 1px, transparent 1px);
    background-size: 50px 50px, 30px 30px, 40px 40px;
    animation: sm-confetti 2s linear infinite;
    pointer-events: none;
    z-index: 10000;
}
@keyframes sm-confetti {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .sm-wrapper {
        --symbol-size: 14vw;
        --reel-gap: 1vw;
    }
    .sm-frame-top, .sm-frame-bottom {
        padding: 12px 16px;
    }
    .sm-machine { padding: 12px; }
    .sm-jackpot-bar { padding: 8px 16px; margin-bottom: 12px; }
    .sm-jackpot-text { font-size: 3rem; }
    .sm-jackpot-sub { font-size: 1.5rem; }
}
@media (min-width: 768px) {
    .sm-wrapper {
        --symbol-size: 90px;
        --reel-gap: 10px;
    }
}
@media (min-width: 1024px) {
    .sm-wrapper {
        --symbol-size: 100px;
        --reel-gap: 12px;
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    .sm-reel-strip { transition: none !important; }
    .sm-symbol.win-glow { animation: none; }
    .sm-symbol.win-glow::after { animation: none; }
    .sm-symbol.tier-special { animation: none; }
    .sm-jackpot-val { animation: none; }
    .sm-jackpot-overlay { animation: none; }
    .sm-jackpot-text { animation: none; }
    .sm-jackpot-overlay.sm-jackpot-fade { animation: none; opacity: 0; }
    .sm-win-line.active { animation: none; }
    body.sm-jackpot-shake { animation: none; }
    body.sm-jackpot-shake::before { animation: none; display: none; }
}
