/* Koninkrijk van de Kroon — "Steen & ijzer"
   Layout: an iron-bound oak sidebar beside a slate HUD and a masonry hall;
   every surface is stone, oak, forged iron or brass, lit by torches. */
:root {
  color-scheme: dark;

  /* stone & mortar */
  --stone-0: #0d0c0a;
  --stone-1: #171512;
  --stone-2: #211e1a;
  --stone-3: #2e2a25;
  --stone-4: #433d35;
  /* forged iron */
  --iron-0: #0f1011;
  --iron-1: #26292b;
  --iron-2: #44494c;
  --iron-3: #767d81;
  --iron-hi: #b8bfc2;
  /* oak */
  --oak-0: #1d130b;
  --oak-1: #33210f;
  --oak-2: #523517;
  /* metals & fire */
  --brass: #c79b45;
  --brass-hi: #f0d58a;
  --brass-lo: #6a4a17;
  --ember: #e0741f;
  --ember-hi: #ffbe63;
  --blood: #8e2a20;
  --blood-hi: #d0513f;
  --moss: #9db467;
  --spectre: #8fe8c0;
  /* text */
  --bone: #eadcbb;
  --bone-2: #b9aa88;
  --bone-3: #857a62;
  --ink: #1b130b;
  --parch: #dcc79a;
  --parch-2: #c3a874;

  --font-display: "Grenze Gotisch", "UnifrakturCook", "Palatino Linotype", Georgia, serif;
  --font-sc: "Alegreya SC", "Palatino Linotype", Georgia, serif;
  --font-body: "Alegreya", "Palatino Linotype", Palatino, Georgia, serif;
  --font-fell: "IM Fell English", "Alegreya", Georgia, serif;

  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.3' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .22 -.06'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --masonry: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='120'%3E%3Cg fill='%23fff'%3E%3Crect x='3' y='3' width='116' height='55' fill-opacity='.022'/%3E%3Crect x='123' y='3' width='114' height='55' fill-opacity='.008'/%3E%3Crect x='-57' y='63' width='116' height='54' fill-opacity='.014'/%3E%3Crect x='63' y='63' width='116' height='54' fill-opacity='.03'/%3E%3Crect x='183' y='63' width='116' height='54' fill-opacity='.014'/%3E%3C/g%3E%3Cpath d='M0 1.5H240M0 61H240M0 119H240M1.5 0V61M121 0V61M61 61V120M181 61V120' stroke='%23000' stroke-opacity='.55' stroke-width='3' fill='none'/%3E%3Cpath d='M0 4H240M0 64H240M4 4V61M124 4V61M64 64V120M184 64V120' stroke='%23fff' stroke-opacity='.035' stroke-width='1' fill='none'/%3E%3C/svg%3E");
  --oakgrain: repeating-linear-gradient(92deg, rgba(0, 0, 0, 0.16) 0 2px, transparent 2px 9px, rgba(255, 220, 160, 0.025) 9px 11px, transparent 11px 23px);

  --plate-ring:
    0 0 0 1px #000,
    0 0 0 3px var(--iron-2),
    0 0 0 4px #000,
    0 14px 30px rgba(0, 0, 0, 0.55);
  --plate-inset:
    inset 0 1px 0 rgba(255, 240, 210, 0.07),
    inset 0 0 0 1px rgba(0, 0, 0, 0.5),
    inset 0 -18px 30px rgba(0, 0, 0, 0.35);

  --radius: 3px;
  --gutter: clamp(16px, 2.2vw, 28px);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--stone-0);
}

body {
  min-height: 100vh;
  margin: 0;
  padding-inline: var(--gutter);
  padding-block: var(--gutter) 72px;
  background-color: var(--stone-1);
  background-image:
    radial-gradient(ellipse at 50% 120%, rgba(0, 0, 0, 0.9), transparent 60%),
    radial-gradient(ellipse at 50% -10%, rgba(0, 0, 0, 0.75), transparent 55%),
    var(--masonry),
    var(--noise);
  background-size: auto, auto, 240px 120px, 180px 180px;
  background-attachment: fixed;
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.45;
  overflow-x: hidden;
}

/* ambient light */
.torchlight {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(38vmax 30vmax at 4% 8%, rgba(255, 150, 60, 0.2), transparent 70%),
    radial-gradient(38vmax 30vmax at 96% 8%, rgba(255, 150, 60, 0.16), transparent 70%);
  mix-blend-mode: screen;
  animation: flicker 4.2s infinite steps(1, end);
}

@keyframes flicker {
  0% { opacity: 0.92; }
  7% { opacity: 1; }
  13% { opacity: 0.84; }
  21% { opacity: 0.97; }
  34% { opacity: 0.88; }
  46% { opacity: 1; }
  58% { opacity: 0.9; }
  71% { opacity: 0.98; }
  83% { opacity: 0.86; }
  92% { opacity: 0.95; }
}

.embers {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

img {
  max-width: 100%;
}

.eyebrow,
.tier-label {
  color: var(--brass);
  font-family: var(--font-sc);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: lowercase;
}

/* ---------- buttons: forged iron ---------- */
button {
  position: relative;
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid #050505;
  border-radius: var(--radius);
  background-color: var(--iron-1);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.02) 42%, rgba(0, 0, 0, 0.25) 58%, rgba(0, 0, 0, 0.45)),
    var(--grain-light),
    linear-gradient(180deg, var(--iron-2), var(--iron-1));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 0 0 1px rgba(0, 0, 0, 0.35),
    inset 0 0 0 3px rgba(199, 155, 69, 0.22),
    0 2px 0 #000,
    0 6px 14px rgba(0, 0, 0, 0.5);
  color: var(--brass-hi);
  cursor: pointer;
  font-family: var(--font-sc);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 0 #000, 0 0 10px rgba(240, 190, 90, 0.25);
  transition:
    transform 120ms ease,
    box-shadow 200ms ease,
    color 200ms ease,
    filter 200ms ease;
  overflow: hidden;
  isolation: isolate;
}

/* rivets */
button::before,
button::after {
  position: absolute;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e9d9a8, var(--brass-lo) 70%, #000);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
  content: "";
}

button::before {
  left: 7px;
}

button::after {
  right: 7px;
}

button:hover:not(:disabled) {
  color: #fff0c9;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 0 0 1px rgba(0, 0, 0, 0.35),
    inset 0 0 0 3px rgba(255, 170, 80, 0.4),
    inset 0 -10px 22px rgba(224, 116, 31, 0.5),
    0 2px 0 #000,
    0 0 22px rgba(224, 116, 31, 0.32),
    0 6px 14px rgba(0, 0, 0, 0.5);
}

button:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.6),
    inset 0 0 0 3px rgba(255, 170, 80, 0.4),
    0 0 0 #000;
}

button:focus-visible {
  outline: 2px solid var(--ember-hi);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  color: var(--bone-3);
  text-shadow: 0 1px 0 #000;
  filter: saturate(0.4) brightness(0.8);
}

button.is-quiet {
  color: var(--bone-2);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.35)),
    var(--grain-light),
    linear-gradient(180deg, var(--stone-3), var(--stone-2));
}

/* cooldown fill drawn as cooling metal across the button */
button[data-cd]::selection {
  background: none;
}

button .cd-fill {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: var(--cd, 0%);
  background: linear-gradient(90deg, rgba(224, 116, 31, 0.08), rgba(224, 116, 31, 0.32));
  box-shadow: inset -2px 0 0 rgba(255, 190, 99, 0.6);
}

/* ---------- layout ---------- */
.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  gap: var(--gutter);
  max-width: 1480px;
  margin: 0 auto;
}

.content-shell {
  display: grid;
  gap: var(--gutter);
  min-width: 0;
  align-content: start;
}

