/* ================================================================
   TWITCHER CSS — Redesigned UI
   Aesthetic: Scientific precision meets clean modern tooling.
   Palette: Deep slate + electric cyan accent, warm off-white surface.
   Fonts:  Syne (headings) · JetBrains Mono (data/code)
   ================================================================ */

/* ── Custom properties ─────────────────────────────────────── */
:root {
    --bg: #0f1117;
    --surface: #171c27;
    --surface-2: #1e2435;
    --surface-3: #252d40;
    --border: rgba(255, 255, 255, 0.07);
    --border-mid: rgba(255, 255, 255, 0.12);

    --accent: #3fefb4; /* electric mint/cyan */
    --accent-dim: rgba(63, 239, 180, 0.12);
    --accent-glow: 0 0 18px rgba(63, 239, 180, 0.25);

    --text: #e2e8f0;
    --text-mid: #94a3b8;
    --text-dim: #4b5a72;

    --danger: #f87171;
    --warn: #fbbf24;
    --ok: #34d399;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;

    --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Syne', system-ui, sans-serif;
    font-size: 14px;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Animated background ───────────────────────────────────── */
.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image: linear-gradient(rgba(63, 239, 180, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(63, 239, 180, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

.bg-grid::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(63, 239, 180, 0.06) 0%, transparent 60%);
}

/* ── App shell ─────────────────────────────────────────────── */
.app-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ────────────────────────────────────────────────── */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: rgba(23, 28, 39, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    animation: slideDown 0.4s ease both;
}
.settings-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 34px;
    padding: 0.35rem 0.75rem;

    border-radius: 999px;

    border: 1px solid var(--border-mid);
    background: var(--surface-2);

    color: var(--text-mid);

    font-family: 'Syne', system-ui, sans-serif;
    font-size: 0.75rem;
    font-weight: 700;

    cursor: pointer;

    transition:
        background var(--transition),
        color var(--transition),
        border-color var(--transition),
        transform var(--transition);
}

.settings-toggle:hover {
    background: var(--surface-3);
    color: var(--text);
    border-color: rgba(63, 239, 180, 0.35);
    transform: translateY(-1px);
}


.settings-toggle:active {
    transform: translateY(0);
}

.settings-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 999px;
    background: none;
    color: var(--accent, #38bdf8);
    font-size: 1.05rem;
    line-height: 1;
}

.settings-toggle-text {
    white-space: nowrap;
}

.settings-toggle-icon svg {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.logo-mark {
    width: 40px;
    height: 40px;
    background: var(--accent-dim);
    border: 1px solid rgba(63, 239, 180, 0.2);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--accent-glow);
    animation: pulse-border 4s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% {
        box-shadow: 0 0 10px rgba(63, 239, 180, 0.15);
    }
    50% {
        box-shadow: 0 0 22px rgba(63, 239, 180, 0.35);
    }
}

.app-title {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: #fff;
    line-height: 1;
}

.app-subtitle {
    font-size: 0.7rem;
    color: var(--text-dim);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-top: 2px;
}

.app-tagline {
    font-size: 0.6rem;
    color: var(--text-dim);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.1em;
    margin-top: 3px;
    white-space: nowrap;
}

.app-tagline span {
    color: var(--accent);
    font-weight: 600;
}

/* Stage nav */
.stage-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stage-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    opacity: 0.35;
}

.stage-item.active,
.stage-item.font-medium { /* compat with JS setStage */
    opacity: 1;
    background: var(--accent-dim);
    border: 1px solid rgba(63, 239, 180, 0.25);
}

.stage-item.text-gray-400 {
    opacity: 0.35;
    background: none;
    border: none;
}

.stage-item.text-gray-800 {
    opacity: 1;
    background: var(--accent-dim);
    border: 1px solid rgba(63, 239, 180, 0.25);
}

.stage-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.04em;
}

.stage-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
}

.stage-sep {
    width: 20px;
    height: 1px;
    background: var(--border-mid);
}

/* ── Main content ──────────────────────────────────────────── */
.app-main {
    flex: 1;
    padding: 1.25rem 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── Demo mode badge ──────────────────────────────────────────── */
.demo-mode-badge {
    position: fixed;
    bottom: 10px;
    right: 14px;
    z-index: 500;

    padding: 0.2rem 0.6rem;
    border-radius: 999px;

    border: 1px solid var(--border-mid);
    background: var(--surface-2);
    color: var(--text-mid);

    font-family: 'Syne', system-ui, sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;

    pointer-events: none;
    opacity: 0.85;
}

.demo-mode-badge[hidden] {
    display: none;
}
