/* ==========================================================================
   ESTILOS GENERALES Y VARIABLES DE DISEÑO
   Tema cósmico oscuro con efecto de vidrio esmerilado (Glassmorphism)
   Optimizado para móvil (Mobile-First) y escritorio
   ========================================================================== */

:root {
    --bg-space: #030712;
    --bg-card: rgba(15, 23, 42, 0.78);
    --bg-card-hover: rgba(30, 41, 59, 0.88);
    --bg-glass-panel: rgba(15, 23, 42, 0.75);
    --border-glass: rgba(255, 255, 255, 0.14);
    --border-focus: #f59e0b;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8; /* Alto contraste para lectura óptima */
    --text-highlight: #fbbf24;

    --accent-gold: #f59e0b;
    --accent-gold-glow: rgba(245, 158, 11, 0.4);
    --accent-blue: #38bdf8;
    --accent-blue-glow: rgba(56, 189, 248, 0.35);
    --accent-cyan: #38bdf8;
    --accent-red: #f43f5e;
    --accent-emerald: #10b981;

    --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px var(--accent-gold-glow);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-space);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 14px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   ESTRUCTURA PRINCIPAL DE LA APLICACIÓN
   ========================================================================== */

#app-container {
    position: relative;
    width: 100%;
    height: 100%;
    height: 100dvh; /* Altura dinámica en navegadores móviles */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Canvas del eclipse */
.canvas-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#eclipseCanvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* Capa de interfaz superpuesta */
.ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
    padding: 10px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
}

.ui-overlay > * {
    pointer-events: auto;
}

/* ==========================================================================
   SECCIÓN SUPERIOR AGRUPADA (CABECERA + AVISOS + TELEMETRÍA)
   ========================================================================== */

.top-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    pointer-events: none;
}

.top-section > * {
    pointer-events: auto;
}

/* Cabecera superior */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: var(--bg-glass-panel);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    box-shadow: var(--shadow-soft);
    width: 100%;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
    padding: 3px 6px;
    border-radius: var(--radius-md);
    transition: background-color 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
}

.brand-section:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

.brand-section:active {
    transform: scale(0.97);
    background-color: rgba(255, 255, 255, 0.1);
}

.brand-section:focus-visible {
    outline: 2px solid var(--accent-gold);
    outline-offset: 2px;
}

.brand-icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: var(--radius-full);
    background: radial-gradient(circle, #f59e0b 20%, #1e1b4b 70%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 10px var(--accent-gold-glow);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand-section:hover .brand-icon {
    transform: rotate(20deg) scale(1.08);
}

.brand-title-wrap {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brand-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.brand-version {
    font-size: 10px;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--accent-gold);
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-sm);
    padding: 1px 5px;
    letter-spacing: 0.2px;
    line-height: 1.2;
    display: inline-block;
    flex-shrink: 0;
}

.brand-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 1;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.header-actions::-webkit-scrollbar {
    display: none;
}

.btn-header {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    padding: 6px 10px;
    min-height: 36px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-header:hover {
    background: rgba(255, 255, 255, 0.16);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.25);
}

.btn-header.active {
    background: var(--accent-gold);
    color: #0f172a;
    border-color: var(--accent-gold);
    font-weight: 600;
}

.btn-live-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    padding: 5px 10px;
    min-height: 32px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-live-toggle:hover {
    background: rgba(255, 255, 255, 0.16);
    color: var(--text-primary);
}

.btn-live-toggle.active {
    background: var(--accent-gold);
    color: #0f172a;
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px var(--accent-gold-glow);
    font-weight: 600;
}

.eclipse-selector-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.select-eclipse-dropdown {
    background-color: rgba(15, 23, 42, 0.92) !important;
    border: 1px solid var(--accent-gold) !important;
    color: #fbbf24 !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    padding: 4px 22px 4px 8px !important;
    min-height: 34px !important;
    border-radius: var(--radius-sm) !important;
    cursor: pointer !important;
    outline: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23fbbf24' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 6px center !important;
    max-width: 142px;
}

.select-eclipse-dropdown:hover, .select-eclipse-dropdown:focus {
    background-color: rgba(30, 41, 59, 0.95) !important;
}

