/* ============================================
   ScreenCraft Pro v2.0 - Premium Design System
   ============================================ */

/* ---- CSS Variables & Themes ---- */
:root {
    --bg-primary: #06060b;
    --bg-secondary: #0e0e16;
    --bg-card: rgba(16, 16, 28, 0.75);
    --bg-card-hover: rgba(24, 24, 42, 0.85);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --border-glass: rgba(255, 255, 255, 0.07);
    --border-glass-hover: rgba(255, 255, 255, 0.14);
    --text-primary: #f0f0f5;
    --text-secondary: #8a8a9a;
    --text-muted: #50506a;
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.3);
    --warning: #f59e0b;
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.3);
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 50%;
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.03);
    --transition-fast: 150ms cubic-bezier(.4, 0, .2, 1);
    --transition-base: 250ms cubic-bezier(.4, 0, .2, 1);
    --transition-smooth: 400ms cubic-bezier(.16, 1, .3, 1);
}

[data-theme="purple"] {
    --accent: #7c3aed;
    --accent2: #06b6d4;
    --accent-rgb: 124, 58, 237;
    --accent2-rgb: 6, 182, 212;
}

[data-theme="blue"] {
    --accent: #3b82f6;
    --accent2: #8b5cf6;
    --accent-rgb: 59, 130, 246;
    --accent2-rgb: 139, 92, 246;
}

[data-theme="emerald"] {
    --accent: #10b981;
    --accent2: #06b6d4;
    --accent-rgb: 16, 185, 129;
    --accent2-rgb: 6, 182, 212;
}

[data-theme="rose"] {
    --accent: #f43f5e;
    --accent2: #ec4899;
    --accent-rgb: 244, 63, 94;
    --accent2-rgb: 236, 72, 153;
}

[data-theme="amber"] {
    --accent: #f59e0b;
    --accent2: #ef4444;
    --accent-rgb: 245, 158, 11;
    --accent2-rgb: 239, 68, 68;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---- Particle Canvas ---- */
.particle-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* ---- Background Orbs ---- */
.bg-animation {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: .12;
    animation: orbFloat 25s ease-in-out infinite;
}

.bg-orb-1 {
    width: 600px;
    height: 600px;
    background: var(--accent);
    top: -200px;
    right: -100px;
}

.bg-orb-2 {
    width: 500px;
    height: 500px;
    background: var(--accent2);
    bottom: -150px;
    left: -100px;
    animation-delay: -8s;
}

.bg-orb-3 {
    width: 350px;
    height: 350px;
    background: var(--accent);
    top: 50%;
    left: 40%;
    animation-delay: -16s;
}

.bg-orb-4 {
    width: 250px;
    height: 250px;
    background: var(--accent2);
    top: 20%;
    left: 20%;
    animation-delay: -12s;
    opacity: .08;
}

@keyframes orbFloat {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(30px, -50px) scale(1.05);
    }

    50% {
        transform: translate(-20px, 20px) scale(.95);
    }

    75% {
        transform: translate(40px, 30px) scale(1.02);
    }
}

/* ---- App Container ---- */
.app-container {
    position: relative;
    z-index: 1;
    max-width: 1440px;
    margin: 0 auto;
    padding: var(--space-lg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Header ---- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) 0;
    margin-bottom: var(--space-xl);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.logo-icon {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 24px rgba(var(--accent-rgb), .4);
}

.logo-icon .material-icons-round {
    font-size: 28px;
    color: #fff;
}

.logo-icon-glow {
    position: absolute;
    inset: -4px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    opacity: .3;
    filter: blur(12px);
    z-index: -1;
    animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {

    0%,
    100% {
        opacity: .2;
        transform: scale(1);
    }

    50% {
        opacity: .4;
        transform: scale(1.05);
    }
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.2;
}

.logo-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-tagline {
    font-size: .72rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: .02em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.header-divider {
    width: 1px;
    height: 24px;
    background: var(--border-glass);
    margin: 0 var(--space-xs);
}

/* ---- Theme Switcher ---- */
.theme-switcher {
    display: flex;
    gap: 6px;
    padding: 4px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(10px);
}

.theme-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: var(--dot-color);
    cursor: pointer;
    transition: all var(--transition-base);
    opacity: .5;
}

.theme-dot:hover {
    opacity: .8;
    transform: scale(1.15);
}

.theme-dot.active {
    opacity: 1;
    border-color: rgba(255, 255, 255, .5);
    transform: scale(1.15);
    box-shadow: 0 0 10px var(--dot-color);
}

/* ---- Buttons ---- */
.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    background: var(--bg-glass);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    backdrop-filter: blur(10px);
    position: relative;
}

.btn-icon:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-glass-hover);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.btn-icon .material-icons-round {
    font-size: 20px;
}

