@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700;900&family=Orbitron:wght@700&display=swap');

:root {
    --bg-color: #0f1c14;
    --primary: #f1c40f;
    --text-light: #ecf0f1;
    --low-color: #3498db;
    --high-color: #e74c3c;
    --seven-color: #f1c40f;
    --panel-bg: rgba(0, 0, 0, 0.6);
}

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

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-color);
    background-image: url('bg.png');
    background-size: cover;
    background-position: center;
    color: var(--text-light);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    justify-content: center;
}

#app {
    width: 100%;
    max-width: 500px;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
}

/* --- PROMO BANNER --- */
.promo-banner {
    background-color: #e74c3c;
    background-image: linear-gradient(45deg, #c0392b, #e74c3c);
    color: #fff;
    text-align: center;
    padding: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 50;
    box-shadow: 0 4px 15px rgba(0,0,0,0.6);
    line-height: 1.4;
    border-bottom: 2px solid #f1c40f;
}

.promo-banner a {
    color: #f1c40f;
    text-decoration: underline;
    font-weight: 900;
}

.promo-banner a:active {
    opacity: 0.8;
}

/* --- HEADER --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.9), rgba(0,0,0,0));
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-btn {
    background: rgba(255,255,255,0.1);
    color: var(--text-light);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.info-btn:active {
    transform: scale(0.9);
    background: rgba(255,255,255,0.3);
}

.logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(241, 196, 15, 0.5);
}

.balance-container {
    text-align: right;
    background: var(--panel-bg);
    padding: 5px 15px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.1);
}

.balance-container .label {
    display: block;
    font-size: 0.6rem;
    color: #bdc3c7;
    letter-spacing: 1px;
}

.balance-container .value {
    font-size: 1.2rem;
    font-weight: 900;
    color: #2ecc71;
}

/* --- STAGE (DICE) --- */
#stage {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

#diceContainer {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.die {
    width: 80px;
    height: 80px;
    background-color: #fff;
    border-radius: 15px;
    box-shadow: inset 0 -5px 10px rgba(0,0,0,0.2), 0 10px 20px rgba(0,0,0,0.5);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 10px;
    transition: transform 0.1s ease;
}

.dot {
    background-color: #2c3e50;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    justify-self: center;
    align-self: center;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

/* Dice Rolling Animation */
.rolling .die {
    animation: wobble 0.3s infinite;
}

@keyframes wobble {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-10deg) scale(1.1); }
    50% { transform: rotate(0deg) scale(1); }
    75% { transform: rotate(10deg) scale(1.1); }
    100% { transform: rotate(0deg) scale(1); }
}

#sumDisplay {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    font-weight: 900;
    color: rgba(255,255,255,0.8);
    text-shadow: 0 5px 15px rgba(0,0,0,0.5);
    min-height: 60px;
}

/* --- INFO MODAL --- */
.modal {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(5px);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 1;
    transition: opacity 0.3s;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--panel-bg);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 15px;
    padding: 25px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.hidden .modal-content {
    transform: translateY(20px);
}

.modal h2 {
    color: var(--primary);
    font-family: 'Orbitron', sans-serif;
    margin-bottom: 15px;
    text-align: center;
}

.modal p, .modal ul {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 15px;
    color: #ecf0f1;
}

.modal ul {
    list-style: none;
    padding-left: 0;
}

.modal li {
    margin-bottom: 10px;
    background: rgba(255,255,255,0.05);
    padding: 8px 12px;
    border-radius: 8px;
}

.payouts {
    background: rgba(0,0,0,0.5);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.payouts p {
    margin: 5px 0;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
}

.blue-text { color: #3498db; }
.red-text { color: #e74c3c; }
.gold-text { color: #f1c40f; }

.close-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #000;
    border: none;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.close-btn:active {
    background: #d4ac0d;
    transform: scale(0.98);
}

/* --- OVERLAY MESSAGE --- */
#messageOverlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.85);
    padding: 20px 40px;
    border-radius: 20px;
    text-align: center;
    z-index: 100;
    backdrop-filter: blur(5px);
    border: 2px solid;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s, transform 0.3s;
}

#messageOverlay.hidden {
    opacity: 0;
    transform: translate(-50%, -40%);
}

#messageOverlay.win { border-color: #2ecc71; box-shadow: 0 0 30px rgba(46, 204, 113, 0.4); }
#messageOverlay.lose { border-color: #e74c3c; box-shadow: 0 0 30px rgba(231, 76, 60, 0.4); }

#messageText { font-size: 2.5rem; font-weight: 900; margin-bottom: 5px; }
#messageOverlay.win #messageText { color: #2ecc71; }
#messageOverlay.lose #messageText { color: #e74c3c; }

#messageSubtext { font-size: 1.2rem; color: #fff; }

/* --- CONTROLS --- */
#controls {
    background: var(--panel-bg);
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.bet-info {
    text-align: center;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: #bdc3c7;
}

.bet-info .highlight {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.2rem;
    margin-left: 5px;
}

.chips-container {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.chip {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px dashed rgba(255,255,255,0.3);
    background: radial-gradient(circle, #34495e 0%, #2c3e50 100%);
    color: #fff;
    font-weight: 900;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 5px 10px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chip:active { transform: scale(0.9); }

.chip.active {
    border: 3px solid var(--primary);
    background: radial-gradient(circle, #f39c12 0%, #d35400 100%);
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.5);
    transform: translateY(-5px);
}

.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.bet-btn {
    background: #34495e;
    border: none;
    border-radius: 12px;
    padding: 15px 10px;
    color: white;
    font-family: 'Montserrat', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s, filter 0.1s;
    box-shadow: 0 6px 0 rgba(0,0,0,0.4);
}

.bet-btn:active {
    transform: translateY(6px);
    box-shadow: 0 0 0 rgba(0,0,0,0.4);
}

.bet-btn:disabled {
    filter: grayscale(1) opacity(0.5);
    cursor: not-allowed;
    transform: translateY(6px);
    box-shadow: 0 0 0 rgba(0,0,0,0.4);
}

.bet-btn.full-width {
    grid-column: 1 / -1;
}

.bet-btn.blue { background: linear-gradient(135deg, #2980b9, #2c3e50); }
.bet-btn.red { background: linear-gradient(135deg, #c0392b, #2c3e50); }
.bet-btn.gold { background: linear-gradient(135deg, #f39c12, #d35400); }

.bet-btn .title { font-size: 1.4rem; font-weight: 900; letter-spacing: 1px; }
.bet-btn .range { font-size: 0.9rem; opacity: 0.9; margin: 3px 0; }
.bet-btn .payout { font-size: 0.7rem; color: #f1c40f; background: rgba(0,0,0,0.3); padding: 2px 8px; border-radius: 10px; margin-top: 5px;}
.bet-btn.gold .payout { color: #fff; background: rgba(0,0,0,0.2);}