/* ---------- sidebar: oak door with iron straps ---------- */
.sidebar {
  position: sticky;
  top: calc(var(--gutter) + env(safe-area-inset-top, 0px));
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-self: start;
  padding: 20px 16px;
  border-radius: var(--radius);
  background-color: var(--oak-1);
  background-image:
    linear-gradient(180deg, transparent 0 96px, rgba(0, 0, 0, 0.55) 96px 98px, var(--iron-1) 98px 112px, rgba(0, 0, 0, 0.55) 112px 114px, transparent 114px),
    linear-gradient(180deg, rgba(255, 210, 150, 0.06), rgba(0, 0, 0, 0.45)),
    var(--oakgrain),
    var(--noise),
    linear-gradient(90deg, var(--oak-0), var(--oak-2) 50%, var(--oak-0));
  box-shadow: var(--plate-ring), var(--plate-inset);
}

.brand {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 72px;
}

.crest {
  width: 54px;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.7));
}

.brand h1 {
  color: var(--bone);
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 0.98;
  text-shadow: 0 2px 0 #000;
}

.realm-nav {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.nav-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-height: 52px;
  padding: 6px 14px 6px 8px;
  color: var(--bone-2);
  font-size: 1.02rem;
  text-align: left;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(0, 0, 0, 0.4)),
    var(--grain-light),
    linear-gradient(180deg, var(--stone-3), var(--stone-2));
}

.nav-button::before,
.nav-button::after {
  display: none;
}

.nav-button img {
  flex: none;
  width: 38px;
  height: 38px;
  padding: 3px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, var(--stone-3), var(--stone-0) 75%);
  box-shadow: inset 0 0 0 1px #000, 0 0 0 2px var(--iron-2), 0 0 0 3px #000;
}

.nav-button.is-active {
  color: var(--brass-hi);
  background-image:
    linear-gradient(90deg, rgba(224, 116, 31, 0.3), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.4)),
    var(--grain-light),
    linear-gradient(180deg, var(--iron-2), var(--iron-1));
  box-shadow:
    inset 3px 0 0 var(--ember),
    inset 0 0 0 1px rgba(0, 0, 0, 0.4),
    inset 0 0 0 3px rgba(199, 155, 69, 0.4),
    0 2px 0 #000,
    0 0 18px rgba(224, 116, 31, 0.22);
}

.nav-button.is-active img {
  box-shadow: inset 0 0 0 1px #000, 0 0 0 2px var(--brass), 0 0 0 3px #000, 0 0 12px rgba(255, 170, 80, 0.5);
}

.nav-button.is-feature-locked {
  opacity: 0.55;
}

.nav-button.is-feature-locked span::after {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-left: 6px;
  background: url("assets/icons/lock.svg") center / contain no-repeat;
  content: "";
  vertical-align: -0.1em;
}

.sidebar-foot {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 220, 160, 0.06);
}

.ghost-button {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  min-height: 38px;
  font-size: 0.9rem;
}

.sound-glyph {
  width: 14px;
  height: 14px;
  background: currentColor;
  clip-path: polygon(0 32%, 32% 32%, 70% 0, 70% 100%, 32% 68%, 0 68%);
}

.ghost-button[aria-pressed="false"] .sound-glyph {
  opacity: 0.45;
}

.sidebar-hint {
  color: var(--bone-3);
  font-family: var(--font-fell);
  font-size: 0.82rem;
  font-style: italic;
  text-align: center;
}

/* ---------- slate plates (HUD) ---------- */
.plate {
  position: relative;
  border-radius: var(--radius);
  background-color: var(--stone-2);
  background-image:
    linear-gradient(180deg, rgba(255, 240, 210, 0.05), rgba(0, 0, 0, 0.3)),
    var(--noise),
    linear-gradient(160deg, var(--stone-3), var(--stone-1));
  box-shadow: var(--plate-ring), var(--plate-inset);
}

.panel-corner {
  position: absolute;
  z-index: 2;
  width: 22px;
  height: 22px;
  pointer-events: none;
  background:
    radial-gradient(circle at 7px 7px, #e9d9a8 0 1px, var(--brass-lo) 2.2px, #000 3.2px, transparent 3.6px),
    linear-gradient(var(--iron-2), var(--iron-1)) 0 0 / 22px 8px no-repeat,
    linear-gradient(var(--iron-2), var(--iron-1)) 0 0 / 8px 22px no-repeat;
  filter: drop-shadow(0 1px 0 #000) drop-shadow(0 0 1px #000);
}

.corner-top-left {
  top: -2px;
  left: -2px;
}

.corner-top-right {
  top: -2px;
  right: -2px;
  transform: scaleX(-1);
}

.corner-bottom-left {
  bottom: -2px;
  left: -2px;
  transform: scaleY(-1);
}

.corner-bottom-right {
  right: -2px;
  bottom: -2px;
  transform: scale(-1);
}

.player-hud {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.38fr);
  gap: 16px;
}

.lord-panel {
  display: grid;
  gap: 12px;
  padding: 18px 22px 16px;
}

.lord-head {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.lord-laurel {
  width: 52px;
  filter: drop-shadow(0 2px 3px #000);
}

#rankName {
  color: var(--bone);
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.4vw, 2.7rem);
  font-weight: 700;
  line-height: 0.95;
  text-shadow: 0 2px 0 #000, 0 0 24px rgba(255, 170, 80, 0.15);
}

.level-badge {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 30%, var(--brass-hi), var(--brass) 45%, var(--brass-lo) 85%);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.5), inset 0 0 0 5px rgba(255, 240, 200, 0.25), 0 0 0 2px #000, 0 4px 10px rgba(0, 0, 0, 0.6);
  color: var(--ink);
  font-family: var(--font-sc);
  font-size: 1.45rem;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(255, 240, 200, 0.5);
}

.level-badge.is-pulsing {
  animation: badge-pulse 1.4s ease-out 2;
}

@keyframes badge-pulse {
  0% { box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.5), 0 0 0 2px #000, 0 0 0 0 rgba(255, 190, 99, 0.8); }
  100% { box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.5), 0 0 0 2px #000, 0 0 0 22px rgba(255, 190, 99, 0); }
}

/* channel of molten brass */
.rank-meter,
.vital-bar,
.quest-progress,
.battle-hp,
.build-progress {
  position: relative;
  display: block;
  height: 14px;
  overflow: hidden;
  border-radius: 2px;
  background: linear-gradient(180deg, #000, var(--stone-1));
  box-shadow: inset 0 2px 4px #000, 0 0 0 1px #000, 0 0 0 2px var(--iron-2), 0 1px 0 2px rgba(255, 255, 255, 0.05);
}

.rank-meter span,
.vital-bar i,
.quest-progress span,
.battle-hp span,
.build-progress span {
  position: absolute;
  inset: 0 auto 0 0;
  display: block;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 45%, rgba(0, 0, 0, 0.3)),
    linear-gradient(90deg, var(--brass-lo), var(--brass) 70%, var(--brass-hi));
  box-shadow: 0 0 10px rgba(240, 200, 110, 0.45);
  transition: width 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.rank-meter span::after,
.build-progress span::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 250, 220, 0.55) 50%, transparent 70%);
  background-size: 220% 100%;
  animation: shimmer 3.2s linear infinite;
  content: "";
}

@keyframes shimmer {
  from { background-position: 160% 0; }
  to { background-position: -60% 0; }
}

.small-copy {
  color: var(--bone-2);
  font-size: 0.95rem;
}

.hud-vitals {
  display: grid;
  gap: 16px;
}

.vital {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  grid-template-areas:
    "icon label value"
    "icon bar bar";
  align-items: center;
  column-gap: 12px;
  row-gap: 6px;
  padding: 12px 16px;
}

