/* =============================================
   Thomas Monitor — Glassmorphism Dark Theme
   Version 16 — 2026-07-10
   ============================================= */

:root {
    --bg-primary: #0c0a04;
    --bg-secondary: #14120a;
    --glass-bg: rgba(28, 25, 16, 0.65);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --glass-blur: 20px;
    
    --text-primary: #f0ece4;
    --text-secondary: rgba(240, 236, 228, 0.6);
    --text-tertiary: rgba(240, 236, 228, 0.35);
    
    --accent: #4ade80;
    --accent-hover: #6ee7a0;
    --accent-glow: rgba(74, 222, 128, 0.25);
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #f87171;
    
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --star-opacity: 0.6;
}

body.light-mode {
    --bg-primary: #e8f0e8;
    --bg-secondary: #dce6dc;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(0, 0, 0, 0.06);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    
    --text-primary: #1a2e1a;
    --text-secondary: rgba(26, 46, 26, 0.6);
    --text-tertiary: rgba(26, 46, 26, 0.35);
    
    --accent: #16a34a;
    --accent-hover: #15803d;
    --accent-glow: rgba(22, 163, 74, 0.2);
    --success: #16a34a;
    
    --star-opacity: 0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100%;
    overflow-x: hidden;
    position: relative;
}

/* === Star Background === */
#stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    transition: background 0.8s ease;
    background: 
        radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 40% 70%, rgba(255,255,255,0.2), transparent),
        radial-gradient(1.5px 1.5px at 60% 20%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 80% 50%, rgba(255,255,255,0.15), transparent),
        radial-gradient(1.5px 1.5px at 10% 80%, rgba(255,255,255,0.25), transparent),
        radial-gradient(1px 1px at 50% 90%, rgba(255,255,255,0.2), transparent),
        radial-gradient(1px 1px at 70% 60%, rgba(255,255,255,0.15), transparent),
        radial-gradient(1px 1px at 90% 10%, rgba(255,255,255,0.2), transparent),
        radial-gradient(1px 1px at 30% 50%, rgba(255,255,255,0.15), transparent),
        radial-gradient(1px 1px at 15% 15%, rgba(255,255,255,0.2), transparent),
        radial-gradient(1px 1px at 85% 85%, rgba(255,255,255,0.15), transparent),
        radial-gradient(1px 1px at 45% 45%, rgba(255,255,255,0.2), transparent);
    background-color: var(--bg-primary);
    animation: twinkle 8s ease-in-out infinite alternate;
    opacity: var(--star-opacity);
}

@keyframes twinkle {
    0% { opacity: 0.4; }
    100% { opacity: 0.8; }
}

#three-bg {
    z-index: 1;
    opacity: 0;
    transition: opacity 1.5s ease;
}

#three-bg.ready {
    opacity: 1;
}

/* === Container === */
.container {
    position: relative;
    z-index: 2;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* === Glass Card === */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow);
    transition: var(--transition);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

/* === Header === */
.header {
    padding: 16px 24px;
    margin-bottom: 24px;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    font-size: 2rem;
    line-height: 1;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* === Theme Toggle === */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
    color: var(--text-secondary);
    line-height: 1;
}

.theme-toggle:hover {
    background: rgba(74, 222, 128, 0.12);
    border-color: rgba(74, 222, 128, 0.3);
    color: var(--accent);
}

.light-mode .theme-toggle:hover {
    background: rgba(22, 163, 74, 0.1);
    border-color: rgba(22, 163, 74, 0.3);
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.2);
    border-radius: 20px;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.live-text {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--success);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.clock {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
}

/* === Section Header === */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.section-header h2 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.section-icon {
    font-size: 1.1rem;
}

.section-badge {
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.15);
    color: var(--text-secondary);
}

