/* ============================================================
   MI TIERRA — Layout: Control | E1 | Mapa | E2
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: row;
}

/* ── PANEL DE CONTROL (col 1) ── */
#control-panel {
    width: 280px;
    min-width: 280px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 8px rgba(0,0,0,0.12);
    z-index: 100;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    order: 1;
}

.control-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.control-header h2 { color: #1a73e8; font-size: 15px; }

#turn-badge {
    background: #e8f0fe;
    color: #1a73e8;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 12px;
    white-space: nowrap;
}

#current-origin-display {
    background: #e8f4fd;
    border-left: 3px solid #1a73e8;
    padding: 6px 10px;
    border-radius: 0 4px 4px 0;
    font-size: 12px;
    color: #1a73e8;
    margin-bottom: 4px;
}

/* ── PANELES DE EQUIPO (col 2 y col 4) ── */
.team-panel {
    width: 200px;
    min-width: 200px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, min-width 0.3s ease;
    overflow: hidden;
    z-index: 100;
}
.team-panel.collapsed-panel {
    width: 42px;
    min-width: 42px;
}

#panel-team-0 { box-shadow:  2px 0 8px rgba(0,0,0,0.1); order: 2; }
#panel-team-1 { box-shadow: -2px 0 8px rgba(0,0,0,0.1); order: 4; }

