
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --background: #090a0d;
    --panel: #151619;
    --panel-light: #1c1d21;
    --border: #292b30;
    --text: #eeeeef;
    --muted: #8b8d94;
    --green: #159b12;
    --green-light: #21c51b;
    --red: #ed3039;
    --purple: #8b39dc;
    --blue: #1474df;
}

body {
    min-height: 100vh;
    background: var(--background);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    overflow-x: hidden;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.app {
    width: 100%;
    min-height: 100vh;
}

/* TOP BAR */

.topbar {
    height: 58px;
    background: #111216;
    border-bottom: 1px solid #27282c;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    position: relative;
    z-index: 10;
}

.brand {
    font-size: 27px;
    font-weight: 1000;
    color: #f03740;
    letter-spacing: -1.8px;
    font-style: italic;
}

.brand span {
    font-size: 12px;
    color: white;
    background: #292b31;
    padding: 4px 6px;
    border-radius: 4px;
    margin-left: 5px;
    letter-spacing: 0;
    vertical-align: middle;
}

.top-right {
    display: flex;
    align-items: center;
    gap: 24px;
    position: relative;
}

.wallet {
    background: #24262b;
    border: 1px solid #34363b;
    border-radius: 20px;
    padding: 7px 13px;
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 12px;
}

.wallet-label {
    color: #8c8e96;
    font-size: 9px;
}

.wallet strong {
    color: #f4f4f4;
}

.online {
    color: #a4a6ad;
    font-size: 11px;
}

.online strong {
    color: #35d78b;
}

.online-dot,
.status-dot {
    width: 7px;
    height: 7px;
    background: #2bd987;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.menu-button {
    color: white;
    background: transparent;
    border: none;
    font-size: 23px;
}

.menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 43px;
    width: 170px;
    background: #202126;
    border: 1px solid #3b3c43;
    border-radius: 7px;
    overflow: hidden;
    z-index: 30;
}

.menu-dropdown.open {
    display: block;
}

.menu-dropdown button {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: none;
    border-bottom: 1px solid #33343a;
    color: white;
    text-align: left;
    font-size: 12px;
}

.menu-dropdown button:hover {
    background: #303138;
}

/* MAIN LAYOUT */

.main-layout {
    display: grid;
    grid-template-columns: 275px minmax(400px, 1fr) 265px;
    gap: 8px;
    min-height: calc(100vh - 91px);
    padding: 8px;
}

/* LEFT PANEL */

.left-panel,
.right-panel {
    background: var(--panel);
    border: 1px solid #25262b;
    border-radius: 7px;
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.left-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: #0d0e11;
    padding: 7px;
    gap: 4px;
}

.tab {
    background: transparent;
    color: #a3a5ac;
    border: none;
    border-radius: 15px;
    padding: 7px 3px;
    font-size: 11px;
}

.tab.active {
    color: white;
    background: #34363c;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    padding: 14px 10px 9px;
    color: #aaaab0;
    font-size: 10px;
    font-weight: bold;
}

#betCount {
    color: #40d68b;
}

.bet-table {
    padding: 0 8px;
}

.bet-table-head {
    display: grid;
    grid-template-columns: 1.3fr 1fr .7fr .8fr;
    gap: 3px;
    color: #777981;
    font-size: 9px;
    padding: 8px 5px;
}

.bet-row {
    display: grid;
    grid-template-columns: 1.3fr 1fr .7fr .8fr;
    gap: 3px;
    align-items: center;
    min-height: 34px;
    padding: 5px;
    background: #101114;
    border: 1px solid #292b30;
    border-radius: 17px;
    margin-bottom: 5px;
    font-size: 10px;
}

.bet-row.mine {
    background: #16320f;
    border-color: #286b1a;
}

.bet-player {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.player-avatar {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    background: #333a44;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 11px;
}

.bet-coef {
    color: #d8a3ff;
    background: #712fc3;
    padding: 3px 4px;
    text-align: center;
    border-radius: 10px;
}

.bet-win {
    color: #8ce6a2;
}

.empty-row {
    color: #6d7078;
    font-size: 11px;
    text-align: center;
    padding: 20px 5px;
}

.left-footer {
    margin-top: auto;
    padding: 12px;
    color: #777981;
    font-size: 9px;
    border-top: 1px solid #292a30;
}

/* CENTER PANEL */

.center-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-bar {
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #141519;
    border: 1px solid #27282d;
    border-radius: 7px;
    padding: 6px 10px;
    overflow: hidden;
}

.history-label {
    font-size: 9px;
    color: #85878e;
    white-space: nowrap;
}

.history-list {
    display: flex;
    gap: 6px;
    overflow: hidden;
}

.history-chip {
    border-radius: 12px;
    padding: 5px 9px;
    font-size: 10px;
    font-weight: bold;
    white-space: nowrap;
}

.history-chip.low {
    background: #30333a;
    color: #aeb3bf;
}

.history-chip.high {
    background: #6c2cb7;
    color: white;
}

.history-empty {
    color: #777;
    font-size: 10px;
}

.game-container {
    position: relative;
    min-height: 360px;
    flex: 1;
    background: #06131b;
    border: 1px solid #303136;
    border-radius: 9px;
    overflow: hidden;
}

#gameCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.game-top-label {
    position: absolute;
    top: 14px;
    left: 15px;
    color: rgba(255,255,255,.7);
    font-size: 10px;
    letter-spacing: 1px;
    pointer-events: none;
}

