/* ==========================================================================
   TESLA Fullscreen Launcher - Premium HMI Stylesheet
   Directeur Artistique & Lead Product Designer UI/UX
   ========================================================================== */

/* Design Tokens & Theme Variables */
:root {
    --bg-app: #0F0F12;          /* Premium slate dark gray background */
    --bg-surface: #1A1A1E;      /* Contrasting card & container background */
    --border-color: #2A2A30;    /* Muted structural border */
    --color-primary: #3E6AE1;   /* Tesla / iOS Electric Blue Accent */
    --color-primary-hover: #4F7BF0;
    --color-danger: #E53935;    /* Tesla Alert Red */
    --color-danger-hover: #D32F2F;

    --text-main: #F5F5F5;       /* High-contrast off-white */
    --text-muted: #9AA0A6;      /* Secondary gray */
    --text-dark: #6C727A;       /* Inactive / Placeholder gray */

    --font-brand: 'Exo 2', system-ui, -apple-system, sans-serif;
    --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;

    --transition-snappy: all 120ms cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Light Theme Override Variables */
.light-theme {
    --bg-app: #F4F4F6;                 /* Light grey backdrop */
    --bg-surface: #FFFFFF;             /* Crisp white card base */
    --bg-surface-elevated: #EAEAEE;    /* Elevated light grey */
    --border-color: #D2D2D6;           /* Subtle light border */
    --text-main: #111111;              /* Dark charcoal primary text */
    --text-muted: #5F6368;             /* Muted grey secondary text */
    --text-dark: #8E8E93;              /* Inactive text */
}

/* Light Theme Image Inversions for Dark Logos */
.light-theme .home-logo,
.light-theme .header-logo-img {
    filter: invert(1) hue-rotate(180deg) brightness(0.95);
    mix-blend-mode: multiply;
}

/* Material Symbols Custom configuration (Lightweight & Premium) */
.material-symbols-outlined {
    font-variation-settings:
        'FILL' 0,
        'wght' 300, /* Ultra-thin, elegant automotive feel */
        'GRAD' 0,
        'opsz' 24;
    font-size: 22px;
    display: inline-block;
    line-height: 1;
    color: inherit;
    vertical-align: middle;
}

/* Reset and Haptic Baseline */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none; /* Block selection on touchscreens */
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Strict SPA layout - no vertical scroll */
}

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    font-family: var(--font-ui);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Base App Layout (Fixed Viewport ~900px Optimized Landscape) */
.app-container {
    width: 100%;
    height: 100%;
    max-height: 900px;
    max-width: 1440px;
    padding: 8px 32px 16px 32px; /* Pull header to the top, compact bottom padding */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
}

/* Generic Hidden State */
.hidden {
    display: none !important;
}

/* ==========================================================================
   Header Section (Wordmark & Minimal Utilities)
   ========================================================================== */
.app-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.header-left {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.header-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.header-right {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
}

.header-brand-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo-img {
    height: 38px;
    width: auto;
    object-fit: contain;
}

.header-brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand-title {
    font-family: var(--font-brand);
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 0.16em;
    color: var(--text-main);
    line-height: 1.1;
}

.brand-subtitle {
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Header actions wrapper (simplified) */

.header-action-btn {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-snappy);
}

.header-action-btn:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
    transform: scale(1.02);
}

.header-clock {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.app-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly; /* Even spacing across screen height */
    padding: 12px 0;
}

/* ==========================================================================
   Console Input Section (Paste & Large Actions)
   ========================================================================== */
.home-logo-container {
    text-align: center;
    margin-bottom: 8px;
    width: 100%;
}

.home-logo {
    max-width: 640px;
    width: 86%;
    height: auto;
    object-fit: contain;
}

.console-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    gap: 14px;
}

.console-label-row {
    width: 100%;
    display: flex;
    justify-content: flex-start;
}

