.progress-page,
.about-page,
.leaderboard-page {
    max-width: 720px;
    margin: 0 auto;
    padding: var(--space-4) var(--space-4) var(--space-6);
}

.parent-screen {
    min-height: 100svh;
    background: var(--color-parent-bg);
    color: var(--color-parent-ink);
}

html:has(.parent-screen),
body:has(.parent-screen) {
    background: var(--color-parent-bg);
}

.parent-header,
.progress-header,
.about-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    margin-bottom: var(--space-4);
}

.parent-header h1,
.progress-header h1,
.about-header h1 {
    order: -1;
    flex: 1 0 100%;
    margin: 0;
    font-size: clamp(1.5rem, 5vw, 1.85rem);
    color: var(--color-parent-ink);
}

.parent-text-link {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-parent-accent);
    text-decoration: none;
}

.parent-text-link:hover {
    text-decoration: underline;
}

.parent-lede,
.progress-privacy {
    font-size: 0.95rem;
    color: var(--color-parent-muted);
    background: var(--color-parent-surface);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    margin: 0 0 var(--space-4);
}

.parent-empty,
.progress-empty {
    text-align: center;
    color: var(--color-parent-muted);
    padding: var(--space-6) var(--space-4);
    font-size: 1.05rem;
}

.progress-profile-block {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid #eee;
}

.progress-profile-block:last-child {
    border-bottom: none;
}

.progress-profile-block h2 {
    margin: 0 0 14px;
    font-size: 1.25rem;
    color: #1b6ec2;
}

.progress-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.progress-stat {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.progress-stat--rhythm {
    background: #fff8e8;
    border-color: #f0d78c;
}

.progress-stat-label {
    font-size: 0.8rem;
    color: #666;
}

.progress-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e50;
}

.progress-table-wrap {
    overflow-x: auto;
}

.progress-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.progress-table th,
.progress-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.progress-table th {
    font-weight: 600;
    color: #555;
    background: #fafafa;
}

.about-section {
    margin-bottom: 24px;
}

.about-section h2 {
    font-size: 1.15rem;
    margin: 0 0 8px;
    color: #2c3e50;
}

.about-section p {
    margin: 0 0 10px;
    line-height: 1.5;
    color: #444;
}

.error-friendly {
    max-width: 420px;
    margin: 40px auto;
    padding: 24px;
    text-align: center;
}

.error-friendly h1 {
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.error-friendly p {
    color: #666;
    margin-bottom: 20px;
}

.error-friendly .btn {
    margin: 4px;
}

.home-header-links {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.parent-link {
    font-size: 0.8rem;
    color: #888;
    text-decoration: none;
}

.parent-link:hover {
    color: #1b6ec2;
    text-decoration: underline;
}

.progress-reset {
    margin: 0 0 1.25rem;
    padding: 0.75rem 0;
    border-top: 1px solid #e8e8e8;
    border-bottom: 1px solid #e8e8e8;
}

.progress-reset-warn {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    color: #6c3a3a;
}

.progress-reset-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.progress-reset-done {
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
    color: #2d6a4f;
}

.practice-hero {
    background: linear-gradient(135deg, #1b6ec2 0%, #155fa8 100%);
    color: #fff;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 14px;
    box-shadow: 0 6px 20px rgba(27, 110, 194, 0.25);
}

.practice-hero-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.9;
    margin-bottom: 6px;
}

.practice-hero-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 6px;
}

.practice-hero-meta {
    font-size: 0.95rem;
    opacity: 0.95;
    margin-bottom: 10px;
}

.practice-hero-hint {
    font-size: 0.95rem;
    margin: 0 0 16px;
    opacity: 0.95;
}

.practice-hero .btn-play-now {
    background: #fff;
    color: #1b6ec2;
    border: none;
    font-weight: 700;
    padding: 10px 24px;
}

.practice-hero .btn-play-now:hover {
    background: #f0f7ff;
}

.practice-hero-choose {
    display: inline-block;
    margin-top: 12px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: underline;
}

.practice-rhythm-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #fff8e8;
    border: 2px solid #f0d78c;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 20px;
    text-align: left;
}

.practice-rhythm-card-body {
    flex: 1;
    min-width: 0;
}

.practice-rhythm-card-title {
    font-weight: 700;
    color: #8a6d1a;
    margin: 0 0 4px;
}

.practice-rhythm-card-desc {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
}

