/* UX pass (Claude, 2026-10-27). Loaded after polish.css so the layout system stays as it is; this only
   (1) clears the combat HUD while a companion talks, (2) turns locked slots into quiet locks instead of cut-off sentences,
   (3) raises the small type for 4th graders on desktop and tablet widths, (4) styles the journal's "next power" line. */

/* 1 · talking: the scene and the dialogue box, nothing else */
#hud .spellbar,#hud .goal,#hud .mini,#hud .vitals,.mb-study-hud{transition:opacity .25s}
body.talking #hud .spellbar,body.talking #hud .talk-prompt,body.talking #hud .goal,body.talking #hud .mini,body.talking #hud .cross,body.talking #hud .aim-mark,
body.talking #hud .toast,body.talking .mb-study-hud,body.talking .touch-controls{opacity:0!important;pointer-events:none!important}
body.talking #hud .vitals{opacity:.35}
body.talking .story-dialog{bottom:max(28px,env(safe-area-inset-bottom,0px))}

/* 2 · locked: a quiet lock, the reason stays in the tooltip; learned skills are what the eye finds */
.slot.locked{background:#ebe4d4c0;border-style:dashed;box-shadow:none}
.slot.locked .nm,.slot.locked .status{visibility:hidden}
.slot.locked::after{content:'';position:absolute;left:50%;top:56%;width:14px;height:11px;transform:translate(-50%,-50%);border-radius:3px;background:#a49a86;opacity:.75}
.slot.locked::before{content:'';position:absolute;left:50%;top:41%;width:9px;height:9px;transform:translate(-50%,-50%);border:2.5px solid #a49a86;border-bottom:none;border-radius:6px 6px 0 0;opacity:.75}
.el.locked .n{opacity:.4}

/* 3 · shared type and target sizes are defined in section 6, after all layouts. */
.banner.show{animation-duration:2.1s}

/* 4 · journal: what the next finished activity wakes up */
.mb-next-power{margin:0 0 10px;padding:9px 12px;border-radius:12px;background:#fff3d6;border-left:5px solid var(--np,#f08a3a);font:15px/1.45 Nanum,MBNanum,sans-serif;color:#4a3524;word-break:keep-all}
.mb-next-power b{font-family:Jua,MBJua,sans-serif;font-weight:400;color:#6b3f24}

/* 5 · the atlas: a big parchment sheet with a side list (Claude, 2026-10-27) */
.world-map-card.atlas{width:min(1240px,97vw);display:grid;grid-template-columns:minmax(0,1fr) 270px;grid-template-rows:auto auto auto;column-gap:16px;background:#f6ead0}
.world-map-card.atlas header{grid-column:1/-1}
.world-map-card.atlas .world-map-sheet{grid-column:1;width:min(100%,calc(100dvh - 150px));aspect-ratio:1/1;position:relative;background:#e9d8b0;border:4px solid #8a6238;border-radius:10px;box-shadow:inset 0 0 0 2px #f8ecd0,0 6px 20px #3a24123a;cursor:grab}
.world-map-card.atlas .world-map-sheet:active{cursor:grabbing}
.world-map-card.atlas .world-map-location{grid-column:1;margin:8px 0 0}
.world-map-card.atlas .world-map-legend,.world-map-card.atlas .world-map-units{display:none}
.atlas-tools{position:absolute;left:12px;top:12px;display:grid;gap:6px}
.atlas-tools button{width:40px;height:40px;border-radius:10px;border:2px solid #8a6238;background:#fff7e6;color:#4a3322;font:20px Jua,sans-serif;cursor:pointer;box-shadow:0 2px 0 #8a623866}
.atlas-tip{position:absolute;transform:translate(-50%,calc(-100% - 18px));background:#fffaf0;border:2px solid #8a6238;border-radius:10px;padding:6px 10px;display:grid;gap:2px;pointer-events:none;white-space:nowrap;box-shadow:0 4px 12px #3a241233}
.atlas-tip b{font:15px Jua,sans-serif;color:#4a3322;font-weight:400}.atlas-tip span{font:12.5px Nanum,sans-serif;color:#6a5440}
.atlas-side{grid-column:2;grid-row:2/4;align-self:start;display:grid;gap:10px;font-family:Nanum,sans-serif;color:#4a3322}
.atlas-side h3{margin:0;font:18px Jua,sans-serif;font-weight:400;color:#6b3f24}
.atlas-side ul{list-style:none;margin:0;padding:0;display:grid;gap:7px}
.atlas-side li{padding:8px 10px;border-radius:10px;background:#fff8e8;border-left:5px solid var(--uc);cursor:pointer;display:grid;gap:1px;box-shadow:0 1px 0 #8a623833}
.atlas-side li:hover{background:#fff2d2}.atlas-side li b{font:15px Jua,sans-serif;font-weight:400}.atlas-side li small{font-size:12px;color:#7a6450}
.atlas-side li span{font-size:12.5px}.atlas-side li em{font-style:normal;font-size:12px;color:#9a4a32}.atlas-side li em.done{color:#3f7a4a}
.atlas-legend{display:flex;flex-wrap:wrap;gap:6px 12px;font-size:12.5px}.atlas-legend span{display:inline-flex;align-items:center;gap:5px}
.atlas-legend i{width:12px;height:12px;border-radius:50%;display:inline-block;border:2px solid #fff6e2;box-shadow:0 0 0 1px #4a332266}
.atlas-legend i.lg-me{background:#e9532f}.atlas-legend i.lg-goal{background:#f2b34b;border-radius:2px;transform:rotate(45deg)}.atlas-legend i.lg-study{background:#6e7b3c}.atlas-legend i.lg-flag{background:#e07a3a}.atlas-legend i.lg-won{background:#e2b84a}.atlas-legend i.lg-boss{background:#b0412f}
.atlas-hint{margin:0;font-size:12px;color:#7a6450}
@media(max-width:900px){.world-map-card.atlas{grid-template-columns:1fr}.world-map-card.atlas .world-map-sheet{width:min(100%,62dvh)}.atlas-side{grid-column:1;grid-row:auto}}

body[data-state="map"] #hud{visibility:hidden}
.world-map-card.atlas .world-map-sheet::before,.world-map-card.atlas .world-map-sheet::after{display:none}

/* 6 · 2026-10-28: readable HUD and comfortable buttons, without canvas scaling.
   Desktop, tablet and short windows share the same type sizes; only the panel
   width/spacing changes. The learning sheet retains its question layout. */
:root{--hud-button-height:48px;--hud-label-size:18px;--hud-detail-size:15px}
.pause-button{min-width:54px;min-height:54px;font-size:22px}
.pause-button span{font-size:14px;line-height:1.2}
body .mb-study-hud button,.goal-action,.world-map-close,.story-dialog .opts button{min-height:var(--hud-button-height);font-size:var(--hud-label-size);line-height:1.25;padding:10px 16px}
.story-dialog{width:min(740px,92vw);max-height:calc(100dvh - max(28px,env(safe-area-inset-bottom,0px)) - 16px);overflow:auto;overscroll-behavior:contain;padding:20px 24px}
/* Keep the name in the scrollable card: a negative top offset clips it. */
.story-dialog .who{position:static;display:table;max-width:100%;margin:0 0 10px;padding:5px 14px;font-size:18px;line-height:1.3;overflow-wrap:anywhere}
.story-dialog .line{font-size:20px;line-height:1.6}
.story-dialog .next{font-size:16px}
.story-dialog .opts{gap:10px;margin-top:12px}
.story-dialog .opts:empty{display:none}
@media(max-height:420px){
  .story-dialog{padding:12px 18px}
  .story-dialog .who{margin-bottom:6px}
  .story-dialog .line{min-height:0;margin:4px 0 10px}
}
.atlas-tools button{width:48px;height:48px;font-size:24px}
.atlas-tip b,.atlas-side li b{font-size:17px}
.atlas-tip span,.atlas-side li small,.atlas-side li span,.atlas-side li em,.atlas-hint,.atlas-legend{font-size:15px;line-height:1.45}
.atlas-side li{min-height:72px;padding:10px 12px;gap:3px}
.world-map-location{font-size:18px}
@media(min-width:901px){
  .world-map-card.atlas{height:calc(100dvh - 24px);grid-template-rows:auto minmax(0,1fr) auto;overflow:hidden}
  .world-map-card.atlas .world-map-sheet{width:auto;height:100%;max-width:100%;min-height:0;justify-self:center}
  .atlas-side{align-self:stretch;min-height:0;overflow:auto;padding-right:6px;scrollbar-gutter:stable}
}

/* Combat protection and link timing share the journal HUD, on mouse and touch. */
.boss-link[hidden]{display:none}
.combat-lab{margin:12px 0;border:1px dashed #a77b48;padding:9px;border-radius:10px}.combat-lab p{font-size:13px!important}.combat-lab button{font-size:13px;padding:8px;margin:4px}.combat-lab select{min-height:40px}
.combat-lab-label{position:fixed;bottom:8px;left:50%;transform:translateX(-50%);z-index:12;padding:5px 12px;max-width:85vw;border-radius:9px;background:#562f24dd;color:#fff3cf;font:13px Nanum,sans-serif;pointer-events:none}
.boss .bs{display:table;max-width:100%;margin:5px auto 0;padding:4px 10px;border-radius:12px;background:#30251ce6;text-shadow:none}
.boss-link{padding:7px 9px;margin-top:5px;border:1px solid #dcc99766;border-radius:12px;background:#30251ce6;text-shadow:none}
.link-marks{display:flex;justify-content:center;flex-wrap:wrap;gap:6px}
.link-marks span{padding:4px 9px;border:1px solid #d4c3a77a;border-radius:12px;background:#312d26dc;color:#e1d6bf;font-size:14px;line-height:1.35}
.link-marks span.done{background:#35695ee8;border-color:#c6ebc9;color:#fff9da}
.link-clock{height:5px;background:#302a22b8;border-radius:5px;overflow:hidden;margin:7px 5% 4px}
.link-clock i{height:100%;display:block;background:#e7c28a;transition:width .08s linear}
.boss-link small{display:block;font-family:Nanum,sans-serif;font-size:13px;line-height:1.5;color:#fff1d8}
.boss[data-phase="open"] .bb{box-shadow:0 0 12px #ffd778}.boss[data-phase="open"] .bs{color:#ffe2a0}
.boss[data-phase="open"] .link-clock i{background:#ffcf71}
.aim-mark span{white-space:nowrap}.aim-mark[data-phase="open"]{filter:drop-shadow(0 0 4px #ffc55a)}
.el.needed{outline:3px solid #ffdc80;outline-offset:3px}
.touch-quick-elements{display:flex;gap:7px;grid-column:1/-1}
.touch-quick-elements[hidden],.touch-quick-elements button[hidden]{display:none}
.supplies-button{pointer-events:auto;align-self:flex-end;border:1px solid #c4b18a;border-radius:11px;background:#f6efddeb;color:#654b31;padding:6px 10px;font:14px Jua,sans-serif;cursor:pointer;min-height:32px}.supplies-button:disabled{opacity:.6;cursor:default}.touch-mode .supplies-button{display:none}
.touch-actions .touch-heal{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:44px!important;padding:7px 12px}
.touch-quick-elements button{flex:1;min-width:0;min-height:44px!important;font-size:14px!important;padding:7px!important;line-height:1.35}
.touch-quick-elements button[aria-pressed="true"]{background:#8a5530;color:#fff6df}
body.touch-mode .touch-controls .touch-interact{bottom:calc(var(--touch-actions-height, 260px) + max(30px, env(safe-area-inset-bottom)) + 12px)}
@media(max-height:650px){.boss-link small{font-size:12px}.link-marks span{font-size:12px;padding:3px 7px}.boss-link{padding-top:4px}.touch-quick-elements button{min-height:40px!important;font-size:12px!important}}
.mb-next-power{font-size:17px;line-height:1.5;padding:11px 14px}
.help{font-size:16px;line-height:1.6;max-width:370px}
.card p,.card li,.presentation-settings label{font-size:16px}
.presentation-settings select{font-size:16px;min-height:44px}
.presentation-settings legend{font-size:17px}
.presentation-settings small{font-size:14px}
button:focus-visible{outline:3px solid #e8913f;outline-offset:4px}

@media(min-width:561px){
  .spellbar{width:408px;gap:10px}
  .els{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:7px}
  .el{width:100%;min-width:0;height:56px;min-height:56px}
  .el .n{font-size:18px}.el .k{font-size:13px;top:3px;left:5px}
  .slots{gap:8px}
  .slot{height:auto;min-height:82px;padding:8px 10px;gap:3px}
  .slot .key{font-size:14px;line-height:1.15}
  .slot .nm{font-size:18px;line-height:1.15;white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere}
  .slot .status{font-size:15px;line-height:1.2}
  .element-note{font-size:16px;line-height:1.3}
  .vitals{width:min(370px,40vw)}
  .vitals .vt .val{font-size:20px}.vitals .vt.mp .val{font-size:18px}
  .vitals .reso-line{font-size:15px;line-height:1.3}
  .vitals .bar{height:19px}.vitals .mp .bar{height:14px}
  .goal{right:96px;width:300px;max-width:300px;padding:14px 16px;gap:9px}
  .goal .goal-kicker{font-size:15px}.goal-main b{font-size:22px;line-height:1.25;word-break:keep-all;overflow-wrap:anywhere}
  .goal small{font-size:16px;line-height:1.5;word-break:keep-all;overflow-wrap:anywhere}
  .goal[data-review="true"] .goal-kicker{font-size:15px}
  .goal-bearing{width:30px;height:30px;font-size:25px}
  .goal-action{font-size:18px;min-height:48px}
  .mini{width:164px;height:164px}
  .mini-key{font-size:15px;padding:4px 10px}
  body .mb-study-hud{bottom:206px;gap:10px}
  .boss{top:calc(var(--goal-bottom, 210px) + 14px)}
  .boss .bn{font-size:26px}.boss .bs{font-size:16px;line-height:1.45}
  .talk-prompt{font-size:19px;max-width:calc(100vw - 860px);line-height:1.4}
  .toast{font-size:17px;line-height:1.5;bottom:100px}
  .aim-mark span{font-size:14px}
  .touch-controls button{font-size:18px;min-height:56px}
  .touch-controls button small{font-size:15px;line-height:1.25}
  .touch-actions{width:248px}
  .touch-actions button{min-height:66px;padding:10px 12px}
  .touch-actions .touch-attack{min-height:82px}
  .touch-mode #hud .spellbar{width:360px}
  .touch-mode .mini{width:132px;height:132px;bottom:288px}
  .touch-mode .mb-study-hud{top:134px;bottom:auto}
  .touch-mode #hud .boss{width:min(440px,42vw);top:calc(var(--spell-bottom, 300px) + 14px)}
  .touch-controls .touch-interact{min-height:52px;font-size:18px!important;bottom:280px;max-width:248px}
  .move-pad small{font-size:16px}
}
@media(min-width:561px) and (max-width:980px){
  .spellbar{width:340px;right:18px}
  .goal{width:min(286px,36vw);max-width:36vw;right:88px}
  .goal-main b{font-size:20px}
  .vitals{width:320px;max-width:43vw}
  .vitals .reso-line .fn{max-width:none}
  .mini{width:136px;height:136px}
  body .mb-study-hud{left:18px;bottom:180px;gap:8px}
  .talk-prompt{bottom:300px;max-width:80vw}
  .toast{bottom:350px;max-width:80vw}
  .touch-mode #hud .spellbar{width:340px}
  .touch-mode #hud .boss{left:22px;transform:none;width:min(360px,44vw);top:204px}
  .touch-mode .mb-study-hud{top:134px;bottom:auto}
  .touch-mode .toast{bottom:350px}
}
@media(max-height:600px) and (min-width:561px){
  .vitals{padding:8px 10px;top:12px}.vitals .reso-line{font-size:14px}
  .goal{top:12px;padding:10px 12px;gap:6px}
  .goal .goal-kicker{display:none}.goal-main b{font-size:20px}
  .goal small{font-size:15px}
  .spellbar{width:352px;gap:6px;bottom:14px}
  .el{height:50px;min-height:50px}.slot{min-height:76px;padding:6px 8px}
  .slot .key{font-size:13px}.element-note{font-size:15px}
  .mini{width:110px;height:110px;bottom:18px}
  body .mb-study-hud{bottom:146px}
  .talk-prompt{bottom:280px;max-width:80vw}.toast{bottom:330px}
  .touch-mode .mb-study-hud{top:114px;bottom:auto}
  .touch-mode .mini{width:100px;height:100px;bottom:240px}
  .touch-actions{bottom:18px;width:232px;gap:6px}
  .touch-actions button{min-height:54px;padding:6px 10px}
  .touch-actions .touch-attack{min-height:66px}
  .touch-controls .touch-interact{bottom:224px;max-width:232px;min-height:48px}
  .touch-mode #hud .spellbar{width:340px}
  .touch-mode #hud .boss{left:50%;top:auto;bottom:24px;transform:translateX(-50%);width:40vw}
  .touch-mode #hud.boss-active~.touch-controls .touch-hint{display:none}
}
@media(max-width:560px){
  :root{--hud-button-height:44px;--hud-label-size:16px}
  .pause-button{min-width:48px;min-height:48px}
  .goal-action{position:static;min-height:44px;font-size:16px;max-width:100%}
  .goal[data-kind="learn"] .goal-main,.goal[data-kind="rest"] .goal-main{padding-right:0}
  .goal small{font-size:14px}.goal-main b{font-size:19px}
  body .mb-study-hud button{font-size:16px;min-height:44px}
  .slot .key{font-size:12px}.slot .status{font-size:13px}
  .slot .nm,.el .n{font-size:16px}.slot{height:70px}
  .element-note{font-size:14px}
  .spellbar,.touch-mode #hud .spellbar{width:min(320px,calc(100vw - 24px));right:12px}
  .els{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:5px}
  .el{width:100%;min-width:0;min-height:44px}
  .mini{bottom:260px}
  body .mb-study-hud{bottom:366px;max-width:calc(100vw - 24px)}
  .touch-mode .mini{bottom:304px}
  body.touch-mode .mb-study-hud{top:auto;bottom:251px}
  .story-dialog{padding:14px 16px}.story-dialog .line{font-size:18px}
  .touch-controls button small{font-size:13px}
  .world-map-card.atlas{padding:12px}.atlas-side{gap:8px}
}
/* Keep the three notebook / equipment actions readable on one line. */
body .mb-study-hud{width:max-content;max-width:calc(100vw - 44px)}
body .mb-study-hud button{white-space:nowrap;flex:0 0 auto}
@media(max-width:560px){body .mb-study-hud{max-width:calc(100vw - 24px);gap:6px}body .mb-study-hud button{padding:8px 11px}}
