/* TikDL — monochrome editorial brutalism.
   Giant tight type, pill outline buttons, dark glass cards, bracket labels.
   Light is default; body.light is toggled by script.js (dark otherwise). */

:root {
    --bg: #0e0e0e;
    --ink: #ececec;
    --muted: #8d8d8d;
    --line: #ececec;
    --card-a: #2c2c2c;
    --card-b: #151515;
    --card-ink: #ececec;
    --accent: #fe2c55;
    --topbar-height: 58px;
    --menu-width: 300px;
}
body.light {
    --bg: #d9d9d9;
    --ink: #0a0a0a;
    --muted: #555555;
    --line: #0a0a0a;
    --card-a: #3b3b3b;
    --card-b: #121212;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Inter Tight', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    min-height: 100vh;
    padding-top: var(--topbar-height);
    display: flex; flex-direction: column;
    overflow-x: hidden;
}
/* film grain */
body::before {
    content: ''; position: fixed; inset: 0; z-index: 500; pointer-events: none; opacity: .16; mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .7 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
body:not(.light)::before { mix-blend-mode: screen; opacity: .07; }

a { color: inherit; }
button, input { font-family: inherit; }

/* ---------- Pill (shared) ---------- */
.pill, .burger-btn, .theme-toggle, .btn-submit, .btn {
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: transparent; color: var(--ink);
    text-transform: uppercase; letter-spacing: .02em; font-weight: 600;
    cursor: pointer;
    transition: background-color .15s, color .15s;
}

/* ---------- Topbar ---------- */
.topbar {
    position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-height);
    display: flex; align-items: center; gap: .7rem;
    padding: 0 1.25rem;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    z-index: 100;
}
.topbar-brand { order: 1; flex: 1; display: flex; align-items: center; gap: 0; font-size: .95rem; font-weight: 800; letter-spacing: -.01em; text-transform: uppercase; }
.topbar-brand i { display: none; }
.topbar-brand b { font-weight: 800; }
.topbar-brand::after { content: '.'; margin-left: 1px; }
.topbar-actions { order: 2; display: flex; }
.burger-btn { order: 3; }

