/* ============================================
   RoboKeno - Keno Game Styles
   ============================================ */

.keno-container {
    --bg-dark: #0d0d12;
    --bg-card: #16161f;
    --bg-card-hover: #1c1c28;
    --border: #2a2a3e;
    --text: #e8e6e3;
    --text-muted: #9a9590;
    --accent: #d4a853;
    --accent-glow: rgba(212, 168, 83, 0.35);
    --success: #4ade80;
    --danger: #f87171;
    --radius: 12px;
    --font-head: 'Orbitron', sans-serif;
    --font-body: 'Exo 2', sans-serif;

    font-family: var(--font-body);
    color: var(--text);
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ---- Header ---- */

.keno-header {
    margin-bottom: 20px;
}

.keno-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.keno-title {
    font-family: var(--font-head);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 3px;
    margin: 0;
    color: var(--text);
}

.keno-title-accent {
    color: var(--accent);
    text-shadow: 0 0 20px var(--accent-glow);
}

.keno-balance-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 20px;
}

.keno-balance-label {
    font-family: var(--font-head);
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--text-muted);
}

.keno-balance-amount {
    font-family: var(--font-head);
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    text-shadow: 0 0 12px var(--accent-glow);
    min-width: 120px;
    text-align: right;
}

/* ---- Main Layout ---- */

.keno-main {
    display: grid;
    grid-template-columns: 220px 1fr 220px;
    gap: 20px;
    align-items: start;
}

/* ---- Panels / Sidebars ---- */

.keno-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.keno-panel-title {
    font-family: var(--font-head);
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin: 0 0 12px 0;
    text-transform: uppercase;
}

/* ---- Pay Table ---- */

.keno-picks-info {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.keno-paytable {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.keno-paytable-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 13px;
    transition: background 0.2s;
}

.keno-paytable-row:hover {
    background: var(--bg-card-hover);
}

.keno-paytable-row.active {
    background: rgba(212, 168, 83, 0.1);
    border: 1px solid rgba(212, 168, 83, 0.2);
}

.keno-paytable-hits {
    color: var(--text-muted);
}

.keno-paytable-multi {
    font-weight: 600;
    color: var(--accent);
}

/* ---- History ---- */

.keno-history {
    max-height: 200px;
    overflow-y: auto;
}

.keno-history-empty {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 12px;
}

.keno-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 12px;
    border-bottom: 1px solid rgba(42, 42, 62, 0.5);
}

.keno-history-item:last-child {
    border-bottom: none;
}

.keno-history-item .hist-hits {
    color: var(--text-muted);
}

.keno-history-item .hist-payout {
    font-weight: 600;
}

.keno-history-item .hist-payout.win {
    color: var(--success);
}

.keno-history-item .hist-payout.loss {
    color: var(--danger);
}

/* ---- Board Area ---- */

.keno-board-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Win display */

.keno-win-display {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.08), rgba(212, 168, 83, 0.08));
    border: 1px solid rgba(74, 222, 128, 0.2);
    border-radius: var(--radius);
    text-align: center;
}

.keno-win-display.visible {
    display: flex;
    animation: winPop 0.5s ease-out;
}

.keno-win-display.loss {
    background: linear-gradient(135deg, rgba(248, 113, 113, 0.06), rgba(42, 42, 62, 0.1));
    border-color: rgba(248, 113, 113, 0.15);
}

.keno-win-label {
    font-family: var(--font-head);
    font-size: 10px;
    letter-spacing: 3px;
    color: var(--text-muted);
}

.keno-win-amount {
    font-family: var(--font-head);
    font-size: 36px;
    font-weight: 700;
    color: var(--success);
    text-shadow: 0 0 20px rgba(74, 222, 128, 0.4);
}

.keno-win-display.loss .keno-win-amount {
    color: var(--danger);
    text-shadow: none;
    font-size: 20px;
}

.keno-win-display.loss .keno-win-label {
    display: none;
}

.keno-win-chips {
    font-family: var(--font-head);
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--text-muted);
}

@keyframes winPop {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

/* Status bar */

.keno-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.keno-pick-counter {
    font-family: var(--font-head);
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--accent);
}

.keno-draw-status {
    font-size: 12px;
    color: var(--text-muted);
}

/* ---- Number Grid ---- */

.keno-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.keno-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-head);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.keno-cell:hover:not(.selected):not(.drawn):not(.disabled) {
    background: var(--bg-card-hover);
    border-color: rgba(212, 168, 83, 0.3);
    color: var(--text);
    transform: scale(1.05);
}

