/* PMDice Redesign - Deep Neon Dark Mode */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@500;600;700;800&display=swap');

:root {
    /* New Palette: Deep Neon */
    --bg-dark: #0f1923;
    /* Deep Navy Background */
    --bg-panel: #1a242d;
    /* Lighter Panels */
    --bg-input: #29343d;
    /* Input Backgrounds */
    --accent-green: #00e701;
    /* Neon Green (Win/Action) */
    --accent-blue: #00f0ff;
    /* Cyber Blue (Link/Highlight) */
    --accent-red: #ff2d55;
    /* Punchy Red (Loss) */
    --text-primary: #ffffff;
    --text-secondary: #8b9bb4;
    --border-color: #313f4d;
    /* Subtle Borders */
    --glow-green: 0 0 15px rgba(0, 231, 1, 0.4);
    --glow-blue: 0 0 15px rgba(0, 240, 255, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 14px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

html {
    overflow-x: hidden;
}

/* === HEADER === */
header {
    background: rgba(15, 25, 35, 0.95);
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
}

.logo {
    font-family: 'Poppins', sans-serif;
    color: #fff;
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--accent-red);
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 700;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--accent-blue);
    text-shadow: var(--glow-blue);
}

/* Mobile-only elements (hidden on desktop) */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

.mobile-balance {
    display: none;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--accent-green);
}

/* Hotkeys hint */
.hotkeys-hint {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    padding: 10px 0;
}

/* === MAIN LAYOUT === */
.main-wrap {
    display: flex;
    flex: 1;
}

