
/* Fallback Font-Display */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('Inter Regular'), local('Inter-Regular');
}

:root {
    --primary-color: #1f7a6d;
    --primary-dark: #165c53;
    --secondary-color: #c45a3f;
    --accent-color: #d08930;
    --background: #f8f9fa;
    --card-bg: #ffffff;
    --text-dark: #1a3038;
    --text-light: #545d64;
    --border-radius: 12px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--background);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    text-size-adjust: 100%; /* Verhindert Text-Inflation auf Mobile */
}

@media (min-width: 769px) {
    html {
        overflow-y: scroll; /* Nur auf Desktop: Verhindert Springen (CLS) durch Scrollbar */
    }
}

/* Barrierefreiheit: Reduzierte Bewegung für Nutzer mit Vestibularstörungen */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

.top-nav {
    background: var(--primary-color);
    padding: 1rem 2rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 2rem;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    height: 80px;
    contain: layout; /* Erlaubt das Überlappen von Dropdowns (wichtig für Desktop) */
}

/* i18n-loading wird jetzt via Critical CSS in den HTML-Dateien gesteuert */

.top-nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: transform 0.3s ease;
    position: relative;
}

.top-nav a::before {
    content: '';
    position: absolute;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.top-nav a:hover::before {
    opacity: 1;
}

.top-nav a:hover {
    transform: translateY(-2px);
}

.top-nav a.active {
    background: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    contain: layout; /* Isoliert Layout-Berechnungen */
}

h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    text-align: center;
}

.subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

form {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    contain: content;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-size: 0.95rem;
}

select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-family: inherit;
}

select:hover:not(:disabled) {
    border-color: var(--primary-color);
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.1);
}

select:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Range Slider Styling */
input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: linear-gradient(to right, var(--primary-color) 0%, var(--primary-color) 10%, #e0e0e0 10%, #e0e0e0 100%);
    outline: none;
    -webkit-appearance: none;
    margin: 1rem 0;
}

input[type="range"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--primary-dark);
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(42, 157, 143, 0.4);
}

input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    background: var(--primary-dark);
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(42, 157, 143, 0.4);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: -0.5rem;
}

/* Number Input Styling */
input[type="number"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-family: inherit;
}

input[type="number"]:hover {
    border-color: var(--primary-color);
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.1);
}

/* Radio Button Styling */
input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

input[type="radio"]:hover {
    transform: scale(1.1);
}

.description {
    display: block;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    font-style: italic;
}

.info-box {
    background: linear-gradient(135deg, #e3f2fd 0%, #f0f7ff 100%);
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-weight: 500;
    color: var(--primary-dark);
    display: none;
}

.info-box.show {
    display: block;
    animation: slideIn 0.3s ease;
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: var(--shadow-sm);
    margin-top: 1rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.result-box {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    margin: 2rem 0;
    display: none;
    min-height: 220px;
    contain: content;
}

.result-box.show {
    display: block;
    animation: fadeIn 0.5s ease;
    contain: paint;
}

.result-box h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.result-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #e0e0e0;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.result-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-color);
}

.result-label {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.result-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.result-unit {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-left: 0.2rem;
}

.tips-section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    contain: content; /* Isoliert die Sektion komplett vom Rest-Layout */
    margin-top: 2rem;
}

.tips-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.tips-section ul {
    list-style: none;
    padding: 0;
}

.tips-section li {
    padding: 0.75rem 0;
    padding-left: 2rem;
    position: relative;
    border-bottom: 1px solid #f0f0f0;
}

.tips-section li:last-child {
    border-bottom: none;
}

.tips-section li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.2rem;
}

nav {
    margin: 2rem 0;
    text-align: center;
}

nav a {
    display: inline-block;
    margin: 0 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
    font-weight: 500;
}

nav a:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    contain: content;
    content-visibility: auto;
    margin: 2rem 0;
}

section p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

section ul {
    margin-left: 1.5rem;
}

section li {
    margin: 0.5rem 0;
}

footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    margin-top: 3rem;
    border-top: 1px solid #e0e0e0;
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Temperature Toggle Container */
.temp-toggle-container {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 25px;
    padding: 4px 8px 4px 12px;
    margin-left: auto;
    transition: transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.temp-toggle-container:hover {
    background-color: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.temp-toggle-label {
    font-size: 1.2rem;
    line-height: 1;
}

/* Temperature Toggle Button */
.temp-toggle-btn {
    background: linear-gradient(135deg, #f4a261 0%, #e76f51 100%);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.95rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    min-width: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.temp-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    background: linear-gradient(135deg, #e76f51 0%, #f4a261 100%);
}

.temp-toggle-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.temp-toggle-btn .temp-symbol {
    font-size: 1.1rem;
    font-weight: 700;
}

/* ============================================
   MOBILE TOUCH OPTIMIZATIONS
   ============================================ */

/* Touch-Target Größen (iOS Guidelines: min 44x44px) */
button,
.btn-primary,
.temp-toggle-btn,
input[type="submit"],
.top-nav a {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Touch-Feedback für interaktive Elemente */
button:active,
.btn-primary:active,
.temp-toggle-btn:active,
a:active,
input[type="submit"]:active,
input[type="radio"]:active,
input[type="range"]:active {
    transform: scale(0.97);
    opacity: 0.85;
    transition: transform 0.1s ease, opacity 0.1s ease;
}

/* Range Slider Touch-Optimierung */
input[type="range"] {
    min-height: 44px;
    -webkit-appearance: none;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
}

input[type="range"]::-moz-range-thumb:active {
    transform: scale(1.2);
}

/* Select Dropdowns Touch-freundlich */
select {
    min-height: 44px;
    padding: 12px;
    font-size: 16px; /* Verhindert Auto-Zoom auf iOS */
}

/* Input Felder Touch-freundlich */
input[type="number"],
input[type="text"] {
    min-height: 44px;
    padding: 12px;
    font-size: 16px; /* Verhindert Auto-Zoom auf iOS */
}

/* Pull-to-Refresh deaktivieren */
body {
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

/* iOS Safe Areas für Notch/Dynamic Island */
@supports (padding: max(0px)) {
    body {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .top-nav {
        padding-left: max(1.5rem, env(safe-area-inset-left));
        padding-right: max(1.5rem, env(safe-area-inset-right));
        padding-top: max(1rem, env(safe-area-inset-top));
    }
}

/* Touch-Optimierung für Radio Buttons */
input[type="radio"] {
    min-width: 24px;
    min-height: 24px;
    cursor: pointer;
}

label:has(input[type="radio"]) {
    cursor: pointer;
    padding: 8px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

/* Tap Highlight entfernen (eigenes Feedback nutzen) */
button, a, input, select {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* Image Styling */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ============================================
   HERO BANNER - Mobile Optimized
   ============================================ */
.hero-banner {
    position: relative;
    height: 340px; /* Fixe Höhe eliminiert VW-basierte Shifts komplett */
    margin-bottom: 2rem;
    overflow: hidden;
    border-radius: 0 0 20px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    width: 100%;
    contain: strict;
}

.hero-banner img {
    width: 100%;
    height: 100%;
    aspect-ratio: 8/3; /* Reserviert Platz im Browser-Rendering */
    object-fit: cover;
    filter: brightness(0.7);
}

.hero-section {
    position: relative;
    height: 340px;
    overflow: hidden;
    border-radius: 0 0 20px 20px;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    width: 100%;
    contain: content; /* Content erlaubt variable Inhalte, Strict schneidet ab */
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.7);
}

.hero-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    width: 90%;
    max-width: 900px;
}

.hero-title {
    font-size: clamp(1.8rem, 5vw, 3.5rem);
    margin-bottom: 0.75rem;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.8);
    color: white;
    min-height: 8.5rem; /* Beibehalten, wichtig für CLS */
    line-height: 1.1;
    display: block;
    overflow: hidden;
}

.hero-subtitle {
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    text-shadow: 1px 1px 4px rgba(0,0,0,0.8);
    min-height: 6rem; /* Beibehalten, wichtig für CLS */
    line-height: 1.4;
    display: block;
    overflow: hidden;
}

/* Stabilität für die Home-Cards gegen i18n Layout Shifts */
.container div[style*="grid-template-columns"] a > div,
.container > div > a > div,
.home-card-container { /* Neue Klasse für mehr Stabilität */
    height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Verhindert das Springen bei Textänderungen */
    padding-top: 5rem; /* Visuelle Zentrierung durch festen Abstand von oben */
    contain: content; /* Wichtig für Mobile: Erlaubt Wachsen bei Textumbruch */
    overflow: hidden;
    min-height: 400px; /* Erzwingt Platzreservierung */
}

/* Intro-Text Stabilisierung */
.home-intro-container {
    min-height: 120px; /* Reserviert Platz für den Einleitungstext */
    margin-bottom: 2rem;
}

/* Content Image Container with aspect-ratio */
.content-image {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    aspect-ratio: 3/2;
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
}

.content-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .hero-banner {
        height: 200px;
        margin-bottom: 1rem;
    }

    .hero-section {
        height: 200px;
    }

    .hero-title {
        font-size: 1.6rem;
        min-height: auto;
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 0.95rem;
        min-height: auto;
        height: auto;
        line-height: 1.3;
    }

    .top-nav {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
        height: auto;
        min-height: 60px;
    }

    .top-nav a {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
        min-height: 36px;
    }

    .temp-toggle-container {
        padding: 3px 6px 3px 8px;
        margin-left: 0;
    }

    .temp-toggle-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
        min-width: 45px;
        min-height: 32px;
    }

    .temp-toggle-label {
        font-size: 1rem;
    }

    form {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    label {
        font-size: 0.9rem;
    }

    .result-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .result-item {
        padding: 1rem;
    }

    .result-value {
        font-size: 1.5rem;
    }

    .result-box {
        padding: 1.25rem;
        margin: 1rem 0;
        min-height: auto;
    }

    .result-box h2 {
        font-size: 1.4rem;
        margin-bottom: 1rem;
    }

    .tips-section, section {
        padding: 1rem;
        margin: 1rem 0;
    }

    .tips-section h2, .tips-section h3,
    section h2 {
        font-size: 1.2rem !important;
        margin-bottom: 0.75rem !important;
    }

    .tips-section li {
        padding: 0.5rem 0 0.5rem 1.5rem;
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .tips-section li:before {
        font-size: 1rem;
    }

    /* Make ALL two-column layouts single column on mobile */
    [style*="grid-template-columns: 2fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns: repeat"],
    section[style*="grid-template-columns"],
    .tips-section[style*="grid-template-columns"],
    div[style*="grid-template-columns"] {
        display: block !important;
    }

    /* Content images in grids - full width on mobile */
    .content-image {
        margin-top: 1rem;
        max-height: 180px;
    }

    /* Database section grid */
    section > div[style*="grid-template-columns"] {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    section > div[style*="grid-template-columns"] > div {
        padding: 1rem !important;
    }

    section > div[style*="grid-template-columns"] > div > div:first-child {
        font-size: 1.8rem !important;
        margin-bottom: 0.25rem !important;
    }

    /* Cards auf index.html */
    section > div[style*="minmax(250px"] {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Card styling mobile */
    section > div > a > div {
        padding: 1.5rem 1rem !important;
        height: auto !important;
        min-height: auto !important;
        padding-top: 1.5rem !important;
    }

    section > div > a > div > div:first-child {
        font-size: 2rem !important;
        margin-bottom: 0.5rem !important;
    }

    section > div > a > div > h3 {
        font-size: 1.2rem !important;
        margin-bottom: 0.25rem !important;
    }

    section > div > a > div > p {
        font-size: 0.9rem !important;
    }

    /* Intro text */
    .home-intro-container {
        min-height: auto;
        margin-bottom: 1rem;
    }

    .home-intro-container p {
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
    }

    /* Quick start section */
    section ol {
        font-size: 0.9rem;
        line-height: 1.7;
        padding-left: 1.25rem;
    }

    /* Footer mobile */
    footer {
        padding: 1.5rem 1rem;
        margin-top: 1.5rem;
    }

    footer p {
        font-size: 0.8rem !important;
        line-height: 1.5;
    }

    /* Ad container mobile */
    .ad-container {
        min-height: 200px;
        margin: 0.75rem 0;
    }

    nav a {
        display: block;
        margin: 0.5rem 0;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.75rem;
    }

    h1 {
        font-size: 1.4rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .hero-banner {
        height: 160px;
    }

    .hero-title {
        font-size: 1.3rem;
    }

    .hero-subtitle {
        font-size: 0.85rem;
    }

    form {
        padding: 0.75rem;
    }

    .form-group {
        margin-bottom: 0.75rem;
    }

    label {
        font-size: 0.85rem;
        margin-bottom: 0.3rem;
    }

    select, input[type="number"] {
        padding: 0.6rem 0.75rem;
        font-size: 16px; /* Prevent iOS zoom */
    }

    .btn-primary {
        font-size: 0.95rem;
        padding: 0.75rem;
        margin-top: 0.75rem;
    }

    .result-value {
        font-size: 1.3rem;
    }

    .result-unit {
        font-size: 1rem;
    }

    .result-item {
        padding: 0.75rem;
    }

    .top-nav {
        padding: 0.4rem 0.5rem;
        gap: 0.3rem;
    }

    .top-nav a {
        font-size: 0.7rem;
        padding: 0.3rem 0.5rem;
        min-height: 32px;
    }

    .temp-toggle-container {
        padding: 2px 4px 2px 6px;
    }

    .temp-toggle-btn {
        font-size: 0.7rem;
        min-width: 40px;
        padding: 0.2rem 0.4rem;
    }

    .temp-toggle-label {
        font-size: 0.9rem;
    }

    /* Tips section sehr klein */
    .tips-section, section {
        padding: 0.75rem;
    }

    .tips-section h2, .tips-section h3,
    section h2 {
        font-size: 1.1rem !important;
    }

    .tips-section li {
        font-size: 0.85rem;
        padding-left: 1.25rem;
    }

    /* Database grid - single column on very small screens */
    section > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    section > div[style*="grid-template-columns"] > div {
        padding: 0.75rem !important;
    }

    section > div[style*="grid-template-columns"] > div > div:first-child {
        font-size: 1.5rem !important;
    }

    /* Footer sehr klein */
    footer {
        padding: 1rem 0.75rem;
    }

    footer p {
        font-size: 0.75rem !important;
    }

    /* Slider labels */
    .slider-labels {
        font-size: 0.75rem;
    }

    /* Unit toggle buttons */
    .unit-btn {
        font-size: 0.75rem !important;
        padding: 2px 6px !important;
    }

    /* Description text */
    .description {
        font-size: 0.8rem;
    }

    /* Language switcher */
    #langBtn {
        padding: 4px 8px;
        font-size: 11px;
        min-width: 60px;
    }

    #currentLangFlag .flag-icon {
        width: 16px;
        height: 11px;
    }

    .language-dropdown {
        min-width: 140px;
    }

    .lang-option {
        padding: 8px 10px;
        font-size: 13px;
    }
}

/* ============================================
   LANGUAGE SWITCHER (i18n)
   ============================================ */

.language-switcher {
    position: relative;
    display: inline-block;
    margin-left: auto;
}

#langBtn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
    min-height: 44px;
    width: 90px;
    justify-content: center;
}

#langBtn:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

#langBtn:active {
    transform: translateY(0);
}

#currentLangFlag {
    font-size: 18px;
    line-height: 1;
}

#currentLangCode {
    font-weight: 600;
    letter-spacing: 0.5px;
}

.language-dropdown {
    position: absolute;
    top: 52px;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    padding: 8px;
    min-width: 180px;
    display: none;
    z-index: 1000;
    border: 1px solid rgba(0,0,0,0.08);
}

.language-dropdown.show,
.language-dropdown.active {
    display: block;
    animation: fadeInDown 0.2s ease;
}

.lang-option {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #333;
    font-size: 15px;
    font-weight: 500;
    transition: transform 0.2s ease, background-color 0.2s ease;
    min-height: 44px;
}

.lang-option:hover {
    background-color: #f5f5f5;
    transform: translateX(4px);
}

.lang-option:active {
    transform: translateX(2px);
}

.lang-option.active {
    background: var(--primary-color);
    color: white;
}

.lang-option.active:hover {
    background: var(--primary-dark);
}

.lang-option .flag {
    font-size: 22px;
    line-height: 1;
}

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

/* Language Switcher - Mobile Optimierungen */
@media (max-width: 768px) {
    .language-switcher {
        margin-left: 0;
    }

    #langBtn {
        padding: 6px 12px;
        font-size: 12px;
        min-width: 70px;
        min-height: 44px;
    }

    #currentLangFlag {
        font-size: 16px;
    }

    .language-dropdown {
        right: auto;
        left: 0;
        min-width: 160px;
    }

    .lang-option {
        padding: 10px 14px;
        font-size: 14px;
    }

    .lang-option .flag {
        font-size: 20px;
    }
}

