/* Realm of Old Earth — game.css: every style for the page, the HUD, the touch controls and the menus. */
/* Layout: full-bleed 3D canvas; HUD plates pinned to the corners with bronze trim; menus are stone tablets centered over a dimmed scene */
:root {
  color-scheme: dark;
  --night: #10141f;
  --plate: rgba(14, 18, 24, 0.74);
  --bronze: #d6a85c;
  --bronze-deep: #a8783a;
  --bronze-line: rgba(214, 168, 92, 0.38);
  --bone: #eee5d1;
  --ash: #b3b8c2;
  --moss: #86b86a;
  --moss-hi: #b3e094;
  --moss-lo: #5a8c45;
  --ember: #ff8c45;
  --ember-hi: #ffc58f;
  --ember-lo: #c95f2c;
  --rift: #ff5a4a;
  --blood: #e0303a;
  --blood-hi: #ff8a7a;
  --blood-lo: #8f1422;
  --ink: #1a1309;
  --font-display: "Uncial Antiqua", "Papyrus", Georgia, serif;
  --font-body: "Alegreya Sans", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --inset-t: env(safe-area-inset-top, 0px);
  --inset-r: env(safe-area-inset-right, 0px);
  --inset-b: env(safe-area-inset-bottom, 0px);
  --inset-l: env(safe-area-inset-left, 0px);
}
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; }
body {
  margin: 0;
  background: var(--night);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
#game { position: fixed; inset: 0; overflow: hidden; touch-action: none; background: var(--night); }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#vignette, #focus { position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0; }
#vignette { background: radial-gradient(ellipse at center, transparent 42%, rgba(200, 32, 40, 0.6) 100%); }
#focus { background: radial-gradient(ellipse at center, transparent 46%, rgba(150, 205, 255, 0.42) 100%); transition: opacity 0.25s; }
#focus.on { opacity: 1; }
#fx-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.plate {
  position: absolute;
  background: var(--plate);
  border: 1px solid var(--bronze-line);
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.left-stack {
  position: absolute; top: calc(12px + var(--inset-t)); left: calc(12px + var(--inset-l));
  width: min(270px, 46vw); display: flex; flex-direction: column; align-items: stretch; gap: 6px;
}
.left-stack > .plate { position: relative; box-sizing: border-box; }
.hero-plate { padding: 7px 12px 10px; }
.plate .row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.comp-plate { padding: 5px 12px 8px; }
.comp-name { font-size: 15px; color: #f3d29a; }
.comp-bar { height: 9px; margin-top: 4px; }
.comp-bar i { background: linear-gradient(180deg, #f6dcae, #c9934f 55%, #8a5a2b); }
.comp-plate.down .comp-bar i { filter: grayscale(0.85) brightness(0.7); }
.comp-plate.down .hp-num { color: var(--rift); }
.who { font-family: var(--font-display); font-size: 17px; color: var(--bone); }
.hp-num { font-size: 13px; font-weight: 700; color: var(--ash); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hpbar, .bossbar {
  position: relative; height: 12px; margin-top: 5px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(214, 168, 92, 0.3);
  border-radius: 2px; overflow: hidden;
}
.hpbar i, .bossbar i {
  position: absolute; inset: 0 auto 0 0; width: 100%;
  background: linear-gradient(180deg, var(--moss-hi), var(--moss) 55%, var(--moss-lo));
  transition: width 0.18s ease-out;
}
.lv {
  display: inline-block; margin-left: 6px; padding: 0 6px; vertical-align: 3px;
  font: 800 11px/1.6 var(--font-body); letter-spacing: 0.06em; font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--bronze); border-radius: 2px;
}
.xpbar { position: relative; height: 5px; margin-top: 4px; background: rgba(0, 0, 0, 0.5); border-radius: 2px; overflow: hidden; }
.xpbar i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--bronze-deep), #ffd98a); transition: width 0.3s ease-out; }
.stambar { position: relative; height: 7px; margin-top: 4px; background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(214, 168, 92, 0.22); border-radius: 2px; overflow: hidden; }
.stambar i { position: absolute; inset: 0 auto 0 0; width: 100%; background: linear-gradient(180deg, #fff3bf, #e9c75e 55%, #a9872f); }
.stambar.low i { background: linear-gradient(180deg, #ffe0a8, #f2a446 55%, #b3691f); }
.stambar.out i { background: linear-gradient(180deg, #ffa494, #e2553c 55%, #902418); }
.stambar.out { animation: tired 0.9s ease-in-out infinite; }
.stambar.deny { animation: denied 0.3s; }
@keyframes tired { 50% { border-color: rgba(255, 96, 74, 0.85); box-shadow: 0 0 9px rgba(255, 96, 74, 0.55); } }
.hpbar.low i { background: linear-gradient(180deg, var(--ember-hi), var(--ember) 55%, var(--ember-lo)); }
.hpbar::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(0, 0, 0, 0.38) calc(10% - 1px) 10%);
}
.wave-plate {
  top: calc(12px + var(--inset-t)); left: 50%; transform: translateX(-50%);
  text-align: center; padding: 6px 18px 8px; min-width: 150px;
}
.wave-plate::before, .wave-plate::after {
  content: ""; position: absolute; top: 50%; width: 7px; height: 7px; margin-top: -4px;
  background: var(--bronze); transform: rotate(45deg); opacity: 0.8;
}
.wave-plate::before { left: -4px; }
.wave-plate::after { right: -4px; }
.wave-name { font-family: var(--font-display); font-size: 18px; color: var(--bronze); white-space: nowrap; }
.foes { font-size: 13px; color: var(--ash); white-space: nowrap; }
.foes b { color: var(--rift); font-weight: 800; font-variant-numeric: tabular-nums; }
.boss-plate {
  top: calc(70px + var(--inset-t)); left: 50%; transform: translateX(-50%);
  width: min(520px, 62vw); padding: 6px 14px 9px; text-align: center;
  border-color: rgba(255, 90, 90, 0.4);
}
.boss-name { font-family: var(--font-display); font-size: 17px; color: var(--blood-hi); }
.boss-lv { display: inline-block; margin-right: 8px; padding: 0 7px; border: 2px solid currentColor; border-radius: 7px; background: rgba(18, 10, 14, 0.9); font: 800 13px/18px "Alegreya Sans", sans-serif; vertical-align: 2px; color: #ffe2c0; }
.boss-lv[hidden] { display: none; }
.boss-lv[data-tone="low"] { color: #aaa49b; } .boss-lv[data-tone="high"] { color: #ffc94a; } .boss-lv[data-tone="deadly"] { color: #ff5a48; }
.bossbar { height: 10px; margin-top: 4px; border-color: rgba(255, 90, 90, 0.35); }
.bossbar i { background: linear-gradient(180deg, var(--blood-hi), var(--blood) 55%, var(--blood-lo)); }
.left-stack > .wave-plate { position: fixed; top: calc(12px + var(--inset-t)); left: 50%; transform: translateX(-50%); }
.left-stack > .boss-plate { position: fixed; top: calc(70px + var(--inset-t)); left: 50%; transform: translateX(-50%); }
.sys { position: absolute; top: calc(12px + var(--inset-t)); right: calc(12px + var(--inset-r)); display: flex; gap: 8px; pointer-events: auto; }
.icon-btn {
  width: 42px; height: 42px; padding: 0; display: grid; place-items: center;
  background: var(--plate); color: var(--bone);
  border: 1px solid var(--bronze-line); border-radius: 4px; cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }
button:focus-visible { outline: 2px solid var(--bronze); outline-offset: 2px; }
#combo {
  position: absolute; left: calc(18px + var(--inset-l)); top: 46%;
  display: grid; justify-items: start; line-height: 1; pointer-events: none;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55), 0 0 18px rgba(255, 140, 60, 0.5);
}
#combo b { font-family: var(--font-display); font-weight: 400; font-size: 46px; color: var(--bone); font-variant-numeric: tabular-nums; }
#combo span { margin-top: 3px; font-size: 12px; font-weight: 800; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ember); }
#combo.pop b { animation: pop 0.22s ease-out; }
@keyframes pop { 0% { transform: scale(1.45); color: var(--ember-hi); } 100% { transform: scale(1); } }
.keys {
  position: absolute; left: 50%; bottom: calc(14px + var(--inset-b)); transform: translateX(-50%);
  margin: 0; font-size: 13px; color: var(--bone); width: max-content; max-width: calc(100% - 24px); text-align: center; line-height: 1.9;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
kbd {
  display: inline-block; min-width: 20px; padding: 0 6px; text-align: center;
  font: 700 12px/1.6 var(--font-body); color: var(--bone);
  background: rgba(14, 18, 24, 0.55);
  border: 1px solid var(--bronze-line); border-bottom-width: 2px; border-radius: 3px;
}
body.is-touch .keys { display: none; }

/* ---------- touch controls ---------- */
#touch { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
#stick-zone, #look-zone { position: absolute; bottom: 0; top: 22%; width: 50%; pointer-events: auto; touch-action: none; }
#stick-zone { left: 0; }
#look-zone { right: 0; }
#stick {
  position: absolute; width: 116px; height: 116px; margin: -58px 0 0 -58px; border-radius: 50%;
  border: 2px solid var(--bronze-line);
  background: radial-gradient(circle, rgba(14, 18, 24, 0.12), rgba(14, 18, 24, 0.5));
  pointer-events: none;
}
#knob {
  position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; border-radius: 50%;
  background: var(--bronze); opacity: 0.88; transform: translate(-50%, -50%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}
.act {
  position: absolute; pointer-events: auto; touch-action: none; cursor: pointer;
  display: grid; place-items: center; align-content: center; gap: 1px; padding: 0;
  border-radius: 50%; border: 2px solid var(--bronze);
  background: radial-gradient(circle at 50% 35%, rgba(60, 45, 26, 0.88), rgba(14, 18, 24, 0.88));
  color: var(--bone); font: 800 11px var(--font-body); letter-spacing: 0.1em; text-transform: uppercase;
  transition: transform 0.06s;
}
.act svg { width: 28px; height: 28px; color: var(--bronze); }
.act.down { transform: scale(0.93); }
.strike { width: 92px; height: 92px; right: calc(22px + var(--inset-r)); bottom: calc(26px + var(--inset-b)); }
.strike svg { width: 36px; height: 36px; }
.dodge { width: 66px; height: 66px; right: calc(128px + var(--inset-r)); bottom: calc(30px + var(--inset-b)); border-color: var(--bronze-line); }
.dodge::after {
  content: ""; position: absolute; inset: -2px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(rgba(8, 10, 18, 0.74) calc(var(--cd, 0) * 360deg), transparent 0);
}
.jump { width: 62px; height: 62px; right: calc(32px + var(--inset-r)); bottom: calc(132px + var(--inset-b)); border-color: var(--bronze-line); }
.guard { width: 62px; height: 62px; right: calc(114px + var(--inset-r)); bottom: calc(112px + var(--inset-b)); border-color: var(--bronze-line); }
.guard.down { border-color: var(--bronze); background: radial-gradient(circle at 50% 35%, rgba(126, 98, 52, 0.95), rgba(32, 27, 20, 0.92)); }
.sheathe { width: 60px; height: 60px; right: calc(206px + var(--inset-r)); bottom: calc(33px + var(--inset-b)); border-color: var(--bronze-line); font-size: 9px; letter-spacing: 0.02em; }
.jump svg, .guard svg { width: 24px; height: 24px; }
/* (v77) the fast run: lit while it's on */
.act.run { width: 56px; height: 56px; right: calc(196px + var(--inset-r)); bottom: calc(112px + var(--inset-b)); border-color: var(--bronze-line); font-size: 9px; }
.act.run svg { width: 20px; height: 20px; }
.act.run[aria-pressed="true"] { border-color: var(--bronze); background: radial-gradient(circle at 50% 35%, rgba(126, 98, 52, 0.95), rgba(32, 27, 20, 0.92)); }
.sheathe svg { width: 20px; height: 20px; }
.act.denied { animation: denied 0.3s; }
#touch.tired .strike, #touch.tired .dodge, #touch.tired .jump { opacity: 0.42; }

/* ---------- companion moves ---------- */
#moves {
  position: absolute; z-index: 5; right: calc(18px + var(--inset-r)); top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 12px; pointer-events: none;
}
.move {
  position: relative; pointer-events: auto; touch-action: none; cursor: pointer;
  width: 64px; height: 64px; padding: 0; border-radius: 50%;
  display: grid; place-items: center; align-content: center; gap: 1px;
  border: 2px solid #c9934f; color: var(--bone);
  background: radial-gradient(circle at 50% 35%, rgba(74, 52, 30, 0.9), rgba(14, 18, 24, 0.9));
  font: 800 10px var(--font-body); letter-spacing: 0.08em; text-transform: uppercase;
}
.move svg { width: 24px; height: 24px; color: #f3d29a; }
.move::after {
  content: ""; position: absolute; inset: -2px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(rgba(8, 10, 18, 0.8) calc(var(--cd, 0) * 360deg), transparent 0);
}
.move kbd { position: absolute; top: -7px; right: -7px; min-width: 14px; padding: 0 4px; font-size: 10px; line-height: 1.5; }
body.is-touch .move kbd { display: none; }
.move.off { opacity: 0.45; }
.move.ready { animation: ready 0.55s ease-out; }
.move.denied { animation: denied 0.3s; }
@keyframes ready { 0% { box-shadow: 0 0 0 0 rgba(243, 210, 154, 0.9); } 100% { box-shadow: 0 0 0 16px rgba(243, 210, 154, 0); } }
@keyframes denied { 25% { translate: -4px 0; } 75% { translate: 4px 0; } }
body.is-touch #moves { top: auto; transform: none; bottom: calc(212px + var(--inset-b)); right: calc(32px + var(--inset-r)); }
@media (max-height: 520px) {
  body.is-touch #moves { flex-direction: row-reverse; bottom: calc(206px + var(--inset-b)); right: calc(22px + var(--inset-r)); }
  body.is-touch .move { width: 58px; height: 58px; }
}

/* ---------- banner + floating numbers ---------- */
#banner {
  position: absolute; left: 0; right: 0; top: 24%; z-index: 5; padding: 0 24px;
  text-align: center; pointer-events: none;
  opacity: 0; transform: translateY(8px); transition: opacity 0.35s, transform 0.35s;
}
#banner.show { opacity: 1; transform: none; }
#banner h2 {
  margin: 0; font-family: var(--font-display); font-weight: 400;
  font-size: clamp(30px, 6vw, 52px); line-height: 1.05; color: var(--bone); text-wrap: balance;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55), 0 0 26px rgba(255, 90, 60, 0.55);
}
#levelup {
  position: absolute; left: 0; right: 0; top: 40%; z-index: 5; padding: 0 24px;
  display: grid; justify-items: center; gap: 2px; text-align: center; pointer-events: none;
  opacity: 0; transform: scale(0.92); transition: opacity 0.3s, transform 0.3s;
}
#levelup.show { opacity: 1; transform: none; }
#levelup span { font: 800 12px var(--font-body); letter-spacing: 0.24em; text-transform: uppercase; color: #ffd98a; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9); }
#levelup b {
  font-family: var(--font-display); font-weight: 400; font-size: clamp(30px, 6vw, 46px); line-height: 1.05; color: #fff1cc;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55), 0 0 24px rgba(255, 190, 80, 0.8);
}
#levelup em { font-style: normal; font-size: 15px; font-weight: 700; color: var(--bone); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95); }
#banner p { margin: 6px 0 0; font-size: 17px; font-weight: 500; color: var(--bone); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95); }
.dmg {
  position: absolute; transform: translate(-50%, -50%);
  font: 800 20px/1 var(--font-body); color: var(--bone); font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.65), 0 0 10px rgba(255, 120, 40, 0.55);
  animation: rise 0.8s ease-out forwards; white-space: nowrap;
}
.dmg.crit { color: var(--ember-hi); font-size: 28px; }
.dmg.hurt { color: var(--rift); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.65); }
.dmg.heal { color: var(--moss-hi); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.65); }
.dmg.xp { font-size: 14px; color: #ffd98a; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6), 0 0 10px rgba(255, 200, 90, 0.7); }
.dmg.comp { color: #f3d29a; }
.dmg.note { font-size: 14px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: #cfe8ff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6), 0 0 12px rgba(120, 190, 255, 0.8); }
@keyframes rise {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
  15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -190%) scale(1); }
}

/* ---------- menu screens ---------- */
.screen {
  position: absolute; inset: 0; z-index: 10; display: flex; overflow-y: auto; touch-action: pan-y;
  padding: calc(16px + var(--inset-t)) max(16px, var(--inset-r)) calc(16px + var(--inset-b)) max(16px, var(--inset-l));
  background: radial-gradient(ellipse at 50% 40%, rgba(8, 10, 14, 0.12), rgba(6, 8, 12, 0.72));
}
.tablet {
  margin: auto; width: 100%; max-width: 500px; display: grid; gap: 14px;
  padding: 28px 28px 22px;
  background: var(--plate); border: 1px solid var(--bronze-line); border-radius: 6px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--bronze); }
