:root {
    --bg: #f8fafc;
    --text: #1e293b;
    --primary: #f97316;
    --primary-hover: #ea580c;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --danger: #ef4444;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }
body { background: var(--bg); color: var(--text); -webkit-tap-highlight-color: transparent; }

/* HEADER / FOOTER */
.app-header {
    background: #1e293b; color: #fff; padding: 15px 20px; 
    display: flex; justify-content: space-between; align-items: center; 
    position: fixed; width: 100%; left: 0; z-index: 1000;
}
@media (min-width: 601px) {
    .app-header { top: 0; bottom: auto; }
    body { padding-top: 60px; padding-bottom: 0; }
}
@media (max-width: 600px) {
    .app-header { bottom: 0; top: auto; }
    body { padding-bottom: 70px; padding-top: 0; }
}
.header-logo { font-weight: 900; font-size: 1.2rem; letter-spacing: 1px; color: var(--primary); }
.header-user { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; font-weight: 600; }
.btn-icon { background: none; border: none; color: #fff; font-size: 1.2rem; cursor: pointer; }
.btn-install { background: #10b981; color: #fff; border: none; padding: 8px 12px; border-radius: 8px; font-weight: bold; cursor: pointer; display: none; margin-right: 10px; font-size: 0.9rem; }

/* INSTALL MODAL iOS */
.ios-install-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); z-index: 2000;
    display: none; justify-content: center; align-items: center; padding: 20px;
}
.ios-install-modal.active { display: flex; }
.ios-install-card {
    background: #fff; color: #1e293b; border-radius: 12px; padding: 25px; text-align: center; max-width: 320px;
}
.ios-install-card img { width: 60px; height: 60px; margin-bottom: 15px; }
.btn-close-modal { background: #e2e8f0; border: none; padding: 10px 20px; border-radius: 8px; font-weight: bold; margin-top: 20px; cursor: pointer; width: 100%; }

/* LAYOUT */
.app-container { padding: 20px; max-width: 800px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* LOGIN */
.login-card { background: var(--card-bg); padding: 30px 20px; border-radius: 12px; border: 1px solid var(--border); margin-top: 40px; text-align: center; }
.login-card h2 { margin-bottom: 20px; color: var(--text); }
.form-group { margin-bottom: 15px; text-align: left; }
.form-group label { display: block; margin-bottom: 5px; font-size: 0.9rem; font-weight: 600; color: #64748b; }
.form-group input { width: 100%; padding: 12px; border: 2px solid var(--border); border-radius: 8px; font-size: 1rem; outline: none; }
.form-group input:focus { border-color: var(--primary); }
.btn-primary { width: 100%; background: var(--primary); color: #fff; border: none; padding: 15px; border-radius: 8px; font-size: 1rem; font-weight: 700; cursor: pointer; }
.error-msg { color: var(--danger); font-size: 0.9rem; margin-top: 10px; font-weight: 600; }

/* CANCHAS */
.view-title { font-size: 1.3rem; margin-bottom: 20px; text-align: center; font-weight: 800; }
.canchas-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; }
.cancha-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer; }
.cancha-card img { width: 100%; height: 150px; object-fit: cover; display: block; }
.cancha-card h3 { padding: 15px; text-align: center; font-size: 1.1rem; color: var(--text); }

/* PARTIDOS */
.view-header { display: flex; align-items: center; margin-bottom: 20px; gap: 15px; }
.view-header h2 { margin: 0; font-size: 1.1rem; flex: 1; }
.btn-back { background: #e2e8f0; border: none; padding: 10px 15px; border-radius: 8px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 5px; }

.partidos-list { display: flex; flex-direction: column; gap: 15px; }
.partido-item { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 15px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; }
.partido-info { font-size: 0.8rem; font-weight: 700; color: #64748b; text-align: center; text-transform: uppercase; }
.partido-teams { display: flex; justify-content: space-between; align-items: center; }
.team-row { display: flex; flex-direction: column; align-items: center; gap: 5px; flex: 1; text-align: center; }
.team-row img { width: 40px; height: 40px; object-fit: contain; }
.team-row span { font-weight: 700; font-size: 0.95rem; }
.vs { font-weight: 900; color: #cbd5e1; font-size: 1.2rem; }

.partido-finalizado {
    opacity: 0.6;
    background: #f1f5f9;
    cursor: default;
    border-color: #cbd5e1;
}
.partido-finalizado .partido-info {
    color: #94a3b8;
}
.final-score-badge {
    text-align: center;
    background: #e2e8f0;
    padding: 5px 10px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 1rem;
    margin-top: 10px;
    color: #475569;
}

/* PIZARRA */
.scoreboard { display: flex; flex-direction: column; gap: 20px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
@media (min-width: 600px) { .scoreboard { flex-direction: row; align-items: stretch; } }
.team-panel { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 15px; background: #f1f5f9; padding: 20px; border-radius: 12px; }
.team-panel h3 { font-size: 1.2rem; text-align: center; margin: 0; }
.score-controls { display: flex; align-items: center; gap: 15px; width: 100%; justify-content: center; }
.btn-score { width: 50px; height: 50px; border-radius: 50%; border: none; font-size: 1.5rem; font-weight: 900; color: #fff; cursor: pointer; }
.btn-score.minus { background: #94a3b8; }
.btn-score.plus { background: var(--primary); }
.score-display { font-size: 3.5rem; font-weight: 900; min-width: 70px; text-align: center; line-height: 1; }

.center-panel { display: flex; flex-direction: column; justify-content: center; gap: 20px; align-items: center; }
.set-selector { display: flex; gap: 10px; background: #e2e8f0; padding: 5px; border-radius: 8px; }
.set-btn { padding: 10px 15px; font-weight: 700; border-radius: 6px; cursor: pointer; color: #64748b; }
.set-btn.active { background: #fff; color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; border: none; padding: 15px 20px; border-radius: 8px; font-weight: 700; cursor: pointer; width: 100%; }
