/* KINGDOMFALL — UI design system: dark fantasy luxury.
   Obsidian glass, aged gold filigree, ember accents, engraved serif type. */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400&display=swap');

:root {
  --ink: #07080c;
  --obsidian: rgba(10, 11, 16, 0.78);
  --glass: rgba(18, 17, 24, 0.62);
  --glass-hi: rgba(40, 34, 30, 0.55);
  --gold: #c9a45c;
  --gold-hi: #f0d08a;
  --gold-dim: #7a6236;
  --ember: #ff7a2e;
  --blood: #b3202a;
  --blood-hi: #e2463c;
  --stamina: #b9c46a;
  --mana: #4f8fe0;
  --parchment: #e9dfc8;
  --text: #e6ddcb;
  --mute: #9a917f;
  --line: rgba(201, 164, 92, 0.35);
  --serif: 'Cormorant Garamond', Georgia, serif;
  --display: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --r-common: #a9b0b8; --r-uncommon: #6fbf73; --r-rare: #4f9be8; --r-epic: #a86ef0; --r-legendary: #f0a53c; --r-mythic: #ff4d5e;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--text); font-family: var(--serif); user-select: none; -webkit-user-select: none; }
canvas#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; outline: none; }
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#ui .interactive, #ui button, #ui .menu { pointer-events: auto; }
.hidden { display: none !important; }

/* ------------------------------------------------ frames */
.frame { position: relative; background: linear-gradient(180deg, rgba(22,20,26,.82), rgba(10,10,14,.9)); border: 1px solid var(--line);
  box-shadow: 0 0 0 1px rgba(0,0,0,.6), inset 0 0 24px rgba(0,0,0,.6), 0 10px 40px rgba(0,0,0,.45); }
.frame::before, .frame::after { content: ''; position: absolute; width: 14px; height: 14px; border: 1px solid var(--gold); opacity: .8; }
.frame::before { top: -4px; left: -4px; border-right: none; border-bottom: none; }
.frame::after { bottom: -4px; right: -4px; border-left: none; border-top: none; }
.rule { height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: .55; margin: 10px 0; }
.display { font-family: var(--display); letter-spacing: .14em; text-transform: uppercase; }
.gold { color: var(--gold-hi); }
.mute { color: var(--mute); }

/* ------------------------------------------------ vitals */
#vitals { position: absolute; left: 34px; top: 30px; width: 380px; }
#vitals .row { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
#vitals .lvl { width: 46px; height: 46px; border: 1px solid var(--gold); transform: rotate(45deg); display: grid; place-items: center; background: radial-gradient(circle, #2a2118, #0c0a0a); box-shadow: 0 0 14px rgba(201,164,92,.25); margin-right: 8px; }
#vitals .lvl span { transform: rotate(-45deg); font-family: var(--display); font-size: 17px; color: var(--gold-hi); }
.bar { position: relative; height: 12px; background: rgba(0,0,0,.65); border: 1px solid rgba(201,164,92,.4); overflow: hidden; }
.bar .ghost, .bar .fill { position: absolute; left: 0; top: 0; bottom: 0; }
.bar .ghost { background: rgba(255,235,200,.55); transition: width .6s ease .35s; }
.bar .fill { transition: width .08s linear; }
.bar.hp { height: 14px; } .bar.hp .fill { background: linear-gradient(180deg, var(--blood-hi), var(--blood) 55%, #6d1016); box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.bar.st .fill { background: linear-gradient(180deg, #d6df8a, var(--stamina) 55%, #6b7430); }
.bar.mp .fill { background: linear-gradient(180deg, #8fc0ff, var(--mana) 55%, #1f4f93); }
.bar.flash { animation: barflash .35s ease 2; }
@keyframes barflash { 50% { border-color: #fff; box-shadow: 0 0 12px rgba(255,255,255,.6); } }
.bar .tick { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(0,0,0,.5); }
#flasks { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-family: var(--display); font-size: 13px; color: var(--gold-hi); }
#flasks .flask { width: 26px; height: 32px; background: url('../public/lib/icons/PotionRed.png') center/contain no-repeat; filter: drop-shadow(0 0 6px rgba(255,90,40,.55)); }

/* ------------------------------------------------ compass + objective */
#compass { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); width: 520px; height: 34px; overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); }
#compass .strip { position: absolute; top: 0; height: 100%; white-space: nowrap; }
#compass .mark { position: absolute; top: 8px; transform: translateX(-50%); font-family: var(--display); font-size: 13px; color: var(--parchment); text-shadow: 0 0 6px #000; }
#compass .mark.minor { color: var(--mute); font-size: 10px; top: 11px; }
#compass .mark.quest { color: var(--gold-hi); font-size: 16px; top: 6px; text-shadow: 0 0 10px rgba(240,208,138,.8); }
#compass .mark.enemy { color: #ff5a4a; font-size: 10px; top: 20px; }
#compass::after { content: ''; position: absolute; left: 50%; bottom: 0; width: 1px; height: 8px; background: var(--gold); }
#compassLine { position: absolute; top: 55px; left: 50%; transform: translateX(-50%); width: 360px; height: 1px; background: linear-gradient(90deg, transparent, var(--line), transparent); }

#objective { position: absolute; right: 38px; top: 250px; width: 300px; text-align: right; }
#objective .qname { font-family: var(--display); font-size: 13px; letter-spacing: .16em; color: var(--gold-hi); text-transform: uppercase; }
#objective .qstep { font-size: 17px; margin-top: 4px; color: var(--parchment); text-shadow: 0 1px 4px #000; }
#objective .qdist { font-size: 13px; color: var(--mute); margin-top: 2px; }
#objective.pulse .qstep { animation: objPulse 1.4s ease; }
@keyframes objPulse { 0% { color: #fff; text-shadow: 0 0 16px var(--gold-hi); } 100% { color: var(--parchment); } }

/* ------------------------------------------------ minimap */
#minimap { position: absolute; right: 34px; top: 26px; width: 196px; height: 196px; border-radius: 50%; overflow: hidden;
  border: 1px solid var(--gold); box-shadow: 0 0 0 4px rgba(0,0,0,.55), 0 0 0 5px var(--gold-dim), 0 8px 30px rgba(0,0,0,.6); background: #0b0b0e; }
#minimap canvas { width: 100%; height: 100%; }
#minimapN { position: absolute; right: 124px; top: 12px; font-family: var(--display); font-size: 12px; color: var(--gold-hi); }

/* ------------------------------------------------ abilities */
#abilities { position: absolute; right: 38px; bottom: 34px; display: flex; gap: 10px; align-items: flex-end; }
.slot { position: relative; width: 58px; height: 58px; border: 1px solid var(--line); background: radial-gradient(circle at 50% 40%, rgba(60,48,38,.7), rgba(8,8,10,.92));
  box-shadow: inset 0 0 12px rgba(0,0,0,.8); display: grid; place-items: center; }
.slot.big { width: 74px; height: 74px; border-color: var(--gold); }
.slot img { width: 70%; height: 70%; object-fit: contain; filter: drop-shadow(0 0 4px rgba(0,0,0,.8)); }
.slot .key { position: absolute; left: 4px; top: 2px; font-family: var(--display); font-size: 11px; color: var(--gold-hi); }
.slot .cd { position: absolute; inset: 0; background: conic-gradient(rgba(0,0,0,.72) var(--cd, 0%), transparent 0); }
.slot .count { position: absolute; right: 4px; bottom: 2px; font-size: 13px; color: var(--parchment); }
.slot.locked { opacity: .35; }
.slot .res { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(0deg, rgba(240,180,80,.45), rgba(240,208,138,.15)); pointer-events: none; }
.slot.ready { border-color: var(--gold-hi); box-shadow: 0 0 18px rgba(240,208,138,.6), inset 0 0 12px rgba(0,0,0,.8); animation: availPulse 1.2s ease infinite; }
.slot .glyph { font-size: 26px; color: var(--ember); text-shadow: 0 0 10px rgba(255,120,40,.7); }

/* ------------------------------------------------ combat readouts */
#lockon { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border: 1.5px solid var(--gold-hi); transform: rotate(45deg); box-shadow: 0 0 12px rgba(240,208,138,.6); transition: opacity .15s; }
#lockon::after { content: ''; position: absolute; inset: 11px; background: var(--gold-hi); }
.ehp { position: absolute; width: 90px; height: 5px; margin-left: -45px; background: rgba(0,0,0,.7); border: 1px solid rgba(0,0,0,.9); }
.ehp .fill { height: 100%; background: linear-gradient(180deg, #e0463c, #8c1a1a); transition: width .1s; }
.ehp .poise { position: absolute; left: 0; right: 0; bottom: -4px; height: 2px; background: rgba(255,210,120,.0); }
.ehp .poise i { display: block; height: 100%; background: #f2c46a; }
.ehp.stag { box-shadow: 0 0 10px #ffcf6a; }
.ehp .nm { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); white-space: nowrap; font-size: 12px; color: var(--parchment); text-shadow: 0 0 4px #000, 0 0 2px #000; }
.alertmark { position: absolute; margin-left: -8px; font-family: var(--display); font-size: 26px; color: #ffcf6a; text-shadow: 0 0 10px #ff8a2a; animation: alertPop 1.2s ease forwards; }
@keyframes alertPop { 0% { transform: scale(.3); opacity: 0; } 15% { transform: scale(1.3); opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-12px); } }
.tellmark { position: absolute; margin-left: -9px; width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle, #fff 0, #ffb04a 35%, rgba(255,120,30,0) 70%); animation: tell .5s ease forwards; }
@keyframes tell { 0% { transform: scale(.2); opacity: 0; } 30% { transform: scale(1.6); opacity: 1; } 100% { transform: scale(1); opacity: 0; } }
.dmg { position: absolute; font-family: var(--display); font-weight: 700; font-size: 18px; color: #f4ead4; text-shadow: 0 0 4px #000, 0 2px 2px #000; animation: dmgUp .9s ease-out forwards; }
.dmg.crit { color: var(--gold-hi); font-size: 24px; }
.dmg.blocked { color: #9fb2c8; font-size: 14px; }
.dmg.player { color: #ff6b5e; }
@keyframes dmgUp { 0% { transform: translate(-50%, 0) scale(1.4); opacity: 1; } 100% { transform: translate(-50%, -46px) scale(.9); opacity: 0; } }

#callout { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); font-family: var(--display); font-weight: 700; font-size: 44px; letter-spacing: .3em;
  color: var(--gold-hi); text-shadow: 0 0 24px rgba(255,190,90,.8), 0 2px 0 #000; opacity: 0; white-space: nowrap; }
#callout.show { animation: callout 1.1s ease forwards; }
@keyframes callout { 0% { opacity: 0; letter-spacing: .6em; } 20% { opacity: 1; letter-spacing: .3em; } 75% { opacity: 1; } 100% { opacity: 0; letter-spacing: .36em; } }

/* ------------------------------------------------ boss bar */
#boss { position: absolute; left: 50%; bottom: 70px; transform: translateX(-50%); width: min(820px, 70vw); text-align: center; transition: opacity .6s; }
#boss .name { font-family: var(--display); font-size: 20px; letter-spacing: .28em; color: var(--parchment); text-shadow: 0 0 12px #000; margin-bottom: 8px; }
#boss .title { font-size: 14px; font-style: italic; color: var(--mute); margin-top: -4px; margin-bottom: 8px; }
#boss .bar { height: 14px; border-color: var(--gold-dim); }
#boss .bar .fill { background: linear-gradient(180deg, #d34a3c, #8a1616 60%, #4a0a0a); }
#boss .phases { position: absolute; inset: 0; pointer-events: none; }
#boss .phases i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--gold); box-shadow: 0 0 6px var(--gold); }

/* ------------------------------------------------ prompts / toasts */
#prompt { position: absolute; left: 50%; bottom: 22%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 9px 20px; font-size: 18px; opacity: 0; transition: opacity .2s; }
#prompt.show { opacity: 1; }
.kbd { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 7px; border: 1px solid var(--gold); color: var(--gold-hi); font-family: var(--display); font-size: 13px; background: rgba(0,0,0,.55); box-shadow: inset 0 -2px 0 rgba(201,164,92,.35); }
#toasts { position: absolute; left: 34px; bottom: 40%; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 12px; padding: 8px 18px 8px 10px; min-width: 260px; background: linear-gradient(90deg, rgba(10,10,14,.9), rgba(10,10,14,0)); border-left: 2px solid var(--gold); font-size: 17px; animation: toastIn .35s ease, toastOut .5s ease 3.4s forwards; }
.toast img { width: 30px; height: 30px; object-fit: contain; }
.toast .q { color: var(--mute); margin-left: 6px; }
.toast.warn { border-left-color: var(--blood-hi); }
@keyframes toastIn { from { transform: translateX(-30px); opacity: 0; } }
@keyframes toastOut { to { transform: translateX(-20px); opacity: 0; } }

#areaTitle { position: absolute; left: 50%; top: 24%; transform: translateX(-50%); text-align: center; opacity: 0; }
#areaTitle .t { font-family: var(--display); font-size: 46px; letter-spacing: .32em; color: var(--parchment); text-shadow: 0 0 30px rgba(0,0,0,.9); }
#areaTitle .s { font-size: 19px; font-style: italic; color: var(--gold); margin-top: 6px; }
#areaTitle.show { animation: areaT 5s ease forwards; }
@keyframes areaT { 0% { opacity: 0; letter-spacing: .5em; } 18% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }

#subtitle { position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%); max-width: 900px; text-align: center; font-size: 24px; line-height: 1.35; text-shadow: 0 0 8px #000, 0 2px 3px #000; opacity: 0; transition: opacity .4s; }
#subtitle.show { opacity: 1; }
#subtitle .who { font-family: var(--display); font-size: 14px; letter-spacing: .2em; color: var(--gold-hi); display: block; margin-bottom: 4px; }

/* ------------------------------------------------ dialogue */
#dialogue { position: absolute; left: 50%; bottom: 7%; transform: translateX(-50%); width: min(960px, 86vw); padding: 22px 32px 18px; pointer-events: auto; }
#dialogue .who { font-family: var(--display); letter-spacing: .2em; font-size: 15px; color: var(--gold-hi); }
#dialogue .role { font-size: 14px; font-style: italic; color: var(--mute); margin-left: 10px; }
#dialogue .text { font-size: 22px; line-height: 1.45; margin: 10px 0 14px; min-height: 64px; }
#dialogue .choices { display: flex; flex-direction: column; gap: 6px; }
#dialogue .choice { padding: 7px 14px; border: 1px solid transparent; font-size: 18px; color: var(--parchment); cursor: pointer; background: rgba(255,255,255,.02); transition: all .12s; }
#dialogue .choice:hover, #dialogue .choice.sel { border-color: var(--line); background: rgba(201,164,92,.12); color: #fff; padding-left: 20px; }
#dialogue .choice .n { color: var(--gold); font-family: var(--display); margin-right: 10px; }
#dialogue .choice.quest { color: var(--gold-hi); }
#dialogue .cont { text-align: right; font-size: 13px; color: var(--mute); }
#dialogue.hero .who { color: #9ec8ff; }
#dialogue.hero .text { font-style: italic; color: #e8eef8; }
#dialogue .dhead { display: flex; align-items: baseline; }
/* ambient NPC conversations: floating speech above heads */
.bubble { position: absolute; transform: translate(-50%, -100%); max-width: 300px; padding: 8px 12px 9px; background: linear-gradient(180deg, rgba(20,18,22,.88), rgba(8,8,10,.9)); border: 1px solid var(--line); color: var(--parchment); font-size: 15px; line-height: 1.35; pointer-events: none; opacity: 0; transition: opacity .35s; white-space: normal; text-align: left; }
.bubble.show { opacity: 1; }
.bubble b { display: block; font-family: var(--display); font-weight: 400; letter-spacing: .16em; font-size: 10px; color: var(--gold); margin-bottom: 2px; }
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px; background: rgba(8,8,10,.9); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); transform: translateX(-50%) rotate(45deg); }

/* ------------------------------------------------ screens */
.screen { position: fixed; inset: 0; z-index: 30; pointer-events: auto; display: flex; align-items: center; justify-content: center; }
#loading { background: radial-gradient(ellipse at 50% 60%, #1a1210 0%, #050507 70%); flex-direction: column; z-index: 50; transition: opacity 1s; }
#loading .logo { font-family: var(--display); font-weight: 900; font-size: clamp(38px, 6vw, 84px); letter-spacing: .12em; color: var(--parchment);
  background: linear-gradient(180deg, #fff3d6, #c9a45c 60%, #6a4f22); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 0 30px rgba(255,160,70,.25)); }
#loading .sub { font-family: var(--display); letter-spacing: .6em; font-size: 15px; color: var(--gold); margin-top: 10px; }
#loading .lbar { width: 420px; height: 2px; background: rgba(255,255,255,.08); margin-top: 60px; overflow: hidden; }
#loading .lbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-dim), var(--gold-hi)); box-shadow: 0 0 10px var(--gold); transition: width .3s; }
#loading .tip { margin-top: 18px; font-style: italic; color: var(--mute); font-size: 17px; max-width: 560px; text-align: center; min-height: 48px; }
#loading .embers { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.btn { font-family: var(--display); letter-spacing: .22em; text-transform: uppercase; font-size: 15px; color: var(--parchment); background: linear-gradient(180deg, rgba(40,34,28,.85), rgba(14,12,12,.9)); border: 1px solid var(--line);
  padding: 13px 34px; cursor: pointer; transition: all .15s; position: relative; }
.btn:hover, .btn.sel { color: #fff; border-color: var(--gold); box-shadow: 0 0 18px rgba(201,164,92,.25), inset 0 0 18px rgba(201,164,92,.12); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { border-color: var(--gold); color: var(--gold-hi); }

#title { background: transparent; flex-direction: column; justify-content: flex-end; padding-bottom: 9vh; z-index: 40; }
#title .logo { font-family: var(--display); font-weight: 900; font-size: clamp(44px, 7vw, 104px); letter-spacing: .1em; text-align: center; line-height: 1;
  background: linear-gradient(180deg, #fff6df 10%, #d9b46a 55%, #6a4a1e); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 4px 30px rgba(0,0,0,.9)); }
#title .sub { font-family: var(--display); letter-spacing: .7em; font-size: clamp(12px, 1.3vw, 18px); color: var(--gold-hi); text-align: center; margin: 14px 0 50px; text-shadow: 0 0 20px #000; }
#title .menu { display: flex; flex-direction: column; gap: 10px; align-items: center; }
#title .menu .btn { width: 300px; }
#title .foot { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; font-size: 13px; color: var(--mute); }
#clickToStart { position: absolute; bottom: 22vh; font-family: var(--display); letter-spacing: .4em; color: var(--gold-hi); animation: breathe 2.4s ease infinite; }
@keyframes breathe { 50% { opacity: .35; } }

#death { background: radial-gradient(ellipse, rgba(40,0,0,.35), rgba(0,0,0,.85)); flex-direction: column; opacity: 0; transition: opacity 2s; }
#death.show { opacity: 1; }
#death .t { font-family: var(--display); font-size: clamp(40px, 6vw, 88px); letter-spacing: .3em; color: #b8231d; text-shadow: 0 0 40px rgba(180,20,20,.6); }
#death .s { font-style: italic; color: var(--mute); margin: 10px 0 40px; font-size: 20px; }

/* ------------------------------------------------ menus (inventory, map, …) */
#menu { background: radial-gradient(ellipse at 50% 30%, rgba(24,20,22,.72), rgba(4,4,6,.92)); z-index: 35; flex-direction: column; justify-content: flex-start; padding: 34px 48px; backdrop-filter: blur(4px); }
#menu .tabs { display: flex; gap: 6px; justify-content: center; margin-bottom: 18px; }
#menu .tab { font-family: var(--display); letter-spacing: .2em; font-size: 14px; padding: 10px 22px; color: var(--mute); cursor: pointer; border-bottom: 1px solid transparent; }
#menu .tab.on { color: var(--gold-hi); border-bottom-color: var(--gold); text-shadow: 0 0 12px rgba(240,208,138,.4); }
#menu .body { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; display: flex; gap: 24px; min-height: 0; }
#menu .hint { text-align: center; color: var(--mute); font-size: 14px; margin-top: 12px; }
.panel { padding: 18px 20px; overflow: auto; }
.panel h3 { font-family: var(--display); letter-spacing: .18em; font-size: 14px; color: var(--gold-hi); margin: 0 0 10px; font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, 72px); gap: 8px; }
.cell { width: 72px; height: 72px; position: relative; border: 1px solid rgba(201,164,92,.22); background: radial-gradient(circle at 50% 35%, rgba(50,42,36,.55), rgba(8,8,10,.9)); cursor: pointer; display: grid; place-items: center; transition: all .1s; }
.cell:hover, .cell.sel { border-color: var(--gold); box-shadow: 0 0 12px rgba(201,164,92,.35); }
.cell img, .cell canvas { width: 78%; height: 78%; object-fit: contain; }
.cell .q { position: absolute; right: 4px; bottom: 2px; font-size: 13px; }
.cell .eq { position: absolute; left: 4px; top: 2px; font-size: 11px; color: var(--gold-hi); font-family: var(--display); }
.cell::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--rc, transparent); }
.cats { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.cat { font-size: 14px; padding: 4px 10px; border: 1px solid transparent; color: var(--mute); cursor: pointer; }
.cat.on { color: var(--parchment); border-color: var(--line); }
.detail .nm { font-family: var(--display); font-size: 20px; letter-spacing: .08em; }
.detail .rar { font-size: 14px; letter-spacing: .2em; text-transform: uppercase; margin: 4px 0 10px; }
.detail .desc { font-style: italic; color: #cbbfa5; font-size: 17px; line-height: 1.4; }
.detail .stats { margin-top: 12px; font-size: 16px; }
.detail .stats div { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.detail .up { color: #7fd07a; } .detail .down { color: #e06a5a; }
.detail .preview { width: 100%; height: 220px; margin-bottom: 10px; }
.eqslots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.eqslot { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid rgba(201,164,92,.18); cursor: pointer; min-height: 60px; }
.eqslot:hover { border-color: var(--gold); }
.eqslot .ic { width: 48px; height: 48px; display: grid; place-items: center; background: rgba(0,0,0,.45); }
.eqslot .ic img { width: 80%; }
.eqslot .lb { font-size: 12px; letter-spacing: .14em; color: var(--mute); text-transform: uppercase; }
.eqslot .v { font-size: 16px; }
.statlist div { display: flex; justify-content: space-between; font-size: 17px; padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,.05); }

/* skill tree */
.tree { position: relative; flex: 1; }
.tree svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.snode { position: absolute; width: 40px; height: 40px; margin: -20px 0 0 -20px; transform: rotate(45deg); border: 1px solid var(--gold-dim); background: radial-gradient(circle, #231d19, #0a0909); cursor: pointer; display: grid; place-items: center; transition: all .12s; }
.snode span { transform: rotate(-45deg); font-size: 16px; }
.snode.owned { border-color: var(--gold-hi); box-shadow: 0 0 16px rgba(240,208,138,.45); background: radial-gradient(circle, #5a3f1c, #140e08); }
.snode.avail { border-color: var(--gold); animation: availPulse 1.8s ease infinite; }
.snode.ult { width: 52px; height: 52px; margin: -26px 0 0 -26px; }
@keyframes availPulse { 50% { box-shadow: 0 0 14px rgba(201,164,92,.5); } }
.branchName { position: absolute; transform: translateX(-50%); font-family: var(--display); letter-spacing: .1em; font-size: 11px; white-space: nowrap; color: var(--gold-hi); }

/* quest log */
.qlist .q { padding: 10px 12px; border-left: 2px solid transparent; cursor: pointer; }
.qlist .q.on { border-left-color: var(--gold); background: rgba(201,164,92,.07); }
.qlist .q .t { font-family: var(--display); font-size: 14px; letter-spacing: .1em; }
.qlist .q .k { font-size: 12px; color: var(--mute); letter-spacing: .2em; text-transform: uppercase; }
.qsteps div { padding: 5px 0 5px 22px; position: relative; font-size: 17px; }
.qsteps div::before { content: '◇'; position: absolute; left: 0; color: var(--gold); }
.qsteps div.done { color: var(--mute); text-decoration: line-through; }
.qsteps div.done::before { content: '◆'; }

/* settings */
.set { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.05); font-size: 18px; }
.set select, .set input[type=range] { accent-color: var(--gold); background: #0c0b0d; color: var(--parchment); border: 1px solid var(--line); font-family: var(--serif); font-size: 16px; padding: 4px 8px; }
.opts { display: flex; gap: 4px; }
.opts span { padding: 4px 10px; border: 1px solid transparent; cursor: pointer; font-size: 15px; color: var(--mute); }
.opts span.on { border-color: var(--gold); color: var(--gold-hi); }

/* merchant */
.shopRow { display: flex; align-items: center; gap: 12px; padding: 8px; border-bottom: 1px solid rgba(255,255,255,.05); cursor: pointer; }
.shopRow:hover { background: rgba(201,164,92,.08); }
.shopRow img { width: 40px; height: 40px; object-fit: contain; }
.shopRow .p { margin-left: auto; color: var(--gold-hi); font-family: var(--display); }
.coin { display: inline-block; width: 16px; height: 16px; background: url('../public/lib/icons/Coin.png') center/contain no-repeat; vertical-align: -2px; margin-right: 4px; }

#hint { position: absolute; left: 34px; bottom: 34px; max-width: 420px; padding: 12px 18px; font-size: 17px; line-height: 1.5; opacity: 0; transform: translateY(8px); transition: all .35s; }
#hint.show { opacity: 1; transform: none; }
#hint .kbd { margin: 0 3px; height: 24px; min-width: 24px; font-size: 11px; }
#fps { position: absolute; left: 8px; bottom: 6px; font: 11px monospace; color: rgba(255,255,255,.35); }
#letterbox-skip { position: absolute; right: 40px; bottom: 30px; font-size: 14px; color: var(--mute); opacity: 0; transition: opacity .5s; }
#letterbox-skip.show { opacity: 1; }

@media (max-width: 900px) { #minimap { width: 130px; height: 130px; } #vitals { width: 260px; } #objective { top: 175px; width: 220px; } #compass { width: 300px; } }

/* character screen: the hero is shown live between the panels */
#menu.charview { background: linear-gradient(90deg, rgba(4,4,6,.93) 0%, rgba(4,4,6,.85) 34%, rgba(4,4,6,0) 42%, rgba(4,4,6,0) 60%, rgba(4,4,6,.85) 68%, rgba(4,4,6,.93) 100%); backdrop-filter: none; }
.dollzone { flex: 0.9; position: relative; cursor: grab; }
.dollzone:active { cursor: grabbing; }
.dollhint { position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; font-family: var(--display); letter-spacing: .3em; font-size: 11px; color: var(--mute); }
.cmps { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.cmp { font-size: 12px; padding: 1px 6px; border: 1px solid rgba(255,255,255,.12); color: var(--mute); }
.cmp.up { color: #8ad07a; border-color: rgba(138,208,122,.35); } .cmp.down { color: #e0705a; border-color: rgba(224,112,90,.35); }
.detail .vs { display: block !important; margin-top: 8px; font-size: 13px; color: var(--mute); }

#buffs { display: flex; gap: 6px; margin: 4px 0 0 64px; min-height: 0; }
.buff { position: relative; width: 30px; height: 30px; border: 1px solid var(--gold-dim); background: rgba(8,8,10,.7); box-shadow: 0 0 8px rgba(0,0,0,.6); }
.buff img { width: 100%; height: 100%; }
.buff span { position: absolute; right: 1px; bottom: -2px; font-size: 11px; color: var(--parchment); text-shadow: 0 0 3px #000; }
.buff.bad { border-color: #8a3a2a; }

/* ---------------------------------------------------------------- journey intros: narrator + wipes */
#narrator { position: absolute; left: 50%; bottom: 15%; transform: translateX(-50%); width: min(880px, 86vw); text-align: center; opacity: 0; transition: opacity .9s ease; pointer-events: none; z-index: 40; }
#narrator.show { opacity: 1; }
#narrator .nmark { font-size: 22px; color: var(--gold); opacity: .8; margin-bottom: 6px; text-shadow: 0 0 12px rgba(255,190,90,.5); }
#narrator .nwho { font-family: var(--display); font-size: 13px; letter-spacing: .34em; color: var(--gold-hi); margin-bottom: 8px; text-shadow: 0 0 10px #000; }
#narrator .ntext { font-family: var(--serif); font-style: italic; font-size: clamp(20px, 2.3vw, 31px); line-height: 1.42; color: #f4ead6; text-shadow: 0 0 18px rgba(0,0,0,.95), 0 2px 4px #000; letter-spacing: .01em; }
#narrator .ntext.spoken { font-style: normal; font-weight: 500; color: #fff3de; }
#narrator .ntext span { display: inline-block; opacity: 0; filter: blur(6px); transform: translateY(6px); animation: nword .9s ease forwards; }
@keyframes nword { to { opacity: 1; filter: blur(0); transform: none; } }
#wipe { position: absolute; inset: 0; pointer-events: none; z-index: 35; overflow: hidden; }
#wipe i { position: absolute; top: calc(-20% + var(--i) * 13%); left: -60%; width: 90%; height: 45%; border-radius: 50%; background: radial-gradient(closest-side, var(--c, #ccc) 0%, color-mix(in srgb, var(--c, #ccc) 70%, transparent) 45%, transparent 72%); opacity: 0; }
#wipe.run i { animation: wipeCloud var(--d, 1.6s) cubic-bezier(.45,.05,.55,.95) forwards; animation-delay: calc(var(--i) * 0.035s); }
@keyframes wipeCloud { 0% { transform: translateX(0) scale(1); opacity: 0; } 30% { opacity: 1; } 50% { transform: translateX(95%) scale(1.8); opacity: 1; } 70% { opacity: 1; } 100% { transform: translateX(210%) scale(1.3); opacity: 0; } }
