/* --- ZÁKLADNÍ RESET & PROMĚNNÉ (Zkopírováno z inspirace.html) --- */
* { box-sizing: border-box; } 

:root {
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.85);
    --border-tech: rgba(148, 163, 184, 0.2);
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.4);
    --accent-green: #10b981; 
    --accent-orange: #f97316; 
    --accent-red: #ef4444;    
    --accent-purple: #a855f7;
    --text-main: #f1f5f9; 
    --text-muted: #94a3b8;
    --tech-font: 'Exo 2', sans-serif;
    --body-font: 'Inter', sans-serif;
}

body {
    font-family: var(--body-font); 
    /* Pokud nemáš bg.jpg, použije se tmavá barva */
    background: #020617 url('../bg.jpg') no-repeat center center fixed;
    background-size: cover;
    color: var(--text-main); 
    display: flex; justify-content: center; align-items: flex-start;
    min-height: 100vh; margin: 0; padding: 20px 10px;
}

/* --- TECH CARD DESIGN --- */
.card {
    background: var(--bg-card); 
    backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--border-tech); 
    border-top: 1px solid rgba(255,255,255,0.15);
    border-radius: 24px; 
    padding: 0; 
    width: 100%; max-width: 500px; 
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(255,255,255,0.05);
    position: relative; overflow: hidden;
    animation: fadeInUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    padding-bottom: 20px;
}

/* Mřížka na pozadí karty */
.card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-image: 
        linear-gradient(var(--border-tech) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-tech) 1px, transparent 1px);
    background-size: 30px 30px;
    opacity: 0.15; pointer-events: none; z-index: 0;
}

