@import url("https://fonts.googleapis.com/css2?family=Literata:opsz,wght@7..72,600&family=Space+Grotesk:wght@400;500;700&display=swap");

:root {
    --bg-top: #f3ede2;
    --bg-bottom: #dfe8dc;
    --panel: rgba(255, 255, 255, 0.86);
    --panel-strong: rgba(255, 255, 255, 0.94);
    --line: rgba(23, 43, 35, 0.12);
    --text: #13231c;
    --muted: #5e6d65;
    --accent: #0f6a4f;
    --accent-dark: #0b4f3b;
    --warning: #a15c16;
    --danger: #a23232;
    --shadow: 0 20px 60px rgba(19, 35, 28, 0.12);
    --radius-xl: 30px;
    --radius-lg: 22px;
    --radius-md: 16px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Space Grotesk", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.9), transparent 28%),
        linear-gradient(150deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(19, 35, 28, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(19, 35, 28, 0.04) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent 80%);
}

a {
    color: inherit;
}

.page-shell {
    position: relative;
    z-index: 1;
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 48px 0 64px;
    display: grid;
    gap: 24px;
}

.page-shell--wide {
    width: min(1220px, calc(100% - 32px));
}

.app-body--welcome .page-shell {
    grid-template-columns: minmax(0, 1.1fr) minmax(360px, 460px);
    align-items: stretch;
    min-height: 100vh;
}

.app-body--dashboard .page-shell {
    gap: 20px;
}

.hero-card,
.auth-card,
.panel,
.dashboard-header {
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--panel);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.hero-card {
    padding: 42px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.hero-card::after {
    content: "";
    position: absolute;
    right: -90px;
    bottom: -90px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(15, 106, 79, 0.18) 0%, rgba(15, 106, 79, 0) 72%);
}

.auth-card {
    padding: 34px;
    background: var(--panel-strong);
}

.dashboard-header {
    padding: 24px 28px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.panel {
    padding: 28px;
}

.panel__header,
.auth-card__header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.eyebrow {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 12px;
    color: var(--accent);
}

.hero-title,
.section-title {
    margin: 0;
    font-family: "Literata", serif;
    line-height: 1.02;
}

.hero-title {
    max-width: 12ch;
    font-size: clamp(42px, 7vw, 76px);
}

.section-title {
    font-size: clamp(28px, 3vw, 38px);
}

.hero-text,
.dashboard-subtitle,
.field-note,
.video-card__meta,
.empty-state {
    color: var(--muted);
}

.hero-text {
    max-width: 42ch;
    font-size: 18px;
    line-height: 1.65;
    margin: 20px 0 28px;
}

.hero-stat {
    display: inline-flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 20px;
    max-width: 360px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(15, 106, 79, 0.14);
}

.hero-stat__value {
    font-size: 20px;
    font-weight: 700;
}

.auth-tabs {
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 6px;
    border-radius: 999px;
    background: rgba(19, 35, 28, 0.05);
    margin-bottom: 18px;
}

.auth-tab-button,
.primary-button,
.secondary-button,
.ghost-link {
    appearance: none;
    border: 0;
    background: none;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}

.auth-tab-button {
    padding: 12px 16px;
    border-radius: 999px;
    color: var(--muted);
    transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.auth-tab-button.is-active {
    background: var(--text);
    color: #fff;
    transform: translateY(-1px);
}

.auth-pane {
    display: none;
}

.auth-pane.is-active {
    display: block;
}

.stack-form {
    display: grid;
    gap: 12px;
}

.field-label {
    font-size: 14px;
    font-weight: 700;
}

.text-input {
    width: 100%;
    min-height: 54px;
    padding: 0 18px;
    border-radius: 16px;
    border: 1px solid rgba(19, 35, 28, 0.14);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    font: inherit;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.text-input:focus {
    outline: none;
    border-color: rgba(15, 106, 79, 0.45);
    box-shadow: 0 0 0 4px rgba(15, 106, 79, 0.12);
    transform: translateY(-1px);
}

.input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
}

.primary-button,
.secondary-button,
.ghost-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 0 22px;
    border-radius: 16px;
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, color 160ms ease;
}

.primary-button {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: #fff;
    box-shadow: 0 14px 30px rgba(15, 106, 79, 0.22);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-link:hover {
    transform: translateY(-1px);
}

.primary-button--compact {
    min-width: 160px;
}

.secondary-button {
    border: 1px solid rgba(19, 35, 28, 0.12);
    background: rgba(255, 255, 255, 0.8);
    color: var(--text);
}

.primary-button:disabled,
.secondary-button:disabled {
    cursor: wait;
    opacity: 0.82;
}

.secondary-button--link {
    min-height: 46px;
    padding: 0 18px;
}

.ghost-link {
    min-height: auto;
    padding: 0;
    color: var(--accent-dark);
}

.pill {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(15, 106, 79, 0.1);
    color: var(--accent-dark);
    font-weight: 700;
}

.flash {
    margin-bottom: 16px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid transparent;
    line-height: 1.5;
}

.flash--success {
    background: rgba(15, 106, 79, 0.1);
    border-color: rgba(15, 106, 79, 0.18);
}

.flash--warning {
    background: rgba(161, 92, 22, 0.12);
    border-color: rgba(161, 92, 22, 0.2);
}

.flash--error {
    background: rgba(162, 50, 50, 0.12);
    border-color: rgba(162, 50, 50, 0.2);
}

.inline-feedback {
    display: none;
    padding: 14px 16px;
    border-radius: 16px;
    line-height: 1.5;
}

.inline-feedback.is-visible {
    display: block;
}

.inline-feedback.is-warning {
    background: rgba(161, 92, 22, 0.12);
    color: #7e4b14;
}

.inline-feedback.is-success {
    background: rgba(15, 106, 79, 0.12);
    color: var(--accent-dark);
}

.inline-feedback.is-error {
    background: rgba(162, 50, 50, 0.12);
    color: var(--danger);
}

.inline-feedback a {
    color: inherit;
    font-weight: 700;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

.job-list {
    display: grid;
    gap: 14px;
}

.job-card {
    display: grid;
    gap: 12px;
    padding: 18px;
    border-radius: 22px;
    border: 1px solid rgba(19, 35, 28, 0.12);
    background: rgba(255, 255, 255, 0.78);
}

.job-card.is-active {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 14px 32px rgba(19, 35, 28, 0.08);
}

.job-card__head,
.job-card__stats,
.job-card__actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.job-card__titles {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.job-card__title {
    margin: 0 0 4px;
    font-size: 19px;
    line-height: 1.2;
}

.job-card__url {
    display: block;
    color: var(--accent-dark);
    font-size: 13px;
    line-height: 1.45;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.job-card__message,
.job-card__bytes,
.job-card__error {
    margin: 0;
    line-height: 1.5;
}

.job-card__bytes {
    color: var(--muted);
    font-size: 13px;
}

.job-card__error {
    color: var(--danger);
}

.job-card__preview {
    width: 84px;
    height: 52px;
    border-radius: 14px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(19, 35, 28, 0.08);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.status-pill--queued {
    background: rgba(19, 35, 28, 0.08);
    color: var(--text);
}

.status-pill--running {
    background: rgba(15, 106, 79, 0.12);
    color: var(--accent-dark);
}

.status-pill--completed {
    background: rgba(15, 106, 79, 0.18);
    color: var(--accent-dark);
}

.status-pill--duplicate {
    background: rgba(161, 92, 22, 0.14);
    color: #7e4b14;
}

.status-pill--failed {
    background: rgba(162, 50, 50, 0.14);
    color: var(--danger);
}

.job-progress {
    position: relative;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(19, 35, 28, 0.08);
}

.job-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent) 0%, #58a58d 100%);
    transition: width 260ms ease;
}

.job-card__stats {
    color: var(--muted);
    font-size: 13px;
}

.video-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-radius: 24px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(19, 35, 28, 0.1);
}

.video-card__thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(15, 106, 79, 0.9), rgba(19, 35, 28, 0.78)),
        linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent);
    color: rgba(255, 255, 255, 0.86);
    text-decoration: none;
}

.video-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-card__body {
    display: grid;
    gap: 10px;
    padding: 18px;
}

.video-card__title {
    margin: 0;
    font-size: 19px;
    line-height: 1.3;
}

.video-card__meta {
    margin: 0;
    font-size: 13px;
}

.video-card__source {
    min-width: 0;
    color: var(--accent-dark);
    font-size: 14px;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.video-card__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
}

.empty-state {
    padding: 28px;
    border-radius: 22px;
    border: 1px dashed rgba(19, 35, 28, 0.18);
    background: rgba(255, 255, 255, 0.5);
}

.is-hidden {
    display: none !important;
}

code {
    font-family: "Space Grotesk", sans-serif;
}

@media (max-width: 960px) {
    .app-body--welcome .page-shell {
        grid-template-columns: 1fr;
        min-height: auto;
        padding-top: 28px;
    }

    .hero-card,
    .auth-card,
    .panel,
    .dashboard-header {
        border-radius: 24px;
    }
}

@media (max-width: 720px) {
    .page-shell,
    .page-shell--wide {
        width: min(100% - 20px, 100%);
        padding-bottom: 32px;
    }

    .hero-card,
    .auth-card,
    .panel,
    .dashboard-header {
        padding: 22px;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: stretch;
    }

    .input-row {
        grid-template-columns: 1fr;
    }

    .primary-button--compact,
    .secondary-button,
    .primary-button {
        width: 100%;
    }

    .video-card__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .job-card__head,
    .job-card__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .job-card__titles {
        align-items: flex-start;
    }

    .status-pill {
        width: fit-content;
    }

    .secondary-button--link,
    .ghost-link {
        width: 100%;
    }
}
