:root {
  color-scheme: light;
  --forest-900: #18391f;
  --forest-800: #24492c;
  --forest-700: #315f38;
  --forest-600: #507b51;
  --forest-100: #e9efe2;
  --forest-050: #f3f5ed;
  --sage: #91a584;
  --sage-soft: #dfe7d5;
  --paper: #fffdf7;
  --paper-warm: #f5eedf;
  --paper-deep: #eadfc8;
  --ink: #2d3029;
  --ink-soft: #62645b;
  --wood: #795434;
  --wood-dark: #543a26;
  --honey: #b9914f;
  --honey-soft: #e8d5a7;
  --line: #d8c9aa;
  --danger: #8f4034;
  --shadow: 0 22px 60px rgba(69, 53, 31, 0.12);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--paper-warm);
  color: var(--ink);
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 5%, rgba(255, 255, 255, 0.88), transparent 24rem),
    radial-gradient(circle at 88% 12%, rgba(126, 151, 101, 0.14), transparent 27rem),
    linear-gradient(155deg, #f7f0e1 0%, #f1efe3 52%, #e7eddf 100%);
  color: var(--ink);
}

body::before,
body::after {
  position: fixed;
  z-index: -1;
  width: 22rem;
  height: 22rem;
  border: 1px solid rgba(53, 98, 58, 0.08);
  border-radius: 45% 55% 48% 52%;
  content: "";
  pointer-events: none;
  transform: rotate(22deg);
}

body::before { top: -10rem; left: -9rem; }
body::after { right: -10rem; bottom: -11rem; transform: rotate(68deg); }

button,
input,
select,
textarea { font: inherit; }

button {
  min-height: 42px;
  padding: 9px 17px;
  border: 1px solid var(--forest-700);
  border-radius: 9px;
  background: var(--forest-700);
  color: #fff;
  cursor: pointer;
  font-weight: 680;
  line-height: 1.2;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

button:hover:not(:disabled),
button:focus-visible:not(:disabled) {
  border-color: var(--forest-900);
  background: var(--forest-900);
  color: #fff;
}

button:active:not(:disabled) {
  border-color: var(--wood-dark);
  background: var(--wood-dark);
  color: #fff;
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(197, 154, 72, 0.48);
  outline-offset: 3px;
}

button.secondary {
  border-color: var(--forest-700);
  background: rgba(255, 253, 246, 0.74);
  color: var(--forest-900);
}

button.secondary:hover:not(:disabled),
button.secondary:focus-visible:not(:disabled) {
  border-color: var(--forest-800);
  background: var(--forest-800);
  color: #fff;
}

button.secondary:active:not(:disabled) {
  border-color: var(--forest-900);
  background: var(--forest-900);
  color: #fff;
}

button:disabled,
input:disabled {
  border-color: #bbb9aa;
  background: #e5e3d9;
  color: #77786f;
  cursor: not-allowed;
  opacity: 0.72;
}

input {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid #bdb49f;
  border-radius: 8px;
  background: rgba(255, 254, 249, 0.94);
  color: var(--ink);
}

select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #bdb49f;
  border-radius: 8px;
  background: rgba(255, 254, 249, 0.94);
  color: var(--ink);
}

textarea { min-height: 118px; resize: vertical; }

label {
  display: block;
  margin-bottom: 7px;
  color: #4d5147;
  font-size: 0.9rem;
  font-weight: 650;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--forest-900);
}

