:root {
    --board: #2f4f3e;
    --board-dark: #243d30;
    --wood: #8b5a2b;
    --wood-dark: #6b4220;
    --paper: #fdfbf3;
    --ink: #2b2b3a;
    --line: #cfe3f3;
    --margin: #f3b5b5;
    --pencil: #f2c230;
    --red: #c0392b;
    --chalk: #f4f1e8;
    --radius: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    color: var(--ink);
    font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
    line-height: 1.5;
    background-color: var(--paper);
    /* füzetlap: vonalak + piros margó */
    background-image:
        linear-gradient(90deg, transparent 54px, var(--margin) 54px, var(--margin) 56px, transparent 56px),
        repeating-linear-gradient(transparent, transparent 31px, var(--line) 31px, var(--line) 32px);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---------- Fejléc: iskolatábla ---------- */
.board {
    background: var(--board);
    border-bottom: 10px solid var(--wood);
    box-shadow: 0 4px 0 var(--wood-dark), 0 8px 18px rgba(0, 0, 0, .25);
    color: var(--chalk);
    position: relative;
}
.board-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 18px 20px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    color: inherit;
    text-decoration: none;
}
.brand-icon {
    font-size: 2rem;
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    background: var(--pencil);
    color: var(--board-dark);
    border-radius: 50%;
    transform: rotate(-8deg);
    box-shadow: 0 2px 0 rgba(0, 0, 0, .25);
}
.brand-name {
    display: block;
    font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
    font-size: 1.7rem;
    letter-spacing: .5px;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, .3);
}
.brand-sub {
    display: block;
    font-size: .9rem;
    opacity: .8;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.nav { display: flex; gap: 8px; }
.nav a {
    color: var(--chalk);
    text-decoration: none;
    padding: 8px 16px;
    border: 2px dashed rgba(244, 241, 232, .55);
    border-radius: 8px;
    font-weight: 600;
    transition: background .15s, color .15s;
}
.nav a:hover { background: var(--chalk); color: var(--board-dark); }
.chalk-tray {
    position: absolute;
    left: 0; right: 0; bottom: -10px;
    height: 10px;
}

/* ---------- Oldal ---------- */
.page {
    flex: 1;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 20px 48px 76px; /* a margó vonal mellett */
}
@media (max-width: 700px) {
    .page { padding-left: 20px; }
    body { background-image: repeating-linear-gradient(transparent, transparent 31px, var(--line) 31px, var(--line) 32px); }
}

.intro h1, .section-title {
    font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
    font-size: 2.1rem;
    margin: 0 0 4px;
    display: inline-block;
    background: linear-gradient(transparent 62%, rgba(242, 194, 48, .55) 62%); /* kiemelő */
    padding: 0 6px;
}
.intro p { margin: 6px 0 28px; font-size: 1.05rem; }
.section-title { font-size: 1.5rem; margin: 36px 0 18px; }

/* ---------- Galéria: faliújság ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 34px 26px;
    padding-top: 10px;
}
.card {
    margin: 0;
    position: relative;
    background: #fff;
    padding: 12px 12px 14px;
    border-radius: 3px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .22);
    transform: rotate(var(--tilt, 0deg));
    transition: transform .2s, box-shadow .2s;
}
.card:hover {
    transform: rotate(0deg) translateY(-4px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, .28);
    z-index: 2;
}
.pin {
    position: absolute;
    top: -10px; left: 50%;
    width: 18px; height: 18px;
    margin-left: -9px;
    background: radial-gradient(circle at 35% 35%, #ff8a7a, var(--red) 60%, #8e2418);
    border-radius: 50%;
    box-shadow: 0 3px 3px rgba(0, 0, 0, .35);
    z-index: 3;
}
.thumb { display: block; overflow: hidden; background: #eee; }
.thumb img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}
.card figcaption {
    margin-top: 10px;
    text-align: center;
    font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
    font-size: 1rem;
    color: var(--ink);
}

.empty {
    text-align: center;
    padding: 50px 20px;
    border: 3px dashed var(--board);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .75);
    font-size: 1.1rem;
}

/* ---------- Lightbox ---------- */
.lightbox {
    position: fixed; inset: 0;
    background: rgba(20, 30, 25, .94);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 24px;
}
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; max-width: 90vw; text-align: center; }
.lightbox img {
    max-width: 100%;
    max-height: 80vh;
    border: 10px solid #fff;
    border-radius: 3px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .6);
}
.lightbox figcaption {
    margin-top: 14px;
    color: var(--chalk);
    font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
    font-size: 1.2rem;
}
.lightbox button {
    background: rgba(255, 255, 255, .12);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, .4);
    width: 48px; height: 48px;
    border-radius: 50%;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    margin: 0 10px;
}
.lightbox button:hover { background: var(--pencil); color: var(--board-dark); border-color: var(--pencil); }
.lb-close { position: absolute; top: 18px; right: 18px; }
@media (max-width: 600px) {
    .lb-prev, .lb-next { position: absolute; bottom: 18px; }
    .lb-prev { left: 18px; }
    .lb-next { right: 18px; }
}

