* {
    box-sizing: border-box;
}

:root {
    --bg-darkest: #0C1116;
    --bg-center: #17212B;
    --card-solid: #242F3D;
    --card-light: #2B5278;
    --accent-blue: #3F96D0;
    --neon-green: #0DC846;
    --text-white: #ffffff;
    --text-muted: #8e9db0;
    --danger-red: #ff4d4d;
    --font-family: 'Inter', sans-serif;
    --blue-green-gradient: linear-gradient(135deg, var(--accent-blue), var(--neon-green));
}

body {
    margin: 0;
    padding: 0;
    background: radial-gradient(circle at center, var(--card-solid) 0%, var(--bg-darkest) 100%);
    background-attachment: fixed;
    color: var(--text-white);
    font-family: var(--font-family);
    font-size: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

.game-wrapper {
    width: 100%;
    max-width: 1400px;
    height: 80%;
    padding: 20px;
    box-sizing: border-box;
}

/* 2-Column Layout */
.two-column-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 30px;
    height: 100%;
}

@media (max-width: 900px) {
    .game-wrapper {
        height: auto;
        min-height: 100vh;
    }

    body {
        overflow-y: auto;
        height: auto;
    }

    .two-column-layout {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }
}

/* Left Column: Core Flow (Stats -> Dice -> Stake -> Button) */
.column-left {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 15px;
}

/* Stats Card - 2px Gradient Border restored */
.stats-card {
    background: var(--card-solid);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 10px 25px;
    /* Reduced from 15px */
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Changed from baseline to center for manual alignment */
    background-image: linear-gradient(var(--card-solid), var(--card-solid)), var(--blue-green-gradient);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    flex-shrink: 0;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-label {
    color: var(--text-white);
    font-size: 16px;
    font-weight: 600;
    margin-top: -1px;
    /* Manual upward nudge */
}

.stat-value {
    font-weight: 600;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.strike-dots-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-darkest);
    transition: 0.3s;
}

.dot.active {
    background: var(--neon-green);
    box-shadow: 0 0 8px var(--neon-green);
}

/* Hero Dice Area - Dynamic Height */
.hero-dice-area {
    flex: 1;
    /* Takes rest of the space */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    margin-top: -10%;
}

#dice-container-main {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 450px;
    max-height: 450px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Stake Panel - Compact */
.stake-panel {
    background: var(--card-solid);
    border-radius: 14px;
    padding: 15px 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid var(--card-light);
    flex-shrink: 0;
}

.stake-header-label {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
}

.stake-input-group {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.central-input-container {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--card-light);
    border-radius: 8px;
    padding: 6px 15px;
    flex: 1;
}

.input-content-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.gem-symbol,
.currency-icon {
    width: 20px;
    height: 20px;
    vertical-align: -0.12em;
    display: inline-block;
}

.central-input-container input {
    background: transparent;
    border: none;
    color: var(--text-white);
    font-size: 26px;
    font-weight: 800;
    width: 80px;
    text-align: center;
    outline: none;
}

.usd-hint {
    color: var(--text-muted);
    font-size: .9em;
}

.step-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-center);
    border: 1px solid var(--card-light);
    color: #fff;
    border-radius: 6px;
    font-size: 22px;
    cursor: pointer;
    transition: 0.2s;
}

.step-btn.plus-btn-accent {
    background: var(--accent-blue);
    border: none;
}

.step-btn:active {
    transform: scale(0.9);
}

.quick-bets-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.small-bet-chip {
    background: transparent;
    border: 1px solid var(--accent-blue);
    color: var(--text-white);
    padding: 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1em;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.small-bet-chip:hover {
    background: var(--accent-blue);
    color: white;
}

.chip-gem-icon,
.currency-icon-small {
    width: 18px;
    height: 18px;
    vertical-align: -0.1em;
    display: inline-block;
}

/* Larger icon */

/* Main Action Button */
.main-action-btn {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 1.3em;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(63, 150, 208, 0.6);
    transition: 0.3s;
    flex-shrink: 0;
    margin-bottom: 5px;
}

.main-action-btn:hover {
    background: var(--neon-green);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 1.3em;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 25px var(--neon-green);
    transition: 0.3s;
    flex-shrink: 0;
    margin-bottom: 7px;
}

.main-action-btn:active {
    transform: translateY(2px);
}

/* Right Column: Info & History (Vertical Stack) */
.column-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
    min-height: 0;
    /* Forces children to stay within parent height */
}

.side-card {
    background: transparent;
    border: 1px solid var(--card-light);
    border-radius: 14px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* Crucial for internal scrolling */
}

.info-card {
    flex-shrink: 0;
}

.history-card {
    flex: 1;
    overflow: hidden;
}

.side-card-title {
    margin: 0 0 24px 0;
    font-size: 1em;
    font-weight: 600;
    color: var(--text-white);
}

/* Paytable - FIXED ALIGNMENT */
.paytable-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.pay-cell {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-light);
    border-radius: 8px;
    padding: 0 6px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
    width: 100%;
    min-height: 80px;
}

