
/* Embers of Solun UI. VOICE: a storybook game box, warm wood and parchment over a darkening world
   IDEA: a carved wooden notice board and ledger, the town's own woodwork
   PICTURE: the live pixel town itself, full screen
   COLOUR and TYPE: wood browns, parchment ink, ember orange accent; pixel font from the art pack
   LAYOUT: game fills the screen, HUD hugs the corners, panels are wooden boards */
@font-face { font-family: Pixel; src: url(../assets/ui/font.ttf); }
:root { --ink: #3b2418; --parch: #f3e2c0; --wood: #8a5a34; --dark: #24160f; --ember: #f08a3c; --gold: #ffd66b; --mana: #5fa8ff; color-scheme: dark; }
* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #120b08; color: var(--parch); font: 16px/1.4 Pixel, ui-monospace, monospace; user-select: none; word-spacing: .3em; }
canvas#game { position: fixed; left: 0; top: 0; image-rendering: pixelated; image-rendering: crisp-edges; cursor: crosshair; }
.hidden { display: none !important; }
img { image-rendering: pixelated; }
.board { border: 18px solid transparent; border-image: url(../assets/ui/panel.png) 6 / 18px stretch; background: #fbecc9; background-clip: padding-box; color: var(--ink); image-rendering: pixelated; letter-spacing: .02em; }
.btn { font: inherit; font-size: 16px; color: var(--ink); background: none; border: 12px solid transparent; border-image: url(../assets/ui/btn.png) 5 fill / 12px stretch; padding: 0 8px; min-height: 44px; cursor: pointer; image-rendering: pixelated; }
.btn:hover:not([disabled]), .btn.sel { border-image-source: url(../assets/ui/btnh.png); }
.btn:active:not([disabled]) { border-image-source: url(../assets/ui/btnp.png); }
.btn[disabled] { opacity: .55; cursor: default; }
button, input, textarea { word-spacing: .3em; }
.btn:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
.btn.small { min-height: 36px; font-size: 14px; border-width: 9px; border-image-width: 9px; padding: 0 4px; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud-tl { position: absolute; left: 12px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
#hearts { display: flex; flex-wrap: wrap; max-width: 260px; gap: 0; filter: drop-shadow(0 2px 0 #0008); }
.heart { width: 28px; height: 28px; background: url(../assets/ui/heart.png) 0 0 / 140px 28px; display: inline-block; }
.heart.f0 { background-position: 0 0; }
.heart.f2 { background-position: -56px 0; } .heart.f4 { background-position: -112px 0; }
.heart.halfmax { width: 14px; }   /* an odd maximum: only the left half of the last heart */
#mana { position: relative; width: 150px; height: 14px; background: #1c2438; border: 2px solid #0d1220; box-shadow: 0 2px 0 #0008; }
#mana-fill { height: 100%; background: linear-gradient(#8cc4ff, var(--mana)); transition: width .15s; }
#mana-txt { position: absolute; inset: 0; font-size: 11px; line-height: 10px; text-align: center; color: #fff; text-shadow: 1px 1px 0 #000; }
#goldbox { display: flex; align-items: center; gap: 6px; font-size: 18px; color: var(--gold); text-shadow: 2px 2px 0 #000; }
#goldbox i { width: 20px; height: 20px; background: url(../assets/items/coin.png) 0 0 / 80px 20px; image-rendering: pixelated; }
#buffs { align-self: flex-start; padding: 4px 7px; background: #2a1a10d0; border: 2px solid #5e3b22; font-size: 14px; line-height: 1.55; white-space: pre-line; text-shadow: 1px 1px 0 #000; }
#buffs:empty { display: none; }
#buffs { pointer-events: auto; cursor: help; }   /* hover a line: what it does (ui.js showBuffTip) */
#hud-tr { position: absolute; right: 12px; top: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#clock { font-size: 18px; padding: 4px 10px; background: #2a1a10d0; border: 2px solid #5e3b22; color: var(--parch); text-shadow: 1px 1px 0 #000; white-space: nowrap; }
#clock.night { color: #b9c8ff; background: #121a33d0; border-color: #33406b; }
.hud-btns { display: flex; gap: 6px; pointer-events: auto; }
.hud-btns button { font: 13px Pixel, monospace; color: var(--parch); background: #2a1a10c0; border: 2px solid #5e3b22; padding: 6px 8px; cursor: pointer; min-height: 32px; }
.hud-btns button:hover { background: #4a2e1a; }
#tracker { position: absolute; right: 12px; top: 96px; width: 230px; display: flex; flex-direction: column; gap: 6px; }
.tq { background: #1d120bc8; border-left: 3px solid var(--ember); padding: 5px 8px; font-size: 13px; text-shadow: 1px 1px 0 #000; }
.tq b { display: block; color: var(--gold); font-weight: normal; font-size: 14px; }
.tq span { display: block; color: #f1e4c8; font-size: 14px; }
.tq.ready { border-color: #7dff9a; } .tq.ready span { color: #9dffb0; }
#hotbar { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 6px; }
.slot { position: relative; width: 52px; height: 52px; background: url(../assets/ui/cell.png) 0 0 / 100% 100%; image-rendering: pixelated; display: grid; place-items: center; overflow: hidden; }
.slot img { width: 28px; height: 28px; object-fit: contain; }
.slot b { position: absolute; left: 4px; top: 2px; font-size: 11px; color: #fff; text-shadow: 1px 1px 0 #000; font-weight: normal; }
.slot em { position: absolute; right: 5px; bottom: 2px; font-size: 13px; color: #fff; text-shadow: 1px 1px 0 #000; font-style: normal; }
.slot span { color: #6b4a33; font-size: 20px; }
.slot.locked img { opacity: .3; } .slot.nomana img { filter: grayscale(1) brightness(.7); }
.slot .cd { position: absolute; left: 0; bottom: 0; width: 100%; height: 0; background: #000a; }
.slot.wep img { width: 18px; height: 34px; }
.slot.wep.second { width: 40px; height: 40px; align-self: end; } .slot.wep.second img { width: 14px; height: 26px; opacity: .8; }   /* the second weapon: Shift */
#bossbar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); width: min(420px, 60vw); text-align: center; color: #ffb0a0; text-shadow: 2px 2px 0 #000; font-size: 15px; }
#bossbar .one, #boss-parts .part > div { height: 12px; background: #2a0d0d; border: 2px solid #000; margin-top: 3px; }
#boss-fill, #boss-parts .part-fill { height: 100%; background: linear-gradient(#ff7a5a, #b8261f); transition: width .2s; }
/* a fight with several health pools (the Oathbound Pair): a bar each, side by side, under the fight's name */
#boss-parts { display: none; gap: 14px; margin-top: 2px; }
#bossbar.parts .one { display: none; }
#bossbar.parts #boss-parts { display: flex; }
#boss-parts .part { flex: 1; min-width: 0; }
#boss-parts .part em { font-style: normal; font-size: 13px; display: block; }
#boss-parts .part > div { height: 10px; margin-top: 1px; }
#boss-parts .part.down em, #boss-parts .part.down > div { opacity: .5; }
/* the colosseum's crowd (systems/bout.js): seen, never heard. Clean play fills it; finish above the laurel's line to win it */
#crowd { margin-top: 4px; color: #f0dca0; font-size: 13px; }
#crowd em { font-style: normal; display: block; }
#crowd em b { font-weight: normal; color: #fff0c0; }
#crowd .meter { position: relative; height: 8px; background: #1e1a10; border: 2px solid #000; margin: 1px auto 0; width: 70%; }
#crowd-fill { height: 100%; width: 40%; background: linear-gradient(#f4d27a, #b98a2a); transition: width .25s; }
#crowd .laurel { position: absolute; top: -4px; bottom: -4px; left: 80%; width: 2px; background: #9fd08a; box-shadow: 0 0 0 1px #000; }
#crowd.roar #crowd-fill { background: linear-gradient(#d8f0a0, #7fb04a); }
/* the new-version notice (core/updates.js): a small bar at the top centre, over everything; below the boss bar in a fight */
#update { position: fixed; top: 6px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 16px);
  padding: 6px 8px 6px 14px; background: #fbecc9; color: var(--ink); border: 3px solid #6b2a0c; box-shadow: 0 3px 0 rgba(0,0,0,.45); font-size: 14px; line-height: 1.3; }
#update.hidden { display: none; }
@media (min-width: 700px) { #update span { white-space: nowrap; } }
#hud:not(.hidden):has(#bossbar:not(.hidden)) ~ #update { top: 60px; }
#hud:not(.hidden):has(#bossbar.parts:not(.hidden)) ~ #update { top: 78px; }
#update button { font: 14px Pixel, monospace; color: var(--ink); background: #f0c070; border: 2px solid #6b2a0c; padding: 4px 10px; min-height: 32px; cursor: pointer; flex: none; }
#update #update-x { background: transparent; border-color: transparent; padding: 4px 8px; font-size: 18px; }
#update button:focus-visible { outline: 2px solid #8a3b12; outline-offset: 2px; }
#area { position: fixed; top: 22%; left: 0; right: 0; text-align: center; font-size: 34px; color: var(--parch); text-shadow: 3px 3px 0 #000; opacity: 0; pointer-events: none; letter-spacing: 1px; }
#area.show { animation: area 2.6s ease; }
@keyframes area { 0% { opacity: 0; transform: translateY(8px); } 15%, 70% { opacity: 1; transform: none; } 100% { opacity: 0; } }
#toasts { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; width: min(560px, 92vw); }
.toast { background: #1d120be8; border: 2px solid #5e3b22; padding: 7px 14px; font-size: 16px; letter-spacing: .02em; text-align: center; color: var(--parch); transition: opacity .5s, transform .5s; }
.toast.gold { border-color: #c9962c; color: var(--gold); } .toast.warn { border-color: #b8261f; color: #ffb0a0; } .toast.quest { border-color: #3d8a55; color: #b8ffc8; }
.toast.out { opacity: 0; transform: translateY(-6px); }
/* a boss's note on the fight: the game waits under it until you've read it (UI.bossNote) */
#note { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); width: min(600px, 92vw); background: #1d120bf2; border: 2px solid #b8261f; padding: 12px 18px 10px; text-align: center; color: #ffd2c4; cursor: pointer; box-shadow: 0 4px 0 #0008; z-index: 30; }
#note.gold { border-color: #c9962c; color: var(--gold); } #note.plain { border-color: #5e3b22; color: var(--parch); }
#note p { font-size: 18px; line-height: 1.45; margin: 0 0 8px; letter-spacing: .02em; }
#note em { display: block; font-style: normal; font-size: 13px; color: #c9a77c; letter-spacing: .06em; }
#note em b { display: inline-block; min-width: 16px; padding: 0 4px; margin-right: 4px; border: 1px solid #c9a77c; color: var(--parch); }
#note.hidden { display: none; }
#pickups { position: fixed; left: 12px; bottom: 80px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
.pick { display: flex; align-items: center; gap: 6px; background: #1d120bd0; padding: 3px 10px 3px 4px; font-size: 14px; text-shadow: 1px 1px 0 #000; animation: pk .25s ease; }
.pick img { width: 20px; height: 20px; object-fit: contain; } .pick em { color: var(--gold); font-style: normal; }
@keyframes pk { from { transform: translateX(-20px); opacity: 0; } }
#prompt { position: fixed; display: none; transform: translate(-50%, -100%); pointer-events: none; width: 26px; height: 26px; line-height: 22px; text-align: center; background: var(--parch); color: var(--ink); border: 2px solid var(--ink); font-size: 16px; box-shadow: 0 2px 0 #0008; }
@keyframes bob { 50% { margin-top: -3px; } }
#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .3s; }
#fade.on { opacity: 1; }

/* Dialog */
#dialog { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(760px, 96vw); min-height: 150px; display: flex; gap: 14px; align-items: flex-start; cursor: pointer; }
#dlg-face { flex: none; width: 96px; height: 96px; background: url(../assets/ui/facebox.png) 0 0 / 100% 100%; display: grid; place-items: center; }
#dlg-face img { width: 76px; height: 76px; }
#dlg-main { flex: 1; }
#dlg-name { color: #9a3d0e; font-size: 19px; margin-bottom: 6px; }
#dlg-text { font-size: 19px; line-height: 1.55; min-height: 56px; white-space: pre-wrap; color: #2e1a10; }
#dlg-more { text-align: right; font-size: 14px; color: #8a5a34; }
#dlg-choices { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.choice { text-align: left; } .choice b { color: #8a3b12; font-weight: normal; margin-right: 6px; }

/* Modals */
.modal { position: fixed; inset: 0; display: grid; place-items: center; background: #0008; }
.modal > .board { width: min(720px, 96vw); max-height: 88vh; display: flex; flex-direction: column; }
.mhead { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.mhead h3 { margin: 0; font-weight: normal; font-size: 22px; color: #6b2a0c; flex: 1; }
.mhead .gold { color: #8a5a00; font-size: 17px; white-space: nowrap; }
.mhead img.face { width: 48px; height: 48px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.tab { font: inherit; font-size: 15px; background: #d9bd8c; color: var(--ink); border: 2px solid #8a5a34; padding: 6px 12px; cursor: pointer; min-height: 36px; }
.tab.on { background: #fff3d6; border-color: #6b2a0c; color: #6b2a0c; }
.mbody { overflow-y: auto; flex: 1; padding-right: 4px; }
.row { display: flex; gap: 10px; align-items: center; padding: 8px; border-bottom: 2px dashed #c9a46e; }
.row.eq { background: #fff3d680; } .row.dim { opacity: .6; }
.row .ic { flex: none; width: 40px; height: 40px; display: grid; place-items: center; background: url(../assets/ui/cell.png) 0 0 / 100% 100%; }
.row .ic img { max-width: 28px; max-height: 32px; }
.row .ic img.i32 { width: 32px; height: 32px; max-width: none; max-height: none; image-rendering: pixelated; }
.row .info { flex: 1; } .row .info b { font-weight: normal; font-size: 17px; color: #4a1c08; }
.row .info p { margin: 2px 0 0; font-size: 15px; color: #4a2e1c; line-height: 1.4; }
.stat { font-size: 12px; color: #2f5d8a; margin-left: 4px; }
.mat { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; margin-right: 8px; color: #2f6b3a; } .mat img { width: 14px; height: 14px; } .mat.miss { color: #a3261c; }
.buy { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }
.price { color: #8a5a00; font-size: 15px; white-space: nowrap; }
.empty, .note { font-size: 14px; color: #6b4a33; } .done { font-size: 13px; color: #5a3a24; }
h4 { margin: 10px 0 4px; font-weight: normal; color: #6b2a0c; font-size: 17px; }
.stats { font-size: 15px; background: #fff3d6; padding: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.cell { position: relative; background: #fff3d680; border: 2px solid #c9a46e; padding: 6px 4px; text-align: center; font-size: 12px; }
.cell img { width: 28px; height: 28px; object-fit: contain; display: block; margin: 0 auto 2px; }
.cell em { position: absolute; right: 4px; top: 2px; font-style: normal; color: #6b2a0c; }
.cell.use { cursor: pointer; border-color: #3d8a55; } .cell.use:hover { background: #e8ffe8; }
.quest { padding: 8px; border-bottom: 2px dashed #c9a46e; font-size: 14px; } .quest b { font-weight: normal; color: #4a1c08; font-size: 16px; }
.quest p { margin: 2px 0; color: #4a2e1c; font-size: 15px; } .quest small { color: #8a5a34; } .quest.ready div { color: #2f6b3a; }
.pips i { display: inline-block; width: 10px; height: 10px; border: 2px solid #8a5a34; margin-left: 3px; } .pips i.on { background: var(--ember); }
#menu-body { display: flex; flex-direction: column; gap: 8px; }
.vol { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; } .vol input { width: 140px; accent-color: #8a3b12; }
/* Settings (title screen and pause menu): resolution, volumes, full screen */
.settings { display: grid; gap: 8px; font-size: 14px; color: #5a3a24; text-align: left; margin: 6px 0; }
.settings .set-row { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); align-items: center; gap: 10px; margin: 0; font-size: 14px; color: #5a3a24; }
.settings select { font: 15px Pixel, monospace; padding: 6px 8px; background: #fff8e8; color: var(--ink); border: 2px solid #8a5a34; min-height: 36px; }
.settings select:focus-visible, .settings input:focus-visible, #title-settings summary:focus-visible { outline: 2px solid #8a3b12; outline-offset: 2px; }
.settings input[type=range] { width: 100%; accent-color: #8a3b12; min-height: 28px; }
.settings .set-fs { justify-self: start; width: auto; margin-top: 2px; }
#title .settings .set-row { display: grid; margin: 0; }   /* the title's labels are blocks; these rows are grids */
.settings .set-note { margin: 0; font-size: 12px; color: #6b4a33; }
#title-settings { margin-top: 10px; text-align: left; }
#title-settings summary { cursor: pointer; display: block; list-style: none; text-align: center; font-size: 16px; color: #6b2a0c; padding: 8px 10px; min-height: 40px; box-sizing: border-box;
  background: #f3d9a4; border: 2px solid #8a5a34; box-shadow: inset 0 -3px 0 rgba(107,42,12,.18); }   /* looks like a button, so players see it */
#title-settings summary::-webkit-details-marker { display: none; }
#title-settings summary::after { content: ' ▾'; } #title-settings[open] summary::after { content: ' ▴'; }
#title-settings summary:hover { background: #f7e2b6; }
#title-settings[open] summary { margin-bottom: 8px; }
details { font-size: 14px; } summary { cursor: pointer; color: #6b2a0c; padding: 6px 0; }
textarea { width: 100%; height: 70px; font: 11px monospace; margin: 6px 0; background: #fff8e8; color: #333; border: 2px solid #c9a46e; user-select: text; }
.controls { font-size: 13px; color: #5a3a24; line-height: 1.6; }
#summary .board { width: min(520px, 94vw); text-align: center; }
#sum-body { overflow-y: auto; min-height: 0; }
#sum-ok { flex: none; margin-top: 8px; align-self: center; }
#summary h2 { font-weight: normal; color: #6b2a0c; margin: 0 0 6px; font-size: 30px; }
#summary .up { background: #fff3d680; padding: 8px; margin: 6px 0; border-left: 4px solid var(--ember); text-align: left; }
#summary .up b { font-weight: normal; color: #4a1c08; font-size: 18px; } #summary .up p { margin: 2px 0 0; font-size: 15px; line-height: 1.4; }
.dim { color: #7a5a44; }

/* Title & loading */
#title { position: fixed; inset: 0; display: flex; overflow-y: auto; padding: 12px 0; box-sizing: border-box; }   /* scrolls when Settings makes it taller than a short window */
#title > .board { margin: auto; }
#title .board { width: min(440px, 92vw); text-align: center; }
#title h1 { margin: 0; font-weight: normal; font-size: clamp(38px, 7vw, 54px); line-height: 1.05; color: #6b2a0c; text-shadow: 2px 2px 0 #f0c070; }
#title .sub { margin: 4px 0 14px; color: #6b4a33; font-size: 15px; }
#title label { display: block; text-align: left; font-size: 14px; color: #5a3a24; }
#name-input { width: 100%; font: 18px Pixel, monospace; padding: 8px; margin: 4px 0 10px; background: #fff8e8; border: 2px solid #8a5a34; color: var(--ink); user-select: text; }
#title .btn { width: 100%; margin-top: 6px; } #title .btn small { display: block; font-size: 12px; color: #6b4a33; }
#title-warn { color: #a3261c; font-size: 13px; min-height: 18px; margin: 4px 0 0; }
#title-status, #title .keys { font-size: 12px; color: #6b4a33; margin: 8px 0 0; }
#loading { position: fixed; inset: 0; display: grid; place-items: center; background: #120b08; }
#loading div { width: 220px; height: 10px; border: 2px solid #5e3b22; } #load-bar { height: 100%; width: 0; background: var(--ember); }
@media (max-width: 700px) { #tracker { display: none; } #area { font-size: 24px; } .heart { width: 22px; height: 22px; background-size: 110px 22px; } .heart.f2 { background-position: -44px 0; } .heart.f4 { background-position: -88px 0; } .heart.halfmax { width: 11px; } }
@media (prefers-reduced-motion: reduce) { #area.show, .pick, #prompt, #dlg-more { animation: none; } }

/* Chapter 1 additions */
.slots6 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0; }
.gslot { display: flex; align-items: center; gap: 8px; background: #fff3d680; border: 2px solid #c9a46e; padding: 4px 6px; min-height: 48px; }
.gslot.empty { opacity: .6; }
.gslot .ic { flex: none; width: 36px; height: 36px; display: grid; place-items: center; background: url(../assets/ui/cell.png) 0 0 / 100% 100%; }
.gslot .ic img { max-width: 26px; max-height: 30px; }
.gslot small { display: block; color: #8a5a34; font-size: 11px; } .gslot span { font-size: 14px; color: #4a1c08; }
.pbar { height: 10px; background: #d9bd8c; border: 2px solid #8a5a34; margin: 6px 0 4px; }
.pbar i { display: block; height: 100%; background: linear-gradient(#ffcf7a, var(--ember)); }
.diff { color: #a3261c; font-size: 11px; letter-spacing: 1px; }
.hidden-gold { display: none; }
#title h1 small { display: block; font-size: 16px; color: #8a5a34; text-shadow: none; margin-top: 6px; }

/* the world map (M) */
#worldmap .board { width: min(1056px, 96vw); }
#worldmap .mbody { padding-right: 0; }
.atlas-wrap { max-width: 840px; margin: 0 auto; }
.world-atlas { display: block; word-spacing: .1em; }
.atl-frame {
  width: 100%;
  aspect-ratio: 9 / 4;
  max-height: max(166px, calc(88vh - 167px));
  padding: 3px;
  border: 1px solid #987044;
  border-radius: 4px;
  background: #d9b981;
  box-shadow: inset 0 0 0 1px #f8e7bd;
}
.atlas-wrap .atl-frame { max-height: max(150px, calc(88vh - 207px)); }
.atlas {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 2px;
  background: #f3e2b8;
  cursor: grab;
  touch-action: none;
  image-rendering: auto;
}
.atlas.is-dragging { cursor: grabbing; }
.atlas text {
  font-family: Pixel, monospace;
  text-anchor: middle;
  letter-spacing: 0;
  fill: #4a3424;
  paint-order: stroke;
  stroke: #f5e6bf;
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
}
.atlas .atl-name { font-size: max(16px, calc(13px * var(--atl-label-unit, 1))); }
.atlas .atl-note { font-size: max(12px, calc(11px * var(--atl-label-unit, 1))); fill: #704b2f; }
.atlas .atl-q { font-size: max(20px, calc(15px * var(--atl-label-unit, 1))); fill: #775b3d; }
.atlas .atl-obstacle { fill: #743c29; }
.atl-here { animation: atl-bob 1.2s ease-in-out infinite; }
@keyframes atl-bob { 50% { transform: translate(-3px, -3px); } }
@media (prefers-reduced-motion: reduce) { .atl-here { animation: none; } }
.atl-bar, .atl-presets, .atl-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.atl-bar { justify-content: space-between; gap: 6px 12px; margin-top: 6px; }
.atl-btn {
  min-height: 32px;
  padding: 0 5px;
  border: 8px solid transparent;
  border-image: url(../assets/ui/btn.png) 5 fill / 8px stretch;
  background: none;
  color: var(--ink);
  font: 14px/1 Pixel, monospace;
  word-spacing: inherit;
  white-space: nowrap;
  cursor: pointer;
}
.atl-btn:hover:not(:disabled), .atl-btn[aria-pressed="true"] { border-image-source: url(../assets/ui/btnh.png); }
.atl-btn[aria-pressed="true"] { color: #6b2a0c; }
.atl-btn:active:not(:disabled) { border-image-source: url(../assets/ui/btnp.png); }
.atl-btn:focus-visible { outline: 2px solid #a84518; outline-offset: 1px; }
.atl-btn:disabled { opacity: .55; cursor: default; }
.atl-zoom { min-width: 32px; font-size: 17px; }
.atl-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  margin-top: 6px;
  color: #62432c;
  font-size: 12px;
  line-height: 1.35;
  letter-spacing: 0;
}
.atl-foot > :first-child { flex: 1 1 auto; }
.atl-help { flex: none; margin-inline-start: auto; color: #775539; }
@media (max-width: 520px) {
  .atl-foot { display: block; }
  .atl-help { display: block; margin-top: 2px; }
}

/* Treasure maps and readable items in the Pack */
.pack-read { display: block; margin: 4px auto 0; }
.pack-q { display: block; margin: 4px auto 0; }
.pack-q.on { background: var(--ember); color: #fff; }
.cell.qfood { outline: 2px solid var(--ember); outline-offset: -2px; }
#treasure-reader:not([open]) { display: none; }
#treasure-reader[open] { display: flex; flex-direction: column; }
#treasure-reader { width: min(660px, 96vw); max-width: none; max-height: 88vh; padding: 4px; overflow: hidden; }
#treasure-reader::backdrop { background: #24160fab; }
#treasure-reader .mbody { min-height: 0; }
.treasure-place { margin: 0 0 4px; color: #6b4a33; font-size: 15px; }
.treasure-sketch { display: block; width: 100%; height: auto; max-height: max(150px, calc(88vh - 240px)); }
.treasure-sketch text { font-family: Pixel, monospace; }
.treasure-note { margin: 8px 0 0; padding: 6px 10px; border-left: 3px solid #b78d60; font-size: 16px; line-height: 1.5; }
.treasure-note p { margin: 0; }
.treasure-note cite { display: block; margin-top: 4px; color: #6b4a33; font-size: 14px; font-style: normal; }
.treasure-pages { padding: 12px 16px; border: 2px solid #bd9967; background: linear-gradient(115deg, #f5e5bd, #ecd5a7); color: #4a3424; font-size: 17px; line-height: 1.6; }
.treasure-pages p { margin: 0; white-space: pre-wrap; }
.treasure-pages p + p { margin-top: 12px; }
