:root {
    --bg: #111113;
    --surface: #1a1a1e;
    --surface-2: #222228;
    --border: #2e2e36;
    --border-strong: #3d3d48;
    --text: #f2f2f4;
    --text-muted: #9b9ba8;
    --accent: #e8e2d6;
    --accent-ink: #141414;
    --focus: #c9b896;
    --success: #8fbc8f;
    --error: #d98989;
    --radius: 10px;
    --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

.page {
    width: min(100% - 2rem, 640px);
    margin: 0 auto;
    padding: 3.5rem 0 4rem;
}

.header {
    margin-bottom: 1.75rem;
}

.eyebrow {
    margin: 0 0 0.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.header h1 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.75rem, 4vw, 2.1rem);
    font-weight: 650;
    letter-spacing: -0.03em;
    color: var(--text);
}

.lede {
    margin: 0;
    max-width: 34rem;
    color: var(--text-muted);
    font-size: 0.98rem;
}

.panel {
    padding: 1.15rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.label {
    display: block;
    margin-bottom: 0.55rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.controls {
    display: grid;
    gap: 0.7rem;
}

input[type="url"],
input[type="text"] {
    width: 100%;
    min-width: 0;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder {
    color: #6f6f7a;
}

input:focus {
    border-color: var(--focus);
    box-shadow: 0 0 0 3px rgba(201, 184, 150, 0.18);
}

.actions {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.6rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0 1rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-secondary {
    color: var(--text);
    background: var(--surface-2);
    border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--border-strong);
    background: #2a2a31;
}

.btn-primary {
    color: var(--accent-ink);
    background: var(--accent);
}

.btn-primary:hover:not(:disabled) {
    background: #f1ecdf;
}

.btn-spinner {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid rgba(20, 20, 20, 0.2);
    border-top-color: var(--accent-ink);
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.status {
    margin-top: 0.85rem;
    padding: 0.7rem 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.status.error {
    color: #f0c4c4;
    border-color: rgba(217, 137, 137, 0.45);
    background: rgba(217, 137, 137, 0.08);
}

.status.success {
    color: #c8e6c8;
    border-color: rgba(143, 188, 143, 0.4);
    background: rgba(143, 188, 143, 0.08);
}

.hidden {
    display: none !important;
}

.skeleton-list,
.result-list {
    margin-top: 1rem;
    display: grid;
    gap: 0.85rem;
}

.skeleton-item,
.media-item {
    padding: 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.skeleton-block {
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 8px;
    background: var(--surface-2);
}

.skeleton-row {
    margin-top: 0.75rem;
    height: 2.5rem;
    border-radius: 8px;
    background: var(--surface-2);
}

.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.04),
        transparent
    );
    animation: shimmer 1.35s infinite;
}

@keyframes shimmer {
    100% { transform: translateX(100%); }
}

.media-frame {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #0c0c0e;
}

.media-type {
    position: absolute;
    top: 0.55rem;
    left: 0.55rem;
    z-index: 1;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(17, 17, 19, 0.85);
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.media-item video,
.media-item img {
    display: block;
    width: 100%;
    max-height: 460px;
    object-fit: contain;
    background: #0c0c0e;
}

.media-actions {
    margin-top: 0.8rem;
    display: flex;
}

.btn-dl {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-dl:hover {
    background: #2d2d35;
    border-color: #4a4a56;
}

@media (min-width: 560px) {
    .controls {
        grid-template-columns: 1fr auto;
        align-items: stretch;
    }

    .actions {
        grid-template-columns: auto auto;
    }
}
