@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-main: #0b1020;
    --bg-card: #151b2b;
    --bg-card-hover: #1a2235;
    --border-color: #2a3441;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-green: #10b981;
    --accent-red: #f43f5e;
    --accent-amber: #f59e0b;
    --accent-blue: #3b82f6;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: 150ms ease;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

/* Sticky Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(11, 16, 32, 0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.ticker {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.wallet-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.wallet-amount {
    color: var(--accent-green);
    font-weight: 700;
    font-size: 18px;
    transition: color 150ms ease, text-shadow 150ms ease;
}

.wallet-amount.flash {
    color: #fff;
    text-shadow: 0 0 8px var(--accent-green);
}

.btn {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 13px;
    transition: all var(--transition);
}

.btn:hover {
    background-color: var(--bg-card-hover);
    transform: scale(1.02);
}

.btn-primary { background-color: var(--accent-blue); border-color: var(--accent-blue); color: #fff; }
.btn-primary:hover { background-color: #2563eb; }
.btn-success { background-color: var(--accent-green); border-color: var(--accent-green); color: #000; }
.btn-success:hover { background-color: #059669; }
.btn-danger { background-color: var(--accent-red); border-color: var(--accent-red); color: #fff; }
.btn-danger:hover { background-color: #e11d48; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* 4-Panel Grid */
.dashboard {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 380px 300px;
    gap: 16px;
    margin-bottom: 24px;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
}

.card h2 {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.chart-panel { grid-column: 1 / 2; grid-row: 1 / 2; }
.news-panel { grid-column: 2 / 3; grid-row: 1 / 2; overflow-y: auto; }
.market-panel { grid-column: 1 / 2; grid-row: 2 / 3; overflow-y: auto; }
.history-panel { grid-column: 2 / 3; grid-row: 2 / 3; overflow-y: auto; }

/* Lists & Rows */
ul { list-style: none; padding: 0; margin: 0; }
.list-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
}
.list-item:last-child { border-bottom: none; }
.list-item strong { color: var(--text-primary); }

.market-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}
.market-row:last-child { border-bottom: none; }
.green-text { color: var(--accent-green); font-weight: 600; }
.red-text { color: var(--accent-red); font-weight: 600; }

/* Chart Area */
#chartContainer {
    flex-grow: 1;
    position: relative;
    width: 100%;
    margin-top: 8px;
}
.y-axis {
    position: absolute;
    left: 0; top: 0; bottom: 0; width: 40px;
    display: flex; flex-direction: column; justify-content: space-between;
    color: var(--text-secondary); font-size: 11px; pointer-events: none;
}
.chart-area {
    position: absolute; bottom: 0; left: 45px; right: 0; height: 100%;
    display: flex; align-items: flex-end; justify-content: space-between; gap: 2px;
}
#trendCanvas {
    position: absolute; top: 0; left: 45px; right: 0; height: 100%; pointer-events: none;
}
.candle-wrapper {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; width: 10px;
}
.candle-wick {
    position: absolute; width: 2px; background-color: var(--text-secondary); left: 50%; transform: translateX(-50%); border-radius: 1px;
}
.candle-body {
    position: absolute; width: 100%; left: 0; border-radius: 2px;
}
.price-label {
    position: absolute; right: 0; top: 0; padding: 2px 6px; font-size: 11px; font-weight: 600; border-radius: var(--radius-sm); z-index: 10;
}
.price-label.green { background-color: var(--accent-green); color: #000; }
.price-label.red { background-color: var(--accent-red); color: #fff; }

/* Handover Panel */
.handover-panel {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}
.handover-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Tabs UI for Casino */
.casino-section {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    margin-bottom: 40px;
}
.tabs-header {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(0,0,0,0.2);
}
.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 16px;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    border-bottom: 2px solid transparent;
}
.tab-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255,255,255,0.02);
}
.tab-btn.active {
    color: var(--accent-green);
    border-bottom-color: var(--accent-green);
    background-color: rgba(16, 185, 129, 0.05);
}
.tab-content {
    display: none;
    padding: 32px 24px;
    min-height: 400px;
}
.tab-content.active {
    display: block;
}