/* === Main Grid === */
.main-grid {
    display: grid;
    /* links: minmax(0, …) — die Webcam-Spalte MUSS unter den min-content des
       white-space:nowrap-Zeitraffers (~982px) schrumpfen dürfen, sonst wächst
       das ganze Grid auf 1409px und die Wetter-Karte wird von
       html { overflow-x: hidden } abgeschnitten.
       rechts: Mindestbreite reservieren, die das 6-spaltige Stat-Grid braucht
       (~420px), sonst ragen bei 900–1120px die letzten Karten aus der Karte. */
    grid-template-columns: minmax(0, 1.6fr) minmax(420px, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

/* Grid items MÜSSEN schrumpfen dürfen.
   Default ist min-width: auto = min-content. Der Zeitraffer ist
   white-space: nowrap, sein min-content (~9 Thumbs + Padding) ist ~982px breit,
   damit konnte die 1.6fr-Spalte nicht schrumpfen -> das Grid wuchs auf 1409px
   und die Wetter-Karte wurde von html { overflow-x: hidden } abgeschnitten.
   min-width: 0 lässt die Spalte ihrem fr-Anteil folgen, der Strip scrollt intern. */
.main-grid > * {
    min-width: 0;
}

/* === Webcam Section === */
.webcam-section {
    padding: 20px;
}

.webcam-wrapper {
    width: 100%;
    overflow: hidden;
}

.webcam-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #000;
    border: 1px solid var(--glass-border);
}

.webcam-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.5s ease;
}

.webcam-skeleton {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: linear-gradient(135deg, #1a1812 0%, #0c0a04 100%);
    z-index: 2;
}

.skeleton-camera-icon {
    font-size: 3rem;
    opacity: 0.4;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.skeleton-pulse {
    width: 120px;
    height: 120px;
    border: 2px solid rgba(74, 222, 128, 0.15);
    border-radius: 50%;
    position: absolute;
    animation: pulse-ring 2s ease-out infinite;
}

@keyframes pulse-ring {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(1.4); opacity: 0; }
}

.skeleton-text {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    animation: pulse-text 1.5s ease-in-out infinite;
}

@keyframes pulse-text {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.webcam-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 3;
}

.overlay-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.overlay-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
}

.overlay-res {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.6);
}

.overlay-timestamp {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
}

.webcam-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.ctrl-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.ctrl-btn:hover {
    background: rgba(74, 222, 128, 0.12);
    border-color: rgba(74, 222, 128, 0.3);
    color: var(--text-primary);
}

.ctrl-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ctrl-btn.small {
    padding: 4px 10px;
    font-size: 0.72rem;
}

.ctrl-btn.active {
    background: rgba(74, 222, 128, 0.15);
    border-color: var(--accent);
    color: var(--accent);
}

.ctrl-status {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    margin-left: auto;
}

/* === Zoom Overlay === */
.zoom-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.25s ease;
}

.zoom-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: rgba(0,0,0,0.5);
    z-index: 2;
}

.zoom-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.zoom-actions {
    display: flex;
    gap: 8px;
}

.zoom-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
}

.zoom-btn:hover {
    background: rgba(74, 222, 128, 0.15);
    border-color: rgba(74, 222, 128, 0.3);
    color: #fff;
}

.zoom-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    cursor: grab;
    touch-action: none;
}

.zoom-viewport:active {
    cursor: grabbing;
}

.zoom-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform-origin: 0 0;
    transition: none;
    image-rendering: auto;
    will-change: transform;
}

.zoom-image.zoomed {
    object-fit: contain;
}

.zoom-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: rgba(0,0,0,0.5);
    font-size: 0.75rem;
    color: var(--text-tertiary);
    z-index: 2;
}

.zoom-level {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.zoom-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.zoom-nav-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: background 0.2s;
}

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

.zoom-nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.zoom-time {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    min-width: 70px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.weather-hero {
    position: relative;
    margin-bottom: 20px;
    min-height: 110px;
}

.weather-hero-skeleton {
    padding: 12px 0;
    min-height: 88px;
}

.weather-hero-content {
    animation: fadeIn 0.4s ease;
    min-height: 110px;
}

.hero-temp-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 6px;
}

