/* ============================================================================
   Blazorators demo — modern UX (Unlumen-inspired)
   Pure CSS. Design tokens on :root and .dark. No frameworks.
   ============================================================================ */

/* ---------- design tokens ---------- */

:root {
    color-scheme: light;

    /* surfaces */
    --background: 0 0% 100%;
    --foreground: 240 10% 4%;
    --surface: 0 0% 99%;
    --surface-2: 240 5% 96.5%;

    /* muted */
    --muted: 240 5% 96%;
    --muted-foreground: 240 4% 46%;

    /* accents */
    --accent: 240 5% 95%;
    --accent-foreground: 240 6% 10%;

    /* primary (Blazorators purple-blue) */
    --primary: 252 95% 60%;
    --primary-foreground: 0 0% 100%;

    /* states */
    --destructive: 0 84% 60%;
    --destructive-foreground: 0 0% 100%;
    --warning: 38 92% 50%;
    --success: 142 71% 45%;
    --info: 199 89% 48%;

    /* borders & rings */
    --border: 240 6% 90%;
    --border-strong: 240 6% 82%;
    --ring: 252 95% 60%;

    /* shape */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 22px;

    /* layout */
    --sidebar-w: 256px;
    --header-h: 60px;
    --content-max: 1100px;

    /* motion */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --dur-fast: 120ms;
    --dur: 200ms;
    --dur-slow: 320ms;
}

.dark {
    color-scheme: dark;

    --background: 240 10% 5%;
    --foreground: 0 0% 98%;
    --surface: 240 9% 7%;
    --surface-2: 240 8% 10%;

    --muted: 240 6% 13%;
    --muted-foreground: 240 5% 65%;

    --accent: 240 6% 14%;
    --accent-foreground: 0 0% 98%;

    --primary: 252 95% 70%;
    --primary-foreground: 240 10% 5%;

    --destructive: 0 72% 51%;
    --destructive-foreground: 0 0% 98%;
    --warning: 38 92% 60%;
    --success: 142 70% 55%;
    --info: 199 89% 60%;

    --border: 240 6% 16%;
    --border-strong: 240 6% 22%;
    --ring: 252 95% 70%;
}

/* ---------- reset ---------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
}

html {
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
    font-size: 15px;
    line-height: 1.55;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    transition: background-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}

code,
pre,
kbd,
samp,
.mono {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
    font-feature-settings: 'liga' 0, 'calt' 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: hsl(var(--foreground));
}

h1 {
    font-size: clamp(1.6rem, 2.4vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.03em;
}

h2 {
    font-size: 1.35rem;
}

h3 {
    font-size: 1.1rem;
}

p {
    margin: 0 0 1rem;
    color: hsl(var(--muted-foreground));
}

p strong {
    color: hsl(var(--foreground));
    font-weight: 600;
}

a {
    color: hsl(var(--primary));
    text-decoration: none;
    transition: color var(--dur-fast) var(--ease-out);
}

a:hover {
    color: hsl(var(--primary) / 0.85);
    text-decoration: underline;
    text-underline-offset: 3px;
}

:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px hsl(var(--ring) / 0.4);
    border-radius: var(--radius-sm);
}

/* Suppress focus ring on elements that are only programmatically focused for a11y
   (e.g. Blazor's FocusOnNavigate sets tabindex="-1" on the H1 and calls focus()). */
[tabindex="-1"]:focus,
[tabindex="-1"]:focus-visible {
    outline: none;
    box-shadow: none;
}

hr {
    border: 0;
    border-top: 1px solid hsl(var(--border));
    margin: 1.5rem 0;
}

::selection {
    background: hsl(var(--primary) / 0.25);
    color: hsl(var(--foreground));
}

/* webkit scrollbars */
*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: hsl(var(--border));
    border-radius: 999px;
    border: 2px solid hsl(var(--background));
}

*::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--border-strong));
}

/* ---------- icons (Lucide) ---------- */

.icon {
    width: 1.1em;
    height: 1.1em;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
    vertical-align: -0.18em;
}

.icon-sm {
    width: 0.95em;
    height: 0.95em;
    stroke-width: 2.25;
}

.icon-lg {
    width: 1.4em;
    height: 1.4em;
}

.icon-xl {
    width: 2rem;
    height: 2rem;
}

/* ---------- app shell ---------- */

.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--header-h) 1fr;
    grid-template-areas:
        "sidebar header"
        "sidebar main";
    min-height: 100vh;
    transition: grid-template-columns var(--dur) var(--ease-out);
}

/* Desktop: when toggled, collapse the sidebar column to 0 and slide it out. */
@media (min-width: 901px) {
    .app.nav-toggled {
        grid-template-columns: 0 1fr;
    }

    .app.nav-toggled .app-sidebar {
        transform: translateX(-100%);
        opacity: 0;
        pointer-events: none;
    }

    /* The desktop sidebar always transitions so the toggle feels smooth. */
    .app-sidebar {
        transition:
            transform var(--dur) var(--ease-out),
            opacity var(--dur) var(--ease-out);
    }

    /* Scrim is never shown on desktop. */
    .sidebar-scrim {
        display: none;
    }
}

.app-header {
    grid-area: header;
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1.5rem;
    background: hsl(var(--background) / 0.7);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid hsl(var(--border));
}

.app-header .crumb {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
    min-width: 0;
    flex: 1;
}

.app-header .crumb code {
    padding: 2px 8px;
    background: hsl(var(--muted));
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    font-size: 0.78rem;
}

.app-header .actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.app-sidebar {
    grid-area: sidebar;
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    width: var(--sidebar-w);
    border-right: 1px solid hsl(var(--border));
    background: hsl(var(--surface));
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 50;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    height: var(--header-h);
    padding: 0 1.25rem;
    border-bottom: 1px solid hsl(var(--border));
    font-weight: 700;
    letter-spacing: -0.02em;
    font-size: 1.02rem;
    color: hsl(var(--foreground));
}

.brand img,
.brand svg {
    width: 26px;
    height: 26px;
    border-radius: 6px;
}

.brand:hover {
    text-decoration: none;
}

.app-main {
    grid-area: main;
    padding: 2rem 2rem 4rem;
    min-width: 0;
}

.app-main > .content {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
}

.nav-toggle {
    display: inline-flex;
}

/* mobile shell */
@media (max-width: 900px) {
    .app {
        grid-template-columns: 1fr;
        grid-template-rows: var(--header-h) 1fr;
        grid-template-areas:
            "header"
            "main";
    }

    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform var(--dur) var(--ease-out);
        box-shadow: 0 0 40px hsl(0 0% 0% / 0.18);
    }

    .app.nav-toggled .app-sidebar {
        transform: translateX(0);
    }

    .sidebar-scrim {
        position: fixed;
        inset: 0;
        background: hsl(0 0% 0% / 0.45);
        backdrop-filter: blur(2px);
        z-index: 45;
        opacity: 1;
        pointer-events: auto;
        animation: scrim-in var(--dur) var(--ease-out);
    }

    .app-main {
        padding: 1.25rem 1rem 3rem;
    }
}

@keyframes scrim-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* page transition */
.page-enter {
    animation: page-in 320ms var(--ease-out) both;
}

@keyframes page-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

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

/* ---------- nav ---------- */

.nav {
    padding: 0.75rem 0.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
}

.nav-section {
    padding: 0.75rem 0.75rem 0.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: hsl(var(--muted-foreground));
    font-weight: 600;
}

