:root {
  color-scheme: dark;
  --bg: #07111f;
  --surface: #0d1a2b;
  --surface-2: #13233a;
  --line: rgba(166, 192, 229, .16);
  --text: #f5f8ff;
  --muted: #9fb0c8;
  --blue: #2d7fff;
  --blue-2: #65a5ff;
  --danger: #ff7f8a;
  --shadow: 0 24px 80px rgba(0, 0, 0, .38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 300px; min-height: 100vh; background: radial-gradient(circle at 75% -10%, #143367 0, transparent 32rem), var(--bg); color: var(--text); }
button, input { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
svg { width: 1.35rem; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 2rem; position: relative; overflow: hidden; }
.login-glow { position: absolute; border-radius: 999px; filter: blur(12px); opacity: .32; pointer-events: none; }
.login-glow-one { width: 34rem; height: 34rem; background: #126cff; top: -17rem; right: -10rem; }
.login-glow-two { width: 22rem; height: 22rem; background: #08b5ff; bottom: -13rem; left: -8rem; opacity: .13; }
.login-card { width: 100%; max-width: 31rem; padding: 2.25rem; background: linear-gradient(145deg, rgba(18, 35, 59, .96), rgba(8, 18, 32, .96)); border: 1px solid var(--line); border-radius: 2rem; box-shadow: var(--shadow); position: relative; }
.brand { display: flex; align-items: center; gap: .8rem; }
.brand img { width: 3rem; height: 3rem; object-fit: contain; }
.brand strong { display: block; font-size: 1.7rem; line-height: 1; letter-spacing: -.06em; }
.brand strong span { color: var(--blue); }
.brand small { display: block; margin-top: .25rem; color: var(--muted); font-size: .84rem; }
.brand-login { margin-bottom: 2.75rem; }
.brand-login img { width: 3.7rem; height: 3.7rem; }
.brand-login strong { font-size: 2rem; }
.eyebrow { color: var(--blue-2); font-size: .72rem; font-weight: 800; letter-spacing: .18em; margin: 0 0 .7rem; }
.login-copy h1, .hero-row h1 { margin: 0; letter-spacing: -.045em; line-height: 1.02; }
.login-copy h1 { font-size: clamp(2.15rem, 7vw, 3.25rem); }
.login-copy > p:last-child { color: var(--muted); line-height: 1.55; margin: 1rem 0 2rem; }
#login-form { display: grid; gap: 1rem; }
#login-form label { display: grid; gap: .5rem; font-size: .86rem; font-weight: 700; }
#login-form input { width: 100%; border: 1px solid var(--line); border-radius: 1rem; background: rgba(4, 12, 23, .72); color: var(--text); padding: .95rem 1rem; outline: none; }
#login-form input:focus, .search-box:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(45, 127, 255, .16); }
.primary-button, .soft-button, .icon-button, .danger-button { border: 0; cursor: pointer; transition: transform .18s ease, background .18s ease, opacity .18s ease; }
.primary-button { min-height: 3.25rem; border-radius: 1rem; background: linear-gradient(135deg, var(--blue), #1762df); font-weight: 800; box-shadow: 0 12px 28px rgba(45, 127, 255, .28); display: inline-flex; align-items: center; justify-content: center; gap: .55rem; }
.primary-button:hover, .soft-button:hover, .icon-button:hover, .danger-button:hover { transform: translateY(-1px); }
.primary-button:disabled, .soft-button:disabled, .danger-button:disabled { opacity: .5; cursor: wait; transform: none; }
.danger-button { min-height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: 0 1rem; border-radius: .9rem; background: rgba(255, 78, 94, .13); border: 1px solid rgba(255, 127, 138, .32); color: #ff9ca5; font-weight: 800; }
.danger-button:hover { background: rgba(255, 78, 94, .2); }
.danger-button.compact { min-height: 2.75rem; }
.form-error { min-height: 1.2rem; color: var(--danger); margin: 0; font-size: .86rem; text-align: center; }
.privacy-note { color: #73849d; font-size: .75rem; line-height: 1.45; text-align: center; margin: 1.4rem 0 0; }

.app-shell { min-height: 100vh; padding-bottom: 7rem; }
.topbar { height: 5.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 clamp(1rem, 4vw, 3rem); border-bottom: 1px solid var(--line); background: rgba(7, 17, 31, .82); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 20; }
.header-actions, .selection-actions { display: flex; align-items: center; gap: .65rem; }
.soft-button { min-height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; gap: .55rem; padding: 0 1rem; border-radius: .9rem; background: var(--surface-2); border: 1px solid var(--line); font-weight: 700; }
.icon-button { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; border-radius: .9rem; background: var(--surface-2); border: 1px solid var(--line); }
.gallery-main { width: min(100% - 2rem, 92rem); margin: 0 auto; }
.hero-row { display: flex; justify-content: space-between; align-items: end; gap: 1rem; padding: clamp(2rem, 6vw, 4.5rem) 0 2rem; }
.hero-row h1 { font-size: clamp(2.45rem, 7vw, 4.6rem); }
.hero-row > div > p:last-child { color: var(--muted); margin: .75rem 0 0; }
.controls { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.filter-tabs { display: flex; gap: .4rem; padding: .35rem; border-radius: 1rem; background: var(--surface); border: 1px solid var(--line); }
.filter { border: 0; border-radius: .72rem; background: transparent; padding: .65rem .85rem; color: var(--muted); cursor: pointer; font-weight: 700; }
.filter span { margin-left: .35rem; font-size: .74rem; opacity: .72; }
.filter.active { color: white; background: #244873; }
.search-box { min-width: min(24rem, 42vw); height: 3rem; display: flex; align-items: center; gap: .65rem; padding: 0 .9rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--surface); color: var(--muted); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .55rem; }
.media-card { aspect-ratio: 1; border: 0; border-radius: .9rem; padding: 0; overflow: hidden; background: var(--surface); position: relative; cursor: pointer; isolation: isolate; }
.media-card img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .28s ease, opacity .2s ease; }
.media-card:hover img { transform: scale(1.035); }
.media-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.66)); opacity: .75; z-index: 1; pointer-events: none; }
.media-card.selected { outline: 3px solid var(--blue-2); outline-offset: -3px; }
.select-toggle { position: absolute; top: .65rem; right: .65rem; width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 50%; border: 2px solid rgba(255,255,255,.9); background: rgba(4,12,23,.34); color: white; font-weight: 900; z-index: 3; box-shadow: 0 4px 15px rgba(0,0,0,.25); }
.media-card.selected .select-toggle { background: var(--blue); border-color: var(--blue); }
.media-label { position: absolute; left: .75rem; right: .75rem; bottom: .65rem; z-index: 2; color: white; display: flex; align-items: end; justify-content: space-between; gap: .4rem; }
.media-label strong { font-size: .77rem; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-type { flex: none; display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: rgba(0,0,0,.5); font-size: .7rem; }
.media-placeholder { width: 100%; height: 100%; display: grid; place-items: center; background: linear-gradient(145deg, #172944, #0d1828); color: #6c83a5; }
.media-placeholder svg { width: 3rem; }
.loading-state, .empty-state { min-height: 45vh; display: grid; place-content: center; justify-items: center; color: var(--muted); text-align: center; }
.spinner { width: 2rem; height: 2rem; border: 3px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-icon { width: 4.5rem; height: 4.5rem; display: grid; place-items: center; border-radius: 1.4rem; background: var(--surface-2); color: var(--blue-2); }
.empty-icon svg { width: 2.2rem; }
.empty-state h2 { color: var(--text); margin: 1rem 0 .3rem; }
.empty-state p { margin: 0; }

.selection-bar { position: fixed; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 2rem), 52rem); z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1rem; border: 1px solid rgba(133,174,232,.28); border-radius: 1.35rem; background: rgba(14, 28, 48, .94); backdrop-filter: blur(18px); box-shadow: var(--shadow); }
.selection-bar > div:first-child { display: flex; align-items: center; gap: .65rem; }
.selection-bar button { white-space: nowrap; }
#clear-selection { border: 0; background: transparent; color: var(--blue-2); cursor: pointer; }
.primary-button.compact { min-height: 2.75rem; padding: 0 1rem; }

.viewer { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; border: 0; padding: 0; background: rgba(2, 7, 14, .97); color: white; }
.viewer::backdrop { background: #02070e; }
.viewer-stage { width: 100%; height: calc(100% - 5.5rem); display: grid; place-items: center; padding: 4rem clamp(1rem, 8vw, 7rem) 1rem; }
.viewer-stage img, .viewer-stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: .6rem; }
.viewer-close, .viewer-nav { position: fixed; z-index: 2; border: 0; border-radius: 50%; background: rgba(25, 40, 62, .8); color: white; cursor: pointer; }
.viewer-close { width: 2.8rem; height: 2.8rem; top: 1rem; right: 1rem; font-size: 2rem; line-height: 1; }
.viewer-nav { width: 3.2rem; height: 3.2rem; top: 50%; transform: translateY(-50%); font-size: 2.5rem; line-height: 1; }
.viewer-prev { left: 1rem; }.viewer-next { right: 1rem; }
.viewer-footer { height: 5.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 clamp(1rem, 4vw, 3rem); border-top: 1px solid var(--line); background: rgba(7,17,31,.86); }
.viewer-details { min-width: 0; }
.viewer-actions { display: flex; align-items: center; gap: .65rem; flex: none; }
.viewer-footer strong, .viewer-footer small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-footer small { color: var(--muted); margin-top: .25rem; }
.toast { position: fixed; left: 50%; bottom: 1.5rem; z-index: 100; transform: translate(-50%, 150%); padding: .8rem 1rem; background: #eaf2ff; color: #10213a; border-radius: .85rem; box-shadow: var(--shadow); transition: transform .25s ease; font-weight: 700; text-align: center; }
.toast.show { transform: translate(-50%, 0); }

@media (max-width: 700px) {
  .login-shell { padding: 1rem; align-items: center; }
  .login-card { padding: 1.5rem; border-radius: 1.5rem; }
  .brand-login { margin-bottom: 2rem; }
  .topbar { height: 4.8rem; }
  .topbar .brand img { width: 2.5rem; height: 2.5rem; }
  .topbar .brand strong { font-size: 1.45rem; }
  .header-actions .soft-button span, .header-actions .danger-button span { display: none; }
  .header-actions .soft-button, .header-actions .danger-button { width: 2.75rem; padding: 0; }
  .gallery-main { width: min(100% - 1rem, 92rem); }
  .hero-row { padding: 2.2rem .25rem 1.5rem; }
  .controls { align-items: stretch; flex-direction: column; }
  .filter-tabs { width: 100%; }
  .filter { flex: 1; padding-inline: .45rem; }
  .search-box { min-width: 100%; }
  .gallery-grid { grid-template-columns: repeat(3, 1fr); gap: .2rem; }
  .media-card { border-radius: .35rem; }
  .media-label strong { display: none; }
  .media-label { justify-content: flex-end; }
  .selection-bar { align-items: stretch; flex-direction: column; }
  .selection-bar > div:first-child, .selection-actions { justify-content: space-between; width: 100%; }
  .selection-actions .soft-button { font-size: .82rem; }
  .selection-actions { flex-wrap: wrap; }
  .selection-actions > button { flex: 1; }
  #select-visible { flex-basis: 100%; }
  .viewer-nav { width: 2.6rem; height: 2.6rem; opacity: .75; }
  .viewer-prev { left: .35rem; }.viewer-next { right: .35rem; }
  .viewer-footer { height: 6.5rem; }
  .viewer-footer .soft-button, .viewer-footer .danger-button { padding-inline: .7rem; font-size: .78rem; }
  .viewer-actions { gap: .35rem; }
  .viewer-actions span { display: none; }
  .viewer-actions > button { width: 2.75rem; padding: 0; }
  .viewer-stage { height: calc(100% - 6.5rem); padding-inline: 2.4rem; }
}