.home-container--challenge {
    min-height: calc(100dvh - 24px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px 16px 32px;
}

.home-header--minimal {
    width: 100%;
    max-width: 420px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 0;
}

.home-header--minimal h1 {
    text-align: center;
    font-size: clamp(1.5rem, 6vw, 1.9rem);
    color: #2f6fed;
}

.challenge-hero {
    width: 100%;
    max-width: 420px;
    text-align: center;
    background: linear-gradient(145deg, #2f6fed 0%, #1b5fd0 100%);
    color: #fff;
    border-radius: 24px;
    padding: 28px 22px 24px;
    box-shadow: 0 12px 28px rgba(47, 111, 237, 0.28);
}

.challenge-hero-kicker {
    margin: 0 0 6px;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.9;
    font-weight: 700;
}

.challenge-hero-title {
    margin: 0 0 10px;
    font-size: clamp(1.75rem, 7vw, 2.25rem);
    font-weight: 800;
}

.challenge-hero-hint {
    margin: 0 0 22px;
    font-size: 1rem;
    opacity: 0.95;
    line-height: 1.4;
}

.challenge-hero .btn-play-now {
    background: #fff;
    color: #1b5fd0;
    border: none;
    font-weight: 800;
    font-size: 1.25rem;
    padding: 14px 36px;
    min-width: 180px;
    border-radius: 999px;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12);
}

.challenge-hero .btn-play-now:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
}

.home-mascot {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #ffe08a;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.home-mascot img {
    width: 85%;
    height: 85%;
    object-fit: contain;
}

.challenge-end-streak {
    margin: 8px 0 16px;
    text-align: center;
}

.challenge-end-label {
    font-size: 0.95rem;
    color: #666;
}

.challenge-end-value {
    font-size: 3rem;
    font-weight: 800;
    color: #2f6fed;
    line-height: 1.1;
}

.home-choose-heading {
    scroll-margin-top: 12px;
}

/* —— Sprint 1 home screen —— */
.page main .content:has(.home-screen) {
    padding: 0 !important;
    max-width: none;
    width: 100%;
}

html:has(.home-screen),
body:has(.home-screen) {
    margin: 0;
    height: 100%;
    max-height: 100svh;
    overflow: hidden;
    background: #2f6fed;
}

#app:has(.home-screen),
.page:has(.home-screen),
.page main:has(.home-screen) {
    height: 100%;
    max-height: 100svh;
    width: 100%;
    max-width: none;
    overflow: hidden;
}

.page main .content:has(.home-screen) {
    padding: 0 !important;
    max-width: none;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.home-screen {
    position: relative;
    width: 100%;
    height: 100dvh;
    height: 100svh;
    max-height: 100dvh;
    max-height: 100svh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    justify-content: safe center;
    gap: var(--space-3);
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    box-sizing: border-box;
    background:
        radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.35), transparent 40%),
        radial-gradient(circle at 85% 20%, rgba(255, 210, 74, 0.25), transparent 35%),
        linear-gradient(165deg, #5b9bff 0%, #2f6fed 45%, #1b5fd0 100%);
}

.home-screen__header {
    position: relative;
    /* Higher than __mascot/__hero (both z-index:1) so the profile-switch
       modal nested inside this header — a position:fixed descendant —
       isn't painted under the later, equal-z-index hero card. Stacking
       nests by DOM ancestry, so the modal's own high z-index only wins
       comparisons within this header; the header itself must outrank
       its siblings for the modal to render above them. */
    z-index: 2;
    width: min(100%, 520px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.home-screen__header h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(1.6rem, 6vw, 2rem);
    font-weight: 800;
    text-shadow: 0 3px 0 rgba(0, 0, 0, 0.12);
    text-align: center;
}

.home-screen__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.home-screen__parent {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--color-play-blue);
    text-decoration: none;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-pill);
    background: var(--color-neutral-0);
}

.home-screen__parent:hover {
    color: var(--color-play-blue-deep);
    background: var(--color-neutral-0);
}

.home-screen .profile-selector,
.home-screen .current-profile-display {
    color: var(--color-ink);
    background: var(--color-neutral-0);
}

.home-screen .profile-selector .profile-label,
.home-screen .profile-selector .profile-name {
    color: var(--color-ink);
}

.home-screen .profile-selector .profile-name {
    color: var(--color-play-blue);
}

.home-screen .profile-change {
    color: var(--color-play-blue);
    background: var(--color-neutral-0);
    border-color: var(--color-play-blue);
}