/* Cabecera */
.team-header {
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex-shrink: 0;
}
.team-color-0 { background: #1a73e8; color: white; }
.team-color-1 { background: #ea4335; color: white; }

.team-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}
.team-name { font-size: 14px; font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.panel-collapse-btn {
    background: rgba(255,255,255,0.25);
    border: none; color: white;
    width: 24px; height: 24px; min-width: 24px;
    border-radius: 4px; cursor: pointer; font-size: 10px;
    display: flex; align-items: center; justify-content: center;
    padding: 0; flex-shrink: 0;
    transition: background 0.2s;
}
.panel-collapse-btn:hover { background: rgba(255,255,255,0.4); }

.team-km-display { font-size: 22px; font-weight: bold; line-height: 1; white-space: nowrap; }
.km-unit { font-size: 12px; font-weight: normal; opacity: 0.8; }
.team-status { font-size: 10px; font-weight: bold; letter-spacing: 0.5px; opacity: 0.9; text-transform: uppercase; }

/* Cuerpo */
.team-body {
    display: flex;
    flex-direction: column;
    transition: opacity 0.25s ease;
}
.team-body.collapsed { display: none; }

/* Panel colapsado — solo muestra la cabecera con nombre vertical */
.team-panel.collapsed-panel .team-km-display,
.team-panel.collapsed-panel .team-status,
.team-panel.collapsed-panel .team-name { display: none; }
.team-panel.collapsed-panel .team-header { cursor: pointer; justify-content: center; align-items: center; height: 100%; padding: 10px 0; }

/* Origen */
.team-origin-box {
    padding: 7px 10px; background: #f8f9fa;
    border-bottom: 1px solid #eee;
    display: flex; flex-direction: column; gap: 1px; flex-shrink: 0;
}
.origin-label { font-size: 10px; color: #aaa; text-transform: uppercase; letter-spacing: 0.5px; }
.origin-name  { font-size: 12px; font-weight: bold; color: #333; }

/* Historial */
.team-history { display: flex; flex-direction: column; }
.history-empty { padding: 14px 10px; color: #ccc; font-style: italic; font-size: 11px; text-align: center; }

.history-row {
    padding: 6px 10px; border-bottom: 1px solid #f0f0f0;
    display: flex; justify-content: space-between; align-items: flex-start;
    font-size: 11px;
}
.history-row:last-of-type { border-bottom: none; }
.history-meta  { font-size: 10px; color: #bbb; margin-bottom: 1px; }
.history-label { color: #333; }
.history-label.lost { color: #ea4335; }
.history-km    { font-weight: bold; white-space: nowrap; margin-left: 6px; color: #1a73e8; flex-shrink: 0; }
.history-km.lost { color: #ea4335; }

.history-total {
    padding: 8px 10px;
    border-top: 1px solid rgba(212, 175, 55, 0.3);
    display: flex; justify-content: space-between;
    font-weight: bold; font-size: 11px; color: #D4AF37;
    margin-top: 10px;
}

/* Historial agrupado por turno (Journey Cards) */
.journey-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: all 0.2s ease;
}
.journey-card:hover {
    box-shadow: 0 3px 6px rgba(0,0,0,0.08);
}
.journey-card.completed {
    border-left: 4px solid #2e7d32;
}
.journey-card.lost {
    border-left: 4px solid #c62828;
}
.journey-card.in-progress {
    border-left: 4px solid #1565c0;
    border-style: dashed;
}

.journey-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}
.journey-turn {
    font-size: 9px;
    font-weight: bold;
    color: #777;
    letter-spacing: 0.5px;
}
.journey-status-badge {
    font-size: 9px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
}
.journey-status-badge.completed {
    background: #e8f5e9;
    color: #2e7d32;
}
.journey-status-badge.lost {
    background: #ffebee;
    color: #c62828;
}
.journey-status-badge.in-progress {
    background: #e3f2fd;
    color: #1565c0;
}

/* Stepper Vertical */
.journey-stepper {
    position: relative;
    padding: 12px 12px 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.stepper-line {
    position: absolute;
    top: 20px;
    bottom: 20px;
    left: 23px; /* centrado con el node-marker */
    width: 2px;
    background: #e0e0e0;
    z-index: 1;
}
.stepper-node {
    position: relative;
    display: flex;
    gap: 12px;
    z-index: 2;
}
.node-marker {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    font-size: 11px;
    z-index: 3;
}
.node-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.node-title {
    font-weight: bold;
    font-size: 11px;
    color: #333;
    line-height: 1.2;
}
.node-subtitle {
    font-size: 9px;
    color: #777;
    margin-top: 2px;
    line-height: 1.2;
}
.node-cat {
    font-weight: 500;
    color: #1a73e8;
    background: #f1f3f4;
    padding: 1px 4px;
    border-radius: 3px;
    display: inline-block;
    margin-top: 2px;
}

/* Punto de Retorno Activo (Pausa) */
.stepper-node.active-resume {
    animation: pulse-glowing 2s infinite alternate;
    border-radius: 4px;
    padding: 2px 4px;
    background: rgba(26, 115, 232, 0.05);
}
.stepper-node.active-resume .node-title {
    color: #1a73e8;
}
.resume-badge {
    background: #1a73e8;
    color: white;
    font-size: 8px;
    padding: 1px 4px;
    border-radius: 8px;
    margin-left: 6px;
    font-weight: bold;
    animation: flash 1s infinite alternate;
}

@keyframes pulse-glowing {
    0% { box-shadow: 0 0 2px rgba(26, 115, 232, 0.1); }
    100% { box-shadow: 0 0 8px rgba(26, 115, 232, 0.3); }
}
@keyframes flash {
    0% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Estilos de tramos actuales y pendientes (Journey Map en progreso) */
.stepper-node.segment.current .node-title {
    color: #e65100; /* Naranja oscuro */
}
.stepper-node.segment.current.active-resume {
    background: rgba(230, 81, 0, 0.05);
    border: 1px solid rgba(230, 81, 0, 0.2);
    animation: pulse-glowing-current 2s infinite alternate;
}
.stepper-node.segment.current .resume-badge {
    background: #e65100;
}
.stepper-node.segment.pending {
    opacity: 0.55;
}
.stepper-node.segment.pending .node-title {
    color: #888;
    font-weight: 500;
}

@keyframes pulse-glowing-current {
    0% { box-shadow: 0 0 2px rgba(230, 81, 0, 0.1); }
    100% { box-shadow: 0 0 8px rgba(230, 81, 0, 0.35); }
}

/* Tarjeta de ubicación actual fija (cuando no se está en ruta) */
.current-position-card {
    background: #e8f0fe;
    border: 1px solid #1a73e8;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.current-position-card.active-resume {
    border-left: 4px solid #1a73e8;
    animation: pulse-glowing 2.5s infinite alternate;
}
.pos-badge {
    font-size: 8px;
    font-weight: bold;
    color: #1a73e8;
    letter-spacing: 0.5px;
}
.pos-name {
    font-size: 13px;
    font-weight: bold;
    color: #1557b0;
}
.pos-desc {
    font-size: 9px;
    color: #666;
}

/* Panel de estadísticas para modo Explorador (Single Player) */
.exploration-stats-panel {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.stat-box {
    flex: 1;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.stat-num {
    font-size: 14px;
    font-weight: bold;
    color: #1a73e8;
}
.stat-label {
    font-size: 8px;
    color: #666;
    margin-top: 2px;
    text-align: center;
}

/* Equipo activo — borde superior destacado */
.team-panel.team-active { box-shadow: 2px 0 8px rgba(0,0,0,0.1), inset 0 3px 0 #34a853; }

/* ── MAPA (col 3) ── */
#map { flex: 1; height: 100vh; order: 3;
    min-height: 400px;  /* 🆕 Añadir esta línea */ }

/* ── CONTROLES ── */
.control-group { margin-bottom: 12px; }
.control-group label { display: block; margin-bottom: 5px; font-weight: 600; color: #333; font-size: 12px; }
.control-group input[type="text"],
.control-group select { width: 100%; padding: 7px 9px; border: 1px solid #ddd; border-radius: 4px; font-size: 12px; margin-bottom: 4px; }
.control-group input[type="range"] { width: 100%; margin-bottom: 4px; }
.range-value { font-weight: bold; color: #1a73e8; }

button {
    width: 100%; padding: 9px 12px; background: #1a73e8; color: white;
    border: none; border-radius: 4px; font-size: 12px; cursor: pointer;
    transition: background 0.2s, transform 0.1s; margin-bottom: 6px; display: block;
}
button:hover  { background: #1557b0; }
button:active { transform: scale(0.98); }

.toggle-row { display: flex; gap: 5px; margin-bottom: 0; }
.toggle-row button { flex: 1; padding: 8px 2px; font-size: 13px; margin-bottom: 0; }
.toggle-btn       { background: #34a853; }
.toggle-btn:hover { background: #2d8e47; }
.toggle-btn.active       { background: #ea4335; }
.toggle-btn.active:hover { background: #c5392b; }
.icon-btn       { background: #757575; }
.icon-btn:hover { background: #555; }

/* Municipios */
#municipalities-list {
    max-height: 160px;
    min-height: 60px;
    overflow-y: auto;
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 8px;
    padding: 8px;
    background: transparent;
    display: none;
    margin-bottom: 10px;
    font-size: 12px;
}
#municipalities-list.visible { display: block; }
.municipality-item { 
    padding: 8px 10px; 
    cursor: pointer; 
    border-radius: 6px; 
    margin-bottom: 4px;
    transition: background 0.2s, color 0.2s;
    border: 1px solid #eee;
}
.municipality-item:hover    { background: #e8f0fe; color: #1a73e8; border-color: #d2e3fc; }
.municipality-item.selected { background: #1a73e8; color: white; font-weight: bold; border-color: #1a73e8; }

/* Route info */
#route-info {
    background: #e8f5e9; border-left: 3px solid #4caf50;
    padding: 7px 10px; border-radius: 0 4px 4px 0;
    font-size: 11px; margin-bottom: 6px;
}
.route-info-row { display: flex; justify-content: space-between; margin: 2px 0; }

/* Advertencia territorio */
#territory-warning {
    background: #fff0f0; border: 1px solid #ea4335; border-radius: 4px;
    padding: 8px 10px; margin: 4px 0 6px;
    color: #c5392b; font-size: 11px; font-weight: bold; text-align: center;
    display: none;
}

/* Panel tramos */
#segment-panel {
    background: #fff8e1; border: 2px solid #ff9800;
    border-radius: 6px; padding: 10px; margin-bottom: 6px; font-size: 12px;
}
.seg-progress-bg   { background: #ffe0b2; border-radius: 4px; height: 7px; margin: 6px 0 10px; overflow: hidden; }
.seg-progress-fill { background: #ff9800; height: 100%; border-radius: 4px; transition: width 0.4s; }
.seg-current-box   { background: white; border: 1px solid #ffcc80; border-radius: 5px; padding: 7px; margin-bottom: 8px; text-align: center; }
.seg-btn-row { display: flex; gap: 6px; }
.seg-btn-row button { flex: 1; margin-bottom: 0; padding: 8px; font-weight: bold; }
#btn-correct { background: #34a853; } #btn-correct:hover { background: #2d8e47; }
#btn-wrong   { background: #ea4335; } #btn-wrong:hover   { background: #c5392b; }

/* Confirmación pérdida */
#loss-confirmation {
    background: #fff0f0; border: 2px solid #ea4335;
    border-radius: 6px; padding: 10px; margin-bottom: 6px; font-size: 12px;
}
#btn-confirm-loss { background: #ea4335; font-weight: bold; }
#btn-confirm-loss:hover { background: #c5392b; }

/* Separadores */
.section-divider { border-top: 1px solid #e8e8e8; margin: 10px 0; }

/* Notificación flotante */
#game-notification {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    color: white; padding: 12px 20px; border-radius: 8px;
    font-size: 14px; font-weight: bold; z-index: 9999;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25); text-align: center;
    min-width: 260px; pointer-events: none;
}

/* Temporizador */
.team-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 18px;
    font-weight: bold;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 4px 10px;
}

.timer-icon {
    font-size: 14px;
}

.timer-value {
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.timer-warning {
    color: #ffcc00;
    text-shadow: 0 0 3px rgba(0,0,0,0.5);
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Eliminar estilos de colapso si ya no se usan */
.panel-collapse-btn {
    display: none;
}
#game-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #2c3e50;
    padding: 6px 16px;
    border-radius: 8px 8px 0 0;
}
.status-team {
    font-size: 1.4rem;
    font-weight: bold;
    order: 2;
}
.status-timer {
    font-size: 1rem;
    order: 3;
}
.status-message {
    font-size: 0.9rem;
    order: 1;
    flex: 1;
    text-align: left;
}
#game-status-bar.team-1-active {
    border-bottom-color: #ea4335;
}
.status-team-name {
    font-weight: bold;
    font-size: 1.2rem;
    margin-left: 6px;
}
.status-time {
    font-family: 'Courier New', monospace;
    font-size: 1.4rem;
    font-weight: bold;
    letter-spacing: 2px;
    background: #00000066;
    padding: 2px 8px;
    border-radius: 20px;
}
.status-message {
    font-size: 0.9rem;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40%;
}

#game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}
#map {
    flex: 1;
    width: 100%;
}


@keyframes fadeOutOverlay {
    0% { opacity: 0; }
    15% { opacity: 1; }
    85% { opacity: 1; }
    100% { opacity: 0; visibility: hidden; }
}

/* Estilos compactos para el panel de administración */
#admin-content .control-group {
    margin-bottom: 6px !important;
}
#admin-content .control-group label {
    margin-bottom: 2px !important;
    font-size: 11px !important;
}
#admin-content input[type="text"],
#admin-content select {
    padding: 5px 8px !important;
    font-size: 11px !important;
    margin-bottom: 2px !important;
}
#admin-content button {
    padding: 7px 10px !important;
    font-size: 12px !important;
}

/* Asegurar que el desplegable de sugerencias de Google Autocomplete se muestre sobre el modal FTI */
.pac-container {
    z-index: 22000 !important;
}

/* ============================================================
   MAP-FIRST OVERRIDES (PILOTO SEGOVIA)
   ============================================================ */

/* Cuerpo completo */
body {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* Área del juego (Mapa a pantalla completa) */
#game-area {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 0 !important;
}

#map {
    width: 100% !important;
    height: 100% !important;
}

/* Bottom Sheet Flotante (Panel de control) */
#control-panel {
    position: fixed !important;
    bottom: 15px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 90% !important;
    max-width: 600px !important;
    height: auto !important;
    max-height: 35vh !important;
    background: rgba(26, 24, 23, 0.93) !important; /* Pizarra 93% */
    border: 2px solid #D4AF37 !important; /* Oro Dorado */
    border-radius: 16px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
    z-index: 1000 !important;
    overflow-y: auto !important;
    padding: 14px 20px !important;
    color: #F8F5EC !important; /* Pergamino */
}

/* Ocultar divisores y cabeceras innecesarias en Bottom Sheet */
#control-panel .section-divider,
#control-panel .control-header h2 {
    display: none !important;
}

/* HUD Superior Translúcido */
#game-status-bar {
    position: fixed !important;
    top: 15px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 90% !important;
    max-width: 800px !important;
    height: 55px !important;
    background: rgba(26, 24, 23, 0.90) !important; /* Pizarra translúcida */
    border: 1px solid rgba(212, 175, 55, 0.3) !important;
    border-radius: 12px !important;
    z-index: 1000 !important;
    color: #F8F5EC !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 20px !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important;
    backdrop-filter: blur(8px) !important;
}

/* Widgets de Equipos Flotantes */
.team-panel {
    position: fixed !important;
    top: 85px !important;
    width: 220px !important;
    height: auto !important;
    max-height: 50vh !important;
    background: rgba(26, 24, 23, 0.92) !important;
    border: 1px solid rgba(212, 175, 55, 0.2) !important;
    border-radius: 12px !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4) !important;
    z-index: 950 !important;
    color: #F8F5EC !important;
    overflow-y: auto !important;
    transition: all 0.3s ease !important;
}

#panel-team-0 {
    left: 20px !important;
}

#panel-team-1 {
    right: 20px !important;
}

.team-header {
    background: rgba(212, 175, 55, 0.1) !important;
    color: #F8F5EC !important;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2) !important;
    padding: 10px !important;
}

.team-header-top {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
}

.team-km-top {
    color: #D4AF37 !important; /* Oro */
    font-weight: 800 !important;
    font-size: 14px !important;
    margin-left: auto !important;
    letter-spacing: 0.5px;
}

.team-body {
    background: transparent !important;
    color: #F8F5EC !important;
    padding: 10px !important;
}

.team-km-display {
    color: #D4AF37 !important; /* Oro */
    font-weight: bold !important;
}

.team-timer {
    color: #F8F5EC !important;
}

/* ── VENTANA COMPACTA DEL EQUIPO INACTIVO ── */
.team-panel.inactive-team-compact {
    position: fixed !important;
    top: 90px !important;
    width: 260px !important;
    height: auto !important;
    max-height: none !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5) !important;
    z-index: 950 !important;
    overflow: hidden !important;
    border: 2px solid #D4AF37 !important;
    padding: 0 !important;
    background: transparent !important;
}

#panel-team-0.inactive-team-compact .team-header {
    background: linear-gradient(135deg, #1a73e8, #0d47a1) !important; /* Azul Equipo 1 */
    color: #ffffff !important;
    padding: 10px 14px !important;
    border-radius: 10px !important;
    border: none !important;
}

#panel-team-1.inactive-team-compact .team-header {
    background: linear-gradient(135deg, #ea4335, #b71c1c) !important; /* Rojo Equipo 2 */
    color: #ffffff !important;
    padding: 10px 14px !important;
    border-radius: 10px !important;
    border: none !important;
}

.inactive-team-compact .team-timer,
.inactive-team-compact .team-status,
.inactive-team-compact .team-km-display,
.inactive-team-compact .team-body {
    display: none !important;
}

.inactive-team-compact .team-header-top {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
}

.inactive-team-compact .team-name {
    font-size: 15px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    color: #ffffff !important;
}

.inactive-team-compact .team-km-top {
    font-size: 15px !important;
    font-weight: 900 !important;
    color: #FFD700 !important; /* Oro brillante */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6) !important;
}

/* Ocultar botones de colapso en cabecera */
.panel-collapse-btn {
    display: none !important;
}

/* Animaciones */
@keyframes pulse-halo {
    0% { transform: scale(0.3); opacity: 0.8; }
    100% { transform: scale(1.6); opacity: 0; }
}

@keyframes conquer-flash-anim {
    0% { transform: scale(0.1); opacity: 1; }
    50% { opacity: 1; }
    100% { transform: scale(2.5); opacity: 0; }
}

@keyframes cardEntrance {
    from { transform: scale(0.85) translateY(40px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

/* Estilos de botones de sugerencias y listas en Bottom Sheet */
.municipality-item {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #F8F5EC !important;
    border: 1px solid rgba(212, 175, 55, 0.2) !important;
    border-radius: 8px !important;
    margin: 4px 0 !important;
    padding: 8px 12px !important;
}

.municipality-item:hover {
    background: rgba(212, 175, 55, 0.2) !important;
    color: #F8F5EC !important;
}

.municipality-item.selected {
    background: #D4AF37 !important;
    color: #1A1817 !important;
    font-weight: bold !important;
    border-color: #D4AF37 !important;
}

/* Scrollbars custom */
#control-panel::-webkit-scrollbar,
.team-panel::-webkit-scrollbar {
    width: 6px;
}
#control-panel::-webkit-scrollbar-thumb,
.team-panel::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.3);
    border-radius: 3px;
}

/* Estilos del Álbum de Naipes del Explorador */
.album-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin-top: 16px;
    max-height: 50vh;
    overflow-y: auto;
    padding: 8px;
}

.album-card {
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 140px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.album-card.conquered {
    background: #F8F5EC;
    border: 2px solid #D4AF37;
    color: #1A1817;
}

.album-card.pending {
    background: #2a2827;
    border: 2px dashed #4a4847;
    color: #777777;
}

.album-card-title {
    font-weight: bold;
    font-size: 11px;
    margin-bottom: 4px;
}

.album-card-badge {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 12px;
    align-self: center;
    font-weight: bold;
}

.album-card.conquered .album-card-badge {
    background: rgba(212,175,55,0.2);
    color: #8c7320;
}

.album-card.pending .album-card-badge {
    background: rgba(255,255,255,0.05);
    color: #666;
}

/* Estilos para el Naipe Cronista */
.cronista-naipe-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    z-index: 20050;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.cronista-naipe-card {
    background: #F8F5EC; /* Fondo Pergamino */
    border: 3px solid #D4AF37; /* Borde Oro Dorado */
    border-radius: 16px;
    padding: 24px 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 15px 35px rgba(0,0,0,0.5), inset 0 0 40px rgba(212,175,55,0.15);
    color: #1A1817; /* Texto Pizarra */
    text-align: center;
    animation: cardEntrance 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    position: relative;
    overflow: hidden;
}

.cronista-naipe-title {
    font-size: 14px;
    font-weight: bold;
    color: #D4AF37; /* Oro */
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.cronista-naipe-parchment {
    background: #fdfbf7;
    border: 1px solid #e2d9c2;
    border-radius: 8px;
    padding: 16px;
    font-family: 'Georgia', serif;
    font-style: italic;
    font-size: 15px;
    line-height: 1.5;
    color: #4a3e2a;
    margin-bottom: 20px;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.05);
}

.cronista-naipe-question {
    font-size: 17px;
    font-weight: bold;
    margin-bottom: 20px;
    line-height: 1.4;
    color: #1A1817;
}

.cronista-naipe-option {
    display: block;
    width: 100%;
    margin: 10px 0;
    padding: 12px 16px;
    background: #ffffff;
    color: #1A1817;
    border: 1px solid #dcd1b4;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.cronista-naipe-option:hover:not(:disabled) {
    background: #fdfbf7;
    border-color: #D4AF37;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.cronista-naipe-option.correct {
    background: #d4edda !important;
    border-color: #c3e6cb !important;
    color: #155724 !important;
    font-weight: bold;
}

.cronista-naipe-option.incorrect {
    background: #f8d7da !important;
    border-color: #f5c6cb !important;
    color: #721c24 !important;
}

.cronista-naipe-revelation {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed #dcd1b4;
    font-size: 13px;
    line-height: 1.4;
    text-align: left;
}

.cronista-naipe-continue-btn {
    margin-top: 20px;
    width: 100%;
    padding: 12px;
    background: #D4AF37;
    color: #1A1817;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(212,175,55,0.3);
}

.cronista-naipe-continue-btn:hover {
    background: #c59e2b;
    box-shadow: 0 6px 15px rgba(212,175,55,0.4);
}

/* Panel de Juego acoplable bajo la tarjeta del equipo activo */
.gameplay-docked-panel {
    background: rgba(26, 24, 23, 0.93) !important;
    border: 2px solid #D4AF37 !important;
    border-radius: 12px !important;
    padding: 12px 16px !important;
    margin-top: 10px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
    color: #F8F5EC !important;
    font-family: inherit;
    box-sizing: border-box !important;
    animation: cardEntrance 0.3s ease-out;
}

/* Ajustes para los tramos en el panel de juego */
#segment-panel {
    border-top: 1px solid rgba(212,175,55,0.3) !important;
    margin-top: 10px !important;
    padding-top: 8px !important;
}

/* En el widget flotante, hacemos que los botones reaccionen */
#map-tools-widget button {
    transition: transform 0.2s ease, opacity 0.2s ease;
}

#map-tools-widget button:hover {
    transform: scale(1.2);
    opacity: 0.9;
}

/* ── HUD HÍBRIDO FLOTANTE / BARRA LATERAL (ESPEC-007) ── */
#bottom-sheet {
    position: fixed;
    top: 85px;
    bottom: 65px; /* Margen de seguridad para quedar 100% visible por encima de la barra de tareas */
    width: 340px;
    background: transparent;
    border: none;
    z-index: 1005;
    display: none; /* Oculto hasta que la partida comience */
    flex-direction: column;
    box-shadow: none;
    pointer-events: none; /* Permite clics a través del contenedor al mapa */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 0;
    transition: left 0.3s ease, right 0.3s ease; /* Transición fluida al cambiar de lado */
}

#bottom-sheet.team-0-active {
    left: 20px;
    right: auto;
}

#bottom-sheet.team-1-active {
    right: 20px;
    left: auto;
}

#bottom-sheet-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 0;
    gap: 8px;
    overflow: visible;
    box-sizing: border-box;
    pointer-events: none; /* Clics siguen pasando al mapa */
    width: 100%;
}

/* Título de Cabecera del Equipo Activo (ESPEC-007) */
#active-team-sidebar-title {
    font-size: 15px;
    font-weight: 900;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 10px;
    text-align: center;
    letter-spacing: 0.8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    border: 2px solid #D4AF37;
    text-transform: uppercase;
    pointer-events: auto;
    flex-shrink: 0;
    background: linear-gradient(135deg, #1a73e8, #0d47a1);
}

/* Panel flotante HUD Izquierdo (Info y Historial del Equipo) */
#bottom-sheet-team-info {
    pointer-events: auto; /* Reactivar interacción para el panel */
    width: 100%;
    min-width: 100%;
    flex: 1;
    max-height: calc(100vh - 400px);
    min-height: 120px;
    background: rgba(26, 24, 23, 0.85);
    border: 2px solid #D4AF37;
    border-radius: 14px;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    overflow-y: hidden;
    color: #F8F5EC;
    box-sizing: border-box;
}

