/* Fonts: Alegreya SC and Alegreya Sans, served from this game (SIL Open Font License, see fonts/OFL-*.txt) */
@font-face { font-family: "Alegreya SC"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/alegreya-sc-500.98b4a138b611.woff2") format("woff2"); }
@font-face { font-family: "Alegreya SC"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/alegreya-sc-700.988821cdcc03.woff2") format("woff2"); }
@font-face { font-family: "Alegreya Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/alegreya-sans-400.b2a5a35a2563.woff2") format("woff2"); }
@font-face { font-family: "Alegreya Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/alegreya-sans-500.55b61d22cc7a.woff2") format("woff2"); }
@font-face { font-family: "Alegreya Sans"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/alegreya-sans-700.5acd19a58861.woff2") format("woff2"); }
:root {
  --ink: #1e1a15;
  --ink-2: #2c261f;
  --ink-3: #3a3128;
  --line: #8a6a3f;
  --line-dim: #5d4a30;
  --paper: #efe3c8;
  --paper-dim: #c9b994;
  --copper: #c4742f;
  --gold: #f3d38a;
  --hp: #b8322a;
  --mp: #2f63a8;
  --xp: #c99b1f;
  --body: "Alegreya Sans", "Trebuchet MS", sans-serif;
  --head: "Alegreya SC", Georgia, serif;
  /* The phone's notch, rounded corners and home indicator (viewport-fit=cover lets the page run under them) */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --tabs: calc(54px + var(--sab));
  /* Portrait: what sits under the world (status strip, auto-hunt pill, tab bar) */
  --dock: calc(186px + var(--sab));
  --vh: 100vh;
  --world: calc(var(--vh) - var(--dock));
}
@supports (height: 1dvh) { :root { --vh: 100dvh; } }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; background: #1e1a15; color: var(--paper); font-family: var(--body); touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button { touch-action: manipulation; }
button:focus-visible { outline: 3px solid var(--paper); outline-offset: 2px; }
#view { position: fixed; left: 0; top: 0; width: 100%; height: 100%; display: block; }
[hidden] { display: none !important; }

.panel { background: var(--ink); border: 2px solid var(--line); border-radius: 4px; box-shadow: 0 2px 0 #00000066; }
.btn { position: relative; font: 700 16px var(--body); color: var(--paper); background: var(--ink-2); border: 2px solid var(--line); border-radius: 4px; min-height: 44px; min-width: 44px; padding: 0 14px; cursor: pointer; }
.btn:focus-visible, .slot:focus-visible, .tab:focus-visible { outline: 3px solid var(--paper); outline-offset: 2px; }
.btn.big { min-height: 52px; padding: 0 26px; font-size: 18px; }
.btn.primary { background: #6b4317; border-color: var(--gold); color: #fff3d6; }
.btn:active { background: var(--ink-3); }
.btn[aria-disabled="true"] { border-style: dashed; color: var(--paper-dim); background: transparent; cursor: default; }
.kicker { font: 500 14px var(--head); color: var(--copper); letter-spacing: 0.08em; margin: 0 0 2px; }

/* ---- HUD: a status strip, a map chip, the auto-hunt pill and the screen tabs */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud button { pointer-events: auto; }
.strip { position: fixed; left: calc(8px + var(--sal)); top: calc(8px + var(--sat)); width: min(400px, 46vw); display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; background: var(--ink); border: 2px solid var(--line); border-radius: 4px; }
.s-lv { width: 42px; height: 44px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 2px solid var(--copper); border-radius: 3px; background: #3a2a18; line-height: 1; }
.s-lv span { font: 500 11px var(--head); color: var(--paper-dim); }
.s-lv b { font: 700 19px var(--head); }
.s-bars { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tb { position: relative; height: 14px; background: #0f0c09; border: 1px solid var(--line-dim); border-radius: 2px; overflow: hidden; }
.tb .fill { position: absolute; inset: 0; transform-origin: left; }
.tb.hp .fill { background: var(--hp); }
.tb.mp .fill { background: var(--mp); }
.tb.xb .fill { background: var(--xp); }
.tb > span { position: absolute; inset: 0; display: flex; align-items: center; gap: 4px; padding-left: 5px; font-size: 11.5px; line-height: 1; text-shadow: 0 1px 0 #000, 0 0 3px #000; white-space: nowrap; }
.tb > span b { width: 26px; font-weight: 700; }
.s-coins { display: flex; align-items: center; gap: 5px; font: 700 16px var(--body); flex: none; }
.coin-mark { width: 13px; height: 13px; border-radius: 50%; background: #e2b33c; border: 2px solid #7a5a12; }

#mapchip { position: fixed; left: calc(8px + var(--sal)); top: calc(72px + var(--sat)); display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
#btn-map { min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 10px; font: 700 14px var(--head); color: var(--paper); background: #1e1a15d9; border: 2px solid var(--line-dim); border-radius: 4px; cursor: pointer; }
#btn-map .chev { font: 500 12px var(--body); color: var(--paper-dim); border-left: 1px solid var(--line-dim); padding-left: 8px; }
#minimap { display: block; width: 180px; height: 30px; background: #2f2a22; border: 2px solid var(--line-dim); border-radius: 3px; }

#toasts { position: fixed; left: 50%; top: 66px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; width: max-content; max-width: calc(100vw - 24px); pointer-events: none; z-index: 2; }
.toast { background: var(--ink); border: 2px solid var(--line); border-radius: 4px; padding: 5px 12px; font-weight: 500; font-size: 14px; text-align: center; animation: toast 2.6s forwards; }
.toast.big { font: 700 19px var(--head); border-color: var(--xp); padding: 6px 16px; }
@keyframes toast { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }

.pill { position: fixed; left: 50%; bottom: calc(8px + var(--sab)); transform: translateX(-50%); width: min(470px, calc(100vw - 16px)); display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 10px; background: var(--ink); border: 2px solid var(--line); border-left-width: 6px; border-radius: 4px; }
.auto-words { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.auto-state { font: 700 14px var(--head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auto-detail { font-size: 14px; color: var(--paper-dim); line-height: 1.2; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.pill #btn-auto { font-size: 14px; padding: 0 10px; flex: none; }
body[data-auto="on"] .pill { border-left-color: #8fbf5a; }
body[data-auto="manual"] .pill { border-left-color: var(--gold); border-left-style: dashed; }
body[data-auto="off"] .pill { border-left-color: var(--line-dim); border-left-style: dotted; }
.cds { display: flex; gap: 4px; flex: none; }
.cd-chip { font: 700 13px var(--body); padding: 2px 5px; border: 1px solid var(--line-dim); border-radius: 3px; color: var(--paper); white-space: nowrap; }
.cd-chip.wait { color: var(--paper-dim); border-style: dashed; }
body.manual .cds { display: none; }

#tabs { position: fixed; right: calc(8px + var(--sar)); top: calc(8px + var(--sat)); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#tabs .tabs-list { display: none; flex-direction: column; gap: 4px; }
#tabs.open .tabs-list { display: flex; }
.tabbtn { position: relative; min-height: 44px; min-width: 112px; padding: 0 12px; text-align: left; font: 700 15px var(--body); color: var(--paper); background: var(--ink-2); border: 2px solid var(--line-dim); border-radius: 4px; cursor: pointer; }
.tabbtn[aria-current="true"] { background: var(--ink-3); border-color: var(--gold); text-decoration: underline; text-underline-offset: 4px; }
.rail-toggle[aria-expanded="true"] { border-color: var(--gold); }
.badge { display: inline-block; margin-left: 6px; font: 700 12px var(--body); background: var(--gold); color: var(--ink); border-radius: 3px; padding: 1px 4px; vertical-align: 2px; }

/* ---- Manual controls: only while the player steers, in the bottom corners */
#controls { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
#controls button { pointer-events: auto; position: relative; font: 700 13px var(--body); color: var(--paper); background: #1e1a15c0; border: 2px solid #8a6a3fcc; border-radius: 6px; min-width: 48px; min-height: 48px; padding: 0 4px; }
#controls button.on { background: #4a3a26e0; border-color: var(--paper-dim); }
.pad { position: absolute; left: calc(10px + var(--sal)); bottom: calc(8px + var(--sab)); width: 150px; height: 150px; }
#controls .pad button { position: absolute; width: 50px; height: 50px; }
.pad [data-hold=up] { left: 50px; top: 0; }
.pad [data-hold=left] { left: 0; top: 50px; }
.pad [data-hold=right] { left: 100px; top: 50px; }
.pad [data-hold=down] { left: 50px; top: 100px; }
.acts { position: absolute; right: calc(10px + var(--sar)); bottom: calc(8px + var(--sab)); display: grid; grid-template-columns: repeat(3, 54px); gap: 5px; }
.acts .strike { grid-column: 2 / span 2; }
.acts .tonic { display: flex; align-items: center; justify-content: center; gap: 0; padding: 0 2px; }
.acts .tonic img { width: 22px; height: 20px; flex: none; image-rendering: pixelated; }
.acts .tonic span { font-size: 13px; white-space: nowrap; }
.acts .cd { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: #0e0b08d8; border-radius: 4px; font-size: 13px; }
.acts .cooling .cd { display: flex; }
/* ---- Floating numbers and tags */
#floaters { position: fixed; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; overflow: hidden; }
.dmg { position: absolute; font: 700 30px var(--head); color: #ffe7a6; -webkit-text-stroke: 1.5px #2a1606; text-shadow: 0 3px 0 #2a1606; transform: translate(-50%, -50%); white-space: nowrap; }
.dmg.crit { font-size: 40px; color: #ffb347; }
.dmg.crit::after { content: " crit"; font-size: 18px; }
.dmg.hurt { color: #ff9d8f; font-size: 26px; }
.dmg.hurt::before { content: "-"; }
.dmg.gain { font-size: 20px; color: #d9f2a6; }
.dmg.coin { font-size: 18px; color: #ffd76a; -webkit-text-stroke: 1px #2a1606; }
.dmg.level { font-size: 34px; color: #fff3c4; }
.tag { position: absolute; transform: translate(-50%, 0); background: #1e1a15d9; border: 1px solid var(--line-dim); border-radius: 3px; padding: 1px 7px; font-size: 13px; white-space: nowrap; }
.tag.tough { border-color: var(--copper); font-weight: 700; }
.mobbar { position: absolute; transform: translate(-50%, 0); width: 54px; height: 7px; background: #0f0c09; border: 1px solid #000; }
.mobbar i { display: block; height: 100%; background: var(--hp); }
.speech { position: absolute; transform: translate(-50%, -100%); max-width: 260px; background: var(--paper); color: var(--ink); border: 2px solid var(--line); border-radius: 4px; padding: 6px 10px; font-size: 14px; line-height: 1.3; }
.speech b { display: block; font-family: var(--head); }
.portal-tag { position: absolute; transform: translate(-50%, -100%); background: var(--ink); border: 2px solid var(--copper); border-radius: 3px; padding: 2px 8px; font-size: 13px; white-space: nowrap; }

/* ---- Away panels */
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #120f0bcc; padding: calc(16px + var(--sat)) calc(16px + var(--sar)) calc(16px + var(--sab)) calc(16px + var(--sal)); z-index: 6; }
.card { --pad-b: 22px; background: var(--ink); border: 2px solid var(--line); border-radius: 6px; max-width: 620px; width: 100%; padding: 22px 24px var(--pad-b); max-height: 100%; overflow: auto; overscroll-behavior: contain; touch-action: pan-y; }
/* The card's buttons stay in reach when its text is taller than the screen */
.card > .row:last-child { position: sticky; bottom: calc(-1 * var(--pad-b)); margin-bottom: calc(-1 * var(--pad-b)); padding: 12px 0 var(--pad-b); background: var(--ink); }
h2 { font: 700 26px var(--head); margin: 0; }
.premise { font-size: 18px; line-height: 1.45; margin: 0 0 18px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.note { color: var(--paper-dim); font-size: 14px; line-height: 1.4; }
.credit { color: var(--paper-dim); font-size: 13px; line-height: 1.4; margin-top: 18px; border-top: 1px solid #4a3a26; padding-top: 10px; }

.away-card { max-width: 460px; border-top: 6px solid var(--gold); }
.away-card h2 { font-size: 30px; color: var(--gold); }
.away-time { font-size: 16px; margin: 6px 0 14px; }
.away-grid { display: flex; flex-direction: column; border: 2px solid var(--line-dim); border-radius: 4px; }
.away-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "k v" "s v"; padding: 8px 12px; gap: 0 12px; align-items: center; }
.away-row + .away-row { border-top: 1px solid var(--line-dim); }
.away-row .k { grid-area: k; font-weight: 700; }
.away-row .s { grid-area: s; font-size: 14px; color: var(--paper-dim); }
.away-row .v { grid-area: v; font: 700 26px var(--head); color: #ffe7a6; }

/* ---- Sheets: upgrades, fields, bag, relight, menu */
.sheet { position: fixed; z-index: 5; width: min(470px, calc(100vw - 16px)); background: var(--ink); border: 2px solid var(--line); border-radius: 6px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 6px 0 #00000055; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 8px 16px; border-bottom: 2px solid var(--line-dim); flex-wrap: wrap; }
.sheet-head h2 { flex: 1; }
.sheet-head .tabs { order: 3; width: 100%; display: flex; gap: 6px; }
.tab { flex: 1; min-height: 44px; font: 700 15px var(--body); color: var(--paper-dim); background: transparent; border: 2px solid var(--line-dim); border-radius: 4px; cursor: pointer; }
.tab[aria-selected="true"] { color: var(--paper); background: var(--ink-3); border-color: var(--gold); text-decoration: underline; text-underline-offset: 4px; }
.sheet-sub { margin: 0; padding: 10px 16px; font-size: 14px; color: var(--paper-dim); line-height: 1.4; }
.sheet-sub:empty { display: none; }
.sheet-sub:empty + .list { padding-top: 10px; }
.list { flex: 1; overflow-y: auto; padding: 0 10px 12px; display: flex; flex-direction: column; gap: 8px; touch-action: pan-y; overscroll-behavior: contain; }
.list > * { flex: none; }
.row-card { display: flex; gap: 10px; align-items: center; background: var(--ink-2); border: 2px solid var(--line-dim); border-radius: 4px; padding: 10px 10px 10px 12px; }
.row-card.here { border-color: var(--gold); }
.row-card.locked { border-style: dashed; background: transparent; }
.row-card.locked .rc-title b { color: var(--paper-dim); }
.rc-main { flex: 1; min-width: 0; }
.rc-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rc-title b { font: 700 18px var(--head); overflow-wrap: anywhere; }
.rc-level { font-size: 14px; color: var(--copper); font-weight: 700; }
.rc-now { font-size: 14px; margin-top: 2px; }
.rc-next { font-size: 14px; color: var(--paper-dim); margin-top: 2px; }
.rc-act { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px; flex: none; max-width: 56%; }
.rc-status { flex-basis: 100%; }
.rc-status { font-size: 13.5px; color: var(--paper-dim); text-align: right; }
.rc-status:empty { display: none; }
.btn.buy { font-size: 14px; padding: 0 12px; white-space: nowrap; }

.bag-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px 0; flex-wrap: wrap; }
.worn { flex: 1; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "i l" "i n" "i a"; column-gap: 10px; align-items: center; }
.worn img { grid-area: i; width: 48px; height: 43px; image-rendering: pixelated; background: var(--ink-2); border: 2px solid var(--line-dim); border-radius: 4px; }
.worn .label { grid-area: l; font-size: 13px; color: var(--paper-dim); }
.worn b { grid-area: n; font: 700 18px var(--head); }
.worn span:last-child { grid-area: a; font-size: 13px; color: var(--paper-dim); }
#bag-list { flex: 1; overflow-y: auto; padding: 0 10px 12px; display: flex; flex-direction: column; gap: 8px; touch-action: pan-y; }
.bag-item { display: flex; gap: 10px; align-items: center; background: var(--ink-2); border: 2px solid var(--line-dim); border-radius: 4px; padding: 6px 8px; min-height: 56px; }
.bag-item img { width: 40px; height: 36px; image-rendering: pixelated; flex: none; }
.bi-text { flex: 1; min-width: 0; }
.bi-text b { font-size: 15px; }
.bi-count { font-size: 13px; color: var(--copper); font-weight: 700; }
.bi-text small { display: block; color: var(--paper-dim); font-size: 13.5px; }

.relight-box { display: flex; gap: 12px; margin: 0 10px 10px; padding: 12px; border: 2px solid var(--copper); border-radius: 4px; background: #2a1d10; align-items: center; flex-wrap: wrap; }
.lights { display: flex; flex-direction: column; min-width: 96px; }
.lights .label, .lights .small { font-size: 13.5px; color: var(--paper-dim); }
.lights b { font: 700 34px var(--head); color: var(--gold); line-height: 1.1; }
.relight-act { flex: 1; min-width: 180px; }
.relight-act p { margin: 0 0 8px; font-size: 14px; }
#btn-relight { width: 100%; }
#btn-relight.armed { background: #6b2b17; border-color: var(--gold); }

.controls { border-collapse: collapse; margin: 0 16px 16px; font-size: 15px; }
.controls th { text-align: left; font-weight: 500; color: var(--paper-dim); padding: 6px 12px 6px 0; vertical-align: top; }
.controls td { padding: 6px 0; font-weight: 700; }
#sheet-pause { overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }

#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity 0.18s; z-index: 4; }
#fade.on { opacity: 1; transition: none; }

/* ---- Landscape: everything rides over the world; screens are a side panel */
.sheet { top: calc(8px + var(--sat)); right: calc(8px + var(--sar)); bottom: calc(8px + var(--sab)); }
.hero-grid { padding: 10px 14px; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; }
.hero-grid .stat { background: var(--ink-2); border: 2px solid var(--line-dim); border-radius: 4px; padding: 6px 10px; display: flex; flex-direction: column; }
.hero-grid .stat span { font-size: 13.5px; color: var(--paper-dim); }
.hero-grid .stat b { font: 700 18px var(--body); }
.hero-grid .wide { grid-column: 1 / -1; }

/* Landscape: toasts sit in the open sky between the status strip and the Menu button */
#toasts { left: calc(min(400px, 46vw) + 24px + var(--sal)); right: calc(140px + var(--sar)); top: calc(8px + var(--sat)); transform: none; width: auto; max-width: none; }
@media (max-height: 520px) and (orientation: landscape) {
  .strip { width: min(360px, 44vw); }
  #toasts { left: calc(min(360px, 44vw) + 24px + var(--sal)); }
  #mapchip { top: calc(70px + var(--sat)); }
  .pill { bottom: calc(6px + var(--sab)); width: min(440px, calc(100vw - 380px - var(--sal) - var(--sar))); }
  .acts { grid-template-columns: repeat(3, 50px); gap: 4px; }
  #controls button { min-height: 46px; }
  #tabs .tabs-list { max-height: calc(var(--vh) - 64px - var(--sat) - var(--sab)); overflow-y: auto; }
  /* A short screen: the screens are wider and their heading shares a line with the sub-tabs, so the list keeps room */
  .sheet { width: min(560px, 66vw); }
  .sheet-head { padding: 6px 8px 6px 12px; gap: 6px; }
  .sheet-head h2 { flex: 0 1 auto; font-size: 21px; }
  .sheet-head .tabs { order: 2; flex: 1 1 auto; width: auto; min-width: 0; gap: 4px; }
  .sheet-head .close { order: 3; }
  .sheet-head:not(:has(.tabs:not([hidden]))) h2 { flex: 1; }
  .tab { padding: 0 6px; font-size: 14px; }
  .sheet-sub { padding: 6px 14px; }
  .overlay { padding-top: calc(8px + var(--sat)); padding-bottom: calc(8px + var(--sab)); }
  .card { --pad-b: 14px; padding: 14px 18px var(--pad-b); }
  .away-card h2, .intro-card h2 { font-size: 24px; }
  .away-time { margin: 2px 0 8px; }
  .away-grid { display: grid; grid-template-columns: 1fr 1fr; }
  .away-row { padding: 6px 10px; }
  .away-row + .away-row { border-top: 0; }
  .away-row:nth-child(n + 3) { border-top: 1px solid var(--line-dim); }
  .away-row:nth-child(even) { border-left: 1px solid var(--line-dim); }
  .away-row .v { font-size: 22px; }
  .premise { font-size: 16px; }
}

/* ---- Portrait: the world on top, then the strip, the pill and a tab bar */
body.portrait.notabs { --dock: calc(132px + var(--sab)); } /* a new hero has no tabs yet: no empty band under the pill */
body.portrait #view { height: var(--world); }
body.portrait #floaters { height: var(--world); }
body.portrait .strip { top: var(--world); left: 0; right: 0; width: auto; border-radius: 0; border-width: 2px 0 0; padding: 5px calc(10px + var(--sar)) 5px calc(6px + var(--sal)); }
body.portrait #mapchip { top: calc(8px + var(--sat)); }
body.portrait #toasts { top: calc(60px + var(--sat)); left: 50%; right: auto; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 24px); }
body.portrait .pill { top: calc(var(--world) + 62px); bottom: auto; left: calc(6px + var(--sal)); right: calc(6px + var(--sar)); width: auto; transform: none; }
body.portrait #tabs { top: auto; left: 0; right: 0; bottom: 0; height: var(--tabs); flex-direction: row; gap: 0; background: #15120e; border-top: 2px solid var(--line); padding: 4px calc(4px + var(--sar)) calc(4px + var(--sab)) calc(4px + var(--sal)); }
body.portrait .rail-toggle { display: none; }
body.portrait #tabs .tabs-list { display: flex; flex-direction: row; flex: 1; gap: 4px; }
body.portrait .tabbtn { flex: 1; min-width: 0; padding: 0 2px; text-align: center; font-size: 14px; }
body.portrait .badge { position: absolute; top: -9px; right: 0; margin: 0; }
body.portrait .pad, body.portrait .acts { bottom: calc(var(--dock) + 8px); }
body.portrait .sheet { top: 28vh; left: 0; right: 0; bottom: var(--tabs); width: auto; border-radius: 0; border-width: 3px 0 0; }
body.portrait.notabs .sheet { bottom: 0; padding-bottom: var(--sab); }
body.portrait .sheet-head { padding-left: calc(16px + var(--sal)); padding-right: calc(10px + var(--sar)); }
body.portrait .overlay { padding: calc(12px + var(--sat)) calc(12px + var(--sar)) calc(12px + var(--sab)) calc(12px + var(--sal)); }
body.portrait .card { --pad-b: 18px; padding: 18px; }
/* The creator: it is left by its Done button, so the other sub-tabs and Close are put away until then */
body.creating #sheet-hero .tabs, body.creating #sheet-hero [data-close] { display: none; }

/* ---- Rows with icons and several buttons */
.rc-icon { width: 36px; height: 32px; image-rendering: pixelated; flex: none; }
.rc-act .btn.buy { min-width: 96px; }
.btn.buy[aria-pressed="true"] { border-color: var(--gold); background: var(--ink-3); }
.pill #btn-leave { font-size: 14px; padding: 0 10px; flex: none; }
.list .hero-grid { padding: 0; }

/* ---- Moments: a level, a temper held, missed or slipped */
.moment { position: fixed; left: 50%; top: 22%; transform: translate(-50%, -50%); z-index: 7; pointer-events: none; text-align: center; padding: 12px 26px 14px; background: var(--ink); border: 3px solid var(--gold); border-radius: 6px; min-width: 240px; }
body.portrait .moment { top: calc(var(--world) * 0.35); max-width: calc(100vw - 32px); }
.moment b { display: block; font: 700 34px var(--head); color: var(--gold); line-height: 1.1; }
.moment span { display: block; font-size: 15px; margin-top: 4px; }
.moment.show { animation: moment 1.7s ease-out forwards; }
.moment.temper-up { border-color: #9fd36a; border-style: double; border-width: 5px; }
.moment.temper-up b { color: #d8f5a8; }
.moment.temper-miss { border-color: var(--line); border-style: dashed; }
.moment.temper-miss b { color: var(--paper); }
.moment.temper-slip { border-color: #d0614f; border-style: dotted; border-width: 4px; }
.moment.temper-slip b { color: #ffb4a6; }
@keyframes moment { 0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; } 12% { transform: translate(-50%, -50%) scale(1.12); opacity: 1; } 22% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -58%) scale(1); } }
.dmg.crit { animation: critpop 0.25s ease-out; }
@keyframes critpop { 0% { transform: translate(-50%, -50%) scale(1.8); } 100% { transform: translate(-50%, -50%) scale(1); } }

.sign { position: absolute; transform: translate(-50%, -100%); background: #3a2a18e6; border: 2px solid var(--copper); border-radius: 3px; padding: 3px 10px 4px; text-align: center; font-size: 12px; color: var(--paper-dim); white-space: nowrap; }
.sign b { display: block; font: 700 15px var(--head); color: var(--gold); }
.tabbtn.fresh::after { content: "New"; position: absolute; top: -9px; right: 2px; font: 700 12px var(--body); background: var(--gold); color: var(--ink); border-radius: 3px; padding: 1px 4px; }
.intro-card { max-width: 440px; border-top: 6px solid var(--copper); }
.intro-card h2 { font-size: 28px; color: var(--gold); margin-bottom: 8px; }
.intro-line { font-size: 17px; line-height: 1.4; margin: 0 0 10px; }

.warn { position: fixed; left: 50%; top: calc(8px + var(--sat)); transform: translateX(-50%); z-index: 8; max-width: calc(100vw - 16px); background: #3a1712; border: 2px solid #d0614f; border-radius: 4px; padding: 6px 10px; font-size: 14px; display: flex; align-items: center; gap: 10px; }
.warn .btn { min-height: 44px; font-size: 14px; }

/* ---- The quest line */
.questchip { position: fixed; left: calc(8px + var(--sal)); top: calc(124px + var(--sat)); width: min(360px, 44vw); min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 3px 4px 3px 10px; background: var(--ink); border: 2px solid var(--copper); border-radius: 4px; font-size: 13px; pointer-events: auto; }
.questchip span { flex: 1; min-width: 0; line-height: 1.25; font-size: 14px; }
.questchip b { font-family: var(--head); margin-right: 4px; color: var(--gold); }
.questchip .btn { font-size: 14px; padding: 0 10px; }
body.portrait .questchip { top: auto; bottom: calc(var(--dock) + 6px); left: calc(6px + var(--sal)); right: calc(6px + var(--sar)); width: auto; }
body.manual .questchip { display: none; }
@media (max-height: 520px) and (orientation: landscape) { .questchip { top: calc(118px + var(--sat)); } }

/* ---- The world map */
.region { border: 2px solid var(--line); border-radius: 6px; padding: 10px; background: var(--ink-2); }
.region.locked { border-style: dashed; background: transparent; }
.region header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.region h3 { margin: 0; font: 700 20px var(--head); color: var(--gold); }
.region header span { font-size: 14px; color: var(--paper-dim); }
.region p { margin: 4px 0 8px; font-size: 14px; color: var(--paper-dim); }
.nodes { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; }
.node { flex: 1 1 120px; min-height: 44px; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; padding: 6px 8px; font: 500 14px var(--body); color: var(--paper); background: var(--ink); border: 2px solid var(--line-dim); border-radius: 4px; cursor: pointer; }
.node b { font: 700 14px var(--head); }
.node.here { border-color: var(--gold); border-width: 3px; }
.node.locked { border-style: dashed; color: var(--paper-dim); }
.node .node-state { font-weight: 700; }
.node .node-gate { color: var(--paper-dim); font-size: 13px; }
.node-link { flex: 0 0 10px; align-self: center; height: 3px; background: var(--line); }
/* Narrow screens: the fields of a region in two even columns (the links would dangle at the ends of wrapped rows) */
@media (max-width: 600px) {
  .nodes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .node-link { display: none; }
}
.region-boss { margin-top: 8px; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 2px solid var(--copper); border-radius: 4px; font-size: 14px; }
.region-boss span { flex: 1; }
.region-boss b { display: block; font: 700 14px var(--head); }
.cast-tag { position: absolute; transform: translate(-50%, -100%); background: #3a1712; border: 2px dashed #ff6a4a; border-radius: 3px; padding: 2px 8px; font: 700 13px var(--body); color: #ffe0d6; white-space: nowrap; }
body.inrun .cds { display: none; }

/* ---- Start screen: the illustration, its leaves and embers, the loading bar and the start buttons.
   The art is placed by start.js so the logo, the travelers and the fire stay in view; a blurred copy of it fills
   whatever the art leaves uncovered, so the edges always match. */
.start { position: fixed; inset: 0; z-index: 8; overflow: hidden; background: #3d4a3a; }
.start-wash { position: absolute; inset: -40px; background: center 45% / cover no-repeat; /* the image is set from src/title-art.js */ filter: blur(26px) saturate(1.1) brightness(0.62); }
.start-art { position: absolute; left: 0; top: 0; display: block; transform-origin: 0 0; user-select: none; pointer-events: none;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent), linear-gradient(transparent, #000 5%, #000 95%, transparent);
  -webkit-mask-composite: source-in; mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent), linear-gradient(transparent, #000 5%, #000 95%, transparent); mask-composite: intersect; }
.start-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.start-panel { position: absolute; left: 50%; bottom: calc(16px + var(--sab)); transform: translateX(-50%); width: min(420px, calc(100% - 32px));
  display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding: 16px; background: #1e1a15e6; border: 2px solid var(--line); border-top: 4px solid var(--copper); border-radius: 6px; box-shadow: 0 6px 24px #0008; }
.start:not(.stack) .start-panel { bottom: auto; transform: none; padding: 12px; gap: 10px; overflow: auto; }
.start:not(.stack) #start-credit { position: absolute; margin: 0; padding: 8px 10px; background: #1e1a15cc; border: 1px solid var(--line-dim); border-radius: 4px; color: var(--paper); font-size: 13px; }
.load { display: flex; flex-direction: column; gap: 8px; }
.load-track { position: relative; height: 18px; background: #0f0c09; border: 2px solid var(--line-dim); border-radius: 3px; overflow: hidden; }
.load-track i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(#f3d38a, #c4742f); transition: width 0.25s ease-out; }
.load-track i::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 3px; background: #fff3d6; box-shadow: 0 0 10px 3px #ffb45a; }
.load-note { margin: 0; font: 500 15px var(--body); color: var(--paper); text-align: center; }
.start-actions { display: flex; flex-direction: column; gap: 10px; }
.start-actions[hidden] { display: none; }
.start-btn { min-height: 60px; font: 700 26px var(--head); letter-spacing: 0.04em; }
.start-btn.secondary { min-height: 48px; font-size: 18px; background: var(--ink-2); border-color: var(--line); color: var(--paper); }
.start-btn:focus-visible { outline: 3px solid #fff3d6; outline-offset: 3px; }
.start-saved { margin: 0; text-align: center; font-size: 14px; color: var(--paper-dim); }
.start .credit { margin: 0; font-size: 13px; padding-top: 8px; }
.start.ready .start-actions { animation: start-in 0.35s ease-out; }
@keyframes start-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .start.ready .start-actions { animation: none; }
  .load-track i { transition: none; }
}
@media (max-height: 430px) {
  .start-panel { gap: 8px; padding: 12px; }
  .start-btn { min-height: 52px; font-size: 22px; }
  .start .credit { font-size: 12.5px; }
}

/* ---- Cloud save and the fan notice (src/cloud.js; the Menu sheet, the start screen) */
#sheet-pause { overflow-y: auto; }
.menu-part { padding: 4px 16px 14px; }
.menu-part h3 { margin: 4px 0 6px; font: 700 17px var(--head); color: var(--paper); }
.menu-part .row .btn { font-size: 14px; }
.notice p { margin: 0 0 8px; font-size: 14px; line-height: 1.45; color: var(--paper-dim); }
.credit p { margin: 0; }
.credit .about-btn { margin-top: 8px; min-height: 44px; padding: 0 12px; font-size: 14px; background: #1e1a15d9; }
#cloud-ask, #about { z-index: 9; }
.cloud-saves { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 16px; }
.cloud-saves[hidden] { display: none; }
.cloud-save { flex: 1 1 200px; background: var(--ink-2); border: 2px solid var(--line-dim); border-radius: 4px; padding: 10px 12px; font-size: 14px; line-height: 1.45; }
.cloud-save b { display: block; font: 700 17px var(--head); color: var(--paper); }
.cloud-save .newer { color: #ffe7a6; font-weight: 700; }

/* ---- Round six: hunt or gather, the look, the workshop, the collection log */
.pill #btn-mode { font-size: 14px; padding: 0 10px; flex: none; }
.mode-menu { position: absolute; left: -2px; right: -2px; bottom: calc(100% + 6px); max-height: calc(var(--vh) - 140px - var(--sat)); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; display: flex; flex-direction: column; gap: 6px; padding: 8px; background: var(--ink); border: 2px solid var(--line); border-radius: 4px; pointer-events: auto; box-shadow: 0 6px 18px #0008; }
.mode-menu[hidden] { display: none; }
.mode-title { margin: 0 0 2px; font: 700 14px var(--head); color: var(--paper-dim); }
.mode-opt { position: relative; min-height: 48px; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 10px; text-align: left; font: 500 14px var(--body); color: var(--paper-dim); background: var(--ink-2); border: 2px solid var(--line-dim); border-radius: 4px; cursor: pointer; }
.mode-opt b { font: 700 16px var(--head); color: var(--paper); }
.mode-opt[aria-pressed="true"] { border-color: var(--gold); border-width: 3px; background: var(--ink-3); }
.mode-opt i { position: absolute; right: 10px; top: 8px; font-style: normal; font-weight: 700; font-size: 13px; color: var(--gold); }
.look-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.look-tab { flex: 1 1 30%; font-size: 14px; padding: 0 8px; }
.look-tab[aria-pressed="true"] { border-color: var(--gold); background: var(--ink-3); text-decoration: underline; text-underline-offset: 4px; }
.look-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.look-opt { position: relative; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 4px; font: 600 14px var(--body); color: var(--paper); background: var(--ink-2); border: 2px solid var(--line-dim); border-radius: 4px; cursor: pointer; }
.look-opt .sw { width: 30px; height: 18px; border: 2px solid #0008; border-radius: 3px; }
.look-opt[aria-pressed="true"] { border-color: var(--gold); border-width: 3px; background: var(--ink-3); }
.look-opt .lo-on { font-size: 13px; font-weight: 700; color: var(--gold); }
.look-done { width: 100%; }
.list-head { margin: 6px 2px 0; font: 700 16px var(--head); color: var(--gold); }
.trade-levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.trade { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 6px; padding: 6px 10px; background: var(--ink-2); border: 2px solid var(--line-dim); border-radius: 4px; }
.trade span { font-size: 14px; color: var(--paper-dim); }
.trade b { font: 700 18px var(--head); }
.trade .tbar { grid-column: 1 / -1; display: block; height: 6px; background: #0f0c09; border: 1px solid var(--line-dim); border-radius: 2px; overflow: hidden; }
.trade .tbar i { display: block; height: 100%; background: var(--xp); }
.trade small { grid-column: 1 / -1; font-size: 13px; color: var(--paper-dim); }
.clog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 6px; }
.clog-slot { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; text-align: center; background: var(--ink-2); border: 2px solid var(--line-dim); border-radius: 4px; font-size: 13px; }
.clog-slot b { font-size: 14px; line-height: 1.2; overflow-wrap: anywhere; }
.clog-slot span { color: var(--paper-dim); }
.clog-slot.got { border-color: var(--copper); }
.clog-slot.missing { border-style: dashed; background: transparent; }
.clog-slot.missing b { color: var(--paper-dim); }
.clog-q { width: 36px; height: 32px; display: flex; align-items: center; justify-content: center; font: 700 20px var(--head); color: var(--line); }
body.portrait .cds { display: none; } /* the pill keeps room for the hunt or gather choice on a phone */

/* ---- Less motion for players who ask for it: things appear and fade, nothing pops, slides or shakes */
@media (prefers-reduced-motion: reduce) {
  .moment.show { animation: moment-still 1.7s linear forwards; }
  .dmg.crit { animation: none; }
  #fade { transition: none; }
}
@keyframes moment-still { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }

/* ---- Round seven: blessings, waymark trails, caskets, weaknesses */
.spr { image-rendering: pixelated; width: 22px; height: auto; vertical-align: middle; }
.spr.big { width: 46px; }
/* Lit blessings on the HUD: the prayer icon in a ring that empties with its time, minutes under it */
.blessbar { position: fixed; right: calc(8px + var(--sar)); top: calc(66px + var(--sat)); display: flex; gap: 6px; z-index: 3; pointer-events: auto; }
body.portrait .blessbar { top: calc(8px + var(--sat)); }
.bb { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 44px; min-height: 44px; padding: 0; background: none; border: 0; color: var(--paper); cursor: pointer; }
.bb-ring, .pt-ring { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 1turn), #0000008c 0); }
.bb-ring::before, .pt-ring::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--ink); }
.bb-ring img, .pt-ring img { position: relative; image-rendering: pixelated; width: 26px; }
.bb-t { font: 700 12px var(--body); background: var(--ink); border: 1px solid var(--line-dim); border-radius: 3px; padding: 0 4px; line-height: 16px; }
/* The trail line sits on top of the quest line when both show */
.trailchip { border-color: var(--gold); }
.trailchip .rc-icon { width: 30px; height: auto; }
.trailchip.stacked { top: calc(176px + var(--sat)); }
body.portrait .trailchip.stacked { top: auto; bottom: calc(var(--dock) + 58px); }
body.manual .trailchip { display: none; }
/* Weakness badge beside a creature's health bar */
.mobbar .wk { position: absolute; right: calc(100% + 3px); top: -9px; display: flex; align-items: center; gap: 2px; background: #0f0c09e6; border: 1px solid #000; border-radius: 3px; padding: 0 3px 0 1px; white-space: nowrap; }
.mobbar .wk .spr { width: 16px; }
.mobbar .wk b { font: 700 11px var(--body); line-height: 18px; }
.mobbar .wk.up b { color: #b8f08a; }
.mobbar .wk.down b { color: #ffb0a0; }
.dmg.weakhit { color: #d8ffb0; font-size: 1.12em; }
.wk-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 5px; }
.wk-line > b { font-weight: 700; color: var(--paper); margin-right: 2px; }
.wk-chip { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px 1px 2px; border: 1px solid var(--line-dim); border-radius: 3px; background: var(--ink); font-size: 13px; color: var(--paper); }
.wk-you { font-size: 13px; color: var(--gold); }
/* Hero, Prayer */
.pray-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--ink-2); border: 2px solid var(--line-dim); border-radius: 4px; }
.ph-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ph-main b { font: 700 22px var(--head); color: var(--gold); }
.ph-main span { font-size: 13.5px; color: var(--paper-dim); }
.tbar { height: 8px; background: #0f0c09; border: 1px solid #000; border-radius: 2px; overflow: hidden; }
.tbar i { display: block; height: 100%; background: var(--xp); }
.ph-slots { display: grid; grid-template-columns: repeat(3, 30px); gap: 4px; justify-items: center; }
.ph-slots em { grid-column: 1 / -1; font-style: normal; font-size: 12px; color: var(--paper-dim); }
.ph-slots .slot { width: 30px; height: 30px; border: 2px solid var(--line-dim); border-radius: 50%; display: grid; place-items: center; font-size: 10px; color: var(--paper-dim); }
.ph-slots .slot.on { border-color: var(--gold); }
.ph-slots .slot.shut { border-style: dashed; }
.ph-slots .slot img { image-rendering: pixelated; width: 20px; }
.bones { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.bone { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "i n" "i s" "b b"; gap: 0 8px; align-items: center; padding: 8px; background: var(--ink-2); border: 2px solid var(--line-dim); border-radius: 4px; }
.bone .rc-icon { grid-area: i; }
.bone b { grid-area: n; font-size: 20px; }
.bone span { grid-area: s; font-size: 12.5px; color: var(--paper-dim); }
.bone .btn { grid-area: b; margin-top: 6px; min-height: 44px; }
.pbook { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 8px; }
.ptile { display: flex; flex-direction: column; background: var(--ink-2); border: 2px solid var(--line-dim); border-radius: 4px; }
.ptile.lit { border-color: var(--gold); background: #3a3020; }
.ptile.locked { opacity: 0.8; }
.pt-main { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 10px; min-height: 44px; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; }
.pt-main[aria-disabled="true"] { cursor: default; }
.pt-ring { flex: none; width: 48px; height: 48px; }
.pt-ring img { width: 30px; }
.pt-words { display: flex; flex-direction: column; min-width: 0; }
.pt-words b { font: 700 16px var(--head); line-height: 1.15; }
.pt-g { font-size: 12px; color: var(--copper); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.pt-b { font-size: 13px; line-height: 1.25; }
.pt-s { font-size: 12.5px; color: var(--paper-dim); margin-top: 2px; }
.ptile.lit .pt-s { color: var(--gold); font-weight: 700; }
.pt-tools { display: flex; gap: 6px; padding: 0 10px 10px; }
.pt-tools .btn { flex: 1; min-height: 44px; font-size: 13.5px; padding: 0 6px; }
/* The waymark trail: a route of steps, the current one open, the rest hidden */
.trail { background: #3b3122; border: 2px solid var(--gold); border-radius: 4px; padding: 10px; margin-bottom: 8px; }
.trail.idle { border-color: var(--line-dim); background: var(--ink-2); }
.trail header { display: flex; align-items: center; gap: 10px; }
.trail header > div { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.trail header b { font: 700 18px var(--head); color: var(--gold); }
.trail header span { font-size: 13.5px; color: var(--paper-dim); }
.trail header .btn { min-height: 44px; }
.route { list-style: none; display: flex; justify-content: space-between; margin: 12px 4px 6px; padding: 0; position: relative; }
.route::before { content: ""; position: absolute; left: 22px; right: 22px; top: 21px; border-top: 3px dashed #8a6a3f; }
.route li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; width: 54px; }
.rn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); border: 2px solid var(--line-dim); }
.rn img { max-width: 32px; max-height: 30px; image-rendering: pixelated; }
.rn .q { font: 700 20px var(--head); color: var(--paper-dim); }
.rl { font-size: 12px; color: var(--paper-dim); white-space: nowrap; }
.node-done .rn { border-color: #7fae5a; }
.node-done .rl { color: #b8f08a; }
.node-now .rn { border: 3px solid var(--gold); background: #4a3c24; }
.node-now .rl { color: var(--gold); font-weight: 700; }
.node-end .rn { border-style: dashed; }
.trail-now { margin: 4px 2px 8px; }
.trail-now b { display: block; font-size: 15px; margin-bottom: 4px; }
.trail-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; border-top: 1px solid var(--line-dim); padding-top: 8px; margin-top: 8px; font-size: 13.5px; }
.tf-item { display: inline-flex; align-items: center; gap: 4px; }
.tf-item .rc-icon { width: 28px; height: auto; }
.tf-done { color: var(--paper-dim); margin-left: auto; }
/* Casket reveal */
.casket-card { max-width: 420px; text-align: center; border-top: 6px solid var(--gold); }
.casket-art img { width: 84px; height: auto; image-rendering: pixelated; animation: casket-pop 0.5s ease-out both; }
.casket-card h2 { color: var(--gold); margin: 4px 0 12px; }
.casket-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-bottom: 12px; }
.cf { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px; background: var(--ink-2); border: 2px solid var(--line-dim); border-radius: 4px; animation: casket-in 0.35s ease-out both; animation-delay: var(--d); }
.cf .rc-icon { width: 40px; height: auto; }
.cf b { font-size: 18px; }
.cf span { font-size: 12.5px; color: var(--paper-dim); }
.cf.gem { border-color: var(--gold); background: #3b3122; }
.cf.gem span { color: var(--gold); }
@keyframes casket-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes casket-pop { 0% { transform: scale(0.6); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .cf, .casket-art img { animation: none; } }
.moment.pet { border-color: #b8f08a; }
.casket-card .row { justify-content: center; }
.rc-icon, .spr, .rn img, .bb-ring img, .pt-ring img { object-fit: contain; }

/* ---- Picture tabs: the tab bar and each screen's sub-tabs show KayKit icons; the names stay for screen readers and
   as a tooltip, and show beside the icon only where the words fit (the landscape rail) */
.tab-ic { width: 34px; height: 34px; object-fit: contain; pointer-events: none; }
.tabbtn { display: flex; align-items: center; gap: 8px; }
.tab-name { pointer-events: none; }
.tabbtn.has-ic .tab-name, .tab.has-ic .tab-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#tabs .tabbtn.has-ic { min-width: 52px; justify-content: center; }
body.portrait .tabbtn { justify-content: center; }
body.portrait .tabbtn .tab-ic { width: 38px; height: 38px; }
.tab.has-ic { display: grid; place-items: center; padding: 2px; }
.tab.has-ic .tab-ic { width: 32px; height: 32px; }
.tab[aria-selected="true"] { background: var(--ink-3); border-color: var(--gold); }
.tabbtn[aria-current="true"] { background: #4a3c24; }
.tabbtn.logout { border-style: dashed; }

/* Discord's Blurple sign-in button (Social SDK design guidelines): the 45 degree gradient, a hairline border, white words
   beside Discord's logo, unchanged, in a pill */
.btn.discord-btn, .discord-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 12px 22px; background: linear-gradient(45deg, #4752c4, #6571f3); color: #fff; border: 1px solid rgba(0, 0, 0, .08); border-radius: 40px; font: 700 15px var(--body); }
.discord-btn .dc-mark { width: 22px; height: 22px; flex: none; }
.discord-btn:focus-visible { outline: 3px solid #fff3d6; outline-offset: 3px; }