.console-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.console-input-wrapper {
    position: relative;
    width: 100%;
}

#url-input {
    width: 100%;
    height: 60px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    padding: 0 60px 0 20px;
    font-family: var(--font-ui);
    font-size: 16px;
    outline: none;
    transition: var(--transition-snappy);
    user-select: text;
}

#url-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary);
}

.clear-btn-overlay {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-snappy);
    opacity: 0;
    pointer-events: none;
}

.clear-btn-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.clear-btn-overlay:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

/* Typing touch helpers */
.touch-assist-row {
    display: flex;
    gap: 12px;
    width: 100%;
}

.assist-btn {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    flex-grow: 1;
    height: 48px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-snappy);
}

.assist-btn:hover {
    background-color: var(--border-color);
    color: var(--text-main);
}

.assist-btn:active {
    transform: scale(0.97);
}

/* Launch Action Controls */
.launch-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 14px;
    margin-top: 6px;
}

.btn-launch-primary {
    width: 100%;
    height: 64px; /* Touch target optimized */
    background-color: var(--color-primary);
    border: none;
    border-radius: var(--radius-md);
    color: #FFFFFF;
    font-family: var(--font-ui);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    transition: var(--transition-snappy);
    box-shadow: 0 4px 16px rgba(62, 106, 225, 0.25);
}

.btn-launch-primary:hover {
    background-color: var(--color-primary-hover);
    box-shadow: 0 6px 20px rgba(62, 106, 225, 0.35);
    transform: scale(1.01);
}

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

.btn-launch-secondary {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-snappy);
    padding: 6px 16px;
}

.btn-launch-secondary:hover {
    color: var(--text-main);
    text-decoration: underline;
}

/* ==========================================================================
   Quick Apps Grid Section
   ========================================================================== */
.quick-apps-section {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.quick-apps-grid {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    flex-wrap: wrap; /* Wraps cleanly to a 2nd line if screen is narrow or extra apps are added */
}

.quick-app-btn {
    width: 120px; /* Sized up from 108px */
    height: 110px; /* Sized up from 100px */
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-ui);
    font-size: 13px; /* Slightly larger text */
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-snappy);
    display: flex;
    flex-direction: column; /* Stack vertically */
    align-items: center;
    justify-content: center;
    gap: 10px; /* Gap between icon and text */
    position: relative;
    flex-shrink: 0;
}

.quick-app-btn img {
    width: 48px; /* Sized up from 40px */
    height: 48px;
    border-radius: 8px;
    object-fit: contain;
}

.quick-app-symbol {
    font-size: 48px !important; /* Sized up from 40px */
    color: var(--color-primary);
    transition: var(--transition-snappy);
}

.quick-app-btn:hover .quick-app-symbol {
    color: var(--text-main);
}

.modal-action-favicon-img {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: contain;
    flex-shrink: 0;
}

.quick-app-btn:hover {
    border-color: var(--color-primary);
    background-color: #202025;
    transform: scale(1.02);
}

.quick-app-btn:active {
    transform: scale(0.97);
}

.quick-app-btn .card-delete-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: var(--color-danger);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 1px solid var(--border-color);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 5;
}

.quick-app-btn .card-delete-badge:hover {
    background-color: var(--color-danger-hover);
}


/* ==========================================================================
   Favorites & Recents Horizontal Carousel
   ========================================================================== */
.favorites-section {
    width: 100%;
    max-width: 100%;
    margin: 28px auto 0 auto; /* generous spacing, no visual line */
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.edit-favorites-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-snappy);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.edit-favorites-btn:hover {
    color: var(--text-main);
    background-color: var(--bg-surface);
}

.edit-favorites-btn.active {
    color: var(--color-danger);
    background-color: rgba(229, 57, 53, 0.1);
}

.carousel-outer {
    position: relative;
    width: 100%;
    margin: 0 -4px;
}

.favorites-carousel {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 4px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Hide scrollbar Firefox */
}

