:root {
    color-scheme: dark;
    --bg: #0f1012;
    --elev: #17181b;
    --text: #f3efe6;
    --muted: #9c978d;
    --line: rgba(243, 239, 230, 0.14);
    --accent: #e4b15a;
    --accent-ink: #241a0c;
    --danger: #e07a68;
    --ok: #8fbf7f;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
}

main { flex: 1; }

a { color: inherit; }

img { max-width: 100%; }

button, .button, input, textarea, select {
    font: inherit;
    color: inherit;
}

button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    text-decoration: none;
    cursor: pointer;
}

button.primary, .button.primary {
    background: var(--accent);
    color: var(--accent-ink);
    border-color: transparent;
    font-weight: 600;
}

button.danger {
    color: var(--danger);
    border-color: rgba(224, 122, 104, 0.45);
}

button.icon-btn {
    width: 42px;
    padding: 0;
    font-size: 1.4rem;
}

.skip {
    position: absolute;
    left: 12px;
    top: -48px;
    background: #000;
    padding: 8px 12px;
    z-index: 40;
}

.skip:focus { top: 12px; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.top {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 12px 16px;
    min-height: 60px;
    padding: 8px 22px;
    background: rgba(15, 16, 18, 0.9);
    border-bottom: 0;
    box-shadow: inset 0 -3px 0 #e10600, inset 0 -6px 0 #f0b429;
    backdrop-filter: blur(16px);
}

.brand {
    justify-self: start;
    font-family: "Avenir Next", Futura, "Century Gothic", "Segoe UI", sans-serif;
    font-size: 1.35rem;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: -0.045em;
}

.brand .tld { color: #f0b429; font-weight: 500; }

.menu {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px 18px;
}

.menu-main { justify-self: center; }

.menu-account { justify-self: end; }

.menu a.menu-aside,
.menu button.menu-aside {
    font-size: 0.82rem;
}

.menu a, .menu button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin: 0;
    padding: 0 2px;
    line-height: 1;
    text-decoration: none;
}

.menu a.is-on { color: #f0b429; }

.menu form {
    display: flex;
    align-items: center;
    margin: 0;
}

.menu button {
    border: 0;
    background: transparent;
    min-height: 44px;
    padding: 0 2px;
}

h1, h2 {
    font-family: Palatino, "Palatino Linotype", Georgia, serif;
    font-weight: 600;
    letter-spacing: 0;
}

.album-copy h2,
.toolbar h1 {
    font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
    font-weight: 600;
    letter-spacing: -0.03em;
}

h1 { font-size: clamp(1.8rem, 3vw, 2.6rem); margin: 0; }
h2 { font-size: 1.15rem; margin: 0; }

.meta, .hint, .crumb { color: var(--muted); }
.hint { font-size: 0.92rem; line-height: 1.45; }
.crumb { margin: 0 0 6px; }
.crumb a { color: var(--muted); }

.lead { max-width: 62ch; line-height: 1.5; }

.flash {
    margin: 16px 22px 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: #2a2418;
}

.flash.error { background: #3a221e; }

.sheet { padding: 18px 22px 0; }

.panel {
    max-width: 720px;
    margin: 8px 0 18px;
    padding: 12px 14px 4px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--elev);
}

.panel summary {
    cursor: pointer;
    margin-bottom: 12px;
    font-weight: 600;
}

.stack { display: grid; gap: 12px; margin-bottom: 16px; }

#neu[hidden] { display: none !important; }
#neu.coach::before { content: none; }

label { display: grid; gap: 6px; font-size: 0.92rem; }

.choice { display: flex; align-items: center; gap: 8px; }

fieldset {
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    display: grid;
    gap: 10px;
}

legend { padding: 0 6px; color: var(--muted); }

input, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #101114;
}

input[type="radio"], input[type="checkbox"] {
    width: 1.05rem;
    height: 1.05rem;
    padding: 0;
    accent-color: #e10600;
    flex: 0 0 auto;
}

textarea { resize: vertical; }

.albums {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 22px;
    padding: 28px 22px 48px;
}

.section-label {
    margin: 18px 22px 0;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
}

.albums.subalbums {
    padding-top: 12px;
    padding-bottom: 8px;
}

.album-note {
    margin: 0 22px 18px;
}

.sort-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 4px 22px 0;
}

