:root {
    --bg-color: #0f0c29;
    --card-bg: #1e1b4b;
    --primary: #f43f5e;
    --secondary: #3b82f6;
    --accent: #10b981;
    --text: #f8fafc;
    --gold: #fbbf24;
    --neon-pink: #ff00ff;
    --neon-blue: #00ffff;
}

html {
    /* Refined fluid base font size */
    font-size: calc(10px + 0.4vw);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background: var(--bg-color);
    background-image: url('../assets/chatgpt-image-2026-júl-3-17_59_08.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text);
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    justify-content: center;
    position: fixed;
    touch-action: none; 
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

body.loaded {
    opacity: 1;
}

/* Audio UI - Casino Style */
.audio-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.8);
    padding: 6px 14px;
    border-radius: 100px;
    border: 1px solid rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(0, 255, 255, 0.05);
    backdrop-filter: blur(4px);
}

#mute-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: transform 0.2s, filter 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#mute-btn:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 0 5px var(--neon-blue));
}

/* Custom Styled Slider */
.vol-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 70px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--neon-blue);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--neon-blue);
    border: 2px solid #fff;
}

.vol-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--neon-blue);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--neon-blue);
    border: 2px solid #fff;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

#game-container {
    width: 100vw;
    max-width: 120rem; /* Proportional max-width */
    height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 0 1rem;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* Global Header Layout */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    height: auto;
    min-height: 100px;
    gap: 15px;
    width: 100%;
}

@media (min-width: 601px) {
    .game-header {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
    }
    .header-controls {
        grid-column: 2;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    .logo {
        grid-column: 1;
        justify-content: flex-start;
    }
    .stats-bar {
        grid-column: 3;
        align-items: flex-end;
    }
}

.logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 1.5; 
    min-width: 0;
}

.header-logo {
    height: 80px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(255, 0, 255, 0.4));
}

.logo-container-main {
    width: 100%;
    max-width: clamp(250px, 50vw, 420px);
    margin: 0 auto 20px auto;
}

.main-game-logo {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 25px rgba(255, 0, 255, 0.6));
    animation: floating 4s ease-in-out infinite;
}

.header-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1; /* Space for middle controls */
    flex-shrink: 0;
}

.stats-bar {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex: 1;
    flex-shrink: 0;
}

.stat-item .value {
    font-size: 1.2rem;
    font-weight: 950;
    color: #fff;
}