.nav-section:not(:first-child) {
    margin-top: 0.5rem;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.75rem;
    color: hsl(var(--muted-foreground));
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-weight: 500;
    transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.nav a:hover {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
    text-decoration: none;
}

.nav a.active {
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
}

.nav a .icon {
    width: 18px;
    height: 18px;
    color: hsl(var(--muted-foreground));
}

.nav a.active .icon,
.nav a:hover .icon {
    color: hsl(var(--foreground));
}

.nav-footer {
    margin-top: auto;
    padding: 0.75rem 0.75rem 1rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.72rem;
    border-top: 1px solid hsl(var(--border));
    background: hsl(var(--surface));
}

.nav-footer .badge {
    margin-bottom: 0.35rem;
}

/* ---------- buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0 0.95rem;
    height: 38px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    color: hsl(var(--foreground));
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    cursor: pointer;
    user-select: none;
    transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
    white-space: nowrap;
}

.btn:hover {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
    text-decoration: none;
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.5;
    pointer-events: none;
}

.btn .icon {
    width: 16px;
    height: 16px;
}

.btn-sm {
    height: 32px;
    padding: 0 0.7rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    height: 44px;
    padding: 0 1.25rem;
    font-size: 0.95rem;
    border-radius: var(--radius);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
}

.btn-icon.btn-sm {
    width: 32px;
    height: 32px;
}

.btn-icon.btn-lg {
    width: 44px;
    height: 44px;
}

.btn-primary {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

.btn-primary:hover {
    background: hsl(var(--primary) / 0.9);
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary) / 0.9);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: hsl(var(--muted-foreground));
}

.btn-ghost:hover {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.btn-danger {
    background: transparent;
    border-color: hsl(var(--border));
    color: hsl(var(--destructive));
}

.btn-danger:hover {
    background: hsl(var(--destructive) / 0.1);
    color: hsl(var(--destructive));
    border-color: hsl(var(--destructive) / 0.4);
}

.btn-danger-solid {
    background: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
    border-color: hsl(var(--destructive));
}

.btn-danger-solid:hover {
    background: hsl(var(--destructive) / 0.9);
    color: hsl(var(--destructive-foreground));
}

.btn-warning {
    background: hsl(var(--warning) / 0.15);
    color: hsl(var(--warning));
    border-color: hsl(var(--warning) / 0.4);
}

.btn-warning:hover {
    background: hsl(var(--warning) / 0.2);
    color: hsl(var(--warning));
}

.btn-info {
    background: hsl(var(--info) / 0.15);
    color: hsl(var(--info));
    border-color: hsl(var(--info) / 0.4);
}

.btn-info:hover {
    background: hsl(var(--info) / 0.22);
    color: hsl(var(--info));
}

/* button group */
.btn-group {
    display: inline-flex;
    gap: 0;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--surface));
}

.btn-group .btn {
    border-radius: 0;
    border: 0;
    border-right: 1px solid hsl(var(--border));
    background: transparent;
}

.btn-group .btn:last-child {
    border-right: 0;
}

.btn-group .btn.active,
.btn-group .btn[aria-pressed="true"] {
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
}

/* Segmented control: pill-shaped, soft track, and the primary CTA keeps
   its solid fill while ghost siblings stay subtle. */
.btn-group-segmented {
    padding: 4px;
    gap: 4px;
    background: hsl(var(--muted) / 0.55);
    border-color: hsl(var(--border));
    border-radius: 999px;
    overflow: visible;
    align-items: stretch;
}

.btn-group-segmented .btn {
    border: 0;
    background: transparent;
    border-radius: 999px;
    height: 34px;
    padding: 0 0.85rem;
}

.btn-group-segmented .btn.btn-primary {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    padding: 0 1.05rem;
}

.btn-group-segmented .btn.btn-primary:hover {
    background: hsl(var(--primary) / 0.92);
    color: hsl(var(--primary-foreground));
}

.btn-group-segmented .btn.btn-ghost {
    color: hsl(var(--muted-foreground));
}

.btn-group-segmented .btn.btn-ghost:hover {
    background: hsl(var(--surface));
    color: hsl(var(--foreground));
}

.btn-group-segmented .btn.btn-icon {
    width: 34px;
    padding: 0;
}

.btn-group-segmented .btn-icon-danger:hover {
    color: hsl(var(--danger));
}

/* ---------- inputs ---------- */

.input,
.select,
.textarea {
    display: inline-flex;
    align-items: center;
    width: 100%;
    height: 38px;
    padding: 0 0.85rem;
    font-family: inherit;
    font-size: 0.92rem;
    color: hsl(var(--foreground));
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
    outline: none;
}

.textarea {
    height: auto;
    padding: 0.7rem 0.85rem;
    line-height: 1.55;
    resize: vertical;
    min-height: 6.5rem;
}

.input::placeholder,
.textarea::placeholder {
    color: hsl(var(--muted-foreground));
}

.input:hover,
.select:hover,
.textarea:hover {
    border-color: hsl(var(--border-strong));
}

.input:focus,
.select:focus,
.textarea:focus,
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 3px hsl(var(--ring) / 0.25);
}

.input-lg {
    height: 44px;
    font-size: 0.95rem;
    padding: 0 1rem;
}

.select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.25rem;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px;
}

.input-group {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    width: 100%;
}

.input-group .input,
.input-group .select,
.input-group .textarea {
    flex: 1 1 auto;
    min-width: 0;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
}

.field label,
.label {
    font-size: 0.85rem;
    font-weight: 500;
    color: hsl(var(--foreground));
}

.field-hint {
    font-size: 0.78rem;
    color: hsl(var(--muted-foreground));
}

/* range */
.range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: hsl(var(--muted));
    border-radius: 999px;
    outline: none;
}

.range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: hsl(var(--primary));
    border: 2px solid hsl(var(--background));
    cursor: pointer;
    transition: transform var(--dur-fast) var(--ease-out);
}

.range::-webkit-slider-thumb:hover {
    transform: scale(1.12);
}

.range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: hsl(var(--primary));
    border: 2px solid hsl(var(--background));
    cursor: pointer;
}

.range:focus-visible {
    box-shadow: 0 0 0 3px hsl(var(--ring) / 0.3);
}

/* legacy: when a checkbox carries class="check" directly (not used by
   StorageCheckbox anymore, but kept for any one-off consumer). The
   wrapper-label form is handled in the patch block at the end of this
   file. */
input.check {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    border-radius: 5px;
    border: 1.5px solid hsl(var(--border-strong));
    background: hsl(var(--surface));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
    position: relative;
}

input.check:hover {
    border-color: hsl(var(--primary));
}

input.check:checked {
    background: hsl(var(--primary));
    border-color: hsl(var(--primary));
}

input.check:checked::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/12px no-repeat;
}

input.check:focus-visible {
    box-shadow: 0 0 0 3px hsl(var(--ring) / 0.35);
}

/* ---------- cards / surfaces ---------- */

.card {
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: border-color var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out);
}

.card-compact {
    padding: 1rem;
    border-radius: var(--radius);
}

.card-hover:hover {
    border-color: hsl(var(--border-strong));
}

.card-interactive {
    cursor: pointer;
}

.card-interactive:hover {
    border-color: hsl(var(--border-strong));
    transform: translateY(-1px);
}

.surface {
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
}

/* page header */
.page-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.page-header .title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.page-header .kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: hsl(var(--primary));
    margin-bottom: 0.1rem;
}

.page-header .lead {
    color: hsl(var(--muted-foreground));
    font-size: 1rem;
    margin-bottom: 0;
    max-width: 720px;
}

/* badges & pills */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 22px;
    padding: 0 0.55rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    background: hsl(var(--muted));
    border: 1px solid hsl(var(--border));
    border-radius: 999px;
    line-height: 1;
}

.badge .icon {
    width: 12px;
    height: 12px;
}

.badge-primary {
    color: hsl(var(--primary));
    background: hsl(var(--primary) / 0.1);
    border-color: hsl(var(--primary) / 0.3);
}

.badge-success {
    color: hsl(var(--success));
    background: hsl(var(--success) / 0.1);
    border-color: hsl(var(--success) / 0.3);
}

.badge-warning {
    color: hsl(var(--warning));
    background: hsl(var(--warning) / 0.12);
    border-color: hsl(var(--warning) / 0.35);
}

.badge-danger {
    color: hsl(var(--destructive));
    background: hsl(var(--destructive) / 0.1);
    border-color: hsl(var(--destructive) / 0.3);
}

.badge-info {
    color: hsl(var(--info));
    background: hsl(var(--info) / 0.1);
    border-color: hsl(var(--info) / 0.3);
}

.badge-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: currentColor;
}

.badge-dot.live {
    background: hsl(var(--success));
    box-shadow: 0 0 0 0 hsl(var(--success) / 0.6);
    animation: pulse-dot 1.6s infinite;
}

@keyframes pulse-dot {
    0% {
        box-shadow: 0 0 0 0 hsl(var(--success) / 0.55);
    }

    70% {
        box-shadow: 0 0 0 8px hsl(var(--success) / 0);
    }

    100% {
        box-shadow: 0 0 0 0 hsl(var(--success) / 0);
    }
}

/* kbd */
.kbd {
    display: inline-block;
    padding: 1px 5px;
    font-size: 0.72rem;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    background: hsl(var(--muted));
    border: 1px solid hsl(var(--border));
    border-bottom-width: 2px;
    border-radius: 4px;
    color: hsl(var(--muted-foreground));
}

/* callout */
.callout {
    display: flex;
    gap: 0.85rem;
    padding: 1rem 1.1rem;
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    color: hsl(var(--foreground));
}

