/* Bubble Pop Frenzy — Tropical Sunset Style */

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

:root {
    --sunset-orange: #ff7e5f;
    --sunset-pink:   #feb47b;
    --candy-pink:    #ff6b9d;
    --candy-yellow:  #ffa502;
    --soft-pink:     #ffd6e8;

    --bubble-red:    #ff4757;
    --bubble-blue:   #1e90ff;
    --bubble-green:  #2ed573;
    --bubble-yellow: #ffa502;
    --bubble-purple: #a55eea;
    --bubble-bomb:   #2f3542;

    --text-white:    #ffffff;
    --text-dark:     #2f1b4d;
    --text-muted:    rgba(255, 255, 255, 0.75);
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(160deg, var(--sunset-orange) 0%, var(--sunset-pink) 60%, #ffd6a4 100%);
    min-height: calc(100dvh - 3.5rem);
    color: var(--text-white);
}

/* ============ BOKEH BACKGROUND ============ */
#bokeh-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bokeh {
    position: absolute;
    bottom: -6rem;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.7), rgba(255,255,255,0.1) 60%, transparent 75%);
    animation: bokehFloat 14s linear infinite;
    opacity: 0.45;
}

.bokeh:nth-child(1) { left: 5%;  width: 4rem; height: 4rem; animation-delay:  0s; animation-duration: 12s; }
.bokeh:nth-child(2) { left: 18%; width: 2.5rem; height: 2.5rem; animation-delay:  2s; animation-duration: 16s; }
.bokeh:nth-child(3) { left: 32%; width: 5rem; height: 5rem; animation-delay:  4s; animation-duration: 18s; }
.bokeh:nth-child(4) { left: 45%; width: 3rem; height: 3rem; animation-delay:  1s; animation-duration: 13s; }
.bokeh:nth-child(5) { left: 58%; width: 4.5rem; height: 4.5rem; animation-delay:  6s; animation-duration: 15s; }
.bokeh:nth-child(6) { left: 70%; width: 2rem; height: 2rem; animation-delay:  3s; animation-duration: 11s; }
.bokeh:nth-child(7) { left: 82%; width: 3.5rem; height: 3.5rem; animation-delay:  5s; animation-duration: 17s; }
.bokeh:nth-child(8) { left: 92%; width: 2.8rem; height: 2.8rem; animation-delay:  7s; animation-duration: 14s; }
.bokeh:nth-child(9) { left: 12%; width: 3.2rem; height: 3.2rem; animation-delay:  8s; animation-duration: 19s; }
.bokeh:nth-child(10){ left: 62%; width: 2.2rem; height: 2.2rem; animation-delay: 10s; animation-duration: 12s; }

@keyframes bokehFloat {
    0%   { transform: translateY(0) scale(1);     opacity: 0; }
    10%  { opacity: 0.55; }
    50%  { opacity: 0.45; }
    90%  { opacity: 0.3; }
    100% { transform: translateY(-110vh) scale(1.1); opacity: 0; }
}

/* ============ SCREENS ============ */
.hidden { display: none !important; }

/* ============ GAME CONTAINER ============ */
#game-container {
    width: 100%;
    max-width: 31rem;
    height: 100%;
    max-height: 56rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0.75rem;
    position: relative;
    z-index: 1;
}

/* ============ HEADER ============ */
#game-header {
    width: 100%;
    padding: 0.4rem 0;
    display: flex;
    justify-content: center;
}

.balance-display {
    background: linear-gradient(180deg, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.1) 100%);
    border: 1px solid rgba(255,255,255,0.45);
    border-radius: 1.25rem;
    padding: 0.4rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    box-shadow: 0 0.4rem 1.2rem rgba(255, 126, 95, 0.3);
    backdrop-filter: blur(6px);
}

.balance-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    letter-spacing: 0.05rem;
    text-transform: uppercase;
}

