/*
 * Screen Capture Studio
 * JollyGrid dark theme · Nunito · purple/pink palette
 *
 * Layout: topbar + full-height workspace
 * Idle state: centered launcher with large mode cards + prominent CTA
 * Active states: preview / scroll / result fill the workspace
 */

:root {
    --sc-font: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --sc-bg: #080c18;
    --sc-surface: #0c1424;
    --sc-surface-2: #121a2e;
    --sc-border: rgba(255, 255, 255, 0.08);
    --sc-border-hover: rgba(167, 139, 250, 0.35);
    --sc-text: #f8fafc;
    --sc-text-2: rgba(248, 250, 252, 0.82);
    --sc-text-3: rgba(248, 250, 252, 0.50);
    --sc-purple: #a78bfa;
    --sc-pink: #f472b6;
    --sc-green: #34d399;
    --sc-red: #f87171;
    --sc-gradient: linear-gradient(135deg, #a78bfa, #f472b6);
    --sc-gradient-subtle: linear-gradient(135deg, rgba(167, 139, 250, 0.10), rgba(244, 114, 182, 0.06));
    --sc-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    --sc-shadow-glow: 0 0 0 1px rgba(167, 139, 250, 0.12), 0 8px 32px rgba(167, 139, 250, 0.14);
    --sc-r: 12px;
    --sc-ease: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--sc-bg);
    color: var(--sc-text);
    font-family: var(--sc-font);
    -webkit-font-smoothing: antialiased;
}

[hidden] {
    display: none !important;
}

/* ── A11y ── */
.sc-skip {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--sc-purple);
    color: #fff;
    padding: 8px 16px;
    z-index: 100000;
    font-size: 14px;
    text-decoration: none;
    transition: top 0.2s;
}

.sc-skip:focus {
    top: 0;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

*:focus-visible {
    outline: 2px solid var(--sc-purple);
    outline-offset: 2px;
}

/* ── Loading ── */
.sc-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 100vh;
    font-size: 15px;
    color: var(--sc-text-2);
}

.sc-loading__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--sc-purple);
    animation: sc-bounce 1s infinite;
}

.sc-loading__dot:nth-child(2) {
    animation-delay: 0.15s;
}

.sc-loading__dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes sc-bounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ── Shell ── */
.sc {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.sc-icon {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

/* ── Topbar ── */
.sc-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 52px;
    padding: 0 16px;
    background: var(--sc-surface);
    border-bottom: 1px solid var(--sc-border);
    flex-shrink: 0;
    z-index: 10;
}

.sc-topbar__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--sc-text);
}

.sc-topbar__logo {
    width: 26px;
    height: 26px;
    border-radius: 6px;
}

.sc-topbar__name {
    font-size: 15px;
    font-weight: 800;
    white-space: nowrap;
}

.sc-topbar__sep {
    width: 1px;
    height: 20px;
    background: var(--sc-border);
    flex-shrink: 0;
}

.sc-topbar__back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--sc-border);
    background: transparent;
    color: var(--sc-text-2);
    font: 700 13px var(--sc-font);
    text-decoration: none;
    transition: border-color var(--sc-ease), color var(--sc-ease);
}

.sc-topbar__back:hover {
    color: var(--sc-text);
    border-color: var(--sc-border-hover);
}

.sc-topbar__badge {
    margin-left: auto;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    background: var(--sc-gradient);
}

/* ── Workspace — fills remaining viewport ── */
.sc-ws {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    overflow: auto;
    background:
        radial-gradient(circle at 30% 30%, rgba(167, 139, 250, 0.04), transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(244, 114, 182, 0.03), transparent 50%);
}

.sc-ws__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
}

/* ── Idle — the capture launcher ── */
.sc-launcher {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 36px;
    width: 100%;
    max-width: 680px;
}

.sc-launcher__header {
    text-align: center;
}

.sc-launcher__icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    border-radius: 22px;
    background: var(--sc-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(167, 139, 250, 0.3);
}

.sc-launcher__icon .sc-icon {
    width: 32px;
    height: 32px;
    color: #fff;
    stroke-width: 1.8;
}

.sc-launcher__title {
    margin: 0;
    font-size: 26px;
    font-weight: 900;
    line-height: 1.2;
}

.sc-launcher__sub {
    margin: 8px 0 0;
    font-size: 16px;
    color: var(--sc-text-2);
    line-height: 1.5;
}

/* Mode cards — prominent, side by side, premium feel */
.sc-modes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    width: 100%;
}