.vital .side-icon {
  grid-area: icon;
  width: 40px;
  filter: drop-shadow(0 2px 2px #000);
}

.vital > span:not(.vital-bar) {
  grid-area: label;
  color: var(--bone-2);
  font-family: var(--font-sc);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: lowercase;
}

.vital strong {
  grid-area: value;
  font-family: var(--font-sc);
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}

.vital-bar {
  grid-area: bar;
  height: 9px;
}

.energy-panel .vital-bar i {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 45%, rgba(0, 0, 0, 0.3)),
    linear-gradient(90deg, #8a3a0c, var(--ember), var(--ember-hi));
  box-shadow: 0 0 10px rgba(255, 140, 50, 0.5);
}

.hp-panel .vital-bar i {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent 45%, rgba(0, 0, 0, 0.3)),
    linear-gradient(90deg, #4a0e09, var(--blood), var(--blood-hi));
  box-shadow: 0 0 10px rgba(208, 81, 63, 0.45);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 12px;
  padding: 12px 14px;
}

.stat .resource-icon {
  grid-row: span 2;
  width: 42px;
  filter: drop-shadow(0 2px 2px #000);
  transition: transform 300ms cubic-bezier(0.3, 1.6, 0.5, 1);
}

.stat span {
  color: var(--bone-2);
  font-family: var(--font-sc);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: lowercase;
}

.stat strong {
  color: var(--bone);
  font-family: var(--font-sc);
  font-size: 1.45rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  transition: color 400ms ease, text-shadow 400ms ease;
}

.stat.is-up strong {
  color: var(--brass-hi);
  text-shadow: 0 0 14px rgba(240, 200, 110, 0.7);
}

.stat.is-down strong {
  color: var(--blood-hi);
}

.stat.is-up .resource-icon {
  transform: scale(1.18) rotate(-6deg);
}

.income-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
}

.income-panel span {
  color: var(--bone-2);
  font-family: var(--font-sc);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: lowercase;
}

.income-panel strong {
  color: var(--moss);
  font-family: var(--font-sc);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

/* tooltips */
[data-tip] {
  position: relative;
}

[data-tip]:hover::after,
[data-tip]:focus-within::after {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  z-index: 30;
  width: max-content;
  max-width: 240px;
  padding: 8px 12px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--parch), var(--parch-2));
  box-shadow: 0 0 0 1px #000, 0 10px 20px rgba(0, 0, 0, 0.6);
  color: var(--ink);
  content: attr(data-tip);
  font-family: var(--font-fell);
  font-size: 0.92rem;
  line-height: 1.3;
  transform: translateX(-50%);
  pointer-events: none;
  animation: tip-in 160ms ease-out;
}

@keyframes tip-in {
  from { opacity: 0; transform: translate(-50%, -4px); }
}

/* ---------- main hall ---------- */
.main-board {
  min-width: 0;
}

.view-panel {
  display: none;
}

.view-panel.is-active {
  display: grid;
  gap: 22px;
  animation: view-in 380ms ease-out;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
}

.feature-lock {
  display: none;
}

.view-panel.is-feature-locked > :not(.feature-lock) {
  display: none;
}

.view-panel.is-feature-locked > .feature-lock {
  display: grid;
}

.feature-lock-frame {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  min-height: 240px;
  padding: 32px;
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(135deg, transparent 0 22px, rgba(0, 0, 0, 0.25) 22px 24px),
    var(--noise),
    linear-gradient(160deg, var(--stone-3), var(--stone-0));
  box-shadow: var(--plate-ring), var(--plate-inset);
}

.feature-lock-frame h3,
.card-lock h3,
.action-lock h3 {
  margin: 4px 0 6px;
  color: var(--bone);
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.05;
}

.card-lock h3,
.action-lock h3 {
  font-size: 1.3rem;
}

.feature-lock-frame p:not(.tier-label),
.card-lock p:not(.tier-label),
.action-lock p:not(.tier-label) {
  max-width: 52ch;
  color: var(--bone-2);
  font-family: var(--font-fell);
  font-style: italic;
}

.lock-icon {
  width: 84px;
  filter: drop-shadow(0 4px 6px #000);
  animation: lock-sway 4s ease-in-out infinite;
  transform-origin: 50% 0;
}

.card-lock .lock-icon,
.action-lock .lock-icon {
  width: 56px;
}

@keyframes lock-sway {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.7);
  box-shadow: 0 1px 0 rgba(255, 220, 160, 0.06);
}

.topbar h2,
.quest-hero h2,
.vista-caption h2 {
  color: var(--bone);
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 2px 0 #000;
}

.farm-yield {
  display: grid;
  justify-items: end;
}

.farm-yield span {
  color: var(--bone-2);
  font-family: var(--font-sc);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
}

.farm-yield strong {
  color: var(--moss);
  font-family: var(--font-sc);
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- vista ---------- */
.vista-frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: var(--plate-ring);
  background: #07090d;
}

.vista {
  display: block;
  aspect-ratio: 1000 / 300;
  width: 100%;
  max-width: 100%;
}

.vista svg {
  display: block;
  width: 100%;
  height: 100%;
}

.vista-frame.is-compact .vista {
  aspect-ratio: 1000 / 260;
}

.vista-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  max-width: 460px;
  padding: 22px 26px;
  background: linear-gradient(90deg, rgba(5, 6, 8, 0.85), rgba(5, 6, 8, 0.5) 70%, transparent);
}

.vista-caption p:last-child {
  margin-top: 8px;
  color: var(--bone-2);
  font-family: var(--font-fell);
  font-style: italic;
}

.vista-legend {
  position: absolute;
  right: 14px;
  bottom: 10px;
  color: var(--bone-2);
  font-family: var(--font-fell);
  font-size: 0.9rem;
  font-style: italic;
  text-shadow: 0 1px 2px #000;
}

.vista .v-part {
  transition: opacity 600ms ease, transform 600ms ease;
}

.vista .v-hit {
  cursor: pointer;
}

.vista .v-hit:hover .v-glow,
.vista .v-hit.is-hover .v-glow {
  opacity: 1;
}

.vista .v-glow {
  opacity: 0;
  transition: opacity 200ms ease;
}

.vista .v-window {
  animation: window-flicker 5s infinite steps(1, end);
}

.vista .v-window:nth-of-type(2n) {
  animation-delay: -2.1s;
}

@keyframes window-flicker {
  0%, 100% { opacity: 1; }
  40% { opacity: 0.78; }
  44% { opacity: 1; }
  70% { opacity: 0.86; }
}

.vista .v-flag {
  transform-box: fill-box;
  transform-origin: 0 50%;
  animation: flag-wave 2.6s ease-in-out infinite;
}

@keyframes flag-wave {
  0%, 100% { transform: skewY(0deg) scaleX(1); }
  50% { transform: skewY(6deg) scaleX(0.9); }
}

.vista .v-scaffold {
  animation: scaffold 1.6s ease-in-out infinite alternate;
}

@keyframes scaffold {
  from { opacity: 0.65; }
  to { opacity: 1; }
}

.vista .v-smoke {
  animation: smoke 6s ease-in-out infinite;
}

@keyframes smoke {
  0% { transform: translate(0, 6px); opacity: 0.4; }
  50% { opacity: 1; }
  100% { transform: translate(14px, -18px); opacity: 0; }
}

.vista .v-hit:focus-visible {
  outline: none;
}

.vista .v-hit:focus-visible .v-glow {
  opacity: 1;
}

.vista .v-cloud {
  animation: drift 90s linear infinite;
}

@keyframes drift {
  from { transform: translateX(-200px); }
  to { transform: translateX(1100px); }
}

/* ---------- cards: iron-bound oak ---------- */
.actions-grid,
.farm-grid,
.settlement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 22px;
}