.btn-glow:hover {
    box-shadow: 0 0 20px rgba(var(--accent-rgb), .15);
}

.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--danger);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    font-family: inherit;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(var(--accent-rgb), .3);
}

.btn-primary .material-icons-round {
    font-size: 18px;
}

.btn-secondary-sm {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    background: var(--bg-glass);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: .8rem;
    cursor: pointer;
    transition: all var(--transition-base);
}

.btn-secondary-sm:hover {
    border-color: rgba(var(--accent-rgb), .3);
    color: var(--text-primary);
    background: rgba(var(--accent-rgb), .1);
}

.btn-secondary-sm .material-icons-round {
    font-size: 16px;
}

.btn-danger-sm {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(239, 68, 68, .2);
    background: rgba(239, 68, 68, .1);
    color: var(--danger);
    font-family: inherit;
    font-size: .8rem;
    cursor: pointer;
    transition: all var(--transition-base);
}

.btn-danger-sm:hover {
    background: rgba(239, 68, 68, .2);
    border-color: rgba(239, 68, 68, .3);
}

.btn-danger-sm .material-icons-round {
    font-size: 16px;
}

/* ---- Main Layout ---- */
.main-content {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: var(--space-xl);
    align-items: start;
    flex: 1;
}

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    backdrop-filter: blur(20px);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-card);
}

.card:hover {
    border-color: var(--border-glass-hover);
}

.card-animated {
    animation: cardFadeIn .5s ease-out both;
}

.card-animated:nth-child(2) {
    animation-delay: .05s;
}

.card-animated:nth-child(3) {
    animation-delay: .1s;
}

.card-animated:nth-child(4) {
    animation-delay: .15s;
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.card-icon {
    font-size: 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.card-header h2 {
    font-size: .88rem;
    font-weight: 600;
    letter-spacing: -.01em;
}

.control-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* ---- Source Selection ---- */
.source-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.source-btn {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: left;
}

.source-btn:hover {
    background: var(--bg-glass);
    border-color: var(--border-glass-hover);
    color: var(--text-primary);
}

.source-btn.active {
    background: rgba(var(--accent-rgb), .08);
    border-color: rgba(var(--accent-rgb), .25);
    color: var(--text-primary);
}

.source-btn.active .source-btn-icon {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
}

.source-btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    flex-shrink: 0;
}

.source-btn-icon .material-icons-round {
    font-size: 20px;
}

.source-btn-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.source-btn-title {
    font-size: .85rem;
    font-weight: 500;
}

.source-btn-desc {
    font-size: .7rem;
    color: var(--text-muted);
}

/* ---- Toggle ---- */
.toggle-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    cursor: pointer;
}

.toggle-option+.toggle-option {
    border-top: 1px solid var(--border-glass);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: .83rem;
    color: var(--text-secondary);
}

.toggle-label .material-icons-round {
    font-size: 18px;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .08);
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition-base);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-muted);
    top: 3px;
    left: 3px;
    transition: all var(--transition-smooth);
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(20px);
    background: #fff;
}

/* ---- Mic / Audio ---- */
.mic-volume-container {
    padding: var(--space-sm) 0;
}

.volume-bar {
    height: 4px;
    background: rgba(255, 255, 255, .08);
    border-radius: 2px;
    overflow: hidden;
}

.volume-level {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    border-radius: 2px;
    transition: width 80ms linear;
}

.audio-waveform {
    height: 32px;
    margin-top: var(--space-xs);
    display: flex;
    align-items: end;
    gap: 2px;
}

