/* ======================================================
   Design Tokens & Core
   ====================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Colors - Slate Palette (Clean & Neutral) */
    --bg-color: #020617;
    /* Slate 950 */
    --card-bg: #0f172a;
    /* Slate 900 */
    --text-primary: #f8fafc;
    /* Slate 50 */
    --text-secondary: #94a3b8;
    /* Slate 400 */

    /* Brand - Indigo (Modern Tech) */
    --accent: #6366f1;
    /* Indigo 500 */
    --accent-hover: #4f46e5;
    /* Indigo 600 */
    --accent-subtle: rgba(99, 102, 241, 0.1);

    /* Semantic */
    --success: #10b981;
    /* Emerald 500 */
    --error: #ef4444;
    /* Red 500 */
    --input-bg: #1e293b;
    /* Slate 800 */
    --border-color: rgba(255, 255, 255, 0.08);
    /* Subtle border */

    /* Typography */
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Spacing (Strict 4px Scale) */
    --space-xs: 0.25rem;
    /* 4px */
    --space-sm: 0.5rem;
    /* 8px */
    --space-md: 1rem;
    /* 16px */
    --space-lg: 1.5rem;
    /* 24px */
    --space-xl: 2.5rem;
    /* 40px */
    --space-2xl: 4rem;
    /* 64px */

    /* Radius */
    --radius-sm: 0.25rem;
    /* 4px */
    --radius-md: 0.5rem;
    /* 8px */
    --radius-lg: 0.75rem;
    /* 12px */
    --radius-xl: 1rem;
    /* 16px */

    /* Shadows (Depth) */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 15px rgba(99, 102, 241, 0.3);

    /* Motion */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ======================================================
   Base & Typography
   ====================================================== */
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #0f172a;
    /* Uniform Slate 900 */
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1 {
    margin: 0 0 var(--space-xs);
    font-size: 2.75rem;
    /* Slightly restrained */
    font-weight: 800;
    text-align: center;
    background: linear-gradient(to right, #fff, #94a3b8);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.03em;
    /* Tight & Modern */
    line-height: 1.1;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-secondary);
}

/* ======================================================
   Layout & Containers
   ====================================================== */
.container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: var(--space-xl);
    text-align: center;
    position: relative;
    animation: fadeInUp 0.6s ease-out;
    box-sizing: border-box;
}

.header-section {
    text-align: center;
    margin-bottom: var(--space-2xl);
    animation: fadeInDown 0.6s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-lg);
}

/* Centered Body Layout (Landing/Auth) */
body.centered {
    justify-content: flex-start;
    align-items: center;
    padding: var(--space-md);
    padding-top: var(--space-2xl);
    /* More breathing room */
    box-sizing: border-box;
}

@media (min-width: 769px) {
    body.centered {
        padding-left: calc(var(--sidebar-width, 0px) + var(--space-xl));
    }
}

@media (max-width: 768px) {
    body.centered {
        padding-top: var(--space-xl);
    }
}

/* Advanced View Layout (Full Page Apps) */
.view-section {
    position: relative;
    width: 100%;
    min-height: 100vh;
    box-sizing: border-box;
    transition: all 0.3s ease-in-out;
}

.view-section.hidden {
    display: none !important;
}

.mobile-full-height {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: 0;
}

.view-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    position: sticky;
    top: 0;
    background: transparent;
    z-index: 10;
    padding: var(--space-sm) 0;
    backdrop-filter: blur(8px);
}

.view-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
}

.advanced-scroll-content {
    flex: 1;
    padding-bottom: 0;
}

/* ======================================================
   Component: Buttons
   ====================================================== */
button {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #ffffff;
    background: var(--accent);
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
    transition: all 0.2s ease;
}

button:hover:not(:disabled) {
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--text-secondary);
    box-shadow: none;
}

/* Button Variants */
button.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3);
}

button.danger:hover:not(:disabled) {
    box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.4);
}

.back-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    box-shadow: none;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(-2px);
    box-shadow: none;
}

.btn-icon {
    font-size: 1.2rem;
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* Auth Action Links */
.auth-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: var(--space-sm);
}

