* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-light: #F7F9FC;
    --bg-dark: #0F172A;
    --card-light: #FFFFFF;
    --card-dark: #1E293B;
    --text-light: #1A202C;
    --text-dark: #E2E8F0;
    --primary: #3B82F6;
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --border-light: #E5E7EB;
    --border-dark: #334155;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(to bottom, #87CEEB 0%, #E0F6FF 100%);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.3s ease;
}

body.dark-mode {
    background: linear-gradient(to bottom, #1a1a2e 0%, #16213e 100%);
}

#app-container {
    display: flex;
    min-height: 100vh;
    max-width: 1920px;
    margin: 0 auto;
    position: relative;
}

.panel {
    flex: 1;
    min-width: 0;
}

/* ================================
   GAME PANEL (Left)
   ================================ */

#game-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    position: relative;
}

.game-header {
    width: 100%;
    max-width: 400px;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 10;
}

h1 {
    font-size: 28px;
    color: white;
    text-shadow: 3px 3px 0 #2c3e50, -1px -1px 0 #2c3e50, 1px -1px 0 #2c3e50, -1px 1px 0 #2c3e50;
    letter-spacing: 2px;
}

#scores {
    display: flex;
    gap: 20px;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-label {
    font-size: 12px;
    color: #2c3e50;
    font-weight: bold;
}

#current-score, #high-score {
    font-size: 24px;
    color: white;
    text-shadow: 2px 2px 0 #2c3e50;
    font-weight: bold;
}

#settings-btn {
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.2s;
}

#settings-btn:hover {
    transform: scale(1.1);
}

#settings-panel {
    position: absolute;
    top: 70px;
    right: 20px;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    z-index: 100;
    min-width: 200px;
}

#settings-panel.hidden {
    display: none;
}

#settings-panel h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.setting-row label {
    font-weight: bold;
    color: #2c3e50;
}

.toggle-btn {
    background: #5CBF3C;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 5px 15px;
    cursor: pointer;
    font-weight: bold;
}

.toggle-btn.off {
    background: #e74c3c;
}

#difficulty-select {
    padding: 5px 10px;
    border-radius: 8px;
    border: 2px solid #2c3e50;
    font-weight: bold;
    cursor: pointer;
}

#reset-highscore, #close-settings {
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    border: none;
    border-radius: 10px;
    background: #e74c3c;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

#close-settings {
    background: #3498db;
}

#reset-highscore:hover {
    background: #c0392b;
}

#close-settings:hover {
    background: #2980b9;
}

#canvas {
    display: block;
    width: 100%;
    max-width: 400px;
    height: 600px;
    background: linear-gradient(to bottom, #87CEEB 0%, #E0F6FF 70%);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    cursor: pointer;
}

.screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 50;
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    max-width: 320px;
}

.screen.hidden {
    display: none;
}

.screen-content h2 {
    font-size: 36px;
    color: #2c3e50;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0 #ecf0f1;
}

.pulse {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.instructions {
    font-size: 16px;
    color: #34495e;
    margin-bottom: 20px;
}

.motivation {
    font-size: 14px;
    color: #7f8c8d;
    font-style: italic;
}

#medal-container {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#medal {
    font-size: 60px;
    margin-bottom: 10px;
}

#medal-text {
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
}

.final-score {
    font-size: 24px;
    color: #2c3e50;
    margin: 20px 0;
    font-weight: bold;
}

.combo-message {
    font-size: 14px;
    color: #e67e22;
    font-weight: bold;
    margin-bottom: 15px;
    min-height: 20px;
}

#play-again-btn, #share-btn {
    width: 100%;
    padding: 15px 30px;
    margin: 10px 0;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

#play-again-btn {
    background: #5CBF3C;
    color: white;
}

#share-btn {
    background: #3498db;
    color: white;
}

#play-again-btn:hover, #share-btn:hover {
    transform: scale(1.05);
}

/* ================================
   DIVIDER
   ================================ */

.divider {
    width: 2px;
    background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.1), transparent);
    position: relative;
    flex-shrink: 0;
}

.divider-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* ================================
   DASHBOARD PANEL (Right)
   ================================ */

#dashboard-panel {
    background: var(--bg-light);
    color: var(--text-light);
    transition: all 0.3s ease;
}

body.dark-mode #dashboard-panel {
    background: var(--bg-dark);
    color: var(--text-dark);
}

.dashboard-container {
    height: 100%;
    overflow-y: auto;
}

.dashboard-header {
    background: var(--card-light);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
}

body.dark-mode .dashboard-header {
    background: var(--card-dark);
    border-bottom-color: var(--border-dark);
}

.dashboard-title h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.tagline {
    font-size: 12px;
    color: #6B7280;
}

.dashboard-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.icon-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(0,0,0,0.05);
}

body.dark-mode .icon-btn:hover {
    background: rgba(255,255,255,0.1);
}

.notification-btn {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--error);
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
    font-weight: bold;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.dashboard-layout {
    display: flex;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: var(--card-light);
    border-right: 1px solid var(--border-light);
    padding: 20px 0;
    transition: width 0.3s ease;
    position: relative;
}

body.dark-mode .sidebar {
    background: var(--card-dark);
    border-right-color: var(--border-dark);
}

.sidebar.collapsed {
    width: 70px;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    text-align: left;
}

body.dark-mode .nav-item {
    color: var(--text-dark);
}

