:root {
    --bg: #101820;
    --bg-2: #161f29;
    --surface: #1b2532;
    --surface-2: #243040;
    --line: rgba(255, 255, 255, .08);
    --text: #fefefe;
    --muted: #9aa3ad;
    --accent: #fff500;
    --accent-2: #e6dd00;
    --accent-ink: #101820;
    --danger: #ff5f56;
    --radius: 18px;
    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --font: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.45;
    background: var(--bg);
    color: var(--text);
    padding-bottom: calc(96px + var(--sab));
    -webkit-tap-highlight-color: transparent;
}
img, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

/* ---------- hero ---------- */
.hero {
    position: relative;
    min-height: min(62svh, 560px);
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    isolation: isolate;
}
.hero__bg, .hero__bg img {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: 50% 45%;
    z-index: -2;
}
.hero::after {
    content: "";
    position: absolute; inset: 0; z-index: -1;
    background:
        linear-gradient(180deg, rgba(16, 24, 32, .25) 0%, rgba(16, 24, 32, .05) 30%, rgba(16, 24, 32, .55) 65%, var(--bg) 100%);
}
.hero__inner {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: calc(24px + var(--sat)) 20px 28px;
}
.hero__brand {
    display: inline-flex; align-items: center; gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: 600; font-size: 13px; letter-spacing: .04em; text-transform: uppercase;
    opacity: .9;
    margin: 0 0 10px;
}
.hero__brand svg { width: 18px; height: 25px; color: var(--accent); filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); }
.hero__title {
    margin: 0;
    font-weight: 900;
    font-size: clamp(56px, 15vw, 128px);
    line-height: .9;
    letter-spacing: -.045em;
    text-transform: uppercase;
    color: var(--text);
    text-shadow: 0 6px 30px rgba(0, 0, 0, .45);
}
.hero__title span { color: var(--accent); }
.hero__sub {
    margin: 12px 0 4px;
    font-size: clamp(18px, 4.5vw, 24px);
    font-weight: 600;
    text-shadow: 0 2px 12px rgba(0, 0, 0, .5);
}
.hero__stats { margin: 0; color: rgba(254, 254, 254, .8); font-weight: 500; font-size: 15px; min-height: 1.4em; }

