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

/* CSS Variables voor theming */
:root {
    --bg-gradient-1: #667eea;
    --bg-gradient-2: #764ba2;
    --card-bg: white;
    --text-primary: #333;
    --text-secondary: #666;
    --text-tertiary: #999;
    --accent-color: #667eea;
    --stat-bg: #f7f7f7;
    --border-color: #eee;
    --command-bg: #f0f4ff;
    --shadow: rgba(0,0,0,0.2);
    --font-body: "Source Sans 3", "Segoe UI", "Helvetica Neue", sans-serif;
    --font-heading: "Manrope", "Source Sans 3", "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    --surface-shadow-lg: 0 10px 24px var(--shadow);
    --surface-shadow-md: 0 8px 20px var(--shadow);
    --motion-fast: 0.16s;
    --motion-base: 0.2s;
    --motion-emphasis: 0.28s;
    --motion-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --motion-lift-sm: translateY(-1px);
    --motion-lift-md: translateY(-2px);
    --motion-press: translateY(0) scale(0.98);
    --gm-network-dots-opacity: 0.16;
    --gm-network-rings-opacity: 0.15;
    --gm-header-rings-opacity: 0.22;
    --gm-header-dots-opacity: 0.18;
    --gm-network-dots-drift-duration: 22s;
    --gm-network-dots-pulse-duration: 6.4s;
    --gm-network-rings-pulse-duration: 9.6s;
    --gm-header-rings-pulse-duration: 6.6s;
    --gm-header-dots-drift-duration: 11s;
    --gm-header-dots-pulse-duration: 4.8s;
    --gm-live-dot-pulse-duration: 2.4s;
}

[data-theme="dark"] {
    --bg-gradient-1: #1a1a2e;
    --bg-gradient-2: #16213e;
    --card-bg: #0f3460;
    --text-primary: #e8e8e8;
    --text-secondary: #b8b8b8;
    --text-tertiary: #888;
    --accent-color: #00d4ff;
    --stat-bg: #1a1a2e;
    --border-color: #2a2a4e;
    --command-bg: #1a3a5a;
    --shadow: rgba(0,0,0,0.5);
}

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 100%);
    min-height: 100vh;
    padding: 10px;
    color: var(--text-primary);
    transition: background 0.3s ease;
    line-height: 1.45;
    letter-spacing: 0.01em;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

html[data-motion-intensity="subtle"] {
    --gm-network-dots-opacity: 0.1;
    --gm-network-rings-opacity: 0.09;
    --gm-header-rings-opacity: 0.14;
    --gm-header-dots-opacity: 0.11;
    --gm-network-dots-drift-duration: 30s;
    --gm-network-dots-pulse-duration: 8.2s;
    --gm-network-rings-pulse-duration: 12.4s;
    --gm-header-rings-pulse-duration: 8.8s;
    --gm-header-dots-drift-duration: 15s;
    --gm-header-dots-pulse-duration: 6.6s;
    --gm-live-dot-pulse-duration: 3.1s;
}

html[data-motion-intensity="lively"] {
    --gm-network-dots-opacity: 0.2;
    --gm-network-rings-opacity: 0.19;
    --gm-header-rings-opacity: 0.28;
    --gm-header-dots-opacity: 0.24;
    --gm-network-dots-drift-duration: 16s;
    --gm-network-dots-pulse-duration: 4.8s;
    --gm-network-rings-pulse-duration: 7.2s;
    --gm-header-rings-pulse-duration: 5.1s;
    --gm-header-dots-drift-duration: 8.4s;
    --gm-header-dots-pulse-duration: 3.6s;
    --gm-live-dot-pulse-duration: 1.9s;
}

/* Subtle network ambience (dots + pulse rings) */
body[data-page]:not([data-page="map"])::before,
body[data-page]:not([data-page="map"])::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    will-change: opacity, transform, background-position;
}

body[data-page]:not([data-page="map"])::before {
    background-image:
        radial-gradient(circle, color-mix(in srgb, var(--accent-color) 32%, transparent) 0 1.6px, transparent 2.8px),
        radial-gradient(circle, color-mix(in srgb, var(--accent-color) 28%, transparent) 0 1.5px, transparent 2.6px),
        radial-gradient(circle, color-mix(in srgb, var(--accent-color) 24%, transparent) 0 1.4px, transparent 2.5px);
    background-repeat: repeat;
    background-size: 320px 220px, 280px 240px, 360px 260px;
    background-position: 0 0, 120px 36px, 64px 128px;
    opacity: var(--gm-network-dots-opacity);
    animation:
        network-dots-drift var(--gm-network-dots-drift-duration) linear infinite,
        network-dots-pulse var(--gm-network-dots-pulse-duration) ease-in-out infinite;
}

