@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:wght@400;500;600;700&family=Cinzel:wght@500;700&display=swap');

:root {
    --bg-image: url('https://images.unsplash.com/photo-1550684376-efcbd6e3f031?q=80&w=2000&auto=format&fit=crop'); 
    --bg-overlay: rgba(0, 0, 0, 0.4);
    --paper-texture: url('https://www.transparenttextures.com/patterns/cream-paper.png');
    --cover-color: #2b1810;
    --paper-base: #fcf9f2;
    --paper-edge: #decfa6;
    --ink: #1c1c1c;
    --cursor: #4a3b30;
    --cursor-bg: rgba(74, 59, 48, 0.12);
    --error-bg: rgba(156, 28, 28, 0.15);
    --error-color: #9c1c1c;
    --gray-text: #968c78;
    --shadow-ambient: 20px 30px 50px rgba(0,0,0,0.75);
}

body[data-theme="relic"] {
    --bg-image: url('https://images.unsplash.com/photo-1546484396-fb3fc6f95f98?q=80&w=2000&auto=format&fit=crop'); 
    --bg-overlay: rgba(0, 0, 0, 0.7);
    --paper-texture: url('https://www.transparenttextures.com/patterns/old-wall.png');
    --cover-color: #1a120b;
    --paper-base: #e0cca8;
    --paper-edge: #b59b71;
    --ink: #2b1a0d;
    --cursor: #5c3c1e;
    --cursor-bg: rgba(92, 60, 30, 0.15);
    --gray-text: #8c7353;
    --shadow-ambient: 30px 40px 60px rgba(0,0,0,0.9);
}

body[data-theme="gothic"] {
    --bg-image: url('https://images.unsplash.com/photo-1506259091721-347e791bab0f?q=80&w=2000&auto=format&fit=crop'); 
    --bg-overlay: rgba(0, 0, 0, 0.85);
    --paper-texture: url('https://www.transparenttextures.com/patterns/dark-leather.png');
    --cover-color: #000000;
    --paper-base: #1a1a1a;
    --paper-edge: #0a0a0a;
    --ink: #d4d4d4;
    --cursor: #8b0000;
    --cursor-bg: rgba(139, 0, 0, 0.2);
    --error-color: #ff3333;
    --error-bg: rgba(255, 0, 0, 0.3);
    --gray-text: #666666;
    --shadow-ambient: 0 0 100px rgba(0,0,0,1);
}

body[data-theme="divine"] {
    --bg-image: url('https://images.unsplash.com/photo-1589131379434-2e9154b5dfd9?q=80&w=2000&auto=format&fit=crop'); 
    --bg-overlay: rgba(255, 255, 255, 0.1);
    --paper-texture: none; 
    --cover-color: #d4af37;
    --paper-base: #ffffff;
    --paper-edge: #f0f0f0;
    --ink: #2c3e50;
    --cursor: #f39c12;
    --cursor-bg: rgba(243, 156, 18, 0.1);
    --gray-text: #bdc3c7;
    --shadow-ambient: 0 30px 80px rgba(212, 175, 55, 0.3);
}

body {
    margin: 0; min-height: 100vh; display: flex; justify-content: center; align-items: center;
    background-image: linear-gradient(var(--bg-overlay), var(--bg-overlay)), var(--bg-image);
    background-size: cover; background-position: center; background-attachment: fixed;
    font-family: 'EB Garamond', serif; overflow: hidden;
    transition: background-image 0.5s ease;
}

#app-view { display: flex; justify-content: center; align-items: center; width: 100vw; height: 100vh; position: relative; }
.view-hidden { display: none !important; }

#auth-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.85); backdrop-filter: blur(10px);
    display: flex; justify-content: center; align-items: center; z-index: 9999;
    font-family: 'Segoe UI', Tahoma, sans-serif;
}
.auth-box {
    background: var(--paper-base); background-image: var(--paper-texture);
    padding: 40px; border-radius: 12px; border: 4px solid var(--cover-color);
    box-shadow: 0 0 40px rgba(0,0,0,0.8); text-align: center; max-width: 400px; width: 90%;
}
.auth-box h2 { font-family: 'Cinzel', serif; font-size: 2rem; margin-top: 0; color: var(--cover-color); }
.auth-box input { width: 100%; box-sizing: border-box; padding: 12px; margin: 10px 0; border: 1px solid var(--gray-text); border-radius: 4px; font-size: 1.1rem; }
.auth-buttons { display: flex; gap: 10px; margin-top: 15px; }
.auth-buttons button { flex: 1; padding: 12px; background: var(--cover-color); color: white; border: none; cursor: pointer; border-radius: 4px; font-weight: bold; font-size: 1.1rem; transition: filter 0.2s; }
.auth-buttons button:hover { filter: brightness(1.2); }
#auth-error { color: var(--error-color); font-weight: bold; margin-top: 15px; min-height: 20px; }

