/* ==========================================================================
   Hogwarts Voxel — UI overlay.  Magical parchment + gold leaf + candlelight.
   Every selector is prefixed hx-.  Fonts (loaded by the page <link>):
   "Cinzel Decorative", "Cinzel", "Cormorant Garamond", (optional) "IM Fell English".
   ========================================================================== */

.hx-root {
  --hx-gold: #e6c477;
  --hx-gold-hi: #fff2c4;
  --hx-gold-lo: #a97c2c;
  --hx-gold-a: rgba(230, 196, 119, 0.55);
  --hx-gold-b: rgba(230, 196, 119, 0.22);
  --hx-ink: rgba(12, 9, 24, 0.74);
  --hx-ink-2: rgba(22, 17, 38, 0.86);
  --hx-text: #f4ead2;
  --hx-dim: rgba(244, 234, 210, 0.62);
  --hx-house-a: #c8202a;
  --hx-house-b: #f0b43a;
  --hx-display: 'Cinzel Decorative', 'Cinzel', 'Trajan Pro', Georgia, serif;
  --hx-caps: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --hx-body: 'Cormorant Garamond', 'EB Garamond', Georgia, 'Times New Roman', serif;
  --hx-fell: 'IM Fell English', 'Cormorant Garamond', Georgia, serif;
  --hx-ease: cubic-bezier(0.22, 0.8, 0.24, 1);

  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  pointer-events: none;
  font-family: var(--hx-body);
  font-size: 18px;
  line-height: 1.3;
  color: var(--hx-text);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
.hx-root *, .hx-root *::before, .hx-root *::after { box-sizing: border-box; }
:where(.hx-root) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; outline: none; }
:where(.hx-root) button:focus-visible, :where(.hx-root) input:focus-visible { outline: 1px solid var(--hx-gold); outline-offset: 3px; }
.hx-root canvas { display: block; }
.hx-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.hx-hidden { display: none !important; }

