:root {
    --accent: #c68e17;
    --accent-glow: rgba(198, 142, 23, 0.35);
    --panel: rgba(18, 20, 28, 0.68);
    --line: rgba(255, 255, 255, 0.12);
    --info-w: 340px;
}

* { box-sizing: border-box; }

html { background: #000; }

body {
    margin: 0;
    min-height: 100vh;
    background: #000;
    font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
    color: #e8e8e8;
    display: flex;
    flex-direction: column;
}

body.lb-open { overflow: hidden; }

[hidden] { display: none !important; }

.bg-layer {
    position: fixed;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: blur(48px) brightness(0.4);
    transform: scale(1.08);
    opacity: 0;
    transition: opacity 0.6s ease;
    z-index: 0;
    pointer-events: none;
}

/* ---------- top nav (unchanged look) ---------- */
#nav {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(18, 20, 28, 0.72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--line);
    border-radius: 9999px;
    padding: 6px 8px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-logo {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 1.5px;
    padding: 6px 14px 6px 16px;
    color: #e8d9b8;
    text-decoration: none;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    margin-right: 4px;
}

.nav-link {
    color: #b8b8c0;
    text-decoration: none;
    padding: 8px 18px;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 9999px;
    border: 1px solid transparent;
    transition: all 0.18s ease;
}

.nav-link:hover { color: #fff; background: rgba(255, 255, 255, 0.07); }

.nav-link.active,
.pill.active {
    color: #fff;
    background: linear-gradient(145deg, rgba(198, 142, 23, 0.22), rgba(198, 142, 23, 0.08));
    border: 1px solid rgba(198, 142, 23, 0.45);
    box-shadow: 0 6px 16px -4px var(--accent-glow);
}

/* ---------- page ---------- */
#page {
    position: relative;
    z-index: 10;
    flex: 1;
    width: 100%;
    max-width: 1680px;
    margin: 0 auto;
    padding: 86px clamp(10px, 2.5vw, 36px) 40px;
}

.pill-wrap {
    display: flex;
    justify-content: flex-start;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 4px 2px 10px;
}

.pill-wrap::-webkit-scrollbar { display: none; }

.pill-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(18, 20, 28, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
    padding: 5px 8px;
    box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.55);
    flex: none;
    margin: 0 auto;
}

.pill {
    border: 1px solid transparent;
    background: transparent;
    color: #b8b8c0;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    border-radius: 9999px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.18s ease;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.pill:hover { color: #fff; background: rgba(255, 255, 255, 0.07); }

.pill .n {
    font-size: 11px;
    color: var(--accent);
    opacity: 0.9;
}

#sub-nav .pill { padding: 6px 14px; }

#g-head {
    text-align: center;
    margin: 14px 0 6px;
}

#g-title {
    margin: 0;
    font-size: clamp(22px, 3vw, 32px);
    font-weight: 600;
    letter-spacing: 1.5px;
    color: #e8d9b8;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
}

#g-meta {
    margin: 6px 0 0;
    font-size: 13px;
    letter-spacing: 0.5px;
    color: var(--accent);
    min-height: 1em;
}

#status {
    text-align: center;
    color: #999;
    font-size: 13px;
    min-height: 1em;
    margin: 6px 0;
}

/* ---------- grid ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.tile {
    position: relative;
    display: block;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 10px 26px -14px rgba(0, 0, 0, 0.8);
    outline: none;
}

.tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transform: scale(1.001);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.tile.ok img { opacity: 1; }
.tile:hover img, .tile:focus-visible img { transform: scale(1.04); }
.tile:focus-visible { border-color: rgba(198, 142, 23, 0.7); }
.tile.err::after {
    content: 'Unavailable';
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #777;
    font-size: 12px;
}

#sentinel { height: 1px; }

/* ---------- year / section cards ---------- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    margin-top: 10px;
}

.card {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: rgba(18, 20, 28, 0.6);
    padding: 0;
    cursor: pointer;
    color: #fff;
    font-family: inherit;
    text-align: left;
    box-shadow: 0 14px 34px -16px rgba(0, 0, 0, 0.85);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.card.ok img { opacity: 0.85; }
.card:hover { border-color: rgba(198, 142, 23, 0.55); }
.card:hover img { transform: scale(1.04); opacity: 1; }

.card .label {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 28px 16px 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.card .t { font-size: 22px; font-weight: 600; letter-spacing: 1px; color: #e8d9b8; }
.card .c { font-size: 12.5px; color: var(--accent); }

/* ---------- lightbox ---------- */
#lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(5, 6, 10, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    touch-action: none;
    user-select: none;
}

#lb-stage {
    position: absolute;
    inset: 56px 84px 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: right 0.28s ease, bottom 0.28s ease;
}

#lb-img, #lb-ph {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    -webkit-user-drag: none;
}

