:root {
  color-scheme: dark;
  --ink: #f5f8ff;
  --muted: #9da9bc;
  --surface: rgba(13, 19, 29, 0.84);
  --surface-solid: #0d131d;
  --line: rgba(255, 255, 255, 0.11);
  --cyan: #43e7ff;
  --blue: #5686ff;
  --lime: #b6ff6a;
  --danger: #ff6f91;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #070b11; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -15%, rgba(67, 231, 255, 0.12), transparent 37%),
    linear-gradient(180deg, #090e16 0%, #070a10 100%);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}

button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.ambient {
  position: fixed;
  width: 26rem;
  height: 26rem;
  border-radius: 999px;
  filter: blur(110px);
  opacity: 0.08;
  pointer-events: none;
}
.ambient-one { background: var(--cyan); top: 18%; left: -12rem; }
.ambient-two { background: var(--blue); bottom: -12rem; right: -10rem; }

.site-header {
  width: min(1180px, calc(100% - 40px));
  height: 88px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 2;
}

.brand { display: inline-flex; align-items: center; gap: 11px; font-family: Manrope, sans-serif; font-weight: 700; letter-spacing: -0.03em; }
.brand b { color: var(--cyan); }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid rgba(67,231,255,.42); transform: rotate(45deg); border-radius: 7px; }
.brand-mark span { width: 10px; height: 10px; background: var(--cyan); border-radius: 3px; box-shadow: 0 0 20px var(--cyan); }

nav { display: flex; gap: 5px; padding: 5px; border: 1px solid var(--line); background: rgba(255,255,255,.025); border-radius: 999px; }
.nav-link { padding: 8px 18px; border-radius: 999px; color: var(--muted); font-size: .9rem; font-weight: 600; }
.nav-link.active { background: rgba(255,255,255,.09); color: var(--ink); }

.account-actions { justify-self: end; display: flex; align-items: center; gap: 10px; }
.user-badge { color: var(--muted); font-size: .9rem; }

.button {
  border: 0;
  border-radius: 11px;
  min-height: 42px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button-dark { background: var(--ink); color: #080c12; }
.button-ghost { background: rgba(255,255,255,.04); border: 1px solid var(--line); }
.button-primary { color: #061015; background: linear-gradient(135deg, var(--cyan), #77ffcf); box-shadow: 0 10px 30px rgba(67,231,255,.16); }
.button-large { min-height: 54px; width: 100%; }
.button:disabled { opacity: .55; cursor: wait; transform: none; }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; position: relative; z-index: 1; }
.view { min-height: calc(100vh - 160px); }

.upload-view { display: grid; grid-template-columns: .82fr 1.18fr; gap: clamp(42px, 7vw, 96px); align-items: center; padding: 72px 0 54px; }
.eyebrow { display: flex; align-items: center; gap: 10px; color: #b5c0d0; text-transform: uppercase; letter-spacing: .15em; font-size: .74rem; font-weight: 700; }
.eyebrow span { width: 26px; height: 1px; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.intro h1, .gallery-heading h1, .result-card h1 { margin: 20px 0; font-family: Manrope, sans-serif; font-size: clamp(3.2rem, 6vw, 6rem); letter-spacing: -.07em; line-height: .94; }
.intro h1 em { color: var(--cyan); font-style: normal; }
.intro > p { color: var(--muted); font-size: 1.12rem; max-width: 34rem; }

.upload-shell { min-height: 500px; display: flex; align-items: center; }
.drop-zone, .selection-panel {
  width: 100%;
  border: 1px solid rgba(255,255,255,.14);
  background: linear-gradient(145deg, rgba(21,30,44,.9), rgba(11,16,25,.92));
  box-shadow: var(--shadow);
  border-radius: 24px;
}
.drop-zone { min-height: 460px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 42px; text-align: center; outline: none; border-style: dashed; cursor: pointer; transition: border .2s, transform .2s, background .2s; }
.drop-zone:hover, .drop-zone:focus-visible, .drop-zone.dragging { border-color: var(--cyan); background: rgba(20,36,48,.96); transform: translateY(-3px); }
.upload-glyph { width: 76px; height: 76px; display: grid; place-items: center; border-radius: 22px; background: rgba(67,231,255,.1); border: 1px solid rgba(67,231,255,.22); margin-bottom: 25px; }
.upload-glyph svg { width: 34px; fill: none; stroke: var(--cyan); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.drop-zone h2 { margin: 0 0 7px; font-family: Manrope, sans-serif; font-size: 1.55rem; }
.drop-zone p { margin: 0 0 24px; color: var(--muted); }
.drop-zone p span { color: var(--cyan); font-weight: 700; }
.drop-zone small { color: #718096; }

.selection-panel { padding: 30px; }
.selection-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.section-label { color: var(--cyan); text-transform: uppercase; letter-spacing: .14em; font-size: .7rem; font-weight: 800; }
.selection-heading h2 { margin: 6px 0 0; font-family: Manrope, sans-serif; font-size: 1.4rem; }
.icon-button { border: 1px solid var(--line); background: transparent; color: var(--muted); width: 38px; height: 38px; border-radius: 10px; cursor: pointer; font-size: 1.4rem; }
.preview-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; margin: 24px 0; }
.preview { aspect-ratio: 1; border-radius: 11px; overflow: hidden; background: #090d14; border: 1px solid var(--line); }
.preview img { width: 100%; height: 100%; object-fit: cover; }
.preview-more { display: grid; place-items: center; color: var(--muted); font-weight: 700; }

.member-options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 20px 0; border-top: 1px solid var(--line); }
.field-group label, .login-dialog label { display: block; color: #c7d0dd; font-size: .82rem; font-weight: 700; margin-bottom: 8px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; background: rgba(0,0,0,.24); border: 1px solid var(--line); border-radius: 11px; }
.segmented button { border: 0; background: transparent; color: var(--muted); border-radius: 8px; min-height: 39px; cursor: pointer; font-size: .85rem; font-weight: 700; }
.segmented button.active { background: rgba(255,255,255,.1); color: var(--ink); }
select, .login-dialog input { width: 100%; min-height: 49px; border-radius: 11px; background: rgba(0,0,0,.24); border: 1px solid var(--line); color: var(--ink); padding: 0 13px; outline: none; }
select:focus, .login-dialog input:focus { border-color: var(--cyan); }
.privacy-note { display: flex; gap: 11px; align-items: center; padding: 15px; margin: 8px 0 20px; background: rgba(67,231,255,.055); border: 1px solid rgba(67,231,255,.13); border-radius: 11px; color: #aeb9c9; font-size: .82rem; }
.privacy-note svg { width: 20px; flex: 0 0 auto; fill: none; stroke: var(--cyan); stroke-width: 1.6; }

.trust-row { grid-column: 1 / -1; display: flex; justify-content: center; gap: 36px; color: #6f7b8c; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.trust-row b { color: var(--cyan); margin-right: 7px; }

.gallery-view { padding: 74px 0; }
.gallery-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 44px; }
.gallery-heading h1 { font-size: clamp(3rem, 5vw, 5rem); margin-bottom: 12px; }
.gallery-heading p { color: var(--muted); margin: 0; }
.gallery-grid { columns: 4 230px; column-gap: 15px; }
.gallery-card { break-inside: avoid; margin: 0 0 15px; border-radius: 15px; overflow: hidden; position: relative; background: var(--surface-solid); border: 1px solid var(--line); }
.gallery-card img { display: block; width: 100%; min-height: 140px; object-fit: cover; transition: transform .3s ease; }
.gallery-card:hover img { transform: scale(1.025); }
.gallery-meta { position: absolute; inset: auto 0 0; padding: 30px 13px 12px; display: flex; justify-content: space-between; align-items: end; gap: 8px; background: linear-gradient(transparent, rgba(2,5,9,.9)); opacity: 0; transition: opacity .2s; }
.gallery-card:hover .gallery-meta, .gallery-card:focus-within .gallery-meta { opacity: 1; }
.gallery-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
.gallery-meta button { border: 0; background: rgba(255,255,255,.13); color: white; border-radius: 8px; padding: 7px 9px; cursor: pointer; }
.empty-state { text-align: center; padding: 100px 20px; color: var(--muted); }
.empty-icon { color: var(--cyan); font-size: 4rem; }
.empty-state h2 { color: var(--ink); }

.result-view { display: grid; place-items: center; padding: 70px 0; }
.result-card { width: min(720px, 100%); padding: 42px; border: 1px solid var(--line); background: var(--surface); border-radius: 24px; box-shadow: var(--shadow); }
.result-card h1 { font-size: clamp(2.4rem, 5vw, 4rem); margin: 12px 0 30px; }
.success-mark { float: right; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: rgba(182,255,106,.1); border: 1px solid rgba(182,255,106,.3); color: var(--lime); font-size: 1.4rem; }
.result-item { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; padding: 11px; border: 1px solid var(--line); border-radius: 13px; margin-bottom: 10px; }
.result-item img { width: 64px; height: 54px; object-fit: cover; border-radius: 8px; background: #070a10; }
.result-url { min-width: 0; }
.result-url strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; }
.result-url span { display: block; color: var(--muted); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-button { border: 1px solid var(--line); background: rgba(255,255,255,.05); color: var(--ink); padding: 9px 12px; border-radius: 9px; cursor: pointer; }
.result-actions { display: flex; gap: 10px; margin-top: 24px; }

.login-dialog { width: min(440px, calc(100% - 30px)); max-height: 90vh; overflow-y: auto; padding: 0; color: var(--ink); background: #101722; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.login-dialog::backdrop { background: rgba(2,5,9,.75); backdrop-filter: blur(7px); }
.login-dialog form { padding: 34px; }
.dialog-close { float: right; border: 0; background: transparent; color: var(--muted); font-size: 1.5rem; cursor: pointer; }
.login-dialog h2 { font-family: Manrope, sans-serif; font-size: 2rem; margin: 7px 0 5px; }
.login-dialog p { color: var(--muted); margin: 0 0 25px; }
.login-dialog input { margin-bottom: 16px; }
.login-dialog .button { margin-top: 8px; }
.login-dialog .form-error { color: var(--danger); margin: 0 0 8px; font-size: .86rem; }
.login-dialog .optional { color: var(--muted); font-weight: 500; }
.login-dialog .auth-switch { margin: 18px 0 0; text-align: center; font-size: .9rem; }
.auth-switch button { border: 0; padding: 0; background: transparent; color: var(--cyan); font: inherit; font-weight: 800; cursor: pointer; }
.auth-switch button:hover { text-decoration: underline; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 120px); opacity: 0; background: #f7f9fc; color: #090d14; padding: 12px 17px; border-radius: 11px; box-shadow: var(--shadow); z-index: 20; font-weight: 700; transition: .25s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

footer { width: min(1180px, calc(100% - 40px)); min-height: 72px; margin: 0 auto; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; color: #667284; font-size: .78rem; }

@media (max-width: 880px) {
  .site-header { grid-template-columns: 1fr auto; }
  .site-header nav { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 10; background: rgba(12,18,27,.92); backdrop-filter: blur(16px); box-shadow: var(--shadow); }
  .account-actions .user-badge, #dashboardLink { display: none !important; }
  .upload-view { grid-template-columns: 1fr; padding-top: 48px; }
  .intro { text-align: center; }
  .intro .eyebrow { justify-content: center; }
  .intro > p { margin-left: auto; margin-right: auto; }
  .upload-shell { min-height: unset; }
  .trust-row { flex-wrap: wrap; gap: 12px 24px; padding-bottom: 55px; }
  .gallery-heading { align-items: start; }
}

@media (max-width: 580px) {
  .site-header, main, footer { width: min(100% - 24px, 1180px); }
  .site-header { height: 72px; }
  .brand { font-size: .93rem; }
  .brand-mark { width: 26px; height: 26px; }
  .account-actions .button { padding: 0 13px; }
  .intro h1 { font-size: 3.3rem; }
  .drop-zone { min-height: 380px; padding: 24px; }
  .selection-panel { padding: 20px; }
  .preview-strip { grid-template-columns: repeat(4, 1fr); }
  .member-options { grid-template-columns: 1fr; }
  .gallery-heading { display: block; }
  .gallery-heading .button { margin-top: 22px; }
  .gallery-grid { columns: 2 140px; }
  .gallery-meta { opacity: 1; }
  .result-card { padding: 25px; }
  .result-item { grid-template-columns: 52px 1fr; }
  .result-item img { width: 52px; height: 48px; }
  .result-item .copy-button { grid-column: 1 / -1; width: 100%; }
  .result-actions { flex-direction: column; }
  footer { padding-bottom: 80px; }
}
