:root {
    /* Väripaletti Fotomin LUMIX-kamera + filmirulla -kuvasta:
       lämmin kermanvalkoinen tausta, kameran musta runko, hopeanharmaat
       metalliset korostukset ja filmin lämmin kupari/ruskea sävy. */
    --bg: #f3ead9;
    --surface: #fffdf9;
    --ink: #2a2521;
    --ink-soft: #756a5b;
    --border: #e4d7bf;
    --accent: #8a4b23;
    --accent-dark: #6e3a19;
    --accent-soft: #f1e0cb;
    --charcoal: #211d1a;
    --silver-1: #e2e5e9;
    --silver-2: #7d838c;

    /* Yläpalkin vihreä gradientti - käytetään myös muissa napeissa, jotta
       koko sivuston napit ovat yhtenäisen näköisiä. */
    --green-gradient: linear-gradient(180deg, #10321d 0%, #2e6b41 50%, #10321d 100%);
    --green-gradient-hover: linear-gradient(180deg, #184026 0%, #3a7d52 50%, #184026 100%);
    --green-gradient-active: linear-gradient(180deg, #081a0e 0%, #1c4429 50%, #081a0e 100%);
}

* { box-sizing: border-box; }

/* Yhtenäinen, selkeästi luettava fokus-tyyli kaikille lomakekentille:
   tausta pysyy vaaleana ja teksti tummana, vain reunus vihertyy. */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #2e6b41;
    box-shadow: 0 0 0 3px rgba(46, 107, 65, 0.18);
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background-color: var(--bg);
    background-image: linear-gradient(rgba(243, 234, 217, 0.45), rgba(243, 234, 217, 0.45)), url('img/background.webp');
    background-repeat: no-repeat, repeat;
    background-size: cover, 320px 320px;
    background-attachment: fixed, fixed;
    color: var(--ink);
    margin: 0;
    min-height: 100vh;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--green-gradient);
    color: #fff;
}

.topbar h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: linear-gradient(180deg, #f5f7f9 0%, #c2c8ce 42%, #82868d 55%, #dfe2e6 75%, #9aa0a7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Nappi ja teksti samalla elementillä: kaksi taustakerrosta, joista
   ensimmäinen (metallinen gradientti) rajataan tekstin muotoon ja toinen
   (vihreä, kuten topbar) täyttää koko napin taustan sen ympärillä. */
.topbar nav a {
    display: inline-flex;
    align-items: center;
    margin-left: 0.6rem;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
    background-image:
        linear-gradient(180deg, #f5f7f9 0%, #c2c8ce 42%, #82868d 55%, #dfe2e6 75%, #9aa0a7 100%),
        var(--green-gradient);
    -webkit-background-clip: text, border-box;
    background-clip: text, border-box;
    color: transparent;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.18), inset 0 -1px 0 rgba(0,0,0,0.25);
    transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.topbar nav a:hover {
    background-image:
        linear-gradient(180deg, #f5f7f9 0%, #c2c8ce 42%, #82868d 55%, #dfe2e6 75%, #9aa0a7 100%),
        var(--green-gradient-hover);
}

.topbar nav a:active {
    background-image:
        linear-gradient(180deg, #f5f7f9 0%, #c2c8ce 42%, #82868d 55%, #dfe2e6 75%, #9aa0a7 100%),
        var(--green-gradient-active);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.6);
    transform: scale(0.97);
}

.topbar nav span {
    margin-right: 1rem;
    background: linear-gradient(180deg, #f5f7f9 0%, #c2c8ce 42%, #82868d 55%, #dfe2e6 75%, #9aa0a7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-bg {
    position: fixed;
    inset: -20px;
    background-size: cover;
    background-position: center;
    filter: blur(18px) brightness(0.8);
    transform: scale(1.1);
    z-index: -1;
}

.auth-box {
    max-width: 420px;
    width: 100%;
    margin: 3rem auto;
    padding: 2rem;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(40,25,10,0.22);
    position: relative;
}

.auth-box label {
    display: block;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.auth-box label.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-box label.checkbox-label input { width: auto; margin-top: 0; }

.auth-box input,
.auth-box textarea,
.auth-box select {
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.25rem;
    border: 1px solid #b9cdbf;
    border-radius: 4px;
    font-size: 1rem;
    background: #fff;
    color: var(--ink);
}

.auth-box button {
    background: var(--green-gradient);
    color: #fff;
    font-weight: 700;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.18);
    transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.auth-box button:hover { background: var(--green-gradient-hover); }
.auth-box button:active { background: var(--green-gradient-active); transform: scale(0.98); }

.error { color: #b91c1c; }
.success { color: #15803d; }

.notice-bar {
    max-width: 1100px;
    margin: 1rem auto 0;
    padding: 0.75rem 1.5rem;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--ink);
}

.notice-bar p { margin: 0; }

.notice-bar form { margin: 0; }

.notice-bar button {
    background: var(--green-gradient);
    color: #fff;
    font-weight: 700;
    border: none;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.18);
    transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.notice-bar button:hover { background: var(--green-gradient-hover); }
.notice-bar button:active { background: var(--green-gradient-active); transform: scale(0.97); }

.notice-info {
    background: var(--silver-1);
    border-color: #cdd2d8;
}

.button-link {
    display: inline-block;
    background: var(--green-gradient);
    color: #fff;
    font-weight: 700;
    border: none;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.18);
    transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.button-link:hover { background: var(--green-gradient-hover); }
.button-link:active { background: var(--green-gradient-active); transform: scale(0.97); }

.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--charcoal);
    color: #fff;
    padding: 0.6rem 1.1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    max-width: 90vw;
    z-index: 200;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.badge-private {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.7rem;
    padding: 0.05rem 0.4rem;
    border-radius: 8px;
}

.filter-bar {
    max-width: 1100px;
    margin: 1.5rem auto 0;
    padding: 0 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.filter-bar label {
    font-size: 0.9rem;
}

.filter-bar select {
    margin-left: 0.4rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid #b9cdbf;
    border-radius: 4px;
    background: var(--surface);
    color: var(--ink);
}

.gallery {
    max-width: 1100px;
    margin: 1.5rem auto 3rem;
    padding: 2rem 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 2.5rem 2rem;
}

/* Polaroid-tyylinen pikkukuva: valkoinen "filmi"-reunus, paksumpi alareuna,
   kevyt varjo ja satunnainen kallistus, teksti käsinkirjoitetulla fontilla. */
.card {
    background: var(--surface);
    border-radius: 2px;
    box-shadow: 0 3px 6px rgba(50,35,15,0.2), 0 1px 3px rgba(50,35,15,0.14);
    margin: 0;
    padding: 0.85rem 0.85rem 0;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    transform: rotate(var(--tilt, -1.5deg));
}

.card:nth-child(2n) { --tilt: 2deg; }
.card:nth-child(3n) { --tilt: -2.5deg; }
.card:nth-child(4n) { --tilt: 1.5deg; }
.card:nth-child(5n) { --tilt: -1deg; }
.card:nth-child(6n) { --tilt: 2.5deg; }

.card:hover,
.card:focus {
    transform: rotate(0deg) scale(1.04) translateY(-4px);
    box-shadow: 0 14px 24px rgba(50,35,15,0.28), 0 4px 8px rgba(50,35,15,0.18);
    z-index: 2;
    outline: none;
}

.card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    filter: contrast(1.05) saturate(1.05);
    background: #eee;
}

.card figcaption {
    padding: 0.9rem 0.25rem 1.4rem;
    text-align: center;
}

.card h2 {
    margin: 0;
    font-family: 'Caveat', 'Segoe Script', cursive;
    font-weight: 700;
    font-size: 1.7rem;
    line-height: 1.1;
    color: #3a2a1a;
}

/* Kaikki muu tieto (kuvaus, kategoria, laite, lisääjä, päivämäärä) piilotetaan
   pikkukuvasta - vain nimi ja kuva näkyvät. */
.card figcaption p { display: none; }

.hint {
    font-size: 0.8rem;
    color: var(--ink-soft);
    margin: -0.5rem 0 1rem;
}

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.15s ease;
}

.lightbox.hidden { display: none; }
.lightbox.closing { opacity: 0; }

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

.lightbox-content {
    max-width: 1100px;
    max-height: 90vh;
    width: 100%;
    background: var(--surface);
    border-radius: 8px;
    overflow: auto;
    display: flex;
    flex-wrap: wrap;
}

.lightbox-content img {
    flex: 1 1 500px;
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    background: #111;
}

.lightbox-info {
    flex: 1 1 280px;
    padding: 1.5rem;
    overflow-y: auto;
}

.lightbox-info h2 { margin-top: 0; }

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #ddd;
    font-size: 0.85rem;
}

.admin-actions form { margin: 0; }

.admin-actions a {
    color: var(--accent);
    text-decoration: none;
}

.admin-actions button {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    border-radius: 4px;
    padding: 0.3rem 0.7rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.edit-preview {
    display: block;
    max-width: 100%;
    max-height: 260px;
    object-fit: contain;
    border-radius: 6px;
    margin-bottom: 1.25rem;
    background: #eee;
}

.exif-table {
    margin-top: 1rem;
    border-collapse: collapse;
    width: 100%;
    font-size: 0.85rem;
}

.exif-table th {
    text-align: left;
    color: var(--ink-soft);
    font-weight: 600;
    padding: 0.3rem 0.75rem 0.3rem 0;
    white-space: nowrap;
    vertical-align: top;
}

.exif-table td {
    padding: 0.3rem 0;
}

.reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 1.25rem;
}

.reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: #e4efe8;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.25rem 0.6rem;
    cursor: pointer;
    font-size: 1rem;
    transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.reaction-btn:hover {
    box-shadow: 0 1px 3px rgba(16,50,29,0.25);
}

.reaction-btn .count {
    font-size: 0.75rem;
    color: var(--ink-soft);
}

.reaction-btn.active {
    background: var(--green-gradient);
    border-color: transparent;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.18);
}

.reaction-btn.active .count {
    color: #fff;
}

.comments {
    margin-top: 1.5rem;
    border-top: 1px solid #eee;
    padding-top: 1rem;
}

.comments h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.comment-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    max-height: 220px;
    overflow-y: auto;
}

.comment {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.comment-meta {
    font-size: 0.75rem;
    color: var(--ink-soft);
    margin-bottom: 0.2rem;
}

.comment-body {
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.comment-empty {
    font-size: 0.85rem;
    color: var(--ink-soft);
}

.comment-form textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
}

.comment-form button {
    margin-top: 0.5rem;
    background: var(--green-gradient);
    color: #fff;
    font-weight: 700;
    border: none;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.18);
    transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.comment-form button:hover { background: var(--green-gradient-hover); }
.comment-form button:active { background: var(--green-gradient-active); transform: scale(0.97); }

.hidden { display: none; }

.page {
    max-width: 1100px;
    margin: 1.5rem auto 3rem;
    padding: 0 1.5rem;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(40,25,10,0.12);
    font-size: 0.9rem;
}

.user-table th,
.user-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.user-table th {
    background: var(--accent-soft);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--ink-soft);
}

.badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
}

.badge-ok { background: #dcfce7; color: #166534; }
.badge-banned { background: #fee2e2; color: #991b1b; }

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.actions form { display: inline; }

.actions button {
    background: var(--green-gradient);
    color: #fff;
    font-weight: 700;
    border: none;
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.18);
    transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.actions button:hover { background: var(--green-gradient-hover); }
.actions button:active { background: var(--green-gradient-active); transform: scale(0.97); }

.actions button.danger {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

.user-detail {
    margin-top: 1.5rem;
    background: var(--surface);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 4px rgba(40,25,10,0.12);
}

.activity-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}

.activity-list li {
    padding: 0.4rem 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

.changelog {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.changelog-entry {
    background: var(--surface);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 4px rgba(40,25,10,0.12);
    border-left: 4px solid var(--accent);
}

.changelog-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.changelog-version {
    font-weight: 700;
    color: var(--accent);
    font-size: 1rem;
}

.changelog-title {
    font-weight: 600;
    color: var(--ink);
}

.changelog-date {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--ink-soft);
}

.changelog-items {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--ink);
}

.changelog-items li {
    margin-bottom: 0.3rem;
    font-size: 0.92rem;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
}

.table-scroll .user-table {
    margin-bottom: 0;
}

.stats-bar {
    max-width: 1100px;
    margin: 1rem auto 0;
    padding: 0 1.5rem;
    font-size: 0.85rem;
    color: var(--ink-soft);
}

.stats-bar p { margin: 0; }
.stats-bar strong { color: var(--accent); }

.per-page-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
}

.per-page-label { color: var(--ink-soft); }

.per-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    padding: 0.3rem 0.55rem;
    border: 1px solid #b9cdbf;
    border-radius: 4px;
    background: #e4efe8;
    color: var(--ink);
    text-decoration: none;
    font-size: 0.85rem;
}

.per-page-btn:hover {
    border-color: #2e6b41;
}

.per-page-btn.active {
    background: var(--green-gradient);
    border-color: transparent;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.18);
}