.favorites-carousel::-webkit-scrollbar {
    display: none; /* Hide scrollbar Chrome/Safari */
}

/* Smart Card Design */
.smart-card {
    flex: 0 0 260px; /* Width expanded slightly to balance same-line elements */
    height: 96px; /* Reduced vertical height */
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    scroll-snap-align: start;
    cursor: pointer;
    transition: var(--transition-snappy);
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.smart-card:hover {
    border-color: var(--color-primary);
    transform: scale(1.02);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.smart-card:active {
    transform: scale(0.97);
}

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

.smart-card-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 85%;
    overflow: hidden;
}

.smart-card-icon {
    width: 32px; /* Enlarge favorite site logo */
    height: 32px;
    border-radius: 6px;
    object-fit: contain;
    flex-shrink: 0;
}

.smart-card-title {
    font-size: 16px; /* Enlarge favorite site label */
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smart-card-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 4px;
    gap: 8px;
}

.smart-card-context {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 65%; /* Restricts context width so button is fully visible */
}

.smart-card-launch-btn {
    background: none;
    border: none;
    color: var(--color-primary);
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    pointer-events: none; /* Tap resolves to parent card */
    flex-shrink: 0;
}

/* Edit / Delete trigger button overlays */
.card-delete-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--color-danger);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 5;
}

.card-delete-badge:hover {
    background-color: var(--color-danger-hover);
}

/* Unified [+] Add Card */
.add-favorite-card {
    border-style: dashed;
    border-color: var(--text-dark);
    background-color: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
}

.add-favorite-card:hover {
    border-color: var(--text-muted);
    background-color: rgba(255, 255, 255, 0.02);
}

.add-card-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    border: 1px solid var(--border-color);
}

.add-card-label {
    font-size: 12px;
    font-weight: 500;
}

/* ==========================================================================
   Floating Glassmorphic Modals Overlay
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(10, 10, 12, 0.82);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 120ms ease-out;
}

.modal-content {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    animation: modalSlideUp 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from {
        transform: translateY(12px) scale(0.98);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.5px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition-snappy);
}

.modal-close:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.modal-body {
    padding: 24px;
}

.form-padding {
    padding: 24px;
}

.scrollable-modal-body {
    max-height: 480px;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Form Styles inside Modals */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.form-group:last-of-type {
    margin-bottom: 24px;
}

.form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.form-group input {
    width: 100%;
    height: 52px;
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    padding: 0 16px;
    font-family: var(--font-ui);
    font-size: 14px;
    outline: none;
    transition: var(--transition-snappy);
    user-select: text;
}

.form-group input:focus {
    border-color: var(--color-primary);
}

/* Icon selection grid inside add favorites */
.icon-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.selector-icon-item {
    height: 48px;
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-snappy);
}

.selector-icon-item.active {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--text-main);
}

/* Modal Actions List (Options Modal) */
.modal-actions-list {
    display: flex;
    flex-direction: column;
}

.modal-action-row {
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 18px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    width: 100%;
    cursor: pointer;
    transition: var(--transition-snappy);
    color: var(--text-main);
}

.modal-action-icon {
    font-size: 20px;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: var(--transition-snappy);
}

.modal-action-row:hover .modal-action-icon {
    color: var(--text-main);
    transform: scale(1.05);
}

.modal-action-row:last-child {
    border-bottom: none;
}

.modal-action-row:hover {
    background-color: rgba(128, 128, 128, 0.06);
}

.modal-action-details {
    display: flex;
    flex-direction: column;
}

.modal-action-name {
    font-size: 15px;
    font-weight: 600;
}

.modal-action-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
}

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

.text-red:hover {
    background-color: rgba(229, 57, 53, 0.05);
}

/* Help Guide Cards */
.help-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: var(--radius-md);
}