@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* --- STATUS BAR --- */
.status-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 25px;
    background: rgba(15, 23, 42, 0.6);
    border-bottom: 1px solid var(--border-tech);
    font-family: var(--tech-font); font-size: 0.7rem; letter-spacing: 1px;
    text-transform: uppercase; color: var(--text-muted);
    position: relative; z-index: 2;
}
.status-left, .status-right { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.status-dot { width: 8px; height: 8px; background: var(--text-muted); border-radius: 50%; transition: 0.3s; }
.status-dot.connected { background: var(--accent-green); box-shadow: 0 0 8px var(--accent-green); }

/* --- HLAVIČKA --- */
.app-header {
    padding: 25px 25px 10px 25px; text-align: center; position: relative; z-index: 2;
}
h1 {
    font-family: var(--tech-font); margin: 0; font-size: 2.2rem; font-weight: 800;
    color: white; text-transform: uppercase; letter-spacing: -1px;
    text-shadow: 0 2px 15px rgba(0,0,0,0.5);
    line-height: 1;
    background: linear-gradient(to bottom, #fff, #cbd5e1);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.slogan { 
    font-family: var(--tech-font); font-size: 0.7rem; color: var(--primary); 
    text-transform: uppercase; letter-spacing: 3px; margin-top: 8px; opacity: 0.9; 
    font-weight: 600; text-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

/* --- OBSAH & MONITOR UI --- */
.content-wrap { padding: 0 25px; position: relative; z-index: 2; }

/* Hlavní tlačítko (Action Btn) - převzato 1:1 */
.action-btn { 
    width: 100%; padding: 18px; 
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); 
    border: none; border-radius: 16px; 
    color: white; font-family: var(--tech-font); font-size: 1rem; font-weight: 800; 
    cursor: pointer; transition: 0.3s; text-transform: uppercase; letter-spacing: 2px; 
    box-shadow: 0 5px 20px rgba(37, 99, 235, 0.4); border-top: 1px solid rgba(255,255,255,0.2);
    position: relative; overflow: hidden; margin-bottom: 20px;
}
.action-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(37, 99, 235, 0.6); }
.action-btn:disabled { background: #334155; box-shadow: none; color: #94a3b8; cursor: not-allowed; }

/* Sekce */
.section-box { margin-bottom: 20px; }
.section-label { 
    color: var(--text-muted); font-size: 0.7rem; text-transform: uppercase; 
    font-weight: 700; letter-spacing: 1.2px; margin-bottom: 8px; 
    font-family: var(--tech-font);
}

/* Primární metriky (Watts + Pace) */
.primary-metrics {
    display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 15px;
}
.metric-box {
    background: rgba(0,0,0,0.3); border: 1px solid var(--border-tech);
    border-radius: 16px; padding: 15px; text-align: center;
    position: relative;
}
.value-huge {
    font-family: var(--tech-font); font-size: 2.8rem; font-weight: 800;
    color: white; line-height: 1.1;
    text-shadow: 0 0 20px rgba(255,255,255,0.1);
}
.unit-label {
    font-size: 0.7rem; color: var(--text-muted); font-weight: 600;
}

/* Sekundární mřížka (SPM, Dist, Time) */
.secondary-grid {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px;
}
.mini-card {
    background: rgba(255,255,255,0.03); border: 1px solid var(--border-tech);
    border-radius: 12px; padding: 10px 5px; text-align: center;
}
.value-medium {
    font-family: var(--tech-font); font-size: 1.4rem; font-weight: 700; color: #e2e8f0;
}

/* Animal Badge (Gamifikace) - přesná kopie stylu */
.animal-badge { 
    background: linear-gradient(135deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01)); 
    border-radius: 16px; padding: 15px 20px; 
    display: flex; align-items: center; justify-content: space-between; 
    border: 1px solid var(--border-tech); position: relative; 
}
.animal-icon { font-size: 3rem; margin-right: 15px; filter: drop-shadow(0 0 10px rgba(255,255,255,0.1)); }
.animal-info { text-align: left; flex: 1; }
.animal-title { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; letter-spacing: 1px; }
.animal-name { font-size: 1.3rem; font-family: var(--tech-font); font-weight: 800; color: #fcd34d; text-shadow: 0 0 15px rgba(252, 211, 77, 0.3); }
.animal-watts { text-align: right; }
.watt-val { font-size: 1.4rem; font-weight: 800; color: #fff; font-family: var(--tech-font); }

/* XP Bar pod zvířátkem */
.xp-track-container {
    height: 6px; background: rgba(0,0,0,0.4); border-radius: 3px; 
    margin-top: 10px; overflow: hidden; position: relative;
}
.xp-track-bar {
    height: 100%; background: var(--primary); 
    box-shadow: 0 0 10px var(--primary);
    transition: width 0.5s ease;
}

/* Graf */
.graph-container {
    height: 120px; background: rgba(0,0,0,0.2); 
    border: 1px solid var(--border-tech); border-radius: 12px;
    width: 100%; position: relative;
}
canvas { width: 100%; height: 100%; display: block; }

/* Patička */
.app-footer {
    text-align: center;
    padding-top: 15px;
    margin-top: 20px;
    border-top: 1px dashed var(--border-tech);
    color: var(--text-muted);
    font-size: 0.65rem;
    font-family: var(--tech-font);
    letter-spacing: 1px;
    text-transform: uppercase;
}
.f-row { margin-bottom: 5px; }
.f-ver { color: var(--primary); font-weight: 700; text-shadow: 0 0 10px var(--primary-glow); }

/* Responzivita pro menší mobily */
@media (max-width: 380px) {
    .value-huge { font-size: 2.2rem; }
    .secondary-grid { grid-template-columns: 1fr; }
    .mini-card { display: flex; justify-content: space-between; align-items: center; padding: 10px 20px; }
}

/* --- LANDSCAPE MODE (FULLSCREEN) --- */
#landscape-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: #000; /* Čistě černé pozadí pro kontrast */
    z-index: 9999;
    padding: 10px;
    display: flex;
    flex-direction: column;
}

#landscape-overlay.hidden {
    display: none !important;
}

.land-grid {
    display: grid;
    grid-template-columns: 1.8fr 1fr; /* Levá část větší (Tempo) */
    height: 100%;
    width: 100%;
    gap: 10px;
}

.land-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    background: rgba(20, 30, 50, 0.5);
}

.land-pace-box {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
}

.land-right-col {
    display: grid;
    grid-template-rows: 1fr 1fr 0.8fr; /* SPM, Čas, Metry */
    gap: 10px;
}

/* TYPOGRAFIE PRO LANDSCAPE */
.land-label {
    font-family: var(--tech-font);
    color: var(--text-muted);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.land-val-huge {
    font-family: var(--tech-font);
    font-weight: 800;
    font-size: 25vw; /* Dynamická velikost podle šířky */
    color: #fff;
    line-height: 0.9;
    text-shadow: 0 0 20px rgba(255,255,255,0.2);
}

.land-val-big {
    font-family: var(--tech-font);
    font-weight: 700;
    font-size: 12vh; /* Dynamická velikost podle výšky */
    color: var(--accent-orange);
}

.land-val-med {
    font-family: var(--tech-font);
    font-weight: 600;
    font-size: 6vh;
    color: #e2e8f0;
}

/* Zavírací tlačítko */
.land-close {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10000;
}

/* Úprava pro případ, že mobil je stále na výšku, i když je zapnutý overlay */
@media (orientation: portrait) {
    .land-val-huge { font-size: 18vw; }
    .land-grid { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
    .land-right-col { grid-template-rows: 1fr 1fr; grid-template-columns: 1fr 1fr; }
    /* Schováme metry v portrait módu overlaye, aby se to tam vešlo, nebo upravíme grid */
    .land-right-col .land-box:last-child { grid-column: span 2; }
}