/* ============================================================
   GRAMIO RUNNER — STYLE SYSTEM
   Paleta: Gram Blue #30A1F5 · Cyan #78D8FF · Dark #0A0E14
   Estilo: Premium, minimalista, sin retro arcade pixel fonts
   ============================================================ */

:root {
    --blue: #30A1F5;
    --cyan: #78D8FF;
    --deep: #0E74C8;
    --bg-dark: #011135;
    --card: rgba(20, 27, 38, 0.75);
    --card-solid: #141B26;
    --border: rgba(120,216,255,0.10);
    --border-hover: rgba(120,216,255,0.20);
    --text: #F0F6FC;
    --text-2: rgba(240,246,252,0.50);
    --text-3: rgba(240,246,252,0.22);
    --glow: rgba(48,161,245,0.35);
    --glow-sm: rgba(48,161,245,0.12);
    --r: 16px;
}

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

html, body { 
    width: 100%; 
    height: 100%; 
    overflow: hidden; 
    background: var(--bg-dark); 
    font-family: 'Inter', system-ui, -apple-system, sans-serif; 
    color: var(--text); 
    touch-action: manipulation; 
    -webkit-font-smoothing: antialiased;
}

#game-canvas { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    z-index: 0; 
}
#game-canvas canvas { 
    display: block; 
    width: 100%; 
    height: 100%; 
}

/* Ambient glow on screens */
.screen { 
    position: fixed; 
    inset: 0; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    z-index: 20; 
    background: rgba(1, 17, 53, 0.85); 
    backdrop-filter: blur(14px); 
    -webkit-backdrop-filter: blur(14px); 
    animation: fadeIn .35s cubic-bezier(0.16, 1, 0.3, 1); 
    transition: opacity .35s ease; 
}
.screen.hidden { 
    opacity: 0; 
    pointer-events: none; 
}

.screen-content { 
    text-align: center; 
    padding: 30px 24px; 
    max-width: 360px; 
    width: 90%; 
    background: rgba(20, 27, 38, 0.6);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* Game Title */
.game-title { 
    font-size: 26px; 
    font-weight: 900; 
    letter-spacing: -1px; 
    color: var(--text); 
    line-height: 1.1; 
    text-transform: uppercase;
}
.title-accent { 
    font-size: 32px; 
    display: block; 
    background: linear-gradient(135deg, var(--cyan), var(--blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 900;
    text-shadow: 0 0 20px rgba(120, 216, 255, 0.15);
}

/* Character Wrap */
#start-character { 
    width: 100px; 
    height: 100px; 
    object-fit: contain; 
    border-radius: 50%; 
    margin: 8px auto; 
    display: block; 
    animation: mascotFloat 3.5s ease-in-out infinite; 
    filter: drop-shadow(0 0 24px var(--glow)); 
    border: 2px solid rgba(120, 216, 255, 0.15);
    box-shadow: 0 0 30px var(--glow-sm);
}

@keyframes mascotFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* Welcome Text */
.welcome-user { 
    font-size: 13px; 
    font-weight: 600; 
    color: var(--cyan); 
    letter-spacing: 0.3px; 
}

/* How to Play Cards */
.how-to-play { 
    display: flex; 
    gap: 8px; 
    width: 100%;
    justify-content: center; 
}
.htp-tip { 
    flex: 1;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 4px; 
    padding: 10px 6px; 
    background: var(--card-solid); 
    border: 1px solid var(--border); 
    border-radius: 12px; 
    font-size: 10px; 
    color: var(--text-2); 
    font-weight: 600; 
    animation: fadeInUp .4s ease backwards; 
}
.htp-tip:nth-child(1){animation-delay:.05s}
.htp-tip:nth-child(2){animation-delay:.1s}
.htp-tip:nth-child(3){animation-delay:.15s}
.htp-icon { 
    font-size: 18px; 
}

/* Best Score Card */
.best-score-card { 
    background: var(--card-solid); 
    border: 1px solid var(--border); 
    border-radius: 14px; 
    padding: 10px 16px; 
    width: 100%; 
    display: flex;
    align-items: center;
    justify-content: space-between;
}
/* bsc-pending/bsc-ready handled by inline critical CSS (opacity transition) */
.bsc-label { 
    font-size: 10px; 
    font-weight: 700;
    color: var(--text-3); 
    text-transform: uppercase;
    letter-spacing: 1px; 
}
.bsc-value { 
    display: flex; 
    align-items: center; 
    gap: 6px; 
    font-size: 18px; 
    font-weight: 800; 
    color: var(--cyan); 
}

/* Buttons */
.btn-play { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px; 
    padding: 15px 36px; 
    font-size: 15px; 
    font-weight: 800;
    color: #fff; 
    background: linear-gradient(135deg, var(--blue), var(--deep)); 
    border: none; 
    border-radius: 14px; 
    cursor: pointer; 
    transition: all .2s ease; 
    box-shadow: 0 4px 20px var(--glow); 
    width: 100%; 
    letter-spacing: 0.5px; 
}
.btn-play:active { 
    transform: scale(0.97); 
    box-shadow: 0 2px 10px var(--glow-sm); 
}
.btn-play.pulse { 
    animation: btnPulse 3s ease-in-out infinite; 
}

@keyframes btnPulse {
    0%, 100% { box-shadow: 0 4px 20px var(--glow); }
    50% { box-shadow: 0 4px 30px rgba(0, 152, 234, 0.6); }
}

/* Loading state — shown while GLBs/character are still fetching */
.btn-play.btn-loading {
    opacity: 0.45;
    cursor: not-allowed;
    animation: none;
    position: relative;
    overflow: hidden;
}
.btn-play.btn-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(120,216,255,0.18) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: btnScan 1.4s linear infinite;
}
@keyframes btnScan {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.btn-secondary { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px; 
    padding: 12px 28px; 
    font-size: 13px; 
    font-weight: 600;
    color: var(--text-2); 
    background: var(--card-solid); 
    border: 1px solid var(--border); 
    border-radius: 14px; 
    cursor: pointer; 
    width: 100%; 
    transition: all .2s; 
}
.btn-secondary:active { 
    background: rgba(255, 255, 255, 0.05); 
    transform: scale(0.97); 
}

/* HUD System */
#hud { 
    position: fixed; 
    top: 0; 
    left: 0; 
    right: 0; 
    z-index: 10; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 16px 20px; 
    background: linear-gradient(180deg, rgba(10, 14, 20, 0.8) 0%, transparent 100%); 
    pointer-events: none; 
    transition: opacity .3s; 
}
#hud.hidden { 
    opacity: 0; 
    pointer-events: none; 
}
.back-btn { 
    pointer-events: all; 
    font-size: 11px; 
    font-weight: 700;
    color: var(--text-2); 
    text-decoration: none; 
    padding: 8px 14px; 
    background: rgba(20, 27, 38, 0.6); 
    border: 1px solid var(--border); 
    border-radius: 10px; 
    transition: all .2s ease; 
}
.back-btn:active { 
    background: rgba(255, 255, 255, 0.05); 
    color: var(--text); 
}