/* Slots UI */
.slots-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}
.slots-grid {
    display: flex;
    gap: 16px;
    background-color: rgba(0,0,0,0.2);
    padding: 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}
.slot-reel {
    width: 80px;
    height: 100px;
    background-color: var(--bg-main);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    box-shadow: inset 0 4px 6px rgba(0,0,0,0.3);
}

/* Roulette UI */
.roulette-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 40px;
}
.wheel-wrapper {
    width: 320px;
    height: 320px;
    position: relative;
    border-radius: 50%;
    box-shadow: 0 0 24px rgba(0,0,0,0.4);
}
#wheelCanvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}
.roulette-table {
    background-color: #064e3b;
    border: 4px solid #1f2937;
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: inset 0 0 32px rgba(0,0,0,0.6);
    position: relative;
}
.table-row {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 4px;
}
.table-cell {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid rgba(255,255,255,0.2);
    position: relative;
    user-select: none;
}
.table-cell.red { background-color: #e11d48; color: #fff; }
.table-cell.black { background-color: #111827; color: #fff; }
.table-cell.green { background-color: #059669; color: #fff; }
.table-cell:hover { transform: scale(1.05); border-color: #fff; }
.table-cell.highlight { border: 2px solid var(--accent-amber); box-shadow: 0 0 12px var(--accent-amber); }

.side-bets {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}
.side-btn {
    background-color: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.side-btn:hover { background-color: rgba(255,255,255,0.2); }
.side-btn.red { border-bottom: 2px solid #e11d48; }
.side-btn.black { border-bottom: 2px solid #111827; }
.side-btn.green { border-bottom: 2px solid #059669; }

.countdown-bar {
    position: absolute;
    top: -4px; left: 0; right: 0; height: 4px;
    background: transparent;
    overflow: hidden;
    border-radius: 4px 4px 0 0;
}
.countdown-light {
    height: 100%;
    width: 0%;
    background-color: var(--accent-amber);
    transition: width 0.1s linear;
    box-shadow: 0 0 8px var(--accent-amber);
}

.bet-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

/* Poker UI */
.poker-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}
.poker-table {
    background-color: #064e3b;
    border: 6px solid #1f2937;
    border-radius: 60px;
    padding: 32px;
    min-width: 600px;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    position: relative;
}
.poker-hand {
    display: flex;
    gap: 8px;
}
.poker-card {
    width: 60px;
    height: 84px;
    background-color: #fff;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    position: relative;
    user-select: none;
}
.poker-card.hidden {
    background: repeating-linear-gradient(45deg, #1e40af, #1e40af 10px, #1d4ed8 10px, #1d4ed8 20px);
    border: 2px solid #fff;
    color: transparent;
}
.poker-card.red { color: #e11d48; }
.poker-card.black { color: #111827; }

.community-cards {
    display: flex;
    gap: 8px;
    min-height: 84px;
    padding: 12px;
    background-color: rgba(0,0,0,0.2);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
}
.poker-pot {
    background-color: rgba(0,0,0,0.4);
    color: var(--accent-amber);
    padding: 6px 16px;
    border-radius: 16px;
    font-weight: bold;
    font-size: 14px;
    border: 1px solid var(--accent-amber);
}
.poker-controls {
    display: flex;
    gap: 12px;
}
.poker-status {
    position: absolute;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 18px;
    color: #fff;
    z-index: 20;
    display: none;
    text-align: center;
    border: 1px solid var(--border-color);
}
.poker-player-info {
    color: #fff;
    font-size: 12px;
    text-align: center;
    margin-bottom: 4px;
    background: rgba(0,0,0,0.4);
    padding: 2px 8px;
    border-radius: 4px;
}

@media (max-width: 768px) {
    .dashboard { grid-template-columns: 1fr; grid-template-rows: auto; }
    .chart-panel, .news-panel, .market-panel, .history-panel { grid-column: auto; grid-row: auto; }
    .header { flex-direction: column; gap: 12px; }
    .poker-table { min-width: 100%; padding: 16px; border-radius: 20px; }
    .poker-card { width: 40px; height: 56px; font-size: 14px; }
    .community-cards { min-height: 56px; }
}