#settings-sidebar {
    position: absolute; left: 20px; top: 50%; transform: translateY(-50%); z-index: 100;
    width: 260px; background: rgba(15, 15, 15, 0.85); backdrop-filter: blur(10px);
    border-radius: 12px; border: 1px solid rgba(255,255,255,0.1);
    padding: 20px; color: #e5dec9; display: flex; flex-direction: column; gap: 20px; box-shadow: 5px 0 20px rgba(0,0,0,0.6);
    font-family: 'Segoe UI', Tahoma, sans-serif;
}
.sidebar-section h4 { margin: 0 0 5px 0; color: #fff; font-size: 16px; text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid rgba(255,255,255,0.2); padding-bottom: 5px; }
.sidebar-section label { display: flex; align-items: center; gap: 8px; cursor: pointer; opacity: 0.8; font-size: 15px; }
.sidebar-section label:hover { opacity: 1; }
select, .sidebar-btn { padding: 8px 12px; background: rgba(255,255,255,0.05); color: inherit; border: 1px solid rgba(255,255,255,0.2); font-size: 15px; border-radius: 4px; cursor: pointer; outline: none; transition: background 0.2s; width: 100%; margin-top: 5px;}
.sidebar-btn:hover, select:hover { background: rgba(255,255,255,0.15); }
.sidebar-btn { font-weight: bold; color: #fff; }
.sidebar-btn-small { padding: 8px; color: white; border-radius: 4px; cursor: pointer; margin-top: 5px; width: 100%; }
.danger { background: rgba(220, 53, 69, 0.7) !important; }
.danger:hover { background: rgba(220, 53, 69, 1) !important; }

#top-bar {
    position: absolute; top: 20px; left: 50%; transform: translateX(-50%); z-index: 100;
    display: flex; gap: 12px; align-items: center; 
    background: rgba(15, 15, 15, 0.85); backdrop-filter: blur(10px);
    padding: 10px 24px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.1);
    color: #e5dec9; font-size: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    font-family: 'Segoe UI', Tahoma, sans-serif;
}
#top-bar select { width: auto; color: white; }
#top-bar select option { color: black; }
.btn-start { padding: 8px 20px; color: white; font-weight: bold; border-radius: 4px; cursor: pointer; font-size: 1.1rem; }

#live-stats-bar {
    position: absolute; top: 80px; left: 50%; transform: translateX(-50%); z-index: 100;
    display: flex; justify-content: center; gap: 40px;
    background: rgba(15, 15, 15, 0.85); padding: 8px 25px; border-radius: 6px;
    color: #e5dec9; font-family: 'Cinzel', serif; font-size: 1.1rem; border: 1px solid rgba(255,255,255,0.1);
}
.highlight { color: #d4af37; font-weight: bold; font-size: 1.3rem; }

#text-container {
    position: relative; width: 1100px; height: 740px; 
    background-color: var(--paper-base);
    background-image: var(--paper-texture);
    background-blend-mode: multiply; 
    border-radius: 4px 12px 12px 4px; box-sizing: border-box; z-index: 2; 
    margin-left: 280px; 
    box-shadow: 
        2px 2px 0px var(--paper-edge), 4px 4px 0px var(--paper-edge), 6px 6px 0px var(--paper-edge),
        9px 9px 0px var(--cover-color), -3px 9px 0px var(--cover-color), 0px 9px 0px var(--cover-color),
        0px -3px 0px var(--cover-color), 9px -3px 0px var(--cover-color), 
        var(--shadow-ambient);
}

#text-container::before {
    content: ""; position: absolute; top: -3px; bottom: -9px; left: -3px; width: 6px;
    background: var(--cover-color); border-radius: 6px 0 0 6px; z-index: -1; 
}

/* Zwingende Buch-Eigenschaften (Harte Spalten-Füllung) */
#text-page-view {
    position: absolute; top: 60px; left: 80px; right: 80px; bottom: 70px; overflow: hidden;
    display: block; 
    column-count: 2; 
    column-gap: 90px; 
    column-fill: auto; /* Zwingt den Browser, zuerst Spalte 1 ganz nach unten zu füllen, bevor Spalte 2 beginnt */
    text-align: left;
    line-height: 1.6; font-size: 20px; color: var(--ink); scroll-behavior: smooth;
    font-family: 'EB Garamond', serif;
}