.select-eclipse-dropdown option {
    background: #0f172a !important;
    color: #f8fafc !important;
}

/* Banner de seguridad visual */
.safety-banner {
    align-self: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(244, 63, 94, 0.2);
    border: 1px solid rgba(244, 63, 94, 0.4);
    border-radius: var(--radius-full);
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 600;
    color: #fecdd3;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    white-space: nowrap;
    max-width: 95%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.safety-banner.totality-safe {
    background: rgba(16, 185, 129, 0.25);
    border-color: rgba(16, 185, 129, 0.5);
    color: #a7f3d0;
}

/* ==========================================================================
   TELEMETRÍA SUPERIOR COMPACTA (COBERTURA Y ORIENTACIÓN)
   ========================================================================== */

.telemetry-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    width: 100%;
}

/* Tarjeta de cobertura compacta */
.card-coverage {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: var(--bg-glass-panel);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-soft);
    flex: 1;
    min-width: 0;
}

.coverage-gauge {
    position: relative;
    width: 42px;
    height: 42px;
    min-width: 42px;
}

.coverage-gauge svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.gauge-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 6;
}

.gauge-progress {
    fill: none;
    stroke: var(--accent-gold);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 169.64;
    stroke-dashoffset: 169.64;
    transition: stroke-dashoffset 0.3s ease;
}

.gauge-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.coverage-details {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.phase-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-gold);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.time-countdown {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    white-space: nowrap;
}

/* Tarjeta de coordenadas y orientación */
.card-orientation {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: var(--bg-glass-panel);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-soft);
    flex-shrink: 0;
}

.compass-mini {
    position: relative;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-glass);
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.compass-needle {
    width: 2px;
    height: 20px;
    background: linear-gradient(to bottom, var(--accent-red) 50%, #e2e8f0 50%);
    border-radius: 2px;
    transition: transform 0.3s ease;
}

.orientation-data {
    font-size: 10px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.2;
    white-space: nowrap;
}

.orientation-data span {
    color: var(--text-primary);
    font-weight: 600;
    font-family: var(--font-mono);
}

/* ==========================================================================
   PANEL INFERIOR Y LÍNEA DE TIEMPO (TIMELINE / SIMULACIÓN COMPACTA)
   ========================================================================== */

.bottom-controls {
    display: flex;
    flex-direction: column;
    gap: 4px;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    background: rgba(15, 23, 42, 0.70);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 6px 10px;
    box-shadow: var(--shadow-soft);
    width: 100%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 260px;
    overflow: hidden;
}

/* Barra superior del panel con estado rápido y tirador */
.bottom-controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    min-height: 20px;
    gap: 8px;
}

.bottom-status-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.live-dot-indicator {
    display: inline-block;
    width: 7px;
    height: 7px;
    min-width: 7px;
    border-radius: 50%;
    background: var(--accent-emerald);
    box-shadow: 0 0 6px var(--accent-emerald);
    animation: pulseDot 2s infinite ease-in-out;
}

.live-dot-indicator.simulating {
    background: var(--accent-gold);
    box-shadow: 0 0 6px var(--accent-gold);
}

@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(0.85); }
}

.compact-time {
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    letter-spacing: 0.2px;
}

.compact-phase {
    font-size: 10px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-panel-toggle {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    border-radius: var(--radius-full);
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-panel-toggle:hover {
    background: rgba(255, 255, 255, 0.16);
    color: var(--text-primary);
}

.icon-toggle {
    transition: transform 0.3s ease;
}

/* Estado Plegado / Colapsado */
.bottom-controls.is-collapsed {
    max-height: 38px;
    padding: 5px 10px;
    background: rgba(15, 23, 42, 0.55);
}

.bottom-controls.is-collapsed .icon-toggle {
    transform: rotate(180deg);
}

.bottom-controls.is-collapsed .bottom-controls-content {
    opacity: 0;
    pointer-events: none;
    max-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.bottom-controls-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    transition: opacity 0.25s ease, max-height 0.3s ease;
    max-height: 240px;
    opacity: 1;
}

/* Fila de hitos de contacto (C1, C2, Máximo, C3, C4) */
.timeline-contacts-bar {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 3px;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.timeline-contacts-bar::-webkit-scrollbar {
    display: none;
}

.contact-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-size: 9.5px;
    font-weight: 600;
    padding: 2px 4px;
    min-width: 48px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
    flex: 1;
    text-align: center;
}

.contact-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.12);
}