.auth-actions button {
    width: auto;
    padding: 0;
    font-size: 0.85rem;
    background: none;
    color: var(--accent);
    text-decoration: underline;
    opacity: 0.9;
    box-shadow: none;
    border: none;
}

.auth-actions button:hover {
    opacity: 1;
    color: var(--accent-hover);
    background: none;
    transform: none;
    box-shadow: none;
}

/* ======================================================
   Component: Forms
   ====================================================== */
.field {
    margin-bottom: 1.5rem;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #cbd5e1;
    letter-spacing: 0.02em;
}

input,
select {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    box-sizing: border-box;
    transition: all 0.2s;
}

input:focus,
select:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.4);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Input with Icon Wrapper */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    pointer-events: none;
    z-index: 1;
}

.input-with-icon input {
    padding-left: 3rem;
}

/* Checkboxes */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-lg);
    justify-content: center;
    margin-top: var(--space-lg);
}

.checkbox-label {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-secondary);
    transition: color var(--transition-base);
}

.checkbox-label:hover {
    color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 6px;
    background-color: var(--input-bg);
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-base);
    padding: 0;
    /* Reset padding for checkbox */
}

.checkbox-label input[type="checkbox"]:checked {
    background-color: var(--accent);
    border-color: var(--accent);
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
    background-size: 100% 100%;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #475569;
    border-radius: 26px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked+.toggle-slider {
    background-color: #10b981;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(16, 185, 129, 0.1);
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(22px);
}

.toggle-switch input:disabled+.toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.toggle-slider:hover:not(:has(input:disabled)) {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 0 4px rgba(255, 255, 255, 0.05);
}

.toggle-switch.loading .toggle-slider {
    opacity: 0.6;
    cursor: wait;
}

.toggle-switch.loading .toggle-slider:before {
    animation: pulse 1.5s ease-in-out infinite;
}

/* ======================================================
   Component: Cards & Containers
   ====================================================== */
.section-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: left;
    margin-bottom: 2rem;
}

.section-card h3 {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 700;
}

.auth-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.auth-section .tabs {
    margin-bottom: var(--space-lg);
    background: rgba(0, 0, 0, 0.2);
    border: none;
}

.auth-section .field:last-child {
    margin-bottom: 0;
}

.info-box {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
    padding: 1rem;
    margin-bottom: var(--space-xl);
    background: rgba(59, 130, 246, 0.08);
    /* More subtle blue */
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: var(--radius-lg);
    text-align: left;
}

.info-box svg {
    width: 1.5rem;
    height: 1.5rem;
    fill: var(--accent);
    flex-shrink: 0;
    opacity: 0.9;
}

.info-box p {
    margin: 0;
    font-size: 0.95rem;
    color: #94a3b8;
    line-height: 1.5;
}

.info-box b {
    color: #fff;
}

.info-btn-link {
    margin-left: 0.5rem;
    color: var(--text-secondary);
    vertical-align: middle;
    display: inline-flex;
    text-decoration: none;
    transition: color var(--transition-base);
}

.info-btn-link:hover {
    color: var(--text-primary);
}

.result-box {
    display: none;
    margin-top: var(--space-xl);
    padding: var(--space-md);
    background-color: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--success);
    border-radius: var(--radius-md);
    position: relative;
    text-align: left;
}

.result-box.error {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: var(--error);
}

.result-title {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: bold;
}

.api-key {
    position: relative;
    padding: var(--space-md) 3.5rem var(--space-md) var(--space-md);
    font-family: var(--font-mono);
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    word-break: break-all;
    user-select: all;
    color: var(--text-primary);
}

/* ======================================================
   Component: Modals
   ====================================================== */
/* Simple Modal (Unified) */
.simple-modal-overlay,
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay {
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    display: none;
}

.modal-overlay:not(.hidden) {
    display: flex;
}

@media (min-width: 769px) {
    .modal-overlay {
        left: var(--sidebar-width, 0px);
    }
}

/* Base Modal Style */
.simple-modal,
.modal {
    background: #1e293b;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 1rem;
    width: 100%;
    max-width: 400px;
    padding: 1.5rem;
    transform: scale(0.95);
    animation: zoomInModal 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    color: #fff;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 2rem);
    text-align: left;
}

