:root {
    --sl-bg: #0a0a0f;
    --sl-bg2: #111118;
    --sl-surface: rgba(255, 255, 255, 0.08);
    --sl-border: rgba(255, 255, 255, 0.1);
    --sl-text: #f4f4f5;
    --sl-muted: #a1a1aa;
    --sl-indigo: #6366f1;
    --sl-pink: #ec4899;
    --sl-green: #22c55e;
    --sl-red: #ef4444;
    --sl-safe-b: env(safe-area-inset-bottom, 0px);
    --sl-safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--sl-bg);
    color: var(--sl-text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
    overscroll-behavior: none;
}

body {
    padding-top: var(--sl-safe-t);
    padding-bottom: var(--sl-safe-b);
}

#app {
    min-height: 100dvh;
}

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

.sl-screen {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.sl-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--sl-border);
    background: rgba(10, 10, 15, 0.92);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.sl-header h1 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    flex: 1;
}

.sl-btn {
    appearance: none;
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--sl-indigo);
    color: #fff;
}

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

.sl-btn-ghost {
    background: var(--sl-surface);
    color: var(--sl-text);
    border: 1px solid var(--sl-border);
}

.sl-btn-green { background: rgba(34, 197, 94, 0.2); color: var(--sl-green); }
.sl-btn-red { background: rgba(239, 68, 68, 0.15); color: var(--sl-red); }

.sl-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--sl-border);
    background: var(--sl-surface);
    color: var(--sl-text);
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sl-content {
    flex: 1;
    padding: 16px;
    overflow: auto;
}

.sl-card {
    background: var(--sl-surface);
    border: 1px solid var(--sl-border);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 12px;
}

.sl-card h3 {
    margin: 0;
    font-size: 1rem;
}

.sl-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

.sl-btn-control {
    width: 100%;
    background: rgba(99, 102, 241, 0.22);
    border: 1px solid rgba(99, 102, 241, 0.35);
}

.sl-card p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--sl-muted);
}

.sl-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.18);
    color: var(--sl-green);
}

.sl-badge.off {
    background: rgba(161, 161, 170, 0.15);
    color: var(--sl-muted);
}

.sl-input {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--sl-border);
    background: var(--sl-surface);
    color: var(--sl-text);
    font-size: 1rem;
    margin-bottom: 12px;
}

.sl-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.sl-stat {
    text-align: center;
    padding: 10px 6px;
    border-radius: 12px;
    background: var(--sl-surface);
    border: 1px solid var(--sl-border);
}

.sl-stat strong {
    display: block;
    font-size: 1.1rem;
    color: var(--sl-indigo);
}

.sl-stat span {
    font-size: 0.68rem;
    color: var(--sl-muted);
}

.sl-chips {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.sl-chip {
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--sl-border);
    background: var(--sl-surface);
    color: var(--sl-muted);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.sl-chip.active {
    background: rgba(99, 102, 241, 0.22);
    color: #c7d2fe;
    border-color: rgba(99, 102, 241, 0.35);
}

.sl-row-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.sl-row-actions .sl-btn {
    flex: 1;
    padding: 10px;
    font-size: 0.78rem;
}

.sl-preview {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
    border-radius: 14px;
    background: #000;
}

.sl-control-frame {
    width: 100%;
    min-height: 360px;
    border: none;
    border-radius: 14px;
    background: #000;
    margin-top: 10px;
}

.sl-error {
    color: var(--sl-red);
    font-size: 0.85rem;
    margin: 8px 0;
}

.sl-splash {
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(180deg, var(--sl-bg), var(--sl-bg2));
}

.sl-logo {
    width: 88px;
    height: 88px;
    border-radius: 22px;
    margin-bottom: 16px;
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.35);
}

.sl-install-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    padding-bottom: calc(16px + var(--sl-safe-b));
}

.sl-install-sheet {
    width: 100%;
    max-width: 420px;
    background: #16161f;
    border: 1px solid var(--sl-border);
    border-radius: 22px 22px 16px 16px;
    padding: 22px 18px;
    animation: slSlideUp 0.35s ease;
}

@keyframes slSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.sl-install-sheet h2 {
    margin: 0 0 8px;
    font-size: 1.15rem;
}

.sl-install-sheet p {
    margin: 0 0 16px;
    color: var(--sl-muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

.sl-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
    padding: 12px;
    border-radius: 14px;
    background: var(--sl-surface);
    border: 1px solid var(--sl-border);
}

.sl-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sl-indigo), var(--sl-pink));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sl-step strong { display: block; margin-bottom: 4px; }
.sl-step span { color: var(--sl-muted); font-size: 0.82rem; line-height: 1.4; }

.sl-share-hint {
    text-align: center;
    margin: 10px 0 6px;
    font-size: 2rem;
    animation: slBounce 1.2s ease infinite;
}

@keyframes slBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.sl-install-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.sl-muted-note {
    font-size: 0.75rem;
    color: var(--sl-muted);
    text-align: center;
    line-height: 1.45;
}

.sl-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--sl-muted);
}

.sl-login-wrap {
    max-width: 400px;
    margin: 0 auto;
    padding-top: 24px;
}

.sl-login-wrap h2 {
    text-align: center;
    margin: 0 0 8px;
}

.sl-login-wrap .sub {
    text-align: center;
    color: var(--sl-muted);
    font-size: 0.88rem;
    margin-bottom: 20px;
}