.sort-bar button.is-on {
    background: var(--accent);
    color: var(--accent-ink);
    border-color: transparent;
}

.sort-hint { margin: 8px 22px 0; }

.album-wrap { display: grid; gap: 8px; min-width: 0; align-content: start; }

.album-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.album-tools form { display: flex; gap: 6px; margin: 0; }

.album-tools button, .drag-handle {
    min-height: 36px;
    padding: 4px 10px;
    font-size: 0.82rem;
}

.drag-handle {
    display: inline-flex;
    align-items: center;
    border: 1px dashed var(--line);
    border-radius: 999px;
    cursor: grab;
    color: var(--muted);
}

.album-wrap.is-dragging { opacity: 0.45; }

.album { display: grid; gap: 10px; text-decoration: none; }

.album-cover {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    border-radius: 8px;
    background:
        radial-gradient(circle at 50% 42%, rgba(228, 177, 90, 0.28), transparent 46%),
        linear-gradient(160deg, #2a261f, #141516);
}

.album-cover img, .tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.album-cover.is-tall img, .tile.is-tall img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    margin: auto;
    object-fit: contain;
    object-position: center center;
}

.album-cover img, .tile img { transition: transform 0.35s ease; }

.lock, .cover-flag {
    position: absolute;
    top: 10px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
}

.lock {
    left: 10px;
    background: rgba(0, 0, 0, 0.62);
}

.cover-flag {
    right: 10px;
    background: #e10600;
    color: #fff8f2;
}

.tile { position: relative; }

.tile-wrap { position: relative; }

.tile-wrap.is-picked .tile {
    outline: 3px solid #f0b429;
    outline-offset: -3px;
}

.tile-wrap.is-cursor .tile {
    outline: 2px solid #f6f0e4;
    outline-offset: 3px;
}

.tile-wrap.is-cursor.is-picked .tile {
    outline: 3px solid #f0b429;
    outline-offset: 3px;
}

.pick-target {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 0.92rem;
}

.pick-bar select {
    width: auto;
    min-width: 12rem;
    max-width: 18rem;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #121316;
    color: inherit;
}

.pick {
    position: absolute;
    z-index: 2;
    top: 4px;
    left: 4px;
    width: 40px;
    height: 40px;
    margin: 0;
    display: grid;
    place-items: center;
}

.double-flag {
    position: absolute;
    left: 8px;
    bottom: 8px;
    z-index: 2;
    max-width: calc(100% - 16px);
    padding: 3px 8px;
    border-radius: 999px;
    background: #f0b429;
    color: #241a0c;
    font-size: 0.72rem;
    font-weight: 700;
}

.tile-name {
    margin: 4px 2px 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#upload-review[hidden] { display: none !important; }

.upload-review {
    display: grid;
    gap: 12px;
    margin-top: 12px;
    padding: 14px 16px;
    border: 1px solid #f0b429;
    border-radius: 16px;
    background: #2a2418;
}

.upload-review p { margin: 0; }

.upload-review ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.upload-review .choice {
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-review .choice span:first-of-type {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.private-flag {
    position: absolute;
    top: 8px;
    left: 44px;
    z-index: 2;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.72);
    color: #f6f0e4;
    font-size: 0.72rem;
    font-weight: 700;
}

.geo-flag {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 2;
    padding: 3px 8px;
    border-radius: 999px;
    background: #243044;
    color: #d5e4f5;
    font-size: 0.72rem;
    font-weight: 700;
}

.tile-wrap > .drag-handle {
    margin-top: 6px;
}

.sort-hint { margin: 0 22px 8px; }

.pick-hint { margin: 0 22px 8px; }

.pick-bar {
    position: sticky;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 6;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: min(720px, calc(100% - 24px));
    margin: 0 auto 16px;
    padding: 10px 12px;
    border: 1px solid rgba(240, 180, 41, 0.5);
    border-radius: 16px;
    background: rgba(23, 24, 27, 0.94);
    box-shadow: var(--shadow);
}

.pick-bar[hidden],
.pick-bar button[hidden] { display: none !important; }

.pick-bar button:disabled { opacity: 0.45; }

.pick-bar p { margin: 0 8px 0 4px; }

.album-copy { display: grid; gap: 3px; }

.photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 8px;
    padding: 8px 22px 28px;
}

.tile {
    display: grid;
    place-items: center;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    border-radius: 6px;
    background: #1a1c1f;
}

.toolbar, .map-bar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    padding: 22px 22px 8px;
}