.callout .callout-icon {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.callout .callout-body {
    flex: 1;
    min-width: 0;
}

.callout .callout-title {
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.callout p {
    margin: 0;
}

.callout-primary {
    background: hsl(var(--primary) / 0.06);
    border-color: hsl(var(--primary) / 0.25);
}

.callout-primary .callout-icon {
    background: hsl(var(--primary) / 0.12);
    color: hsl(var(--primary));
}

/* ---------- source prompt ("View on GitHub" demo footer) ---------- */

.source-prompt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    margin-top: 0.5rem;
    padding: 0.75rem 0.95rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background:
        linear-gradient(135deg,
            hsl(var(--surface)) 0%,
            hsl(var(--muted) / 0.4) 100%);
    transition:
        border-color var(--dur-fast) var(--ease-out),
        background var(--dur-fast) var(--ease-out);
}

.source-prompt:hover {
    border-color: hsl(var(--border-strong, var(--border)));
}

.source-prompt-meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.source-prompt-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: hsl(var(--muted-foreground));
}

.source-prompt-kicker .icon {
    width: 13px;
    height: 13px;
    color: hsl(var(--primary));
}

.source-prompt-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    line-height: 1.3;
}

.source-prompt-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem 0.45rem 0.75rem;
    border-radius: 999px;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--surface));
    color: hsl(var(--foreground));
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition:
        background var(--dur-fast) var(--ease-out),
        border-color var(--dur-fast) var(--ease-out),
        color var(--dur-fast) var(--ease-out),
        transform var(--dur-fast) var(--ease-out);
}

.source-prompt-link:hover {
    background: hsl(var(--primary));
    border-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    transform: translateY(-1px);
    text-decoration: none;
}

.source-prompt-link .icon {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}

.source-prompt-arrow {
    transition: transform var(--dur-fast) var(--ease-out);
}

.source-prompt-link:hover .source-prompt-arrow {
    transform: translate(2px, -2px);
}

@media (max-width: 480px) {
    .source-prompt-link {
        width: 100%;
        justify-content: center;
    }
}

/* ---------- tables ---------- */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.table thead th {
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: hsl(var(--muted-foreground));
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid hsl(var(--border));
}

.table tbody td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid hsl(var(--border));
    color: hsl(var(--foreground));
    vertical-align: top;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table tbody tr:hover {
    background: hsl(var(--muted) / 0.5);
}

.table code {
    font-size: 0.8rem;
    color: hsl(var(--foreground));
}

/* ---------- code block (shared Code.razor) ---------- */

.codeblock {
    background: hsl(var(--surface-2));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    overflow: hidden;
    margin: 1rem 0 1.5rem;
}

.codeblock-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.65rem 0.4rem 0.95rem;
    background: hsl(var(--surface));
    border-bottom: 1px solid hsl(var(--border));
    font-size: 0.78rem;
    color: hsl(var(--muted-foreground));
}

.codeblock-head .filename {
    flex: 1;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    color: hsl(var(--foreground));
}

.codeblock-body {
    margin: 0;
    padding: 1rem 1.1rem;
    overflow-x: auto;
    font-size: 0.82rem;
    line-height: 1.55;
    color: hsl(var(--foreground));
    background: transparent;
}

.codeblock-body code {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    background: transparent;
    padding: 0;
}

.codeblock.is-error {
    border-color: hsl(var(--destructive) / 0.4);
    background: hsl(var(--destructive) / 0.04);
}

.codeblock.is-error .codeblock-head {
    background: hsl(var(--destructive) / 0.06);
    border-bottom-color: hsl(var(--destructive) / 0.3);
    color: hsl(var(--destructive));
}

/* inline code */
:not(pre) > code {
    font-size: 0.85em;
    padding: 0.1em 0.35em;
    background: hsl(var(--muted));
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    color: hsl(var(--foreground));
}

/* ---------- map ---------- */

.map-shell {
    position: relative;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: hsl(var(--surface));
    margin-top: 1rem;
}

.map-shell.is-loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
            45deg,
            hsl(var(--muted)),
            hsl(var(--muted)) 14px,
            hsl(var(--surface)) 14px,
            hsl(var(--surface)) 28px);
    opacity: 0.35;
    pointer-events: none;
    z-index: 1;
}

.map-shell .map-canvas {
    width: 100%;
    height: 45vh;
    min-height: 320px;
}

.maplibregl-ctrl-attrib,
.maplibregl-ctrl-attrib a {
    font-family: inherit !important;
    font-size: 11px !important;
}

/* ---------- spinners & loading ---------- */

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid hsl(var(--muted));
    border-top-color: hsl(var(--primary));
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: -3px;
}

.spinner-lg {
    width: 22px;
    height: 22px;
    border-width: 2.5px;
}

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

/* ---------- mic (large) ---------- */

.mic-btn {
    --mic-size: 76px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--mic-size);
    height: var(--mic-size);
    border-radius: 50%;
    border: 1px solid hsl(var(--border-strong));
    background: hsl(var(--surface));
    color: hsl(var(--foreground));
    cursor: pointer;
    transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
    position: relative;
    z-index: 1;
}

.mic-btn:hover {
    border-color: hsl(var(--primary));
    transform: scale(1.04);
}

.mic-btn .icon {
    width: 28px;
    height: 28px;
}

.mic-btn.recording {
    background: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
    border-color: hsl(var(--destructive));
}

.mic-btn.recording::before,
.mic-btn.recording::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid hsl(var(--destructive) / 0.65);
    animation: mic-pulse 1.8s ease-out infinite;
    z-index: -1;
}

.mic-btn.recording::after {
    animation-delay: 0.9s;
}

@keyframes mic-pulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }

    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

.mic-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    margin: 1.25rem 0;
}

.mic-row .mic-label {
    font-size: 0.85rem;
    color: hsl(var(--muted-foreground));
}

.mic-row .mic-label .badge {
    margin-right: 0.4rem;
}

/* ---------- list (todos) ---------- */

.todo-list {
    list-style: none;
    padding: 0;
    margin: 1.25rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.todo-list li {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 0.85rem;
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
    animation: row-in 220ms var(--ease-out) both;
}

.todo-list li:hover {
    border-color: hsl(var(--border-strong));
}

@keyframes row-in {
    from {
        opacity: 0;
        transform: translateY(-3px);
    }

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

.todo-text {
    flex: 1;
    font-size: 0.95rem;
    color: hsl(var(--foreground));
    transition: color var(--dur-fast) var(--ease-out), text-decoration-color var(--dur-fast) var(--ease-out);
    min-width: 0;
    word-break: break-word;
}

.todo-text.completed {
    color: hsl(var(--muted-foreground));
    text-decoration: line-through;
    text-decoration-color: hsl(var(--muted-foreground));
}

/* ---------- hero / feature grid (home) ---------- */

.hero {
    padding: 2rem 0 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid hsl(var(--border));
}

.hero h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    letter-spacing: -0.04em;
    line-height: 1.05;
    background: linear-gradient(180deg, hsl(var(--foreground)), hsl(var(--foreground) / 0.7));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero .kicker {
    margin-bottom: 0.75rem;
}

.hero .lead {
    font-size: 1.1rem;
    max-width: 640px;
    margin: 0.95rem 0 1.5rem;
}

.hero .cta-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.grid {
    display: grid;
    gap: 1rem;
}

.grid-feat {
    grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
}

.feature-card {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 1.25rem;
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-lg);
    color: hsl(var(--foreground));
    transition: border-color var(--dur) var(--ease-out), transform var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out);
    position: relative;
    overflow: hidden;
}

.feature-card:hover {
    border-color: hsl(var(--border-strong));
    transform: translateY(-2px);
    text-decoration: none;
}

.feature-card::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at top right, hsl(var(--primary) / 0.06), transparent 60%);
    opacity: 0;
    transition: opacity var(--dur) var(--ease-out);
}

.feature-card:hover::after {
    opacity: 1;
}

.feature-card .feature-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.feature-card .feature-icon .icon {
    width: 20px;
    height: 20px;
}

.feature-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
}

.feature-card p {
    margin: 0;
    font-size: 0.88rem;
    color: hsl(var(--muted-foreground));
    line-height: 1.5;
}

.feature-card .feature-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    color: hsl(var(--primary));
    font-weight: 500;
    margin-top: auto;
}

/* ---------- utilities ---------- */

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

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

.items-start {
    align-items: flex-start;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-1 {
    gap: 0.25rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

.gap-6 {
    gap: 1.5rem;
}

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }

.text-muted {
    color: hsl(var(--muted-foreground));
}

.text-warning {
    color: hsl(var(--warning));
}

.text-info {
    color: hsl(var(--info));
}

.text-danger {
    color: hsl(var(--destructive));
}

.text-sm {
    font-size: 0.85rem;
}

.text-xs {
    font-size: 0.78rem;
}

.full-width {
    width: 100%;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* details/summary */
details.modern {
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--surface));
    margin-top: 1.25rem;
}

