/* Adapted from pace33/anti classroom-refresh.css: the Korean experience orb. */
/* The circle owns experience; the freed row is used for readable wallet/menu controls. */
body.rpg-hud-active #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; }
@media (min-width: 761px) {
    #aiedue-rpg-hud .rpg-profile-copy { grid-template-columns: 124px auto; }
    #aiedue-rpg-hud .rpg-wallet-line > span {
        display: grid; grid-template-columns: 124px auto; justify-content: start; gap: 8px;
    }
}
#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 #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 #aiedue-rpg-hud.rpg-collapsed { width: 131px; }
    #aiedue-rpg-hud.rpg-collapsed .rpg-profile-banner { width: 131px; min-width: 131px; height: 121px; }
}
/* Override math's older top-right 64px portrait on every learning screen. */
body.rpg-hud-active #aiedue-rpg-hud.math-rpg-hud {
  left: max(12px, env(safe-area-inset-left)) !important;
  right: auto !important; top: auto !important;
  bottom: max(12px, env(safe-area-inset-bottom)) !important;
  width: min(800px, calc(100vw - 24px)) !important;
  max-width: calc(100vw - 24px) !important;
  transform: none !important; align-items: flex-start !important;
}
body.rpg-hud-active #aiedue-rpg-hud.math-rpg-hud.rpg-collapsed { width: 146px !important; }
#aiedue-rpg-hud.math-rpg-hud .rpg-profile-banner { min-width: 0; width: 100%; }
#aiedue-rpg-hud.math-rpg-hud .rpg-profile-portrait {
  width: 126px !important; height: 126px !important;
  left: 10px !important; right: auto !important; top: auto !important; bottom: 4px !important;
  transform: none !important; border-radius: 50%;
}
#aiedue-rpg-hud.math-rpg-hud .rpg-level-badge { right: -7px !important; bottom: -3px !important; padding: 5px 8px !important; font-size: 14px !important; }
#aiedue-rpg-hud.math-rpg-hud .rpg-action-tray { left: 0 !important; right: auto !important; top: auto !important; bottom: calc(100% + 62px) !important; }
body.rpg-hud-active .math-hub-shell { padding-bottom: 190px; }
body.rpg-hud-active #math-learning-section .dashboard-stage-board { padding-bottom: 190px; }
@media (max-width: 760px) {
  #aiedue-rpg-hud.math-rpg-hud .rpg-profile-portrait { width: 111px !important; height: 111px !important; bottom: 54px !important; }
  body.rpg-hud-active #aiedue-rpg-hud.math-rpg-hud.rpg-collapsed { width: 131px !important; }
  #aiedue-rpg-hud.math-rpg-hud .rpg-profile-copy { display: flex; flex-direction: column; gap: 1px; align-items: stretch; }
  #aiedue-rpg-hud.math-rpg-hud .rpg-wallet-line { margin-top: 1px; }
  #aiedue-rpg-hud.math-rpg-hud .rpg-wallet-line b { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  #aiedue-rpg-hud .rpg-profile-banner::before { transition: none; }
}