.actions-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 700px) {
  .actions-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.action-card,
.farm-card,
.settlement-card,
.smith-card,
.dungeon-creature,
.dungeon-complete {
  --mx: 50%;
  --my: 0%;
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  align-content: start;
  gap: 14px;
  padding: 22px 20px 18px;
  border-radius: var(--radius);
  background-color: var(--oak-1);
  background-image:
    radial-gradient(260px 200px at var(--mx) var(--my), rgba(255, 180, 90, 0.16), transparent 70%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.45) 0 10px, var(--iron-1) 10px 22px, rgba(0, 0, 0, 0.55) 22px 24px, transparent 24px),
    linear-gradient(0deg, rgba(0, 0, 0, 0.45) 0 10px, var(--iron-1) 10px 22px, rgba(0, 0, 0, 0.55) 22px 24px, transparent 24px),
    linear-gradient(180deg, rgba(255, 210, 150, 0.05), rgba(0, 0, 0, 0.5)),
    var(--oakgrain),
    var(--noise),
    linear-gradient(90deg, var(--oak-0), var(--oak-2) 48%, var(--oak-1));
  background-size: auto, 100% 24px, 100% 24px, auto, auto, 180px, auto;
  background-position: 0 0, 0 18px, 0 calc(100% - 18px), 0 0, 0 0, 0 0, 0 0;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat, repeat, no-repeat;
  box-shadow: var(--plate-ring), var(--plate-inset);
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.action-card:hover,
.farm-card:hover,
.settlement-card:hover,
.smith-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 0 0 1px #000,
    0 0 0 3px var(--iron-3),
    0 0 0 4px #000,
    0 22px 38px rgba(0, 0, 0, 0.65),
    var(--plate-inset);
}

.action-card > div:not(.action-lock):not(.card-lock):not(.herd),
.farm-card > div:not(.action-lock):not(.card-lock):not(.herd),
.settlement-card > div,
.smith-card > div {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.card-icon,
.creature-portrait img,
.smith-placeholder,
.quest-task > img,
.inventory-item > img,
.equipment-item > img {
  width: 76px;
  height: 76px;
  padding: 10px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 200, 120, 0.12), transparent 60%),
    radial-gradient(circle at 50% 35%, var(--stone-3), var(--stone-0) 72%);
  box-shadow:
    inset 0 3px 8px rgba(0, 0, 0, 0.9),
    0 0 0 2px #000,
    0 0 0 5px var(--iron-2),
    0 0 0 6px #000,
    0 0 0 7px rgba(199, 155, 69, 0.35),
    0 8px 14px rgba(0, 0, 0, 0.6);
  object-fit: contain;
  transition: transform 300ms cubic-bezier(0.3, 1.5, 0.5, 1);
}

.card-icon {
  margin: 14px 0 0 6px;
}

.action-card:hover .card-icon,
.farm-card:hover .card-icon,
.settlement-card:hover .card-icon,
.smith-card:hover .card-icon {
  transform: rotate(-8deg) scale(1.06);
}

.action-card h3,
.farm-card h3,
.settlement-card h3,
.smith-card h3,
.dungeon-creature h3,
.dungeon-complete h3,
.section-title h3 {
  color: var(--bone);
  font-family: var(--font-sc);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.1;
  text-shadow: 0 2px 0 #000;
}

.action-card p:not(.tier-label),
.farm-card p:not(.tier-label),
.settlement-card p:not(.tier-label),
.smith-card p:not(.tier-label),
.dungeon-creature p:not(.tier-label),
.dungeon-complete p:not(.tier-label) {
  color: var(--bone-2);
  font-family: var(--font-fell);
  font-size: 1.02rem;
  font-style: italic;
  line-height: 1.35;
}

dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 8px;
  margin: 0;
}

dl > div {
  min-width: 0;
  padding: 7px 10px;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.35));
  box-shadow: inset 0 1px 3px #000, 0 1px 0 rgba(255, 220, 160, 0.07);
}

dt {
  color: var(--bone-3);
  font-family: var(--font-sc);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: lowercase;
}

dd {
  margin: 0;
  color: var(--bone);
  font-family: var(--font-sc);
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.action-card > button,
.farm-card > button,
.settlement-card > button,
.smith-card > button,
.dungeon-creature > button {
  width: 100%;
  margin-bottom: 14px;
}

.action-card.is-feature-locked,
.farm-card.is-feature-locked {
  background-image:
    repeating-linear-gradient(135deg, transparent 0 22px, rgba(0, 0, 0, 0.25) 22px 24px),
    var(--noise),
    linear-gradient(160deg, var(--stone-3), var(--stone-0));
  background-size: auto;
  background-position: 0 0;
  background-repeat: repeat;
}

.action-card.is-feature-locked > :not(.panel-corner, .action-lock, button),
.farm-card.is-feature-locked > :not(.panel-corner, .card-lock, button) {
  display: none !important;
}

.action-card .action-lock,
.farm-card .card-lock {
  display: none;
}

.action-card.is-feature-locked .action-lock,
.farm-card.is-feature-locked .card-lock {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  min-height: 170px;
}

.action-card.is-feature-locked,
.farm-card.is-feature-locked {
  grid-template-rows: 1fr auto;
}

/* herd: little animals that appear as you buy */
.herd {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  min-height: 30px;
  padding: 4px 6px;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(80, 100, 40, 0.18), rgba(30, 40, 15, 0.4));
  box-shadow: inset 0 1px 3px #000;
}

.herd img {
  width: 24px;
  height: 24px;
  animation: graze 3.4s ease-in-out infinite;
  transform-origin: 50% 100%;
}

.herd img:nth-child(3n) { animation-delay: -1.1s; }
.herd img:nth-child(3n + 1) { animation-delay: -2.3s; }
.herd img.is-new { animation: herd-pop 500ms cubic-bezier(0.3, 1.8, 0.5, 1), graze 3.4s 500ms ease-in-out infinite; }

.herd .herd-more {
  align-self: center;
  margin-left: 4px;
  color: var(--bone-2);
  font-family: var(--font-sc);
  font-size: 0.85rem;
}

.herd-empty {
  align-self: center;
  color: var(--bone-3);
  font-family: var(--font-fell);
  font-size: 0.9rem;
  font-style: italic;
}

@keyframes graze {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-4deg) translateY(1px); }
}

@keyframes herd-pop {
  from { transform: scale(0) translateY(-10px); }
}

/* ---------- settlement ---------- */
.settlement-card.is-building {
  box-shadow:
    0 0 0 1px #000,
    0 0 0 3px var(--ember),
    0 0 0 4px #000,
    0 0 26px rgba(224, 116, 31, 0.35),
    var(--plate-inset);
}

.settlement-card.is-complete {
  filter: saturate(0.85);
}

.settlement-card.is-complete .card-icon {
  box-shadow:
    inset 0 3px 8px rgba(0, 0, 0, 0.9),
    0 0 0 2px #000,
    0 0 0 5px var(--brass),
    0 0 0 6px #000,
    0 8px 14px rgba(0, 0, 0, 0.6);
}

.settlement-card.is-waiting {
  opacity: 0.72;
}

.settlement-card.fx-highlight,
.farm-card.fx-highlight {
  animation: highlight 1.2s ease-out;
}