.hero-temp {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--text-primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    cursor: pointer;
    transition: var(--transition);
}

.hero-temp:hover {
    opacity: 0.8;
}

.hero-condition {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hero-icon {
    font-size: 2rem;
    line-height: 1;
    color: var(--accent);
    animation: weatherPulse 3s ease-in-out infinite;
}

@keyframes weatherPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.8; }
}

.hero-desc {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.hero-meta-secondary {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.hero-sep {
    opacity: 0.4;
    font-weight: 700;
}

.hero-feels span,
.hero-taupunkt span,
.hero-heatindex span {
    font-weight: 600;
    color: var(--text-primary);
}

.hero-location i {
    color: var(--accent);
    font-size: 0.7rem;
    vertical-align: middle;
}

/* === Weather Value Animation === */
.stat-value, .hero-temp, .hero-feels span, .hero-taupunkt span, .hero-heatindex span,
.weather-value {
    transition: color 0.4s ease;
}

.stat-value.flash-up {
    animation: flashValue 0.8s ease;
    color: var(--success);
}

.stat-value.flash-down {
    animation: flashValue 0.8s ease;
    color: var(--danger);
}

.hero-temp.flash-up {
    animation: flashHero 0.8s ease;
    color: var(--success);
}

.hero-temp.flash-down {
    animation: flashHero 0.8s ease;
    color: var(--danger);
}

@keyframes flashValue {
    0% { transform: scale(1.1); }
    50% { transform: scale(1.05); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes flashHero {
    0% { transform: scale(1.08); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

/* Gentle number transition */
.stat-value, .weather-value {
    font-variant-numeric: tabular-nums;
}

/* === Trend indicator === */
.trend-neutral {
    color: var(--text-tertiary);
}

.trend-up {
    color: #f87171;
}

.trend-down {
    color: #60a5fa;
}

/* === Stat Cards Grid === */
.weather-stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

/* === Expand Card === */
.expand-card {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: rgba(255,255,255,0.03);
    border: 1px dashed var(--glass-border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    min-height: 80px;
}

.expand-card:hover {
    background: rgba(74, 222, 128, 0.08);
    border-color: rgba(74, 222, 128, 0.2);
}

.expand-card .stat-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.expand-icon {
    font-size: 1.3rem;
    color: var(--accent);
    animation: bounce-chevron 2s ease-in-out infinite;
}

@keyframes bounce-chevron {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

.expand-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* === Extended Stats (expandable) === */
.weather-stats-extended {
    margin-top: 10px;
    overflow: hidden;
    animation: slideDown 0.35s ease;
}

.weather-stats-extended.hidden {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 600px;
        transform: translateY(0);
    }
}

.expand-collapse {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
    padding: 8px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-tertiary);
    border-radius: var(--radius-xs);
    transition: var(--transition);
    border: 1px solid transparent;
}

.expand-collapse:hover {
    color: var(--accent);
    background: rgba(74, 222, 128, 0.06);
    border-color: rgba(74, 222, 128, 0.15);
}

.expand-collapse i {
    font-size: 0.8rem;
}

/* === MFA / Token Area (nur sichtbar mit ?mfa) === */
.reolink-mfa {
    margin-top: 12px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    transition: var(--transition);
}

.reolink-mfa.hidden-url {
    display: none !important;
}

.mfa-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.reolink-mfa {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--glass-border);
}

.mfa-form {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.mfa-hint {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-bottom: 10px;
}

.mfa-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.mfa-code-input {
    flex: 1;
    min-width: 120px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    text-align: center;
    outline: none;
    transition: var(--transition);
}

.mfa-code-input:focus {
    border-color: rgba(74, 222, 128, 0.3);
}

.mfa-code-input::placeholder {
    color: var(--text-tertiary);
    letter-spacing: 0;
    font-size: 0.75rem;
}

.mfa-error {
    font-size: 0.72rem;
    color: var(--danger);
    margin-top: 8px;
}

.mfa-send-btn,
.mfa-verify-btn {
    white-space: nowrap;
}

/* === Timeline Section === */
.timeline-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--glass-border);
}

.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 8px;
}

.timeline-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.timeline-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeline-range {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.72rem;
    padding: 3px 8px;
    cursor: pointer;
    outline: none;
}

.timeline-range:focus {
    border-color: rgba(74, 222, 128, 0.3);
}

.timeline-count {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.timeline-loading {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 8px 0;
}

.timeline-skel-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.timeline-skel-label {
    width: 80px;
    height: 12px;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    animation: pulse-text 1.5s ease-in-out infinite;
}

.timeline-skel-strip {
    display: flex;
    gap: 6px;
}

.timeline-skel-thumb {
    width: 100px;
    height: 60px;
    background: rgba(255,255,255,0.04);
    border-radius: 6px;
    animation: pulse-text 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

/* Vertikales Layout: Tage untereinander */
.timeline-track {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 50px;
    min-width: 0;
}

.timeline-day-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.timeline-day-header {
    display: flex;
    align-items: center;
    gap: 6px;
}

.timeline-day-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-tertiary);
    white-space: nowrap;
    letter-spacing: 0.03em;
}

.timeline-day-line {
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

/* Horizontale Strip pro Tag (scrollt nur innerhalb der Reihe) */
.timeline-hour-strip {
    display: block;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    padding: 2px 0 6px 0;
    white-space: nowrap;
}

.timeline-hour-strip > .timeline-thumb {
    display: inline-block;
    scroll-snap-align: start;
    width: 100px;
    height: 64px;
    margin-right: 5px;
    vertical-align: top;
}

.timeline-hour-strip > .timeline-thumb:last-child {
    margin-right: 0;
}

.timeline-hour-strip::-webkit-scrollbar {
    height: 3px;
}

.timeline-hour-strip::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.02);
    border-radius: 2px;
}

.timeline-hour-strip::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
}

.timeline-thumb {
    position: relative;
    width: 100px;
    height: 64px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--glass-border);
    transition: border-color 0.2s ease, opacity 0.2s ease;
    flex-shrink: 0;
    background: #000;
    opacity: 0.85;
}