.multiplier-display {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    width: 90%;
}

#multiplier {
    font-size: clamp(40px, 7vw, 76px);
    font-weight: 900;
    color: #fff;
    text-shadow: 0 3px 20px rgba(0,0,0,.5);
    letter-spacing: -3px;
}

#gameMessage {
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 3px;
    color: #e9e9e9;
    margin-top: 3px;
}

.distance-display {
    position: absolute;
    bottom: 13px;
    left: 14px;
    background: rgba(0,0,0,.45);
    padding: 7px 11px;
    border-radius: 5px;
    display: flex;
    gap: 10px;
    font-size: 10px;
}

.distance-display span {
    color: #9da9ad;
}

.distance-display strong {
    color: white;
}

.sound-indicator {
    position: absolute;
    bottom: 12px;
    right: 15px;
    color: #d7e9ed;
    opacity: .7;
}

.crash-overlay {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: repeating-conic-gradient(
        from 0deg at 50% 50%,
        rgba(0,0,0,.96) 0deg 13deg,
        rgba(30,30,34,.96) 13deg 25deg
    );
    z-index: 3;
}

.crash-overlay.show {
    display: flex;
}

.crash-title {
    font-size: clamp(22px, 4vw, 36px);
    letter-spacing: 4px;
    color: white;
    font-weight: 300;
}

#crashValue {
    font-size: clamp(48px, 8vw, 82px);
    color: #ed3039;
    font-weight: 900;
}

/* BET CARDS */

.betting-area {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.bet-card {
    min-width: 0;
    background: #191a1e;
    border: 1px solid #292a30;
    border-radius: 12px;
    padding: 10px;
}

.bet-mode {
    width: 70%;
    margin: 0 auto 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #101114;
    border: 1px solid #303138;
    border-radius: 20px;
    padding: 2px;
}

.mode-button {
    border: none;
    border-radius: 20px;
    padding: 4px;
    background: transparent;
    color: #9b9da4;
    font-size: 10px;
}

.mode-button.active {
    background: #36383e;
    color: white;
}

.stake-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.stake-control {
    display: flex;
    align-items: center;
    min-width: 0;
    border: 1px solid #303137;
    background: #090a0d;
    border-radius: 20px;
    padding: 3px 5px;
}

.stake-input {
    width: 100%;
    min-width: 0;
    color: white;
    background: transparent;
    border: none;
    outline: none;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
}

.stake-adjust {
    width: 21px;
    height: 21px;
    flex: 0 0 21px;
    background: #41434a;
    border: none;
    border-radius: 50%;
    color: white;
    font-weight: bold;
}

.bet-action {
    min-height: 48px;
    border: none;
    border-radius: 13px;
    background: var(--green);
    color: white;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: .5px;
    transition: .15s;
}

.bet-action:hover:not(:disabled) {
    background: var(--green-light);
    transform: translateY(-1px);
}

.bet-action:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.bet-action.cashout {
    background: #d68b13;
}

.bet-action.cashed {
    background: #236c40;
}

.bet-action.lost {
    background: #7d3036;
}

.quick-stakes {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-top: 7px;
}

.quick-stakes button {
    color: #a7a9b0;
    background: #25262b;
    border: 1px solid #34353a;
    border-radius: 6px;
    padding: 5px 2px;
    font-size: 10px;
}

.quick-stakes button:hover {
    color: white;
    background: #3b3d44;
}

.auto-options {
    display: none;
    gap: 8px;
    flex-direction: column;
    margin-top: 10px;
    font-size: 10px;
    color: #aeb0b6;
}

.bet-card.auto-mode .auto-options {
    display: flex;
}

.auto-options label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 5px;
}

.auto-options input[type="number"] {
    width: 75px;
    background: #0d0e11;
    color: white;
    border: 1px solid #3a3c42;
    padding: 5px;
    border-radius: 5px;
}

.auto-options input[type="checkbox"] {
    accent-color: #1caf51;
}

.bet-card-footer {
    display: flex;
    justify-content: space-between;
    gap: 5px;
    margin-top: 9px;
    font-size: 10px;
    color: #92949c;
}

