/* ============================================
   Dice Roll 7 - Main Styles
   ============================================ */

/* CSS Variables */
:root {
    --bg-dark: #001201;
    --bg-felt: #00420c;
    --bg-surface: #001201;
    --dice-white: #f5f5f5;
    --dice-dots: #1a1a1a;
    --bet-default: #003a0a;
    --bet-selected: #fad900;
    --bet-win: #22c55e;
    --bet-lose: #666;
    --accent: #fad900;
    --accent-light: #fff8dc;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --gold: #fad900;
    --gold-dark: #b8860b;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: transparent;
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    min-height: calc(100dvh - 3.5rem);
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Screen states */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    z-index: 100;
}

.screen.hidden {
    display: none;
}

/* Loading Screen */
#loading-screen {
    background: #001201;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--bg-surface);
    border-top-color: #fad900;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-screen p {
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Login Screen */
#login-screen {
    background: #001201;
}

.login-content {
    text-align: center;
    padding: 40px;
}

.login-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.login-content h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.login-content p {
    color: var(--text-secondary);
}

/* Game Container */
#game-container {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    padding: 10px;
    padding-bottom: 20px;
    position: relative;
}

#game-container.hidden {
    display: none;
}

/* Header */
#game-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 15px;
    background: var(--bg-surface);
    border-radius: 12px;
    margin-bottom: 10px;
}

.balance-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.balance-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

#balance-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gold);
}

.balance-currency {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ============================================
   DICE SECTION
   ============================================ */
#dice-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 10px;
    background: var(--bg-surface);
    border-radius: 16px;
    margin-bottom: 10px;
}

.dice-container {
    display: flex;
    gap: 30px;
    perspective: 600px;
    margin-bottom: 15px;
}

/* 3D Dice */
.dice {
    width: 70px;
    height: 70px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.1s ease-out;
}

.dice.rolling {
    animation: diceRoll 1.5s ease-out;
}

@keyframes diceRoll {
    0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
    20% { transform: rotateX(360deg) rotateY(180deg) rotateZ(90deg); }
    40% { transform: rotateX(720deg) rotateY(360deg) rotateZ(180deg); }
    60% { transform: rotateX(1080deg) rotateY(540deg) rotateZ(270deg); }
    80% { transform: rotateX(1440deg) rotateY(720deg) rotateZ(360deg); }
    100% { transform: rotateX(var(--final-x)) rotateY(var(--final-y)) rotateZ(0deg); }
}

.dice-face {
    position: absolute;
    width: 70px;
    height: 70px;
    background: var(--dice-white);
    border: 2px solid #ddd;
    border-radius: 10px;
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
    padding: 10px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

/* Dice face positions */
.face-1 { transform: rotateY(0deg) translateZ(35px); }
.face-6 { transform: rotateY(180deg) translateZ(35px); }
.face-2 { transform: rotateY(90deg) translateZ(35px); }
.face-5 { transform: rotateY(-90deg) translateZ(35px); }
.face-3 { transform: rotateX(90deg) translateZ(35px); }
.face-4 { transform: rotateX(-90deg) translateZ(35px); }

/* Dots */
.dot {
    width: 12px;
    height: 12px;
    background: var(--dice-dots);
    border-radius: 50%;
    position: absolute;
}

.dot.center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.dot.top-left { top: 12px; left: 12px; }
.dot.top-right { top: 12px; right: 12px; }
.dot.bottom-left { bottom: 12px; left: 12px; }
.dot.bottom-right { bottom: 12px; right: 12px; }
.dot.middle-left { top: 50%; left: 12px; transform: translateY(-50%); }
.dot.middle-right { top: 50%; right: 12px; transform: translateY(-50%); }

/* Sum Display */
#sum-display {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 25px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    border-radius: 25px;
    font-size: 1.3rem;
    font-weight: 700;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

#sum-display.visible {
    opacity: 1;
    transform: scale(1);
}

#sum-display.hidden {
    display: none;
}

.sum-label {
    color: rgba(255,255,255,0.8);
}

#sum-value {
    color: var(--text-primary);
    font-size: 1.5rem;
}

/* Win Display */
#win-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    padding: 25px 50px;
    border-radius: 20px;
    text-align: center;
    z-index: 50;
    opacity: 0;
    transition: all 0.3s ease;
}