.modal {
    /* Legacy Modal Overrides */
    max-width: 450px;
    padding: var(--space-xl);
    background-color: var(--card-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.simple-modal.fade-out {
    animation: fadeOut 0.2s ease-in forwards;
}

.simple-modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.simple-modal-header .icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
}

.simple-modal-header .icon-wrapper svg {
    width: 1.5rem;
    height: 1.5rem;
}

.simple-modal-header-content h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.simple-modal-body {
    margin-bottom: 2rem;
    color: #94a3b8;
    font-size: 1rem;
    line-height: 1.6;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.simple-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 1rem;
}

.simple-modal-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 1rem;
}

.simple-modal-input:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.simple-modal-btn {
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    border: none;
}

.simple-modal-btn.primary {
    background: #3b82f6;
    color: white;
}

.simple-modal-btn.primary:hover {
    background: #2563eb;
}

.simple-modal-btn.secondary {
    background: transparent;
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.simple-modal-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

/* Legacy Modal Credential Display */
.credential-group {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.result-box .credential-group {
    margin-bottom: 0;
}

.credential-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) 0;
}

.credential-item:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--space-sm);
    margin-bottom: var(--space-xs);
}

.credential-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.credential-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 600;
}

.credential-value {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.copy-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.copy-icon-btn:hover {
    background: var(--input-bg);
    color: var(--text-primary);
    border-color: var(--accent);
}

.copy-icon-btn.copied {
    color: var(--success);
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}

.copy-icon-btn svg {
    width: 18px;
    height: 18px;
}

.setup-hint {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

.modal-steps {
    text-align: left;
    margin-bottom: var(--space-xl);
    padding: var(--space-md);
    background: var(--input-bg);
    border-radius: var(--radius-lg);
}

.modal-steps h3 {
    margin: 0 0 var(--space-sm) 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.modal-steps ol {
    margin: 0;
    padding-left: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.modal-steps li {
    margin-bottom: 0.5rem;
}

/* ======================================================
   Component: Tabs
   ====================================================== */
.tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    padding: var(--space-xs);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
    position: relative;
    gap: var(--space-xs);
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
    box-shadow: none;
}

.tab-btn:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: #ffffff;
    background: var(--accent);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* ======================================================
   Component: Validation & Loading
   ====================================================== */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    margin-right: var(--space-sm);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s ease-in-out infinite;
}

.loading-duck {
    position: relative;
    display: inline-block;
    margin-right: var(--space-sm);
    animation: duck-bob 1.5s ease-in-out infinite;
    font-size: 1.25rem;
    vertical-align: middle;
    z-index: 2;
}

/* Front Wave */
.loading-duck::before {
    content: '';
    position: absolute;
    bottom: 2px;
    left: -4px;
    right: -4px;
    height: 8px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='10'%3E%3Cpath d='M0 5 Q 5 0 10 5 T 20 5 V 10 H 0 Z' fill='%236366f1'/%3E%3C/svg%3E");
    background-repeat: repeat-x;
    background-size: 20px 10px;
    animation: wave-slide 1.5s linear infinite;
    opacity: 0.7;
    z-index: 3; /* Slightly in front of duck */
}

/* Back Wave */
.loading-duck::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: -4px;
    right: -4px;
    height: 8px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='10'%3E%3Cpath d='M0 5 Q 5 0 10 5 T 20 5 V 10 H 0 Z' fill='%236366f1'/%3E%3C/svg%3E");
    background-repeat: repeat-x;
    background-size: 20px 10px;
    animation: wave-slide 2.5s linear infinite reverse;
    opacity: 0.3;
    z-index: 1; /* Behind duck */
}

.status-message {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    padding: 0.75rem;
    text-align: left;
}

.status-message.success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.status-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-message.loading {
    color: var(--text-secondary);
    font-style: italic;
}

.control-row.error {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
    animation: shake 0.4s ease-in-out;
}

.control-error-message {
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 0.25rem;
    animation: fadeIn 0.2s ease;
}

/* ======================================================
   Feature: Landing Page
   ====================================================== */
.mascot-wrapper {
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    margin-bottom: var(--space-xs);
}

.mascot-wrapper::after {
    content: '';
    position: absolute;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    z-index: -1;
    filter: blur(20px);
}

.mascot {
    position: relative;
    font-size: 4.5rem;
    line-height: 1;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
    animation: duck-bob 1.5s ease-in-out infinite;
    display: inline-block;
    z-index: 2;
}

/* Hero Front Wave */
.mascot::before {
    content: '';
    position: absolute;
    bottom: 8px;
    left: -15px;
    right: -15px;
    height: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='10'%3E%3Cpath d='M0 5 Q 5 0 10 5 T 20 5 V 10 H 0 Z' fill='%236366f1'/%3E%3C/svg%3E");
    background-repeat: repeat-x;
    background-size: 40px 20px;
    animation: wave-slide-hero 1.5s linear infinite;
    opacity: 0.7;
    z-index: 3;
}

/* Hero Back Wave */
.mascot::after {
    content: '';
    position: absolute;
    bottom: 12px;
    left: -15px;
    right: -15px;
    height: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='10'%3E%3Cpath d='M0 5 Q 5 0 10 5 T 20 5 V 10 H 0 Z' fill='%236366f1'/%3E%3C/svg%3E");
    background-repeat: repeat-x;
    background-size: 40px 20px;
    animation: wave-slide-hero 2.5s linear infinite reverse;
    opacity: 0.3;
    z-index: 1;
}

.duck-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: middle;
    position: relative;
    top: -2px;
}

