.contest-banner, .groups-grid, .group-box {
    font-family: Arial, sans-serif;
}

.container {
    width: 100%;
}

h2 {
    color: #003366;
    margin-bottom: 10px;
    font-size: 22px;
}
h3 {
    color: #8b1010;
    margin-bottom: 5px;
    font-size: 14px;
}
/* ── Заглавие + бутон „Правила“ ───────────────────────── */
.contest-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.contest-title-row h2 { margin: 0; }
.rules-btn {
    flex-shrink: 0;
    margin-left: auto;
    padding: 8px 16px;
    background: #003366;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.rules-btn:hover { background: #00509e; }

/* ── Модален прозорец „Правила“ ───────────────────────── */
.rules-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, .55);
}
.rules-overlay[hidden] { display: none; }
.rules-dialog {
    background: #fff;
    border-radius: 10px;
    width: 100%;
    max-width: 680px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}
.rules-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #e5e7eb;
}
.rules-head h3 { margin: 0; color: #003366; font-size: 18px; }
.rules-close {
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 4px 8px;
}
.rules-close:hover { color: #111827; }
.rules-body {
    padding: 16px 18px 20px;
    overflow-y: auto;
    font-size: 15px;
    line-height: 1.6;
    color: #1f2937;
}

.contest-subtitle {
    color: #374151;
    font-size: 15px;
    line-height: 1.5;
    margin: -4px 0 10px;
}

/* ── Grid на групите ─────────────────────────────────── */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    padding: 10px 0;
}

.group-box {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    padding: 15px;
    box-sizing: border-box;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.group-content {
    flex-grow: 1;
}

/* ── Снимки вътре в карточката ───────────────────────── */
.stamp-images {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin: 10px 0;
}

.stamp-images a {
    display: inline-block;
    line-height: 0;
}

.stamp-images img {
    max-height: 110px;
    max-width: 130px;
    width: auto;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: zoom-in;
    transition: border-color 0.2s, transform 0.2s;
}

@media (hover: hover) {
    .stamp-images img:hover {
        border-color: #003366;
        transform: scale(1.06);
        position: relative;
        z-index: 1;
    }
}

.subject {
    font-size: 13px;
    margin-bottom: 8px;
}

.info-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    margin-left: 4px;
    border-radius: 50%;
    background: #1e3a5f;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    font-style: italic;
    font-family: Georgia, serif;
    line-height: 1;
    cursor: help;
    vertical-align: middle;
}

.info-tip {
    display: none;
    position: absolute;
    top: 125%;
    left: 0;
    z-index: 50;
    width: 240px;
    max-width: 70vw;
    padding: 8px 10px;
    border-radius: 6px;
    background: #1e293b;
    color: #fff;
    font-size: 12px;
    font-style: normal;
    font-weight: 400;
    font-family: inherit;
    line-height: 1.4;
    text-align: left;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
}

.info-icon:hover .info-tip,
.info-icon:focus .info-tip {
    display: block;
}

.group-box .subject {
    font-size: 14px;
    margin-bottom: 10px;
    color: #003366;
}

.group-box p {
    margin: 5px 0;
    font-size: 14px;
}

/* ── Секция за гласуване ─────────────────────────────── */
.vote-section {
    margin-top: auto;
    font-size: 14px;
    padding: 10px;
    color: #fff;
    background: #172e55;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}

@media (hover: hover) {
    .vote-section:hover {
        background: #1660db;
        transform: scale(1.05);
    }
}

.vote-section input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
    vertical-align: middle;
}

/* ── Бутон „Гласувай" ────────────────────────────────── */
.vote-btn-wrap {
    text-align: center;
    margin: 24px 0 10px;
}

.vote-btn {
    background: #003366;
    color: #fff;
    border: none;
    padding: 12px 36px;
    border-radius: 6px;
    font-size: 17px;
    cursor: pointer;
    transition: background 0.25s;
}

.vote-btn:hover {
    background: #990000;
}

/* ── Резултати ───────────────────────────────────────── */
.result-section {
    margin-top: auto;
    padding-top: 8px;
    font-size: 14px;
}

.progress-bar {
    width: 100%;
    background: #eee;
    border-radius: 6px;
    overflow: hidden;
    height: 18px;
    margin: 8px 0;
    border: 1px solid #ccc;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #003366, #990000);
    transition: width 0.5s ease;
}

.error {
    color: #990000;
    font-size: 18px;
    margin-bottom: 15px;
}

/* ═══════════════════════════════════════════════════════
   ЛАЙТБОКС
   ═══════════════════════════════════════════════════════ */
.lb-overlay {
    display: none;
    position: fixed;
    z-index: 9999;
    inset: 0;
    background: rgba(0,0,0,0.92);
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.lb-content {
    overflow: hidden;
    max-width: 90vw;
    max-height: 76vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lb-img {
    max-width: 88vw;
    max-height: 74vh;
    object-fit: contain;
    border: 3px solid #fff;
    border-radius: 6px;
    transition: transform 0.25s ease;
    transform-origin: center;
    user-select: none;
    cursor: zoom-in;
    display: block;
}

.lb-img.zoomed {
    cursor: zoom-out;
}

/* Затваряне */
.lb-close {
    position: absolute;
    top: 14px; right: 18px;
    font-size: 22px;
    color: #fff;
    background: rgba(0,0,0,0.55);
    border: 2px solid rgba(255,255,255,0.35);
    border-radius: 50%;
    width: 40px; height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    transition: background 0.2s;
    padding: 0;
    line-height: 1;
}

.lb-close:hover {
    background: rgba(180,0,0,0.75);
}

/* Навигационни стрелки */
.lb-prev, .lb-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 30px;
    color: #fff;
    background: rgba(0,0,0,0.45);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    width: 50px; height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    transition: background 0.2s;
    padding: 0;
    line-height: 1;
}

.lb-prev { left: 14px; }
.lb-next { right: 14px; }

.lb-prev:hover, .lb-next:hover {
    background: rgba(255,255,255,0.22);
}

/* Брояч */
.lb-counter {
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    margin-top: 10px;
    letter-spacing: 0.5px;
}

/* Zoom бутони */
.lb-zoom-controls {
    position: absolute;
    bottom: 16px;
    display: flex;
    gap: 8px;
}

.lb-zoom-controls button {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 5px;
    padding: 4px 14px;
    font-size: 20px;
    cursor: pointer;
    line-height: 1.4;
    transition: background 0.2s;
}

.lb-zoom-controls button:hover {
    background: rgba(255,255,255,0.35);
}

/* ═══════════════════════════════════════════════════════
   ТАБОВЕ ПО ГОДИНИ
   ═══════════════════════════════════════════════════════ */
.contest-tabs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 22px;
    justify-content: flex-start;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
}

.contest-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: .85rem;
    font-weight: 700;
    color: #475569;
    text-decoration: none;
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    transition: color .18s, background .18s, border-color .18s;
    letter-spacing: .02em;
}

