:root {
    --bg: #121212;
    --panel: #1a1a1a;
    --line: #2a2a2a;
    --text: #e6e6e6;
    --muted: #9aa0a6;
    --accent: #d4af6a;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    overflow-x: hidden;
    max-width: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, "Segoe UI", Arial, sans-serif;
}

a { color: inherit; text-decoration: none; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 12px 20px;
    background: rgba(13, 13, 13, .9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}

.brand {
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    font-size: 15px;
    color: var(--accent);
}

.bar-collapse { display: flex; align-items: center; gap: 18px; flex: 1; }
.tabs { display: flex; gap: 4px; }
.search { margin-left: auto; }
.account { display: flex; align-items: center; gap: 12px; }
.acct-email { color: var(--muted); font-size: 13px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-link { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.acct-link:hover { border-color: var(--accent); }
.acct-logout { margin: 0; }
.hamburger { display: none; background: none; border: none; color: var(--text); font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 6px; }

.tab {
    padding: 7px 14px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 14px;
}

.tab:hover { color: var(--text); background: var(--panel); }
.tab.active { color: #1a1a1a; background: var(--accent); font-weight: 600; }

.search input {
    width: 220px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
    font-size: 14px;
}

.search input:focus { outline: none; border-color: var(--accent); }

.subject {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px 0;
    font-size: 17px;
}

.subject strong { color: var(--accent); }
.subject .back { color: var(--muted); font-size: 14px; }
.subject .back:hover { color: var(--text); }
.subject-h1 { margin: 0; font-size: 17px; font-weight: 400; line-height: 1.3; }

.subject-intro {
    max-width: 900px; padding: 8px 20px 0; margin: 0;
    color: var(--muted); font-size: 14px; line-height: 1.6;
}
.subject-intro a { color: var(--accent); }
.subject-intro a:hover { text-decoration: underline; }

/* Masonry via CSS columns — keeps portrait/landscape at native ratio. */
.masonry {
    column-gap: 10px;
    columns: 5 220px;
    padding: 14px 20px 80px;
}

.card {
    break-inside: avoid;
    margin: 0 0 10px;
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
}

.card .ph { display: block; }
.card img { width: 100%; height: auto; display: block; }

.card figcaption {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 22px 10px 8px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .82));
    opacity: 0;
    transition: opacity .15s;
    font-size: 12.5px;
    line-height: 1.4;
}

.card:hover figcaption { opacity: 1; }
.card .b { display: block; font-weight: 600; }
.card .p { display: block; color: var(--muted); }
.card .r { color: var(--accent); }
.card figcaption a { color: inherit; text-decoration: none; }
.card figcaption a:hover { text-decoration: underline; }

/* Name index */
.names {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
    padding: 18px 20px 80px;
}

.namecard {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color .15s, transform .15s;
}

.namecard:hover { border-color: var(--accent); transform: translateY(-2px); }

.namecard .cover {
    display: block;
    aspect-ratio: 1 / 1;
    background: #000;
}

.namecard .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.namecard .meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 11px;
}

.namecard .nm { font-size: 14px; font-weight: 600; }
.namecard .ct { font-size: 12px; color: var(--muted); }

.empty { color: var(--muted); padding: 40px 20px; text-align: center; }

.card { cursor: zoom-in; }

/* Lightbox */
.lb {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .94);
    overflow: hidden;
}

.lb[hidden] { display: none; }

.lb-stage {
    max-width: 88vw;
    max-height: 88vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lb-stage img {
    max-width: 88vw;
    max-height: 88vh;
    width: auto;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .6);
}

.lb-info {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 16px 22px 20px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .85));
    text-align: center;
}

.lb-names .b { font-size: 18px; font-weight: 600; }
.lb-names .p { color: var(--muted); margin-left: 10px; }
.lb-names a { color: inherit; text-decoration: none; }
.lb-names a:hover { text-decoration: underline; }