.pagination-nav {
    max-width: 1100px;
    margin: 0 auto 2.5rem;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
}

.page-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: var(--green-gradient);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(16,50,29,0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

a.page-arrow:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(16,50,29,0.4);
}

.page-arrow-disabled {
    opacity: 0.35;
    box-shadow: none;
    cursor: default;
}

.page-indicator {
    font-size: 0.9rem;
    color: var(--ink-soft);
    min-width: 6rem;
    text-align: center;
}

/* Taustakuvan päällä (laatikoiden ulkopuolella) olevat tekstit paksummiksi
   ja mustiksi, jotta ne erottuvat selkeästi kuvioidusta taustasta. */
.page > h1,
.page > h2,
.page > h3,
.page > p.hint,
.stats-bar p,
.filter-bar label,
.per-page-label,
.page-indicator,
.gallery > p {
    color: #000;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(243, 234, 217, 0.9), 0 0 1px rgba(243, 234, 217, 0.9);
}

.page > h1 { font-weight: 800; }

/* ------------------------------------------------------
   Tägit
   ------------------------------------------------------ */
.tag-search {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
}

.tag-search input {
    padding: 0.3rem 0.5rem;
    border: 1px solid #b9cdbf;
    border-radius: 4px;
    background: var(--surface);
    color: var(--ink);
}