#balance-value {
    color: var(--text-white);
    font-size: 1.25rem;
    font-weight: 800;
    min-width: 4rem;
    text-align: right;
    text-shadow: 0 0.1rem 0.4rem rgba(255, 70, 120, 0.5);
    transition: transform 0.2s ease;
    display: inline-block;
}

#balance-value.pop {
    animation: balancePop 0.5s ease;
}

@keyframes balancePop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.2); color: #fff7c2; }
    100% { transform: scale(1); }
}

.balance-currency {
    color: var(--soft-pink);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05rem;
}

/* ============ STATS BAR ============ */
.stats-bar {
    width: 100%;
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin: 0.4rem 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0.08) 100%);
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 0.75rem;
    backdrop-filter: blur(6px);
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    flex: 1;
    min-width: 0;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1rem;
    text-transform: uppercase;
}

#score-value,
#combo-value,
#time-value {
    color: var(--text-white);
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1;
    text-shadow: 0 0.1rem 0.3rem rgba(143, 31, 80, 0.5);
}

.stat-combo #combo-value {
    color: #fff5b5;
    text-shadow: 0 0 0.8rem rgba(255, 200, 50, 0.7);
}

#combo-value.pulse {
    animation: comboPulse 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes comboPulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.35); }
    100% { transform: scale(1); }
}

#time-value.warning {
    color: #ffe1e1;
    animation: timeWarn 0.5s ease infinite alternate;
}

@keyframes timeWarn {
    from { color: #ffe1e1; text-shadow: 0 0 0.3rem rgba(255, 80, 80, 0.4); }
    to   { color: #ff5a5a; text-shadow: 0 0 1rem rgba(255, 80, 80, 0.9); }
}

/* ============ GAME AREA ============ */
.game-area {
    flex: 1;
    width: 100%;
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 170, 140, 0.4) 0%, rgba(254, 180, 123, 0.6) 100%);
    border: 1px solid rgba(255,255,255,0.4);
    box-shadow:
        0 0.5rem 2rem rgba(255, 70, 120, 0.25),
        inset 0 0.1rem 0 rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
    touch-action: none;
}

/* Idle hint */
.idle-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255,255,255,0.85);
    color: var(--text-dark);
    padding: 0.75rem 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 0.5rem 1.5rem rgba(255, 70, 120, 0.3);
    pointer-events: none;
    z-index: 15;
    animation: idleHintBounce 1.6s ease-in-out infinite;
}

.idle-emoji {
    font-size: 2rem;
    line-height: 1;
}

.idle-text {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.05rem;
}

@keyframes idleHintBounce {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50%       { transform: translate(-50%, -54%) scale(1.04); }
}

/* Result display */
.result-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 20;
    background: rgba(40, 18, 50, 0.95);
    color: var(--text-white);
    padding: 1.5rem 2rem;
    border-radius: 1.25rem;
    border: 1px solid rgba(255,255,255,0.25);
    box-shadow: 0 0.8rem 2.5rem rgba(0,0,0,0.4);
    animation: resultIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 14rem;
}