#win-display.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

#win-display.hidden {
    display: none;
}

.win-label {
    display: block;
    font-size: 1.2rem;
    color: var(--bg-dark);
    margin-bottom: 5px;
}

#win-amount {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--bg-dark);
}

/* Message Display */
#message-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 20px 40px;
    border-radius: 12px;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#message-display.visible {
    opacity: 1;
}

#message-display.hidden {
    display: none;
}

#message-text {
    color: var(--text-primary);
    font-size: 1.1rem;
}

/* ============================================
   BET BOARD
   ============================================ */
#bet-board {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.bet-section {
    background: var(--bg-surface);
    border-radius: 12px;
    padding: 10px;
}

.bet-row {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 6px;
}

.bet-row:last-child {
    margin-bottom: 0;
}

/* Bet Buttons */
.bet-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 8px 10px;
    background: var(--bet-default);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.bet-btn:hover {
    background: #4a4a5a;
    transform: translateY(-2px);
}

.bet-btn.selected {
    background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 100%);
    border-color: var(--gold);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.bet-btn.selected .bet-value,
.bet-btn.selected .bet-mult {
    color: var(--bg-dark);
}

.bet-btn.win {
    background: var(--bet-win);
    animation: winPulse 0.5s ease-out;
}

@keyframes winPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.bet-btn.lose {
    opacity: 0.5;
}

.bet-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.bet-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.bet-mult {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Seven button special */
.bet-btn.seven {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    min-width: 60px;
}

.bet-btn.seven:hover {
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
}

.bet-btn.seven.selected {
    background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 100%);
}

/* Special bets */
.special-bet {
    flex: 1;
    max-width: 120px;
}

.special-bet .bet-value {
    font-size: 0.85rem;
}

/* Bet amount chip display */
.bet-chip {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    background: var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--bg-dark);
    border: 2px solid var(--gold-dark);
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
}

.bet-btn.selected .bet-chip {
    opacity: 1;
    transform: scale(1);
}

/* Total Bet Display */
#total-bet-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-surface);
    border-radius: 10px;
    margin-bottom: 10px;
}

.total-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

#total-bet-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gold);
}

/* ============================================
   BET CONTROLS
   ============================================ */
#bet-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-surface);
    border-radius: 12px;
    margin-bottom: 10px;
}

.bet-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.bet-buttons {
    display: flex;
    gap: 8px;
}

.amount-btn {
    padding: 10px 16px;
    background: var(--bet-default);
    border: 2px solid transparent;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.amount-btn:hover {
    background: #4a4a5a;
}

.amount-btn.active {
    background: #fad900;
    border-color: #fff8dc;
    color: #001201;
}

/* ============================================
   ROLL BUTTON
   ============================================ */
#roll-button {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #fad900 0%, #fff8dc 100%);
    border: none;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

#roll-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(250, 217, 0, 0.4);
}

#roll-button:disabled {
    background: var(--bet-default);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#roll-button.rolling {
    animation: buttonPulse 0.3s ease infinite;
}

@keyframes buttonPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ============================================
   GAME TITLE
   ============================================ */
.game-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    opacity: 0.6;
}

.title-icon {
    font-size: 1.5rem;
}

.title-text {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 1px;
}

/* ============================================
   PARTICLES
   ============================================ */
#particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 60;
}

.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: particleFall 1.5s ease-out forwards;
}

@keyframes particleFall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(200px) rotate(720deg);
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 380px) {
    .dice {
        width: 60px;
        height: 60px;
    }

    .dice-face {
        width: 60px;
        height: 60px;
    }

    .face-1 { transform: rotateY(0deg) translateZ(30px); }
    .face-6 { transform: rotateY(180deg) translateZ(30px); }
    .face-2 { transform: rotateY(90deg) translateZ(30px); }
    .face-5 { transform: rotateY(-90deg) translateZ(30px); }
    .face-3 { transform: rotateX(90deg) translateZ(30px); }
    .face-4 { transform: rotateX(-90deg) translateZ(30px); }

    .dot {
        width: 10px;
        height: 10px;
    }

    .bet-btn {
        min-width: 45px;
        padding: 6px 8px;
    }

    .bet-value {
        font-size: 0.9rem;
    }

    .amount-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
}

/* Hidden utility */
.hidden {
    display: none !important;
}