#lb-img {
    opacity: 0;
    filter: drop-shadow(0 24px 40px rgba(0, 0, 0, 0.6));
    transition: opacity 0.3s ease;
}

#lb-img.ready { opacity: 1; }

/* thumbnail shown blurred while the full image loads */
#lb-ph {
    opacity: 0;
    filter: blur(12px) brightness(0.9);
    transition: opacity 0.3s ease;
}

#lb-ph.show { opacity: 1; }
#lb-ph:not([src]) { display: none; }

#lb-spin {
    position: absolute;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid rgba(198, 142, 23, 0.25);
    border-top-color: var(--accent);
    animation: spin 0.9s linear infinite;
    opacity: 0;
    transition: opacity 0.2s ease;
}

#lightbox.loading #lb-spin { opacity: 1; }

@keyframes spin { to { transform: rotate(360deg); } }

.nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 210;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(18, 20, 28, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #e8d9b8;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.nav-arrow:hover {
    border-color: rgba(198, 142, 23, 0.5);
    background: rgba(198, 142, 23, 0.15);
    color: #fff;
}

#lb-prev { left: max(12px, 2vw); }
#lb-next { right: max(12px, 2vw); }

.lb-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(18, 20, 28, 0.6);
    color: #e8d9b8;
    font-size: 16px;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.18s ease;
}

.lb-btn:hover { border-color: rgba(198, 142, 23, 0.5); color: #fff; }

#lb-close, #lb-info-btn, #lb-cmt-btn, #lb-admin, #lb-del {
    position: fixed;
    top: 14px;
    z-index: 210;
    transition: right 0.28s ease, all 0.18s ease;
}

#lb-close { right: 16px; }
#lb-cmt-btn { right: 112px; }
#lb-admin { right: 160px; text-decoration: none; font-size: 17px; }
#lb-del { right: 208px; }
#lb-del .dc { display: none; }
#lb-del.confirm {
    width: auto;
    min-width: 40px;
    padding: 0 14px;
    border-radius: 20px;
    white-space: nowrap;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
}
#lb-del.confirm .di { display: none; }
#lb-del.confirm .dc { display: inline; }
#lb-del:hover { border-color: rgba(224, 96, 82, 0.7); color: #ffd9d2; background: rgba(150, 40, 32, 0.45); }
#lb-del.confirm { border-color: rgba(224, 96, 82, 0.85); color: #fff; background: rgba(176, 44, 34, 0.92); }
#lb-del.busy { opacity: 0.55; pointer-events: none; }
#lb-cmt-btn[aria-expanded="true"] {
    color: #fff;
    border-color: rgba(198, 142, 23, 0.6);
    background: rgba(198, 142, 23, 0.22);
}
#lb-cmt-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--accent);
    color: #111;
    font: 700 10.5px/18px 'Segoe UI', system-ui, sans-serif;
    text-align: center;
}
#lb-info-btn { right: 64px; font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-weight: 700; font-size: 18px; }
#lb-info-btn[aria-expanded="true"] {
    color: #fff;
    border-color: rgba(198, 142, 23, 0.6);
    background: rgba(198, 142, 23, 0.22);
}

/* ---------- EXIF info panel ---------- */
#lb-info {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--info-w);
    z-index: 205;
    background: rgba(14, 16, 22, 0.94);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-left: 1px solid var(--line);
    box-shadow: -18px 0 40px -20px rgba(0, 0, 0, 0.8);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.28s ease, visibility 0s linear 0.28s;
    display: flex;
    flex-direction: column;
    touch-action: pan-y;
    user-select: text;
}

#lightbox.info-open #lb-info {
    transform: none;
    visibility: visible;
    transition: transform 0.28s ease, visibility 0s;
}

#lightbox.info-open #lb-stage { right: calc(var(--info-w) + 24px); }
#lightbox.info-open #lb-next { right: calc(var(--info-w) + 12px); }
#lightbox.info-open #lb-close { right: calc(var(--info-w) + 16px); }
#lightbox.info-open #lb-info-btn { right: calc(var(--info-w) + 64px); }
#lightbox.info-open #lb-cmt-btn { right: calc(var(--info-w) + 112px); }
#lightbox.info-open #lb-admin { right: calc(var(--info-w) + 160px); }
#lightbox.info-open #lb-del { right: calc(var(--info-w) + 208px); }
#lightbox.info-open #lb-caption { left: calc(50% - var(--info-w) / 2); max-width: min(880px, calc(100vw - var(--info-w) - 200px)); }
#lightbox.info-open #lb-count { left: calc(50% - var(--info-w) / 2); }

.info-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px 10px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
}

.info-head h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #e8d9b8;
}

.info-head .lb-btn { width: 32px; height: 32px; font-size: 13px; }