.audio-waveform .wave-bar {
    flex: 1;
    background: linear-gradient(to top, var(--accent), var(--accent2));
    border-radius: 2px 2px 0 0;
    min-height: 2px;
    transition: height 80ms linear;
    opacity: .6;
}

/* ---- Webcam Shape ---- */
.webcam-shape-selector {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
}

.shape-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
}

.shape-btn.active {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), .1);
}

.shape-preview {
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-muted);
    transition: border-color var(--transition-base);
}

.shape-btn.active .shape-preview {
    border-color: var(--accent);
}

.shape-preview.circle {
    border-radius: 50%;
}

.shape-preview.rounded {
    border-radius: 4px;
}

.shape-preview.rectangle {
    border-radius: 0;
}

.webcam-preview-mini {
    margin-top: var(--space-sm);
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 16/9;
    background: var(--bg-secondary);
}

.webcam-preview-mini video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

/* ---- Input Fields ---- */
.input-field {
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    font-size: .85rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.input-field:focus {
    border-color: var(--accent);
}

.input-sm {
    width: 60px;
    text-align: center;
}

.select-field {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 6px 12px;
    font-family: inherit;
    font-size: .85rem;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition-fast);
}

.select-field:focus {
    border-color: var(--accent);
}

/* ---- Schedule ---- */
.schedule-section {
    border-top: 1px solid var(--border-glass);
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
}

.schedule-controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.schedule-input-group label {
    font-size: .75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: block;
}

.schedule-time {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: .8rem;
    color: var(--text-secondary);
}

/* ---- Preview Panel ---- */
.preview-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.preview-card {
    padding: 0;
    overflow: hidden;
}

.preview-container {
    position: relative;
    aspect-ratio: 16/9;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* Idle */
.preview-idle {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
}

.preview-idle-animation {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.idle-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(var(--accent-rgb), .15);
    animation: idleRingSpin 8s linear infinite;
}

.idle-ring-1 {
    width: 100px;
    height: 100px;
}

.idle-ring-2 {
    width: 80px;
    height: 80px;
    animation-direction: reverse;
    animation-duration: 6s;
    border-color: rgba(var(--accent2-rgb), .12);
}

.idle-ring-3 {
    width: 60px;
    height: 60px;
    animation-duration: 10s;
    border-style: dashed;
    border-color: rgba(var(--accent-rgb), .08);
}

@keyframes idleRingSpin {
    to {
        transform: rotate(360deg);
    }
}

.preview-idle-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(var(--accent-rgb), .12);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.preview-idle-icon .material-icons-round {
    font-size: 24px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.preview-idle h3 {
    font-size: 1rem;
    font-weight: 600;
}

.preview-idle p {
    font-size: .82rem;
    color: var(--text-secondary);
}

.idle-shortcuts {
    margin-top: var(--space-xs);
    font-size: .72rem;
    color: var(--text-muted);
}

.idle-shortcuts kbd {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: .68rem;
    color: var(--text-secondary);
}

/* Live Preview */
#livePreview {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* Drawing Canvas */
.drawing-canvas {
    position: absolute;
    inset: 0;
    z-index: 8;
    cursor: crosshair;
}

/* Webcam Overlay */
.webcam-overlay {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, .2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, .5);
    cursor: grab;
    z-index: 10;
    transition: border-color var(--transition-fast), border-radius var(--transition-base);
}

.webcam-overlay:hover {
    border-color: var(--accent);
}

.webcam-overlay.dragging {
    cursor: grabbing;
    transform: scale(1.02);
}

.webcam-overlay.shape-rounded {
    border-radius: var(--radius-lg);
    width: 200px;
    height: 150px;
}

.webcam-overlay.shape-rectangle {
    border-radius: 4px;
    width: 200px;
    height: 150px;
}

.webcam-overlay video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

/* Watermark */
.watermark-display {
    position: absolute;
    bottom: 16px;
    left: 16px;
    font-size: .7rem;
    color: rgba(255, 255, 255, .25);
    font-weight: 600;
    letter-spacing: .05em;
    z-index: 6;
    pointer-events: none;
    text-shadow: 0 1px 4px rgba(0, 0, 0, .5);
}

/* Countdown */
.countdown-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    backdrop-filter: blur(10px);
}

