@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
    --bg: #f4f7fb;
    --bg-accent: rgba(37, 99, 235, .06);
    --surface: rgba(255, 255, 255, .86);
    --surface-strong: #ffffff;
    --border: rgba(15, 23, 42, .08);
    --text: #0f172a;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-2: #3b82f6;
    --shadow: 0 12px 30px rgba(15, 23, 42, .08);
    --shadow-soft: 0 8px 18px rgba(15, 23, 42, .06);
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

html.dark-mode {
    --bg: #08111f;
    --bg-accent: rgba(96, 165, 250, .08);
    --surface: rgba(15, 23, 42, .82);
    --surface-strong: #0f172a;
    --border: rgba(148, 163, 184, .12);
    --text: #e2e8f0;
    --muted: #94a3b8;
    --primary: #60a5fa;
    --primary-2: #3b82f6;
    --shadow: 0 14px 34px rgba(0, 0, 0, .28);
    --shadow-soft: 0 8px 16px rgba(0, 0, 0, .18);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    min-height: 100%;
    color-scheme: light;
}

html.dark-mode {
    color-scheme: dark;
}

body {
    min-height: 100vh;
    font-family: "Inter", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, .10), transparent 28%),
        radial-gradient(circle at bottom right, rgba(59, 130, 246, .10), transparent 32%),
        var(--bg);
    background-attachment: fixed;
}

button,
input,
select {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.navbar {
    min-height: 68px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, .32);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}

html.dark-mode .navbar {
    background: rgba(8, 17, 31, .7);
}

.brand {
    color: var(--primary);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .2px;
}

.theme-switch {
    position: relative;
    width: 84px;
    height: 40px;
    flex-shrink: 0;
    cursor: pointer;
}

.theme-switch input {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}

.theme-slider {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, #dbeafe, #fef3c7);
    border: 1px solid rgba(255, 255, 255, .55);
    box-shadow: var(--shadow-soft);
    transition: background .25s ease, border-color .25s ease;
}

.theme-icon {
    position: relative;
    z-index: 1;
    font-size: 14px;
    user-select: none;
}

.theme-switch-knob {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .18);
    transition: transform .25s ease, background .25s ease;
}

.theme-switch input:checked + .theme-slider {
    background: linear-gradient(135deg, #111827, #1d4ed8);
}

.theme-switch input:checked + .theme-slider .theme-switch-knob {
    transform: translateX(44px);
    background: #dbeafe;
}

.page {
    width: min(1100px, calc(100% - 24px));
    margin: 0 auto;
    padding: 72px 0 42px;
}

.downloader-card {
    width: min(720px, 100%);
    margin: 0 auto;
    padding: 28px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.downloader-card h1 {
    text-align: center;
    color: var(--primary);
    font-size: clamp(24px, 4.8vw, 36px);
    line-height: 1.2;
    letter-spacing: -.4px;
}

.subtitle {
    margin-top: 10px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.form-group {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.platform-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.platform-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .3px;
    text-transform: uppercase;
}

.platform-picker {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.platform-card {
    min-height: 66px;
    padding: 10px 8px;
    border: 1px solid transparent;
    border-radius: 16px;
    background: rgba(255, 255, 255, .35);
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

html.dark-mode .platform-card {
    background: rgba(15, 23, 42, .6);
}

.platform-card:hover {
    transform: translateY(-1px);
    border-color: rgba(37, 99, 235, .18);
}

.platform-card.active {
    background: rgba(37, 99, 235, .10);
    border-color: rgba(37, 99, 235, .28);
    box-shadow: 0 10px 22px rgba(37, 99, 235, .12);
}

html.dark-mode .platform-card.active {
    background: rgba(96, 165, 250, .14);
    border-color: rgba(96, 165, 250, .28);
}

.platform-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(37, 99, 235, .10);
    color: var(--primary);
    font-size: 15px;
    font-weight: 800;
}

.platform-name {
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.platform-native-select {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

#url {
    width: 100%;
    height: 54px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    outline: none;
    background: rgba(255, 255, 255, .82);
    color: var(--text);
    box-shadow: var(--shadow-soft);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

html.dark-mode #url {
    background: rgba(15, 23, 42, .8);
}

#url::placeholder {
    color: #94a3b8;
}

#url:focus {
    border-color: rgba(37, 99, 235, .45);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}

#downloadBtn {
    width: 100%;
    min-height: 52px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #ffffff;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(37, 99, 235, .22);
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}

#downloadBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(37, 99, 235, .28);
}

#downloadBtn:active {
    transform: scale(.985);
}

#downloadBtn:disabled {
    opacity: .68;
    cursor: not-allowed;
    transform: none;
}

#result {
    width: 100%;
    margin-top: 4px;
}

.result-card {
    margin-top: 8px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface-strong);
    box-shadow: var(--shadow);
}

.result-thumbnail {
    display: block;
    width: 100%;
    max-height: 360px;
    object-fit: cover;
    border-radius: 16px;
    background: rgba(148, 163, 184, .12);
}

.result-title {
    margin-top: 14px;
    color: var(--text);
    font-size: 18px;
    line-height: 1.45;
    font-weight: 800;
    word-break: break-word;
}

.result-meta {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.result-meta span {
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(37, 99, 235, .08);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

html.dark-mode .result-meta span {
    background: rgba(148, 163, 184, .10);
}

.result-actions {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-inline {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.media-download-btn {
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: rgba(37, 99, 235, .10);
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
    box-shadow: var(--shadow-soft);
    transition: transform .15s ease, background .15s ease, border-color .15s ease;
}

.media-download-btn:hover {
    transform: translateY(-1px);
    background: rgba(37, 99, 235, .14);
    border-color: rgba(37, 99, 235, .18);
}

.media-download-btn:active {
    transform: scale(.985);
}

html.dark-mode .media-download-btn {
    background: rgba(15, 23, 42, .7);
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, .10);
}

html.dark-mode .media-download-btn:hover {
    background: rgba(30, 41, 59, .82);
    border-color: rgba(96, 165, 250, .18);
}

.features {
    width: min(720px, 100%);
    margin: 18px auto 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.feature-card {
    padding: 18px 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.feature-card h3 {
    color: var(--primary);
    font-size: 14px;
    line-height: 1.3;
    font-weight: 800;
}

.feature-card p {
    margin-top: 8px;
    color: var(--muted);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -.2px;
}

footer {
    padding: 26px 16px 34px;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

@media (max-width: 768px) {
    .navbar {
        padding: 0 16px;
    }

    .brand {
        font-size: 17px;
    }

    .page {
        width: min(100% - 18px, 720px);
        padding-top: 24px;
    }

    .downloader-card {
        padding: 20px 14px;
        border-radius: 18px;
    }

    .platform-picker {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .features {
        grid-template-columns: 1fr;
    }

    .result-inline {
        grid-template-columns: 1fr;
    }

    .result-thumbnail {
        max-height: 300px;
    }
}
