[hidden]{display:none!important}
@font-face{font-family:"IBM Plex Mono";font-style:normal;font-weight:400;font-display:swap;src:url("ibm-plex-mono-latin-400.c36f509c0a.woff2") format("woff2")}
@font-face{font-family:"IBM Plex Mono";font-style:normal;font-weight:600;font-display:swap;src:url("ibm-plex-mono-latin-600.ad4580d8cb.woff2") format("woff2")}
/* Layout: full-bleed WebGL stage. Explore HUD top-left, boss bar top-centre in a fight,
   player bars bottom-left, renderer panel bottom-right. Single dark look on purpose. */
:root {
  color-scheme: dark;
  --bg: #04070a;
  --panel: rgba(8, 13, 16, 0.88);
  --line: #1d2a2e;
  --fg: #cfdcd7;
  --muted: #7d918c;
  --moon: #efe6c2;
  --ember: #ff9a4a;
  --blood: #e2493a;
  --b-green: #4dff6a;
  --b-blue: #4a7bff;
  --b-red: #ff3b3b;
  --b-yellow: #ffe03a;
  --b-volt: #3af0ff;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--fg); font-family: var(--mono); overflow: hidden; }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }

#hud { position: fixed; top: calc(16px + env(safe-area-inset-top, 0px)); left: 16px; right: 16px; pointer-events: none; display: grid; gap: 4px; }
#hud h1 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: 0.04em; color: var(--moon); text-wrap: balance; }
#hud p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
#hud kbd { font: inherit; color: var(--fg); }
#obj { color: var(--ember) !important; }

#tags { position: fixed; top: calc(100px + env(safe-area-inset-top, 0px)); left: 0; right: 0; display: grid; grid-template-columns: 1fr 1fr; pointer-events: none; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--moon); }
#tags span { justify-self: center; background: var(--panel); border: 1px solid var(--line); padding: 3px 8px; border-radius: 4px; }

#label { position: fixed; left: 0; top: 0; font-size: 11px; color: var(--moon); pointer-events: none; white-space: nowrap; text-shadow: 0 0 6px #000; }

#bossbar, #royalbars { position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); display: grid; gap: 6px; pointer-events: none; }
#bossbar .row, #royalbars .row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
#bossbar .name, #royalbars .name { font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--moon); }
#bossbar .tag, #royalbars .tag { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ember); }
#royalbars { grid-template-columns: 1fr 1fr; gap: 6px 18px; }
#royalbars:not([hidden]) { display: grid; }
#royalbars .rb { display: grid; gap: 6px; min-width: 0; }
#royalbars .rb.dead { opacity: 0.35; }
#royalbars .rb.wide { grid-column: 1 / -1; }
#royalbars .fill.dragon { background: var(--ember); }
@media (max-width: 560px) { #royalbars { grid-template-columns: 1fr; } }
#lockmark { position: fixed; left: 0; top: 0; color: var(--ember); font-size: 14px; pointer-events: none; text-shadow: 0 0 6px #000; }
.track { position: relative; height: 8px; background: rgba(0,0,0,.6); border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.track i { position: absolute; inset: 0 auto 0 0; display: block; }
.track .ghost { background: #f3d9a8; opacity: .55; transition: width .6s ease .35s; }
.track .fill { background: var(--blood); }
#pbars .st .fill { background: var(--moon); }
#poise { height: 3px; }
#poise .fill { background: var(--ember); }

#pbars { position: fixed; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: min(300px, calc(100vw - 32px)); display: grid; grid-template-columns: 104px minmax(0, 1fr); align-items: center; gap: 12px; pointer-events: none; font-size: 11px; }
#pbars .pcol { display: grid; gap: 7px; min-width: 0; }
#coil { width: 104px; height: 104px; overflow: visible; }
#coilTrack { fill: none; stroke: rgba(120, 170, 158, 0.16); stroke-width: 7.5; stroke-linecap: round; }
#coilFill { fill: none; stroke: url(#soulGrad); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 100 100; transition: stroke-dashoffset .25s ease; }
#pbars.low #coilFill { stroke: var(--blood); animation: soulThrob .8s ease-in-out infinite; }
@keyframes soulThrob { 50% { opacity: .55; } }
.ar-track { fill: none; stroke: rgba(58, 240, 255, 0.12); stroke-width: 2.5; }
#arRing { fill: none; stroke: var(--b-volt); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 0 100; filter: drop-shadow(0 0 3px var(--b-volt)); transition: stroke-dasharray .25s ease; }
.orb-shell { fill: rgba(0, 0, 0, 0.55); stroke: rgba(74, 123, 255, 0.7); stroke-width: 1.2; }
#orbFill { fill: var(--b-blue); transition: y .25s ease, height .25s ease; }
#pbars .volt { color: var(--b-volt); } #pbars .mana { color: var(--b-blue); }
@media (prefers-reduced-motion: reduce) { #pbars.low #coilFill { animation: none; } }
#pbars .row { display: flex; justify-content: space-between; color: var(--muted); font-variant-numeric: tabular-nums; }
#pbars .row span span { color: var(--fg); }
#flasks { color: var(--ember); letter-spacing: 0.2em; }
#pbars .duo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#pbars .hp .fill { background: var(--b-green); }
#pbars .ar .fill { background: var(--b-volt); box-shadow: 0 0 6px var(--b-volt); }
#pbars .mp .fill { background: var(--b-blue); }
#pbars .thin { height: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 0; }
.chip { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 6px; border-radius: 3px; border: 1px solid currentColor; font-variant-numeric: tabular-nums; }
.chip.red { color: var(--b-red); } .chip.yellow { color: var(--b-yellow); } .chip.cyan { color: #bff6ff; } .chip.orange { color: #ff9a4a; } .chip.green { color: #7fdc5a; }
.legend { display: grid; gap: 4px; margin: 8px 0 0; padding: 0; list-style: none; }
.legend li { display: flex; gap: 8px; align-items: baseline; }
.legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

#panel { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: min(300px, calc(100vw - 32px)); box-sizing: border-box; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; backdrop-filter: blur(6px); font-size: 12px; }
#panel:not([open]) { width: auto; }
#panel > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; font-size: 11px; color: var(--moon); list-style: none; }
#panel > summary::-webkit-details-marker { display: none; }
#panel > summary::after { content: " +"; color: var(--muted); }
#panel[open] > summary::after { content: " \2212"; }
.body { display: grid; gap: 12px; padding: 2px 14px 14px; max-height: 60vh; overflow-y: auto; }
.ctl { display: grid; grid-template-columns: 78px 1fr auto; align-items: center; gap: 10px; }
.lab { color: var(--muted); }
.seg { display: flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; grid-column: 2 / 4; }
.seg button { flex: 1; font: inherit; font-size: 11px; color: var(--muted); background: transparent; border: 0; padding: 6px 4px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--moon); color: #11161a; font-weight: 600; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
input[type="range"] { width: 100%; accent-color: var(--moon); min-width: 0; }
output { font-variant-numeric: tabular-nums; color: var(--fg); min-width: 44px; text-align: right; }
.chk { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.chk input { accent-color: var(--moon); margin: 0; }
.chk code { color: var(--moon); }
.sub { border-top: 1px solid var(--line); padding-top: 10px; }
.sub summary { cursor: pointer; color: var(--moon); }
.sub ol, .sub dl { margin: 8px 0 0; line-height: 1.45; }
.sub ol { padding-left: 18px; display: grid; gap: 6px; }
.sub li::marker { color: var(--muted); }
.sub code, .sub dt { color: var(--moon); }
.sub dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.sub dd { margin: 0; }

#banner { position: fixed; inset: 0; display: grid; place-items: center; padding-inline: 16px; pointer-events: none; }
#banner .card { pointer-events: auto; text-align: center; display: grid; gap: 10px; justify-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 22px 28px; max-width: 420px; }
#banner.title .card { background: none; border: 0; pointer-events: none; }
#banner h2 { margin: 0; font-size: clamp(20px, 4vw, 30px); letter-spacing: 0.22em; text-transform: uppercase; color: var(--moon); text-wrap: balance; font-weight: 600; }
#banner.lose h2 { color: var(--blood); }
#banner p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
#banner button { font: inherit; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #11161a; background: var(--moon); border: 0; border-radius: 4px; padding: 9px 16px; cursor: pointer; }

#flash { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 45%, rgba(226,73,58,.55)); opacity: 0; transition: opacity .35s ease; }
#nums { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.num { position: absolute; left: 0; top: 0; font-size: 14px; font-weight: 600; color: var(--moon); text-shadow: 0 0 6px #000; white-space: nowrap; }
.num.big { color: var(--ember); font-size: 18px; }
.num.word { color: var(--ember); letter-spacing: 0.12em; }
.num.hurt { color: var(--blood); }


#minimap { position: fixed; top: calc(16px + env(safe-area-inset-top, 0px)); right: 16px; width: 170px; height: 170px; border: 1px solid var(--line); border-radius: 6px; background: rgba(6, 10, 12, 0.82); z-index: 2; pointer-events: none; }
#minimap.big { width: min(420px, calc(100vw - 32px)); height: min(420px, calc(100vw - 32px)); }
#campclock { position: fixed; top: calc(192px + env(safe-area-inset-top, 0px)); right: 16px; width: 170px; box-sizing: border-box; text-align: center; font-size: 11px; color: #7fdc8a; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 3px 0; pointer-events: none; z-index: 2; font-variant-numeric: tabular-nums; }
#hero { position: fixed; top: calc(222px + env(safe-area-inset-top, 0px)); right: 16px; width: min(280px, calc(100vw - 32px)); box-sizing: border-box; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; font-size: 12px; z-index: 2; }
#hero:not([open]) { width: auto; }
#hero > summary { cursor: pointer; padding: 9px 14px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; font-size: 11px; color: var(--moon); list-style: none; }
#hero > summary::-webkit-details-marker { display: none; }
#hpts { color: var(--ember); }
#hero .row, #shop .row { display: flex; justify-content: space-between; gap: 10px; font-variant-numeric: tabular-nums; }
#hero .xp { display: grid; gap: 5px; }
#hero .xp .fill { background: #ffd36a; }
.gold { color: #ffd36a; }
.muted { color: var(--muted); margin: 0; line-height: 1.45; }
.attrs { display: grid; gap: 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding-block: 10px; }
.attr { display: grid; grid-template-columns: 1fr 28px; gap: 2px 8px; align-items: center; }
.attr b { color: var(--fg); font-weight: 600; }
.attr small { color: var(--muted); font-size: 10px; }
.attr button { grid-row: 1 / span 2; grid-column: 2; font: inherit; font-weight: 600; color: #11161a; background: var(--moon); border: 0; border-radius: 4px; height: 26px; cursor: pointer; }
.attr button:disabled { background: var(--line); color: var(--muted); cursor: default; }
#skills { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 6px; pointer-events: none; }
.sk { position: relative; width: 64px; height: 46px; background: var(--panel); border: 1px solid var(--line); border-radius: 5px; display: grid; place-items: center; align-content: center; overflow: hidden; font-size: 10px; }
.sk b { color: var(--moon); font-size: 13px; } .sk span { color: var(--muted); }
.sk i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0,0,0,.7); }
.sk.locked { opacity: .3; }
#prompt { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(74px + env(safe-area-inset-bottom, 0px)); font-size: 12px; color: var(--moon); background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 5px 10px; pointer-events: none; white-space: nowrap; }
#shop, #worlds { position: fixed; inset: 0; display: grid; place-items: center; padding-inline: 16px; background: rgba(0,0,0,.5); z-index: 3; }
#shop .card, #worlds .card { width: min(380px, 100%); box-sizing: border-box; display: grid; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 20px; font-size: 12px; }
#shop h2, #worlds h2 { margin: 0; font-size: 18px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--moon); font-weight: 600; }
#shop p, #worlds p { margin: 0; color: var(--muted); line-height: 1.45; }
.shopbtn { display: flex; justify-content: space-between; gap: 12px; font: inherit; text-align: left; color: var(--fg); background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 4px; padding: 9px 12px; cursor: pointer; }
.shopbtn:disabled { color: var(--muted); cursor: default; }
#worldlist { display: grid; gap: 8px; }
.shopbtn small { display: block; margin-top: 2px; font-size: 10px; color: var(--muted); line-height: 1.4; }
#shop .close, #worlds .close { font: inherit; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #11161a; background: var(--moon); border: 0; border-radius: 4px; padding: 9px 16px; cursor: pointer; }
#cbars { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.cbar { position: absolute; left: 0; top: 0; display: grid; justify-items: center; gap: 2px; }
.cbar span { font-size: 10px; white-space: nowrap; color: var(--fg); text-shadow: 0 0 4px #000, 0 0 2px #000; }
.cbar.vet span { color: #ffd36a; }
.cbar.anc span { color: #ff9a4a; font-weight: 600; letter-spacing: 0.04em; }
.cbar .ct { width: 40px; height: 4px; background: rgba(0,0,0,.65); border: 1px solid var(--line); }
.cbar.anc .ct { width: 70px; height: 5px; border-color: #ff9a4a; }
.cbar i { display: block; height: 100%; background: var(--blood); }
.cbar.relic span { font-weight: 600; letter-spacing: 0.04em; }
.cbar.myth span { color: #ff6a5a; }
.cbar.myth .ct { width: 96px; border-color: #ff6a5a; }
#relics { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.relic { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; }
.relic span { font-weight: 600; }
.relic small { grid-column: 1 / span 2; color: var(--muted); font-size: 10px; line-height: 1.4; }
.relic button { font: inherit; font-size: 10px; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 4px; padding: 2px 7px; cursor: pointer; }
.relic button:hover { color: var(--moon); border-color: var(--moon); }
.combat { display: grid; gap: 4px; border-top: 1px solid var(--line); padding-top: 10px; }
#pausebtn { position: fixed; right: 16px; bottom: calc(60px + env(safe-area-inset-bottom, 0px)); font: inherit; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--moon); background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px; cursor: pointer; }
#pause { position: fixed; inset: 0; display: grid; place-items: center; padding-inline: 16px; background: rgba(0,0,0,.55); z-index: 4; }
#pause .card { width: min(460px, 100%); box-sizing: border-box; display: grid; gap: 12px; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 22px; font-size: 12px; }
#pause h2 { margin: 0; font-size: 22px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--moon); font-weight: 600; }
#pause p { margin: 0; color: var(--muted); line-height: 1.45; }
#pause .close { font: inherit; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #11161a; background: var(--moon); border: 0; border-radius: 4px; padding: 9px 16px; cursor: pointer; }
#err { position: fixed; inset: 0; display: grid; place-items: center; padding-inline: 16px; text-align: center; color: var(--fg); }
@media (prefers-reduced-motion: reduce) { .track .ghost, #flash { transition: none; } }

/* Gear strip and inventory */
#gear { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(66px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 6px; max-width: calc(100vw - 32px); z-index: 2; }
#gear button { display: grid; gap: 3px; min-width: 92px; max-width: 150px; padding: 6px 8px; font: inherit; font-size: 10px; text-align: left; color: var(--fg); background: var(--panel); border: 1px solid #3a4a4e; border-radius: 5px; cursor: pointer; }
#gear button b { color: var(--moon); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#gear button small { color: #8fa29b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#gear button.ready { border-color: #9fe8ff; box-shadow: 0 0 10px rgba(159,232,255,.45); }
.edge { display: block; height: 4px; background: rgba(0,0,0,.6); border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.edge b { display: block; height: 100%; background: #9fe8ff; }
#inv { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.45); z-index: 6; padding: 16px; }
#inv[hidden] { display: none; }
#inv .card { width: min(440px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-sizing: border-box; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 18px; display: grid; gap: 10px; font-size: 12px; }
#inv h2 { margin: 0; font-size: 14px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--moon); }
#inv h3 { margin: 4px 0 0; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--moon); }
#inv .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
#inv .slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
#inv .slots.bag { grid-template-columns: repeat(4, 1fr); }
#inv .cell { position: relative; }
#inv .slot { width: 100%; min-height: 58px; display: grid; align-content: start; gap: 3px; padding: 6px; font: inherit; font-size: 10px; text-align: left; color: var(--fg); background: rgba(0,0,0,.35); border: 1px solid #3a4a4e; border-radius: 4px; cursor: pointer; }
#inv .slot span { color: var(--moon); font-weight: 600; }
#inv .slot small { color: #8fa29b; }
#inv .slot.sword { border-color: #6a8a9a; }
#inv .slot.charm { border-color: #7a6a9a; }
#inv .slot.empty { cursor: default; opacity: .5; }
#inv .x { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; padding: 0; font: inherit; font-size: 12px; line-height: 1; color: var(--fg); background: rgba(0,0,0,.6); border: 1px solid var(--line); border-radius: 3px; cursor: pointer; }
#inv .close { justify-self: end; font: inherit; color: var(--moon); background: transparent; border: 1px solid var(--line); border-radius: 4px; padding: 6px 12px; cursor: pointer; }
@media (max-width: 560px) { #inv .slots.bag { grid-template-columns: repeat(2, 1fr); } #gear button:nth-child(n+2):nth-child(-n+3) { display: none; } }
#skills .sk { background: var(--panel); border-color: #3a4a4e; }

/* Touch layout: shown while the player is using touch (live, so hybrids like a ThinkPad Yoga switch both ways) */
#joyzone, #tacts, #tmisc, #tops { display: none; }
body.touch #joyzone { display: block; position: fixed; left: 0; bottom: 0; width: 46vw; height: 62vh; z-index: 1; touch-action: none; }
#joybase { position: absolute; left: 96px; top: calc(100% - 120px - env(safe-area-inset-bottom, 0px)); width: 124px; height: 124px; margin: -62px 0 0 -62px; border-radius: 50%; border: 2px solid rgba(239,230,194,.28); background: rgba(8,13,16,.35); opacity: .55; transition: opacity .15s; pointer-events: none; }
#joybase.on { opacity: 1; position: fixed; }
#joyknob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: rgba(239,230,194,.85); box-shadow: 0 0 12px rgba(0,0,0,.6); }
body.touch #tacts { display: block; position: fixed; right: calc(8px + env(safe-area-inset-right, 0px)); bottom: calc(8px + env(safe-area-inset-bottom, 0px)); width: 270px; height: 270px; z-index: 3; transform-origin: bottom right; }
#tacts button, #tmisc button, #tops button { font: inherit; color: var(--moon); background: rgba(8,13,16,.78); border: 1px solid #3a4a4e; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
#tacts button { position: absolute; border-radius: 50%; font-size: 11px; letter-spacing: .04em; padding: 0; display: grid; place-items: center; overflow: hidden; }
#tacts button:active, #tmisc button:active, #tops button:active { background: rgba(239,230,194,.25); }
#tacts .t-attack { right: 22px; bottom: 22px; width: 84px; height: 84px; font-size: 13px; font-weight: 600; text-transform: uppercase; border: 2px solid var(--moon); }
#tacts .t-heavy { right: 135px; bottom: 35px; width: 58px; height: 58px; }
#tacts .t-block { right: 121px; bottom: 85px; width: 58px; height: 58px; }
#tacts .t-jump { right: 85px; bottom: 121px; width: 58px; height: 58px; }
#tacts .t-roll { right: 35px; bottom: 135px; width: 58px; height: 58px; }
#tacts .t-sk { width: 50px; height: 50px; font-size: 10px; border-color: #6a7a9a; }
#tacts .t-sk span { position: relative; z-index: 1; }
#tacts .t-sk::after { content: ""; position: absolute; inset: 0; background: conic-gradient(rgba(0,0,0,.72) var(--cd, 0%), transparent 0); }
#tacts .t-sk.locked { opacity: .45; }
#tacts .t-s1 { right: 210px; bottom: 36px; } #tacts .t-s2 { right: 187px; bottom: 124px; }
#tacts .t-s3 { right: 124px; bottom: 187px; } #tacts .t-s4 { right: 36px; bottom: 210px; }
/* Blade Spin sits in the top-left corner of the action square, clear of the skill arc */
#tacts .t-s5 { right: 210px; bottom: 210px; } #tacts .t-s6 { right: 124px; bottom: 270px; }
body.touch #tmisc { display: flex; position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); gap: 6px; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 600px); min-width: 180px; z-index: 3; }
#tmisc button, #tops button { border-radius: 6px; font-size: 11px; padding: 0 12px; height: 40px; min-width: 56px; }
body.touch #tops { display: flex; gap: 6px; position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(146px + env(safe-area-inset-right, 0px)); z-index: 3; }
body.touch #pausebtn { top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(342px + env(safe-area-inset-right, 0px)); bottom: auto; left: auto; transform: none; height: 40px; }
body.touch #minimap:not(.big) { width: 120px; height: 120px; }
body.touch #minimap { top: calc(12px + env(safe-area-inset-top, 0px)); }
body.touch #campclock { top: calc(138px + env(safe-area-inset-top, 0px)); }
body.touch #hero { top: calc(168px + env(safe-area-inset-top, 0px)); }
body.touch #keyhelp, body.touch #skills, body.touch #gear { display: none; }
body.touch #hud { right: 440px; }
body.touch #hero:not([open]) { display: none; }
body.touch #obj { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
body.touch #pbars { top: calc(84px + env(safe-area-inset-top, 0px)); bottom: auto; }
body.touch #prompt { bottom: calc(286px + env(safe-area-inset-bottom, 0px)); pointer-events: auto; padding: 10px 14px; font-size: 13px; cursor: pointer; }
body.touch #panel { display: none; }
body.touch.paused #panel { display: block; z-index: 5; }
@media (max-height: 560px) { body.touch #tacts { transform: scale(.8); } body.touch #campclock { display: none; } body.touch #obj { -webkit-line-clamp: 1; } body.touch #hero { top: calc(140px + env(safe-area-inset-top, 0px)); } body.touch #prompt { bottom: calc(230px + env(safe-area-inset-bottom, 0px)); } }
@media (max-width: 760px) { body.touch #hud { right: 16px; top: calc(60px + env(safe-area-inset-top, 0px)); } body.touch #tops { right: auto; left: 16px; } body.touch #pausebtn { right: auto; left: 222px; } body.touch #pbars { top: calc(150px + env(safe-area-inset-top, 0px)); } body.touch #tmisc { left: auto; right: 8px; transform: none; bottom: 290px; max-width: 70px; flex-direction: column; min-width: 0; } }
/* iPad and other tablets: no double-tap zoom, no long-press text selection or callouts, no rubber-band scrolling */
body.touch { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
body.touch #inv .card, body.touch #hero .body, body.touch #panel { touch-action: pan-y; }
#newgame { font: inherit; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 4px; padding: 7px 14px; cursor: pointer; }
#newgame[data-armed="1"] { color: var(--blood); border-color: var(--blood); }

/* ---------- Controls: key help, rebinding, pause controls list (controls agent) ---------- */
#keyhelp kbd + kbd { margin-left: 1px; }
#keyhelp .khint { color: var(--muted); opacity: .8; }
#pause .card { max-height: calc(100dvh - 32px); grid-template-rows: auto auto auto auto minmax(0, 1fr); }
#controlsbox { min-height: 0; max-height: min(46vh, 340px); overflow-y: auto; overscroll-behavior: contain; text-align: left; border-top: 1px solid var(--line); padding: 10px 2px 2px; scrollbar-width: thin; }
#controlsbox h3 { margin: 0 0 2px; font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--moon); }
#controlsbox h4 { margin: 10px 0 4px; font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
#controlsbox .cnote { margin: 0; font-size: 11px; color: var(--muted); }
#controlsbox .cnote:last-of-type { margin-top: 10px; }
#controlsbox .cgrp { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; }
#controlsbox .cgrp h4 { grid-column: 1 / -1; }
#controlsbox .crow { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 0; color: var(--fg); }
#controlsbox .ckey { font: inherit; font-size: 11px; min-width: 46px; color: var(--moon); background: transparent; border: 1px solid var(--line); border-radius: 4px; padding: 3px 6px; cursor: pointer; }
#controlsbox .ckey:hover, #controlsbox .ckey:focus-visible { border-color: var(--moon); outline: none; }
#controlsbox .ckey.cap { color: #11161a; background: var(--moon); border-color: var(--moon); }
#ckreset { margin-top: 10px; width: 100%; font: inherit; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 4px; padding: 7px 14px; cursor: pointer; }
#ckreset:hover { color: var(--fg); }
@media (max-width: 420px) { #controlsbox .cgrp { grid-template-columns: 1fr; } }
body.touch #controlsbox { display: none; }

/* ---------- Status strip and tip cards (HUD agent) ---------- */
#statusstrip:not([hidden]) { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
#statusstrip .sc { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px 2px 5px; font-size: 11px; line-height: 16px; color: var(--c, var(--moon)); background: var(--panel); border: 1px solid color-mix(in srgb, var(--c, var(--moon)) 45%, transparent); border-radius: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#statusstrip .sc b { font-weight: 400; font-size: 12px; width: 13px; text-align: center; }
#statusstrip .ride, #statusstrip .soul, #statusstrip .away { --c: #bff6ff; } #statusstrip .away { opacity: 0.8; }
#statusstrip .ride.low { --c: #ffd36a; } #statusstrip .soul.hungry { --c: #ff6a8a; }
#statusstrip .spin { --c: #ffd36a; } #statusstrip .stone { --c: #c8c8c0; } #statusstrip .chill { --c: #bfe8ff; } #statusstrip .burn { --c: #ff8a3a; } #statusstrip .poison { --c: #7fdc5a; }
#statusstrip .ride.low, #statusstrip .soul.hungry { animation: scpulse 1s ease-in-out infinite alternate; }
@keyframes scpulse { to { border-color: var(--c); box-shadow: 0 0 6px color-mix(in srgb, var(--c) 50%, transparent); } }
#tipcard { position: fixed; left: 50%; bottom: calc(112px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); width: max-content; max-width: min(340px, calc(100vw - 32px)); box-sizing: border-box; display: grid; gap: 3px; padding: 9px 14px 10px; background: var(--panel); border: 1px solid var(--line); border-left: 2px solid #bff6ff; border-radius: 6px; backdrop-filter: blur(6px); pointer-events: none; font-size: 12px; line-height: 1.45; color: var(--moon); z-index: 2; }
#tipcard[hidden] { display: none; }
#tipcard b { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: #bff6ff; margin-bottom: 2px; }
#tipcard span { color: #d6dccd; }
#tipcard.in { animation: tipin 0.22s ease-out; }
@keyframes tipin { from { opacity: 0; transform: translate(-50%, 6px); } }
body.touch #tipcard { bottom: auto; top: calc(34% + env(safe-area-inset-top, 0px)); }
@media (max-width: 760px) { body.touch #tipcard { top: calc(46% + env(safe-area-inset-top, 0px)); } }
@media (prefers-reduced-motion: reduce) { #tipcard.in, #statusstrip .sc { animation: none; } }
