@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700&family=Lato:wght@300;400;700&family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&display=swap');

*:focus, *:active, *:focus-visible { outline: none !important; }
* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }

:root {
    --bg-color: #e8e4dd;
    --paper-color: #fdfbf7;
    
    --ink-primary: #2a2320;
    --ink-secondary: #59504a;
    --ink-light: #948c87;
    
    --accent-gold: #bfa15f;
    --accent-gold-dark: #9e8246;
    --accent-crimson: #963a2f;

    --font-ui: 'Lato', sans-serif;
    --font-body: 'Cormorant Garamond', serif;
    --font-display: 'Cinzel', serif;
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --shadow-card: 0 10px 30px -5px rgba(42, 35, 32, 0.15);
}

body {
    margin: 0; font-family: var(--font-ui);
    color: var(--ink-primary); background-color: var(--bg-color);
    min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden;
}

.hidden { display: none !important; }
.text-center { text-align: center; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.animate-fade-in { animation: fadeIn 0.4s ease-out forwards; }

/* SIDEBAR */
.nav-toggle {
    position: fixed; top: 20px; left: 20px; z-index: 1100;
    width: 40px; height: 40px;
    background: var(--paper-color);
    border: 1px solid rgba(0,0,0,0.1); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.1); transition: transform 0.2s;
    color: var(--ink-primary);
}
.nav-toggle:hover { transform: scale(1.1); }

.side-nav {
    position: fixed; top: 0; left: 0; height: 100%; width: 280px;
    background: var(--paper-color); box-shadow: 5px 0 25px rgba(0,0,0,0.1);
    transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000; padding: 80px 0 20px; display: flex; flex-direction: column;
}
.side-nav.open { transform: translateX(0); }
.side-nav::before {
    content: ''; position: absolute; top: 0; right: 0; width: 4px; height: 100%;
    background: linear-gradient(to bottom, var(--accent-gold), var(--accent-crimson));
}

.nav-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(44, 36, 32, 0.4); backdrop-filter: blur(2px);
    z-index: 999; opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.nav-overlay.visible { opacity: 1; pointer-events: auto; }

/* APLIKACJA */
.app-wrapper {
    flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px;
    min-height: 100vh;
}

/* ZMIANY: Płynne wydłużanie się kontenera */
.parchment-card {
    background-color: var(--paper-color);
    width: 100%; max-width: 850px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card);
    position: relative; 
    border: 1px solid rgba(0,0,0,0.04);
    transition: height 0.4s cubic-bezier(0.25, 1, 0.5, 1); /* Płynna zmiana wysokości */
    overflow: hidden; /* Utrzymuje elementy w ryzach podczas animacji wys. */
}

/* NOWOŚĆ: Kontener wew. do odmierzania rzeczywistego rozmiaru */
.parchment-inner {
    padding: 2rem 3rem;
    display: flex;
    flex-direction: column;
}

.card-header {
    text-align: center; margin-bottom: 1rem; padding-bottom: 1rem;
    border-bottom: 1px solid rgba(44, 36, 32, 0.08);
}
.display-title { font-family: var(--font-display); font-size: 2rem; margin: 0; color: var(--ink-primary); }
.display-subtitle { font-size: 0.8rem; color: var(--accent-gold-dark); text-transform: uppercase; letter-spacing: 2px; font-weight: 700; margin-top: 5px; }

.status-row {
    display: flex; justify-content: space-between; align-items: center; width: 100%;
    padding: 0 5px 10px 5px; border-bottom: none; margin-bottom: 0;
    font-size: 0.9rem; font-weight: 500; color: var(--ink-secondary);
}

.progress-container {
    height: 4px; background: rgba(0,0,0,0.06); width: 100%; margin-bottom: 25px;
    border-radius: 2px; overflow: hidden;
}
.progress-bar { height: 100%; background: var(--accent-gold); width: 0%; transition: width 0.4s ease; }

/* --- WYGLĄD LINKÓW W MENU BOCZNYM --- */
.nav-item {
    padding: 12px 30px; 
    color: var(--ink-secondary); 
    text-decoration: none;
    font-weight: 500; 
    transition: all 0.2s; 
    border-left: 4px solid transparent;
    display: block;
}

.nav-item:hover { 
    background: rgba(197, 157, 95, 0.1); 
    color: var(--ink-primary); 
    padding-left: 35px; 
}

.nav-item.active {
    background: rgba(197, 157, 95, 0.15); 
    color: var(--ink-primary);
    border-left-color: var(--accent-gold); 
    font-weight: 700;
}

/* --- MODAL (DEFINITION BOTTOM SHEET / SKRÓTY) --- */
.modal-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(44, 36, 32, 0.4);
    opacity: 0; pointer-events: none; transition: opacity 0.5s ease; z-index: 9999; backdrop-filter: blur(2px);
}
.modal-backdrop.visible { opacity: 1; pointer-events: auto; }

.definition-modal {
    position: fixed; bottom: 30px; left: 50%; width: 90%; max-width: 500px;
    background: #fdfbf7; border: none; /* ZDJĘTE RAMKI */
    border-radius: var(--radius-md); box-shadow: 0 20px 60px rgba(0,0,0,0.5); text-align: center; padding: 2rem; z-index: 10000;
    transform: translate3d(-50%, 120%, 0); opacity: 0; pointer-events: none; transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.3s ease;
}
.definition-modal.visible { transform: translate3d(-50%, 0, 0); opacity: 1; pointer-events: auto; }

/* --- WYGLĄD LINKU POWROTU W MENU BOCZNYM --- */
.nav-back-link {
    text-decoration: none; 
    color: var(--ink-secondary); 
    font-size: 0.95rem; 
    font-weight: 600; 
    font-family: var(--font-ui); 
    display: inline-flex; 
    align-items: center; 
    gap: 8px; 
    transition: color 0.2s;
}

.nav-back-link:hover {
    color: var(--accent-crimson);
}
