/* ============================================
   BASE
   ============================================ */
* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    background: linear-gradient(135deg, #e0f2fe 0%, #ffffff 100%);
    transition: background 0.3s ease, color 0.3s ease;
}
.dark body { background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); }

.glass-panel {
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.3);
}
.dark .glass-panel {
    background: rgba(30,41,59,0.7);
    border: 1px solid rgba(255,255,255,0.1);
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(156,163,175,0.5); border-radius: 10px; }
.dark ::-webkit-scrollbar-thumb { background: rgba(71,85,105,0.8); }

/* ============================================
   MESSAGES
   ============================================ */
.message-user { background: #ebebeb; color: #1a1a1a; }
.dark .message-user { background: #303030; color: #ececec; }
.message-ai { color: #1e293b; }
.dark .message-ai { color: #e2e8f0; }

.prose pre { background: #1e293b !important; color: #e2e8f0; padding: 1rem; border-radius: 0.5rem; overflow-x: auto; }
.prose code { color: #ec4899; background: rgba(128,128,128,0.1); padding: 0.2em 0.4em; border-radius: 0.25rem; font-size: 0.875em; }
.dark .prose code { color: #f472b6; }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.animate-slide-in { animation: slideIn 0.3s cubic-bezier(0.16,1,0.3,1) forwards; will-change: opacity, transform; }

@keyframes toastSlide {
    from { opacity: 0; transform: translateY(100%); }
    to   { opacity: 1; transform: translateY(0); }
}
.toast-enter { animation: toastSlide 0.3s cubic-bezier(0.16,1,0.3,1) forwards; }

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar-container { transition: margin-left 0.3s cubic-bezier(0.4,0,0.2,1); }
.sidebar-collapsed { margin-left: -16rem; }
@media (max-width: 768px) {
    .sidebar-container { position: absolute; z-index: 50; height: 100%; margin-left: -16rem; }
    .sidebar-open-mobile { margin-left: 0; }
}

/* ============================================
   TABS (settings)
   ============================================ */
.tab-btn { border-bottom: 2px solid transparent; transition: all 0.2s; }
.tab-btn.active { border-bottom-color: #3b82f6; color: #3b82f6; }
.dark .tab-btn.active { color: #60a5fa; border-bottom-color: #60a5fa; }

textarea::-webkit-scrollbar { width: 4px; }

/* ============================================
   MARKDOWN PROSE RENDERING
   ============================================ */

/* Inline code */
.inline-code {
    font-family: ui-monospace, 'Fira Code', monospace;
    font-size: 0.82em;
    padding: 0.15em 0.45em;
    border-radius: 4px;
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    border: 1px solid rgba(99, 102, 241, 0.2);
    white-space: nowrap;
}
.dark .inline-code {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border-color: rgba(99, 102, 241, 0.25);
}

/* Fenced code block inside prose */
.prose-code-block {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.08);
    background: #0f172a;
    margin: 0.75rem 0;
    font-size: 0;
}
.dark .prose-code-block {
    border-color: rgba(255,255,255,0.07);
}

.prose-code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: #1e293b;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-size: 11px;
}

.prose-code-lang {
    font-family: ui-monospace, monospace;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #60a5fa;
    display: flex;
    align-items: center;
    gap: 6px;
}

.prose-code-copy {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #64748b;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}
.prose-code-copy:hover { background: rgba(255,255,255,0.08); color: #94a3b8; }

.prose-code-pre {
    margin: 0 !important;
    padding: 14px 16px !important;
    background: transparent !important;
    overflow-x: auto;
    border-left: 3px solid #3b82f6;
}
.prose-code-pre code {
    font-family: ui-monospace, 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.65;
    color: #e2e8f0;
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    white-space: pre;
}

/* Tables */
.prose-table-wrap {
    overflow-x: auto;
    margin: 0.75rem 0;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.08);
}
.dark .prose-table-wrap {
    border-color: rgba(255,255,255,0.08);
}
.prose-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.prose-table th {
    background: rgba(59,130,246,0.08);
    color: #3b82f6;
    font-weight: 700;
    padding: 9px 14px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(59,130,246,0.15);
}
.dark .prose-table th {
    background: rgba(59,130,246,0.1);
    color: #60a5fa;
    border-bottom-color: rgba(59,130,246,0.2);
}
.prose-table td {
    padding: 8px 14px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    color: #374151;
    vertical-align: top;
}
.dark .prose-table td {
    color: #cbd5e1;
    border-bottom-color: rgba(255,255,255,0.05);
}
.prose-table tr:last-child td { border-bottom: none; }
.prose-table tr:hover td {
    background: rgba(59,130,246,0.03);
}
.dark .prose-table tr:hover td {
    background: rgba(59,130,246,0.05);
}

/* Blockquotes */
.prose-blockquote {
    margin: 0.75rem 0;
    padding: 10px 16px;
    border-left: 3px solid #3b82f6;
    background: rgba(59,130,246,0.05);
    border-radius: 0 8px 8px 0;
    color: #475569;
    font-style: italic;
}
.dark .prose-blockquote {
    background: rgba(59,130,246,0.08);
    color: #94a3b8;
}
.prose-blockquote p { margin: 0; }

/* ============================================
   PROSE-MSG: AI bubble text container
   Replaces Tailwind prose classes to avoid margin bleed
   ============================================ */
.prose-msg {
    font-size: 0.9rem;
    line-height: 1.65;
    color: inherit;
    max-width: none;
    font-family: Georgia, 'Times New Roman', Times, serif;
}
.prose-msg p {
    margin: 0 0 0.5em 0;
}
.prose-msg p:last-child {
    margin-bottom: 0;
}
.prose-msg strong { font-weight: 700; }
.prose-msg em { font-style: italic; }
.prose-msg a { color: #3b82f6; text-decoration: underline; text-underline-offset: 2px; }
.dark .prose-msg a { color: #60a5fa; }
.prose-msg ul, .prose-msg ol { padding-left: 1.4em; margin: 0.4em 0; }
.prose-msg li { margin: 0.2em 0; }
.prose-msg hr { border: none; border-top: 1px solid rgba(0,0,0,0.1); margin: 0.6em 0; }
.dark .prose-msg hr { border-top-color: rgba(255,255,255,0.1); }
.prose-msg h1, .prose-msg h2, .prose-msg h3, .prose-msg h4 {
    font-weight: 700; margin: 0.8em 0 0.3em 0; line-height: 1.3; color: inherit;
}
.prose-msg h1 { font-size: 1.2em; }
.prose-msg h2 { font-size: 1.1em; }
.prose-msg h3 { font-size: 1em; }

/* General prose cleanup inside AI bubbles */
.prose h1, .prose h2, .prose h3, .prose h4 {
    color: inherit;
    font-weight: 700;
    margin-top: 1rem;
    margin-bottom: 0.4rem;
    line-height: 1.3;
}
.prose h1 { font-size: 1.2em; }
.prose h2 { font-size: 1.1em; }
.prose h3 { font-size: 1em; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0.4rem 0; }
.prose li { margin: 0.2rem 0; }
.prose p { margin: 0.35rem 0; }
.prose p:first-child { margin-top: 0; }
.prose p:last-child { margin-bottom: 0; padding-bottom: 0; }
.prose strong { font-weight: 700; }
.prose em { font-style: italic; }
.prose a { color: #3b82f6; text-decoration: underline; text-underline-offset: 2px; }
.dark .prose a { color: #60a5fa; }
.prose hr { border: none; border-top: 1px solid rgba(0,0,0,0.1); margin: 0.75rem 0; }
.dark .prose hr { border-top-color: rgba(255,255,255,0.1); }

/* ============================================
   ARTIFACT CARD (inline in chat bubble)
   ============================================ */
.artifact-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 12px 14px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.artifact-card:hover {
    border-color: rgba(59,130,246,0.4);
    box-shadow: 0 0 0 2px rgba(59,130,246,0.1);
}

.artifact-card-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.artifact-card-icon-wrap {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(59,130,246,0.15);
    border: 1px solid rgba(59,130,246,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #60a5fa;
    font-size: 15px;
}

.artifact-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.artifact-card-title {
    font-size: 14px;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: 0.01em;
    font-family: ui-monospace, monospace;
    line-height: 1.3;
}

.artifact-card-lang-label {
    font-size: 11px;
    font-weight: 600;
    color: #60a5fa;
    font-family: ui-monospace, monospace;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1.2;
}

.artifact-card-meta {
    font-size: 11px;
    color: #475569;
    line-height: 1.2;
}

.artifact-card-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(59,130,246,0.15);
    border: 1px solid rgba(59,130,246,0.3);
    color: #60a5fa;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.artifact-card-btn:hover {
    background: rgba(59,130,246,0.25);
    border-color: rgba(59,130,246,0.5);
    color: #93c5fd;
}
.artifact-card-btn i { font-size: 11px; }

/* ============================================
   RESIZE HANDLE
   ============================================ */
.resize-handle {
    width: 5px;
    cursor: col-resize;
    background: transparent;
    position: relative;
    flex-shrink: 0;
    z-index: 10;
    transition: background 0.15s;
}
.resize-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 40px;
    border-radius: 2px;
    background: rgba(99,102,241,0.0);
    transition: background 0.15s, height 0.15s;
}
.resize-handle:hover { background: rgba(59,130,246,0.06); }
.resize-handle:hover::after { background: rgba(99,102,241,0.5); height: 64px; }
.resize-handle:active { background: rgba(59,130,246,0.12); }
.resize-handle:active::after { background: #6366f1; height: 80px; }

/* ============================================
   ARTIFACT SIDE PANEL
   ============================================ */
.artifact-panel {
    flex-direction: column;
    background: #0d1117;
    min-width: 300px;
    overflow: hidden;

    /* Slide-in animation */
    transform: translateX(100%);
    opacity: 0;
    transition: transform 0.22s cubic-bezier(0.4,0,0.2,1),
                opacity 0.22s ease;
}
.artifact-panel.panel-open {
    transform: translateX(0);
    opacity: 1;
}

/* Panel header */
.artifact-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #161b22;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
    min-height: 52px;
}

.artifact-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #60a5fa;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    font-family: ui-monospace, monospace;
    flex: 1;
    min-width: 0;
}

.artifact-panel-filename {
    color: #475569;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    font-size: 11px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

/* Panel tabs */
.artifact-panel-tabs {
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.35);
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
    flex-shrink: 0;
}
.artifact-panel-tabs.hidden { display: none; }

.artifact-tab {
    font-size: 11px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.artifact-tab i { font-size: 10px; }
.artifact-tab:hover { color: #94a3b8; background: rgba(255,255,255,0.05); }
.artifact-tab.active { background: #3b82f6; color: #fff; box-shadow: 0 1px 4px rgba(59,130,246,0.35); }

/* Panel actions */
.artifact-panel-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.artifact-action-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #64748b;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 13px;
}
.artifact-action-btn:hover { background: rgba(255,255,255,0.08); color: #94a3b8; }
.artifact-action-btn.copied { color: #34d399; }

/* Panel body */
.artifact-panel-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.artifact-panel-code-pane {
    flex: 1;
    overflow: auto;
    border-left: 3px solid #3b82f6;
}
.artifact-panel-code-pane::-webkit-scrollbar { width: 5px; height: 5px; }
.artifact-panel-code-pane::-webkit-scrollbar-track { background: transparent; }
.artifact-panel-code-pane::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

.artifact-panel-preview-pane {
    flex: 1;
    overflow: hidden;
    background: #fff;
}
.artifact-panel-preview-pane iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Code display */
.artifact-pre {
    margin: 0 !important;
    padding: 20px 24px !important;
    background: transparent !important;
    border-radius: 0 !important;
    overflow: visible !important;
}

.artifact-code {
    font-family: ui-monospace, 'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.7;
    color: #e2e8f0;
    white-space: pre;
    display: block;
    background: transparent !important;
    padding: 0 !important;
}

/* ============================================
   MODEL DROPDOWN
   ============================================ */
#modelDropdownMenu {
    scrollbar-width: thin;
    padding: 0.5rem 0;
}
#modelDropdownMenu::-webkit-scrollbar { width: 6px; }
#modelDropdownMenu::-webkit-scrollbar-thumb { background: rgba(156,163,175,0.5); border-radius: 10px; }
.dark #modelDropdownMenu::-webkit-scrollbar-thumb { background: rgba(71,85,105,0.8); }

.model-provider-group { display: flex; flex-direction: column; border-bottom: 1px solid rgba(156,163,175,0.1); }
.dark .model-provider-group { border-bottom-color: rgba(255,255,255,0.05); }
.model-provider-group:last-child { border-bottom: none; }

.model-provider-name {
    font-weight: 700; font-size: 0.65rem; color: #94a3b8;
    text-transform: uppercase; letter-spacing: 0.05em;
    padding: 0.75rem 1rem 0.35rem;
    background: rgba(156,163,175,0.03);
    display: flex; align-items: center;
}
.dark .model-provider-name { color: #64748b; background: rgba(0,0,0,0.1); }

.model-item {
    display: flex; align-items: center; width: 100%;
    padding: 0.65rem 1rem; text-align: left; font-size: 0.85rem;
    color: #475569; transition: all 0.2s; background: transparent;
    border: none; border-left: 3px solid transparent;
    font-family: inherit; cursor: pointer;
}
.dark .model-item { color: #cbd5e1; }
.model-item:hover { background-color: #f1f5f9; color: #3b82f6; border-left-color: #3b82f6; }
.dark .model-item:hover { background-color: rgba(59,130,246,0.1); color: #60a5fa; border-left-color: #60a5fa; }
.model-item.active { background-color: #eff6ff; color: #2563eb; font-weight: 600; border-left-color: #2563eb; }
.model-item.active .selected-icon { opacity: 1 !important; }
.dark .model-item.active { background-color: rgba(59,130,246,0.15); color: #60a5fa; border-left-color: #60a5fa; }
.model-name-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ============================================
   AUTH SCREEN
   ============================================ */
#authScreen {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
#authScreen.auth-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.auth-tab-btn {
    transition: color 0.2s, border-color 0.2s;
}

@keyframes authFadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
#authScreen > div {
    animation: authFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ============================================
   STREAMING CURSOR
   ============================================ */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}
.streaming-cursor {
    display: inline-block;
    color: #3b82f6;
    animation: blink 0.7s ease-in-out infinite;
    margin-left: 1px;
    font-size: 0.9em;
    line-height: 1;
    vertical-align: middle;
}

/* ============================================
   FLOATING FOOTER
   ============================================ */

/* Footer floats as an absolute overlay so the chat column has no
   white block at the bottom. The wrapper is pointer-events:none so
   wheel/touch events fall through to the chat window; only the form
   and its children restore pointer-events so they stay interactive. */
#chatFooter {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    pointer-events: none;
    background: transparent;
}

#chatFooter > div,
#chatFooter #chatForm,
#chatFooter #attachmentPreview,
#chatFooter #attachmentPreview button,
#chatFooter #chatForm * {
    pointer-events: auto;
}

/* Fade-out mask at the bottom of the chat window so messages
   dissolve naturally into the floating message bar */
#chatWindow {
    -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 5rem), transparent 100%);
    mask-image: linear-gradient(to bottom, black calc(100% - 5rem), transparent 100%);
}

/* ============================================
   SMOOTH STREAMING
   ============================================ */

/* Streaming text container — will-change avoids layout recalcs per frame */
.streaming-content {
    will-change: contents;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

/* ============================================
   MOBILE ARTIFACT PANEL — FULL-SCREEN OVERLAY
   On screens ≤ 768 px the side panel becomes a
   full-screen view that slides up from the bottom,
   matching the Claude mobile app behaviour.
   ============================================ */

/* Drag-handle pill — only rendered on mobile */
.artifact-mobile-drag {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 10px 0 4px;
    cursor: grab;
    flex-shrink: 0;
    touch-action: none;
}
.artifact-mobile-drag::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 2px;
}

@media (max-width: 768px) {
    /* Show drag handle */
    .artifact-mobile-drag {
        display: flex;
    }

    /* Full-screen overlay — covers the entire viewport */
    .artifact-panel {
        position: fixed !important;
        inset: 0;                          /* top/right/bottom/left: 0 */
        width: 100% !important;
        height: 100% !important;
        min-width: unset !important;
        border-radius: 0;
        border: none !important;
        z-index: 80;
        /* Slide up from below the screen */
        transform: translateY(110%) !important;
        opacity: 1 !important;
        transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    .artifact-panel.panel-open {
        transform: translateY(0) !important;
    }

    /* Push the header below the Dynamic Island / notch */
    .artifact-panel-header {
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
        min-height: calc(52px + env(safe-area-inset-top, 0px));
    }

    /* Lift the code/preview pane above the iOS home indicator */
    .artifact-panel-body {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    /* Desktop resize handle is meaningless on mobile */
    #resizeHandle {
        display: none !important;
    }
}

/* Finalized prose-msg blocks fade in gently so the markdown snap is invisible */
@keyframes proseFadeIn {
    from { opacity: 0.55; }
    to   { opacity: 1; }
}
.prose-msg {
    animation: proseFadeIn 0.25s ease forwards;
}

/* ============================================
   iOS SAFARI — NOTCH / DYNAMIC ISLAND SUPPORT
   ============================================ */

/* Fix 100vh on iOS Safari: the address bar shrinks/grows the viewport,
   so -webkit-fill-available gives the correct inner height.
   viewport-fit=cover (set in the meta tag) unlocks the full screen area
   so the safe-area-inset-* env() values become non-zero on notch devices. */
body {
    min-height: 100vh;                   /* non-iOS fallback */
    min-height: -webkit-fill-available;  /* iOS Safari true inner height */
}

/* Momentum scrolling for all scrollable regions on iOS */
#chatWindow,
#chatList,
.artifact-panel-code-pane,
.artifact-panel-preview-pane,
#settingsModal .overflow-y-auto,
#ocrModal .overflow-y-auto {
    -webkit-overflow-scrolling: touch;
}

/* Safe-area insets — only applied on devices that expose them
   (iPhones with notch or Dynamic Island, and landscape iPads with rounded
   corners). The @supports guard keeps this a no-op on all other browsers. */
@supports (padding: env(safe-area-inset-top)) {

    /* Sidebar: clear the status-bar / Dynamic Island in portrait,
       and the left hardware edge in landscape. */
    #sidebar {
        padding-top: env(safe-area-inset-top);
        padding-left: env(safe-area-inset-left);
    }

    /* Chat header: extend downward to sit below the notch / Dynamic Island */
    #chatColumn > header {
        padding-top: env(safe-area-inset-top);
        height: calc(4rem + env(safe-area-inset-top));
    }

    /* Chat footer: lift the message bar above the iOS home indicator */
    #chatFooter {
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)) !important;
    }

    /* Auth screen: keep the card away from the notch and home indicator */
    #authScreen {
        padding-top:    max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
        padding-left:   max(1rem, env(safe-area-inset-left));
        padding-right:  max(1rem, env(safe-area-inset-right));
    }

    /* Modals: inset the overlay so they don't bleed into hardware corners
       in landscape (Dynamic Island side) */
    #settingsModal,
    #ocrModal {
        padding-top:    env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left:   env(safe-area-inset-left);
        padding-right:  env(safe-area-inset-right);
    }
}