/* ---------- filters ---------- */
.main { max-width: 1100px; margin: 0 auto; padding: 0 0 24px; }
.filters {
    position: sticky; top: 0; z-index: 20;
    display: flex; gap: 8px; align-items: center;
    padding: 12px 16px;
    background: rgba(16, 24, 32, .82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.chip {
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 999px;
    padding: 8px 16px;
    font-weight: 600; font-size: 14px;
    transition: background .15s, color .15s, transform .1s;
}
.chip:active { transform: scale(.97); }
.chip.is-active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip--ghost { margin-left: auto; width: 38px; height: 38px; padding: 0; display: grid; place-items: center; }
.chip--ghost svg { width: 18px; height: 18px; }
.chip--ghost.is-spinning svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- gallery ---------- */
.gallery { padding: 0 3px; }
.day { margin: 0 0 14px; }
.day__head {
    position: sticky; top: 62px; z-index: 10;
    margin: 0; padding: 10px 14px 8px;
    font-size: 15px; font-weight: 700;
    color: var(--text);
    background: linear-gradient(180deg, rgba(16,24,32,.95), rgba(16,24,32,.75) 70%, transparent);
}
.day__head small { font-weight: 500; color: var(--muted); margin-left: 8px; text-transform: none; }
.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
}
@media (min-width: 520px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 760px) { .grid { grid-template-columns: repeat(5, 1fr); gap: 4px; } .gallery { padding: 0 8px; } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(6, 1fr); } }
.tile {
    position: relative;
    aspect-ratio: 1;
    padding: 0; border: 0;
    background: var(--surface);
    overflow: hidden;
    border-radius: 4px;
}
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
@media (hover: hover) { .tile:hover img { transform: scale(1.04); } }
.tile--novid {
    display: grid; place-items: center;
    background: linear-gradient(135deg, #243040, #16202b);
}
.tile--novid svg { width: 34%; height: 34%; color: rgba(255,255,255,.75); }
.tile--noimg { display: grid; place-items: center; background: linear-gradient(135deg, #2a2f3a, #181f28); }
.tile--noimg svg { width: 30%; height: 30%; color: rgba(255,255,255,.55); }
.tile__badge {
    position: absolute; right: 6px; bottom: 6px;
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 7px;
    border-radius: 6px;
    background: rgba(0, 0, 0, .6);
    font-size: 11px; font-weight: 700;
    backdrop-filter: blur(4px);
}
.tile__badge svg { width: 10px; height: 10px; }
.tile--new { animation: pop .4s ease; }
@keyframes pop { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }

/* ---------- empty ---------- */
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty__icon { font-size: 48px; }
.empty h2 { color: var(--text); margin: 8px 0 4px; }
.empty p { max-width: 320px; margin: 0 auto 20px; }

.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 12px 20px 8px; }
.footer p { margin: 4px 0; }
.footer a, .footer__name { color: var(--accent); text-decoration: none; font-weight: 600; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: 700; font-size: 15px;
    text-decoration: none;
    transition: transform .1s, filter .15s, background .15s;
    min-height: 46px;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn--accent { background: var(--accent); color: var(--accent-ink); }
.btn--accent:hover { filter: brightness(.95); }
.btn--glass { background: rgba(255, 255, 255, .1); color: var(--text); border-color: var(--line); backdrop-filter: blur(8px); }
.btn--glass:hover { background: rgba(255, 255, 255, .16); }
.btn--ghost { background: var(--surface-2); color: var(--text); }
.btn--lg { padding: 14px 20px; font-size: 16px; min-height: 52px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; margin-top: 14px; }

.iconbtn {
    width: 40px; height: 40px;
    border: 0; border-radius: 50%;
    background: var(--surface-2); color: var(--text);
    display: grid; place-items: center;
    font-size: 16px; font-weight: 700;
}

/* ---------- action bar ---------- */
.actionbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex; gap: 10px;
    padding: 12px 16px calc(12px + var(--sab));
    background: linear-gradient(180deg, transparent, rgba(16, 24, 32, .92) 40%);
    pointer-events: none;
}
.actionbar .btn { pointer-events: auto; flex: 1; box-shadow: 0 8px 30px rgba(0, 0, 0, .45); }

@media (min-width: 700px) {
    .actionbar { justify-content: center; }
    .actionbar .btn { flex: 0 1 240px; }
}

/* ---------- sheets (dialogs) ---------- */
.sheet {
    border: 0; padding: 0;
    width: 100%; max-width: 560px;
    margin: auto auto 0;
    background: var(--bg-2);
    color: var(--text);
    border-radius: 24px 24px 0 0;
    max-height: calc(100dvh - 24px);
    box-shadow: 0 -10px 60px rgba(0, 0, 0, .6);
    padding: 8px 20px calc(20px + var(--sab));
    overflow: auto;
}
@media (min-width: 700px) {
    .sheet { margin: auto; border-radius: 24px; padding-bottom: 24px; }
}
.sheet::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px); }
.sheet[open] { animation: slideUp .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet[open], .tile--new { animation: none; } }
.sheet__handle { width: 44px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.2); margin: 6px auto 12px; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet__head h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.sheet__hint { color: var(--muted); font-size: 13px; margin: 16px 0 0; }

.field { display: block; margin: 8px 0 14px; }
.field span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field small { color: var(--muted); font-weight: 400; }
.field input {
    width: 100%;
    font: inherit; font-size: 17px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    outline: none;
}
.field input:focus { border-color: var(--accent); }
.upload__summary { margin: 0; color: var(--muted); font-weight: 500; }