@keyframes highlight {
  0% { box-shadow: 0 0 0 1px #000, 0 0 0 3px var(--brass-hi), 0 0 0 4px #000, 0 0 40px rgba(240, 213, 138, 0.6); }
}

.build-progress {
  height: 10px;
}

.build-progress span {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 45%, rgba(0, 0, 0, 0.3)),
    repeating-linear-gradient(135deg, var(--ember) 0 8px, #a64b10 8px 16px);
}

.tier-pips {
  display: flex;
  gap: 6px;
}

.tier-pips i {
  width: 12px;
  height: 12px;
  transform: rotate(45deg);
  background: var(--stone-0);
  box-shadow: inset 0 1px 2px #000, 0 0 0 1px var(--iron-2);
}

.tier-pips i.is-on {
  background: radial-gradient(circle at 35% 30%, var(--brass-hi), var(--brass) 60%, var(--brass-lo));
  box-shadow: 0 0 0 1px #000, 0 0 6px rgba(240, 200, 110, 0.5);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* ---------- armory ---------- */
.armory-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 22px;
}

.equipment-panel,
.inventory-panel,
.smith-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 22px;
  border-radius: var(--radius);
  background:
    var(--masonry),
    var(--noise),
    linear-gradient(160deg, var(--stone-3), var(--stone-1));
  background-size: 240px 120px, 180px, auto;
  box-shadow: var(--plate-ring), var(--plate-inset);
}

.smith-panel {
  grid-column: 1 / -1;
  background:
    radial-gradient(600px 240px at 50% 110%, rgba(224, 116, 31, 0.22), transparent 70%),
    var(--masonry),
    var(--noise),
    linear-gradient(160deg, var(--stone-3), var(--stone-1));
  background-size: auto, 240px 120px, 180px, auto;
}

.section-title {
  display: grid;
  gap: 2px;
}

.equipment-grid {
  display: grid;
  gap: 12px;
}

.equipment-slot {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.25));
  box-shadow: inset 0 2px 6px #000, 0 1px 0 rgba(255, 220, 160, 0.06);
}

.equipment-slot > span {
  color: var(--bone-3);
  font-family: var(--font-sc);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: lowercase;
}

.equipment-slot.is-equipping {
  animation: equip-flash 700ms ease-out;
}

@keyframes equip-flash {
  0% { box-shadow: inset 0 2px 6px #000, 0 0 0 2px var(--brass-hi), 0 0 30px rgba(240, 213, 138, 0.6); }
}

.equipment-item,
.equipment-empty {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.equipment-empty {
  grid-template-columns: minmax(0, 1fr);
  min-height: 56px;
}

.equipment-item > img,
.inventory-item > img {
  width: 56px;
  height: 56px;
  padding: 7px;
}

.equipment-item strong,
.equipment-empty strong,
.inventory-item h4 {
  color: var(--bone);
  font-family: var(--font-sc);
  font-size: 1.08rem;
  font-weight: 800;
}

.equipment-item p,
.equipment-empty p,
.inventory-item p {
  color: var(--bone-2);
  font-size: 0.92rem;
}

.equipment-empty strong {
  color: var(--bone-3);
}

.inventory-filters,
.quest-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inventory-filter,
.quest-tab {
  min-height: 36px;
  padding: 4px 16px;
  color: var(--bone-2);
  font-size: 0.9rem;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.4)),
    linear-gradient(180deg, var(--stone-3), var(--stone-2));
}

.inventory-filter::before,
.inventory-filter::after,
.quest-tab::before,
.quest-tab::after {
  display: none;
}

.inventory-filter.is-active,
.quest-tab.is-active {
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 240, 200, 0.5);
  background-image: radial-gradient(circle at 50% 20%, var(--brass-hi), var(--brass) 55%, var(--brass-lo));
}

.inventory-list {
  display: grid;
  gap: 10px;
}

.inventory-item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.2));
  box-shadow: inset 0 1px 3px #000, 0 1px 0 rgba(255, 220, 160, 0.06);
  animation: item-in 300ms ease-out;
}

.inventory-item.is-equipped {
  box-shadow: inset 0 1px 3px #000, inset 3px 0 0 var(--brass);
}

@keyframes item-in {
  from { opacity: 0; transform: translateX(-6px); }
}

.inventory-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inventory-actions button {
  min-height: 36px;
  padding: 4px 16px;
  font-size: 0.88rem;
}

.empty-inventory {
  padding: 18px;
  color: var(--bone-3);
  font-family: var(--font-fell);
  font-style: italic;
  text-align: center;
}

.smith-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 22px;
}

.smith-card.is-owned {
  opacity: 0.8;
}

.smith-card.is-complete .card-icon {
  box-shadow:
    inset 0 3px 8px rgba(0, 0, 0, 0.9),
    0 0 0 2px #000,
    0 0 0 5px var(--brass),
    0 0 0 6px #000,
    0 8px 14px rgba(0, 0, 0, 0.6);
}

/* forging: glowing anvil and sparks */
.forge {
  position: relative;
  width: 76px;
  height: 76px;
  margin: 14px 0 0 6px;
}

.forge img {
  width: 76px;
  height: 76px;
  padding: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 70%, rgba(255, 140, 40, 0.7), #2a0e04 70%);
  box-shadow:
    inset 0 3px 8px rgba(0, 0, 0, 0.9),
    0 0 0 2px #000,
    0 0 0 5px var(--iron-2),
    0 0 0 6px #000,
    0 0 24px rgba(255, 130, 40, 0.5);
  animation: forge-glow 1.4s ease-in-out infinite alternate;
}

@keyframes forge-glow {
  to { box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.9), 0 0 0 2px #000, 0 0 0 5px var(--iron-2), 0 0 0 6px #000, 0 0 38px rgba(255, 150, 50, 0.8); }
}

.forge i {
  position: absolute;
  top: 30%;
  left: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ember-hi);
  box-shadow: 0 0 6px var(--ember);
  animation: spark 1.1s ease-out infinite;
}

.forge i:nth-child(3) { animation-delay: -0.35s; --dx: -26px; }
.forge i:nth-child(4) { animation-delay: -0.7s; --dx: 22px; }
.forge i:nth-child(5) { animation-delay: -0.9s; --dx: 8px; }

@keyframes spark {
  from { opacity: 1; transform: translate(0, 0); }
  to { opacity: 0; transform: translate(var(--dx, -12px), -34px); }
}

/* ---------- quests: notices nailed to the board ---------- */
.quest-board {
  display: grid;
  gap: 20px;
  padding: 24px;
  border-radius: var(--radius);
  background-color: var(--oak-1);
  background-image:
    linear-gradient(180deg, rgba(255, 210, 150, 0.04), rgba(0, 0, 0, 0.45)),
    repeating-linear-gradient(180deg, transparent 0 118px, rgba(0, 0, 0, 0.6) 118px 121px, rgba(255, 220, 160, 0.05) 121px 122px),
    var(--oakgrain),
    var(--noise),
    linear-gradient(90deg, var(--oak-0), var(--oak-2) 50%, var(--oak-0));
  box-shadow: var(--plate-ring), var(--plate-inset);
}

.quest-hero {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}

.quest-hero > img {
  width: 64px;
  filter: drop-shadow(0 4px 5px #000);
}

.quest-rewards {
  display: flex;
  gap: 12px;
}

.quest-rewards article {
  display: grid;
  grid-template-columns: 30px auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  padding: 8px 12px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 1px 3px #000;
}

.quest-rewards img {
  grid-row: span 2;
  width: 30px;
}

.quest-rewards strong {
  font-family: var(--font-sc);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.quest-rewards span {
  color: var(--bone-3);
  font-family: var(--font-sc);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
}

.quest-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: 22px 20px;
}

.quest-task {
  position: relative;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 14px;
  padding: 24px 18px 16px;
  border-radius: 1px;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255, 255, 255, 0.25), transparent 60%),
    radial-gradient(ellipse at 90% 100%, rgba(90, 55, 15, 0.35), transparent 55%),
    var(--noise),
    linear-gradient(170deg, var(--parch), var(--parch-2));
  background-size: auto, auto, 180px, auto;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4), 0 10px 18px rgba(0, 0, 0, 0.55);
  color: var(--ink);
  transform: rotate(var(--tilt, -0.6deg));
  transition: transform 200ms ease;
  clip-path: polygon(0 2%, 4% 0, 30% 1%, 60% 0, 97% 1%, 100% 5%, 99% 50%, 100% 96%, 96% 100%, 50% 99%, 3% 100%, 0 97%, 1% 50%);
}

