:root {
    --raven-blue: #0e1a40;
    --bronze: #744d18;
    --parchment-base: #f4e4bc;
    --ink: #1a1a1a;
    --glow: rgba(255, 255, 255, 0.5);
}

body {
    margin: 0;
    padding: 0;
    background-color: #0a0a0a;
    background-image: radial-gradient(circle at center, #1a1a1a 0%, #050505 100%);
    font-family: 'Cormorant Garamond', serif;
    color: var(--ink);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#candlelight-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(circle at 50% 50%, transparent 20%, rgba(0,0,0,0.5) 100%);
    animation: flicker 5s infinite;
    z-index: 5;
}

@keyframes flicker {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 0.9; }
    80% { opacity: 0.8; }
}

#scroll-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

#parchment {
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    aspect-ratio: 1 / 1;
    background-image: url('/api/nanobanana/image/1024/1024?prompt=blank+ancient+medieval+parchment+paper+texture+yellowed+worn+edges+plain+background+high+resolution&negative_prompt=text,words,letters,script,writing,wood,desk,table,pen,inkwell');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    padding: 12% 15%; /* Responsive padding based on aspect ratio */
    box-sizing: border-box;
    position: relative;
    filter: drop-shadow(0 20px 50px rgba(0,0,0,0.9));
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    border-bottom: 1px solid rgba(116, 77, 24, 0.2);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

#eagle-seal {
    width: 50px;
    filter: sepia(1) saturate(1.5) brightness(0.6);
    margin-bottom: 5px;
}

h1 {
    font-family: 'MedievalSharp', cursive;
    margin: 0;
    font-size: 2rem;
    color: var(--raven-blue);
    text-shadow: 0 0 10px var(--glow);
}

#manuscript-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 15px;
}

#riddle-text {
    font-size: 1.6rem;
    line-height: 1.3;
    font-weight: 700;
    text-align: center;
    text-shadow: 0 0 10px var(--glow), 0 0 2px white;
    color: var(--ink);
}

.ink-bleed {
    animation: ink-reveal 2.5s forwards;
    opacity: 0;
}

@keyframes ink-reveal {
    from { opacity: 0; filter: blur(3px); }
    to { opacity: 1; filter: blur(0); }
}

#input-container {
    text-align: center;
    padding-top: 15px;
}

#user-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--bronze);
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    font-weight: 700;
    width: 80%;
    text-align: center;
    color: var(--ink);
    outline: none;
    padding: 5px;
    text-shadow: 0 0 10px var(--glow);
}

#user-input::placeholder {
    color: rgba(26, 26, 26, 0.4);
    font-style: italic;
}

.italic-hint {
    margin-top: 8px;
    font-size: 1rem;
    color: #4a3511;
    font-style: italic;
    min-height: 1.2rem;
}

#feedback-log {
    margin-top: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    color: #333;
    min-height: 1.5rem;
}

/* Overlays */
.parchment-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(244, 228, 188, 0.85);
    backdrop-filter: blur(3px);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 5px;
}

.result-box {
    text-align: center;
    padding: 20px;
    border: 2px double var(--bronze);
}

.result-box h2 {
    font-family: 'MedievalSharp', cursive;
    font-size: 2rem;
    color: var(--raven-blue);
}

#result-text {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 15px;
}

#share-grid {
    font-size: 1.8rem;
    margin-bottom: 15px;
}

button {
    background: var(--raven-blue);
    color: #fff;
    border: 1px solid var(--bronze);
    padding: 8px 16px;
    font-family: 'MedievalSharp', cursive;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
}

button:hover {
    background: var(--bronze);
    transform: translateY(-2px);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    #parchment {
        padding: 15% 10%;
    }
    h1 { font-size: 1.5rem; }
    #riddle-text { font-size: 1.2rem; }
    #user-input { font-size: 1.2rem; }
}