@media (max-width: 600px) {
    .game-header {
        min-height: 40px;
        padding: 4px 0;
        gap: 6px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    .header-logo {
        height: 28px;
    }
    .logo {
        flex: 0 0 auto;
    }
    .header-controls {
        flex: 1;
        flex-direction: row;
        justify-content: flex-end;
        gap: 6px;
    }
    .audio-controls {
        display: flex; /* Restored for mobile */
        gap: 4px;
        padding: 4px 8px;
    }
    .vol-slider {
        width: 50px; /* Slimmer for mobile */
    }
    .demo-indicator, .fairness-indicator {
        font-size: 0.45rem;
        padding: 2px 5px;
        white-space: nowrap;
    }
    .stats-bar {
        flex: 0 0 auto;
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }
    .stat-item .label {
        font-size: 0.45rem;
    }
    .stat-item .value {
        font-size: 0.8rem;
    }
    .logo-container-main {
        max-width: clamp(150px, 40vw, 250px);
    }
    .status-msg {
        font-size: 0.7rem;
        padding: 3px;
        margin: 0;
        border-radius: 6px;
    }
    .game-footer {
        padding: 0;
    }
    .compliance-footer {
        padding: 2px 0;
        font-size: 0.45rem;
    }

    /* HEAVILY UPSCALED Betting Panel for Mobile */
    .betting-panel {
        padding: clamp(15px, 4vw, 25px);
        gap: 15px;
        border-radius: 30px 30px 0 0;
        width: 100%;
        margin: 0;
        position: relative;
        bottom: 0;
        background: #0f0c29;
        /* Start shrinking earlier on mobile to avoid card overlap */
        transform: scale(clamp(0.5, 100vh / 700, 1));
        transform-origin: bottom center;
    }
    .panel-header {
        padding-bottom: 8px;
        border-bottom: 2px solid rgba(255, 255, 255, 0.1);
        margin-bottom: 5px;
    }
    .panel-label, .win-potential {
        font-size: 0.9rem;
    }
    .panel-body {
        display: flex;
        flex-direction: column;
        gap: 20px; /* More breathing room */
        align-items: center;
        margin-top: 10px;
    }
    .bet-control-container {
        flex: 1;
        gap: 12px;
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    .small-label { display: block; font-size: 0.75rem; font-weight: 900; } 
    .casino-input-wrapper {
        height: 65px; /* Huge input for mobile */
        border-radius: 15px;
        max-width: none;
        border-width: 3px;
    }
    .bet-adj {
        width: 70px;
        font-size: 1.8rem;
    }
    .casino-input {
        font-size: 1.8rem;
    }
    .quick-bets {
        display: flex; 
        gap: 10px;
        width: 100%;
    }
    .quick-bet-btn {
        font-size: 1rem;
        padding: 15px 10px;
        border-radius: 12px;
        font-weight: 950;
        background: rgba(255, 255, 255, 0.1);
    }
    .action-container {
        height: 85px; /* Extremely prominent button */
        width: 100%;
        margin-top: 5px;
    }
    .casino-btn-main {
        font-size: 1.5rem;
        border-radius: 20px;
    }
    .multiplier-display {
        padding: 8px 25px;
        margin-top: 10px;
        border-radius: 30px;
        background: rgba(0,0,0,0.5);
    }
    .mult-label { font-size: 0.8rem; }
    .mult-value { font-size: 1.4rem; }
    .difficulty-switch-container {
        display: none; /* Hide to save space */
    }

    /* Character Cards Mobile Redesign */
    .character-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important; 
        gap: 4px !important;
        padding: 4px !important;
        width: 100vw !important;
        max-width: 100vw !important;
        margin: auto !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }
    .character-card {
        width: 100% !important;
        height: auto !important;
        max-width: none !important;
        aspect-ratio: 2.2 / 5.2 !important; /* Made significantly taller/longer vertically */
        background-color: rgba(0,0,0,0.5) !important;
        border-width: 2px !important;
        flex: none !important;
    }
    #game-container {
        padding: 0 !important;
        width: 100vw !important;
        overflow: hidden !important;
    }
    .character-header {
        font-size: 0.5rem;
        padding: 2px;
    }
    .character-image-container {
        height: auto;
        flex: 1; 
        padding-top: 5px; /* Move character up slightly */
    }
    .character-image {
        object-position: center 20%; /* Center the character better */
    }
    .character-footer {
        padding: 3px;
        gap: 0;
        background: none !important; /* Removed black part behind button */
        border-top: none;
    }
    .explanation-btn {
        padding: 0;
        font-size: 0.65rem;
        width: 100%;
        border-radius: 4px;
        letter-spacing: 1px;
        height: 35px !important; /* Increased height vertically only */
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 
            0 1px 3px rgba(0,0,0,0.5),
            inset 0 1px 1px rgba(255,255,255,0.5);
    }
    .explanation-btn::after, .explanation-btn::before {
        display: none; /* Clear previous icon/text hacks */
    }
    .explanation-btn .listen-text, .explanation-btn .listen-icon {
        display: none;
    }
}

/* Season Progress Removed */

.difficulty-options {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.diff-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 20px 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.diff-btn:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.1);
}

.diff-btn.easy { border-color: var(--accent); }
.diff-btn.easy:hover { box-shadow: 0 0 30px rgba(16, 185, 129, 0.4); }
.diff-btn.easy .diff-label { color: var(--accent); }

.diff-btn.medium { border-color: var(--secondary); }
.diff-btn.medium:hover { box-shadow: 0 0 30px rgba(59, 130, 246, 0.4); }
.diff-btn.medium .diff-label { color: var(--secondary); }

.diff-btn.hard { border-color: var(--primary); }
.diff-btn.hard:hover { box-shadow: 0 0 30px rgba(244, 63, 94, 0.4); }
.diff-btn.hard .diff-label { color: var(--primary); }

