/* SWIPE STUFF */
/* Button states */
.btn-swipe-actions:hover,
.btn-swipe-actions:active,
.btn-swipe-actions:focus,
.btn-swipe-actions:target {
    background-color: #282828;
    border-color: #000000;
}

.btn-swipe-actions.active:hover,
.btn-swipe-actions.active:active,
.btn-swipe-actions.active:focus,
.btn-swipe-actions.active:target {
    background-color: #2A9D8F;
    border-color: #000000;
}

.swipeArea {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

    .swipeArea::-webkit-scrollbar {
        display: none;
    }

.swipe-content.swiped {
    transform: translateX(-75vw);
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
}

.swipe-content {
    width: 100%;
    transform: translateX(0);
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
}

.bg-episode-list-item {
    flex: 2 0 100%;
    max-width: calc(680px - 3rem);
}

.input-group {
    flex-wrap: nowrap;
}

.swipe-actions {
    position: absolute;
    right: 2em;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
}

.swipe-items {
    margin-left: 1.5rem;
}

.swipe-items-container {
    display: flex;
    align-items: center;
}


.study-texts-list {
    overflow-y: auto;
}

:root {
    --app-safe-area-top: env(safe-area-inset-top, 0px);
}

.mud-appbar.mud-appbar-fixed-top {
    padding-top: var(--app-safe-area-top);
}

.mud-layout {
    padding-top: var(--app-safe-area-top);
}

.mud-drawer.mud-drawer-fixed.mud-drawer-clipped-always {
    margin-top: var(--app-safe-area-top);
    bottom: 0;
    height: auto;
}

/* Web header: keep layout in global CSS so production is not dependent on RCL scoped CSS hashes */
.learning-portal-header__left,
.learning-portal-header__right {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    min-width: 0;
}

.learning-portal-header__left {
    /* Floor between menu and header back; JS gutter offset only adds margin-left. */
    column-gap: 0.75rem;
}

.learning-portal-header__right {
    gap: 0.25rem;
}

/* Margin is applied by contentBackVisibility.js so header back tracks the content/main gutter left edge. */
.learning-portal-header__back {
    flex-shrink: 0;
}

.learning-portal-header__play-pack,
.learning-portal-header__play-square {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.learning-portal-header__play-pack {
    max-width: 14rem;
    margin-left: 0.35rem;
}

.learning-portal-header__play-square {
    max-width: 18rem;
    opacity: 0.92;
}

.learning-portal-header__title {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    color: inherit;
    text-decoration: none;
    border-radius: 8px;
}

.learning-portal-header__title:hover,
.learning-portal-header__title:focus-visible {
    color: inherit;
    text-decoration: none;
    opacity: 0.9;
}

.ypq-header-mark {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
    background-color: #fff;
    border-radius: 8px;
}

.ypq-header-wordmark {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.2;
    color: inherit;
}

.ypq-mark {
    display: block;
    width: 48px;
    height: 48px;
    object-fit: contain;
    background-color: #fff;
    border-radius: 8px;
}

/* Login card: loads after MudBlazor so these beat default h1 sizing. */
.ypq-login-mark-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
}

h1.ypq-login-title {
    text-align: center;
    white-space: nowrap;
    font-size: 1.35rem;
    line-height: 1.3;
    font-weight: 700;
    margin: 0.35rem 0 0;
}

.ypq-login-actions {
    display: flex;
    justify-content: center;
}

.learning-portal-header__user-name {
    max-width: 16rem;
    margin-bottom: 0;
    min-width: auto;
    overflow: hidden;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    text-align: right;
    text-overflow: ellipsis;
    text-transform: none !important;
    white-space: nowrap;
}

.learning-portal-header__user-name .mud-button-label {
    text-transform: none !important;
}

@media (max-width: 960px) {
    .learning-portal-header__left {
        column-gap: 1.5rem;
    }
}

@media (max-width: 800px) {
    .ypq-header-wordmark {
        display: none;
    }
}

@media (max-width: 700px) {
    .learning-portal-header__user-name {
        max-width: 8rem;
    }

    .learning-portal-header__play-pack {
        max-width: 7rem;
    }

    .learning-portal-header__play-square {
        max-width: 9rem;
    }
}

/* Distinctive MudTable header row (used across Razor pages) */
.mud-table-distinct-header .mud-table-header-cell-distinct {
    font-weight: 700;
    background-color: var(--mud-palette-table-lines, #E8EDE9) !important;
    border-bottom: 2px solid var(--mud-palette-primary, #2A9D8F);
    color: var(--mud-palette-primary-darken, #218176);
}

/* Lesson set expansion well: sage-tinted contrast behind lesson cards */
.lesson-set-expansion .mud-expand-panel-content {
    background-color: var(--mud-palette-table-lines, #E8EDE9);
}

/* Lesson set expansion header (TitleContent area) */
.lesson-set-expansion .mud-expand-panel-header {
    background-color: var(--mud-palette-table-lines, #E8EDE9); /* or whatever color you want */
}

/* Nav menu drawer: keep utility links anchored while primary links scroll */
.nav-drawer-scroll {
    overflow: hidden;
    height: calc(100vh - 64px - var(--app-safe-area-top));
    min-height: 0;
}

.nav-menu-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.nav-menu-primary {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.nav-menu-footer {
    flex: 0 0 auto;
}

.app-version-footer {
    margin: 0;
    padding: 0.25rem 0.75rem 0.35rem;
    font-size: 0.75rem;
    line-height: 1.2;
    text-align: center;
    opacity: 0.8;
}

/* Fantasy occupant editor: square model preview fills right column */
.occupant-editor-preview-canvas {
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto !important;
}

.gltf-asset-preview-viewport {
    width: 100%;
    background: #e5e7eb;
    border-radius: 4px;
}

.gltf-asset-editor-grid {
    align-items: stretch;
}

.gltf-asset-editor-grid > .mud-grid-item {
    display: flex;
    flex-direction: column;
}

.gltf-asset-editor-preview-column {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 100%;
}

.gltf-asset-editor-preview-canvas {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 360px;
}

.gltf-asset-preview-viewport--fill {
    flex: 1 1 auto;
    min-height: 320px;
    height: auto !important;
}

.gltf-asset-tile-grid > .gltf-asset-tile-item.mud-grid-item {
    display: block;
}

.gltf-asset-tile {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    text-align: center;
    cursor: pointer;
}

.gltf-asset-tile-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #d1d5db;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
}

.gltf-asset-tile:hover .gltf-asset-tile-image,
.gltf-asset-tile:focus-visible .gltf-asset-tile-image {
    border-color: #1976d2;
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

.gltf-asset-tile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.course-avatar-allowance-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 180px;
    margin-top: 0.5rem;
    background: #d1d5db;
    border-radius: 8px;
    overflow: hidden;
}

.course-avatar-allowance-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.gltf-asset-tile-body {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.gltf-asset-tile-name {
    font-size: 1rem;
    font-weight: 500;
}

.gltf-asset-tile-key {
    color: var(--mud-palette-text-secondary, #64756C);
    font-size: 0.75rem;
}

.gltf-asset-tile-inactive {
    color: var(--mud-palette-warning, #f59e0b);
    font-size: 0.75rem;
}

.gltf-directory-import-layout {
    min-height: 480px;
}

.gltf-directory-file-list {
    max-height: 560px;
    overflow: auto;
    border: 1px solid #d1d5db;
    border-radius: 8px;
}

.gltf-directory-file-row {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    border-bottom: 1px solid #e5e7eb;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.gltf-directory-file-row:last-child {
    border-bottom: none;
}

.gltf-directory-file-row:hover,
.gltf-directory-file-row:focus-visible {
    background: #eef2ff;
    outline: none;
}

.gltf-directory-file-row--selected {
    background: #e3f2fd;
}

.gltf-directory-file-row--imported .gltf-directory-file-name {
    color: var(--mud-palette-success, #2e7d32);
}

.gltf-directory-file-name {
    font-weight: 500;
    overflow-wrap: anywhere;
}

.gltf-directory-file-meta {
    color: var(--mud-palette-text-secondary, #64756C);
    font-size: 0.75rem;
    overflow-wrap: anywhere;
}

.gltf-directory-file-imported {
    margin-left: 0.5rem;
    color: var(--mud-palette-success, #2e7d32);
    font-weight: 600;
}

/* Main content is full-width; pages that want a narrow column use their own .container. */
.app-main-container.mud-container {
    max-width: none !important;
    width: 100% !important;
}

/* Default layout back button: upper-left of main content (hidden when WebBackButton renders nothing). */
.app-main-back {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.app-main-back-button {
    margin-bottom: 0.5rem;
}

/* Immersive pages: pull into the main-content padding so left/right gutters disappear. */
.mud-main-content:has(.app-full-bleed-page) {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
}

.app-main-container:has(.app-full-bleed-page) {
    max-width: none !important;
    width: 100% !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
}

.app-full-bleed-page {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    margin: 0;
}

/* Shared fullscreen icon (studentFullscreen.js). Positioning is inline or host CSS. */
.student-fullscreen-toggle {
    box-sizing: border-box;
}

/* Hidden while the browser shows its own way out of full screen (browserFullscreenExit.mjs). The button stays in the
   page, so the HUDs that make room for it leave that corner to the browser's button. Beats the inline display. */
.student-fullscreen-toggle[hidden] {
    display: none !important;
}

.student-fullscreen-toggle svg {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}

.student-fullscreen-toggle:focus-visible {
    outline: 2px solid #f8fafc;
    outline-offset: 2px;
}

.ylp-ipad-fs-tip-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(env(safe-area-inset-top, 0px) + 1rem) calc(env(safe-area-inset-right, 0px) + 1rem) calc(env(safe-area-inset-bottom, 0px) + 1rem) calc(env(safe-area-inset-left, 0px) + 1rem);
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: auto;
    touch-action: manipulation;
}

.ylp-ipad-fs-tip-card {
    width: min(100%, 26rem);
    max-height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 1.25rem 1.35rem;
    border: 1px solid rgba(248, 250, 252, 0.24);
    border-radius: 16px;
    background: #0f172a;
    color: #f8fafc;
    box-shadow: 0 20px 50px rgba(2, 6, 23, 0.65);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

.ylp-ipad-fs-tip-title {
    margin: 0 0 0.55rem;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.25;
    color: #ffffff;
}

.ylp-ipad-fs-tip-lead {
    margin: 0 0 0.75rem;
    font-size: 0.94rem;
    line-height: 1.45;
    color: #e2e8f0;
}

.ylp-ipad-fs-tip-steps {
    margin: 0 0 0.85rem;
    padding-left: 1.35rem;
    font-size: 0.94rem;
    line-height: 1.5;
    color: #f8fafc;
}

.ylp-ipad-fs-tip-step + .ylp-ipad-fs-tip-step {
    margin-top: 0.35rem;
}

.ylp-ipad-fs-tip-note {
    margin: 0 0 1rem;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.14);
    font-size: 0.84rem;
    line-height: 1.4;
    color: #cbd5e1;
}

.ylp-ipad-fs-tip-actions {
    display: flex;
    justify-content: flex-end;
}

.ylp-ipad-fs-tip-close {
    min-width: 6.5rem;
    min-height: 2.75rem;
    padding: 0.5rem 1.15rem;
    border: 0;
    border-radius: 10px;
    background: #2a9d8f;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
}

.ylp-ipad-fs-tip-close:focus-visible {
    outline: 2px solid #f8fafc;
    outline-offset: 2px;
}

/* Mouse / Touch toggle on Classroom and Campus. Scoped so maze pages keep their own rule. */
.student-room-viewport .ylp-input-mode-toggle {
    position: absolute;
    top: 3.5rem;
    right: 6.4rem;
    left: auto;
    bottom: auto;
    z-index: 7;
    min-width: 3.4rem;
    min-height: 2.5rem;
    padding: 0.35rem 0.55rem;
    border: 1px solid rgba(248, 250, 252, 0.35);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.78);
    color: #f8fafc;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
    white-space: nowrap;
}

/* The Shop panel opens under this button's spot, so hide it while the Shop is open. */
.student-room-viewport:has(.student-room-catalog-overlay:not([hidden])) .ylp-input-mode-toggle {
    display: none !important;
    pointer-events: none !important;
}

/* Math practice dialog: keep keypad + used-answer history side by side on phones. */
@media (max-width: 600px) {
    .room-math-practice-dialog-content {
        padding-left: 0.6rem !important;
        padding-right: 0.6rem !important;
    }
}

[data-client-speak-state="loading"],
[data-client-speak-state="playing"] {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.42rem;
    transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

[data-client-speak-state="loading"] {
    cursor: progress;
    border-color: #38bdf8 !important;
    background-color: rgba(56, 189, 248, 0.22) !important;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35);
}

[data-client-speak-state="loading"]::before {
    content: "";
    width: 0.85em;
    height: 0.85em;
    flex: 0 0 auto;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    box-sizing: border-box;
    animation: ylp-client-speak-spin 650ms linear infinite;
}

[data-client-speak-state="playing"] {
    border-color: #facc15 !important;
    background-color: rgba(250, 204, 21, 0.22) !important;
    box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.35);
}

[data-client-speak-state="playing"]::before {
    content: "";
    width: 0.55em;
    height: 0.55em;
    flex: 0 0 auto;
    border-radius: 50%;
    background: currentColor;
    animation: ylp-client-speak-pulse 800ms ease-in-out infinite;
}

@keyframes ylp-client-speak-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes ylp-client-speak-pulse {
    0%, 100% {
        transform: scale(0.75);
        opacity: 0.55;
    }
    50% {
        transform: scale(1.15);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    [data-client-speak-state="loading"]::before,
    [data-client-speak-state="playing"]::before {
        animation: none;
    }
}