/* ---------- Admin ---------- */
.paper {
    background: #fff;
    border: 2px solid var(--board);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: 5px 5px 0 var(--board);
}
.login-wrap { display: flex; justify-content: center; padding-top: 20px; }
.login { width: 100%; max-width: 400px; }
.login h1, .upload h2 {
    font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
    margin-top: 0;
}
label { display: block; font-weight: 600; margin-bottom: 14px; }
input[type=text], input[type=password], input[type=file] {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    font: inherit;
    border: 2px solid #b8c4bd;
    border-radius: 8px;
    background: var(--paper);
}
input:focus { outline: none; border-color: var(--board); box-shadow: 0 0 0 3px rgba(242, 194, 48, .5); }

.btn {
    display: inline-block;
    background: var(--board);
    color: var(--chalk);
    border: 0;
    border-bottom: 4px solid var(--board-dark);
    padding: 10px 22px;
    font: inherit;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: transform .1s;
}
.btn:hover { background: #3b6350; }
.btn:active { transform: translateY(2px); border-bottom-width: 2px; }
.btn-ghost { background: transparent; color: var(--board); border: 2px solid var(--board); }
.btn-ghost:hover { background: var(--board); color: var(--chalk); }
.btn-small { padding: 6px 14px; font-size: .9rem; }
.btn-danger { background: var(--red); border-bottom-color: #8e2418; }
.btn-danger:hover { background: #d84a3a; }

.admin-top { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; }
.msg {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-weight: 600;
}
.msg.ok { background: #e3f4e3; border: 2px solid #4a9a4a; }
.msg.error { background: #fde4e1; border: 2px solid var(--red); }

.admin-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}
.admin-item { padding: 12px; box-shadow: 3px 3px 0 var(--board); display: flex; flex-direction: column; gap: 10px; }
.admin-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; display: block; }
.rename { display: flex; gap: 6px; }
.rename input { margin-top: 0; padding: 6px 8px; }

/* ---------- Galériák (albumok) ---------- */
.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 30px 26px;
}
.album-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 2px solid var(--board);
    border-left: 16px solid var(--board); /* füzet gerince */
    border-radius: 4px 12px 12px 4px;
    box-shadow: 5px 5px 0 var(--board);
    overflow: hidden;
    transition: transform .15s, box-shadow .15s;
}
.album-card:hover {
    transform: translate(-3px, -3px);
    box-shadow: 8px 8px 0 var(--board);
}
.album-cover {
    aspect-ratio: 4 / 3;
    background: #dfe8e2;
    display: grid;
    place-items: center;
    overflow: hidden;
}
.album-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-empty { font-size: 3.5rem; color: var(--board); opacity: .45; }
.album-label {
    margin: 12px;
    padding: 10px 12px;
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.album-label strong {
    font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
    font-size: 1.2rem;
}
.album-desc { font-size: .92rem; opacity: .85; }
.album-count { font-size: .85rem; font-weight: 700; color: var(--board); }

.crumbs { margin: 0 0 14px; font-weight: 700; }
.crumbs a { color: var(--board); text-decoration: none; border-bottom: 2px dashed var(--board); }
.crumbs a:hover { background: var(--pencil); }

/* ---------- Admin kiegészítések ---------- */
textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    font: inherit;
    border: 2px solid #b8c4bd;
    border-radius: 8px;
    background: var(--paper);
    resize: vertical;
}
textarea:focus { outline: none; border-color: var(--board); box-shadow: 0 0 0 3px rgba(242, 194, 48, .5); }
.admin-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}
.admin-cols h2, .upload h2 { font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; margin-top: 0; font-size: 1.25rem; }
.danger-zone { margin-top: 18px; padding-top: 14px; border-top: 2px dashed #ccc; }
.admin-thumb { position: relative; display: block; }
.badge {
    position: absolute; top: 8px; left: 8px;
    background: var(--pencil);
    color: var(--board-dark);
    font-weight: 800;
    font-size: .8rem;
    padding: 2px 10px;
    border-radius: 20px;
    box-shadow: 0 2px 0 rgba(0, 0, 0, .25);
}
.item-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Lábléc ---------- */
.foot {
    background: var(--wood);
    color: #fff;
    text-align: center;
    padding: 14px;
    font-size: .9rem;
    border-top: 4px solid var(--wood-dark);
}
.foot p { margin: 0; }