.contact-btn.active {
    color: var(--accent-gold);
    border-color: rgba(245, 158, 11, 0.5);
    background: rgba(245, 158, 11, 0.2);
}

.contact-btn .time-label {
    font-size: 8px;
    font-weight: 400;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

/* Barra de desplazamiento temporal (Scrubber) */
.scrubber-container {
    position: relative;
    width: 100%;
    height: 18px;
    display: flex;
    align-items: center;
    touch-action: none;
}

.scrubber-track {
    position: relative;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.scrubber-totality-zone {
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #ef4444, #f59e0b);
    border-radius: var(--radius-full);
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
}

.scrubber-input {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 5;
}

.scrubber-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--accent-blue);
    border-radius: var(--radius-full);
    pointer-events: none;
}

.scrubber-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: var(--radius-full);
    background: #ffffff;
    border: 2px solid var(--accent-gold);
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.8), 0 0 10px var(--accent-gold-glow);
    pointer-events: none;
    z-index: 4;
}

/* Fila de reproducción y velocidades */
.playback-controls {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.playback-controls-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 6px;
}

.time-display {
    display: flex;
    flex-direction: column;
    min-width: 70px;
}

.sim-time {
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    letter-spacing: 0.2px;
    line-height: 1.1;
}

.sim-mode-tag {
    font-size: 8.5px;
    color: var(--text-muted);
}

/* Fila dedicada de meteorología en directo */
.live-weather-bar {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 3px;
}

.live-weather-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: var(--radius-full);
    padding: 3px 12px;
    font-size: 11px;
    color: var(--text-primary);
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.live-weather-pill.live-active {
    border-color: rgba(16, 185, 129, 0.55);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.25);
    background: rgba(16, 185, 129, 0.14);
}

.weather-pill-icon {
    font-size: 12px;
    line-height: 1;
    flex-shrink: 0;
}

.weather-pill-text {
    font-weight: 600;
    color: var(--accent-cyan);
    font-size: 10.5px;
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.weather-pill-text::-webkit-scrollbar {
    display: none;
}

.player-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-ctrl {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-ctrl:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-ctrl.btn-play {
    width: 32px;
    height: 32px;
    background: var(--accent-gold);
    color: #0f172a;
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px var(--accent-gold-glow);
}

.playback-controls-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 6px;
}

.speed-selector {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    padding: 1px 3px;
    gap: 1px;
    flex: 1;
    justify-content: space-between;
}

.speed-label {
    font-size: 9px;
    color: var(--text-muted);
    padding-left: 6px;
    white-space: nowrap;
}

.speed-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 600;
    padding: 3px 5px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.15s ease;
}

.speed-btn.active {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

/* ==========================================================================
   MODALES (UBICACIÓN Y GUÍA)
   ========================================================================== */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-window {
    background: #0f172a;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-soft), var(--shadow-glow);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-glass);
}

.modal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.modal-body {
    padding: 14px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
    flex-shrink: 0;
}

.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
}

.search-input:focus {
    border-color: var(--accent-gold);
}

.cities-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-height: 140px;
    max-height: 280px;
    overflow-y: auto;
}

.city-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    min-height: 44px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.city-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.city-item.active {
    background: rgba(245, 158, 11, 0.15);
    border-color: var(--accent-gold);
}

.city-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.city-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.city-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--radius-full);
}