.hx-gold-text {
  background: linear-gradient(180deg, #fff8dc 0%, #f4d98c 38%, #c08c34 62%, #f6df9e 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ============================== TITLE SCREEN ============================== */
.hx-title {
  position: absolute; inset: 0; pointer-events: auto; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: #07050f;
  transition: opacity 1.1s ease, visibility 0s linear 1.1s, transform 1.4s var(--hx-ease);
  overflow: hidden auto;
}
.hx-title.hx-leaving { opacity: 0; visibility: hidden; transform: scale(1.06); pointer-events: none; }
.hx-title-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hx-title-vig {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 75% 65% at 50% 45%, rgba(7, 5, 15, 0) 0%, rgba(7, 5, 15, 0.35) 70%, rgba(7, 5, 15, 0.82) 100%),
    linear-gradient(180deg, rgba(7, 5, 15, 0.35) 0%, rgba(7, 5, 15, 0) 30%, rgba(7, 5, 15, 0) 62%, rgba(7, 5, 15, 0.6) 100%);
}
.hx-title-inner {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: clamp(14px, 3.4vh, 40px) 20px; width: min(960px, 100%); margin: auto;
  animation: hx-rise 1.6s var(--hx-ease) both;
}
.hx-crest { width: clamp(64px, 11vh, 108px); height: clamp(64px, 11vh, 108px); filter: drop-shadow(0 0 14px rgba(240, 196, 100, 0.55)); animation: hx-float 7s ease-in-out infinite; }
.hx-crest svg { width: 100%; height: 100%; overflow: visible; }
.hx-title-name {
  margin: clamp(4px, 1.2vh, 14px) 0 0;
  font-family: var(--hx-display); font-weight: 900; font-size: clamp(44px, 10.5vw, 128px); line-height: 1.02;
  letter-spacing: 0.16em; padding-left: 0.16em; text-transform: uppercase;
  background: linear-gradient(180deg, #fffbe6 0%, #f6dc92 30%, #c8923a 56%, #8a5f1c 64%, #f2d48a 82%, #fff4cc 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 0 22px rgba(236, 176, 70, 0.4)) drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6));
  position: relative;
}
.hx-title-name::after {
  content: attr(data-t); position: absolute; inset: 0; padding-left: 0.16em;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.95) 50%, transparent 62%) -160% 0 / 60% 100% no-repeat;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
  animation: hx-sheen 6.5s ease-in-out 1.8s infinite;
}
.hx-title-sub {
  display: flex; align-items: center; gap: clamp(10px, 2vw, 22px); margin-top: clamp(0px, 0.8vh, 8px);
  font-family: var(--hx-body); font-style: italic; font-weight: 500; font-size: clamp(18px, 2.7vw, 32px); letter-spacing: 0.28em;
  color: #f1dca4; text-shadow: 0 0 14px rgba(240, 190, 90, 0.5), 0 2px 6px rgba(0, 0, 0, 0.7);
}
.hx-rule { display: block; height: 14px; width: clamp(40px, 12vw, 150px); }
.hx-rule svg { width: 100%; height: 100%; display: block; }
.hx-rule.r { transform: scaleX(-1); }
.hx-sec-label {
  margin-top: clamp(14px, 3.4vh, 38px); font-family: var(--hx-caps); font-size: 12px; letter-spacing: 0.5em; text-transform: uppercase; color: var(--hx-gold);
  opacity: 0.85; padding-left: 0.5em;
}
.hx-houses { display: flex; gap: clamp(8px, 1.4vw, 18px); margin-top: clamp(8px, 1.6vh, 16px); flex-wrap: wrap; justify-content: center; }
.hx-house {
  --a: #c00; --b: #fc0;
  position: relative; width: clamp(104px, 14vw, 150px); padding: clamp(10px, 1.8vh, 16px) 8px clamp(8px, 1.4vh, 12px);
  border: 1px solid rgba(230, 196, 119, 0.22); border-radius: 3px;
  background: linear-gradient(180deg, rgba(20, 15, 36, 0.62), rgba(10, 8, 20, 0.7));
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  filter: saturate(0.55) brightness(0.8);
  transition: transform 0.35s var(--hx-ease), filter 0.35s, border-color 0.35s, box-shadow 0.35s, background 0.35s;
}
.hx-house:hover { filter: saturate(0.9) brightness(1); transform: translateY(-3px); }
.hx-house .hx-medal {
  width: clamp(40px, 6.2vh, 56px); height: clamp(40px, 6.2vh, 56px); border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 28%, color-mix(in srgb, var(--a) 70%, #fff) 0%, var(--a) 45%, color-mix(in srgb, var(--a) 40%, #000) 100%);
  border: 1px solid var(--b); box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35), 0 0 0 4px color-mix(in srgb, var(--b) 45%, transparent), inset 0 -6px 12px rgba(0, 0, 0, 0.35);
}
.hx-house .hx-medal svg { width: 62%; height: 62%; overflow: visible; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5)); }
.hx-house-name { font-family: var(--hx-caps); font-weight: 600; font-size: clamp(11px, 1.15vw, 14px); letter-spacing: 0.2em; text-transform: uppercase; padding-left: 0.2em; color: var(--hx-text); }
.hx-house-traits { font-style: italic; font-size: 13px; color: var(--hx-dim); opacity: 0; max-height: 0; overflow: hidden; transition: opacity 0.3s, max-height 0.3s; text-align: center; line-height: 1.15; }
.hx-house.hx-sel {
  filter: none; transform: translateY(-5px);
  border-color: var(--hx-gold);
  background: linear-gradient(180deg, color-mix(in srgb, var(--a) 38%, rgba(20, 15, 36, 0.7)), rgba(10, 8, 20, 0.78));
  box-shadow: 0 0 0 1px rgba(230, 196, 119, 0.25), 0 10px 30px color-mix(in srgb, var(--a) 55%, transparent), 0 0 34px color-mix(in srgb, var(--a) 45%, transparent);
}
.hx-house.hx-sel::before, .hx-house.hx-sel::after {
  content: ''; position: absolute; width: 10px; height: 10px; border: 1px solid var(--hx-gold); pointer-events: none;
}
.hx-house.hx-sel::before { top: 3px; left: 3px; border-right: 0; border-bottom: 0; }
.hx-house.hx-sel::after { bottom: 3px; right: 3px; border-left: 0; border-top: 0; }
.hx-house.hx-sel .hx-house-name { color: #fff6d8; text-shadow: 0 0 10px var(--a); }
.hx-house.hx-sel .hx-house-traits { opacity: 1; max-height: 40px; }
.hx-house.hx-sel .hx-medal { animation: hx-breathe 3.2s ease-in-out infinite; }

.hx-enter-wrap { margin-top: clamp(14px, 3.2vh, 34px); display: flex; flex-direction: column; align-items: center; gap: 14px; width: min(420px, 90%); }
.hx-enter {
  position: relative; padding: clamp(14px, 2.2vh, 20px) clamp(36px, 6vw, 68px); overflow: hidden;
  font-family: var(--hx-caps); font-weight: 600; font-size: clamp(14px, 1.5vw, 19px); letter-spacing: 0.36em; padding-left: calc(clamp(36px, 6vw, 68px) + 0.36em);
  text-transform: uppercase; color: #fff2cc;
  border: 1px solid rgba(240, 206, 130, 0.85); border-radius: 2px;
  background: linear-gradient(180deg, rgba(112, 78, 22, 0.55), rgba(40, 26, 8, 0.78));
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.25), 0 0 0 5px rgba(230, 196, 119, 0.28), 0 8px 30px rgba(0, 0, 0, 0.55), inset 0 0 22px rgba(255, 200, 100, 0.15);
  transition: transform 0.3s var(--hx-ease), box-shadow 0.3s, opacity 0.5s, filter 0.5s;
}
.hx-enter::before { content: ''; position: absolute; inset: 3px; border: 1px solid rgba(230, 196, 119, 0.3); pointer-events: none; }
.hx-enter::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255, 240, 200, 0.45), transparent); opacity: 0;
}
.hx-enter[disabled] { opacity: 0.4; cursor: default; filter: saturate(0.4); }
.hx-enter:not([disabled]) { animation: hx-glowpulse 3s ease-in-out infinite; }
.hx-enter:not([disabled])::after { animation: hx-btnsheen 4s ease-in-out 1s infinite; }
.hx-enter:not([disabled]):hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.25), 0 0 0 5px rgba(240, 206, 130, 0.6), 0 10px 44px rgba(240, 180, 70, 0.45), inset 0 0 28px rgba(255, 200, 100, 0.3); }
.hx-enter:not([disabled]):active { transform: translateY(0) scale(0.99); }
.hx-load { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; transition: opacity 0.8s; }
.hx-load-line { position: relative; width: 100%; height: 2px; background: rgba(230, 196, 119, 0.16); overflow: visible; }
.hx-load-line::before, .hx-load-line::after { content: ''; position: absolute; top: -2px; width: 6px; height: 6px; transform: rotate(45deg); border: 1px solid rgba(230, 196, 119, 0.7); background: #0a0814; }
.hx-load-line::before { left: -3px; } .hx-load-line::after { right: -3px; }
.hx-load-line i {
  position: absolute; left: 0; top: 0; bottom: 0; width: 100%; transform-origin: 0 50%; transform: scaleX(0); transition: transform 0.5s var(--hx-ease);
  background: linear-gradient(90deg, #a97c2c, #f4d98c 70%, #fffbe6); box-shadow: 0 0 10px rgba(240, 196, 100, 0.8);
}
.hx-load-line i::after { content: ''; position: absolute; right: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: #fff8dc; box-shadow: 0 0 12px 3px rgba(255, 220, 130, 0.9); }
.hx-load-text { font-style: italic; font-size: 17px; letter-spacing: 0.08em; color: var(--hx-dim); min-height: 1.3em; text-align: center; }
.hx-title.hx-ready .hx-load-line { opacity: 0.35; }
.hx-title.hx-ready .hx-load-text { color: var(--hx-gold); }
.hx-ctrl-sum {
  margin-top: clamp(12px, 2.6vh, 28px); display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; max-width: 840px;
  font-size: 15px; color: var(--hx-dim);
}
.hx-ctrl-sum span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.hx-kbd {
  display: inline-block; min-width: 24px; padding: 1px 7px 0; text-align: center; font-family: var(--hx-caps); font-weight: 600; font-size: 11px; letter-spacing: 0.06em;
  line-height: 20px; color: var(--hx-gold-hi); border: 1px solid rgba(230, 196, 119, 0.5); border-bottom-width: 2px; border-radius: 4px; background: rgba(10, 8, 20, 0.55);
}

/* ================================== HUD ================================== */
.hx-hud { position: absolute; inset: 0; transition: opacity 0.9s ease; }
.hx-title-on .hx-hud { opacity: 0; visibility: hidden; }

/* crosshair */
.hx-cross { position: absolute; left: 50%; top: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px; --cc: rgba(255, 255, 255, 0.85); }
.hx-cross svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 6px color-mix(in srgb, var(--cc) 55%, transparent)); transition: transform 0.2s var(--hx-ease); }
.hx-cross g { opacity: 0; transition: opacity 0.16s, transform 0.22s var(--hx-ease); transform-origin: 0 0; transform: scale(0.7); stroke: var(--cc); fill: none; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.hx-cross[data-mode='default'] .m-d, .hx-cross[data-mode='target'] .m-t, .hx-cross[data-mode='item'] .m-i, .hx-cross[data-mode='door'] .m-o, .hx-cross[data-mode='locked'] .m-l { opacity: 1; transform: scale(1); }
.hx-cross[data-mode='target'] { --cc: #ff9a78; }
.hx-cross[data-mode='item'] { --cc: #ffe27a; }
.hx-cross[data-mode='door'] { --cc: #bfe6ff; }
.hx-cross[data-mode='locked'] { --cc: #ff6a6a; }
.hx-cross .fillme { fill: var(--cc); stroke: none; }
.hx-cross[data-mode='target'] .m-t { animation: hx-spin 9s linear infinite; }
.hx-cross[data-mode='item'] .m-i .spark { animation: hx-twinkle 1.3s ease-in-out infinite; transform-origin: 0 0; }
.hx-hint {
  position: absolute; left: 50%; top: calc(50% + 30px); transform: translateX(-50%); display: flex; align-items: center; gap: 9px; white-space: nowrap;
  font-family: var(--hx-body); font-weight: 600; font-size: 19px; letter-spacing: 0.06em; color: #fff6dc; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9), 0 0 12px rgba(0, 0, 0, 0.6);
  opacity: 0; transition: opacity 0.2s; padding: 3px 12px; border-radius: 20px;
  background: radial-gradient(ellipse at center, rgba(8, 6, 16, 0.5), rgba(8, 6, 16, 0) 75%);
}
.hx-hint.on { opacity: 1; }
.hx-hint .hx-kbd { font-size: 12px; }

/* compass + clock */
.hx-compass { position: absolute; left: 50%; top: 10px; width: clamp(200px, 34vw, 400px); height: 40px; transform: translateX(-50%); }
.hx-compass-ribbon {
  position: absolute; inset: 0; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 20%, #000 80%, transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 20%, #000 80%, transparent 100%);
}
.hx-compass-ribbon::before, .hx-compass-ribbon::after { content: ''; position: absolute; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(230, 196, 119, 0.65), transparent); }
.hx-compass-ribbon::before { top: 2px; } .hx-compass-ribbon::after { bottom: 2px; }
.hx-compass canvas { width: 100%; height: 100%; }
.hx-compass-caret { position: absolute; left: 50%; top: -4px; width: 12px; height: 8px; margin-left: -6px; filter: drop-shadow(0 0 4px rgba(255, 210, 110, 0.9)); }
.hx-clock { position: absolute; left: 100%; top: -2px; margin-left: clamp(8px, 1.6vw, 18px); width: 50px; text-align: center; }
.hx-clock canvas { width: 46px; height: 46px; margin: 0 auto; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55)); }
.hx-clock-t { font-family: var(--hx-caps); font-size: 10px; letter-spacing: 0.14em; color: var(--hx-gold); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9); margin-top: -2px; }
.hx-fps { position: absolute; left: 12px; top: 10px; font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: rgba(230, 255, 230, 0.85); text-shadow: 0 1px 3px #000; letter-spacing: 0.04em; }

/* spell bar */
.hx-spellbar { position: absolute; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; --s: clamp(40px, 5.4vw, 60px); }
.hx-spellinfo { text-align: center; min-height: 46px; transition: opacity 0.3s; pointer-events: none; }
.hx-spellname { font-family: var(--hx-caps); font-weight: 600; font-size: clamp(13px, 1.4vw, 17px); letter-spacing: 0.3em; padding-left: 0.3em; text-transform: uppercase; color: #fff4d4; text-shadow: 0 0 12px var(--c, #ffe9a0), 0 2px 6px rgba(0, 0, 0, 0.9); }
.hx-spellinc { font-style: italic; font-weight: 500; font-size: clamp(14px, 1.4vw, 18px); letter-spacing: 0.1em; color: var(--c, #ffe9a0); text-shadow: 0 0 10px color-mix(in srgb, var(--c, #ffe9a0) 70%, transparent), 0 1px 4px rgba(0, 0, 0, 0.9); filter: brightness(1.25); }
.hx-spellinfo.swap { animation: hx-swap 0.4s var(--hx-ease); }
.hx-slots { position: relative; display: flex; gap: clamp(6px, 1vw, 12px); align-items: flex-end; }
.hx-slot {
  --c: #ffe9a0; position: relative; width: var(--s); height: var(--s); border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 28%, rgba(70, 58, 104, 0.6), rgba(14, 10, 26, 0.85) 70%);
  border: 1px solid rgba(230, 196, 119, 0.4);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55), inset 0 0 14px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: transform 0.3s var(--hx-ease), border-color 0.3s, box-shadow 0.3s, filter 0.3s;
  filter: saturate(0.7) brightness(0.85);
}
.hx-slot::before { content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 1px solid rgba(230, 196, 119, 0.14); transition: border-color 0.3s; pointer-events: none; }
.hx-slot canvas { position: absolute; inset: 12%; width: 76%; height: 76%; }
.hx-slot.hx-sel {
  filter: none; transform: translateY(-6px) scale(1.14); border-color: var(--c);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 70%, transparent), 0 0 22px 3px color-mix(in srgb, var(--c) 65%, transparent), 0 8px 22px rgba(0, 0, 0, 0.6), inset 0 0 16px color-mix(in srgb, var(--c) 28%, transparent);
  animation: hx-slotglow 2.6s ease-in-out infinite;
}
.hx-slot.hx-sel::before { border-color: color-mix(in srgb, var(--c) 60%, transparent); }
.hx-slot .hx-key {
  position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); min-width: 17px; height: 17px; padding: 0 4px;
  font-family: var(--hx-caps); font-weight: 700; font-size: 10px; line-height: 16px; text-align: center; color: var(--hx-gold-hi);
  background: linear-gradient(180deg, #2a2142, #120d22); border: 1px solid rgba(230, 196, 119, 0.65); border-radius: 9px;
}
.hx-slot.hx-sel .hx-key { background: var(--c); color: #1a1020; border-color: #fff6; }
.hx-cd { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; }
.hx-slot.hx-cast { animation: hx-slotcast 0.45s var(--hx-ease); }
.hx-ripple { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--c); pointer-events: none; animation: hx-ripple 0.65s ease-out forwards; }
.hx-held {
  position: absolute; left: 100%; bottom: 0; margin-left: clamp(16px, 2.4vw, 30px); display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none;
  transition: opacity 0.3s, transform 0.3s var(--hx-ease);
}
.hx-held::before { content: ''; position: absolute; left: calc(-1 * clamp(8px, 1.2vw, 15px)); top: 10px; bottom: 0; width: 1px; background: linear-gradient(180deg, transparent, rgba(230, 196, 119, 0.5), transparent); }
.hx-held.off { opacity: 0; transform: translateY(8px); }
.hx-held-label { font-family: var(--hx-caps); font-size: 9px; letter-spacing: 0.34em; padding-left: 0.34em; text-transform: uppercase; color: var(--hx-gold); text-shadow: 0 1px 4px #000; }
.hx-held-box {
  position: relative; width: calc(var(--s) * 0.8); height: calc(var(--s) * 0.8); border-radius: 8px; padding: 5px;
  background: rgba(14, 10, 26, 0.75); border: 1px solid rgba(230, 196, 119, 0.55); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55), inset 0 0 10px rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.hx-held-box canvas { width: 100%; height: 100%; image-rendering: pixelated; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6); }
.hx-held-n { position: absolute; right: 3px; bottom: 1px; font-family: var(--hx-caps); font-weight: 700; font-size: 11px; color: #fff; text-shadow: 0 1px 3px #000, 0 0 4px #000; }
.hx-held-name { font-size: 13px; font-style: italic; color: var(--hx-dim); text-shadow: 0 1px 4px #000; max-width: 100px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hx-held-rmb { white-space: nowrap; font-size: 11px; letter-spacing: 0.1em; color: rgba(244, 234, 210, 0.45); }

/* incantation */
.hx-incants { position: absolute; left: 50%; top: 66%; transform: translateX(-50%); width: 100%; text-align: center; pointer-events: none; }
.hx-incant {
  position: absolute; left: 0; right: 0; top: 0; font-family: var(--hx-display); font-weight: 700; font-size: clamp(30px, 5.4vw, 66px); letter-spacing: 0.06em; color: #fff;
  text-shadow: 0 0 10px var(--c), 0 0 28px var(--c), 0 0 60px var(--c), 0 3px 6px rgba(0, 0, 0, 0.5);
  animation: hx-incant 1.3s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; white-space: nowrap;
}

/* location title card */
.hx-loc { position: absolute; left: 0; right: 0; top: 15%; text-align: center; pointer-events: none; padding: 0 16px; }
.hx-loc-card { opacity: 0; display: flex; flex-direction: column; align-items: center; animation: hx-loc 4.4s ease-in-out forwards; }
.hx-loc-name {
  font-family: var(--hx-display); font-weight: 700; font-size: clamp(26px, 4.8vw, 62px); line-height: 1.1; letter-spacing: 0.1em; padding-left: 0.1em;
  background: linear-gradient(180deg, #fffbe6 0%, #f4d98c 45%, #c8923a 75%, #f6df9e 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 0 16px rgba(240, 180, 80, 0.4)) drop-shadow(0 3px 8px rgba(0, 0, 0, 0.7));
}
.hx-loc-flourish { width: clamp(200px, 32vw, 380px); height: 22px; margin-top: 4px; overflow: visible; }
.hx-loc-flourish .ln { stroke-dasharray: 1; stroke-dashoffset: 1; animation: hx-draw 1.6s 0.35s ease-out forwards; }
.hx-loc-flourish .dm { opacity: 0; animation: hx-fadein 0.8s 0.8s forwards; }
.hx-loc-sub { margin-top: 6px; font-style: italic; font-weight: 500; font-size: clamp(16px, 2vw, 25px); letter-spacing: 0.22em; padding-left: 0.22em; color: #f3e4b6; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9), 0 0 16px rgba(0, 0, 0, 0.6); }

/* toasts */
.hx-toasts { position: absolute; right: max(16px, env(safe-area-inset-right)); top: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; width: min(340px, 80vw); pointer-events: none; }
.hx-toast {
  --c: #e6c477; position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 18px 8px 10px; max-width: 100%;
  background: linear-gradient(90deg, rgba(14, 10, 26, 0.55), rgba(14, 10, 26, 0.8)); border: 1px solid rgba(230, 196, 119, 0.28); border-right: 2px solid var(--c); border-radius: 3px 0 0 3px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), -4px 0 18px -6px var(--c);
  font-size: 18px; color: var(--hx-text); animation: hx-toastin 0.5s var(--hx-ease) both;
}
.hx-toast.out { animation: hx-toastout 0.45s ease-in forwards; }
.hx-toast canvas { width: 30px; height: 30px; flex: none; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--c) 70%, transparent)); }
.hx-toast .hx-glyph { width: 30px; text-align: center; font-size: 22px; flex: none; color: var(--c); }
.hx-toast.hx-item { padding: 10px 22px 10px 12px; gap: 14px; border-color: rgba(230, 196, 119, 0.55); animation: hx-itemin 0.7s var(--hx-ease) both; }
.hx-toast.hx-item canvas { width: 54px; height: 54px; }
.hx-toast .hx-iwrap { position: relative; width: 54px; height: 54px; flex: none; }
.hx-toast .hx-iwrap::before { content: ''; position: absolute; inset: -10px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--c) 55%, transparent), transparent 68%); animation: hx-breathe 2s ease-in-out infinite; }
.hx-toast .hx-iwrap canvas { position: relative; }
.hx-toast-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.hx-toast-kicker { font-family: var(--hx-caps); font-size: 9px; letter-spacing: 0.4em; text-transform: uppercase; color: var(--hx-gold); }
.hx-toast-title { font-family: var(--hx-caps); font-weight: 700; font-size: 16px; letter-spacing: 0.1em; color: #fff3cc; line-height: 1.2; }
.hx-toast-sub { font-style: italic; font-size: 15px; color: var(--hx-dim); }
.hx-toast-bar { height: 2px; margin-top: 4px; background: rgba(255, 255, 255, 0.12); position: relative; }
.hx-toast-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--hx-gold-lo), var(--hx-gold-hi)); box-shadow: 0 0 6px var(--hx-gold); }
.hx-spark { position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px; border-radius: 50%; background: #fff6cc; box-shadow: 0 0 8px 2px var(--c, #ffd870); pointer-events: none; animation: hx-spark 0.95s ease-out forwards; }

/* broom gauge */
.hx-broom { position: absolute; left: max(18px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom)); width: clamp(104px, 13vw, 150px); opacity: 0; transform: translateY(10px); transition: opacity 0.4s, transform 0.4s var(--hx-ease); }
.hx-broom.on { opacity: 1; transform: none; }
.hx-broom svg { width: 100%; height: auto; overflow: visible; display: block; filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6)); }
.hx-broom .trk { fill: none; stroke: rgba(230, 196, 119, 0.2); stroke-width: 5; stroke-linecap: round; }
.hx-broom .val { fill: none; stroke: var(--bc, #7fe0d0); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray 0.18s linear, stroke 0.3s; filter: drop-shadow(0 0 4px var(--bc, #7fe0d0)); }
.hx-broom .tk { stroke: rgba(230, 196, 119, 0.55); stroke-width: 1; }
.hx-broom .num { font-family: var(--hx-caps); font-weight: 700; font-size: 26px; fill: #fff4d4; text-anchor: middle; }
.hx-broom .unit { font-family: var(--hx-caps); font-size: 7.5px; letter-spacing: 0.3em; fill: var(--hx-gold); text-anchor: middle; text-transform: uppercase; }

/* =============================== PANELS =============================== */
.hx-panels { position: absolute; inset: 0; z-index: 60; pointer-events: none; }
.hx-panels.hx-open { pointer-events: auto; }
.hx-scrim {
  position: absolute; inset: 0; opacity: 0; transition: opacity 0.3s;
  background: radial-gradient(ellipse at 50% 40%, rgba(24, 16, 44, 0.55), rgba(4, 3, 10, 0.82));
  -webkit-backdrop-filter: blur(7px) saturate(0.85); backdrop-filter: blur(7px) saturate(0.85);
}
.hx-open .hx-scrim { opacity: 1; }
.hx-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: clamp(6px, 2vh, 24px) clamp(4px, 2vw, 24px); }
.hx-panel {
  position: relative; display: flex; flex-direction: column; max-width: 100%; max-height: 100%; outline: none;
  background: linear-gradient(160deg, rgba(38, 30, 60, 0.84), rgba(14, 10, 28, 0.9) 60%, rgba(20, 14, 34, 0.9));
  -webkit-backdrop-filter: blur(20px) saturate(1.2); backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid var(--hx-gold-a); border-radius: 4px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 0, 0, 0.7), 0 0 60px rgba(120, 90, 200, 0.12), inset 0 0 80px rgba(120, 90, 200, 0.07);
  animation: hx-panelin 0.5s var(--hx-ease) both;
}
.hx-panel.hx-closing { animation: hx-panelout 0.2s ease-in forwards; }
.hx-panel::before { content: ''; position: absolute; inset: 7px; border: 1px solid var(--hx-gold-b); border-radius: 2px; pointer-events: none; }
.hx-panel::after { content: ''; position: absolute; left: 12%; right: 12%; top: 0; height: 1px; background: linear-gradient(90deg, transparent, #fff2c4, transparent); opacity: 0.7; pointer-events: none; }
.hx-c { position: absolute; width: 44px; height: 44px; pointer-events: none; background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 44'%3E%3Cg fill='none' stroke='%23e6c477' stroke-width='1.2' stroke-linecap='round'%3E%3Cpath d='M3 42V10Q3 3 10 3H42'/%3E%3Cpath d='M10 42V17Q10 10 17 10H42' opacity='.35'/%3E%3Cpath d='M14 14Q22 14 22 22Q22 14 30 14' opacity='.0'/%3E%3C/g%3E%3Cpath d='M17 17l4-4 4 4-4 4z' fill='%23e6c477'/%3E%3Ccircle cx='10' cy='10' r='2' fill='%23fff2c4'/%3E%3Ccircle cx='3' cy='42' r='1.6' fill='%23e6c477'/%3E%3Ccircle cx='42' cy='3' r='1.6' fill='%23e6c477'/%3E%3C/svg%3E"); filter: drop-shadow(0 0 4px rgba(230, 196, 119, 0.4)); }
.hx-c.tl { left: -3px; top: -3px; } .hx-c.tr { right: -3px; top: -3px; transform: scaleX(-1); }
.hx-c.bl { left: -3px; bottom: -3px; transform: scaleY(-1); } .hx-c.br { right: -3px; bottom: -3px; transform: scale(-1, -1); }
.hx-head { position: relative; display: flex; align-items: center; gap: 20px; padding: 18px 28px 0 30px; flex: none; }
.hx-title-txt { font-family: var(--hx-display); font-weight: 700; font-size: clamp(18px, 2.2vw, 26px); letter-spacing: 0.14em; text-transform: uppercase; margin: 0; }
.hx-sub-txt { font-style: italic; color: var(--hx-dim); font-size: 17px; }
.hx-head-grow { flex: 1; }
.hx-tabs { display: flex; gap: clamp(10px, 2vw, 26px); }
.hx-tab { position: relative; padding: 8px 4px; font-family: var(--hx-caps); font-weight: 600; font-size: clamp(11px, 1.2vw, 14px); letter-spacing: 0.28em; text-transform: uppercase; color: var(--hx-dim); transition: color 0.25s; }
.hx-tab::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--hx-gold); transform: scaleX(0); transition: transform 0.35s var(--hx-ease); box-shadow: 0 0 8px var(--hx-gold); }
.hx-tab:hover { color: var(--hx-text); }
.hx-tab.on { color: var(--hx-gold-hi); }
.hx-tab.on::after { transform: scaleX(1); }
.hx-x { position: relative; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--hx-gold-a); flex: none; transition: transform 0.3s var(--hx-ease), background 0.25s, box-shadow 0.25s; pointer-events: auto; }
.hx-x::before, .hx-x::after { content: ''; position: absolute; left: 50%; top: 50%; width: 14px; height: 1.5px; background: var(--hx-gold); margin: -0.75px 0 0 -7px; transform: rotate(45deg); }
.hx-x::after { transform: rotate(-45deg); }
.hx-x:hover { background: rgba(230, 196, 119, 0.15); box-shadow: 0 0 14px rgba(230, 196, 119, 0.4); transform: rotate(90deg); }
.hx-flourish { display: block; width: calc(100% - 60px); height: 10px; margin: 8px auto 0; flex: none; opacity: 0.9; }
.hx-body { position: relative; flex: 1; min-height: 0; display: flex; padding: 14px 30px 26px; }
.hx-scroll { overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: rgba(230, 196, 119, 0.5) transparent; }
.hx-scroll::-webkit-scrollbar { width: 8px; }
.hx-scroll::-webkit-scrollbar-thumb { background: rgba(230, 196, 119, 0.4); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
.hx-scroll::-webkit-scrollbar-thumb:hover { background: rgba(230, 196, 119, 0.7); background-clip: padding-box; border: 2px solid transparent; }
.hx-btn {
  position: relative; padding: 11px 26px; font-family: var(--hx-caps); font-weight: 600; font-size: 13px; letter-spacing: 0.26em; text-transform: uppercase; color: #fff2cc;
  border: 1px solid rgba(240, 206, 130, 0.7); border-radius: 2px; background: linear-gradient(180deg, rgba(112, 78, 22, 0.5), rgba(40, 26, 8, 0.7));
  box-shadow: inset 0 0 16px rgba(255, 200, 100, 0.1); transition: transform 0.25s var(--hx-ease), box-shadow 0.25s, background 0.25s; pointer-events: auto;
}
.hx-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(240, 180, 70, 0.3), inset 0 0 20px rgba(255, 200, 100, 0.22); }
.hx-btn.ghost { background: rgba(10, 8, 20, 0.4); border-color: var(--hx-gold-a); color: var(--hx-text); }

/* ----- inventory ----- */
.hx-inv { width: min(1080px, 96vw); height: min(720px, 90vh); }
.hx-inv .hx-body { gap: 26px; }
.hx-inv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hx-summary { display: flex; align-items: baseline; gap: 14px; flex: none; margin-bottom: 10px; }
.hx-summary b { font-family: var(--hx-display); font-weight: 700; font-size: 22px; color: var(--hx-gold-hi); letter-spacing: 0.06em; }
.hx-summary span { font-style: italic; color: var(--hx-dim); font-size: 17px; }
.hx-prog { flex: none; height: 3px; background: rgba(230, 196, 119, 0.15); margin-bottom: 14px; position: relative; }
.hx-prog i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--hx-gold-lo), var(--hx-gold-hi)); box-shadow: 0 0 10px rgba(240, 196, 100, 0.7); transition: width 0.6s var(--hx-ease); }
.hx-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); grid-auto-rows: min-content; gap: 10px; padding: 4px 8px 8px 4px; align-content: start; }
.hx-cell {
  position: relative; aspect-ratio: 1; border-radius: 6px; padding: 8px; pointer-events: auto;
  background: radial-gradient(circle at 50% 35%, rgba(70, 58, 104, 0.38), rgba(12, 9, 24, 0.6)); border: 1px solid rgba(230, 196, 119, 0.2);
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.5); transition: transform 0.25s var(--hx-ease), border-color 0.25s, box-shadow 0.25s;
}
.hx-cell canvas { width: 100%; height: 100%; transition: filter 0.3s; }
.hx-cell:hover, .hx-cell.on { transform: translateY(-2px); border-color: var(--hx-gold); box-shadow: 0 6px 22px rgba(0, 0, 0, 0.5), 0 0 16px rgba(230, 196, 119, 0.25), inset 0 0 14px rgba(0, 0, 0, 0.5); }
.hx-cell .hx-n { position: absolute; right: 5px; bottom: 3px; font-family: var(--hx-caps); font-weight: 700; font-size: 12px; color: #fff; text-shadow: 0 1px 3px #000, 0 0 4px #000; }
.hx-cell.lock canvas { filter: brightness(0) contrast(2) opacity(0.38); }
.hx-cell.lock { border-style: dashed; border-color: rgba(230, 196, 119, 0.14); }
.hx-cell.lock:hover canvas { filter: brightness(0) contrast(2) opacity(0.55); }
.hx-cell.lock::after { content: '?'; position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--hx-display); font-size: 22px; color: rgba(230, 196, 119, 0.55); }
.hx-bcell { aspect-ratio: auto; padding: 8px 6px 6px; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.hx-bcell canvas { width: 46px; height: 46px; flex: none; image-rendering: pixelated; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7), 0 3px 8px rgba(0, 0, 0, 0.5); }
.hx-bcell .hx-bn { font-size: 14px; line-height: 1.05; text-align: center; color: var(--hx-text); max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 2.1em; }
.hx-bcell .hx-n { position: static; font-size: 11px; color: var(--hx-gold); text-shadow: none; }
.hx-bcell.sel { border-color: var(--hx-gold); background: radial-gradient(circle at 50% 30%, rgba(230, 196, 119, 0.25), rgba(12, 9, 24, 0.6)); box-shadow: 0 0 0 1px var(--hx-gold), 0 0 22px rgba(230, 196, 119, 0.4), inset 0 0 14px rgba(0, 0, 0, 0.4); }
.hx-bcell.sel::after { content: ''; position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; background: var(--hx-gold); transform: rotate(45deg); box-shadow: 0 0 8px var(--hx-gold); }
.hx-search { flex: none; margin-bottom: 12px; display: flex; gap: 12px; align-items: center; }
.hx-search input {
  flex: 1; max-width: 320px; padding: 8px 14px; font: italic 17px var(--hx-body); color: var(--hx-text); background: rgba(8, 6, 16, 0.6); border: 1px solid var(--hx-gold-b); border-radius: 20px; outline: none; user-select: text; -webkit-user-select: text; pointer-events: auto;
}
.hx-search input:focus { border-color: var(--hx-gold); box-shadow: 0 0 12px rgba(230, 196, 119, 0.25); }
.hx-search span { color: var(--hx-dim); font-style: italic; }
.hx-detail { width: clamp(200px, 26%, 270px); flex: none; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 18px 16px; border-radius: 6px; border: 1px solid var(--hx-gold-b); background: linear-gradient(180deg, rgba(40, 32, 66, 0.4), rgba(10, 8, 20, 0.5)); overflow-y: auto; }
.hx-detail-ic { position: relative; width: 132px; height: 132px; flex: none; display: grid; place-items: center; }
.hx-detail-ic::before { content: ''; position: absolute; inset: -6px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--dc, #e6c477) 38%, transparent), transparent 70%); }
.hx-detail-ic canvas { position: relative; width: 120px; height: 120px; }
.hx-detail-ic.pix canvas { width: 92px; height: 92px; image-rendering: pixelated; box-shadow: 0 0 0 1px #000, 0 8px 24px rgba(0, 0, 0, 0.6); border-radius: 4px; }
.hx-detail-ic.lock canvas { filter: brightness(0) contrast(2) opacity(0.4); }
.hx-detail-name { font-family: var(--hx-display); font-weight: 700; font-size: 18px; letter-spacing: 0.06em; color: var(--hx-gold-hi); line-height: 1.2; }
.hx-detail-desc { font-style: italic; font-size: 18px; color: var(--hx-text); opacity: 0.9; line-height: 1.3; }
.hx-detail-meta { font-family: var(--hx-caps); font-size: 11px; letter-spacing: 0.25em; text-transform: uppercase; color: var(--hx-gold); }
.hx-detail .hx-rule-s { width: 70%; height: 8px; }

/* ----- map ----- */
.hx-mapp { width: min(1240px, 98vw); height: min(800px, 94vh); }
.hx-mapp .hx-body { padding: 12px 24px 22px; gap: 16px; }
.hx-wplist { width: clamp(150px, 19%, 220px); flex: none; display: flex; flex-direction: column; gap: 2px; padding-right: 4px; }
.hx-wp-h { font-family: var(--hx-caps); font-size: 10px; letter-spacing: 0.4em; text-transform: uppercase; color: var(--hx-gold); margin: 2px 0 8px; }
.hx-wpi { text-align: left; padding: 7px 10px; font-size: 17px; border-left: 2px solid transparent; color: var(--hx-dim); transition: all 0.2s; pointer-events: auto; display: flex; align-items: center; gap: 8px; }
.hx-wpi::before { content: ''; width: 6px; height: 6px; transform: rotate(45deg); background: var(--hx-gold-lo); flex: none; }
.hx-wpi:hover { color: var(--hx-text); background: rgba(230, 196, 119, 0.08); }
.hx-wpi.on { color: var(--hx-gold-hi); border-left-color: var(--hx-gold); background: linear-gradient(90deg, rgba(230, 196, 119, 0.16), transparent); }
.hx-mapvp {
  position: relative; flex: 1; min-width: 0; overflow: hidden; border: 1px solid var(--hx-gold-a); border-radius: 3px; background: #0b0916; cursor: grab; touch-action: none; pointer-events: auto;
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.45), inset 0 0 0 4px rgba(230, 196, 119, 0.2);
}
.hx-mapvp.drag { cursor: grabbing; }
.hx-mapvp > canvas.hx-mapcv { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.hx-mapvig { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 90px 20px rgba(6, 4, 14, 0.75); background: linear-gradient(180deg, rgba(240, 200, 120, 0.05), rgba(40, 20, 60, 0.12)); mix-blend-mode: normal; }
.hx-maplayer { position: absolute; inset: 0; pointer-events: none; }
.hx-pin { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; }
.hx-pin button { position: absolute; left: -12px; top: -30px; width: 24px; height: 32px; pointer-events: auto; transition: transform 0.2s var(--hx-ease); transform-origin: 50% 100%; }
.hx-pin button svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 6px rgba(255, 210, 110, 0.6)); }
.hx-pin button:hover, .hx-pin.on button { transform: scale(1.3); }
.hx-pin .lbl { position: absolute; left: 50%; top: 6px; transform: translateX(-50%); white-space: nowrap; font-family: var(--hx-caps); font-weight: 600; font-size: 11px; letter-spacing: 0.14em; color: #fff3cc; text-shadow: 0 0 4px #000, 0 0 8px #000, 0 1px 2px #000; pointer-events: none; opacity: 0.95; }
.hx-pin.on .lbl { color: #fff; font-size: 12px; }
.hx-mapvp.nolabels .hx-pin:not(.on) .lbl { opacity: 0; transition: opacity 0.2s; }
.hx-mapvp.nolabels .hx-pin:hover .lbl { opacity: 1; }
.hx-pin:hover { z-index: 5; }
.hx-you { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; }
.hx-you .ring { position: absolute; left: -18px; top: -18px; width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid rgba(120, 220, 255, 0.8); animation: hx-ping 2s ease-out infinite; }
.hx-you svg { position: absolute; left: -13px; top: -15px; width: 26px; height: 30px; overflow: visible; filter: drop-shadow(0 0 5px rgba(120, 220, 255, 0.9)) drop-shadow(0 1px 2px #000); }
.hx-you .lbl { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); font-family: var(--hx-caps); font-size: 10px; letter-spacing: 0.3em; color: #bfeaff; text-shadow: 0 0 4px #000, 0 0 8px #000; }
.hx-mapinfo { position: absolute; left: 50%; bottom: 16px; transform: translate(-50%, 14px); opacity: 0; pointer-events: none; display: flex; align-items: center; gap: 16px; padding: 10px 14px 10px 20px; border: 1px solid var(--hx-gold-a); border-radius: 3px; background: rgba(12, 9, 24, 0.86); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); transition: opacity 0.25s, transform 0.3s var(--hx-ease); max-width: 94%; }
.hx-mapinfo.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.hx-mapinfo b { font-family: var(--hx-display); font-size: 16px; letter-spacing: 0.08em; color: var(--hx-gold-hi); display: block; }
.hx-mapinfo small { font-style: italic; color: var(--hx-dim); font-size: 14px; }
.hx-mapctl { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; }
.hx-mapctl button { width: 34px; height: 34px; border: 1px solid var(--hx-gold-a); border-radius: 3px; background: rgba(12, 9, 24, 0.75); font-family: var(--hx-caps); font-size: 18px; color: var(--hx-gold-hi); pointer-events: auto; transition: background 0.2s; display: grid; place-items: center; }
.hx-mapctl button:hover { background: rgba(230, 196, 119, 0.22); }
.hx-mapctl svg { width: 18px; height: 18px; }
.hx-mapcoord { position: absolute; left: 12px; bottom: 10px; font-family: var(--hx-caps); font-size: 11px; letter-spacing: 0.16em; color: rgba(244, 234, 210, 0.7); text-shadow: 0 1px 4px #000; pointer-events: none; }
.hx-rose { position: absolute; left: 12px; top: 12px; width: 62px; height: 62px; pointer-events: none; opacity: 0.9; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.7)); }
.hx-maphelp { position: absolute; right: 14px; bottom: 10px; font-size: 14px; font-style: italic; color: rgba(244, 234, 210, 0.5); pointer-events: none; }

/* ----- menu ----- */
.hx-menu { width: min(940px, 96vw); height: min(680px, 92vh); }
.hx-menu .hx-body { padding: 8px 0 0; gap: 0; }
.hx-nav { width: clamp(150px, 24%, 230px); flex: none; display: flex; flex-direction: column; gap: 6px; padding: 18px 20px 24px 30px; border-right: 1px solid var(--hx-gold-b); }
.hx-nav .hx-crest-s { width: 56px; height: 56px; margin: 0 0 6px 4px; filter: drop-shadow(0 0 8px rgba(240, 196, 100, 0.5)); }
.hx-nav .hx-crest-s svg { width: 100%; height: 100%; }
.hx-navb { text-align: left; padding: 12px 6px; font-family: var(--hx-caps); font-weight: 600; font-size: 13px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--hx-dim); position: relative; transition: color 0.2s, padding 0.3s var(--hx-ease); pointer-events: auto; }
.hx-navb::before { content: ''; position: absolute; left: -14px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; transform: rotate(45deg) scale(0); background: var(--hx-gold); box-shadow: 0 0 10px var(--hx-gold); transition: transform 0.3s var(--hx-ease); }
.hx-navb:hover { color: var(--hx-text); padding-left: 12px; }
.hx-navb.on { color: var(--hx-gold-hi); padding-left: 12px; }
.hx-navb.on::before { transform: rotate(45deg) scale(1); }
.hx-navb.primary { margin-bottom: 8px; padding: 14px 16px; color: #fff2cc; border: 1px solid rgba(240, 206, 130, 0.7); background: linear-gradient(180deg, rgba(112, 78, 22, 0.5), rgba(40, 26, 8, 0.7)); text-align: center; border-radius: 2px; box-shadow: inset 0 0 16px rgba(255, 200, 100, 0.12); }
.hx-navb.primary:hover { padding-left: 16px; box-shadow: 0 6px 24px rgba(240, 180, 70, 0.3), inset 0 0 20px rgba(255, 200, 100, 0.22); }
.hx-navb.primary::before { display: none; }
.hx-nav-foot { margin-top: auto; font-style: italic; font-size: 15px; color: rgba(244, 234, 210, 0.45); }
.hx-menu-main { flex: 1; min-width: 0; padding: 14px 30px 28px 32px; }
.hx-sect { font-family: var(--hx-caps); font-weight: 600; font-size: 12px; letter-spacing: 0.4em; text-transform: uppercase; color: var(--hx-gold); margin: 20px 0 6px; display: flex; align-items: center; gap: 12px; }
.hx-sect:first-child { margin-top: 4px; }
.hx-sect::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--hx-gold-b), transparent); }
.hx-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 9px 0; border-bottom: 1px solid rgba(230, 196, 119, 0.07); min-height: 48px; }
.hx-row > label, .hx-row > .hx-lab { font-size: 19px; color: var(--hx-text); flex: 0 1 auto; }
.hx-row .hx-lab small { display: block; font-size: 14px; font-style: italic; color: var(--hx-dim); }
.hx-ctl { display: flex; align-items: center; gap: 14px; flex: 0 0 min(300px, 52%); justify-content: flex-end; }
.hx-val { min-width: 54px; text-align: right; font-family: var(--hx-caps); font-size: 12px; letter-spacing: 0.1em; color: var(--hx-gold-hi); }
.hx-range { -webkit-appearance: none; appearance: none; flex: 1; height: 4px; border-radius: 2px; outline: none; cursor: pointer; pointer-events: auto; --p: 50%; background: linear-gradient(90deg, var(--hx-gold-lo), var(--hx-gold) var(--p), rgba(255, 255, 255, 0.14) var(--p)); }
.hx-range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; transform: rotate(45deg); border: 1px solid #fff2c4; border-radius: 2px; background: linear-gradient(135deg, #fff2c4, #c8923a); box-shadow: 0 0 10px rgba(240, 196, 100, 0.8); transition: transform 0.2s; }
.hx-range::-moz-range-thumb { width: 14px; height: 14px; transform: rotate(45deg); border: 1px solid #fff2c4; border-radius: 2px; background: linear-gradient(135deg, #fff2c4, #c8923a); box-shadow: 0 0 10px rgba(240, 196, 100, 0.8); }
.hx-range:active::-webkit-slider-thumb { transform: rotate(45deg) scale(1.25); }
.hx-seg { display: flex; border: 1px solid var(--hx-gold-a); border-radius: 2px; overflow: hidden; }
.hx-seg button { padding: 7px 13px; font-family: var(--hx-caps); font-weight: 600; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--hx-dim); transition: all 0.2s; pointer-events: auto; }
.hx-seg button + button { border-left: 1px solid var(--hx-gold-b); }
.hx-seg button:hover { color: var(--hx-text); background: rgba(230, 196, 119, 0.08); }
.hx-seg button.on { color: #1a1020; background: linear-gradient(180deg, #fff2c4, #d9a940); box-shadow: 0 0 14px rgba(240, 196, 100, 0.5); }
.hx-sw { position: relative; width: 48px; height: 24px; border-radius: 12px; border: 1px solid var(--hx-gold-a); background: rgba(8, 6, 16, 0.7); transition: background 0.3s, box-shadow 0.3s; pointer-events: auto; flex: none; }
.hx-sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #8a8294; transition: transform 0.3s var(--hx-ease), background 0.3s, box-shadow 0.3s; }
.hx-sw.on { background: rgba(230, 196, 119, 0.22); box-shadow: 0 0 14px rgba(230, 196, 119, 0.35); }
.hx-sw.on::after { transform: translateX(24px); background: linear-gradient(135deg, #fff2c4, #d9a940); box-shadow: 0 0 10px rgba(255, 220, 130, 0.9); }
.hx-keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 30px; }
.hx-keyrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid rgba(230, 196, 119, 0.07); font-size: 19px; }
.hx-keyrow .ks { display: flex; gap: 5px; flex: none; }

/* ----- spellbook ----- */
.hx-book { width: min(1040px, 96vw); height: min(700px, 90vh); background: linear-gradient(160deg, rgba(40, 30, 22, 0.88), rgba(16, 11, 10, 0.92)); border-color: rgba(230, 196, 119, 0.7); }
.hx-book .hx-body { padding: 18px 26px 26px; }
.hx-pages { position: relative; flex: 1; display: flex; min-height: 0; border-radius: 3px; overflow: hidden; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.6); color: #3a2812; font-family: var(--hx-fell); }
.hx-page { flex: 1; min-width: 0; padding: clamp(14px, 3vh, 30px) clamp(16px, 3vw, 38px); position: relative; background: radial-gradient(ellipse at 50% 50%, #f1e3bc 0%, #e2cd9a 70%, #cdb27a 100%); }
.hx-page.l { box-shadow: inset -26px 0 30px -20px rgba(70, 40, 10, 0.55); }
.hx-page.r { box-shadow: inset 26px 0 30px -20px rgba(70, 40, 10, 0.55); display: flex; flex-direction: column; align-items: center; text-align: center; overflow-y: auto; }
.hx-page::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.35; background-image: repeating-linear-gradient(0deg, rgba(120, 80, 30, 0.05) 0 1px, transparent 1px 3px), radial-gradient(ellipse at 20% 20%, rgba(140, 90, 30, 0.2), transparent 50%); }
.hx-spine { width: 3px; background: linear-gradient(180deg, #4a2c10, #2a1608); box-shadow: 0 0 12px rgba(0, 0, 0, 0.6); flex: none; }
.hx-page h3 { font-family: var(--hx-display); font-weight: 700; font-size: 20px; letter-spacing: 0.16em; text-transform: uppercase; color: #5a3a12; margin: 0 0 4px; text-align: center; }
.hx-page .hx-sm { text-align: center; font-style: italic; color: #7a5a2c; font-size: 16px; margin-bottom: 8px; }
.hx-splist { display: flex; flex-direction: column; gap: 2px; max-height: calc(100% - 64px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: #a07a38 transparent; padding-right: 4px; }
.hx-spi { display: flex; align-items: center; gap: 12px; padding: 6px 10px; text-align: left; border-radius: 3px; transition: background 0.2s; color: #3a2812; pointer-events: auto; }
.hx-spi canvas { width: 40px; height: 40px; flex: none; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #3a3058, #130e22); box-shadow: 0 0 0 1px #8a6420, 0 2px 5px rgba(0, 0, 0, 0.4); padding: 4px; }
.hx-spi b { font-family: var(--hx-caps); font-weight: 700; font-size: 14px; letter-spacing: 0.14em; text-transform: uppercase; display: block; }
.hx-spi i { font-size: 16px; color: #7a5a2c; }
.hx-spi:hover { background: rgba(120, 80, 30, 0.12); }
.hx-spi.on { background: linear-gradient(90deg, rgba(120, 80, 30, 0.26), rgba(120, 80, 30, 0.06)); box-shadow: inset 3px 0 0 #8a5a14; }
.hx-bigmed { position: relative; width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; margin: 4px 0 10px; background: radial-gradient(circle at 35% 30%, #3a3058, #0e0a1a); box-shadow: 0 0 0 3px #c8923a, 0 0 0 5px rgba(80, 50, 10, 0.6), 0 10px 28px rgba(0, 0, 0, 0.5), 0 0 40px color-mix(in srgb, var(--sc, #fff) 50%, transparent); flex: none; }
.hx-bigmed canvas { width: 118px; height: 118px; }
.hx-inc { font-family: var(--hx-display); font-weight: 900; font-size: clamp(24px, 3.2vw, 38px); letter-spacing: 0.06em; color: color-mix(in srgb, var(--sc, #8a5a14) 22%, #3a1a06); text-shadow: 0 1px 0 rgba(255, 245, 210, 0.6); }
.hx-page .hx-sdesc { font-size: clamp(18px, 1.8vw, 22px); line-height: 1.35; margin: 10px 0; color: #3a2812; max-width: 420px; }
.hx-page .hx-orn { width: 160px; height: 10px; margin: 6px auto; opacity: 0.8; }

/* ============================ ANIMATIONS ============================ */
@keyframes hx-rise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes hx-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes hx-sheen { 0% { background-position: -160% 0; } 40%, 100% { background-position: 260% 0; } }
@keyframes hx-btnsheen { 0% { left: -60%; opacity: 0; } 8% { opacity: 1; } 28%, 100% { left: 130%; opacity: 0; } }
@keyframes hx-glowpulse { 0%, 100% { box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.25), 0 0 0 5px rgba(230, 196, 119, 0.28), 0 8px 30px rgba(0, 0, 0, 0.55), 0 0 18px rgba(240, 180, 70, 0.2), inset 0 0 22px rgba(255, 200, 100, 0.15); } 50% { box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.25), 0 0 0 5px rgba(240, 206, 130, 0.5), 0 8px 30px rgba(0, 0, 0, 0.55), 0 0 40px rgba(240, 180, 70, 0.45), inset 0 0 28px rgba(255, 200, 100, 0.25); } }
@keyframes hx-breathe { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }
@keyframes hx-spin { to { transform: rotate(360deg); } }
@keyframes hx-twinkle { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(0.72) rotate(45deg); } }
@keyframes hx-swap { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes hx-slotglow { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.18); } }
@keyframes hx-slotcast { 0% { transform: translateY(-6px) scale(1.14); } 30% { transform: translateY(-9px) scale(1.34); } 100% { transform: translateY(-6px) scale(1.14); } }
@keyframes hx-ripple { from { transform: scale(1); opacity: 0.9; } to { transform: scale(2.1); opacity: 0; } }
@keyframes hx-incant { 0% { opacity: 0; transform: scale(0.82); letter-spacing: -0.02em; filter: blur(8px); } 14% { opacity: 1; transform: scale(1.04); letter-spacing: 0.06em; filter: blur(0); } 60% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: translateY(-18px) scale(1.08); letter-spacing: 0.14em; filter: blur(3px); } }
@keyframes hx-loc { 0% { opacity: 0; transform: translateY(10px) scale(0.97); } 18% { opacity: 1; transform: none; } 78% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-6px) scale(1.02); } }
@keyframes hx-draw { to { stroke-dashoffset: 0; } }
@keyframes hx-fadein { to { opacity: 1; } }
@keyframes hx-toastin { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes hx-toastout { to { opacity: 0; transform: translateX(30px); } }
@keyframes hx-itemin { 0% { opacity: 0; transform: translateX(60px) scale(0.9); } 60% { opacity: 1; transform: translateX(-6px) scale(1.04); } 100% { transform: none; } }
@keyframes hx-spark { 0% { transform: translate(0, 0) scale(1); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; } }
@keyframes hx-panelin { from { opacity: 0; transform: translateY(18px) scale(0.965); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes hx-panelout { to { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes hx-ping { 0% { transform: scale(0.5); opacity: 1; } 100% { transform: scale(1.7); opacity: 0; } }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 860px) {
  .hx-inv .hx-body { flex-direction: column; gap: 12px; padding: 12px 18px 18px; }
  .hx-detail { width: 100%; flex-direction: row; text-align: left; gap: 14px; padding: 10px 14px; max-height: 150px; flex: none; }
  .hx-detail-ic { width: 76px; height: 76px; } .hx-detail-ic canvas { width: 70px; height: 70px; } .hx-detail-ic.pix canvas { width: 56px; height: 56px; }
  .hx-detail-name { font-size: 15px; } .hx-detail-desc { font-size: 16px; }
  .hx-wplist { display: none; }
  .hx-menu .hx-body { flex-direction: column; }
  .hx-nav { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 18px; border-right: 0; border-bottom: 1px solid var(--hx-gold-b); gap: 4px 12px; }
  .hx-nav .hx-crest-s, .hx-nav-foot { display: none; }
  .hx-navb { padding: 8px 4px; } .hx-navb.primary { margin: 0 8px 0 0; padding: 10px 16px; } .hx-navb::before { display: none; }
  .hx-menu-main { padding: 6px 18px 22px; }
  .hx-ctl { flex-basis: 56%; }
  .hx-pages { flex-direction: column; overflow-y: auto; }
  .hx-spine { width: auto; height: 3px; }
  .hx-page.r { overflow: visible; }
  .hx-splist { max-height: 180px; }
  .hx-head { padding: 14px 16px 0 18px; gap: 10px; flex-wrap: wrap; }
  .hx-flourish { width: calc(100% - 36px); }
}
@media (max-width: 600px) {
  .hx-root { font-size: 16px; }
  .hx-toasts { top: 104px; }
  .hx-clock { left: auto; right: -2px; top: 40px; margin: 0; }
  .hx-compass { width: min(62vw, 300px); }
  .hx-ctrl-sum { font-size: 13px; gap: 6px 14px; }
  .hx-house { width: calc(50% - 8px); max-width: 160px; }
  .hx-keys { grid-template-columns: 1fr; }
  .hx-spellbar { --s: min(40px, calc((100vw - 50px) / 9)); }
  .hx-slots { gap: 4px; }
  .hx-broom { bottom: 100px; width: 104px; }
  .hx-held { position: absolute; left: auto; right: 0; bottom: calc(100% + 28px); margin: 0; }
  .hx-held::before { display: none; }
  .hx-spellinfo { min-height: 40px; }
  .hx-row { flex-wrap: wrap; } .hx-ctl { flex-basis: 100%; }
  .hx-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; }
  .hx-mapp .hx-body { padding: 8px 10px 12px; }
  .hx-rose, .hx-maphelp { display: none; }
}
@media (max-height: 640px) {
  .hx-ctrl-sum { display: none; }
  .hx-house-traits { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hx-root *, .hx-root *::before, .hx-root *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Once the world is ready, let the live castle flyover show through the title screen. */
.hx-title { transition: opacity 1.1s ease, visibility 0s linear 1.1s, transform 1.4s var(--hx-ease), background-color 2.5s ease; }
.hx-title.hx-ready { background: radial-gradient(ellipse at 50% 42%, rgba(7,5,15,.05) 0%, rgba(7,5,15,.25) 55%, rgba(7,5,15,.7) 100%); }
.hx-title.hx-ready .hx-title-vig { opacity: .55; transition: opacity 3s ease; }
.hx-title-bg { transition: opacity 3s ease; }
.hx-title.hx-ready .hx-title-bg { opacity: .08; }