details.modern > summary {
    cursor: pointer;
    list-style: none;
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
    color: hsl(var(--foreground));
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

details.modern > summary::-webkit-details-marker {
    display: none;
}

details.modern > summary::before {
    content: '';
    width: 12px;
    height: 12px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center/contain no-repeat;
    transition: transform var(--dur-fast) var(--ease-out);
}

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

details.modern > *:not(summary) {
    padding: 0 1rem 1rem;
}

/* ---------- segmented theme toggle ---------- */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    padding: 3px;
    background: hsl(var(--muted));
    border: 1px solid hsl(var(--border));
    border-radius: 999px;
}

.theme-toggle button {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    border-radius: 999px;
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.theme-toggle button:hover {
    color: hsl(var(--foreground));
}

.theme-toggle button[aria-pressed="true"] {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    box-shadow: 0 1px 2px hsl(0 0% 0% / 0.08), 0 0 0 1px hsl(var(--primary) / 0.4);
}

.theme-toggle button[aria-pressed="true"]:hover {
    color: hsl(var(--primary-foreground));
}

.theme-toggle button .icon {
    width: 14px;
    height: 14px;
}

/* ---------- error UI ---------- */

#blazor-error-ui {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    background: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
    border-radius: var(--radius);
    box-shadow: 0 8px 24px hsl(0 0% 0% / 0.25);
    font-size: 0.88rem;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    opacity: 0.85;
}

#blazor-error-ui .dismiss:hover {
    opacity: 1;
}

#blazor-error-ui a {
    color: hsl(var(--destructive-foreground));
    text-decoration: underline;
}

/* ---------- splash (pre-Blazor boot) ---------- */

.splash {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font-family: 'Inter', system-ui, sans-serif;
}

.splash .splash-mark {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.splash .splash-mark img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    animation: splash-pulse 1.8s ease-in-out infinite;
}

@keyframes splash-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

.splash .splash-bar {
    width: 180px;
    height: 3px;
    background: hsl(var(--muted));
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.splash .splash-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    width: 40%;
    background: hsl(var(--primary));
    border-radius: 999px;
    animation: splash-slide 1.4s var(--ease-out) infinite;
}

@keyframes splash-slide {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(280%);
    }
}

.splash .splash-sub {
    font-size: 0.82rem;
    color: hsl(var(--muted-foreground));
}

/* hide splash once #app contains the rendered router output beyond loading */
#app.app-loaded .splash {
    display: none;
}

/* ============================================================================
   Patch: tokens, layout helpers, and class aliases used by the Razor markup.
   Keep this block at the bottom so it cleanly augments the design system.
   ============================================================================ */

/* Hex primaries for canvas-style consumers (e.g. MapLibre marker color).
   Mirror of --primary HSL — keep them in sync if --primary is retuned. */
:root {
    --primary-hex: #7c3aed;
    --primary-hex-strong: #6d28d9;
}

.dark {
    --primary-hex: #a78bfa;
    --primary-hex-strong: #c4b5fd;
}

/* ---------- splash markup used by index.html ---------- */
.splash-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.25rem;
}

.splash-logo .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: hsl(var(--primary));
    opacity: 0.4;
    animation: splash-dot 1.2s var(--ease-out) infinite;
}

.splash-logo .dot:nth-child(2) {
    animation-delay: 0.15s;
}

.splash-logo .dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes splash-dot {
    0%, 80%, 100% { opacity: 0.35; transform: scale(0.85); }
    40% { opacity: 1; transform: scale(1); }
}

.splash-title {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

/* ---------- hero (home) class aliases ---------- */
.hero {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: hsl(var(--primary));
    margin-bottom: 0.1rem;
}

.hero-lede {
    font-size: 1.1rem;
    max-width: 640px;
    margin: 0.95rem 0 1.5rem;
    color: hsl(var(--muted-foreground));
    line-height: 1.55;
}

.hero-cta {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.grad {
    background: linear-gradient(135deg,
        hsl(var(--primary)) 0%,
        hsl(var(--info)) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* feature grid: make the layout actually grid */
.grid-feat {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
    margin-top: 0.5rem;
}

/* ---------- page-header class aliases used across pages ---------- */
.page-header h1 {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin: 0;
}

.page-header > p {
    color: hsl(var(--muted-foreground));
    font-size: 1rem;
    margin: 0;
    max-width: 720px;
}

/* hero-eyebrow doubles as the page-header kicker */
.page-header .hero-eyebrow {
    align-self: flex-start;
}

/* ---------- code block aliases (Code.razor) ---------- */
.codeblock {
    margin: 0;
}

.codeblock-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.55rem 0.4rem 0.95rem;
    background: hsl(var(--surface));
    border-bottom: 1px solid hsl(var(--border));
    font-size: 0.78rem;
    color: hsl(var(--muted-foreground));
}

.codeblock-filename {
    flex: 1;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    color: hsl(var(--foreground));
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.codeblock.is-error .codeblock-toolbar {
    background: hsl(var(--destructive) / 0.06);
    border-bottom-color: hsl(var(--destructive) / 0.3);
    color: hsl(var(--destructive));
}

.codeblock.is-error .codeblock-filename {
    color: hsl(var(--destructive));
}

.codeblock > pre {
    margin: 0;
    padding: 1rem 1.1rem;
    overflow-x: auto;
    font-size: 0.82rem;
    line-height: 1.55;
    color: hsl(var(--foreground));
    background: transparent;
}

.codeblock > pre > code {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    background: transparent;
    border: 0;
    padding: 0;
    color: inherit;
}

/* ---------- syntax highlighting (highlight.js token classes) ---------- */
/* Light theme tokens — soft, modern palette with strong contrast on parchment. */
:root {
    --hl-comment: 220 9% 46%;
    --hl-keyword: 262 80% 53%;
    --hl-string: 142 71% 35%;
    --hl-number: 24 95% 45%;
    --hl-property: 199 89% 38%;
    --hl-literal: 350 80% 50%;
    --hl-builtin: 199 89% 38%;
    --hl-type: 199 89% 38%;
    --hl-function: 213 94% 50%;
    --hl-punctuation: 220 9% 46%;
    --hl-tag: 0 72% 51%;
    --hl-attr: 24 95% 45%;
    --hl-meta: 220 9% 46%;
    --hl-symbol: 350 80% 50%;
    --hl-regexp: 142 71% 35%;
}

.dark {
    --hl-comment: 220 8% 60%;
    --hl-keyword: 263 86% 78%;
    --hl-string: 142 71% 70%;
    --hl-number: 24 95% 70%;
    --hl-property: 199 89% 70%;
    --hl-literal: 18 90% 70%;
    --hl-builtin: 199 89% 70%;
    --hl-type: 199 89% 70%;
    --hl-function: 213 94% 75%;
    --hl-punctuation: 220 8% 70%;
    --hl-tag: 350 90% 75%;
    --hl-attr: 24 95% 70%;
    --hl-meta: 220 8% 60%;
    --hl-symbol: 18 90% 70%;
    --hl-regexp: 142 71% 70%;
}

.hljs {
    color: hsl(var(--foreground));
    background: transparent;
}

.hljs-comment,
.hljs-quote,
.hljs-meta {
    color: hsl(var(--hl-comment));
    font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-doctag,
.hljs-section {
    color: hsl(var(--hl-keyword));
    font-weight: 600;
}

.hljs-string,
.hljs-regexp,
.hljs-template-tag,
.hljs-template-variable,
.hljs-addition {
    color: hsl(var(--hl-string));
}

.hljs-number,
.hljs-deletion {
    color: hsl(var(--hl-number));
}

.hljs-attr,
.hljs-attribute,
.hljs-property,
.hljs-variable {
    color: hsl(var(--hl-property));
}

.hljs-literal,
.hljs-built_in,
.hljs-bullet,
.hljs-symbol {
    color: hsl(var(--hl-literal));
}

.hljs-type,
.hljs-class .hljs-title,
.hljs-title.class_,
.hljs-title.function_ {
    color: hsl(var(--hl-type));
}

.hljs-function .hljs-title,
.hljs-title.function_ {
    color: hsl(var(--hl-function));
}

.hljs-tag,
.hljs-name {
    color: hsl(var(--hl-tag));
}

.hljs-punctuation,
.hljs-operator {
    color: hsl(var(--hl-punctuation));
}

.hljs-emphasis {
    font-style: italic;
}

.hljs-strong {
    font-weight: 700;
}

.hljs-link {
    text-decoration: underline;
}

/* Error code blocks dim the highlighting slightly so the destructive frame reads first. */
.codeblock.is-error .hljs-keyword,
.codeblock.is-error .hljs-string,
.codeblock.is-error .hljs-number,
.codeblock.is-error .hljs-literal,
.codeblock.is-error .hljs-property,
.codeblock.is-error .hljs-attr {
    filter: saturate(0.9);
}

.codeblock-lang {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.5rem;
    margin-left: auto;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: hsl(var(--muted-foreground));
    background: hsl(var(--muted));
    border-radius: 999px;
}

.codeblock.is-error .codeblock-lang {
    color: hsl(var(--destructive));
    background: hsl(var(--destructive) / 0.1);
}

.copy-btn .icon {
    transition: transform var(--dur-fast) var(--ease-out);
}

.copy-btn:active .icon {
    transform: scale(0.9);
}

/* ---------- checkbox row used by StorageCheckbox ---------- */
.check-row,
.check {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    user-select: none;
    flex: 1 1 auto;
}

.check-box {
    position: relative;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1.5px solid hsl(var(--border-strong));
    background: hsl(var(--surface));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out);
}

.check-box .icon {
    width: 14px;
    height: 14px;
    color: hsl(var(--primary-foreground));
    opacity: 0;
    transition: opacity var(--dur-fast) var(--ease-out);
}

/* hide raw input; we draw the box ourselves */
.check > input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.check > input[type="checkbox"]:checked + .check-box {
    background: hsl(var(--primary));
    border-color: hsl(var(--primary));
}

.check > input[type="checkbox"]:checked + .check-box .icon {
    opacity: 1;
}

.check > input[type="checkbox"]:focus-visible + .check-box {
    box-shadow: 0 0 0 3px hsl(var(--ring) / 0.35);
}

.check:hover .check-box {
    border-color: hsl(var(--primary));
}

.check-label {
    font-size: 0.95rem;
    color: hsl(var(--foreground));
    transition: color var(--dur-fast) var(--ease-out),
                text-decoration-color var(--dur-fast) var(--ease-out);
    min-width: 0;
    word-break: break-word;
}

.todo-item.completed .check-label {
    color: hsl(var(--muted-foreground));
    text-decoration: line-through;
    text-decoration-color: hsl(var(--muted-foreground));
}

/* ---------- field-label alias ---------- */
.field-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: hsl(var(--foreground));
}

/* ---------- layout helpers ---------- */
.stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.empty {
    color: hsl(var(--muted-foreground));
    font-size: 0.92rem;
    margin: 1.25rem 0 0;
    text-align: center;
    padding: 1.5rem 0.5rem;
    border: 1px dashed hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--surface));
}

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
}