.panel-tabs { display: flex; gap: 4px; }
.panel-tabs button {
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #9a9aa4;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.18s ease;
}
.panel-tabs button:hover { color: #fff; }
.panel-tabs button[aria-selected="true"] {
    color: #e8d9b8;
    border-color: rgba(198, 142, 23, 0.45);
    background: rgba(198, 142, 23, 0.12);
}
.panel-tabs .n { color: var(--accent); margin-left: 3px; letter-spacing: 0; }
.info-grip { display: none; }

#panel-scroll {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px 20px 22px;
    font-size: 13px;
    line-height: 1.45;
}

#info-body, #cmt-body { transition: opacity 0.2s ease; }
#info-body.busy, #cmt-body.busy { opacity: 0.45; }

.info-file {
    margin: 0 0 12px;
    color: #8a8a94;
    font-size: 12px;
    word-break: break-all;
}

#info-body dl {
    margin: 0;
    display: grid;
    grid-template-columns: minmax(96px, auto) 1fr;
    gap: 7px 14px;
}

#info-body dt { color: #8f8f9a; }
#info-body dd { margin: 0; color: #eee; word-break: break-word; }

#info-body details {
    margin-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 10px;
}

#info-body summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 12.5px;
    margin-bottom: 10px;
}

#info-body details dl { font-size: 12px; }
.info-empty { color: #999; }

.info-copy {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid rgba(198, 142, 23, 0.3);
    background: rgba(198, 142, 23, 0.07);
    color: #d8c9a8;
    font-size: 12px;
}

.info-copy p { margin: 0; }
.info-copy p + p { margin-top: 6px; }
.info-copy a, .footer-note a { color: var(--accent); }

/* ---------- caption ---------- */
#lb-stage { bottom: calc(64px + var(--cap-h, 0px)); }

#lb-caption {
    position: fixed;
    left: 50%;
    bottom: 54px;
    transform: translateX(-50%);
    z-index: 206;
    width: max-content;
    max-width: min(880px, calc(100vw - 200px));
    margin: 0;
    padding: 8px 18px;
    border-radius: 12px;
    background: rgba(14, 16, 22, 0.62);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #f1ead9;
    font-size: 15px;
    line-height: 1.45;
    letter-spacing: 0.2px;
    text-align: center;
    white-space: pre-line;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer;
    user-select: text;
    transition: left 0.28s ease;
}
#lb-caption[hidden] { display: none !important; }
#lb-caption.full { -webkit-line-clamp: unset; display: block; max-height: 40vh; overflow-y: auto; }

#pane-cap {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-left: 2px solid var(--accent);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 0 8px 8px 0;
    color: #f1ead9;
    font-size: 13.5px;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

/* grid tiles: caption on hover (a subtle always-on line on touch screens) + comment count badge */
.tile-cap {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 22px 10px 7px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
    color: #f1ead9;
    font-size: 12.5px;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}
.tile:hover .tile-cap, .tile:focus-visible .tile-cap { opacity: 1; transform: none; }
@media (hover: none) {
    .tile-cap { opacity: 1; transform: none; font-size: 11.5px; padding: 18px 8px 5px; }
}
.tile-cc {
    position: absolute;
    top: 6px;
    right: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px 2px 6px;
    border-radius: 999px;
    background: rgba(14, 16, 22, 0.7);
    border: 1px solid rgba(198, 142, 23, 0.4);
    color: #e8d9b8;
    font-size: 11px;
    line-height: 16px;
    pointer-events: none;
}
.tile-cc::before {
    content: '';
    width: 10px;
    height: 9px;
    border-radius: 2px;
    background: var(--accent);
    clip-path: polygon(0 0, 100% 0, 100% 75%, 45% 75%, 20% 100%, 22% 75%, 0 75%);
}