.actions, .upload-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.file-btn { position: relative; }

.upload-row input { max-width: 100%; }

.js .manual-submit { display: none; }

.js .upload-row input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.empty { padding: 48px 22px 64px; max-width: 40rem; }

.coach {
    position: relative;
    max-width: 820px;
    overflow: hidden;
    padding: 0 16px 8px;
    border-color: rgba(240, 180, 41, 0.45);
    background:
        linear-gradient(180deg, rgba(225, 6, 0, 0.22), transparent 72px),
        linear-gradient(135deg, #1b2838 0%, #14181f 48%, #10141b 100%);
}

.coach::before {
    content: "";
    display: block;
    height: 8px;
    margin: 0 -16px 12px;
    background: linear-gradient(90deg, #e10600 0 22%, #f6f0e4 22% 26%, #143d66 26% 74%, #f6f0e4 74% 78%, #e10600 78% 100%);
}

.coach summary {
    font-family: Palatino, "Palatino Linotype", Georgia, serif;
    font-size: 1.35rem;
}

.coach-lead {
    margin: 0;
    color: #d7c7a2;
}

.coach-form input,
.coach-form textarea {
    background: #0d1218;
    border-color: rgba(246, 240, 228, 0.18);
}

.coach-form input:focus,
.coach-form textarea:focus {
    border-color: #f0b429;
}

.visibility {
    border-color: rgba(240, 180, 41, 0.28);
    background: rgba(8, 12, 18, 0.35);
}

.vis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.vis-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
    min-width: 0;
    margin: 0;
    padding: 12px;
    border: 1px solid rgba(246, 240, 228, 0.14);
    border-radius: 12px;
    background: #121820;
    cursor: pointer;
}

.vis-card:has(:checked) {
    border-color: #e10600;
    background: linear-gradient(180deg, rgba(225, 6, 0, 0.2), rgba(20, 61, 102, 0.45));
    box-shadow: inset 4px 0 0 #f0b429;
}

.vis-body { display: grid; gap: 4px; min-width: 0; }
.vis-title { font-weight: 600; }
.vis-text { color: var(--muted); font-size: 0.86rem; line-height: 1.35; }

.coach .primary {
    justify-self: start;
    min-width: 180px;
    background: linear-gradient(180deg, #ff3b30, #c10500);
    color: #fff8f2;
    box-shadow: 0 8px 20px rgba(225, 6, 0, 0.28);
}

.install-coach { margin-top: 28px; }
.install-coach h1 { margin-bottom: 8px; }

.rail-empty { max-width: 36rem; }
.rail-mark { width: min(280px, 100%); height: auto; margin-bottom: 8px; }

.card {
    width: min(460px, calc(100% - 32px));
    margin: 32px auto 48px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--elev);
    box-shadow: var(--shadow);
}

.card.wide { width: min(760px, calc(100% - 32px)); }

.legal {
    width: min(640px, calc(100% - 32px));
}

.legal p {
    line-height: 1.55;
    margin: 14px 0 0;
}

.legal .copyline {
    color: var(--muted);
    letter-spacing: 0.01em;
}

.legal .mail { color: #f0b429; }

.checks { list-style: none; padding: 0; display: grid; gap: 6px; }
.checks li { display: flex; justify-content: space-between; gap: 12px; }
.checks .ok::before { content: "● "; color: var(--ok); }
.checks .bad::before { content: "● "; color: var(--danger); }
.checks span { color: var(--muted); }

.danger-zone { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }

body.page-photo {
    height: 100dvh;
    overflow: hidden;
}

body.page-photo main {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.stage, .viewer-layout {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.stage { flex: 1; }

.viewer-layout {
    flex: 1 1 0;
    height: auto;
}

.stage-photo, .viewer-photo {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #090a0b;
}

.zoom {
    position: absolute;
    inset: 0;
    display: block;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    min-height: 0;
    line-height: 0;
    cursor: zoom-in;
}

.zoom img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: contain;
}

.stage-photo.is-original, .viewer-photo.is-original {
    overflow: auto;
}

.stage-photo.is-original .zoom,
.viewer-photo.is-original .zoom,
body.page-photo.details-open .stage-photo.is-original .zoom,
dialog.viewer.details-open .viewer-photo.is-original .zoom {
    position: relative;
    inset: auto;
    display: block;
    width: max-content;
    min-width: 100%;
    height: auto;
    cursor: zoom-out;
}

.stage-photo.is-original .zoom img, .viewer-photo.is-original .zoom img {
    position: static;
    inset: auto;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    object-fit: none;
}

.detail-bar {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex: 0 0 auto;
    padding: 10px 12px;
    background: #121316;
    border-top: 1px solid rgba(243, 239, 230, 0.08);
}

.detail-panel {
    flex: 0 1 auto;
    max-height: 62%;
    overflow: auto;
    padding: 8px 18px 18px;
    background: #121316;
}

.detail-panel[hidden] { display: none !important; }

.viewer-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    margin: 0;
}

.nav {
    text-decoration: none;
}

a.nav, button.nav {
    position: absolute;
    top: 50%;
    z-index: 3;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    min-height: 46px;
    padding: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    font-size: 1.8rem;
    line-height: 1;
    text-decoration: none;
}

.prev { left: 12px; }
.next { right: 12px; }

.exif { display: grid; gap: 10px; margin: 18px 0; }
.exif div { display: grid; grid-template-columns: 9.5rem 1fr; gap: 8px; }
.exif dt { color: var(--muted); margin: 0; }
.exif dd { margin: 0; }

.close-row { display: flex; justify-content: flex-end; }

dialog.viewer:not([open]) {
    display: none;
}

dialog.viewer[open] {
    display: flex;
    flex-direction: column;
}

dialog.viewer {
    width: 100vw;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100dvh;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    overflow: hidden;
    background: #0c0d0f;
    color: var(--text);
}

dialog.viewer .detail-bar {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

@media (min-width: 900px) {
    body.page-photo.details-open .stage,
    dialog.viewer.details-open .viewer-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(26rem, 38rem);
        grid-template-rows: auto minmax(0, 1fr);
    }

    body.page-photo.details-open .stage-photo,
    dialog.viewer.details-open .viewer-photo {
        grid-column: 1;
        grid-row: 1 / -1;
    }

    body.page-photo.details-open .stage-photo .zoom,
    dialog.viewer.details-open .viewer-photo .zoom {
        inset: 28px 18px 28px 28px;
    }

    body.page-photo.details-open .detail-bar,
    dialog.viewer.details-open .detail-bar {
        grid-column: 2;
        grid-row: 1;
    }

    body.page-photo.details-open .detail-panel,
    dialog.viewer.details-open .detail-panel {
        grid-column: 2;
        grid-row: 2;
        max-height: none;
        min-height: 0;
        padding: 8px 28px 28px 18px;
    }

    body.page-photo.details-open .minimap,
    dialog.viewer.details-open .minimap {
        width: 100%;
        max-width: 100%;
        height: auto;
        aspect-ratio: 3 / 2;
        margin: 12px 0 16px;
    }
}

dialog.viewer::backdrop { background: rgba(0, 0, 0, 0.72); }

.minimap, #map { background: #1a1c1f; }
.minimap {
    width: 100%;
    max-width: 100%;
    height: 220px;
    border-radius: 8px;
    overflow: hidden;
    margin: 8px 0 16px;
}

.capture h2 { font-size: 1.2rem; }

.capture-modes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    border: 0;
    padding: 0;
}

.capture-modes label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.capture-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
    gap: 10px;
}