/* Language Switcher - Accessibility */
#langBtn:focus,
.lang-option:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.lang-option:focus {
    outline-color: var(--primary-dark);
}

/* Language Switcher - Touch Optimierungen */
@media (hover: none) and (pointer: coarse) {
    .lang-option {
        min-height: 48px;
        padding: 14px 16px;
    }

    #langBtn {
        min-height: 48px;
    }
}

/* ============================================
   SVG FLAGS (Cross-browser compatible)
   ============================================ */

.flag-icon {
    display: inline-block;
    width: 22px;
    height: 16px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 2px;
    vertical-align: middle;
}

.flag-icon-de {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 3'%3E%3Crect width='5' height='1' y='0' fill='%23000'/%3E%3Crect width='5' height='1' y='1' fill='%23D00'/%3E%3Crect width='5' height='1' y='2' fill='%23FFCE00'/%3E%3C/svg%3E");
}

.flag-icon-gb {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 30'%3E%3CclipPath id='s'%3E%3Cpath d='M0,0 v30 h60 v-30 z'/%3E%3C/clipPath%3E%3CclipPath id='t'%3E%3Cpath d='M30,15 h30 v15 z v15 h-30 z h-30 v-15 z v-15 h30 z'/%3E%3C/clipPath%3E%3Cg clip-path='url(%23s)'%3E%3Cpath d='M0,0 v30 h60 v-30 z' fill='%23012169'/%3E%3Cpath d='M0,0 L60,30 M60,0 L0,30' stroke='%23fff' stroke-width='6'/%3E%3Cpath d='M0,0 L60,30 M60,0 L0,30' clip-path='url(%23t)' stroke='%23C8102E' stroke-width='4'/%3E%3Cpath d='M30,0 v30 M0,15 h60' stroke='%23fff' stroke-width='10'/%3E%3Cpath d='M30,0 v30 M0,15 h60' stroke='%23C8102E' stroke-width='6'/%3E%3C/g%3E%3C/svg%3E");
}