.timeline-thumb:hover {
    border-color: var(--accent);
    opacity: 1;
    z-index: 2;
}

.timeline-thumb img {
    width: 100%;
    height: 100%;
}

.timeline-thumb-time {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 3px 5px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    font-size: 0.6rem;
    color: rgba(255,255,255,0.85);
    text-align: center;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.timeline-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 16px;
    font-size: 0.78rem;
    color: var(--text-tertiary);
    gap: 6px;
}

@media (max-width: 900px) {
    .timeline-hour-strip > .timeline-thumb {
        width: 80px;
        height: 52px;
        margin-right: 5px;
    }
}

@media (max-width: 480px) {
    .timeline-hour-strip > .timeline-thumb {
        width: 90px;
        height: 58px;
        margin-right: 4px;
    }
}

.mfa-hint {
    color: var(--text-secondary);
    margin: 0 0 10px 0;
    font-size: 0.8rem;
}

.mfa-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.mfa-code-input {
    flex: 1;
    min-width: 140px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-xs);
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    letter-spacing: 4px;
    text-align: center;
    transition: var(--transition);
}

.mfa-code-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.mfa-code-input::placeholder {
    letter-spacing: 1px;
    color: var(--text-tertiary);
}

.mfa-send-btn,
.mfa-verify-btn {
    white-space: nowrap;
    padding: 8px 14px;
    font-size: 0.8rem;
}

.mfa-send-btn {
    background: rgba(96,165,250,0.15);
    border: 1px solid rgba(96,165,250,0.25);
    color: #60a5fa;
}

.mfa-send-btn:hover {
    background: rgba(96,165,250,0.25);
}

.mfa-verify-btn {
    background: rgba(74,222,128,0.15);
    border: 1px solid rgba(74,222,128,0.25);
    color: var(--accent);
}