.tag-list-view {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.75rem 0;
}

.tag-badge {
    display: inline-block;
    background: var(--silver-1);
    color: var(--ink);
    border-radius: 999px;
    padding: 0.2rem 0.7rem;
    font-size: 0.8rem;
    text-decoration: none;
}

.tag-badge:hover {
    background: var(--accent-soft);
}

.tag-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.tag-list {
    list-style: none;
    margin: 0.5rem 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--silver-1);
    border-radius: 999px;
    padding: 0.2rem 0.3rem 0.2rem 0.7rem;
    font-size: 0.85rem;
}

.tag-chip form { margin: 0; }

.tag-remove {
    background: none;
    border: none;
    color: var(--ink-soft);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0.1rem 0.4rem;
    border-radius: 50%;
}

.tag-remove:hover {
    background: rgba(0,0,0,0.1);
    color: #991b1b;
}

.tag-add-form {
    margin-top: 0.75rem;
}

.tag-add-form textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
}

.tag-add-form button {
    margin-top: 0.5rem;
    background: var(--green-gradient);
    color: #fff;
    font-weight: 700;
    border: none;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.18);
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.tag-add-form button:hover { background: var(--green-gradient-hover); }
.tag-add-form button:active { background: var(--green-gradient-active); transform: scale(0.97); }

