/* Layout: fixed top bar; contents as a drawer on phones and a persistent left sidebar on wide iPads;
   one guide section per page in a ~38em reading column. Paper (sepia) and Night palettes. */
:root {
  --bg: #F6F0E3;
  --fg: #3B3228;
  --mute: #7A6D5E;
  --rule: #E2D8C4;
  --panel: #EEE6D3;
  --side: #F0E9DA;
  --acc: #2C6A6E;
  --acc-ink: #FFFFFF;
  --hit: #F2D27A;
  --ok: #3F7A4A;
  --bad: #A23B32;
  --fs: 18px;
  --read: Charter, "Iowan Old Style", "Palatino", Georgia, serif;
  --ui: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  --party: #6A3D9A; --enemy: #995200; --boss: #B3261E; --place: #1D5FA6; --npc: #A3306F; --item: #1E7348;
  --m-sea: #AFC8D4; --m-shore: #7F9FAF; --m-land: #BCD29A; --m-plain: #D3E2A6; --m-forest: #7EA46A; --m-mountain: #B49B78; --m-desert: #E9D8A7;
  --m-sea-r: #CDB3A8; --m-land-r: #C6B38C; --m-grass-r: #A4B47C; --m-forest-r: #728C5C; --m-mountain-r: #9E8669; --m-desert-r: #E6D095;
  /* one color per character (party cards), from their look in the game */
  --c-terra: #267A4C; --c-locke: #2B64B5; --c-cyan: #4B4BA6; --c-shadow: #4D5866; --c-edgar: #876500; --c-sabin: #A84D0E; --c-celes: #11717F;
  --c-strago: #86643A; --c-relm: #B8338F; --c-setzer: #7445B0; --c-mog: #BE3B34; --c-gau: #62730F; --c-gogo: #8E4E6E; --c-umaro: #456C8C;
  /* one color per kind of gear (Inventory) */
  --k-weapon: #A8382F; --k-shield: #2B64B5; --k-helmet: #11717F; --k-armor: #3D7536; --k-relic: #7445B0; --k-item: #876500;
  --mono: ui-monospace, Menlo, "SF Mono", Consolas, monospace;
  --bar-h: 52px;
  --side-w: 330px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1C1B19; --fg: #E6E1D6; --mute: #9A9284; --rule: #34312C; --panel: #262420; --side: #201F1C;
    --acc: #86B9B4; --acc-ink: #10201F; --hit: #6B5A22; --ok: #8DC497; --bad: #E58A80; color-scheme: dark;
    --party: #C7A6F0; --enemy: #E3A857; --boss: #F28B82; --place: #8DB8F2; --npc: #EE9CC9; --item: #7FCF9E;
    --c-terra: #96D9B4; --c-locke: #90B1DF; --c-cyan: #9F9FD0; --c-shadow: #AFB7C1; --c-edgar: #F8D777; --c-sabin: #EEAE81; --c-celes: #87DCE9;
    --c-strago: #D1BA9E; --c-relm: #DC93C6; --c-setzer: #B49CD4; --c-mog: #DC9793; --c-gau: #D8E986; --c-gogo: #CAA5B8; --c-umaro: #A2BACD;
    --k-weapon: #DC9993; --k-shield: #90B1DF; --k-helmet: #87DCE9; --k-armor: #A5CFA0; --k-relic: #B49CD4; --k-item: #F8D777;
    --m-sea: #1D3340; --m-shore: #3F5D6D; --m-land: #3D5132; --m-plain: #4C6239; --m-forest: #2B4027; --m-mountain: #5C4B37; --m-desert: #706340;
    --m-sea-r: #3A2523; --m-shore-r: #6A4740; --m-land-r: #4E4431; --m-grass-r: #475431; --m-forest-r: #2E3A24; --m-mountain-r: #5D4C38; --m-desert-r: #75663B;
  }
}
:root[data-theme="dark"] {
  --bg: #1C1B19; --fg: #E6E1D6; --mute: #9A9284; --rule: #34312C; --panel: #262420; --side: #201F1C;
  --acc: #86B9B4; --acc-ink: #10201F; --hit: #6B5A22; --ok: #8DC497; --bad: #E58A80; color-scheme: dark;
  --party: #C7A6F0; --enemy: #E3A857; --boss: #F28B82; --place: #8DB8F2; --npc: #EE9CC9; --item: #7FCF9E;
  --c-terra: #96D9B4; --c-locke: #90B1DF; --c-cyan: #9F9FD0; --c-shadow: #AFB7C1; --c-edgar: #F8D777; --c-sabin: #EEAE81; --c-celes: #87DCE9;
  --c-strago: #D1BA9E; --c-relm: #DC93C6; --c-setzer: #B49CD4; --c-mog: #DC9793; --c-gau: #D8E986; --c-gogo: #CAA5B8; --c-umaro: #A2BACD;
  --k-weapon: #DC9993; --k-shield: #90B1DF; --k-helmet: #87DCE9; --k-armor: #A5CFA0; --k-relic: #B49CD4; --k-item: #F8D777;
    --m-sea: #1D3340; --m-shore: #3F5D6D; --m-land: #3D5132; --m-plain: #4C6239; --m-forest: #2B4027; --m-mountain: #5C4B37; --m-desert: #706340;
    --m-sea-r: #3A2523; --m-shore-r: #6A4740; --m-land-r: #4E4431; --m-grass-r: #475431; --m-forest-r: #2E3A24; --m-mountain-r: #5D4C38; --m-desert-r: #75663B;
}
:root[data-font="sans"] { --read: var(--ui); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + env(safe-area-inset-top, 0px) + 12px); }
body { margin: 0; background: var(--bg); color: var(--fg); font: var(--fs)/1.56 var(--read); text-rendering: optimizeLegibility; -webkit-tap-highlight-color: transparent; }
body.locked { overflow: hidden; }
a { color: var(--acc); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- top bar ---------- */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 30; display: flex; align-items: center; gap: 4px;
  height: calc(var(--bar-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(8px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px));
  background: var(--bg); border-bottom: 1px solid var(--rule); font-family: var(--ui);
}
.ib { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; border-radius: 10px; cursor: pointer; flex: none; }
.ib svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ib:active { background: var(--panel); }
.ib[aria-expanded="true"] { color: var(--acc); }
.ib[hidden] { display: none; }
.ib[aria-busy="true"] { opacity: .45; }
.ib.has-dot { position: relative; }
.ib.has-dot::after { content: ""; position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); border: 2px solid var(--bg); }
.shortcuts { display: flex; align-items: center; gap: 2px; flex: none; }
.sc { color: var(--fg); text-decoration: none; }
.sc[aria-current="page"] { color: var(--acc); background: var(--panel); }
.sc-l { display: none; }
@media (max-width: 699px) {
  .shortcuts {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; justify-content: space-around; gap: 0;
    padding: 4px max(6px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px));
    background: var(--bg); border-top: 1px solid var(--rule);
  }
  .sc { width: auto; height: auto; min-width: 48px; padding: 4px 3px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--mute); }
  .sc[aria-current="page"] { color: var(--acc); background: none; }
  .sc-l { display: block; font: 600 10.5px var(--ui); letter-spacing: .01em; }
  body.has-tabs main { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 112px); }
  body.has-tabs .toast { bottom: calc(env(safe-area-inset-bottom, 0px) + 76px); }
  body.has-tabs .toc-panel { bottom: calc(env(safe-area-inset-bottom, 0px) + 57px); }
}
.bar-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; justify-content: center; text-decoration: none; color: var(--fg); font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; padding: 0 4px; }
.bar-title .bt { overflow: hidden; text-overflow: ellipsis; }
.bar-title .num { color: var(--acc); font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- main column ---------- */
main { padding: calc(var(--bar-h) + env(safe-area-inset-top, 0px) + 8px) max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 48px) max(16px, env(safe-area-inset-left, 0px)); outline: none; }
main > * { max-width: 38em; margin-inline: auto; }
.loading { color: var(--mute); font-family: var(--ui); padding-top: 3rem; text-align: center; }