.mfa-verify-btn:hover {
    background: rgba(74,222,128,0.25);
}

.mfa-verify-btn.loading {
    opacity: 0.6;
    pointer-events: none;
}

.mfa-error {
    color: var(--danger);
    font-size: 0.8rem;
    margin: 8px 0 0 0;
}

.mfa-success {
    color: var(--success);
    font-size: 0.8rem;
    margin: 8px 0 0 0;
}

/* === Weather Current Section === */
.weather-section {
    padding: 20px;
}

.weather-current {
    margin-bottom: 16px;
}

.weather-main {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.weather-temp-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.weather-temp {
    font-size: 3.2rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--text-primary);
    line-height: 1;
}

.weather-condition {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding-top: 4px;
}

.weather-icon {
    font-size: 2rem;
}

.weather-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.weather-feels {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.weather-meta {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    display: flex;
    gap: 16px;
}

.weather-meta strong {
    color: var(--text-secondary);
    font-weight: 500;
}

/* === Stats Grid === */
.weather-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stat-card {
    padding: 14px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    min-height: 88px;
}

.stat-card:hover {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.1);
}

.stat-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    animation: statContentIn 0.35s ease both;
}

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

.stat-icon {
    font-size: 1.3rem;
}

.stat-value {
    font-size: 1.15rem;
    font-weight: 600;
}

.stat-label {
    font-size: 0.68rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* === History Chart === */
.history-section {
    padding: 20px;
    margin-bottom: 24px;
}

.history-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.history-metric-select {
    position: relative;
    display: inline-block;
}

.history-metric-select::after {
    content: '\f107';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    font-size: 0.72rem;
    z-index: 1;
}

.history-metric-select select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 5px 24px 5px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.72rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
    min-width: 100px;
}

.history-metric-select select:hover {
    border-color: rgba(255,255,255,0.15);
}

.history-metric-select select:focus {
    border-color: var(--accent);
}

.history-metric-select select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 4px 8px;
}

.chart-wrapper {
    position: relative;
    width: 100%;
    height: 280px;
}

.chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

.chart-skeleton {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    padding: 0 20px 20px;
}

.skeleton-chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    width: 100%;
    height: 80%;
}

.sk-bar {
    flex: 1;
    background: linear-gradient(to top, rgba(74,222,128,0.08), rgba(74,222,128,0.02));
    border-radius: 4px 4px 0 0;
    animation: sk-bar-pulse 1.5s ease-in-out infinite;
    min-height: 10%;
}

