:root {
    --rh-bg: #f4f7fb;
    --rh-bg-accent: #e8f2f5;
    --rh-surface: #ffffff;
    --rh-surface-elevated: #ffffff;
    --rh-surface-subtle: #f7f9fc;
    --rh-text: #102033;
    --rh-text-muted: #5b6c80;
    --rh-border: #d8e1eb;
    --rh-border-strong: #b8c7d8;
    --rh-action: #0059a8;
    --rh-action-hover: #00437f;
    --rh-action-soft: #e1effc;
    --rh-success: #197447;
    --rh-success-soft: #e3f5ea;
    --rh-warning: #8a5b00;
    --rh-warning-soft: #fff2d8;
    --rh-danger: #ad2f35;
    --rh-danger-soft: #fde8e8;
    --rh-focus-ring: #2f81d5;
    --rh-hero-start: #0b3565;
    --rh-hero-middle: #0059a8;
    --rh-hero-end: #08796f;
    --rh-hero-text: #f7fbff;
    --rh-hero-text-muted: rgba(247, 251, 255, 0.84);
    --rh-radius-card: 1.15rem;
    --rh-radius-control: 0.78rem;
    --rh-space-1: 0.25rem;
    --rh-space-2: 0.5rem;
    --rh-space-3: 0.75rem;
    --rh-space-4: 1rem;
    --rh-space-5: 1.5rem;
    --rh-space-6: 2rem;
    --rh-space-7: 3rem;
    --rh-shadow-1: 0 1px 2px rgba(16, 32, 51, 0.05), 0 8px 24px rgba(16, 32, 51, 0.06);
    --rh-shadow-2: 0 18px 45px rgba(16, 32, 51, 0.11);
    --rh-reading-width: 72ch;
    --rh-learning-width: 56rem;
    --rh-wide-width: 72rem;
    --noun-masculine-surface: #edf6ff;
    --noun-masculine-border: #a9cde9;
    --noun-masculine-accent: #226797;
    --noun-feminine-surface: #fff1f4;
    --noun-feminine-border: #e8b9c4;
    --noun-feminine-accent: #9b4661;
    --noun-neuter-surface: #edf8f0;
    --noun-neuter-border: #acd4b8;
    --noun-neuter-accent: #31744a;
    --noun-special-surface: #fff7e7;
    --noun-special-border: #dfc48d;
    --noun-special-accent: #7f5b15;

    /* Compatibility aliases for the established app styles. */
    --rh-page-bg: var(--rh-bg);
    --rh-page-bg-top: #f8fbff;
    --rh-page-bg-bottom: #eef3f8;
    --rh-surface-soft: var(--rh-surface-subtle);
    --rh-navy-950: var(--rh-text);
    --rh-navy-900: #172b42;
    --rh-navy-800: #243b55;
    --rh-navy-700: #40566f;
    --rh-slate-500: var(--rh-text-muted);
    --rh-line: var(--rh-border);
    --rh-line-strong: var(--rh-border-strong);
    --rh-primary: var(--rh-action);
    --rh-primary-strong: #0870c9;
    --rh-primary-tint: rgba(0, 89, 168, 0.09);
    --rh-success-bg: var(--rh-success-soft);
    --rh-error-bg: var(--rh-danger-soft);
    --rh-error: var(--rh-danger);
    --rh-error-ink: #842229;
    --rh-shadow: var(--rh-shadow-2);
    --rh-shadow-soft: var(--rh-shadow-1);
    --rh-radius-xl: var(--rh-radius-card);
    --rh-radius-lg: var(--rh-radius-control);
}

:focus-visible {
    outline: 3px solid var(--rh-focus-ring);
    outline-offset: 3px;
}

input,
textarea,
select {
    font-size: max(1rem, 16px);
}

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

.rh-layout__tools {
    display: flex;
    justify-content: flex-end;
    width: min(100%, 53rem);
    margin: 0 auto -0.6rem;
    padding: max(0.65rem, env(safe-area-inset-top)) 1rem 0;
}

.rh-theme-toggle {
    position: relative;
    z-index: 20;
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid var(--rh-border-strong);
    border-radius: 999px;
    background: color-mix(in srgb, var(--rh-surface) 92%, transparent);
    color: var(--rh-text);
    box-shadow: var(--rh-shadow-1);
    backdrop-filter: blur(12px);
}

.rh-theme-toggle:hover {
    border-color: var(--rh-action);
    color: var(--rh-action);
}

@media (max-width: 44rem) {
    body:has(.rh-bottom-nav) .rh-layout__tools {
        position: fixed;
        top: calc(max(0.7rem, env(safe-area-inset-top)) + 3.7rem);
        right: max(0.85rem, env(safe-area-inset-right));
        z-index: 1140;
        width: auto;
        margin: 0;
        padding: 0;
    }

    body:has(.rh-bottom-nav):has(.rh-layout__tools) .rh-layout__main {
        padding-top: 7.45rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