.tablet h1 {
  margin: 0; font-family: var(--font-display); font-weight: 400;
  font-size: clamp(32px, 7vw, 46px); line-height: 1.02; color: var(--bone); text-wrap: balance;
}
.lede { margin: 0; color: var(--ash); max-width: 60ch; }
.controls {
  display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; align-items: baseline;
  margin: 0; padding: 14px 0; font-size: 14px;
  border-top: 1px solid var(--bronze-line); border-bottom: 1px solid var(--bronze-line);
}
.controls dt { color: var(--bone); font-weight: 700; white-space: nowrap; }
.controls dd { margin: 0; color: var(--ash); }
.controls .touch-only { display: none; }
body.is-touch .controls .touch-only { display: block; }
body.is-touch .controls .kb-only { display: none; }
.tips { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 14px; color: var(--bone); }
.tips li { display: flex; gap: 10px; align-items: flex-start; }
.tips li::before {
  content: ""; flex: none; width: 13px; height: 13px; margin-top: 3px; border-radius: 50%;
  border: 1px solid var(--ember); background: radial-gradient(circle, var(--ember) 34%, transparent 40%);
}
.tips li.warn::before { border-color: #ff5a4a; background: radial-gradient(circle, rgba(255, 70, 50, 0.95) 34%, rgba(255, 60, 60, 0.22) 40%); }
.primary, .secondary {
  width: 100%; padding: 14px 16px; border-radius: 4px; cursor: pointer;
  font: 800 15px var(--font-body); letter-spacing: 0.1em; text-transform: uppercase;
}
.primary { color: var(--ink); background: linear-gradient(180deg, var(--bronze), var(--bronze-deep)); border: 0; }
.primary:hover { filter: brightness(1.08); }
.secondary { color: var(--bone); background: transparent; border: 1px solid var(--bronze-line); }
.secondary:hover { border-color: var(--bronze); }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }
.note { margin: 0; font-size: 13px; color: var(--ash); text-align: center; }
.portrait-note { display: none; }
@media (orientation: portrait) and (pointer: coarse) { .portrait-note { display: block; } }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; margin: 0; }
.stats div { border: 1px solid var(--bronze-line); border-radius: 4px; padding: 8px 10px; }
.stats dt { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ash); }
.stats dd { margin: 2px 0 0; font-size: 22px; font-weight: 800; color: var(--bone); font-variant-numeric: tabular-nums; }
#gl-error {
  left: 50%; top: 40%; transform: translateX(-50%); z-index: 12; margin: 0;
  width: min(440px, calc(100vw - 32px)); padding: 10px 14px;
  font-size: 14px; color: var(--bone); border-color: rgba(255, 90, 90, 0.5); pointer-events: none;
}
/* ---------- character creation (v70): your hero's sheet on the left, your hero in the middle, the look on the right
   (on a narrow screen one of the two at a time, as a sheet along the bottom) ---------- */