.diff-label { font-size: 1.2rem; font-weight: 950; }
.diff-mult { font-size: 1.1rem; font-weight: 900; color: var(--gold); }
.diff-desc { font-size: 0.6rem; opacity: 0.7; font-weight: bold; }

.fairness-indicator {
    font-size: 0.65rem;
    font-weight: 900;
    color: var(--accent);
    background: rgba(16, 185, 129, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid var(--accent);
    cursor: help;
    text-transform: uppercase;
}

.demo-indicator {
    font-size: 0.65rem;
    font-weight: 900;
    color: var(--gold);
    background: rgba(251, 191, 36, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid var(--gold);
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: flash 2s infinite;
}

@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.difficulty-switch-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.switch-btn {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    padding: 4px 12px;
    font-size: 0.7rem;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.2s;
}

.switch-btn.easy-mode {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.switch-btn.medium-mode {
    border-color: var(--secondary);
    color: var(--secondary);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.switch-btn.hard-mode {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.2);
}

/* Global Activity Feed */
.activity-feed {
    background: rgba(0, 0, 0, 0.4);
    height: 30px;
    margin-top: 10px;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.feed-container {
    display: flex;
    align-items: center;
    height: 100%;
    white-space: nowrap;
    position: absolute;
    animation: ticker 30s linear infinite;
}

.feed-item {
    display: inline-flex;
    align-items: center;
    padding: 0 20px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    gap: 8px;
}

.feed-item.win { color: var(--accent); }
.feed-item.loss { color: var(--primary); }

.feed-player { color: var(--text); }
.feed-amount { font-weight: 900; }

@keyframes ticker {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

.icon-btn-text {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 900;
    cursor: pointer;
}

/* Modal Tabs */
.modal-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

.tab-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-weight: 900;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 5px 10px;
    transition: all 0.2s;
}

.tab-btn.active {
    color: var(--neon-blue);
    border-bottom: 2px solid var(--neon-blue);
}


.modal-content.audit-dashboard {
    width: 95%;
    max-width: 800px;
    background: #0f172a;
    border: 2px solid var(--neon-blue);
    padding: 20px;
}

.audit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

.audit-header h2 {
    margin-bottom: 0;
    font-size: 1.2rem;
}

.audit-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.mini-btn {
    background: #334155;
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 900;
    cursor: pointer;
}

.mini-btn:hover {
    background: var(--neon-blue);
    color: #000;
}

.audit-scroll-container {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.audit-stat-card {
    background: rgba(0,0,0,0.3);
    padding: 10px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255,255,255,0.05);
}

.audit-stat-card.highlight {
    border-color: var(--neon-blue);
}

.audit-stat-card .label {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.5);
    font-weight: 900;
}

.audit-stat-card .value {
    font-size: 1.1rem;
    font-weight: 950;
    color: #fff;
}

.audit-table-wrapper h3 {
    font-size: 0.8rem;
    margin-bottom: 10px;
    color: var(--gold);
}

#audit-logs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.7rem;
}

#audit-logs-table th, #audit-logs-table td {
    text-align: left;
    padding: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

#audit-logs-table th {
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.5);
}

#audit-logs-table tr:hover {
    background: rgba(255,255,255,0.02);
}

.audit-scroll-container::-webkit-scrollbar {
    width: 6px;
}

.audit-scroll-container::-webkit-scrollbar-thumb {
    background: var(--neon-blue);
    border-radius: 3px;
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    #audit-logs-table th:nth-child(1), 
    #audit-logs-table td:nth-child(1),
    #audit-logs-table th:nth-child(6),
    #audit-logs-table td:nth-child(6) {
        display: none;
    }
}

.modal-content h2 {
    font-size: 1.2rem;
    font-weight: 900;
    margin-bottom: 20px;
    text-align: center;
    color: var(--neon-blue);
}

.admin-style h2 {
    color: var(--gold);
}

.verifier-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.input-group label {
    font-size: 0.7rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
}

.input-group input, .input-group select {
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    padding: 10px;
    font-size: 0.9rem;
    width: 100%;
}

