:root {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --border-color: #334155;
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --accent-cyan: #00f2fe;
    --accent-cyan-hover: #00c6ff;
    --success: #10b981;
    --danger: #ef4444;
    --nav-bg: #1e293b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 70px; /* Espacio para la barra de navegación inferior */
}

/* --- HEADER --- */
.game-header {
    text-align: center;
    padding: 24px 16px 12px;
}

.logo {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: 4px;
}

.cyan-dot {
    color: var(--accent-cyan);
}

.tagline {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    margin-top: 4px;
}

/* --- CONTENEDOR PRINCIPAL --- */
.main-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
    flex: 1;
}

/* --- PANTALLAS Y VISTAS --- */
.sub-screen, .view-section {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px 20px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.section-title {
    font-size: 1.4rem;
    margin-bottom: 8px;
}

.section-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.topic-box {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--accent-cyan);
    margin: 16px 0;
    padding: 12px;
    background: rgba(0, 242, 254, 0.08);
    border-radius: 8px;
    border: 1px dashed var(--accent-cyan);
}

.rules-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 20px;
}

/* --- BOTONES --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.2s ease;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-cyan-hover));
    color: #0f172a;
}

.btn-google {
    background-color: #ffffff;
    color: #333333;
}

.btn-google img {
    width: 20px;
    height: 20px;
}

.btn-logout-link {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
    margin-top: 16px;
}

/* --- ESTADO DEL JUEGO Y TEMPORIZADOR --- */
.game-status-bar {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.game-status-bar strong {
    color: var(--text-primary);
}

.timer-container {
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.timer-bar {
    height: 100%;
    width: 100%;
    background-color: var(--accent-cyan);
    transition: width 0.03s linear;
}

.timer-text {
    text-align: right;
    font-size: 0.8rem;
    font-family: monospace;
    color: var(--accent-cyan);
    margin-bottom: 20px;
}

.question-text {
    font-size: 1.15rem;
    line-height: 1.4;
    margin-bottom: 20px;
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-btn {
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.option-btn:hover {
    background-color: rgba(0, 242, 254, 0.1);
    border-color: var(--accent-cyan);
}

/* --- RESULTADOS Y RESUMEN --- */
.score-card {
    background-color: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 20px;
    margin: 16px 0;
    border: 1px solid var(--border-color);
}

.card-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.big-score {
    font-size: 2.8rem;
    font-weight: 900;
    color: var(--accent-cyan);
    margin: 6px 0;
}

.sub-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.failed-summary {
    margin: 20px 0;
    text-align: left;
    background-color: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    padding: 14px;
}

.summary-title {
    font-size: 0.9rem;
    color: var(--danger);
    margin-bottom: 10px;
}

.failed-item {
    margin-bottom: 10px;
    font-size: 0.85rem;
    padding-bottom: 8px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.failed-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.failed-q {
    color: var(--text-primary);
}

.failed-a {
    color: var(--success);
    margin-top: 2px;
}

.info-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* --- HISTORIAL DE TEMAS CON SCROLL INTERNO --- */
.themes-log-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 6px;
}

.themes-log-list::-webkit-scrollbar {
    width: 6px;
}

.themes-log-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.themes-log-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.themes-log-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent-cyan);
}

.theme-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.85rem;
}

.theme-date {
    color: var(--text-muted);
    font-size: 0.75rem;
    min-width: 80px;
}

.theme-name {
    flex: 1;
    margin: 0 10px;
    font-weight: 500;
}

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

.status-played {
    color: var(--accent-cyan);
}

.status-missed {
    color: var(--text-muted);
    font-style: italic;
    font-weight: normal;
}

/* --- PANEL ANALÍTICO --- */
.stats-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.stat-box {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
}

.stat-num {
    display: block;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent-cyan);
}

.stat-lbl {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* --- CONTENEDOR DE LA GRÁFICA --- */
.chart-wrapper {
    position: relative;
    width: 100%;
    height: 320px;
    margin: 20px 0;
}

/* --- NAVEGACIÓN INFERIOR --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: var(--nav-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: bold;
    padding: 10px 16px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.nav-item.active {
    color: var(--accent-cyan);
    border-bottom: 2px solid var(--accent-cyan);
}