html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif; /* Nur Arial wird verwendet */
    background-color: #111;
    color: #f0f0f0;
    height: 100vh;
    width: 100%;
    line-height: 1.6;
    overflow: hidden; /* Verhindert Scrollen */
    /* Disable zoom gestures on iOS */
    touch-action: manipulation;
    transition: background-color 0.5s ease, color 0.5s ease;
}

/* Light Mode Styles - Vollständig orange */
html.light-mode {
    background-color: #f7931a;
}

body.light-mode {
    background-color: #f7931a;
    color: #000;
}

/* NEU: Hauptcontainer mit fester Struktur */
.main-layout {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-rows: 1fr auto 1fr;
    padding: 20px;
    /* Für iPhone mit Notch/Dynamic Island */
    padding-top: calc(env(safe-area-inset-top, 20px) + 20px);
    padding-bottom: env(safe-area-inset-bottom, 20px);
    padding-left: env(safe-area-inset-left, 20px);
    padding-right: env(safe-area-inset-right, 20px);
}

/* Mobile-spezifische Anpassung */
@media (max-width: 768px) {
    .main-layout {
        padding-top: calc(env(safe-area-inset-top, 20px) + 40px);
    }
}

/* Info-Container für alle vier Zeilen */
.info-container {
    position: fixed;
    top: 20px; /* Gleiche Höhe wie die Icons rechts */
    left: 20px; /* Gleicher Abstand wie Impressum unten */
    z-index: 1000;
    /* Anpassung für iPhones mit Notch/Dynamic Island */
    top: calc(20px + env(safe-area-inset-top, 0px));
    left: calc(20px + env(safe-area-inset-left, 0px));
}

/* Versionsnummer in der oberen linken Ecke */
.version-number {
    font-size: 0.8rem;
    color: #666;
    opacity: 0.7;
    font-family: 'Courier New', monospace;
    transition: opacity 0.3s ease;
    margin-bottom: 2px;
}

/* Light Mode Version Number */
body.light-mode .version-number {
    color: #333;
}

/* Datenquelle unter der Versionsnummer */
.data-source {
    font-size: 0.8rem;
    color: #666;
    opacity: 0.7;
    font-family: 'Courier New', monospace;
    transition: opacity 0.3s ease;
    margin-bottom: 2px;
}

/* Status unter der Datenquelle */
.connection-status {
    font-size: 0.8rem;
    color: #666;
    opacity: 0.7;
    font-family: 'Courier New', monospace;
    transition: opacity 0.3s ease;
    margin-bottom: 2px;
}

/* Updated unter dem Status */
.last-updated {
    font-size: 0.8rem;
    color: #666;
    opacity: 0.7;
    font-family: 'Courier New', monospace;
    transition: opacity 0.3s ease;
}

/* Light Mode für alle Info-Elemente */
body.light-mode .data-source,
body.light-mode .connection-status,
body.light-mode .last-updated {
    color: #333;
}

.version-number:hover {
    opacity: 1;
}

/* Light Mode Version Number */
body.light-mode .version-number {
    color: #333;
}

/* NEU: Oberer Bereich mit fester Position */
.top-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 50px; /* GEÄNDERT: Mehr Abstand nach unten */
    padding-top: 40px; /* NEU: Mehr Abstand nach oben */
}

/* NEU: Mittlerer Bereich mit dem Preis */
.middle-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* NEU: Unterer Bereich mit Footer */
.bottom-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 50px; /* GEÄNDERT: Mehr Abstand nach oben */
}

.bitcoin-symbol {
    font-size: 5rem; /* Angepasst für "₿itzen" */
    color: #f7931a;
    text-shadow: 0 0 20px rgba(247, 147, 26, 0.7);
    margin: 0;
    line-height: 1;
    cursor: pointer; /* Zeigt an, dass es klickbar ist */
    transition: color 0.5s ease;
}

/* Light Mode Bitcoin Symbol */
body.light-mode .bitcoin-symbol {
    color: #000;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
}

.bitcoin-symbol:hover {
    transform: scale(1.02);
    transition: transform 0.2s ease;
}

p {
    font-size: 1.2rem;
    margin: 20px 0 0 0; /* Angepasste Abstände */
    font-style: italic;
    cursor: pointer; /* Zeigt an, dass es klickbar ist */
}

