/* ==========================================
   1. DESIGN (Ultra-Realistisches Pergament)
   ========================================== */
:root {
    --accent: #ffcc00; 
    --accent-dark: #b8860b;
    --ink: #2c1e16;    
    --ink-fade: rgba(44, 30, 22, 0.8);
}

/* Der Wrapper legt sich über die gesamte Startseite */
#kodex-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999; 
    display: none;
    justify-content: center;
    align-items: center;
    font-family: 'MedievalSharp', cursive;
}

/* Die Hintergrund-Abdunkelung */
.kodex-overlay-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

/* Düsterer Tavernen-Hintergrund */
.overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at center, transparent 0%, #000 100%), 
                url('https://images.unsplash.com/photo-1605648937326-88abebbb11c1?q=80&w=2000&auto=format&fit=crop') center/cover no-repeat;
    filter: brightness(0.25) blur(3px);
    z-index: 1;
}

/* ==========================================
   DIE SCHRIFTROLLE
   ========================================== */
.scroll-container {
    position: relative;
    z-index: 10;
    width: 90%;
    max-width: 650px;
    padding: 50px 70px;
    
    /* Realistische Papiertextur mit verbrannten Kanten */
    background-color: #e8dcc4;
    background-image: 
        linear-gradient(to right, rgba(50,30,10,0.5) 0%, rgba(0,0,0,0) 8%, rgba(0,0,0,0) 92%, rgba(50,30,10,0.5) 100%),
        linear-gradient(to bottom, rgba(50,30,10,0.6) 0%, rgba(0,0,0,0) 5%, rgba(0,0,0,0) 95%, rgba(50,30,10,0.6) 100%),
        url('https://www.transparenttextures.com/patterns/aged-paper.png');
    
    box-shadow: 
        0 30px 60px rgba(0,0,0,0.9), 
        inset 0 0 80px rgba(100, 50, 20, 0.6),
        inset 0 0 20px rgba(0, 0, 0, 0.4);
    
    border-radius: 2px 2px 4px 4px;
    animation: unroll 1.2s cubic-bezier(0.1, 0.8, 0.2, 1) forwards;
    transform-origin: top;
    clip-path: polygon(1% 0, 99% 1%, 100% 98%, 98% 100%, 0 99%);
}

@keyframes unroll {
    0% { transform: scaleY(0) rotateX(-40deg); opacity: 0; box-shadow: 0 0 0 rgba(0,0,0,0); }
    100% { transform: scaleY(1) rotateX(0); opacity: 1; }
}