@keyframes resultIn {
    0%   { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
}

.result-icon {
    font-size: 3rem;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.result-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.1rem;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
}

.result-title.win  { color: #ffeb7a; text-shadow: 0 0 1rem rgba(255, 200, 50, 0.6); }
.result-title.lose { color: #b0b8c8; }

.result-score {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.result-multiplier {
    font-size: 2rem;
    font-weight: 800;
    color: #ffa502;
    line-height: 1.1;
    text-shadow: 0 0 1rem rgba(255, 165, 2, 0.6);
}

.result-amount {
    font-size: 1.3rem;
    font-weight: 700;
    color: #5fffa6;
    margin-top: 0.25rem;
}

/* ============ BET CONTROLS ============ */
#bet-controls {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 0.25rem;
    flex-wrap: wrap;
}

.bet-label {
    color: var(--text-white);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.1rem;
    text-transform: uppercase;
    text-shadow: 0 0.1rem 0.2rem rgba(143, 31, 80, 0.4);
}

.bet-buttons { display: flex; gap: 0.4rem; }

.bet-btn {
    width: 3rem;
    height: 2.1rem;
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 0.5rem;
    color: var(--text-white);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    backdrop-filter: blur(4px);
}

.bet-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.28);
    transform: translateY(-1px);
}

.bet-btn.active {
    background: linear-gradient(160deg, var(--candy-pink) 0%, var(--candy-yellow) 100%);
    color: var(--text-white);
    border-color: rgba(255,255,255,0.8);
    box-shadow: 0 0.2rem 0.8rem rgba(255, 107, 157, 0.55);
    text-shadow: 0 0.1rem 0.2rem rgba(143, 31, 80, 0.5);
}

.bet-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.current-bet {
    background: rgba(0,0,0,0.2);
    padding: 0.25rem 0.85rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255,255,255,0.3);
}

#current-bet-value {
    color: #fff7c2;
    font-size: 1rem;
    font-weight: 800;
}

/* ============ ACTION BUTTON ============ */
#action-button {
    width: 12rem;
    height: 3.25rem;
    background: linear-gradient(160deg, var(--candy-pink) 0%, var(--candy-yellow) 100%);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 1.75rem;
    cursor: pointer;
    box-shadow:
        0 0.3rem 1.2rem rgba(255, 107, 157, 0.5),
        inset 0 0.1rem 0 rgba(255,255,255,0.4);
    transition: all 0.18s ease;
    margin: 0.5rem 0;
    color: var(--text-white);
    text-shadow: 0 0.1rem 0.3rem rgba(143, 31, 80, 0.5);
}

#action-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1.5rem rgba(255, 165, 2, 0.6);
}

#action-button:active:not(:disabled) {
    transform: translateY(0);
}

#action-button:disabled {
    background: linear-gradient(160deg, #b0a0a0 0%, #8c7878 100%);
    border-color: rgba(255,255,255,0.2);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.7;
}

#action-button.pulse {
    animation: actionPulse 1.6s ease-in-out infinite;
}

@keyframes actionPulse {
    0%, 100% { box-shadow: 0 0.3rem 1.2rem rgba(255, 107, 157, 0.5); }
    50%      { box-shadow: 0 0.3rem 2rem rgba(255, 200, 50, 0.85); }
}

#action-text {
    color: var(--text-white);
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.2rem;
}

/* ============ GAME TITLE ============ */
.game-title {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.25rem 0 0.4rem;
}

.title-bubble {
    color: rgba(255,255,255,0.55);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.15rem;
    text-transform: uppercase;
}

.title-frenzy {
    color: #fff7c2;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.15rem;
    text-shadow: 0 0 0.8rem rgba(255, 200, 50, 0.6);
    text-transform: uppercase;
}

/* ============ MESSAGE DISPLAY ============ */
.message-display {
    position: fixed;
    bottom: 6rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(40, 18, 50, 0.92);
    padding: 0.6rem 1.4rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255,255,255,0.3);
    z-index: 100;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: var(--text-white);
    font-size: 0.85rem;
    font-weight: 700;
    pointer-events: none;
}

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

/* ============ RESPONSIVE ============ */
@media (max-width: 25rem) {
    #action-button { width: 10rem; height: 3rem; }
    #action-text { font-size: 1rem; letter-spacing: 0.15rem; }
    .bet-btn { width: 2.6rem; height: 1.9rem; font-size: 0.8rem; }
    #score-value, #combo-value, #time-value { font-size: 1.2rem; }
}

@media (max-height: 44rem) {
    .stats-bar { padding: 0.4rem 0.5rem; margin: 0.25rem 0; }
    .game-title { padding: 0.15rem 0 0.25rem; }
    #action-button { margin: 0.3rem 0; }
}