.home-screen__mascot {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.home-screen__mascot .hp-mascot {
    width: clamp(96px, 18svh, 160px) !important;
    height: clamp(96px, 18svh, 160px) !important;
}

.home-screen__mascot .hp-mascot img {
    /* Soft contact shadow only — avoid large blur that reads as a square plate */
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
}

.home-screen__hero {
    position: relative;
    z-index: 1;
    width: min(100%, 520px);
    text-align: center;
    background: rgba(255, 255, 255, 0.96);
    color: #1b3a6b;
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-5) var(--space-4);
    box-shadow: 0 16px 40px rgba(15, 50, 120, 0.28);
}

.home-screen__kicker {
    margin: 0 0 6px;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--color-play-blue, #2f6fed);
}

.home-screen__title {
    margin: 0 0 12px;
    font-size: clamp(1.9rem, 7vw, 2.4rem);
    font-weight: 800;
    color: #163a7a;
}

.home-screen__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: var(--space-3);
    min-height: 0;
}

.home-screen__stat {
    font-size: 0.95rem;
    background: #eef4ff;
    color: #2f6fed;
    border-radius: 999px;
    padding: 6px 12px;
    font-weight: 600;
}

.home-screen__stat strong {
    font-weight: 800;
}

.game-idle-screen {
    position: relative;
    overflow: visible;
}

.start-screen--celebrate,
.game-idle-screen .start-screen.start-screen--celebrate {
    position: relative;
    overflow: visible;
    background: linear-gradient(180deg, rgba(255, 248, 220, 0.98), rgba(255, 255, 255, 0.97));
    border-radius: var(--radius-lg);
}

.celebrate-burst {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: inherit;
    pointer-events: none;
    z-index: 0;
}

.start-screen--celebrate > :not(.celebrate-burst) {
    position: relative;
    z-index: 1;
}

.celebrate-title {
    font-size: clamp(2rem, 8vw, 2.8rem) !important;
    font-weight: 700;
    color: var(--color-play-ink);
    line-height: 1.05;
}

.game-container--playing .practice-screen {
    background:
        radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.65), transparent 55%),
        linear-gradient(180deg, #e8f6f4 0%, #d5eef8 100%);
}

.practice-buddy {
    /* positioned in game.css — no bubble chrome */
}

.practice-stave-wrap {
    position: relative;
}

.keyboard-naturals .white-key {
    /* sizing handled in game.css practice dock */
}



/* Home: one-tap sprint under the main Play/Continue button */
.home-screen__sprint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    margin-top: var(--space-3);
}

.home-screen__sprint-note {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-muted);
}

/* ───────── Bottom navigation (web app) ───────── */
:root {
    --bottom-nav-h: calc(64px + env(safe-area-inset-bottom, 0px));
}

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 0;
    width: min(100%, 560px);
    transform: translateX(-50%);
    border-radius: 18px 18px 0 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: var(--bottom-nav-h);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid rgba(27, 58, 107, 0.12);
    box-shadow: 0 -6px 20px rgba(15, 50, 120, 0.12);
}

.bottom-nav__item,
.bottom-nav__item:hover,
.bottom-nav__item:focus {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: #6b7a99;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav__icon {
    width: 26px;
    height: 26px;
}

.bottom-nav__label {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.02em;
}