/* Die Holzstangen der Rolle */
.scroll-container::before, .scroll-container::after {
    content: "";
    position: absolute;
    left: -30px; right: -30px;
    height: 28px;
    background: linear-gradient(to bottom, #3a2311 0%, #5d3a1a 40%, #2b1708 100%);
    border-radius: 15px;
    box-shadow: 
        inset 0 2px 5px rgba(255,255,255,0.1),
        0 10px 20px rgba(0,0,0,0.8);
    border: 1px solid #1a0d04;
}
.scroll-container::before { top: -14px; clip-path: none; }
.scroll-container::after { bottom: -14px; clip-path: none; }

/* ==========================================
   TYPOGRAFIE & TINTE
   ========================================== */
h1 {
    font-family: 'Uncial Antiqua', serif;
    text-align: center;
    font-size: 2.8rem;
    margin: 0 0 5px 0;
    color: #3b2415;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.3), 0 0 10px rgba(59, 36, 21, 0.2);
    border-bottom: 2px solid rgba(59, 36, 21, 0.3);
    padding-bottom: 10px;
}

.sub-header {
    text-align: center;
    font-style: italic;
    font-size: 1.1rem;
    margin-bottom: 25px;
    color: #5c402c;
}

.scroll-content {
    height: 320px;
    overflow-y: auto;
    padding-right: 20px;
    margin-bottom: 30px;
    font-size: 1.15rem;
    line-height: 1.6;
    text-shadow: 0px 0px 0.5px rgba(44, 30, 22, 0.4);
}

.scroll-content::-webkit-scrollbar { width: 8px; }
.scroll-content::-webkit-scrollbar-track { background: rgba(0,0,0,0.05); border-radius: 4px; border: 1px solid rgba(0,0,0,0.1); }
.scroll-content::-webkit-scrollbar-thumb { background: #5d3a1a; border-radius: 4px; }

h3 { 
    font-family: 'Uncial Antiqua', serif;
    color: #5d3a1a; 
    margin-top: 25px; 
    margin-bottom: 5px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

h3::before {
    content: "♦";
    color: var(--accent-dark);
    font-size: 1rem;
}

.signature-date {
    margin-top: 40px; 
    text-align: center; 
    font-size: 1rem; 
    color: rgba(59, 36, 21, 0.6); 
    font-family: 'Uncial Antiqua', serif;
}

/* ==========================================
   AKZEPTIEREN & SIEGEL-BUTTONS
   ========================================== */
.accept-section {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    margin-bottom: 25px;
    border-top: 1px solid rgba(0,0,0,0.1);
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.accept-section input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--accent-dark);
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

.accept-section label {
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    color: #3b2415;
    text-shadow: 0px 0px 1px rgba(0,0,0,0.2);
}

.buttons {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.btn {
    font-family: 'Uncial Antiqua', serif;
    font-size: 1.1rem;
    padding: 12px 30px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.btn-cancel {
    background: transparent;
    color: #5c402c;
    border: 2px dashed #5c402c;
    border-radius: 4px;
}

.btn-cancel:hover {
    background: rgba(92, 64, 44, 0.1);
}

.btn-accept {
    background: radial-gradient(circle at 30% 30%, #ffd700 0%, #b8860b 60%, #8a6300 100%);
    color: #2b1d0e;
    border: 3px solid #5a4000;
    border-radius: 50px;
    font-weight: bold;
    box-shadow: 
        inset 0 2px 5px rgba(255,255,255,0.8),
        inset 0 -3px 5px rgba(0,0,0,0.4),
        0 8px 15px rgba(0,0,0,0.6);
    text-shadow: 1px 1px 0px rgba(255,255,255,0.4);
}

.btn-accept:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        inset 0 2px 5px rgba(255,255,255,0.8),
        inset 0 -3px 5px rgba(0,0,0,0.4),
        0 12px 20px rgba(0,0,0,0.7);
    filter: brightness(1.1);
}

.btn-accept:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: 
        inset 0 1px 2px rgba(255,255,255,0.8),
        0 2px 5px rgba(0,0,0,0.6);
}

.btn-accept:disabled {
    background: radial-gradient(circle at 30% 30%, #888 0%, #555 60%, #333 100%);
    border-color: #222;
    color: #aaa;
    text-shadow: none;
    cursor: not-allowed;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

/* ==========================================
   ERZWUNGENE SCHRIFTFARBE FÜR DEN KODEX
   ========================================== */
#kodex-wrapper .scroll-content,
#kodex-wrapper .scroll-content p,
#kodex-wrapper .scroll-content li,
#kodex-wrapper .sub-header,
#kodex-wrapper .signature-date {
    color: var(--ink) !important;
}

#kodex-wrapper h1,
#kodex-wrapper h3 {
    color: #3b2415 !important;
}

#kodex-wrapper .accept-section label {
    color: #3b2415 !important;
}

#kodex-signature-name {
    display: inline-block;
    min-width: 200px;
    text-align: center;
    /* Wir erzwingen hier schwarz, damit es wie frische Tinte aussieht */
    color: #000000 !important; 
    text-shadow: 0 0 1px rgba(0,0,0,0.3);
}

/* Checkbox und Text ausgrauen, solange man nicht runtergescrollt hat */
.accept-section input:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.accept-section input:disabled + label {
    color: rgba(44, 30, 22, 0.4) !important;
    cursor: not-allowed;
}