/* ---------- contents panel ---------- */
.toc-panel {
  position: fixed; z-index: 25; top: calc(var(--bar-h) + env(safe-area-inset-top, 0px)); bottom: 0; left: 0;
  width: min(var(--side-w), 88vw); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background: var(--side); border-right: 1px solid var(--rule); font: 15px/1.35 var(--ui);
  padding-left: env(safe-area-inset-left, 0px);
}
.scrim { position: fixed; inset: 0; z-index: 24; background: rgb(0 0 0 / .32); }
@media (min-width: 1024px) {
  :root:has(#toc:not([hidden])) main { padding-left: calc(var(--side-w) + 24px); }
  .toc-panel { width: var(--side-w); }
}
.toc-in { min-height: 100%; display: flex; flex-direction: column; padding: 10px 10px calc(env(safe-area-inset-bottom, 0px) + 16px); }
.toc-progress { margin: 4px 8px 10px; color: var(--mute); font-size: 13px; }
.toc-list, .toc-list ol { list-style: none; margin: 0; padding: 0; }
.toc-list summary { list-style: none; cursor: pointer; border-radius: 8px; }
.toc-list summary::-webkit-details-marker { display: none; }
.sum-in, .toc-ch, .toc-sub { display: flex; gap: 8px; align-items: baseline; padding: 9px 8px; border-radius: 8px; color: var(--fg); text-decoration: none; }
.sum-in { font-weight: 600; }
.sum-in::before { content: ""; width: 7px; height: 7px; flex: none; border-right: 2px solid var(--mute); border-bottom: 2px solid var(--mute); transform: translateY(-2px) rotate(-45deg); transition: transform .15s; align-self: center; }
details[open] > summary .sum-in::before { transform: translateY(-3px) rotate(45deg); }
.toc-ch { font-weight: 600; padding-left: 23px; }
.toc-sub { padding-left: 23px; font-size: 14.5px; }
.toc-list .n { color: var(--acc); font-variant-numeric: tabular-nums; min-width: 3.1em; flex: none; font-size: .92em; }
.toc-ch .n:empty, .toc-sub .n:empty { display: none; }
.toc-list .t { flex: 1; min-width: 0; }
.toc-list .cnt { color: var(--mute); font-weight: 400; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.toc-list a[aria-current="page"] { background: var(--acc); color: var(--acc-ink); }
.toc-list a[aria-current="page"] .n, .toc-list a[aria-current="page"] .t { color: inherit; }
.toc-list a.done .t::after { content: " ✓"; color: var(--ok); font-weight: 700; }
.toc-list a[aria-current="page"].done .t::after { color: inherit; }
.toc-list a:active, .toc-list summary:active { background: var(--panel); }

/* ---------- reading ---------- */
h1, h2, h3 { font-family: var(--ui); line-height: 1.25; text-wrap: balance; }
.sec-h { font-size: 1.45em; margin: .9em 0 .8em; display: flex; flex-direction: column; gap: 2px; }
.sec-h .num { font-size: .62em; letter-spacing: .04em; color: var(--acc); font-variant-numeric: tabular-nums; }
.body p { margin: 0 0 .85em; }
.num { color: var(--acc); font-variant-numeric: tabular-nums; }
mark { background: var(--hit); color: inherit; border-radius: 2px; padding: 0 1px; }

.done-btn { display: flex; align-items: center; gap: 10px; margin: 2.2em auto 0; padding: 12px 18px; border-radius: 12px; border: 1.5px solid var(--rule); background: transparent; font: 600 15px var(--ui); cursor: pointer; min-height: 48px; }
.done-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; opacity: .35; }
.done-btn.on { border-color: var(--ok); color: var(--ok); }
.done-btn.on svg { opacity: 1; }
.upto-btn { display: block; margin: .8em auto 0; font-size: 14px; font-weight: 500; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 1.6em; font-family: var(--ui); }
.pn { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-radius: 12px; background: var(--panel); color: var(--fg); text-decoration: none; min-width: 0; }
.pn.next { text-align: right; }
.pn .pt { font-size: 14.5px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.pn .num { margin-right: .4em; }
.eyebrow { font: 600 11.5px var(--ui); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }

/* ---------- walkthrough index ---------- */
.continue { display: flex; flex-direction: column; gap: 4px; margin: 1.4em 0; padding: 16px 18px; border-radius: 14px; background: var(--acc); color: var(--acc-ink); text-decoration: none; font-family: var(--ui); }
.continue .eyebrow { color: inherit; opacity: .8; }
.continue .ct { font-size: 1.05rem; font-weight: 600; }
.continue .num { color: inherit; opacity: .85; margin-right: .5em; }
.stat { color: var(--mute); font: 14px var(--ui); margin: 1.6em 0 .4em; }
.chapters { list-style: none; margin: 0; padding: 0; font: 16px/1.35 var(--ui); }
.chapters li { border-top: 1px solid var(--rule); }
.chapters a { display: flex; gap: 10px; align-items: baseline; padding: 13px 2px; color: var(--fg); text-decoration: none; }
.chapters .n { color: var(--acc); min-width: 2.6em; font-variant-numeric: tabular-nums; }
.chapters .t { flex: 1; }
.chapters .cnt { color: var(--mute); font-size: 13px; }

.err { color: var(--bad); border: 1px solid currentColor; border-radius: 10px; padding: 10px 12px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1.5px solid var(--rule); background: var(--bg); font: 600 15px var(--ui); cursor: pointer; color: var(--fg); }
.btn.solid { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }
.btn.big { min-height: 52px; padding: 0 22px; font-size: 16px; }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn:disabled { opacity: .45; cursor: default; }
.txt-btn { border: 0; background: none; color: var(--acc); font: 600 16px var(--ui); padding: 8px 4px; cursor: pointer; flex: none; }

/* ---------- sheets ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; background: rgb(0 0 0 / .35); display: flex; justify-content: center; align-items: flex-start; padding: calc(env(safe-area-inset-top, 0px) + 10px) 10px 10px; font-family: var(--ui); }
.sheet-in { width: min(36rem, 100%); max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 20px); overflow-y: auto; overscroll-behavior: contain; background: var(--bg); border-radius: 16px; padding: 14px 16px 18px; box-shadow: 0 12px 40px rgb(0 0 0 / .28); }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sheet-head h2 { flex: 1; margin: 0; font-size: 1.15rem; }
.sheet-sub { font-size: 1rem; margin: 1.4em 0 .3em; }
.sheet-sub.first { margin-top: .6em; }
.sheet-h3 { font-size: .95rem; margin: 1.1em 0 .2em; }
.gd-setup { margin-top: 8px; border: 1px solid var(--rule); border-radius: 10px; padding: 0 12px; }
.gd-setup summary { cursor: pointer; padding: 10px 0; font-weight: 600; font-size: 14px; color: var(--acc); }
.gd-setup input { width: 100%; box-sizing: border-box; font: 15px var(--ui); padding: 9px 10px; border-radius: 8px; border: 1.5px solid var(--rule); background: var(--panel); color: var(--fg); margin: 4px 0 12px; }
.gd-setup code { font: 12.5px var(--mono); overflow-wrap: anywhere; }
#q { flex: 1; min-width: 0; font: 17px var(--ui); padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--rule); background: var(--panel); color: var(--fg); }
.hint { color: var(--mute); font-size: 14px; margin: .3em 0 .6em; }
.hint.small { font-size: 12.5px; margin-top: 1.4em; }
.results { list-style: none; margin: 0; padding: 0; }
.results li { border-top: 1px solid var(--rule); }
.results a { display: flex; flex-direction: column; gap: 3px; padding: 11px 2px; color: var(--fg); text-decoration: none; }
.r-h { font-weight: 600; font-size: 15px; display: flex; gap: 8px; align-items: baseline; }
.r-h .cnt { margin-left: auto; color: var(--mute); font-weight: 400; font-size: 12.5px; }
.r-s { color: var(--mute); font-size: 14px; line-height: 1.4; }
.r-s mark { color: var(--fg); }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--rule); }
.setting-k { font-size: 15px; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 44px; height: 40px; border-radius: 10px; border: 1.5px solid var(--rule); background: var(--bg); font: 600 14px var(--read); cursor: pointer; }
.stepper button.big { font-size: 20px; }
.stepper output { min-width: 2.2em; text-align: center; font-variant-numeric: tabular-nums; color: var(--mute); font-size: 14px; }
.seg { display: flex; border: 1.5px solid var(--rule); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: none; padding: 8px 12px; font: 600 14px var(--ui); cursor: pointer; min-height: 38px; }
.seg button + button { border-left: 1.5px solid var(--rule); }
.seg button[aria-checked="true"] { background: var(--acc); color: var(--acc-ink); }
.switch { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 15px; background: var(--rule); position: relative; cursor: pointer; flex: none; margin: 0; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .15s; }
.switch:checked { background: var(--ok); }
.switch:checked::after { transform: translateX(20px); }
.names { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.names:empty { display: none; }
.names li { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; align-items: center; gap: 6px; }
.names input { font: 16px var(--ui); padding: 9px 10px; border-radius: 8px; border: 1.5px solid var(--rule); background: var(--panel); color: var(--fg); width: 100%; min-width: 0; }
.nm-arrow { color: var(--mute); }
#nameAdd, #tagAdd { width: 100%; }
.upto-form { display: flex; gap: 8px; }
.upto-form select { flex: 1; min-width: 0; font: 16px var(--ui); padding: 9px 10px; border-radius: 8px; border: 1.5px solid var(--rule); background: var(--panel); color: var(--fg); }
.upto-form .btn { flex: none; }
.tags li { grid-template-columns: minmax(0, 1fr) auto auto; }
.tags select { font: 15px var(--ui); padding: 9px 8px; border-radius: 8px; border: 1.5px solid var(--rule); background: var(--panel); color: var(--fg); }
.tag-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: .2em 0 .4em; font: 600 14px var(--ui); }
.tag-legend .cnt { color: var(--mute); font-weight: 400; font-size: 12.5px; }

/* ---------- Gau's Rages ---------- */
.toc-tracker { display: flex; gap: 8px; align-items: baseline; margin: 2px 0 6px; padding: 9px 8px; border-radius: 8px; color: var(--fg); text-decoration: none; font-weight: 600; border: 1px solid var(--rule); }
.toc-tracker .t { flex: 1; }
.toc-tracker .cnt { color: var(--mute); font-weight: 400; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.toc-tracker[aria-current="page"] { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }
.toc-tracker[aria-current="page"] .cnt { color: inherit; opacity: .85; }
.rages { font-family: var(--ui); }
.rages h1 { margin: .1em 0 .2em; }
.rg-stat { margin: 0 0 .4em; font-size: 15px; color: var(--mute); }
.rg-stat strong { color: var(--fg); font-variant-numeric: tabular-nums; }
.rages .meter { margin-bottom: 1em; }
.rg-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: .8em 0 .4em; }
.rg-tools input { flex: 1 1 14em; min-width: 0; font: 16px var(--ui); padding: 9px 12px; border-radius: 10px; border: 1.5px solid var(--rule); background: var(--panel); color: var(--fg); }
.rg-start { display: block; margin: .2em 0; font-size: 14px; }
.rg-list { list-style: none; margin: .4em 0 1.2em; padding: 0; }
.rg { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--rule); }
.rg label { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 12px; padding: 10px 2px; cursor: pointer; }
.rg input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--ok); }
.rg-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rg-name { font-weight: 600; font-size: 15.5px; }
.rg-alt { color: var(--mute); font-weight: 400; font-size: 13px; }
.rg-ab { color: var(--mute); font-size: 14px; }
.rg-note { color: var(--mute); font-size: 13px; font-style: italic; }
.rg.on .rg-name { color: var(--ok); }
.rg.never { opacity: .55; }
.rg.never label { cursor: default; }
.rg-find { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: none; color: var(--mute); border-radius: 8px; cursor: pointer; }
.rg-find svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.rg-find:active { background: var(--panel); }
.badge { display: inline-block; padding: 0 6px; border-radius: 6px; border: 1px solid var(--rule); font: 600 11px/1.6 var(--ui); letter-spacing: .03em; color: var(--mute); vertical-align: 1px; }
.badge.lore { color: var(--acc); border-color: currentColor; }

