:root {
    color-scheme: dark;
    font-family: system-ui, sans-serif;
    background: #101218;
    color: #f5f4fa;
    --panel: #191c26;
    --border: #343749;
    --muted: #bbbcd0;
    --accent: #c9bbff;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible {
    outline: 3px solid #e4d7ff;
    outline-offset: 4px;
}
.shell { width: min(1120px, calc(100% - 2.5rem)); margin-inline: auto; }
.header { border-bottom: 1px solid var(--border); padding-block: 1rem; }
.brand { display: inline-flex; gap: .65rem; align-items: center; color: inherit; font-weight: 750; text-decoration: none; }
.mark { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .6rem; color: #18132a; background: var(--accent); }
.intro { padding-block: clamp(2.5rem, 8vw, 4.75rem) 1.65rem; }
h1 { margin: 0; font-size: clamp(2.35rem, 7vw, 5rem); line-height: 1.02; letter-spacing: -.06em; }
.intro p { margin: 1rem 0 0; color: var(--muted); font-size: 1.1rem; }
.upload { position: relative; border: 1px solid var(--border); background: var(--panel); padding: 1rem; border-radius: 1.25rem; }
.picker { min-height: 13rem; display: grid; justify-items: center; align-content: center; gap: .5rem; border: 1px dashed #8175a6; border-radius: .85rem; background: #211d32; cursor: pointer; text-align: center; padding: 1rem; }
.picker:hover, .upload:focus-within .picker { border-color: var(--accent); }
.picker strong { font-size: 1.2rem; }
.picker span:not(.plus), .upload-actions span, .gallery-title span, .size { color: var(--muted); font-size: .9rem; }
.plus { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 1rem; background: #393055; color: var(--accent); font-size: 2rem; margin-bottom: .35rem; }
.file { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); }
.upload-actions { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .85rem; padding-top: 1rem; }
button { font: inherit; font-weight: 750; padding: .8rem 1.15rem; min-height: 44px; border: 0; border-radius: .7rem; background: var(--accent); color: #171126; cursor: pointer; }
button:hover { background: #e0d7ff; }
button:disabled { opacity: .7; cursor: wait; }
.gallery { margin-block: 2.75rem; }
.gallery-title { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1rem; }
h2 { margin: 0; font-size: 1.75rem; }
.empty, .notice { padding: .9rem 1.1rem; border: 1px solid var(--border); border-radius: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.notice { margin-bottom: 1rem; }
.notice p { margin: .25rem 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 1rem; align-items: start; }
.card { min-width: 0; border: 1px solid var(--border); border-radius: 1rem; background: var(--panel); }
.preview { display: grid; place-items: center; aspect-ratio: 4 / 3; background: #222638; border-radius: .95rem .95rem 0 0; overflow: hidden; text-decoration: none; }
.preview img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: .9rem; }
.filename { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 650; margin: 0; }
.size { margin: .35rem 0 .75rem; }
.card-actions { display: grid; gap: .55rem; }
summary { color: #ffb9c6; cursor: pointer; width: fit-content; }
.delete-form { margin-top: .75rem; display: grid; gap: .6rem; }
.delete-form input[type=password] { display: block; width: 100%; margin-top: .4rem; border: 1px solid var(--border); border-radius: .5rem; padding: .6rem; font: inherit; background: #101218; color: inherit; }
.delete-form button { background: #ffb9c6; }
@media (max-width: 480px) { .upload-actions button { width: 100%; } }

.gallery-controls:not([hidden]) { display: flex; flex-wrap: wrap; gap: .75rem 1rem; margin-bottom: 1rem; }
.gallery-controls label { display: grid; gap: .35rem; font-size: .9rem; }
.gallery-controls select { font: inherit; background: var(--panel); color: inherit; border: 1px solid var(--border); border-radius: .55rem; padding: .6rem; }
.grid[data-preview-size="small"] { grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.grid[data-preview-size="large"] { grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }
.upload-result { margin-top: 1rem; }
#upload-errors { max-height: 13rem; overflow: auto; }

.header { padding-block: .6rem; }
.intro { padding-block: 1.2rem .9rem; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
.intro p { margin-top: .5rem; }
.upload { padding: .65rem; }
.picker { min-height: 3.75rem; display: flex; justify-content: center; align-items: center; flex-wrap: wrap; padding: .45rem .7rem; }
.picker strong { font-size: 1rem; }
.plus { width: 1.85rem; height: 1.85rem; border-radius: .5rem; font-size: 1.35rem; margin: 0; }
.upload-actions { padding-top: .55rem; }
.upload-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
#clear-selection { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.gallery { margin-block: 1.5rem; }
#photo-viewer { position: fixed; inset: 0; margin: auto; padding: 0; border: 0; background: transparent; width: 100%; height: 100%; max-width: none; max-height: none; overflow: hidden; }
#photo-viewer::backdrop { background: rgb(0 0 0 / 85%); }
.viewer-image { display: flex; width: 100%; height: 100%; overflow: auto; }
#photo-viewer img { display: block; flex: none; width: auto; height: auto; margin: auto; }
#photo-viewer form { position: absolute; top: .4rem; right: 1rem; }
#photo-viewer button { font-size: 1.4rem; line-height: 1; padding: .5rem .85rem; }
.picker-help { margin: .45rem .15rem 0; color: var(--muted); font-size: .875rem; }

.bulk-delete:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.bulk-delete input[type=password] { font: inherit; max-width: 100%; padding: .5rem; border: 1px solid var(--border); border-radius: .5rem; }
.photo-choice:not([hidden]) { display: flex; align-items: center; gap: .35rem; margin-bottom: .65rem; cursor: pointer; }