.help-item h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.help-item p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Modal Button Styling */
.btn-modal-primary {
    width: 100%;
    height: 56px;
    background-color: var(--color-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: #FFFFFF;
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-snappy);
}

.btn-modal-primary:hover {
    background-color: var(--color-primary-hover);
}

.btn-modal-primary:active {
    transform: scale(0.97);
}

.btn-modal-danger {
    width: 100%;
    height: 48px;
    background-color: transparent;
    border: 1px solid var(--color-danger);
    border-radius: var(--radius-sm);
    color: var(--color-danger);
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-snappy);
    margin-top: 10px;
}

.btn-modal-danger:hover {
    background-color: var(--color-danger);
    color: white;
}

/* Haptic Settings Control Components */
.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.settings-row:last-of-type {
    border-bottom: none;
}

.settings-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-width: 70%;
}

.settings-name {
    font-size: 14px;
    font-weight: 600;
}

.settings-desc {
    font-size: 11px;
    color: var(--text-muted);
}

/* iOS Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: var(--transition-snappy);
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-snappy);
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--color-primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Segmented Control for Clock Format */
.segmented-control {
    display: flex;
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 4px;
}

.segment-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition-snappy);
}

.segment-btn.active {
    background-color: var(--color-primary);
    color: #FFFFFF;
}

/* ==========================================================================
   Redirection Fullscreen Transition Screen
   ========================================================================== */
.redirect-screen {
    background-color: var(--bg-app);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.redirect-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 400px;
    text-align: center;
}

.redirect-logo-wrapper {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.monogram-logo {
    font-family: var(--font-brand);
    font-size: 32px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--color-primary);
}

.redirect-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.redirect-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 32px;
}

.progress-bar-container {
    width: 280px;
    height: 4px;
    background-color: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 24px;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background-color: var(--color-primary);
    border-radius: 2px;
    transition: width 1.4s cubic-bezier(0.1, 0.8, 0.2, 1);
    animation: progressPulse 1.2s infinite ease-in-out;
}

@keyframes progressPulse {
    0% { opacity: 0.8; }
    50% { opacity: 1; }
    100% { opacity: 0.8; }
}

/* GPU-Accelerated Snappy Tactile Buttons Active Press Scale */
.btn-launch-primary:active,
.btn-launch-secondary:active,
.quick-app-btn:active,
.smart-card:active,
.segment-btn:active,
.assist-btn:active,
.header-action-btn:active,
.btn-modal-primary:active,
.btn-modal-danger:active,
.modal-action-row:active,
.modal-close:active {
    transform: scale(0.96) !important;
}

.redirect-fallback-tip {
    font-size: 11px;
    color: var(--text-dark);
}

/* ==========================================================================
   Footer & Legal Disclaimer Section
   ========================================================================== */
.settings-footer-credits {
    margin-top: 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 14px;
}

.settings-credit-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.settings-disclaimer-text {
    font-size: 10px;
    color: var(--text-dark);
    line-height: 1.35;
    max-width: 500px;
    margin: 0 auto;
}

/* ==========================================================================
   Home Screen V1 - Validated Tesla HMI
   ========================================================================== */
:root {
    --bg-app: #05070B;
    --bg-surface: rgba(14, 17, 24, 0.76);
    --bg-surface-strong: rgba(10, 12, 18, 0.92);
    --border-color: rgba(255, 255, 255, 0.14);
    --border-soft: rgba(255, 255, 255, 0.08);
    --color-primary: #E82127;
    --color-primary-hover: #F02B31;
    --text-main: #F7F7F8;
    --text-muted: #A1A6B2;
    --text-dark: #687280;
    --shadow-card: 0 14px 34px rgba(0, 0, 0, 0.36);
    --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.24);
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --transition-snappy: color 120ms ease-out, border-color 120ms ease-out, background-color 120ms ease-out, transform 120ms ease-out, box-shadow 120ms ease-out;
}

