*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --border: #2a2f3a;
    --text: #e8eaed;
    --muted: #9aa0a6;
    --accent: #4f8cff;
    --accent-hover: #3a7ae8;
    --accent-glow: rgba(79, 140, 255, 0.25);
    --gradient-start: #4f8cff;
    --gradient-end: #7c5cff;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 17, 23, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-link img {
    height: 40px;
    width: auto;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface);
    border-color: #3c4043;
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    padding: 0.5rem 0.75rem;
}

.btn-ghost:hover {
    color: var(--text);
}

/* Hero */
.hero {
    position: relative;
    padding: 5rem 0 4rem;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -40%;
    left: 50%;
    transform: translateX(-50%);
    width: 900px;
    height: 600px;
    background: radial-gradient(ellipse, rgba(79, 140, 255, 0.15) 0%, rgba(124, 92, 255, 0.08) 40%, transparent 70%);
    pointer-events: none;
}

.hero-grid {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    align-items: center;
}

@media (min-width: 768px) {
    .hero-grid {
        grid-template-columns: 1.2fr 1fr;
    }
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.875rem;
    background: rgba(79, 140, 255, 0.12);
    border: 1px solid rgba(79, 140, 255, 0.25);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent);
    margin-bottom: 1.25rem;
}

.hero-badge svg {
    width: 14px;
    height: 14px;
}

.hero h1 {
    margin: 0 0 1rem;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.hero h1 span {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-tagline {
    font-size: 1.125rem;
    color: var(--muted);
    max-width: 540px;
    margin: 0 0 2rem;
}

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.hero-visual {
    display: flex;
    justify-content: center;
}

.hero-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}

.hero-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.75rem;
    color: var(--muted);
}

.hero-card-dots {
    display: flex;
    gap: 4px;
}

.hero-card-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
}

