:root { --ink: #151c22; --panel: #14231fdd; --line: #d6a64c66; --text: #f2e6c4; --gold: #d6a64c; --mint: #7fe0c4; }
html, body { margin: 0; height: 100%; background: var(--ink); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
body { font: 600 15px/1.3 system-ui, "Segoe UI", sans-serif; color: var(--text); }
#view { display: block; width: 100vw; height: 100vh; }
#loading { position: fixed; inset: 0; display: grid; place-items: center; font-size: 20px; }
.panel { position: fixed; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.vitals { left: max(12px, env(safe-area-inset-left)); top: max(12px, env(safe-area-inset-top)); width: min(300px, 46vw); }
.row { display: flex; justify-content: space-between; margin-bottom: 6px; }
#level { color: var(--gold); }
.bar { height: 10px; border-radius: 6px; background: #0b1412; overflow: hidden; }
.bar + .bar { height: 4px; margin-top: 5px; }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; }
.hp i { background: var(--mint); }
.xp i { background: var(--gold); }
.tally { right: max(12px, env(safe-area-inset-right)); top: max(12px, env(safe-area-inset-top)); display: flex; gap: 14px; }
#dash { position: fixed; right: max(22px, env(safe-area-inset-right)); bottom: max(26px, env(safe-area-inset-bottom)); width: 92px; height: 92px; border-radius: 50%; border: 2px solid var(--line); background: var(--panel); color: var(--text); font: inherit; display: none; }
#stick { position: fixed; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 2px solid var(--line); background: #14231f66; display: none; pointer-events: none; }
#stick i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px; border-radius: 50%; background: var(--gold); opacity: .8; }
body.touch #dash { display: block; }
@media (max-width: 560px) { .tally { top: auto; bottom: max(12px, env(safe-area-inset-bottom)); right: auto; left: 50%; transform: translateX(-50%); font-size: 12px; white-space: nowrap; } }
#texts { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#texts span { position: absolute; left: 0; top: 0; font-weight: 800; font-size: 17px; text-shadow: 0 0 3px #000, 0 2px 0 #000; white-space: nowrap; will-change: transform; }
#texts span.big { font-size: 26px; }
#overlay { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 16px; box-sizing: border-box; background: #0b1412cc; backdrop-filter: blur(3px); overflow: auto; }
#overlay[hidden] { display: none; }
#overlay h1 { margin: 0; font: 700 clamp(24px, 5vw, 40px)/1.1 Georgia, "Times New Roman", serif; color: var(--gold); letter-spacing: .04em; text-align: center; }
#overlay p { margin: 0; }
.cards { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; width: 100%; max-width: 980px; }
.card { flex: 1 1 220px; max-width: 300px; min-height: 190px; display: flex; flex-direction: column; gap: 8px; padding: 16px; text-align: left; border-radius: 14px; border: 2px solid var(--line); background: linear-gradient(170deg, #1d332c, #101b18); color: var(--text); font: inherit; cursor: pointer; transition: transform .12s, border-color .12s; }
.card:hover, .card:focus-visible { transform: translateY(-4px); border-color: var(--gold); outline: none; }
.card small { color: var(--mint); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; }
.card b { font: 700 19px/1.2 Georgia, "Times New Roman", serif; color: var(--gold); }
.card span { font-weight: 500; font-size: 14px; opacity: .92; }
.card em { margin-top: auto; font-style: normal; font-size: 12px; opacity: .7; }
.card.epic { border-color: #b98cff; }
.card.epic b { color: #d2b4ff; }
.card.relic { border-color: #6eaaff; }
.card.rarity2 { border-color: #ffa03c; }
.card.rarity3 { border-color: #c846a0; }
.wide { padding: 12px 22px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; cursor: pointer; }
.wide:hover { border-color: var(--gold); }
@media (max-width: 560px) { .card { min-height: 0; flex-basis: 100%; max-width: none; padding: 12px; } #overlay { justify-content: flex-start; } }
#overlay.menu { background: radial-gradient(circle at 50% 30%, #24443a, #0b1412 70%); }
#overlay.menu h1 { font-size: clamp(40px, 9vw, 84px); letter-spacing: .12em; }
.card:disabled { opacity: .45; cursor: default; transform: none; border-color: var(--line); }
#loading[hidden] { display: none; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 46%, transparent 52%, #0a1410b3 100%); mix-blend-mode: multiply; }
.tally { align-items: center; }
#boss { position: fixed; left: 50%; top: max(64px, env(safe-area-inset-top)); transform: translateX(-50%); width: min(520px, 80vw); text-align: center; font: 700 16px/1.4 Georgia, serif; color: #f0b0b8; letter-spacing: .1em; text-transform: uppercase; }
#boss[hidden] { display: none; }
#boss .bar { height: 12px; border: 1px solid #c6485a88; margin-top: 4px; }
#boss .bar i { background: linear-gradient(90deg, #8d3847, #e0607a); }
#abilities { position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 10px; }
body.touch #abilities { left: auto; right: max(12px, env(safe-area-inset-right)); bottom: max(130px, env(safe-area-inset-bottom)); transform: none; flex-direction: column; }
@media (max-width: 560px) { .tally { bottom: auto; top: max(74px, env(safe-area-inset-top)); } }
#overlay h2 { margin: 6px 0 -6px; font: 700 13px/1 system-ui, sans-serif; letter-spacing: .22em; text-transform: uppercase; color: var(--mint); opacity: .85; }
.motto { font: italic 500 17px/1.2 Georgia, serif; opacity: .8; margin-top: -10px !important; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.stats div { min-width: 86px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); text-align: center; display: flex; flex-direction: column; gap: 2px; }
.stats b { font: 700 24px/1 Georgia, serif; color: var(--gold); }
.stats small { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; opacity: .7; }
.card.hero { min-height: 150px; }
.card.hero em { color: var(--mint); opacity: 1; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; }
.card.last { border-color: var(--gold); box-shadow: 0 0 24px #d6a64c33; }
.keeper { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; max-width: 980px; }
.upgrade { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; text-align: left; border-radius: 12px; border: 1px solid var(--line); background: linear-gradient(170deg, #1d332c, #101b18); color: var(--text); font: inherit; cursor: pointer; }
.upgrade:hover:enabled { border-color: var(--gold); }
.upgrade:disabled { cursor: default; }
.upgrade:disabled b, .upgrade:disabled span { opacity: .6; }
.upgrade b { font: 700 16px/1.2 Georgia, serif; color: var(--gold); }
.upgrade span { font-weight: 500; font-size: 13px; opacity: .9; }
.upgrade em { font-style: normal; font-size: 12px; color: var(--mint); }
.pips { --rank: 0; display: block; height: 5px; margin: 4px 0 2px; border-radius: 3px; background: linear-gradient(90deg, var(--gold) calc(var(--rank) * 100%), #0b1412 calc(var(--rank) * 100%)); }
.primary { background: linear-gradient(170deg, #d6a64c, #a87a2c); color: #1a1408; border-color: #f2d48a; font-weight: 800; padding: 14px 30px; }
#overlay.result { background: radial-gradient(circle at 50% 30%, #2a2030cc, #0b1412ee 70%); }
@media (max-width: 760px) { .keeper { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stats div { min-width: 64px; padding: 8px 10px; } .stats b { font-size: 19px; } }
#overlay { justify-content: safe center; }
#overlay.menu, #overlay.result { justify-content: flex-start; padding-top: max(24px, env(safe-area-inset-top)); padding-bottom: 32px; touch-action: pan-y; }
#overlay.menu > *, #overlay.result > * { flex: none; }
#overlay.menu > h1 { margin-top: auto; }
#overlay.menu > .keeper { margin-bottom: auto; }
@media (max-width: 560px) { .card.hero { min-height: 0; flex: 1 1 40%; padding: 10px 12px; gap: 5px; } .card.hero b { font-size: 16px; } .card.hero span { font-size: 12px; } .stats { gap: 6px; flex-wrap: nowrap; } .stats div { min-width: 0; flex: 1; padding: 8px 6px; } .stats small { font-size: 9px; } .upgrade { padding: 9px 10px; } .upgrade b { font-size: 14px; } .upgrade span { font-size: 11px; } #overlay.menu h1 { font-size: 44px; } }
#overlay.menu { background: linear-gradient(90deg, #08110ff5 0%, #0a1512d9 34%, #0a151200 64%), url(assets/keyart.jpg) right center / cover no-repeat #0b1412; backdrop-filter: none; align-items: flex-start; padding-left: clamp(16px, 5vw, 80px); }
#overlay.menu > * { width: min(600px, 100%); max-width: 600px; }
#overlay.menu > h1, #overlay.menu > h2, #overlay.menu > p { text-align: left; }
#overlay.menu > h1 { text-shadow: 0 0 40px #d6a64c55; }
#overlay.menu .stats, #overlay.menu .cards { justify-content: flex-start; }
#overlay.menu .card.hero { flex: 1 1 40%; max-width: none; min-height: 120px; }
#overlay.menu .keeper { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#overlay.menu .card, #overlay.menu .upgrade, #overlay.menu .stats div { background: linear-gradient(170deg, #1d332ce6, #101b18e6); backdrop-filter: blur(6px); }
#overlay.result { background: linear-gradient(#0b1412b3, #0b1412e6), url(assets/grove.jpg) center / cover no-repeat #0b1412; backdrop-filter: none; justify-content: safe center; }
@media (max-width: 900px) { #overlay.menu { background: linear-gradient(#0a1512a6 0%, #0a1512e6 38%, #08110ffa 70%), url(assets/keyart.jpg) 78% top / auto 62vh no-repeat #08110f; align-items: center; padding-left: 16px; }
  #overlay.menu > h1, #overlay.menu > h2, #overlay.menu > p { text-align: center; } #overlay.menu .stats, #overlay.menu .cards { justify-content: center; } }
@media (max-width: 560px) { #overlay.menu .card.hero { min-height: 0; } }
.icon { --x: 0; --y: 0; display: block; flex: none; width: var(--size, 44px); aspect-ratio: 1; background: url(assets/icons.webp) calc(var(--x) / 7 * 100%) calc(var(--y) / 13 * 100%) / 800% auto no-repeat; }
.card .art { --size: 84px; align-self: center; margin: -4px 0 2px; filter: drop-shadow(0 6px 10px #0008); }
.card.hero { position: relative; padding-right: 92px; }
.card.hero .portrait { --size: 76px; position: absolute; right: 10px; top: 12px; filter: drop-shadow(0 4px 8px #0009); }
.card.hero:disabled .portrait { filter: grayscale(.8) brightness(.7); }
.upgrade { position: relative; padding-left: 62px !important; }
.upgrade .icon { --size: 44px; position: absolute; left: 9px; top: 10px; }
.upgrade .pips { width: 100%; }
.tally .coin { display: flex; align-items: center; gap: 4px; }
.tally .coin i { --size: 22px; }
.tally b { color: var(--gold); }
#clock { font-variant-numeric: tabular-nums; opacity: .85; }
#mute { --size: 26px; border: 0; background-color: transparent; cursor: pointer; padding: 0; }
#abilities button { --ready: 1; position: relative; width: 66px; height: 66px; padding: 0; border-radius: 50%; border: 2px solid var(--line); background: #101b18; cursor: pointer; overflow: visible; box-shadow: 0 4px 14px #0008; transition: transform .1s, border-color .2s; }
#abilities button:active { transform: scale(.93); }
#abilities button i { --size: 100%; border-radius: 50%; }
/* The cooldown sweeps away clockwise like a clock hand. */
#abilities button::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(#0000 calc(var(--ready) * 360deg), #060d0bcc 0); pointer-events: none; }
#abilities small { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); padding: 1px 7px; border-radius: 8px; border: 1px solid var(--line); background: #101b18; color: var(--text); font: 700 10px/1.4 system-ui, sans-serif; z-index: 1; }
#abilities #a-ult { width: 76px; height: 76px; }
#abilities .charged { border-color: var(--gold); animation: charged 1.2s ease-in-out infinite; }
#abilities .locked i { filter: grayscale(1) brightness(.5); }
@keyframes charged { 50% { box-shadow: 0 0 22px #d6a64ccc, 0 4px 14px #0008; } }
#abilities { align-items: flex-end; gap: 14px; }
body.touch #abilities { align-items: center; gap: 10px; }
body.touch #abilities small, body.touch #a-dash { display: none; }
body.touch #abilities button { width: 62px; height: 62px; }
body.touch #abilities #a-ult { width: 68px; height: 68px; }
@media (max-width: 560px) { .card .art { --size: 56px; position: absolute; right: 10px; top: 10px; margin: 0; } .card { position: relative; } .card:not(.hero) > b, .card:not(.hero) > small { padding-right: 62px; } .card.hero { padding-right: 62px !important; } .card.hero .portrait { --size: 50px; right: 6px; top: 8px; } .upgrade { padding-left: 48px !important; } .upgrade .icon { --size: 34px; left: 7px; } }
#goal { position: fixed; left: max(14px, env(safe-area-inset-left)); top: calc(max(12px, env(safe-area-inset-top)) + 74px); max-width: min(300px, 60vw); font: italic 600 14px/1.3 Georgia, serif; color: var(--gold); text-shadow: 0 1px 3px #000, 0 0 8px #000a; pointer-events: none; }
#prompt { position: fixed; left: 50%; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 104px); transform: translateX(-50%); min-width: 210px; padding: 9px 16px 10px; border-radius: 14px; border: 1px solid var(--gold); background: var(--panel); color: var(--text); font: inherit; text-align: center; display: flex; flex-direction: column; gap: 3px; cursor: pointer; box-shadow: 0 6px 20px #0009; }
#prompt[hidden] { display: none; }
#prompt b { font: 700 17px/1.2 Georgia, serif; color: var(--gold); }
#prompt span { font-size: 12px; opacity: .85; }
#prompt .bar { height: 5px; margin-top: 3px; }
#prompt .bar i { background: var(--gold); transition: none; }
#prompt.blocked { border-color: #c6485a; }
#prompt.blocked span { color: #f0a0aa; opacity: 1; }
#prompt.blocked .bar { display: none; }
body.touch #prompt { bottom: auto; top: 38%; left: 50%; }
@media (max-width: 560px) { #goal { top: calc(max(74px, env(safe-area-inset-top)) + 44px); font-size: 12px; } }
#hurt, #flash { position: fixed; inset: 0; pointer-events: none; opacity: 0; }
#hurt { background: radial-gradient(ellipse at 50% 50%, transparent 45%, #c61e3acc 100%); }
#flash { background: radial-gradient(circle at 50% 55%, #ffe9a8cc, #d6a64c33 45%, transparent 70%); mix-blend-mode: screen; }
#veil { position: fixed; inset: 0; pointer-events: none; opacity: 0; background: #060d0b; }
.purse { display: flex; align-items: center; gap: 8px; font: 700 22px/1 Georgia, serif; color: var(--gold); }
.purse .icon { --size: 30px; }
.card .price { color: var(--gold); opacity: 1; font-size: 15px; font-weight: 800; }
.card:disabled .price { color: #f0a0aa; }
.wide:disabled { opacity: .45; cursor: default; }
#overlay.shop { background: linear-gradient(#0b1412cc, #0b1412ee), url(assets/grove.jpg) center / cover no-repeat #0b1412; }
#yaga { --size: 46px; position: fixed; right: max(12px, env(safe-area-inset-right)); top: calc(max(12px, env(safe-area-inset-top)) + 58px); width: 58px; height: 58px; border-radius: 50%; border: 2px solid var(--line); background: #101b18 url(assets/icons.webp) calc(2 / 7 * 100%) calc(13 / 13 * 100%) / 800% auto no-repeat; cursor: pointer; box-shadow: 0 4px 14px #0008; }
#yaga[hidden] { display: none; }
@media (max-width: 560px) { #yaga { top: calc(max(74px, env(safe-area-inset-top)) + 96px); width: 50px; height: 50px; } }
#pause { --size: 26px; border: 0; background-color: transparent; cursor: pointer; padding: 0; }
#map { position: fixed; right: max(12px, env(safe-area-inset-right)); top: calc(max(12px, env(safe-area-inset-top)) + 56px); width: 168px; height: 168px; border-radius: 14px; border: 1px solid var(--line); background: #0f1c18b8; pointer-events: none; }
#yaga { right: auto; left: max(14px, env(safe-area-inset-left)); top: calc(max(12px, env(safe-area-inset-top)) + 122px); }
@media (max-width: 560px) { #map { width: 104px; height: 104px; top: calc(max(74px, env(safe-area-inset-top)) + 52px); } #yaga { top: calc(max(74px, env(safe-area-inset-top)) + 96px); } }
#overlay .wide { min-width: 240px; }
#dash.icon { --size: 92px; background-color: #101b18; box-shadow: 0 4px 14px #0008; }
@media (max-width: 560px) { #goal { max-width: 46vw; } }
.upgrade.last { border-color: var(--gold); box-shadow: 0 0 18px #d6a64c33; }
#overlay.menu .arsenal { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.arsenal .upgrade { padding: 62px 12px 12px !important; text-align: center; align-items: center; }
.arsenal .upgrade .icon { --size: 50px; left: 50%; top: 8px; transform: translateX(-50%); }
.arsenal .upgrade:disabled .icon { filter: grayscale(1) brightness(.55); }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modes .upgrade { padding-left: 14px !important; }
.modes .mode1 b { color: #f08a96; }
.modes .mode1.last { border-color: #c6485a; box-shadow: 0 0 18px #c6485a44; }
.start { font-size: 20px; letter-spacing: .14em; text-transform: uppercase; padding: 16px 30px !important; box-shadow: 0 8px 26px #d6a64c44; }
#overlay.menu .card.hero { min-height: 96px; }
@media (max-width: 560px) { .arsenal .upgrade b { font-size: 12px; } .arsenal .upgrade span { display: none; } .start { position: sticky; bottom: 8px; z-index: 2; } }
.start { position: sticky; bottom: 8px; z-index: 2; }
body.menu { background: url(assets/grove.jpg) center / cover no-repeat #0b1412; }
#overlay.menu { background: linear-gradient(90deg, #08110ff0 0%, #0a1512cc 36%, #0a151200 60%); }
@media (max-width: 900px) {
  #overlay.menu { background: linear-gradient(#0a151200 0%, #0a151200 26vh, #0a1512e6 44vh, #08110ffa 60vh); padding-top: 4vh; }
  #overlay.menu > h1 { margin-top: 0; font-size: 40px; }
  #overlay.menu > .stats { margin-top: 30vh; }
  #overlay.menu > .motto { display: none; }
}
#map { pointer-events: auto; cursor: pointer; }
#goal { display: flex; flex-direction: column; gap: 2px; }
#goal b { font-weight: 600; }
#goal span { font: 500 12px/1.3 system-ui, sans-serif; color: var(--text); opacity: .85; }
#kit { position: fixed; left: max(12px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap-reverse; gap: 4px; max-width: min(330px, 34vw); pointer-events: none; }
#kit span { position: relative; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: #101b18cc; pointer-events: auto; }
#kit .icon { --size: 32px; }
#kit b { position: absolute; right: -3px; bottom: -4px; min-width: 14px; padding: 0 3px; border-radius: 7px; background: var(--gold); color: #1a1408; font: 800 10px/14px system-ui, sans-serif; text-align: center; }
#combo { position: fixed; right: max(200px, 14vw); top: 30%; font: italic 800 44px/1 Georgia, serif; color: var(--gold); text-shadow: 0 2px 0 #000, 0 0 18px #d6a64c88; pointer-events: none; }
#combo[hidden], #intro[hidden], #atlas[hidden] { display: none; }
#intro { position: fixed; left: 0; right: 0; top: 26%; padding: 18px 0; text-align: center; font: 700 clamp(30px, 7vw, 68px)/1.1 Georgia, serif; letter-spacing: .14em; text-transform: uppercase; color: #ffd0d6; text-shadow: 0 3px 0 #000, 0 0 40px #c6485a; background: linear-gradient(90deg, #0000, #1a0a0ecc 30%, #1a0a0ecc 70%, #0000); pointer-events: none; animation: intro .5s ease-out; }
@keyframes intro { from { opacity: 0; letter-spacing: .5em; } }
#atlas { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px; box-sizing: border-box; background: #070d0be6; backdrop-filter: blur(4px); }
#atlas h1 { margin: 0; font: 700 28px/1 Georgia, serif; color: var(--gold); letter-spacing: .1em; }
#atlas p { margin: 0; font-size: 13px; opacity: .85; text-align: center; }
#atlas-sheet { position: relative; border-radius: 6px; border: 3px solid #3a2716; outline: 2px solid #b4791f; outline-offset: 3px; background: #22170e; overflow: hidden; box-shadow: 0 10px 40px #000a, inset 0 0 40px #0008; }
.map-icon { --x: 0; --y: 0; display: block; flex: none; width: var(--size, 32px); aspect-ratio: 1; background: url(assets/map-icons.webp) calc(var(--x) / 4 * 100%) calc(var(--y) / 3 * 100%) / 500% auto no-repeat; }
#atlas-chart { display: block; }
.pin { position: absolute; transform: translate(-50%, -50%); padding: 5px 10px; border-radius: 12px; border: 1px solid var(--gold); background: #1d332cee; color: var(--gold); font: 700 12px/1 system-ui, sans-serif; cursor: pointer; box-shadow: 0 0 14px #d6a64c66; }
.pin:disabled { opacity: .55; cursor: default; box-shadow: none; }
#atlas-pins .pin { border-radius: 3px; border: 1.5px solid #3a2716; background: #efdfb8; color: #3a2716; font: italic 700 13px/1 Georgia, serif; box-shadow: 1px 2px 0 #3a271688; }
.extras { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
body.touch #kit { bottom: auto; top: calc(max(74px, env(safe-area-inset-top)) + 150px); max-width: 80px; flex-wrap: wrap; }
body.touch #kit span { width: 26px; height: 26px; }
body.touch #kit .icon { --size: 24px; }
@media (max-width: 560px) { #combo { right: 16px; top: 44%; font-size: 32px; } }
#yaga { left: auto; right: max(12px, env(safe-area-inset-right)); top: calc(max(12px, env(safe-area-inset-top)) + 236px); }
@media (max-width: 560px) { #yaga { top: calc(max(74px, env(safe-area-inset-top)) + 166px); } }
/* The fighting screen is laid out like the original: portrait and health top left, the chapter in the middle,
   purse and buttons top right, objectives under the health, relics bottom left, a round map bottom right. */
.vitals { width: min(340px, 50vw); padding-left: 74px; min-height: 46px; }
#portrait { --size: 56px; position: absolute; left: 9px; top: 50%; transform: translateY(-50%); filter: drop-shadow(0 3px 5px #0009); }
.chapter { left: 50%; top: max(12px, env(safe-area-inset-top)); transform: translateX(-50%); width: min(420px, 34vw); text-align: center; padding: 8px 16px 10px; }
#place { font-size: 13px; letter-spacing: .12em; }
#hunt { margin: 2px 0 5px; font: 700 15px/1.2 system-ui, sans-serif; letter-spacing: .1em; color: var(--gold); font-variant-numeric: tabular-nums; }
#hunt.alarm { color: #ff8a96; }
.chapter .bar { height: 4px; }
.chapter .bar i { background: linear-gradient(90deg, #c6485a, #ff8a70); transition: width .5s linear; }
.tally { gap: 12px; }
#open-map { --size: 26px; border: 0; background-color: transparent; cursor: pointer; padding: 0; }
#goal { top: calc(max(12px, env(safe-area-inset-top)) + 80px); left: max(12px, env(safe-area-inset-left)); padding: 9px 14px; border-radius: 12px; background: #14231fb8; gap: 4px; width: min(312px, 46vw); max-width: none; box-sizing: border-box; font: 500 13px/1.3 system-ui, sans-serif; color: var(--text); text-shadow: none; }
#goal b, #goal span { display: block; padding-left: 16px; position: relative; font: 500 13px/1.3 system-ui, sans-serif; color: var(--text); opacity: .92; }
#goal b::before, #goal span::before { content: ""; position: absolute; left: 0; top: 5px; width: 7px; height: 7px; border-radius: 50%; background: #8a968f; }
#goal b::before { background: var(--mint); }
#map { top: auto; bottom: max(14px, env(safe-area-inset-bottom)); width: 190px; height: 190px; border-radius: 50%; border: 2px solid var(--gold); box-shadow: 0 6px 20px #0009; }
#yaga { top: calc(max(12px, env(safe-area-inset-top)) + 58px); width: auto; height: auto; padding: 8px 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: 600 14px/1.2 system-ui, sans-serif; box-shadow: none; }
#boss { top: max(92px, env(safe-area-inset-top)); }
body.touch #map { bottom: auto; top: calc(max(74px, env(safe-area-inset-top)) + 52px); width: 112px; height: 112px; }
@media (max-width: 760px) {
  .chapter { position: fixed; left: 0; right: 0; top: auto; bottom: auto; transform: none; width: auto; margin: 0 12px; top: calc(max(12px, env(safe-area-inset-top)) + 62px); padding: 5px 12px 7px; }
  #hunt { display: inline; font-size: 12px; margin: 0 0 0 8px; } #place { display: inline; font-size: 11px; }
  .chapter .bar { margin-top: 4px; }
  .tally { top: max(12px, env(safe-area-inset-top)); left: auto; right: max(12px, env(safe-area-inset-right)); transform: none; bottom: auto; padding: 8px 10px; gap: 8px; }
  .tally #kills, .tally #clock { display: none; }
  .vitals { width: min(210px, 52vw); padding-left: 56px; }
  #portrait { --size: 42px; left: 7px; }
  #goal { top: calc(max(12px, env(safe-area-inset-top)) + 110px); width: min(230px, 56vw); font-size: 11px; padding: 6px 10px; }
  #goal b, #goal span { font-size: 11px; }
  body.touch #map { top: calc(max(12px, env(safe-area-inset-top)) + 110px); }
  #yaga { top: calc(max(12px, env(safe-area-inset-top)) + 232px); padding: 6px 10px; font-size: 12px; }
  body.touch #kit { top: calc(max(12px, env(safe-area-inset-top)) + 200px); }
  #boss { top: calc(max(12px, env(safe-area-inset-top)) + 112px); }
}
#dash.icon { background: url(assets/icons.webp) calc(var(--x) / 7 * 100%) calc(var(--y) / 13 * 100%) / 800% auto no-repeat #101b18; }
@media (max-width: 760px) { .vitals { width: min(176px, 42vw); box-sizing: border-box; } .vitals .row { font-size: 12px; } }
/* Level-up cards sit in a column on the left so the fight stays in view; the run waits behind them. */
#overlay.pick { align-items: flex-start; justify-content: safe center; background: linear-gradient(90deg, #08110ff2 0, #0a1512d9 300px, #0a151200 560px); backdrop-filter: none; padding-left: max(18px, env(safe-area-inset-left)); gap: 10px; }
#overlay.pick > h1 { font-size: clamp(22px, 3vw, 30px); text-align: left; }
#overlay.pick .cards { flex-direction: column; flex-wrap: nowrap; width: min(400px, 92vw); max-width: none; gap: 9px; }
#overlay.pick .card { flex: none; max-width: none; min-height: 0; padding: 12px 14px 12px 96px; position: relative; gap: 4px; }
#overlay.pick .card .art { --size: 68px; position: absolute; left: 14px; top: 50%; margin: 0; transform: translateY(-50%); }
#overlay.pick .card:hover, #overlay.pick .card:focus-visible { transform: translateX(6px); }
#overlay.pick .card b { font-size: 17px; }
#overlay.pick .card span { font-size: 13px; }
#overlay.pick .card::after { content: attr(data-key); position: absolute; right: 10px; top: 8px; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line); font: 700 12px/22px system-ui, sans-serif; text-align: center; opacity: .7; }
#overlay.pick .extras { width: min(400px, 92vw); justify-content: flex-start; }
#overlay.pick .extras .wide { min-width: 0; flex: 1; padding: 10px 12px; font-size: 13px; }
@media (max-width: 560px) { #overlay.pick .card { padding: 9px 10px 9px 70px; } #overlay.pick .card .art { --size: 50px; left: 10px; right: auto; top: 50%; } #overlay.pick .card:not(.hero) > b, #overlay.pick .card:not(.hero) > small { padding-right: 26px; } #overlay.pick .card span { font-size: 12px; } }
/* The main menu fits one screen: everything is sized from the height of the window, and nothing scrolls. */
#overlay.menu { overflow: hidden; justify-content: center; gap: clamp(5px, 1.3vh, 13px); padding-top: clamp(8px, 2vh, 24px); padding-bottom: clamp(8px, 2vh, 24px); }
#overlay.menu > * { width: min(560px, 100%); max-width: 560px; }
#overlay.menu > h1 { margin: 0; font-size: clamp(30px, 8.4vh, 76px); line-height: 1; }
#overlay.menu > h2 { margin: clamp(0px, .6vh, 6px) 0 0; font-size: clamp(10px, 1.5vh, 13px); }
#overlay.menu .stats div { padding: clamp(4px, 1vh, 10px) 12px; min-width: 74px; }
#overlay.menu .stats b { font-size: clamp(15px, 2.6vh, 24px); }
.heroes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.heroes.arsenal { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: clamp(5px, 1vh, 10px) 6px; border-radius: 12px; border: 2px solid var(--line); background: linear-gradient(170deg, #1d332ce6, #101b18e6); color: var(--text); font: inherit; cursor: pointer; text-align: center; transition: transform .12s, border-color .12s; }
.tile:hover:enabled { transform: translateY(-2px); border-color: var(--gold); }
.tile .icon { --size: clamp(34px, 7vh, 62px); filter: drop-shadow(0 3px 6px #0009); }
.tile b { font: 700 clamp(11px, 1.7vh, 15px)/1.15 Georgia, serif; color: var(--gold); }
.tile em { font-style: normal; font-size: clamp(9px, 1.35vh, 12px); color: var(--mint); }
.tile.last { border-color: var(--gold); box-shadow: 0 0 20px #d6a64c44; }
.tile:disabled { cursor: default; }
.tile:disabled .icon { filter: grayscale(1) brightness(.55); }
.tile:disabled b { opacity: .6; }
.lore { margin: 0 !important; font: italic 500 clamp(11px, 1.7vh, 14px)/1.25 Georgia, serif; opacity: .85; min-height: 1.25em; }
#overlay.menu .modes .upgrade { padding: clamp(5px, 1vh, 10px) 12px !important; }
#overlay.menu .modes .upgrade b { font-size: clamp(12px, 1.9vh, 16px); }
#overlay.menu .modes .upgrade span { font-size: clamp(10px, 1.45vh, 13px); }
.actions { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; margin-top: clamp(2px, .8vh, 8px); }
#overlay.menu .actions .wide { min-width: 0; padding: clamp(8px, 1.6vh, 16px) 10px !important; position: static; }
#overlay.menu .actions .start { font-size: clamp(14px, 2.3vh, 20px); }
#overlay.menu > .start { position: static; }
#overlay.menu .keeper .upgrade { padding-top: clamp(6px, 1.2vh, 12px); padding-bottom: clamp(6px, 1.2vh, 12px); }
@media (max-width: 900px) {
  #overlay.menu { justify-content: flex-end; padding-top: 0; background: linear-gradient(#0a151200 0%, #0a151200 22vh, #0a1512e6 36vh, #08110ffa 46vh); }
  #overlay.menu > h1 { position: absolute; top: max(8px, env(safe-area-inset-top)); left: 0; right: 0; width: auto; max-width: none; font-size: clamp(22px, 4.6vh, 40px); text-align: center; }
  #overlay.menu > .stats { margin-top: 0; }
  #overlay.menu .stats small { display: none; }
  #overlay.menu .stats div { flex-direction: row; gap: 5px; align-items: baseline; justify-content: center; }
  #overlay.menu .stats div::after { content: attr(data-label); font-size: 9px; opacity: .7; }
  .lore { text-align: center; }
  .tile b { font-size: clamp(9px, 1.5vh, 12px); }
}
/* The minimap is drawn on its own canvas, rim and all, so the element itself has no frame. */
#map { border: 0; border-radius: 50%; background: none; box-shadow: none; width: 220px; height: 220px; }
#map-zoom { position: fixed; right: max(12px, env(safe-area-inset-right)); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 182px); display: flex; flex-direction: column; gap: 4px; }
#map-zoom button, #atlas-tools button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--gold); background: #0c181de6; color: var(--gold); font: 700 18px/1 system-ui, sans-serif; cursor: pointer; padding: 0; }
#atlas { gap: 8px; }
#atlas-sheet { width: min(96vw, 1100px); height: min(70vh, 760px); touch-action: none; cursor: grab; }
#atlas-sheet:active { cursor: grabbing; }
#atlas-chart { width: 100%; height: 100%; }
#atlas-tools { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
#atlas-tools button { width: 38px; height: 38px; font-size: 20px; }
#atlas-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; max-width: min(96vw, 1100px); font-size: 12px; opacity: .9; }
#atlas-legend span { display: flex; align-items: center; gap: 4px; }
#atlas-legend .map-icon { --size: 26px; }
.pin { transform: translate(-50%, 0); }
body.touch #map { width: 132px; height: 132px; }
body.touch #map-zoom { bottom: auto; top: calc(max(12px, env(safe-area-inset-top)) + 112px); right: calc(max(12px, env(safe-area-inset-right)) + 136px); }
body.touch #map-zoom button { width: 26px; height: 26px; font-size: 15px; }
@media (max-width: 760px) { #atlas-sheet { height: 62vh; } #atlas-legend { font-size: 10px; } #atlas-legend .map-icon { --size: 20px; } }
#abilities button::before { content: attr(data-left); position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 2; font: 800 18px/1 system-ui, sans-serif; color: #fff6d8; text-shadow: 0 1px 0 #000, 0 0 6px #000; pointer-events: none; }
#abilities button.cooling i { filter: grayscale(.6) brightness(.7); }
#map-goal { --goal: var(--gold); position: fixed; right: max(12px, env(safe-area-inset-right)); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 226px); display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 6px; border-radius: 12px; border: 1px solid var(--goal); background: #0c181de6; font: 600 12px/1.2 system-ui, sans-serif; color: var(--text); pointer-events: none; }
#map-goal[hidden], #compass[hidden] { display: none; }
#map-goal .icon, #map-goal .map-icon { --size: 22px; }
#compass { --goal: var(--gold); --turn: 0rad; position: fixed; left: 0; top: 0; margin: -24px 0 0 -24px; width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--goal); background: #0c181de6; display: flex; align-items: center; justify-content: center; pointer-events: none; box-shadow: 0 0 16px #0009; }
#compass .icon, #compass .map-icon { --size: 32px; }
#compass b { position: absolute; top: 50px; left: 50%; transform: translateX(-50%); white-space: nowrap; font: 700 11px/1 system-ui, sans-serif; color: var(--text); text-shadow: 0 1px 2px #000, 0 0 4px #000; }
#compass .tip { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform: rotate(var(--turn)) translateX(30px); transform-origin: 0 0; }
#compass .tip::after { content: ""; position: absolute; left: -2px; top: -8px; border-left: 12px solid var(--goal); border-top: 8px solid transparent; border-bottom: 8px solid transparent; }
body.touch #map-goal { bottom: auto; top: calc(max(12px, env(safe-area-inset-top)) + 248px); }
@media (max-width: 760px) { #map-goal { top: calc(max(12px, env(safe-area-inset-top)) + 248px); bottom: auto; font-size: 11px; } }
#map-goal { white-space: nowrap; z-index: 1; }
/* Desktop: the caption sits above the minimap, left of the zoom buttons. */
#map-goal { right: calc(max(12px, env(safe-area-inset-right)) + 44px); }
/* Phone: zoom buttons in a row under the minimap, the caption under them. */
body.touch #map-zoom { flex-direction: row; top: calc(max(12px, env(safe-area-inset-top)) + 236px); right: calc(max(12px, env(safe-area-inset-right)) + 38px); }
body.touch #map-goal { top: calc(max(12px, env(safe-area-inset-top)) + 270px); right: max(12px, env(safe-area-inset-right)); }
#tip { position: fixed; z-index: 30; max-width: min(300px, 80vw); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #0d1714f2; color: var(--text); box-shadow: 0 6px 22px #000a; pointer-events: none; font: 13px/1.4 system-ui, sans-serif; }
#tip b { display: block; margin-bottom: 4px; color: var(--gold); font: 700 15px/1.25 Georgia, serif; }
#tip p { margin: 0 0 3px; }
#tip small { display: block; margin-top: 6px; color: #9fb8ae; font-size: 11px; }
#abilities small kbd { font: inherit; }
#overlay .tip-yaga { max-width: 640px; margin: -4px auto 10px; color: #b8e09a; font: italic 15px/1.4 Georgia, serif; text-align: center; }
#overlay .coop { display: flex; flex-direction: column; gap: 10px; align-items: center; max-width: 420px; margin: 0 auto; }
#overlay .coop .room { font: 700 46px/1 Georgia, serif; letter-spacing: 8px; color: var(--gold); margin: 6px 0; }
#overlay .coop .code { width: 220px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: #0d1714; color: var(--text); font: 700 24px/1 system-ui, sans-serif; letter-spacing: 6px; text-align: center; }
#overlay .coop .notice { color: #b8e09a; font: italic 15px/1.4 Georgia, serif; text-align: center; }
/* The minimap: a frameless silhouette of the explored land in the bottom right corner. */
#map { top: auto; bottom: max(14px, env(safe-area-inset-bottom)); right: max(14px, env(safe-area-inset-right)); width: 230px; height: 180px; border: 0; border-radius: 0; background: none; box-shadow: none; }
#map-zoom { display: none; }
body.touch #map { bottom: auto; top: calc(max(12px, env(safe-area-inset-top)) + 54px); width: 140px; height: 110px; }
@media (max-width: 760px) { body.touch #map { top: calc(max(12px, env(safe-area-inset-top)) + 104px); } }

/* The map tools as ink seals on the parchment. */
#atlas-tools button { background: #efdfb8 !important; color: #3a2716 !important; border: 2px solid #3a2716 !important; box-shadow: 1px 2px 0 #3a271688 !important; font-family: Georgia, serif !important; }