.badge-totality {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-partial {
    background: rgba(56, 189, 248, 0.15);
    color: #7dd3fc;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--border-glass);
    background: rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    padding: 8px 14px;
    min-height: 38px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.btn-primary {
    background: var(--accent-gold);
    border: 1px solid var(--accent-gold);
    color: #0f172a;
    padding: 8px 14px;
    min-height: 38px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

/* ==========================================================================
   OPTIMIZACIONES MÓVILES (< 640px)
   ========================================================================== */

@media (max-width: 640px) {
    .ui-overlay {
        padding: 4px 6px;
        padding-top: max(4px, env(safe-area-inset-top));
        padding-bottom: max(6px, env(safe-area-inset-bottom));
        padding-left: max(4px, env(safe-area-inset-left));
        padding-right: max(4px, env(safe-area-inset-right));
    }

    .app-header {
        padding: 4px 6px !important;
        gap: 4px !important;
        justify-content: space-between !important;
    }

    .brand-section {
        gap: 4px !important;
        padding: 2px 3px !important;
    }

    .brand-icon {
        width: 24px !important;
        height: 24px !important;
        min-width: 24px !important;
    }

    .brand-title {
        font-size: 12px !important;
        gap: 3px !important;
    }

    .brand-title-text {
        display: none !important;
    }

    .brand-version {
        font-size: 8.5px !important;
        padding: 1px 3px !important;
    }

    .brand-subtitle {
        display: none !important;
    }

    .header-actions {
        gap: 2px !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        padding-bottom: 0 !important;
        max-width: 100% !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .header-actions::-webkit-scrollbar {
        display: none;
    }

    .btn-header {
        padding: 0 !important;
        width: 28px !important;
        height: 28px !important;
        min-height: 28px !important;
        min-width: 28px !important;
        max-width: 28px !important;
        flex-shrink: 0 !important;
        border-radius: var(--radius-sm) !important;
    }

    .btn-header svg {
        width: 13px !important;
        height: 13px !important;
    }

    .select-eclipse-dropdown {
        font-size: 9.5px !important;
        padding: 2px 14px 2px 5px !important;
        min-height: 28px !important;
        max-width: 86px !important;
        background-position: right 4px center !important;
    }

    /* Ocultar texto en botones de cabecera en móvil y dejar solo iconos */
    .btn-header-text {
        display: none !important;
    }

    .btn-live-toggle {
        padding: 4px 8px !important;
        min-height: 26px !important;
        height: auto !important;
        width: auto !important;
        max-width: none !important;
        font-size: 10px !important;
    }

    .top-section {
        gap: 4px !important;
    }

    .safety-banner {
        font-size: 10px !important;
        padding: 3px 8px !important;
    }

    .telemetry-row {
        gap: 4px !important;
    }


    .card-coverage {
        flex: 1;
        max-width: none;
        padding: 4px 7px;
        gap: 6px;
        background: rgba(15, 23, 42, 0.60);
    }

    .coverage-gauge {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }

    .gauge-text {
        font-size: 8.5px;
    }

    .phase-badge {
        font-size: 9.5px;
    }

    .time-countdown {
        font-size: 9.5px;
    }

    .card-orientation {
        padding: 4px 7px;
        gap: 6px;
        background: rgba(15, 23, 42, 0.60);
    }

    .compass-mini {
        width: 24px;
        height: 24px;
        min-width: 24px;
    }

    .compass-needle {
        height: 14px;
    }

    .orientation-data {
        font-size: 8.5px;
    }

    .bottom-controls {
        padding: 4px 8px;
        gap: 3px;
    }

    .bottom-controls.is-collapsed {
        max-height: 32px;
        padding: 4px 8px;
    }

    .toggle-text {
        display: none; /* En móvil mostrar solo el chevron */
    }

    .btn-panel-toggle {
        padding: 2px 5px;
    }

    .contact-btn {
        min-width: 44px;
        padding: 2px 3px;
        font-size: 8.5px;
    }

    .contact-btn .time-label {
        font-size: 7.5px;
    }

    .scrubber-container {
        height: 16px;
    }

    .scrubber-thumb {
        width: 12px;
        height: 12px;
    }

    .sim-time {
        font-size: 12px;
    }

    .btn-ctrl {
        width: 26px;
        height: 26px;
    }

    .btn-ctrl.btn-play {
        width: 30px;
        height: 30px;
    }

    .speed-btn {
        padding: 2px 3px;
        font-size: 8.5px;
    }

    /* Modal centrado y adaptable en móvil */
    .modal-backdrop {
        align-items: center;
        justify-content: center;
        padding: 12px;
    }

    .modal-window {
        max-width: 100%;
        border-radius: var(--radius-lg);
        max-height: 85vh;
    }

    .search-input {
        font-size: 16px; /* Evita auto-zoom en iOS Safari */
    }
}

@media (max-width: 380px) {
    .btn-header {
        width: 26px !important;
        height: 26px !important;
        min-height: 26px !important;
        min-width: 26px !important;
        max-width: 26px !important;
    }

    .select-eclipse-dropdown {
        font-size: 9px !important;
        padding: 2px 12px 2px 4px !important;
        max-width: 76px !important;
    }
}

/* ==========================================================================
   SPLASH DE CARGA INICIAL (C3)
   ========================================================================== */

.splash-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: #030712;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.splash-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-eclipse-icon {
    position: relative;
    width: 64px;
    height: 64px;
}

.splash-sun {
    position: absolute;
    top: 0;
    left: 0;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffffff 20%, #f59e0b 60%, #d97706 100%);
    box-shadow: 0 0 40px rgba(245, 158, 11, 0.6), 0 0 80px rgba(245, 158, 11, 0.3);
}

.splash-moon {
    position: absolute;
    top: 0;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #030712;
    animation: splashMoonSlide 2.5s ease-in-out infinite alternate;
}

@keyframes splashMoonSlide {
    0%   { left: -40px; }
    100% { left: 0px; }
}

.splash-text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #94a3b8;
    letter-spacing: 0.3px;
}

.splash-credits {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-gold);
    letter-spacing: 0.5px;
    opacity: 0.9;
    margin-top: 2px;
}

/* ==========================================================================
   PESTAÑAS DE CATEGORÍA DE UBICACIONES Y MODAL DE INFORME
   ========================================================================== */

.category-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 0;
    flex-shrink: 0;
    overflow-x: auto;
    padding: 2px 2px 6px 2px;
}