/* ------------------------------------------------------
   Pikaeditori (rajaus/sumennus)
   ------------------------------------------------------ */
.editor-page {
    max-width: 1300px;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem;
    background: var(--surface);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 1rem 0;
    box-shadow: 0 1px 4px rgba(40,25,10,0.12);
}

.editor-tool-group {
    display: flex;
    gap: 0.5rem;
}

.editor-tool-btn {
    background: #e4efe8;
    border: 1px solid #b9cdbf;
    border-radius: 4px;
    padding: 0.45rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--ink);
    transition: box-shadow 0.15s ease;
}

.editor-tool-btn:hover {
    box-shadow: 0 1px 3px rgba(16,50,29,0.25);
}

.editor-tool-btn.active {
    background: var(--green-gradient);
    border-color: transparent;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.18);
}

.editor-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--ink-soft);
}

.editor-controls label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.editor-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.editor-canvas-wrap {
    background: var(--charcoal);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(40,25,10,0.12);
}

#editor-canvas {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    touch-action: none;
    cursor: crosshair;
}

/* ------------------------------------------------------
   Diaesitys
   ------------------------------------------------------ */
.slideshow-setup {
    background: var(--surface);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
    box-shadow: 0 1px 4px rgba(40,25,10,0.12);
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1.25rem;
    max-width: 900px;
}

