/* ============================================================ */
/* 1. BASE Y BARRA SUPERIOR (ESTÉTICA INDEX.TXT / ESTILOS 1)    */
/* ============================================================ */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #121212;
    color: white;
    text-align: center;
    padding: 0;
    margin: 0;
    user-select: none;
    -webkit-user-select: none;
    /* CORREGIDO: Eliminado el espacio artificial extra, usando solo lo necesario */
    padding-top: calc(50px + env(safe-area-inset-top));
    padding-bottom: calc(90px + env(safe-area-inset-bottom));
    min-height: 100vh;
}

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    /* Altura ajustada a Estilos 2 */
    height: calc(50px + env(safe-area-inset-top));
    background: #1f1f1f;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Aumentamos padding lateral para evitar que se pegue a los bordes */
    padding-left: 15px;
    padding-right: 15px;
    box-sizing: border-box;
    z-index: 1000;
    padding-top: env(safe-area-inset-top); 
}

.menu-btn { font-size: 1.8rem; background: none; border: none; color: white; cursor: pointer; padding: 0 10px; }
.app-title {
    font-weight: 900;
    /* Reducimos un pelín el título (1.2rem -> 1.1rem) */
    font-size: 1.1rem; 
    color: #fff;
    letter-spacing: 0.5px;
    white-space: nowrap;
    margin-right: 5px; /* Menos margen derecho */
}

/* HEADER BUTTONS */

.header-actions {
    display: flex;
    /* Reducimos hueco entre botones (8px -> 4px) */
    gap: 4px; 
    align-items: center;
    flex-shrink: 0; 
}

.header-btn {
    height: 36px;
    /* Reducimos padding lateral (12px -> 8px) para ganar espacio */
    padding: 0 8px; 
    border-radius: 4px; 
    font-weight: bold; 
    /* Fuente un poco más compacta (0.9rem -> 0.8rem) */
    font-size: 0.8rem; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    border: 1px solid #555; 
    transition: all 0.2s;
    background: #222; 
    color: #ccc;
}