.countdown-ring {
    position: absolute;
    width: 120px;
    height: 120px;
}

.countdown-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.countdown-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, .08);
    stroke-width: 4;
}

.countdown-ring-progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 339.292;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

.countdown-number {
    font-size: 64px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: countdownPop 1s ease-out;
    z-index: 1;
}

@keyframes countdownPop {
    0% {
        transform: scale(.3);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(1);
    }
}

/* Live Captions */
.live-captions-display {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    text-align: center;
    z-index: 15;
    pointer-events: none;
}

.caption-text {
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    font-size: 1.15rem;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    line-height: 1.4;
    display: inline-block;
    backdrop-filter: blur(4px);
    transition: opacity 0.2s ease-in-out;
}
.caption-text:empty {
    display: none;
}

/* Rec Indicator */
.recording-indicator {
    position: absolute;
    top: 16px;
    left: 16px;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 6px 14px;
    background: rgba(0, 0, 0, .65);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(10px);
    font-size: .78rem;
    font-weight: 600;
    z-index: 5;
    border: 1px solid rgba(239, 68, 68, .2);
}

.rec-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    animation: recBlink 1s ease-in-out infinite;
}

@keyframes recBlink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .3;
    }
}

.rec-label {
    color: var(--danger);
    font-size: .7rem;
}

.rec-timer {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    font-family: 'JetBrains Mono', monospace;
    font-size: .75rem;
}

.rec-size {
    color: var(--text-muted);
    font-size: .7rem;
    margin-left: var(--space-xs);
}

/* ---- Drawing Toolbar ---- */
.drawing-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: rgba(var(--accent-rgb), .05);
    border-top: 1px solid var(--border-glass);
}

.draw-tools,
.draw-options {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.draw-tool {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.draw-tool:hover {
    background: rgba(var(--accent-rgb), .1);
    color: var(--text-primary);
}

.draw-tool.active {
    background: rgba(var(--accent-rgb), .15);
    border-color: rgba(var(--accent-rgb), .3);
    color: var(--accent);
}

.draw-tool .material-icons-round {
    font-size: 18px;
}

.color-input {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: transparent;
}

.color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-input::-webkit-color-swatch {
    border: 2px solid var(--border-glass);
    border-radius: var(--radius-sm);
}

.size-slider {
    width: 80px;
}

.size-slider input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

/* ---- Recording Controls ---- */
.recording-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
    padding: var(--space-md) 0;
}

.btn-control {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-glass);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    backdrop-filter: blur(10px);
    position: relative;
}

.btn-control:hover:not(:disabled) {
    background: var(--bg-card-hover);
    border-color: var(--border-glass-hover);
    color: var(--text-primary);
    transform: scale(1.08);
}

.btn-control:disabled {
    opacity: .3;
    cursor: not-allowed;
}

.btn-control .material-icons-round {
    font-size: 22px;
}

.btn-stop:hover:not(:disabled) {
    border-color: rgba(239, 68, 68, .3);
    background: rgba(239, 68, 68, .1);
    color: var(--danger);
}

/* Tooltip */
.tooltip .tooltip-text {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    font-size: .7rem;
    color: var(--text-secondary);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.tooltip:hover .tooltip-text {
    opacity: 1;
}

/* Record Button */
.btn-record {
    position: relative;
    width: 68px;
    height: 68px;
    border-radius: var(--radius-full);
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-record-inner {
    width: 58px;
    height: 58px;
    border-radius: var(--radius-full);
    background: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    z-index: 1;
    box-shadow: 0 4px 24px var(--danger-glow);
}

.btn-record-inner .material-icons-round {
    font-size: 28px;
    color: #fff;
}

.btn-record-ring {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-full);
    border: 2px solid var(--danger);
    opacity: .5;
    transition: all var(--transition-base);
}

.btn-record-pulse {
    position: absolute;
    inset: -6px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(239, 68, 68, .2);
    opacity: 0;
    transition: all var(--transition-base);
}

.btn-record:hover .btn-record-inner {
    transform: scale(1.06);
    box-shadow: 0 6px 32px rgba(239, 68, 68, .4);
}

.btn-record:hover .btn-record-ring {
    opacity: .8;
    transform: scale(1.08);
}

.btn-record:hover .btn-record-pulse {
    opacity: 1;
    transform: scale(1.15);
}

.btn-record.recording .btn-record-inner {
    animation: recPulse 2s ease-in-out infinite;
}

.btn-record.recording .btn-record-ring {
    animation: ringPulse 2s ease-in-out infinite;
}

@keyframes recPulse {

    0%,
    100% {
        box-shadow: 0 4px 20px var(--danger-glow);
    }

    50% {
        box-shadow: 0 4px 44px rgba(239, 68, 68, .5);
    }
}

@keyframes ringPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: .5;
    }

    50% {
        transform: scale(1.15);
        opacity: .15;
    }
}