.verify-result-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 15px;
    font-size: 0.7rem;
    font-family: monospace;
    word-break: break-all;
    text-align: center;
    color: var(--gold);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-actions {
    margin-top: 25px;
    display: flex;
    justify-content: center;
}

.secondary-btn {
    background: #334155;
    border: none;
    border-radius: 10px;
    color: #fff;
    padding: 10px 30px;
    font-weight: 900;
    cursor: pointer;
}

@media (max-height: 700px) {
    .character-card {
        height: 280px;
    }
    .character-bubble {
        min-height: 80px;
        font-size: 0.65rem;
    }
    .welcome-character-container {
        height: 100px;
    }
}

/* Stage */
.game-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 0;
    width: 100%;
    position: relative;
    overflow: visible; /* Changed from hidden/auto to visible to prevent clipping */
    z-index: 10;
    margin-bottom: 15px; /* Forced minimum gap between card area and footer */
}

.center-actions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 80%;
    max-width: 300px;
    pointer-events: auto;
}

.center-play-btn, .center-continue-btn {
    height: 70px;
    font-size: 1.2rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8), 0 0 20px rgba(244, 63, 94, 0.4);
}

.status-msg {
    font-size: 1.8rem;
    font-weight: 950;
    text-transform: uppercase;
    text-align: center;
    color: #fff;
    text-shadow: 0.2rem 0.2rem 0px #ff00ff, -0.2rem -0.2rem 0px #00ffff;
    margin-bottom: 0.5rem;
    padding: 0.8rem;
    background: rgba(0,0,0,0.6);
    border-radius: 1rem;
    flex-shrink: 0;
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem; /* Reduced gap to move cards closer */
    width: 100%;
    max-width: 65rem; /* Limit width to keep the group tight on large screens */
    flex: none;
    min-height: 0;
    overflow: visible; 
    padding: 2rem;
    margin: auto auto; /* Center the grid container itself */
    z-index: 10;
}

.character-footer {
    padding: 10px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    position: absolute;
    bottom: 0;
    width: 100%;
    z-index: 10;
}

.explanation-btn {
    background: linear-gradient(180deg, #ffd700 0%, #d97706 50%, #b45309 100%);
    border: 0.1rem solid #fff;
    border-radius: 5rem; 
    color: #fff;
    padding: 0.8rem 1.5rem;
    font-weight: 950;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    width: 90%;
    box-shadow: 
        0 0 0 0.2rem rgba(0, 0, 0, 0.3),
        0 0.4rem 1rem rgba(0, 0, 0, 0.5),
        0 0 1.5rem rgba(251, 191, 36, 0.4),
        inset 0 0.2rem 0.2rem rgba(255, 255, 255, 0.8),
        inset 0 -0.2rem 0.5rem rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.15rem;
    position: relative;
    overflow: hidden;
}

/* Casino Shine Animation */
.explanation-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -100%;
    width: 50%;
    height: 200%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: rotate(30deg);
    animation: casinoShine 3s infinite;
}

@keyframes casinoShine {
    0% { left: -100%; }
    20% { left: 150%; }
    100% { left: 150%; }
}

.explanation-btn:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 
        0 0 0 2px rgba(0, 0, 0, 0.3),
        0 8px 20px rgba(0, 0, 0, 0.6),
        0 0 25px rgba(251, 191, 36, 0.8),
        inset 0 2px 2px rgba(255, 255, 255, 1);
    filter: brightness(1.1);
}

.explanation-btn:active {
    transform: scale(0.95) translateY(1px);
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.5);
}

.listen-icon {
    font-size: 1rem;
    filter: drop-shadow(0 1px 1px rgba(255,255,255,0.5));
}

/* Global Casino Modal Styling */
.casino-modal-content {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    width: 90%;
    max-width: 400px;
    max-height: 85vh;
    border-radius: 30px;
    padding: 25px;
    border: 3px solid transparent;
    background-image: linear-gradient(rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.95)), 
                      linear-gradient(135deg, var(--neon-pink), var(--neon-blue));
    background-origin: border-box;
    background-clip: padding-box, border-box;
    box-shadow: 0 0 50px rgba(0, 0, 0, 1), 0 0 20px rgba(255, 0, 255, 0.3);
    text-align: center;
    animation: casinoPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
}

