/* ─── Reset & Global ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
    --primary:       #5B5EF4;
    --primary-hover: #4749d6;
    --primary-light: #eeeffe;
    --danger:        #EF4444;
    --danger-light:  #FEE2E2;
    --bg:            #F4F4F6;
    --white:         #ffffff;
    --text:          #111827;
    --text-muted:    #6B7280;
    --text-light:    #9CA3AF;
    --border:        #E5E7EB;
    --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md:  0 4px 16px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.06);
    --shadow-lg:  0 10px 40px rgba(0,0,0,.18), 0 4px 12px rgba(0,0,0,.10);
    --shadow-xl:  0 25px 70px rgba(0,0,0,.55), 0 8px 24px rgba(0,0,0,.20);
    --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px;
}

html { font-size: 15px; }

body {
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ════════════════════════════════════════
   LOCKSCREEN
════════════════════════════════════════ */
.ls-body { background: #0d0d18; overflow: hidden; }

.ls-bg {
    position: fixed; inset: 0; z-index: 0;
    background: radial-gradient(ellipse at 30% 40%, rgba(91,94,244,.25) 0%, transparent 60%),
                radial-gradient(ellipse at 75% 70%, rgba(79,70,229,.18) 0%, transparent 55%);
}

.ls-wrap {
    position: relative; z-index: 1;
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}

.ls-card {
    background: rgba(255,255,255,.04);
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 24px;
    padding: 48px 40px 40px;
    width: 100%; max-width: 480px;
    text-align: center;
    box-shadow: 0 32px 80px rgba(0,0,0,.5);
    transition: transform .5s cubic-bezier(.34,1.36,.64,1), opacity .4s;
}
.ls-card.ls-success { transform: scale(1.04); opacity: 0; }

.ls-logo {
    display: flex; align-items: center; justify-content: center;
    gap: 12px; margin-bottom: 28px;
}
.ls-logo-name { font-size: 1.25rem; font-weight: 700; color: #fff; letter-spacing: -.02em; }

.ls-heading { font-size: 1.6rem; font-weight: 700; color: #fff; letter-spacing: -.02em; }
.ls-sub { font-size: .875rem; color: rgba(255,255,255,.45); margin-top: 6px; }

/* PIN row */
.ls-pin-row {
    display: flex; gap: 10px; justify-content: center;
    margin: 32px 0 20px;
}
@keyframes shake {
    0%,100% { transform: translateX(0); }
    20%      { transform: translateX(-10px); }
    40%      { transform: translateX(10px); }
    60%      { transform: translateX(-6px); }
    80%      { transform: translateX(6px); }
}
.ls-pin-row.shake { animation: shake .42s ease; }

.ls-pin-box {
    width: 46px; height: 58px;
    border: 2px solid rgba(255,255,255,.15);
    border-radius: 12px;
    background: rgba(255,255,255,.07);
    color: #fff;
    font-family: 'Geist', monospace;
    font-size: 1.5rem; font-weight: 700;
    text-align: center;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    caret-color: transparent;
}
.ls-pin-box:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91,94,244,.30);
    background: rgba(91,94,244,.12);
}
.ls-pin-box:disabled { opacity: .4; }

/* Error */
.ls-error {
    font-size: .82rem; color: #f87171;
    min-height: 20px; margin-bottom: 16px;
}

/* Unlock button */
.ls-btn {
    width: 100%; height: 50px;
    background: var(--primary);
    border: none; border-radius: 12px;
    font-family: 'Geist', sans-serif;
    font-size: 1rem; font-weight: 600; color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(91,94,244,.4);
    transition: background .15s, opacity .15s, transform .1s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.ls-btn:disabled { opacity: .4; cursor: not-allowed; }
.ls-btn:not(:disabled):hover { background: var(--primary-hover); }
.ls-btn:not(:disabled):active { transform: scale(.98); }

.ls-spinner {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2.5px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    animation: spin .7s linear infinite;
    display: inline-block;
}

/* ════════════════════════════════════════
   HEADER
════════════════════════════════════════ */
.header {
    position: sticky; top: 0; z-index: 100;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.header-inner {
    display: flex; align-items: center; gap: 16px;
    padding: 0 32px; height: 64px;
}
.header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* Logo */
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.logo-mark {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 9px;
    background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
    box-shadow: 0 2px 8px rgba(91,94,244,.35);
}
.logo-name { font-size: 1.05rem; font-weight: 700; color: var(--text); letter-spacing: -.01em; }

/* Search */
.search-wrap {
    display: flex; align-items: center;
    flex: 1; max-width: 520px; margin: 0 auto; position: relative;
}
.search-icon { position: absolute; left: 14px; color: var(--text-light); display: flex; pointer-events: none; }
.search-input {
    width: 100%; height: 40px; padding: 0 44px 0 42px;
    background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--r-sm);
    font-family: inherit; font-size: .875rem; color: var(--text); outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.search-input::placeholder { color: var(--text-light); }
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,94,244,.15); background: var(--white); }
.search-kbd {
    position: absolute; right: 12px;
    display: flex; align-items: center; justify-content: center;
    width: 22px; height: 22px;
    border: 1.5px solid var(--border); border-radius: 5px;
    font-size: .72rem; font-family: inherit; color: var(--text-muted);
    background: var(--white); pointer-events: none;
}
.search-clear {
    position: absolute; right: 10px;
    display: flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 50%; border: none;
    background: var(--text-light); color: var(--white);
    cursor: pointer; transition: background .15s;
}
.search-clear:hover { background: var(--text-muted); }

/* Upload & Lock buttons */
.btn-upload {
    display: flex; align-items: center; gap: 8px;
    height: 40px; padding: 0 18px;
    background: var(--primary); color: var(--white);
    border: none; border-radius: var(--r-sm);
    font-family: inherit; font-size: .875rem; font-weight: 600;
    cursor: pointer; white-space: nowrap;
    box-shadow: 0 2px 8px rgba(91,94,244,.30);
    transition: background .15s, box-shadow .15s, transform .1s;
}
.btn-upload:hover { background: var(--primary-hover); box-shadow: 0 4px 12px rgba(91,94,244,.40); }
.btn-upload:active { transform: translateY(1px); }

.btn-lock {
    display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px;
    background: var(--white); border: 1.5px solid var(--border); border-radius: var(--r-sm);
    color: var(--text-muted); cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.btn-lock:hover { background: var(--bg); color: var(--text); border-color: #c5c7ce; }

/* ════════════════════════════════════════
   MAIN
════════════════════════════════════════ */
.main { padding: 36px 32px 60px; }

/* Section header */
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 28px; gap: 16px;
}
.section-title-block { display: flex; align-items: center; gap: 16px; }
.section-title { font-size: 1.5rem; font-weight: 700; color: var(--text); letter-spacing: -.02em; line-height: 1.2; }
.section-subtitle { font-size: .875rem; color: var(--text-muted); margin-top: 3px; }

/* Section controls */
.section-controls { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* Clear filter button */
.clear-filter-btn {
    height: 34px; padding: 0 14px;
    background: none; border: none;
    font-family: inherit; font-size: .82rem; font-weight: 500;
    color: var(--text-muted); cursor: pointer;
    border-radius: var(--r-sm);
    transition: color .15s, background .15s;
}
.clear-filter-btn:hover { color: var(--danger); background: var(--danger-light); }

/* Sort dropdown */
.sort-wrap { position: relative; }
.sort-btn {
    display: flex; align-items: center; gap: 7px;
    height: 38px; padding: 0 14px;
    background: var(--white); border: 1.5px solid var(--border); border-radius: var(--r-sm);
    font-family: inherit; font-size: .85rem; font-weight: 500; color: var(--text);
    cursor: pointer; white-space: nowrap;
    transition: border-color .15s, box-shadow .15s;
}
.sort-btn:hover,
.sort-btn[aria-expanded="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,94,244,.12); }
.sort-caret { color: var(--text-muted); flex-shrink: 0; transition: transform .18s; }
.sort-btn[aria-expanded="true"] .sort-caret { transform: rotate(180deg); }
.sort-menu {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 200;
    min-width: 170px;
    background: var(--white); border: 1.5px solid var(--border); border-radius: var(--r-md);
    box-shadow: var(--shadow-md); overflow: hidden; list-style: none;
    animation: menuIn .14s ease;
}
@keyframes menuIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }
.sort-opt {
    display: block; width: 100%; padding: 9px 14px;
    background: none; border: none;
    font-family: inherit; font-size: .85rem; color: var(--text); text-align: left;
    cursor: pointer; transition: background .1s;
}
.sort-opt:hover { background: var(--bg); }
.sort-opt.active { color: var(--primary); font-weight: 600; background: var(--primary-light); }

/* View toggle */
.view-toggle {
    display: flex; align-items: center;
    background: var(--white); border: 1.5px solid var(--border);
    border-radius: var(--r-sm); overflow: hidden;
}
.view-btn {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    background: transparent; border: none;
    color: var(--text-muted); cursor: pointer;
    transition: background .15s, color .15s;
}
.view-btn:hover { background: var(--bg); color: var(--text); }
.view-btn.active { background: var(--primary); color: var(--white); }

/* Column slider */
.col-slider-wrap {
    display: flex; align-items: center; gap: 7px;
    height: 38px; padding: 0 10px;
    background: var(--white); border: 1.5px solid var(--border); border-radius: var(--r-sm);
    color: var(--text-light);
}
.col-slider-wrap svg { flex-shrink: 0; }
.col-slider {
    width: 80px; cursor: pointer;
    -webkit-appearance: none; appearance: none;
    height: 3px; border-radius: 2px;
    background: var(--border); outline: none;
    transition: background .15s;
}
.col-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--primary); cursor: pointer;
    box-shadow: 0 1px 4px rgba(91,94,244,.40);
    transition: transform .1s;
}
.col-slider::-webkit-slider-thumb:active { transform: scale(1.2); }
.col-slider::-moz-range-thumb {
    width: 14px; height: 14px; border-radius: 50%; border: none;
    background: var(--primary); cursor: pointer;
}
.col-slider:hover { background: #d1d5db; }
.col-slider-count {
    font-size: .75rem; font-weight: 700; color: var(--text-muted);
    min-width: 10px; text-align: center;
}

/* ════════════════════════════════════════
   IMAGE GRID
════════════════════════════════════════ */
.image-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols, 5), 1fr);
    gap: 20px;
}
/* List view */
.image-grid.list-view { grid-template-columns: 1fr; gap: 10px; }
.image-grid.list-view .image-card { height: 80px; aspect-ratio: unset; border-radius: var(--r-sm); display: flex; align-items: center; }
.image-grid.list-view .image-card img { width: 80px; height: 80px; object-fit: cover; border-radius: var(--r-sm); flex-shrink: 0; }
.image-grid.list-view .card-overlay { display: none; }
.image-grid.list-view .card-meta { position: static; flex: 1; padding: 0 16px; background: none; }
.image-grid.list-view .card-name { color: var(--text); text-shadow: none; }
.image-grid.list-view .card-date { color: var(--text-muted); text-shadow: none; }
.image-grid.list-view .card-size-badge {
    background: var(--bg); color: var(--text-muted);
    border: 1.5px solid var(--border); margin-right: 12px;
    backdrop-filter: none; -webkit-backdrop-filter: none;
}