.header-btn:active { transform: scale(0.96); }
.btn-roster { font-size: 1.1rem; }
.btn-roster.active-roster { background: #90caf9; color: #0d47a1; border-color: #64b5f6; box-shadow: 0 0 8px rgba(144, 202, 249, 0.4); }
.btn-save { background: #00e676 !important; color: black !important; border-color: #00e676; font-size: 0.8rem; }

/* ============================================================ */
/* 2. CAJA DEL CRONO (ESTÉTICA INDEX.TXT / ESTILOS 1)           */
/* ============================================================ */
.box { background: #1e1e1e; padding: 10px; border-radius: 8px; margin-bottom: 10px; border: 1px solid #333; }

.timer-box-container {
    margin: 0;
    width: 100%; border-radius: 0; border: none;
    border-bottom: 1px solid #333; background: #1a1a1a;
    padding: 10px 5px; /* Padding amplio de Estilos 1 */
    display: flex; align-items: flex-start;
    justify-content: space-between;
    box-sizing: border-box; min-height: 90px;
    flex-wrap: wrap; 
}

/* TIMER GIGANTE (2.0rem para igualar Index.txt visualmente) */
#timer { 
    font-size: 2.0rem; 
    color: #00e676; 
    font-weight: 800; 
    margin: 5px 0; 
    font-variant-numeric: tabular-nums; 
    text-shadow: 0 0 10px rgba(0,230,118,0.2); 
    cursor: pointer;
    line-height: 1;
    white-space: nowrap;
}
#timer:active { transform: scale(0.98); opacity: 0.8; }

#periodTimer {
    font-size: 0.9rem; 
    color: #ff9800; 
    font-family: monospace; 
    font-weight:bold; 
    letter-spacing: 1px;
    margin-top:5px;
}

.timer-center-wrapper {
    position: relative;
    display: flex; flex-direction: column; align-items: center;
    flex: 1; 
}

.action-btn-wrapper {
    display: flex; flex-direction: column; align-items: center;
    justify-content: flex-start; width: 110px;
}

.btn-label {
    font-size: 0.6rem; color: #999; margin-top: 8px;
    text-align: center; line-height: 1.2; width: 100%; white-space: nowrap;
}

.btn-timer-action {
    background: none; border: 1px solid #444;
    font-size: 1.5rem; width: 48px; height: 48px;
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
    margin: 0 auto; cursor: pointer;
}
.flag-btn { color: #ffb74d; }
.sync-btn { color: #ccc; }

/* CONFIGURACION ARRIBA (Checks) */
.top-config { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; margin-top: 5px; color: #ccc; }
.time-check { display: flex; align-items: center; gap: 5px; }
input[type="checkbox"] { transform: scale(1.3); }
.vid-cfg { display: flex; align-items: center; gap: 3px; }
.vid-cfg input { width: 30px; background: #222; border: 1px solid #555; color: white; text-align: center; padding: 4px; border-radius: 4px; font-size: 0.9rem; }

/* ============================================================ */
/* 3. PARTE INFERIOR Y BOTONES FLOTANTES (ESTÉTICA ESTILOS 2)   */
/* ============================================================ */

/* CONTROLES FLOTANTES (COPIA EXACTA DE ESTILOS 2) */
.controls-float {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #1f1f1f;
    /* Medidas exactas de ESTILOS 2 */
    padding: 8px 15px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: 12px; 
    box-sizing: border-box;
    border-top: 1px solid #333;
    z-index: 900;
}

/* Grupo Izquierdo (Deshacer/Rehacer) */
.ctrl-group-left {
    display: flex;
    gap: 10px;
    flex: 0 0 auto;
}

/* Estilo base botones inferiores */
.btn-ctrl {
    height: 42px; 
    border-radius: 8px;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
    font-size: 0.9rem;
    font-weight: 400 !important;
}
.btn-ctrl:active { transform: scale(0.96); }

/* Deshacer / Rehacer Rectangulares */
.ctrl-group-left .btn-ctrl {
    width: 65px; 
    padding: 0;
    background: #333;
    border: 1px solid #444;
    font-size: 1.4rem; 
    line-height: 1;
}

/* BOTÓN PRINCIPAL (ESTRUCTURA NUEVA ESTILOS 2) */
#btnMain {
    flex: 1; 
    min-width: 0; 
    background: #00796b;
    color: white;
    padding: 0 10px; 
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.main-icon {
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0; 
}

.main-text {
    font-weight: 400 !important;
    font-size: 0.9rem; 
    letter-spacing: 0px; 
    white-space: nowrap;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* BOTÓN "PANTALLA COMPLETA" (Clase específica de estilos2) */
.btn-menu-std {
    width: 100%;
    background: #252525;
    border: 1px solid #333;
    color: #eee;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    transition: all 0.2s;
}
.btn-menu-std:hover { background: #333; border-color: #ff9800; color: white; }
.btn-menu-std:active { transform: scale(0.98); }

/* ============================================================ */
/* 4. RESTO DE COMPONENTES (COMÚN)                              */
/* ============================================================ */

/* ROSTER PANEL */
.roster-panel { display: flex; gap: 8px; overflow-x: auto; padding: 10px 5px; margin-bottom: 5px; white-space: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.roster-panel::-webkit-scrollbar { display: none; }
.btn-player { min-width: 45px; height: 45px; border-radius: 50%; border: 2px solid #444; background: #222; color: #aaa; font-weight: bold; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.2s; cursor: pointer; }
.btn-player.selected { background: #00e676; color: black; border-color: #fff; transform: scale(1.1); box-shadow: 0 0 10px rgba(0,230,118,0.5); }

/* BOTONERA DINÁMICA */
.grid-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 5px; padding-bottom: 20px; }
.btn-game { padding: 10px 5px; font-size: 0.85rem; font-weight: bold; border: none; border-radius: 6px; color: white; cursor: pointer; box-shadow: 0 4px 0 #00000040; position: relative; min-height: 60px; word-wrap: break-word; text-transform: uppercase; display: flex; align-items: center; justify-content: center; }
.btn-game:active { transform: translateY(4px); box-shadow: none; }
.rec-dot { position: absolute; top: 6px; right: 6px; width: 12px; height: 12px; background: #ff1744; border-radius: 50%; box-shadow: 0 0 8px #ff1744; animation: pulse-red 1s infinite; }
.btn-add { background: #222; border: 2px dashed #555; color: #555; font-size: 2rem; box-shadow: none; }

/* COLORES */
.c-amarillo { background: #fbc02d; color: black; }
.c-azul { background: #1565c0; }
.c-rojo { background: #c62828; }
.c-verde { background: #2e7d32; }
.c-gris { background: #616161; }
.c-naranja { background: #ef6c00; }
.c-negro { background: #212121; border: 1px solid #444; }
.c-morado { background: #6a1b9a; }

/* TABS */
.tabs-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #333; margin-bottom: 0; padding: 5px 0; }
.tab-btn { flex: 1; background: none; color: #555; border: none; font-weight: bold; font-size: 0.75rem; padding: 8px 0; cursor: pointer; text-transform: uppercase; border-bottom: 3px solid transparent; transition: all 0.2s; }
.tab-btn.active { color: #00e676; border-bottom-color: #00e676; }
#tabBoard { order: 1; } #tabLog { order: 2; } #tabNotes { order: 3; }

/* LISTA */
.log-list { height: 260px; overflow-y: scroll; background: #1a1a1a; text-align: left; }
.row { padding: 8px; border-bottom: 1px solid #333; display: flex; align-items: center; justify-content: space-between; font-size: 0.85rem; }
.rate-good { border-left: 6px solid #00e676; background: rgba(0, 230, 118, 0.35) !important; }
.rate-bad { border-left: 6px solid #ff1744; background: rgba(255, 23, 68, 0.35) !important; }
.row-actions { display: flex; gap: 5px; }
.btn-icon { background: #333; border: 1px solid #555; padding: 4px 8px; border-radius: 4px; font-size: 1.1rem; transition: all 0.1s; }
.btn-pressed-style { background: #111 !important; box-shadow: inset 0 3px 6px rgba(0,0,0,0.8); transform: translateY(2px); border-color: #222; }
.icon-like.active { color: #00e676; } .icon-dislike.active { color: #ff1744; }
.btn-del-row { background: #b71c1c; border-color: #d32f2f; color: white; }
.audio-player { margin-top: 5px; width: 100%; height: 30px; }

/* NOTAS Y PIZARRA */
#notesArea { display: none; height: 260px; background: #1a1a1a; padding: 0; box-sizing: border-box; }
#matchNotes { width: 100%; height: 100%; background: #222; border: 1px solid #444; color: white; resize: none; padding: 15px; font-size: 1rem; font-family: sans-serif; box-sizing: border-box; outline: none; border:none; }
#matchNotes:focus { background: #2a2a2a; }

#tacticalBoard { display: none; width: 100%; height: 260px; background: #2e7d32; position: relative; overflow: hidden; border: 2px solid #fff; box-sizing: border-box; touch-action: none; }
.pitch-lines { position: absolute; width: 100%; height: 100%; pointer-events: none; background-image: linear-gradient(rgba(255,255,255,0.3) 2px, transparent 2px), linear-gradient(90deg, rgba(255,255,255,0.3) 2px, transparent 2px); background-size: 50px 50px; }
.center-circle { position: absolute; top: 50%; left: 50%; width: 60px; height: 60px; border: 2px solid rgba(255,255,255,0.4); border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.mid-line { position: absolute; top: 0; left: 50%; width: 2px; height: 100%; background: rgba(255,255,255,0.4); pointer-events: none; }
#paintCanvas { position: absolute; top:0; left:0; width:100%; height:100%; z-index: 10; cursor: crosshair; touch-action: none; pointer-events: none;}

.token { position: absolute; width: 24px; height: 24px; border-radius: 50%; font-size: 0.65rem; font-weight: bold; display: flex; align-items: center; justify-content: center; border: 2px solid white; box-shadow: 0 2px 4px rgba(0,0,0,0.5); z-index: 20; cursor: grab; user-select: none; }
.token:active { cursor: grabbing; }
.token-red { background: #c62828; color: white; }
.token-ball { background: white; border: 2px solid black; color: black; z-index: 21; font-size:0.6rem;}

.board-toggle-btn { position: absolute; bottom: 10px; right: 10px; width: 40px; height: 40px; background: #222; border: 1px solid #555; border-radius: 50%; color: white; z-index: 40; font-size: 1.2rem; cursor: pointer; box-shadow: 0 2px 5px rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; }
.board-controls { display: none; position: absolute; bottom: 60px; right: 10px; flex-direction: column; align-items: flex-end; gap: 8px; z-index: 30; background: rgba(0,0,0,0.9); padding: 10px; border-radius: 8px; border: 1px solid #444; }
.board-controls.visible { display: flex; animation: slideUp 0.2s; }
@keyframes slideUp { from {opacity: 0; transform: translateY(10px);} to {opacity: 1; transform: translateY(0);} }
.board-row { display: flex; gap: 8px; align-items: center; }
.btn-board { width: 32px; height: 32px; border-radius: 5px; border: 1px solid #555; background: #333; color: white; font-size: 0.9rem; display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
.btn-board.active { background: #00e676; color: black; border-color: white;}
.color-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #555; cursor: pointer; }
.color-dot.selected { border-color: white; transform: scale(1.2); }

/* MENÚ LATERAL */
.side-menu {
    position: fixed; top: 0; left: -100%; width: 85%; height: 100%;
    background: #141414; z-index: 2000; transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 15px 0 40px rgba(0,0,0,0.6);
    display: flex; flex-direction: column; box-sizing: border-box;
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
}
.menu-header { padding: 25px 20px; background: transparent; display: flex; justify-content: space-between; align-items: center; }
.menu-header span { font-weight: 900; font-size: 1.5rem; letter-spacing: -0.5px; color: #fff; }
.menu-content { padding: 0 20px 80px 20px; overflow-y: auto; flex: 1; text-align: left; }
.menu-section { margin-bottom: 25px; padding-bottom: 25px; border-bottom: 1px solid #2a2a2a; }
.menu-section:last-child { border-bottom: none; }
.menu-section-title { color: #00e676; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; opacity: 0.9; display: block; }
label.lbl-input { display: block; font-size: 0.75rem; color: #888; margin-bottom: 6px; font-weight: 500; }

.tutorial-list { text-align: left; padding: 0 5px; overflow-y: auto; flex: 1; }
.t-item { display: flex; align-items: flex-start; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid #2a2a2a; }
.t-icon { font-size: 1.5rem; width: 40px; text-align: center; margin-right: 15px; flex-shrink: 0; padding-top: 2px; }
.t-desc { font-size: 0.9rem; color: #ccc; line-height: 1.4; }
.t-strong { color: #00e676; font-weight: bold; display: block; margin-bottom: 4px; font-size: 1rem; }

.tutorial-btn { width: 100%; box-sizing: border-box; background: #262626; color: #eee; border: none; border-radius: 8px; font-size: 0.95rem; font-weight: 500; padding: 12px 15px; margin-bottom: 0; transition: background 0.2s, transform 0.1s; display: flex; align-items: center; justify-content: flex-start; gap: 12px; }
.tutorial-btn:active { background: #333; transform: scale(0.99); }
button.tutorial-btn { justify-content: flex-start !important; gap: 15px; }

.settings-select, .tutorial-btn, .btn-action-menu { width: 100%; box-sizing: border-box; background: #222; color: #eee; border: 1px solid transparent; border-radius: 8px; font-size: 0.9rem; padding: 12px 15px; margin-bottom: 0; transition: background 0.2s, transform 0.1s; display: flex; align-items: center; justify-content: space-between; }
.settings-select:active, .tutorial-btn:active, .btn-action-menu:active { background: #2a2a2a; transform: scale(0.99); }
.settings-select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23555%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E"); background-repeat: no-repeat; background-position: right 15px center; background-size: 10px; }

.profile-group { margin-bottom: 15px; }
.profile-row-container { display: flex; gap: 8px; }
.btn-edit-profile { background: #222; border: none; color: #888; width: 46px; border-radius: 8px; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.btn-edit-profile:active { background: #333; color: #fff; }

.share-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.btn-share { background: #222; border: none; color: #ccc; padding: 12px; border-radius: 8px; font-size: 0.85rem; font-weight: 600; }

.vib-row { display: flex; justify-content: space-between; align-items: center; background: #222; padding: 12px 15px; border-radius: 8px; margin-top: 20px; }
.btn-reset-factory { 
    margin-top: 15px; 
    background: rgba(211, 47, 47, 0.15) !important; /* Fondo rojo suave */
    color: #ff5252 !important;                      /* Texto rojo vivo */
    border: 1px solid rgba(255, 82, 82, 0.5) !important; /* Borde rojo */
    text-align: center; 
    justify-content: center;
}
.hist-section { margin-top: 10px; }
.saved-match-card { background: #202020; padding: 12px; border-radius: 8px; margin-bottom: 10px; border-left: 3px solid #00e676; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.sm-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.sm-title { font-weight: 700; font-size: 0.95rem; color: #fff; line-height: 1.2; }
.sm-date { font-size: 0.7rem; color: #777; margin-top: 2px; }
.sm-actions { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 5px; }
.btn-sm { background: #333; border: none; color: #ccc; padding: 8px 4px; border-radius: 4px; font-size: 0.65rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.btn-sm-play { color: #00e676; background: rgba(0, 230, 118, 0.1); }
.btn-sm-xls { color: #b388ff; background: rgba(179, 136, 255, 0.1); }
.btn-sm-xml { color: #ffab40; background: rgba(255, 171, 64, 0.1); }
.btn-sm-del { background: #3a1c1c; color: #ff5252; width: 32px; }

.credits-section { text-align: center; margin-top: 30px; opacity: 0.6; }
.donation-card { background: #1f1f1f; padding: 15px; border-radius: 8px; margin-top: 10px; text-align: center; border: 1px solid #333;}
.warning-box { background: rgba(255, 143, 0, 0.08); border: 1px solid rgba(255, 143, 0, 0.2); color: #ffb74d; padding: 12px; border-radius: 8px; font-size: 0.8rem; margin-top: 20px; display: flex; gap: 10px; align-items: flex-start; }

.btn-modal { width: 100%; height: 55px !important; border: none; border-radius: 8px; font-weight: 600; font-size: 1.1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; text-transform: uppercase; box-shadow: 0 4px 0 rgba(0,0,0,0.4); transition: transform 0.1s; letter-spacing: 0.5px; margin: 5px 0; }
.btn-modal:active { transform: translateY(3px); box-shadow: none; }
.btn-green { background: #00e676 !important; color: #000 !important; }
.btn-grey { background-color: #555 !important; color: #ccc !important; }
.btn-red { background-color: #d32f2f !important; color: #fff !important; }
.btn-yellow { background-color: #ffc107 !important; color: #000 !important; }
.modal-actions-column { display: flex; flex-direction: column; gap: 15px; width: 100%; margin-top: 10px; }

.modal-overlay { display: none; position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.9); z-index: 3000; align-items: center; justify-content: center; }
.modal-content { background: #222; color: white; padding: 20px; border-radius: 8px; width: 85%; border: 1px solid #555; text-align: center; max-height: 85vh; display: flex; flex-direction: column; }
.modal-content h3 { color: #00e676 !important; margin-top: 0; }
.color-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 15px 0; }
.color-opt { height: 35px; border-radius: 5px; cursor: pointer; border: 2px solid transparent; }
.color-opt.selected { border-color: white; transform: scale(1.1); }
input[type="text"], textarea { width: 100%; padding: 10px; background: #333; border: 1px solid #555; color: white; border-radius: 5px; box-sizing: border-box;}

.picker-frame { display: flex; justify-content: center; gap: 5px; height: 160px; margin: 15px 0; position: relative; background: #111; border-radius: 10px; border: 1px solid #333; overflow: hidden; }
.picker-frame::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 50px; background: linear-gradient(to bottom, #111, rgba(17,17,17,0)); pointer-events: none; z-index: 2; }
.picker-frame::after { content: ""; position: absolute; bottom: 0; left: 0; width: 100%; height: 50px; background: linear-gradient(to top, #111, rgba(17,17,17,0)); pointer-events: none; z-index: 2; }
.picker-highlight { position: absolute; top: 50%; left: 0; width: 100%; height: 40px; margin-top: -20px; border-top: 2px solid #00e676; border-bottom: 2px solid #00e676; background: rgba(0, 230, 118, 0.1); pointer-events: none; z-index: 1; }
.picker-col { flex: 1; height: 100%; overflow-y: scroll; scroll-snap-type: y mandatory; scrollbar-width: none; position: relative; z-index: 3; }
.picker-col::-webkit-scrollbar { display: none; }
.picker-col-content { padding-top: 60px; padding-bottom: 60px; }
.picker-item { height: 40px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: bold; color: #888; scroll-snap-align: center; }
.picker-sep { display:flex; align-items:center; font-weight:bold; font-size:1.5rem; color: #555; z-index: 3;}
.input-error { border: 1px solid #d32f2f !important; animation: shake 0.5s; }
@keyframes shake { 0% { transform: translateX(0); } 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-5px); } 100% { transform: translateX(0); } }

#toast { visibility: hidden; min-width: 250px; background-color: #333; color: #fff; text-align: center; border-radius: 2px; padding: 16px; position: fixed; z-index: 5000; left: 50%; bottom: 80px; transform: translateX(-50%); box-shadow: 0 0 10px rgba(0,0,0,0.5); border-left: 5px solid #00e676; font-weight: bold; }
#toast.show { visibility: visible; animation: fadein 0.5s, fadeout 0.5s 2.5s; }
@keyframes fadein { from {bottom: 0; opacity: 0;} to {bottom: 80px; opacity: 1;} }
@keyframes fadeout { from {bottom: 80px; opacity: 1;} to {bottom: 0; opacity: 0;} }

.roster-select-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; margin-top: 15px; }
.btn-roster-opt { background: #333; padding: 12px; border: 1px solid #555; color: white; border-radius: 5px; text-align: left; display: flex; justify-content: space-between; align-items: center; cursor: pointer;}
.btn-roster-opt.active { border-color: #00e676; background: rgba(0,230,118,0.1); }
.btn-roster-del { background: #b71c1c; color: white; border: none; padding: 5px 10px; border-radius: 4px; font-size: 0.8rem; margin-left: 10px; }

.drum-container { height: 150px; overflow-y: scroll; background: #111; border: 1px solid #444; border-radius: 5px; margin-top: 10px; scroll-snap-type: y mandatory;}
.drum-item { height: 50px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: bold; color: #888; scroll-snap-align: center; border-bottom: 1px solid #222; cursor: pointer;}
.drum-item.selected { background: #00e676; color: black; font-weight: 900; border-color: white; }

.modal-audio-controls { display: flex; gap: 10px; justify-content: center; margin-bottom: 15px; background: #333; padding: 10px; border-radius: 8px; }
.btn-audio { width: 50px; height: 50px; border-radius: 50%; border: none; font-size: 1.5rem; cursor: pointer; display: flex; align-items: center; justify-content: center;}
.btn-rec { background: #ff1744; color: white; }
.btn-rec.recording { animation: pulse-rec 1s infinite; }
.btn-stop { background: #fff; color: black; }
.btn-del-audio { background: #333; border: 1px solid #555; color: #ccc; font-size: 1rem; width: 40px; height: 40px; }
@keyframes pulse-rec { 0% { opacity: 1; transform:scale(1);} 50% { opacity: 0.8; transform:scale(1.1);} 100% { opacity: 1; transform:scale(1);} }

audio::-webkit-media-controls-current-time-display, audio::-webkit-media-controls-time-remaining-display { display: none !important; }
audio::-webkit-media-controls-timeline { flex: 1; }

.zone-grid-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: none; grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; z-index: 50; }
.btn-zone-toggle { position: absolute; top: 10px; right: 10px; width: 45px; height: 45px; background: rgba(0,0,0,0.6); border: 2px solid #555; border-radius: 8px; color: #ccc; font-size: 1.5rem; z-index: 60; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.btn-zone-toggle.active { background: #ff9800; color: black; border-color: white; box-shadow: 0 0 15px rgba(255, 152, 0, 0.5); }
.board-toggle-btn { z-index: 60 !important; }
.board-controls { z-index: 60 !important; }
.zone-cell { border: 1px dashed rgba(255, 255, 255, 0.3); display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 900; color: rgba(255, 255, 255, 0.2); cursor: pointer; text-transform: uppercase; }
.zone-cell.active { background-color: rgba(0, 230, 118, 0.4); color: white; border: 2px solid #00e676; }

.video-mode-active { background: rgba(3, 169, 244, 0.05) !important; border: none !important; padding-bottom: 25px; }
#videoModeContainer { width: 100%; flex-basis: 100%; order: 10; text-align: center; margin-top: 5px; display: none; }
#videoTimerDisplay { font-family: 'Courier New', monospace; font-size: 1.4rem; color: #03a9f4; font-weight: bold; margin: 10px 0; letter-spacing: 1px; }
#videoControls { width: 100%; display: flex; justify-content: center; }
.vid-row { display: flex; gap: 3px; width: 100%; justify-content: center; padding: 0 2px; }
.btn-vid-ctrl { flex: 1; background: #263238; border: 1px solid #37474f; color: #b0bec5; padding: 14px 0; border-radius: 6px; font-size: 0.75rem; font-weight: bold; touch-action: manipulation; min-width: 0; white-space: nowrap; }
.btn-vid-play { background: #0277bd; color: white; font-size: 1.4rem; flex: 1.8; border-color: #0288d1; z-index: 5; }
.active-video { background: #90caf9 !important; color: #0d47a1 !important; border-color: #64b5f6 !important; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* --- CORRECCIÓN BOTONES DENTRO DE MODALES (Referencia: Estilos 2) --- */
/* Esto hace que los botones "Cerrar", "Copiar", "Sí/No" ocupen el ancho completo y sean grandes */
.modal-content .btn-ctrl {
    width: 100%;        /* Ancho completo */
    flex: 1;            /* Repartir espacio si hay varios */
    margin: 0;
    height: 50px;       /* Altura cómoda para el dedo */
    font-size: 1rem;
    font-weight: bold !important;
    justify-content: center; /* Texto centrado */
    border-radius: 8px;
}

/* Contenedor de botones en modales (Alertas, Confirmaciones) */
/* Busca el div que contiene los botones y asegúrate de que se expanda */
.modal-content > div:last-child, 
.modal-actions-column {
     width: 100%;
     display: flex;
     justify-content: center;
     gap: 10px;         /* Espacio entre botones */
     margin-top: 15px;
}

/* Asegurar que el área de texto (Exportar/Importar) no se desborde */
.modal-content textarea, 
.modal-content input {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
}

/* --- CORRECCIÓN MENÚ: MÁS COMPACTO --- */

/* Menos espacio entre bloques del menú */
.menu-section {
    margin-bottom: 15px; /* Antes era mucho más */
    padding-bottom: 15px;
    border-bottom: 1px solid #2a2a2a;
}

/* Botones del menú más finos */
.settings-select, 
.tutorial-btn, 
.btn-action-menu,
.btn-share {
    width: 100%;
    box-sizing: border-box;
    background: #222;
    color: #eee;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.9rem;
    /* REDUCIDO: Antes 12px 15px -> Ahora 10px 12px para que sean menos altos */
    padding: 10px 12px; 
    min-height: 45px; /* Altura mínima controlada */
    margin-bottom: 0;
    display: flex; 
    align-items: center; 
    justify-content: space-between;
}

/* Texto de las secciones (CONFIGURACIÓN, ETC) un poco más pegado */
.menu-section-title {
    margin-bottom: 8px; /* Reducido */
    font-size: 0.75rem;
}


/* --- ESTÉTICA MODALES (Más compactos y armoniosos) --- */

.modal-content {
    background: #222;
    color: white;
    /* Padding reducido lateralmente para móviles estrechos */
    padding: 20px 15px; 
    border-radius: 10px; /* Radio un poco más suave */
    width: 85%;
    max-width: 360px; /* Un poco más estrecho (antes 380px) */
    border: 1px solid #444;
    text-align: center;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0,0,0,0.8);
}

/* Títulos de modales más pequeños */
.modal-content h3 {
    font-size: 1.2rem !important; /* Antes 1.4rem (demasiado grande) */
    margin-top: 0;
    margin-bottom: 15px; /* Menos espacio debajo del título */
    line-height: 1.2;
}

/* Textos descriptivos más compactos */
.modal-content p {
    font-size: 0.9rem;
    margin-bottom: 15px;
    line-height: 1.4;
    color: #ccc;
}

/* Columna de botones: Menos separación entre ellos */
.modal-actions-column {
    display: flex;
    flex-direction: column;
    gap: 8px; /* Antes 15px (demasiado separado) */
    width: 100%;
    margin-top: 10px;
}

/* --- BOTONES GRANDES DEL MODAL (Guardar, Salir, etc) --- */
.btn-modal {
    width: 100%;
    /* Altura reducida drásticamente para elegancia (55px -> 44px) */
    height: 44px !important; 
    border: none;
    border-radius: 6px;
    font-weight: 600;
    /* Fuente reducida (1.1rem -> 0.95rem) */
    font-size: 0.95rem; 
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    box-shadow: 0 2px 0 rgba(0,0,0,0.3);
    letter-spacing: 0.5px;
    margin: 2px 0; /* Margen vertical mínimo */
}

/* --- BOTONES PEQUEÑOS/MEDIANOS (Alertas, Confirmaciones) --- */
.modal-content .btn-ctrl {
    width: 100%;
    flex: 1;
    margin: 0;
    /* Altura reducida (50px -> 42px) */
    height: 42px; 
    font-size: 0.9rem; /* Fuente más pequeña */
    font-weight: 600 !important;
    justify-content: center;
    border-radius: 6px;
}

/* Inputs dentro de modales (Texto, Nombre equipo...) */
.modal-content input[type="text"], 
.modal-content input[type="number"],
.modal-content textarea {
    padding: 8px 10px; /* Padding interno reducido */
    font-size: 1rem;
    margin: 5px 0 15px 0; /* Menos margen alrededor */
    border-radius: 6px;
    background: #111;
    border: 1px solid #444;
    color: white;
    width: 100%;
    box-sizing: border-box;
}

/* CORRECCIÓN: El texto de las alertas genéricas (como notas de voz) debe ser blanco, no verde */
#genAlertMsg {
    color: #e0e0e0 !important;
    font-weight: 400 !important;
    font-size: 1rem !important;
    margin-top: 10px;
}