body[data-page]:not([data-page="map"])::after {
    background-image:
        radial-gradient(circle, transparent 0 42%, color-mix(in srgb, var(--accent-color) 22%, transparent) 44% 46%, transparent 49%),
        radial-gradient(circle, transparent 0 42%, color-mix(in srgb, var(--accent-color) 18%, transparent) 44% 46%, transparent 49%),
        radial-gradient(circle, transparent 0 42%, color-mix(in srgb, var(--accent-color) 16%, transparent) 44% 46%, transparent 49%);
    background-repeat: no-repeat;
    background-position: 18% 68%, 72% 16%, 84% 78%;
    background-size: 96px 96px, 78px 78px, 88px 88px;
    opacity: var(--gm-network-rings-opacity);
    animation: network-rings-pulse var(--gm-network-rings-pulse-duration) ease-in-out infinite;
}

.header {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 15px;
    box-shadow: var(--surface-shadow-lg);
    margin-bottom: 10px;
    transition: background 0.3s ease;
    height: 90px;
    display: flex;
    align-items: center;
    overflow: hidden;
    gap: 15px;
    position: relative;
    isolation: isolate;
}

.header::before,
.header::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.header::before {
    background-image:
        radial-gradient(circle, transparent 0 42%, color-mix(in srgb, var(--accent-color) 28%, transparent) 44% 46%, transparent 49%),
        radial-gradient(circle, transparent 0 42%, color-mix(in srgb, var(--accent-color) 22%, transparent) 44% 46%, transparent 49%),
        radial-gradient(circle, transparent 0 42%, color-mix(in srgb, var(--accent-color) 24%, transparent) 44% 46%, transparent 49%);
    background-repeat: no-repeat;
    background-position: 14% 58%, 52% 36%, 86% 62%;
    background-size: 70px 70px, 58px 58px, 76px 76px;
    opacity: var(--gm-header-rings-opacity);
    animation: header-rings-pulse var(--gm-header-rings-pulse-duration) ease-in-out infinite;
}

.header::after {
    background-image:
        radial-gradient(circle, color-mix(in srgb, var(--accent-color) 36%, transparent) 0 1.4px, transparent 2.4px),
        radial-gradient(circle, color-mix(in srgb, var(--accent-color) 30%, transparent) 0 1.3px, transparent 2.3px),
        radial-gradient(circle, color-mix(in srgb, var(--accent-color) 28%, transparent) 0 1.2px, transparent 2.2px),
        radial-gradient(circle, color-mix(in srgb, var(--accent-color) 24%, transparent) 0 1.3px, transparent 2.2px);
    background-repeat: repeat;
    background-size: 220px 120px, 260px 140px, 200px 100px, 280px 160px;
    background-position: 0 0, 34px 16px, 120px 24px, 80px 64px;
    opacity: var(--gm-header-dots-opacity);
    animation:
        header-dots-drift var(--gm-header-dots-drift-duration) linear infinite,
        header-dots-pulse var(--gm-header-dots-pulse-duration) ease-in-out infinite;
}

.header > * {
    position: relative;
    z-index: 1;
}

.header-left {
    flex: 1;
}

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

/* Header connection status pill (shared across pages) */
.live-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent-color) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-color) 35%, transparent);
    color: var(--text-secondary);
    font-size: 0.82em;
    font-weight: 600;
    white-space: nowrap;
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4caf50;
    box-shadow: 0 0 6px rgba(76, 175, 80, 0.6);
}

.live-time {
    color: var(--text-tertiary);
    font-weight: 500;
}

.live-status.live-online .live-dot {
    background: #4caf50;
    box-shadow: 0 0 6px rgba(76, 175, 80, 0.6);
}

.live-status.live-reconnecting .live-dot {
    background: #ff9800;
    box-shadow: 0 0 6px rgba(255, 152, 0, 0.6);
}

.live-status.live-offline .live-dot {
    background: #f44336;
    box-shadow: 0 0 6px rgba(244, 67, 54, 0.6);
}

.live-status.live-online .live-dot {
    animation: live-dot-pulse var(--gm-live-dot-pulse-duration) ease-out infinite;
}