.pay-cell.bonus-cell-double {
    grid-column: span 2;
}

.mini-icon {
    width: 45px;
    height: 45px;
}

.bonus-dice-trio {
    display: flex;
    gap: -8px;
    /* Slightly more overlap */
    justify-content: center;
}

.cell-m {
    font-size: 15px;
    font-weight: 600;
}

.rules-caption,
.history-placeholder,
.stake-header-label {
    color: var(--text-muted);
    font-size: .9em;
    text-align: left;
    margin-top: 12px;
    line-height: 1.4;
}



/* History Log - FIXED PADDING & SPACING */
.history-log {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 8px;
    /* Extra space for custom scrollbar */
    min-height: 0;
}

.history-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 14px;
    flex-shrink: 0;
}

/* Message Styles */
.message {
    text-align: center;
    font-size: 1em;
    font-weight: 600;
    min-height: 24px;
    margin: 5px 0;
}

.message.type-success {
    color: var(--neon-green);
}

/* Win Highlight - NEON GREEN GROW */
.pay-cell.win-effect {
    background: rgba(13, 200, 70, 0.1);
    border: 2px solid var(--neon-green) !important;
    box-shadow: 0 0 15px rgba(13, 200, 70, 0.5);
    /* No scaling to avoid layout shifts */
}

.win-text {
    color: var(--neon-green);
    font-weight: 600;
}

.loss-text {
    color: var(--danger-red);
    font-weight: 600;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--card-light);
    border-radius: 3px;
    border: 1px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--accent-blue);
}

/* Mobile Optimizations */
@media (max-width: 480px) {
    .game-wrapper {
        padding: 10px;
        height: auto;
        min-height: 100vh;
        display: block;
        overflow-y: visible;
    }

    body {
        overflow-y: auto;
        height: auto;
    }

    .two-column-layout {
        gap: 15px;
        display: flex;
        flex-direction: column;
    }

    .column-left,
    .column-right {
        height: auto;
        min-height: 0;
        gap: 10px;
    }

    .stats-card {
        padding: 6px 15px;
        /* Reduced from 10px */
        align-items: center;
    }

    .stat-label {
        font-size: 14px;
    }

    .stat-value {
        font-size: 16px;
    }

    .dot {
        width: 10px;
        height: 10px;
    }

    .hero-dice-area {
        flex: none;
        /* Do not stretch to fill the column */
        min-height: 160px;
        margin-top: 0;
        /* Removing negative margin that caused overlap */
    }

    #dice-container-main {
        max-width: 280px;
        max-height: 280px;
    }

    .stake-panel {
        padding: 12px 15px;
        gap: 10px;
    }

    .central-input-container input {
        font-size: 20px;
        width: 60px;
    }

    .step-btn {
        width: 34px;
        height: 34px;
        font-size: 18px;
    }

    .small-bet-chip {
        padding: 8px;
        font-size: 0.9em;
    }

    .main-action-btn {
        padding: 14px;
        font-size: 1.1em;
    }

    .side-card {
        padding: 12px;
        height: auto;
    }

    .history-card {
        max-height: 380px;
        /* Cap history height on mobile */
    }

    .side-card-title {
        margin-bottom: 15px;
    }

    .pay-cell {
        min-height: 70px;
        padding: 0 4px 8px;
    }

    .mini-icon {
        width: 35px;
        height: 35px;
    }

    .cell-m {
        font-size: 13px;
    }

    .rules-caption,
    .history-placeholder,
    .stake-header-label {
        font-size: 0.85em;
        margin-top: 8px;
    }
}

/* =========================================
   LANDING PAGE EXTENSIONS
   ========================================= */

/* UTILITY */
.hidden {
    display: none !important;
}

/* 2. HEADER */
.app-header {
    width: 100%;
    max-width: 1400px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    box-sizing: border-box;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    /* Subtle seperation */
    margin-bottom: 0px;
    /* Hero margin handles spacing */
    flex-shrink: 0;
}

.header-right {
    display: flex;
    gap: 10px;
}

.header-left {
    display: flex;
    flex-direction: column;
}

.header-title {
    font-weight: 700;
    font-size: 18px;
    color: var(--text-white);
}

.badge-beta {
    background: rgba(63, 150, 208, 0.2);
    color: var(--accent-blue);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 5px;
    text-transform: uppercase;
}

.header-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.7;
}

.wallet-btn {
    background: rgba(63, 150, 208, 0.15);
    border: 1px solid rgba(63, 150, 208, 0.3);
    color: var(--accent-blue);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: 0.2s;
}

.wallet-btn:hover {
    background: rgba(63, 150, 208, 0.25);
    transform: translateY(-1px);
}

.icon-star {
    width: 16px;
    height: 16px;
}

.withdraw-btn {
    background: rgba(13, 200, 70, 0.15) !important;
    border: 1px solid rgba(13, 200, 70, 0.3) !important;
    color: var(--neon-green) !important;
}

.withdraw-btn:hover {
    background: rgba(13, 200, 70, 0.25) !important;
    border-color: var(--neon-green) !important;
}