/* ---- Status Bar ---- */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    font-size: .78rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: all var(--transition-base);
}

.status-dot.idle {
    background: var(--text-muted);
}

.status-dot.ready {
    background: var(--success);
    box-shadow: 0 0 8px var(--success-glow);
}

.status-dot.recording {
    background: var(--danger);
    animation: recBlink 1s ease-in-out infinite;
}

.status-dot.paused {
    background: var(--warning);
}

#statusText {
    color: var(--text-secondary);
}

.status-info {
    display: flex;
    gap: var(--space-md);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    font-family: 'JetBrains Mono', monospace;
    font-size: .72rem;
}

/* ---- Footer ---- */
.app-footer {
    text-align: center;
    padding: var(--space-lg) 0 var(--space-md);
    color: var(--text-muted);
    font-size: .72rem;
}

/* ---- Floating Controller ---- */
.floating-controller {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 8px 16px;
    background: rgba(10, 10, 18, .9);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 40px rgba(0, 0, 0, .5);
    z-index: 50;
    cursor: default;
}

.float-drag-handle {
    cursor: grab;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.float-drag-handle .material-icons-round {
    font-size: 18px;
}

.float-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 var(--space-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: .85rem;
    font-weight: 600;
}

.float-rec-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    animation: recBlink 1s ease-in-out infinite;
}

.float-actions {
    display: flex;
    gap: 4px;
    border-left: 1px solid var(--border-glass);
    padding-left: var(--space-sm);
    margin-left: var(--space-xs);
}

.float-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.float-btn:hover {
    background: rgba(255, 255, 255, .08);
    color: var(--text-primary);
}

.float-btn .material-icons-round {
    font-size: 18px;
}

.float-btn-stop:hover {
    background: rgba(239, 68, 68, .15);
    color: var(--danger);
}

/* ---- Modals ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .65);
    backdrop-filter: blur(10px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow: hidden;
    transform: scale(.95) translateY(10px);
    transition: transform var(--transition-smooth);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-lg {
    max-width: 680px;
}

.modal-xl {
    max-width: 940px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-glass);
}

.modal-header h2 {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1.05rem;
    font-weight: 600;
}

.modal-header h2 .material-icons-round {
    font-size: 22px;
    color: var(--accent);
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.modal-body {
    padding: var(--space-lg);
    overflow-y: auto;
    max-height: calc(85vh - 80px);
}

.modal-close {
    border: none !important;
    background: transparent !important;
}

/* ---- Settings Tabs ---- */
.settings-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.settings-tab {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: .8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
}

.settings-tab:hover {
    color: var(--text-primary);
}

.settings-tab.active {
    background: rgba(var(--accent-rgb), .12);
    color: var(--accent);
}

.settings-tab-content {
    display: none;
}

.settings-tab-content.active {
    display: block;
    animation: tabFadeIn .3s ease;
}

@keyframes tabFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.settings-group {
    margin-bottom: var(--space-xl);
}

.settings-group:last-child {
    margin-bottom: 0;
}

.settings-group h3 {
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: var(--space-md);
}

.settings-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) 0;
}

.settings-option+.settings-option {
    border-top: 1px solid var(--border-glass);
}