.nav-item:hover {
    background: rgba(59, 130, 246, 0.1);
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-icon {
    font-size: 18px;
    min-width: 20px;
}

.sidebar.collapsed .nav-label {
    display: none;
}

.sidebar-toggle {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 12px;
}

/* Main Content */
.dashboard-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: var(--card-light);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

body.dark-mode .metric-card {
    background: var(--card-dark);
}

.metric-card:hover {
    transform: translateY(-2px);
}

.metric-label {
    font-size: 12px;
    color: #6B7280;
    font-weight: 500;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.metric-unit {
    font-size: 16px;
    font-weight: 400;
}

.metric-change {
    font-size: 12px;
    font-weight: 600;
}

.metric-change.positive {
    color: var(--success);
}

.metric-indicator {
    margin-top: 8px;
    font-size: 16px;
}

.widget {
    background: var(--card-light);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

body.dark-mode .widget {
    background: var(--card-dark);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.widget-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.badge {
    background: var(--warning);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
}

.live-indicator {
    font-size: 12px;
    color: var(--error);
    font-weight: 600;
}

.gaming-widget {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.gaming-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.gaming-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gaming-stat span {
    font-size: 12px;
    opacity: 0.9;
}

.gaming-stat strong {
    font-size: 20px;
    font-weight: 700;
}

.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.activity-feed {
    max-height: 400px;
}

.activity-list {
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: rgba(0,0,0,0.02);
    transition: background 0.2s;
}

body.dark-mode .activity-item {
    background: rgba(255,255,255,0.05);
}

.activity-item:hover {
    background: rgba(59, 130, 246, 0.1);
}

.activity-status {
    font-weight: bold;
}

.activity-item.success .activity-status {
    color: var(--success);
}

.activity-item.error .activity-status {
    color: var(--error);
}

.activity-item.processing .activity-status {
    color: var(--warning);
}

.activity-text {
    flex: 1;
    font-size: 13px;
}

.activity-time {
    font-size: 11px;
    color: #6B7280;
}

.graph-toggles {
    display: flex;
    gap: 8px;
}

.graph-toggle {
    padding: 6px 12px;
    border: 1px solid var(--border-light);
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

body.dark-mode .graph-toggle {
    border-color: var(--border-dark);
}

.graph-toggle.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

#usage-chart {
    width: 100%;
    height: 200px;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.action-btn {
    padding: 12px 20px;
    border: 1px solid var(--border-light);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

body.dark-mode .action-btn {
    background: var(--card-dark);
    border-color: var(--border-dark);
    color: var(--text-dark);
}

.action-btn.primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.search-input {
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 14px;
    width: 250px;
}

body.dark-mode .search-input {
    background: var(--card-dark);
    border-color: var(--border-dark);
    color: var(--text-dark);
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 12px;
    font-weight: 600;
    font-size: 12px;
    color: #6B7280;
    border-bottom: 2px solid var(--border-light);
}

body.dark-mode th {
    border-bottom-color: var(--border-dark);
}

th.sortable {
    cursor: pointer;
}

th.sortable:hover {
    color: var(--primary);
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}

body.dark-mode td {
    border-bottom-color: var(--border-dark);
}

.deployment-row {
    transition: background 0.2s;
    cursor: pointer;
}

.deployment-row:hover {
    background: rgba(0,0,0,0.02);
}

body.dark-mode .deployment-row:hover {
    background: rgba(255,255,255,0.05);
}

.deployment-details {
    background: rgba(59, 130, 246, 0.05);
}

.details-content {
    padding: 15px;
}

.details-content p {
    margin-bottom: 8px;
    font-size: 13px;
}

.table-action {
    padding: 6px 12px;
    margin-right: 6px;
    border: 1px solid var(--border-light);
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

body.dark-mode .table-action {
    border-color: var(--border-dark);
}

.table-action:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.billing-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.billing-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
    margin: 0 12px;
    overflow: hidden;
}

body.dark-mode .progress-bar {
    background: rgba(255,255,255,0.1);
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

.progress-label {
    font-size: 12px;
    color: #6B7280;
}

/* Toast notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.toast {
    background: white;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-bottom: 10px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    font-size: 14px;
    max-width: 300px;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--error);
}

.toast-info {
    border-left: 4px solid var(--primary);
}

/* Confetti animation */
.confetti {
    position: fixed;
    font-size: 24px;
    animation: confetti-fall 3s linear forwards;
    z-index: 9999;
    pointer-events: none;
}

@keyframes confetti-fall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Footer */
.app-footer {
    background: rgba(0,0,0,0.05);
    padding: 20px;
    text-align: center;
    font-size: 12px;
    color: #6B7280;
    margin-top: 40px;
}

body.dark-mode .app-footer {
    background: rgba(255,255,255,0.05);
}

.app-footer a {
    color: var(--error);
    text-decoration: none;
    font-weight: bold;
}

.app-footer a:hover {
    text-decoration: underline;
}

.footer-credits {
    margin: 8px 0;
    font-style: italic;
}

.disclaimer {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 8px;
}

/* Responsive */
@media (max-width: 1024px) {
    #app-container {
        flex-direction: column;
    }
    
    .divider {
        height: 2px;
        width: 100%;
    }
    
    .divider-logo {
        left: 50%;
        top: 50%;
    }
    
    .two-column {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-light);
    }
    
    .dashboard-layout {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .gaming-stats {
        grid-template-columns: 1fr;
    }
    
    .dashboard-content {
        padding: 15px;
    }
}