.shell {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.eyebrow {
  margin: 0;
  color: var(--forest-600);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.message {
  min-height: 1.35em;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 0.9rem;
  line-height: 1.45;
}

.message.success { color: var(--forest-700); }

/* Login and one-time identity */

.login-screen {
  display: grid;
  min-height: calc(100vh - 70px);
  place-items: center;
}

.max-launch-screen {
  display: grid;
  min-height: calc(100vh - 70px);
  place-items: center;
  text-align: center;
}

.max-client .max-launch-screen,
.max-client .identity-setup-screen,
.max-client .login-screen {
  min-height: calc(var(--max-viewport-height, 100vh) - 70px);
}

.identity-setup-screen {
  display: grid;
  min-height: calc(100vh - 70px);
  place-items: center;
}

.identity-setup-card {
  width: min(540px, 100%);
  padding: clamp(25px, 6vw, 46px);
  border: 1px solid rgba(185, 145, 79, 0.5);
  border-radius: 6px 28px 6px 28px;
  background: rgba(255, 253, 247, 0.94);
  box-shadow: var(--shadow);
}

.identity-setup-card h1 { margin: 7px 0 12px; font-size: clamp(2rem, 7vw, 3rem); }
.identity-setup-card > p:not(.eyebrow, .message) { color: var(--ink-soft); line-height: 1.6; }
.identity-setup-form { display: grid; gap: 20px; margin-top: 25px; }
.identity-sex-options { display: grid; gap: 10px; margin: 0; padding: 0; border: 0; }
.identity-sex-options legend { margin-bottom: 9px; color: #4d5147; font-size: .9rem; font-weight: 650; }
.identity-sex-options label { display: flex; align-items: center; gap: 9px; min-height: 44px; margin: 0; }
.identity-sex-options input { width: 20px; min-height: 20px; margin: 0; }
.identity-one-time-warning { margin: 0; padding: 12px 14px; border-left: 3px solid var(--honey); background: var(--honey-soft); line-height: 1.5; }
.identity-name-hint { display: block; margin-top: 7px; color: var(--ink-soft); line-height: 1.45; }
.identity-rules-note { margin: 0; color: var(--ink-soft); font-size: .9rem; }
.link-button { display: inline; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--forest-700); font-weight: 750; text-decoration: underline; }
.link-button:hover:not(:disabled), .link-button:focus-visible:not(:disabled), .link-button:active:not(:disabled) { border: 0; background: transparent; color: var(--forest-900); transform: none; }

.login-card {
  position: relative;
  width: min(760px, 100%);
  overflow: hidden;
  border: 1px solid rgba(172, 136, 73, 0.36);
  border-radius: 5px 30px 5px 30px;
  background:
    linear-gradient(rgba(255, 253, 247, 0.97), rgba(255, 253, 247, 0.97)),
    repeating-linear-gradient(0deg, transparent 0 5px, rgba(121, 84, 52, 0.025) 5px 6px);
  box-shadow: var(--shadow);
}

.login-header {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 22px clamp(22px, 5vw, 38px);
  border-bottom: 1px solid rgba(185, 145, 79, 0.3);
  background: rgba(255, 252, 243, 0.7);
  box-shadow: 0 5px 16px rgba(66, 51, 31, 0.045);
}

.login-emblem {
  width: 58px;
  height: 58px;
}

.login-heading { min-width: 0; }

.login-card h1 {
  margin: 5px 0 0;
  font-size: clamp(2rem, 5.4vw, 3.35rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1;
}

.login-content {
  position: relative;
  width: min(560px, 100%);
  margin: 0 auto;
  padding: clamp(34px, 7vw, 60px) clamp(24px, 7vw, 54px) 18px;
}

.login-lead {
  max-width: 40ch;
  margin: 0 auto;
  color: var(--ink-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.03rem, 2.4vw, 1.16rem);
  line-height: 1.7;
  text-align: center;
}

.login-divider { margin: 28px 0 25px; }
.login-form { display: grid; gap: 17px; }
.login-submit { margin-top: 5px; }
.field { display: grid; }

.login-landscape.scene-landscape {
  width: 100%;
  max-height: none;
  margin: 0;
}

.login-landscape .landscape-haze { fill: url(#login-landscape-ground-fill); }
.login-landscape .hut-roof,
.login-landscape .hut-gable { fill: url(#login-landscape-roof-fill); }

/* Game shell */

.workspace {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(172, 136, 73, 0.36);
  border-radius: 5px 30px 5px 30px;
  background:
    linear-gradient(rgba(255, 253, 247, 0.97), rgba(255, 253, 247, 0.97)),
    repeating-linear-gradient(0deg, transparent 0 5px, rgba(121, 84, 52, 0.025) 5px 6px);
  box-shadow: var(--shadow);
}

.game-header {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto auto;
  gap: 18px;
  align-items: center;
  padding: 18px clamp(18px, 3vw, 32px);
  border: 0;
  border-bottom: 1px solid rgba(185, 145, 79, 0.3);
  border-radius: 0;
  background: rgba(255, 252, 243, 0.7);
  box-shadow: 0 5px 16px rgba(66, 51, 31, 0.045);
}

.game-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.game-brand h1 { margin: 2px 0 0; font-size: clamp(1.55rem, 3vw, 2.15rem); font-weight: 500; letter-spacing: -0.03em; line-height: 1; }

.brand-emblem {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  overflow: visible;
}
.brand-emblem-ring { fill: none; stroke: var(--honey); stroke-width: 1.05; stroke-dasharray: 1.5 2.4; }
.brand-emblem-field { fill: var(--forest-900); stroke: rgba(185, 145, 79, 0.9); stroke-width: 1; }
.brand-emblem-branch, .brand-emblem-ground { fill: none; stroke: #f4ead0; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.35; }
.brand-emblem-leaves { fill: #e9e6c9; stroke: rgba(255, 253, 247, 0.5); stroke-width: .45; }
.player-vitals { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }

.vital {
  padding: 6px 9px;
  border: 1px solid #ddd2bb;
  border-radius: 6px;
  background: rgba(245, 238, 223, 0.7);
  color: var(--ink-soft);
  font-size: 0.78rem;
  white-space: nowrap;
}

.vital strong { color: var(--forest-900); }
.vital-health { position: relative; overflow: hidden; padding-bottom: 9px; }
.vital-health > span { color: #a64d3d; }
.vital-health::after {
  position: absolute;
  right: 8px;
  bottom: 4px;
  left: 8px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #a64d3d var(--health-percent, 0%), #dfd5c2 var(--health-percent, 0%));
  content: "";
}
/* Main player HP only: leave scene/combat health-meter components unchanged. */
.player-vitals .vital-health { min-width: 140px; max-width: 100%; padding-bottom: 14px; text-align: center; }
.player-vitals .vital-health::after { height: 6px; }
.logout-button { min-height: 38px; padding: 7px 13px; }
.max-client .game-brand .brand-emblem { display: none; }
.max-client .game-brand h1 {
  overflow-wrap: anywhere;
  font-size: clamp(1.35rem, 5.8vw, 2rem);
  line-height: 1.1;
}
.max-client .logout-button { display: none !important; }

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: start;
}

.scene-card,
.side-card {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.scene-card {
  grid-row: 2;
  position: relative;
  min-height: 560px;
  padding: clamp(38px, 6vw, 72px) clamp(24px, 8vw, 92px) 0;
  overflow: hidden;
  border-radius: 0;
}

.game-output { min-height: 100%; }
.game-status { margin: 0; color: var(--ink-soft); font-family: Georgia, serif; font-size: 1.05rem; line-height: 1.7; }
.game-scene { display: grid; gap: 20px; }

.region-label {
  display: flex;
  gap: 9px;
  align-items: center;
  margin: 0;
  color: var(--forest-600);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}
.region-label svg {
  width: 19px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.location-heading { display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.location-title { max-width: 16ch; margin: 0; font-size: clamp(2.75rem, 5.2vw, 4.5rem); font-weight: 500; letter-spacing: -0.05em; line-height: 0.95; text-wrap: balance; }
.location-title::after {
  display: inline-block;
  width: clamp(38px, 7vw, 64px);
  height: 1px;
  margin: 0 0 0.22em 14px;
  background: linear-gradient(90deg, var(--honey), transparent);
  content: "";
  vertical-align: middle;
}
.look-around-button { display: inline-flex; flex: 0 0 auto; gap: 8px; align-items: center; min-height: 44px; padding: 8px 14px; border-color: rgba(185, 145, 79, 0.68); background: rgba(255, 253, 247, 0.82); }
.look-around-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.45; }

.location-description {
  max-width: 68ch;
  margin: 10px 0 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #45473f;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.04rem, 2vw, 1.16rem);
  line-height: 1.9;
}

.scene-event {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 7px 12px;
  border: 1px solid #c8d5b8;
  border-radius: 999px;
  background: #edf2e5;
  color: var(--forest-800);
  font-size: 0.88rem;
  font-weight: 700;
}
.scene-event::before {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 100% 0 100% 0;
  background: var(--forest-600);
  content: "";
  transform: rotate(-25deg);
}
.scene-event-danger { border-color: rgba(143, 64, 52, 0.34); background: #f4e8dd; color: #71382f; }
.scene-event-danger::before { background: var(--danger); }

.objects-section,
.exits-section {
  position: relative;
  margin-top: 12px;
  padding-top: 16px;
}
.botanical-divider {
  display: grid;
  grid-template-columns: 1fr 76px 1fr;
  gap: 12px;
  align-items: center;
  margin: 2px 0 26px;
  position: relative;
}
.botanical-divider span { height: 1px; background: linear-gradient(90deg, transparent, rgba(197, 154, 72, 0.58)); }
.botanical-divider span:last-child { background: linear-gradient(90deg, rgba(197, 154, 72, 0.58), transparent); }
.botanical-divider svg { display: block; width: 76px; height: 24px; overflow: visible; }
.divider-stem { fill: none; stroke: rgba(185, 145, 79, 0.74); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1; }
.divider-leaf { fill: rgba(145, 165, 132, 0.28); stroke: rgba(80, 123, 81, 0.62); stroke-width: .7; }
.botanical-divider circle { fill: var(--paper); stroke: rgba(185, 145, 79, 0.84); stroke-width: 1; }

.objects-section h3,
.exits-section h3 {
  margin: 0 0 18px;
  font-size: clamp(1.55rem, 3vw, 2.1rem);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.world-objects { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 14px; }

/* Inline resources only; existing entity cards and player panels stay unchanged. */
.resources-section { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.resources-section h3 { margin: 0 0 12px; color: var(--forest-900); font-family: Georgia, serif; font-size: 1.35rem; font-weight: 500; }
.resource-rows { display: grid; gap: 8px; }
.resource-row { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px 3px 9px 3px; background: var(--paper); }
.resource-label { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; color: var(--forest-900); font-family: Georgia, serif; }
.resource-name { min-width: 0; overflow-wrap: anywhere; }
.resource-quantity { white-space: nowrap; color: var(--ink-soft); }
.resource-collect { flex: 0 0 auto; min-height: 44px; padding: 8px 12px; }
.ground-items-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.ground-items-section h3 { margin: 0 0 10px; color: var(--forest-900); font-family: Georgia, serif; font-size: 1.2rem; font-weight: 500; }
.ground-item-rows { display: grid; gap: 8px; }
.ground-item-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px 3px 8px 3px; background: var(--paper); }
.ground-item-label { display: flex; align-items: center; gap: 7px; min-width: 0; }
.ground-item-label .item-icon { flex: 0 0 auto; }
.ground-item-quantity { color: var(--wood); font-weight: 700; }

.world-object-card {
  position: relative;
  min-width: 0;
  padding: 0;
  border: 1px solid rgba(185, 145, 79, 0.45);
  border-radius: 5px 18px 5px 18px;
  background: rgba(255, 254, 249, 0.76);
  overflow: hidden;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.world-object-card::before {
  position: absolute; top: 0; left: 22px; width: 54px; height: 2px;
  background: linear-gradient(90deg, var(--honey), rgba(185, 145, 79, 0.08));
  content: "";
}

.scene-entity-npc { border-color: rgba(185, 145, 79, 0.54); background: rgba(255, 252, 242, 0.82); }
.scene-entity-object { border-color: rgba(185, 145, 79, 0.38); background: rgba(255, 254, 249, 0.76); }
.mob-card { border-color: rgba(130, 150, 111, 0.52); background: rgba(246, 248, 237, 0.82); }
.scene-entity-corpse { border-color: rgba(145, 132, 111, 0.45); background: rgba(246, 242, 232, 0.78); }
.player-presence-card { border-color: rgba(145, 165, 132, 0.52); background: rgba(247, 250, 241, 0.8); }
.scene-entity-card.scene-entity-selected { border-color: var(--forest-700); box-shadow: 0 10px 24px rgba(36, 75, 43, 0.16); transform: translateY(-1px); }
.scene-entity-card.scene-entity-selected::before { width: 74px; height: 2px; background: linear-gradient(90deg, var(--forest-600), rgba(80, 123, 81, 0.1)); }
.scene-entity-summary {
  display: grid;
  width: 100%;
  min-height: 0;
  padding: 23px 24px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.scene-entity-interactive .scene-entity-summary:hover:not(:disabled),
.scene-entity-interactive .scene-entity-summary:focus-visible:not(:disabled) { border-color: transparent; background: rgba(232, 239, 225, 0.82); color: var(--ink); }
.scene-entity-interactive .scene-entity-summary:active:not(:disabled) { border-color: transparent; background: var(--forest-100); color: var(--ink); transform: none; }
.scene-entity-summary:disabled { border-color: transparent; background: transparent; color: var(--ink); cursor: default; opacity: 1; }
.scene-entity-selected .scene-entity-summary { background: rgba(232, 239, 225, 0.68); }
.scene-entity-heading { display: flex; gap: 11px; align-items: center; min-width: 0; }
.scene-entity-icon { width: 28px; height: 28px; flex: 0 0 28px; fill: none; stroke: var(--forest-600); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.35; }
.item-icon, .resource-icon { width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: var(--forest-600); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.5; }
.item-icon-weapon { stroke: var(--wood-dark); }
.item-icon-equipment { stroke: var(--forest-800); }
.item-icon-consumable { stroke: #8b5f45; }
.item-icon-plant, .resource-icon { stroke: var(--forest-600); }
.item-icon-hide { stroke: #78624d; }
.item-icon-meat { stroke: #945d54; }
.item-icon-material { stroke: #81715e; }
.item-heading, .item-inline-label { display: flex; align-items: center; gap: 7px; min-width: 0; }
.item-heading > span, .item-inline-label > span { min-width: 0; overflow-wrap: anywhere; }
.scene-entity-mob .scene-entity-icon { stroke: var(--wood); }
.scene-entity-corpse .scene-entity-icon { stroke: #81715e; }
.scene-entity-player .scene-entity-icon { stroke: var(--honey); }
.world-object-name { display: block; min-width: 0; margin: 0; color: var(--forest-900); font-family: Georgia, serif; font-size: clamp(1.3rem, 2.5vw, 1.65rem); font-weight: 600; overflow-wrap: anywhere; }
.world-object-description { display: block; margin: 8px 0 0; color: var(--ink-soft); font-weight: 400; line-height: 1.58; }
.health-meter { display: block; width: min(260px, 100%); height: 7px; margin-top: 10px; overflow: hidden; border: 1px solid rgba(84, 58, 38, 0.18); border-radius: 999px; background: #e4decf; }
.health-meter-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #9b493d, #bd6651); }
.scene-context-actions { position: relative; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 15px 17px 17px; border-top: 1px solid rgba(53, 98, 58, 0.2); background: rgba(255, 253, 246, 0.72); }
.player-presence-card .scene-context-actions { grid-template-columns: 1fr; }
.player-presence-card .scene-context-actions:not([hidden]) { display: grid; }
.player-presence-card .scene-context-action { width: 100%; justify-content: flex-start; }
.player-info-panel { display: grid; gap: 7px; padding-top: 10px; border-top: 1px solid var(--line); }
.player-info-panel h5,
.player-info-panel p { margin: 0; }
.player-info-panel p { color: var(--ink-soft); font-size: 0.88rem; }
.player-info-close { justify-self: start; min-height: 44px; }
.scene-action-unavailable { margin: -2px 2px 4px; color: var(--ink-soft); font-size: 0.8rem; }
.scene-context-actions::before { position: absolute; top: -2px; left: 17px; width: 42px; height: 3px; border-radius: 99px; background: var(--honey); content: ""; }
.quest-marker { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 1.35em; height: 1.35em; border: 1px solid var(--honey); border-radius: 50%; background: var(--honey-soft); color: var(--wood-dark); font-family: Georgia, serif; font-size: 1rem; font-weight: 700; line-height: 1; }
.quest-list { flex: 1 1 100%; display: grid; gap: 14px; min-width: 0; }
.quest-card { display: grid; gap: 8px; min-width: 0; padding-top: 12px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.quest-title { margin: 0; color: var(--forest-900); font-family: Georgia, serif; font-size: 1.12rem; line-height: 1.35; }
.quest-status { margin: 0; color: var(--forest-700); font-size: 0.8rem; font-weight: 600; }
.quest-description { margin: 0; color: var(--ink-soft); font-family: Georgia, serif; line-height: 1.6; }
.quest-objectives { display: grid; gap: 5px; margin: 0; padding-left: 18px; color: var(--ink); font-size: 0.9rem; line-height: 1.5; }
.quest-objectives li { padding-left: 2px; }
.quest-objectives li .item-icon { display: inline-block; margin-right: 5px; vertical-align: -5px; }
.quest-rewards, .quest-turn-in-hint { margin: 0; color: var(--wood); font-size: 0.84rem; line-height: 1.6; }
.quest-rewards { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 10px; }
.quest-action { justify-self: start; max-width: 100%; min-height: 44px; }
.world-object-action { min-height: 36px; padding: 7px 12px; font-size: 0.84rem; }
.scene-context-action { display: inline-flex; align-items: center; gap: 7px; }
.scene-action-icon { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.world-object-action:not(:disabled) {
  border-color: var(--forest-700);
  background: #f5f5e9;
  color: var(--forest-900);
}

.world-object-action:hover:not(:disabled),
.world-object-action:focus-visible:not(:disabled) { border-color: var(--forest-700); background: var(--forest-700); color: #fff; }
.world-object-action:active:not(:disabled) { border-color: var(--forest-900); background: var(--forest-900); color: #fff; }
.world-object-action:disabled { border-color: #c4c2b4; background: #e8e6dc; color: #797a71; cursor: default; opacity: 0.78; }

.scene-entity-card > .dialogue-panel,
.scene-entity-card > .shop-panel { margin: 0 17px 17px; }

.exit-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(310px, 100%), 1fr)); gap: 13px; }
.exit-button { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 5px 13px; min-width: 0; min-height: 82px; padding: 15px 46px 15px 18px; border-color: var(--forest-800); border-radius: 6px 16px 6px 16px; background: linear-gradient(145deg, #37663d, #1d4325); text-align: left; box-shadow: 0 8px 18px rgba(24, 57, 31, 0.16); }
.exit-button::after { position: absolute; top: 50%; right: 15px; color: rgba(255, 255, 255, 0.72); content: "›"; font-family: Georgia, serif; font-size: 1.45rem; transform: translateY(-52%); }
.exit-icon { grid-row: 1 / 3; align-self: center; width: 25px; height: 25px; fill: none; stroke: rgba(255, 255, 255, 0.82); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.45; }
.exit-label { grid-column: 2 / -1; font-family: Georgia, serif; font-size: 1.12rem; line-height: 1.22; }
.exit-target { grid-column: 2; min-width: 0; color: rgba(255, 255, 255, 0.75); font-size: 0.8rem; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.exit-noise { align-self: end; color: #f6dc94; font-size: 0.73rem; font-weight: 800; letter-spacing: 0.03em; line-height: 1.3; }
.no-exits { margin: 0; padding: 11px 14px; border-left: 3px solid var(--forest-600); background: var(--forest-050); color: var(--ink-soft); }

.scene-landscape { display: block; width: calc(100% + clamp(48px, 16vw, 184px)); height: auto; max-height: 190px; margin: 34px calc(clamp(24px, 8vw, 92px) * -1) 0; pointer-events: none; }
.landscape-haze { fill: url(#landscape-ground-fill); }
.birch-crown { fill: rgba(145, 165, 132, 0.15); stroke: rgba(92, 126, 82, 0.13); stroke-width: 1; }
.birch-trunk { fill: rgba(217, 218, 190, 0.28); stroke: rgba(114, 132, 91, 0.2); stroke-width: 1; }
.birch-mark { fill: none; stroke: rgba(89, 104, 72, 0.22); stroke-linecap: round; stroke-width: 1.4; }
.hut-wall { fill: rgba(189, 164, 111, 0.18); stroke: rgba(128, 101, 59, 0.2); stroke-width: 1; }
.hut-roof, .hut-gable { fill: url(#landscape-roof-fill); stroke: rgba(110, 88, 51, 0.22); stroke-linejoin: round; stroke-width: 1; }
.hut-door { fill: rgba(91, 112, 74, 0.18); }
.hut-window { fill: rgba(205, 165, 82, 0.28); stroke: rgba(128, 101, 59, 0.2); stroke-width: .8; }
.hut-frame, .hut-smoke { fill: none; stroke: rgba(105, 88, 58, 0.25); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.2; }
.landscape-meadow { fill: rgba(108, 135, 92, 0.1); }
.landscape-plants { fill: none; stroke: rgba(81, 119, 74, 0.27); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.5; }
.landscape-flowers { fill: rgba(190, 153, 79, 0.2); stroke: rgba(139, 108, 56, 0.17); stroke-width: .7; }

/* Sidebar and technical player access */

.player-sidebar { grid-row: 1; position: static; display: grid; padding: 0 clamp(18px, 3vw, 32px); border-bottom: 1px solid rgba(185, 145, 79, 0.2); background: rgba(247, 242, 229, 0.52); }
.game-scene > .player-sidebar { grid-row: auto; }
.side-card { padding: 12px 0; border-radius: 0; }
.player-card { display: flex; gap: 18px; align-items: center; justify-content: space-between; margin: 0; }
.player-card > strong { color: var(--forest-900); font-family: Georgia, serif; font-size: 1.22rem; }
.player-card > span { color: var(--ink-soft); font-size: 0.78rem; }
.quick-action-bar { flex: 1 1 420px; min-width: 0; }
.quick-action-bar-title { display: block; margin-bottom: 5px; color: var(--forest-800); font-size: .78rem; font-weight: 800; }
.quick-action-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.runtime-quick-action { display: grid; gap: 2px; min-width: 0; min-height: 44px; padding: 6px 8px; text-align: left; }
.runtime-quick-action strong, .runtime-quick-action small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.runtime-quick-action small { font-size: .72rem; font-weight: 500; }
.quick-actions { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0; }
.quick-actions button { min-width: 0; padding-inline: 10px; }

/* Dialogue and shop */

.dialogue-panel,
.shop-panel { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.dialogue-text { margin: 4px 0 0; color: #3f4139; font-family: Georgia, serif; font-size: 1.06rem; line-height: 1.72; }
.dialogue-text:not(:empty)::before { color: var(--honey); content: "— "; }
.dialogue-choices { display: grid; gap: 9px; margin-top: 16px; }
.dialogue-choice { min-height: 44px; padding: 10px 14px; border-color: var(--forest-700); background: var(--paper); color: var(--forest-900); text-align: left; }
.dialogue-choice:hover:not(:disabled), .dialogue-choice:focus-visible:not(:disabled) { border-color: var(--forest-700); background: var(--forest-700); color: #fff; }
.dialogue-choice:active:not(:disabled) { border-color: var(--forest-900); background: var(--forest-900); color: #fff; }
.dialogue-choice:disabled { border-color: #bdbbac; background: #e6e4da; color: #71736b; opacity: 0.78; }

.shop-mode-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin-bottom: 13px; padding: 4px; border: 1px solid #d7cfba; border-radius: 10px; background: rgba(232, 239, 225, 0.72); }
button.shop-mode-tab { min-width: 0; min-height: 44px; padding: 8px 14px; border-color: transparent; background: transparent; color: var(--forest-900); }
button.shop-mode-tab:hover:not(:disabled), button.shop-mode-tab:focus-visible:not(:disabled) { border-color: var(--forest-700); background: var(--forest-100); color: var(--forest-900); }
button.shop-mode-tab[aria-selected="true"] { border-color: var(--forest-700); background: var(--forest-700); color: #fff; box-shadow: 0 3px 9px rgba(36, 75, 43, 0.18); }
button.shop-mode-tab[aria-selected="true"]:hover:not(:disabled), button.shop-mode-tab[aria-selected="true"]:focus-visible:not(:disabled) { border-color: var(--forest-900); background: var(--forest-900); color: #fff; }
button.shop-mode-tab:active:not(:disabled) { border-color: var(--forest-900); background: var(--forest-900); color: #fff; }
button.shop-mode-tab:disabled { border-color: transparent; background: transparent; color: #85877e; cursor: default; opacity: 0.72; }
.shop-mode-content { display: grid; gap: 10px; }
.shop-mode-content[hidden] { display: none; }
.shop-coins { margin: 0; color: var(--wood); font-weight: 800; }
.shop-capacity, .inventory-capacity { margin: 0; color: var(--forest-800); font-size: 0.9rem; font-weight: 700; }
.shop-message { min-height: 1.35em; margin: 8px 0; color: var(--danger); }
.shop-section-title { margin: 12px 0 7px; color: var(--forest-900); font-family: Georgia, serif; font-size: 1rem; }
.shop-sell-message { margin: 0; color: var(--ink-soft); }
.shop-items, .shop-sell-items, .inventory-items { display: grid; gap: 10px; }
.shop-item, .inventory-item {
  display: grid;
  gap: 7px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 9px 3px 9px 3px;
  background: rgba(255, 254, 249, 0.9);
}
.shop-item h6, .inventory-item h5 { margin: 0; color: var(--forest-900); font-size: 1rem; }
.shop-item p, .inventory-item p { margin: 0; color: var(--ink-soft); line-height: 1.5; }
.shop-price, .inventory-quantity { color: var(--wood); }
.shop-inventory-count { color: var(--ink-soft); font-size: 0.84rem; }
.shop-buy, .inventory-use, .inventory-equip, .inventory-equipped { justify-self: start; }
.shop-sell-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.shop-sell-all:not(:disabled) { border-color: var(--forest-700); background: var(--paper); color: var(--forest-900); }
.shop-sell-all:hover:not(:disabled), .shop-sell-all:focus-visible:not(:disabled) { background: var(--forest-700); color: #fff; }
.shop-sell-all:active:not(:disabled) { background: var(--forest-900); color: #fff; }
.shop-sell:disabled, .shop-sell-all:disabled { cursor: not-allowed; opacity: 0.72; }
.shop-close { margin-top: 12px; }

.shop-close:not(:disabled),
.inventory-equip:not(:disabled),
button.equipment-unequip:not(:disabled) { border-color: var(--forest-700); background: var(--paper); color: var(--forest-900); }
.shop-close:hover:not(:disabled), .shop-close:focus-visible:not(:disabled),
.inventory-equip:hover:not(:disabled), .inventory-equip:focus-visible:not(:disabled),
button.equipment-unequip:hover:not(:disabled), button.equipment-unequip:focus-visible:not(:disabled) { background: var(--forest-700); color: #fff; }
.shop-close:active:not(:disabled), .inventory-equip:active:not(:disabled), button.equipment-unequip:active:not(:disabled) { background: var(--forest-900); color: #fff; }
.inventory-equipped:disabled { border-color: #9cad8d; background: #dfe8d4; color: var(--forest-900); cursor: default; opacity: 1; }
.inventory-drop-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.inventory-drop-controls input { width: 56px; min-height: 34px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 7px; background: #fffdf7; color: var(--ink); }
.inventory-drop { min-height: 34px; width: auto; padding: 5px 9px; }
.spells-panel, .spell-list { display: grid; gap: 12px; min-width: 0; }
.spells-panel { margin: 12px 0 18px; padding: 16px; border: 1px solid var(--line); border-radius: 12px 4px 12px 4px; background: rgba(255, 253, 247, 0.88); }
.spells-panel h4, .combat-spells h5, .combat-spell-sheet h5 { margin: 0; color: var(--forest-900); font-family: Georgia, serif; }
.spells-summary, .spells-message, .spell-card p { margin: 0; color: var(--ink-soft); }
.spell-card { display: grid; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: 9px 3px 9px 3px; background: var(--paper); }
.spell-card h5 { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--forest-900); font-size: 1rem; }
.spell-icon { width: 22px; height: 22px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.spell-effect, .spell-ready { color: var(--forest-800); }
.spell-unavailable { color: #8b4d38 !important; font-weight: 700; }
.spell-quick-slot { min-height: 42px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fffdf7; color: var(--ink); }
.combat-quick-actions { display: grid; gap: 6px; min-height: 102px; margin-bottom: 6px; }
.combat-quick-actions h5 { margin: 0; color: var(--forest-900); font-family: Georgia, serif; }
.combat-quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; min-height: 48px; }
.combat-quick-action { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 1px 6px; min-width: 0; min-height: 48px; padding: 6px 7px; text-align: left; }
.combat-quick-spell small { grid-column: 2; }
.combat-quick-empty { align-self: center; margin: 0; color: var(--ink-soft); font-size: .87rem; }
.combat-action-note { margin: 0; color: var(--ink-soft); font-size: .87rem; }

.quest-journal-panel, .quest-journal-content { min-width: 0; overflow-wrap: anywhere; }
.quest-journal-content { display: grid; gap: 12px; }
.quest-journal-heading { margin: 0; color: var(--forest-900); font-family: Georgia, serif; font-size: 1.05rem; }
.quest-journal-empty, .quest-journal-message { margin: 0; color: var(--ink-soft); line-height: 1.6; }
.quest-journal-panel .quest-card-ready { padding: 12px; border: 1px solid var(--honey); border-radius: 8px; background: var(--honey-soft); }
.quest-journal-panel .quest-card-ready .quest-status { color: var(--wood-dark); }
.quest-journal-close { justify-self: start; min-height: 44px; margin-top: 4px; }

/* Prepared player phrases */

.prepared-phrases-panel { min-width: 0; overflow-wrap: anywhere; }
.prepared-phrases-help, .prepared-phrases-message, .prepared-phrases-empty { margin: 0; color: var(--ink-soft); line-height: 1.5; }
.prepared-phrases-message { min-height: 1.35em; }
.prepared-phrase-categories { display: flex; flex-wrap: wrap; gap: 7px; }
button.prepared-phrase-category { min-height: 44px; padding: 8px 12px; border-color: #bdb69f; background: var(--paper); color: var(--forest-900); }
button.prepared-phrase-category[aria-selected="true"] { border-color: var(--forest-700); background: var(--forest-700); color: #fff; }
.prepared-phrase-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
button.prepared-phrase-option { min-height: 48px; padding: 10px 13px; border-color: var(--forest-700); background: #fffdf7; color: var(--forest-900); text-align: left; }
.prepared-phrases-close { justify-self: start; min-height: 44px; }

/* Inventory, character and quest journal */

.inventory-panel,
.character-panel,
.quest-journal-panel,
.prepared-phrases-panel,
.combat-panel {
  display: grid;
  gap: 11px;
  margin: 4px 0 8px;
  padding: clamp(16px, 3vw, 22px);
  border: 1px solid #cbbd9e;
  border-radius: 12px 4px 12px 4px;
  background: linear-gradient(145deg, #f8f3e5, #edf1e4);
}

.inventory-panel h4,
.character-panel h4,
.character-panel h5,
.quest-journal-panel h4,
.prepared-phrases-panel h4,
.combat-panel h4 { margin: 0; }
.inventory-panel h4, .character-panel h4, .quest-journal-panel h4, .prepared-phrases-panel h4, .combat-panel h4 { font-size: 1.35rem; }
.character-panel h5 { margin-top: 5px; font-size: 1rem; }
.inventory-message, .character-message { min-height: 1.35em; margin: 0; color: var(--ink-soft); }
.item-properties { display: grid; gap: 3px; margin: 2px 0; padding-left: 19px; color: var(--forest-800); font-size: 0.88rem; line-height: 1.4; }
.item-properties li::marker { color: var(--honey); }
.item-requirements > ul { margin: 3px 0 0; padding-left: 18px; }
.item-requirement-insufficient { color: #9b2f25; font-weight: 700; }
.item-requirement-insufficient::marker { color: #9b2f25 !important; }
.inventory-close, .character-close { justify-self: start; margin-top: 4px; }

#inventory-button:not(:disabled),
#character-button:not(:disabled),
#quest-journal-button:not(:disabled),
button.quest-journal-close:not(:disabled),
button.prepared-phrases-close:not(:disabled),
button.inventory-close:not(:disabled),
button.character-close:not(:disabled) { border-color: var(--forest-700); background: var(--paper); color: var(--forest-900); }
#inventory-button:hover:not(:disabled), #inventory-button:focus-visible:not(:disabled),
#character-button:hover:not(:disabled), #character-button:focus-visible:not(:disabled),
#quest-journal-button:hover:not(:disabled), #quest-journal-button:focus-visible:not(:disabled),
button.quest-journal-close:hover:not(:disabled), button.quest-journal-close:focus-visible:not(:disabled),
button.prepared-phrases-close:hover:not(:disabled), button.prepared-phrases-close:focus-visible:not(:disabled),
button.inventory-close:hover:not(:disabled), button.inventory-close:focus-visible:not(:disabled),
button.character-close:hover:not(:disabled), button.character-close:focus-visible:not(:disabled) { background: var(--forest-700); color: #fff; }
#inventory-button:active:not(:disabled), #character-button:active:not(:disabled),
#quest-journal-button:active:not(:disabled), button.quest-journal-close:active:not(:disabled),
button.prepared-phrases-close:active:not(:disabled),
button.inventory-close:active:not(:disabled), button.character-close:active:not(:disabled) { background: var(--forest-900); color: #fff; }
#inventory-button:disabled, #character-button:disabled,
#quest-journal-button:disabled, button.quest-journal-close:disabled,
button.prepared-phrases-close:disabled,
button.inventory-close:disabled, button.character-close:disabled { border-color: #bbb9aa; background: #e5e3d9; color: #77786f; cursor: not-allowed; opacity: 0.72; }

.character-details, .character-attributes, .character-equipment { display: grid; gap: 7px; margin-bottom: 9px; }
.character-details p, .character-attributes p, .character-equipment p { margin: 0; color: var(--ink-soft); }
.character-details strong, .character-attributes strong, .character-equipment strong { color: var(--forest-900); }
.character-attribute-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.character-attribute-add { flex: 0 0 auto; min-width: 34px; min-height: 34px; padding: 5px 10px; }
.equipment-slot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border: 1px solid #d7ccb4; border-radius: 7px; background: rgba(255, 254, 249, 0.82); }
.equipment-slot-details { min-width: 0; }
.equipment-slot-details .item-properties { margin-top: 5px; }
.equipment-unequip { flex: 0 0 auto; min-height: 34px; padding: 6px 10px; }
.character-region-map { justify-self: stretch; min-height: 46px; }
.character-help { justify-self: stretch; min-height: 46px; margin-top: 14px; }
.character-quick-actions { display: grid; gap: 9px; }
.character-quick-slot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; padding: 10px; border: 1px solid #d7ccb4; border-radius: 8px; background: rgba(255, 254, 249, .82); }
.character-quick-current, .character-quick-state { grid-column: 1 / -1; margin: 0; }
.character-quick-current { color: var(--forest-900); }
.character-quick-state { min-height: 1.2em; color: var(--ink-soft); }
.character-quick-select { grid-column: 1 / -1; width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fffdf7; color: var(--ink); }
.character-quick-controls { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 7px; }
.character-quick-controls button { min-height: 42px; }
.return-rune-state { margin: 2px 0; color: var(--ink-soft); }
.return-rune-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.return-rune-actions button { min-height: 42px; }

/* Combat and loot */

.combat-panel { position: relative; overflow: hidden; padding: 20px 22px; border: 1px solid #b59a6d; border-left: 4px solid var(--wood); border-radius: 4px 16px 4px 16px; background: linear-gradient(145deg, #fff9eb, #ecebdd); box-shadow: 0 9px 24px rgba(84, 58, 38, 0.11); }
.combat-panel h4 { color: var(--wood-dark); font-size: 1.48rem; }
.combat-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.combat-status { color: var(--ink-soft); font-size: 0.85rem; font-weight: 800; }
.combat-health { margin: 0; color: var(--danger); font-weight: 800; }
.combat-health-meter { width: min(300px, 100%); margin-top: -4px; }
.combat-participants { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.combat-side { display: grid; align-content: start; gap: 6px; min-width: 0; }
.combat-side h5, .combat-journal h5 { margin: 0; color: var(--forest-900); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }
.combat-participant-list { display: grid; gap: 7px; }
.combat-participant { display: grid; gap: 5px; width: 100%; min-width: 0; min-height: 70px; padding: 9px; border: 1px solid #cec1a7; border-radius: 8px; background: rgba(255, 254, 249, 0.82); color: var(--forest-900); text-align: left; box-shadow: none; }
.combat-participant-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 5px; min-width: 0; }
.combat-participant-heading strong { overflow-wrap: anywhere; line-height: 1.18; }
.combat-participant-health { color: var(--ink-soft); font-size: 0.78rem; font-weight: 700; }
.combat-participant-meter { width: 100%; }
.combat-participant-self { border-color: #9aac8d; background: #f4f6ed; }
.combat-target-button:not(:disabled) { border-color: #b59a6d; background: var(--paper); color: var(--forest-900); }
.combat-target-button:hover:not(:disabled), .combat-target-button:focus-visible:not(:disabled) { border-color: var(--forest-700); background: #f1f5ea; color: var(--forest-900); }
.combat-target-button:active:not(:disabled) { border-color: var(--forest-900); background: #e5ecdc; color: var(--forest-900); }
.combat-participant-target, .combat-target-button.combat-participant-target:not(:disabled) { border: 2px solid var(--forest-700); background: #edf3e6; }
.combat-target-label { flex: 0 0 auto; padding: 2px 5px; border-radius: 999px; background: var(--forest-700); color: #fff; font-size: 0.64rem; letter-spacing: 0.04em; text-transform: uppercase; }
.combat-participant-inactive { opacity: 0.58; }
.combat-journal, .combat-content { display: grid; gap: 6px; }
.combat-journal-list { display: grid; gap: 4px; max-height: 190px; margin: 0; padding: 9px 9px 9px 29px; overflow-y: auto; border-left: 2px solid #d1b77f; background: rgba(255, 254, 249, 0.48); color: #4f5047; font-size: 0.84rem; line-height: 1.4; }
.combat-journal-list li::marker { color: var(--honey); }
.combat-journal-newest { color: var(--forest-900); font-weight: 750; }
.combat-journal-empty, .combat-content p { margin: 0; color: #4f5047; line-height: 1.52; }
.combat-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.combat-attack { flex: 1 1 150px; border-color: var(--wood); background: var(--wood); }
.combat-flee { flex: 0 1 auto; }
.combat-attack:hover:not(:disabled), .combat-attack:focus-visible:not(:disabled) { border-color: var(--wood-dark); background: var(--wood-dark); color: #fff; }
.corpse-loot-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--forest-900); }
.corpse-inline-panel { display: grid; gap: 10px; margin: 0 17px 17px; padding: 14px; border: 1px solid rgba(53, 98, 58, 0.28); border-radius: 10px; background: rgba(255, 253, 246, 0.82); }
.corpse-inline-title, .corpse-inline-status, .corpse-inline-error { margin: 0; }
.corpse-inline-content { display: grid; gap: 9px; }
.corpse-inline-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.corpse-inline-error { color: var(--danger); font-weight: 700; }
.corpse-loot-details { display: grid; gap: 5px; min-width: 0; }
.corpse-loot-details p { margin: 0; color: var(--ink-soft); }
.corpse-loot-details .item-properties { margin: 0; }
.corpse-capacity-warning { color: var(--danger) !important; font-weight: 700; }
.combat-flee:not(:disabled), .combat-close:not(:disabled), .corpse-close:not(:disabled), .corpse-take:not(:disabled), .corpse-take-all:not(:disabled) { border-color: var(--forest-700); background: var(--paper); color: var(--forest-900); }
.combat-flee:hover:not(:disabled), .combat-flee:focus-visible:not(:disabled), .combat-close:hover:not(:disabled), .combat-close:focus-visible:not(:disabled), .corpse-close:hover:not(:disabled), .corpse-close:focus-visible:not(:disabled), .corpse-take:hover:not(:disabled), .corpse-take:focus-visible:not(:disabled), .corpse-take-all:hover:not(:disabled), .corpse-take-all:focus-visible:not(:disabled) { background: var(--forest-700); color: #fff; }
.combat-flee:active:not(:disabled), .combat-close:active:not(:disabled), .corpse-close:active:not(:disabled), .corpse-take:active:not(:disabled), .corpse-take-all:active:not(:disabled) { background: var(--forest-900); color: #fff; }

/* Read-only Region map */

body.region-map-open { overflow: hidden; }
.region-map-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: 8px; width: 100%; height: 100vh; height: 100dvh; padding: clamp(10px, 2.5vw, 22px); background: #e8eadf; color: var(--ink); }
.region-map-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.region-map-header h2 { margin: 0; color: var(--forest-900); font-family: Georgia, serif; font-size: clamp(1.25rem, 4.8vw, 1.8rem); }
.region-map-layer, .region-map-message { min-height: 1.25em; margin: 2px 0 0; color: var(--ink-soft); font-size: .85rem; }
.region-map-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.region-map-controls button { min-height: 42px; padding: 7px 11px; }
.region-map-viewport { min-width: 0; min-height: 0; overflow: hidden; border: 1px solid #afa98f; border-radius: 10px 3px 10px 3px; background: radial-gradient(circle at center, #f8f5e9, #dce3d4); box-shadow: inset 0 0 40px rgba(57, 78, 52, .08); }
.region-map-svg { display: block; width: 100%; height: 100%; min-height: 280px; touch-action: none; cursor: grab; user-select: none; }
.region-map-svg:active { cursor: grabbing; }
.region-map-link { stroke: #829078; stroke-width: 3; stroke-linecap: round; opacity: .75; vector-effect: non-scaling-stroke; }
.region-map-node-marker { fill: #f6f1df; stroke: var(--forest-700); stroke-width: 3; vector-effect: non-scaling-stroke; }
.region-map-node-settlement .region-map-node-marker { fill: #e5d4a7; stroke: #7d603c; }
.region-map-node-landmark .region-map-node-marker { fill: #d8c8a8; stroke: #665840; }
.region-map-node-water .region-map-node-marker { fill: #cfe2df; stroke: #4f7774; }
.region-map-node-forest .region-map-node-marker { fill: #d9e6cf; stroke: #52704b; }
.region-map-node-path .region-map-node-marker { fill: #eee5cf; stroke: #8c7655; }
.region-map-node-label, .region-map-boundary-label { fill: #31392e; paint-order: stroke; stroke: #f4f2e8; stroke-width: 4px; stroke-linejoin: round; font: 700 15px/1.2 system-ui, sans-serif; pointer-events: none; }
.region-map-boundary-arrow { fill: none; stroke: #8c623e; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.region-map-boundary-label { fill: #754c2c; font-size: 13px; }
.region-map-node-current .region-map-node-marker { fill: #fff4ad; stroke: #8e5d24; stroke-width: 4; }
.region-map-player-marker { fill: none; stroke: #bb702a; stroke-width: 3; opacity: .9; vector-effect: non-scaling-stroke; animation: region-map-pulse 1.8s ease-out infinite; }
.region-map-guidance-halo { fill: rgba(220, 166, 52, .18); stroke: #b5791e; stroke-width: 4; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.region-map-node-guidance-turn_in .region-map-guidance-halo { fill: rgba(102, 132, 73, .22); stroke: var(--forest-700); stroke-dasharray: none; }
.region-map-node-guidance .region-map-node-marker { stroke-width: 4; }
.quest-map-action { width: 100%; min-height: 44px; margin-top: 8px; }
@keyframes region-map-pulse { 0% { opacity: .95; } 60%, 100% { opacity: .28; } }

/* Help, feedback and player reports */

body.help-open { overflow: hidden; }
.help-overlay { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; width: 100%; height: 100vh; height: 100dvh; padding: clamp(10px, 3vw, 28px); background: rgba(27, 42, 29, .42); }
.help-card { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 14px; width: min(720px, 100%); max-height: 100%; padding: clamp(18px, 4vw, 30px); overflow: hidden; border: 1px solid var(--line); border-radius: 5px 24px 5px 24px; background: var(--paper); box-shadow: var(--shadow); }
.help-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.help-header h2 { margin: 0; }
.help-menu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.help-menu button { min-width: 0; padding-inline: 10px; }
.help-content { min-height: 160px; overflow-y: auto; overscroll-behavior: contain; line-height: 1.55; }
.help-content h3 { margin: 0 0 14px; }
.help-guide { display: grid; gap: 14px; }
.help-guide section { padding-bottom: 12px; border-bottom: 1px solid rgba(216, 201, 170, .68); }
.help-guide h4, .help-guide p { margin: 0; }
.help-guide p { margin-top: 5px; color: var(--ink-soft); }
.rules-list { display: grid; gap: 10px; padding-left: 22px; }
.pvp-rules-note { padding: 12px 14px; border-left: 3px solid var(--forest-600); background: var(--forest-050); font-weight: 680; }
.feedback-form { display: grid; gap: 15px; }
.feedback-form .field { margin: 0; }
.feedback-submit { justify-self: start; }
.player-report-button { margin-right: auto; }

[hidden] { display: none !important; }

/* Responsive */

@media (max-width: 900px) {
  .game-header { grid-template-columns: 1fr auto; }
  .player-vitals { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .logout-button { grid-column: 2; grid-row: 1; }
  .game-layout { grid-template-columns: minmax(0, 1fr); }
  .player-sidebar { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .shell { width: min(100% - 16px, 1120px); padding: 8px 0 18px; }
  .login-screen { min-height: calc(100vh - 26px); }
  .identity-setup-screen { min-height: calc(100vh - 26px); }
  .max-launch-screen { min-height: calc(100vh - 26px); }
  .max-client .max-launch-screen,
  .max-client .identity-setup-screen,
  .max-client .login-screen {
    min-height: calc(var(--max-viewport-height, 100vh) - 26px);
  }
  .identity-setup-card { padding: 25px 20px; border-radius: 4px 20px 4px 20px; }
  .identity-setup-form button { width: 100%; min-height: 48px; }
  .login-card { border-radius: 4px 20px 4px 20px; }
  .login-header { gap: 12px; padding: 18px 17px; }
  .login-emblem { width: 46px; height: 46px; }
  .login-card h1 { font-size: clamp(1.85rem, 9.4vw, 2.5rem); }
  .login-content { padding: 30px 22px 14px; }
  .login-lead { font-size: 1rem; text-align: left; }
  .login-divider { margin: 24px 0 22px; }
  .workspace { border-radius: 4px 20px 4px 20px; }
  .game-header { gap: 12px; padding: 13px 14px; }
  .brand-emblem { width: 40px; height: 40px; }
  .game-brand { gap: 9px; }
  .game-brand h1 { font-size: clamp(1.22rem, 5.7vw, 1.42rem); }
  .player-vitals { gap: 5px; }
  .vital { padding: 5px 7px; font-size: 0.73rem; }
  .vital-health { padding-bottom: 9px; }
  .player-vitals .vital-health { flex-basis: 100%; min-width: 0; font-size: 0.85rem; }
  .logout-button { min-height: 44px; padding: 7px 11px; }
  .player-sidebar { padding-inline: 14px; }
  .scene-card { min-height: 460px; padding: 32px 18px 0; }
  .combat-panel { padding: 15px 13px; }
  .corpse-inline-panel { margin: 0 12px 12px; padding: 12px; }
  .combat-participants { gap: 7px; }
  .combat-participant { min-height: 68px; padding: 8px 7px; }
  .combat-actions button { min-height: 46px; }
  .location-heading { flex-direction: column; gap: 13px; }
  .location-title { max-width: 100%; font-size: clamp(2.2rem, 11vw, 3rem); line-height: 1; }
  .location-title::after { display: none; }
  .location-description { font-size: 1rem; line-height: 1.75; }
  .look-around-button { width: 100%; justify-content: center; }
  .botanical-divider { grid-template-columns: 1fr 62px 1fr; gap: 8px; margin-bottom: 20px; }
  .botanical-divider svg { width: 62px; }
  .world-objects { grid-template-columns: 1fr; }
  .scene-entity-summary { padding: 20px 18px; }
  .scene-context-actions { display: grid; }
  .scene-context-action { width: 100%; justify-content: flex-start; }
  .exit-buttons { display: grid; grid-template-columns: 1fr; }
  .exit-button { width: 100%; min-height: 78px; }
  .scene-landscape { width: calc(100% + 36px); max-height: 118px; margin: 28px -18px 0; }
  .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-actions button { padding-inline: 7px; font-size: 0.82rem; min-height: 44px; }
  .equipment-slot, .corpse-loot-row { align-items: stretch; flex-direction: column; }
  .prepared-phrase-options { grid-template-columns: 1fr; }
  .equipment-unequip, .corpse-loot-row button { align-self: start; }
  .character-attribute-row { align-items: flex-start; }
  .player-card { flex-wrap: wrap; }
  .quick-action-bar { flex-basis: 100%; order: 3; }
  .region-map-header { align-items: flex-start; }
  .region-map-controls { max-width: 150px; }
  .region-map-controls button { min-height: 40px; padding: 6px 9px; }
  .help-overlay { padding: 6px; }
  .help-card { border-radius: 4px 18px 4px 18px; }
  .help-menu { grid-template-columns: 1fr; }
  .feedback-submit { width: 100%; min-height: 48px; }
}

@media (max-width: 430px) {
  .player-card { display: grid; gap: 10px; }
  .quick-action-buttons { grid-template-columns: 1fr; }
  .quick-actions { width: 100%; }
  .quick-actions button { min-height: 44px; }
  .objects-section h3, .exits-section h3 { font-size: 1.55rem; }
}

@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
  .region-map-player-marker { animation: none; }
}
