:root {
    color-scheme: light;
}

html.dark {
    color-scheme: dark;
}

html,
body {
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}

/* --------------------------------------------------------------------------
   Themed app background — light by default, dark when .dark is set on <html>.
   The two colours are injected as CSS variables by the layout.
   -------------------------------------------------------------------------- */
.app-bg {
    background-color: var(--app-bg-light);
}

html.dark .app-bg {
    background-color: var(--app-bg-dark);
}

/* --------------------------------------------------------------------------
   Device frame — full screen on phones, a centred phone mock on desktop.
   #device-frame is transformed on desktop so it becomes the containing block
   for the position:fixed header/footer, keeping them inside the mock.
   -------------------------------------------------------------------------- */
#device-frame {
    width: 100%;
    height: 100vh;
    height: 100dvh;
}

#app-shell {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
}

#app-shell::-webkit-scrollbar {
    width: 6px;
}

#app-shell::-webkit-scrollbar-thumb {
    background: rgba(120, 120, 120, 0.4);
    border-radius: 3px;
}

@media (min-width: 768px) {
    body {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 100vh;
        padding: 1.5rem;
        background-color: #18181b;
    }

    #device-frame {
        width: 420px;
        max-width: 100%;
        height: 840px;
        max-height: calc(100vh - 3rem);
        overflow: hidden;
        border: 8px solid #27272a;
        border-radius: 36px;
        background-color: var(--app-bg-light);
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
        /* Establishes a containing block for position:fixed descendants. */
        transform: translate(0, 0);
    }

    html.dark #device-frame {
        border-color: #111;
        background-color: var(--app-bg-dark);
    }
}

body.theme-ready,
body.theme-ready * {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.eyebrow {
    font-size: 0.75rem;
    line-height: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #71717a;
}

html.dark .eyebrow {
    color: #a1a1aa;
}

@keyframes e365-slide-in {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.e365-toast {
    animation: e365-slide-in 0.2s ease-out;
}

.e365-pulse {
    width: 18px;
    height: 18px;
    border-radius: 9999px;
    background: #dc2626;
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
    animation: e365-pulse 1.6s infinite;
}

@keyframes e365-pulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
    70% { box-shadow: 0 0 0 16px rgba(220, 38, 38, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.e365-map {
    height: 16rem;
    width: 100%;
    border-radius: 0.75rem;
    z-index: 0;
}

.e365-map-lg {
    height: 20rem;
}

.ai-summary {
    white-space: pre-wrap;
    overflow-wrap: break-word;
    font-size: 0.875rem;
    line-height: 1.625;
    color: #3f3f46;
}

html.dark .ai-summary {
    color: #d4d4d8;
}

.ai-summary strong {
    font-weight: 700;
    color: #dc2626;
}

html.dark .ai-summary strong {
    color: #f87171;
}

select.e365-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2371717a' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.6rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem;
    padding-right: 2.25rem;
}

input[type='number']::-webkit-outer-spin-button,
input[type='number']::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