p:hover {
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.glitch {
    animation: glitch 1s linear infinite;
}

@keyframes glitch {
    2%, 8%, 14%, 22%, 30% {
        opacity: 0.8;
        transform: translate3d(-5px, 0, 0) scale(1.01);
    }
    4%, 10%, 18%, 26%, 34% {
        opacity: 0.9;
        transform: translate3d(5px, 0, 0) scale(0.99);
    }
    0%, 40%, 100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

/* Gruppe für den Hauptinhalt */
.price-group {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Reduzierter Abstand zwischen den Elementen */
    width: 100%;
    max-width: 360px; /* Erhöht von 320px auf 360px für mehr Platz */
}

/* Container für die Preisanzeige - CSS Grid für gleichmäßige Abstände */
.price-display-container {
    display: grid;
    grid-template-rows: 26px auto 26px; /* Feste Höhen: Unit (26px), Price (flexibel), Performance (26px) */
    gap: 8px; /* Gleichmäßiger Abstand zwischen allen Elementen */
    align-items: center;
    justify-items: center;
    place-items: center; /* Firefox-spezifische Verbesserung für Grid-Alignment */
    padding: 10px;
    height: 160px;
    align-content: center; /* Zentriere das Grid vertikal */
}

.price-display-container:hover {
    /* Hover-Effekt ohne Hintergrundverfärbung */
    transition: transform 0.2s ease;
    transform: scale(1.01); /* Leichter Scale-Effekt statt Hintergrundfarbe */
}

/* Einheit oben - gleiche Schriftart wie Performance */
.unit-display {
    color: #f7931a;
    font-weight: normal; /* Gleiche Schriftstärke wie Performance */
    font-size: 1.6rem; /* Leicht vergrößert für bessere Sichtbarkeit */
    margin-bottom: 0; /* Abstand wird durch CSS Grid gap verwaltet */
    letter-spacing: -1px; /* Reduziert den Abstand zwischen ₿ und 1 */
    cursor: pointer;
    transition: color 0.5s ease;
    white-space: nowrap; /* Verhindert Zeilenumbruch */
    line-height: 1; /* Verhindert ungewollte Höhenunterschiede */
    height: 26px; /* Feste Höhe für stabiles Layout */
    display: flex; /* Für vertikale Zentrierung */
    align-items: center; /* Vertikal zentrieren */
    justify-content: center; /* Horizontal zentrieren */
    outline: none; /* Entfernt Browser-Focus-Outline beim Klick */
    /* Mobile-spezifische Fixes für Touch-Feedback */
    -webkit-tap-highlight-color: transparent; /* iOS Safari Touch-Highlight entfernen */
    -webkit-touch-callout: none; /* iOS Callout-Menu entfernen */
    -webkit-user-select: none; /* Text-Selektion verhindern */
    user-select: none; /* Text-Selektion verhindern */
}

/* Spezifische Anpassung für den Sats-Modus */
.sats-mode .unit-display {
    font-size: 1.6rem; /* Gleiche Größe wie ₿ 1 */
}

/* Light Mode Unit Display */
body.light-mode .unit-display {
    color: #000;
}

/* Preis darunter */
.price-display {
    font-size: 4rem; /* Doppelt so groß (vorher 2rem) */
    font-weight: bold;
    line-height: 1.2; /* Kontrolliert die Zeilenhöhe */
    cursor: pointer;
    margin-bottom: 0; /* Abstand wird durch CSS Grid gap verwaltet */
    color: #f7931a; /* Bitcoin-Orange im Dark Mode - NEU */
    outline: none; /* Entfernt Browser-Focus-Outline beim Klick */
    /* Mobile-spezifische Fixes für Touch-Feedback */
    -webkit-tap-highlight-color: transparent; /* iOS Safari Touch-Highlight entfernen */
    -webkit-touch-callout: none; /* iOS Callout-Menu entfernen */
    -webkit-user-select: none; /* Text-Selektion verhindern */
    user-select: none; /* Text-Selektion verhindern */
}

/* Preis im Light Mode bleibt schwarz - NEU */
body.light-mode .price-display {
    color: #000;
}

/* Skeleton Loading Styles */
.skeleton {
    background: linear-gradient(90deg, #333 25%, #555 50%, #333 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite ease-in-out;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.05) 50%, transparent 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite ease-in-out;
}

/* Light mode skeleton - orange-compatible colors */
body.light-mode .skeleton {
    background: linear-gradient(90deg, #d47c1a 25%, #e89233 50%, #d47c1a 75%);
    background-size: 200% 100%;
}

body.light-mode .skeleton::after {
    background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.4) 50%, transparent 75%);
    background-size: 200% 100%;
}

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

/* Skeleton für Unit Display */
.unit-display.skeleton {
    width: 40px; /* Kompakt für ₿ 1 Text */
    height: 26px; /* Angepasst an 1.6rem font-size mit line-height: 1 */
    margin: 0 auto; /* Grid gap verwaltet Abstände */
    align-self: center; /* Firefox-spezifisches Alignment */
}

.sats-mode .unit-display.skeleton {
    width: 140px; /* Breiter für "1000 sats" Text */
    height: 26px; /* Angepasst an 1.6rem font-size mit line-height: 1 */
}

/* Skeleton für Price Display */
.price-display.skeleton {
    width: 200px;
    height: 64px; /* Entspricht font-size: 4rem */
    margin: 0 auto; /* Grid gap verwaltet Abstände */
}

/* Skeleton für Price Change */
.price-change.skeleton {
    width: 120px; /* Länger wie andere Info-Elemente */
    height: 26px; /* Angepasst an 1.6rem font-size mit line-height: 1.2 (ca. 31px, aber wir halten es kompakt) */
    margin: 0 auto; /* Grid gap verwaltet Abstände */
}

/* Preisänderung */
.price-change {
    font-size: 1.6rem; /* Leicht vergrößert für bessere Sichtbarkeit */
    text-align: center;
    width: 100%;
    margin-bottom: 0; /* Kein Abstand nach unten */
    line-height: 1.2; /* Konsistente Zeilenhöhe */
    height: 26px; /* Feste Höhe für stabiles Layout */
    display: flex; /* Für vertikale Zentrierung */
    align-items: center; /* Vertikal zentrieren */
    justify-content: center; /* Horizontal zentrieren */
    cursor: pointer; /* Zeigt an, dass es klickbar ist - NEUE ÄNDERUNG */
    outline: none; /* Entfernt Browser-Focus-Outline beim Klick */
    /* Mobile-spezifische Fixes für Touch-Feedback */
    -webkit-tap-highlight-color: transparent; /* iOS Safari Touch-Highlight entfernen */
    -webkit-touch-callout: none; /* iOS Callout-Menu entfernen */
    -webkit-user-select: none; /* Text-Selektion verhindern */
    user-select: none; /* Text-Selektion verhindern */
}

/* Hover-Effekt nur für Desktop/Maus-Geräte und nicht für Skeleton */
@media (hover: hover) {
    .price-change:hover:not(.skeleton) {
        text-decoration: underline; /* Unterstreichung beim Hover */
        opacity: 0.8;
    }
}

/* Explizit: Skeleton-Elemente haben niemals Unterstreichung */
.price-change.skeleton:hover,
body.light-mode .price-change.skeleton:hover {
    text-decoration: none !important;
    opacity: 1 !important;
}

.positive {
    color: #00c853;
}

body.light-mode .positive {
    color: #006400; /* Dunkleres Grün im Light Mode für besseren Kontrast */
}

.negative {
    color: #ff3d00;
}

body.light-mode .negative {
    color: #d32f2f; /* Dunkleres Rot im Light Mode für besseren Kontrast */
}

.footer-info {
    width: 100%;
    max-width: 320px;
    text-align: center;
}

/* NEU: Stil für das Datum in der zweiten Zeile */
.date-line {
    display: block;
    margin-top: 4px;
    font-size: 0.85rem;
}

.stale-data {
    opacity: 0.8;
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #333;
    border: none;
    border-radius: 20px; /* Gerundetes Rechteck auf allen Geräten */
    padding: 10px;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 100;
    color: #fff;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    height: 50px;
    /* Browser-Resets für konsistente Darstellung */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
    box-sizing: border-box;
    /* Anpassung für iPhones mit Notch/Dynamic Island */
    top: calc(20px + env(safe-area-inset-top, 0px));
    right: calc(20px + env(safe-area-inset-right, 0px));
}

/* Desktop-spezifische Styles */
@media (min-width: 768px) {
    .theme-toggle {
        width: 50px;
        height: 50px;
        border-radius: 20px; /* Auch Desktop: gerundetes Rechteck */
        padding: 0;
        font-size: 1.4rem;
        /* Zusätzliche Browser-Resets für Desktop */
        -webkit-border-radius: 20px;
        -moz-border-radius: 20px;
        background-clip: padding-box;
    }
}

body.light-mode .theme-toggle {
    background: #d2691e; /* Dunkelorange (Chocolate) */
    color: #fff;
}

/* Sound Toggle Button - ähnlich wie Theme Toggle */
.sound-toggle {
    position: fixed;
    top: 20px;
    right: 80px; /* Links vom Theme Toggle */
    background: #333;
    border: none;
    border-radius: 20px;
    padding: 10px;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 100;
    color: #fff;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    height: 50px;
}

/* Desktop-spezifisches Styling für Sound Toggle */
@media (min-width: 769px) {
    .sound-toggle {
        width: 50px;
        height: 50px;
        border-radius: 20px; /* Auch Desktop: gerundetes Rechteck wie Theme Toggle */
        padding: 0;
        font-size: 1.4rem;
        right: 90px; /* Mehr Abstand auf Desktop */
        -webkit-border-radius: 20px;
        -moz-border-radius: 20px;
        background-clip: padding-box;
    }
}

body.light-mode .sound-toggle {
    background: #d2691e;
    color: #fff;
}

/* Audio-Player verstecken */
#audioPlayer {
    display: none;
}

/* Styling für den Footer-Text */
.footer-text {
    font-size: 0.8rem;
    opacity: 0.5;
    color: #f0f0f0;
    text-align: center;
    margin-bottom: 5px;
}

body.light-mode .footer-text {
    color: #000;
}

/* Styling für das fixed positioned "Made with ₿❤️" (unten mittig) */
.footer-made-with {
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    font-size: 0.8rem;
    opacity: 0.5;
    color: #f0f0f0;
    text-align: center;
    pointer-events: auto;
}

body.light-mode .footer-made-with {
    color: #000;
}

/* Animation für ₿ und ❤️ Symbole in der fixed Position */
.footer-made-with .bitcoin-heart,
.footer-made-with .heart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

.footer-made-with .heart {
    animation-delay: 0.5s;
}

/* Animation bei hover stoppen */
.footer-made-with:hover .bitcoin-heart,
.footer-made-with:hover .heart {
    animation: none;
}

/* Styling für das fixed positioned X-Logo (rechts unten) */
.x-logo-fixed {
    position: fixed;
    right: calc(20px + env(safe-area-inset-right, 0px));
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    color: #f0f0f0;
    text-decoration: none;
    transition: opacity 0.3s ease;
    pointer-events: auto;
}

body.light-mode .x-logo-fixed {
    color: #000;
}

.x-logo-fixed:hover {
    opacity: 0.9;
}

/* Styling für den X-Link (falls noch benötigt) */
.x-link {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    color: #f0f0f0;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

body.light-mode .x-link {
    color: #000;
}

.x-link:hover {
    opacity: 0.9;
}

.combined-footer .spacer {
    display: inline-block;
    width: 4px; /* Abstand zwischen "with" und "₿" */
}

.combined-footer .x-icon {
    margin-right: 8px;
    flex-shrink: 0;
}

.footer-text {
    line-height: 18px; /* Gleiche Höhe wie das X-Icon */
}

.bitcoin-heart, .heart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 2px;
    font-size: 16px; /* Angepasst auf ähnliche Größe wie das X-Logo */
    transform-origin: center;
    height: 18px; /* Gleiche Höhe wie das X-Icon */
    /* Animation standardmäßig aktivieren */
    animation: pulse 1s infinite alternate;
    /* Firefox Rendering-Verbesserungen */
    will-change: transform;
    backface-visibility: hidden;
    transform-style: preserve-3d;
}

/* Leichte Anpassung der vertikalen Position */
.bitcoin-heart {
    position: relative;
    top: -1px; /* Feinabstimmung der vertikalen Position */
    animation-delay: 0s;
}

.heart {
    animation-delay: 0.5s;
}

/* Animation bei hover stoppen */
.footer-text:hover .bitcoin-heart,
.footer-text:hover .heart {
    animation: none;
}

@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.3); }
}