/* Social share buttons (lightbox + photo page) */
.lb-share { display: flex; gap: 8px; justify-content: center; margin: 12px 0 4px; }
.share-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 50%;
    background: rgba(255,255,255,.06); border: 1px solid var(--line);
    color: var(--muted); cursor: pointer; padding: 0; position: relative;
    transition: color .15s, border-color .15s, background .15s;
}
.share-btn:hover { color: var(--accent); border-color: var(--accent); background: rgba(212,175,106,.12); }
.share-btn.copied { color: #1a1a1a; background: var(--accent); border-color: var(--accent); }
.share-btn.copied::after {
    content: "Copied!"; position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%);
    background: var(--accent); color: #1a1a1a; font-size: 11px; font-weight: 600;
    padding: 3px 7px; border-radius: 5px; white-space: nowrap;
}

/* Language switcher (topbar account area) */
.langsw { position: relative; }
.langsw-menu {
    position: absolute; right: 0; top: 100%; z-index: 40; margin: 6px 0 0; padding: 6px 0;
    list-style: none; min-width: 148px; background: var(--panel);
    border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.langsw-menu[hidden] { display: none; }
.langsw-menu li { margin: 0; }
.langsw-menu a { display: block; padding: 7px 14px; color: var(--text); font-size: 14px; }
.langsw-menu a:hover { background: rgba(255,255,255,.06); color: var(--accent); }
.langsw-menu a.active { color: var(--accent); }

/* Single-photo share page (/photo/{id}) */
.photopage { max-width: 920px; margin: 0 auto; padding: 22px 20px 64px; }
.pp-stage { text-align: center; }
.pp-stage img { max-width: 100%; max-height: 78vh; border-radius: 8px; background: #000; }
.pp-meta { margin-top: 18px; text-align: center; }
.pp-title { font-size: 22px; font-weight: 600; margin: 0 0 6px; }
.pp-title a { color: var(--accent); }
.pp-title a:hover { text-decoration: underline; }
.pp-by { color: var(--muted); font-weight: 400; margin-left: 6px; }
.pp-by a { color: var(--muted); }
.pp-by a:hover { color: var(--accent); text-decoration: underline; }
.pp-rate { color: var(--accent); margin: 4px 0; }
.pp-share { display: inline-flex; align-items: center; gap: 10px; margin: 16px 0 4px; }
.pp-share-label { color: var(--muted); font-size: 14px; }
.pp-nav { display: flex; justify-content: space-between; margin-top: 10px; font-size: 14px; }
.pp-nav a { color: var(--muted); }
.pp-nav a:hover { color: var(--accent); }
.pp-related { margin-top: 30px; text-align: left; }
.pp-related h2 { font-size: 16px; font-weight: 600; margin: 0 0 10px; }
.pp-rel-all { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 10px; }
.pp-rel-all:hover { color: var(--accent); text-decoration: underline; }
.pp-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.pp-thumbs a { display: block; }
.pp-thumbs img { width: 100%; height: 150px; object-fit: cover; border-radius: 6px; display: block; background: #000; }
.pp-back { margin-top: 18px; }
.pp-back a { color: var(--muted); }
.pp-back a:hover { color: var(--accent); }

/* Comments (server-rendered on the /photo/{id} page) */
.pp-comments { max-width: 680px; margin: 32px auto 0; text-align: left; border-top: 1px solid var(--line); padding-top: 20px; }
.pp-c-title { font-size: 18px; font-weight: 600; margin: 0 0 16px; }
.pp-comment { margin-bottom: 16px; }
.pp-c-head { display: flex; align-items: baseline; gap: 10px; }
.pp-c-author { font-weight: 600; }
.pp-c-time { color: var(--muted); font-size: 12px; }
.pp-c-body { margin: 3px 0 0; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.pc-form { margin-bottom: 24px; }
.pc-form textarea {
    width: 100%; box-sizing: border-box; resize: vertical; min-height: 60px;
    background: var(--panel); color: var(--text); border: 1px solid var(--line);
    border-radius: 8px; padding: 10px 12px; font: inherit; font-size: 15px; line-height: 1.45;
}
.pc-form textarea:focus { outline: none; border-color: var(--accent); }
.pc-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.pc-list { list-style: none; margin: 0; padding: 0; }
.pc-list .pp-comment { margin-bottom: 16px; }
.pc-list .lbc-del { float: right; }

/* Comments (lightbox) */
.lb-comments { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); text-align: left; }
.lbc-title { font-size: 14px; font-weight: 600; margin: 0 0 10px; color: var(--text); }
.lbc-title #lbc-count { color: var(--muted); font-weight: 400; }
.lbc-form { margin-bottom: 14px; }
.lbc-form textarea {
    width: 100%; box-sizing: border-box; resize: vertical; min-height: 44px;
    background: var(--panel); color: var(--text); border: 1px solid var(--line);
    border-radius: 8px; padding: 9px 11px; font: inherit; font-size: 14px; line-height: 1.4;
}
.lbc-form textarea:focus { outline: none; border-color: var(--accent); }
.lbc-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.lbc-actions .btn-primary { padding: 8px 18px; font-size: 14px; }
.lbc-msg { color: var(--muted); font-size: 13px; }
.lbc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.lbc-item { font-size: 14px; }
.lbc-head { display: flex; align-items: baseline; gap: 8px; }
.lbc-author { font-weight: 600; color: var(--text); }
.lbc-time { color: var(--muted); font-size: 12px; }
.lbc-del {
    margin-left: auto; background: none; border: none; color: var(--muted);
    font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.lbc-del:hover { color: #e0a0a0; }
.lbc-body { color: var(--text); line-height: 1.45; margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.lbc-empty { color: var(--muted); font-size: 13px; }

.lb-rate { margin-top: 8px; display: flex; gap: 12px; justify-content: center; align-items: center; }
.lb-stars { display: inline-flex; gap: 2px; }

.star {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    color: #555;
    padding: 0 1px;
    transition: color .1s;
}

.star.on, .star.hover { color: var(--accent); }
.lb-ratemeta { color: var(--muted); font-size: 13px; }

.lb-suggest-toggle {
    margin-top: 10px;
    background: none;
    border: 1px solid var(--line);
    color: var(--muted);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
}

.lb-suggest-toggle:hover { color: var(--text); border-color: var(--accent); }

.lb-suggest {
    margin: 10px auto 0;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lb-suggest[hidden] { display: none; }

.lb-suggest input {
    width: 100%;
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 11px;
    font-size: 14px;
}

.lb-suggest input:focus { outline: none; border-color: var(--accent); }

.lb-suggest button[type=submit] {
    background: var(--accent);
    color: #1a1a1a;
    border: none;
    border-radius: 6px;
    padding: 7px 16px;
    font-weight: 600;
    cursor: pointer;
}

.sg-msg { align-self: center; color: var(--accent); font-size: 13px; }

.lb-close, .lb-nav {
    position: absolute;
    background: rgba(0, 0, 0, .35);
    border: none;
    color: #fff;
    cursor: pointer;
    border-radius: 999px;
}

.lb-close { top: 16px; right: 18px; width: 42px; height: 42px; font-size: 26px; }
.lb-nav { top: 50%; transform: translateY(-50%); width: 50px; height: 64px; font-size: 34px; }
.lb-prev { left: 14px; }
.lb-next { right: 14px; }
.lb-close:hover, .lb-nav:hover { background: rgba(0, 0, 0, .65); }

/* Auth modal (inline login for rate/suggest) */
.authmodal {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, .75);
    padding: 16px;
}
.authmodal[hidden] { display: none; }
.am-box {
    position: relative; width: 100%; max-width: 380px;
    background: #1b1b1b; border: 1px solid var(--line); border-radius: 14px;
    padding: 26px 24px 20px;
}
.am-title { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.am-sub { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.am-form { display: flex; flex-direction: column; gap: 10px; }
.am-form input {
    background: var(--panel); color: var(--text);
    border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; font-size: 15px;
}
.am-form input:focus { outline: none; border-color: var(--accent); }
.am-form .btn-primary { margin-top: 4px; }
.am-form input[inputmode=numeric] { letter-spacing: 6px; text-align: center; font-size: 20px; }

/* Social sign-in button + divider */
.am-social {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; box-sizing: border-box; padding: 11px 12px; margin-bottom: 8px;
    background: #242424; color: var(--text); border: 1px solid var(--line); border-radius: 8px;
    font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer;
    transition: background .15s, border-color .15s;
}
.am-social:hover { background: #2e2e2e; border-color: var(--accent); }
.am-social svg { flex: 0 0 auto; }
.am-or { display: flex; align-items: center; gap: 12px; margin: 14px 0; color: var(--muted); font-size: 12px; }
.am-or::before, .am-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.am-msg { color: #e0a0a0; font-size: 13px; min-height: 16px; }
.am-msg.ok { color: #8bc28b; }
.am-alt { margin-top: 16px; color: var(--muted); font-size: 14px; text-align: center; }
.am-alt a, .am-switch { color: var(--accent); text-decoration: underline; }
.am-switch { background: none; border: none; padding: 0; font: inherit; cursor: pointer; }
.am-close {
    position: absolute; top: 10px; right: 12px;
    background: none; border: none; color: var(--muted); font-size: 24px; cursor: pointer;
}
.am-close:hover { color: var(--text); }

/* Upload page */
.upload-wrap { max-width: 720px; margin: 0 auto; padding: 24px 20px 80px; }
.up-title { font-weight: 600; }
.dropzone {
    border: 2px dashed var(--line);
    border-radius: 12px;
    background: var(--panel);
    min-height: 280px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; text-align: center; padding: 16px; outline: none;
    transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone:focus, .dropzone.over { border-color: var(--accent); background: #1f1f1f; }
.dropzone img { max-width: 100%; max-height: 60vh; border-radius: 6px; display: block; }
.dz-big { font-size: 18px; }
.dz-sub { color: var(--muted); margin-top: 4px; }
.paste-box { margin-top: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.paste-box > summary { cursor: pointer; padding: 10px 14px; color: var(--muted); font-size: 14px; user-select: none; }
.paste-box[open] > summary { border-bottom: 1px solid var(--line); }
.paste-area {
    width: 100%; box-sizing: border-box; margin: 0; resize: vertical;
    background: var(--bg); color: var(--text); border: none; border-radius: 0 0 8px 8px;
    padding: 10px 14px; font: inherit; font-size: 14px; line-height: 1.5;
}
.paste-area:focus { outline: none; }
.paste-actions { display: flex; align-items: center; gap: 12px; padding: 0 14px 12px; }

.up-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.up-fields label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.up-fields span { color: var(--muted); }
.up-fields input {
    background: var(--panel); color: var(--text);
    border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 15px;
}
.up-fields input:focus { outline: none; border-color: var(--accent); }
.up-actions { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.btn-primary {
    background: var(--accent); color: #1a1a1a; border: none; border-radius: 8px;
    padding: 11px 22px; font-weight: 600; font-size: 15px; cursor: pointer;
}
.btn-primary:disabled { opacity: .5; cursor: default; }
.up-msg { color: var(--accent); font-size: 14px; }
.up-msg a { text-decoration: underline; }
.up-note { color: var(--muted); font-size: 13px; margin-top: 10px; }
.tab.add { background: var(--accent); color: #1a1a1a; font-weight: 600; }

.dupwarn {
    margin-top: 20px; padding: 16px; border: 1px solid #6a4a2a;
    background: #251c10; border-radius: 10px;
}
.dw-title { color: var(--accent); font-weight: 600; margin-bottom: 10px; }
.dw-list { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.dw-item { width: 150px; display: flex; flex-direction: column; }
.dw-item img { width: 150px; height: 150px; object-fit: cover; border-radius: 6px; display: block; background: #000; }
.dw-cap { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.dw-update { margin-top: 6px; padding: 6px 10px; font-size: 12.5px; }
.dw-actions { display: flex; gap: 10px; }
.btn-secondary {
    background: var(--panel); color: var(--text); border: 1px solid var(--line);
    border-radius: 8px; padding: 11px 18px; font-size: 14px; cursor: pointer;
}
.btn-secondary:hover { border-color: var(--accent); }

/* Inline text button (cookie settings, etc.) */
.link-btn {
    background: none; border: none; padding: 0; cursor: pointer;
    color: var(--accent); font: inherit; text-decoration: underline;
}

/* Site footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 22px 16px; background: var(--panel); }
.foot-inner {
    max-width: 1100px; margin: 0 auto; display: flex; flex-wrap: wrap;
    align-items: center; gap: 10px 18px; font-size: 13px; color: var(--muted);
}
.foot-brand { font-weight: 600; color: var(--text); }
.foot-links { display: flex; flex-wrap: wrap; gap: 16px; }
.foot-links a, .foot-links .link-btn { color: var(--muted); text-decoration: none; }
.foot-links a:hover, .foot-links .link-btn:hover { color: var(--accent); }
.foot-copy { margin-left: auto; }

/* Cookie consent banner */
.cookie-banner {
    position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 60;
    max-width: 720px; margin: 0 auto;
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
    padding: 16px 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.cookie-banner[hidden] { display: none; }
.cb-text { margin: 0; font-size: 13.5px; color: var(--text); flex: 1 1 320px; line-height: 1.5; }
.cb-text a { color: var(--accent); text-decoration: underline; }
.cb-actions { display: flex; gap: 10px; margin-left: auto; }

/* Legal pages (privacy / cookies) */
.legal { max-width: 760px; margin: 0 auto; padding: 28px 20px 60px; line-height: 1.65; }
.legal h1 { font-size: 28px; margin: 0 0 4px; }
.legal h2 { font-size: 18px; margin: 28px 0 8px; }
.legal p, .legal li { color: var(--text); font-size: 15px; }
.legal a { color: var(--accent); text-decoration: underline; }
.legal ul { padding-left: 20px; }
.legal li { margin-bottom: 8px; }
.legal-updated { color: var(--muted); font-size: 13px; margin-top: 0; }
.legal-ok { color: #8bc28b; font-weight: 600; }
.legal-back { margin-top: 32px; }
.legal-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 14px; }
.legal-table th, .legal-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.legal-table th { color: var(--muted); font-weight: 600; }

@media (max-width: 640px) {
    .cookie-banner { flex-direction: column; align-items: stretch; }
    .cb-actions { margin-left: 0; }
    .cb-actions .btn-primary, .cb-actions .btn-secondary { flex: 1; }
    .foot-copy { margin-left: 0; flex-basis: 100%; }
}

@media (max-width: 640px) {
    .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
    .hamburger { display: block; margin-left: auto; }
    .bar-collapse {
        display: none; flex-basis: 100%; order: 3;
        flex-direction: column; align-items: stretch; gap: 14px; padding-top: 4px;
    }
    .topbar.open .bar-collapse { display: flex; }
    .tabs { flex-wrap: wrap; }
    .search { margin-left: 0; }
    .search input { width: 100%; }
    .account { flex-wrap: wrap; gap: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
    .acct-email { max-width: none; flex-basis: 100%; }
    .masonry { columns: 2 140px; column-gap: 8px; padding: 10px 12px 80px; }

    .lb-stage, .lb-stage img { max-width: 100vw; max-height: 82vh; }
    .lb-stage img { border-radius: 0; }
    .lb-nav { width: 40px; height: 52px; font-size: 26px; background: rgba(0, 0, 0, .25); }
    .lb-prev { left: 2px; } .lb-next { right: 2px; }
    .lb-close { top: 10px; right: 10px; width: 38px; height: 38px; }
    .lb-info { padding: 14px 14px 18px; }
    .lb-names .b { font-size: 16px; }
    .up-fields { grid-template-columns: 1fr; }
}