.quest-task:nth-child(2n) { --tilt: 0.7deg; }
.quest-task:nth-child(3n) { --tilt: -1.1deg; }

.quest-task:hover {
  transform: rotate(0deg) translateY(-2px);
}

/* iron nail */
.quest-task::before {
  position: absolute;
  top: 7px;
  left: 50%;
  width: 11px;
  height: 11px;
  margin-left: -5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #c9cfd2, var(--iron-2) 55%, #000);
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.6);
  content: "";
}

.quest-task > img {
  width: 56px;
  height: 56px;
  padding: 6px;
  background: rgba(60, 35, 10, 0.12);
  box-shadow: inset 0 0 0 1px rgba(60, 35, 10, 0.4);
}

.quest-task-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.quest-task .tier-label {
  color: #7a2a18;
}

.quest-task h3 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1;
}

.quest-task-main > p {
  color: #4a3519;
  font-family: var(--font-fell);
  font-style: italic;
}

.quest-progress {
  height: 20px;
  background: rgba(60, 35, 10, 0.25);
  box-shadow: inset 0 1px 3px rgba(40, 20, 5, 0.6), 0 0 0 1px rgba(40, 20, 5, 0.5);
}

.quest-progress span {
  background: linear-gradient(90deg, #5a1a10, #8e2a20);
  box-shadow: none;
}

.quest-progress strong {
  position: relative;
  display: block;
  padding-right: 8px;
  color: #fff3d6;
  font-family: var(--font-sc);
  font-size: 0.85rem;
  line-height: 20px;
  text-align: right;
  text-shadow: 0 1px 1px #000, 0 0 3px #000;
}

.quest-task-reward {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(60, 35, 10, 0.4);
}

.quest-task-reward span {
  color: #3d2a10;
  font-family: var(--font-sc);
  font-size: 0.92rem;
  font-weight: 700;
}

.quest-task-reward button {
  min-height: 38px;
  font-size: 0.9rem;
}

.quest-task.is-ready {
  box-shadow: 0 0 0 2px var(--brass-hi), 0 0 26px rgba(240, 200, 110, 0.55), 0 10px 18px rgba(0, 0, 0, 0.55);
  animation: ready-pulse 2s ease-in-out infinite;
  clip-path: none;
}

@keyframes ready-pulse {
  50% { box-shadow: 0 0 0 2px var(--brass-hi), 0 0 40px rgba(240, 200, 110, 0.85), 0 10px 18px rgba(0, 0, 0, 0.55); }
}

.quest-task.is-claimed {
  filter: sepia(0.4) brightness(0.72);
}

/* red wax seal stamped onto completed notices */
.quest-task.is-claimed::after {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 58px;
  height: 58px;
  background: url("assets/icons/influence.svg") center / contain no-repeat;
  content: "";
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.6));
  transform: rotate(-14deg);
  animation: stamp 420ms cubic-bezier(0.3, 1.6, 0.5, 1);
}

@keyframes stamp {
  from { opacity: 0; transform: rotate(-30deg) scale(2.2); }
}