/* ---------- inventory ---------- */
.rg-tools select { font: 15px var(--ui); padding: 9px 8px; border-radius: 10px; border: 1.5px solid var(--rule); background: var(--panel); color: var(--fg); }
.gr { display: block; --k: var(--rule); border-left: 4px solid var(--k); padding-left: 10px; }
.gr[data-cat="weapon"] { --k: var(--k-weapon); } .gr[data-cat="shield"] { --k: var(--k-shield); } .gr[data-cat="helmet"] { --k: var(--k-helmet); }
.gr[data-cat="armor"] { --k: var(--k-armor); } .gr[data-cat="relic"] { --k: var(--k-relic); } .gr[data-cat="item"] { --k: var(--k-item); }
.gr-kind { color: var(--k); font-weight: 600; }
.gr .gr-more { background: color-mix(in srgb, var(--k) 8%, var(--panel)); }
.gr-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.gr-row > input[type="checkbox"] { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--k); }
.gr-open { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 6px 2px; border: 0; background: none; color: var(--fg); text-align: left; font: inherit; cursor: pointer; border-radius: 8px; }
.gr-open:active { background: var(--panel); }
.gr-open[aria-expanded="true"] .rg-name::after { content: " ▴"; color: var(--mute); }
.gr.on .rg-name { color: var(--ok); }
.gr-step { flex: none; display: flex; align-items: center; gap: 2px; }
.gr-step button { width: 34px; height: 34px; border-radius: 8px; border: 1.5px solid var(--rule); background: var(--bg); color: var(--fg); font: 600 17px var(--ui); cursor: pointer; }
.gr-step button:disabled { opacity: .35; cursor: default; }
.rg .gr-n, .pc .gr-n { width: 2.6em; height: 34px; margin: 0; text-align: center; font: 600 15px var(--ui); font-variant-numeric: tabular-nums; border-radius: 8px; border: 1.5px solid var(--rule); background: var(--panel); color: var(--fg); padding: 0; }
.gr-more { margin: 0 0 10px 32px; padding: 8px 12px 10px; border-radius: 10px; background: var(--panel); }
.gr-tbl { border-collapse: collapse; width: 100%; font-size: 14px; }
.gr-tbl th { text-align: left; vertical-align: top; color: var(--mute); font-weight: 600; padding: 4px 12px 4px 0; white-space: nowrap; width: 1%; }
.gr-tbl td { padding: 4px 0; }
.gr-tbl tr + tr th, .gr-tbl tr + tr td { border-top: 1px solid var(--rule); }
.gr-total td { font-weight: 600; }
.gr-note { margin: .4em 0 0; font-size: 13px; color: var(--mute); font-style: italic; }
.gr-find { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 14px; }
.gr-find svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.toc-tracker + .toc-tracker { margin-top: 0; }