.slideshow-setup label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--ink-soft);
}

.slideshow-setup select,
.slideshow-setup input[type="text"] {
    padding: 0.4rem 0.6rem;
    border: 1px solid #b9cdbf;
    border-radius: 4px;
    background: #fff;
    color: var(--ink);
    font-size: 0.95rem;
}

.slideshow-setup .hint {
    flex-basis: 100%;
    margin: 0;
}

.slideshow-player {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 300;
    overflow: hidden;
}

.slideshow-player.hidden { display: none; }

.slide-layer {
    position: absolute;
    inset: 0;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #000;
    opacity: 0;
    transition: opacity 1.2s ease;
    transform: scale(1);
    transform-origin: center;
}

.slide-layer.visible {
    opacity: 1;
}

.slide-layer.kenburns {
    animation-name: kenburns;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

@keyframes kenburns {
    from { transform: scale(1); }
    to   { transform: scale(1.08); }
}

.slide-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 4.5rem;
    text-align: center;
    color: #fff;
    font-size: 1rem;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
    padding: 0 1.5rem;
    z-index: 2;
}

.slide-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255,255,255,0.15);
    z-index: 2;
}

.slide-progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #10321d 0%, #2e6b41 50%, #10321d 100%);
}

.slide-controls {
    position: absolute;
    left: 50%;
    bottom: 1.25rem;
    transform: translateX(-50%);
    display: flex;
    gap: 0.6rem;
    z-index: 2;
}

.slide-controls button {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    border: none;
    background: var(--green-gradient);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    transition: transform 0.15s ease;
}

.slide-controls button:hover {
    transform: translateY(-2px);
}

.slide-controls button.hidden { display: none; }

#exit-slideshow {
    background: linear-gradient(180deg, #6e3a19 0%, #8a4b23 50%, #6e3a19 100%);
}

/* ------------------------------------------------------
   Mobiili (puhelimet, leveys enintään 640px)
   ------------------------------------------------------ */