.capture select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #101114;
    color: inherit;
}

.capture[data-mode="year"] .need-month,
.capture[data-mode="year"] .need-day,
.capture[data-mode="year"] .need-time,
.capture[data-mode="month"] .need-day,
.capture[data-mode="month"] .need-time { display: none; }

.pick-map { cursor: crosshair; }

.leaflet-div-icon.pick-pin {
    width: 18px;
    height: 18px;
    background: #f0b429;
    border: 2px solid #e10600;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(225, 6, 0, 0.28);
}
.leaflet-container { max-width: 100%; font-family: inherit; }
#viewer-map[hidden] { display: none !important; }

body.page-map { height: 100vh; overflow: hidden; }
body.page-map main { display: flex; min-height: 0; }
.map-shell { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#map { flex: 1; min-height: 240px; }
.map-hint { margin: 0 22px 8px; }
.map-bar { align-items: center; }

.drop {
    display: none;
    position: fixed;
    inset: 16px;
    z-index: 30;
    place-items: center;
    border: 2px dashed var(--accent);
    border-radius: 16px;
    background: rgba(15, 16, 18, 0.88);
    font-size: 1.4rem;
}

body.is-drag .drop { display: grid; }

.popup { display: grid; gap: 6px; width: 180px; }
.popup img { width: 180px; height: 120px; object-fit: cover; border-radius: 4px; }
.popup span { color: var(--muted); font-size: 0.85rem; }

.leaflet-popup-content-wrapper,
.leaflet-popup-tip { background: #17181b; color: var(--text); box-shadow: none; }
.leaflet-popup-content { margin: 10px 12px; }
.leaflet-control-layers, .leaflet-bar a {
    background: #17181b;
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.12);
}
.leaflet-control-layers-toggle { filter: invert(1); }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background-color: rgba(228, 177, 90, 0.35); }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div {
    background-color: rgba(228, 177, 90, 0.92);
    color: var(--accent-ink);
    font-weight: 600;
}