.sc-mode {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 28px 24px;
    min-height: 200px;
    border-radius: 20px;
    border: 1.5px solid rgba(255, 255, 255, 0.10);
    background:
        linear-gradient(180deg, rgba(167, 139, 250, 0.04), transparent 40%),
        var(--sc-surface);
    color: var(--sc-text);
    font-family: var(--sc-font);
    cursor: pointer;
    text-align: left;
    transition: border-color var(--sc-ease), box-shadow var(--sc-ease), transform var(--sc-ease), background var(--sc-ease);
}

.sc-mode__icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--sc-gradient-subtle);
    color: #c4b5fd;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sc-mode__icon .sc-icon {
    width: 22px;
    height: 22px;
}

.sc-mode__name {
    font-size: 18px;
    font-weight: 800;
}

.sc-mode__desc {
    font-size: 14px;
    color: var(--sc-text-3);
    line-height: 1.5;
}

.sc-mode__action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding: 11px 20px;
    border-radius: 12px;
    background: rgba(167, 139, 250, 0.08);
    border: 1px solid rgba(167, 139, 250, 0.15);
    font-size: 14px;
    font-weight: 800;
    color: #c4b5fd;
    letter-spacing: 0.2px;
    transition: background var(--sc-ease), color var(--sc-ease), border-color var(--sc-ease), box-shadow var(--sc-ease);
}

.sc-mode__action .sc-icon {
    width: 16px;
    height: 16px;
}

.sc-mode:hover:not([disabled]) .sc-mode__action {
    background: var(--sc-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 16px rgba(167, 139, 250, 0.25);
}

.sc-mode:hover:not([disabled]) {
    border-color: rgba(167, 139, 250, 0.35);
    box-shadow: var(--sc-shadow-glow);
    transform: translateY(-3px);
    background:
        linear-gradient(180deg, rgba(167, 139, 250, 0.08), transparent 50%),
        var(--sc-surface);
}

.sc-mode:active:not([disabled]) {
    transform: translateY(0) scale(0.98);
}

.sc-mode--active {
    border-color: rgba(167, 139, 250, 0.45);
    box-shadow: var(--sc-shadow-glow);
    background:
        linear-gradient(180deg, rgba(167, 139, 250, 0.08), transparent 50%),
        var(--sc-surface);
}

.sc-mode--active .sc-mode__icon {
    background: var(--sc-gradient);
    color: #fff;
    box-shadow: 0 4px 12px rgba(167, 139, 250, 0.3);
}

.sc-mode--active .sc-mode__action {
    background: var(--sc-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 16px rgba(167, 139, 250, 0.2);
}

.sc-mode[disabled] {
    opacity: 0.3;
    cursor: not-allowed;
}

.sc-mode[disabled]:hover {
    transform: none;
    box-shadow: none;
    background: var(--sc-surface);
}

.sc-mode[disabled] .sc-mode__action {
    display: none;
}

.sc-mode__soon {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sc-text-3);
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: 999px;
}

/* Privacy note */
.sc-privacy {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--sc-text-3);
}

.sc-privacy .sc-icon {
    color: var(--sc-green);
    width: 14px;
    height: 14px;
}

.sc-status {
    margin: 0;
    padding: 12px 16px;
    border-radius: var(--sc-r);
    background: rgba(167, 139, 250, 0.06);
    border: 1px solid rgba(167, 139, 250, 0.15);
    font-size: 14px;
    color: var(--sc-text-2);
    text-align: center;
    max-width: 680px;
    align-self: center;
}

/* ── Buttons ── */
.sc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: 0;
    border-radius: var(--sc-r);
    font: 800 15px var(--sc-font);
    cursor: pointer;
    text-decoration: none;
    transition: transform var(--sc-ease), box-shadow var(--sc-ease);
}

.sc-btn .sc-icon {
    width: 17px;
    height: 17px;
}

.sc-btn--primary {
    color: #fff;
    background: var(--sc-gradient);
    box-shadow: 0 6px 24px rgba(167, 139, 250, 0.25);
}

.sc-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 32px rgba(167, 139, 250, 0.3);
}

.sc-btn--primary:active {
    transform: scale(0.98);
}

.sc-btn--primary[disabled] {
    opacity: 0.5;
    cursor: wait;
}

.sc-btn--ghost {
    padding: 10px 16px;
    color: var(--sc-text-2);
    background: var(--sc-surface);
    border: 1px solid var(--sc-border);
}

.sc-btn--ghost:hover {
    border-color: var(--sc-border-hover);
    color: var(--sc-text);
}

/* ── Active states ── */
.sc-active {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 900px;
}

/* ── Scroll Capture Session — prominent card ── */
.sc-session {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 100%;
    max-width: 520px;
    padding: 40px 32px;
    border-radius: 20px;
    border: 1.5px solid rgba(52, 211, 153, 0.2);
    background:
        linear-gradient(180deg, rgba(52, 211, 153, 0.04), transparent 40%),
        var(--sc-surface);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    margin: 0 auto;
}