.casino-modal-header {
    margin-bottom: 15px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
    flex-shrink: 0;
}

.casino-modal-body {
    overflow-y: auto;
    padding: 10px 5px;
    margin-bottom: 20px;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.casino-explanation-text {
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.5;
    color: var(--gold);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    font-style: italic;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.casino-close-btn {
    width: 100%;
    background: linear-gradient(135deg, #f43f5e 0%, #991b1b 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    color: #fff;
    padding: 15px;
    font-weight: 950;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(244, 63, 94, 0.4);
    transition: transform 0.2s, filter 0.2s;
    flex-shrink: 0;
}

.casino-close-btn:hover {
    transform: scale(1.03);
    filter: brightness(1.2);
}

.casino-close-btn:active {
    transform: scale(0.97);
}

@keyframes casinoPop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 600px) {
    .explanation-btn {
        padding: 6px 10px;
        font-size: 0.6rem;
    }
    .casino-modal-content {
        padding: 20px;
    }
    .casino-explanation-text {
        font-size: 0.9rem;
    }
    .casino-modal-title {
        font-size: 1rem;
    }
}

.character-card {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    perspective: 1000px;
    height: 26rem;
    width: 18.5rem;
    max-width: 100%;
    position: relative;
    box-shadow: none;
    overflow: visible;
    margin: 0 auto;
    will-change: transform, opacity;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.character-card.is-flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateZ(0); /* Force layer creation */
}

.card-front {
    z-index: 2;
    background-color: #1e1b4b;
    background-image: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.3)), url('../assets/card_bg_casino_slots-webp.webp');
    background-size: cover;
    background-position: center;
    border: 3px solid #4a3728;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.8), 0 5px 15px rgba(0,0,0,0.5);
    transform: rotateY(0deg);
}

