/* Reading size: rem-based type and faces grow together. Caps stay modest so the shell does not break. */
html {
    font-size: calc(100% * var(--text-scale, 1));
    overflow-x: clip;
    max-width: 100vw;
}

body {
    overflow-x: clip;
    max-width: 100vw;
}

.app-shell,
.app-shell__main,
.adventure-main,
.adventure-width {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

h1:focus {
    outline: none;
}

a[href],
button:not(:disabled),
[role="button"],
summary,
select,
label[for] {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--primary);
}

.invalid {
    outline: 1px solid var(--destructive);
}

.validation-message {
    color: var(--destructive);
}

.blazor-error-boundary {
    background-color: var(--destructive);
    color: var(--destructive-foreground);
    padding: 1rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

#blazor-error-ui {
    display: none;
    position: fixed;
    top: 0;
    inset-inline: 0;
    z-index: 100;
    padding: 0.75rem 1rem;
    pointer-events: none;
}

#blazor-error-ui.show {
    display: block;
}

#blazor-error-ui .blazor-error-ui__panel {
    pointer-events: auto;
    margin-inline: auto;
    max-width: 28rem;
    border: 1px solid color-mix(in oklch, var(--destructive, #b42318) 35%, var(--border));
    border-radius: 0.75rem;
    background: var(--surface, #fff);
    color: var(--foreground);
    box-shadow: 0 12px 32px color-mix(in oklch, #000 18%, transparent);
    padding: 0.9rem 1rem;
}

#blazor-error-ui .blazor-error-ui__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}

#blazor-error-ui .blazor-error-ui__hint {
    margin: 0.35rem 0 0;
    font-size: 0.8rem;
    color: var(--muted-foreground, #667);
}

#blazor-error-ui .blazor-error-ui__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

#blazor-error-ui .blazor-error-ui__reload {
    display: inline-flex;
    align-items: center;
    height: 2.25rem;
    padding: 0 0.9rem;
    border-radius: 0.5rem;
    background: var(--primary, #7a3dff);
    color: var(--primary-foreground, #fff);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}

#blazor-error-ui .blazor-error-ui__dismiss {
    display: inline-flex;
    align-items: center;
    height: 2.25rem;
    padding: 0 0.9rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background: var(--background, #fff);
    color: var(--foreground);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.busy-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: color-mix(in oklch, var(--background, #fffaf0) 88%, transparent);
    pointer-events: all;
}

.busy-overlay__panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    min-width: min(18rem, 100%);
    padding: 1.5rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: var(--surface);
    color: var(--foreground);
    text-align: center;
}

.busy-overlay__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.4;
}

.busy-overlay__spinner {
    width: 2.25rem;
    height: 2.25rem;
    border: 0.22rem solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: busy-overlay-spin 700ms linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .busy-overlay__spinner {
        animation: none;
        border-top-color: var(--primary);
        border-right-color: var(--primary);
    }
}

/* ---- Responsive application shell ----------------------------------------------------------------------------
   Material 3 window size classes, one navigation model for the parent and the child shell:
     compact  (< 600px)         bottom bar (BottomNav), content below the header
     medium   (600px - 1199px)  navigation RAIL on the screen edge (right in Arabic), 5rem, icon over label
     expanded (>= 1200px)       permanent navigation DRAWER on the screen edge, 16rem, icon beside label
   The rail/drawer is full height and sticks to the screen edge; the header and the page live in the column beside it.
   The app is Arabic/RTL only, so the first grid column is the right edge; safe-area insets are mapped to that. */
.app-shell {
    --nav-w: 0px;
    --content-max: 72rem;
}

.app-shell__grid {
    display: block;
}

.app-shell__header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 3.5rem;
    width: 100%;
    max-width: var(--content-max);
    margin-inline: auto;
    padding: 0.4rem max(1rem, env(safe-area-inset-right, 0px)) 0.4rem max(1rem, env(safe-area-inset-left, 0px));
}

.app-shell__content {
    width: 100%;
    max-width: var(--content-max);
    margin-inline: auto;
    padding: 1.25rem max(1rem, env(safe-area-inset-right, 0px)) 1.5rem max(1rem, env(safe-area-inset-left, 0px));
}

/* Compact: keep the content clear of the fixed bottom bar. */
.app-shell--parent .app-shell__content {
    padding-bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
}

.app-shell--child .app-shell__main {
    padding-bottom: 7rem;
}

.side-nav {
    display: none;
}

.app-shell__skip {
    position: absolute;
    inset-inline-start: 0.75rem;
    top: -4rem;
    z-index: 60;
    border-radius: 0.75rem;
    background: var(--primary);
    color: var(--primary-foreground);
    padding: 0.6rem 1rem;
    font-weight: 700;
    text-decoration: none;
}

.app-shell__skip:focus {
    top: 0.75rem;
}

/* Medium and up: rail or drawer */
@media (min-width: 600px) {
    .app-shell--parent,
    .app-shell--child {
        --nav-w: 5rem;
        display: grid;
        grid-template-columns: calc(var(--nav-w) + env(safe-area-inset-right, 0px)) minmax(0, 1fr);
        grid-template-rows: auto 1fr;
        grid-template-areas: "nav header" "nav main";
    }

    .app-shell--parent .app-shell__header,
    .app-shell--child .app-shell__header {
        grid-area: header;
        min-width: 0;
    }

    /* The grid wrapper disappears so the nav and the page become cells of the shell grid. */
    .app-shell--parent .app-shell__grid,
    .app-shell--child .app-shell__grid {
        display: contents;
    }

    .app-shell--parent .app-shell__main,
    .app-shell--child .app-shell__main {
        grid-area: main;
        min-width: 0;
        padding-bottom: 0;
    }

    /* Notion-like page: the content sits in a centred column with breathing room that grows with the screen. */
    .app-shell {
        --page-gutter: clamp(1.5rem, 6vw, 5.5rem);
        --content-max: 66rem;
    }

    .app-shell--parent .app-shell__content {
        padding: clamp(1.75rem, 3.5vw, 3rem) max(var(--page-gutter), env(safe-area-inset-right, 0px)) 2rem max(var(--page-gutter), env(safe-area-inset-left, 0px));
    }

    .app-shell--parent .app-shell__header-inner,
    .app-shell--child .app-shell__header-inner {
        padding-inline: max(var(--page-gutter), env(safe-area-inset-right, 0px)) max(var(--page-gutter), env(safe-area-inset-left, 0px));
    }

    .app-shell--child .app-shell__main {
        padding-top: clamp(0.75rem, 2vw, 1.5rem);
    }

    /* The bar holds only the account and notes here (the brand is in the side rail), so it stays slim. */
    .adventure-preview.app-shell--child .adventure-header {
        padding-block: 0.25rem;
    }

    .app-shell--child .app-shell__main .adventure-width {
        width: min(100% - 2 * var(--page-gutter), var(--content-max));
        margin-inline: auto;
    }

    .app-shell--child .app-shell__main {
        padding-bottom: 2rem;
    }

    .app-shell--parent .app-shell__brand,
    .app-shell--child .app-shell__brand {
        display: none;
    }

    .app-shell--parent .app-account-nav,
    .app-shell--child .app-account-nav {
        margin-inline-start: auto;
    }

    .app-shell--parent .bottom-nav,
    .app-shell--child .adventure-bottom-nav,
    .adventure-preview.app-shell--child .adventure-bottom-nav {
        display: none !important; /* beats the adventure theme wide-screen rule that keeps the bar */
    }

    .side-nav {
        grid-area: nav;
        position: sticky;
        top: 0;
        align-self: start;
        height: 100dvh;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        overflow-y: auto;
        border-inline-end: 1px solid var(--border);
        background: var(--surface);
        padding: max(0.75rem, env(safe-area-inset-top, 0px)) 0.5rem max(0.75rem, env(safe-area-inset-bottom, 0px)) calc(0.5rem + env(safe-area-inset-right, 0px));
    }

    .side-nav__brand {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.6rem;
        min-height: 3rem;
    }

    .side-nav__title {
        display: none;
        font-size: 1.05rem;
    }

    .side-nav__menu {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }

    /* Rail item: icon over a 12px label, at least 56px tall. */
    .side-nav__item {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
        min-height: 3.5rem;
        border-radius: 1rem;
        padding: 0.4rem 0.2rem;
        color: var(--muted-foreground);
        font-size: 0.75rem;
        font-weight: 600;
        line-height: 1.2;
        text-align: center;
        text-decoration: none;
    }

    .side-nav__label {
        flex: none;
    }

    .side-nav .nav-badge--inline {
        position: absolute;
        top: 0.25rem;
        inset-inline-end: 0.9rem;
        margin: 0;
    }
}

/* Expanded: a permanent drawer, icon beside label. */
@media (min-width: 1200px) {
    .app-shell--parent,
    .app-shell--child {
        --nav-w: 16rem;
    }

    .side-nav {
        padding-inline-start: calc(0.75rem + env(safe-area-inset-right, 0px));
        padding-inline-end: 0.75rem;
    }

    .side-nav__brand {
        justify-content: flex-start;
        padding-inline: 0.5rem;
    }

    .side-nav__title {
        display: inline;
    }

    .side-nav__item {
        flex-direction: row;
        justify-content: flex-start;
        gap: 0.75rem;
        min-height: 3rem;
        padding: 0.4rem 0.9rem;
        font-size: 0.95rem;
        text-align: start;
    }

    .side-nav__label {
        flex: 1;
        min-width: 0;
    }

    .side-nav .nav-badge--inline {
        position: static;
        margin-inline-start: auto;
    }
}

/* The child rail lists every destination. When the screen is too short for them, the last ones drop out one by one and
   "More" (which lists all of them) takes their place. One item is about 3.75rem with its gap; "More" costs one more. */
.side-nav__more {
    display: none !important;
}

@media (min-width: 600px) and (max-height: 540px) {
    .side-nav--child .side-nav__more { display: flex !important; }
    .side-nav--child [data-rail="7"] { display: none; }
}

@media (min-width: 600px) and (max-height: 470px) {
    .side-nav--child [data-rail="6"] { display: none; }
}

@media (min-width: 600px) and (max-height: 410px) {
    .side-nav--child [data-rail="5"] { display: none; }
}

@media (min-width: 600px) and (max-height: 350px) {
    .side-nav--child [data-rail="4"] { display: none; }
}

.side-nav__logo {
    display: inline-grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.75rem;
    background: color-mix(in oklch, var(--primary) 16%, transparent);
    color: var(--primary);
}

.side-nav__item:hover {
    background: color-mix(in oklch, var(--primary) 8%, transparent);
}

.side-nav__item.is-active {
    background: color-mix(in oklch, var(--primary) 16%, transparent);
    color: var(--foreground);
}

.side-nav__item:focus-visible,
.bottom-nav__link:focus-visible,
.child-master__item:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Master-detail: the list of children beside the selected child profile. Starts at 900px so the profile keeps >= 480px beside the rail. */
.master-detail__master {
    display: block;
}

@media (max-width: 899px) {
    .child-master {
        flex-direction: row;
        align-items: center;
        gap: 0.4rem;
        border: 0;
        background: transparent;
        padding: 0;
    }

    .child-master__title {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    .child-master__list {
        flex-direction: row;
        gap: 0.35rem;
        overflow-x: auto;
    }

    .child-master__item {
        flex: 0 0 auto;
        max-width: 9rem;
    }
}

@media (min-width: 900px) {
    .master-detail {
        display: grid;
        grid-template-columns: 14rem minmax(0, 1fr);
        gap: 1.5rem;
        align-items: start;
    }

    .master-detail__master {
        display: block;
        position: sticky;
        top: 1rem;
    }

    /* The list of children is the way back, so the separate back link is redundant here. */
    .master-detail .page-back {
        display: none;
    }
}

.child-master {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: var(--surface);
    padding: 0.85rem;
}

.child-master__title {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--muted-foreground);
}

.child-master__list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.child-master__item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 2.75rem;
    border-radius: 0.75rem;
    padding: 0.35rem 0.5rem;
    color: var(--foreground);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}

.child-master__item:hover {
    background: color-mix(in oklch, var(--primary) 8%, transparent);
}

.child-master__item.is-selected {
    background: color-mix(in oklch, var(--primary) 16%, transparent);
}

.child-master__photo,
.child-master__avatar {
    flex: none;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    object-fit: cover;
}

.child-master__avatar {
    display: inline-grid;
    place-items: center;
    background: color-mix(in oklch, var(--primary) 18%, var(--surface));
    font-weight: 800;
}

.child-master__name {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.child-master__empty {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted-foreground);
}

.app-account-nav {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.8125rem;
    font-weight: 600;
}

.app-account-nav__identity {
    display: inline-flex;
    min-width: 2.75rem;
    min-height: 2.75rem;
    justify-content: center;
    align-items: center;
    color: inherit;
    text-decoration: none;
    border-radius: 999px;
    padding: 0.15rem;
}

.app-account-nav__identity:hover {
    background: color-mix(in oklch, var(--muted-foreground) 10%, transparent);
}

.app-account-nav__identity:focus-visible {
    outline: 2px solid color-mix(in oklch, var(--primary) 55%, transparent);
    outline-offset: 2px;
}

.app-account-nav__avatar {
    display: inline-flex;
    width: 3rem;
    height: 3rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: color-mix(in oklch, var(--primary) 18%, var(--surface));
    color: var(--foreground);
    font-size: 1rem;
    font-weight: 800;
}

.app-account-nav__avatar-img {
    width: 3rem;
    height: 3rem;
    flex-shrink: 0;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid color-mix(in oklch, var(--primary) 25%, var(--border));
}

.app-account-nav__name {
    display: none;
}

.app-account-nav__link {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    min-height: 2.75rem;
    padding-inline: 0.5rem;
    color: var(--muted-foreground);
    text-decoration: none;
}

.app-account-nav__logout {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    min-height: 0;
    padding: 0;
    border-radius: 999px;
    color: var(--muted-foreground);
    text-decoration: none;
}

.app-account-nav__logout:focus-visible,
.app-account-nav__link:focus-visible,
.color-mode-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* A phone keeps the avatar and drops the name so the header never overflows at 360px. */
@media (max-width: 479px) {
    .app-account-nav__name {
        display: none;
    }
}

.app-account-nav__logout:hover,
.app-account-nav__link:hover {
    color: var(--foreground);
}

.app-account-nav__logout:hover {
    background: color-mix(in oklch, var(--muted-foreground) 10%, transparent);
}

.color-mode-toggle {
    appearance: none;
    display: inline-flex;
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--foreground);
    cursor: pointer;
}

.color-mode-toggle:hover {
    background: color-mix(in oklch, var(--muted-foreground) 10%, transparent);
}

.color-mode-toggle:focus-visible {
    outline: 2px solid color-mix(in oklch, var(--primary) 55%, transparent);
    outline-offset: 2px;
}

.app-toast,
.app-inline-toast {
    position: fixed;
    z-index: 40;
    inset-inline: 0.75rem;
    top: calc(0.65rem + env(safe-area-inset-top, 0px));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    background: var(--surface);
    padding: 0.7rem 0.85rem;
    color: var(--foreground);
    font-size: 0.8125rem;
    font-weight: 600;
    box-shadow: 0 8px 24px color-mix(in oklch, var(--foreground) 12%, transparent);
    opacity: 0;
    transform: translateY(-0.65rem);
    pointer-events: none;
    transition: opacity 220ms ease, transform 220ms ease;
}

.app-inline-toast {
    position: sticky;
    top: 0.35rem;
    z-index: 5;
    margin-bottom: 0.35rem;
}

.app-toast.is-visible,
.app-inline-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.app-toast__close {
    border: 0;
    background: transparent;
    color: var(--muted-foreground);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.bottom-nav {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 30;
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 0.4rem max(0.5rem, env(safe-area-inset-right, 0px)) calc(0.4rem + env(safe-area-inset-bottom)) max(0.5rem, env(safe-area-inset-left, 0px));
}

.bottom-nav__list {
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.bottom-nav__link {
    display: flex;
    min-width: 3.5rem;
    min-height: 3.25rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    border-radius: 0.75rem;
    color: var(--muted-foreground);
    font-size: 0.7rem;
    font-weight: 600;
    text-decoration: none;
}

.bottom-nav__link.active {
    background: color-mix(in oklch, var(--primary) 16%, transparent);
    color: var(--foreground);
}

.bottom-nav__icon {
    font-size: 1.05rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.child-home__empty {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    border: 1px dashed color-mix(in oklch, var(--border) 80%, var(--primary));
    border-radius: 1rem;
    background: color-mix(in oklch, var(--surface) 88%, var(--primary));
    padding: 1.1rem 1.15rem;
}

.child-home__hint {
    margin: 0 0 0.75rem;
}

.star-wallet {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 0.7rem 0.95rem;
}

.star-wallet .wallet-star {
    display: inline-flex;
    color: var(--primary);
}

.star-wallet b {
    display: block;
    font-size: 1.25rem;
    line-height: 1.1;
}

.star-wallet small {
    color: var(--muted-foreground);
    font-size: 0.75rem;
}

.task-details__checks {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin: 0.75rem 0 0;
    padding: 0;
    list-style: none;
}

.task-details__check,
.task-details__check--readonly {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 2.75rem;
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    background: var(--surface);
    padding: 0.55rem 0.8rem;
    cursor: pointer;
}

.task-details__check--readonly {
    cursor: default;
}

.task-details__checks li.is-done .task-details__check,
.task-details__checks li.is-done .task-details__check--readonly {
    border-color: color-mix(in oklch, var(--primary) 45%, var(--border));
    background: color-mix(in oklch, var(--primary) 10%, var(--surface));
}

.task-details__check input {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: var(--primary);
}

.task-details__check-points {
    margin-inline-start: auto;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--primary);
}

.app-shell__header {
    background: color-mix(in oklch, var(--surface) 88%, transparent);
}

/* Android 15/16 enforce edge-to-edge WebViews. Capacitor fills this value
   from the native status-bar height because WebView safe-area can report 0. */
:root {
    --native-status-bar-height: env(safe-area-inset-top, 0px);
}

html.capacitor-native:not(.native-window-insets-applied) .app-shell__header,
html.capacitor-native:not(.native-window-insets-applied) .adventure-header {
    padding-top: max(var(--native-status-bar-height, 24px), env(safe-area-inset-top, 0px)) !important;
}

html.capacitor-native:not(.native-window-insets-applied) .app-toast {
    top: calc(0.65rem + max(var(--native-status-bar-height, 24px), env(safe-area-inset-top, 0px)));
}

/* Server-published occasion layer. The wash keeps content readable over approved images. */
html[data-occasion] .app-shell,
html[data-occasion] .adventure-preview {
    background-color: var(--background) !important;
    background-image:
        linear-gradient(color-mix(in oklch, var(--background) 58%, transparent), color-mix(in oklch, var(--background) 76%, transparent)),
        var(--occasion-background-image, none) !important;
    background-size: cover !important;
    background-position: center !important;
    background-attachment: fixed !important;
}

html[data-occasion] .app-shell__header,
html[data-occasion] .adventure-header {
    border-color: color-mix(in oklch, var(--occasion-accent, var(--primary)) 22%, var(--border));
    backdrop-filter: blur(14px);
}

html[data-occasion] .bg-primary {
    background-color: var(--occasion-accent, var(--primary));
}

.appearance-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.appearance-option {
    position: relative;
    overflow: hidden;
    min-height: 8.5rem;
    border: 2px solid var(--border);
    border-radius: 1rem;
    background: var(--background);
    text-align: start;
}

.appearance-option picture,
.appearance-option img {
    display: block;
    width: 100%;
}

.appearance-option img {
    height: 6rem;
    object-fit: cover;
}

.appearance-option span {
    display: block;
    padding: 0.65rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 700;
}

.appearance-option small {
    position: absolute;
    inset-block-start: 0.5rem;
    inset-inline-end: 0.5rem;
    border-radius: 999px;
    background: var(--primary);
    color: var(--primary-foreground);
    padding: 0.2rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 800;
}

.appearance-option.is-selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px color-mix(in oklch, var(--primary) 18%, transparent);
}

@media (min-width: 640px) {
    .appearance-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.app-shell__brand--parent {
    letter-spacing: 0.01em;
}

.app-shell__brand--child {
    font-family: var(--font-display);
    font-weight: 800;
}

.family-home__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem 1rem;
}

.family-home__date {
    margin: 0.15rem 0 0;
    color: var(--muted-foreground);
    font-size: 0.9rem;
}

.family-home__account {
    color: var(--foreground);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

.family-home__shortcuts button {
    min-height: 2.75rem;
    padding: 0.35rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--foreground);
    font: inherit;
    font-weight: 700;
}

.family-home__attention {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    background: var(--surface);
    color: var(--foreground);
    font-weight: 700;
    text-decoration: none;
}

.family-home__error {
    margin: 0;
    color: var(--destructive-foreground, var(--foreground));
    background: color-mix(in srgb, var(--destructive, var(--accent)) 16%, var(--surface));
    border-radius: 0.8rem;
    padding: 0.7rem 0.9rem;
}

.family-home__hint {
    margin: 0;
    color: var(--muted-foreground);
}

.child-summary-card__main {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: center;
    gap: 0.75rem;
    color: inherit;
    text-decoration: none;
}

.child-summary-card__assign {
    flex-shrink: 0;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 800;
    text-decoration: none;
}

.family-picker {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.family-picker button {
    width: 100%;
    min-height: 2.75rem;
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    background: var(--surface);
    color: var(--foreground);
    font: inherit;
    font-weight: 700;
    text-align: start;
    padding-inline: 0.9rem;
}

.family-home__title {
    margin: 0;
    font-family: var(--font-display, inherit);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.family-home__shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 700;
}

.family-home__shortcuts a {
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
    color: var(--muted-foreground);
    text-decoration: none;
}

.family-home__shortcuts a:hover {
    color: var(--foreground);
}

.family-home__pending {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem 0.9rem;
    border: 1px solid color-mix(in oklch, var(--primary) 40%, var(--border));
    border-radius: 0.95rem;
    background: color-mix(in oklch, var(--primary) 12%, var(--surface));
    color: inherit;
    font-weight: 700;
    text-decoration: none;
}

.family-home__pending-count {
    display: inline-grid;
    place-items: center;
    min-width: 1.8rem;
    height: 1.8rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    background: var(--primary);
    color: var(--primary-foreground);
    font-weight: 800;
}

.family-home__pending-text {
    flex: 1;
    font-size: 0.9rem;
}

.family-home__pending-go {
    color: var(--muted-foreground);
    font-size: 1.25rem;
}

.family-home__empty {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border: 1px dashed var(--border);
    border-radius: 1.1rem;
    background: color-mix(in oklch, var(--surface) 80%, transparent);
    padding: 1.25rem;
}

.family-home__cta {
    align-self: start;
    border-radius: 0.75rem;
    background: var(--primary);
    padding: 0.55rem 0.9rem;
    color: var(--primary-foreground);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

.family-home__grid {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
    margin: 0;
    padding: 0;
    list-style: none;
}

.child-summary-card {
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.7rem;
    border: 1px solid var(--border);
    border-radius: 1.15rem;
    background:
        linear-gradient(135deg,
            color-mix(in oklch, var(--primary) 10%, var(--surface)),
            var(--surface) 55%);
    padding: 0.85rem 0.95rem;
    color: inherit;
}

.child-summary-card:active {
    transform: scale(0.985);
}

.child-summary-card__identity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.child-summary-card__identity a {
    color: inherit;
    text-decoration: none;
}

.child-summary-card__balance,
.child-summary-card__earned,
.child-summary-card__note {
    margin: 0.1rem 0 0;
    color: var(--muted-foreground);
    font-size: 0.82rem;
}

.child-summary-card__stats,
.child-summary-card__activity {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
    margin: 0;
}

.child-summary-card__stats > div,
.child-summary-card__activity > div {
    padding: 0.4rem 0.5rem;
    border-radius: 0.7rem;
    background: color-mix(in oklch, var(--background) 70%, transparent);
}

.child-summary-card__stats dt,
.child-summary-card__activity dt {
    margin: 0;
    color: var(--muted-foreground);
    font-size: 0.75rem;
}

.child-summary-card__stats dd,
.child-summary-card__activity dd {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
}

.child-summary-card__stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.child-summary-card__stats > div {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 0.4rem;
    text-align: start;
}

@container (min-width: 40rem) {
    .child-summary-card__stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.child-summary-card__activity > div {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.5rem;
}

.child-summary-card__activity dt {
    font-size: 0.85rem;
}

.child-summary-card__split {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.child-summary-card__split dd {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted-foreground);
}

.child-summary-card__countline {
    display: inline-flex;
    align-items: baseline;
    gap: 0.25rem;
}

.child-summary-card__countline b {
    color: var(--foreground);
    font-size: 0.95rem;
    font-weight: 800;
}

.child-summary-card__deed {
    flex-shrink: 0;
    font-size: 1.15rem;
    line-height: 1;
}

.child-summary-card__present {
    flex-shrink: 0;
    color: var(--primary);
}

.child-summary-card__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.child-summary-card__actions button {
    flex: 1 1 calc(50% - 0.45rem);
}

.child-summary-card__details {
    flex: 1 1 100%;
}

@container (min-width: 22rem) {
    .child-summary-card__actions button {
        flex: 0 1 auto;
    }

    .child-summary-card__details {
        flex: 0 0 auto;
        margin-inline-start: auto;
    }
}

.child-summary-card__actions button,
.child-summary-card__actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    min-height: 2.75rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: inherit;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
}

.child-summary-card__actions .child-summary-card__watch-btn {
    border-color: color-mix(in oklch, var(--primary) 35%, var(--border));
    background: color-mix(in oklch, var(--primary) 12%, var(--surface));
    color: var(--primary);
}

.child-summary-card__actions .child-summary-card__watch-btn:hover {
    background: color-mix(in oklch, var(--primary) 20%, var(--surface));
}

.child-summary-card__actions .child-summary-card__join-btn {
    border-color: color-mix(in oklch, #f59e0b 40%, var(--border));
    background: color-mix(in oklch, #f59e0b 14%, var(--surface));
    color: color-mix(in oklch, #d97706 90%, var(--foreground));
}

.child-summary-card__actions .child-summary-card__join-btn:hover {
    background: color-mix(in oklch, #f59e0b 22%, var(--surface));
}

.child-summary-card__avatar {
    display: inline-flex;
    width: 3.75rem;
    height: 3.75rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: color-mix(in oklch, var(--primary) 22%, var(--background));
    font-size: 1.15rem;
    font-weight: 800;
}

.child-summary-card__photo {
    width: 3.75rem;
    height: 3.75rem;
    flex-shrink: 0;
    border-radius: 999px;
    object-fit: cover;
    border: 2px solid color-mix(in oklch, var(--primary) 30%, var(--border));
}

.child-summary-card__body {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 0.35rem;
}

.child-summary-card__name {
    font-size: 1.05rem;
    font-weight: 800;
}

.child-summary-card__penalty {
    color: color-mix(in oklch, var(--destructive, #b42318) 80%, var(--foreground));
}

.child-summary-card__chevron {
    color: var(--muted-foreground);
    font-size: 1.25rem;
}

.child-profile__hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    border-radius: 1.35rem;
    background:
        radial-gradient(90% 120% at 0% 0%,
            color-mix(in oklch, var(--primary) 28%, transparent),
            transparent 52%),
        var(--surface);
    border: 1px solid var(--border);
    padding: 0.85rem 1rem 0.9rem;
}

.child-profile__portrait {
    width: 4.5rem;
    height: 4.5rem;
    flex-shrink: 0;
    border-radius: 1.35rem;
    object-fit: cover;
    border: 2.5px solid color-mix(in oklch, var(--primary) 40%, var(--border));
    background: color-mix(in oklch, var(--primary) 14%, var(--background));
    box-shadow: 0 8px 20px color-mix(in oklch, var(--primary) 18%, transparent);
}

.child-profile__portrait--initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--foreground);
}

.child-profile__identity {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.child-profile__name {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.child-profile__meta {
    margin: 0;
}

.child-profile__theme-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    background: color-mix(in oklch, var(--primary) 16%, var(--background));
    color: var(--foreground);
    font-size: 0.75rem;
    font-weight: 700;
}

/* The counts take their own full-width row under the name and stay on one line. */
.child-profile__pulse {
    display: flex;
    flex: 1 1 100%;
    flex-wrap: nowrap;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.child-profile__pulse li {
    flex: 1 1 0;
    justify-content: center;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--background);
    padding: 0.28rem 0.65rem;
    color: var(--muted-foreground);
    font-size: 0.72rem;
    font-weight: 700;
}

.child-profile__pulse b {
    color: var(--foreground);
    font-size: 0.85rem;
}

.child-profile__pulse .is-hot {
    border-color: color-mix(in oklch, var(--primary) 45%, var(--border));
    background: color-mix(in oklch, var(--primary) 14%, var(--background));
    color: var(--foreground);
}

.child-profile__pulse .is-penalty {
    border-color: color-mix(in oklch, var(--destructive, #b42318) 40%, var(--border));
    color: color-mix(in oklch, var(--destructive, #b42318) 70%, var(--foreground));
}

.child-profile__tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    padding: 0.3rem;
    border-radius: 1rem;
    background: color-mix(in oklch, var(--muted-foreground) 8%, var(--surface));
    border: 1px solid var(--border);
}

.child-profile__tab {
    appearance: none;
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    border: 0;
    border-radius: 0.75rem;
    background: transparent;
    color: var(--muted-foreground);
    font-size: 0.88rem;
    font-weight: 800;
    padding: 0.55rem 0.4rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.child-profile__tab.is-active {
    background: var(--surface);
    color: var(--foreground);
    box-shadow: 0 1px 0 color-mix(in oklch, var(--foreground) 8%, transparent);
}

.child-profile__subtabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.35rem;
    padding: 0.25rem;
    border-radius: 0.95rem;
    background: color-mix(in oklch, var(--muted-foreground) 6%, var(--surface));
    border: 1px solid var(--border);
}

.child-profile__subtab {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    min-width: 0;
    min-height: 2.5rem;
    padding: 0.35rem 0.35rem;
    border-radius: 0.7rem;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted-foreground);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.child-profile__subtab.is-active {
    border-color: color-mix(in oklch, var(--primary) 45%, var(--border));
    background: color-mix(in oklch, var(--primary) 14%, var(--surface));
    color: var(--foreground);
    box-shadow: 0 1px 2px color-mix(in oklch, var(--foreground) 8%, transparent);
}

.child-profile__subtab-badge {
    display: inline-grid;
    place-items: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--primary);
    color: var(--primary-foreground);
    font-size: 0.7rem;
    font-weight: 800;
}

.child-profile__section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.child-profile__section--alert {
    border: 1px solid color-mix(in oklch, var(--destructive, #b42318) 30%, var(--border));
    border-radius: 1.1rem;
    background: color-mix(in oklch, var(--destructive, #b42318) 6%, var(--surface));
    padding: 0.9rem 1rem;
}

.child-profile__section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.child-profile__section-head h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.child-profile__count {
    display: inline-flex;
    min-width: 1.5rem;
    height: 1.5rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: color-mix(in oklch, var(--primary) 22%, transparent);
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0 0.45rem;
}

.child-profile__empty {
    margin: 0;
    color: var(--muted-foreground);
    font-size: 0.875rem;
    line-height: 1.5;
}

.child-profile__list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.child-profile__mission {
    display: block;
}

.child-profile__assign-btn {
    appearance: none;
    border: 0;
    border-radius: 0.75rem;
    background: var(--primary);
    color: var(--primary-foreground);
    font-size: 0.8rem;
    font-weight: 800;
    padding: 0.55rem 0.85rem;
    cursor: pointer;
}

.child-profile__assign-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.child-profile__bank {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: var(--surface);
    padding: 0.75rem;
}

.child-profile__bank-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border-radius: 0.75rem;
    background: var(--background);
    padding: 0.55rem 0.7rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.child-profile__bank-give {
    appearance: none;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    background: var(--surface);
    color: var(--foreground);
    font-size: 0.8rem;
    font-weight: 800;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
}

.child-profile__restriction {
    border-radius: 0.75rem;
    background: var(--surface);
    padding: 0.65rem 0.75rem;
    font-size: 0.875rem;
}

.child-profile__link {
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 700;
    text-decoration: none;
}

.child-profile__account {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.child-profile__field {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    border: 1px solid var(--border);
    border-radius: 1.15rem;
    background: var(--surface);
    padding: 1rem 1.05rem;
}

.child-profile__field-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.child-profile__field-hint {
    margin: 0;
    color: var(--muted-foreground);
    font-size: 0.8rem;
}

.child-profile__avatars {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.55rem;
}

.child-profile__avatar-pick {
    appearance: none;
    border: 2px solid var(--border);
    border-radius: 1rem;
    background: color-mix(in oklch, var(--primary) 8%, var(--background));
    padding: 0.35rem;
    cursor: pointer;
}

.child-profile__avatar-pick img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 0.75rem;
}

.child-profile__avatar-pick.is-selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 28%, transparent);
}

.child-profile__themes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.child-profile__theme {
    appearance: none;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--background);
    color: var(--foreground);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.45rem 0.85rem;
    cursor: pointer;
}

.child-profile__theme.is-selected {
    border-color: var(--primary);
    background: color-mix(in oklch, var(--primary) 18%, var(--background));
}

.child-profile__password {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.child-profile__label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted-foreground);
}

.child-profile__input {
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--background);
    color: var(--foreground);
    font-size: 0.95rem;
    padding: 0.65rem 0.75rem;
}

.page-back {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    width: fit-content;
    color: var(--muted-foreground);
    font-size: 0.875rem;
    font-weight: 700;
    text-decoration: none;
}

.page-back:hover {
    color: var(--foreground);
}

.app-shell__back {
    display: none;
    min-height: 2.75rem;
    padding-inline: 0.15rem;
    color: var(--foreground);
    font-size: 0.95rem;
}

.app-shell__back:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 0.5rem;
}

/* Phone: the child-profile back sits in the header so the page starts with the child. */
@media (max-width: 599px) {
    .app-shell--child-open .app-shell__back {
        display: inline-flex;
    }

    .app-shell--child-open .app-shell__brand--parent {
        display: none;
    }

    .child-profile > a.page-back {
        display: none;
    }
}

.template-view {
    flex: none;
    display: inline-flex;
    align-items: center;
    align-self: center;
    gap: 0.28rem;
    min-height: 1.7rem;
    margin: 0;
    padding: 0.05rem 0.5rem 0.05rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--muted-foreground);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
}

.template-view__icon {
    flex: none;
    width: 13px;
    height: 13px;
}

@media (min-width: 48rem) {
    .template-view {
        gap: 0.35rem;
        min-height: 1.9rem;
        padding: 0.1rem 0.7rem;
        font-size: 0.78rem;
    }

    .template-view__icon {
        width: 15px;
        height: 15px;
    }
}

.template-view:hover,
.template-view:focus-visible {
    color: var(--foreground);
    border-color: color-mix(in oklch, var(--primary) 45%, var(--border));
    outline: none;
}

.page-hero {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
}

.page-hero__copy {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.page-mark {
    position: relative;
    display: inline-flex;
    width: 3.25rem;
    height: 3.25rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 1.05rem;
    border: 1px solid color-mix(in oklch, var(--page-mark, var(--primary)) 35%, var(--border));
    background:
        radial-gradient(circle at 30% 25%,
            color-mix(in oklch, var(--page-mark, var(--primary)) 42%, white),
            transparent 55%),
        color-mix(in oklch, var(--page-mark, var(--primary)) 16%, var(--surface));
    color: color-mix(in oklch, var(--page-mark, var(--primary)) 70%, var(--foreground));
    overflow: hidden;
}

.page-mark__glow {
    position: absolute;
    inset: auto -20% -35% auto;
    width: 70%;
    height: 70%;
    border-radius: 50%;
    background: color-mix(in oklch, var(--page-mark, var(--primary)) 35%, transparent);
    filter: blur(10px);
    pointer-events: none;
}

.page-mark__icon {
    position: relative;
    z-index: 1;
}

.page-mark--teal { --page-mark: oklch(0.62 0.12 195); }
.page-mark--amber { --page-mark: oklch(0.78 0.15 75); }
.page-mark--lime { --page-mark: oklch(0.78 0.16 135); }
.page-mark--violet { --page-mark: oklch(0.62 0.16 300); }
.page-mark--coral { --page-mark: oklch(0.72 0.14 35); }
.page-mark--sky { --page-mark: oklch(0.72 0.12 230); }

.question-card {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 1.15rem;
    background: var(--surface);
    padding: 1rem 1.05rem;
}

.question-card__prompt {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.45;
}

.question-card__choices {
    display: grid;
    gap: 0.55rem;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .question-card__choices {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.question-card__choice {
    min-height: 3rem;
    border: 1px solid var(--border);
    border-radius: 0.95rem;
    background: var(--background);
    padding: 0.65rem 0.85rem;
    font-size: 0.95rem;
    font-weight: 700;
    text-align: start;
    color: var(--foreground);
}

.question-card__choice.is-selected {
    border-color: var(--primary);
    background: color-mix(in oklch, var(--primary) 14%, var(--background));
}

.question-card__choice:disabled {
    opacity: 0.75;
}

.question-card__feedback {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 800;
}

.question-card__feedback.is-ok {
    color: color-mix(in oklch, var(--accent-green, var(--primary)) 70%, var(--foreground));
}

.question-card__feedback.is-try {
    color: color-mix(in oklch, var(--accent-orange, var(--primary)) 65%, var(--foreground));
}

.question-card__hint {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--muted-foreground);
}

.question-card__enrichment {
    margin: 0;
    padding: 0.6rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--foreground);
    background: color-mix(in oklch, var(--accent-green, var(--primary)) 12%, var(--background));
}

.question-card__matching {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.question-card__input {
    min-height: 2.85rem;
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    background: var(--background);
    padding: 0.55rem 0.75rem;
    font-size: 0.95rem;
    color: var(--foreground);
}

.question-card__submit {
    min-height: 2.75rem;
    border: none;
    border-radius: 0.85rem;
    background: var(--primary);
    color: var(--primary-foreground);
    font-weight: 800;
}

/* Matching: each left item is a card; its right-hand answers are full-width tap targets that wrap their text, so no
   long label is cut off and nothing opens a native dropdown. */
.question-card__match-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.95rem;
    background: var(--background);
}

.question-card__match-left {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 800;
    line-height: 1.45;
    color: var(--foreground);
    overflow-wrap: anywhere;
}

.question-card__match-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.question-card__match-option {
    min-height: 2.75rem;
    max-width: 100%;
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    background: var(--card, var(--background));
    padding: 0.5rem 0.75rem;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: start;
    color: var(--foreground);
    overflow-wrap: anywhere;
}

.question-card__match-option.is-selected {
    border-color: var(--primary);
    background: color-mix(in oklch, var(--primary) 14%, var(--background));
}

.question-card__match-option:disabled {
    opacity: 0.75;
}

/* Study pages: the parent's question bank and packages */
.study-back {
    align-self: flex-start;
    min-height: 2.5rem;
    display: inline-flex;
    align-items: center;
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.study-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.study-header__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    margin-inline-end: auto;
    font-size: 1.35rem;
    font-weight: 800;
}

.study-header__count {
    display: inline-grid;
    place-items: center;
    min-width: 1.6rem;
    height: 1.6rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    background: color-mix(in oklch, var(--foreground) 9%, transparent);
    font-size: 0.8rem;
    font-weight: 700;
}

.study-search,
.study-field input,
.study-field textarea,
.study-row input {
    width: 100%;
    min-height: 2.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.7rem;
    background: var(--surface);
    color: var(--foreground);
    font: inherit;
    font-size: 0.95rem;
}

.study-header .study-search {
    order: 3;
    flex: 1 1 100%;
}

@media (min-width: 768px) {
    .study-header .study-search {
        order: 0;
        flex: 0 1 18rem;
    }
}

.study-btn {
    min-height: 2.75rem;
    padding: 0 1.1rem;
    border: 0;
    border-radius: 0.8rem;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.study-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

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

.study-btn--ghost {
    background: color-mix(in oklch, var(--foreground) 8%, transparent);
    color: var(--foreground);
}

.study-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.study-chip {
    min-height: 2.5rem;
    padding: 0 0.95rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--foreground);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.study-chip.is-on {
    border-color: var(--primary);
    background: color-mix(in oklch, var(--primary) 14%, transparent);
    font-weight: 700;
}

.study-list {
    display: grid;
    gap: 0.55rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (min-width: 768px) {
    .study-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.study-card {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    min-height: 4rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.95rem;
    background: var(--surface);
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
}

.study-card:hover {
    border-color: var(--primary);
}

.study-card__icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 0.75rem;
    background: color-mix(in oklch, var(--primary) 14%, transparent);
    font-size: 1.3rem;
}

.study-card__body {
    display: grid;
    gap: 0.25rem;
    min-width: 0;
}

.study-card__title {
    display: -webkit-box;
    overflow: hidden;
    font-weight: 800;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.study-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--muted-foreground);
}

.study-status,
.study-tag {
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    background: var(--muted);
    color: var(--foreground);
    font-size: 0.75rem;
    font-weight: 700;
}

.study-status--published {
    background: color-mix(in oklch, var(--accent-green, var(--primary)) 18%, transparent);
}

.study-status--draft {
    background: color-mix(in oklch, var(--accent) 70%, transparent);
}

.study-form {
    display: grid;
    gap: 0.9rem;
}

.study-field {
    display: grid;
    gap: 0.3rem;
    min-width: 0;
}

.study-field > span,
.study-box > legend {
    font-size: 0.85rem;
    font-weight: 700;
}

.study-field small,
.study-box > legend small {
    font-weight: 500;
    color: var(--muted-foreground);
}

.study-error {
    margin: 0;
    padding: 0.55rem 0.75rem;
    border-radius: 0.7rem;
    background: color-mix(in oklch, var(--destructive) 12%, transparent);
    color: var(--destructive);
    font-size: 0.85rem;
    white-space: pre-line;
}

.study-segment {
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    gap: 0.25rem;
    padding: 0.25rem;
    border-radius: 0.9rem;
    background: color-mix(in oklch, var(--foreground) 6%, transparent);
}

.study-segment__item {
    min-height: 2.75rem;
    padding: 0 0.4rem;
    border: 1px solid transparent;
    border-radius: 0.7rem;
    background: transparent;
    color: var(--muted-foreground);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

.study-segment__item.is-on {
    border-color: var(--primary);
    background: var(--surface);
    color: var(--foreground);
}

.study-box {
    display: grid;
    gap: 0.5rem;
    min-width: 0;
    margin: 0;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.9rem;
}

.study-box > legend {
    padding-inline: 0.3rem;
}

.study-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.study-row--pair input {
    flex: 1 1 0;
    min-width: 0;
}

.study-row--end {
    justify-content: flex-end;
}

.study-mark {
    flex: none;
    width: 2.75rem;
    height: 2.75rem;
    border: 2px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: transparent;
    font-size: 1.1rem;
    font-weight: 900;
    cursor: pointer;
}

.study-mark.is-on {
    border-color: var(--accent-green, var(--primary));
    background: var(--accent-green, var(--primary));
    color: var(--primary-foreground);
}

.study-remove {
    flex: none;
    min-width: 2.5rem;
    min-height: 2.75rem;
    border: 0;
    border-radius: 0.7rem;
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
}

.study-remove:hover:not(:disabled) {
    color: var(--destructive);
}

.study-remove:disabled {
    opacity: 0.3;
}

.study-link {
    justify-self: start;
    min-height: 2.5rem;
    padding: 0 0.4rem;
    border: 0;
    background: transparent;
    color: var(--primary);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.study-link--muted {
    color: var(--muted-foreground);
    font-size: 0.85rem;
}

.study-hint {
    margin: 0;
    font-size: 0.82rem;
    color: var(--muted-foreground);
}

.study-issues {
    margin: 0;
    padding: 0.6rem 0.75rem;
    border-radius: 0.75rem;
    background: color-mix(in oklch, var(--accent) 45%, transparent);
    font-size: 0.82rem;
}

.study-issues ul {
    margin: 0.25rem 0 0;
    padding-inline-start: 1.1rem;
}

.study-preview-label {
    margin: 0 0 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted-foreground);
}

.study-order,
.study-pick {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.study-pick {
    max-height: 18rem;
    overflow: auto;
}

.study-order__item,
.study-pick__item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.75rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface);
}

.study-pick__item {
    width: 100%;
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
}

.study-pick__item:hover {
    border-color: var(--primary);
}

.study-pick__item small {
    flex: none;
    color: var(--muted-foreground);
}

.study-order__number {
    display: grid;
    flex: none;
    place-items: center;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 999px;
    background: color-mix(in oklch, var(--primary) 14%, transparent);
    font-size: 0.8rem;
    font-weight: 800;
}

.study-progress {
    height: 0.5rem;
    overflow: hidden;
    border-radius: 999px;
    background: color-mix(in oklch, var(--primary) 14%, transparent);
}

.study-progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
    transition: width 0.3s ease;
}

.study-result {
    display: grid;
    justify-items: center;
    gap: 0.6rem;
    padding: 1.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 1.2rem;
    background: var(--surface);
    text-align: center;
}

.study-result p {
    margin: 0;
}

.study-result__stars {
    font-size: 3rem;
    line-height: 1;
}

.study-result__back {
    display: inline-grid;
    place-items: center;
    text-decoration: none;
}

.study-order__text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-size: 0.9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.restriction-banner {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: color-mix(in oklch, var(--accent) 55%, var(--surface));
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
}

.restriction-banner strong {
    font-size: 0.95rem;
}

.restriction-banner span {
    font-size: 0.85rem;
    font-weight: 700;
}

.restriction-banner small {
    color: var(--muted-foreground);
    font-size: 0.78rem;
}

.celebration {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: color-mix(in oklch, var(--background) 55%, transparent);
    pointer-events: auto;
}

.celebration__burst {
    position: absolute;
    inset: 12% 18%;
    border-radius: 50%;
    background:
        radial-gradient(circle at 20% 30%, color-mix(in oklch, var(--accent) 55%, transparent), transparent 42%),
        radial-gradient(circle at 80% 25%, color-mix(in oklch, var(--primary) 45%, transparent), transparent 40%),
        radial-gradient(circle at 50% 80%, color-mix(in oklch, var(--accent) 35%, transparent), transparent 45%);
    animation: celebration-burst 700ms ease-out both;
    pointer-events: none;
}

.celebration__card {
    position: relative;
    z-index: 1;
    display: flex;
    max-width: 22rem;
    width: min(100%, 22rem);
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    background: var(--surface);
    padding: 1.25rem 1.35rem;
    text-align: center;
    box-shadow: 0 18px 40px color-mix(in oklch, var(--foreground) 12%, transparent);
    animation: celebration-pop 380ms cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}

.celebration__mascot {
    width: 5.5rem;
}

/* The child's own picture takes the mascot's place: the celebration is about them. */
/* حسناً: wide and easy to hit, with a gentle pulse so it is clearly the way out; still when motion is reduced. */
.celebration__card .celebration__ok {
    justify-content: center;
    min-block-size: 3.25rem;
    padding-inline: 2rem;
    font-size: 1.05rem;
    font-weight: 900;
    box-shadow: 0 0 0 0 color-mix(in oklch, var(--quest-gold, var(--primary)) 55%, transparent);
    animation: celebration-ok-pulse 1.6s ease-in-out infinite;
}

@media (max-width: 767px) {
    .celebration__card .celebration__ok {
        align-self: stretch;
        width: 100%;
    }
}

.celebration--calm .celebration__ok,
html[data-app-hidden] .celebration__ok {
    animation: none;
}

@media (prefers-reduced-motion: reduce) {
    .celebration__card .celebration__ok {
        animation: none;
    }
}

@keyframes celebration-ok-pulse {
    0%, 100% {
        transform: none;
        box-shadow: 0 0 0 0 color-mix(in oklch, var(--quest-gold, var(--primary)) 55%, transparent);
    }
    50% {
        transform: scale(1.03);
        box-shadow: 0 0 0 0.45rem color-mix(in oklch, var(--quest-gold, var(--primary)) 0%, transparent);
    }
}

/* "Sent": the child's companion dancing, with the child's own picture beside it at the height of its face — never lower. */
.celebration__companion {
    display: inline-flex;
    flex: none;
    align-items: flex-start;
    gap: 0.5rem;
}

.celebration__companion > .celebration__kid.kid {
    --kid-size: 6.5rem;
}

/* The face's centre sits a third of --kid-size down the figure (head at y 40 of 160, figure 4/3 as tall as wide). */
.celebration__mini {
    display: grid;
    place-items: center;
    flex: none;
    width: 2.75rem;
    height: 2.75rem;
    margin-block-start: calc(6.5rem / 3 - 1.375rem);
    border-radius: 50%;
    border: 3px solid var(--quest-gold, var(--primary));
    background: var(--surface);
    object-fit: cover;
    font-weight: 900;
}

.celebration__portrait {
    position: relative;
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 5.5rem;
    height: 5.5rem;
}

.celebration__portrait img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--quest-gold, var(--primary));
    box-shadow: 0 6px 18px color-mix(in oklch, var(--primary) 30%, transparent);
    background: var(--surface);
}

.celebration__initial {
    display: inline-grid;
    place-items: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    font-size: 2.4rem;
    color: var(--primary);
    border: 3px solid var(--quest-gold, var(--primary));
    background: color-mix(in oklch, var(--quest-lilac, var(--accent)) 60%, var(--surface));
}

.celebration__portrait-star {
    position: absolute;
    inset-block-end: -0.2rem;
    inset-inline-end: -0.2rem;
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    color: var(--primary);
    background: var(--quest-gold, var(--surface));
    border: 2px solid var(--surface);
}

.celebration__title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--foreground);
}

.celebration__message {
    margin: 0.35rem 0 0;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--muted-foreground);
}

.celebration--micro .celebration__card {
    animation-duration: 280ms;
}

.celebration--major .celebration__burst {
    inset: 8% 12%;
}

.celebration--calm .celebration__burst {
    display: none;
}

.celebration--calm .celebration__card {
    animation: none;
}

.companion {
    width: 4.5rem;
    display: inline-block;
}

.companion__svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

.companion[data-mood="cheer"] .companion__arm--r,
.companion[data-mood="proud"] .companion__arm--r {
    transform-origin: 92px 70px;
    animation: companion-wave 900ms ease-in-out infinite;
}

.companion[data-mood="encourage"] .companion__antenna {
    animation: companion-nod 1.2s ease-in-out infinite;
}

.companion[data-mood="calm"],
.companion.companion--static,
.companion[data-static="true"] {
    /* Idle / accessibility: no motion flourishes. */
}

.companion.companion--static .companion__arm--r,
.companion.companion--static .companion__antenna,
.companion[data-static="true"] .companion__arm--r,
.companion[data-static="true"] .companion__antenna {
    animation: none !important;
}

@keyframes celebration-pop {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.94);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes celebration-burst {
    from {
        opacity: 0;
        transform: scale(0.7);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes companion-wave {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(18deg); }
}

@keyframes companion-nod {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
    .celebration__burst,
    .celebration__card,
    .companion[data-mood] .companion__arm--r,
    .companion[data-mood] .companion__antenna {
        animation: none !important;
    }
}

.lounge-page {
    gap: 0.85rem;
    min-height: calc(100dvh - 7rem);
}

.lounge-page__hero {
    flex: none;
}

.wa-chat {
    --wa-mine: color-mix(in oklch, var(--primary) 16%, #ffffff);
    --wa-mine-ink: #111b21;
    --wa-other: #ffffff;
    --wa-other-ink: #111b21;
    --wa-thread: #efeae2;
    --wa-header: #f0f2f5;
    display: flex;
    flex-direction: column;
    flex: none;
    min-height: 0;
    height: clamp(26rem, calc(100dvh - 16.5rem), 44rem);
    border: 1px solid color-mix(in oklch, var(--border) 80%, transparent);
    border-radius: 1.25rem;
    overflow: hidden;
    background: var(--wa-thread);
}

.adventure-preview.child-quest .wa-chat {
    border: 1.5px solid var(--quest-outline, var(--border));
    box-shadow: var(--quest-shadow, 0 8px 24px oklch(.24 .04 275 / .08));
    --wa-thread: color-mix(in oklch, var(--quest-sky, oklch(.92 .04 220)) 35%, #efeae2);
}

.wa-chat__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid color-mix(in oklch, var(--border) 70%, transparent);
    background: var(--wa-header);
}

.wa-chat__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
}

.wa-chat__subtitle {
    margin: 0.15rem 0 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    color: var(--muted-foreground);
    font-size: 0.75rem;
    font-weight: 600;
}

.wa-chat__unread-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    background: color-mix(in oklch, var(--primary) 22%, transparent);
    color: var(--foreground);
    font-size: 0.7rem;
    font-weight: 800;
}

.wa-chat__error {
    margin: 0;
    padding: 0.55rem 1rem;
    color: var(--destructive, #b42318);
    font-size: 0.85rem;
    background: color-mix(in oklch, var(--destructive, #b42318) 10%, var(--surface));
}

.wa-chat__error p {
    margin: 0;
}

.wa-chat__mic-allow {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    margin-top: 0.45rem;
    padding: 0.3rem 0.95rem;
    border: 0;
    border-radius: 999px;
    background: var(--primary);
    color: var(--primary-foreground, #fff);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.wa-chat__mic-allow:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent);
    outline-offset: 2px;
}

.wa-chat__thread {
    flex: 1;
    min-height: 0;
    overscroll-behavior: contain;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.85rem 0.75rem 1rem;
    scroll-behavior: smooth;
    background-image:
        radial-gradient(circle at 12% 18%, color-mix(in oklch, var(--primary) 8%, transparent) 0 1px, transparent 2px),
        radial-gradient(circle at 88% 42%, color-mix(in oklch, var(--primary) 6%, transparent) 0 1px, transparent 2px);
    background-size: 48px 48px, 64px 64px;
}

.wa-chat__older,
.wa-chat__empty {
    text-align: center;
    color: var(--muted-foreground);
    font-size: 0.8rem;
    padding: 0.35rem;
}

.wa-chat__empty span {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.75rem;
}

.wa-chat__unread-bar {
    display: flex;
    justify-content: center;
    margin: 0.35rem 0 0.55rem;
}

.wa-chat__unread-bar span {
    border-radius: 999px;
    padding: 0.3rem 0.85rem;
    background: color-mix(in oklch, var(--primary) 18%, var(--surface));
    color: var(--foreground);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    box-shadow: 0 1px 0 color-mix(in oklch, var(--foreground) 8%, transparent);
}

.wa-bubble {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    max-width: min(80%, 26rem);
    padding: 0.4rem 0.65rem 0.35rem;
    border-radius: 0.85rem;
    border: 0;
    box-shadow: 0 1px 0.5px color-mix(in oklch, var(--foreground) 12%, transparent);
}

.wa-bubble--mine {
    background: var(--wa-mine);
    color: var(--wa-mine-ink);
    border-start-start-radius: 0.2rem;
    border-start-end-radius: 0.85rem;
}

.wa-bubble--other {
    background: var(--wa-other);
    color: var(--wa-other-ink);
    border-start-end-radius: 0.2rem;
    border-start-start-radius: 0.85rem;
}

.wa-bubble--celebration {
    border-color: color-mix(in oklch, var(--primary) 35%, var(--border));
}

.wa-celebration {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
    margin: 0.65rem 0 0.85rem;
    width: 100%;
}

.wa-celebration__card {
    position: relative;
    width: min(100%, 22rem);
    padding: 0.55rem 0.65rem 0.7rem;
    border-radius: 1rem;
    border: 1px solid color-mix(in oklch, var(--primary) 28%, var(--border));
    background: color-mix(in oklch, var(--surface) 92%, var(--primary));
    box-shadow: 0 4px 14px color-mix(in oklch, var(--foreground) 8%, transparent);
}

.wa-celebration__card:has(.wa-celebration__fans) {
    margin-bottom: 0.35rem;
}

.wa-celebration__main {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.55rem 0.65rem;
}

.wa-celebration__avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.85rem;
    object-fit: cover;
    border: 1.5px solid var(--surface);
    box-shadow: 0 0 0 1.5px color-mix(in oklch, var(--primary) 35%, transparent);
}

.wa-celebration__avatar--fallback {
    display: grid;
    place-items: center;
    background: color-mix(in oklch, var(--primary) 22%, var(--surface));
    font-weight: 800;
    font-size: 1rem;
}

.wa-celebration__copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.wa-celebration__line {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.3rem 0.45rem;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.35;
}

.wa-celebration__hello {
    color: color-mix(in oklch, var(--primary) 55%, var(--foreground));
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
}

.wa-celebration__stars-count {
    margin-inline-start: auto;
    font-weight: 850;
    color: oklch(0.78 0.16 90);
    font-size: 0.8rem;
}

.wa-celebration__task {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 650;
    color: var(--muted-foreground);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wa-celebration__react {
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: 0.4rem 0.7rem;
    background: color-mix(in oklch, var(--primary) 18%, var(--surface));
    color: var(--foreground);
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.wa-celebration__react:hover:not(:disabled) {
    background: color-mix(in oklch, var(--primary) 28%, var(--surface));
}

.wa-celebration__react:disabled {
    opacity: 0.7;
    cursor: default;
}

.wa-celebration__fans {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
    transform: translateY(50%);
    z-index: 2;
    pointer-events: none;
}

.wa-celebration__fans li {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: color-mix(in oklch, var(--primary) 22%, var(--surface));
    border: 2px solid color-mix(in oklch, var(--surface) 88%, var(--primary));
    font-size: 0.7rem;
    font-weight: 800;
    margin-inline-start: -0.55rem;
    box-shadow:
        0 0 0 1px color-mix(in oklch, var(--primary) 30%, transparent),
        0 3px 8px color-mix(in oklch, var(--foreground) 18%, transparent);
    pointer-events: auto;
}

.wa-celebration__fans li:first-child {
    margin-inline-start: 0;
}

.wa-celebration__fans img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wa-celebration__fans-more {
    font-size: 0.62rem !important;
    width: auto !important;
    min-width: 1.75rem;
    padding: 0 0.4rem;
}

.wa-celebration__time {
    font-size: 0.68rem;
    color: var(--muted-foreground);
    font-weight: 600;
    margin-top: 0.85rem;
}

/* A finished family game round in the chat: the result as text and a link to it. */
.wa-game {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.wa-game__text {
    margin: 0;
    color: var(--foreground);
    font-weight: 700;
    line-height: 1.6;
}

.wa-game__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background: color-mix(in oklch, var(--primary) 14%, var(--surface));
}

.wa-game__link {
    align-self: flex-start;
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    padding: 0 0.9rem;
    border-radius: 999px;
    background: var(--primary);
    color: var(--primary-foreground);
    font-weight: 800;
    text-decoration: none;
}

.wa-game__link:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.wa-chat--festive {
    box-shadow: 0 0 0 2px color-mix(in oklch, var(--primary) 35%, transparent);
}

/* Full-screen party: confetti + rockets (~2s) */
.ct-party {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
    transition: opacity 160ms ease-out;
}

.ct-party.is-on {
    opacity: 1;
}

.ct-party.is-off {
    opacity: 0;
}

.ct-party__confetti {
    position: absolute;
    top: -12px;
    left: var(--x);
    width: var(--size);
    height: calc(var(--size) * 0.55);
    border-radius: 2px;
    background: var(--color);
    box-shadow: 0 0 6px color-mix(in oklch, var(--color) 55%, transparent);
    animation: ct-confetti-fall var(--dur) linear var(--delay) both;
    transform: rotate(var(--rot));
    will-change: transform, opacity;
}

.ct-party__rocket {
    position: absolute;
    bottom: -8px;
    left: var(--rx);
    width: 5px;
    height: 22px;
    border-radius: 999px;
    background: linear-gradient(to top, transparent, var(--rcolor));
    box-shadow: 0 0 10px var(--rcolor);
    animation: ct-rocket-up 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) var(--rdelay) both;
}

.ct-party__boom {
    position: absolute;
    top: 20%;
    left: var(--bx);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bcolor);
    box-shadow:
        0 0 0 0 var(--bcolor),
        14px -10px 0 -2px var(--bcolor),
        -16px -8px 0 -2px var(--bcolor),
        10px 14px 0 -2px var(--bcolor),
        -12px 16px 0 -2px var(--bcolor),
        20px 4px 0 -3px var(--bcolor),
        -22px 2px 0 -3px var(--bcolor),
        0 -18px 0 -3px var(--bcolor),
        4px 20px 0 -3px var(--bcolor);
    opacity: 0;
    animation: ct-boom 0.9s ease-out var(--bdelay) both;
}

.ct-party__spark {
    position: absolute;
    top: 20%;
    left: var(--bx);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--bcolor);
    box-shadow: 0 0 8px var(--bcolor);
    opacity: 0;
    animation: ct-spark 0.75s ease-out var(--bdelay) both;
}

@keyframes ct-confetti-fall {
    0% {
        transform: translate3d(0, -4vh, 0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate3d(var(--drift), 110vh, 0) rotate(var(--rot));
        opacity: 0.12;
    }
}

@keyframes ct-rocket-up {
    0% {
        transform: translate3d(0, 0, 0) scaleY(0.6);
        opacity: 0;
    }
    20% { opacity: 1; }
    100% {
        transform: translate3d(0, -72vh, 0) scaleY(1);
        opacity: 0;
    }
}

@keyframes ct-boom {
    0% {
        transform: scale(0.2);
        opacity: 0;
    }
    22% {
        transform: scale(1.15);
        opacity: 1;
    }
    100% {
        transform: scale(2.1);
        opacity: 0;
    }
}

@keyframes ct-spark {
    0% {
        transform: translate3d(0, 0, 0) scale(0.4);
        opacity: 0;
    }
    30% {
        opacity: 1;
    }
    100% {
        transform: translate3d(var(--sx), var(--sy), 0) scale(0.2);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ct-party {
        display: none !important;
    }
}
.wa-bubble__author {
    font-size: 0.72rem;
    font-weight: 800;
    color: color-mix(in oklch, var(--primary) 55%, var(--foreground));
}

.wa-bubble__head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.2rem;
}

.wa-bubble__avatar {
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 999px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1.5px solid var(--surface);
}

.wa-bubble__avatar--fallback {
    display: grid;
    place-items: center;
    background: color-mix(in oklch, var(--primary) 20%, var(--surface));
    font-size: 0.68rem;
    font-weight: 800;
}

.wa-bubble__body {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.wa-bubble__meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    margin-top: 0.1rem;
    color: color-mix(in oklch, var(--muted-foreground) 80%, transparent);
    font-size: 0.65rem;
    font-weight: 600;
}

.wa-bubble__react {
    appearance: none;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    line-height: 1;
}

.wa-chat__composer {
    display: flex;
    gap: 0.5rem;
    padding: 0.7rem 0.75rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid color-mix(in oklch, var(--border) 70%, transparent);
    background: var(--wa-header);
}

.wa-chat__input {
    flex: 1;
    min-width: 0;
    height: 2.75rem;
    border: 0;
    border-radius: 999px;
    background: var(--surface, #fff);
    color: var(--foreground);
    padding: 0 1rem;
    font-size: 0.95rem;
    box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--border) 80%, transparent);
}

.wa-chat__send {
    appearance: none;
    border: 0;
    border-radius: 999px;
    height: 2.75rem;
    padding: 0 1.1rem;
    background: var(--primary);
    color: var(--primary-foreground, #fff);
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
}

.wa-chat__send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
    .wa-chat__thread {
        scroll-behavior: auto;
    }
}


:root[data-color-mode="dark"] .wa-chat,
html.dark .wa-chat,
.dark .wa-chat {
    --wa-mine: color-mix(in oklch, var(--primary) 28%, #005c4b);
    --wa-mine-ink: #e9edef;
    --wa-other: #202c33;
    --wa-other-ink: #e9edef;
    --wa-thread: #0b141a;
    --wa-header: #1f2c34;
}

.child-profile__avatar-preview {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.child-profile__upload-btn {
    appearance: none;
    border: 1px solid color-mix(in oklch, var(--primary) 35%, var(--border));
    border-radius: 0.85rem;
    background: color-mix(in oklch, var(--primary) 12%, var(--surface));
    color: var(--foreground);
    font-size: 0.82rem;
    font-weight: 800;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
}

.child-profile__upload-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.day-avatar--editable {
    appearance: none;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    border-radius: 999px;
}

.ct-avatar-crop {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
    background: rgba(0, 0, 0, 0.7);
}

.ct-avatar-crop__panel {
    width: min(100%, 24rem);
    max-height: 100%;
    overflow-y: auto;
    border-radius: 1.1rem;
    background: var(--surface, #fff);
    color: var(--foreground, #111);
    padding: 1.1rem;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.ct-avatar-crop__title {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 800;
    text-align: center;
}

.ct-avatar-crop__hint {
    margin: 0 0 0.85rem;
    color: var(--muted-foreground);
    font-size: 0.875rem;
    line-height: 1.6;
    text-align: center;
}

.ct-avatar-crop__stage {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 0.85rem;
    overflow: hidden;
    touch-action: none;
    background: #111;
    cursor: grab;
}

.ct-avatar-crop__stage:active {
    cursor: grabbing;
}

.ct-avatar-crop__stage:focus-visible,
.ct-avatar-crop__btn:focus-visible,
.ct-avatar-crop__zoom:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
}

.ct-avatar-crop__canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.ct-avatar-crop__ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 3px solid #fff;
    border-radius: 999px;
    box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.3) inset;
    pointer-events: none;
}

.ct-avatar-crop__zoom-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    font-weight: 700;
}

.ct-avatar-crop__zoom {
    flex: 1;
    min-width: 0;
    accent-color: var(--primary);
}

.ct-avatar-crop__actions {
    display: flex;
    gap: 0.55rem;
    margin-top: 0.85rem;
}

.ct-avatar-crop__btn {
    flex: 1;
    appearance: none;
    border: 0;
    border-radius: 0.75rem;
    min-height: 2.75rem;
    padding: 0.65rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
}

.ct-avatar-crop__btn--ghost {
    background: color-mix(in oklch, var(--muted-foreground, #888) 14%, transparent);
    color: inherit;
}

.ct-avatar-crop__btn--primary {
    background: var(--primary, #2f6fed);
    color: var(--primary-foreground, #fff);
}

.ct-avatar-crop__restore-notice {
    position: fixed;
    inset: auto 1rem max(1rem, env(safe-area-inset-bottom));
    z-index: 210;
    margin-inline: auto;
    max-width: 28rem;
    border-radius: 0.85rem;
    background: var(--surface, #fff);
    color: var(--foreground, #111);
    padding: 0.85rem 1rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.app-connectivity-banner {
    position: sticky;
    top: 0;
    z-index: 90;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 0.75rem;
    min-height: 2.75rem;
    padding: calc(0.55rem + env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) 0.55rem max(0.75rem, env(safe-area-inset-left));
    background: #3f2c22;
    color: #fff8ee;
    font-size: 0.82rem;
    font-weight: 650;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
}

.app-connectivity-banner__icon {
    color: #ffca70;
    font-size: 0.7rem;
}

.app-connectivity-banner__retry {
    min-height: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: inherit;
    padding: 0.25rem 0.75rem;
    font: inherit;
    cursor: pointer;
}

.app-connectivity-banner__retry:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .ct-avatar-crop,
    .ct-avatar-crop__panel {
        animation: none;
        transition: none;
    }
}

/* Settings and family-management panels: collapsible sections sharing one field style. */
.ss-grid {
    display: grid;
    gap: 0.6rem;
    align-items: start;
}

@media (min-width: 768px) {
    .ss-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* The more hub opens in place, so each section keeps the whole row instead of a squeezed half-column. */
    [data-testid="hub-more"].ss-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .ss-grid > .ss--wide,
    .ss-grid > .ss-status {
        grid-column: 1 / -1;
    }
}

.ss-status {
    position: sticky;
    top: 0.5rem;
    z-index: 5;
    margin: 0;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    background: var(--background);
    box-shadow: 0 6px 18px color-mix(in oklch, var(--foreground) 12%, transparent);
    font-size: 0.88rem;
    font-weight: 700;
}

.ss-status--error {
    border-color: color-mix(in oklch, var(--destructive) 50%, var(--border));
    color: var(--destructive);
}

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

.ss__summary {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 3.5rem;
    padding: 0.5rem 0.9rem;
    cursor: pointer;
    list-style: none;
}

.ss__summary::-webkit-details-marker {
    display: none;
}

.ss__summary:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    border-radius: 1rem;
}

.ss__text {
    display: grid;
    flex: 1;
    min-width: 0;
    gap: 0.1rem;
}

.ss__title {
    font-size: 0.98rem;
    font-weight: 800;
}

.ss__sub {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.78rem;
    color: var(--muted-foreground);
}

.ss__chev {
    display: grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    color: var(--muted-foreground);
    line-height: 1;
    transition: transform 160ms ease;
}

.ss__chev svg {
    display: block;
}

/* Closed points down, ready to open. Open points up, ready to close. */
.ss[open] > .ss__summary .ss__chev {
    transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
    .ss__chev { transition: none; }
}

.ss__body {
    display: grid;
    gap: 0.8rem;
    padding: 0.2rem 0.9rem 0.9rem;
}

.ss-form {
    display: grid;
    gap: 0.7rem;
}

@media (min-width: 768px) {
    .ss-form--two {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ss-form--two > .ss-field--wide,
    .ss-form--two > .ss-actions {
        grid-column: 1 / -1;
    }
}

.ss-field {
    display: grid;
    gap: 0.3rem;
    min-width: 0;
}

.ss-field > span {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted-foreground);
}

.ss-field input:not([type="checkbox"]),
.ss-field select {
    width: 100%;
    min-height: 2.75rem;
    padding: 0 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.7rem;
    background: var(--background);
    color: var(--foreground);
    font: inherit;
    font-size: 0.95rem;
}

.ss-field input:focus-visible,
.ss-field select:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.ss-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
}

.ss-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 2.75rem;
    font-size: 0.92rem;
}

.ss-switch input {
    width: 1.35rem;
    height: 1.35rem;
}

.ss-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ss-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0 1.1rem;
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    background: var(--background);
    color: var(--foreground);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

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

.ss-btn.is-on {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 14%, var(--background));
    box-shadow: inset 0 0 0 1px var(--primary);
}

.ss-btn--small {
    min-height: 2.5rem;
    padding: 0 0.8rem;
    font-size: 0.82rem;
}

.ss-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ss-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.ss-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.ss-hint {
    margin: 0;
    font-size: 0.78rem;
    color: var(--muted-foreground);
}

.ss-list {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ss-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    font-size: 0.9rem;
}

.ss-row--stack {
    display: grid;
    justify-content: stretch;
}

.ss-member {
    display: grid;
    gap: 0.4rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.8rem;
}

.ss-member__head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.ss-member__avatar {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    background: color-mix(in oklch, var(--primary) 18%, var(--background));
    font-weight: 800;
    object-fit: cover;
}

.ss-member__text {
    display: grid;
    flex: 1;
    min-width: 0;
}

.ss-member__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 800;
}

.ss-member__meta {
    font-size: 0.78rem;
    color: var(--muted-foreground);
}

.ss-member__manage > summary {
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
    padding: 0 0.2rem;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

.ss-member__manage[open] > summary {
    margin-bottom: 0.4rem;
}

/* Count badge on the reviews link. */
.bottom-nav__link {
    position: relative;
}

.nav-badge {
    position: absolute;
    top: 0.1rem;
    inset-inline-end: 0.85rem;
    display: inline-grid;
    place-items: center;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--destructive, #b42318);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
}

.nav-badge--inline {
    position: static;
    margin-inline-start: auto;
}

/* ---- Loading, empty and error states (LoadingState / EmptyState / ErrorState) ----------------------------------------
   One calm, centred block for a region of a page, so every screen says the same thing the same way. */
.state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    margin-block: 0.5rem;
    border: 1px dashed var(--border);
    border-radius: 1rem;
    background: color-mix(in oklch, var(--surface) 70%, transparent);
    padding: 1.5rem 1rem;
    text-align: center;
}

.state__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--foreground);
}

.state__message {
    margin: 0;
    max-width: 28rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--muted-foreground);
}

.state__icon {
    display: inline-grid;
    place-items: center;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 999px;
    background: color-mix(in oklch, var(--primary) 14%, transparent);
    color: var(--primary);
}

.state__spinner {
    width: 1.75rem;
    height: 1.75rem;
    border: 3px solid color-mix(in oklch, var(--primary) 20%, transparent);
    border-top-color: var(--primary);
    border-radius: 999px;
    animation: busy-overlay-spin 700ms linear infinite;
}

.state--loading .state__title {
    font-weight: 600;
    color: var(--muted-foreground);
}

.state__skeleton {
    display: flex;
    width: min(100%, 22rem);
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.state__skeleton-line {
    height: 0.8rem;
    border-radius: 999px;
    background: linear-gradient(90deg,
        color-mix(in oklch, var(--muted-foreground) 14%, transparent) 25%,
        color-mix(in oklch, var(--muted-foreground) 26%, transparent) 50%,
        color-mix(in oklch, var(--muted-foreground) 14%, transparent) 75%);
    background-size: 200% 100%;
    animation: state-shimmer 1.4s ease-in-out infinite;
}

@keyframes state-shimmer {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

.state--error {
    border-style: solid;
    border-color: color-mix(in oklch, var(--destructive, #b42318) 35%, var(--border));
}

.state__action {
    min-height: 2.75rem;
    border: 0;
    border-radius: 0.85rem;
    background: var(--primary);
    padding: 0.5rem 1.25rem;
    color: var(--primary-foreground);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.state__action:disabled {
    opacity: 0.6;
    cursor: default;
}

.state__action:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ---- Reduced motion, as a first-class preference ------------------------------------------------------------------------
   <html data-reduce-motion="true"> is set by js/preferences.js when the family chose calm mode OR the operating system
   asks for it. Everything that moves collapses to an instant change; a loading spinner keeps a static ring so it still
   reads as "busy". */
html[data-reduce-motion="true"] *,
html[data-reduce-motion="true"] *::before,
html[data-reduce-motion="true"] *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
}

html[data-reduce-motion="true"] .state__spinner,
html[data-reduce-motion="true"] .busy-overlay__spinner {
    animation: none !important;
    border-top-color: var(--primary);
    border-right-color: var(--primary);
}

html[data-reduce-motion="true"] .state__skeleton-line {
    animation: none !important;
    background: color-mix(in oklch, var(--muted-foreground) 18%, transparent);
}

html[data-reduce-motion="true"] .ct-party,
html[data-reduce-motion="true"] .ct-petals {
    display: none !important;
}

/* Roses and paper falling for a game's winner; see ctCelebrate.petals. */
.ct-petals {
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    overflow: hidden;
}

.ct-petals__piece {
    position: absolute;
    top: -40px;
    left: var(--x);
    font-size: var(--size);
    line-height: 1;
    animation: ct-petal-fall var(--dur) ease-in var(--delay) both;
    will-change: transform, opacity;
}

@keyframes ct-petal-fall {
    0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    100% { transform: translate3d(var(--sway), 110vh, 0) rotate(var(--spin)); opacity: .85; }
}

@media (prefers-reduced-motion: reduce) {
    .ct-petals { display: none !important; }
}

/* Photo-evidence gallery for chores: tile grid, add tile and lightbox dialog. Reuses state-shimmer and tokens from app.css. */
.evidence-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; margin: 0; padding: 0; list-style: none; }
@media (min-width: 360px) { .evidence-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .evidence-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.evidence-tile,
.evidence-add { position: relative; aspect-ratio: 1 / 1; border-radius: 0.85rem; }

.evidence-tile__open {
    position: absolute; inset: 0; display: block; overflow: hidden;
    border: 0; border-radius: inherit; padding: 0; background: var(--surface); cursor: pointer;
}
.evidence-tile__img {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
    opacity: 0; transition: opacity 180ms ease;
}
.evidence-tile__fail {
    position: absolute; inset: 0; display: none; place-items: center; padding: 0.5rem;
    text-align: center; font-size: 0.75rem; font-weight: 600; line-height: 1.4; color: var(--muted-foreground);
}
.evidence-tile__remove {
    position: absolute; z-index: 2; inset-block-start: 0.3rem; inset-inline-end: 0.3rem;
    display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
    border: 0; border-radius: 999px; background: rgb(0 0 0 / 0.6); color: #fff;
    font: inherit; font-size: 1rem; line-height: 1; cursor: pointer;
}
.evidence-tile__badge {
    position: absolute; z-index: 1; inset-inline: 0; inset-block-end: 0; display: none;
    padding: 0.35rem 0.5rem; border-radius: 0 0 0.85rem 0.85rem; background: rgb(0 0 0 / 0.6);
    color: #fff; font-size: 0.75rem; font-weight: 700; text-align: center; pointer-events: none;
}

.evidence-tile__preview {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.6;
}
.evidence-tile.is-loaded .evidence-tile__img { opacity: 1; }
.evidence-tile.is-loaded .evidence-tile__skeleton,
.evidence-tile.is-failed .evidence-tile__skeleton { display: none; }
.evidence-tile.is-failed .evidence-tile__img { display: none; }
.evidence-tile.is-failed .evidence-tile__open {
    background: color-mix(in oklch, var(--muted-foreground) 10%, var(--surface));
    box-shadow: inset 0 0 0 1px var(--border);
}
.evidence-tile.is-failed .evidence-tile__fail { display: grid; }
.evidence-tile.is-uploading .evidence-tile__open { cursor: progress; }
.evidence-tile.is-uploading .evidence-tile__img { opacity: 0.45; }
.evidence-tile.is-uploading .evidence-tile__badge { display: block; }

.evidence-add__btn {
    position: absolute; inset: 0; display: grid; place-items: center; box-sizing: border-box;
    min-height: 2.75rem; padding: 0.5rem; border: 2px dashed var(--border); border-radius: inherit;
    color: var(--muted-foreground); font-size: 0.875rem; font-weight: 700; text-align: center; cursor: pointer;
}
.evidence-add__btn:hover { border-color: var(--primary); color: var(--primary); }
.evidence-add__input {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap; opacity: 0;
}

.evidence-tile__open:focus-visible,
.evidence-tile__remove:focus-visible,
.evidence-add__btn:focus-within,
.evidence-lightbox__close:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.evidence-tile__skeleton,
.evidence-lightbox__skeleton {
    position: absolute; inset: 0; display: block;
    background: linear-gradient(90deg,
        color-mix(in oklch, var(--muted-foreground) 14%, transparent) 25%,
        color-mix(in oklch, var(--muted-foreground) 26%, transparent) 50%,
        color-mix(in oklch, var(--muted-foreground) 14%, transparent) 75%);
    background-size: 200% 100%;
    animation: state-shimmer 1.4s ease-in-out infinite;
}

.evidence-lightbox {
    box-sizing: border-box; width: min(92vw, 56rem); max-width: min(92vw, 56rem); margin: auto; padding: 0;
    border: 1px solid var(--border); border-radius: 1rem; background: var(--surface); color: var(--foreground);
}
.evidence-lightbox::backdrop { background: rgb(0 0 0 / 0.75); }
.evidence-lightbox__stage {
    position: relative; display: grid; place-items: center; min-height: 40vh;
    padding-block: 3rem 0.75rem; padding-inline: 0.75rem; touch-action: pan-y;
}
.evidence-lightbox__skeleton { inset: 0.75rem; border-radius: 0.85rem; }
.evidence-lightbox__stage:has(.evidence-lightbox__img.is-loaded) .evidence-lightbox__skeleton { display: none; }
.evidence-lightbox__img {
    position: relative; display: block; width: 100%; height: auto; max-height: 80vh;
    object-fit: contain; border-radius: 0.6rem; opacity: 0; transition: opacity 180ms ease;
}
.evidence-lightbox__img.is-loaded { opacity: 1; }
.evidence-lightbox__close,
.evidence-lightbox__nav {
    position: absolute; z-index: 2; display: grid; place-items: center;
    width: 2.75rem; height: 2.75rem; padding: 0; border: 0; border-radius: 999px;
    background: rgb(0 0 0 / 0.72); color: #fff; cursor: pointer;
    box-shadow: 0 0 0 1px rgb(255 255 255 / 0.45);
}
.evidence-lightbox__close { inset-block-start: 0.5rem; inset-inline-end: 0.5rem; }
.evidence-lightbox__nav { top: 50%; transform: translateY(-50%); }
.evidence-lightbox__nav--prev { inset-inline-start: 0.5rem; }
.evidence-lightbox__nav--next { inset-inline-end: 0.5rem; }
.evidence-lightbox__nav[hidden],
.evidence-lightbox__count[hidden] { display: none; }
.evidence-lightbox__count {
    position: absolute; z-index: 2; inset-block-end: 0.65rem; inset-inline: 0;
    width: fit-content; height: fit-content; margin-inline: auto; margin-block: 0;
    padding: 0.2rem 0.7rem; border-radius: 999px;
    background: rgb(0 0 0 / 0.72); color: #fff; font-size: 0.8rem; font-weight: 700;
    box-shadow: 0 0 0 1px rgb(255 255 255 / 0.28);
}

html[data-reduce-motion="true"] .evidence-tile__skeleton,
html[data-reduce-motion="true"] .evidence-lightbox__skeleton {
    animation: none !important;
    background: color-mix(in oklch, var(--muted-foreground) 18%, transparent);
}

/* The camera tile only makes sense where a camera is one tap away; on a desktop the gallery tile (file dialog) is enough. */
.evidence-add--camera { display: none; }
@media (pointer: coarse) { .evidence-add--camera:not([hidden]) { display: block; } }
.evidence-add[hidden] { display: none; }
.evidence-add__label-touch { display: none; }
@media (pointer: coarse) {
    .evidence-add__label-desktop { display: none; }
    .evidence-add__label-touch { display: inline; }
}

/* A single-column reading page (a list, a story) keeps a comfortable line length inside the page column. */
.page-reading,
.page-split {
    width: 100%;
    max-width: 48rem;
    margin-inline: auto;
}

/* Wide screens: the page keeps its reading column and gains a side column for the companion, so the screen is a world, not a stretched phone. */
.page-split__side {
    display: none;
}

@media (min-width: 1100px) {
    .page-split {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 17rem;
        gap: 2rem;
        max-width: 70rem;
        align-items: start;
    }

    .page-split__main {
        min-width: 0;
    }

    .page-split__side {
        display: block;
        position: sticky;
        top: 1.5rem;
    }
}

/* The child's world behind every page: a moon glow, a lantern glow and a few stars, so a wide screen is a place and not a blank sheet.
   Colours come from the theme tokens; it stays quiet enough to read on. */
.app-shell--child .app-shell__main {
    background:
        radial-gradient(circle at 14% 6%, color-mix(in oklch, var(--quest-gold, var(--primary)) 20%, transparent) 0, transparent 20rem),
        radial-gradient(circle at 90% 34%, color-mix(in oklch, var(--quest-lilac, var(--accent)) 38%, transparent) 0, transparent 26rem),
        radial-gradient(circle at 24% 88%, color-mix(in oklch, var(--quest-peach, var(--accent)) 30%, transparent) 0, transparent 22rem),
        radial-gradient(1.5px 1.5px at 18% 22%, color-mix(in oklch, var(--quest-gold, var(--primary)) 70%, transparent) 99%, transparent),
        radial-gradient(1.5px 1.5px at 72% 12%, color-mix(in oklch, var(--primary) 45%, transparent) 99%, transparent),
        radial-gradient(2px 2px at 84% 66%, color-mix(in oklch, var(--quest-gold, var(--primary)) 60%, transparent) 99%, transparent),
        radial-gradient(1.5px 1.5px at 8% 58%, color-mix(in oklch, var(--primary) 40%, transparent) 99%, transparent);
    background-attachment: fixed;
}

/* A mission or a reward lights up like a lantern when the pointer is on it. */
@media (hover: hover) {
    .adventure-task:hover,
    .reward-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 22px color-mix(in oklch, var(--quest-gold, var(--primary)) 35%, transparent);
    }
}

@media (prefers-reduced-motion: reduce) {
    .adventure-task:hover,
    .reward-card:hover {
        transform: none;
    }
}

.reward-empty-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 1.25rem;
    text-align: center;
    border-radius: 1.6rem;
    border: 1px dashed color-mix(in oklch, var(--primary) 35%, var(--border));
    background: linear-gradient(180deg, color-mix(in oklch, var(--quest-lilac, var(--accent)) 30%, var(--surface)), var(--surface));
}

.reward-empty-stage__art img {
    width: 6rem;
    height: 6rem;
}

.reward-empty-stage h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
}

.reward-empty-stage p {
    margin: 0;
    max-width: 28rem;
    color: var(--muted-foreground);
    line-height: 1.6;
}

/* A parent's page with a children list beside it is allowed more width on very wide screens, so a second column has room. */
@media (min-width: 1600px) {
    .app-shell--parent .app-shell__content:has(.master-detail) {
        max-width: 90rem;
    }
}

/* Child header: light and one line. The notes door is an icon (with its word on wide screens), the photo is a real 44px+
   button into "ملفي", and the brand reads on one line without the tagline. */
.app-account-nav__link--icon {
    gap: 0.35rem;
    min-width: 2.75rem;
    justify-content: center;
    color: var(--foreground);
}

.app-account-nav__link-label {
    display: none;
}

@media (min-width: 600px) {
    .app-account-nav__link-label {
        display: inline;
    }
}

.app-shell--child .app-account-nav__avatar,
.app-shell--child .app-account-nav__avatar-img {
    width: 3rem;
    height: 3rem;
    font-size: 1.05rem;
}

@media (max-width: 599px) {
    .app-shell--child .app-shell__brand-text {
        display: inline;
        white-space: nowrap;
        font-size: 1.05rem;
    }

    .app-shell--child .app-shell__brand-text small {
        display: none;
    }

    .app-shell--child .app-shell__brand {
        flex-direction: row;
        gap: 0.5rem;
    }

    /* Phone: a slim top bar, so the page itself starts high on the screen. */
    .adventure-preview.app-shell--child .adventure-header,
    .app-shell--parent .app-shell__header {
        padding-block: 0;
    }

    .app-shell--child .app-shell__header-inner,
    .app-shell--parent .app-shell__header-inner {
        min-height: 3rem;
        padding-block: 0.25rem;
    }

    .app-shell--child .app-account-nav__avatar,
    .app-shell--child .app-account-nav__avatar-img {
        width: 2.4rem;
        height: 2.4rem;
        font-size: 0.95rem;
    }

    .adventure-preview.app-shell--child .brand-mark {
        width: 2.1rem;
        height: 2.1rem;
    }

    .app-shell--child .app-shell__main .adventure-width {
        padding-top: 0.4rem;
    }
}

.self-settings {
    display: grid;
    gap: 0.9rem;
    padding: 1rem 1.1rem;
    border-radius: 1.4rem;
    border: 1px solid var(--border);
    background: var(--surface);
}

.self-settings__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.self-settings__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.self-settings__hint {
    margin: 0.15rem 0 0;
    font-size: 0.85rem;
    color: var(--muted-foreground);
}

.self-settings__btn {
    min-height: 2.75rem;
    padding-inline: 1.1rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: inherit;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.self-settings__btn--danger {
    border-color: color-mix(in oklch, var(--destructive, #c0392b) 60%, var(--border));
    color: var(--destructive, #c0392b);
}

.self-settings__confirm {
    display: grid;
    gap: 0.6rem;
    padding: 0.8rem 1rem;
    border-radius: 1rem;
    background: color-mix(in oklch, var(--muted-foreground) 8%, transparent);
}

.self-settings__confirm p {
    margin: 0;
    font-weight: 700;
}

.self-settings__confirm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

/* The install card is for browsers; inside the Android app it is already installed. */
html.capacitor-native .android-app-slot {
    display: none;
}

/* ---- Family chat: a phone chat, not a page with a card in it ------------------------------------------------
   Rows hold a bubble and (for others) the speaker's photo beside the last bubble of a run. In RTL the row's start is the right edge:
   my messages sit there, everyone else's on the left. */
.wa-chat__group-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    background: color-mix(in oklch, var(--primary) 18%, var(--surface));
    color: var(--primary);
}

.wa-row {
    display: flex;
    align-items: flex-end;
    gap: 0.4rem;
    margin-top: 0.1rem;
}

.wa-row--first {
    margin-top: 0.45rem;
}

.wa-row--mine {
    justify-content: flex-start;
}

.wa-row--other {
    justify-content: flex-end;
    /* The sender's picture stands at the top, beside the first message of their run. */
    align-items: flex-start;
}

.wa-row__avatar {
    flex: none;
    width: 3rem;
    height: 3rem;
    border-radius: 999px;
    object-fit: cover;
}

.wa-row__avatar--fallback {
    display: grid;
    place-items: center;
    background: color-mix(in oklch, var(--primary) 20%, var(--surface));
    font-size: 1rem;
    font-weight: 800;
}

.wa-row__avatar--spacer {
    background: none;
    /* Keeps the picture's width so bubbles line up, but no height, so short messages stay close together. */
    height: 0;
}

/* Tails only where a run starts, like a phone chat. */
.wa-row:not(.wa-row--first) .wa-bubble {
    border-radius: 0.85rem;
}

.wa-bubble__time {
    display: inline-block;
    margin-inline-start: 0.6rem;
    vertical-align: bottom;
    translate: 0 0.25rem;
    color: color-mix(in oklch, var(--muted-foreground) 80%, transparent);
    font-size: 0.65rem;
    font-weight: 600;
}

.wa-chat__day {
    display: flex;
    justify-content: center;
    position: sticky;
    top: 0;
    z-index: 1;
    margin: 0.6rem 0 0.35rem;
    pointer-events: none;
}

.wa-chat__day span {
    border-radius: 999px;
    padding: 0.2rem 0.8rem;
    background: color-mix(in oklch, var(--surface) 92%, transparent);
    color: var(--muted-foreground);
    font-size: 0.72rem;
    font-weight: 700;
    box-shadow: 0 1px 2px color-mix(in oklch, var(--foreground) 10%, transparent);
}

.wa-chat__send svg {
    /* the arrow points the way the text ends: left, in Arabic */
    transform: scaleX(-1);
}

.wa-chat__send {
    display: grid;
    place-items: center;
    flex: none;
    width: 2.75rem;
    padding: 0;
}

.wa-chat__input:focus-visible {
    outline: 2px solid color-mix(in oklch, var(--primary) 60%, transparent);
    outline-offset: 1px;
}

.wa-chat__input {
    font-size: 1rem;
}

/* A celebration is one flat unit in the thread: who and what, the cheer button, and the cheering faces in a row beneath. */
.wa-celebration {
    gap: 0.2rem;
    margin: 0.7rem 0 0.5rem;
}

.wa-celebration__card,
.wa-celebration__card:has(.wa-celebration__fans) {
    width: min(100%, 24rem);
    margin-bottom: 0;
    box-shadow: none;
}

.wa-celebration__fans {
    position: static;
    transform: none;
    justify-content: flex-start;
    margin-top: 0.5rem;
    pointer-events: auto;
}

.wa-celebration__time {
    margin-top: 0;
}

/* Compact: the chat IS the screen. The page stops scrolling; only the thread does, the composer stays put, and
   while the keyboard is up the tab bar steps aside (a phone chat has no tab bar under the keyboard). */
@media (max-width: 599px) {
    .app-shell:has(.chat-screen) {
        height: 100dvh;
        padding-bottom: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .app-shell:has(.chat-screen) .app-shell__grid {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .app-shell:has(.chat-screen) .app-shell__main {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        padding: 0 0 calc(var(--chat-tabbar-h, 4.1rem) + env(safe-area-inset-bottom, 0px));
        background: var(--wa-thread, var(--background));
    }

    .app-shell:has(.chat-screen) .app-shell__content,
    .app-shell:has(.chat-screen) .adventure-width {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: none;
        padding: 0;
        margin: 0;
    }

    /* The child bar's own height (BottomNav.razor.css: 0.5rem above and below 52px links, a 1.5px top border), so the
       composer meets it exactly; the safe-area inset is added where this is used. */
    .app-shell--child:has(.chat-screen) {
        --chat-tabbar-h: calc(1rem + 52px + 1.5px);
    }

    .chat-screen {
        flex: 1;
        min-height: 0;
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
        gap: 0;
    }

    .chat-screen .lounge-page__intro {
        display: none;
    }

    .chat-screen .wa-chat {
        flex: 1;
        height: auto;
        min-height: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .adventure-preview.child-quest .chat-screen .wa-chat {
        border: 0;
        box-shadow: none;
    }

    .chat-screen .wa-chat__header {
        padding: 0.45rem 0.9rem;
    }

    .chat-screen .wa-chat__composer {
        padding-block-end: 0.6rem;
    }

    .app-shell:has(.wa-chat__input:focus) :is(.bottom-nav, .adventure-bottom-nav) {
        display: none;
    }

    .app-shell:has(.wa-chat__input:focus) .app-shell__main {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}

/* Opening the chat shows that something is on its way: a spinner line and the outline of a few bubbles. */
.wa-chat__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem;
    color: var(--muted-foreground);
    font-size: 0.85rem;
    font-weight: 700;
}

.wa-chat__spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid color-mix(in oklch, var(--primary) 25%, transparent);
    border-top-color: var(--primary);
    border-radius: 50%;
    vertical-align: -0.15em;
    animation: wa-spin 0.8s linear infinite;
}

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

.wa-chat__skeleton {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 0.5rem;
}

.wa-chat__skeleton-bubble {
    height: 2.6rem;
    width: 55%;
    border-radius: 0.85rem;
    background: color-mix(in oklch, var(--foreground) 9%, transparent);
    animation: wa-pulse 1.4s ease-in-out infinite;
}

.wa-chat__skeleton-bubble--long {
    width: 72%;
    height: 3.6rem;
}

.wa-chat__skeleton-bubble--mine {
    align-self: flex-start;
}

.wa-chat__skeleton-bubble--other {
    align-self: flex-end;
}

@keyframes wa-pulse {
    50% {
        opacity: 0.45;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wa-chat__spinner,
    .wa-chat__skeleton-bubble {
        animation: none;
    }
}

/* A reward bought by a child waits on the parent's delivery list: the strip stays on the family home until it is handed over. */
.family-home__pending--rewards {
    border-color: #f0a020;
    background: color-mix(in srgb, #ffcf5a 24%, var(--background));
}
.family-home__pending--rewards .family-home__pending-count {
    background: #d9480f;
    color: #fff;
}

/* ---- The lounge on a tablet or a desktop: the chat is the whole pane, like WhatsApp Web ----
   No page title above it, no card inside the page, no side margins: the conversation header, the thread with its wallpaper
   and the composer fill the space beside the navigation rail, and only the thread scrolls. */
@media (min-width: 600px) {
    .app-shell:has(.chat-screen) {
        height: 100dvh;
        overflow: hidden;
        grid-template-rows: auto minmax(0, 1fr);
    }

    .app-shell:has(.chat-screen) .app-shell__header {
        background: var(--wa-header, var(--background));
        border-bottom: 0;
    }

    .app-shell:has(.chat-screen) .app-shell__header-inner {
        min-height: 2.5rem;
        padding-block: 0.15rem;
    }

    .app-shell:has(.chat-screen) .app-shell__main {
        display: flex;
        flex-direction: column;
        min-height: 0;
        padding: 0;
        overflow: hidden;
        background: none;
    }

    .app-shell:has(.chat-screen) .app-shell__content,
    .app-shell:has(.chat-screen) .adventure-width {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .app-shell .chat-screen {
        flex: 1;
        min-height: 0;
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
        gap: 0;
    }

    .chat-screen .lounge-page__intro {
        display: none;
    }

    .chat-screen .wa-chat,
    .adventure-preview.child-quest .chat-screen .wa-chat {
        flex: 1;
        height: auto;
        min-height: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .chat-screen .wa-chat__header {
        padding: 0.6rem clamp(1rem, 4%, 2.5rem);
        border-bottom: 1px solid color-mix(in oklch, var(--border) 60%, transparent);
    }

    .chat-screen .wa-chat__thread {
        padding: 1rem clamp(1rem, 7%, 7rem) 1.25rem;
        gap: 0.2rem;
    }

    .chat-screen .wa-bubble {
        max-width: min(66%, 36rem);
        padding: 0.45rem 0.75rem 0.4rem;
    }

    .chat-screen .wa-bubble__body {
        font-size: 1rem;
    }

    .chat-screen .wa-celebration__card,
    .chat-screen .wa-celebration__card:has(.wa-celebration__fans) {
        width: min(100%, 28rem);
    }

    .chat-screen .wa-chat__composer {
        align-items: center;
        gap: 0.65rem;
        padding: 0.65rem clamp(1rem, 7%, 7rem) calc(0.65rem + env(safe-area-inset-bottom, 0px));
        border-top: 0;
    }

    .chat-screen .wa-chat__input {
        height: 3rem;
        padding-inline: 1.25rem;
        font-size: 1rem;
    }

    .chat-screen .wa-chat__send {
        width: 3rem;
        height: 3rem;
    }
}

/* One top bar: the page header takes the conversation header's colour, so the account row and the chat title read as a single bar. */
@media (min-width: 600px) {
    .app-shell:has(.chat-screen) {
        --wa-header: #f0f2f5;
    }

    :root[data-color-mode="dark"] .app-shell:has(.chat-screen),
    html.dark .app-shell:has(.chat-screen),
    .dark .app-shell:has(.chat-screen) {
        --wa-header: #1f2c34;
    }

    .app-shell:has(.chat-screen) .app-shell__header {
        background: var(--wa-header);
    }

    .chat-screen .wa-chat__header {
        border-top: 1px solid color-mix(in oklch, var(--border) 45%, transparent);
    }
}

@media (min-width: 600px) {
    .chat-screen .wa-chat__input {
        background: var(--wa-other, var(--surface));
    }
}

/* The unread count on the lounge icon of the child's bottom bar. */
.adventure-bottom-nav a {
    position: relative;
}

.adventure-bottom-nav .nav-badge {
    top: 0.3rem;
    inset-inline-start: calc(50% + 0.45rem);
    inset-inline-end: auto;
}

/* ---- The lounge on a phone: no conversation header ----
   The title, the icon and "live" took a strip of the screen on a phone; the page's own header stays, slim, and tablets and
   desktops keep the conversation header. A parent changes the lounge picture from More. */
@media (max-width: 599px) {
    .chat-screen .wa-chat__header {
        display: none;
    }

    .app-shell:has(.chat-screen) .app-shell__header-inner {
        min-height: 2.75rem;
        padding-block: 0.1rem;
    }
}

/* ---- The lounge's picture: on the conversation header and on the lounge icon in the navigation ---- */
.wa-chat__group-photo,
.nav-glyph-photo {
    display: block;
    border-radius: 999px;
    object-fit: cover;
}

.wa-chat__group-photo {
    width: 100%;
    height: 100%;
}

.nav-glyph-photo {
    box-shadow: 0 0 0 1.5px color-mix(in oklch, currentColor 30%, transparent);
}

.wa-chat__group-icon--button {
    padding: 0;
    border: 0;
    overflow: hidden;
    cursor: pointer;
}

.wa-chat__group-icon--button:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent);
    outline-offset: 2px;
}

.wa-chat__group-icon {
    overflow: hidden;
}

/* ---- Emoji in the message box and in the bubbles ---- */
.wa-chat__emoji {
    flex: none;
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.wa-chat__emoji.is-on {
    background: color-mix(in oklch, var(--primary) 18%, transparent);
}

.wa-chat__emoji:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent);
    outline-offset: 1px;
}

.wa-bubble--emoji .wa-bubble__body {
    font-size: 2.4rem;
    line-height: 1.25;
}

.wa-bubble--emoji .wa-bubble__time {
    font-size: 0.65rem;
}

/* ---- Voice messages: the microphone, the recording bar and the voice bubble ---- */
.wa-chat__send--idle {
    display: none;
}

.wa-chat__composer.is-recording {
    display: none;
}

.wa-chat__recorder {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 0.75rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid color-mix(in oklch, var(--border) 70%, transparent);
    background: var(--wa-header);
}

.wa-chat__recorder-cancel {
    flex: none;
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
}

.wa-chat__recorder-live {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 2.75rem;
    padding-inline: 1rem;
    border-radius: 999px;
    background: var(--wa-other, var(--surface));
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.wa-chat__recorder-dot {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 999px;
    background: #e03131;
    animation: wa-record-pulse 1.1s ease-in-out infinite;
}

.wa-chat__recorder-hint {
    color: var(--muted-foreground);
    font-size: 0.8rem;
    font-weight: 600;
}

@keyframes wa-record-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.8); }
}

html[data-reduce-motion="true"] .wa-chat__recorder-dot {
    animation: none;
}

.wa-chat__recorder-cancel:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent);
    outline-offset: 1px;
}

/* A voice message stays compact: a short track, a smaller play button, and the time on the same line. */
.wa-bubble--voice {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    column-gap: 0.3rem;
    inline-size: min(9.5rem, 48vw);
    min-width: 0;
    padding: 0.25rem 0.45rem 0.2rem;
}

.wa-bubble--voice .wa-bubble__author {
    grid-column: 1 / -1;
}

.wa-voice {
    --voice-progress: 0%;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
    padding-block: 0;
}

.wa-voice__play {
    flex: none;
    display: grid;
    place-items: center;
    width: 1.9rem;
    height: 1.9rem;
    border: 0;
    border-radius: 999px;
    background: var(--primary);
    color: var(--primary-foreground, #fff);
    cursor: pointer;
}

.wa-voice__play:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent);
    outline-offset: 2px;
}

.wa-voice__icon--pause,
.wa-voice.is-playing .wa-voice__icon--play {
    display: none;
}

.wa-voice.is-playing .wa-voice__icon--pause {
    display: block;
}

.wa-voice__track {
    position: relative;
    flex: 1;
    height: 0.35rem;
    border-radius: 999px;
    background: color-mix(in oklch, currentColor 22%, transparent);
}

.wa-voice__fill {
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: var(--voice-progress);
    border-radius: inherit;
    background: var(--primary);
}

.wa-voice__length {
    flex: none;
    font-size: 0.8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.wa-voice.is-failed .wa-voice__play {
    background: var(--muted-foreground);
}

.wa-voice__sent {
    display: block;
    margin: 0;
    translate: 0 0.1rem;
    text-align: end;
}

.wa-voice__icon {
    width: 0.95rem;
    height: 0.95rem;
}

.wa-bubble--voice .wa-voice__length {
    font-size: 0.7rem;
}

.wa-bubble--voice .wa-voice__track {
    height: 0.25rem;
}
/* Unified Toast & Notification System
   Strict Light/Dark theme support, CSS Logical Properties, and Mobile iPhone Capsule vs Desktop Elevated Glass
*/

.app-toast-container {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    transition: all 0.25s ease;
}

/* Mobile & Small screens (< 640px): iPhone Dynamic Island & Floating Capsule at top center */
@media (max-width: 639.98px) {
    .app-toast-container {
        inset-inline: 1rem;
        inset-block-start: calc(0.75rem + env(safe-area-inset-top, 0px));
        align-items: center;
    }

    .app-toast-item {
        pointer-events: auto;
        display: flex;
        align-items: center;
        gap: 0.65rem;
        width: min(24rem, 100%);
        padding: 0.55rem 0.85rem;
        border-radius: 999px; /* Pill Capsule */
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        box-shadow: 0 10px 30px -4px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.12);
        animation: toast-slide-in-mobile 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    /* Light mode mobile capsule: deep dark glass for maximum contrast like iOS Island */
    :root:not(.dark) .app-toast-item {
        background: rgba(22, 24, 29, 0.92);
        color: #ffffff;
        border: 1px solid rgba(255, 255, 255, 0.18);
    }

    /* Dark mode mobile capsule */
    .dark .app-toast-item {
        background: rgba(15, 17, 21, 0.94);
        color: #f8fafc;
        border: 1px solid rgba(255, 255, 255, 0.14);
    }

    .app-toast-item__content {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
    }

    .app-toast-item__title {
        font-size: 0.875rem;
        font-weight: 700;
        line-height: 1.25;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .app-toast-item__desc {
        font-size: 0.75rem;
        opacity: 0.85;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Tablet & Desktop (>= 640px): Floating Elevated Glass Card at top-start */
@media (min-width: 640px) {
    .app-toast-container {
        inset-block-start: 1.25rem;
        inset-inline-end: 1.5rem;
        width: 24rem;
        max-width: calc(100vw - 3rem);
        align-items: stretch;
    }

    .app-toast-item {
        pointer-events: auto;
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: start;
        gap: 0.75rem;
        padding: 0.9rem 1rem;
        border-radius: 1rem;
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        box-shadow: 0 14px 34px -6px rgba(0, 0, 0, 0.18), 0 4px 12px -2px rgba(0, 0, 0, 0.08);
        border: 1px solid var(--border);
        border-inline-start-width: 4px; /* Distinct status border on start edge */
        animation: toast-slide-in-desktop 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    /* Light mode desktop card */
    :root:not(.dark) .app-toast-item {
        background: color-mix(in srgb, var(--surface, #ffffff) 92%, transparent);
        color: var(--foreground, #1c1917);
    }

    /* Dark mode desktop card */
    .dark .app-toast-item {
        background: color-mix(in srgb, var(--surface, #1e1e24) 88%, transparent);
        color: var(--foreground, #f3f4f6);
    }

    .app-toast-item__content {
        display: flex;
        flex-direction: column;
        gap: 0.2rem;
    }

    .app-toast-item__title {
        font-size: 0.925rem;
        font-weight: 800;
        line-height: 1.3;
    }

    .app-toast-item__desc {
        font-size: 0.8rem;
        color: var(--muted-foreground);
        line-height: 1.4;
    }
}

/* Indicator & Levels (Colors and glowing indicators) */
.app-toast-item__indicator {
    flex: none;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
}

/* Success Level */
.app-toast-item--success {
    border-inline-start-color: #10b981 !important;
}
.app-toast-item--success .app-toast-item__indicator {
    background: color-mix(in srgb, #10b981 22%, transparent);
    color: #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

/* Error Level */
.app-toast-item--error {
    border-inline-start-color: var(--destructive, #ef4444) !important;
}
.app-toast-item--error .app-toast-item__indicator {
    background: color-mix(in srgb, var(--destructive, #ef4444) 22%, transparent);
    color: var(--destructive, #ef4444);
    box-shadow: 0 0 12px color-mix(in srgb, var(--destructive, #ef4444) 40%, transparent);
}

/* Warning Level */
.app-toast-item--warning {
    border-inline-start-color: #f59e0b !important;
}
.app-toast-item--warning .app-toast-item__indicator {
    background: color-mix(in srgb, #f59e0b 22%, transparent);
    color: #f59e0b;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

/* Info Level */
.app-toast-item--info {
    border-inline-start-color: var(--primary, #3b82f6) !important;
}
.app-toast-item--info .app-toast-item__indicator {
    background: color-mix(in srgb, var(--primary, #3b82f6) 22%, transparent);
    color: var(--primary, #3b82f6);
    box-shadow: 0 0 12px color-mix(in srgb, var(--primary, #3b82f6) 40%, transparent);
}

/* Close button */
.app-toast-item__close {
    flex: none;
    appearance: none;
    border: none;
    background: transparent;
    padding: 0.3rem;
    margin: -0.2rem -0.2rem -0.2rem 0;
    border-radius: 999px;
    color: currentColor;
    opacity: 0.6;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.app-toast-item__close:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Keyframe animations */
@keyframes toast-slide-in-mobile {
    0% {
        opacity: 0;
        transform: translateY(-1.2rem) scale(0.94);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toast-slide-in-desktop {
    0% {
        opacity: 0;
        transform: translateY(-0.8rem) scale(0.96);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ---- Child Age-Band Presentation & Task Listening (Phase 1.01) --------------------------------------------------
   Three child presentation bands:
     - simplified (ages 3-5): large icons/illustrations, generous touch targets, minimal copy, prominent listen button
     - adventure  (ages 6-10 / standard): playful adventure cards with accessible listen helper
     - mature     (ages 11-16): restrained, respectful tone, hides baby mascots, crisp typography */

.adventure-task-entry {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.adventure-task-entry--simplified {
    gap: 0.55rem;
}

.task-listen-wrap {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.task-listen-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 2.75rem;
    padding-block: 0.45rem;
    padding-inline: 0.95rem;
    border-radius: 999px;
    border: 1.5px solid color-mix(in oklch, var(--primary) 35%, var(--border));
    background: color-mix(in oklch, var(--primary) 12%, var(--surface));
    color: var(--foreground);
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.2;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.dark .task-listen-btn {
    border-color: color-mix(in oklch, var(--primary) 48%, var(--border));
    background: color-mix(in oklch, var(--primary) 20%, var(--surface));
    color: var(--foreground);
}

.task-listen-btn:hover {
    background: color-mix(in oklch, var(--primary) 20%, var(--surface));
}

.dark .task-listen-btn:hover {
    background: color-mix(in oklch, var(--primary) 28%, var(--surface));
}

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

.task-listen-btn--compact {
    min-height: 2.25rem;
    padding-block: 0.3rem;
    padding-inline: 0.75rem;
    font-size: 0.82rem;
}

.task-listen-feedback {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted-foreground);
    padding-inline: 0.35rem;
}

/* Simplified band (ages 3-5): bigger illustrations, bolder titles, cleaner layout */
html[data-age-band="simplified"] .adventure-task,
.adventure-task--simplified {
    padding-block: 1rem;
    padding-inline: 1rem;
    border-radius: 1.35rem;
}

html[data-age-band="simplified"] .adventure-task .task-picture,
.adventure-task--simplified .task-picture {
    width: 3.5rem;
    height: 3.5rem;
}

html[data-age-band="simplified"] .adventure-task .task-copy strong,
.adventure-task--simplified .task-copy strong {
    font-size: 1.15rem;
    line-height: 1.35;
}

html[data-age-band="simplified"] .task-details__title {
    font-size: clamp(1.35rem, 4vw, 1.75rem);
}

/* Mature band (ages 11-16): hide baby mascots, calmer surfaces and restrained radius */
html[data-age-band="mature"] [data-testid="companion-mascot"],
html[data-age-band="mature"] .hero-companion-name {
    display: none !important;
}

html[data-age-band="mature"] .adventure-task,
.adventure-task--mature {
    border-radius: 0.9rem;
}

/* ---- Shared Typography Settings Control (Phase 1.01 Step 3) ----------------------------------------------------- */
.self-settings__block {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding-block: 0.9rem;
    padding-inline: 1rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: var(--surface);
}

.typography-settings {
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
}

.typography-settings__group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.typography-settings__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.typography-settings__label {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--foreground);
}

.typography-settings__fonts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
    gap: 0.55rem;
}

.typography-font-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    min-height: 3.4rem;
    padding-block: 0.65rem;
    padding-inline: 0.85rem;
    border-radius: 0.85rem;
    border: 1.5px solid var(--border);
    background: var(--background);
    color: var(--foreground);
    text-align: start;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.typography-font-option:hover:not(:disabled) {
    border-color: color-mix(in oklch, var(--primary) 45%, var(--border));
}

.typography-font-option.is-on {
    border-color: var(--primary);
    background: color-mix(in oklch, var(--primary) 12%, var(--surface));
}

.dark .typography-font-option.is-on {
    border-color: var(--primary);
    background: color-mix(in oklch, var(--primary) 22%, var(--surface));
}

.typography-font-option__name {
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.3;
}

.typography-font-option__sample {
    font-size: 0.78rem;
    color: var(--muted-foreground);
    line-height: 1.35;
}

.typography-preview {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-block: 0.75rem;
    padding-inline: 0.95rem;
    border-radius: 0.85rem;
    border: 1px dashed color-mix(in oklch, var(--primary) 35%, var(--border));
    background: color-mix(in oklch, var(--primary) 6%, var(--surface));
}

.dark .typography-preview {
    background: color-mix(in oklch, var(--primary) 12%, var(--surface));
}

.typography-preview__eyebrow {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--muted-foreground);
}

.typography-preview__text {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.55;
    color: var(--foreground);
}


/* The texts settings page (from «المزيد»): how texts appear, then the bank; side by side once there is room. */
.texts-page {
    display: grid;
    gap: 1.25rem;
    align-items: start;
}

@media (min-width: 1024px) {
    .texts-page {
        grid-template-columns: minmax(18rem, 24rem) minmax(0, 1fr);
    }

    .texts-page > :first-child {
        position: sticky;
        top: 0;
    }
}


/* ---- Study Session Atmosphere Countdown Timer ------------------------------------------------------------------- */
.study-timer {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding-block: 0.25rem;
    padding-inline: 0.65rem;
    border: 1px solid color-mix(in oklch, var(--primary) 30%, var(--border));
    border-radius: 999px;
    background: color-mix(in oklch, var(--primary) 10%, var(--surface));
    color: var(--foreground);
    font-size: 0.84rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.dark .study-timer {
    border-color: color-mix(in oklch, var(--primary) 42%, var(--border));
    background: color-mix(in oklch, var(--primary) 18%, var(--surface));
    color: var(--foreground);
}

.study-timer.is-low {
    border-color: color-mix(in oklch, #f59e0b 45%, var(--border));
    background: color-mix(in oklch, #f59e0b 14%, var(--surface));
    color: #b45309;
}

.dark .study-timer.is-low {
    border-color: color-mix(in oklch, #f59e0b 55%, var(--border));
    background: color-mix(in oklch, #f59e0b 22%, var(--surface));
    color: #fbbf24;
}

.study-timer.is-done {
    border-color: var(--border);
    background: var(--surface);
    color: var(--muted-foreground);
}