#score-display, #best-display { 
    display: flex; 
    flex-direction: column; 
    align-items: flex-end; 
    gap: 2px; 
}
#best-display {
    align-items: flex-start;
    display: none; /* Hide top best to keep HUD cleaner, or keep it */
}
.score-label { 
    font-size: 9px; 
    font-weight: 700;
    color: var(--text-3); 
    letter-spacing: 1px; 
    text-transform: uppercase;
}
.score-value { 
    font-size: 20px; 
    font-weight: 900;
    color: var(--text); 
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); 
}
#score-value {
    color: var(--cyan);
}

/* Speed Bar */
#hud-speed { 
    position: fixed; 
    top: 66px; 
    left: 20px; 
    right: 20px; 
    height: 4px; 
    background: rgba(255, 255, 255, 0.05); 
    border-radius: 2px; 
    overflow: hidden; 
    z-index: 10; 
}
#hud-speed.hidden { 
    display: none; 
}
#speed-bar { 
    height: 100%; 
    width: 0%; 
    background: linear-gradient(90deg, var(--cyan), #ef4444); 
    border-radius: 2px; 
    transition: width .3s; 
}

/* Game Over Screen */
/* Game Over Screen — same backdrop as start screen */
#gameover-screen {
    /* inherits .screen background */
}
.gameover-title { 
    font-size: 22px; 
    font-weight: 900;
    color: #ef4444; 
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.3); 
    animation: shake .5s ease; 
}

.gameover-wojak { 
    margin-bottom: 4px; 
    animation: shake .5s ease; 
}
.gameover-wojak-img { 
    width: 80px; 
    height: 80px; 
    border-radius: 50%; 
    object-fit: cover; 
    filter: drop-shadow(0 0 20px rgba(239, 68, 68, 0.4)); 
    border: 2px solid rgba(239, 68, 68, 0.2);
}