.keno-cell.selected {
    background: linear-gradient(135deg, var(--accent), #c49a40);
    border-color: var(--accent);
    color: #0d0d12;
    box-shadow: 0 0 12px var(--accent-glow);
}

.keno-cell.disabled {
    cursor: default;
    opacity: 0.7;
}

.keno-cell.drawn-hit {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-color: var(--success);
    color: #fff;
    box-shadow: 0 0 16px rgba(74, 222, 128, 0.4);
    animation: hitPulse 0.6s ease-out;
    z-index: 2;
}

.keno-cell.drawn-miss-on-board {
    background: rgba(248, 113, 113, 0.1);
    border-color: rgba(248, 113, 113, 0.25);
    color: var(--danger);
}

.keno-cell.selected-not-drawn {
    background: linear-gradient(135deg, #b8932e, #a07e28);
    border-color: #a07e28;
    color: #0d0d12;
    opacity: 0.55;
    box-shadow: none;
}

.keno-cell.drawn-reveal {
    animation: cellReveal 0.3s ease-out;
}

@keyframes hitPulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes cellReveal {
    0% { transform: scale(0.6); opacity: 0.3; }
    100% { transform: scale(1); opacity: 1; }
}

/* ---- Controls ---- */

.keno-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    flex-wrap: wrap;
}

.keno-controls-left,
.keno-controls-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.keno-controls-center {
    display: flex;
    align-items: center;
    gap: 12px;
}

.keno-btn {
    font-family: var(--font-head);
    font-size: 11px;
    letter-spacing: 1px;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.keno-btn-secondary {
    background: var(--bg-card-hover);
    color: var(--text);
    border: 1px solid var(--border);
}

.keno-btn-secondary:hover {
    background: #252535;
    border-color: var(--accent);
    color: var(--accent);
}

.keno-btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
}

.keno-btn-ghost:hover {
    color: var(--text);
    border-color: var(--border);
}

.keno-btn-play {
    background: linear-gradient(135deg, var(--accent), #c49a40, #b8892e);
    color: #0d0d12;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    padding: 12px 32px;
    box-shadow: 0 0 20px var(--accent-glow);
}

.keno-btn-play:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 0 30px var(--accent-glow), 0 4px 12px rgba(0,0,0,0.3);
}

.keno-btn-play:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.keno-btn-play:active:not(:disabled) {
    transform: translateY(1px);
}

.keno-btn-danger {
    background: var(--danger);
    color: #fff;
    font-weight: 600;
}

.keno-btn-danger:hover {
    background: #ef4444;
}

/* Bet selector */

.keno-bet-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.keno-bet-label {
    font-family: var(--font-head);
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--text-muted);
}

.keno-chips {
    display: flex;
    gap: 4px;
}

.keno-chip {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-head);
    font-size: 12px;
    font-weight: 700;
    border: 2px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.keno-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.keno-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #0d0d12;
    box-shadow: 0 0 10px var(--accent-glow);
}

/* Auto-play */

.keno-autoplay-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.keno-autoplay-label {
    font-family: var(--font-head);
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--text-muted);
}

.keno-autoplay-options {
    display: flex;
    gap: 4px;
}

.keno-autoplay-btn {
    font-family: var(--font-head);
    font-size: 11px;
    background: var(--bg-dark);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.keno-autoplay-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.keno-autoplay-btn.active {
    background: rgba(212, 168, 83, 0.15);
    border-color: var(--accent);
    color: var(--accent);
}

.keno-autoplay-counter {
    font-family: var(--font-head);
    font-size: 11px;
    color: var(--accent);
    min-width: 80px;
}

.keno-autoplay-stop {
    padding: 5px 14px;
    font-size: 10px;
}

/* ---- Drawn Numbers (right sidebar) ---- */

.keno-drawn-numbers {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.keno-drawn-empty {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    padding: 12px;
}

.keno-drawn-num {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border-radius: 6px;
    font-family: var(--font-head);
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.keno-drawn-num.is-hit {
    background: rgba(74, 222, 128, 0.12);
    border-color: rgba(74, 222, 128, 0.3);
    color: var(--success);
    font-weight: 700;
}

/* ---- Match Summary ---- */

.keno-match-summary {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.keno-match-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
}

.keno-match-label {
    color: var(--text-muted);
}

.keno-match-value {
    font-weight: 600;
    color: var(--text);
}

.keno-match-row-payout .keno-match-value {
    color: var(--accent);
    font-family: var(--font-head);
    font-size: 14px;
}

/* ---- Drawing Animation Overlay ---- */

.keno-drawing-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 100;
}

/* ---- Responsive ---- */

@media (max-width: 1100px) {
    .keno-main {
        grid-template-columns: 1fr;
    }

    .keno-sidebar {
        order: 2;
    }

    .keno-sidebar-left {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .keno-sidebar-left .keno-panel {
        margin-bottom: 0;
    }

    .keno-sidebar-right {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .keno-sidebar-right .keno-panel {
        margin-bottom: 0;
    }

    .keno-board-area {
        order: 1;
    }

    .keno-grid {
        gap: 4px;
        padding: 12px;
    }

    .keno-cell {
        font-size: 12px;
        border-radius: 6px;
    }
}

@media (max-width: 640px) {
    .keno-container {
        padding: 10px;
    }

    .keno-title {
        font-size: 20px;
    }

    .keno-sidebar-left,
    .keno-sidebar-right {
        grid-template-columns: 1fr;
    }

    .keno-grid {
        gap: 3px;
        padding: 8px;
    }

    .keno-cell {
        font-size: 11px;
        border-radius: 4px;
    }

    .keno-controls {
        flex-direction: column;
        gap: 10px;
    }

    .keno-controls-left,
    .keno-controls-center,
    .keno-controls-right {
        width: 100%;
        justify-content: center;
    }

    .keno-btn-play {
        width: 100%;
        justify-content: center;
    }

    .keno-chip {
        width: 34px;
        height: 34px;
        font-size: 11px;
    }

    .keno-autoplay-bar {
        flex-wrap: wrap;
        justify-content: center;
    }

    .keno-win-amount {
        font-size: 28px;
    }
}

/* ---- Scrollbar ---- */

.keno-history::-webkit-scrollbar {
    width: 4px;
}

.keno-history::-webkit-scrollbar-track {
    background: transparent;
}

.keno-history::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* ---- Utility animation ---- */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.keno-fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Shake animation for errors */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.keno-shake {
    animation: shake 0.4s ease-out;
}

/* Win amount count-up glow */
@keyframes glowPulse {
    0%, 100% { text-shadow: 0 0 20px rgba(74, 222, 128, 0.4); }
    50% { text-shadow: 0 0 40px rgba(74, 222, 128, 0.7), 0 0 60px rgba(74, 222, 128, 0.3); }
}

.keno-win-glow {
    animation: glowPulse 1s ease-in-out 2;
}