#text-container::after {
    content: ""; position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 140px; pointer-events: none; z-index: 3; 
    background: linear-gradient(to right, rgba(0,0,0,0) 0%, rgba(0,0,0,0.03) 20%, rgba(0,0,0,0.1) 45%,
        rgba(0,0,0,0.25) 50%, rgba(0,0,0,0.1) 55%, rgba(0,0,0,0.03) 80%, rgba(0,0,0,0) 100%);
}

.vers-zeile { 
    margin-bottom: 15px; 
    line-height: 1.45; 
    display: block; 
    break-inside: avoid; /* Verhindert das Zerschneiden von Versen in der Mitte */
    page-break-inside: avoid;
}

#text-page-view span { position: relative; z-index: 1; color: var(--ink); transition: color 0.1s; }
.grau { color: var(--gray-text); }
.schwarz { color: var(--ink); }

span.getippt-gruen { color: #28a745 !important; }
#text-container.hide-green span.getippt-gruen { color: var(--ink) !important; }
#text-container.hide-green span.getippt-gruen.grau { color: var(--gray-text) !important; }

.falsch { color: var(--error-color) !important; background: var(--error-bg) !important; text-decoration: underline !important; }
.aktuell { background: var(--cursor-bg) !important; box-shadow: inset 2px 0 0 0 var(--cursor) !important; animation: blinkPulse 1.2s infinite; }
.versteckt { color: transparent !important; }

@keyframes blinkPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.versnummer { font-size: 0.6em; font-weight: 700; color: var(--cover-color) !important; margin-right: 6px; vertical-align: super; user-select: none; }
.erledigt { color: #4ade80; font-weight: bold; }

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.85); backdrop-filter: blur(10px);
    display: flex; justify-content: center; align-items: center; z-index: 10000; font-family: 'Segoe UI', Tahoma, sans-serif;
}
.modal-box, .stats-box {
    background: rgba(15,15,15,0.95); color: #fff; padding: 40px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.1);
    max-width: 800px; width: 90%; max-height: 85vh; overflow-y: auto; box-shadow: 0 15px 40px rgba(0,0,0,0.6);
}
.modal-box h2, .stats-title { font-family: 'Cinzel', serif; margin-top: 0; border-bottom: 1px solid rgba(255,255,255,0.2); padding-bottom: 10px; color: #d4af37; text-align: center; }
.modal-close-btn, .btn-large { margin-top: 25px; padding: 12px 25px; background: #007BFF; color: white; border: none; cursor: pointer; border-radius: 4px; font-weight: bold; font-size: 1.1rem; }
.text-center { text-align: center; }

.stat-rings { display: flex; gap: 60px; margin-bottom: 40px; justify-content: center; margin-top:30px;}
.ring-container { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.stat-ring { width: 140px; height: 140px; border-radius: 50%; border: 6px solid rgba(255,255,255,0.1); border-top-color: #fff; display: flex; justify-content: center; align-items: center; transform: rotate(-45deg); }
.ring-value { transform: rotate(45deg); font-size: 42px; font-weight: 700; color: #fff; display: flex; align-items: baseline; }
.ring-unit { font-size: 20px; margin-left: 4px; color: #aaa; }
.ring-label { font-size: 16px; color: #aaa; text-transform: uppercase; letter-spacing: 2px; font-weight: 600; }

.prog-total-bar { width: 100%; height: 25px; background: rgba(255,255,255,0.1); border-radius: 12px; overflow: hidden; border: 1px solid rgba(255,255,255,0.2); }
.prog-total-fill { height: 100%; background: #28a745; transition: width 0.5s ease; }
.prog-book-details { margin-bottom: 15px; border: 1px solid rgba(255,255,255,0.2); border-radius: 6px; background: rgba(0,0,0,0.2); }
.prog-book-details summary { padding: 15px; cursor: pointer; font-weight: bold; font-size: 1.2rem; display: flex; align-items: center; }
.prog-book-content { padding: 15px; border-top: 1px solid rgba(255,255,255,0.2); }
.prog-book-content button { padding: 8px 15px; background: #007BFF; color: white; border: none; border-radius: 4px; cursor: pointer; }
.lb-row { display: flex; align-items: center; padding: 12px; border-bottom: 1px solid rgba(255,255,255,0.1); font-size: 1.2rem; }
.lb-rank { width: 50px; font-weight: bold; color: #d4af37; }
.lb-name { flex: 1; font-weight: bold; }
.lb-percent { width: 150px; text-align: right; margin-right: 15px; }
.lb-bar-bg { width: 200px; height: 15px; background: rgba(255,255,255,0.1); border-radius: 8px; overflow: hidden; }
.lb-bar-fill { height: 100%; background: #007BFF; }