.sidebar {
    width: 280px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar h4 {
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.sidebar-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.sidebar-row span:first-child {
    color: var(--text-secondary);
}

.sidebar-row span:last-child {
    color: #fff;
    font-weight: 600;
}

.change-btn {
    background: var(--bg-input);
    color: var(--accent-blue);
    border: 1px solid var(--accent-blue);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
}

.change-btn:hover {
    background: var(--accent-blue);
    color: #000;
}

.sidebar-menu-btn {
    display: block;
    background: var(--bg-input);
    color: var(--text-primary);
    text-align: center;
    padding: 14px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
}

.sidebar-menu-btn:hover {
    background: var(--accent-green);
    color: #000;
    border-color: var(--accent-green);
    box-shadow: var(--glow-green);
}

/* === CONTENT === */
.content {
    flex: 1;
    padding: 40px;
    display: flex;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Game Panel */
.game-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.game-title {
    font-family: 'Poppins', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
}

.game-title small {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 5px;
}

.game-stats {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.game-stats strong {
    color: #fff;
    margin-left: 5px;
}

/* Game Card */
.game-card {
    background: var(--bg-panel);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

/* Inputs */
.inputs-row {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.input-block {
    flex: 1;
}

.input-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 700;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.input-group {
    display: flex;
    background: var(--bg-input);
    border-radius: 8px;
    overflow: hidden;
    height: 45px;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.input-group:focus-within {
    border-color: var(--accent-blue);
}

.input-prefix {
    padding: 0 15px;
    color: var(--text-secondary);
    font-weight: 600;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.input-field {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    padding: 0 15px;
    outline: none;
    text-align: right;
    font-family: 'Inter', sans-serif;
}

.input-arrows,
.input-btns {
    display: flex;
}

.arrow-btn,
.input-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-left: 1px solid rgba(0, 0, 0, 0.3);
    color: var(--text-secondary);
    padding: 0 12px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.arrow-btn:hover,
.input-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Game Center Area */
.game-center {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    display: flex;
    gap: 30px;
    align-items: center;
}

/* Roll Box */
.roll-box {
    background: var(--bg-input);
    border-radius: 12px;
    padding: 20px;
    min-width: 160px;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.roll-box:hover {
    transform: translateY(-2px);
    background: #32414d;
}

.roll-box::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    border-style: solid;
    border-width: 0 40px 40px 0;
    border-color: transparent var(--accent-green) transparent transparent;
    border-top-right-radius: 12px;
}

.roll-box.over::after {
    border-color: transparent var(--accent-red) transparent transparent;
}

.roll-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 700;
}

.roll-val {
    font-size: 32px;
    font-weight: 800;
    color: #fff;
    margin-top: 5px;
    font-family: 'Poppins', sans-serif;
}

/* Result Area */
.result-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.result-num {
    font-size: 72px;
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    color: var(--accent-green);
    text-shadow: var(--glow-green);
}

.result-num.loss {
    color: var(--accent-red);
    text-shadow: 0 0 15px rgba(255, 45, 85, 0.4);
}

.win-msg {
    position: absolute;
    bottom: -25px;
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-green);
    opacity: 0;
    transition: opacity 0.3s;
}

.win-msg.loss {
    color: var(--accent-red);
}

.win-msg.show {
    opacity: 1;
}

/* Right Stats Inputs */
.right-stats {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 220px;
}

.stat-box {
    display: flex;
    background: var(--bg-input);
    border-radius: 8px;
    height: 40px;
    overflow: hidden;
}

.stat-label {
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
    padding: 0 12px;
    display: flex;
    align-items: center;
    text-transform: uppercase;
    width: 90px;
}

.stat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-weight: 700;
    text-align: center;
    font-size: 14px;
    outline: none;
}

/* ROLL BUTTON */
.roll-btn {
    width: 100%;
    background: var(--accent-green);
    color: #000;
    font-family: 'Poppins', sans-serif;
    font-size: 18px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: var(--glow-green);
    transition: all 0.2s;
    letter-spacing: 1px;
}

.roll-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 231, 1, 0.6);
}

.roll-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.roll-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
    box-shadow: none;
}

/* Right Panel (Balance) */
.right-panel {
    width: 240px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.balance-card {
    background: var(--bg-panel);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.balance-symbol {
    font-size: 28px;
    color: var(--accent-green);
    margin-bottom: 5px;
}

.balance-label {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.balance-val {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    margin-top: 5px;
    font-family: 'Poppins', sans-serif;
}

.action-btn {
    background: var(--bg-input);
    color: #fff;
    padding: 15px;
    border-radius: 8px;
    font-weight: 700;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.action-btn:hover {
    background: var(--bg-dark);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

/* Table */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-top: 30px;
    gap: 30px;
}

.tab {
    padding-bottom: 15px;
    color: var(--text-secondary);
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 12px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab:hover {
    color: #fff;
}

.tab.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.bets-table {
    margin-top: 20px;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 5px;
}

.bets-table th {
    text-align: left;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    padding: 10px;
}

.bets-table td {
    background: var(--bg-input);
    padding: 12px 10px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
}

.bets-table td:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.bets-table td:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.bets-table .win {
    color: var(--accent-green);
}

.bets-table .loss {
    color: var(--accent-red);
}

/* Collapsible Bet Rows */
.bet-row {
    cursor: pointer;
    transition: background 0.2s;
}

.bet-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.bet-row .expand-arrow {
    display: inline-block;
    transition: transform 0.2s;
    margin-right: 6px;
    font-size: 10px;
    color: var(--text-secondary);
}

.bet-row.expanded .expand-arrow {
    transform: rotate(90deg);
}

.bet-details-row {
    display: none;
}

.bet-details-row.show {
    display: table-row;
}

.bet-details-cell {
    padding: 15px 12px !important;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 2px solid var(--accent-blue);
}

.verification-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.verify-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.verify-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.verify-value {
    font-size: 11px;
    color: #fff;
    font-family: monospace;
    word-break: break-all;
    user-select: all;
}

.verify-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.verify-btn {
    padding: 8px 16px;
    background: var(--accent-blue);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.verify-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 153, 255, 0.4);
}

.copy-btn {
    background: var(--accent-green);
    color: #000;
}

.copy-btn:hover {
    box-shadow: var(--glow-green);
}

/* Modals (Dark Mode) */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
}

.modal-box {
    background: var(--bg-panel) !important;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    width: 450px;
    max-width: 90vw;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #fff;
}

.modal-box h3 {
    color: #ffffff !important;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.modal-text {
    color: #b8c5d6 !important;
    font-size: 14px;
    margin-bottom: 20px;
}

.modal-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    color: #fff;
    font-size: 14px;
    margin-bottom: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.modal-input:focus {
    border-color: var(--accent-blue);
}

.modal table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.modal table th {
    color: #ffffff !important;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    letter-spacing: 0.5px;
}

.modal table td {
    color: #e0e6ed !important;
    font-size: 13px;
    padding: 12px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.modal-btn {
    width: 100%;
    background: var(--accent-green);
    color: #000;
    font-weight: 700;
    padding: 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    text-transform: uppercase;
    transition: all 0.2s;
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-green);
}

/* Mobile */
@media (max-width: 1024px) {
    .content {
        padding: 20px;
        flex-direction: column;
    }

    .right-panel {
        width: 100%;
        flex-direction: row;
    }

    .balance-card {
        flex: 1;
    }

    .action-btn {
        flex: 1;
    }

    .sidebar {
        display: none;
    }
}

@media (max-width: 768px) {

    /* Global mobile overflow fix */
    *,
    *::before,
    *::after {
        box-sizing: border-box;
        max-width: 100vw;
    }

    .content,
    .game-panel,
    .game-card,
    .game-center,
    .inputs-row,
    .input-block,
    .input-group,
    .roll-btn-area,
    .msg-area,
    .roll-box,
    .right-stats,
    .stat-box,
    .bets-section {
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }

    /* Header adjustments */
    header {
        padding: 0 12px;
        height: 55px;
    }

    .logo {
        font-size: 18px;
    }

    /* Show mobile elements */
    .mobile-menu-toggle {
        display: flex;
    }

    .mobile-balance {
        display: block;
    }

    /* Hide desktop nav links on mobile */
    .nav-links {
        display: none;
    }

    /* Hide hotkeys hint on mobile */
    .hotkeys-hint {
        display: none;
    }

    /* Sidebar slide-in on mobile */
    .sidebar {
        display: flex;
        position: fixed;
        top: 55px;
        left: 0;
        bottom: 0;
        width: 280px;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        overflow-y: auto;
        box-shadow: none;
    }

    .sidebar.show {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
    }

    /* Main layout stacks vertically */
    .main-wrap {
        flex-direction: column;
    }

    /* Content spacing */
    .content {
        padding: 15px;
        gap: 20px;
        flex-direction: column;
    }

    /* Game panel */
    .game-card {
        padding: 20px;
    }

    .game-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .game-title {
        font-size: 20px;
    }

    .game-stats {
        font-size: 11px;
    }

    .action-btn {
        width: auto;
        flex: 1;
        min-height: 36px;
        padding: 6px 10px;
        font-size: 11px;
    }

    /* Right panel - compact inline bar near roll button */
    .right-panel {
        width: 100%;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 6px;
        align-items: stretch;
        order: -1;
    }

    .balance-card {
        flex: 1;
        padding: 8px 10px;
        min-width: auto;
        border-radius: 8px;
    }

    .balance-symbol {
        font-size: 14px;
        margin-bottom: 0;
    }

    .balance-label {
        font-size: 8px;
    }

    .balance-val {
        font-size: 14px;
        margin-top: 1px;
    }

    /* Input rows - 2 columns side by side */
    .inputs-row {
        flex-direction: row;
        gap: 8px;
    }

    .input-block {
        flex: 1;
        min-width: 0;
    }

    /* Input groups - compact */
    .input-group {
        height: 38px;
    }

    .input-field {
        font-size: 13px;
        padding: 0 2px;
        min-width: 0;
        text-align: left;
    }

    .input-prefix {
        padding: 0 4px;
        font-size: 11px;
    }

    /* Hide arrows on mobile - not touch-friendly */
    .input-arrows {
        display: none;
    }

    .input-btn {
        padding: 0 4px;
        font-size: 9px;
    }

    .input-label {
        font-size: 10px;
        margin-bottom: 4px;
    }

    /* Game center - horizontal compact layout */
    .game-center {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 12px;
        gap: 10px;
        align-items: center;
        justify-content: center;
    }

    /* Roll box - smaller */
    .roll-box {
        width: 80px;
        min-height: 60px;
        padding: 8px;
        flex-shrink: 0;
    }

    .roll-label {
        font-size: 8px;
    }

    .roll-val {
        font-size: 14px;
    }

    /* Result area inline */
    .result-area {
        flex: 1;
        min-width: 80px;
    }

    .result-num {
        font-size: 42px;
    }

    /* Payout + Win Chance - side by side */
    .right-stats {
        width: 100%;
        flex-direction: row;
        gap: 8px;
    }

    .stat-box {
        flex: 1;
        height: 36px;
    }

    .stat-label {
        font-size: 8px;
        width: auto;
        padding: 0 6px;
    }

    .stat-input {
        font-size: 12px;
    }

    /* Roll button - larger for touch */
    .roll-btn {
        padding: 18px;
        font-size: 16px;
        min-height: 56px;
    }

    /* Bets table scroll wrapper */
    .bets-table-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -10px;
        padding: 0 10px;
    }

    .bets-table {
        min-width: 600px;
    }

    .bets-table th,
    .bets-table td {
        font-size: 12px;
        padding: 10px 8px;
    }

    /* Modals - full screen on small devices */
    .modal-box {
        width: 95vw;
        max-height: 90vh;
        overflow-y: auto;
        padding: 20px;
    }

    .modal-box h3 {
        font-size: 20px;
    }

    /* Tabs */
    .tabs {
        gap: 20px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        white-space: nowrap;
    }

    /* Affiliate URL overflow */
    .affiliate-url {
        word-break: break-all;
        font-size: 10px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    header {
        padding: 0 10px;
    }

    .logo {
        font-size: 16px;
    }

    .content {
        padding: 10px;
    }

    .game-card {
        padding: 15px;
    }

    .game-title {
        font-size: 20px;
    }

    .result-num {
        font-size: 48px;
    }

    .action-btn {
        width: 100%;
        margin-bottom: 10px;
    }

    .balance-card {
        margin-bottom: 10px;
    }

    /* Stat boxes stack */
    .stat-box {
        height: 45px;
    }

    .stat-label {
        font-size: 9px;
        width: 80px;
    }

    /* Modal adjustments */
    .modal-box {
        padding: 15px;
    }

    .modal-close {
        font-size: 24px;
        top: 10px;
        right: 15px;
    }
}

/* Landscape orientation on phones */
@media (max-width: 768px) and (orientation: landscape) {
    .game-center {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .roll-box {
        width: 48%;
    }

    .result-area {
        width: 100%;
        order: -1;
    }

    .right-stats {
        width: 48%;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {

    /* Increase all button sizes for touch */
    .change-btn,
    .sidebar-menu-btn,
    .modal-btn,
    .verify-btn {
        min-height: 44px;
        padding: 12px 16px;
    }

    /* Remove hover effects on touch devices */
    .roll-box:hover {
        transform: none;
    }

    .action-btn:hover {
        transform: none;
    }
}