/* ---------- dungeon ---------- */
.dungeon-board {
  position: relative;
  padding: 26px;
  overflow: hidden;
  border-radius: var(--radius);
  background:
    radial-gradient(500px 300px at 50% 30%, rgba(80, 140, 110, 0.12), transparent 70%),
    radial-gradient(ellipse at 50% 120%, #000, transparent 60%),
    var(--masonry),
    var(--noise),
    linear-gradient(180deg, #121411, #070807);
  background-size: auto, auto, 240px 120px, 180px, auto;
  box-shadow: var(--plate-ring), inset 0 0 80px #000;
}

.dungeon-board::before,
.dungeon-board::after {
  position: absolute;
  top: 24px;
  width: 16px;
  height: 26px;
  border-radius: 50% 50% 40% 40%;
  background: radial-gradient(circle at 50% 70%, #fff6c4, var(--ember-hi) 35%, var(--ember) 70%, transparent 72%);
  box-shadow: 0 0 40px 18px rgba(255, 140, 50, 0.25);
  content: "";
  animation: torch 0.9s ease-in-out infinite alternate;
}

.dungeon-board::before { left: 22px; }
.dungeon-board::after { right: 22px; animation-delay: -0.4s; }

@keyframes torch {
  to { transform: scale(0.88, 1.08) translateY(-1px); opacity: 0.85; }
}

.dungeon-creature {
  grid-template-columns: 220px minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  column-gap: 26px;
  max-width: 900px;
  margin: 0 auto;
  background-image:
    radial-gradient(260px 200px at var(--mx) var(--my), rgba(140, 220, 180, 0.08), transparent 70%),
    var(--noise),
    linear-gradient(160deg, var(--stone-3), var(--stone-0));
  background-size: auto, 180px, auto;
  background-position: 0 0;
  background-repeat: no-repeat, repeat, no-repeat;
}

.dungeon-creature:hover {
  transform: none;
}

.creature-portrait {
  grid-row: 1 / span 3;
  display: grid;
  place-items: center;
  min-height: 240px;
  border-radius: 110px 110px 4px 4px;
  background:
    radial-gradient(circle at 50% 55%, rgba(143, 232, 192, 0.18), transparent 60%),
    radial-gradient(circle at 50% 50%, #151815, #030403 75%);
  box-shadow:
    inset 0 10px 30px #000,
    0 0 0 3px #000,
    0 0 0 9px var(--stone-4),
    0 0 0 10px #000;
}

.creature-portrait img {
  width: 150px;
  height: 150px;
  padding: 0;
  background: none;
  box-shadow: none;
  filter: drop-shadow(0 0 18px rgba(143, 232, 192, 0.25)) drop-shadow(0 8px 10px #000);
  animation: lurk 4.5s ease-in-out infinite;
}

@keyframes lurk {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.03); }
}

.creature-copy {
  display: grid;
  gap: 6px;
}

.creature-copy h3 {
  font-family: var(--font-display);
  font-size: 2.3rem;
  font-weight: 700;
}

.dungeon-creature dl {
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
}

.dungeon-creature > button {
  align-self: end;
  min-height: 52px;
  margin: 0;
  font-size: 1.1rem;
}

.depth-track {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 auto 20px;
}

.depth-track span {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, var(--stone-3), var(--stone-0) 72%);
  box-shadow: inset 0 2px 5px #000, 0 0 0 2px var(--iron-2), 0 0 0 3px #000;
  opacity: 0.4;
}

.depth-track img {
  width: 30px;
  filter: brightness(0.4);
}

.depth-track span.is-done {
  opacity: 0.75;
}

.depth-track span.is-done img {
  filter: grayscale(1) brightness(0.8);
}

.depth-track span.is-current {
  opacity: 1;
  box-shadow: inset 0 2px 5px #000, 0 0 0 2px var(--spectre), 0 0 0 3px #000, 0 0 16px rgba(143, 232, 192, 0.5);
}

.depth-track span.is-current img {
  filter: none;
}

.dungeon-complete {
  grid-template-columns: 100px minmax(0, 1fr);
  grid-template-rows: auto;
  align-items: center;
  max-width: 720px;
  margin: 0 auto;
}

.dungeon-complete img {
  width: 100px;
}

.battle-scene {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  gap: 20px;
  max-width: 1000px;
  margin: 0 auto;
}

.battle-versus {
  align-self: center;
  color: var(--blood-hi);
  font-family: var(--font-display);
  font-size: 2.6rem;
  text-shadow: 0 2px 0 #000, 0 0 18px rgba(208, 81, 63, 0.6);
}

.battle-combatant {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 20px;
  border-radius: var(--radius);
  background:
    var(--noise),
    linear-gradient(160deg, var(--stone-3), var(--stone-0));
  box-shadow: var(--plate-ring), var(--plate-inset);
  text-align: center;
}

.battle-combatant > img {
  width: 120px;
  height: 120px;
  filter: drop-shadow(0 8px 10px #000);
}

.battle-combatant.is-enemy > img {
  filter: drop-shadow(0 0 16px rgba(143, 232, 192, 0.3)) drop-shadow(0 8px 10px #000);
  animation: lurk 3.4s ease-in-out infinite;
}

.battle-combatant > div {
  display: grid;
  gap: 8px;
  width: 100%;
}

.battle-combatant h3 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
}

.battle-hp {
  height: 22px;
}

.battle-hp span {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent 45%, rgba(0, 0, 0, 0.3)),
    linear-gradient(90deg, #4a0e09, var(--blood), var(--blood-hi));
  box-shadow: 0 0 10px rgba(208, 81, 63, 0.5);
  transition: width 250ms ease-out;
}

.battle-hp strong {
  position: relative;
  display: block;
  font-family: var(--font-sc);
  font-size: 0.85rem;
  line-height: 22px;
  text-shadow: 0 1px 2px #000;
}

.battle-stat {
  color: var(--bone-2);
  font-size: 0.9rem;
}

.battle-combatant.is-shielded {
  box-shadow: var(--plate-ring), inset 0 0 0 3px rgba(150, 190, 230, 0.6), inset 0 0 40px rgba(150, 190, 230, 0.25);
}

.battle-combatant.fx-hit {
  animation: hit-shake 320ms ease-out;
}

.battle-combatant.fx-hit > img {
  filter: brightness(2.2) sepia(1) hue-rotate(-40deg) saturate(4) drop-shadow(0 8px 10px #000);
}

@keyframes hit-shake {
  20% { transform: translate(-6px, 2px) rotate(-1deg); }
  40% { transform: translate(5px, -2px) rotate(1deg); }
  60% { transform: translate(-3px, 1px); }
  80% { transform: translate(2px, 0); }
}

.slash {
  position: absolute;
  top: 30%;
  left: 50%;
  width: 150px;
  height: 6px;
  margin-left: -75px;
  border-radius: 50%;
  background: linear-gradient(90deg, transparent, #fff, var(--brass-hi), transparent);
  box-shadow: 0 0 14px #fff;
  transform: rotate(-35deg) scaleX(0);
  animation: slash 300ms ease-out forwards;
  pointer-events: none;
}

@keyframes slash {
  50% { transform: rotate(-35deg) scaleX(1); opacity: 1; }
  100% { transform: rotate(-35deg) scaleX(1.1); opacity: 0; }
}

.battle-log {
  grid-column: 1 / -1;
  display: grid;
  gap: 2px;
  padding: 12px 16px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: inset 0 1px 4px #000;
  text-align: center;
}

.battle-log strong {
  color: var(--brass);
  font-family: var(--font-sc);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
}

.battle-log span {
  font-family: var(--font-fell);
  font-style: italic;
}

.battle-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 14px;
}

.battle-actions button {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 12px;
  min-height: 72px;
  padding: 10px 18px 10px 14px;
  text-align: left;
}

.battle-actions button img {
  grid-row: span 2;
  width: 40px;
}

.battle-actions button span {
  font-size: 1.15rem;
}

.battle-actions button small {
  color: var(--bone-2);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0;
}

.battle-actions kbd {
  position: absolute;
  top: 6px;
  right: 18px;
  color: var(--bone-3);
  font-family: var(--font-sc);
  font-size: 0.75rem;
}

.battle-actions button[data-dungeon-action="attack"] {
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(0, 0, 0, 0.45)),
    var(--grain-light),
    linear-gradient(180deg, #6b1d15, #3b0c08);
}

/* ---------- modal: iron-bound decree with wax seal ---------- */
.action-modal {
  width: min(480px, calc(100vw - 32px));
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  color: var(--bone);
}

.action-modal::backdrop {
  background: radial-gradient(circle, rgba(10, 6, 3, 0.6), rgba(0, 0, 0, 0.88));
  backdrop-filter: blur(3px);
}

.action-modal[open] {
  animation: modal-in 420ms cubic-bezier(0.25, 1.4, 0.5, 1);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(-30px) scale(0.94); }
}

.modal-frame {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 58px 30px 26px;
  border-radius: var(--radius);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 190, 110, 0.15), transparent 60%),
    var(--noise),
    linear-gradient(170deg, var(--stone-3), var(--stone-1));
  box-shadow: var(--plate-ring), var(--plate-inset), 0 30px 80px #000;
  text-align: center;
}

.modal-seal {
  position: absolute;
  top: -42px;
  left: 50%;
  width: 92px;
  height: 92px;
  margin-left: -46px;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.7));
}

.action-modal[open] .modal-seal {
  animation: stamp 520ms 120ms cubic-bezier(0.3, 1.6, 0.5, 1) backwards;
}

.action-modal.is-bad .modal-seal img {
  filter: grayscale(1) brightness(0.45) contrast(1.3);
}

.action-modal h2 {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 2px 0 #000;
}

.action-modal.is-bad h2 {
  color: var(--blood-hi);
}

.modal-copy {
  max-width: 40ch;
  color: var(--bone-2);
  font-family: var(--font-fell);
  font-size: 1.08rem;
  font-style: italic;
}

.modal-rewards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 4px 0 6px;
}

.modal-rewards span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 1px 3px #000, 0 0 0 1px rgba(255, 220, 160, 0.08);
  font-family: var(--font-sc);
  font-size: 0.95rem;
  font-weight: 700;
  animation: chip-in 380ms cubic-bezier(0.3, 1.5, 0.5, 1) backwards;
}

.modal-rewards span:nth-child(2) { animation-delay: 80ms; }
.modal-rewards span:nth-child(3) { animation-delay: 160ms; }
.modal-rewards span:nth-child(4) { animation-delay: 240ms; }

@keyframes chip-in {
  from { opacity: 0; transform: translateY(8px) scale(0.8); }
}

.modal-rewards img {
  width: 22px;
  height: 22px;
}

.reward-good {
  color: var(--moss);
}

.reward-bad {
  color: var(--blood-hi);
}

.reward-neutral {
  color: var(--bone-2);
}

.action-modal button {
  min-width: 180px;
}

.confirm-modal .modal-frame {
  padding-top: 34px;
}

.confirm-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.confirm-actions button {
  min-width: 140px;
}

/* ---------- level banner ---------- */
.level-banner[hidden] {
  display: none;
}

.level-banner {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: start center;
  padding-top: 8vh;
  pointer-events: none;
}

.level-banner-cloth {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  padding: 26px 24px 64px;
  background:
    var(--noise),
    linear-gradient(90deg, rgba(0, 0, 0, 0.35), transparent 20% 80%, rgba(0, 0, 0, 0.35)),
    linear-gradient(180deg, #8e2a20, #5a140e);
  box-shadow: 0 0 0 2px #000, inset 0 0 0 4px var(--brass), inset 0 0 0 6px #000, 0 30px 60px rgba(0, 0, 0, 0.8);
  text-align: center;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 86%, 0 100%);
  transform-origin: 50% 0;
  animation: unfurl 3.6s cubic-bezier(0.2, 1, 0.3, 1) forwards;
}

.level-banner-cloth img {
  width: 64px;
}

.level-banner-cloth .eyebrow {
  color: var(--brass-hi);
}