.card-back {
    z-index: 1;
    background-color: #0f0c29;
    background-image: linear-gradient(135deg, #1e1b4b 0%, #0f0c29 100%);
    border: 3px solid #4a3728;
    transform: rotateY(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 60px rgba(0,0,0,0.9), 0 5px 20px rgba(0,0,0,0.5);
    position: relative;
}

/* Neon animated border around the card back */
.card-back::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 12px;
    padding: 3px; /* Border thickness */
    background: linear-gradient(90deg, #ff00ff, #00ffff, #ff00ff);
    background-size: 200% auto;
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    z-index: -1;
    animation: neon-border-slide 3s linear infinite;
    opacity: 0.9;
}

.card-back-logo {
    width: 60%;
    height: auto;
    opacity: 0.2;
    filter: grayscale(1) brightness(2);
}

/* Rarity Frames mapped to card-front */
.character-card.frame-green .card-front { border-color: #10b981; box-shadow: 0 0 20px rgba(16, 185, 129, 0.5); }
.character-card.frame-blue .card-front { border-color: #3b82f6; box-shadow: 0 0 20px rgba(59, 130, 246, 0.7); }
.character-card.frame-gold .card-front { border-color: #fbbf24; box-shadow: 0 0 25px rgba(251, 191, 36, 0.8); }
.character-card.frame-red .card-front { border-color: #f43f5e; box-shadow: 0 0 20px rgba(244, 63, 94, 0.7); }

.character-card.frame-gold .card-inner { animation: goldShimmer 2s infinite; }

.character-card.active:hover {
    transform: scale(1.04);
    z-index: 10;
}


.character-image-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    margin-top: -5px; /* Pull up to meet header */
}

.character-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.5));
    display: block;
}

.character-bubble {
    background: #000;
    padding: 10px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    color: #fff;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    min-height: 0;
}

/* Reveal Labels on Card Front */
.character-card.reveal-lie .card-front::after {
    content: 'LIAR';
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(15deg);
    background: var(--primary);
    color: #fff;
    padding: 5px 15px;
    font-weight: 900;
    font-size: 1.2rem;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    z-index: 20;
}

.character-card.reveal-truth .card-front::after {
    content: 'TRUTH';
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);
    background: var(--neon-blue);
    color: #000;
    padding: 5px 15px;
    font-weight: 900;
    font-size: 1.2rem;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    z-index: 20;
}

.character-card.reveal-truth .card-front {
    border-color: var(--neon-blue);
    box-shadow: 0 0 30px var(--neon-blue);
}

.character-header {
    background: #4a3728;
    color: #f3e5ab;
    padding: clamp(5px, 1vh, 10px);
    font-size: clamp(0.8rem, 1.5vw, 1.1rem);
    font-weight: 900;
    text-align: center;
    text-transform: uppercase;
}

/* Footer & Betting Panel */
.game-footer {
    padding: 5px 0;
    z-index: 5; /* Lower than game-stage (10) to stay behind cards */
    flex-shrink: 0; /* Ensure footer never leaves the view */
}

.betting-panel {
    background: #0f0c29;
    border: 2px solid transparent;
    border-radius: 1.5rem;
    padding: 1.2rem;
    box-shadow: 0 0 4rem rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    width: 100%; 
    max-width: 45rem; /* Reduced from 60rem for a more focused layout */
    margin: 0.8rem auto;
    z-index: 1;
    /* More aggressive scaling: start shrinking at 800px height, down to 50% */
    transform: scale(clamp(0.5, 100vh / 800, 1));
    transform-origin: bottom center;
}

/* Neon animated border around the panel */
.betting-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 20px;
    padding: 2px; /* Border thickness */
    background: linear-gradient(90deg, #ff00ff, #00ffff, #ff00ff);
    background-size: 200% auto;
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    z-index: -1;
    animation: neon-border-slide 3s linear infinite;
    opacity: 0.8;
}

@keyframes neon-border-slide {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 10px;
}

.panel-label {
    font-size: 0.65rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 2px;
}

.win-potential {
    font-size: 0.85rem;
    font-weight: 900;
    color: var(--accent);
}

.glow-text {
    text-shadow: 0 0 10px var(--accent);
}

.panel-body {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.bet-control-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.small-label {
    font-size: 0.6rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
}

.casino-input-wrapper {
    display: flex;
    background: #000;
    border: 0.2rem solid #334155;
    border-radius: 1rem;
    overflow: hidden;
    height: 3.8rem;
    width: 100%;
    max-width: 30rem;
}

.bet-adj {
    background: #1e293b;
    border: none;
    color: #fff;
    width: clamp(50px, 12vw, 120px); /* Wider buttons */
    font-size: clamp(1.5rem, 4vw, 3rem); /* Bigger icons */
    font-weight: 900;
    cursor: pointer;
    transition: background 0.2s;
}

.bet-adj:hover { background: #334155; }
.bet-adj:active { background: #0f172a; }

.casino-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--gold);
    text-align: center;
    font-size: 1.8rem;
    font-weight: 950;
    width: 100%;
    user-select: text;
    -webkit-user-select: text;
}

.casino-input:focus { outline: none; }

.quick-bets {
    display: flex;
    gap: 8px;
    justify-content: center;
    width: 100%;
    max-width: 300px;
}

.quick-bet-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    padding: clamp(10px, 2vh, 25px);
    border-radius: 12px;
    font-size: clamp(0.8rem, 2vw, 1.5rem);
    font-weight: 900;
    cursor: pointer;
}

.currency-symbol {
    display: flex;
    align-items: center;
    padding: 0 4px 0 8px;
    color: var(--gold);
    font-weight: 950;
    font-size: 1.1rem;
    background: #000;
}

.action-container {
    display: flex;
    min-height: 80px;
}

.casino-btn-main {
    width: 100%;
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    border: none;
    border-radius: 14px;
    color: #fff;
    font-weight: 950;
    font-size: 1rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.2);
    transition: transform 0.1s;
}

.casino-btn-main:active { transform: scale(0.96); }

.play-pulse {
    animation: playPulse 2s infinite;
}