.table-wrap > .table {
    border: 0;
    border-radius: 0;
}

.link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: 1px solid hsl(var(--border));
    background: hsl(var(--surface));
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    flex-shrink: 0;
    vertical-align: middle;
    transition:
        color var(--dur-fast) var(--ease-out),
        border-color var(--dur-fast) var(--ease-out),
        background var(--dur-fast) var(--ease-out),
        transform var(--dur-fast) var(--ease-out);
}

.link-icon .icon {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}

.link-icon:hover {
    color: hsl(var(--primary));
    border-color: hsl(var(--primary) / 0.4);
    background: hsl(var(--primary) / 0.06);
    transform: translateY(-1px);
    text-decoration: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ms-auto {
    margin-left: auto;
}

/* ---------- icon size helpers ---------- */
.icon-md {
    width: 20px;
    height: 20px;
}

/* ---------- details chev hint ---------- */
details.modern > summary .chev {
    margin-left: auto;
    transition: transform var(--dur-fast) var(--ease-out);
}

details.modern[open] > summary .chev {
    transform: rotate(180deg);
}

/* ---------- minor map-shell loader text ---------- */
.map-shell.is-loading::after {
    content: 'Resolving location…';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: hsl(var(--muted-foreground));
    font-size: 0.85rem;
    pointer-events: none;
}

/* =====================================================================
   Patch: shadcn-inspired "lit" landing — aurora hero, word rotator,
   bento grid, pointer-tracked spotlight cards, gradient hover glow,
   staggered entrance animations. Loaded after everything else so it
   wins specificity ties.
   ===================================================================== */

@property --angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

/* ---------- shared entrance stagger ----------
   Elements opt in by setting `style="--i:N"` and inheriting from a
   `[data-reveal]` ancestor (or `.bento` for cards). */

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

[data-reveal] > *:not(.hero-aurora) {
    animation: rise-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: calc(var(--i, 0) * 90ms + 80ms);
}

.bento > .bento-card {
    animation: rise-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: calc(var(--i, 0) * 70ms + 240ms);
}

@media (prefers-reduced-motion: reduce) {
    [data-reveal] > *,
    .bento > .bento-card,
    .aurora-blob,
    .word-rotator > span,
    .badge-dot.live::after {
        animation: none !important;
    }
}

/* ---------- hero aurora background ---------- */

.hero-lit {
    position: relative;
    isolation: isolate;
    overflow: visible;
}

.hero-aurora {
    position: absolute;
    inset: -3rem -1rem auto -1rem;
    height: 24rem;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
    border-radius: 24px;
    mask-image: linear-gradient(180deg, #000 50%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, #000 50%, transparent 100%);
}

.aurora-blob {
    position: absolute;
    width: 28rem;
    height: 28rem;
    border-radius: 999px;
    filter: blur(80px);
    opacity: 0.45;
    will-change: transform;
}

.aurora-blob.a1 {
    background: radial-gradient(circle, hsl(var(--primary) / 0.7), transparent 60%);
    top: -8rem;
    left: -4rem;
    animation: aurora-drift-a 18s ease-in-out infinite alternate;
}

.aurora-blob.a2 {
    background: radial-gradient(circle, hsl(var(--info) / 0.6), transparent 60%);
    top: -6rem;
    right: -2rem;
    animation: aurora-drift-b 22s ease-in-out infinite alternate;
}

.aurora-blob.a3 {
    background: radial-gradient(circle, hsl(285 95% 65% / 0.5), transparent 60%);
    bottom: -10rem;
    left: 28%;
    animation: aurora-drift-c 26s ease-in-out infinite alternate;
}

.aurora-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, hsl(var(--foreground) / 0.06) 1px, transparent 1px),
        linear-gradient(to bottom, hsl(var(--foreground) / 0.06) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: radial-gradient(ellipse 60% 70% at 50% 30%, #000 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 60% 70% at 50% 30%, #000 30%, transparent 80%);
    opacity: 0.7;
}

.dark .aurora-blob {
    opacity: 0.35;
}

:root:not(.dark) .aurora-blob {
    opacity: 0.28;
}

@keyframes aurora-drift-a {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(4rem, 2rem, 0) scale(1.15); }
}

@keyframes aurora-drift-b {
    0%   { transform: translate3d(0, 0, 0) scale(1.05); }
    100% { transform: translate3d(-3rem, 3rem, 0) scale(1); }
}

@keyframes aurora-drift-c {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(2rem, -2rem, 0) scale(1.1); }
}

/* ---------- hero headline word rotator ----------
   `inline-grid` stacks every word in the same cell so the container's
   width auto-fits the widest word and there is no layout shift. */

.word-rotator {
    display: inline-grid;
    vertical-align: bottom;
    grid-template-areas: "stack";
    line-height: 1;
}

.word-rotator > span {
    grid-area: stack;
    opacity: 0;
    transform: translateY(0.55em);
    animation: word-flip 12s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

.word-rotator > span:nth-child(1) { animation-delay:  0s; }
.word-rotator > span:nth-child(2) { animation-delay:  3s; }
.word-rotator > span:nth-child(3) { animation-delay:  6s; }
.word-rotator > span:nth-child(4) { animation-delay:  9s; }

@keyframes word-flip {
    0%       { opacity: 0; transform: translateY(0.5em); }
    4%       { opacity: 1; transform: translateY(0); }
    22%      { opacity: 1; transform: translateY(0); }
    27%      { opacity: 0; transform: translateY(-0.5em); }
    100%     { opacity: 0; transform: translateY(-0.5em); }
}

/* ---------- pulsing eyebrow dot ---------- */

.badge-dot.live {
    position: relative;
}

.badge-dot.live::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 999px;
    box-shadow: 0 0 0 0 hsl(var(--success) / 0.6);
    animation: ping 2.4s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
    0%   { box-shadow: 0 0 0 0 hsl(var(--success) / 0.55); }
    80%  { box-shadow: 0 0 0 8px hsl(var(--success) / 0); }
    100% { box-shadow: 0 0 0 0 hsl(var(--success) / 0); }
}

/* ---------- hero stats strip ---------- */

