/* SAICRAFT 2.1 Brain Power wired into Explore (game/brain.js): the Spark bar above the hotbar, the Shrine Power
   icons beside the hearts, the enchanting table's "find a table" note, the purse inside the trade panel and the
   treasure map panel. The pieces' own looks are in learning.css; this file only places them. Linked just before
   style.css. brain.js positions the two HUD pieces in pixels a few times a second (next to the hotbar and hearts,
   clear of the touch controls), so other HUD layouts keep working. Keyframes start with brn. */

/* Same layer as the Explore HUD (12): below the touch controls (20), quiz (25), modals (30) and toasts (35). */
#brain-hud { position:absolute; inset:0; z-index:12; pointer-events:none; }
.game-paused #brain-hud, .quiz-open #brain-hud { visibility:hidden; }
/* While Explore waits (a Games Hall round hides #explore-hud), its Spark bar, icons and chips wait too. */
#explore-hud[style*="display: none"] ~ #brain-hud, #explore-hud[style*="display: none"] ~ .wq-layer { display:none; }
#brain-hud .brain-spark, #brain-hud .brain-powers { position:absolute; left:0; top:0; }
#brain-hud .brain-spark[hidden] { display:none; }
/* The bar never takes a tap or a mouse wheel meant for the world just above the hotbar (the level is a number). */
#brain-hud .spark-bar { width:100%; filter:drop-shadow(0 2px 2px #0007); pointer-events:none; }
#brain-hud .spark-level { min-width:26px; height:24px; font-size:15px; }
#brain-hud .spark-track { height:10px; }
#brain-hud .spark-bar.level-up .spark-level { animation:brnLevel .9s cubic-bezier(.2,1.6,.4,1); }
#brain-hud .spark-bar.level-up .spark-track { animation:brnTrack .9s ease-out; }
#brain-hud .power-icons { filter:drop-shadow(0 2px 2px #0007); }
#brain-hud .brain-powers.gold-hit .power-golden { animation:brnGold .45s ease-out; }

/* The answer for the quiz panel: a lesson's right answer shows its spark. */
.earned-spark { color:#d9ff70; }

/* The enchanting table, opened away from a table: what it costs, and a picture of where to go. */
.rune-away { margin:0 0 10px; padding:8px 14px; border-radius:14px; background:#0006; font-size:26px; text-align:center; letter-spacing:4px; }
.expansion-panel .rune-mount { display:flex; justify-content:center; }

/* The Stall Purse inside the trade panel: the cards make way for the counter. */
.trade-cards.paying { display:flex; justify-content:center; align-items:flex-start; grid-template-columns:none; }
.trade-cards .purse-mount { display:flex; justify-content:center; width:100%; }
.purse-item .item-tile { width:44px; height:44px; vertical-align:middle; }
.purse-item .purse-n { font:18px var(--display); margin-left:2px; vertical-align:bottom; }
.purse-item .purse-gems { display:inline-flex; align-items:center; gap:3px; margin-left:8px; padding:2px 8px; border-radius:10px; background:#0004; font:20px var(--display); vertical-align:middle; color:#fff; }
.purse-item .purse-gems .gem-ico { width:22px; height:22px; }

/* Scout's treasure map card. It always fits the screen, so its ✔ can be tapped on a landscape phone: the path
   picture shrinks to the height that is left (a long walk draws a tall grid), and the card scrolls as a last resort. */
.modal-treasure .treasure-panel { padding:12px; background:transparent; border:0; box-shadow:none; max-height:calc(100dvh - 32px); overflow:auto; overscroll-behavior:contain; touch-action:pan-y; }
.modal-treasure .treasure-svg { max-height:max(110px, calc(100dvh - 250px)); }
/* The minimap's N while a map is out, when it is an SVG letter inside the map: it grows about its own middle and
   turns gold (SVG text takes fill, not color). */
#explore-hud .map-north.treasure-north-pulse { transform-box:fill-box; transform-origin:center; animation:brnNorth 1s ease-in-out infinite; }

@keyframes brnLevel { 0% { transform:scale(1); } 35% { transform:scale(1.5); box-shadow:0 0 22px #c8ff4a; } 100% { transform:scale(1); } }
@keyframes brnTrack { 0% { box-shadow:0 0 0 #c8ff4a00; } 40% { box-shadow:0 0 18px #c8ff4a; } 100% { box-shadow:0 0 0 #c8ff4a00; } }
@keyframes brnGold { 0% { transform:scale(1); } 40% { transform:scale(1.3); filter:brightness(1.6); } 100% { transform:scale(1); } }
@keyframes brnNorth { 0%, 100% { transform:scale(1); } 50% { transform:scale(1.5); fill:#ffd23f; } }

@media (prefers-reduced-motion: reduce) {
  #brain-hud .spark-bar.level-up .spark-level, #brain-hud .spark-bar.level-up .spark-track, #brain-hud .brain-powers.gold-hit .power-golden, #explore-hud .map-north.treasure-north-pulse { animation:none; }
}
@media (max-width:700px), (max-height:600px) {
  #brain-hud .power-icon { width:38px; height:38px; }
  #brain-hud .power-emoji { font-size:19px; }
  #brain-hud .spark-level { min-width:22px; height:20px; font-size:13px; }
  #brain-hud .spark-track { height:8px; }
}