/* Card */
.image-card {
    position: relative; border-radius: var(--r-lg); overflow: hidden;
    aspect-ratio: 4 / 3; box-shadow: var(--shadow-md); cursor: pointer;
    transition: transform .2s, box-shadow .2s;
}
.image-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(0,0,0,.16), 0 4px 12px rgba(0,0,0,.08); }
.image-card img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.image-card:hover img { transform: scale(1.04); }
.card-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,.22) 65%, rgba(0,0,0,.74) 100%);
    pointer-events: none;
}
.card-meta {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 14px 14px 13px;
    display: flex; align-items: flex-end; justify-content: space-between; gap: 8px;
}
.card-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-name { font-size: .8rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.card-date { font-size: .68rem; color: rgba(255,255,255,.78); text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.card-size-badge {
    display: flex; align-items: center; justify-content: center;
    min-width: 34px; height: 26px; padding: 0 7px; border-radius: 7px;
    background: rgba(0,0,0,.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    color: rgba(255,255,255,.92); font-size: .7rem; font-weight: 700;
    flex-shrink: 0; letter-spacing: .02em; pointer-events: none;
}

/* Skeleton */
.skeleton-card {
    border-radius: var(--r-lg); aspect-ratio: 4/3;
    background: linear-gradient(90deg, #e8e8ec 25%, #f0f0f4 50%, #e8e8ec 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Empty state */
.grid-empty {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 12px;
    padding: 80px 20px; color: var(--text-light); text-align: center;
}
.grid-empty svg { opacity: .35; }
.grid-empty h3 { font-size: 1.1rem; font-weight: 600; color: var(--text-muted); }
.grid-empty p  { font-size: .875rem; }

/* Gallery footer */
.gallery-footer {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; margin-top: 40px;
    font-size: .875rem; color: var(--text-muted);
}
.footer-sep { color: var(--border); }

/* ════════════════════════════════════════
   UPLOAD MODAL
════════════════════════════════════════ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15,15,25,.52);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 24px;
    opacity: 0; visibility: hidden;
    transition: opacity .2s, visibility .2s;
}
.modal-overlay.open { opacity: 1; visibility: visible; }

.modal {
    position: relative;
    background: var(--white); border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg);
    width: 100%; max-width: 560px;
    max-height: calc(100vh - 48px);
    display: flex; flex-direction: column;
    overflow: hidden;
    transform: translateY(12px) scale(.98);
    transition: transform .22s cubic-bezier(.34,1.36,.64,1);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 26px 26px 18px; gap: 12px; flex-shrink: 0;
}
.modal-title-block { display: flex; align-items: center; gap: 14px; }
.modal-icon {
    display: flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; border-radius: 12px;
    background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
    color: #fff; flex-shrink: 0; box-shadow: 0 3px 10px rgba(91,94,244,.35);
}
.modal-title { font-size: 1.15rem; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.modal-subtitle { font-size: .82rem; color: var(--text-muted); margin-top: 3px; }
.modal-close {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border: none; border-radius: var(--r-sm);
    background: var(--bg); color: var(--text-muted); cursor: pointer; flex-shrink: 0;
    transition: background .15s, color .15s;
}
.modal-close:hover { background: #e5e6ea; color: var(--text); }

/* Drop zone */
.dropzone {
    border: 2px dashed #D1D5DB; border-radius: var(--r-md);
    padding: 30px 20px; text-align: center; cursor: pointer;
    transition: border-color .15s, background .15s;
    background: #FAFAFA; flex-shrink: 0;
    margin: 0 26px;
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--primary); background: var(--primary-light); }
.dropzone-cloud {
    display: flex; align-items: center; justify-content: center;
    width: 52px; height: 52px; border-radius: 50%;
    background: var(--primary-light); border: 1.5px solid rgba(91,94,244,.20);
    color: var(--primary); margin: 0 auto 12px;
}
.dropzone-primary { font-size: .9rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.dropzone-secondary { font-size: .82rem; color: var(--text-muted); }

.dropzone-hint {
    font-size: .75rem; color: var(--text-light);
    text-align: center; padding: 8px 26px 0; flex-shrink: 0;
}
.dropzone-hint kbd { position: static; display: inline-flex; width: auto; padding: 0 5px; }

/* ── Scrollable file list ── */
.file-list {
    list-style: none;
    max-height: 280px;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 6px;
    padding: 10px 26px;
    /* custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.file-list::-webkit-scrollbar { width: 4px; }
.file-list::-webkit-scrollbar-track { background: transparent; }
.file-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* File item */
.file-item {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 12px; border: 1.5px solid var(--border);
    border-radius: var(--r-sm); background: var(--white);
    transition: border-color .2s, opacity .25s; flex-shrink: 0;
    animation: slideIn .15s ease;
}
.file-item.dim { opacity: 0.28; }
@keyframes slideIn { from { opacity:0; transform:translateY(-5px); } to { opacity:1; transform:translateY(0); } }

.file-thumb { width: 42px; height: 42px; border-radius: 6px; object-fit: cover; flex-shrink: 0; background: var(--bg); }
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: .84rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: .76rem; color: var(--text-muted); margin-top: 2px; }

/* Upload progress */
.file-item.uploading { position: relative; overflow: hidden; border-color: rgba(91,94,244,.35); }
.file-item.uploading::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0;
    background: rgba(91,94,244,.10);
    width: var(--pct, 0%);
    transition: width .25s linear;
}
.file-item.done    { border-color: rgba(34,197,94,.45); }
.file-item.done::before    { width: 100%; background: rgba(34,197,94,.10); }
.file-item.errored { border-color: rgba(239,68,68,.45); }
.file-item.errored::before { width: 100%; background: rgba(239,68,68,.08); }

.file-remove {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border: none; border-radius: 6px;
    background: transparent; color: var(--text-light); cursor: pointer; flex-shrink: 0;
    transition: background .15s, color .15s;
}
.file-remove:hover { background: var(--danger-light); color: var(--danger); }

.file-status {
    font-size: .76rem; font-weight: 600; flex-shrink: 0;
    min-width: 44px; text-align: right;
}
.file-item.uploading .file-status { color: var(--primary); }
.file-item.done      .file-status { color: #16a34a; }
.file-item.errored   .file-status { color: var(--danger); }

/* Modal actions */
.modal-actions {
    display: flex; align-items: center; justify-content: flex-end;
    gap: 10px; padding: 16px 26px;
    border-top: 1.5px solid var(--border); flex-shrink: 0;
}
.btn-cancel {
    height: 40px; padding: 0 20px;
    background: var(--white); border: 1.5px solid var(--border); border-radius: var(--r-sm);
    font-family: inherit; font-size: .875rem; font-weight: 600; color: var(--text); cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.btn-cancel:hover { background: var(--bg); border-color: #c5c7ce; }
/* During upload: cancel/close buttons stay clickable but hint at their role */
.btn-cancel.uploading-active,
.modal-close.uploading-active {
    border-color: var(--danger);
    color: var(--danger);
}
.btn-cancel.uploading-active:hover,
.modal-close.uploading-active:hover {
    background: var(--danger-light);
}
.btn-upload-modal {
    display: flex; align-items: center; gap: 8px;
    height: 40px; padding: 0 20px;
    background: var(--primary); border: none; border-radius: var(--r-sm);
    font-family: inherit; font-size: .875rem; font-weight: 600; color: var(--white); cursor: pointer;
    box-shadow: 0 2px 8px rgba(91,94,244,.30);
    transition: background .15s, box-shadow .15s, opacity .15s; white-space: nowrap;
}
.btn-upload-modal:hover:not(:disabled) { background: var(--primary-hover); box-shadow: 0 4px 12px rgba(91,94,244,.40); }
.btn-upload-modal:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* Spinner */
.spinner {
    width: 20px; height: 20px; border-radius: 50%;
    border: 2.5px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════
   LIGHTBOX
════════════════════════════════════════ */
.lb-overlay {
    position: fixed; inset: 0; z-index: 3000;
    background: #0a0a10;
    display: flex;
    animation: fadeIn .18s ease;
}
.lb-overlay[hidden] { display: none !important; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.lb-container {
    display: flex;
    width: 100%; height: 100%;
    overflow: hidden;
}

.lb-image-panel {
    flex: 1; background: #0a0a10;
    display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
}

.lb-img { max-width: 100%; max-height: 100vh; object-fit: contain; display: block; transition: opacity .18s; }
.lb-img.loading { opacity: 0; transition: none; }

/* Close — top-left of image panel */
.lb-close {
    position: absolute; top: 16px; left: 16px; z-index: 10;
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 10px; border: none;
    background: rgba(255,255,255,.12); color: rgba(255,255,255,.85);
    cursor: pointer; transition: background .15s;
}
.lb-close:hover { background: rgba(255,255,255,.22); }

/* Navigation arrows — sides of image panel */
.lb-nav {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 10;
    display: flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; border-radius: 50%; border: none;
    background: rgba(255,255,255,.10); color: rgba(255,255,255,.85);
    cursor: pointer; transition: background .15s, opacity .15s;
    opacity: 0;
}
.lb-image-panel:hover .lb-nav { opacity: 1; }
.lb-nav:hover { background: rgba(255,255,255,.22); }
.lb-nav:disabled { opacity: 0 !important; cursor: default; }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-img-loader {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity .15s; pointer-events: none;
}
.lb-img-loader.visible { opacity: 1; }

/* Fullscreen button — top-right of image panel (image-only view) */
.lb-fullscreen-btn {
    position: absolute; top: 16px; right: 16px; z-index: 10;
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 10px; border: none;
    background: rgba(255,255,255,.12); color: rgba(255,255,255,.85);
    cursor: pointer; opacity: 0;
    transition: background .15s, opacity .2s;
}
.lb-image-panel:hover .lb-fullscreen-btn { opacity: 1; }
.lb-fullscreen-btn:hover { background: rgba(255,255,255,.22); }

/* Fullscreen overlay */
.fs-overlay {
    position: fixed; inset: 0; z-index: 5000;
    background: #000;
    display: flex; align-items: center; justify-content: center;
    cursor: zoom-out;
    animation: fadeIn .15s ease;
}
.fs-img {
    max-width: 100vw; max-height: 100vh;
    object-fit: contain; display: block;
    cursor: default;
}
.fs-close {
    position: absolute; top: 16px; right: 16px;
    display: flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border-radius: 10px; border: none;
    background: rgba(255,255,255,.14); color: rgba(255,255,255,.85);
    cursor: pointer; transition: background .15s;
}
.fs-close:hover { background: rgba(255,255,255,.26); }
.lb-img-loader .spinner { border-top-color: rgba(255,255,255,.6); border-color: rgba(255,255,255,.15); }

/* Info panel */
.lb-info-panel {
    width: 320px; flex-shrink: 0;
    background: var(--white);
    display: flex; flex-direction: column; overflow: hidden;
    border-left: 1px solid var(--border);
}
.lb-info-body { flex: 1; padding: 24px 22px 0; overflow-y: auto; }
.lb-info-filename {
    font-size: .95rem; font-weight: 700; color: var(--text);
    word-break: break-all; line-height: 1.4; margin-bottom: 18px;
}
.lb-detail-section { margin-bottom: 16px; }
.lb-detail-label {
    font-size: .72rem; font-weight: 700; color: var(--text-light);
    text-transform: uppercase; letter-spacing: .07em; margin-bottom: 10px;
}
.lb-detail-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.lb-detail-list li { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; font-size: .82rem; }
.lb-detail-list li span:first-child { color: var(--text-muted); flex-shrink: 0; }
.lb-detail-list li span:last-child  { color: var(--text); font-weight: 500; text-align: right; word-break: break-all; }
.lb-maps-link { color: var(--primary); text-decoration: none; }
.lb-maps-link:hover { text-decoration: underline; }

/* EXIF section badge grid */
.lb-exif-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 4px;
}
.lb-exif-chip {
    background: var(--bg); border: 1.5px solid var(--border);
    border-radius: var(--r-sm); padding: 7px 10px;
}
.lb-exif-chip-label {
    font-size: .68rem; font-weight: 700; color: var(--text-light);
    text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px;
}
.lb-exif-chip-value {
    font-size: .8rem; font-weight: 600; color: var(--text);
    word-break: break-all;
}

/* Info footer */
.lb-info-footer {
    padding: 14px 20px 20px; border-top: 1.5px solid var(--border); flex-shrink: 0;
}
.lb-counter { font-size: .78rem; color: var(--text-light); margin-bottom: 10px; text-align: center; }

/* Mobile-only floating action bar inside image panel */
.lb-mob-bar {
    display: none;
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 16px 16px 20px;
    background: linear-gradient(to top, rgba(0,0,0,.72) 0%, transparent 100%);
    gap: 10px;
    z-index: 10;
}
.lb-mob-btn {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    flex: 1; height: 42px;
    border: 1.5px solid rgba(255,255,255,.25); border-radius: var(--r-sm);
    background: rgba(255,255,255,.12); backdrop-filter: blur(8px);
    color: #fff; font-family: inherit; font-size: .82rem; font-weight: 600;
    cursor: pointer; text-decoration: none; text-align: center;
    transition: background .15s, border-color .15s;
}
.lb-mob-btn:hover { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.45); }
.lb-mob-details-btn.drawer-open { background: rgba(255,255,255,.28); border-color: rgba(255,255,255,.6); }
.lb-mob-delete-btn:hover { background: rgba(220,53,69,.35); border-color: rgba(220,53,69,.7); }

/* Action button row */
.lb-action-row { display: flex; flex-direction: column; gap: 8px; }
.lb-action-btn {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    flex: 1; height: 44px;
    border: 1.5px solid var(--border); border-radius: var(--r-sm);
    font-family: inherit; font-size: .85rem; font-weight: 600;
    cursor: pointer; text-decoration: none; text-align: center;
    transition: background .15s, border-color .15s, color .15s;
    white-space: nowrap;
}
.lb-download-btn { background: var(--white); color: var(--text-muted); }
.lb-download-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.lb-details-btn { background: var(--white); color: var(--text-muted); display: none; }
.lb-details-btn:hover { background: var(--bg); }
.lb-delete-btn { background: var(--white); color: var(--text-muted); border: 1.5px solid var(--border); }
.lb-delete-btn:hover { background: var(--danger-light); border-color: var(--danger); color: var(--danger); }

/* Inline confirm */
.lb-confirm { margin-top: 2px; animation: slideIn .15s ease; }
.lb-confirm-label { font-size: .8rem; color: var(--text-muted); margin-bottom: 8px; }
.lb-pin-input {
    width: 100%; height: 40px; padding: 0 14px;
    border: 1.5px solid var(--border); border-radius: var(--r-sm);
    font-family: inherit; font-size: 1rem; text-align: center;
    letter-spacing: .3em; outline: none;
    transition: border-color .15s, box-shadow .15s;
    margin-bottom: 10px;
}
.lb-pin-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,94,244,.15); }
.lb-pin-input.error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239,68,68,.15); }
.lb-confirm-btns { display: flex; gap: 8px; }
.lb-confirm-cancel, .lb-confirm-ok {
    flex: 1; height: 34px; border-radius: var(--r-sm);
    font-family: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
    border: 1.5px solid var(--border);
    transition: background .15s, color .15s, border-color .15s;
}
.lb-confirm-cancel { background: var(--white); color: var(--text-muted); }
.lb-confirm-cancel:hover { background: var(--bg); }
.lb-confirm-ok { background: var(--danger); border-color: var(--danger); color: #fff; }
.lb-confirm-ok:hover { background: #dc2626; border-color: #dc2626; }

/* Drag handle — mobile info panel */
.lb-drag-handle {
    width: 36px; height: 4px; border-radius: 2px;
    background: var(--border); margin: 10px auto 4px; flex-shrink: 0;
    display: none;
}

/* Mobile details backdrop */
.lb-mobile-backdrop {
    position: fixed; inset: 0; z-index: 3090;
    background: rgba(0,0,0,.55);
    display: none;
}
.lb-mobile-backdrop.open { display: block; }

/* ════════════════════════════════════════
   CANCEL CONFIRM OVERLAY (inside modal)
════════════════════════════════════════ */
.cancel-confirm {
    position: absolute; inset: 0; z-index: 20;
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    border-radius: inherit;
    animation: fadeIn .15s ease;
}
.cancel-confirm-card {
    text-align: center; padding: 36px 32px; max-width: 320px;
}
.cancel-confirm-icon {
    display: flex; align-items: center; justify-content: center;
    width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 18px;
    background: var(--danger-light); color: var(--danger);
}
.cancel-confirm-title {
    font-size: 1.05rem; font-weight: 700; color: var(--text);
    margin-bottom: 8px; letter-spacing: -.01em;
}
.cancel-confirm-desc {
    font-size: .84rem; color: var(--text-muted); margin-bottom: 24px; line-height: 1.5;
}
.cancel-confirm-btns { display: flex; gap: 10px; justify-content: center; }
.cancel-confirm-keep {
    height: 40px; padding: 0 20px;
    background: var(--white); border: 1.5px solid var(--border); border-radius: var(--r-sm);
    font-family: inherit; font-size: .875rem; font-weight: 600; color: var(--text);
    cursor: pointer; transition: background .15s, border-color .15s;
}
.cancel-confirm-keep:hover { background: var(--bg); border-color: #c5c7ce; }
.cancel-confirm-discard {
    height: 40px; padding: 0 20px;
    background: var(--danger); border: 1.5px solid var(--danger); border-radius: var(--r-sm);
    font-family: inherit; font-size: .875rem; font-weight: 600; color: #fff;
    cursor: pointer; transition: background .15s, border-color .15s;
}
.cancel-confirm-discard:hover { background: #dc2626; border-color: #dc2626; }

/* ════════════════════════════════════════
   TOAST
════════════════════════════════════════ */
.toast-container {
    position: fixed; bottom: 28px; right: 28px; z-index: 4000;
    display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 18px; border-radius: var(--r-md);
    background: #1e1e2e; color: #fff;
    font-size: .875rem; font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    pointer-events: auto; min-width: 240px; max-width: 360px;
    animation: toastIn .2s ease;
}
.toast.success .toast-dot { background: #22c55e; }
.toast.error   .toast-dot { background: var(--danger); }
.toast.info    .toast-dot { background: var(--primary); }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.toast-msg { flex: 1; }
@keyframes toastIn  { from { opacity:0; transform:translateX(16px); } to { opacity:1; transform:translateX(0); } }
@keyframes toastOut { to   { opacity:0; transform:translateX(16px); } }
.toast.out { animation: toastOut .2s ease forwards; }

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
/* grid columns controlled by JS --grid-cols variable */
@media (max-width: 860px) {
    .header-inner { padding: 0 20px; gap: 12px; }
    .main { padding: 24px 20px 48px; }
    .image-grid { gap: 14px; }
    .section-header { flex-wrap: wrap; }

    /* Lightbox — info panel becomes a slide-up drawer */
    .lb-container { flex-direction: row; }
    .lb-image-panel { flex: 1; }
    .lb-drag-handle { display: block; }
    .lb-info-panel {
        position: fixed; bottom: 0; left: 0; right: 0;
        width: 100%; height: auto; max-height: 80vh;
        border-left: none; border-top: none;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        transition: transform .3s cubic-bezier(.4,0,.2,1);
        z-index: 3100;
        box-shadow: 0 -8px 40px rgba(0,0,0,.35);
        overflow-y: auto;
    }
    .lb-info-panel.mobile-open { transform: translateY(0); }

    /* Mobile floating bar replaces the action row in the drawer */
    .lb-mob-bar { display: flex; }
    .lb-action-row { display: none; }
}
@media (max-width: 640px) {
    .col-slider-wrap { display: none; }
}
@media (max-width: 520px) {
    .image-grid { gap: 10px; }
    .logo-name { display: none; }
    .search-wrap { max-width: none; }
    .btn-upload-text { display: none; }
    .btn-upload { padding: 0 14px; }
    .lb-nav { width: 36px; height: 36px; opacity: 1; }
    .lb-prev { left: 8px; } .lb-next { right: 8px; }
    .modal { max-height: 100vh; border-radius: 0; }
    .dropzone { padding: 18px 16px; margin: 0 16px; }
    .dropzone-cloud { width: 40px; height: 40px; margin-bottom: 8px; }
    .dropzone-cloud svg { width: 22px; height: 22px; }
    .dropzone-primary { font-size: .82rem; }
    .dropzone-secondary { font-size: .76rem; }
    .dropzone-hint { padding: 6px 16px 0; font-size: .72rem; }
    .file-list { padding: 8px 16px; max-height: 240px; }
    .modal-header { padding: 18px 16px 14px; }
    .modal-actions { padding: 12px 16px; }
    /* PIN boxes: fit 8 on small screens */
    .ls-card { padding: 36px 20px 28px; }
    .ls-pin-row { gap: 5px; }
    .ls-pin-box { width: 34px; height: 46px; font-size: 1.1rem; }
}
@media (max-width: 380px) {
    /* Very small phones: shrink pins further */
    .ls-card { padding: 28px 14px 22px; }
    .ls-pin-row { gap: 4px; }
    .ls-pin-box { width: 28px; height: 38px; font-size: .88rem; }
}