.mascot .duck-icon {
    width: 4.5rem;
    height: 4.5rem;
}

.loading-duck .duck-icon {
    width: 1.25rem;
    height: 1.25rem;
    margin-bottom: 2px;
}

.tool-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.tool-item {
    position: relative;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    height: auto;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.tool-item:hover {
    background: rgba(30, 41, 59, 0.8);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.tool-card-link {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 2rem;
    text-decoration: none;
    color: inherit;
    width: 100%;
    box-sizing: border-box;
    height: auto;
}

.tool-content-left {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.tool-icon-wrapper {
    font-size: 1.25rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.tool-title {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
    letter-spacing: 0.01em;
}

.arrow-icon {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    opacity: 0.7;
    transition: transform 0.2s ease, color 0.2s ease;
}

.tool-item:hover .arrow-icon {
    transform: translateX(4px);
    color: #fff;
    opacity: 1;
}

.signup,
.helper,
.trust {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: var(--space-sm);
    text-align: left;
}

.signup a,
.helper a,
.trust a {
    color: var(--accent);
    text-decoration: none;
}

.signup a:hover,
.helper a:hover,
.trust a:hover {
    text-decoration: underline;
}

.trust {
    margin-top: var(--space-lg);
}

/* ======================================================
   Feature: QuickStart
   ====================================================== */
.link-clean {
    color: var(--accent);
    text-decoration: none;
}

.debridio-icon {
    width: 16px;
    height: 16px;
    border-radius: 2px;
}

.divider-pipe {
    margin: 0 6px;
    opacity: 0.3;
}

.preview-container {
    margin-top: 1rem;
    border-radius: 0.25rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.img-fluid {
    width: 100%;
    height: auto;
    display: block;
}

/* Advanced Configuration (Details/Summary) */
details {
    margin: var(--space-xl) 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

summary {
    padding: var(--space-md) 0;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

summary:hover {
    color: var(--text-primary);
}

summary::before {
    content: '›';
    font-size: 1.2rem;
    transition: transform var(--transition-base);
}

details[open] summary::before {
    transform: rotate(90deg);
}

.advanced-content {
    padding-bottom: var(--space-md);
    animation: slideDown var(--transition-base);
}

.settings-group {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.group-header {
    margin-bottom: var(--space-md);
    text-align: left;
}

.group-header h3 {
    margin: 0 0 4px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.group-header p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.size-presets {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-sm);
}

.preset-btn {
    padding: 0.75rem 0.5rem;
    font-size: 0.9rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    box-shadow: none;
}

.preset-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: none;
    box-shadow: none;
    border-color: var(--text-secondary);
}

.preset-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

/* Footer Options */
.advanced-footer {
    margin-top: 2rem;
    padding-bottom: 0;
    width: 100%;
}

@media (min-width: 769px) {
    .advanced-footer {
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }
}

.advanced-trigger-container {
    text-align: center;
    margin-top: 1rem;
    margin-bottom: 2rem;
}

.advanced-trigger {
    font-size: 1rem;
    color: var(--text-secondary);
    text-decoration: underline;
    opacity: 0.7;
    transition: opacity var(--transition-base);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.advanced-trigger:hover {
    opacity: 1;
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}

.footer-options {
    margin-top: 1rem;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-options details {
    flex: 1;
    min-width: 200px;
    border: none !important;
    margin: 0 !important;
    background: transparent !important;
    padding: 0;
}

.footer-options summary {
    padding: 0.5rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
}

.footer-options summary:hover {
    color: var(--text-primary);
}

.footer-options .field {
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
}

.settings-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.step-label {
    font-size: 0.75rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    text-align: left;
    padding-left: 2px;
}

/* ======================================================
   Feature: Time Machine
   ====================================================== */
.tm-container {
    max-width: 95%;
    margin: 0 auto;
    padding: 1rem;
    min-height: 90vh;
    display: flex;
    flex-direction: column;
}

.user-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 99px;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    backdrop-filter: blur(10px);
}

.user-status-pill b {
    color: var(--text-primary);
}

.logout-link {
    color: var(--accent);
    cursor: pointer;
    font-weight: 600;
    transition: color 0.2s;
    margin-left: 0.5rem;
    padding-left: 0.5rem;
    border-left: 1px solid var(--border-color);
}

.logout-link:hover {
    color: var(--accent-hover);
    text-decoration: none;
}

#loginView {
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
    animation: fadeInUp 0.6s ease-out;
}

.action-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0;
    gap: 1rem;
    background: none;
    border: none;
}

.note-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    width: 280px;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.note-input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
}

/* Timeline Layout */
.timeline-section {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 600px;
    perspective: 1200px;
    overflow: hidden;
    background: radial-gradient(circle at center, rgba(30, 41, 59, 0.5) 0%, rgba(15, 23, 42, 0.8) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
}

.empty-state {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-align: center;
    padding: var(--space-2xl);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
    /* Addon Locker uses a different empty icon style, handled below */
}

/* Sidebar Ticks */
.tm-ticks {
    width: 140px;
    height: 100%;
    overflow-y: auto;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
    mask-image: none;
    -webkit-mask-image: none;
}

.tm-tick {
    padding: 0.5rem 1.5rem 0.5rem 0.5rem;
    text-align: right;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: all 0.2s ease;
    border-right: 2px solid transparent;
    margin-right: -1px;
    position: relative;
    white-space: nowrap;
}

.tm-tick:hover {
    color: #fff;
    transform: translateX(-6px);
}

.tm-tick.active {
    color: #ffffff;
    font-weight: 800;
    font-size: 1rem;
    border-right-color: var(--accent);
    border-right-width: 4px;
    background: linear-gradient(to left, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0.04));
    box-shadow: inset -6px 0 12px rgba(59, 130, 246, 0.06), 0 4px 18px rgba(2, 6, 23, 0.45);
    transform: translateX(-8px);
    padding-right: 1.25rem;
}

.tm-tick span {
    display: block;
}

.tm-tick-time {
    font-size: 0.75rem;
    opacity: 0.5;
}

.tm-tick-note {
    font-size: 0.75rem;
    color: var(--accent);
    opacity: 0.8;
    margin-top: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Stage Area */
.tm-stage {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow: hidden;
}

/* Snapshot Card */
.tm-snapshot-view {
    width: 100%;
    max-width: 100%;
    height: 100%;
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    animation: zoomIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow: hidden;
}

.tm-snapshot-header {
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    align-items: stretch;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.header-sub {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

.tm-snapshot-date {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
    display: block;
}

.tm-snapshot-time {
    font-size: 0.95rem;
    font-weight: 400;
    margin: 0;
}

/* Note Indicator in Header */
.tm-snapshot-note-container {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.tm-snapshot-note-container:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.tm-snapshot-note-container.has-note {
    color: var(--accent);
}

.tm-snapshot-note-container.no-note {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.9rem;
}

.note-content {
    font-weight: 500;
}

.separator {
    color: var(--border-color);
}

.badge-text {
    font-weight: 500;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    padding: 0.1rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.tm-warning {
    margin-top: 0.75rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding: 0.75rem 1rem;
    background: linear-gradient(90deg, rgba(250, 204, 21, 0.06), rgba(250, 204, 21, 0.03));
    border-left: 4px solid rgba(250, 204, 21, 0.95);
    color: #f8e7b0;
    font-size: 0.95rem;
    border-radius: 6px;
    box-shadow: 0 4px 18px rgba(2, 6, 23, 0.25);
}

.tm-warning strong {
    color: #fff;
    margin-right: 0.4rem;
}

.tm-snapshot-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.tm-snapshot-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
    margin-top: auto;
}

.tm-snapshot-footer .restore-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-left: 1rem;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.tm-snapshot-footer .restore-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4);
}

.tm-snapshot-footer .delete-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tm-snapshot-footer .delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.05);
    border-color: rgba(239, 68, 68, 0.4);
}

/* ======================================================
   Feature: CinePatch
   ====================================================== */
.patch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.patch-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.patch-details {
    display: flex;
    flex-direction: column;
}

/* Provider/Patch Card (Checkboxes) */
.provider-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.provider-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    min-height: 44px;
}

.provider-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.provider-card:has(input:checked) {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.provider-card:has(input:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.card-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.provider-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 4px;
}

.provider-name {
    font-weight: 600;
    color: var(--text-primary);
}

.provider-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    line-height: 1.4;
}

.card-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    color: transparent;
    transition: all 0.2s;
}

.provider-card:has(input:checked) .card-indicator {
    background: var(--accent);
    color: white;
}

.card-indicator svg {
    width: 14px;
    height: 14px;
}

.login-row {
    display: grid;
    gap: 0.5rem;
    margin-top: 1rem;
}

@media (min-width: 640px) {
    .login-row {
        grid-template-columns: 1fr 1fr;
    }
}

.divider-text {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    margin: 1rem 0;
}

.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.divider-text::before {
    margin-right: .5em;
}

.divider-text::after {
    margin-left: .5em;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* ======================================================
   Feature: Addon Locker
   ====================================================== */
.icon-badge {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(59, 130, 246, 0.15));
    border: 2px solid rgba(99, 102, 241, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto var(--space-md);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.2);
    animation: iconFloat 3s ease-in-out infinite;
}

@keyframes iconFloat {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-8px);
    }
}

.login-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.login-status {
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    text-align: center;
    transition: all 0.3s ease;
}

.login-status:not(:empty) {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: var(--accent);
}

.addons-section {
    margin-top: var(--space-xl);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 2px solid rgba(255, 255, 255, 0.08);
}

.section-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.addon-count {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.session-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    animation: fadeInDown 0.4s ease-out;
}

.session-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--accent-subtle);
    color: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
}

