/* Deathroll Web - Professional Dark Theme */

:root {
    --primary: #1E293B;
    --primary-light: #334155;
    --primary-dark: #0F172A;
    --accent: #FFD700;
    --accent-dark: #B8860B;
    --background: #0A0E1A;
    --surface: #1E293B;
    --surface-variant: #334155;
    --success: #10B981;
    --error: #EF4444;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-tertiary: #64748B;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

#app {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
    min-height: 100vh;
}

/* Screens */
.screen {
    display: none;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

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

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.screen-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent);
}

.icon-btn {
    background: transparent;
    border: none;
    font-size: 32px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    transition: transform 0.2s;
}

.icon-btn:active {
    transform: scale(0.9);
}

/* Glass Cards */
.glass-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
}

.title-card {
    text-align: center;
    padding: 32px 24px;
}

.title-card .emoji {
    font-size: 64px;
    margin-bottom: 16px;
}

.title-card h1 {
    font-size: 36px;
    font-weight: 900;
    letter-spacing: 4px;
    color: var(--accent);
    margin-bottom: 8px;
}

.title-card .subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

/* Menu Buttons */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.menu-btn {
    background: var(--surface);
    border: none;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.menu-btn.primary {
    background: rgba(255, 215, 0, 0.15);
}

.menu-btn:active {
    transform: scale(0.98);
}

.btn-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.btn-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-primary);
}

.menu-btn.primary .btn-title {
    color: var(--accent);
}

.btn-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.arrow {
    font-size: 24px;
    color: var(--text-secondary);
}

.menu-btn.primary .arrow {
    color: var(--accent);
}

.secondary-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px;
}

.secondary-btn {
    background: rgba(30, 41, 59, 0.3);
    border: 1px solid var(--surface-variant);
    border-radius: 8px;
    padding: 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-btn:active {
    transform: scale(0.95);
}

/* Game Screen */
.game-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    margin-bottom: 24px;
}

.label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.current-number {
    font-size: 64px;
    font-weight: bold;
    color: var(--accent);
}

.message {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
    min-height: 20px;
}

.dice-btn {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: var(--primary);
    border: none;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    margin: 0 auto 24px;
    display: block;
    transition: all 0.2s;
}

.dice-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

.dice-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.dice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* History */
.history-card {
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.history-card h3 {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-item {
    background: var(--primary-light);
    padding: 8px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    opacity: 0;
    animation: slideIn 0.3s ease forwards;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.history-item.player {
    background: rgba(51, 65, 85, 0.5);
}

.history-item.ai {
    background: rgba(30, 41, 59, 0.5);
}

.history-roll {
    font-weight: bold;
    color: var(--accent);
}

.history-roll.lost {
    color: var(--error);
}

/* Multiplayer */
.create-room-btn {
    width: 100%;
    background: var(--accent);
    color: var(--primary-dark);
    border: none;
    border-radius: 12px;
    padding: 16px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 16px;
    transition: all 0.2s;
}

.create-room-btn:active {
    transform: scale(0.98);
}

.rooms-card {
    padding: 16px;
    min-height: 400px;
}

.rooms-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.room-card {
    background: var(--surface-variant);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.room-info {
    flex: 1;
}

.room-name {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-primary);
}

.room-details {
    font-size: 12px;
    color: var(--text-secondary);
}

.join-btn {
    background: var(--success);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
}

/* Debug Console */
.debug-console {
    position: fixed;
    top: 8px;
    left: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 8px;
    padding: 12px;
    display: none;
    z-index: 1000;
    max-height: 200px;
    overflow: hidden;
}

.debug-console.active {
    display: block;
}

.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 255, 0, 0.3);
    font-size: 10px;
    font-weight: bold;
    color: #00FF00;
    font-family: monospace;
}

.debug-buttons {
    display: flex;
    gap: 8px;
}

.debug-buttons button {
    background: transparent;
    border: none;
    color: #FFAA00;
    font-size: 10px;
    cursor: pointer;
    font-family: monospace;
}

.debug-logs {
    font-family: monospace;
    font-size: 8px;
    max-height: 100px;
    overflow-y: auto;
    color: #00FF00;
}

.debug-log {
    margin: 2px 0;
    word-wrap: break-word;
}

.debug-log.info { color: #00FF00; }
.debug-log.debug { color: #00FFFF; }
.debug-log.warning { color: #FFFF00; }
.debug-log.error { color: #FF0000; }

.debug-toggle {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(26, 26, 26, 0.8);
    border: none;
    font-size: 20px;
    cursor: pointer;
    z-index: 999;
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 215, 0, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 16px;
}

.empty-state .emoji {
    font-size: 48px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Mobile Optimizations */
@media (max-width: 600px) {
    #app {
        padding: 12px;
    }
    
    .current-number {
        font-size: 56px;
    }
}

/* Multiplayer Game */
.players-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.player-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
}

.player-card.active {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid var(--accent);
}

.player-label {
    font-size: 10px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.player-name-large {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.active-indicator {
    font-size: 16px;
    color: transparent;
}

.player-card.active .active-indicator {
    color: var(--success);
}

.loading-spinner {
    text-align: center;
    padding: 24px;
}

/* Utility */
.hidden {
    display: none !important;
}