#screen-create {
  --sheet-w: clamp(250px, 22vw, 318px); --look-w: clamp(330px, 29vw, 420px); --gap: 16px;
  display: block; padding: 0; overflow: hidden; touch-action: none;
  background: linear-gradient(90deg, rgba(6, 8, 12, 0.5), transparent 24%, transparent 72%, rgba(6, 8, 12, 0.5));
}
/* the two side panels: dark glass in a thin bronze frame, an inner line, a diamond on the top edge */
.create-sheet, .create-panel {
  position: absolute; top: calc(var(--gap) + var(--inset-t)); bottom: calc(var(--gap) + var(--inset-b)); box-sizing: border-box;
  background: linear-gradient(180deg, rgba(24, 19, 14, 0.86), rgba(11, 14, 19, 0.88));
  border: 1px solid var(--bronze-line); border-radius: 6px;
  box-shadow: inset 0 0 0 4px rgba(0, 0, 0, 0.22), inset 0 0 0 5px rgba(214, 168, 92, 0.13), 0 18px 50px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.create-sheet::before, .create-panel::before {
  content: ""; position: absolute; top: -5px; left: 50%; width: 9px; height: 9px; transform: translateX(-50%) rotate(45deg);
  background: var(--night); border: 1px solid var(--bronze); pointer-events: none;
}
.create-sheet {
  left: calc(var(--gap) + var(--inset-l)); width: var(--sheet-w);
  display: flex; flex-direction: column; gap: 11px; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  padding: 16px 16px 16px; scrollbar-width: thin; scrollbar-color: rgba(214, 168, 92, 0.4) transparent;
}
.create-panel {
  right: calc(var(--gap) + var(--inset-r)); width: var(--look-w);
  display: flex; flex-direction: column; overflow: hidden;
}
/* headings: Cinzel, with a fine line either side */
.frame-label {
  display: flex; align-items: center; gap: 10px; margin: 0;
  font: 700 13px "Cinzel", Georgia, serif; letter-spacing: 0.12em; color: var(--bronze); text-align: center;
}
.frame-label::before, .frame-label::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--bronze-line)); }
.frame-label::after { background: linear-gradient(90deg, var(--bronze-line), transparent); }
.sheet-top { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 12px; }
.sheet-top .eyebrow, .sheet-top h1 { grid-column: 2; }
.sheet-crest { grid-row: 1 / span 2; }
.sheet-crest {
  width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50%; color: #f3d29a;
  background: radial-gradient(circle at 50% 40%, rgba(214, 168, 92, 0.28), rgba(10, 12, 16, 0.9) 70%);
  box-shadow: 0 0 0 1px var(--bronze), 0 0 0 5px rgba(10, 12, 16, 0.85), 0 0 0 6px var(--bronze-line), 0 6px 22px rgba(0, 0, 0, 0.5);
}
.sheet-crest svg { width: 30px; height: 30px; filter: drop-shadow(0 0 6px rgba(214, 168, 92, 0.45)); }
.sheet-top .eyebrow { margin: 0; font-size: 10.5px; letter-spacing: 0.12em; white-space: nowrap; }
.create-sheet h1 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(24px, 2.3vw, 30px); line-height: 1.1; color: var(--bone); }
.class-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.class-card {
  display: grid; justify-items: center; gap: 3px; padding: 8px 6px 7px; border-radius: 5px; cursor: pointer;
  color: var(--ash); background: rgba(0, 0, 0, 0.3); border: 1px solid var(--bronze-line);
}
.class-card .cc-icon svg { width: 26px; height: 26px; display: block; }
.class-card b { font: 700 15px "Cinzel", Georgia, serif; color: var(--bone); }
.class-card:hover { border-color: var(--bronze); }
.class-card[aria-checked="true"] { color: #f3d29a; border-color: var(--bronze); background: linear-gradient(180deg, rgba(214, 168, 92, 0.24), rgba(214, 168, 92, 0.05)); box-shadow: inset 0 0 0 1px var(--bronze), 0 0 16px rgba(214, 168, 92, 0.18); }
/* (v75) the starting weapon: a card with its picture for each the class can carry */
.weapon-field { display: grid; gap: 5px; margin-top: 4px; }
.weapon-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.weapon-card {
  display: grid; justify-items: center; gap: 1px; padding: 4px 2px 5px; border-radius: 5px; cursor: pointer; min-width: 0;
  color: var(--ash); background: rgba(0, 0, 0, 0.3); border: 1px solid var(--bronze-line);
}
.weapon-card img { width: 44px; height: 44px; display: block; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); }
.weapon-card b { font: 700 12px "Cinzel", Georgia, serif; color: var(--bone); letter-spacing: 0.02em; }
.weapon-card:hover { border-color: var(--bronze); }
.weapon-card[aria-checked="true"] { border-color: var(--bronze); background: linear-gradient(180deg, rgba(214, 168, 92, 0.24), rgba(214, 168, 92, 0.05)); box-shadow: inset 0 0 0 1px var(--bronze), 0 0 12px rgba(214, 168, 92, 0.16); }
.weapon-note { margin: 0; font-size: 12px; line-height: 1.3; color: var(--ash); text-align: center; }
.class-perk { margin: -4px 0 0; font-size: 13px; line-height: 1.35; color: var(--ash); text-align: center; }
.create-sheet .sub { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--bronze); }
/* your starting stats: three bars, and three marks */
.cstats { display: grid; gap: 8px; }
.cstat { display: grid; grid-template-columns: 20px 62px minmax(0, 1fr) 34px; align-items: center; gap: 7px; }
.st-icon svg { width: 18px; height: 18px; display: block; }
.cstat.hp .st-icon { color: var(--blood-hi); } .cstat.mana .st-icon { color: #8cc4ff; } .cstat.stam .st-icon { color: #f2d36b; }
.st-name { font: 700 13px var(--font-body); color: var(--bone); }
.st-bar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5); overflow: hidden; }
.st-bar i { display: block; height: 100%; border-radius: 4px; transition: width 0.35s ease; }
.cstat.hp .st-bar i { background: linear-gradient(90deg, var(--blood-lo), var(--blood), var(--blood-hi)); }
.cstat.mana .st-bar i { background: linear-gradient(90deg, #1f4f9c, #3d8fe0, #8cc4ff); }
.cstat.stam .st-bar i { background: linear-gradient(90deg, #8a6a1c, #d6a85c, #f2d36b); }
.st-v { font: 700 14px var(--font-body); color: var(--bone); text-align: right; font-variant-numeric: tabular-nums; }
.cstat-marks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.cstat-mark {
  display: grid; justify-items: center; gap: 1px; padding: 6px 4px 5px; border-radius: 14px;
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--bronze-line);
}
.cstat-mark b { font: 700 16px "Cinzel", Georgia, serif; color: var(--bone); font-variant-numeric: tabular-nums; }
.cstat-mark span { font: 800 10px var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ash); }
/* origins: two columns of names, the one picked lit with a bronze edge; what it gives under them */
.origin-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.origin-row {
  position: relative; display: grid; place-items: center; min-height: 36px; text-align: center; padding: 6px 8px; border-radius: 4px; cursor: pointer;
  color: var(--bone); background: rgba(0, 0, 0, 0.24); border: 1px solid rgba(214, 168, 92, 0.18); font: 700 13px/1.2 var(--font-body);
}
.origin-row:hover { border-color: var(--bronze-line); }
.origin-row[aria-checked="true"] { color: #f3d29a; border-color: var(--bronze); background: linear-gradient(180deg, rgba(214, 168, 92, 0.24), rgba(214, 168, 92, 0.05)); box-shadow: inset 0 0 0 1px var(--bronze); }
/* the look: its title and the body, the tab's choices, the tabs down the right edge */
.look-head { display: grid; gap: 10px; padding: 16px 16px 12px; border-bottom: 1px solid rgba(214, 168, 92, 0.18); }
.look-head h2 { margin: 0; text-align: center; font: 700 21px "Cinzel", Georgia, serif; letter-spacing: 0.06em; color: var(--bone); }
.look-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 66px; }
.look-panels { min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; padding: 12px 12px 16px 16px; scrollbar-width: thin; scrollbar-color: rgba(214, 168, 92, 0.4) transparent; }
.look-rail { display: flex; flex-direction: column; gap: 4px; padding: 10px 6px; border-left: 1px solid rgba(214, 168, 92, 0.18); background: rgba(0, 0, 0, 0.18); overflow-y: auto; }
.rail-tab {
  position: relative; display: grid; justify-items: center; gap: 3px; padding: 9px 2px 7px; border-radius: 6px; cursor: pointer;
  color: var(--ash); background: transparent; border: 1px solid transparent;
  font: 800 10px var(--font-body); letter-spacing: 0.08em; text-transform: uppercase;
}
.rail-tab .rt-icon svg { width: 22px; height: 22px; display: block; }
.rail-tab:hover { color: var(--bone); border-color: rgba(214, 168, 92, 0.2); }
.rail-tab[aria-checked="true"] { color: #f3d29a; background: rgba(214, 168, 92, 0.14); border-color: var(--bronze-line); }
.rail-tab[aria-checked="true"]::before { content: ""; position: absolute; left: -7px; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--bronze); }
.look-foot { display: flex; justify-content: center; padding: 10px 14px calc(12px); border-top: 1px solid rgba(214, 168, 92, 0.18); }
.random-look { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
.random-look svg { width: 18px; height: 18px; flex: none; }
/* the middle, under your hero: what's loading, the camera, and Back / Begin */
.create-bottom {
  position: absolute; left: calc(var(--sheet-w) + 2 * var(--gap) + var(--inset-l)); right: calc(var(--look-w) + 2 * var(--gap) + var(--inset-r));
  bottom: calc(var(--gap) + var(--inset-b)); display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none;
}
.create-bottom > * { pointer-events: auto; }
.create-bottom .create-status { flex: none; justify-content: center; margin: 0; }
.view-bar { display: flex; align-items: center; gap: 12px; pointer-events: none; }
.view-bar .seg { pointer-events: auto; background: rgba(10, 13, 18, 0.7); }
.drag-hint { margin: 0; font-size: 13px; font-weight: 700; color: var(--bone); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9); }
.create-actions { display: flex; gap: 10px; width: min(440px, 100%); }
.create-actions .secondary { flex: 0 0 34%; }
.create-actions .primary { flex: 1; }
.field { display: grid; gap: 7px; margin: 0; min-width: 0; }
.field > * { min-width: 0; }
.name-row { display: flex; gap: 8px; }
#hero-name {
  flex: 1; min-width: 0; box-sizing: border-box; padding: 11px 12px; border-radius: 4px;
  font: 400 20px var(--font-display); color: var(--bone); background: rgba(0, 0, 0, 0.42);
  border: 1px solid var(--bronze-line); outline: none; -webkit-user-select: text; user-select: text;
}
#hero-name:focus { border-color: var(--bronze); box-shadow: 0 0 0 2px rgba(214, 168, 92, 0.25); }
#hero-name::placeholder { color: rgba(179, 184, 194, 0.55); }
.dice { flex: none; width: 48px; display: grid; place-items: center; padding: 0; border-radius: 4px; cursor: pointer; color: #f3d29a; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--bronze-line); }
.dice svg { width: 24px; height: 24px; }
.dice:hover { border-color: var(--bronze); }
.dice.roll svg { animation: dice 0.35s ease-out; }
@keyframes dice { from { transform: rotate(-200deg) scale(0.8); } }
.seg { display: flex; padding: 3px; gap: 3px; border-radius: 5px; background: rgba(0, 0, 0, 0.4); border: 1px solid var(--bronze-line); }
.seg button {
  flex: 1; padding: 9px 10px; border: 0; border-radius: 3px; cursor: pointer; background: transparent; color: var(--ash);
  font: 800 13px var(--font-body); letter-spacing: 0.1em; text-transform: uppercase;
}
.seg button[aria-checked="true"] { color: var(--ink); background: linear-gradient(180deg, var(--bronze), var(--bronze-deep)); }
.seg.pane-switch { display: none; }   /* (v70: shown on a phone only) */
.seg.small button { padding: 7px 14px; font-size: 11.5px; white-space: nowrap; }
.hint { margin: 0; font-size: 13px; color: var(--ash); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 8px 12px; border-radius: 999px; cursor: pointer; color: var(--bone); background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--bronze-line); font: 700 14px var(--font-body);
}
.chip[aria-checked="true"] { color: var(--ink); background: var(--bronze); border-color: var(--bronze); }
.chip.busy { animation: busy 0.9s ease-in-out infinite; }
@keyframes busy { 50% { opacity: 0.55; } }
/* what's still loading in the creator: a pill over the hero, above the camera buttons */
.create-status { flex: 0 0 100%; display: flex; margin: 0 0 2px; }
.cs-pill {
  display: inline-flex; align-items: center; gap: 9px; padding: 8px 15px 8px 11px; border-radius: 20px;
  max-width: calc(100vw - 32px); box-sizing: border-box; text-align: center; line-height: 1.3; text-wrap: balance;
  font: 700 13.5px var(--font-body); color: var(--bone); background: rgba(10, 13, 18, 0.8);
  border: 1px solid var(--bronze-line); box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}
.cs-spin { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(214, 168, 92, 0.25); border-top-color: var(--bronze); animation: cs-spin 0.8s linear infinite; }
.create-status:not(.busy) .cs-spin { display: none; }
.create-status:not(.busy) .cs-pill { padding-left: 15px; }
.create-status.bad .cs-pill { border-color: rgba(240, 120, 96, 0.6); color: #ffd9cf; }
@keyframes cs-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cs-spin { animation-duration: 2.4s; } }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 34px; height: 34px; padding: 0; border-radius: 50%; cursor: pointer; background: var(--c);
  border: 2px solid rgba(0, 0, 0, 0.55); box-shadow: 0 0 0 1px var(--bronze-line);
}
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--night), 0 0 0 4px var(--bronze); }
/* a narrower window: the side panels a little slimmer */
@media (max-width: 1100px) {
  #screen-create { --sheet-w: 248px; --look-w: 330px; --gap: 10px; }
  .drag-hint { display: none; }
}
/* phones and portrait: one panel at a time, as a sheet along the bottom; Hero / Look at the top switches them */
@media (orientation: portrait), (max-width: 760px) {
  #screen-create { background: linear-gradient(180deg, transparent 30%, rgba(6, 8, 12, 0.35)); }
  .create-sheet, .create-panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 56%; border-radius: 12px 12px 0 0; border-bottom: 0;
    padding-left: var(--inset-l); padding-right: var(--inset-r);
  }
  .create-sheet { padding: 16px calc(16px + var(--inset-r)) calc(16px + var(--inset-b)) calc(16px + var(--inset-l)); }
  .create-panel { padding-bottom: var(--inset-b); }
  #screen-create[data-pane="hero"] .create-panel, #screen-create[data-pane="look"] .create-sheet { display: none; }
  .sheet-crest { width: 50px; height: 50px; }
  .sheet-crest svg { width: 26px; height: 26px; }
  .seg.pane-switch {
    display: flex; position: absolute; top: calc(10px + var(--inset-t)); left: 50%; transform: translateX(-50%); z-index: 2;
    width: min(260px, 70vw); background: rgba(10, 13, 18, 0.78);
  }
  .create-bottom { left: calc(8px + var(--inset-l)); right: calc(8px + var(--inset-r)); bottom: calc(56% + 8px); gap: 6px; }
  .view-bar { order: 2; }
  .create-actions { order: 3; width: min(420px, 100%); }
  .create-status { order: 1; flex: none; justify-content: center; margin-bottom: 0; }
  .drag-hint { display: none; }
  .look-body { grid-template-columns: minmax(0, 1fr) 58px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .create-sheet { gap: 10px; padding-top: 14px; }
  .sheet-crest { width: 50px; height: 50px; }
  .sheet-crest svg { width: 26px; height: 26px; }
  .look-head { padding: 10px 14px 8px; gap: 6px; }
  .look-head h2 { font-size: 18px; }
  .origin-row span { font-size: 12px; }
  .create-bottom { gap: 6px; }
  .drag-hint { display: none; }
}
#hud-name { display: inline-block; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
/* ---------- runs on the title, the Kyris list, the Kyri orb button ---------- */
.runs { display: grid; gap: 8px; }
.run {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; border-radius: 4px; cursor: pointer; text-align: left;
  color: var(--bone); background: rgba(0, 0, 0, 0.3); border: 1px solid var(--bronze-line); font-family: var(--font-body);
}
.run:hover { border-color: var(--bronze); }
.run .num { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--bronze); color: var(--bronze); font: 400 16px/1 var(--font-display); }
.run-text { display: grid; gap: 1px; flex: 1; min-width: 0; }
.run b { font-size: 15px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.run em { font-style: normal; font-size: 13px; color: var(--ash); }
.run.next { color: var(--ink); background: linear-gradient(180deg, var(--bronze), var(--bronze-deep)); border-color: transparent; }
.run.next em { color: rgba(26, 19, 9, 0.8); }
.run.next .num { border-color: var(--ink); color: var(--ink); }
/* (v104) the garden's seed picker */
.seed-rows { max-height: min(52vh, 460px); overflow-y: auto; margin-bottom: 12px; }
.seed-row .seed-ico { flex: none; width: 40px; height: 40px; display: grid; place-items: center; }
.seed-row .seed-ico svg { width: 40px; height: 40px; }
.seed-row .seed-n { flex: none; font: 800 15px/1 var(--font-body); color: var(--bronze); }
.seed-row.none { opacity: 0.45; cursor: default; }
.seed-row.none:hover { border-color: var(--bronze-line); }
/* (v106) your tiered villagers */
.folklib { max-width: 760px; }
.fl-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 4px 0 6px; }
.fl-tab { padding: 7px 12px; border-radius: 4px; border: 1px solid var(--bronze-line); background: rgba(0, 0, 0, 0.3); color: var(--bone); font: 700 13px/1 var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; }
.fl-tab[aria-selected="true"] { color: var(--ink); background: linear-gradient(180deg, var(--bronze), var(--bronze-deep)); border-color: transparent; }
.fl-h { font: 700 13px/1.2 var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--bronze); margin: 12px 0 6px; }
.fl-tierpick { display: flex; gap: 4px; flex-wrap: wrap; }
.fl-tb { padding: 6px 10px; border-radius: 3px; border: 1px solid var(--bronze-line); background: rgba(0, 0, 0, 0.3); color: var(--bone); font: 700 12.5px/1 var(--font-body); cursor: pointer; }
.fl-tb.on { border-color: var(--bronze); background: rgba(200, 150, 60, 0.28); outline: 1px solid var(--bronze); }
.fl-mineline { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.fl-lab { font-size: 13px; color: var(--ash); }
.fl-name, .fl-ctl input, .fl-ctl select { padding: 5px 8px; border-radius: 3px; border: 1px solid var(--bronze-line); background: rgba(0, 0, 0, 0.45); color: var(--bone); font: 600 13px/1.2 var(--font-body); }
.fl-name { width: 180px; }
.fl-look { width: auto; padding: 6px 12px; margin: 0; }
.fl-now { margin: 8px 0 0; padding: 7px 10px; border: 1px solid var(--bronze-line); border-radius: 4px; background: rgba(0, 0, 0, 0.3); font-size: 13.5px; }
.fl-tiers { display: grid; gap: 5px; }
.fl-trow { display: grid; grid-template-columns: 150px 1fr; gap: 4px 12px; align-items: center; padding: 7px 10px; border-radius: 4px; background: rgba(0, 0, 0, 0.24); }
.fl-trow.on { outline: 1px solid var(--bronze); background: rgba(0, 0, 0, 0.4); }
.fl-thead { display: grid; gap: 2px; }
.fl-thead b { font-size: 13px; }
.fl-stars { font: 700 13px/1 sans-serif; letter-spacing: 1px; }
.fl-ctls { display: flex; gap: 12px; flex-wrap: wrap; }
.fl-ctl { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ash); }
.fl-ctl input[type="number"] { width: 72px; }
.fl-unit { color: var(--ash); }
.fl-perk { grid-column: 2; margin: 0; font-size: 12.5px; color: var(--bone); opacity: 0.85; }
.fl-animals { display: flex; margin: 4px 0; }
.fl-animals .fl-stars { flex: 0 0 56px; }
.fl-animals input { flex: 1; min-width: 200px; }
.fl-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.fl-foot button { width: auto; flex: 1 1 auto; margin: 0; }
.fl-status { min-height: 1.2em; }
@media (max-width: 560px) { .fl-trow { grid-template-columns: 1fr; } .fl-perk { grid-column: 1; } }
.folk-stars, .ft-stars { font: 700 20px/1 sans-serif; letter-spacing: 2px; margin: 2px 0 8px; }
.folk-say { font-style: italic; }
.folk-perk { margin: 6px 0 10px; padding: 8px 12px; border: 1px solid var(--bronze-line); border-radius: 4px; background: rgba(0, 0, 0, 0.3); }
.folk-perk span { color: var(--ash); }
.folk-ladder { display: grid; gap: 4px; margin-bottom: 12px; }
.folk-tier { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 4px; background: rgba(0, 0, 0, 0.22); opacity: 0.62; }
.folk-tier.on { opacity: 1; outline: 1px solid var(--bronze); background: rgba(0, 0, 0, 0.4); }
.folk-tier.below { opacity: 0.45; }
.folk-tier .ft-stars { font-size: 13px; margin: 0; flex: none; width: 82px; }
.folk-tier .ft-text { display: grid; gap: 1px; }
.folk-tier b { font-size: 13px; } .folk-tier em { font-style: normal; font-size: 12.5px; color: var(--ash); }
.folk-row .ft-stars { flex: none; width: 92px; font-size: 15px; margin: 0; color: var(--ash); }
.folk-row.none { opacity: 0.55; cursor: default; }
.cheat-folk { display: grid; gap: 4px; margin: 6px 0 10px; }
.cheat-folk-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.cfk-name { flex: 0 0 110px; font-size: 13px; color: var(--bone); }
.cfk-tier { padding: 4px 8px; border-radius: 3px; border: 1px solid var(--bronze-line); background: rgba(0, 0, 0, 0.3); color: var(--bone); font: 700 12px/1 var(--font-body); cursor: pointer; }
.cfk-tier.on { border-color: var(--bronze); background: rgba(200, 150, 60, 0.25); }
.run-done { flex: none; font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--moss-hi); }
.run.next .run-done { color: var(--ink); }
.kyri-tag { margin-left: 6px; font: 800 9.5px var(--font-body); font-style: normal; letter-spacing: 0.14em; text-transform: uppercase; color: #9fe2ff; vertical-align: 2px; }
.kyri-list { display: grid; gap: 10px; }
.kyri-card { display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: center; padding: 12px; border-radius: 6px; border: 1px solid var(--bronze-line); background: rgba(0, 0, 0, 0.3); }
.kyri-card .sigil {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 40% 35%, #e6f8ff, #86cdf2 38%, #24507a 74%, #12263d); box-shadow: 0 0 18px rgba(120, 200, 255, 0.45);
  font: 400 24px/1 var(--font-display); color: #0d2235;
}
.kyri-card.locked .sigil { background: rgba(255, 255, 255, 0.05); box-shadow: inset 0 0 0 1px var(--bronze-line); color: var(--ash); }
.kyri-card h3 { margin: 0; font: 400 21px/1.1 var(--font-display); color: var(--bone); }
.kyri-card p { margin: 3px 0 0; font-size: 13px; color: var(--ash); }
.kyri-card .tag { display: inline-block; margin-top: 6px; font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--moss-hi); }
.kyri-card.locked .tag { color: var(--bronze); }
.kyri-card.more { grid-template-columns: 1fr; border-style: dashed; text-align: center; }
.kyri-card.more p { margin: 0; }
#btn-capture {
  position: absolute; left: 50%; bottom: calc(118px + var(--inset-b)); transform: translateX(-50%); z-index: 8;
  display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; border-radius: 999px; cursor: pointer;
  border: 2px solid #9fdcff; color: var(--bone); background: radial-gradient(ellipse at 30% 50%, rgba(40, 80, 120, 0.95), rgba(10, 16, 28, 0.92));
  font: 800 15px var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap;
  box-shadow: 0 0 22px rgba(120, 200, 255, 0.5); animation: orbPulse 1.2s ease-in-out infinite;
}
#btn-capture .orb-icon { width: 38px; height: 38px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #ffffff, #a6e2ff 32%, #2f6fa8 68%, #142a44); box-shadow: 0 0 14px #8fd8ff, inset 0 0 0 2px rgba(214, 168, 92, 0.9); }
#btn-capture kbd { margin-left: 2px; }
body.is-touch #btn-capture kbd { display: none; }
@keyframes orbPulse { 50% { box-shadow: 0 0 40px rgba(140, 215, 255, 0.95); } }
@media (prefers-reduced-motion: reduce) { #btn-capture { animation: none; } }
#no-gl { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--bone); }

@media (max-width: 600px) {
  .left-stack > .wave-plate, .left-stack > .boss-plate { position: relative; top: auto; left: auto; transform: none; width: auto; min-width: 0; text-align: left; }
  .left-stack > .wave-plate { padding: 5px 12px 6px; }
  .wave-plate::before, .wave-plate::after { display: none; }
  .keys { display: none; }
  #combo b { font-size: 38px; }
}
@media (max-width: 420px) { .tablet { padding: 22px 18px 18px; } }
@media (max-height: 520px) {
  .tablet { max-width: 680px; padding: 16px 20px; gap: 10px; }
  .tablet h1 { font-size: 30px; }
  .lede { font-size: 14px; }
  .controls { padding: 8px 0; gap: 3px 14px; font-size: 13px; }
  .tips { font-size: 13px; gap: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  #banner, #focus, #levelup { transition: none; }
  .xpbar i { transition: none; }
  .hpbar i, .bossbar i { transition: none; }
}

/* ---------- the village ---------- */
#hud:not(.in-village) .village-only { display: none !important; }
#hud.in-village .wave-plate, #hud.in-village .boss-plate, #hud.in-village .comp-plate, #hud.in-village #combo, #hud.in-village .battle-keys { display: none !important; }
#hud:not(.in-village) .village-keys, #hud:not(.building) .build-keys, #hud.building .village-keys { display: none; }
.left-stack > .village-plate { position: fixed; top: calc(12px + var(--inset-t)); left: 50%; transform: translateX(-50%); padding: 6px 18px 7px; text-align: center; }
.village-plate .foes b { color: var(--bronze); font-weight: 800; }
/* on a narrow phone the village's name sits on the right, under the buttons, so it doesn't cover your health */
@media (max-width: 420px) { #hud.in-village .sys { gap: 6px; } #hud.in-village .left-stack { width: min(270px, 44vw); } }
@media (max-width: 600px) { .left-stack > .village-plate { top: calc(64px + var(--inset-t)); left: auto; right: calc(12px + var(--inset-r)); transform: none; text-align: right; padding: 5px 12px 6px; } }
.mats-plate { display: flex; flex-wrap: wrap; gap: 3px 11px; padding: 6px 10px; }
.mat { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 800; color: var(--bone); font-variant-numeric: tabular-nums; }
.mat svg { width: 17px; height: 17px; }
.orb-dot { display: block; width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #ffffff, #e2f3ff 40%, rgba(160, 210, 255, 0.45) 66%, transparent 70%); box-shadow: 0 0 10px rgba(200, 235, 255, 0.9); }
#btn-interact {
  position: absolute; left: 50%; bottom: calc(52px + var(--inset-b)); transform: translateX(-50%); z-index: 8;
  display: flex; align-items: center; gap: 10px; padding: 11px 20px; border-radius: 999px; cursor: pointer; pointer-events: auto;
  border: 2px solid var(--bronze); color: var(--bone); background: radial-gradient(ellipse at 30% 50%, rgba(86, 64, 32, 0.96), rgba(14, 18, 24, 0.93));
  font: 800 15px var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap;
  box-shadow: 0 0 20px rgba(214, 168, 92, 0.38);
}
#btn-interact kbd { margin-left: 2px; }
body.is-touch #btn-interact { bottom: calc(214px + var(--inset-b)); }
body.is-touch #btn-interact kbd { display: none; }
@media (max-height: 520px) { body.is-touch #btn-interact { bottom: calc(26px + var(--inset-b)); } }

/* build mode: the bar of pieces, and the Place / Turn / Remove / Done buttons */
#build-bar {
  position: absolute; z-index: 7; left: 50%; transform: translateX(-50%); bottom: calc(44px + var(--inset-b));
  width: min(780px, calc(100% - 24px)); box-sizing: border-box; display: grid; gap: 7px; padding: 8px 10px 10px; pointer-events: auto;
  background: var(--plate); border: 1px solid var(--bronze-line); border-radius: 6px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.build-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.build-head .seg { flex: none; }
.build-hint { margin: 0; flex: 1; min-width: 0; font-size: 13px; color: var(--ash); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.build-hint.bad { color: #ffb495; }
.build-hint.deny { animation: denied 0.3s; }
.build-list { display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; padding-bottom: 3px; touch-action: pan-x; scrollbar-width: thin; scrollbar-color: var(--bronze-line) transparent; }
.bitem {
  flex: none; display: grid; gap: 4px; align-content: start; min-width: 94px; padding: 7px 10px 8px; border-radius: 4px; cursor: pointer; text-align: left;
  border: 1px solid var(--bronze-line); background: rgba(0, 0, 0, 0.3); color: var(--bone); font: 700 13px/1.2 var(--font-body);
}
.bitem b { font-weight: 800; white-space: nowrap; }
.bitem.on { border-color: var(--bronze); background: rgba(126, 98, 52, 0.5); box-shadow: inset 0 0 0 1px var(--bronze); }
.bitem.locked { opacity: 0.55; }
.bitem.deny { animation: denied 0.3s; }
.costs { display: flex; flex-wrap: wrap; gap: 3px 8px; font-size: 12px; font-weight: 800; }
.costs em { font-style: normal; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--bronze); }
.chip { display: inline-flex; align-items: center; gap: 2px; font-variant-numeric: tabular-nums; }
.chip svg { width: 15px; height: 15px; }
.chip.short { color: #ff9f80; }
.build-keys { display: flex; gap: 6px; }
.build-keys .secondary { flex: 1; width: auto; padding: 8px 6px; font-size: 12px; letter-spacing: 0.06em; }
.build-keys .bk-remove[aria-pressed="true"] { border-color: var(--rift); color: #ffb495; }
body.is-touch .build-keys { display: none; }
body.is-touch #build-bar { bottom: calc(214px + var(--inset-b)); }
@media (max-height: 520px) {
  body.is-touch #build-bar { left: calc(168px + var(--inset-l)); right: calc(214px + var(--inset-r)); width: auto; transform: none; bottom: calc(8px + var(--inset-b)); }
  body.is-touch .build-hint { display: none; }
}
.bact { display: none; }
#touch.building .bact { display: grid; }
#touch.building .strike, #touch.building .dodge, #touch.building .jump, #touch.building .guard, #touch.building .sheathe, #touch.building .run { display: none; }
.bplace { width: 92px; height: 92px; right: calc(22px + var(--inset-r)); bottom: calc(26px + var(--inset-b)); }
.bplace svg { width: 36px; height: 36px; }
.brotate { width: 62px; height: 62px; right: calc(32px + var(--inset-r)); bottom: calc(132px + var(--inset-b)); border-color: var(--bronze-line); }
.bremove { width: 62px; height: 62px; right: calc(114px + var(--inset-r)); bottom: calc(112px + var(--inset-b)); border-color: var(--bronze-line); }
.bremove.down { border-color: var(--rift); background: radial-gradient(circle at 50% 35%, rgba(120, 42, 32, 0.95), rgba(32, 20, 20, 0.92)); }
.bdone { width: 66px; height: 66px; right: calc(128px + var(--inset-r)); bottom: calc(30px + var(--inset-b)); border-color: var(--bronze-line); }
.brotate svg, .bremove svg, .bdone svg { width: 24px; height: 24px; }

/* Wisp's words */
#dialogue {
  position: absolute; z-index: 9; left: 50%; transform: translateX(-50%); top: calc(84px + var(--inset-t));
  width: min(560px, calc(100% - 24px)); box-sizing: border-box; display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px 11px;
  background: rgba(12, 18, 28, 0.88); border: 1px solid rgba(200, 230, 255, 0.45); border-radius: 8px; cursor: pointer; pointer-events: auto;
  box-shadow: 0 0 26px rgba(160, 210, 255, 0.25), 0 10px 30px rgba(0, 0, 0, 0.4);
}
#dialogue.in { animation: dlgIn 0.25s ease-out; }
@keyframes dlgIn { from { opacity: 0; translate: 0 -6px; } }
.dlg-orb { flex: none; width: 30px; height: 30px; margin-top: 2px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #ffffff, #e4f4ff 35%, rgba(150, 205, 255, 0.5) 64%, transparent 70%); box-shadow: 0 0 14px rgba(210, 240, 255, 0.9); }
.dlg-body { min-width: 0; }
.dlg-body b { font-family: var(--font-display); font-weight: 400; font-size: 16px; color: #dff2ff; }
.dlg-body p { margin: 2px 0 0; font-size: 16px; line-height: 1.4; color: var(--bone); }
#dlg-next { display: block; margin-top: 5px; font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(200, 225, 255, 0.7); }
#dlg-next:empty { display: none; }
@media (max-width: 600px) { #dialogue { top: calc(196px + var(--inset-t)); } }
@media (max-height: 520px) { #dialogue { top: calc(74px + var(--inset-t)); left: calc(292px + var(--inset-l)); right: calc(12px + var(--inset-r)); width: auto; max-width: 560px; transform: none; padding: 9px 12px; } .dlg-body p { font-size: 14px; } .dlg-orb { width: 24px; height: 24px; } }
@media (prefers-reduced-motion: reduce) { #dialogue.in { animation: none; } }

/* the shrine and the waystone */
.prows { display: grid; gap: 8px; }
.prow {
  display: grid; grid-template-columns: 30px 1fr auto; grid-template-areas: "icon name btn" "icon bar btn" "icon num btn"; column-gap: 10px; row-gap: 3px; align-items: center;
  padding: 8px 10px; border: 1px solid var(--bronze-line); border-radius: 4px; background: rgba(0, 0, 0, 0.25);
}
.picon { grid-area: icon; display: grid; place-items: center; }
.picon svg { width: 28px; height: 28px; }
.pname { grid-area: name; font-weight: 800; }
.pbar { grid-area: bar; display: block; height: 6px; border-radius: 3px; overflow: hidden; background: rgba(0, 0, 0, 0.5); }
.pbar i { display: block; height: 100%; background: linear-gradient(90deg, #6fb7d8, #d3f4ff); }
.prow.done .pbar i { background: linear-gradient(90deg, var(--moss-lo), var(--moss-hi)); }
.pnum { grid-area: num; font-size: 12px; color: var(--ash); font-variant-numeric: tabular-nums; }
.poffer { grid-area: btn; width: auto; padding: 9px 12px; font-size: 12px; letter-spacing: 0.06em; }
.pillar-unlocks { text-align: left; }
.loot-line { text-align: left; color: #ffd98a; font-weight: 700; }
.primary:disabled, .secondary:disabled { opacity: 0.45; cursor: default; filter: none; }
.dmg.loot { font-size: 15px; color: #ffe2a8; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.65), 0 0 10px rgba(255, 200, 120, 0.55); }
.dmg.loot-ember { color: #ffc08a; }
.dmg.loot-rift { color: #e8c2ff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.65), 0 0 12px rgba(200, 110, 255, 0.7); }
.dmg.loot-iron { color: #d6e2ee; }

/* ---------- the mouse on a computer ---------- */
/* the game's own cursor; it brightens with a star over anything you can click, and turns while you drag the camera */
body:not(.is-touch) #game { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M4 3 L4 25.5 L9.7 20 L13.8 28.8 L18 27 L13.9 18.3 L21.8 18.3 Z' transform='translate%281.3 1.5%29' fill='%23000' fill-opacity='0.38'/%3E%3Cpath d='M4 3 L4 25.5 L9.7 20 L13.8 28.8 L18 27 L13.9 18.3 L21.8 18.3 Z' fill='%23ecd29a' stroke='%2322160a' stroke-width='1.7' stroke-linejoin='round'/%3E%3Cpath d='M6.1 8.2 L6.1 20.6 L9.9 17' fill='none' stroke='%23fff4d8' stroke-width='1.2' stroke-linecap='round' stroke-opacity='0.85'/%3E%3C/svg%3E") 4 3, default; }
body:not(.is-touch) #game :is(button, label, select, .bitem, #dialogue, .hero-plate), body:not(.is-touch) #game.hover-thing { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M4 3 L4 25.5 L9.7 20 L13.8 28.8 L18 27 L13.9 18.3 L21.8 18.3 Z' transform='translate%281.3 1.5%29' fill='%23000' fill-opacity='0.38'/%3E%3Cpath d='M4 3 L4 25.5 L9.7 20 L13.8 28.8 L18 27 L13.9 18.3 L21.8 18.3 Z' fill='%23cdeeff' stroke='%2322160a' stroke-width='1.7' stroke-linejoin='round'/%3E%3Cpath d='M6.1 8.2 L6.1 20.6 L9.9 17' fill='none' stroke='%23ffffff' stroke-width='1.2' stroke-linecap='round' stroke-opacity='0.85'/%3E%3Cpath d='M23.5 1.8 L24.9 5.6 L28.7 7 L24.9 8.4 L23.5 12.2 L22.1 8.4 L18.3 7 L22.1 5.6 Z' fill='%23d8f3ff' stroke='%2316222c' stroke-width='0.9' stroke-linejoin='round'/%3E%3C/svg%3E") 4 3, pointer; }
body:not(.is-touch) #game :is(input[type="text"], textarea) { cursor: text; }
body:not(.is-touch) #game.cam-drag, body:not(.is-touch) #game.cam-drag * { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M6.5 13.5 A10 10 0 0 1 22.5 8.2' fill='none' stroke='%2322160a' stroke-width='5' stroke-linecap='round'/%3E%3Cpath d='M25.5 18.5 A10 10 0 0 1 9.5 23.8' fill='none' stroke='%2322160a' stroke-width='5' stroke-linecap='round'/%3E%3Cpath d='M25.6 5.2 L23.6 12.4 L18.4 7.6 Z' fill='%2322160a' stroke='%2322160a' stroke-width='3' stroke-linejoin='round'/%3E%3Cpath d='M6.4 26.8 L8.4 19.6 L13.6 24.4 Z' fill='%2322160a' stroke='%2322160a' stroke-width='3' stroke-linejoin='round'/%3E%3Cpath d='M6.5 13.5 A10 10 0 0 1 22.5 8.2' fill='none' stroke='%23ecd29a' stroke-width='2.4' stroke-linecap='round'/%3E%3Cpath d='M25.5 18.5 A10 10 0 0 1 9.5 23.8' fill='none' stroke='%23ecd29a' stroke-width='2.4' stroke-linecap='round'/%3E%3Cpath d='M25.6 5.2 L23.6 12.4 L18.4 7.6 Z' fill='%23ecd29a'/%3E%3Cpath d='M6.4 26.8 L8.4 19.6 L13.6 24.4 Z' fill='%23ecd29a'/%3E%3Ccircle cx='16' cy='16' r='2.6' fill='%23ecd29a' stroke='%2322160a' stroke-width='1.4'/%3E%3C/svg%3E") 16 16, move; }
#cursor-tip {
  position: fixed; left: 0; top: 0; z-index: 40; pointer-events: none; padding: 5px 10px; border-radius: 4px;
  background: rgba(12, 16, 22, 0.92); border: 1px solid var(--bronze-line); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  color: #f3e6c8; font: 800 12px var(--font-body); letter-spacing: 0.09em; text-transform: uppercase; white-space: nowrap;
}
#cursor-tip[hidden] { display: none; }
body.is-touch #cursor-tip { display: none; }
.build-list { position: relative; }

/* ---------- the inventory: your hero with gear slots on one side, the bag on the other (tabs on a narrow phone) ---------- */
.hero-plate { pointer-events: auto; cursor: pointer; }
.hero-bag { display: none; }
@media (max-width: 420px) {
  /* no room for a fifth button in the village: tap your hero's plate instead */
  #hud.in-village #btn-bag { display: none; }
  #hud.in-village .hero-bag {
    display: grid; place-items: center; position: absolute; right: -11px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border-radius: 50%;
    background: #241a0e; border: 1px solid var(--bronze); color: var(--bronze); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  }
  #hud.in-village .hero-bag svg { width: 15px; height: 15px; }
}
#game.inv-open :is(#hud, #btn-interact, #dialogue, #moves, #btn-capture, #cursor-tip, #build-bar, #combo) { display: none !important; }
#game.cf-open :is(#hud, #btn-interact, #dialogue, #moves, #btn-capture, #cursor-tip, #build-bar, #combo, #spells, #potions, #stick) { display: none !important; }
#game.cf-open #banner { display: none; }
.cf-toast { position: fixed; left: 50%; bottom: calc(76px + var(--inset-b)); z-index: 2; display: grid; justify-items: center; gap: 2px; min-width: 260px; max-width: calc(100% - 32px); padding: 12px 22px; border-radius: 6px; border: 1px solid rgba(255, 214, 140, 0.7); background: rgba(16, 20, 28, 0.94); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6), 0 0 24px rgba(255, 200, 110, 0.25); text-align: center; pointer-events: none; opacity: 0; transform: translate(-50%, 10px); }
.cf-toast.show { animation: cf-toast 2.8s ease forwards; }
@keyframes cf-toast { 0% { opacity: 0; transform: translate(-50%, 10px); } 9%, 82% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -4px); } }
.cf-toast b { font-family: var(--font-display); font-weight: 400; font-size: 22px; color: #ffe6ad; }
.cf-toast span { font-size: 14px; color: var(--bone); }
#screen-inventory {
  display: block; padding: 0; overflow: hidden; touch-action: none;
  background: linear-gradient(90deg, rgba(6, 8, 12, 0.55), rgba(6, 8, 12, 0.08) 30%, rgba(6, 8, 12, 0.1) 45%, rgba(6, 8, 12, 0.66));
}
#screen-inventory[hidden] { display: none; }
.inv-wrap {
  position: absolute; inset: calc(14px + var(--inset-t)) calc(14px + var(--inset-r)) calc(14px + var(--inset-b)) calc(14px + var(--inset-l));
  display: grid; grid-template-columns: minmax(290px, 430px) minmax(330px, 540px); grid-template-rows: auto minmax(0, 1fr);
  justify-content: center; gap: 12px 16px;
}
.inv-top { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.inv-title { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1; color: var(--bone); text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6); }
.inv-tabs { display: none; }
.inv-close { width: auto; flex: none; padding: 9px 14px; font-size: 12px; background: rgba(12, 16, 22, 0.8); }
body.is-touch .inv-close kbd { display: none; }
.inv-win { min-height: 0; min-width: 0; display: flex; flex-direction: column; border: 1px solid var(--bronze-line); border-radius: 6px; overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); }
.inv-bag { background: var(--plate); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.inv-head { flex: none; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding: 13px 16px 11px; border-bottom: 1px solid var(--bronze-line); background: var(--plate); }
.inv-head h2 { margin: 2px 0 0; font-family: var(--font-display); font-weight: 400; font-size: 24px; line-height: 1.05; color: var(--bone); overflow-wrap: anywhere; }
.inv-head .lv { flex: none; }
/* narrow phones: the bag's four filters take their own row under the heading */
@media (max-width: 560px) {
  .inv-head { flex-wrap: wrap; align-items: center; }
  .inv-head #inv-filter { flex: 1 1 100%; }
  .inv-head #inv-filter button { flex: 1 1 0; padding: 7px 4px; }
}
/* the window your hero stands in: see-through, with the slots down each side */
.inv-stage {
  position: relative; flex: 1; min-height: 0; display: flex; justify-content: space-between; align-items: stretch; padding: 12px; touch-action: none;
  background: radial-gradient(ellipse at 50% 58%, rgba(255, 222, 160, 0.1), transparent 62%);
}
body:not(.is-touch) #game .inv-stage { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M6.5 13.5 A10 10 0 0 1 22.5 8.2' fill='none' stroke='%2322160a' stroke-width='5' stroke-linecap='round'/%3E%3Cpath d='M25.5 18.5 A10 10 0 0 1 9.5 23.8' fill='none' stroke='%2322160a' stroke-width='5' stroke-linecap='round'/%3E%3Cpath d='M25.6 5.2 L23.6 12.4 L18.4 7.6 Z' fill='%2322160a' stroke='%2322160a' stroke-width='3' stroke-linejoin='round'/%3E%3Cpath d='M6.4 26.8 L8.4 19.6 L13.6 24.4 Z' fill='%2322160a' stroke='%2322160a' stroke-width='3' stroke-linejoin='round'/%3E%3Cpath d='M6.5 13.5 A10 10 0 0 1 22.5 8.2' fill='none' stroke='%23ecd29a' stroke-width='2.4' stroke-linecap='round'/%3E%3Cpath d='M25.5 18.5 A10 10 0 0 1 9.5 23.8' fill='none' stroke='%23ecd29a' stroke-width='2.4' stroke-linecap='round'/%3E%3Cpath d='M25.6 5.2 L23.6 12.4 L18.4 7.6 Z' fill='%23ecd29a'/%3E%3Cpath d='M6.4 26.8 L8.4 19.6 L13.6 24.4 Z' fill='%23ecd29a'/%3E%3Ccircle cx='16' cy='16' r='2.6' fill='%23ecd29a' stroke='%2322160a' stroke-width='1.4'/%3E%3C/svg%3E") 16 16, grab; }
.inv-col { display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.inv-slot { display: grid; justify-items: center; gap: 4px; padding: 0; border: 0; background: none; color: var(--bone); }
.inv-slot .inv-ico {
  width: 64px; height: 64px; display: grid; place-items: center; border-radius: 6px; color: rgba(214, 168, 92, 0.42);
  background: rgba(8, 10, 14, 0.66); border: 1px solid var(--bronze-line); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
.inv-slot .inv-ico svg { width: 32px; height: 32px; }
.inv-slot.filled .inv-ico { border-color: var(--bronze); background: radial-gradient(circle at 50% 40%, rgba(214, 168, 92, 0.24), rgba(8, 10, 14, 0.74)); }
.inv-slot.filled .inv-ico svg { width: 44px; height: 44px; }
.inv-slot:hover .inv-ico { border-color: var(--bronze); }
.inv-slot[aria-pressed="true"] .inv-ico { box-shadow: 0 0 0 2px var(--bronze), 0 0 18px rgba(214, 168, 92, 0.5); }
.inv-label { font-size: 10.5px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--bone); text-shadow: 0 1px 3px #000, 0 0 6px #000; }
.inv-spin-hint { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); margin: 0; pointer-events: none; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(238, 229, 209, 0.6); text-shadow: 0 1px 3px #000; white-space: nowrap; }
.inv-stats { flex: none; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--bronze-line); background: var(--plate); }
.inv-stats div { padding: 9px 12px 10px; min-width: 0; }
.inv-stats div + div { border-left: 1px solid rgba(214, 168, 92, 0.18); }
.inv-stats dt { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ash); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-stats dd { margin: 2px 0 0; font-size: 18px; font-weight: 800; color: var(--bone); font-variant-numeric: tabular-nums; }
/* the bag */
.inv-grid { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; padding: 14px 16px; align-content: start; }
.inv-cell { position: relative; aspect-ratio: 1; min-width: 0; padding: 0; display: grid; place-items: center; border-radius: 5px; color: var(--bone); border: 1px solid var(--bronze-line); background: rgba(0, 0, 0, 0.34); }
.inv-cell.empty { border-color: rgba(214, 168, 92, 0.13); background: rgba(0, 0, 0, 0.16); }
.inv-cell .inv-ico { display: grid; place-items: center; }
.inv-cell .inv-ico svg { width: 34px; height: 34px; }
.inv-cell .inv-n { position: absolute; right: 5px; bottom: 3px; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px #000, 0 0 4px #000; }
.inv-cell:not(.empty):hover { border-color: var(--bronze); }
.inv-cell[aria-pressed="true"] { border-color: var(--bronze); background: rgba(126, 98, 52, 0.4); box-shadow: inset 0 0 0 1px var(--bronze), 0 0 14px rgba(214, 168, 92, 0.35); }
.inv-empty { padding: 0 16px; }
.inv-detail { flex: none; margin-top: auto; display: grid; gap: 8px; align-content: start; min-height: 132px; padding: 14px 16px 16px; border-top: 1px solid var(--bronze-line); background: rgba(0, 0, 0, 0.18); }
.inv-dhead { display: flex; gap: 12px; align-items: center; }
.inv-dico { flex: none; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 6px; border: 1px solid var(--bronze-line); background: rgba(0, 0, 0, 0.35); }
.inv-dico svg { width: 36px; height: 36px; }
.inv-dico.dim { color: rgba(214, 168, 92, 0.45); }
.inv-dhead h3 { margin: 0; font-size: 18px; font-weight: 800; color: var(--bone); }
.inv-sub { margin: 2px 0 0; font-size: 12.5px; letter-spacing: 0.03em; color: var(--bronze); }
.inv-row { margin: 0; font-size: 14px; line-height: 1.4; color: var(--ash); }
.inv-row b { color: var(--bone); font-weight: 800; }
.inv-about { margin: 0; font-size: 14px; line-height: 1.4; color: var(--bone); font-style: italic; }
.inv-hint { margin: 0; font-size: 13.5px; color: var(--ash); }
.inv-act { width: auto; justify-self: start; padding: 10px 16px; font-size: 12.5px; }
.inv-detail-char { display: none; }
@media (max-width: 759px) {
  .inv-detail-char { display: grid; margin-top: 0; min-height: 0; }
  .inv-detail-char.none { display: none; }
  .inv-wrap { grid-template-columns: minmax(0, 1fr); }
  .inv-title { display: none; }
  .inv-tabs { display: flex; flex: 0 1 260px; }
  .inv-wrap[data-show="bag"] .inv-char, .inv-wrap[data-show="char"] .inv-bag { display: none; }
  .inv-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .inv-stats { grid-template-columns: repeat(2, 1fr); }
  .inv-stats div:nth-child(3) { border-left: 0; }
  .inv-stats div:nth-child(n + 3) { border-top: 1px solid rgba(214, 168, 92, 0.18); }
}
@media (max-height: 520px) {
  .inv-wrap { gap: 8px 12px; }
  .inv-title { font-size: 22px; }
  .inv-head { padding: 8px 12px; }
  .inv-head h2 { font-size: 18px; }
  .inv-head .eyebrow { display: none; }
  .inv-stage { padding: 8px; }
  .inv-col { gap: 6px; }
  .inv-label { display: none; }
  .inv-slot .inv-ico { width: 44px; height: 44px; }
  .inv-slot .inv-ico svg { width: 24px; height: 24px; }
  .inv-slot.filled .inv-ico svg { width: 32px; height: 32px; }
  .inv-stats dd { font-size: 15px; }
  .inv-stats div { padding: 6px 10px; }
  .inv-grid { padding: 10px 12px; gap: 6px; }
  .inv-detail { min-height: 0; padding: 10px 12px; gap: 6px; }
  .inv-dico { width: 40px; height: 40px; }
  .inv-dico svg { width: 28px; height: 28px; }
  .inv-about { display: none; }
}

/* ---------- test tools ---------- */
.cheat-list { display: grid; gap: 8px; }
.cheat-toggle { display: flex; align-items: center; gap: 12px; text-align: left; text-transform: none; letter-spacing: 0; font-weight: 400; padding: 12px 14px; }
.cheat-text { flex: 1; display: grid; gap: 2px; min-width: 0; }
.cheat-text b { font-size: 15px; font-weight: 800; color: var(--bone); }
.cheat-text span { font-size: 13px; color: var(--ash); line-height: 1.3; }
.cheat-state {
  flex: none; min-width: 44px; padding: 5px 10px; border-radius: 999px; text-align: center; font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ash); border: 1px solid var(--bronze-line); background: rgba(0, 0, 0, 0.3);
}
.cheat-toggle[aria-pressed="true"] { border-color: var(--bronze); background: rgba(126, 98, 52, 0.25); }
.cheat-toggle[aria-pressed="true"] .cheat-state { color: var(--ink); border-color: transparent; background: linear-gradient(180deg, var(--bronze), var(--bronze-deep)); }
.cheat-plate { padding: 4px 10px; font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: #ffd27a; border-color: rgba(255, 196, 90, 0.6); }
body.is-touch #btn-cheats kbd { display: none; }

/* ---------- magic: the mana bar, the spell bar, and studying at the library ---------- */
.manabar { position: relative; height: 6px; margin-top: 3px; background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(120, 170, 255, 0.25); border-radius: 2px; overflow: hidden; }
.manabar i { position: absolute; inset: 0 auto 0 0; width: 100%; background: linear-gradient(180deg, #cfe6ff, #5a9cff 55%, #2c5bb8); transition: width 0.12s linear; }
.manabar.deny { animation: denied 0.3s; }
#spells {
  position: absolute; z-index: 5; left: 50%; bottom: calc(68px + var(--inset-b)); transform: translateX(-50%);
  display: flex; gap: 10px; pointer-events: none;
}
.spell {
  position: relative; pointer-events: auto; touch-action: none; width: 62px; height: 62px; padding: 0; border-radius: 10px;
  display: grid; place-items: center; align-content: center; gap: 1px; color: var(--bone);
  border: 2px solid #c9734f; background: radial-gradient(circle at 50% 35%, rgba(92, 44, 22, 0.92), rgba(14, 16, 22, 0.92));
  font: 800 9.5px var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
.spell .sp-ico { display: grid; place-items: center; }
.spell .sp-ico svg { width: 30px; height: 30px; }
.spell .sp-name { line-height: 1; }
.spell .sp-cost { position: absolute; left: -7px; top: -7px; min-width: 18px; padding: 1px 4px; border-radius: 8px; font-size: 10px; line-height: 1.4; text-align: center; color: #e6f0ff; background: #24448a; border: 1px solid #6f9bea; }
.spell kbd { position: absolute; top: -7px; right: -7px; min-width: 14px; padding: 0 4px; font-size: 10px; line-height: 1.5; }
.spell::after { content: ""; position: absolute; inset: -2px; border-radius: 10px; pointer-events: none; background: conic-gradient(rgba(8, 10, 18, 0.82) calc(var(--cd, 0) * 360deg), transparent 0); }
.spell.poor .sp-ico { opacity: 0.45; filter: grayscale(0.4); }
.spell.poor .sp-cost { color: #ffb4a8; border-color: #e2553c; background: #5a1e18; }
.spell.locked { opacity: 0.42; border-color: rgba(201, 115, 79, 0.45); }
.spell.locked .sp-cost { display: none; }
.spell.locked .sp-ico svg { filter: grayscale(1); }
.spell.lit { border-color: #ffb24a; box-shadow: 0 0 0 2px rgba(255, 178, 74, 0.35), 0 0 22px rgba(255, 140, 60, 0.6); }
.spell.lit::before { content: ""; position: absolute; left: 4px; right: 4px; bottom: 3px; height: 3px; border-radius: 2px; background: #ffb24a; transform-origin: left; transform: scaleX(var(--act, 0)); }
.spell.denied { animation: denied 0.3s; }
body.is-touch .spell kbd, body.is-touch .spell .sp-name { display: none; }
body.is-touch .spell .sp-ico svg { width: 32px; height: 32px; }
body:not(.is-touch) #btn-interact { bottom: calc(146px + var(--inset-b)); }
body.is-touch #spells { left: calc(14px + var(--inset-l)); bottom: calc(212px + var(--inset-b)); transform: none; flex-direction: column-reverse; gap: 10px; }
body.is-touch .spell { width: 56px; height: 56px; }
@media (max-height: 520px) {
  body.is-touch #spells { flex-direction: row; bottom: calc(166px + var(--inset-b)); left: calc(18px + var(--inset-l)); }
  body.is-touch .spell { width: 52px; height: 52px; }
  body.is-touch .spell .sp-name { display: none; }
}
#game.inv-open #spells { display: none !important; }
.dmg.fire { color: #ffb27a; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.65), 0 0 10px rgba(255, 120, 40, 0.7); }
.dmg.burn { font-size: 13px; color: #ff9a5a; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6), 0 0 8px rgba(255, 110, 30, 0.6); }
.spell.blank { opacity: 0.35; border-style: dashed; }
.spell.blank .sp-cost { display: none; }

/* ---------- regions: the small map, and the world map screen ---------- */
#hud:not(.in-region) .region-only { display: none !important; }
#minimap {
  position: absolute; top: calc(64px + var(--inset-t)); right: calc(12px + var(--inset-r));
  width: 172px; height: 172px; border-radius: 50%;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}
@media (max-width: 600px) { #minimap { width: 120px; height: 120px; } }
.screen.wmap { padding: calc(10px + var(--inset-t)) max(10px, var(--inset-r)) calc(10px + var(--inset-b)) max(10px, var(--inset-l)); background: rgba(6, 8, 12, 0.88); }
.wm-wrap { margin: auto; width: 100%; max-width: 1640px; display: flex; gap: 12px; align-items: stretch; min-height: 0; }
.wm-map {
  --wm-ease: cubic-bezier(0.22, 0.8, 0.24, 1); --wm-t: 0.8s;
  position: relative; flex: 1 1 auto; align-self: center; min-width: 0;
  aspect-ratio: 1671 / 941; max-height: calc(100vh - 20px - var(--inset-t) - var(--inset-b));
  max-width: calc((100vh - 20px) * 1.7758);
  border: 1px solid var(--bronze-line); border-radius: 6px; overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6); background: #0d2236;
}
/* the picture (and the roads drawn on it) zoom together; the pins sit above, moved to match */
.wm-world { position: absolute; inset: 0; transform-origin: 0 0; transition: transform var(--wm-t) var(--wm-ease); will-change: transform; }
.wm-world img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; user-select: none; -webkit-user-drag: none; }
.wm-map.no-img .wm-world { background: radial-gradient(ellipse at 40% 45%, #3d6a3a, #2a4a5a 60%, #0d2236); }
.wm-map.snap, .wm-map.snap * { transition: none !important; }
.wm-map[data-view="world"] { cursor: pointer; }
.wm-links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.wm-link { stroke: rgba(255, 228, 176, 0.9); stroke-width: 2.5; stroke-linecap: round; vector-effect: non-scaling-stroke; opacity: 0; transition: opacity 0.3s; }
.wm-link.on { opacity: 0.75; transition: opacity 0.5s 0.45s; }
.wm-shade {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.6s;
  background: radial-gradient(ellipse 52% 62% at var(--cx, 50%) var(--cy, 50%), transparent 45%, rgba(5, 7, 11, 0.62) 100%);
}
.wm-map[data-view="land"] .wm-shade { opacity: 1; }
.wm-pins { position: absolute; inset: 0; pointer-events: none; }
.wm-pins > * { position: absolute; transition: left var(--wm-t) var(--wm-ease), top var(--wm-t) var(--wm-ease), opacity 0.3s, transform 0.15s; }
/* the six lands, on the whole world */
.wm-region {
  transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 2px; pointer-events: auto;
  padding: 6px 13px 6px; border: 1px solid rgba(214, 168, 92, 0.6); border-radius: 5px; cursor: pointer;
  background: rgba(14, 18, 24, 0.7); color: var(--bone); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.wm-region b { font: 400 clamp(13px, 1.5vw, 21px)/1.05 var(--font-display); white-space: nowrap; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8); }
.wm-region em { font-style: normal; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; color: var(--ember-hi); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.wm-region em svg { width: 11px; height: 11px; }
.wm-region .wm-stars { font-size: 10px; letter-spacing: 0.04em; }
.wm-count { color: var(--bone); }
.wm-region.all-done .wm-count { color: var(--moss-hi); }
.wm-region.locked em { text-transform: uppercase; }
.wm-region:hover, .wm-region:focus-visible { border-color: var(--bronze); transform: translate(-50%, -50%) scale(1.06); }
.wm-region.sel { border-color: var(--bronze); box-shadow: 0 0 0 1px var(--bronze), 0 6px 18px rgba(0, 0, 0, 0.45); }
.wm-region.locked { background: rgba(14, 18, 24, 0.82); color: var(--ash); }
.wm-map[data-view="land"] .wm-region { opacity: 0; pointer-events: none; transform: translate(-50%, -50%) scale(0.85); }
.wm-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); transition: opacity 0.3s; margin: 0; padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--bone);
  background: rgba(10, 13, 18, 0.72); border: 1px solid var(--bronze-line); pointer-events: none;
}
.wm-map[data-view="land"] .wm-hint { opacity: 0; }
/* a land's missions, once zoomed in */
.wm-pin { width: 0; height: 0; padding: 0; border: 0; background: none; cursor: pointer; opacity: 0; pointer-events: none; color: var(--ember-hi); }
.wm-pin.in-sel { opacity: 1; pointer-events: auto; transition: left var(--wm-t) var(--wm-ease), top var(--wm-t) var(--wm-ease), opacity 0.4s 0.4s; }
.wm-dot {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); width: clamp(32px, 2.9vw, 44px); height: clamp(32px, 2.9vw, 44px);
  display: grid; place-items: center; border-radius: 50%; box-sizing: border-box;
  border: 2px solid rgba(255, 236, 200, 0.92); background: rgba(20, 16, 12, 0.86);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.55); transition: transform 0.15s, background 0.15s;
}
.wm-dot svg { width: 58%; height: 58%; }
.wm-pin.t-seal { color: #ff8a7a; } .wm-pin.t-defense { color: #9fe2ff; } .wm-pin.t-arena { color: var(--moss-hi); } .wm-pin.t-dungeon { color: #e7b8ff; }
.wm-pin:hover .wm-dot, .wm-pin:focus-visible .wm-dot { transform: translate(-50%, -50%) scale(1.14); border-color: var(--bronze); }
.wm-pin:focus-visible { outline: none; }
.wm-pin.sel .wm-dot { transform: translate(-50%, -50%) scale(1.2); background: var(--bronze); color: var(--ink); border-color: #ffe9c2; }
.wm-pin.sel .wm-dot::after { content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 2px solid rgba(214, 168, 92, 0.7); animation: wm-ping 1.6s ease-out infinite; }
@keyframes wm-ping { from { transform: scale(0.85); opacity: 1; } to { transform: scale(1.45); opacity: 0; } }
.wm-pin.locked .wm-dot { filter: grayscale(0.9) brightness(0.72); }
.wm-pname {
  position: absolute; left: 0; top: calc(clamp(32px, 2.9vw, 44px) / 2 + 6px); transform: translateX(-50%); white-space: nowrap;
  padding: 2px 8px; border-radius: 3px; font-size: 12px; font-weight: 800; letter-spacing: 0.05em; color: var(--bone);
  background: rgba(10, 13, 18, 0.78); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}
.wm-pin.lab-up .wm-pname { top: auto; bottom: calc(clamp(32px, 2.9vw, 44px) / 2 + 6px); }
.wm-pin.edge-l .wm-pname { transform: translateX(-16px); }
.wm-pin.edge-r .wm-pname { transform: translateX(calc(-100% + 16px)); }
.wm-pin.sel .wm-pname { color: var(--ink); background: var(--bronze); text-shadow: none; }
.wm-done { position: absolute; right: -4px; bottom: -4px; width: 14px; height: 14px; border-radius: 50%; background: var(--moss); border: 2px solid #10141f; }
.wm-done::after { content: ""; position: absolute; left: 3px; top: 1px; width: 3px; height: 6px; border: solid #10141f; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.wm-village { transform: translate(-50%, -50%); display: flex; align-items: center; gap: 4px; padding: 3px 8px 3px 5px; border-radius: 12px; background: rgba(14, 18, 24, 0.78); color: #9fe2ff; border: 1px solid rgba(159, 226, 255, 0.6); font-size: 12px; font-weight: 800; letter-spacing: 0.06em; pointer-events: none; }
.wm-village svg { width: 15px; height: 15px; }
.wm-back {
  position: absolute; left: 10px; top: 10px; z-index: 2; display: inline-flex; align-items: center; gap: 4px; padding: 7px 13px 7px 8px;
  border-radius: 4px; cursor: pointer; font: 800 12.5px var(--font-body); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--bone); background: rgba(10, 13, 18, 0.82); border: 1px solid var(--bronze-line); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}
.wm-back svg { width: 16px; height: 16px; }
.wm-back:hover, .wm-back:focus-visible { border-color: var(--bronze); color: #f3d29a; }
/* the panel's list of lands, on the whole world */
.wm-missions.lands { gap: 6px; }
.wm-land {
  display: grid; grid-template-columns: 1fr auto 16px; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  padding: 10px 10px 10px 12px; border: 1px solid var(--bronze-line); border-radius: 4px; background: rgba(0, 0, 0, 0.18); color: var(--bone); font-family: var(--font-body);
}
.wm-land:hover, .wm-land:focus-visible { border-color: var(--bronze); background: rgba(214, 168, 92, 0.08); }
.wm-land.sel { border-color: rgba(214, 168, 92, 0.75); }
.wm-land.locked { opacity: 0.62; }
.wm-land > svg { width: 16px; height: 16px; color: var(--bronze); }
.wm-ltext { display: grid; gap: 3px; min-width: 0; }
.wm-ltext b { font: 400 18px/1.1 var(--font-display); color: var(--bone); }
.wm-ltext em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--ash); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.wm-ltext em svg { width: 12px; height: 12px; color: var(--ember-hi); }
.wm-lcount { font-size: 13px; font-weight: 800; color: var(--bone); }
.wm-mission { cursor: pointer; }
@media (prefers-reduced-motion: reduce) {
  .wm-map { --wm-t: 0.01s; }
  .wm-pin.sel .wm-dot::after { animation: none; }
}
.wm-panel {
  flex: 0 0 340px; display: flex; flex-direction: column; gap: 10px; min-height: 0; max-height: calc(100vh - 20px - var(--inset-t) - var(--inset-b));
  height: calc(100vh - 20px - var(--inset-t) - var(--inset-b)); box-sizing: border-box;   /* (one height for both views, so the map doesn't shift as it zooms) */
  padding: 20px 18px 16px; background: var(--plate); border: 1px solid var(--bronze-line); border-radius: 6px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.wm-panel h1 { margin: 0; font: 400 clamp(26px, 2.4vw, 34px)/1.05 var(--font-display); color: var(--bone); }
.wm-lv { margin: 0; font-size: 13px; font-weight: 700; color: var(--ash); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.wm-lv svg { width: 13px; height: 13px; color: var(--ember-hi); }
.wm-stars { color: var(--bronze); letter-spacing: 0.08em; }
.wm-missions { display: grid; align-content: start; gap: 8px; overflow-y: auto; min-height: 0; flex: 1 1 auto; padding-right: 2px; }
.wm-mission { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 9px 10px; border: 1px solid var(--bronze-line); border-radius: 4px; background: rgba(0, 0, 0, 0.18); }
.wm-mission.focus { border-color: var(--bronze); box-shadow: 0 0 0 1px var(--bronze) inset; }
.wm-mission.locked { opacity: 0.6; }
.wm-ico { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--bronze-line); color: var(--ember-hi); }
.wm-ico svg { width: 20px; height: 20px; }
.wm-ico.t-seal { color: #ff8a7a; } .wm-ico.t-defense { color: #9fe2ff; } .wm-ico.t-arena { color: var(--moss-hi); } .wm-ico.t-dungeon { color: #e7b8ff; }
.wm-mtext { display: grid; gap: 2px; min-width: 0; }
.wm-mtext b { font-size: 14px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--bone); }
.wm-mtext em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--bronze); }
.wm-mtext p { margin: 0; font-size: 13px; color: var(--ash); }
.wm-mtext p.wm-alt { margin-top: 3px; color: #d9b8ff; font-size: 12px; font-style: italic; }   /* (v97: levels from the builder on this place) */
.wm-ok { color: var(--moss-hi); }
.wm-reward { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.wm-reward .chip { display: inline-flex; align-items: center; gap: 2px; padding: 1px 6px 1px 3px; border-radius: 10px; background: rgba(0, 0, 0, 0.3); font-size: 12px; font-weight: 800; color: var(--bone); }
.wm-reward .chip svg { width: 15px; height: 15px; }
.wm-reward .chip.xp { color: #ffe08a; padding-left: 6px; }
.wm-go { width: auto; padding: 10px 14px; }
.wm-go svg { width: 16px; height: 16px; vertical-align: middle; }
#btn-wm-close { flex: none; }
@media (max-width: 900px) {
  .wm-wrap { flex-direction: column; }
  .wm-map { width: 100%; max-width: none; max-height: none; }
  .wm-panel { flex: none; max-height: none; height: auto; }
  .wm-region { padding: 4px 8px; }
  .wm-region b { font-size: 12px; }
  .wm-region em { font-size: 9px; gap: 4px; }
  .wm-region .wm-stars { display: none; }
  .wm-village span { display: none; }
  .wm-hint { font-size: 10px; bottom: 7px; padding: 3px 9px; }
}
@media (max-width: 600px) {
  .wm-dot { width: 30px; height: 30px; }
  .wm-pname { top: 21px; font-size: 11px; }
  .wm-pin.lab-up .wm-pname { top: auto; bottom: 21px; }
  .wm-pin:not(.sel) .wm-pname { display: none; }
  .wm-back { left: 6px; top: 6px; padding: 5px 10px 5px 6px; font-size: 11px; }
}
.tablet.travelling { text-align: center; justify-items: center; }

/* ---------- potions: the three bottles by the spell bar ---------- */
#potions {
  position: absolute; z-index: 5; left: calc(50% + 152px); bottom: calc(72px + var(--inset-b));
  display: flex; gap: 8px; pointer-events: none;
}
.potion {
  position: relative; pointer-events: auto; touch-action: none; width: 46px; height: 54px; padding: 0; border-radius: 10px;
  display: grid; place-items: center; color: var(--bone); border: 2px solid rgba(214, 168, 92, 0.6);
  background: radial-gradient(circle at 50% 35%, rgba(40, 34, 30, 0.92), rgba(14, 16, 22, 0.92)); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
.potion.pot-hp { border-color: #c9584a; } .potion.pot-mana { border-color: #5a86d6; } .potion.pot-stam { border-color: #6fae4e; }
.potion .pt-ico svg { width: 28px; height: 28px; display: block; }
.potion .pt-n { position: absolute; right: 4px; bottom: 2px; font: 800 12px/1 var(--font-body); color: var(--bone); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
.potion kbd { position: absolute; top: -7px; right: -7px; min-width: 14px; padding: 0 4px; font-size: 10px; line-height: 1.5; }
.potion.empty .pt-ico { opacity: 0.35; filter: grayscale(0.7); }
.potion.empty .pt-n { color: var(--ash); }
.potion::after { content: ""; position: absolute; inset: -2px; border-radius: 10px; pointer-events: none; background: conic-gradient(rgba(8, 10, 18, 0.8) calc(var(--cd, 0) * 360deg), transparent 0); }
.potion.denied { animation: denied 0.3s; }
#game.inv-open #potions { display: none !important; }
body.is-touch #potions { left: auto; right: calc(14px + var(--inset-r)); bottom: calc(318px + var(--inset-b)); flex-direction: column; gap: 8px; }
body.is-touch .potion kbd { display: none; }
/* phone held sideways: the potions carry on the spell row, after the four spells */
@media (max-height: 520px) { body.is-touch #potions { bottom: calc(166px + var(--inset-b)); left: calc(270px + var(--inset-l)); right: auto; flex-direction: row; gap: 10px; } }
@media (max-width: 760px) { body:not(.is-touch) #potions { left: auto; right: calc(12px + var(--inset-r)); bottom: calc(150px + var(--inset-b)); } }
.loot-pot-hp { color: #ff9a8a; } .loot-pot-mana { color: #a8c8ff; } .loot-pot-stam { color: #b8ec98; }
/* gear: a part found, a chilled demon, frost hits */
.dmg.loot-part { color: #ffe39a; font-size: 18px; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.7), 0 0 14px rgba(255, 200, 90, 0.75); }
.dmg.chill { font-size: 13px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: #bfe6ff; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6), 0 0 10px rgba(120, 200, 255, 0.8); }
.dmg.frost { color: #cfeaff; }
.inv-cell.part .inv-ico svg { filter: drop-shadow(0 0 3px rgba(255, 215, 130, 0.25)); }
.loot-herbs { color: #b8ec98; } .loot-fish { color: #b9dfeb; }

/* ---------- a villager's workshop (crafting.js): Bram's forge and Elowen's magic table, laid out like a foundry ---------- */
.screen.crafter { padding: calc(14px + var(--inset-t)) max(14px, var(--inset-r)) calc(14px + var(--inset-b)) max(14px, var(--inset-l)); background: radial-gradient(ellipse at 50% 30%, rgba(14, 18, 26, 0.72), rgba(5, 7, 10, 0.92)); }
.cf-wrap { margin: auto; width: 100%; max-width: 1240px; display: grid; gap: 12px; align-content: start; }
.cf-head { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; }
.cf-who { display: flex; align-items: center; gap: 12px; min-width: 0; grid-column: 1; grid-row: 1; }
.cf-face { flex: none; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 8px; border: 1px solid rgba(214, 168, 92, 0.6); background: radial-gradient(circle at 50% 35%, rgba(70, 58, 40, 0.95), rgba(14, 16, 22, 0.95)); box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35); }
.cf-face svg { width: 38px; height: 38px; }
.screen.crafter[data-who="mage"] .cf-face { border-color: rgba(168, 212, 255, 0.6); background: radial-gradient(circle at 50% 35%, rgba(40, 56, 98, 0.95), rgba(12, 14, 26, 0.95)); }
.cf-who .eyebrow { margin: 0; }
.cf-title { grid-column: 2; grid-row: 1; margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 42px; line-height: 1; letter-spacing: 0.08em; text-transform: uppercase; color: #f6f1e6; text-align: center; text-shadow: 0 2px 14px rgba(0, 0, 0, 0.6); white-space: nowrap; }
.cf-mats { grid-column: 3; grid-row: 1; justify-self: end; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; padding: 5px 7px; border: 1px solid var(--bronze-line); border-radius: 5px; background: var(--plate); }
.cf-mats[data-n="6"] { display: grid; grid-template-columns: repeat(3, auto); }
.cf-mat { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; font-size: 14px; font-weight: 800; color: #f2e6c8; font-variant-numeric: tabular-nums; }
.cf-mat svg { width: 20px; height: 20px; }
.cf-say { margin: -2px 0 0; text-align: center; font-size: 14px; font-style: italic; color: var(--ash); }
.cf-nav { display: grid; gap: 8px; }
.cf-tabs { display: flex; justify-content: center; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid rgba(214, 168, 92, 0.28); background: linear-gradient(180deg, rgba(20, 26, 34, 0.0), rgba(20, 26, 34, 0.55)); }
.cf-tabs::-webkit-scrollbar { display: none; }
.cf-tab { flex: none; position: relative; padding: 10px 18px 11px; border: 0; background: none; color: var(--ash); font: 800 15px/1 var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; cursor: pointer; }
.cf-tab:hover { color: var(--bone); }
.cf-tab[aria-selected="true"] { color: #fff6e0; }
.cf-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 2px; background: var(--bronze); box-shadow: 0 0 10px rgba(214, 168, 92, 0.6); }
.cf-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.cf-tools[hidden] { display: none; }
.cf-search { width: min(320px, 50%); padding: 8px 10px; border: 0; border-bottom: 1px solid rgba(214, 168, 92, 0.5); border-radius: 3px 3px 0 0; background: rgba(10, 14, 20, 0.6); color: var(--bone); font: 600 14px/1.2 var(--font-body); letter-spacing: 0.06em; }
.cf-search::placeholder { color: rgba(179, 184, 194, 0.75); text-transform: uppercase; }
.cf-search:focus { outline: 2px solid rgba(214, 168, 92, 0.55); outline-offset: 1px; }
.cf-sort { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ash); }
.cf-sort select { padding: 7px 10px; border: 1px solid var(--bronze-line); border-radius: 3px; background: rgba(10, 14, 20, 0.75); color: var(--bone); font: 700 13px/1.2 var(--font-body); }
/* the cards: pale stone panels with dark ink, like the reference foundry */
.cf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.cf-card { display: grid; grid-template-columns: 124px minmax(0, 1fr); grid-template-rows: 1fr auto; min-width: 0; border-radius: 3px; overflow: hidden; color: #1c1d21; background: linear-gradient(180deg, rgba(240, 238, 232, 0.96), rgba(222, 219, 211, 0.96)); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55), 0 10px 26px rgba(0, 0, 0, 0.45); transition: background 0.15s; }
.cf-card:hover, .cf-card:focus-within { background: linear-gradient(180deg, rgba(246, 236, 196, 0.98), rgba(232, 219, 170, 0.98)); box-shadow: 0 0 0 2px #e6c36a, 0 10px 26px rgba(0, 0, 0, 0.45); }
.cf-art { display: grid; place-items: center; padding: 10px; background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0) 70%); }
.cf-art svg { width: 86px; height: 86px; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.35)); }
.cf-main { display: grid; align-content: start; gap: 6px; padding: 14px 16px 12px 0; min-width: 0; }
.cf-main h3 { margin: 0; font: 800 20px/1.15 var(--font-body); letter-spacing: 0.04em; text-transform: uppercase; color: #15161a; overflow-wrap: anywhere; }
.cf-about { margin: 0; font-size: 13px; line-height: 1.35; color: #4a4c52; }
.cf-reqs { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; }
.cf-rbox, .cf-pick { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-width: 0; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; }
.cf-pick { grid-template-columns: 30px minmax(0, 1fr) auto auto; cursor: pointer; border-radius: 4px; outline: 1px dashed rgba(60, 50, 30, 0.35); outline-offset: 2px; }
.cf-pick:hover { outline-color: #8a6a2a; }
.cf-swap { font-size: 14px; color: #6b5427; }
.cf-ri { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 4px; background: #f7f6f2; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); }
.cf-ri svg { width: 24px; height: 24px; }
.cf-rt { display: grid; min-width: 0; line-height: 1.15; }
.cf-rn { font-size: 11px; font-weight: 700; color: #5a5c62; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cf-rv { font-size: 16px; font-weight: 800; color: #1a1b1f; font-variant-numeric: tabular-nums; }
.cf-req.no .cf-rv { color: #9a2a22; }
.cf-rk { width: 18px; height: 18px; color: #15161a; }
.cf-rk svg { width: 18px; height: 18px; display: block; }
.cf-cfoot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 40px; padding: 6px 12px 6px 16px; background: linear-gradient(180deg, #9aa0a8, #868c94); color: #fff; }
.cf-state { font-size: 14px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); margin-left: auto; text-align: right; }
.cf-state.go { margin-left: 0; text-align: left; color: #fff7da; }
.cf-state.done { margin-left: 0; text-align: left; }
.cf-card.locked .cf-cfoot { background: linear-gradient(180deg, #d9c27a, #c7ab5c); }
.cf-card.locked .cf-state { color: #2a1f08; text-shadow: none; }
.cf-card.locked .cf-art svg, .cf-card.locked .cf-reqs { opacity: 0.6; }
.cf-card.ready .cf-cfoot { background: linear-gradient(180deg, #6f7f5a, #5b6a48); }
.cf-card.done .cf-cfoot { background: linear-gradient(180deg, #5d6f96, #4c5c80); }
.cf-build { flex: none; padding: 8px 20px; border: 0; border-radius: 3px; background: #15181d; color: #ffe6ad; font: 800 13px/1 var(--font-body); letter-spacing: 0.14em; text-transform: uppercase; cursor: pointer; box-shadow: 0 0 0 1px rgba(255, 230, 173, 0.35); }
.cf-build:hover { background: #22262d; box-shadow: 0 0 0 1px #ffe6ad, 0 0 12px rgba(255, 210, 120, 0.45); }
.cf-keys { display: inline-flex; gap: 4px; }
.cf-key { width: 32px; height: 30px; padding: 0; border-radius: 4px; border: 1px solid rgba(255, 255, 255, 0.55); background: rgba(10, 16, 30, 0.35); color: #eef3ff; font: 800 13px/1 var(--font-body); cursor: pointer; }
.cf-key:hover { background: rgba(10, 16, 30, 0.55); }
.cf-key[aria-pressed="true"] { background: #f0d48a; border-color: #f0d48a; color: #1a1406; }
.cf-empty { grid-column: 1 / -1; margin: 18px 0; text-align: center; color: var(--ash); font-size: 15px; }
/* the mage's spell bar */
.cf-bar { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--bronze-line); border-radius: 5px; background: var(--plate); flex-wrap: wrap; }
.cf-bar[hidden] { display: none; }
.cf-barlabel { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--bronze); margin-right: 4px; }
.cf-slot { position: relative; display: flex; align-items: center; gap: 6px; min-width: 128px; padding: 6px 10px 6px 18px; border: 1px solid rgba(168, 212, 255, 0.45); border-radius: 5px; background: rgba(30, 44, 80, 0.45); }
.cf-slot.empty { border-style: dashed; border-color: var(--bronze-line); background: rgba(0, 0, 0, 0.2); }
.cf-slot kbd { position: absolute; top: -8px; left: -6px; }
.cf-sico svg { width: 26px; height: 26px; display: block; }
.cf-sname { font-size: 13px; font-weight: 800; color: var(--bone); }
.cf-slot.empty .cf-sname { color: var(--ash); font-weight: 600; }
/* the Parts tab */
.cf-parts { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.cf-part { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 3px; color: #1c1d21; background: linear-gradient(180deg, rgba(240, 238, 232, 0.95), rgba(222, 219, 211, 0.95)); }
.cf-part b { font-size: 16px; font-variant-numeric: tabular-nums; }
.cf-part .cf-rn { font-size: 13.5px; color: #1c1d21; white-space: normal; }
.cf-rw { font-size: 11.5px; color: #5a5c62; }
/* levelling a villager up */
.cf-level { display: grid; gap: 14px; padding: 18px 20px; border-radius: 3px; color: #1c1d21; background: linear-gradient(180deg, rgba(240, 238, 232, 0.97), rgba(222, 219, 211, 0.97)); box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45); }
.cf-level[hidden] { display: none; }
.cf-lvhead h3 { margin: 0 0 4px; font: 800 22px/1.15 var(--font-body); letter-spacing: 0.04em; text-transform: uppercase; }
.cf-lvhead p { margin: 0; color: #4a4c52; font-size: 14px; line-height: 1.45; }
.cf-asks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; }
.cf-ask { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; }
.cf-ask .cf-rn { font-size: 13px; color: #1c1d21; }
.cf-abar { display: block; height: 7px; margin-top: 4px; border-radius: 4px; background: rgba(0, 0, 0, 0.14); overflow: hidden; }
.cf-abar i { display: block; height: 100%; background: linear-gradient(90deg, #b07a2a, #e6b24a); }
.cf-ask.full .cf-abar i { background: linear-gradient(90deg, #5b7a3a, #8fbf5a); }
.cf-give { width: auto; padding: 6px 12px; font-size: 12px; color: #2a2010; border-color: rgba(60, 40, 10, 0.4); background: rgba(255, 255, 255, 0.6); }
.cf-give:disabled { opacity: 0.55; }
.cf-giveall { justify-self: start; width: auto; padding: 10px 22px; }
.cf-ladder { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.cf-ladder li { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; padding: 6px 10px; border-radius: 3px; font-size: 13.5px; color: #6a6c72; background: rgba(0, 0, 0, 0.05); }
.cf-ladder li b { color: #4a4c52; }
.cf-ladder li.have { color: #1c1d21; background: rgba(120, 150, 80, 0.18); }
.cf-ladder li.have b { color: #3d5a22; }
.cf-ladder li.next { color: #1c1d21; background: rgba(214, 168, 92, 0.3); box-shadow: inset 3px 0 0 #b07a2a; }
/* the bottom bar: the villager's level, and the way out */
.cf-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 4px; }
.cf-lvbtn { display: grid; gap: 5px; min-width: 240px; padding: 9px 14px; border: 1px solid var(--bronze-line); border-radius: 4px; background: var(--plate); color: var(--bone); font: 800 13px/1.1 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; text-align: left; cursor: pointer; }
.cf-lvbtn:hover { border-color: var(--bronze); }
.cf-lvbtn.ready { border-color: #e6b24a; box-shadow: 0 0 12px rgba(230, 178, 74, 0.35); }
.cf-lvbar { display: block; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.cf-lvbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #a8783a, #ffd27a); }
.cf-exit { width: auto; min-width: 120px; padding: 11px 22px; letter-spacing: 0.14em; }
@media (max-width: 900px) {
  .cf-grid { grid-template-columns: minmax(0, 1fr); }
  .cf-title { font-size: 34px; }
}
@media (max-width: 640px) {
  .cf-head { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .cf-who, .cf-title, .cf-mats { grid-column: 1; grid-row: auto; }
  .cf-title { text-align: left; font-size: 26px; white-space: normal; }
  .cf-mats { justify-self: stretch; justify-content: flex-start; }
  .cf-tabs { justify-content: flex-start; }
  .cf-tab { padding: 10px 9px 11px; font-size: 12.5px; letter-spacing: 0.06em; }
  .cf-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; padding-top: 10px; }
  .cf-barlabel { grid-column: 1 / -1; }
  .cf-search { width: 100%; flex: 1; }
  .cf-sort span { display: none; }
  .cf-card { grid-template-columns: 64px minmax(0, 1fr); }
  .cf-art { padding: 10px 6px; place-items: start center; padding-top: 16px; }
  .cf-art svg { width: 48px; height: 48px; }
  .cf-main { padding: 12px 12px 10px 0; }
  .cf-main h3 { font-size: 16px; }
  .cf-reqs { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .cf-req .cf-rt { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
  .cf-req .cf-rn { font-size: 13.5px; color: #33353a; white-space: normal; }
  .cf-req .cf-rv { flex: none; font-size: 15px; }
  .cf-cfoot { flex-wrap: wrap; padding: 6px 10px 6px 12px; }
  .cf-asks { grid-template-columns: minmax(0, 1fr); }
  .cf-ask { grid-template-columns: 30px minmax(0, 1fr) auto; }
  .cf-ask .cf-give { grid-column: 2 / -1; justify-self: start; }
  .cf-slot { min-width: 0; }
  .cf-foot { flex-wrap: wrap; }
  .cf-lvbtn { min-width: 0; flex: 1; }
}
@media (max-height: 520px) {
  .cf-title { font-size: 28px; }
  .cf-face { width: 42px; height: 42px; }
  .cf-say { display: none; }
}

/* ---------- (v74) class abilities: the bar's waiting slots, the Abilities window (U), drawing the Severing Line ---------- */
.spell.waits { border-color: #f4d79a; animation: ab-wait 1.2s ease-in-out infinite; }
.spell.waits .sp-name { color: #f4d79a; }
.spell .ab-q { font: 900 24px/1 var(--font-ui, serif); color: #f4d79a; text-shadow: 0 0 10px rgba(244, 215, 154, 0.7); }
@keyframes ab-wait { 50% { box-shadow: 0 0 0 2px rgba(244, 215, 154, 0.4), 0 0 20px rgba(244, 200, 120, 0.6); } }
#abil-panel { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(4, 4, 8, 0.55); }
#abil-panel[hidden] { display: none; }
#game.ab-open :is(#hud, #spells, #potions, #moves, #stick, #combo) { visibility: hidden; }
.ab-wrap { width: min(860px, 100%); max-height: calc(100vh - 32px); overflow: auto; color: var(--ui-text, #efe4cf); }
.ab-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.ab-head h2 { margin: 0; font: 700 26px/1.1 var(--font-ui, serif); letter-spacing: 0.08em; color: var(--ui-gold-hi, #f4d79a); }
.ab-eyebrow { margin: 0 0 4px; font: 800 11px/1 var(--font-body); letter-spacing: 0.18em; text-transform: uppercase; color: var(--ui-dim, #a8a196); }
.ab-close { width: 34px; height: 34px; border-radius: 2px; border: 1px solid var(--ui-iron); background: rgba(0, 0, 0, 0.35); color: var(--ui-text); font-size: 16px; cursor: pointer; }
.ab-close:hover { border-color: rgba(220, 180, 108, 0.6); }
.ab-rows { display: grid; gap: 10px; }
.ab-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; align-items: stretch; }
.ab-row.locked { opacity: 0.55; }
.ab-row.focus .ab-slot { border-color: #f4d79a; }
.ab-slot { display: grid; place-items: center; align-content: center; gap: 6px; padding: 8px; border: 1px solid var(--ui-iron); background: rgba(0, 0, 0, 0.3); text-align: center; font: 800 10px/1.3 var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ui-dim); }
.ab-slot kbd { font-size: 16px; padding: 2px 8px; }
.ab-opts { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.ab-opts.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ab-card { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px; text-align: left; cursor: pointer; color: #1c1d21;
  border: 0; border-radius: 3px; background: linear-gradient(180deg, rgba(240, 238, 232, 0.96), rgba(222, 219, 211, 0.96)); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5), 0 8px 20px rgba(0, 0, 0, 0.4); }
.ab-card:hover:not(:disabled), .ab-card:focus-visible { background: linear-gradient(180deg, rgba(246, 236, 196, 0.98), rgba(232, 219, 170, 0.98)); box-shadow: 0 0 0 2px #e6c36a, 0 8px 20px rgba(0, 0, 0, 0.4); }
.ab-card.on { background: linear-gradient(180deg, rgba(250, 236, 190, 1), rgba(236, 214, 150, 1)); box-shadow: 0 0 0 2px #c99a3a, 0 0 18px rgba(244, 200, 120, 0.45); }
.ab-card:disabled { cursor: default; }
.ab-row.locked .ab-card, .ab-card:disabled:not(.on) { filter: saturate(0.6); }
.ab-ico { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 6px; background: radial-gradient(circle at 50% 35%, rgba(92, 44, 22, 0.95), rgba(14, 16, 22, 0.95)); border: 2px solid #c9734f; }
.ab-ico svg { width: 34px; height: 34px; }
.ab-txt { display: grid; gap: 3px; min-width: 0; }
.ab-txt b { font: 700 15px/1.2 var(--font-ui, serif); letter-spacing: 0.04em; }
.ab-about { font: 500 12.5px/1.35 var(--font-body); color: #35363b; }
.ab-cost { font: 800 10.5px/1.2 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; color: #24448a; }
.ab-foot { margin: 12px 0 0; font: 500 12.5px/1.4 var(--font-body); color: var(--ui-dim); }
#game.ab-drawing #game-canvas, #game.ab-drawing canvas { cursor: crosshair; }
.dmg.zap { color: #c8f4ff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.65), 0 0 10px rgba(80, 210, 255, 0.7); }
@media (max-width: 640px) { .ab-row { grid-template-columns: minmax(0, 1fr); } .ab-opts.two { grid-template-columns: minmax(0, 1fr); } .ab-slot { grid-auto-flow: column; justify-content: start; } }

/* (v98) home, or keep going: an endless Defense or Survival asks */
.screen.ask { z-index: 12; }
.ask-mul { margin: 0; color: var(--gold, #e6c37a); font-weight: 700; letter-spacing: 0.06em; }

/* ===== (v107) the animal pen (animals.js), the campfire's cooking (food.js), the food bar's buffs ===== */
.pen-tablet, .cook-tablet { max-width: 620px; gap: 10px; }
.pen-nav { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ash); }
.pen-nav:empty { display: none; }
.pen-step { width: auto; padding: 4px 12px; margin: 0; }
.pen-tamer { margin: 0; }
.pen-h { margin: 6px 0 0; font: 700 12px/1 var(--font-body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--bronze); }
.pen-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 520px) { .pen-pair { grid-template-columns: 1fr; } }
.pen-list { display: grid; gap: 6px; max-height: min(34vh, 300px); overflow-y: auto; }
.pen-card { display: grid; gap: 4px; padding: 8px 10px; border: 1px solid var(--bronze-line); border-radius: 4px; background: rgba(0, 0, 0, 0.3); }
.pen-card.sex-m { border-left: 3px solid #6aa8ff; } .pen-card.sex-f { border-left: 3px solid #ff8cc6; }
.pen-card.empty { opacity: 0.75; border-style: dashed; }
.pen-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pen-card-head b { font-size: 14px; color: var(--bone); }
.pen-stars { font: 700 12px/1 sans-serif; letter-spacing: 1px; color: var(--bronze); }
.pen-line { margin: 0; font-size: 12.5px; color: var(--ash); }
.pen-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.pen-act { width: auto; margin: 0; padding: 6px 12px; font-size: 12px; }
.pen-bar { height: 5px; border-radius: 3px; background: rgba(0, 0, 0, 0.45); overflow: hidden; }
.pen-bar.big { height: 8px; }
.pen-bar i { display: block; height: 100%; background: linear-gradient(90deg, #8fd16a, #e8d27a); }
.pen-breed { display: grid; gap: 6px; padding: 8px 10px; border-radius: 4px; background: rgba(0, 0, 0, 0.22); }
.pen-status { margin: 0; font-size: 13px; color: var(--bone); }
.pen-status.dim { color: var(--ash); }
.pen-none { margin: 0; font-size: 12.5px; color: var(--ash); }
.pen-msg { min-height: 1.2em; margin: 0; font-size: 13px; color: var(--bronze); }
.cook-rows { display: grid; gap: 6px; max-height: min(56vh, 520px); overflow-y: auto; }
.cook-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--bronze-line); border-radius: 4px; background: rgba(0, 0, 0, 0.3); }
.cook-row.none { opacity: 0.6; }
.cook-ico { flex: none; width: 40px; height: 40px; } .cook-ico svg { width: 40px; height: 40px; display: block; }
.cook-row .run-text { flex: 1; display: grid; gap: 2px; }
.cook-row .run-text b { font-size: 14px; } .cook-row .run-text em { font-style: normal; font-size: 12.5px; color: var(--bone); opacity: 0.85; }
.cook-need { font-size: 12px; color: var(--ash); }
.cook-btns { flex: none; display: grid; gap: 4px; }
.cook-go { width: auto; margin: 0; padding: 6px 12px; font-size: 12px; }
.food-buffs { position: absolute; left: 0; bottom: calc(100% + 6px); white-space: nowrap; font: 700 11.5px/1 var(--font-body); color: #ffe2a0; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9); pointer-events: none; }
.food-buffs:empty { display: none; }
.inv-keys { display: flex; flex-wrap: wrap; gap: 6px; }
.inv-key.on { opacity: 0.7; }
.fl-animal-list { font-size: 12.5px; color: var(--bone); }
.loot-food { color: #ffcf8a; }
/* (v111) the cooking forge: what's on the fire; the market (market.js); the rune table (village-life.js); coins */
.cook-status { margin: 0; padding: 7px 10px; border-radius: 4px; background: rgba(255, 140, 50, 0.1); border: 1px solid rgba(255, 160, 80, 0.35); font-size: 13px; color: var(--bone); }
.cook-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }
.cook-foot button { width: auto; margin: 0; }
.market-tablet, .rt-tablet { max-width: 640px; gap: 10px; }
.market-coins { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 15px; color: var(--bone); }
.market-coins svg, .mat.coin svg { width: 20px; height: 20px; }
.market-coins b { color: #f2cf6a; font-size: 18px; }
.market-tabs { align-self: flex-start; }
.market-note { margin: 0; font-size: 12.5px; }
.market-rows, .rt-rows { display: grid; gap: 6px; max-height: min(52vh, 500px); overflow-y: auto; padding-right: 2px; }
.market-g, .rt-h { margin: 8px 0 0; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--bronze); }
.market-row, .rt-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--bronze-line); border-radius: 4px; background: rgba(0, 0, 0, 0.3); }
.market-row.none { opacity: 0.55; }
.market-ico { flex: none; width: 34px; height: 34px; } .market-ico svg { width: 34px; height: 34px; display: block; }
.market-row .run-text, .rt-row .run-text { flex: 1; display: grid; gap: 2px; min-width: 0; }
.market-row .run-text b, .rt-row .run-text b { font-size: 14px; }
.market-price { font-size: 12px; color: #f2cf6a; }
.market-btns { flex: none; display: flex; gap: 4px; align-items: center; }
.market-go, .rt-up { width: auto; margin: 0; padding: 6px 11px; font-size: 12px; }
.market-lock { font-size: 11.5px; color: var(--ash); max-width: 150px; text-align: right; }
.market-empty, .rt-none { margin: 4px 0; font-size: 13px; color: var(--ash); }
.rt-bag { margin: 0; display: flex; gap: 12px; }
.rt-bag .mat { display: inline-flex; align-items: center; gap: 4px; } .rt-bag svg { width: 20px; height: 20px; }
.rt-stars { margin-left: 8px; color: #8fd0ff; font-size: 12px; letter-spacing: 1px; } .rt-stars i { font-style: normal; opacity: 0.25; }
.rt-row .run-text small { font-size: 12px; color: var(--ash); } .rt-row .run-text em { font-style: normal; font-size: 12.5px; color: #8fd0ff; }
.rt-row.top { opacity: 0.75; }
.rn-next { font-size: 11.5px; color: var(--ash); align-self: center; }
/* (v112) the village plate under your bars holds only your coins: as wide as they need */
.left-stack > .mats-plate { align-self: flex-start; padding: 5px 12px; }
.mats-plate .mat.coin b { color: #f2cf6a; }
/* (v113) the grind: a rare part in a cost (recipes.js costChips) has a faint ring; the cooking forge's upgrade and the
   rune table show their costs as chips; the shrine's rare-part rows are tinted */
.chip.rare { padding: 0 4px 0 2px; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(255, 120, 90, 0.45); background: rgba(120, 30, 20, 0.22); }
.chip.rare.short { color: #ffb39a; }
#btn-cook-forge .up-cost { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px 8px; margin-top: 4px; font-size: 12px; font-weight: 800; }
.rt-cost { display: flex; flex-wrap: wrap; gap: 3px 8px; margin-top: 3px; font-size: 12px; font-weight: 800; }
.rt-bag { flex-wrap: wrap; gap: 6px 12px; }
.prow.rare .pname { color: #ffc2a8; }

/* (v115) Options: loading a saved game file asks first */
.load-confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0; }
.load-confirm[hidden] { display: none; }
.load-confirm p { flex: 1 1 100%; margin: 0; }