html.disable-ambient-motion body[data-page]:not([data-page="map"])::before,
html.disable-ambient-motion body[data-page]:not([data-page="map"])::after,
html.disable-ambient-motion .header::before,
html.disable-ambient-motion .header::after {
    animation: none !important;
    opacity: 0 !important;
}

html.disable-ambient-motion .live-status.live-online .live-dot {
    animation: none !important;
}

@keyframes network-dots-pulse {
    0%, 100% {
        opacity: 0.09;
    }
    50% {
        opacity: 0.24;
    }
}

@keyframes network-dots-drift {
    0% {
        background-position: 0 0, 120px 36px, 64px 128px;
    }
    100% {
        background-position: 40px -24px, 84px 62px, 116px 92px;
    }
}

@keyframes network-rings-pulse {
    0% {
        opacity: 0.06;
        background-size: 68px 68px, 54px 54px, 62px 62px;
    }
    50% {
        opacity: 0.26;
        background-size: 148px 148px, 122px 122px, 136px 136px;
    }
    100% {
        opacity: 0.06;
        background-size: 68px 68px, 54px 54px, 62px 62px;
    }
}

@keyframes header-rings-pulse {
    0% {
        opacity: 0.08;
        background-size: 44px 44px, 36px 36px, 48px 48px;
    }
    50% {
        opacity: 0.3;
        background-size: 94px 94px, 76px 76px, 102px 102px;
    }
    100% {
        opacity: 0.08;
        background-size: 44px 44px, 36px 36px, 48px 48px;
    }
}

@keyframes header-dots-pulse {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.26; }
}

@keyframes header-dots-drift {
    0% {
        background-position: 0 0, 34px 16px, 120px 24px, 80px 64px;
    }
    100% {
        background-position: 24px -10px, 10px 44px, 144px 8px, 108px 46px;
    }
}

@keyframes live-dot-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.38), 0 0 6px rgba(76, 175, 80, 0.6);
    }
    70% {
        box-shadow: 0 0 0 7px rgba(76, 175, 80, 0), 0 0 8px rgba(76, 175, 80, 0.7);
    }
}

@media (prefers-reduced-motion: reduce) {
    html:not(.force-motion) body[data-page]:not([data-page="map"])::before,
    html:not(.force-motion) body[data-page]:not([data-page="map"])::after,
    html:not(.force-motion) .header::before,
    html:not(.force-motion) .header::after,
    html:not(.force-motion) .live-status.live-online .live-dot {
        animation: none !important;
    }
}

.header-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.header-logo img {
    height: 56px;
    width: auto;
    display: block;
}

h1 {
    color: var(--accent-color);
    font-family: var(--font-heading);
    font-size: 1.58em;
    margin: 5px 0 3px 0;
    line-height: 1.15;
    letter-spacing: -0.015em;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

h1 i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2em;
    font-size: 0.88em;
    opacity: 0.96;
}

.header p {
    margin: 0;
    padding: 0;
    line-height: 1.2;
    font-size: 0.95em;
}

.header-subtitle {
    color: var(--text-secondary);
    font-size: var(--gm-page-subtitle-size, 0.95rem);
    line-height: var(--gm-page-subtitle-line, 1.45);
    font-weight: 500;
    margin: 0;
}

.header-subtitle > * {
    margin: 0;
    line-height: inherit;
}

.navbar {
    background: var(--card-bg);
    padding: 10px 15px;
    border-radius: 15px;
    box-shadow: var(--surface-shadow-lg);
    margin-bottom: 12px;
    transition: background 0.3s ease;
}

.nav-links {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
}

.nav-spacer {
    flex: 1;
}

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    min-height: 36px;
    padding: 0 15px;
    background: color-mix(in srgb, var(--card-bg) 92%, transparent);
    border-radius: 999px;
    transition: background var(--motion-fast) var(--motion-ease), border-color var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease), transform var(--motion-fast) var(--motion-ease), box-shadow var(--motion-fast) var(--motion-ease);
    font-family: var(--font-heading);
    font-weight: 650;
    border: 1px solid color-mix(in srgb, var(--border-color) 88%, transparent);
    font-size: 0.84em;
    letter-spacing: 0.01em;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.nav-link:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: var(--motion-lift-sm);
    box-shadow: 0 6px 14px color-mix(in srgb, var(--accent-color) 28%, transparent);
}