.bs-team-header-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
    display: none !important; /* Ocultamos badge interna ya que tenemos el título de la barra lateral */
}

#bs-active-team-badge {
    background: #D4AF37;
    color: #1A1817;
    font-weight: bold;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
}

#bs-origin-badge {
    font-size: 11px;
    color: #ccc;
    font-weight: bold;
}

#bs-origin-name {
    color: #D4AF37;
}

#bs-travel-mode-icon {
    font-size: 16px;
    margin-left: auto;
}

#bs-history-container {
    flex: 1;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    border: 1px solid rgba(212, 175, 55, 0.15);
    padding: 8px;
}

/* Panel flotante HUD Derecho (Selector de Mecánica y Progreso) */
#bottom-sheet-gameplay-container {
    pointer-events: auto; /* Reactivar interacción para el panel */
    width: 100%;
    min-width: 100%;
    flex: none; /* Ajuste automático sin huecos vacíos */
    height: auto;
    max-height: calc(100vh - 340px);
    background: rgba(26, 24, 23, 0.85);
    border: 2px solid #D4AF37;
    border-radius: 14px;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    padding: 12px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    color: #F8F5EC;
    box-sizing: border-box;
}

#bottom-sheet-gameplay-container .gameplay-docked-panel {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Estilos de responsividad para pantallas móviles o pequeñas */
@media (max-width: 768px) {
    #bottom-sheet {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100%;
        min-height: auto;
    }
    #bottom-sheet-content {
        flex-direction: column;
        align-items: center;
        padding: 10px;
        gap: 12px;
    }
    #bottom-sheet-team-info, 
    #bottom-sheet-gameplay-container {
        width: 100%;
        min-width: 100%;
        height: auto;
        max-height: 180px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    }
    #active-team-sidebar-title {
        display: none !important; /* Ocultar en móvil */
    }
    .bs-team-header-row {
        display: flex !important; /* Volver a mostrar badge interna en móvil */
    }
}

