/* latin-ext */
@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/cinzel-8vIJ7ww63mVu7gt7-GT7LEc.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/cinzel-8vIJ7ww63mVu7gt79mT7.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url(fonts/cinzel-8vIJ7ww63mVu7gt7-GT7LEc.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url(fonts/cinzel-8vIJ7ww63mVu7gt79mT7.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/nunito-XRXV3I6Li01BKofIOOaBXso.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/nunito-XRXV3I6Li01BKofIMeaBXso.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* vietnamese */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/nunito-XRXV3I6Li01BKofIOuaBXso.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/nunito-XRXV3I6Li01BKofIO-aBXso.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/nunito-XRXV3I6Li01BKofINeaB.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url(fonts/nunito-XRXV3I6Li01BKofIOOaBXso.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url(fonts/nunito-XRXV3I6Li01BKofIMeaBXso.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* vietnamese */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url(fonts/nunito-XRXV3I6Li01BKofIOuaBXso.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url(fonts/nunito-XRXV3I6Li01BKofIO-aBXso.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url(fonts/nunito-XRXV3I6Li01BKofINeaB.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --silver: #d9e1ea;
  --silver-dim: #9aa8b8;
  --ltc: #345d9d;
  --ltc-bright: #4f8fe8;
  --navy: #0d1626;
  --gold: #f1c75b;
  --heart: #e2364b;
  --magic: #3fd48a;
  --panel: rgba(8, 16, 32, 0.78);
  --panel-edge: rgba(190, 210, 235, 0.55);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; }
body { font-family: 'Nunito', system-ui, sans-serif; color: var(--silver); user-select: none; -webkit-user-select: none; touch-action: none; }
#app { position: fixed; inset: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---------------- HUD */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud-left { position: absolute; left: 22px; top: 18px; }
#hearts { display: flex; flex-wrap: wrap; gap: 3px; max-width: 330px; }
.heart { width: 26px; height: 24px; position: relative; filter: drop-shadow(0 2px 2px rgba(0,0,0,.6)); }
.heart svg { width: 100%; height: 100%; }
.heart.beat { animation: beat .6s infinite; }
@keyframes beat { 0%,100% { transform: scale(1); } 40% { transform: scale(1.18); } }
#magic { margin-top: 7px; width: 180px; height: 12px; border: 2px solid var(--panel-edge); border-radius: 7px; background: rgba(0,0,0,.55); overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,.5); }
#magic-fill { height: 100%; width: 100%; background: linear-gradient(180deg, #7ef2b4, var(--magic) 55%, #1e9a5d); transform-origin: left; transition: transform .15s; }
#magic.veil #magic-fill { background: linear-gradient(180deg, #d6b6ff, #9a64f0 55%, #5b2fb0); }
#coins, #keys { margin-top: 8px; display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 22px; text-shadow: 0 2px 3px #000; }
.ltc { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f4f8ff, #a9b8cc 55%, #6d7d93); color: #2d4f86; font-weight: 800; font-size: 19px; box-shadow: 0 0 0 2px #2d4f86 inset, 0 2px 3px rgba(0,0,0,.6); text-shadow: none; }
.key-ico { width: 14px; height: 26px; border-radius: 7px 7px 3px 3px; background: linear-gradient(#e3eaf3, #8795a8); box-shadow: 0 2px 3px rgba(0,0,0,.6); }

#hud-right { position: absolute; right: 22px; top: 18px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
#powers { display: flex; gap: 8px; }
.power { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; background: radial-gradient(circle at 40% 35%, rgba(79,143,232,.55), rgba(8,16,32,.85)); border: 2px solid rgba(190,210,235,.35); opacity: .45; position: relative; transition: transform .15s, opacity .15s; text-shadow: 0 0 8px rgba(120,190,255,.9); }
.power.have { opacity: .85; }
.power.sel { opacity: 1; border-color: var(--gold); transform: scale(1.12); box-shadow: 0 0 14px rgba(241,199,91,.6); }
.power .pk { position: absolute; bottom: -4px; right: -2px; font-size: 11px; font-weight: 800; background: var(--navy); border-radius: 6px; padding: 0 4px; color: var(--silver-dim); text-shadow: none; }
.power .pc { position: absolute; top: -6px; left: -4px; font-size: 10px; font-weight: 800; background: #1e9a5d; border-radius: 6px; padding: 0 4px; color: #fff; text-shadow: none; }
#shards { display: flex; gap: 6px; }
.shard { width: 18px; height: 28px; clip-path: polygon(50% 0, 100% 35%, 50% 100%, 0 35%); background: rgba(60,70,90,.7); }
.shard.have { background: linear-gradient(160deg, #ffffff, #a8c8ff 40%, #4f8fe8); filter: drop-shadow(0 0 6px #7fb0ff); }

#level-banner { position: absolute; left: 0; right: 0; top: 30%; text-align: center; animation: bannerIn 4.2s forwards; }
.lb-sub { font-family: 'Cinzel', serif; font-size: 18px; letter-spacing: .3em; color: var(--silver-dim); text-transform: uppercase; }
.lb-title { font-family: 'Cinzel', serif; font-weight: 800; font-size: clamp(34px, 6vw, 68px); color: #f4f7fb; text-shadow: 0 0 22px rgba(79,143,232,.8), 0 3px 4px #000; }
@keyframes bannerIn { 0% { opacity: 0; transform: translateY(12px); } 15%, 75% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* boss intro card: a dark band opens, gold rules draw out, the name slides in */
#boss-card { position: absolute; inset: 0; display: flex; align-items: center; pointer-events: none; z-index: 6; }
.bc-band { position: relative; width: 100%; padding: 22px 16px 26px; text-align: center; background: linear-gradient(90deg, rgba(4,6,14,0) 0%, rgba(4,6,14,.86) 18%, rgba(4,6,14,.86) 82%, rgba(4,6,14,0) 100%); animation: bcBand 3.3s cubic-bezier(.2,.9,.3,1) forwards; }
.bc-edge { position: absolute; left: 12%; right: 12%; height: 2px; background: linear-gradient(90deg, transparent, var(--gold) 20%, #fff6d0 50%, var(--gold) 80%, transparent); transform: scaleX(0); animation: bcEdge 3.3s cubic-bezier(.2,.9,.3,1) forwards; }
.bc-edge.top { top: 6px; } .bc-edge.bot { bottom: 6px; }
.bc-kicker { font-family: 'Cinzel', serif; font-size: 15px; letter-spacing: .5em; color: #ff8a9a; text-transform: uppercase; opacity: 0; animation: bcFade 3.3s .15s forwards; }
.bc-title { font-family: 'Cinzel', serif; font-weight: 800; font-size: clamp(32px, 6vw, 64px); color: #fff; letter-spacing: .04em; text-shadow: 0 0 24px rgba(255,90,120,.55), 0 3px 4px #000; opacity: 0; animation: bcSlide 3.3s .2s cubic-bezier(.34,1.56,.64,1) forwards; }
.bc-sub { font-family: 'Cinzel', serif; font-size: clamp(14px, 2vw, 20px); letter-spacing: .25em; color: var(--silver); opacity: 0; animation: bcFade 3.3s .55s forwards; }
@keyframes bcBand { 0% { transform: scaleY(0); opacity: 0; } 10% { transform: scaleY(1); opacity: 1; } 85% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(.6); opacity: 0; } }
@keyframes bcEdge { 0%, 8% { transform: scaleX(0); } 25%, 100% { transform: scaleX(1); } }
@keyframes bcSlide { 0% { opacity: 0; transform: translateX(-60px); } 18%, 82% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateX(30px); } }
@keyframes bcFade { 0% { opacity: 0; } 20%, 82% { opacity: 1; } 100% { opacity: 0; } }

#boss-bar { position: absolute; left: 50%; bottom: 46px; width: min(640px, 80vw); transform: translateX(-50%); }
.bb-name { font-family: 'Cinzel', serif; font-weight: 800; font-size: 20px; text-align: center; text-shadow: 0 2px 3px #000; margin-bottom: 4px; letter-spacing: .1em; }
.bb-track { height: 14px; border: 2px solid var(--panel-edge); border-radius: 8px; background: rgba(0,0,0,.6); overflow: hidden; }
.bb-fill { height: 100%; width: 100%; background: linear-gradient(180deg, #ff7a8a, #c61f3a 60%, #7a0d1e); transform-origin: left; transition: transform .2s; }

#prompt { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); background: var(--panel); border: 2px solid var(--panel-edge); border-radius: 22px; padding: 8px 18px; font-weight: 800; font-size: 18px; }
#prompt b { color: var(--gold); }
#toast { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); background: var(--panel); border: 2px solid var(--panel-edge); border-radius: 12px; padding: 10px 22px; font-weight: 800; font-size: 20px; text-align: center; }
#reticle { position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border: 3px solid rgba(255,220,120,.9); border-radius: 50%; box-shadow: 0 0 10px rgba(255,210,90,.7); }
#save-ind { position: absolute; right: 24px; bottom: 20px; font-weight: 800; font-size: 16px; color: var(--silver); display: flex; gap: 8px; align-items: center; }
#save-ind span { display: inline-block; animation: spin 1s linear infinite; color: var(--ltc-bright); font-size: 20px; }
@keyframes spin { to { transform: rotateY(360deg); } }

/* ---------------- compass */
#compass { position: absolute; top: calc(14px + env(safe-area-inset-top)); left: 50%; width: min(420px, 44vw); height: 34px; transform: translateX(-50%); overflow: hidden;
  background: linear-gradient(90deg, transparent, rgba(8,16,32,.72) 18%, rgba(8,16,32,.72) 82%, transparent); border-top: 1px solid rgba(190,210,235,.35); border-bottom: 1px solid rgba(190,210,235,.35); }
#compass-strip { position: absolute; inset: 0; }
.cmp { position: absolute; top: 50%; transform: translate(-50%, -50%); font-weight: 800; font-size: 14px; color: var(--silver-dim); text-shadow: 0 1px 2px #000; white-space: nowrap; }
.cmp.card { font-family: 'Cinzel', serif; font-size: 17px; color: var(--silver); }
.cmp.card.n { color: #ff8a8a; }
.cmp.tick { width: 1px; height: 8px; background: rgba(190,210,235,.45); }
.cmp.obj { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--gold); color: #3a2a00; font-size: 13px; box-shadow: 0 0 10px rgba(241,199,91,.8); }
.cmp-center { position: absolute; left: 50%; top: 0; width: 2px; height: 7px; background: var(--gold); transform: translateX(-50%); }
#objective { position: absolute; top: calc(52px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); font-size: 14px; font-weight: 800; color: var(--gold); text-shadow: 0 1px 3px #000; white-space: nowrap; }
body.is-touch #ttop { left: calc(16px + env(safe-area-inset-left)); top: calc(150px + env(safe-area-inset-top)); transform: none; }

/* ---------------- dialog */
#dialog { position: absolute; left: 50%; bottom: 36px; transform: translateX(-50%); width: min(760px, 92vw); min-height: 130px; background: linear-gradient(180deg, rgba(10,22,44,.92), rgba(6,12,26,.92)); border: 3px solid var(--panel-edge); border-radius: 14px; padding: 16px 22px 20px; box-shadow: 0 8px 30px rgba(0,0,0,.6); }
.dlg-name { font-family: 'Cinzel', serif; font-weight: 800; color: var(--gold); font-size: 18px; margin-bottom: 6px; letter-spacing: .06em; }
.dlg-text { font-size: 21px; line-height: 1.4; white-space: pre-wrap; }
.dlg-text em { color: #ff6e7e; font-style: normal; }
.dlg-text strong { color: #8fc0ff; }
.dlg-next { position: absolute; right: 16px; bottom: 6px; color: var(--gold); animation: bob .7s infinite; }
@keyframes bob { 50% { transform: translateY(4px); } }

#itemget { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); text-align: center; background: var(--panel); border: 2px solid var(--panel-edge); border-radius: 14px; padding: 14px 26px; width: min(600px, 90vw); }
.ig-icon { font-size: 34px; }
.ig-title { font-family: 'Cinzel', serif; font-weight: 800; font-size: 26px; color: var(--gold); }
.ig-text { font-size: 18px; margin-top: 4px; }

#fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .5s; }
#fade.white { background: #fff; }
#letterbox div { position: absolute; left: 0; right: 0; height: 9vh; background: #000; }
#letterbox div:first-child { top: 0; } #letterbox div:last-child { bottom: 0; }

/* ---------------- screens */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#title { background: radial-gradient(ellipse at 50% 40%, rgba(10,20,40,0) 0%, rgba(3,6,14,.55) 80%); }
.title-logo { text-align: center; margin-top: -8vh; }
.t-the { font-family: 'Cinzel', serif; font-weight: 600; font-size: clamp(18px, 3vw, 30px); letter-spacing: .35em; color: var(--silver); text-shadow: 0 2px 6px #000; }
.t-main { font-family: 'Cinzel', serif; font-weight: 800; font-size: clamp(64px, 13vw, 150px); line-height: 1; letter-spacing: .06em; background: linear-gradient(180deg, #ffffff 0%, #d6e0ec 45%, #8796ab 52%, #e9eef6 100%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 18px rgba(79,143,232,.75)) drop-shadow(0 4px 2px #000); }
.t-sub { font-family: 'Cinzel', serif; font-size: clamp(16px, 2.4vw, 26px); color: #b9c9e6; letter-spacing: .2em; margin-top: 8px; text-shadow: 0 2px 4px #000; }
.t-press { margin-top: 9vh; font-family: 'Cinzel', serif; font-weight: 800; font-size: 26px; color: var(--gold); text-shadow: 0 2px 4px #000; }
.blink { animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.t-foot { position: absolute; bottom: 20px; font-size: 14px; color: var(--silver-dim); letter-spacing: .2em; }

.screen h2 { font-family: 'Cinzel', serif; font-weight: 800; font-size: 40px; margin: 0 0 22px; text-shadow: 0 0 16px rgba(79,143,232,.7), 0 3px 3px #000; }
#files, #pause, #options, #gameover, #travel { background: rgba(2,6,16,.72); backdrop-filter: blur(3px); }
#file-list { display: flex; flex-direction: column; gap: 12px; width: min(640px, 92vw); }
.file { display: flex; align-items: center; gap: 16px; padding: 14px 18px; background: var(--panel); border: 2px solid rgba(190,210,235,.25); border-radius: 14px; }
.file.sel { border-color: var(--gold); box-shadow: 0 0 18px rgba(241,199,91,.35); }
.file .fnum { font-family: 'Cinzel', serif; font-weight: 800; font-size: 28px; width: 34px; color: var(--silver-dim); }
.file .fmain { flex: 1; }
.file .fname { font-weight: 800; font-size: 22px; }
.file .fmeta { font-size: 15px; color: var(--silver-dim); margin-top: 2px; }
.file .fright { text-align: right; font-size: 15px; color: var(--silver-dim); }
.file .fh { color: var(--heart); font-size: 16px; letter-spacing: 1px; }
.menu { display: flex; flex-direction: column; gap: 8px; min-width: 280px; }
/* the travel list grows with every chapter: it scrolls, and on a phone it runs in two columns */
#travel-menu { max-height: calc(100vh - 190px); overflow-y: auto; padding: 4px 8px; scrollbar-width: thin; pointer-events: auto; }
.menu-row { display: flex; gap: 10px; margin-top: 18px; }
.mi { padding: 10px 20px; background: var(--panel); border: 2px solid rgba(190,210,235,.25); border-radius: 12px; font-weight: 800; font-size: 19px; cursor: pointer; text-align: center; pointer-events: auto; }
.mi.sel, .mi:hover { border-color: var(--gold); color: #fff; box-shadow: 0 0 14px rgba(241,199,91,.3); }
.mi .val { color: var(--gold); margin-left: 10px; }
.mi .tsub { display: block; font-size: 13px; font-weight: 600; color: var(--silver-dim); margin-top: 2px; }
.hint { margin-top: 20px; font-size: 14px; color: var(--silver-dim); max-width: 760px; text-align: center; padding: 0 16px; }
.pause-grid { display: flex; gap: 40px; align-items: flex-start; flex-wrap: wrap; justify-content: center; }
#pause-status { background: var(--panel); border: 2px solid rgba(190,210,235,.25); border-radius: 14px; padding: 16px 22px; min-width: 260px; line-height: 1.7; font-size: 17px; }
#pause-status b { color: var(--gold); }
.go-title { color: #ff8090; }

#credits { background: #000; overflow: hidden; }
#credits-roll { position: absolute; left: 0; right: 0; top: 100%; text-align: center; font-size: 22px; line-height: 1.8; }
#credits-roll h3 { font-family: 'Cinzel', serif; color: var(--gold); margin: 36px 0 4px; font-size: 20px; letter-spacing: .15em; }
#credits-roll .big { font-family: 'Cinzel', serif; font-weight: 800; font-size: 54px; color: #fff; text-shadow: 0 0 20px rgba(79,143,232,.8); }

#loading { background: radial-gradient(ellipse at 50% 40%, #0f2140, #02050c 75%); z-index: 20; }
.load-ltc { font-size: 90px; font-weight: 800; color: var(--silver); text-shadow: 0 0 30px rgba(79,143,232,.9); animation: spin 2.4s linear infinite; }
.load-text { margin-top: 12px; font-family: 'Cinzel', serif; font-size: 20px; letter-spacing: .15em; }
.load-bar { margin-top: 14px; width: 280px; height: 8px; background: rgba(255,255,255,.1); border-radius: 4px; overflow: hidden; }
#load-fill { height: 100%; width: 100%; transform: scaleX(0); transform-origin: left; background: linear-gradient(90deg, var(--ltc), var(--ltc-bright), #cfe0ff); transition: transform .2s; }

/* ---------------- touch */
#touch { position: absolute; inset: 0; pointer-events: none; }
#stick { position: absolute; left: calc(30px + env(safe-area-inset-left)); bottom: calc(30px + env(safe-area-inset-bottom)); width: 140px; height: 140px; border-radius: 50%; background: rgba(255,255,255,.07); border: 2px solid rgba(255,255,255,.22); opacity: .5; transition: opacity .15s; }
#stick.active { opacity: 1; }
#stick-knob { position: absolute; left: 45px; top: 45px; width: 50px; height: 50px; border-radius: 50%; background: rgba(220,230,245,.5); }
#touch button { pointer-events: auto; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); background: rgba(10,20,40,.5); color: #fff; font-weight: 800; font-family: inherit; touch-action: none; -webkit-tap-highlight-color: transparent; }
#touch button.down { background: rgba(79,143,232,.6); transform: scale(.94); }
/* right thumb cluster: attack in the corner, the rest on an arc around it (offsets from bottom-right).
   --tsize scales the whole cluster (Options > Touch buttons). */
#tbtns { position: absolute; right: calc(10px + env(safe-area-inset-right)); bottom: calc(10px + env(safe-area-inset-bottom)); width: 300px; height: 290px; transform: scale(var(--tsize, 1)); transform-origin: 100% 100%; }
#tbtns button { position: absolute; width: 66px; height: 66px; font-size: 26px; }
#tbtns .tb-attack { right: 14px; bottom: 24px; width: 96px; height: 96px; font-size: 38px; background: rgba(160,40,60,.55); }
#tbtns .tb-jump { right: 139px; bottom: 16px; }
#tbtns .tb-roll { right: 122px; bottom: 102px; }
#tbtns .tb-cast { right: 46px; bottom: 146px; background: rgba(40,90,170,.55); }
#tbtns .tb-block { right: 226px; bottom: 76px; width: 62px; height: 62px; }
#tbtns .tb-target { right: 136px; bottom: 186px; width: 56px; height: 56px; font-size: 22px; }
#tbtns .tb-target.on { background: rgba(241,199,91,.55); border-color: var(--gold); }
#tbtns .tb-interact { right: 6px; bottom: 228px; width: 84px; height: 52px; border-radius: 26px; font-size: 18px; background: rgba(241,199,91,.6); }
#ttop { position: absolute; top: calc(12px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; gap: 12px; }
#ttop button { width: 48px; height: 48px; font-size: 18px; }
#ttop .tb-swap { width: 56px; font-size: 22px; background: rgba(120,60,110,.55); }
#party { margin-top: 8px; display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 15px; text-shadow: 0 2px 3px #000; }
#party .pm { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 15px; border: 2px solid rgba(190,210,235,.4); background: rgba(8,16,32,.75); opacity: .55; }
#party .pm.on { opacity: 1; border-color: var(--gold); box-shadow: 0 0 10px rgba(241,199,91,.5); }
#party .pk { font-size: 11px; color: var(--silver-dim); background: var(--navy); border-radius: 6px; padding: 0 4px; }
body.is-touch #party .pk { display: none; }
body.is-touch #powers .power { pointer-events: auto; cursor: pointer; }
body.is-touch #hud-left { left: calc(14px + env(safe-area-inset-left)); top: calc(10px + env(safe-area-inset-top)); }
body.is-touch #hud-right { right: calc(14px + env(safe-area-inset-right)); top: calc(10px + env(safe-area-inset-top)); }
body.is-touch #prompt { bottom: auto; top: 22%; }
body.is-touch .hint { display: none; }
body.is-touch .power .pk { display: none; }
body.is-touch .power { width: 44px; height: 44px; font-size: 20px; }
body.is-touch #dialog { bottom: calc(10px + env(safe-area-inset-bottom)); }
#rotate { position: absolute; inset: 0; z-index: 30; background: #050a16; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; font-family: 'Cinzel', serif; font-size: 20px; text-align: center; padding: 24px; }
.rot-ico { font-size: 64px; animation: spin 2.5s linear infinite; }

@media (max-height: 500px) {
  .t-main { font-size: clamp(48px, 18vh, 110px); } .t-press { margin-top: 5vh; }
  .screen h2 { font-size: 28px; margin-bottom: 12px; }
  .file { padding: 8px 14px; } .file .fname { font-size: 18px; } #file-list { gap: 8px; }
  .mi { padding: 7px 16px; font-size: 16px; } .menu { gap: 6px; }
  #travel-menu { display: grid; grid-template-columns: 1fr 1fr; max-height: calc(100vh - 100px); width: min(94vw, 680px); }
  #travel .hint { display: none; }
  #pause-status { font-size: 14px; padding: 10px 14px; line-height: 1.5; } .pause-grid { gap: 16px; }
  #dialog { min-height: 96px; padding: 10px 16px 14px; } .dlg-text { font-size: 16px; }
  .lb-title { font-size: 34px; }
}
@media (max-width: 700px) {
  #hud-left { left: 12px; top: 10px; } .heart { width: 20px; height: 18px; } #magic { width: 130px; }
  .power { width: 42px; height: 42px; font-size: 20px; }
  .dlg-text { font-size: 17px; }
}