/* REVIEW-001 #2 — Light theme: premium warm grey foundation, stronger
   card separation, reinforced borders and desaturated background. */
body.light-theme {
    --bg-app: #E4E7EC;
    --bg-surface: rgba(255, 255, 255, 0.82);
    --bg-surface-strong: rgba(255, 255, 255, 0.94);
    --border-color: rgba(17, 20, 28, 0.16);
    --border-soft: rgba(17, 20, 28, 0.10);
    --text-main: #111318;
    --text-muted: #4E545E;
    --text-dark: #6E7580;
    --shadow-card: 0 10px 24px rgba(40, 52, 72, 0.14);
    --shadow-soft: 0 6px 18px rgba(40, 52, 72, 0.10);
}

html,
body {
    width: 100%;
    min-width: 100%;
}

body {
    background:
        radial-gradient(ellipse at 50% 38%, rgba(37, 43, 57, 0.42) 0%, rgba(6, 8, 13, 0.72) 34%, rgba(2, 4, 8, 0.98) 78%),
        linear-gradient(160deg, rgba(3, 5, 9, 0.96) 0%, rgba(12, 15, 24, 0.92) 44%, rgba(3, 5, 8, 0.98) 100%);
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
}

/* REVIEW-001 #3 — Reduce geometric background shape visibility.
   Shapes stay atmospheric but never compete with cards or text. */
body::before {
    background:
        linear-gradient(150deg, transparent 0 18%, rgba(21, 26, 37, 0.38) 18.2% 28%, transparent 28.2%),
        linear-gradient(28deg, transparent 0 18%, rgba(16, 20, 29, 0.42) 18.3% 32%, transparent 32.2%),
        radial-gradient(ellipse at 52% 36%, rgba(232, 33, 39, 0.06), transparent 32%),
        radial-gradient(ellipse at 86% 52%, rgba(232, 33, 39, 0.07), transparent 24%);
    opacity: 0.7;
}

body::after {
    background:
        linear-gradient(to bottom, rgba(0, 0, 0, 0.34), transparent 26%, rgba(0, 0, 0, 0.44) 100%),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 4px);
}

/* REVIEW-001 #2 — Desaturated and darkened light-theme background artwork */
body.light-theme {
    background:
        radial-gradient(ellipse at 52% 42%, rgba(240, 242, 246, 0.9) 0%, rgba(224, 228, 236, 0.78) 38%, rgba(210, 216, 226, 0.92) 100%),
        linear-gradient(155deg, #DFE3EA 0%, #EBEEF3 48%, #D6DBE2 100%);
}

/* REVIEW-001 #2 — Reduced light-theme geometric contrast */
body.light-theme::before {
    background:
        linear-gradient(150deg, transparent 0 17%, rgba(190, 198, 212, 0.52) 17.3% 31%, transparent 31.2%),
        linear-gradient(28deg, transparent 0 18%, rgba(198, 206, 218, 0.56) 18.3% 34%, transparent 34.2%),
        radial-gradient(ellipse at 86% 55%, rgba(232, 33, 39, 0.06), transparent 28%);
}

body.light-theme::after {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.12), transparent 30%, rgba(255, 255, 255, 0.2) 100%);
}

.app-container {
    max-width: 1536px;
    max-height: 1024px;
    min-height: 720px;
    padding: 20px 30px 14px;
    justify-content: flex-start;
    gap: 0;
}

.app-header {
    height: 66px;
    padding: 0;
    border-bottom: none;
}

/* REVIEW-001 #1 — Header logo reduced ~22% for better alignment */
.tesla-mark {
    color: var(--color-primary);
    font-family: var(--font-brand);
    font-size: 52px;
    font-weight: 700;
    line-height: 0.8;
    width: 62px;
    height: 48px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    transform: scaleX(1.32);
    text-shadow: 0 0 12px rgba(232, 33, 39, 0.2);
}

