:root {
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
    --text-main: #2d3748;
    --text-muted: #718096;
    --primary: #2c3e50;
    --accent: #3498db;
    --radius: 12px;
}

body { 
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', sans-serif; 
    margin: 0; 
    padding: 40px 20px; 
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    font-family: 'Lora', serif;
    font-weight: 600;
    font-size: 2.5em;
    color: var(--primary);
    margin-bottom: 40px;
}

.search-box { 
    background: var(--card-bg); 
    padding: 15px; 
    border-radius: var(--radius); 
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-bottom: 40px; 
}

.search-form {
    display: flex;
    gap: 12px;
}

.search-box input[type="text"] { 
    flex: 1;
    padding: 14px 20px; 
    font-size: 16px; 
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    transition: all 0.2s;
    outline: none;
}

.search-box input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.search-box button { 
    padding: 14px 28px; 
    cursor: pointer; 
    font-size: 16px;
    font-weight: 600;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    transition: background 0.2s;
}

.search-box button:hover {
    background: #1a252f;
}

.reset-btn { 
    display: flex;
    align-items: center;
    color: #e74c3c; 
    text-decoration: none; 
    font-weight: 500;
    padding: 0 10px;
    transition: color 0.2s;
}

.reset-btn:hover {
    color: #c0392b;
}

.haslo-box { 
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px; 
    margin-bottom: 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start; 
    gap: 30px; 
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.haslo-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.08);
}

.tekst-hasla { 
    flex: 1; 
}

.haslo { 
    font-family: 'Lora', serif;
    color: var(--primary); 
    font-size: 1.5em; 
    display: block;
    margin-bottom: 12px;
    border-bottom: 2px solid #edf2f7;
    padding-bottom: 8px;
}

.definicja { 
    color: var(--text-main); 
    font-size: 1.1em;
    line-height: 1.7;
}

.zrodlo-badge {
    display: inline-block;
    background: #edf2f7;
    color: var(--text-muted);
    font-size: 0.85em;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 20px;
    margin-top: 15px;
}

.obrazek-hasla {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 320px; 
}

.obrazek-hasla img { 
    max-width: 100%; 
    border-radius: 8px; 
    box-shadow: 0 4px 8px rgba(0,0,0,0.1); 
    object-fit: cover;
    display: block;
}

.obrazek-caption {
    margin-top: 10px;
    font-size: 0.85em;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    line-height: 1.4;
}

.no-results {
    text-align: center;
    color: var(--text-muted);
    font-size: 1.2em;
    padding: 40px;
    background: var(--card-bg);
    border-radius: var(--radius);
}

@media (max-width: 768px) {
    .haslo-box { flex-direction: column; }
    .obrazek-hasla { max-width: 100%; width: 100%; }
    .search-form { flex-direction: column; }
    .reset-btn { justify-content: center; padding-top: 10px; }
}

/* Kursor wskazujący dla obrazków i delikatny efekt po najechaniu */
.obrazek-hasla img { 
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.obrazek-hasla img:hover {
    transform: scale(1.03); /* Leciutkie powiększenie */
    box-shadow: 0 8px 15px rgba(0,0,0,0.15);
}

/* =========================================
   STYLIZACJA MODALA (POWIĘKSZONY OBRAZEK)
   ========================================= */
.modal {
    display: none; /* Domyślnie ukryty */
    position: fixed;
    z-index: 1000; /* Zawsze na samym wierzchu */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85); /* Ciemne, lekko przezroczyste tło */
    backdrop-filter: blur(5px); /* Nowoczesne rozmycie tła */
}

/* Kontener centrujący obrazek */
.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 90%;
    max-width: 900px;
}

/* Powiększony obrazek wewnątrz modala */
#modal-img {
    max-width: 100%;
    max-height: 80vh; /* Obrazek nigdy nie przekroczy 80% wysokości ekranu */
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    object-fit: contain;
}

/* Podpis w modalu */
.modal-caption {
    margin-top: 20px;
    color: #f4f7f6;
    font-size: 1.2em;
    font-style: italic;
    font-family: 'Lora', serif;
}

/* Przycisk zamykania (krzyżyk) */
.modal-close {
    position: absolute;
    top: 25px;
    right: 40px;
    color: #f1f1f1;
    font-size: 45px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 1001;
}

.modal-close:hover,
.modal-close:focus {
    color: var(--accent); /* Zmienia kolor na niebieski przy najechaniu */
}

/* Dla mniejszych ekranów (telefony) dostosowujemy przycisk zamykania */
@media (max-width: 768px) {
    .modal-close {
        top: 10px;
        right: 20px;
        font-size: 35px;
    }
}

/* =========================================
   STYLIZACJA PRZYCISKU "DE LEXICO" I MODALA TEKSTOWEGO
   ========================================= */

.top-nav {
    text-align: right;
    margin-bottom: -15px; /* Podciąga h1 trochę wyżej */
}

.top-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.2s;
}

.top-nav a:hover {
    color: var(--accent);
}

/* Wygląd okienka z tekstem */
.text-modal-content {
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius);
    text-align: left;
    max-width: 600px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
    position: relative; /* Potrzebne do umiejscowienia krzyżyka */
}

/* Wewnętrzny krzyżyk dla modala tekstowego */
.text-modal-content .about-close {
    position: absolute;
    top: 15px;
    right: 25px;
    color: var(--text-muted);
    font-size: 35px;
}

.text-modal-content .about-close:hover {
    color: var(--accent);
}

.text-modal-content h2 {
    margin-top: 0;
    color: var(--primary);
    font-family: 'Lora', serif;
    border-bottom: 2px solid #edf2f7;
    padding-bottom: 10px;
}

.text-modal-content p {
    color: var(--text-main);
    font-size: 1.1em;
    line-height: 1.8;
}

.text-modal-content a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.text-modal-content a:hover {
    text-decoration: underline;
}
/* =========================================
   STOPKA (FOOTER)
   ========================================= */
.site-footer {
    text-align: center;
    margin-top: 60px;
    padding: 20px 0;
    border-top: 1px solid #e2e8f0;
    color: var(--text-muted);
    font-size: 0.9em;
}
/* =========================================
   LICZNIK SŁÓW
   ========================================= */
.numerus-vocabulorum {
    text-align: right;
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 12px;
    font-family: 'Lora', serif;
    font-style: italic;
}

.numerus-vocabulorum strong {
    color: var(--primary);
}
/* =========================================
   GALERIA OBRAZKÓW I STRZAŁKI W MODALU
   ========================================= */
.obrazki-galeria {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 320px;
}

.obrazki-galeria .obrazek-hasla {
    width: 100%;
}

.modal-prev, .modal-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    padding: 15px 20px;
    color: white;
    font-weight: bold;
    font-size: 24px;
    background: rgba(0,0,0,0.5);
    border: none;
    border-radius: 5px;
    z-index: 1002;
    transition: background 0.3s;
    user-select: none;
}

.modal-prev { left: 15px; }
.modal-next { right: 15px; }

.modal-prev:hover, .modal-next:hover {
    background: rgba(0,0,0,0.8);
}

@media (max-width: 768px) {
    .modal-prev { left: 5px; padding: 10px 15px; }
    .modal-next { right: 5px; padding: 10px 15px; }
}