/* Quiet backgrounds keep the learning cards and controls in the foreground. */
#dashboard-section { background-image: url('assets/classroom/stage-select.png') !important; }
/* Color alone distinguishes the four stages; the center stays quiet for reading. */
body[data-learning-stage="1"] { --learning-tint: #f8f5ff; --learning-corner: #e9def8; --learning-edge: #f0e8fc; }
body[data-learning-stage="2"] { --learning-tint: #f3f9ff; --learning-corner: #dceefa; --learning-edge: #e5f2fc; }
body[data-learning-stage="3"] { --learning-tint: #fff8f2; --learning-corner: #fae4d2; --learning-edge: #fceee1; }
body[data-learning-stage="4"] { --learning-tint: #f3faf6; --learning-corner: #dceee3; --learning-edge: #e5f4eb; }
body[data-learning-stage] .view-section:not(.hidden) {
    background-color: var(--learning-tint) !important;
    background-image:
        radial-gradient(ellipse at 100% 0%, var(--learning-corner) 0%, transparent 45%),
        radial-gradient(ellipse at 0% 100%, var(--learning-edge) 0%, transparent 50%),
        linear-gradient(135deg, #ffffff, var(--learning-tint)) !important;
    background-position: center !important;
    background-size: cover !important;
}
body[data-learning-stage] .view-section:not(.hidden) > .custom-scrollbar { padding-bottom: 120px !important; }
body[data-learning-stage] .stitched,
body[data-learning-stage] .activity-card { background-color: #fff !important; color: #203448; }
#drawing-activities-section .drawing-logo-button .login-mini-logo { width: 180px; }
body.rpg-hud-active #main-container { transform: none !important; animation: none !important; }
body.rpg-hud-active #main-container > .aiedue-rpg-hud {
    position: absolute !important; left: 18px !important;
    bottom: 18px !important;
    top: auto !important; right: auto !important; transform: none !important;
    width: min(600px, calc(100% - 36px)); max-width: calc(100% - 36px);
    flex-direction: row; align-items: center;
}
body.rpg-hud-active #main-container > .aiedue-rpg-hud.rpg-collapsed { width: 86px; }
body.rpg-hud-active #main-container .rpg-profile-banner { width: 100%; min-width: 0; }
body.dashboard-view-active #dashboard-section .dashboard-quick-actions {
    position: absolute !important; top: 24px !important; right: 24px !important;
    left: auto !important; bottom: auto !important;
    width: auto !important; max-width: calc(100% - 250px) !important;
    flex-direction: row !important; flex-wrap: wrap; justify-content: flex-end !important;
    align-items: flex-start !important;
}
body.rpg-hud-active .aiedue-rpg-hud .rpg-action-tray {
    position: absolute; top: auto; bottom: calc(100% + 8px); left: 0; right: auto;
    width: 0; max-width: calc(100vw - 36px); flex-shrink: 0; transform-origin: bottom left;
}
body.rpg-hud-active .aiedue-rpg-hud.actions-open .rpg-action-tray { width: min(540px, calc(100vw - 36px)); }
body.rpg-hud-active .aiedue-rpg-hud .rpg-action-button > span:last-child {
    overflow: visible; text-overflow: clip;
}
#login-section .login-tabs-container .nav-tab { color: #23462b; background: #f6fff1; }
#login-section .login-tabs-container .nav-tab.active {
    color: #fff !important; -webkit-text-fill-color: #fff;
    background: #286529 !important; border-color: #184e20 !important;
    text-shadow: none; opacity: 1;
}
#login-section .nav-tab:focus-visible, .classroom-dialog :focus-visible { outline: 3px solid #174e8c; outline-offset: 3px; }
.activity-loading-overlay { z-index: 15000; }
.activity-loading-card { width: min(430px, calc(100vw - 32px)); max-height: 90dvh; overflow: auto; padding: 24px; background: #fff; border: 2px solid #c7dfbd; border-radius: 32px; }
.aiedu-loading-scene { position: relative; width: min(250px, 55vw); margin: 0 auto 8px; }
.aiedu-loading-scene img { width: 100%; display: block; animation: aiedu-think 2.8s ease-in-out infinite; }
.aiedu-loading-scene[data-actor="painter"] img { animation: aiedu-paint 1.6s ease-in-out infinite; transform-origin: 50% 85%; }
.aiedu-loading-scene[data-actor="writer"] img { animation: aiedu-write 1.2s ease-in-out infinite; transform-origin: 50% 80%; }
.aiedu-loading-spark { position: absolute; right: 12%; top: 15%; width: 16px; height: 16px; border-radius: 50%; background: #f8d575; animation: aiedu-spark 2s ease-in-out infinite; }
[data-actor="writer"] .aiedu-loading-spark { left: 45%; top: 57%; width: 30px; height: 30px; background: #fff9c7; box-shadow: 0 0 18px #ffe07a; animation: aiedu-flash 4s ease-in-out infinite; }
[data-actor="reader"] .aiedu-loading-spark { top: 8%; right: 20%; background: #c5e8bd; box-shadow: 18px -15px 0 3px #e1f1da; }
.activity-loading-text { color: #203448; font-size: 20px; font-weight: 800; line-height: 1.5; }
.aiedu-loading-value { display: block; margin: 14px 0 7px; font-size: 28px; font-weight: 900; color: #286529; font-variant-numeric: tabular-nums; }
.aiedu-loading-progress { height: 18px; background: #e9eee6; border: 1px solid #9fb795; border-radius: 20px; overflow: hidden; }
.aiedu-loading-progress::before { content: ''; display: block; width: var(--progress, 0%); height: 100%; background: #397c35; border-radius: inherit; transition: width .65s; }
.aiedu-loading-hint { font-size: 13px; line-height: 1.5; color: #50614b; margin-top: 10px; }
@keyframes aiedu-paint { 0%,100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg) translateY(-4px); } }
@keyframes aiedu-write { 0%,100% { transform: rotate(-1deg); } 50% { transform: rotate(1deg) translateY(-2px); } }
@keyframes aiedu-think { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-6px) rotate(1deg); } }
@keyframes aiedu-spark { 0%,100% { opacity: .3; transform: scale(.7); } 50% { opacity: 1; transform: scale(1); } }
@keyframes aiedu-flash { 0%,70%,100% { opacity: 0; } 80% { opacity: .9; } }
.classroom-dialog { width: min(760px, calc(100vw - 24px)); max-height: 90dvh; padding: 0; border: 2px solid #b5d2ac; border-radius: 24px; background: #fff; color: #203448; box-shadow: 0 24px 80px #14281744; }
.classroom-dialog::backdrop { background: #172e3c99; backdrop-filter: blur(3px); }
.classroom-dialog-content { padding: 24px; }
.classroom-dialog h2 { font-size: 26px; font-weight: 900; margin: 0; }
.classroom-dialog p { line-height: 1.65; margin: 14px 0; }
.classroom-dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.classroom-dialog button, .classroom-dialog a { display: inline-block; padding: 10px 14px; border: 2px solid #c2d8ba; border-radius: 12px; background: #f4faef; font-weight: 800; min-height: 44px; color: #234e28; cursor: pointer; }
.classroom-dialog button:disabled { opacity: .55; cursor: default; }
.classroom-dialog .classroom-primary { background: #286529; color: white; border-color: #286529; }
.classroom-name-list { max-height: 49dvh; overflow: auto; padding: 4px; }
.classroom-name-row { display: grid; grid-template-columns: 65px 1fr auto; align-items: center; gap: 8px; margin-bottom: 14px; }
.classroom-name-row label { font-weight: 800; }
.classroom-name-row input { width: 100%; min-width: 0; border: 2px solid #99b68d; border-radius: 12px; padding: 12px; font-size: 20px; background: #fff; color: #203448; }
.classroom-name-row input:disabled { background: #f3f6f0; opacity: 1; }
.classroom-row-status { grid-column: 2 / -1; font-size: 14px; color: #286529; }
.classroom-row-status.failed { color: #a52525; }
.classroom-dialog-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 20px; }
.classroom-currency-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.classroom-currency-grid article { border: 1px solid #ccd8c6; border-radius: 16px; padding: 12px; text-align: center; }
.classroom-currency-grid img { width: 100%; height: 120px; object-fit: contain; }
.classroom-currency-grid h3 { font-size: 22px; font-weight: 900; margin: 10px 0; }
.classroom-currency-grid button { margin-top: 8px; }
@media(max-width: 600px) {
    .classroom-dialog-content { padding: 16px; }
    .classroom-currency-grid { grid-template-columns: 1fr; }
    body.rpg-hud-active #main-container > .aiedue-rpg-hud { left: 8px !important; bottom: 8px !important; width: calc(100% - 16px); max-width: calc(100% - 16px); }
    #dashboard-section > .absolute.top-0 { padding: 14px !important; }
    #dashboard-section .login-mini-logo { width: 110px !important; }
    body.dashboard-view-active #dashboard-section .dashboard-quick-actions {
        top: 14px !important; right: 14px !important;
        width: calc(100% - 148px) !important; max-width: 230px !important;
        flex-wrap: nowrap; gap: 5px;
    }
    #dashboard-section .dashboard-quick-actions .aiedue-library-button {
        flex: 1 1 0; min-width: 0; max-width: none; padding: 7px 4px;
        flex-direction: column; gap: 3px; min-height: 64px; border-radius: 16px;
    }
    #dashboard-section .dashboard-quick-actions .aiedue-library-button strong { font-size: 11px; white-space: nowrap; }
    #dashboard-section .dashboard-quick-actions .aiedue-library-button small { display: none; }
    #dashboard-section .dashboard-quick-actions .aiedue-library-button-icon { font-size: 1.3rem; }
}
@media(prefers-reduced-motion: reduce) {
    .aiedu-loading-scene img, .aiedu-loading-spark { animation: none !important; }
    .aiedu-loading-progress::before { transition: none; }
}

/* A seated reading companion stays outside the passage's scrollable text. */
#literacy-workspace-section .literacy-workspace-grid { margin-top: 94px; }
#literacy-workspace-section .literacy-passage-card { position: relative; overflow: visible; }
.literacy-passage-card > h3 { min-height: 42px; padding-right: 72px; flex-wrap: wrap; }
.literacy-reading-companion {
    position: absolute; width: 164px; height: 164px; right: 3px; top: -124px;
    z-index: 2; pointer-events: none; user-select: none; mix-blend-mode: multiply;
}
.literacy-companion-pose { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; visibility: hidden; transform-origin: 62% 76%; }
.literacy-reading-companion[data-state="reading"] .literacy-companion-reading,
.literacy-reading-companion[data-state="correct"] .literacy-companion-correct,
.literacy-reading-companion[data-state="correct"] .literacy-companion-correct-closed,
.literacy-reading-companion[data-state="incorrect"] .literacy-companion-incorrect { visibility: visible; }
.literacy-reading-companion[data-state="reading"] .literacy-companion-reading { animation: literacy-companion-inspect 3.8s ease-in-out infinite; }
.literacy-reading-companion[data-state="correct"] .literacy-companion-correct { animation: literacy-companion-clap .45s ease-in-out 6; }
.literacy-companion-correct-closed { opacity: 0; }
.literacy-reading-companion[data-state="correct"] .literacy-companion-correct-closed { animation: literacy-companion-clap .45s ease-in-out 6, literacy-companion-clap-frame .45s steps(1, end) 6; }
.literacy-reading-companion[data-state="incorrect"] .literacy-companion-incorrect { animation: literacy-companion-sigh 1.1s ease-out both; }
@keyframes literacy-companion-inspect { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-3deg) translate(-2px, 1px); } }
@keyframes literacy-companion-clap { 0%, 100% { transform: translateY(0) scaleX(1); } 45% { transform: translateY(-5px) scaleX(.96) rotate(-2deg); } 75% { transform: translateY(-2px) scaleX(1.02) rotate(1deg); } }
@keyframes literacy-companion-clap-frame { 0%, 100% { opacity: 0; } 45% { opacity: 1; } }
@keyframes literacy-companion-sigh { from { transform: translateY(-3px) rotate(-2deg); } to { transform: translateY(2px) rotate(2deg); } }
@media (max-width: 600px) {
    #literacy-workspace-section > .custom-scrollbar { padding-left: 18px; padding-right: 18px; }
    #literacy-workspace-section .literacy-workspace-grid { margin-top: 54px; }
    #literacy-workspace-section .literacy-passage-card { padding: 20px; }
    .literacy-passage-card > h3 { min-height: 36px; padding-right: 45px; font-size: 20px; }
    .literacy-reading-companion { width: 124px; height: 124px; top: -94px; right: 0; }
}
@media (prefers-reduced-motion: reduce) { .literacy-companion-pose { animation: none !important; } }

/* Reference stage cards: original transparent artwork, live text and responsive frames. */
#dashboard-section .dashboard-stage-board {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px; max-width: 1120px; padding: 110px 26px 150px;
    align-content: center; overflow-y: auto;
}
#dashboard-section .dashboard-stage-card {
    min-width: 0; max-width: none; width: 100%; height: auto; aspect-ratio: .74;
    padding: 20px 10px 26px; gap: 0; border: 4px solid color-mix(in srgb, var(--stage-color) 68%, white);
    border-radius: 38px; justify-content: flex-start;
    background: radial-gradient(circle at 9% 101%, var(--stage-soft) 0 13%, transparent 13.5%),
        radial-gradient(circle at 27% 105%, var(--stage-soft) 0 12%, transparent 12.5%),
        radial-gradient(circle at 93% 101%, var(--stage-soft) 0 13%, transparent 13.5%),
        radial-gradient(circle at 76% 105%, var(--stage-soft) 0 12%, transparent 12.5%),
        linear-gradient(145deg, #fff 45%, var(--stage-soft));
    box-shadow: inset 0 0 0 4px #ffffffd9, 0 5px 0 color-mix(in srgb, var(--stage-color) 55%, white), 0 14px 28px #263f571a;
    isolation: isolate;
    transition: transform .4s cubic-bezier(.16, 1, .3, 1), filter .35s ease, box-shadow .35s ease !important;
}
#dashboard-section .stage-badge {
    position: static; transform: none; min-width: 56%; padding: 8px 12px;
    font-size: clamp(.8rem, 1.5vw, 1.2rem); line-height: 1.2; margin-bottom: 8px;
}
#dashboard-section .stage-illustration {
    position: relative; display: block; flex: 1; min-height: 0; width: 100%; margin: 0;
    filter: drop-shadow(0 12px 10px color-mix(in srgb, var(--stage-color) 18%, transparent));
    transition: transform .45s cubic-bezier(.16, 1, .3, 1);
}
/* Fit each sprite cell by the available illustration height, without clipping the art. */
#dashboard-section .stage-illustration::after {
    content: ''; display: block; height: 100%; aspect-ratio: 1; margin: auto;
    background: url('assets/classroom/stage-icons.png') var(--art-position) center / 400% auto no-repeat;
}
#card-level-1 { --art-position: 0%; }
#card-level-2 { --art-position: 33.333333%; }
#card-level-3 { --art-position: 66.666667%; }
#card-level-4 { --art-position: 100%; }
#dashboard-section .dashboard-stage-card .level-title {
    font-size: clamp(1.5rem, 3.3vw, 2.7rem); line-height: 1.25; color: var(--stage-ink); margin: 6px 0;
}
#dashboard-section .dashboard-stage-card .level-desc {
    font-size: clamp(.85rem, 1.7vw, 1.35rem); color: #10344e; line-height: 1.4; opacity: 1; word-break: keep-all;
}
#dashboard-section .dashboard-stage-card :is(.level-title, .level-desc) { transition: transform .35s ease; }
#dashboard-section .dashboard-stage-card:not(.locked):is(:hover, :focus-visible) :is(.level-title, .level-desc) { transform: scale(1.035); }
/* Hover/focus is a temporary selection; moving away restores every card. */
#dashboard-section .dashboard-stage-board:has(.dashboard-stage-card:not(.locked):focus-visible) .dashboard-stage-card:not(.locked):not(:focus-visible):not(:hover) { filter: saturate(.38); }
@media (hover: hover) and (pointer: fine) {
    #dashboard-section .dashboard-stage-board:has(.dashboard-stage-card:not(.locked):hover) .dashboard-stage-card:not(.locked):not(:hover):not(:focus-visible) { filter: saturate(.38); }
}
#dashboard-section .dashboard-stage-card:focus-visible { outline: 4px solid var(--stage-ink); outline-offset: 5px; }
#dashboard-section .dashboard-stage-card:not(.locked):is(:hover, :focus-visible) {
    transform: translateY(-10px) scale(1.055); z-index: 2; border-color: color-mix(in srgb, var(--stage-color) 76%, white);
    box-shadow: inset 0 0 0 4px #fff, 0 7px 0 var(--stage-soft), 0 22px 35px color-mix(in srgb, var(--stage-color) 25%, transparent);
}
#dashboard-section .dashboard-stage-card:not(.locked):is(:hover, :focus-visible) .stage-illustration { transform: translateY(-5px) rotate(-7deg) scale(1.14); }
#dashboard-section .dashboard-stage-card:not(.locked)::before {
    content: '' !important; display: block !important; position: absolute; inset: -40%;
    background: linear-gradient(115deg, transparent 43%, #ffffffb3 49%, transparent 55%);
    transform: translateX(-80%); transition: transform .8s ease; pointer-events: none; z-index: 3;
}
#dashboard-section .dashboard-stage-card:not(.locked):is(:hover, :focus-visible)::before { transform: translateX(80%); }
#dashboard-section .dashboard-stage-card:not(.locked):active { transform: translateY(-2px) scale(.98); }
#dashboard-section .dashboard-stage-card.locked::after { top: auto; bottom: 6px; right: 50%; transform: translateX(50%); font-size: 10px; padding: 3px 8px; }

/* Keep the same library/game order and button shape in stages 3 and 4. */
:is(#dictation-activities-section, #literacy-activities-section) .stage-header-actions { align-items: stretch; }
.stage-header-library-button { color: #4e8172; border-color: #c5dfd3; background: linear-gradient(145deg, #ffffffed, #edf7f1ed); }
.stage-header-library-button small { color: #7b9f90; }
.stage-header-library-button:hover { background: #f1faf5; }

/* The circle owns experience; the freed row is used for readable wallet/menu controls. */
body.rpg-hud-active #main-container > .aiedue-rpg-hud { width: min(800px, calc(100% - 36px)); }
#aiedue-rpg-hud .rpg-profile-banner { height: 88px; padding: 6px 14px 6px 150px; gap: 16px; }
/* Draw the orb surround and panel as one silhouette, so overlaps have no seam. */
#aiedue-rpg-hud .rpg-profile-banner {
    --hud-crown-size: 138px; --hud-crown-rise: 52px;
    --hud-panel-top: calc(var(--hud-crown-rise) - 2px);
    isolation: isolate; border-color: transparent; background: transparent; box-shadow: none;
    backdrop-filter: none; -webkit-backdrop-filter: none;
}
#aiedue-rpg-hud .rpg-profile-banner::before {
    content: ''; position: absolute; inset: calc(0px - var(--hud-crown-rise)) -2px -2px;
    z-index: -1; pointer-events: none;
    background:
        radial-gradient(circle closest-side, #fff calc(100% - .5px), transparent) 6px 0 / var(--hud-crown-size) var(--hud-crown-size) no-repeat,
        linear-gradient(#fff, #fff) 24px var(--hud-panel-top) / calc(100% - 48px) calc(100% - var(--hud-panel-top)) no-repeat,
        linear-gradient(#fff, #fff) 0 calc(var(--hud-panel-top) + 24px) / 100% calc(100% - var(--hud-panel-top) - 48px) no-repeat,
        radial-gradient(circle at bottom right, #fff 23.5px, transparent 24px) 0 var(--hud-panel-top) / 24px 24px no-repeat,
        radial-gradient(circle at bottom left, #fff 23.5px, transparent 24px) 100% var(--hud-panel-top) / 24px 24px no-repeat,
        radial-gradient(circle at top right, #fff 23.5px, transparent 24px) 0 100% / 24px 24px no-repeat,
        radial-gradient(circle at top left, #fff 23.5px, transparent 24px) 100% 100% / 24px 24px no-repeat;
    filter: drop-shadow(0 -1px 0 #cde4c7) drop-shadow(1px 0 0 #cde4c7) drop-shadow(-1px 0 0 #cde4c7) drop-shadow(0 1px 0 #cde4c7) drop-shadow(0 14px 18px #325b452e);
    opacity: 1; transition: opacity .2s ease;
}
#aiedue-rpg-hud.rpg-collapsed .rpg-profile-banner::before { opacity: 0; }
#aiedue-rpg-hud .rpg-profile-portrait { left: 10px; top: auto; bottom: 4px; transform: none; width: 126px; height: 126px; background: #ffffff45; border: 2px solid #ffffffd9; overflow: visible; box-shadow: 0 4px 12px #789d412e, 0 0 0 1px #bfd995b3; }
.rpg-experience-circle { --experience: 0%; position: absolute; inset: 0; overflow: hidden; border-radius: 50%; background: linear-gradient(145deg, #ffffffb3, #f1f9d580 45%, #e2f3ba99); box-shadow: inset 0 1px 4px #fff, inset 0 -3px 8px #aacb754d; backdrop-filter: blur(6px); isolation: isolate; }
.rpg-circle-water { position: absolute; inset: auto 0 0; height: var(--experience); background: linear-gradient(135deg, #d1efabcc, #a7d96ec9 52%, #b5e885d9); box-shadow: inset 0 2px 0 #edfac6cc; }
.rpg-circle-water::before { content: ''; position: absolute; top: -5px; left: -30%; width: 160%; height: 12px; border-radius: 50%; background: linear-gradient(90deg, #d9efabd9, #b9dd84d9, #e1f4bccc); }
.rpg-experience-circle::after { content: ''; position: absolute; inset: 3px; border-radius: inherit; background: radial-gradient(ellipse at 24% 19%, #ffffffc9 0, #ffffff4d 14%, transparent 34%), linear-gradient(115deg, transparent 25%, #ffffff52 36%, transparent 48%); box-shadow: inset 1px 1px 2px #fff9, inset -1px -2px 3px #fff6; pointer-events: none; }
.rpg-circle-copy { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #4e7435; text-shadow: 0 1px 1px #ffffff80; font-weight: 700; z-index: 1; }
.rpg-circle-percent { font: 700 30px/1.2 Outfit, sans-serif; font-variant-numeric: tabular-nums; }
.rpg-circle-copy small { font: 600 11px/1.4 Outfit, sans-serif; letter-spacing: .12em; }
#aiedue-rpg-hud .rpg-level-badge { right: -7px; bottom: -3px; min-width: 52px; font-size: 14px; padding: 5px 8px; background: linear-gradient(135deg, #81ad50, #68933f); z-index: 2; }
.rpg-experience-gain { position: absolute; left: 50%; top: 0; white-space: nowrap; color: #567d35; background: #f5ffe1ed; border: 1px solid #bdd891; border-radius: 99px; padding: 6px 12px; font: 700 20px/1.2 Outfit, sans-serif; box-shadow: 0 5px 16px #247d4326; pointer-events: none; z-index: 4; }
.rpg-experience-gain[hidden] { display: none; }
#aiedue-rpg-hud.experience-received .rpg-profile-portrait { box-shadow: 0 0 0 4px #d4eb9d80, 0 0 20px #b3d97a80; }
#aiedue-rpg-hud.experience-level-up .rpg-experience-circle { box-shadow: inset 0 0 18px #fff, inset 0 0 0 4px #ffe885; }
#aiedue-rpg-hud .rpg-profile-copy { min-width: 150px; flex: 1; display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 0 8px; }
#aiedue-rpg-hud .rpg-profile-copy > strong { max-width: 180px; font-size: 15px; line-height: 1.25; }
#aiedue-rpg-hud .rpg-role-label { font-size: 11px; }
#aiedue-rpg-hud .rpg-wallet-line { grid-column: 1 / -1; flex-direction: column; gap: 1px; margin-top: 3px; font-size: 12px; width: 100%; }
.rpg-wallet-line > span { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; white-space: nowrap; }
.rpg-points { color: #875508; }
.rpg-warnings { color: #c52632; }
.rpg-wallet-line b { font-size: 18px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.rpg-wallet-line small { font-size: 11px; }
#aiedue-rpg-hud .rpg-profile-tools { margin-left: 0; transform: none; gap: 6px; }
#aiedue-rpg-hud .rpg-tool-button { min-width: 48px; width: 48px; height: 54px; font-size: 11px; gap: 2px; border-radius: 16px; }
#aiedue-rpg-hud .rpg-tool-button > span:first-child { font-size: 22px; }
#aiedue-rpg-hud .rpg-tool-button > span:last-child { display: block; }
#aiedue-rpg-hud :focus-visible { outline: 3px solid #176b35; outline-offset: 4px; }
/* Folding changes the panel only; the orb retains its size and bottom anchor. */
body.rpg-hud-active #main-container > #aiedue-rpg-hud.rpg-collapsed { width: 146px; }
#aiedue-rpg-hud.rpg-collapsed .rpg-profile-banner { width: 146px; min-width: 146px; height: 136px; padding: 0; border-color: transparent; background: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
#aiedue-rpg-hud.rpg-collapsed .rpg-profile-portrait { left: 10px; top: auto; bottom: 4px; transform: none; }
@media (max-width: 760px) {
    #aiedue-rpg-hud .rpg-profile-banner { --hud-crown-size: 123px; --hud-crown-rise: 51px; }
    #aiedue-rpg-hud .rpg-profile-banner { height: 124px; padding: 6px 12px 54px 133px; gap: 8px; }
    #aiedue-rpg-hud .rpg-profile-portrait { width: 111px; height: 111px; top: auto; bottom: 54px; left: 10px; }
    #aiedue-rpg-hud .rpg-profile-copy { min-width: 0; }
    #aiedue-rpg-hud .rpg-circle-percent { font-size: 27px; }
    #aiedue-rpg-hud .rpg-profile-copy > strong { font-size: 14px; }
    #aiedue-rpg-hud .rpg-role-label { display: none; }
    #aiedue-rpg-hud .rpg-profile-tools { position: absolute; bottom: 6px; left: 10px; right: 10px; justify-content: space-between; gap: 4px; }
    #aiedue-rpg-hud .rpg-tool-button { min-width: 40px; width: 46px; flex: 1; max-width: 60px; height: 44px; gap: 0; font-size: 10px; }
    #aiedue-rpg-hud .rpg-tool-button > span:first-child { font-size: 19px; }
    body.rpg-hud-active .aiedue-rpg-hud .rpg-action-tray {
        width: 0; max-width: calc(100vw - 16px); height: 0; display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 0;
    }
    body.rpg-hud-active .aiedue-rpg-hud.actions-open .rpg-action-tray {
        width: min(340px, calc(100vw - 16px)); height: auto; padding: 7px;
    }
    #aiedue-rpg-hud .rpg-action-button { width: 100%; min-width: 0; max-width: none; height: 50px; }
    #aiedue-rpg-hud .rpg-action-button > span:last-child { white-space: normal; line-height: 1.15; }
    body.rpg-hud-active #main-container > #aiedue-rpg-hud.rpg-collapsed { width: 131px; }
    #aiedue-rpg-hud.rpg-collapsed .rpg-profile-banner { width: 131px; min-width: 131px; height: 121px; }
    #dashboard-section .dashboard-stage-board { padding: 110px 18px 155px; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; }
    #dashboard-section .dashboard-stage-card { aspect-ratio: .9; border-radius: 26px; padding: 12px 7px 22px; border-width: 3px; }
    #dashboard-section .stage-badge { padding: 5px 10px; margin-bottom: 0; }
    #dashboard-section .dashboard-stage-card .level-title { font-size: 24px; margin: 0 0 2px; }
    #dashboard-section .dashboard-stage-card .level-desc { font-size: 14px; }
    body[data-learning-stage] .view-section:not(.hidden) > .custom-scrollbar { padding-bottom: 150px !important; }
}
@media (prefers-reduced-motion: reduce) {
    #aiedue-rpg-hud .rpg-profile-banner::before { transition: none; }
    #dashboard-section .dashboard-stage-card, #dashboard-section .stage-illustration,
    #dashboard-section .dashboard-stage-card::before,
    #dashboard-section .dashboard-stage-card :is(.level-title, .level-desc) { transition: none !important; transform: none !important; }
    #dashboard-section .dashboard-stage-card:not(.locked):is(:hover, :focus-visible),
    #dashboard-section .dashboard-stage-card:not(.locked):is(:hover, :focus-visible) .stage-illustration,
    #dashboard-section .dashboard-stage-card:not(.locked):is(:hover, :focus-visible) :is(.level-title, .level-desc) { transform: none !important; }
}