.header-center {
    gap: 14px;
    color: var(--text-main);
    min-width: 310px;
}

.header-time-icon {
    font-size: 21px;
    color: var(--text-main);
}

.header-clock {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0;
}

.header-divider,
.footer-divider {
    width: 1px;
    height: 24px;
    background-color: var(--border-color);
}

.header-date {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

.header-right {
    gap: 24px;
}

.header-action-btn {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
    border: 1px solid var(--border-color);
    color: var(--text-main);
    box-shadow: var(--shadow-soft);
    position: relative;
}

.header-action-btn .material-symbols-outlined {
    font-size: 31px;
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
}

.header-action-btn.active-theme::after {
    content: "";
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--color-primary);
    left: 50%;
    bottom: -5px;
    transform: translateX(-50%);
    box-shadow: 0 0 10px rgba(232, 33, 39, 0.72);
}

.app-main {
    flex: 1;
    padding: 8px 18px 0;
    justify-content: flex-start;
    gap: 20px;
}

.console-section {
    max-width: 892px;
    gap: 16px;
    margin-top: -18px;
}

.home-logo-container {
    height: 116px;
    overflow: hidden;
}

.home-logo {
    max-width: 508px;
    width: 52vw;
    transform: translateY(-2px);
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.4));
}

body.light-theme .home-logo {
    filter: invert(1) hue-rotate(180deg) brightness(0.2) drop-shadow(0 5px 14px rgba(255, 255, 255, 0.22));
    mix-blend-mode: multiply;
}

.console-input-wrapper {
    height: 78px;
    display: grid;
    grid-template-columns: 64px 1fr 208px;
    align-items: center;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.025));
    border: 1px solid var(--border-color);
    border-radius: 26px;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

body.light-theme .console-input-wrapper {
    background: rgba(255, 255, 255, 0.78);
}

.launcher-link-icon {
    justify-self: center;
    font-size: 31px;
    color: var(--text-main);
}

#url-input {
    height: 100%;
    min-width: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0 48px 0 0;
    font-size: 22px;
    font-weight: 400;
    box-shadow: none;
}

#url-input::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

#url-input:focus {
    border-color: transparent;
    box-shadow: none;
}

.clear-btn-overlay {
    right: 214px;
}

.btn-launch-primary {
    width: 100%;
    height: 100%;
    border-radius: 0;
    background: linear-gradient(180deg, #E82127, #A90F18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 10px 24px rgba(232, 33, 39, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.btn-launch-primary .material-symbols-outlined {
    font-size: 34px;
}

.quick-apps-section,
.favorites-section {
    width: 100%;
    max-width: none;
    gap: 18px;
    margin: 0;
}

.section-header {
    padding: 0;
}

.section-title {
    color: var(--text-main);
    font-size: 20px;
    letter-spacing: 0.12em;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title::before {
    content: "";
    width: 3px;
    height: 22px;
    border-radius: 3px;
    background-color: var(--color-primary);
    box-shadow: 0 0 10px rgba(232, 33, 39, 0.45);
}

.edit-favorites-btn {
    color: var(--color-primary);
    font-size: 18px;
    font-weight: 500;
    padding: 8px 14px;
}

.edit-favorites-btn::after {
    content: " edit";
    font-family: "Material Symbols Outlined";
    font-size: 18px;
    vertical-align: -3px;
    margin-left: 8px;
}

.quick-apps-grid {
    gap: 14px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 3px;
}

.quick-apps-grid::-webkit-scrollbar,
.favorites-carousel::-webkit-scrollbar {
    display: none;
}

.quick-app-btn {
    width: 144px;
    height: 170px;
    border-radius: 13px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.018));
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    gap: 26px;
    font-size: 18px;
    font-weight: 500;
    flex: 0 0 144px;
}

.quick-app-btn:hover,
.smart-card:hover {
    border-color: var(--border-color);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.018));
    transform: none;
    box-shadow: var(--shadow-card);
}

