/* Player levels. Colours are the game's own tokens from styles.css (--ink, --line, --lavender, --cream, --shadow). */
.xp-bar{display:grid;grid-template-columns:auto 1fr;gap:4px 10px;align-items:center;margin:10px 0 4px}
.xp-level{font:15px Georgia,serif;color:var(--ink);white-space:nowrap}
.xp-track{height:10px;border-radius:999px;background:#eee4f4;overflow:hidden;border:2px solid #a57cc5;box-shadow:inset 0 1px 2px #51346f33}
.xp-fill{height:100%;border-radius:999px;background:linear-gradient(90deg,#64429a 0%,#7e55b7 60%,#a77bd3 100%);box-shadow:inset 0 1px #ffffff80,inset -1px 0 #573581;transition:width .4s ease}
.xp-next{grid-column:1/-1;margin:0;font-size:13px;color:var(--muted)}
.xp-how{grid-column:1/-1;margin:0;font-size:12px;color:#80698a}

/* A tiny journey: current milestone, paw-step progress and the actual next doorway. */
.xp-chip{display:grid;grid-template-columns:52px minmax(54px,1fr) 58px;align-items:center;gap:8px;flex:0 1 330px;min-width:280px;height:64px;padding:5px 8px;border-radius:18px;background:var(--cream);border:1px solid #b795d6;box-shadow:0 3px 0 #b795d6,0 8px 18px #b4a0dc33;color:var(--ink);text-align:left;cursor:pointer;transition:transform .15s,box-shadow .15s}
.xp-chip:hover{transform:translateY(-1px)}
.xp-chip:active{transform:translateY(2px);box-shadow:0 1px 0 #b795d6}
.xp-chip-badge{display:grid;place-items:center;align-self:center;width:48px;height:48px;min-width:0;border:2px solid #071d32;border-radius:50%;background:#fff8e6;box-shadow:0 2px 0 #c8aedc;color:#392553;line-height:1}
.xp-chip-number{display:flex;align-items:baseline;gap:2px;color:#392553;font:700 11px/1 system-ui,sans-serif;white-space:nowrap}
.xp-chip-number b{font:700 22px/1 Georgia,serif}
.xp-chip-body{display:block;min-width:0}
.xp-chip-title{display:block;max-width:58px;overflow:hidden;text-overflow:ellipsis;text-align:center;font:700 11px/1.1 system-ui,sans-serif;color:var(--ink);white-space:nowrap}
.xp-chip-progress{display:grid;gap:4px;min-width:0;text-align:center}
.xp-chip .xp-track{position:relative;display:block;min-width:28px;height:9px;border:0;overflow:visible;box-shadow:none;background:#e4d7ed}
.xp-chip .xp-fill{display:block}
.xp-chip-marker{position:absolute;z-index:2;top:50%;width:16px;height:21px;transform:translate(-50%,-72%);transition:left .4s ease;pointer-events:none}
.xp-chip-marker::before{content:'';position:absolute;top:0;left:1px;width:12px;height:12px;border:2px solid #071d32;border-radius:50% 50% 50% 0;background:#b49ad8;box-shadow:0 1px 0 #ffffff99;transform:rotate(-45deg)}
.xp-chip-marker::after{content:'';position:absolute;top:5px;left:6px;width:5px;height:5px;border-radius:50%;background:#fff8e6}
.xp-chip-destination{display:grid;justify-items:center;align-content:center;gap:1px;min-width:0}
.xp-chip-destination>img{width:28px;height:28px;object-fit:contain}
.xp-chip-gate{display:inline-flex;align-items:center;gap:2px;color:#725326;font-size:9px;font-weight:700;line-height:1;white-space:nowrap}
.xp-chip-lock{display:block;width:12px;height:14px;object-fit:contain}
.xp-chip-summary{font:700 10px/1.2 system-ui,sans-serif;color:#54337b;font-variant-numeric:tabular-nums}
/* Confirmed XP stays legible while the little hearts and stars burst around it. */
.xp-burst{position:fixed;z-index:9;top:max(18px,env(safe-area-inset-top));left:50%;transform:translateX(-50%);display:flex;align-items:center;justify-content:center;gap:12px;width:min(310px,calc(100vw - 36px));padding:14px 18px;border:3px solid #071d32;border-radius:28px;background:#fff8e6;box-shadow:0 5px 0 #b795d6,0 12px 28px #4f3c6633;color:#3a2a4a;pointer-events:none;animation:level-pop .55s cubic-bezier(.2,1.35,.45,1) both}
.xp-burst-mascot{position:relative;width:76px;height:82px;object-fit:contain;animation:xp-mascot-hop .65s ease-out both}
.xp-burst-copy{position:relative;display:grid;gap:3px;text-align:center}
.xp-burst-label{font:700 12px/1.2 system-ui,sans-serif;color:#76518d}
.xp-burst-gain{font:900 34px/1.1 system-ui,sans-serif;color:#54337b;letter-spacing:-1px}
.xp-burst-total{font:700 14px/1.3 system-ui,sans-serif;font-variant-numeric:tabular-nums}
.xp-burst-sparks{position:absolute;inset:0;overflow:hidden;border-radius:24px}
.xp-burst-spark{position:absolute;left:50%;top:50%;font-size:20px;line-height:1;color:#ae567f;text-shadow:0 1px #fff;animation:xp-spark 1.15s var(--delay) ease-out both}
.xp-burst-spark:nth-child(even){color:#99702b}
@keyframes xp-spark{0%{opacity:0;transform:translate(-50%,-50%) scale(.3)}20%{opacity:1}100%{opacity:0;transform:translate(calc(-50% + var(--x)),calc(-50% + var(--y))) rotate(35deg) scale(.8)}}
@keyframes xp-mascot-hop{0%,100%{transform:translateY(0) rotate(0)}45%{transform:translateY(-8px) rotate(-9deg)}70%{transform:translateY(1px) rotate(5deg)}}
@media(prefers-reduced-motion:reduce){.xp-burst,.xp-burst-mascot{animation:none}.xp-burst-sparks{display:none}}
@media(min-width:761px) and (max-width:1100px){.site-header:has(.xp-chip) .header-note{display:none}.site-header .xp-chip{margin-left:auto}}

/* A tiny celebration, deliberately not a modal: leveling up should feel like a reward, not a detour. */
.level-up-popover{position:fixed;z-index:8;top:max(12px,env(safe-area-inset-top));left:50%;display:grid;grid-template-columns:52px minmax(0,1fr) auto;align-items:center;gap:10px;width:min(460px,calc(100vw - 28px));padding:10px 12px;border:2px solid #071d32;border-radius:22px;background:linear-gradient(135deg,#fff8de,#f4e8ff);box-shadow:0 5px 0 #b795d6,0 14px 28px #4f3c662e;color:var(--ink);transform:translateX(-50%);animation:level-pop .5s cubic-bezier(.2,1.35,.45,1) both}
.level-up-popover>img{width:52px;height:52px}.level-up-copy{display:grid;gap:2px;min-width:0}.level-up-kicker{margin:0;color:#65477d;font:700 15px/1 Georgia,serif}.level-up-copy strong{font:18px/1.15 Georgia,serif}.level-up-copy span{font-size:12px;line-height:1.25;color:var(--muted)}.level-up-next{color:#65477d;font-weight:600}
.level-up-dismiss{padding:7px 9px;border:1px solid #9d7bc1;border-radius:11px;background:#fffaf0;color:#60456f;font:600 12px/1.1 inherit;cursor:pointer}.level-up-dismiss:hover{background:#eee0f5}
@keyframes level-pop{from{opacity:0;transform:translate(-50%,-22px) scale(.78)}60%{opacity:1;transform:translate(-50%,3px) scale(1.04)}to{opacity:1;transform:translate(-50%,0) scale(1)}}

/* The ladder: one row per level and the surface it opens. */
.level-ladder{list-style:none;margin:14px 0 4px;padding:0;display:grid;gap:6px;max-height:min(52vh,430px);overflow-y:auto}
.level-step{display:grid;grid-template-columns:34px minmax(0,1fr) auto;gap:10px;align-items:center;padding:8px 10px;border-radius:16px;border:1px solid transparent}
.level-step-badge{display:grid;place-items:center;width:32px;height:32px;border-radius:50%;font:700 14px/1 Georgia,serif;background:#e8dcf0;color:#53386e;border:2px solid #cab1df}
.level-step-text{display:grid;min-width:0}
.level-step-text strong{font:17px/1.25 Georgia,serif;font-weight:400}
.level-step-line{font-size:12px;line-height:1.35;color:var(--muted)}
.level-step-tag{font-size:11px;padding:3px 9px;border-radius:20px;background:#e8dcf0;color:#654d79;white-space:nowrap}
.level-step[data-state=here]{background:#eee0f5;border-color:#b795d6}
.level-step[data-state=here] .level-step-badge{background:linear-gradient(135deg,#f7e7bf,#f1d493);border-color:#071d32;color:#071d32}
.level-step[data-state=here] .level-step-tag{background:#f4dfbf;color:#6b4f2a}
.level-step[data-state=next]{border-color:#ded0e4;border-style:dashed}
.level-step:is([data-state=next],[data-state=locked]) .level-step-tag{background:transparent;border:1px solid #ded0e4;color:var(--muted)}
.level-step[data-state=locked]{opacity:.62}
.level-step[data-state=locked] .level-step-badge{background:transparent;border-style:dashed}
.level-step:is([data-state=locked],[data-state=open]) .level-step-line{display:none}
dialog .xp-bar{margin-top:0}

/* The one pending card: the only new thing on the page, and its only exit is its one button. */
.level-card{border:1px solid #cab1df;border-radius:24px;padding:22px 24px;background:var(--cream);box-shadow:var(--shadow);margin:18px 0 6px;text-align:left}
.level-card-eyebrow{margin:0;font-size:11px;letter-spacing:2px;text-transform:uppercase;color:#81658b}
.level-card h2{margin:4px 0 8px;font-size:26px}
.level-card p:not(.level-card-eyebrow){margin:0 0 16px;color:#705b7b}
/* Tappable, so it reads as a button: raised edge, a shadow under it and a chevron. */
.level-card-go{border:1px solid #b795d6;box-shadow:0 3px 0 #b795d6,0 8px 18px #b4a0dc33}
.level-card-go:hover{box-shadow:0 2px 0 #b795d6,0 6px 14px #b4a0dc33}
.level-card-go:active{transform:translateY(2px);box-shadow:0 1px 0 #b795d6}

/* Before the wallet opens the profile's hud has nothing in it, so it takes no room either. Scoped to
   levels-on: with levels off an empty hud keeps the space it always took. */
body.levels-on .profile-hud:empty{display:none}

/* The one "new" pip, on whichever doorway the player has not opened yet. A doorway tile already spends its
   ::after on a chevron and the daily card its ::before on a glow, so each carrier uses whichever side is free. */
.new-pip{position:relative}
.new-pip:not(.daily-card)::before,.daily-card.new-pip::after{content:'new';position:absolute;z-index:2;top:-10px;left:10px;padding:2px 9px;border-radius:20px;font:11px/1.5 inherit;letter-spacing:.5px;background:#f4dfbf;color:#77567f;border:1px solid #e8cda9;pointer-events:none}
.daily-card.new-pip::after{top:14px;right:16px;left:auto}
/* On a nav tab it rides in the corner rather than stretching the label. */
.bottom-nav .new-pip::before{top:0;right:2px;left:auto;padding:1px 6px;border:2px solid #071d32;font-size:10px;font-weight:700}
@media(max-width:760px){.site-header:has(.xp-chip){flex-wrap:wrap}.site-header .xp-chip{order:3;flex:1 0 100%;min-width:0;width:100%;margin:6px 0 0}.xp-chip{padding:5px 8px}.level-card{padding:18px 18px;border-radius:20px}.level-card h2{font-size:23px}.level-up-popover{grid-template-columns:44px minmax(0,1fr) auto;gap:8px;padding:8px 10px}.level-up-popover>img{width:44px;height:44px}.level-up-copy strong{font-size:16px}.level-up-dismiss{padding:6px 7px}}
@media(prefers-reduced-motion:reduce){.xp-fill{transition:none}.level-card-go:active,.xp-chip:active{transform:none}.level-up-popover{animation:none}}
/* Inline guides sit beside working controls and can always be replayed. */
.feature-guide{width:100%;text-align:left;margin:8px 0 12px;min-width:0}
.feature-guide-help{min-height:44px;text-decoration:underline;text-underline-offset:3px;font-size:13px}
.feature-guide-body{padding:14px 16px;border:1px solid #b795d6;border-radius:16px;background:#fffaf0;box-shadow:0 3px 0 #dfcde3;color:var(--ink)}
.feature-guide-body strong{display:block;font-size:16px}
.feature-guide-body p{margin:5px 0 8px;font-size:14px;line-height:1.5;color:#624d70}
.feature-guide-body button{min-height:44px}
.monster-guide-anchor,.visitor-guide-anchor{width:100%;min-width:0}
.postcard-home>.visitor-guide-anchor{text-align:left}
.level-card .quiet{margin-left:12px;min-height:44px}
.postcard-home:has(.feature-guide-body:not([hidden]))>.level-card{display:none}
/* The first level-up card explains XP and levels in three pictures (levelTutorialStrip in how-it-works.mjs). */
.level-tutorial-wrap{margin:0 0 16px;padding:12px 0 0;border-top:1px dashed #ded0e4}
.level-tutorial-title{margin:0;font-size:11px;letter-spacing:2px;text-transform:uppercase;color:#81658b;font-weight:400}
.level-tutorial.comic-strip{margin-top:8px}