.user-avatar svg {
    width: 20px;
    height: 20px;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.user-email {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

.sign-out-btn {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    width: auto;
    box-shadow: none;
}

.sign-out-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
    transform: none;
    box-shadow: none;
}

.addons-container {
    min-height: 200px;
}

.addon-list {
    display: flex;
    /* Unified from grid */
    flex-direction: column;
    gap: var(--space-md);
    animation: fadeInUp 0.4s ease-out;
}

/* Time Machine / Addon Locker Shared Grid List */
.addon-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

/* Note: The above overwrites the flex rule. Will keep the grid one as it seems standard. */

.addon-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 2rem;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 1.5rem;
    transition: all 0.2s ease;
    margin-bottom: 1.5rem;
}

.addon-brand {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 0.75rem;
    min-width: 0;
    text-align: center;
}

.addon-icon-well {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.addon-icon {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    object-fit: cover;
}

.addon-icon-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--text-secondary);
}

.addon-name {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    max-width: 100%;
}

.addon-version {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: monospace;
}

.addon-desc {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.3rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.addon-controls {
    display: flex !important;
    flex-direction: row !important;
    gap: 2rem;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
}

.addon-control-pair {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.control-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.25rem;
}

.addon-control-label-text {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.addon-control-status {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.addon-control-status.allowed {
    color: var(--success);
}

.addon-control-status.blocked {
    color: var(--error);
}

.control-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.control-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.75rem;
    padding: 0;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.control-row-primary {
    margin-bottom: 0.5rem;
}

.control-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.control-text {
    flex: 1;
    margin-right: 1rem;
}

.control-state {
    font-weight: 600;
    margin-left: 0.25rem;
}

.control-sublabel {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ======================================================
   Feature: Cloner
   ====================================================== */
.responsive-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .responsive-columns {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        margin-top: 1.5rem;
    }

    .responsive-columns>*:last-child {
        margin-bottom: 1rem;
    }
}

/* ======================================================
   Utilities & Animations
   ====================================================== */
.hidden {
    display: none !important;
}

.text-muted {
    font-size: 0.85rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

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

.text-success {
    color: var(--success) !important;
}

.text-error {
    color: var(--error) !important;
}

.w-100 {
    width: 100%;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.my-1 {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.pb-3 {
    padding-bottom: 1.5rem;
}

.d-block {
    display: block;
}

.flex-between-baseline {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.flex-col-gap-xs {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.text-caption {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.beta-tag {
    display: inline-block;
    font-size: 0.3em;
    vertical-align: middle;
    margin-left: 0.5rem;
    padding: 0.25em 0.6em;
    -webkit-text-fill-color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius-md);
    font-weight: 700;
    letter-spacing: 0.05em;
    transform: translateY(-0.15em);
    line-height: normal;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes zoomInModal {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes duck-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* FAB Icon States */

@keyframes wave-slide {
    from { background-position-x: 0; }
    to { background-position-x: -20px; }
}

@keyframes wave-slide-hero {
    from { background-position-x: 0; }
    to { background-position-x: -40px; }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* Mobile Global Adjustments (Final Overrides) */
@media (max-width: 480px) {
    h1 {
        font-size: 2.2rem;
    }

    .subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .container {
        padding: 1.25rem;
    }

    label {
        font-size: 0.95rem;
        margin-bottom: 0.4rem;
    }

    .result-box,
    .section-card {
        padding: 1rem;
    }

    #cloneBtn {
        margin-bottom: 4rem;
        width: 100%;
        max-width: 100%;
    }

    .tool-list {
        width: 100%;
    }

    .tab-btn {
        font-size: 0.85rem;
        padding: 0.6rem;
    }
}

@media (max-width: 640px) {
    body.centered {
        padding-top: 2rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .container {
        padding: 1.25rem;
    }

    h1 {
        font-size: 2rem;
    }

    .section-card {
        padding: 1rem;
    }

    .auth-section {
        padding: 1rem;
    }

    .tab-btn {
        padding: 0.6rem;
        font-size: 0.9rem;
    }
}

/* ======================================================
   Feature: Addon Locker
   ====================================================== */
.addon-locker-header {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.user-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(30, 41, 59, 0.8);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 auto 2rem auto;
    max-width: fit-content;
}

.user-status-pill b {
    color: var(--text-primary);
}

.logout-link {
    color: var(--accent);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-left: 0.75rem;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
}

.logout-link:hover {
    color: #60a5fa;
    text-decoration: underline;
}

.addon-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
    align-items: start;
}

.addon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.addon-item:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(255, 255, 255, 0.12);
}

.addon-icon {
    width: 4rem;
    height: 4rem;
    border-radius: 0.75rem;
    object-fit: contain;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.addon-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.addon-icon-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border-radius: 0.75rem;
}

.addon-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
}

.addon-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.addon-control-separator {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
}

.addon-control-pair {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
}

.control-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    line-height: 1;
}

.addon-control-label-text {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0;
}

.addon-control-status {
    font-weight: 700;
    font-size: 0.7rem;
    margin-left: 0;
    margin-bottom: 0;
    text-transform: uppercase;
}

.addon-control-status.allowed {
    color: #86efac;
}

.addon-control-status.blocked {
    color: #fca5a5;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .addon-list {
        grid-template-columns: 1fr;
    }

    .addon-item {
        flex-direction: row;
        text-align: left;
        padding: 1rem;
        gap: 1rem;
        min-height: auto;
    }

    .addon-icon,
    .addon-icon-fallback {
        width: 3rem;
        height: 3rem;
        font-size: 1.5rem;
    }

    .addon-name {
        font-size: 1rem;
        margin-bottom: 0;
        flex: 1;
    }

    .addon-controls {
        width: auto;
        margin-top: 0;
        padding-top: 0;
        border-top: none;
        flex-direction: row;
    }

    .addon-control-status {
        display: block;
        font-size: 0.6rem;
    }
}

/* ======================================================
   Feature: Addon Butler
   ====================================================== */

/* Single-column list — optimised for drag-to-reorder */
.butler-addon-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    animation: fadeInUp 0.4s ease-out;
}

/* Row card */
.butler-addon-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.875rem;
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
}

.butler-addon-item:hover {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(255, 255, 255, 0.13);
}

/* Being dragged */
.butler-addon-item.dragging {
    opacity: 0.45;
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

/* Valid drop target */
.butler-addon-item.drag-over {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.45);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Grip handle */
.butler-drag-handle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    color: rgba(148, 163, 184, 0.4);
    cursor: grab;
    transition: color 0.15s ease;
    padding: 0 2px;
}

.butler-drag-handle:active {
    cursor: grabbing;
}

.butler-addon-item:hover .butler-drag-handle {
    color: rgba(148, 163, 184, 0.8);
}

.butler-drag-handle svg {
    width: 16px;
    height: 16px;
}

/* Icon */
.butler-addon-icon {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.625rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.butler-addon-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.butler-addon-icon .addon-icon-fallback {
    font-size: 1.4rem;
    background: transparent;
    border-radius: 0;
    color: #22c55e;
}

/* Name */
.butler-addon-name {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Controls section — reuse existing toggle styles, just shrink gaps */
.butler-addon-item .addon-controls {
    flex-shrink: 0;
    gap: 0.75rem !important;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    width: auto !important;
}

.butler-addon-item .addon-control-pair {
    gap: 0.2rem;
    font-size: 0.8rem;
}

.butler-addon-item .control-divider {
    height: 28px;
}

/* Mobile adjustments for Addon Butler */
@media (max-width: 640px) {
    .butler-addon-item {
        gap: 0.65rem;
        padding: 0.75rem 0.75rem;
    }

    .butler-addon-name {
        font-size: 0.875rem;
    }

    .butler-addon-icon {
        width: 2.25rem;
        height: 2.25rem;
    }

    .butler-addon-icon .addon-icon-fallback {
        font-size: 1.1rem;
    }
}

/* ======================================================
   Update Notification
   ====================================================== */
.update-notification {
    width: 100%;
    max-width: 600px;
    margin: 0 auto var(--space-lg) auto;
    padding: var(--space-md) var(--space-lg);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(59, 130, 246, 0.1) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
    animation: slideDown 0.3s ease-out;
    z-index: 100;
}

.update-notification.hidden {
    display: none;
}

.update-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.update-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
}

.update-title-group {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    flex: 1;
}

.update-notification h3 {
    margin: 0 0 var(--space-xs) 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.update-version {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.dismiss-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    padding: 0;
}

.dismiss-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    color: var(--text-primary);
}

.update-changes {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    max-height: 130px;
    overflow-y: auto;
    padding-right: var(--space-xs);
}

.update-changes li {
    padding-left: 1.5rem;
    position: relative;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.update-changes li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #10b981;
    font-weight: 600;
}

.update-changes .update-date-header {
    padding-left: 0;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: var(--space-xs);
    margin-bottom: calc(var(--space-xs) / 2);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.update-changes .update-date-header:before {
    display: none;
}

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

@media (max-width: 640px) {
    .update-notification {
        padding: var(--space-md);
        margin: 0 auto var(--space-md) auto;
    }

    .update-header {
        gap: var(--space-sm);
    }

    .update-title-group {
        gap: var(--space-sm);
    }

    .update-notification h3 {
        font-size: 0.95rem;
    }

    .update-changes li {
        font-size: 0.85rem;
    }
}