.level-banner-cloth h2 {
  font-family: var(--font-display);
  font-size: 2.8rem;
  line-height: 1;
  text-shadow: 0 2px 0 #000;
}

.level-banner-cloth p:last-child {
  font-family: var(--font-fell);
  font-style: italic;
}

@keyframes unfurl {
  0% { transform: scaleY(0); opacity: 0; }
  14% { transform: scaleY(1.04); opacity: 1; }
  20%, 82% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(0.2); opacity: 0; }
}

/* ---------- effects ---------- */
.fx-layer {
  position: fixed;
  inset: 0;
  z-index: 70;
  overflow: hidden;
  pointer-events: none;
}

.fx-float {
  position: absolute;
  font-family: var(--font-sc);
  font-size: 1.25rem;
  font-weight: 800;
  white-space: nowrap;
  text-shadow: 0 2px 0 #000, 0 0 8px #000;
  transform: translate(-50%, -50%);
  animation: float-up 1.3s ease-out forwards;
}

.fx-float.is-good { color: var(--brass-hi); }
.fx-float.is-bad { color: var(--blood-hi); }
.fx-float.is-hit { color: #fff3d6; font-size: 1.9rem; }
.fx-float.is-crit { color: var(--ember-hi); font-size: 2.4rem; }

@keyframes float-up {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.6); }
  15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -240%) scale(1); }
}

.fx-coin {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff1b8, var(--brass) 55%, var(--brass-lo));
  box-shadow: 0 0 0 1px #000, 0 0 8px rgba(240, 200, 110, 0.6);
  animation: coin-arc var(--dur, 800ms) cubic-bezier(0.4, 0, 0.6, 1) forwards;
}

@keyframes coin-arc {
  0% { transform: translate(0, 0) scale(0.6); opacity: 1; }
  40% { transform: translate(calc(var(--dx) * 0.4), calc(var(--dy) * 0.4 - 60px)) scale(1.1); }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.5); opacity: 0.4; }
}

.fx-spark {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ember-hi);
  box-shadow: 0 0 8px var(--ember);
  animation: spark-burst 600ms ease-out forwards;
}

@keyframes spark-burst {
  to { transform: translate(var(--dx), var(--dy)); opacity: 0; }
}

.hit-flash {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  box-shadow: inset 0 0 120px rgba(160, 20, 10, 0.75);
  opacity: 0;
}

.hit-flash.is-on {
  animation: hit-flash 450ms ease-out;
}

@keyframes hit-flash {
  20% { opacity: 1; }
}

/* ---------- debug ---------- */
.debug-dock {
  position: fixed;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 50;
  display: flex;
  gap: 6px;
  opacity: 0.45;
  transition: opacity 200ms ease;
}

.debug-dock:hover,
.debug-dock:focus-within {
  opacity: 1;
}

.debug-button {
  min-height: 30px;
  padding: 2px 10px;
  color: var(--bone-2);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.debug-button::before,
.debug-button::after {
  display: none;
}

.debug-button.is-active {
  color: var(--ink);
  background-image: linear-gradient(180deg, var(--ember-hi), var(--ember));
}

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: relative;
    top: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    background-image:
      linear-gradient(180deg, rgba(255, 210, 150, 0.06), rgba(0, 0, 0, 0.45)),
      var(--oakgrain),
      var(--noise),
      linear-gradient(90deg, var(--oak-0), var(--oak-2) 50%, var(--oak-0));
  }

  .realm-nav {
    grid-column: 1 / -1;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin: 0;
  }

  .nav-button {
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    font-size: 0.85rem;
    text-align: center;
  }

  .sidebar-foot {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .sidebar-hint {
    display: none;
  }

  .player-hud {
    grid-template-columns: minmax(0, 1fr);
  }

  .hud-vitals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  body {
    font-size: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .armory-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .realm-nav {
    display: flex;
    overflow-x: auto;
    padding: 4px 4px 8px;
    scroll-snap-type: x mandatory;
  }

  .nav-button {
    flex: 0 0 96px;
    scroll-snap-align: start;
  }

  .dungeon-creature {
    grid-template-columns: minmax(0, 1fr);
  }

  .creature-portrait {
    grid-row: auto;
    min-height: 200px;
  }

  .battle-scene {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .battle-versus {
    display: none;
  }

  .battle-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .quest-hero {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .quest-rewards {
    grid-column: 1 / -1;
  }

  .vista-caption {
    position: static;
    max-width: none;
    background: var(--stone-1);
  }

  .vista-legend {
    display: none;
  }
}

@media (max-width: 520px) {
  .brand h1 {
    font-size: 1.3rem;
  }

  .ghost-button #soundLabel {
    display: none;
  }

  .hud-vitals {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat {
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 10px;
  }

  .stat .resource-icon {
    width: 34px;
  }

  .stat strong {
    font-size: 1.2rem;
  }

  .lord-head {
    grid-template-columns: 40px minmax(0, 1fr) auto;
  }

  .lord-laurel {
    width: 40px;
  }

  .battle-scene {
    grid-template-columns: minmax(0, 1fr);
  }

  .feature-lock-frame {
    grid-template-columns: minmax(0, 1fr);
    padding: 24px;
  }

  .inventory-item {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .inventory-actions {
    grid-column: 1 / -1;
  }

  .dungeon-board {
    padding: 18px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }

  .embers {
    display: none;
  }
}

.settlement-card dl > div:last-child,
.dungeon-creature dl > div:last-child {
  grid-column: 1 / -1;
}

@media (max-width: 860px) {
  .vista,
  .vista-frame.is-compact .vista {
    aspect-ratio: 16 / 9;
  }
}

/* ---------- de weide ---------- */
.vista-frame.is-farm .vista {
  aspect-ratio: 1000 / 240;
}

@media (max-width: 860px) {
  .vista-frame.is-farm .vista {
    aspect-ratio: 4 / 3;
  }
}

.vista .f-label {
  fill: #f0d58a;
  font-family: var(--font-sc);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  paint-order: stroke;
  stroke: #000;
  stroke-width: 3px;
}

.vista .f-sign,
.vista .f-empty,
.vista .f-count {
  fill: #eadcbb;
  font-family: var(--font-fell);
  font-size: 14px;
  font-style: italic;
  paint-order: stroke;
  stroke: #000;
  stroke-width: 3px;
}

.vista .f-empty {
  fill: #b9aa88;
  opacity: 0.8;
}

.vista .f-animal {
  cursor: pointer;
}

.vista .f-walk {
  transform-box: fill-box;
  animation: wander 10s ease-in-out infinite;
}

@keyframes wander {
  0%, 8% { transform: translateX(0); }
  46%, 54% { transform: translateX(var(--range, 20px)); }
  92%, 100% { transform: translateX(0); }
}

.vista .f-face {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}

.vista .f-body {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: graze 3.4s ease-in-out infinite;
}

.vista .f-body.is-pecking {
  animation: peck 1.6s ease-in-out infinite;
}

@keyframes peck {
  0%, 60%, 100% { transform: rotate(0deg); }
  70% { transform: rotate(14deg) translateY(2px); }
  80% { transform: rotate(0deg); }
  88% { transform: rotate(12deg) translateY(2px); }
}

.vista .f-face.fx-hop .f-body {
  animation: hop 520ms cubic-bezier(0.3, 1.6, 0.5, 1);
}

@keyframes hop {
  40% { transform: translateY(-14px) rotate(-6deg); }
}

.vista .f-animal.is-new .f-face {
  animation: drop-in 700ms cubic-bezier(0.3, 1.6, 0.5, 1);
}

@keyframes drop-in {
  from { opacity: 0; transform: translateY(-60px) scale(0.6); }
}

.vista .f-zone:hover .f-label,
.vista .f-zone.is-hover .f-label {
  fill: #fff0c9;
}