/* MAIN STRUCTURE ADJUSTMENTS */
.main-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

/* Ensure game wrapper fits nicely */
.game-wrapper {
    height: auto !important;
    /* Allow growing */
    min-height: auto !important;
    margin-bottom: 30px;
}

/* 4. ASSET PANEL */
.asset-panel-section {
    width: 100%;
    max-width: 800px;
    padding: 0 20px;
    margin-bottom: 40px;
    box-sizing: border-box;
}

.panel-title {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    font-weight: 600;
}

.asset-buttons {
    display: flex;
    gap: 15px;
}

.asset-btn-primary {
    flex: 2;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    color: white;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
    transition: 0.2s;
}

.asset-btn-primary:active {
    transform: scale(0.98);
}

.asset-btn-primary span {
    display: block;
}

.asset-btn-primary .btn-subtext {
    font-size: 11px;
    font-weight: 500;
    opacity: 0.9;
    margin-top: 2px;
}

.asset-btn-secondary {
    flex: 1;
    background: transparent;
    border: 1px solid var(--text-muted);
    border-radius: 12px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: 0.2s;
}

.asset-btn-secondary:hover {
    border-color: var(--text-white);
    color: var(--text-white);
}

/* 5. INFO BLOCK COMPACT */
.info-block-section-compact {
    margin-top: 10px;
    background: var(--card-solid);
    border: 1px solid var(--card-light);
    border-radius: 14px;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.section-title {
    color: var(--accent-blue);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    border-left: 3px solid var(--accent-blue);
    padding-left: 10px;
    font-weight: 700;
}

.info-content {
    background: rgba(255, 255, 255, 0.03);
    padding: 20px;
    border-radius: 12px;
    font-size: 14px;
    color: #ccc;
    line-height: 1.6;
}

.info-content p {
    margin: 0 0 15px;
}

.info-content p:last-child {
    margin: 0;
}

.info-alert {
    background: rgba(231, 76, 60, 0.15);
    border-left: 3px solid #e74c3c;
    padding: 10px 15px;
    border-radius: 6px;
    color: #e74c3c;
    font-size: 13px;
    margin-top: 15px;
}

/* 6. LIVE FEED CARD */
.live-feed-card {
    flex: 1;
    min-height: 250px;
}

.live-title {
    display: flex;
    align-items: center;
    border-left: none;
    padding-left: 0;
    margin-bottom: 15px;
}

.pulse-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #e74c3c;
    border-radius: 50%;
    margin-right: 8px;
    box-shadow: 0 0 8px #e74c3c;
    animation: pulseRed 2s infinite;
}

@keyframes pulseRed {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }

    100% {
        opacity: 1;
    }
}

.live-feed-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 180px;
    overflow: hidden;
    position: relative;
    /* Mask for fade out effect */
    mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
}

.live-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-muted);
    border-left: 2px solid transparent;
    cursor: pointer;
    transition: 0.2s;
    animation: slideIn 0.5s ease-out;
}

.live-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.live-item.win-streak {
    border-left-color: var(--neon-green);
}

.live-item.withdraw {
    border-left-color: #f1c40f;
}

.live-item.premium {
    border-left-color: #9b59b6;
}

.user-id {
    color: var(--text-white);
    font-weight: 500;
    font-family: monospace;
}

.action-desc {
    flex: 1;
    margin: 0 10px;
    color: #bbb;
}

.time-ago {
    font-size: 11px;
    opacity: 0.6;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 7. FOOTER */
.app-footer {
    width: 100%;
    text-align: center;
    padding: 30px 20px 60px;
    /* Extra bottom for mobile scroll */
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.3);
    box-sizing: border-box;
}

.app-footer p {
    margin-bottom: 10px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    margin: 0 5px;
    transition: 0.2s;
}

.footer-links a:hover {
    color: var(--accent-blue);
}

/* 8. MODALS */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 5000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-container {
    background: var(--card-solid);
    border: 1px solid var(--card-light);
    border-radius: 16px;
    width: 100%;
    max-width: 360px;
    padding: 25px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    text-align: center;
    position: relative;
    animation: popUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popUp {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-icon {
    font-size: 40px;
    margin-bottom: 15px;
    display: block;
}

.modal-title {
    color: var(--text-white);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
}

.modal-text {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.modal-btn {
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
}

.btn-primary:hover {
    background: #3582b5;
}

/* 9. TOAST */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 26, 33, 0.95);
    border: 1px solid var(--card-light);
    padding: 12px 20px;
    border-radius: 30px;
    z-index: 4000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 400px;
    text-align: center;
    cursor: pointer;
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 100px);
    }

    to {
        transform: translate(-50%, 0);
    }
}

.toast-text {
    font-size: 13px;
    color: #fff;
    font-weight: 500;
}

/* RESPONSIVE */
@media (max-width: 480px) {
    .asset-buttons {
        flex-direction: column;
    }

    .asset-btn-primary {
        padding: 15px;
    }

    .header-title {
        font-size: 16px;
    }
}