.leaflet-marker-icon.map-thumb {
    background: #fff;
    border: 2px solid #fff;
    border-radius: 10px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.38);
    overflow: visible;
}

.leaflet-container .leaflet-marker-pane .map-thumb img {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.map-count {
    position: absolute;
    right: -6px;
    bottom: -6px;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 4px;
    border-radius: 999px;
    background: #e10600;
    color: #fff8f2;
    font-size: 0.72rem;
    font-weight: 700;
    display: grid;
    place-items: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

@media (min-width: 900px) {
    .top {
        min-height: 72px;
        padding: 10px 40px;
    }

    .menu { gap: 6px 22px; }
    .menu a, .menu button { padding: 10px 2px; }

    .sheet, .toolbar, .map-bar, .sort-bar { padding-left: 40px; padding-right: 40px; }
    .sort-hint { margin-left: 40px; margin-right: 40px; }
    .flash { margin-left: 40px; margin-right: 40px; }
    .map-hint { margin-left: 40px; margin-right: 40px; }

    .albums {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 28px;
        padding: 36px 40px 72px;
    }

    .photos {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 8px;
        padding: 12px 32px 48px;
    }

    .popup { width: 240px; }
    .popup img { width: 240px; height: 160px; }
}

@media (max-width: 760px) {
    .top {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "brand account" "nav nav";
        align-items: center;
        min-height: 52px;
        padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
        row-gap: 0;
    }

    .brand { grid-area: brand; font-size: 1.12rem; }
    .menu-main { grid-area: nav; justify-self: center; width: 100%; justify-content: center; }
    .menu-account { grid-area: account; }

    .menu {
        position: static;
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 2px;
        min-height: 44px;
        margin: 0;
        padding: 0;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .menu a, .menu form, .menu button {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 44px;
        min-height: 44px;
        margin: 0;
        padding: 0 6px;
        font-size: 0.78rem;
        line-height: 1;
        white-space: nowrap;
    }

    .menu a.menu-aside,
    .menu button.menu-aside { font-size: 0.68rem; }

    .sheet, .toolbar, .map-bar { padding: 14px 16px 6px; }
    .flash { margin: 12px 16px 0; }
    .map-hint { margin: 0 16px 8px; font-size: 0.82rem; }

    .toolbar, .map-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .actions, .upload-row { width: 100%; }
    .actions .button, .upload-row .button, .file-btn { flex: 1; }

    .albums {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        padding: 16px 16px 28px;
    }

    .photos {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 2px;
        padding: 2px;
    }

    .detail-panel { padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); }
    .exif div { grid-template-columns: 1fr; gap: 2px; }
    .vis-grid { grid-template-columns: 1fr; }

    a.nav, button.nav {
        width: 44px;
        height: 44px;
        background: rgba(0, 0, 0, 0.62);
    }

    input, textarea, select { font-size: 16px; }

    body.page-map {
        height: 100dvh;
        padding-bottom: 0;
    }

    .popup { width: min(220px, 70vw); }
    .popup img { width: 100%; height: 120px; }
    .minimap { height: 180px; }
}

@media (hover: hover) and (pointer: fine) {
    .album:hover .album-cover img, .tile:hover img { transform: scale(1.03); }
}

@media (prefers-reduced-motion: reduce) {
    .album-cover img, .tile img { transition: none; }
    .album:hover .album-cover img, .tile:hover img { transform: none; }
}