.achievement-banner { 
    background: linear-gradient(135deg, rgba(120, 216, 255, 0.12), rgba(120, 216, 255, 0.02)); 
    border: 1px solid rgba(120, 216, 255, 0.25); 
    padding: 8px 16px; 
    border-radius: 12px; 
    font-size: 11px; 
    font-weight: 700;
    color: var(--cyan); 
    animation: achievementPop .5s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    width: 100%;
}
.achievement-banner.hidden { 
    display: none !important; 
}

.gameover-stats { 
    display: flex; 
    justify-content: center; 
    gap: 8px; 
    width: 100%;
}
.stat { 
    flex: 1;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 3px; 
    padding: 10px 6px; 
    background: var(--card-solid); 
    border: 1px solid var(--border); 
    border-radius: 14px; 
}
.stat-label { 
    font-size: 9px; 
    color: var(--text-3); 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
    font-weight: 700; 
}
.stat-value { 
    font-size: 15px; 
    font-weight: 800;
    color: var(--text); 
    white-space: nowrap; 
}
.stat-value.best-value { 
    color: var(--cyan); 
}
.stat-value.coins-value { 
    color: #ffd600; 
}

.total-coins-bar { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 6px; 
    padding: 10px 16px; 
    background: rgba(120, 216, 255, 0.04); 
    border: 1px solid var(--border); 
    border-radius: 14px; 
    font-size: 12px; 
    color: var(--text-2); 
    font-weight: 600; 
    width: 100%;
}
.total-coins-value { 
    font-weight: 800; 
    color: #ffd600; 
}

/* Loader */
#loading-screen { 
    background: var(--bg-dark); 
    z-index: 1000; 
}
.loader { 
    width: 40px; 
    height: 40px; 
    border: 3px solid rgba(255, 255, 255, 0.05); 
    border-top-color: var(--cyan); 
    border-radius: 50%; 
    margin: 0 auto 16px; 
    animation: spin .8s linear infinite; 
}
.loading-text { 
    font-size: 11px; 
    font-weight: 700;
    color: var(--cyan); 
    letter-spacing: 1.5px; 
}

#flash-overlay { 
    position: fixed; 
    inset: 0; 
    background: #ef4444; 
    opacity: 0; 
    pointer-events: none; 
    z-index: 4; 
    transition: opacity .1s; 
}

/* Sound floating button */
#sound-toggle { 
    position: fixed; 
    bottom: 16px; 
    right: 16px; 
    z-index: 15; 
    width: 42px; 
    height: 42px; 
    border-radius: 50%; 
    background: rgba(20, 27, 38, 0.6); 
    border: 1px solid var(--border); 
    color: var(--text-2); 
    font-size: 16px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: all .2s; 
    backdrop-filter: blur(8px); 
    -webkit-backdrop-filter: blur(8px);
}
#sound-toggle:active { 
    transform: scale(0.9); 
    background: rgba(255, 255, 255, 0.05); 
}

/* Animations */
@keyframes fadeIn { 
    from { opacity: 0; } 
    to { opacity: 1; } 
}
@keyframes fadeInUp { 
    from { opacity: 0; transform: translateY(8px); } 
    to { opacity: 1; transform: translateY(0); } 
}
@keyframes spin { 
    to { transform: rotate(360deg); } 
}
@keyframes shake { 
    0%, 100% { transform: translateX(0); } 
    25% { transform: translateX(-4px); } 
    50% { transform: translateX(4px); } 
    75% { transform: translateX(-2px); } 
}
@keyframes achievementPop { 
    0% { transform: scale(0.9); opacity: 0; } 
    100% { transform: scale(1); opacity: 1; } 
}

/* ========== WEB3 DASHBOARD DESIGN ========== */
.dashboard-panel {
    background: rgba(1, 20, 55, 0.8) !important;
    border: 1.5px solid rgba(120, 216, 255, 0.15) !important;
    box-shadow: 0 16px 40px rgba(48, 161, 245, 0.08), 0 0 1px 0 rgba(120, 216, 255, 0.3) inset !important;
    position: relative;
    padding: 28px 22px 20px !important;
    overflow: hidden;
}
.alert-panel {
    padding: 24px 20px 18px !important;
}

.dashboard-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--cyan), var(--blue));
}

