:root {
    --bg: #0f172a;
    --bg-soft: #111827;
    --card: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.08);
    --text: #e5e7eb;
    --muted: #94a3b8;
    --primary: #22c55e;
    --primary-dark: #16a34a;
    --accent: #38bdf8;
    --danger: #f87171;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    --radius: 16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 10% 10%, rgba(34, 197, 94, 0.18), transparent 35%),
        radial-gradient(circle at 90% 0%, rgba(56, 189, 248, 0.15), transparent 30%),
        linear-gradient(180deg, #0b1220, #111827 40%, #0f172a);
}

.page { max-width: 980px; margin: 0 auto; padding: 24px 16px 48px; }

.hero-inner {
    display: grid;
    gap: 20px;
    grid-template-columns: 1.2fr 0.8fr;
    align-items: stretch;
}

@media (max-width: 820px) {
    .hero-inner { grid-template-columns: 1fr; }
}

.brand-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
    font-size: 12px;
    margin-bottom: 10px;
}

.brand h1 { margin: 0 0 8px; font-size: clamp(1.6rem, 4vw, 2.2rem); }
.brand p { margin: 0; color: var(--muted); line-height: 1.6; }

.auth-card, .panel {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.auth-card { padding: 18px; }

.auth-status { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.auth-status.ok { color: #86efac; }
.auth-status.warn { color: #fde68a; }

.login-form label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }

.login-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    align-items: center;
}

.login-form-actions .btn {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-buy {
    background: rgba(251, 191, 36, 0.16);
    color: #fde68a;
    border: 1px solid rgba(251, 191, 36, 0.35);
}

.btn-buy:hover {
    background: rgba(251, 191, 36, 0.26);
    color: #fef3c7;
}

.login-form input,
textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(15, 23, 42, 0.75);
    color: var(--text);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.login-form input:focus,
textarea:focus {
    border-color: rgba(34, 197, 94, 0.55);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

textarea { resize: vertical; min-height: 180px; line-height: 1.5; font-family: inherit; }

.hint { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.hint code { color: #cbd5e1; }

.main { margin-top: 24px; display: grid; gap: 18px; }
.panel { padding: 18px; }
.panel-title { margin: 0; font-size: 16px; }

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.btn-sm { padding: 6px 12px; font-size: 12px; }

.history-tip {
    margin: 0 0 12px;
    font-size: 12px;
    color: var(--muted);
}

.history-list { display: grid; gap: 8px; }

.history-empty {
    font-size: 13px;
    color: var(--muted);
    padding: 12px 0;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(15, 23, 42, 0.45);
}

.history-item.active {
    border-color: rgba(34, 197, 94, 0.45);
    background: rgba(34, 197, 94, 0.08);
}

.history-meta { flex: 1; min-width: 180px; }

.history-time {
    font-size: 13px;
    color: #e2e8f0;
    margin-bottom: 4px;
}

.history-summary {
    font-size: 12px;
    color: var(--muted);
}

.history-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.btn {
    border: none;
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: transform .15s, opacity .15s, background .15s;
}

.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #052e16; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); color: #ecfdf5; }

.btn-accent { background: rgba(56, 189, 248, 0.18); color: #bae6fd; border: 1px solid rgba(56, 189, 248, 0.35); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid rgba(255,255,255,.12); }

.trial-tip { margin: 12px 0 0; font-size: 13px; color: var(--muted); }

.result-item {
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 12px;
    background: rgba(15, 23, 42, 0.45);
}

.result-item.fail { border-color: rgba(248, 113, 113, 0.35); }

.result-url {
    font-size: 13px;
    color: #cbd5e1;
    word-break: break-all;
    margin-bottom: 10px;
}

.media-grid { display: grid; gap: 10px; }

.media-card {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255,255,255,.04);
}

.media-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.media-meta { font-size: 13px; color: var(--muted); }
.media-meta strong { color: #e2e8f0; }

.poster {
    width: 96px;
    height: 54px;
    object-fit: cover;
    border-radius: 8px;
    background: #1e293b;
}

.footer { margin-top: 28px; text-align: center; color: var(--muted); font-size: 13px; }

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%) translateY(120%);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255,255,255,.12);
    color: #f8fafc;
    padding: 10px 16px;
    border-radius: 999px;
    opacity: 0;
    transition: .25s ease;
    z-index: 1000;
    max-width: calc(100vw - 32px);
    text-align: center;
    font-size: 14px;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.logged-panel p { margin: 0 0 10px; font-size: 14px; color: #bbf7d0; }