.category-tab {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    font-size: 12px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.category-tab:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.category-tab.active {
    background: rgba(56, 189, 248, 0.2);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    font-weight: 600;
}

.modal-window-large {
    max-width: 680px;
    width: 92vw;
}

.report-header-box {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 16px;
}

.report-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.report-location-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.report-location-coords {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.report-badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.report-badge.totality {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-gold);
    border: 1px solid var(--accent-gold);
}

.report-badge.partial {
    background: rgba(56, 189, 248, 0.2);
    color: var(--accent-cyan);
    border: 1px solid var(--accent-cyan);
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

@media (max-width: 520px) {
    .report-grid {
        grid-template-columns: 1fr;
    }
}

.report-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 12px;
}

.report-card-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-cyan);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.report-table td {
    padding: 4px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.report-table tr:last-child td {
    border-bottom: none;
}

.report-label {
    color: var(--text-secondary);
}

.report-val {
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
    font-family: var(--font-mono);
}

/* Estilos de impresión para guardar en PDF o imprimir papel A4 */
@media print {
    body {
        background: #ffffff !important;
        color: #0f172a !important;
    }

    #app-container, .ui-overlay, .canvas-wrapper, .modal-backdrop:not(#modalReport), .no-print {
        display: none !important;
    }

    #modalReport {
        position: static !important;
        background: #ffffff !important;
        display: block !important;
        width: 100% !important;
        height: auto !important;
        padding: 0 !important;
    }

    .modal-window {
        background: #ffffff !important;
        border: none !important;
        box-shadow: none !important;
        color: #0f172a !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    .modal-header, .modal-footer {
        display: none !important;
    }

    .report-header-box, .report-card {
        background: #f8fafc !important;
        border: 1px solid #cbd5e1 !important;
        color: #0f172a !important;
    }

    .report-location-name, .report-val {
        color: #0f172a !important;
    }

    .report-location-coords, .report-label {
        color: #475569 !important;
    }

    .report-badge.totality {
        background: #fef3c7 !important;
        color: #b45309 !important;
        border-color: #f59e0b !important;
    }

    .report-card-title {
        color: #0284c7 !important;
    }
}