.alert-panel::before {
    background: linear-gradient(90deg, #ef4444, #b91c1c) !important;
}

.alert-panel {
    border-color: rgba(239, 68, 68, 0.2) !important;
    box-shadow: 0 16px 40px rgba(239, 68, 68, 0.08), 0 0 1px 0 rgba(239, 68, 68, 0.3) inset !important;
}

/* Panel status bar */
.panel-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    width: 100%;
    justify-content: center;
}
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.status-dot.green {
    background: #10B981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}
.status-dot.red {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}
.status-text {
    font-size: 9px;
    font-weight: 800;
    color: var(--text-3);
    letter-spacing: 1.5px;
}
.status-text.text-red {
    color: rgba(239, 68, 68, 0.5);
}

/* Hologram Mascot */
.mascot-hologram, .gameover-hologram {
    position: relative;
    width: 110px;
    height: 110px;
    margin: 4px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gameover-hologram {
    width: 90px;
    height: 90px;
    margin: 2px 0;
}
.holo-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px dashed rgba(120, 216, 255, 0.25);
    animation: spin 16s linear infinite;
}
.holo-ring.outer {
    inset: -6px;
}
.holo-ring.inner {
    inset: 6px;
    border-style: dotted;
    animation-direction: reverse;
    animation-duration: 10s;
}
.holo-ring.red-ring {
    inset: -6px;
    border-color: rgba(239, 68, 68, 0.3);
    animation: spin 12s linear infinite;
}

/* Mono font */
.mono-font {
    font-family: 'Courier New', Courier, monospace;
    font-weight: 900 !important;
    letter-spacing: -0.5px;
}

/* Best score dashboard style */
.best-score-card {
    background: rgba(120, 216, 255, 0.03) !important;
    border: 1px solid rgba(120, 216, 255, 0.08) !important;
    border-radius: 12px !important;
    padding: 12px 16px !important;
    width: 100%;
    display: flex;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 4px !important;
}
.bsc-header {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 8px;
    font-weight: 800;
    color: var(--text-3);
    letter-spacing: 1px;
}
.bsc-sub {
    color: var(--cyan);
}
.bsc-value-wrap {
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.bsc-icon {
    font-size: 16px;
}
.bsc-unit {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-3);
    letter-spacing: 0.5px;
}

/* Monospace console tips */
.console-tips {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    background: rgba(0,0,0,0.15);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    text-align: left;
}
.tip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 9px;
    font-weight: 700;
}
.tip-key {
    color: var(--cyan);
    font-family: monospace;
    background: rgba(120,216,255,0.08);
    padding: 2px 6px;
    border-radius: 4px;
    border: 0.5px solid rgba(120,216,255,0.15);
}
.tip-action {
    color: var(--text-2);
    letter-spacing: 0.2px;
}

/* Action buttons row */
.action-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 4px;
}
.action-sub-row {
    display: flex;
    gap: 8px;
    width: 100%;
}
.btn-compact {
    padding: 10px 12px !important;
    font-size: 10px !important;
    letter-spacing: 0.5px;
    flex: 1;
    min-width: 0;
}

/* Receipt style report */
.receipt-report {
    width: 100%;
    background: rgba(1, 25, 70, 0.45);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}
.receipt-header {
    font-size: 9px;
    font-weight: 800;
    color: var(--text-3);
    letter-spacing: 1.5px;
    border-bottom: 1px dashed var(--border);
    padding-bottom: 8px;
    text-align: center;
}
.receipt-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}
.receipt-line.border-dashed {
    border-bottom: 1px dashed var(--border);
    padding-bottom: 12px;
}
.receipt-label {
    font-weight: 700;
    color: var(--text-2);
    letter-spacing: 0.2px;
}
.receipt-value {
    font-size: 14px;
}
.receipt-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 4px;
}
.receipt-footer .receipt-label {
    font-size: 10px;
    color: var(--text);
}
.receipt-footer .receipt-value {
    font-size: 16px;
}

/* Custom Text Colors */
.text-cyan {
    color: var(--cyan) !important;
}
.text-gold {
    color: #ffd600 !important;
}

/* Animations */
.animate-pulse {
    animation: pulseGlow 1.5s infinite alternate;
}
@keyframes pulseGlow {
    from { opacity: 0.4; }
    to { opacity: 1; }
}

/* Responsive adjust */
@media (max-height: 600px) {
    .dashboard-panel {
        padding: 20px 16px 16px !important;
        gap: 10px;
    }
    .mascot-hologram, .gameover-hologram {
        width: 80px;
        height: 80px;
        margin: 4px 0;
    }
    .game-title { font-size: 20px; }
    .title-accent { font-size: 24px; }
    #start-character { width: 70px; height: 70px; }
    .btn-play { padding: 12px 24px; font-size: 13px; }
    .gameover-title { font-size: 22px; }
    .receipt-report { padding: 12px; gap: 8px; }
}
@media (max-height: 500px) {
    .mascot-hologram, .gameover-hologram { display: none !important; }
}