.hero-stats {
    list-style: none;
    padding: 0;
    margin: 1.25rem 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.75rem;
    border-top: 1px solid hsl(var(--border));
    padding-top: 1.25rem;
}

.hero-stats > li {
    display: inline-flex;
    flex-direction: column;
    gap: 0.1rem;
}

.hero-stats > li > strong {
    font-size: 1.1rem;
    font-weight: 600;
    background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--info)) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.01em;
}

.hero-stats > li > span {
    font-size: 0.78rem;
    color: hsl(var(--muted-foreground));
    letter-spacing: 0.01em;
}

/* ---------- bento grid + cards ---------- */

.bento {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1rem;
    margin-top: 2.5rem;
}

.bento-card {
    --bg: hsl(var(--surface));
    grid-column: span 12;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.4rem;
    background: var(--bg);
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-lg);
    color: hsl(var(--foreground));
    position: relative;
    isolation: isolate;
    overflow: hidden;
    transition:
        border-color var(--dur) var(--ease-out),
        transform var(--dur) var(--ease-out),
        box-shadow var(--dur) var(--ease-out);
}

/* Spotlight: a radial gradient painted at (--mx, --my) — set by
   spotlight.js — that fades in on hover. */
.bento-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
        circle 320px at var(--mx, -200px) var(--my, -200px),
        hsl(var(--primary) / 0.18),
        transparent 55%
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s var(--ease-out);
    z-index: 0;
}

.bento-card:hover::before {
    opacity: 1;
}

.bento-card > * {
    position: relative;
    z-index: 1;
}

.bento-card:hover {
    border-color: hsl(var(--primary) / 0.4);
    transform: translateY(-2px);
    text-decoration: none;
    box-shadow:
        0 0 0 1px hsl(var(--primary) / 0.18),
        0 14px 40px -18px hsl(var(--primary) / 0.45),
        0 4px 12px -6px hsl(0 0% 0% / 0.15);
}

.bento-feat {
    grid-column: span 12;
    grid-row: span 2;
}

@media (min-width: 760px) {
    .bento-card {
        grid-column: span 6;
    }

    .bento-feat {
        grid-column: span 6;
        grid-row: span 2;
    }
}

@media (min-width: 1100px) {
    .bento-card {
        grid-column: span 4;
    }

    .bento-feat {
        grid-column: span 8;
        grid-row: span 2;
    }
}

/* ---------- card icon: subtle glow on hover ---------- */

.bento-card .feature-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, hsl(var(--muted)) 0%, hsl(var(--background)) 100%);
    border: 1px solid hsl(var(--border));
    color: hsl(var(--primary));
    transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}

.bento-card .feature-icon .icon {
    width: 20px;
    height: 20px;
}

.bento-card:hover .feature-icon {
    transform: scale(1.06) rotate(-2deg);
    color: hsl(var(--primary));
    box-shadow:
        0 0 0 1px hsl(var(--primary) / 0.25),
        0 6px 20px -8px hsl(var(--primary) / 0.55);
}

.bento-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.01em;
}

.bento-feat h3 {
    font-size: 1.35rem;
}

.bento-card p {
    margin: 0;
    font-size: 0.9rem;
    color: hsl(var(--muted-foreground));
    line-height: 1.55;
}

.bento-card .feature-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    color: hsl(var(--primary));
    font-weight: 500;
    margin-top: auto;
}

.bento-card .feature-link .arrow {
    transition: transform var(--dur) var(--ease-out);
}

.bento-card:hover .feature-link .arrow {
    transform: translateX(3px);
}

/* ---------- inline code preview (lead bento card) ---------- */

.bento-preview {
    position: relative;
    margin: 0.25rem 0;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--background) / 0.7);
    backdrop-filter: blur(4px);
    overflow: hidden;
}

.bento-preview-head {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.7rem;
    border-bottom: 1px solid hsl(var(--border));
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.72rem;
    color: hsl(var(--muted-foreground));
}

.bento-preview-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: hsl(var(--muted-foreground) / 0.3);
    margin-left: auto;
}

.bento-preview-dot ~ .bento-preview-dot {
    margin-left: 0.3rem;
}

.bento-preview pre {
    margin: 0;
    padding: 0.85rem 1rem;
    font-size: 0.78rem;
    line-height: 1.65;
    overflow-x: auto;
    background: transparent;
    color: hsl(var(--foreground));
}

.bento-preview pre code {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    background: transparent;
}

/* Shimmer sweep across the preview when the parent card is hovered. */
.bento-preview::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        110deg,
        transparent 0%,
        hsl(var(--primary) / 0.12) 50%,
        transparent 100%
    );
    transform: translateX(-110%);
    transition: transform 0.9s var(--ease-out);
    pointer-events: none;
}

.bento-card:hover .bento-preview::after {
    transform: translateX(110%);
}

/* ---------- responsive cleanup ---------- */

@media (max-width: 600px) {
    .hero-aurora {
        height: 20rem;
    }

    .hero-stats {
        gap: 0.4rem 1.25rem;
    }

    .bento-preview pre {
        font-size: 0.72rem;
    }
}
/* =====================================================================
   Patch: per-card inner animations for the lit landing bento.
   Each non-featured card hosts a small `.bento-anim` panel that
   illustrates the API it represents (waveform, pin ripple, transcript
   stack, orbiting chips, route trace). The featured card splits into
   an animated "saving todos" stack + an inline code preview.
   ===================================================================== */

.icon-xs {
    width: 0.8em;
    height: 0.8em;
    stroke-width: 2.4;
}

/* Common shell for every per-card animation panel. */
.bento-anim {
    position: relative;
    height: 120px;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    background:
        linear-gradient(180deg,
            hsl(var(--background) / 0.6) 0%,
            hsl(var(--muted) / 0.4) 100%);
    overflow: hidden;
    isolation: isolate;
    margin-top: 0.25rem;
}

@media (prefers-reduced-motion: reduce) {
    .bento-anim *,
    .bento-anim::before,
    .bento-anim::after,
    .anim-route-dot,
    .anim-route-fg,
    .bento-feat-split * {
        animation: none !important;
    }
}

/* ---------- Featured card: split panel ----------
   Left half is the animated "saving todos to localStorage" stack,
   right half is the existing code preview. Collapses to a single
   column under 720px. */

.bento-feat-split {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 0.25rem;
    flex: 1 1 auto;
    min-height: 0;
}

@media (min-width: 1280px) {
    .bento-feat-split {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
        gap: 1rem;
    }
}

/* The animation panel reuses .bento-anim styles via the .bento-anim-stack class. */
.bento-anim-stack {
    height: 100%;
    min-height: 160px;
}

@media (min-width: 1280px) {
    .bento-anim-stack {
        min-height: 200px;
    }
}

.bento-feat-split .bento-preview {
    margin: 0;
}

.bento-feat-split .bento-preview pre {
    font-size: 0.72rem;
    padding: 0.7rem 0.85rem;
    line-height: 1.55;
}

.bento-anim-stack .anim-storage-disk {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    background: hsl(var(--primary) / 0.12);
    color: hsl(var(--primary));
    border: 1px solid hsl(var(--primary) / 0.35);
    font-size: 0.7rem;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    box-shadow: 0 0 24px -8px hsl(var(--primary) / 0.6);
    z-index: 1;
}

.bento-anim-stack .anim-storage-disk::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 999px;
    border: 1px solid hsl(var(--primary) / 0.4);
    opacity: 0;
    animation: disk-pulse 2.2s ease-out infinite;
}

@keyframes disk-pulse {
    0%   { transform: scale(0.85); opacity: 0.55; }
    100% { transform: scale(1.4);  opacity: 0; }
}

.bento-anim-stack .anim-todo {
    position: absolute;
    left: 14px;
    top: 18px;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.7rem;
    border-radius: var(--radius-sm);
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    box-shadow:
        0 2px 4px -2px hsl(0 0% 0% / 0.15),
        0 8px 18px -10px hsl(0 0% 0% / 0.2);
    font-size: 0.78rem;
    color: hsl(var(--foreground));
    white-space: nowrap;
    width: 130px;
    animation: todo-fly 6s cubic-bezier(0.5, 0, 0.55, 1) infinite both;
    animation-delay: calc(var(--n) * 1.5s);
    opacity: 0;
    z-index: 2;
}

.bento-anim-stack .anim-todo-check {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: hsl(var(--success));
    color: hsl(var(--background));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 16px;
}

.bento-anim-stack .anim-todo-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes todo-fly {
    0%   { transform: translate(0, 12px) scale(0.92); opacity: 0; }
    12%  { transform: translate(0, 0)    scale(1);    opacity: 1; }
    55%  { transform: translate(0, 0)    scale(1);    opacity: 1; }
    78%  { transform: translate(calc(100% + 30px), 0) scale(0.6); opacity: 0; }
    100% { transform: translate(calc(100% + 30px), 0) scale(0.6); opacity: 0; }
}