.nav-link.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    font-weight: 600;
    pointer-events: none;
}

.nav-more {
    position: relative;
}

.nav-more-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background var(--motion-fast) var(--motion-ease), border-color var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease), transform var(--motion-fast) var(--motion-ease), box-shadow var(--motion-fast) var(--motion-ease);
}

.nav-more-toggle:hover,
.nav-more-toggle.is-open {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: var(--motion-lift-sm);
    box-shadow: 0 6px 14px color-mix(in srgb, var(--accent-color) 28%, transparent);
}

.nav-more-toggle.is-active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.nav-more-menu {
    position: absolute;
    left: 0;
    top: 44px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--surface-shadow-md);
    border-radius: 12px;
    padding: 10px;
    display: none;
    flex-direction: column;
    gap: 8px;
    min-width: 220px;
    z-index: 1001;
}

.nav-more-menu.is-open {
    display: flex;
}

.nav-more-link {
    width: 100%;
    justify-content: flex-start;
}

.breadcrumbs {
    margin: 0 0 14px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 6px 14px var(--shadow);
    max-width: 100%;
    flex-wrap: wrap;
}

.breadcrumb-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.breadcrumb-link:hover {
    color: var(--text-primary);
}

.breadcrumb-sep {
    color: var(--text-tertiary);
    font-size: 0.82em;
}

.breadcrumb-current {
    color: var(--text-secondary);
    font-weight: 600;
}

.breadcrumb-current a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}

.breadcrumb-current a:hover {
    color: var(--text-primary);
}

.breadcrumb-current a:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent-color) 72%, white 28%);
    outline-offset: 2px;
    border-radius: 4px;
}

.theme-toggle {
    background: color-mix(in srgb, var(--card-bg) 92%, transparent);
    border: 1px solid color-mix(in srgb, var(--border-color) 88%, transparent);
    padding: 8px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 1.1em;
    color: var(--text-primary);
    transition: background var(--motion-fast) var(--motion-ease), border-color var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease), transform var(--motion-fast) var(--motion-ease), box-shadow var(--motion-fast) var(--motion-ease);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: var(--motion-lift-sm);
    box-shadow: 0 6px 14px color-mix(in srgb, var(--accent-color) 28%, transparent);
}

/* Language Switcher (single cycling button) */
.lang-btn {
    background: color-mix(in srgb, var(--card-bg) 92%, transparent);
    border: 1px solid color-mix(in srgb, var(--border-color) 88%, transparent);
    padding: 8px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 1.2em;
    color: var(--text-primary);
    transition: background var(--motion-fast) var(--motion-ease), border-color var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease), transform var(--motion-fast) var(--motion-ease), box-shadow var(--motion-fast) var(--motion-ease);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lang-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: var(--motion-lift-sm);
    box-shadow: 0 6px 14px color-mix(in srgb, var(--accent-color) 28%, transparent);
}

/* Beginner Mode Toggle */
.beginner-toggle {
    background: color-mix(in srgb, var(--card-bg) 92%, transparent);
    border: 1px solid color-mix(in srgb, var(--border-color) 88%, transparent);
    padding: 8px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 1em;
    color: var(--text-primary);
    transition: background var(--motion-fast) var(--motion-ease), border-color var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease), transform var(--motion-fast) var(--motion-ease), box-shadow var(--motion-fast) var(--motion-ease);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.beginner-toggle:hover,
.beginner-toggle.is-active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: var(--motion-lift-sm);
    box-shadow: 0 6px 14px color-mix(in srgb, var(--accent-color) 28%, transparent);
}

/* Navbar tools dropdown */
.nav-tools {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-tools-toggle {
    background: color-mix(in srgb, var(--card-bg) 92%, transparent);
    border: 1px solid color-mix(in srgb, var(--border-color) 88%, transparent);
    padding: 8px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 1.1em;
    color: var(--text-primary);
    transition: background var(--motion-fast) var(--motion-ease), border-color var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease), transform var(--motion-fast) var(--motion-ease), box-shadow var(--motion-fast) var(--motion-ease);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-tools-toggle:hover,
.nav-tools-toggle.is-open {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: var(--motion-lift-sm);
    box-shadow: 0 6px 14px color-mix(in srgb, var(--accent-color) 28%, transparent);
}

.nav-link:active,
.nav-more-toggle:active,
.theme-toggle:active,
.lang-btn:active,
.beginner-toggle:active,
.nav-tools-toggle:active {
    transform: var(--motion-press);
    box-shadow: none;
}

.nav-tools-menu {
    position: absolute;
    right: 0;
    top: 54px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--surface-shadow-md);
    border-radius: 12px;
    padding: 10px;
    display: none;
    flex-direction: column;
    gap: 8px;
    min-width: 200px;
    z-index: 1001;
}