.sc-session__header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sc-live-dot--lg {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--sc-green);
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.4);
    animation: sc-pulse 1.2s ease-in-out infinite;
}

@keyframes sc-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.sc-session__status {
    font-size: 20px;
    font-weight: 900;
    color: var(--sc-green);
}

.sc-session__stats {
    display: flex;
    gap: 32px;
}

.sc-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.sc-stat__value {
    font-size: 36px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    color: var(--sc-text);
}

.sc-stat__label {
    font-size: 13px;
    font-weight: 700;
    color: var(--sc-text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sc-session__instructions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sc-session__instructions p {
    margin: 0;
    font-size: 14px;
    color: var(--sc-text-2);
    line-height: 1.5;
}

.sc-session__instructions .sc-icon {
    color: var(--sc-purple);
    vertical-align: text-bottom;
    margin-right: 4px;
}

.sc-session__alt {
    font-size: 13px !important;
    color: var(--sc-text-3) !important;
}

.sc-countdown {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: #93c5fd;
    font-variant-numeric: tabular-nums;
}

/* Preview / Result */
#sc-preview-video,
#sc-canvas {
    display: block;
    width: 100%;
    max-height: calc(100vh - 180px);
    border-radius: var(--sc-r);
    background: #060a14;
    border: 1px solid var(--sc-border);
    box-shadow: var(--sc-shadow);
    object-fit: contain;
}

.sc-meta {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--sc-text-2);
}

.sc-truncation-warn {
    margin: 0;
    padding: 10px 14px;
    border-radius: var(--sc-r);
    border: 1px solid rgba(251, 191, 36, 0.25);
    background: rgba(251, 191, 36, 0.08);
    font-size: 13px;
    font-weight: 700;
    color: #fbbf24;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.5;
}

.sc-truncation-warn .sc-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sc-note {
    margin: 0;
    font-size: 12px;
    color: var(--sc-text-3);
}

.sc-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Error ── */
.sc-error {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: min(480px, calc(100% - 24px));
    padding: 14px 16px;
    border-radius: var(--sc-r);
    border: 1px solid rgba(248, 113, 113, 0.2);
    background: rgba(31, 10, 18, 0.95);
    box-shadow: var(--sc-shadow);
}

.sc-error__msg {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 800;
    color: #fecaca;
}

.sc-error__hint {
    margin: 0 0 10px;
    font-size: 13px;
    color: #fca5a5;
    line-height: 1.5;
}

/* ── Compat ── */
.sc-compat {
    max-width: 400px;
    margin: 80px auto;
    padding: 32px;
    text-align: center;
    border-radius: var(--sc-r);
    background: var(--sc-surface);
    border: 1px solid var(--sc-border);
}

.sc-compat .sc-icon {
    width: 36px;
    height: 36px;
    color: #fbbf24;
    margin-bottom: 12px;
}

.sc-compat h2 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 900;
}

.sc-compat ul {
    margin: 12px 0 0;
    padding-left: 20px;
    text-align: left;
    color: var(--sc-text-2);
    line-height: 1.7;
}

.sc-compat p {
    margin-top: 12px;
    color: var(--sc-text-3);
    line-height: 1.5;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .sc-live-dot--lg {
        animation: none;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Mobile ── */
@media (max-width: 600px) {
    .sc-ws {
        padding: 20px 16px;
    }

    .sc-modes {
        grid-template-columns: 1fr;
    }

    .sc-launcher__icon {
        width: 48px;
        height: 48px;
        border-radius: 14px;
    }

    .sc-launcher__icon .sc-icon {
        width: 22px;
        height: 22px;
    }

    .sc-launcher__title {
        font-size: 20px;
    }

    .sc-mode {
        min-height: 100px;
        padding: 16px;
    }

    .sc-btn--lg {
        width: 100%;
    }

    .sc-actions {
        flex-direction: column;
    }

    .sc-actions .sc-btn {
        width: 100%;
    }

    .sc-topbar__name {
        display: none;
    }
}

/* ── Print ── */
@media print {

    html,
    body {
        background: #fff;
        color: #111;
        overflow: visible;
        height: auto;
    }

    .sc-topbar,
    .sc-error,
    .sc-skip,
    .sc-launcher,
    .sc-actions {
        display: none !important;
    }

    .sc-truncation-warn {
        color: #92400e;
        background: #fef3c7;
        border-color: #fbbf24;
    }

    .sc,
    .sc-ws {
        display: block;
        height: auto;
        padding: 0;
    }

    .sc-meta,
    .sc-note {
        color: #111;
    }

    #sc-canvas {
        max-height: none;
        border: 1px solid #d1d5db;
        border-radius: 0;
        box-shadow: none;
        background: #fff;
        page-break-inside: avoid;
    }
}