@keyframes playPulse {
    0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(244, 63, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

#ingame-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.casino-btn-secondary {
    background: #334155;
    border: none;
    border-radius: 10px;
    color: #fff;
    padding: 8px;
    font-weight: 900;
    font-size: 0.7rem;
    cursor: pointer;
}

.streak-actions-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.center-continue-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 15px;
    height: auto;
    min-height: 75px;
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%); /* Gold Gradient */
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
}

.center-continue-btn:hover {
    filter: brightness(1.2);
    transform: scale(1.02);
}

.btn-main-text {
    font-size: 1.1rem;
    font-weight: 950;
}

.btn-sub-text {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--gold);
    text-shadow: 0 0 5px rgba(251, 191, 36, 0.5);
}

.casino-btn-cashout-center {
    width: 100%;
    background: linear-gradient(135deg, #f43f5e 0%, #991b1b 100%); /* Red Gradient */
    border: none;
    border-radius: 14px;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 950;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.4);
    padding: 12px;
    min-height: 60px;
    transition: transform 0.1s;
}

.casino-btn-cashout-center:active { transform: scale(0.96); }

.gold-pulse {
    animation: goldPulse 1.5s infinite;
}

@keyframes goldPulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2); transform: scale(1.02); }
}

.cashout-label { font-size: 0.6rem; opacity: 0.7; }
.cashout-amount { font-size: 1rem; }

.multiplier-display {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 30px;
    padding: 5px 15px;
    display: inline-block;
    align-self: center;
    margin-top: 10px;
}

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

.mult-label {
    font-size: 0.6rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
}

.mult-value {
    font-size: clamp(1.1rem, 3vw, 2.5rem);
    font-weight: 950;
    color: var(--gold);
    text-shadow: 0 0 10px var(--gold);
}

.mult-x {
    color: var(--gold);
    font-weight: 900;
    font-size: 0.8rem;
}

.difficulty-switch-container {
    display: none !important;
}

.perfect-streak-mode .big-win-title {
    color: var(--gold);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.4);
    animation: perfect-title-glow 1.5s ease-in-out infinite alternate;
}

@keyframes perfect-title-glow {
    from { transform: scale(1); filter: brightness(1); }
    to { transform: scale(1.05); filter: brightness(1.3); }
}

.perfect-streak-mode::before {
    content: "💰";
    position: absolute;
    top: -50px;
    font-size: 2rem;
    animation: rain-coins 3s linear infinite;
    z-index: 10;
}

@keyframes rain-coins {
    0% { transform: translateY(0) rotate(0); opacity: 1; left: 10%; }
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0; left: 90%; }
}

/* Compliance Footer fix */
.compliance-footer {
    padding: 10px 0;
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 0.6rem;
    font-weight: bold;
    color: rgba(255,255,255,0.3);
}

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

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 12, 41, 0.98);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* 
   TRIPLE-A JACKPOT SYSTEM 
   Engineered for zero-lag and full-screen presence
*/

#big-win-overlay {
    background: #000;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bwBackgroundFade 0.3s ease-out forwards;
}

@keyframes bwBackgroundFade {
    0% { background: rgba(0,0,0,0); }
    100% { background: rgba(0,0,0,0.98); }
}

.big-win-inner {
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    animation: bwContentFadeIn 0.2s ease-out 0.3s forwards;
    width: 90%;
    max-width: 500px;
}

@keyframes bwContentFadeIn {
    to { opacity: 1; transform: translateY(0); }
}

.bw-title {
    font-size: clamp(3rem, 12vw, 5rem);
    font-weight: 950;
    color: var(--gold);
    text-transform: uppercase;
    margin-bottom: 5px;
    letter-spacing: -2px;
}

.bw-subtitle {
    font-size: 1rem;
    color: #fff;
    opacity: 0.8;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 30px;
}

.bw-amount {
    font-size: clamp(4rem, 15vw, 7rem);
    font-weight: 950;
    color: #fff;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.bw-currency { color: var(--gold); }

.bw-claim-btn {
    width: 100%;
    background: var(--gold);
    color: #000;
    border: none;
    padding: 20px;
    border-radius: 15px;
    font-size: 1.5rem;
    font-weight: 950;
    cursor: pointer;
    text-transform: uppercase;
    transition: transform 0.1s;
}

.bw-claim-btn:active { transform: scale(0.97); }

.bw-msg {
    margin-top: 20px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.4);
    font-weight: 800;
}