/* progress bars */
.bar {
    width: 100%; height: 8px;
    appearance: none; -webkit-appearance: none;
    border: 0; border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
}
.bar::-webkit-progress-bar { background: var(--surface-2); border-radius: 999px; }
.bar::-webkit-progress-value { background: var(--accent); border-radius: 999px; transition: width .2s; }
.bar::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.bar--big { height: 14px; }
.bar.is-done::-webkit-progress-value { background: #3ddc84; }
.bar.is-done::-moz-progress-bar { background: #3ddc84; }
.bar.is-error::-webkit-progress-value { background: var(--danger); }
.bar.is-error::-moz-progress-bar { background: var(--danger); }
.bar:indeterminate::-webkit-progress-bar { background: linear-gradient(90deg, var(--surface-2) 0 40%, var(--accent) 50%, var(--surface-2) 60% 100%) 0 0 / 300% 100%; animation: indet 1.2s linear infinite; }
.bar:indeterminate::-moz-progress-bar { background: var(--accent); animation: indet 1.2s linear infinite; }
@keyframes indet { from { background-position: 100% 0; } to { background-position: 0 0; } }

.upload__overall { padding: 14px; border-radius: 16px; background: var(--surface); }
.upload__overallText { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; font-size: 17px; }
.upload__overallText span { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent); font-size: 22px; }
.upload__meta { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.upload__hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.upload__overall.is-done .upload__overallText span { color: #3ddc84; }

.filelist { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.file {
    display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center;
    padding: 8px 10px 8px 8px;
    background: var(--surface); border-radius: 14px;
}
.file__thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; font-size: 22px; overflow: hidden; }
.file__thumb img { width: 100%; height: 100%; object-fit: cover; }
.file__info { min-width: 0; }
.file__name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file__status { color: var(--muted); font-size: 12px; margin: 2px 0 6px; font-variant-numeric: tabular-nums; }
.file .bar { height: 6px; }
.file__pct { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; min-width: 40px; text-align: right; color: var(--muted); }
.file.is-done .file__pct { color: #3ddc84; }
.file.is-error .file__pct { color: var(--danger); }
.file__remove { border: 0; background: transparent; color: var(--muted); font-size: 18px; padding: 6px; }

/* download sheet */
.dl__options { display: grid; gap: 8px; }
.dl__opt {
    display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px;
    padding: 14px; border: 1px solid var(--line); border-radius: 16px;
    background: var(--surface); text-align: left;
}
.dl__opt:hover { background: var(--surface-2); }
.dl__icon { font-size: 26px; text-align: center; }
.dl__text { display: grid; }
.dl__text strong { font-size: 16px; }
.dl__text small { color: var(--muted); font-size: 13px; }
.dl__chev { font-size: 24px; color: var(--muted); }
.dl__status { display: grid; gap: 14px; padding: 6px 0; }
.dl__status p { margin: 0; font-weight: 600; }

/* ---------- lightbox ---------- */
.lightbox {
    border: 0; padding: 0; margin: 0;
    width: 100vw; height: 100dvh; max-width: none; max-height: none;
    background: #000; color: var(--text);
    display: none;
    grid-template-rows: auto 1fr auto;
    overflow: hidden;
}
.lightbox[open] { display: grid; }
.lightbox::backdrop { background: #000; }
.lb__top, .lb__bottom {
    position: relative; z-index: 2;
    display: flex; align-items: center; justify-content: space-between;
    padding: calc(10px + var(--sat)) 14px 10px;
    background: linear-gradient(180deg, rgba(0,0,0,.6), transparent);
}
.lb__bottom {
    flex-direction: column; align-items: stretch; gap: 10px;
    padding: 10px 14px calc(14px + var(--sab));
    background: linear-gradient(0deg, rgba(0,0,0,.7), transparent);
}
.lb__counter { font-weight: 700; font-variant-numeric: tabular-nums; }
.iconbtn--lb { background: rgba(255,255,255,.12); }
.lb__stage { display: grid; place-items: center; min-height: 0; min-width: 0; touch-action: pan-y; position: relative; overflow: hidden; }
.lb__stage > * { min-width: 0; min-height: 0; }
.lb__stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.lb__stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.lb__nopreview { display: grid; gap: 10px; place-items: center; text-align: center; color: var(--muted); padding: 24px; max-width: 360px; }
.lb__nopreview svg { width: 64px; height: 64px; color: rgba(255,255,255,.5); }
.lb__nopreview strong { color: var(--text); font-size: 17px; }
.lb__nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    z-index: 3;
    width: 48px; height: 72px;
    border: 0; border-radius: 12px;
    background: rgba(0,0,0,.35); color: #fff;
    font-size: 40px; line-height: 1;
    display: none;
}
.lb__nav--prev { left: 12px; } .lb__nav--next { right: 12px; }
@media (hover: hover) and (min-width: 700px) { .lb__nav { display: grid; place-items: center; } }
.lb__caption { font-size: 14px; color: rgba(255,255,255,.85); text-align: center; }
.lb__caption strong { color: #fff; }
.lb__actions { display: flex; justify-content: center; gap: 10px; }
.lbtn {
    display: inline-flex; flex-direction: column; align-items: center; gap: 4px;
    min-width: 84px; padding: 8px 10px;
    border: 0; border-radius: 12px;
    background: rgba(255,255,255,.1); color: #fff;
    font-size: 12px; font-weight: 600; text-decoration: none;
}
.lbtn svg { width: 22px; height: 22px; }
.lbtn--danger { color: var(--danger); }
.lb__loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); pointer-events: none; }

/* toast */
.toast {
    position: fixed; left: 50%; bottom: calc(100px + var(--sab)); z-index: 60;
    transform: translateX(-50%);
    max-width: calc(100vw - 32px);
    padding: 12px 18px;
    border-radius: 14px;
    background: var(--text); color: var(--accent-ink);
    font-weight: 600; font-size: 14px;
    box-shadow: 0 10px 40px rgba(0,0,0,.5);
    animation: pop .25s ease;
}
.toast--error { background: var(--danger); color: #fff; }

/* thanks */
.thanks {
    margin-top: 14px;
    padding: 20px 18px;
    border-radius: 16px;
    text-align: center;
    background: linear-gradient(135deg, rgba(255, 245, 0, .16), rgba(255, 245, 0, .04));
    border: 1px solid rgba(255, 245, 0, .35);
    animation: pop .45s cubic-bezier(.2, .8, .2, 1);
}
.thanks__emoji { font-size: 34px; letter-spacing: .1em; margin-bottom: 8px; }
.thanks__text { margin: 0; font-size: 19px; font-weight: 800; line-height: 1.3; letter-spacing: -.01em; }
.thanks__text span { color: var(--accent); }

/* ---------- intro ---------- */
.intro {
    position: fixed; inset: 0; z-index: 100;
    display: grid; place-content: center; justify-items: center;
    gap: 6px;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    cursor: pointer;
    animation: introOut .6s ease 2.9s forwards;
}
.intro.is-done { display: none; }
.intro__sun {
    position: absolute; left: 50%; top: 50%; z-index: -1;
    width: 40vmax; height: 40vmax; border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 245, 0, .28), rgba(255, 245, 0, 0) 70%);
    transform: translate(-50%, -50%) scale(0);
    animation: sun 1.6s cubic-bezier(.2, .8, .2, 1) .2s forwards;
}
.intro__logo { width: clamp(72px, 18vw, 120px); color: var(--accent); filter: drop-shadow(0 10px 40px rgba(255, 245, 0, .35)); }
.intro__logo svg { width: 100%; height: auto; display: block; }
.intro__logo--emoji { width: auto; font-size: clamp(64px, 16vw, 110px); line-height: 1; }
.intro__logo svg path {
    stroke: var(--accent); stroke-width: 6; fill: var(--accent); fill-opacity: 0;
    stroke-dasharray: 1400; stroke-dashoffset: 1400;
    animation: draw 1.1s ease-out .1s forwards, fillIn .5s ease .9s forwards;
}
.intro__logo { animation: logoPop .6s cubic-bezier(.2, .9, .3, 1.4) 0s both, logoUp .5s ease 1.3s forwards; }
.intro__word {
    display: flex; gap: .01em;
    font-weight: 900; font-size: clamp(38px, 11vw, 88px);
    letter-spacing: -.04em; line-height: 1;
    text-transform: uppercase;
}
.intro__word span { display: inline-block; opacity: 0; transform: translateY(.6em) rotate(6deg); animation: letter .5s cubic-bezier(.2, .8, .2, 1) forwards; }
.intro__word span.y { color: var(--accent); }
.intro__word span:nth-child(1) { animation-delay: 1.15s; }
.intro__word span:nth-child(2) { animation-delay: 1.20s; }
.intro__word span:nth-child(3) { animation-delay: 1.25s; }
.intro__word span:nth-child(4) { animation-delay: 1.30s; }
.intro__word span:nth-child(5) { animation-delay: 1.35s; }
.intro__word span:nth-child(6) { animation-delay: 1.40s; }
.intro__word span:nth-child(7) { animation-delay: 1.45s; }
.intro__word span:nth-child(8) { animation-delay: 1.50s; }
.intro__word span:nth-child(9) { animation-delay: 1.55s; }
.intro__word span:nth-child(10) { animation-delay: 1.60s; }
.intro__tag {
    margin: 10px 0 0;
    font-size: clamp(16px, 4.2vw, 22px); font-weight: 600;
    color: rgba(254, 254, 254, .85);
    opacity: 0; transform: translateY(10px);
    animation: letter .6s ease 2.0s forwards;
}
@keyframes logoPop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes logoUp { to { transform: translateY(-6px) scale(.92); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fillIn { to { fill-opacity: 1; } }
@keyframes sun { to { transform: translate(-50%, -50%) scale(1); } }
@keyframes letter { to { opacity: 1; transform: none; } }
@keyframes introOut { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
    .intro { animation-delay: 1.2s; animation-duration: .3s; }
    .intro__logo, .intro__logo svg path, .intro__sun { animation: none; fill-opacity: 1; stroke-dashoffset: 0; transform: none; }
    .intro__word span, .intro__tag { animation-duration: .2s; animation-delay: .1s; }
}