/* ---------- monster intel ---------- */
.mn-search { position: sticky; top: calc(var(--bar-h) + env(safe-area-inset-top, 0px)); z-index: 5; background: var(--bg); padding: 6px 0 8px; }
.mn-search input { width: 100%; font: 18px var(--ui); padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--rule); background: var(--panel); color: var(--fg); }
.mn-grid { list-style: none; margin: .6em 0 1.2em; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mn-pick { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border-radius: 12px; border: 1px solid var(--rule); background: var(--bg); color: var(--fg); font: 600 13.5px/1.25 var(--ui); cursor: pointer; text-align: center; }
.mn-pick:active { background: var(--panel); }
.mn-pick[aria-pressed="true"] { border-color: var(--acc); box-shadow: 0 0 0 1.5px var(--acc); }
.mn-pic { width: 72px; height: 72px; object-fit: contain; image-rendering: pixelated; }
.mn-noimg { display: grid; place-items: center; border-radius: 10px; background: var(--panel); color: var(--mute); font: 700 26px var(--ui); }
.mn-n { overflow-wrap: anywhere; }
.mn-card { border: 1px solid var(--rule); border-radius: 14px; padding: 14px 16px 12px; margin: .4em 0 1em; background: var(--bg); scroll-margin-top: calc(var(--bar-h) + 80px); }
.mn-head { display: flex; gap: 14px; align-items: center; }
.mn-head h2 { margin: 0; font-size: 1.35rem; }
.mn-big { width: 96px; height: 96px; object-fit: contain; image-rendering: pixelated; flex: none; }
.mn-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: .4em 0 0; }
.badge.boss { color: var(--boss); border-color: currentColor; }
.mn-forms { margin: 12px 0 2px; flex-wrap: wrap; }
.mn-forms button[aria-selected="true"] { background: var(--acc); color: var(--acc-ink); }
.mn-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 12px 0; }
.mn-stats div { background: var(--panel); border-radius: 10px; padding: 6px 8px; text-align: center; }
.mn-stats dt { font-size: 11.5px; color: var(--mute); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.mn-stats dd { margin: 0; font: 700 16px var(--ui); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.mn-tbl { margin-bottom: 8px; }
.chip-el { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid currentColor; margin: 1px 0; }
.el-weak { color: var(--boss); }
.el-absorb { color: var(--ok); }
.el-immune { color: var(--mute); }
.el-resist { color: var(--place); }
.mn-odds { color: var(--mute); font-size: 12.5px; }
.mn-sus { white-space: nowrap; }
.mn-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; border-top: 1px solid var(--rule); padding-top: 8px; }
.mn-rage { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.mn-rage input { width: 20px; height: 20px; accent-color: var(--ok); margin: 0; }
.mn-save { font-size: inherit; padding: 0; }
.mn-rages { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--panel); font-size: 14.5px; }
.mn-rh { margin: 0 0 4px; font-weight: 700; }
.mn-rages ol { margin: 0; padding-left: 1.3em; }
.mn-rages li { margin: 3px 0; }
.mn-avoid { margin: 6px 0 0; color: var(--bad); font-size: 13.5px; }
.rg-pow { color: var(--fg); font-weight: 600; }
.rg-pow[data-el="Fire"] { color: var(--boss); }
.rg-pow[data-el="Ice"], .rg-pow[data-el="Water"] { color: var(--place); }
.rg-pow[data-el="Lightning"] { color: var(--enemy); }
.rg-pow[data-el="Holy"], .rg-pow[data-el="Wind"] { color: var(--party); }
.rg-pow[data-el="Poison"], .rg-pow[data-el="Earth"] { color: var(--ok); }
@media (max-width: 520px) { .mn-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } .mn-pic { width: 56px; height: 56px; } }