@media (max-width: 768px) {
    .bitcoin-symbol {
        font-size: 4rem; /* Angepasst für "₿itzen" */
    }
    
    .unit-display {
        font-size: 1.6rem; /* Gleich wie Desktop */
    }
    
    /* Sats-Modus bleibt gleich wie Desktop */
    .sats-mode .unit-display {
        font-size: 1.6rem; /* Gleich wie Desktop */
    }
    
    .price-display {
        font-size: 3.6rem; /* Doppelt so groß (vorher 1.8rem) */
    }
    
    p {
        margin: 15px 0 0 0; /* Angepasste Abstände */
    }
    
    /* Anpassung der Container-Höhe für mittlere Bildschirme */
    .price-display-container {
        height: 140px;
    }
    
    /* GEÄNDERT: Angepasste Abstände für mittlere Bildschirme */
    .top-section {
        padding-bottom: 40px;
    }
    
    .bottom-section {
        padding-top: 40px;
    }
}

@media (max-width: 480px) {
    .bitcoin-symbol {
        font-size: 3rem; /* Angepasst für "₿itzen" */
    }
    
    .unit-display {
        font-size: 1.6rem; /* Gleich wie Desktop */
    }
    
    /* Sats-Modus bleibt gleich wie Desktop */
    .sats-mode .unit-display {
        font-size: 1.6rem; /* Gleich wie Desktop */
    }
    
    .price-display {
        font-size: 3.2rem; /* Doppelt so groß (vorher 1.6rem) */
    }
    
    p {
        font-size: 1rem;
        margin: 10px 0 0 0;
    }
    
    .theme-toggle {
        top: calc(10px + env(safe-area-inset-top, 0px));
        right: calc(10px + env(safe-area-inset-right, 0px));
        /* Mobile bleibt bei der ursprünglichen Rundung */
        border-radius: 20px !important;
        width: auto !important;
        height: auto !important;
        padding: 8px !important;
        font-size: 1.3rem;
    }

    .sound-toggle {
        top: calc(10px + env(safe-area-inset-top, 0px));
        right: calc(70px + env(safe-area-inset-right, 0px)); /* Links vom Theme Toggle */
        border-radius: 20px !important;
        width: auto !important;
        height: auto !important;
        padding: 8px !important;
        font-size: 1.3rem;
    }
    
    /* Version-number wird jetzt durch info-container positioniert */
    
    /* Anpassung der Container-Höhe für mobile Bildschirme */
    .price-display-container {
        height: 120px;
    }
    
    /* GEÄNDERT: Angepasste Abstände für kleine Bildschirme */
    .top-section {
        padding-bottom: 30px;
    }
    
    .bottom-section {
        padding-top: 30px;
    }
}

/* Price change animation */
@keyframes flashGreen {
    0%, 100% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(0, 200, 83, 0.2);
    }
}

@keyframes flashRed {
    0%, 100% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(255, 61, 0, 0.2);
    }
}

.price-flash-up {
    animation: flashGreen 0.5s ease;
}

.price-flash-down {
    animation: flashRed 0.5s ease;
}

.impressum-toggle,
.impressum-container {
    position: fixed;
    left: calc(20px + env(safe-area-inset-left, 0px));
    font-size: 0.8rem;
    color: #666;
    font-family: 'Courier New', monospace;
    text-align: left;
    pointer-events: auto;
}
.impressum-toggle {
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    z-index: 1001;
    background: none;
    border: none;
    cursor: pointer;
}
.impressum-container {
    bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    z-index: 1000;
    background: #111;
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: none;
}

/* Ergänzung für Light Mode */
body.light-mode .impressum-container,
html.light-mode .impressum-container {
    background: #f7931a;
    color: #000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.reverse {
    unicode-bidi: bidi-override;
    direction: rtl;
}