:root {
    --bg: #0a0f1a;
    --bg-elevated: #111827;
    --panel: #151d2e;
    --border: rgba(255, 255, 255, 0.08);
    --text: #f1f5f9;
    --muted: #94a3b8;
    --primary: #d946ef;
    --primary-hover: #c026d3;
    --accent: #f472b6;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(217, 70, 239, 0.18), transparent 35%),
        radial-gradient(circle at bottom right, rgba(244, 114, 182, 0.12), transparent 30%),
        var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a {
    color: var(--accent);
}

code {
    font-size: 0.85em;
    background: rgba(255, 255, 255, 0.06);
    padding: 0.15em 0.4em;
    border-radius: 6px;
}

.auth-page {
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(100%, 440px);
    background: rgba(21, 29, 46, 0.95);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
}

.brand {
    text-align: center;
    margin-bottom: 28px;
}

.brand-icon {
    display: inline-grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(217, 70, 239, 0.35), rgba(244, 114, 182, 0.2));
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.brand h1,
.hero h1,
.panel-header h2 {
    margin: 0 0 8px;
}

.brand p,
.muted,
.subtitle,
.section-desc {
    color: var(--muted);
}

.muted.small {
    font-size: 0.85rem;
}

.auth-footnote {
    margin-top: 20px;
    font-size: 0.85rem;
    text-align: center;
}

.login-form label {
    display: block;
    margin-bottom: 16px;
}

.login-form span {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--muted);
}

.login-form input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
}

.topbar {
    border-bottom: 1px solid var(--border);
    background: rgba(10, 15, 26, 0.85);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-brand strong {
    display: block;
}

.subtitle {
    font-size: 0.85rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-pill {
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.hero h1 {
    font-size: 1.5rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.panel h3 {
    margin: 0 0 4px;
    font-size: 1.1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

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

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

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    text-decoration: none;
    padding: 8px 12px;
}

.btn-block {
    width: 100%;
}

.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-top: 16px;
    font-size: 0.95rem;
}

.alert-error {
    background: rgba(248, 113, 113, 0.15);
    border: 1px solid rgba(248, 113, 113, 0.35);
    color: #fecaca;
}

.alert-success {
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.3);
    color: #a7f3d0;
}

.alert-info {
    background: rgba(244, 114, 182, 0.1);
    border: 1px solid rgba(244, 114, 182, 0.25);
    color: #fbcfe8;
}

.hidden {
    display: none !important;
}

.upload-zone .drop-area {
    border: 2px dashed rgba(217, 70, 239, 0.45);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-zone .drop-area.dragover {
    border-color: var(--accent);
    background: rgba(244, 114, 182, 0.06);
}

.drop-title {
    font-size: 1.1rem;
    margin: 0 0 8px;
}

.preview-canvas {
    max-width: 100%;
    max-height: 220px;
    border-radius: 10px;
    margin-bottom: 12px;
}

.frame-strip {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 12px;
}

.frame-thumb {
    width: 96px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.media-info {
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--muted);
}

.upload-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.panel-wide {
    grid-column: 1 / -1;
}

.summary-text {
    font-size: 1.05rem;
    margin: 0;
}

.hero .badge,
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
}

.badge-high {
    background: rgba(52, 211, 153, 0.15);
    color: #6ee7b7;
}

.badge-medium {
    background: rgba(251, 191, 36, 0.15);
    color: #fcd34d;
}

.badge-low {
    background: rgba(148, 163, 184, 0.15);
    color: #cbd5e1;
}

.result-block {
    margin-top: 12px;
}

.result-block h4 {
    margin: 0 0 6px;
    font-size: 0.95rem;
    color: var(--muted);
}

.result-block ul {
    margin: 0;
    padding-left: 1.2rem;
}

.prompt-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
}

.tab-btn.active {
    background: rgba(217, 70, 239, 0.2);
    border-color: rgba(217, 70, 239, 0.45);
    color: var(--text);
}

.prompt-box {
    position: relative;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
}

.prompt-box h4 {
    margin: 0 0 10px;
    font-size: 0.9rem;
    color: var(--muted);
}

.prompt-box pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
    line-height: 1.45;
}

.copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-size: 0.8rem;
    cursor: pointer;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.tag {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.8rem;
    color: var(--muted);
}

.builder-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.builder-options label span,
.builder-options label {
    display: block;
}

.builder-options span {
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--muted);
}

.builder-options select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
}

.enhance-btn {
    margin-top: 16px;
}

.text-builder-panel {
    border-color: rgba(217, 70, 239, 0.25);
}

.remix-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.custom-instruction {
    display: block;
    margin-bottom: 12px;
}

.custom-instruction span {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--muted);
}

.custom-instruction textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
}

.vary-summary {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 10px;
    background: rgba(217, 70, 239, 0.08);
    border: 1px solid rgba(217, 70, 239, 0.25);
    font-size: 0.95rem;
}

.limitations-list {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--muted);
}

.limitations-list li {
    margin-bottom: 8px;
}

@media (max-width: 768px) {
    .results-grid {
        grid-template-columns: 1fr;
    }

    .panel-wide {
        grid-column: auto;
    }
}