@keyframes jackpotFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Loss Overlay Style */
.loss-overlay {
    background: radial-gradient(circle, rgba(40, 0, 0, 0.98) 0%, rgba(10, 0, 0, 1) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loss-content {
    text-align: center;
    animation: bounceIn 0.4s ease-out;
}

.loss-title {
    font-size: 5.5rem;
    font-weight: 950;
    color: #ff0044;
    text-transform: uppercase;
    text-shadow: 0 0 30px rgba(255, 0, 68, 0.5);
    margin-bottom: 10px;
}

.loss-subtitle {
    font-size: 1.4rem;
    color: #fff;
    opacity: 0.8;
    margin-bottom: 40px;
}

.try-again-btn {
    padding: 20px 60px;
    font-size: 1.8rem;
    background: linear-gradient(135deg, #ff0044 0%, #990022 100%);
    border: none;
    border-radius: 20px;
    color: white;
    font-weight: 950;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(255, 0, 68, 0.4);
}

.try-again-btn:active {
    transform: scale(0.95);
}

.welcome-content {
    text-align: center;
    animation: fadeIn 0.5s ease-out;
    width: 100%;
    max-width: 60rem;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-height: 95vh;
}

.logo-container-main {
    width: 100%;
    max-width: 25rem;
    margin: 0 auto 1.5rem auto;
    flex-shrink: 1;
}

.welcome-character-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    height: 12rem;
    max-height: 20vh;
    flex-shrink: 1;
}

.primary-btn {
    background: linear-gradient(135deg, var(--neon-pink) 0%, var(--neon-blue) 100%);
    border: none;
    border-radius: 1.2rem;
    color: white;
    padding: 1.2rem 3rem;
    font-size: 1.4rem;
    font-weight: 950;
    cursor: pointer;
    box-shadow: 0 0 2rem rgba(255, 0, 255, 0.4);
    transition: transform 0.2s, filter 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    flex-shrink: 0;
}

.primary-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
    box-shadow: 0 0 30px rgba(255, 0, 255, 0.6);
}

.primary-btn:active {
    transform: scale(0.95);
}

.primary-btn.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(244, 63, 94, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); opacity: 1; }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.toast {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.95);
    padding: 15px 30px;
    border-radius: 30px;
    border: 2px solid rgba(255,255,255,0.15);
    z-index: 2500;
    font-weight: 950;
    color: #fff;
    white-space: nowrap;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    pointer-events: none;
}

.toast.win { color: #00ff00; border-color: rgba(0, 255, 0, 0.3); box-shadow: 0 0 20px rgba(0, 255, 0, 0.2); }
.toast.fail { color: #ff4444; border-color: rgba(255, 68, 68, 0.3); box-shadow: 0 0 20px rgba(255, 68, 68, 0.2); }

@keyframes toastEntrance {
    0% { transform: translate(-50%, -20px); opacity: 0; }
    100% { transform: translate(-50%, 0); opacity: 1; }
}

.toast:not(.hidden) {
    display: block !important;
    animation: toastEntrance 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.streak-badge {
    position: fixed;
    top: 100px;
    right: 20px;
    background: var(--primary);
    color: #fff;
    padding: 5px 15px;
    border-radius: 10px;
    font-weight: 950;
    box-shadow: 0 0 20px var(--primary);
    z-index: 100;
    animation: playPulse 2s infinite;
}

/* Optimized Animations */
@keyframes cardDeal {
    0% { transform: translate3d(80vw, 0, 0) rotateY(-20deg); opacity: 0; }
    100% { transform: translate3d(0, 0, 0) rotateY(0); opacity: 1; }
}

@keyframes cardClear {
    0% { transform: translate3d(0, 0, 0) rotateY(0); opacity: 1; }
    100% { transform: translate3d(-80vw, 0, 0) rotateY(20deg); opacity: 0; }
}

.character-card.dealing {
    animation: cardDeal 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.character-card.clearing {
    animation: cardClear 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
    pointer-events: none;
}