.slot-return {
    color: #8ee5a6;
    text-align: right;
}

/* RIGHT PANEL */

.activity-header {
    height: 40px;
    background: #111216;
    border-bottom: 1px solid #292a30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
}

.activity-title {
    font-size: 11px;
    font-weight: bold;
}

.live-tag {
    font-size: 9px;
    color: #ed777e;
}

.live-tag i {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #ed3039;
    border-radius: 50%;
    margin-right: 4px;
}

.activity-summary {
    display: flex;
    justify-content: space-between;
    background: #153a72;
    padding: 10px;
    font-size: 11px;
}

#activityMultiplier {
    font-weight: bold;
    color: white;
}

#activityRound {
    color: #c4d6f0;
}

.activity-feed {
    flex: 1;
    overflow-y: auto;
    padding: 7px;
    min-height: 180px;
}

.feed-card {
    background: #172e4c;
    border: 1px solid #24466f;
    border-radius: 7px;
    padding: 10px;
    margin-bottom: 7px;
    font-size: 10px;
}

.feed-top {
    display: flex;
    justify-content: space-between;
    color: #dce8f8;
    margin-bottom: 8px;
}

.feed-message {
    color: #d0d8e3;
    line-height: 1.5;
}

.feed-result {
    display: flex;
    justify-content: space-between;
    gap: 5px;
    margin-top: 9px;
    color: #aebed2;
}

.feed-result strong {
    color: #9fe8b4;
}

.feed-empty {
    text-align: center;
    color: #747780;
    font-size: 11px;
    padding: 20px 5px;
}

.chat-area {
    border-top: 1px solid #303138;
    background: #111216;
    padding: 10px;
}

.chat-heading {
    font-size: 10px;
    color: #a6a8af;
    font-weight: bold;
    margin-bottom: 8px;
}

.chat-messages {
    height: 85px;
    overflow-y: auto;
    font-size: 10px;
    color: #c1c4ca;
}

.chat-system {
    color: #7fa5d2;
    padding: 4px 0;
}

.chat-user-message {
    padding: 4px 0;
    overflow-wrap: anywhere;
}

.chat-user-message strong {
    color: #83b9ff;
}

.chat-form {
    display: flex;
    gap: 5px;
}

.chat-form input {
    min-width: 0;
    flex: 1;
    background: #22242a;
    border: 1px solid #35373e;
    color: white;
    border-radius: 5px;
    padding: 8px;
    outline: none;
    font-size: 10px;
}

.chat-form button {
    width: 34px;
    background: #1761ba;
    color: white;
    border: none;
    border-radius: 5px;
}

.chat-note {
    font-size: 9px;
    color: #686b73;
    margin-top: 6px;
}

/* FOOTER */

.footer {
    height: 25px;
    display: flex;
    justify-content: space-between;
    padding: 5px 12px;
    color: #777981;
    font-size: 9px;
    background: #101115;
    border-top: 1px solid #25262b;
}

/* MODAL */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0,0,0,.8);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.open {
    display: flex;
}

.modal-box {
    width: min(400px, 100%);
    background: #1b1c21;
    border: 1px solid #44464d;
    border-radius: 12px;
    padding: 25px;
    position: relative;
}

.modal-box h2 {
    color: #ed454d;
    margin-bottom: 12px;
}

.modal-box p {
    color: #c1c3c9;
    font-size: 13px;
    line-height: 1.7;
}

.modal-close {
    position: absolute;
    right: 12px;
    top: 8px;
    color: white;
    background: none;
    border: none;
    font-size: 25px;
}

/* RESPONSIVE */

@media (max-width: 1100px) {
    .main-layout {
        grid-template-columns: 210px minmax(350px, 1fr);
    }

    .right-panel {
        grid-column: 1 / -1;
        min-height: 300px;
    }

    .activity-feed {
        min-height: 120px;
    }
}

@media (max-width: 700px) {
    .topbar {
        padding: 0 10px;
    }

    .brand {
        font-size: 21px;
    }

    .top-right {
        gap: 10px;
    }

    .wallet {
        padding: 6px 8px;
        gap: 4px;
        flex-direction: column;
        align-items: flex-start;
    }

    .online {
        display: none;
    }

    .main-layout {
        display: flex;
        flex-direction: column;
        padding: 5px;
    }

    .center-panel {
        order: 1;
    }

    .left-panel {
        order: 2;
        min-height: 160px;
    }

    .right-panel {
        order: 3;
    }

    .game-container {
        min-height: 340px;
    }

    .betting-area {
        grid-template-columns: 1fr;
    }

    .bet-card {
        padding: 12px;
    }

    .right-panel {
        min-height: 300px;
    }

    .footer {
        font-size: 8px;
    }
}