.bottom-nav__item.active {
    color: var(--color-play-blue, #2f6fed);
}

.bottom-nav__item.active .bottom-nav__icon {
    transform: translateY(-1px) scale(1.08);
}

/* Screens that sit above the bar leave room for it */
.page:has(.bottom-nav) .home-screen {
    height: calc(100svh - var(--bottom-nav-h));
    max-height: calc(100svh - var(--bottom-nav-h));
    padding-bottom: 16px;
}

.page:has(.bottom-nav) .nc-stages-screen,
.page:has(.bottom-nav) .parent-screen,
.page:has(.bottom-nav) .sprint-screen {
    padding-bottom: calc(var(--bottom-nav-h) + var(--space-4));
}

/* Home: tidy header row (player, mute, parents icon) */
.home-screen__meta {
    flex-wrap: nowrap;
}

.home-screen__parent {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    flex-shrink: 0;
    border-radius: 50%;
}

/* Home: progress trail */
.home-screen__trail,
.home-screen__trail:hover {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin: 4px 0 14px;
    color: inherit;
    text-decoration: none;
}

/* Home: "Stage 2 of 16" progress bar with the monkey riding along it */
.level-progress {
    width: min(100%, 320px);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.level-progress__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 0 2px;
    font-family: var(--font-display);
    font-weight: 800;
    color: #163a7a;
}

.level-progress__level {
    font-size: 1.15rem;
}

.level-progress__stars {
    font-size: 1.05rem;
    color: #8a5a00;
}

.level-progress__track {
    position: relative;
    height: 16px;
    margin: 4px 0 8px;
    border-radius: 999px;
    background: #dbe6fb;
    box-shadow: inset 0 2px 3px rgba(22, 58, 122, 0.15);
}

.level-progress__fill {
    width: var(--p, 0%);
    height: 100%;
    min-width: 16px;
    border-radius: inherit;
    background: linear-gradient(90deg, #5b9bff, #2f6fed);
    transition: width 600ms var(--ease-soft, ease);
}

.level-progress__monkey {
    position: absolute;
    top: 50%;
    left: clamp(0px, calc(var(--p, 0%) - 18px), calc(100% - 36px));
    width: 36px;
    height: 36px;
    transform: translateY(-58%);
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 2px 2px rgba(22, 58, 122, 0.3));
}

/* Smaller phones: shrink the monkey so the card still fits above the bar */
@media (max-height: 760px) {
    .home-screen__mascot .hp-mascot { width: 120px !important; height: 120px !important; }
}

/* ───────── Sprint page ───────── */
.sprint-screen {
    position: relative;
    min-height: 100dvh;
    min-height: 100svh;
    padding: var(--space-4);
    box-sizing: border-box;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.7), transparent 36%),
        linear-gradient(180deg, #fff1d6 0%, #fff9ee 40%, #ffffff 100%);
}

.sprint-content {
    position: relative;
    z-index: 1;
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.sprint-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
}

.sprint-header h1 {
    margin: 0;
    font-size: clamp(1.8rem, 7vw, 2.3rem);
    color: var(--color-ink);
}

.sprint-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-5) var(--space-4);
    text-align: center;
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: 0 14px 36px rgba(180, 110, 20, 0.2);
}

.sprint-card__title {
    margin: 0;
    font-size: 1.7rem;
    color: var(--color-ink);
}

.sprint-card__text {
    margin: 0 0 var(--space-2);
    font-size: 1rem;
    font-weight: 600;
    color: #144f8f;
}

.sprint-card__best {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin-bottom: var(--space-3);
    padding: var(--space-2) var(--space-5);
    border-radius: var(--radius-md);
    background: #fff4d6;
}

.sprint-card__best-label {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #8a5a00;
}

.sprint-card__best-value {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.05;
    color: #5c3b00;
}

.sprint-card__best-plays {
    font-size: 0.8rem;
    font-weight: 600;
    color: #8a5a00;
}

.sprint-card__notes {
    margin: var(--space-1) 0 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-muted);
}

.sprint-more {
    margin: 0;
    text-align: center;
    font-size: 0.9rem;
    color: var(--color-muted);
}

/* Sprint page fills the screen like the stage list: no wrapper padding or page-background strip */
.page main .content:has(.sprint-screen) {
    padding: 0 !important;
    max-width: none;
    width: 100%;
}

html:has(.sprint-screen),
body:has(.sprint-screen) {
    background: #fff9ee;
}

.sprint-card__best-value--empty {
    font-size: 1.5rem;
    line-height: 1.6;
    color: #8a5a00;
}

/* ───────── Parents area: tab row (Progress · Scores · About) ───────── */
.parent-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    width: 100%;
}

.parent-nav__home,
.parent-nav__home:hover {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-parent-accent);
    text-decoration: none;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-pill);
    background: var(--color-neutral-0, #fff);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
}

.parent-tabs {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    border-radius: var(--radius-pill);
    background: rgba(0, 0, 0, 0.06);
}

.parent-tab,
.parent-tab:hover,
.parent-tab:focus {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.95rem;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-pill);
    color: var(--color-parent-muted);
    text-decoration: none;
}