/* Stagger vertical position so cards stack visually before flying.
   Heights are based on 100% panel height — distribute the 4 cards. */
.bento-anim-stack .anim-todo[style*="--n:0"] { top: 12%; }
.bento-anim-stack .anim-todo[style*="--n:1"] { top: 34%; }
.bento-anim-stack .anim-todo[style*="--n:2"] { top: 56%; }
.bento-anim-stack .anim-todo[style*="--n:3"] { top: 78%; }

/* Subtle scan line behind everything. */
.bento-anim-stack::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to bottom, transparent 0%, hsl(var(--primary) / 0.05) 50%, transparent 100%);
    transform: translateY(-100%);
    animation: scan-line 4s ease-in-out infinite;
}

@keyframes scan-line {
    0%, 100% { transform: translateY(-100%); }
    50%      { transform: translateY(100%); }
}

/* The existing .bento-preview lives inside the right column when split. */

/* ---------- Geolocation: pulsing pin on a faint map grid ---------- */

.bento-anim-pin {
    display: grid;
    place-items: center;
}

.bento-anim-pin .anim-map-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, hsl(var(--border)) 1px, transparent 1px),
        linear-gradient(to bottom, hsl(var(--border)) 1px, transparent 1px);
    background-size: 24px 24px;
    mask-image: radial-gradient(circle at 50% 55%, #000 0%, transparent 75%);
    -webkit-mask-image: radial-gradient(circle at 50% 55%, #000 0%, transparent 75%);
    opacity: 0.5;
}

.bento-anim-pin .anim-pin {
    position: relative;
    z-index: 2;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 0 0 4px hsl(var(--primary) / 0.18),
        0 8px 22px -6px hsl(var(--primary) / 0.6);
    animation: pin-bob 3s ease-in-out infinite;
}

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

.bento-anim-pin .anim-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    border-radius: 999px;
    border: 2px solid hsl(var(--primary));
    opacity: 0;
    animation: ripple-out 3s ease-out infinite;
    z-index: 1;
}

.bento-anim-pin .anim-ripple-a { animation-delay: 0s; }
.bento-anim-pin .anim-ripple-b { animation-delay: 1s; }
.bento-anim-pin .anim-ripple-c { animation-delay: 2s; }

@keyframes ripple-out {
    0%   { transform: scale(0.7); opacity: 0.55; }
    80%  { transform: scale(2.6); opacity: 0; }
    100% { transform: scale(2.6); opacity: 0; }
}

/* ---------- Watch position: SVG path drawing with a traveling dot ---------- */

.bento-anim-route svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.bento-anim-route .anim-route-fg {
    stroke-dasharray: 320;
    stroke-dashoffset: 320;
    animation: route-draw 3s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes route-draw {
    0%   { stroke-dashoffset: 320; }
    60%  { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 0; }
}

.bento-anim-route .anim-route-dot {
    filter: drop-shadow(0 0 6px hsl(var(--primary) / 0.8));
}

/* ---------- Text-to-speech: equalizer bars ---------- */

.bento-anim-wave {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    gap: 3px;
}

.bento-anim-wave > span {
    flex: 1;
    background: linear-gradient(to top, hsl(var(--primary)) 0%, hsl(var(--info)) 100%);
    border-radius: 2px;
    animation: bar-pulse 1.2s ease-in-out infinite;
    animation-delay: calc(var(--n) * -80ms);
    min-height: 6px;
    transform-origin: center;
}

@keyframes bar-pulse {
    0%, 100% { transform: scaleY(0.15); }
    50%      { transform: scaleY(1);    }
}

/* ---------- Speech-to-text: live transcript bubbles ---------- */

.bento-anim-transcript {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 6px;
    overflow: hidden;
}

.bento-anim-transcript .anim-bubble {
    align-self: flex-start;
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: 14px;
    padding: 0.32rem 0.65rem;
    font-size: 0.7rem;
    line-height: 1.25;
    color: hsl(var(--foreground));
    max-width: min(85%, 220px);
    box-shadow: 0 1px 2px hsl(0 0% 0% / 0.04);
    opacity: 0;
    transform: translateY(6px) scale(0.96);
    transform-origin: bottom left;
    animation-duration: 9s;
    animation-iteration-count: infinite;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
    animation-fill-mode: both;
}

.bento-anim-transcript .anim-bubble:nth-child(even) {
    align-self: flex-end;
    background: hsl(var(--primary) / 0.12);
    border-color: hsl(var(--primary) / 0.3);
    color: hsl(var(--primary));
    transform-origin: bottom right;
    border-bottom-right-radius: 4px;
}

.bento-anim-transcript .anim-bubble:nth-child(odd) {
    border-bottom-left-radius: 4px;
}

.bento-anim-transcript .anim-bubble:nth-child(1) { animation-name: bubble-pop-0; }
.bento-anim-transcript .anim-bubble:nth-child(2) { animation-name: bubble-pop-1; }
.bento-anim-transcript .anim-bubble:nth-child(3) { animation-name: bubble-pop-2; }
.bento-anim-transcript .anim-bubble:nth-child(4) { animation-name: bubble-pop-3; }

/* Each bubble fades in at its own offset in a 9s cycle, holds, then
   they all fade out together at 86-93% so the thread "resets" without
   any bubble crossing through another's text. */
@keyframes bubble-pop-0 {
    0%, 100% { opacity: 0; transform: translateY(6px) scale(0.96); }
    4%, 86%  { opacity: 1; transform: translateY(0)   scale(1); }
    93%      { opacity: 0; transform: translateY(-4px) scale(0.98); }
}
@keyframes bubble-pop-1 {
    0%, 18%, 100% { opacity: 0; transform: translateY(6px) scale(0.96); }
    22%, 86%      { opacity: 1; transform: translateY(0)   scale(1); }
    93%           { opacity: 0; transform: translateY(-4px) scale(0.98); }
}
@keyframes bubble-pop-2 {
    0%, 36%, 100% { opacity: 0; transform: translateY(6px) scale(0.96); }
    40%, 86%      { opacity: 1; transform: translateY(0)   scale(1); }
    93%           { opacity: 0; transform: translateY(-4px) scale(0.98); }
}
@keyframes bubble-pop-3 {
    0%, 54%, 100% { opacity: 0; transform: translateY(6px) scale(0.96); }
    58%, 86%      { opacity: 1; transform: translateY(0)   scale(1); }
    93%           { opacity: 0; transform: translateY(-4px) scale(0.98); }
}

@media (prefers-reduced-motion: reduce) {
    .bento-anim-transcript .anim-bubble {
        animation: none !important;
        opacity: 1;
        transform: none;
    }
}

/* ---------- Sandbox: orbiting chips ---------- */

.bento-anim-orbit {
    display: grid;
    place-items: center;
}

.bento-anim-orbit .orbit-core {
    position: relative;
    z-index: 3;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--info)) 100%);
    color: hsl(var(--primary-foreground));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 24px -4px hsl(var(--primary) / 0.7);
    animation: core-bob 4s ease-in-out infinite;
}

@keyframes core-bob {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.08); }
}

.bento-anim-orbit .orbit-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 999px;
    border: 1px dashed hsl(var(--border));
    transform: translate(-50%, -50%);
}

.bento-anim-orbit .orbit-r1 { width: 70px;  height: 70px; }
.bento-anim-orbit .orbit-r2 { width: 100px; height: 100px; opacity: 0.5; }

.bento-anim-orbit .orbit-chip {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border-radius: 999px;
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    color: hsl(var(--primary));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px -6px hsl(0 0% 0% / 0.3);
    transform-origin: center;
    animation: orbit-spin 12s linear infinite;
    --start: var(--a);
}

@keyframes orbit-spin {
    from { transform: rotate(calc(var(--start) + 0deg))   translateX(var(--r)) rotate(calc(0deg - var(--start))); }
    to   { transform: rotate(calc(var(--start) + 360deg)) translateX(var(--r)) rotate(calc(-360deg - var(--start))); }
}

/* Stop spinning on the inner icon so it stays upright. */
.bento-anim-orbit .orbit-chip > .icon {
    transform: none;
}

/* ---------- Card hover sweetener: nudge waveform & ripple a touch faster ---------- */

.bento-card:hover .bento-anim-wave > span { animation-duration: 0.9s; }
.bento-card:hover .anim-pin              { animation-duration: 1.6s; }
.bento-card:hover .orbit-core            { animation-duration: 2s; }

/* =====================================================================
   Patch: richer "audio playback" waveform for the speak card +
   live event timeline for the /track watch-position page.
   ===================================================================== */