body.light-theme .quick-app-btn:hover,
body.light-theme .smart-card:hover {
    background: rgba(255, 255, 255, 0.68);
}

/* REVIEW-001 #2 — Stronger card separation on light theme */
body.light-theme .quick-app-btn,
body.light-theme .smart-card {
    background: rgba(255, 255, 255, 0.82);
    border-color: rgba(17, 20, 28, 0.13);
    box-shadow: 0 4px 16px rgba(40, 52, 72, 0.10);
}

.quick-app-btn img {
    width: 74px;
    height: 74px;
    border-radius: 12px;
}

.quick-app-btn .card-delete-badge {
    top: 10px;
    right: 10px;
}

.quick-app-symbol {
    font-size: 62px !important;
    color: var(--text-muted);
}

.favorites-section {
    margin-top: 4px;
}

/* REVIEW-001 #5 — Fix right-side clipping: deliberate edge fade mask
   shows a partial preview of the next card instead of hard clipping. */
.carousel-outer {
    margin: 0;
    -webkit-mask-image: linear-gradient(to right, #000 0%, #000 92%, transparent 100%);
    mask-image: linear-gradient(to right, #000 0%, #000 92%, transparent 100%);
}

.favorites-carousel {
    gap: 14px;
    padding: 0 24px 4px 0;
}

.smart-card {
    flex: 0 0 220px;
    width: 220px;
    height: 90px;
    border-radius: 12px;
    padding: 14px 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.062), rgba(255, 255, 255, 0.018));
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
}

.smart-card-header {
    min-height: 34px;
}

.smart-card-brand {
    max-width: calc(100% - 28px);
    gap: 14px;
}

/* REVIEW-001 #6 — Normalized favicon size across all cards */
.smart-card-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    object-fit: contain;
    background-color: rgba(128, 128, 128, 0.08);
}

.smart-card-title {
    font-size: 16px;
    font-weight: 500;
}

.smart-card-context {
    font-size: 14px;
    max-width: 70%;
}

.smart-card-launch-btn {
    font-size: 0;
    color: var(--text-muted);
}

.smart-card-launch-btn::after {
    content: "chevron_right";
    font-family: "Material Symbols Outlined";
    font-size: 30px;
    font-weight: 300;
}

.add-favorite-card,
.quick-app-btn.add-quick-app-btn {
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.015);
    color: var(--text-muted);
}

.quick-app-btn.add-quick-app-btn {
    width: 116px;
    flex-basis: 116px;
}

body.light-theme .add-favorite-card,
body.light-theme .quick-app-btn.add-quick-app-btn {
    border-color: rgba(17, 20, 28, 0.22);
    background: rgba(255, 255, 255, 0.42);
}

.add-card-icon {
    width: auto;
    height: auto;
    background: transparent;
    border: none;
    font-size: 42px;
    font-weight: 200;
}

.add-card-label {
    font-size: 18px;
}

.app-footer {
    position: relative;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 16px;
}

.footer-credit {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-heart {
    color: var(--color-primary);
    font-size: 24px;
    line-height: 1;
}

.footer-info-btn {
    position: absolute;
    right: 0;
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.footer-info-btn .material-symbols-outlined {
    font-size: 28px;
}

body.light-theme .tesla-mark,
body.light-theme .footer-heart,
body.light-theme .section-title::before,
body.light-theme .edit-favorites-btn {
    color: var(--color-primary);
}

@media (max-width: 1180px) {
    .app-container {
        padding: 18px 20px 12px;
    }

    .app-main {
        padding-inline: 0;
        gap: 22px;
    }

    .console-section {
        margin-top: 12px;
    }

    .quick-app-btn {
        width: 132px;
        height: 154px;
        flex-basis: 132px;
        font-size: 15px;
    }

    .smart-card {
        flex-basis: 198px;
        width: 198px;
    }
}