.burger-btn, .theme-toggle { width: 38px; height: 28px; display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.burger-btn { flex-direction: column; gap: 4px; padding: 0 11px; }
.burger-btn span { display: block; width: 100%; height: 1.5px; background: var(--ink); transition: background-color .15s; }
.burger-btn:hover, .theme-toggle:hover { background: var(--ink); color: var(--bg); }
.burger-btn:hover span { background: var(--bg); }

/* ---------- Drawer ---------- */
.menu-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 200; opacity: 0; pointer-events: none; transition: opacity .2s; }
.menu-overlay.active { opacity: 1; pointer-events: all; }
.side-menu {
    position: fixed; top: 0; left: 0; width: min(var(--menu-width), 88vw); height: 100vh; height: 100dvh;
    background: linear-gradient(160deg, var(--card-a), var(--card-b)); color: var(--card-ink);
    z-index: 300; transform: translateX(-105%);
    transition: transform .3s cubic-bezier(.77, 0, .175, 1);
    display: flex; flex-direction: column; overflow-y: auto;
}
.side-menu.open { transform: translateX(0); }
.side-menu-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.18); }
.side-menu-title { font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.side-menu-title::before { content: '[ '; } .side-menu-title::after { content: ' ]'; }
.close-btn { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid #ececec; background: transparent; color: #ececec; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.close-btn:hover { background: #ececec; color: #111; }
.side-menu-body { padding: 1.25rem; flex: 1; }
.menu-section { margin-bottom: 1.6rem; }
.menu-section-label { font-size: .68rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #8d8d8d; margin-bottom: .6rem; }
.menu-item { display: flex; align-items: center; gap: .65rem; padding: .7rem .9rem; margin-bottom: .5rem; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; text-decoration: none; color: #ececec; font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; transition: background-color .15s, color .15s; }
.menu-item i { font-size: 1.1rem; flex-shrink: 0; }
.menu-item span:nth-child(2) { flex: 1; }
.menu-item:hover, .menu-item.active { background: #ececec; color: #111; }
.menu-badge { font-size: .58rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; border: 1px solid currentColor; border-radius: 999px; padding: .1rem .45rem; }
.about-card { border: 1px solid rgba(255,255,255,.22); border-radius: 4px; padding: 1rem; }
.about-logo { display: flex; align-items: center; gap: .5rem; font-weight: 800; text-transform: uppercase; margin-bottom: .5rem; }
.about-desc { font-size: .8rem; line-height: 1.5; color: #b5b5b5; margin-bottom: .8rem; }
.about-version { display: flex; justify-content: space-between; align-items: center; font-size: .72rem; font-weight: 600; text-transform: uppercase; }
.version-badge { border: 1px solid currentColor; border-radius: 999px; padding: .05rem .5rem; }
.about-divider { height: 1px; background: rgba(255,255,255,.18); margin: .8rem 0; }
.about-footer { font-size: .74rem; text-align: center; color: #8d8d8d; }
.about-footer a { color: #ececec; font-weight: 600; }

/* ---------- Hero ---------- */
.hero { padding: 2.2rem 1.25rem 1.5rem; }
.hero-grid { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 1fr; gap: 2.2rem; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.5fr 1fr; gap: 3rem; align-items: end; } }

.card-eyebrow { font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 1rem; }
.hero h2 { font-size: clamp(3.4rem, 19vw, 9.5rem); font-weight: 800; line-height: .82; letter-spacing: -.055em; margin-bottom: 2rem; }
.card-sub { font-size: 1.05rem; font-weight: 800; line-height: 1.05; letter-spacing: -.01em; text-transform: uppercase; margin-bottom: .8rem; }
.hero-note { max-width: 36ch; font-size: .8rem; line-height: 1.45; color: var(--muted); margin-bottom: 1.6rem; }

form { display: flex; flex-direction: column; gap: .8rem; max-width: 520px; }
.input-group { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 999px; padding: .25rem .3rem .25rem 1.1rem; }
.input-group:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.input-group input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--ink); font-size: .95rem; font-weight: 500; padding: .6rem 0; }
.input-group input::placeholder { color: var(--muted); }
.btn-paste { width: 38px; height: 38px; flex-shrink: 0; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: 1.1rem; cursor: pointer; }
.btn-paste:hover, .btn-paste.pasted { background: var(--accent); color: #fff; }
.btn-submit { padding: .85rem 1.4rem; background: var(--ink); color: var(--bg); font-size: .9rem; letter-spacing: .08em; -webkit-appearance: none; appearance: none; }
.btn-submit:hover:not(:disabled) { background: transparent; color: var(--ink); }
.btn-submit:disabled { opacity: .45; cursor: not-allowed; }

/* dark glass cards */
.specs { display: grid; grid-template-columns: 1fr; gap: .8rem; }
@media (min-width: 560px) and (max-width: 899px) { .specs { grid-template-columns: 1fr 1fr; } }
.spec, .content ol li, .download-options, .messageError {
    background: linear-gradient(145deg, var(--card-a), var(--card-b));
    color: var(--card-ink);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 4px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 8px 24px rgba(0,0,0,.18);
}
.spec { padding: .9rem 1rem 1rem; }
.spec h4 { font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; margin-bottom: .6rem; }
.spec ul { list-style: none; font-size: .72rem; line-height: 1.5; color: #c9c9c9; }
.spec li { position: relative; padding-left: .9rem; margin-bottom: .25rem; }
.spec li::before { content: ''; position: absolute; left: .1rem; top: .55em; width: 3px; height: 3px; background: #c9c9c9; border-radius: 50%; }

/* status strip */
.strip { overflow: hidden; white-space: nowrap; background: rgba(0,0,0,.18); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
body:not(.light) .strip { background: rgba(255,255,255,.05); }
.strip-track { display: inline-flex; gap: 2.2rem; padding: .7rem 0; font-size: .7rem; font-weight: 600; letter-spacing: .08em; animation: strip 28s linear infinite; }
@keyframes strip { to { transform: translateX(-50%); } }

/* ---------- Content ---------- */
.container { width: 100%; max-width: calc(1180px + 2.5rem); margin: 0 auto; padding: 2rem 1.25rem 1rem; flex: 1; }
.content { width: 100%; }

.content ol { list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
@media (min-width: 800px) { .content ol { grid-template-columns: repeat(4, 1fr); } }
.content ol li { counter-increment: step; padding: .9rem 1rem 1.1rem; font-size: .8rem; line-height: 1.4; min-height: 7.5rem; }
.content ol li::before { content: '[ ' counter(step, decimal-leading-zero) ' ]'; display: block; margin-bottom: 1.8rem; font-size: .7rem; font-weight: 600; letter-spacing: .1em; color: #8d8d8d; }
.content ol b { font-weight: 800; }

.loading { display: flex; flex-direction: column; gap: .8rem; padding: 1rem 0; max-width: 520px; }
.loading-label { font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.loading-label::before { content: '[ '; } .loading-label::after { content: ' ]'; }
.loading-bar-wrap { height: 4px; background: rgba(128,128,128,.35); overflow: hidden; border-radius: 4px; }
.loading-bar { height: 100%; width: 35%; background: var(--ink); animation: slide 1s ease-in-out infinite alternate; }
@keyframes slide { from { margin-left: 0; } to { margin-left: 65%; } }
.loading-dots { display: none; }

/* ---------- Result ---------- */
.result-wrap { display: grid; grid-template-columns: 1fr; gap: 1.4rem; align-items: start; }
@media (min-width: 800px) { .result-wrap { grid-template-columns: 300px 1fr; gap: 2rem; } }
.video-info { grid-column: 1 / -1; }
.video-info h3 { font-size: clamp(1.5rem, 5vw, 3rem); font-weight: 800; line-height: .95; letter-spacing: -.045em; text-transform: uppercase; word-break: break-word; }
.video-info p { margin-top: .6rem; font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; gap: .3rem; align-items: center; }

.video-container { background: #000; border-radius: 4px; overflow: hidden; display: flex; justify-content: center; }
.video-container video { width: 100%; max-height: 70vh; display: block; }

.download-section { min-width: 0; }
.download-options { display: flex; flex-direction: column; gap: .7rem; padding: 1rem; }
.download-options::before { content: '[ FILES ]'; font-size: .7rem; font-weight: 600; letter-spacing: .1em; color: #8d8d8d; margin-bottom: .2rem; }
.download-item { display: flex; flex-direction: column; gap: .35rem; }

.btn { width: 100%; display: flex; align-items: center; gap: .6rem; padding: .85rem 1.2rem; font-size: .82rem; text-align: left; border-color: #ececec; color: #ececec; -webkit-appearance: none; appearance: none; }
.btn i { font-size: 1.05rem; }
.btn::after { content: '↓'; margin-left: auto; font-size: 1.1rem; }
.btn:hover:not(:disabled) { background: #ececec; color: #111; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-hd { background: #ececec; color: #111; }
.btn-hd:hover:not(:disabled) { background: transparent; color: #ececec; }

.dl-progress-wrap { display: none; height: 3px; background: rgba(255,255,255,.2); }
.dl-progress-wrap.active { display: block; }
.dl-progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .15s linear; }
.dl-progress-bar.indeterminate { width: 40%; animation: slide 1s ease-in-out infinite alternate; }
.dl-progress-label { display: none; font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #c9c9c9; }
.dl-progress-label.active { display: block; }
.download-hint { margin-top: .9rem; font-size: .72rem; color: var(--muted); display: flex; gap: .35rem; align-items: center; }

.photo-gallery { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
@media (min-width: 800px) { .photo-gallery { grid-template-columns: repeat(4, 1fr); } }
.photo-item { position: relative; aspect-ratio: 3 / 4; border-radius: 4px; overflow: hidden; background: #222; }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; filter: grayscale(1) contrast(1.05); transition: filter .25s; }
.photo-item:hover img { filter: none; }
.photo-item .btn-photo-dl { position: absolute; right: 8px; bottom: 8px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: #ececec; color: #111; font-size: 1.1rem; cursor: pointer; }
.photo-item .btn-photo-dl:hover { background: var(--accent); color: #fff; }
.result-wrap:has(.photo-gallery) .download-section { grid-column: 1 / -1; }

.messageError { display: flex; gap: .6rem; align-items: flex-start; padding: .9rem 1rem; margin-bottom: 1.4rem; font-size: .85rem; font-weight: 600; border-left: 4px solid var(--accent); max-width: 520px; }
.messageError i { font-size: 1.1rem; color: var(--accent); flex-shrink: 0; }

/* ---------- Footer ---------- */
footer { display: flex; justify-content: center; padding: 2rem 1rem 2.2rem; }
.btn-script { text-decoration: none; text-align: center; }
footer h3 { font-weight: 600; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
footer b { color: var(--ink); font-weight: 800; }
footer p { font-size: .65rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

:focus-visible { outline: 2px dashed var(--accent); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