.parent-tab.is-active,
.parent-tab.is-active:hover {
    color: var(--color-on-play, #fff);
    background: var(--color-parent-accent);
}

/* ───────── Landscape: the tab bar becomes a rail down the left side, home goes side by side ─────────
   Wide and short screens (phones and tablets on their side) lose far more height to a bottom bar than width
   to a side one. The game round itself never shows the bar, so it is untouched. */
@media (orientation: landscape) and (min-width: 600px) and (max-height: 820px) {
    :root {
        --bottom-nav-h: 0px;
        --side-nav-w: calc(84px + env(safe-area-inset-left, 0px));
    }

    .bottom-nav {
        left: 0;
        top: 0;
        bottom: 0;
        width: var(--side-nav-w);
        height: auto;
        transform: none;
        display: flex;
        flex-direction: column;
        justify-content: safe center;
        overflow-y: auto;
        gap: 6px;
        padding: 8px 0 8px env(safe-area-inset-left, 0px);
        border-radius: 0 18px 18px 0;
        border-top: 0;
        border-right: 1px solid rgba(27, 58, 107, 0.12);
        box-shadow: 6px 0 20px rgba(15, 50, 120, 0.12);
    }

    .bottom-nav__item {
        flex: 0 0 auto;
        padding: 10px 0;
    }

    .bottom-nav__item.active {
        background: rgba(47, 111, 237, 0.1);
        border-radius: 14px;
        margin: 0 8px;
    }

    /* Five items on a very short screen: make them smaller so none is cut off */
    @media (max-height: 480px) {
        .bottom-nav { gap: 2px; padding-top: 4px; padding-bottom: 4px; }
        .bottom-nav__item { padding: 5px 0; }
        .bottom-nav__icon { width: 22px; height: 22px; }
        .bottom-nav__label { font-size: 0.62rem; }
    }

    /* Everything beside the rail starts to the right of it */
    .page:has(.bottom-nav) main {
        padding-left: var(--side-nav-w);
        box-sizing: border-box;
    }

    .page:has(.bottom-nav) .home-screen {
        height: 100svh;
        max-height: 100svh;
        padding: max(12px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 12px 20px;
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
        grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas:
            "header hero"
            "mascot hero";
        column-gap: 24px;
        row-gap: 4px;
        align-items: center;
        justify-items: center;
        align-content: safe center;
    }

    .page:has(.bottom-nav) .home-screen__header { grid-area: header; width: 100%; max-width: 440px; align-self: end; }
    .page:has(.bottom-nav) .home-screen__mascot { grid-area: mascot; align-self: start; }
    .page:has(.bottom-nav) .home-screen__hero { grid-area: hero; width: 100%; max-width: 460px; }

    .page:has(.bottom-nav) .home-screen__header h1 { font-size: clamp(1.3rem, 3.4vw, 1.9rem); }
    .page:has(.bottom-nav) .home-screen__mascot .hp-mascot {
        width: clamp(80px, 26svh, 150px) !important;
        height: clamp(80px, 26svh, 150px) !important;
    }

    /* The card is shorter in this shape, so tighten it a little */
    .page:has(.bottom-nav) .home-screen__hero { padding: var(--space-4) var(--space-4) var(--space-3); }
    .page:has(.bottom-nav) .home-screen__title { margin-bottom: 2px; }
    .page:has(.bottom-nav) .home-screen__trail { margin: 2px 0 10px; }
    .page:has(.bottom-nav) .home-screen__sprint { margin-top: var(--space-2); }

    /* Phones on their side are only ~360px tall: shrink the card so it fits without scrolling */
    @media (max-height: 440px) {
        .page:has(.bottom-nav) .home-screen__hero { padding: var(--space-3) var(--space-4) var(--space-2); }
        .page:has(.bottom-nav) .home-screen__kicker { display: none; }
        .page:has(.bottom-nav) .home-screen__title { font-size: 1.5rem; margin: 0 0 2px; }
        .page:has(.bottom-nav) .home-screen__continue-desc { display: none; }
        .page:has(.bottom-nav) .home-screen__trail { margin: 0 0 6px; }
        .page:has(.bottom-nav) .home-screen__sprint { margin-top: 6px; }
        .page:has(.bottom-nav) .home-screen__sprint-note { font-size: 0.75rem; }
    }

    /* Other pages: no bottom padding for a bar that is no longer at the bottom */
    .page:has(.bottom-nav) .nc-stages-screen,
    .page:has(.bottom-nav) .parent-screen,
    .page:has(.bottom-nav) .sprint-screen {
        padding-bottom: var(--space-4);
    }
}

/* iPhone status bar and Dynamic Island: the top of these pages must start below them (the home and game screens
   already do). Without it the clock sat on the "Home" button and the island over the page title. */
.page .nc-stages-screen,
.page .sprint-screen,
.page .parent-screen {
    padding-top: max(var(--space-4), env(safe-area-inset-top, 0px));
}