@media (max-width: 640px) {
    body {
        background-attachment: scroll, scroll;
        background-size: cover, 220px 220px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
        padding: 0.85rem 1rem;
    }

    .topbar nav {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.5rem 0.9rem;
        width: 100%;
    }

    .topbar nav a { margin-left: 0; }
    .topbar nav span { margin-right: 0; }

    .editor-toolbar { flex-direction: column; align-items: stretch; gap: 0.75rem; }
    .editor-actions { margin-left: 0; flex-wrap: wrap; }
    .editor-actions .button-link, .editor-actions button { flex: 1 1 auto; text-align: center; }
    .tag-search { flex-direction: column; align-items: stretch; }

    .slideshow-setup { flex-direction: column; align-items: stretch; padding: 1rem; }
    .slide-controls button { width: 2.4rem; height: 2.4rem; font-size: 1rem; }
    .slide-caption { bottom: 3.75rem; font-size: 0.85rem; }

    .auth-box {
        margin: 1.25rem auto;
        padding: 1.25rem;
        max-width: 100%;
        border-radius: 0;
    }

    .notice-bar {
        margin: 0.75rem 0.75rem 0;
        padding: 0.75rem 1rem;
        flex-direction: column;
        align-items: stretch;
    }

    .notice-bar button, .notice-bar .button-link { width: 100%; padding: 0.6rem; text-align: center; }

    .filter-bar {
        padding: 0 0.75rem;
        margin-top: 1rem;
        flex-direction: column;
        gap: 0.75rem;
    }

    .filter-bar label { display: block; width: 100%; }
    .filter-bar select { width: 100%; margin-left: 0; margin-top: 0.3rem; }

    .per-page-toggle { flex-wrap: wrap; }

    .stats-bar { padding: 0 0.75rem; }

    .pagination-nav { padding: 0 0.75rem; gap: 0.75rem; }
    .page-arrow { width: 2.4rem; height: 2.4rem; font-size: 1.4rem; }

    .gallery {
        padding: 0 0.75rem;
        margin: 1rem auto 2rem;
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .card img { height: 220px; }
    .card { transform: none; margin: 0 0.4rem; }
    .card:hover, .card:focus { transform: scale(1.02); }

    .lightbox { padding: 0; }

    .lightbox-content {
        max-width: 100%;
        max-height: 100vh;
        height: 100%;
        width: 100%;
        border-radius: 0;
        flex-direction: column;
    }

    .lightbox-content img {
        flex: 0 0 auto;
        width: 100%;
        max-height: 42vh;
    }

    .lightbox-info { flex: 1 1 auto; padding: 1rem; }

    .lightbox-close {
        top: 0.5rem;
        right: 0.75rem;
        background: rgba(0,0,0,0.4);
        border-radius: 50%;
        width: 2.25rem;
        height: 2.25rem;
        color: #fff;
        z-index: 10;
    }

    .reaction-btn {
        padding: 0.4rem 0.7rem;
        font-size: 1.1rem;
    }

    .comment-form button {
        width: 100%;
        padding: 0.65rem;
    }

    .page { padding: 0 0.75rem; margin: 1rem auto 2rem; }

    .user-table { font-size: 0.82rem; }
    .user-table th, .user-table td { padding: 0.5rem; }

    .actions {
        flex-direction: column;
        align-items: stretch;
        min-width: 140px;
    }

    .actions form, .actions button { width: 100%; }
    .actions a { display: block; width: 100%; text-align: center; }
    .actions button { padding: 0.5rem; }

    .user-detail { padding: 1rem; margin-top: 1rem; }
}

/* ------------------------------------------------------
   Suosikki- ja profiilikuva: valitsin, esikatselu, avatarit,
   suosikkibadge lightboxissa. Napit samaa vihreää gradienttiperhettä
   kuin muu sivusto.
   ------------------------------------------------------ */

.avatar-circle {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--silver-1, #d8dee2);
    flex-shrink: 0;
    background: var(--surface);
}

.avatar-circle-small {
    width: 1.6rem;
    height: 1.6rem;
}

.avatar-circle-large {
    width: 4.5rem;
    height: 4.5rem;
    border-width: 3px;
}

.comment-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.favorite-badge {
    font-weight: 700;
    color: var(--accent-dark, #2e6b41);
    background: #e4efe8;
    border: 1px solid #b9cdbf;
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    display: inline-block;
}

.favorite-badge.hidden {
    display: none;
}

.profile-preview {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.profile-preview-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
}

.profile-preview-item img {
    max-width: 160px;
    max-height: 160px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border);
}

.profile-preview-item form {
    margin: 0;
}

.picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
    max-height: 640px;
    overflow-y: auto;
    padding: 0.25rem;
}

.picker-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
    display: flex;
    flex-direction: column;
}

.picker-item.is-favorite,
.picker-item.is-profile {
    border-color: #2e6b41;
    box-shadow: 0 0 0 2px rgba(46, 107, 65, 0.25);
}

.picker-item img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    display: block;
}

.picker-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.5rem;
}

.picker-actions form {
    margin: 0;
}

.picker-btn {
    width: 100%;
    border: 1px solid #b9cdbf;
    background: #e4efe8;
    color: var(--ink);
    border-radius: 4px;
    padding: 0.4rem 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: box-shadow 0.15s ease;
}

.picker-btn:hover {
    box-shadow: 0 1px 3px rgba(16,50,29,0.25);
}

.picker-btn.active {
    background: var(--green-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.18);
}

.picker-btn.active:hover {
    background: var(--green-gradient-hover);
}

.picker-btn:active {
    background: var(--green-gradient-active);
}

.request-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
}

@media (max-width: 640px) {
    .picker-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        max-height: 480px;
    }

    .profile-preview {
        gap: 1rem;
    }
}