@keyframes sk-bar-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* === Skeleton Shared === */
.skeleton-block {
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skeleton-line {
    height: 12px;
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 100%);
    border-radius: 6px;
    animation: shimmer 2s ease-in-out infinite;
    background-size: 200% 100%;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.w-60 { width: 60%; }
.w-50 { width: 50%; }
.w-40 { width: 40%; }
.w-30 { width: 30%; }

.hidden {
    display: none !important;
}

/* === Footer === */
.footer {
    text-align: center;
    padding: 20px;
    font-size: 0.72rem;
    color: var(--text-tertiary);
}

.footer p {
    margin-bottom: 4px;
}

.footer-dummy-hint {
    color: var(--warning);
    font-weight: 500;
}

.footer-legal {
    font-size: 0.65rem;
    opacity: 0.6;
}

.api-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

.api-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal {
    width: 100%;
    max-width: 480px;
    padding: 28px 24px 24px;
    position: relative;
    animation: slideUp 0.25s ease;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.modal-icon {
    font-size: 2rem;
    color: var(--accent);
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(74, 222, 128, 0.1);
    border-radius: 14px;
}

.modal-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.modal-value {
    font-size: 1.8rem;
    font-weight: 600;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comparison-bar-wrapper {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.comparison-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease, background 0.3s;
    position: relative;
}

.comparison-bar::after {
    content: '';
    position: absolute;
    right: -4px;
    top: -3px;
    width: 14px;
    height: 14px;
    background: var(--text-primary);
    border-radius: 50%;
    border: 2px solid var(--accent);
}

.comparison-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

.modal-description {
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.modal-description i {
    font-size: 1.1rem;
    color: var(--accent);
    margin-top: 2px;
    flex-shrink: 0;
}

.modal-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.modal-detail-item {
    padding: 10px 12px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    font-size: 0.8rem;
}

.modal-detail-item .dt-label {
    color: var(--text-secondary);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.modal-detail-item .dt-value {
    color: var(--text-primary);
    font-weight: 600;
}

.light-mode .modal-icon {
    background: rgba(22, 163, 74, 0.1);
}

.light-mode .modal-detail-item {
    background: rgba(0,0,0,0.03);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

/* =============================================
   RESPONSIVE — Mobile First
   ============================================= */

/* === Tablet / Small screens (max 900px) === */
@media (max-width: 900px) {
    .main-grid {
        grid-template-columns: 1fr;
        min-width: 0;
        overflow: hidden;
    }

    .container {
        padding: 12px;
        overflow: hidden;
    }

    .header {
        padding: 12px 16px;
    }

    .header-title {
        font-size: 1rem;
    }

    .webcam-section,
    .weather-section,
    .history-section {
        padding: 14px;
        min-width: 0;
        overflow: hidden;
    }

    .hero-temp {
        font-size: 2.4rem;
    }

    .hero-icon {
        font-size: 1.6rem;
    }

    .weather-stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .stat-card {
        padding: 12px 10px;
    }

    .chart-wrapper {
        height: 240px;
    }
}

/* === Small phones (max 480px) === */
@media (max-width: 480px) {
    .container {
        padding: 8px;
    }

    .main-grid {
        min-width: 0;
        overflow: hidden;
    }

    .header {
        padding: 10px 12px;
    }

    .header-inner {
        flex-direction: row;
        align-items: center;
    }

    .header-left {
        gap: 10px;
    }

    .header-title {
        font-size: 0.9rem;
    }

    .header-subtitle {
        display: none;
    }

    .header-right {
        gap: 8px;
    }

    .live-indicator {
        padding: 3px 8px;
    }

    .live-text {
        font-size: 0.6rem;
    }

    .clock {
        font-size: 0.85rem;
    }

    .logo-icon {
        font-size: 1.4rem;
    }

    .webcam-section,
    .weather-section,
    .history-section {
        padding: 12px;
        min-width: 0;
        overflow: hidden;
    }

    .hero-temp {
        font-size: 2rem;
    }

    .hero-icon {
        font-size: 1.4rem;
    }

    .weather-stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        min-width: 0;
    }

    .stat-card {
        padding: 10px 8px;
        min-width: 0;
    }

    .stat-value {
        font-size: 1rem;
        overflow-wrap: break-word;
        word-break: break-word;
    }

    .stat-label {
        overflow-wrap: break-word;
        word-break: break-word;
    }

    .stat-icon {
        font-size: 1.1rem;
    }

    .webcam-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .ctrl-status {
        margin-left: 0;
        text-align: center;
    }

    .ctrl-btn {
        justify-content: center;
        padding: 8px 12px;
    }

    .history-controls {
        flex-wrap: wrap;
        gap: 4px;
    }

    .chart-wrapper {
        height: 200px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .section-header h2 {
        font-size: 0.9rem;
    }

    /* Timeline horizontal scroll */
    .timeline-hour-strip {
        padding-bottom: 8px;
        scrollbar-width: thin;
        scrollbar-color: rgba(255,255,255,0.12) transparent;
    }

    .modal {
        padding: 20px 16px 16px;
    }

    .modal-details {
        grid-template-columns: 1fr;
    }
}

/* === Touch devices: hide scrollbar === */
@media (hover: none) and (pointer: coarse) {
    ::-webkit-scrollbar {
        width: 0;
    }
}