.settings-option label {
    font-size: .83rem;
    color: var(--text-secondary);
}

.shortcut-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.shortcut-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    font-size: .83rem;
    color: var(--text-secondary);
}

kbd {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    padding: 3px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: .72rem;
    color: var(--text-primary);
}

/* ---- History ---- */
.history-stats {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.stat-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
}

.stat-item .material-icons-round {
    font-size: 20px;
    color: var(--accent);
    margin-bottom: 4px;
}

.stat-item span:nth-child(2) {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

.stat-item small {
    font-size: .7rem;
    color: var(--text-muted);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.history-empty {
    text-align: center;
    padding: var(--space-2xl) 0;
    color: var(--text-muted);
}

.history-empty .material-icons-round {
    font-size: 48px;
    margin-bottom: var(--space-md);
    opacity: .2;
}

.history-empty small {
    display: block;
    margin-top: var(--space-xs);
    font-size: .75rem;
}

.history-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.history-item:hover {
    border-color: var(--border-glass-hover);
    background: var(--bg-card-hover);
    transform: translateY(-1px);
}

.history-thumb {
    width: 120px;
    height: 68px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-primary);
    flex-shrink: 0;
}

.history-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-info h4 {
    font-size: .88rem;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-info p {
    font-size: .73rem;
    color: var(--text-muted);
}

.history-actions {
    display: flex;
    gap: var(--space-xs);
    flex-shrink: 0;
}

.history-actions .btn-icon {
    width: 34px;
    height: 34px;
}

/* ---- Preview Modal ---- */
.preview-modal-body {
    padding: 0;
}

.preview-modal-body video {
    width: 100%;
    max-height: 60vh;
    background: #000;
    display: block;
}

/* ---- Trim Editor ---- */
.trim-editor {
    padding: var(--space-md) var(--space-lg);
}

.trim-timeline {
    padding: var(--space-md) 0;
}

.trim-track {
    position: relative;
    height: 40px;
    background: rgba(255, 255, 255, .05);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.trim-selection {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(var(--accent-rgb), .15);
    border-left: 3px solid var(--accent);
    border-right: 3px solid var(--accent);
}

.trim-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 14px;
    cursor: col-resize;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trim-handle::after {
    content: '';
    width: 2px;
    height: 16px;
    background: var(--accent);
    border-radius: 1px;
}

.trim-handle-left {
    left: -7px;
}

.trim-handle-right {
    right: -7px;
}

.trim-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--danger);
    z-index: 2;
    left: 0;
}

.trim-info {
    display: flex;
    gap: var(--space-lg);
    font-size: .8rem;
    color: var(--text-secondary);
    padding: var(--space-sm) 0;
}

.trim-info strong {
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.trim-actions {
    display: flex;
    gap: var(--space-sm);
    padding-top: var(--space-sm);
}

/* ---- Toast ---- */
.toast-container {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px var(--space-md);
    background: rgba(14, 14, 22, .95);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    font-size: .83rem;
    color: var(--text-primary);
    box-shadow: 0 8px 32px rgba(0, 0, 0, .5);
    backdrop-filter: blur(20px);
    animation: toastIn .4s cubic-bezier(.16, 1, .3, 1);
    max-width: 380px;
}

.toast.toast-out {
    animation: toastOut .3s ease-in forwards;
}

.toast .material-icons-round {
    font-size: 20px;
    flex-shrink: 0;
}

.toast.success .material-icons-round {
    color: var(--success);
}

.toast.error .material-icons-round {
    color: var(--danger);
}

.toast.info .material-icons-round {
    color: var(--accent2);
}

@keyframes toastIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .08);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, .15);
}

/* ---- Responsive ---- */
@media(max-width:1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .control-panel {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--space-md);
    }
}

@media(max-width:640px) {
    .app-container {
        padding: var(--space-md);
    }

    .control-panel {
        grid-template-columns: 1fr;
    }

    .recording-controls {
        gap: var(--space-md);
    }

    .webcam-overlay {
        width: 120px;
        height: 120px;
    }

    .modal {
        width: 95%;
    }

    .theme-switcher {
        display: none;
    }

    .header-divider {
        display: none;
    }
}