:root {
    --mw-green: #0a4228;
    --mw-green-dark: #032212;
    --mw-gold: #fccf3e;
    --mw-gold-shadow: #b88a00;
}

* { box-sizing: border-box; user-select: none; -webkit-tap-highlight-color: transparent; }

body {
    margin: 0; padding: 0;
    background: radial-gradient(circle at center, #1a5c38, #000);
    font-family: 'Roboto', sans-serif;
    height: 100dvh;
    display: flex; justify-content: center; align-items: center;
    overflow: hidden;
    color: #fff;
}

/* --- SPLASH SCREEN --- */
.overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 999;
    display: flex; justify-content: center; align-items: center;
    transition: opacity 0.5s; backdrop-filter: blur(5px);
}
.hidden { display: none !important; }
.splash-box { text-align: center; animation: float 3s ease-in-out infinite; }
.logo-text {
    font-family: 'Zcool KuaiLe', cursive; font-size: 4rem; line-height: 1; margin: 0;
    background: linear-gradient(to bottom, #fff 40%, var(--mw-gold) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 5px 0 var(--mw-gold-shadow));
}
.btn-start {
    margin-top: 30px; padding: 15px 60px; border-radius: 50px; border: 2px solid #fff;
    background: linear-gradient(180deg, var(--mw-gold), var(--mw-gold-shadow));
    color: #4a0000; font-weight: 900; font-size: 1.5rem; cursor: pointer;
    box-shadow: 0 0 20px var(--mw-gold);
}

/* --- GAME CONTAINER --- */
.game-container {
    width: 100%; max-width: 480px; height: 100%;
    background: url('https://www.transparenttextures.com/patterns/black-scales.png'), var(--mw-green);
    display: flex; flex-direction: column;
    position: relative;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    border: 2px solid var(--mw-gold);
}

/* TOP BAR */
.top-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 15px; background: rgba(0,0,0,0.4);
    border-bottom: 2px solid var(--mw-gold-shadow);
}
.bal-box { display: flex; flex-direction: column; }
.lbl { font-size: 0.7rem; color: #8fbc8f; letter-spacing: 1px; font-weight: bold; }
.val { font-family: 'Zcool KuaiLe', cursive; color: var(--mw-gold); font-size: 1.4rem; text-shadow: 0 2px 0 #000; }
.btn-reset {
    background: #c0392b; border: 1px solid #e74c3c; color: #fff;
    padding: 5px 15px; border-radius: 5px; font-size: 0.7rem; cursor: pointer;
}

/* SLOT STAGE */
.slot-stage {
    flex: 1; display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    padding: 10px; position: relative;
}

/* MULTIPLIER BAR (Combo Header) */
.multiplier-wrap {
    display: flex; justify-content: center; gap: 5px; margin-bottom: 15px; width: 90%;
    background: rgba(0,0,0,0.3); padding: 5px; border-radius: 30px;
    border: 2px solid var(--mw-gold-shadow);
}
.mult-box {
    width: 60px; height: 40px; background: #333; border-radius: 8px;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    border: 1px solid #555; position: relative; opacity: 0.5; transition: 0.3s;
}
.mult-box span { font-weight: bold; font-family: 'Zcool KuaiLe'; color: #fff; }
.mult-box.active {
    opacity: 1; transform: scale(1.15); z-index: 2;
    background: linear-gradient(180deg, var(--mw-gold) 0%, #ff8c00 100%);
    border: 2px solid #fff; box-shadow: 0 0 15px var(--mw-gold);
}
.mult-box.active span { color: #5a0000; }

/* REELS GRID */
.reels-frame {
    width: 95%; padding: 8px; border-radius: 10px;
    background: linear-gradient(45deg, #b8860b, #ffd700, #b8860b);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.reels-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px;
    background: #022b15; height: 280px; overflow: hidden;
    border-radius: 6px; box-shadow: inset 0 0 20px #000; padding: 5px;
}
.reel { display: flex; flex-direction: column; gap: 5px; transition: transform 0.1s; }

/* --- NEW SPIN ANIMATION --- */
/* Class ini akan diapply via JS saat spin */
.reel.spinning .tile {
    filter: blur(5px);
    transform: translateY(15px) scale(0.95);
    opacity: 0.8;
}
.reel.spinning {
    animation: shakeReel 0.1s infinite;
}

@keyframes shakeReel {
    0% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}
/* ------------------------- */

/* TILES 3D STYLE */
.tile {
    height: 85px; width: 100%;
    display: flex; justify-content: center; align-items: center;
    transition: all 0.2s ease-out; /* Smooth transition when blur removed */
}
.face {
    width: 90%; height: 90%;
    background: linear-gradient(145deg, #fff 0%, #e0e0e0 100%);
    border-radius: 6px;
    display: flex; justify-content: center; align-items: center;
    font-size: 3rem;
    box-shadow: 0 4px 0 #bbb, 0 8px 0 #005c2e, 0 12px 5px rgba(0,0,0,0.5);
    position: relative; z-index: 1;
}
.face.red { color: #d32f2f; }
.face.green { color: #2e7d32; }
.face.blue { color: #1565c0; }
.face.gold { color: #ff8c00; text-shadow: 0 0 2px gold; }

.tile.match .face { animation: flashWin 0.5s infinite; background: #fffacd; box-shadow: 0 0 15px var(--mw-gold); }
.tile.explode { animation: explodeTile 0.3s forwards; }

@keyframes dropIn { from { transform: translateY(-100%); opacity:0; } to { transform: translateY(0); opacity:1; } }
@keyframes flashWin { 0%,100%{filter:brightness(1);} 50%{filter:brightness(1.5);} }
@keyframes explodeTile { to { transform: scale(1.5); opacity: 0; } }
@keyframes float { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-10px);} }

/* INFO WIN BAR */
.info-win {
    margin-top: 15px; width: 90%;
    background: rgba(0,0,0,0.5); border: 1px solid var(--mw-gold-shadow);
    padding: 8px; border-radius: 8px; text-align: center;
}
.win-num { font-family: 'Zcool KuaiLe', cursive; font-size: 1.8rem; color: #fff; text-shadow: 0 0 10px var(--mw-gold); }

/* CONTROLS */
.control-bar {
    background: #111; border-top: 3px solid var(--mw-gold);
    padding: 15px 20px; display: grid; grid-template-columns: 1fr auto 1fr;
    gap: 10px; align-items: center;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
}
.bet-ctrl { display: flex; align-items: center; justify-content: center; gap: 5px; }
.bet-ctrl button { width: 35px; height: 35px; border-radius: 50%; border: 2px solid #555; background: #222; color: #fff; font-weight: bold; }
.bet-val { text-align: center; min-width: 80px; }
.bet-val .t { font-size: 0.6rem; color: #888; display: block; }
.bet-val .n { font-weight: bold; font-size: 1rem; color: #fff; }

.spin-area button {
    width: 80px; height: 80px; border-radius: 50%; border: none;
    background: radial-gradient(circle at 30% 30%, var(--mw-gold), #b8860b);
    box-shadow: 0 0 20px rgba(255,215,0,0.4), inset 0 0 5px #fff;
    cursor: pointer; position: relative; font-size: 2.5rem; color: #4a0000;
}
.spin-area button:active { transform: scale(0.95); }
.spin-area button.disabled { filter: grayscale(1); cursor: not-allowed; }

.turbo-ctrl { display: flex; justify-content: flex-end; }
#turbo-btn { background: transparent; border: 1px solid #555; color: #aaa; padding: 8px 12px; border-radius: 6px; font-weight: bold; font-size: 0.8rem; }
#turbo-btn.active { border-color: var(--mw-gold); color: var(--mw-gold); box-shadow: 0 0 10px rgba(255,215,0,0.2); }

/* --- WIN MODAL (PG SOFT STYLE) --- */
#win-modal {
    background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(8px); z-index: 2000;
}
.win-card {
    position: relative; background: transparent; border: none; box-shadow: none;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    animation: zoomBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sunburst {
    position: absolute; top: 50%; left: 50%; width: 600px; height: 600px;
    background: repeating-conic-gradient(from 0deg, rgba(255, 215, 0, 0.2) 0deg 10deg, transparent 10deg 20deg);
    transform: translate(-50%, -50%); animation: rotateSun 8s linear infinite;
    z-index: -1; border-radius: 50%; mask-image: radial-gradient(circle, black 0%, transparent 70%);
}
.win-title {
    font-family: 'Zcool KuaiLe', sans-serif; 
    font-size: 4.5rem;
    line-height: 1.1; 
    margin: 0; 
    text-transform: uppercase;
    text-align: center; 
    width: 100%;
    display: block;
    background: linear-gradient(to bottom, #ffeb3b 0%, #fbc02d 50%, #f57f17 100%);
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent;
    -webkit-text-stroke: 6px #880e4f;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
    animation: pulseText 0.8s infinite alternate; 
    position: relative; 
    z-index: 10;
}

@media (max-width: 400px) {
    .win-title { font-size: 3.5rem; -webkit-text-stroke: 4px #880e4f; }
    .win-val { font-size: 3.5rem; }
}

.win-subtitle {
    font-family: 'Zcool KuaiLe', sans-serif; font-size: 2.5rem; color: #fff;
    -webkit-text-stroke: 2px #d32f2f; margin-top: -10px; text-shadow: 0 5px 5px rgba(0,0,0,0.5); z-index: 10;
}
.win-val {
    font-family: 'Roboto', sans-serif; font-weight: 900; font-size: 4.5rem; margin-top: 20px;
    color: #fff; text-shadow: 0 0 0 #b71c1c, 2px 2px 0 #b71c1c, 4px 4px 0 #b71c1c, 0 0 20px rgba(255, 215, 0, 1);
    z-index: 10; transform: scale(1); transition: transform 0.1s;
}
.win-sub { font-size: 1.2rem; color: #ffd700; margin-top: 15px; font-weight: bold; letter-spacing: 2px; animation: blink 1s infinite; }

@keyframes zoomBounce { 0% {transform: scale(0);} 80% {transform: scale(1.1);} 100% {transform: scale(1);} }
@keyframes rotateSun { from {transform: translate(-50%, -50%) rotate(0deg);} to {transform: translate(-50%, -50%) rotate(360deg);} }
@keyframes pulseText { from {transform: scale(1); filter: brightness(100%);} to {transform: scale(1.05); filter: brightness(120%) drop-shadow(0 0 20px gold);} }
@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:0.5;} }
/* --- AUTH SCREEN STYLES (LOGIN/REGISTER) --- */
.auth-overlay {
    position: fixed; inset: 0; z-index: 3000;
    background: radial-gradient(circle at center, #1a5c38, #000);
    display: flex; justify-content: center; align-items: center;
    padding: 20px;
}
.auth-box {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 2px solid var(--mw-gold);
    padding: 30px; border-radius: 15px;
    width: 100%; max-width: 400px;
    text-align: center;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
}
.auth-form { display: flex; flex-direction: column; gap: 15px; margin-top: 20px; }
.auth-form h3 { color: #fff; margin: 0; font-family: 'Roboto', sans-serif; letter-spacing: 1px; }
.auth-form input {
    padding: 12px; border-radius: 6px; border: 1px solid #555;
    background: #222; color: #fff; font-size: 1rem; outline: none;
    transition: 0.3s; text-align: center;
}
.auth-form input:focus { border-color: var(--mw-gold); box-shadow: 0 0 10px rgba(255,215,0,0.3); }
.btn-primary, .btn-secondary {
    padding: 12px; border: none; border-radius: 50px; font-weight: bold; font-size: 1.1rem; cursor: pointer; margin-top: 10px;
}
.btn-primary {
    background: linear-gradient(180deg, var(--mw-gold), var(--mw-gold-shadow));
    color: #4a0000; box-shadow: 0 0 15px var(--mw-gold-shadow);
}
.btn-secondary {
    background: #0a4228; border: 2px solid #2e7d32; color: #fff;
}
.switch-text { color: #aaa; font-size: 0.9rem; margin-top: 10px; }
.switch-text a { color: var(--mw-gold); text-decoration: none; font-weight: bold; }
.auth-alert {
    background: rgba(220, 38, 38, 0.8); color: #fff; padding: 10px;
    border-radius: 6px; font-size: 0.9rem; margin-bottom: 10px; border: 1px solid #ef4444;
}
.btn-logout {
    background: #333; border: 1px solid #555; color: #aaa;
    padding: 5px 10px; border-radius: 5px; font-size: 0.7rem; text-decoration: none;
    display: flex; align-items: center;
}
.hidden { display: none !important; }

/* Animasi Spin tambahan */
.reel.spinning .tile { filter: blur(4px); transform: scale(0.9); opacity: 0.8; }
.reel.spinning { animation: shakeReel 0.1s infinite; }
@keyframes shakeReel { 0% {transform: translateY(0);} 50% {transform: translateY(-3px);} 100% {transform: translateY(0);} }