.nav-tools-btn {
    width: 100%;
}

.nav-jump-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 2px;
}

.nav-jump-label {
    font-size: 0.78em;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: 0.03em;
}

.nav-jump-select {
    width: 100%;
    background: var(--stat-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.88em;
}

.nav-jump-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.nav-tools-status {
    margin-left: auto;
    font-size: 0.88em;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-primary);
    opacity: 0.9;
}

.nav-tools-menu.is-open {
    display: flex;
}

.nav-tools-menu .beginner-toggle,
.nav-tools-menu .lang-btn,
.nav-tools-menu .theme-toggle {
    width: 100%;
    border-radius: 12px;
    justify-content: flex-start;
    padding: 8px 12px;
    min-height: 40px;
    height: auto;
}

/* Hide technical details in beginner mode */
.beginner-mode .beginner-hide {
    display: none !important;
}

/* Mobile-First Responsive Design */

/* Compact navbar: icon-only nav links until wide desktop */
@media (max-width: 1400px) {
    .nav-link-text {
        display: none;
    }

    .nav-link {
        padding: 8px 12px;
    }

    .nav-links {
        flex-wrap: wrap;
        row-gap: 8px;
    }

    .breadcrumbs {
        display: flex;
        width: 100%;
    }
}

/* Small mobile devices (portrait phones) */
@media (max-width: 480px) {
    body {
        padding: 5px;
        font-size: 14px;
    }

    .header {
        padding: 12px;
        border-radius: 10px;
        height: 80px;
    }

    .header-logo img {
        height: 44px;
    }

    h1 {
        font-size: 1.34em;
        margin: 4px 0 2px 0;
        text-align: center;
        line-height: 1.2;
    }

    .navbar {
        padding: 8px 12px;
        border-radius: 10px;
        margin-bottom: 12px;
    }

    .nav-link {
        padding: 8px 12px;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .breadcrumbs {
        padding: 7px 10px;
        font-size: 0.9em;
    }

    .nav-link:hover {
        transform: none;
    }

    .nav-more-toggle:hover {
        transform: none;
    }

    .theme-toggle {
        padding: 6px 12px;
        font-size: 1em;
    }
}

/* Medium mobile devices (landscape phones, small tablets) */
@media (min-width: 481px) and (max-width: 768px) {
    body {
        padding: 8px;
    }

    .header {
        padding: 15px;
        height: 85px;
    }

    h1 {
        font-size: 1.4em;
        margin: 4px 0 2px 0;
        text-align: center;
        line-height: 1.2;
    }

    .navbar {
        padding: 10px 15px;
        margin-bottom: 12px;
    }
}

/* Tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    body {
        padding: 15px;
    }

    .header {
        padding: 20px;
    }

    .navbar {
        padding: 12px 20px;
        margin-bottom: 12px;
    }

    h1 {
        font-size: 1.6em;
    }

    .nav-link {
        padding: 9px 16px;
    }
}

/* Desktop (larger screens) */
@media (min-width: 1025px) {
    body {
        padding: 20px;
    }

    .header {
        padding: 30px;
    }

    .navbar {
        padding: 15px 30px;
        margin-bottom: 12px;
    }

    h1 {
        font-size: 2em;
        margin-bottom: 10px;
    }

    .nav-link {
        padding: 10px 20px;
        font-size: 1em;
    }

    .theme-toggle {
        padding: 10px 20px;
        font-size: 1.2em;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .nav-link,
    .theme-toggle,
    button,
    a {
        min-width: 44px;
        min-height: 44px;
    }

    .nav-link:active {
        transform: scale(0.95);
    }

    .theme-toggle:active {
        transform: scale(0.95);
    }
}

@media (prefers-reduced-motion: reduce) {
    html:not(.force-motion) *,
    html:not(.force-motion) *::before,
    html:not(.force-motion) *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    /* Keep loading skeleton shimmer visible even when ambient motion is reduced. */
    html:not(.force-motion) .skeleton-block,
    html:not(.force-motion) .skeleton-line {
        animation-duration: 1.25s !important;
        animation-iteration-count: infinite !important;
    }
}

/* Footer Styles */
.site-footer {
    text-align: center;
    margin-top: 40px;
    background: var(--card-bg);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px var(--shadow);
}

.site-footer p {
    color: var(--text-primary);
    margin: 8px 0;
}

.site-footer a {
    color: var(--accent-color);
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
}

.site-footer a:hover {
    text-decoration: underline;
    opacity: 0.8;
}

.site-footer a svg {
    vertical-align: middle;
    margin-right: 4px;
}

.site-footer-description {
    font-size: 0.9em;
    margin-top: 5px;
}

.site-footer-expert-hint {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 14px auto 4px;
    padding: 10px 12px;
    max-width: 760px;
    border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--accent-color) 26%, var(--border-color));
    background: color-mix(in srgb, var(--stat-bg) 76%, transparent);
}