/* ---------- party ---------- */
.pt-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: .6em 0 1em; }
.pt-foe { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: .6em 0 .2em; font-family: var(--ui); }
.pt-foe input { font: 15px var(--ui); padding: 7px 10px; border-radius: 8px; border: 1.5px solid var(--rule); background: var(--panel); color: var(--fg); width: 15em; max-width: 60vw; }
#ptFoeInfo { font-family: var(--ui); }
#ptFoeInfo .pc-fx a { color: var(--acc); font-weight: 600; }
.pt-shop ul { margin: 4px 0 0; padding-left: 1.2em; }
.pt-shop li { margin: 0 0 8px; }
.pc { border: 1px solid var(--rule); border-radius: 14px; padding: 12px 14px; margin: 0 0 12px; font-family: var(--ui); }
.pc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
/* Character colors: a stripe, a tinted header and name, tinted stat tiles. */
.pc { --pc: var(--acc); border-left: 5px solid var(--pc); }
.pc[data-c="Terra"] { --pc: var(--c-terra); } .pc[data-c="Locke"] { --pc: var(--c-locke); } .pc[data-c="Cyan"] { --pc: var(--c-cyan); }
.pc[data-c="Shadow"] { --pc: var(--c-shadow); } .pc[data-c="Edgar"] { --pc: var(--c-edgar); } .pc[data-c="Sabin"] { --pc: var(--c-sabin); }
.pc[data-c="Celes"] { --pc: var(--c-celes); } .pc[data-c="Strago"] { --pc: var(--c-strago); } .pc[data-c="Relm"] { --pc: var(--c-relm); }
.pc[data-c="Setzer"] { --pc: var(--c-setzer); } .pc[data-c="Mog"] { --pc: var(--c-mog); } .pc[data-c="Gau"] { --pc: var(--c-gau); }
.pc[data-c="Gogo"] { --pc: var(--c-gogo); } .pc[data-c="Umaro"] { --pc: var(--c-umaro); }
.pc > .pc-head { margin: -12px -14px 0 -14px; padding: 10px 14px; border-radius: 0 13px 0 0; background: color-mix(in srgb, var(--pc) 13%, transparent); }
.pc-other:not([open]) { padding-bottom: 0; }
.pc-other:not([open]) > .pc-head { border-radius: 0 13px 13px 0; }
.pc-head .pc-n { color: var(--pc); }
.pc input[type="checkbox"] { accent-color: var(--pc); }
.pc .mn-stats > div { background: color-mix(in srgb, var(--pc) 10%, var(--panel)); }
.pc-head h3 { margin: 0; font-size: 1.15rem; }
.pc-other > summary { cursor: pointer; list-style: none; }
.pc-other > summary::-webkit-details-marker { display: none; }
.pc-in { display: flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; }
.pc-tags { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 6px 14px; }
.pc-in input, .pt-unmet input { width: 20px; height: 20px; margin: 0; accent-color: var(--ok); }
.pc-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 10px 0 8px; }
.pc-lv { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--mute); font-weight: 600; }
.pc-goal { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--mute); }
.pc-goal select, .pc-sel { font: 15px var(--ui); padding: 7px 8px; border-radius: 8px; border: 1.5px solid var(--rule); background: var(--panel); color: var(--fg); max-width: 100%; }
.pc-eq td:nth-child(2) { width: 100%; }
.pc-sel { width: 100%; }
.pc-fx { display: block; font-size: 12.5px; color: var(--mute); margin-top: 3px; }
.pc-lock { width: 36px; height: 36px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-size: 16px; opacity: .55; }
.pc-lock[aria-pressed="true"] { opacity: 1; background: var(--panel); }
.pc-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.pc-est { font-size: 14px; color: var(--mute); margin: .4em 0 0; }
.pc-est strong { color: var(--fg); font-variant-numeric: tabular-nums; }
.pt-unmet { list-style: none; padding: 0; margin: 0 0 1em; display: grid; grid-template-columns: repeat(auto-fill, minmax(10em, 1fr)); gap: 8px; }
.pt-unmet label { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 10px; font-size: 15px; }
.pt-panel { border: 1.5px solid var(--acc); border-radius: 14px; padding: 12px 14px; margin: 0 0 16px; font-family: var(--ui); font-size: 15px; }
.pt-panel p { margin: 0 0 8px; }
.pt-res { border-top: 1px solid var(--rule); padding: 8px 0; }
.pt-res h3 { margin: 0 0 4px; font-size: 1rem; }
.pt-panel .row2 { margin-top: 8px; }
.pc-spells { margin: 6px 0 4px; }
.pc-magic { margin: 8px 0 4px; }
.pc-magic > summary { cursor: pointer; font: 600 15px var(--ui); padding: 8px 0; }
.pc-spells ul { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pc-spells label { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--rule); border-radius: 999px; font-size: 14px; cursor: pointer; }
.pc-spells input { width: 18px; height: 18px; margin: 0; accent-color: var(--ok); }
.pc-spells label:has(input:disabled) { cursor: default; }
.pc-esper { font: 15px var(--ui); padding: 7px 8px; border-radius: 8px; border: 1.5px solid var(--rule); background: var(--panel); color: var(--fg); width: 100%; }
.pt-howto { border: 1px solid var(--rule); border-radius: 12px; padding: 0 14px; margin: 0 0 10px; font: 15px/1.5 var(--ui); }
.pt-howto summary { cursor: pointer; padding: 10px 0; font-weight: 600; color: var(--acc); }
.pt-howto ul { margin: 0 0 12px; padding-left: 1.2em; }
.pt-howto li { margin: .3em 0; }
.pt-espers { list-style: none; padding: 0; margin: 0 0 1.2em; display: grid; grid-template-columns: repeat(auto-fill, minmax(16em, 1fr)); gap: 8px; }
.pt-espers label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 10px; cursor: pointer; font-size: 15px; height: 100%; box-sizing: border-box; }
.pt-espers input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--ok); }
.pt-espers li.on label { border-color: var(--ok); }
.pt-espers .badge { margin-left: 4px; }
@media (max-width: 520px) { .pc-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- walkthrough ---------- */
.walk .continue { margin-top: 1em; }
.wt-list a.done .t { color: var(--mute); }
.walk-ch .eyebrow a { color: inherit; text-decoration: none; }
.wt-sec { margin: 1.4em 0 0; }
.wt-sec h2 { font: 700 .82em var(--ui); letter-spacing: .07em; text-transform: uppercase; color: var(--mute); margin: 0 0 .4em; padding-bottom: .3em; border-bottom: 1px solid var(--rule); }
.wt-sec ul { margin: 0 0 .6em; padding-left: 1.2em; }
.wt-sec li { margin: .35em 0; }
.wt-boss h2 { color: var(--boss); }
.wt-miss h2 { color: var(--enemy); }
.wt-grind h2 { color: var(--ok); }
.wt-side h2 { color: var(--place); }
.wt-monsters p { font-family: var(--ui); font-size: .92em; line-height: 1.9; }
.wt-mon { text-decoration: none; border-bottom: 1px dotted currentColor; }

/* ---------- color-coded names ---------- */
.ent-party { color: var(--party); }
.ent-enemy { color: var(--enemy); }
.ent-boss { color: var(--boss); }
.ent-place { color: var(--place); }
.ent-npc { color: var(--npc); }
.ent-item { color: var(--item); }
a.ent { text-decoration: none; border-bottom: 1px dotted currentColor; }
a.ent:hover { border-bottom-style: solid; }

/* ---------- summary popup ---------- */
.peek { position: fixed; z-index: 45; width: min(20rem, calc(100vw - 32px)); padding: 12px 14px; border-radius: 12px; background: var(--bg); color: var(--fg); border: 1px solid var(--rule); box-shadow: 0 10px 32px rgb(0 0 0 / .25); font: 14.5px/1.45 var(--ui); }
.peek p { margin: 0 0 6px; }
.peek .pk-name { font-weight: 700; font-size: 16px; display: block; }
.peek .pk-open { display: inline-flex; align-items: center; min-height: 32px; font-weight: 600; text-decoration: none; }

/* ---------- wiki ---------- */
.wk { font-family: var(--ui); }
.wk h1 { margin: .1em 0 .2em; }
.wk-group { border-top: 1px solid var(--rule); }
.wk-group > summary { list-style: none; cursor: pointer; }
.wk-group > summary::-webkit-details-marker { display: none; }
.wk-group .sum-in { padding: 12px 2px; font-size: 16px; }
.wk-group .sum-in .t { flex: 1; }
.wk-group .sum-in .cnt { color: var(--mute); font-size: 13px; font-weight: 400; }
.wk-list { list-style: none; margin: 0 0 10px; padding: 0; }
.wk-list a { display: block; padding: 8px 2px 8px 22px; text-decoration: none; color: var(--fg); border-radius: 8px; }
.wk-list a:active { background: var(--panel); }
.wk-list .ent { font-weight: 600; }
.wk-s { display: block; color: var(--mute); font-size: 13.5px; line-height: 1.35; }
.wk-art .eyebrow a { color: inherit; text-decoration: none; }
.wk-back { display: inline-block; margin-top: .6em; font: 600 14px var(--ui); text-decoration: none; }
.wk-h { font-size: 1.6em; margin: .3em 0 .1em; }
.wk-aka { color: var(--mute); font: 14px var(--ui); margin: 0 0 .6em; }
.wk-lead { font-size: 1.05em; font-weight: 600; margin: .4em 0 .9em; }
.wk-facts { font-family: var(--ui); margin: 0 0 1em; }
.wk-later { border: 1px dashed var(--rule); border-radius: 10px; padding: 0 12px; margin: 0 0 1em; }
.wk-later > summary { cursor: pointer; padding: 10px 0; font: 600 14px var(--ui); color: var(--mute); }
.wk-later[open] > summary { color: var(--acc); }
.wk-links { margin: 1.2em 0; }
.wk-refs { margin-top: 1.6em; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.confirm { border: 1px solid var(--bad); border-radius: 12px; padding: 12px; font-size: 14.5px; }
.confirm p { margin: 0 0 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.modal { width: min(26rem, calc(100vw - 32px)); border: 0; border-radius: 16px; padding: 20px; background: var(--bg); color: var(--fg); font: 15px/1.45 var(--ui); box-shadow: 0 16px 48px rgb(0 0 0 / .32); }
.modal::backdrop { background: rgb(0 0 0 / .45); }
.modal h2 { margin: 0 0 .5em; font-size: 1.2rem; }
.modal p { margin: 0 0 .8em; }
.modal-note { color: var(--mute); font-size: 14px; }
.modal .row2 { margin-top: 1.2em; }
.modal .btn:focus-visible { outline: 3px solid var(--acc); outline-offset: 2px; }
.btn:disabled { opacity: .45; }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); transform: translateX(-50%); z-index: 50; background: var(--fg); color: var(--bg); font: 600 14px var(--ui); padding: 10px 16px; border-radius: 999px; box-shadow: 0 6px 20px rgb(0 0 0 / .25); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- side panel ---------- */
.toc-panel { display: flex; flex-direction: column; }
.panel-body { flex: 1 0 auto; display: flex; flex-direction: column; }
.panel-body > .toc-in { flex: 1 0 auto; min-height: 0; }

/* remove buttons in the names and color-coding lists */
.mp-x { flex: none; min-width: 36px; height: 36px; border-radius: 8px; border: 0; background: none; color: var(--mute); font: 600 18px var(--ui); cursor: pointer; }
.mp-x.armed { background: var(--bad); color: #fff; font-size: 12.5px; padding: 0 10px; }

/* ---------- chapter chips ---------- */
.sec-maps { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: -.2em 0 1.2em; font-family: var(--ui); }
.sec-maps .eyebrow { margin-right: 2px; }
.chip { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 999px; background: var(--panel); color: var(--fg); text-decoration: none; font: 600 13.5px var(--ui); border: 1px solid var(--rule); }


/* ---------- blocks from web pages and Markdown ---------- */

/* ---------- world map ---------- */
main > .wmap { max-width: 64em; }
.wmap { font-family: var(--ui); display: flex; flex-direction: column; gap: 8px; --sea: var(--m-sea); --shore: var(--m-shore); --land: var(--m-land); }
.wm-ruin { --sea: var(--m-sea-r); --shore: var(--m-shore-r, var(--m-shore)); --land: var(--m-land-r); }
.wm-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.wm-bar .seg { display: inline-flex; border: 1.5px solid var(--rule); border-radius: 10px; overflow: hidden; }
.wm-w { padding: 8px 12px; font: 600 14px var(--ui); color: var(--mute); text-decoration: none; }
.wm-w[aria-current="page"] { background: var(--acc); color: var(--acc-ink); }
.wm-zoom { display: inline-flex; gap: 6px; }
.wm-zoom .btn { min-height: 38px; min-width: 42px; padding: 0 10px; font-size: 15px; }
.wm-dir { margin: 0; font-size: 15px; line-height: 1.45; }
.wm-dir .eyebrow { margin-right: 4px; }
.wm-stage { position: relative; overflow: hidden; height: calc(100dvh - var(--bar-h) - env(safe-area-inset-top, 0px) - 190px); min-height: 300px; border-radius: 12px; border: 1px solid var(--rule); background: var(--sea); touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.wm-stage:active { cursor: grabbing; }
.wm-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.wm-land { fill: var(--land); stroke: var(--shore); stroke-width: .6px; paint-order: stroke; }
.wm-plain { fill: var(--m-plain); }
.wm-grass { fill: var(--m-grass-r); }
.wm-forest { fill: var(--m-forest); }
.wm-mountain { fill: var(--m-mountain); }
.wm-desert { fill: var(--m-desert); }
.wm-ruin .wm-forest { fill: var(--m-forest-r); }
.wm-ruin .wm-mountain { fill: var(--m-mountain-r); }
.wm-ruin .wm-desert { fill: var(--m-desert-r); }
.wm-route { fill: none; stroke: var(--boss); stroke-width: 3px; stroke-dasharray: 8 6; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.wm-pins { position: absolute; inset: 0; pointer-events: none; }
.wm-pin { position: absolute; display: flex; align-items: center; gap: 4px; transform: translate(-7px, -50%); pointer-events: auto; text-decoration: none; color: var(--fg); padding: 6px 4px 6px 0; }
.wm-dot { width: 14px; height: 14px; flex: none; border-radius: 50%; background: var(--place); border: 2px solid var(--bg); box-shadow: 0 1px 3px rgb(0 0 0 / .35); }
.wm-lb { display: none; font: 600 12.5px var(--ui); white-space: nowrap; text-shadow: 0 0 3px var(--bg), 0 0 3px var(--bg), 0 0 6px var(--bg); }
.wm-labels .wm-lb, .wm-pin.on .wm-lb, .wm-pin.from .wm-lb, .wm-pin:hover .wm-lb { display: block; }
.wm-pin.on .wm-dot { background: var(--boss); width: 18px; height: 18px; margin-left: -2px; box-shadow: 0 0 0 4px rgb(255 255 255 / .45), 0 1px 4px rgb(0 0 0 / .4); }
.wm-pin.on .wm-lb { font-size: 14px; }
.wm-pin.from .wm-dot { background: var(--acc); }
.pk-map { margin-left: 14px; }
@media (max-width: 699px) {
  .wm-stage { height: calc(100dvh - var(--bar-h) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 260px); }
}