.hero-card-dots span:first-child { background: #f28b82; }
.hero-card-dots span:nth-child(2) { background: #fdd663; }
.hero-card-dots span:nth-child(3) { background: #81c995; }

.stream-preview {
    aspect-ratio: 16 / 9;
    background: linear-gradient(145deg, #12151c 0%, #1e2433 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.stream-preview::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.5));
}

.play-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(79, 140, 255, 0.2);
    border: 2px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.play-ring svg {
    width: 24px;
    height: 24px;
    margin-left: 3px;
    fill: var(--accent);
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
}

.stat {
    text-align: center;
    padding: 0.75rem 0.5rem;
    background: rgba(15, 17, 23, 0.6);
    border-radius: 8px;
}

.stat-value {
    display: block;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 0.6875rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Features */
.features {
    padding: 4rem 0;
}

.section-title {
    text-align: center;
    margin-bottom: 2.5rem;
}

.section-title h2 {
    margin: 0 0 0.5rem;
    font-size: 1.75rem;
    font-weight: 700;
}

.section-title p {
    margin: 0;
    color: var(--muted);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: border-color 0.2s, transform 0.2s;
}

.feature-card:hover {
    border-color: rgba(79, 140, 255, 0.4);
    transform: translateY(-2px);
}

.feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(79, 140, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--accent);
}

.feature-icon svg {
    width: 22px;
    height: 22px;
}

.feature-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.feature-card p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--muted);
}

/* Company */
.company {
    padding: 4rem 0;
}

.company-card {
    background: linear-gradient(135deg, rgba(26, 29, 39, 0.95) 0%, rgba(26, 29, 39, 0.6) 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: center;
}

@media (min-width: 768px) {
    .company-card {
        grid-template-columns: auto 1fr;
    }
}

.company-logo img {
    height: 56px;
}

.company-card h2 {
    margin: 0 0 0.75rem;
    font-size: 1.5rem;
}

.company-card p {
    margin: 0 0 1rem;
    color: var(--muted);
}

.company-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 500;
}

.company-link svg {
    width: 16px;
    height: 16px;
}

/* CTA band */
.cta-band {
    padding: 3rem 0 5rem;
}

.cta-inner {
    background: linear-gradient(135deg, rgba(79, 140, 255, 0.15) 0%, rgba(124, 92, 255, 0.1) 100%);
    border: 1px solid rgba(79, 140, 255, 0.25);
    border-radius: 16px;
    padding: 2.5rem;
    text-align: center;
}

.cta-inner h2 {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
}

.cta-inner p {
    margin: 0 0 1.5rem;
    color: var(--muted);
}

.cta-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 2rem 0;
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.footer-copy {
    margin: 0;
    font-size: 0.875rem;
    color: var(--muted);
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
}

.footer-links a {
    color: var(--muted);
}

.footer-links a:hover {
    color: var(--text);
}

/* App / Dashboard / Admin */
.app-body {
    min-height: 100vh;
}

.app-header {
    background: var(--surface);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.app-header h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.header-user {
    font-size: 0.875rem;
    color: var(--muted);
}

.app-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem;
}

.app-main-wide {
    max-width: 1200px;
}

.card {
    background: var(--surface);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.card h2 {
    margin: 0 0 1rem;
    font-size: 1.125rem;
    font-weight: 600;
}

label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    color: var(--muted);
}

input,
select,
textarea {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 1rem;
    background: var(--bg);
    border: 1px solid #3c4043;
    color: var(--text);
    border-radius: 4px;
    font: inherit;
}

textarea {
    resize: vertical;
}

.app-header .btn,
.card .btn,
.app-table .btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 0.875rem;
    font-weight: 500;
    transform: none;
    box-shadow: none;
}

.app-header .btn:hover,
.card .btn:hover,
.app-table .btn:hover {
    background: var(--accent-hover);
    text-decoration: none;
    transform: none;
}

.app-header .btn-secondary,
.card .btn-secondary,
.app-table .btn-secondary {
    background: #3c4043;
    border: none;
}

.app-header .btn-secondary:hover,
.card .btn-secondary:hover,
.app-table .btn-secondary:hover {
    background: #4a4f57;
}

.btn-danger {
    background: #c5221f !important;
}

.btn-danger:hover {
    background: #a31815 !important;
}

.app-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.app-table th,
.app-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.app-table th {
    color: var(--muted);
    font-weight: 500;
}

.col-poster {
    width: 72px;
}

.video-poster {
    width: 64px;
    height: 36px;
    object-fit: cover;
    border-radius: 4px;
    background: #000;
    display: block;
}

.video-poster-placeholder {
    width: 64px;
    height: 36px;
    border-radius: 4px;
    background: linear-gradient(145deg, #12151c 0%, #1e2433 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--muted);
}

.tags {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.tag {
    background: var(--border);
    padding: 0.125rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
}

.tag-error {
    color: #f28b82;
    border: 1px solid rgba(242, 139, 130, 0.35);
}

.status-ready { color: #81c995; }
.status-failed { color: #f28b82; }
.status-processing,
.status-pending { color: #fdd663; }

.progress-bar {
    margin-top: 0.375rem;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    max-width: 140px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--gradient-end));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-label {
    display: block;
    font-size: 0.6875rem;
    color: var(--muted);
    margin-top: 0.125rem;
}

.upload-progress-bar {
    max-width: none;
    height: 10px;
}

.progress-step {
    font-size: 0.6875rem;
    color: var(--muted);
    margin-top: 0.25rem;
    max-width: 160px;
    word-break: break-word;
}

.actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.inline-form {
    display: inline;
}

.text-muted {
    font-size: 0.875rem;
    color: var(--muted);
    margin: 0;
}

.msg-ok {
    border-color: #81c995;
    color: #81c995;
}

.msg-err {
    border-color: #f28b82;
    color: #f28b82;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.url-cell {
    font-size: 0.8125rem;
    word-break: break-all;
}

#player-wrap video {
    width: 100%;
    max-height: 480px;
    background: #000;
    border-radius: 4px;
}

/* Toasts */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: min(420px, calc(100vw - 2rem));
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.875rem 1rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.875rem;
    animation: toast-in 0.25s ease;
    transition: opacity 0.3s, transform 0.3s;
}

.toast strong {
    font-weight: 600;
}

.toast-success {
    border-color: rgba(129, 201, 149, 0.5);
    border-left: 3px solid #81c995;
}

.toast-error {
    border-color: rgba(242, 139, 130, 0.5);
    border-left: 3px solid #f28b82;
}

.toast-hide {
    opacity: 0;
    transform: translateX(1rem);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(1rem);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