.contest-tab:hover {
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #93c5fd;
}

.contest-tab.ct-active {
    color: #fff;
    background: #1e3a5f;
    border-color: #1e3a5f;
    box-shadow: 0 2px 8px rgba(30,58,95,.25);
    pointer-events: none;
}

.ct-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 20px;
    line-height: 1.3;
    letter-spacing: 0;
}

.ct-badge--on    { background: #dcfce7; color: #15803d; }
.ct-badge--pause { background: #fef9c3; color: #a16207; }

.contest-tab.ct-active .ct-badge--on    { background: rgba(255,255,255,.25); color: #86efac; }
.contest-tab.ct-active .ct-badge--pause { background: rgba(255,255,255,.2);  color: #fde68a; }

/* ── Банер за текущия режим ──────────────────────────── */
.contest-banner {
    padding: 11px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: .9rem;
    font-weight: 600;
    border-left: 4px solid transparent;
}

.contest-banner--pause  {
    background: #fefce8;
    color: #854d0e;
    border-left-color: #eab308;
}

.contest-banner--voted  {
    background: #f0fdf4;
    color: #166534;
    border-left-color: #22c55e;
}

.contest-banner--results {
    background: #f8fafc;
    color: #334155;
    border-left-color: #94a3b8;
}

/* ── Секция за резултати ─────────────────────────────── */
.result-section {
    margin-top: auto;
    padding-top: 8px;
    font-size: .87rem;
}

/* ── vote-section muted (при browse/voted режим) ─────── */
.vote-section--muted {
    background: #f1f5f9;
    color: #64748b;
    font-weight: 600;
    font-size: .82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Хедър ───────────────────────────────────────────── */
.site-header {
    display: block;
    align-items: center;
    justify-content: left;
    gap: 20px;
    padding: 1px;
}

/* ── Навигация ───────────────────────────────────────── */
nav.menu {
    width: 70%;
    margin: 1px auto;
    display: flex;
    background-color: #f9f9f9;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #6c8da0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    font-size: 14px;
}

nav.menu a {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 5px 3px;
    color: #2a4d7f;
    text-decoration: none;
    border-right: 1px solid #6c8da0;
    transition: background-color 0.3s ease;
    font-size: 14px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

nav.menu a:last-child {
    border-right: none;
}

nav.menu a:hover {
    background-color: #4db748;
}

/* Хамбургер */
.hamburger {
    display: none;
    font-size: 26px;
    background: none;
    border: none;
    cursor: pointer;
    color: #003366;
}

/* ═══════════════════════════════════════════════════════
   МОБИЛНА ВЕРСИЯ
   ═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    body {
        display: block;
        padding: 5px;
    }

    .site-header {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .site-header img.logo {
        max-width: 150px;
        height: auto;
        margin-bottom: 10px;
    }

    .site-header h1 {
        font-size: 18px;
    }

    .hamburger {
        display: block;
        position: absolute;
        right: 15px;
        top: 15px;
    }

    nav.menu {
        display: none;
        flex-direction: column;
        width: 100%;
        margin-top: 10px;
        font-size: 16px;
    }

    nav.menu.show {
        display: flex;
    }

    nav.menu a {
        display: block;
        padding: 10px;
        border-bottom: 1px solid #ccc;
        border-right: none;
    }

    nav.menu a:last-child {
        border-bottom: none;
    }

    .groups-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .group-box {
        max-width: 95%;
        margin: 0 auto;
    }

    .stamp-images img {
        max-height: 130px;
        max-width: 150px;
    }

    h2 { font-size: 18px; }
    h3 { font-size: 12px; }

    .vote-section {
        font-size: 13px;
        padding: 8px;
    }

    .vote-btn {
        width: 100%;
        font-size: 18px;
        padding: 12px;
    }

    .lb-prev { left: 4px; }
    .lb-next { right: 4px; }

    .lb-zoom-controls button {
        padding: 4px 10px;
        font-size: 18px;
    }

    /* Year tabs – по-малки на тесни екрани */
    .contest-tab {
        padding: 4px 10px;
        font-size: .8rem;
    }

    /* Позволява wrap на текста в muted секцията */
    .vote-section--muted {
        white-space: normal;
    }

    /* Banner текст – по-четим */
    .contest-banner {
        font-size: .85rem;
    }

    /* Checkbox label – по-голяма touch зона */
    .vote-section label {
        display: block;
        padding: 4px 0;
        cursor: pointer;
    }
}

@media (max-width: 480px) {
    .site-header h1 { font-size: 16px; }
    nav.menu { font-size: 14px; }

    /* На много малки екрани марките стават по-големи (1 колона = повече место) */
    .stamp-images img {
        max-height: 140px;
        max-width: 160px;
    }

    .contest-tab {
        padding: 3px 8px;
        font-size: .75rem;
    }
}