/* Columnas de equipo laterales: ocultas por defecto (el activo usa Bottom Sheet) */
.team-panel {
    display: none !important;
}

/* Solo el equipo INACTIVO se muestra como ventana compacta en el lado opuesto */
.team-panel.inactive-team-compact {
    display: flex !important;
    flex-direction: column !important;
}

#game-status-bar {
    position: relative !important;
    background: rgba(26, 24, 23, 0.96) !important;
    border-bottom: 2px solid #D4AF37 !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5) !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    transition: border-bottom-color 0.3s ease;
    z-index: 20060 !important; /* Siempre nítido por encima de cualquier overlay */
}

#game-status-bar.team-0-active {
    border-bottom: 2px solid #1a73e8 !important;
}

#game-status-bar.team-1-active {
    border-bottom: 2px solid #ea4335 !important;
}

#game-status-bar.question-active {
    position: relative !important;
    z-index: 20060 !important;
    box-shadow: 0 0 25px rgba(212, 175, 55, 0.9), 0 4px 15px rgba(0,0,0,0.6) !important;
    border: 2px solid #D4AF37 !important;
    background: rgba(36, 33, 30, 0.98) !important;
    transform: scale(1.01);
    transition: all 0.3s ease;
}

/* ── SLOT MACHINE REEL (ESPEC-007) ── */
.slot-machine-reel {
    width: 100%;
    max-width: 220px;
    height: 42px;
    overflow: hidden;
    margin: 4px auto;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #D4AF37;
    border-radius: 8px;
    position: relative;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.8), 0 4px 10px rgba(0,0,0,0.3);
}

.slot-machine-strip {
    display: flex;
    flex-direction: column;
    width: 100%;
    transform: translateY(0);
    transition: transform 1.2s cubic-bezier(0.15, 0.85, 0.3, 1);
    will-change: transform;
}

.slot-machine-strip.blur-effect {
    filter: blur(2.5px);
}

.slot-item {
    height: 42px;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    text-align: center;
    box-sizing: border-box;
    padding: 0 8px;
}

.slot-machine-reel::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.3), transparent);
    z-index: 2;
}
.slot-machine-reel::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.3), transparent);
    z-index: 2;
}