/* ---------- Speak: representative-spike audio waveform ---------- */

/* Override the base equalizer with a more organic waveform. Bars now
   take their height from the panel (so the scaleY actually paints),
   and each bar follows one of four "spike profiles" so the result
   looks like a real audio level meter rather than a uniform pulse. */
.bento-anim-wave {
    overflow: hidden;
    gap: 2px;
}

.bento-anim-wave > span {
    height: 78%;
    border-radius: 2px;
    transform: scaleY(0.15);
    animation-name: spike-a;
    animation-duration: 1.4s;
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    animation-iteration-count: infinite;
    box-shadow: 0 0 8px -3px hsl(var(--primary) / 0.55);
}

.bento-anim-wave > span:nth-child(4n+2) {
    animation-name: spike-b;
    animation-duration: 1.1s;
}

.bento-anim-wave > span:nth-child(4n+3) {
    animation-name: spike-c;
    animation-duration: 1.6s;
}

.bento-anim-wave > span:nth-child(4n+4) {
    animation-name: spike-d;
    animation-duration: 1.25s;
}

@keyframes spike-a {
    0%, 100% { transform: scaleY(0.16); }
    18%      { transform: scaleY(0.4);  }
    34%      { transform: scaleY(0.92); }
    48%      { transform: scaleY(0.55); }
    66%      { transform: scaleY(0.78); }
    82%      { transform: scaleY(0.3);  }
}

@keyframes spike-b {
    0%, 100% { transform: scaleY(0.18); }
    14%      { transform: scaleY(0.95); }
    28%      { transform: scaleY(0.4);  }
    44%      { transform: scaleY(0.7);  }
    62%      { transform: scaleY(0.32); }
    80%      { transform: scaleY(0.65); }
}

@keyframes spike-c {
    0%, 100% { transform: scaleY(0.14); }
    22%      { transform: scaleY(0.55); }
    42%      { transform: scaleY(0.86); }
    58%      { transform: scaleY(0.96); }
    74%      { transform: scaleY(0.5);  }
    90%      { transform: scaleY(0.25); }
}

@keyframes spike-d {
    0%, 100% { transform: scaleY(0.12); }
    25%      { transform: scaleY(0.22); }
    48%      { transform: scaleY(0.98); }
    60%      { transform: scaleY(0.7);  }
    78%      { transform: scaleY(0.4);  }
}

/* Faint silence line at the centre so peaks read clearly. */
.bento-anim-wave::before {
    content: '';
    position: absolute;
    left: 14px;
    right: 14px;
    top: 50%;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        hsl(var(--primary) / 0.22) 50%,
        transparent 100%);
    transform: translateY(-0.5px);
    pointer-events: none;
    z-index: 0;
}

/* Playhead sweep — a soft vertical glow that travels across the bars
   to simulate audio playback progress. */
.bento-anim-wave::after {
    content: '';
    position: absolute;
    top: 8%;
    bottom: 8%;
    left: 0;
    width: 32px;
    background: radial-gradient(
        ellipse at center,
        hsl(var(--primary) / 0.35) 0%,
        hsl(var(--primary) / 0.12) 35%,
        transparent 70%);
    transform: translateX(-100%);
    animation: playhead-sweep 4.2s cubic-bezier(0.45, 0, 0.55, 1) infinite;
    pointer-events: none;
    mix-blend-mode: screen;
    filter: blur(0.5px);
}

@keyframes playhead-sweep {
    0%   { transform: translateX(-100%); opacity: 0; }
    8%   { opacity: 0.95; }
    50%  { opacity: 0.95; }
    92%  { opacity: 0.95; }
    100% { transform: translateX(calc(100% + 32px)); opacity: 0; }
}

.bento-card:hover .bento-anim-wave > span,
.bento-card:hover .bento-anim-wave > span:nth-child(4n+2),
.bento-card:hover .bento-anim-wave > span:nth-child(4n+3),
.bento-card:hover .bento-anim-wave > span:nth-child(4n+4) {
    animation-duration: 0.85s;
}

.bento-card:hover .bento-anim-wave::after {
    animation-duration: 2.6s;
}

@media (prefers-reduced-motion: reduce) {
    .bento-anim-wave > span,
    .bento-anim-wave::after {
        animation: none !important;
        transform: none !important;
    }
}

/* ---------- /track: live event timeline ---------- */

/* Side-by-side map + timeline on desktop, stacked on mobile. */
.track-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: start;
}

@media (min-width: 960px) {
    .track-grid {
        grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    }
}

.track-grid-map {
    min-width: 0;
}

.track-grid-timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1rem 1rem 1.1rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--surface));
    box-shadow:
        0 1px 0 hsl(var(--border)),
        0 8px 24px -16px hsl(0 0% 0% / 0.18);
    min-width: 0;
    max-height: 32rem;
}

.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid hsl(var(--border));
}

.timeline-title {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: hsl(var(--foreground));
}

.timeline-count {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: hsl(var(--primary) / 0.12);
    color: hsl(var(--primary));
    font-size: 0.72rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    border: 1px solid hsl(var(--primary) / 0.25);
    white-space: nowrap;
}

.timeline-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2.5rem 1rem;
    color: hsl(var(--muted-foreground));
    text-align: center;
}

.timeline-empty .icon {
    width: 28px;
    height: 28px;
    opacity: 0.55;
    animation: compass-spin 6s linear infinite;
}

.timeline-empty p {
    margin: 0;
    font-size: 0.85rem;
}

@keyframes compass-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.timeline {
    list-style: none;
    margin: 0;
    padding: 0.35rem 0 0.1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--border)) transparent;
}

.timeline::-webkit-scrollbar {
    width: 8px;
}

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

.timeline-entry {
    position: relative;
    display: grid;
    grid-template-columns: 14px 1fr;
    gap: 0.7rem;
    align-items: start;
    padding: 0.5rem 0.7rem 0.55rem 0.45rem;
    border-radius: calc(var(--radius) - 6px);
    animation: timeline-splat 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
    transition: background var(--dur-fast) var(--ease-out);
}

.timeline-entry:hover {
    background: hsl(var(--muted) / 0.55);
}

/* Continuous hairline rail behind the dots. */
.timeline-entry::before {
    content: '';
    position: absolute;
    left: 11.5px;
    top: 1.1rem;
    bottom: -0.7rem;
    width: 1px;
    background: hsl(var(--border));
}

.timeline-entry:last-child::before {
    display: none;
}

.timeline-dot {
    position: relative;
    width: 9px;
    height: 9px;
    margin-top: 7px;
    margin-left: 2px;
    border-radius: 999px;
    background: hsl(var(--muted-foreground));
    box-shadow: 0 0 0 3px hsl(var(--surface));
    flex-shrink: 0;
    z-index: 1;
    transition: background var(--dur-fast) var(--ease-out);
}

.timeline-entry.is-newest .timeline-dot {
    background: hsl(var(--primary));
    box-shadow:
        0 0 0 3px hsl(var(--surface)),
        0 0 0 5px hsl(var(--primary) / 0.18);
}

.timeline-entry.is-newest .timeline-dot::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 999px;
    border: 1.5px solid hsl(var(--primary) / 0.5);
    animation: timeline-dot-pulse 1.8s ease-out infinite;
    pointer-events: none;
}

@keyframes timeline-dot-pulse {
    0%   { transform: scale(0.7); opacity: 0.85; }
    100% { transform: scale(2.4); opacity: 0; }
}

.timeline-content {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.timeline-primary {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.35rem 0.8rem;
    min-width: 0;
}

.timeline-time {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.78rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.timeline-entry.is-newest .timeline-time {
    color: hsl(var(--primary));
}

.timeline-coords {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.72rem;
    color: hsl(var(--muted-foreground));
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    min-width: 0;
    white-space: nowrap;
}

.timeline-coords-sep {
    margin: 0 0.25rem 0 0;
    color: hsl(var(--border));
}

.timeline-secondary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    min-width: 0;
}

.timeline-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    background: hsl(var(--muted) / 0.6);
    color: hsl(var(--muted-foreground));
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.66rem;
    font-weight: 500;
    border: 1px solid hsl(var(--border));
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.timeline-chip-accuracy {
    color: hsl(var(--primary));
    background: hsl(var(--primary) / 0.08);
    border-color: hsl(var(--primary) / 0.22);
}

/* Subtle slide-in from the rail. */
@keyframes timeline-splat {
    0%   {
        opacity: 0;
        transform: translateX(-8px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .timeline-entry,
    .timeline-entry.is-newest .timeline-dot::after,
    .timeline-empty .icon {
        animation: none !important;
    }
}