.flag-icon-es {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 750 500'%3E%3Crect width='750' height='500' fill='%23c60b1e'/%3E%3Crect width='750' height='250' y='125' fill='%23ffc400'/%3E%3C/svg%3E");
}

#currentLangFlag .flag-icon {
    width: 20px;
    height: 14px;
}

.lang-option .flag-icon {
    width: 24px;
    height: 17px;
}

/* AdSense Placeholder zur CLS-Vermeidung */
.ad-container {
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    margin: 1rem 0;
    border-radius: 8px;
    overflow: hidden;
    contain: strict; /* Da Höhe fixiert ist, ist strict am performantesten */
}

/* ============================================
   BRATEN GUIDE SPECIFIC MOBILE STYLES
   ============================================ */

/* Core temps section grid */
#coreTempsSection > div {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

@media (max-width: 768px) {
    /* Braten Guide profi tips boxes */
    section > div[style*="background: linear-gradient"] {
        padding: 1rem !important;
        margin-top: 0.75rem !important;
        font-size: 0.9rem;
        line-height: 1.6;
    }

    /* Core temps section - 2 columns on tablet */
    #coreTempsSection > div {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    #coreTempsSection > div > div {
        padding: 0.75rem !important;
    }

    #coreTempsSection > div > div small {
        font-size: 0.8rem !important;
    }

    /* Section headers with emojis */
    section h2[style*="font-size: 1.8rem"] {
        font-size: 1.3rem !important;
        margin-bottom: 0.75rem !important;
    }

    /* Section paragraphs */
    section p[style*="line-height: 1.8"] {
        font-size: 0.9rem !important;
        line-height: 1.6 !important;
    }
}

@media (max-width: 480px) {
    /* Profi tips boxes sehr klein */
    section > div[style*="background: linear-gradient"] {
        padding: 0.75rem !important;
        font-size: 0.85rem;
    }

    /* Core temps - single column on phone */
    #coreTempsSection > div {
        grid-template-columns: 1fr !important;
    }

    #coreTempsSection > div > div {
        padding: 0.6rem !important;
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
    }

    #coreTempsSection > div > div br {
        display: none;
    }

    #coreTempsSection > div > div small {
        width: 100%;
        margin-top: 0.25rem;
    }

    /* Section headers */
    section h2[style*="font-size: 1.8rem"] {
        font-size: 1.15rem !important;
    }

    section p[style*="line-height: 1.8"] {
        font-size: 0.85rem !important;
    }
}