.beginner-mode .site-footer-expert-hint.beginner-only {
    display: flex;
}

.site-footer-expert-copy {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.45;
}

.site-footer-expert-toggle {
    appearance: none;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--accent-color) 36%, var(--border-color));
    background: color-mix(in srgb, var(--card-bg) 92%, transparent);
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    transition: background var(--motion-fast) var(--motion-ease), border-color var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease), transform var(--motion-fast) var(--motion-ease), box-shadow var(--motion-fast) var(--motion-ease);
}

.site-footer-expert-toggle:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: var(--motion-lift-sm);
    box-shadow: 0 6px 14px color-mix(in srgb, var(--accent-color) 26%, transparent);
}

.latest-update-card {
    background:
        radial-gradient(120% 160% at 100% -20%, color-mix(in srgb, var(--accent-color) 12%, transparent), transparent 58%),
        radial-gradient(120% 160% at -10% 120%, color-mix(in srgb, var(--accent-color) 8%, transparent), transparent 56%),
        color-mix(in srgb, var(--card-bg) 94%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-color) 24%, var(--border-color));
    border-radius: 14px;
    box-shadow: 0 8px 22px var(--shadow);
    padding: 16px 18px;
    margin: 14px 0 16px;
}

.latest-update-head h2,
.latest-update-head .chart-title {
    margin: 0 0 6px;
}

.latest-update-intro {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.5;
}

.latest-update-link {
    margin-top: 12px;
    display: grid;
    gap: 5px;
    text-decoration: none;
    color: inherit;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--border-color) 84%, transparent);
    background: color-mix(in srgb, var(--card-bg) 92%, transparent);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.latest-update-link:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--accent-color) 50%, var(--border-color));
    background: color-mix(in srgb, var(--accent-color) 6%, var(--card-bg));
    box-shadow: 0 10px 22px var(--shadow);
}

.latest-update-link:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent-color) 46%, transparent);
    outline-offset: 2px;
}

.latest-update-link-label {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.4;
}

.latest-update-link-summary {
    color: var(--text-secondary);
    line-height: 1.5;
}

.latest-update-link-action {
    color: var(--accent-color);
    font-weight: 650;
}

.site-footer-links {
    font-size: 0.9em;
    margin-top: 10px;
}

.site-footer-link {
    display: inline-block;
    margin: 0 8px;
}

/* Footer mobile responsiveness */
@media (max-width: 480px) {
    .site-footer {
        padding: 15px;
        border-radius: 10px;
    }

    .site-footer p {
        font-size: 0.9em;
        margin: 6px 0;
    }

    .site-footer-expert-hint {
        padding: 10px;
    }

    .latest-update-card {
        padding: 14px;
    }

    .site-footer a {
        margin: 4px 4px;
    }
}

/* Admin alert banner (dashboard only, admin session required) */
.admin-alert-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-alert-banner {
    min-width: 280px;
    max-width: 380px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-left-width: 4px;
    border-radius: 10px;
    padding: 12px 12px 12px 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: adminAlertSlideIn 180ms ease-out;
}

.admin-alert-title {
    font-weight: 700;
    margin-bottom: 4px;
}

.admin-alert-message {
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.3;
}

.admin-alert-dismiss {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1em;
    padding: 4px;
    margin-left: auto;
}

.admin-alert-warning {
    border-left-color: var(--warning-color, #f6c453);
}

.admin-alert-error,
.admin-alert-critical {
    border-left-color: var(--error-color, #e35b5b);
}

.admin-alert-info {
    border-left-color: var(--accent-color, #6fb5ff);
}

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