/* ---------- comments ---------- */
.cmts { list-style: none; margin: 0 0 6px; padding: 0; }
.cmts li { padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
.cmts li:first-child { padding-top: 2px; }
.cmt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 3px; }
.cmt-head strong { color: #e8d9b8; font-weight: 600; overflow-wrap: anywhere; }
.cmt-head time { color: #7f7f8a; font-size: 11.5px; white-space: nowrap; }
.cmts p { margin: 0; color: #e4e4e8; white-space: pre-wrap; overflow-wrap: anywhere; }

#cmt-form {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}
#cmt-form h3 { margin: 0 0 2px; font-size: 12.5px; letter-spacing: 1.2px; text-transform: uppercase; color: #9a9aa4; font-weight: 600; }
#cmt-form input, #cmt-form textarea {
    width: 100%;
    font: inherit;
    font-size: 14px;
    color: #eee;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    padding: 8px 10px;
    resize: vertical;
}
#cmt-form textarea { min-height: 76px; }
#cmt-form input:focus, #cmt-form textarea:focus { outline: none; border-color: rgba(198, 142, 23, 0.7); }
#cmt-form .hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.cmt-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#cmt-count { font-size: 11.5px; color: #7f7f8a; }
#cmt-count.near { color: var(--accent); }
#cmt-send {
    font: inherit;
    font-weight: 600;
    color: #fff;
    padding: 7px 18px;
    border-radius: 999px;
    border: 1px solid rgba(198, 142, 23, 0.6);
    background: linear-gradient(145deg, rgba(198, 142, 23, 0.4), rgba(198, 142, 23, 0.16));
    cursor: pointer;
}
#cmt-send:disabled { opacity: 0.5; cursor: default; }
#cmt-msg { margin: 0; min-height: 1.2em; font-size: 12.5px; color: #9a9aa4; }
#cmt-msg.bad { color: #f0a097; }
#cmt-msg.ok { color: #9fd6a6; }
.cmt-note { margin: 0; font-size: 11.5px; color: #75757f; }

#lb-count {
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 210;
    font-size: 13px;
    color: var(--accent);
    letter-spacing: 0.5px;
    background: rgba(18, 20, 28, 0.5);
    padding: 5px 14px;
    border-radius: 999px;
    border: 1px solid rgba(198, 142, 23, 0.25);
    white-space: nowrap;
}

/* ---------- footer ---------- */
#footer {
    position: relative;
    z-index: 10;
    background: rgba(18, 20, 28, 0.65);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #999;
    text-align: center;
    padding: 12px 10px;
    font-size: 12.5px;
    letter-spacing: 0.5px;
    box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.6);
}

.footer-note {
    margin-top: 4px;
    font-size: 11.5px;
    color: #8a8a92;
}

/* ---------- admin delete toast ---------- */
#toast {
    position: fixed;
    left: 50%;
    bottom: 76px;
    transform: translateX(-50%) translateY(8px);
    z-index: 300;
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: calc(100vw - 32px);
    padding: 10px 16px;
    border-radius: 12px;
    background: rgba(20, 22, 30, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.7);
    color: #f1ead9;
    font-size: 14px;
    letter-spacing: 0.2px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast-undo {
    border: 1px solid rgba(198, 142, 23, 0.5);
    background: rgba(198, 142, 23, 0.15);
    color: var(--accent);
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.toast-undo:hover { background: rgba(198, 142, 23, 0.28); color: #fff; }

@media (max-width: 640px) {
    #page { padding-top: 78px; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
    .cards { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
    .card .t { font-size: 18px; }
    #lb-stage { inset: 56px 6px 60px; }
    .nav-arrow { width: 40px; height: 40px; font-size: 18px; top: auto; bottom: 12px; transform: none; }
    #lb-count { bottom: 22px; }

    /* info panel becomes a bottom sheet */
    #lb-info {
        top: auto;
        left: 0;
        width: auto;
        height: 52vh;
        border-left: none;
        border-top: 1px solid var(--line);
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        box-shadow: 0 -18px 40px -20px rgba(0, 0, 0, 0.8);
    }
    .info-grip {
        display: block;
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        border-radius: 2px;
        background: rgba(255, 255, 255, 0.25);
    }
    #lightbox.info-open #lb-stage { right: 6px; bottom: calc(52vh + 8px); top: 60px; }
    #lightbox.info-open #lb-next { right: max(12px, 2vw); }
    #lightbox.info-open #lb-close { right: 16px; }
    #lightbox.info-open #lb-info-btn { right: 64px; }
    #lightbox.info-open .nav-arrow { bottom: calc(52vh + 12px); }
    #lightbox.info-open #lb-count { left: 50%; bottom: calc(52vh + 20px); }

    #lb-stage { bottom: calc(60px + var(--cap-h, 0px)); }
    #lb-caption { bottom: 62px; max-width: calc(100vw - 20px); font-size: 14px; padding: 7px 14px; -webkit-line-clamp: 2; }
    #lightbox.info-open #lb-caption { display: none; }          /* the sheet shows the caption at its top instead */
    #lightbox.info-open #lb-cmt-btn { right: 112px; }
    #lightbox.info-open #lb-admin { right: 160px; }
    #lightbox.info-open #lb-del { right: 208px; }
    #toast { bottom: 84px; }
    #lb-info { height: 58vh; }
    #lightbox.info-open #lb-stage { bottom: calc(58vh + 8px); }
    #lightbox.info-open .nav-arrow { bottom: calc(58vh + 12px); }
    #lightbox.info-open #lb-count { bottom: calc(58vh + 20px); }
    #panel-scroll { padding: 12px 16px calc(18px + env(safe-area-inset-bottom)); }
    #cmt-form input, #cmt-form textarea { font-size: 16px; }   /* no iOS zoom on focus */
}
