
:root {
  color-scheme: dark;
  --bg: rgba(22, 15, 10, 0.78);
  --wood-1: rgba(50, 32, 18, 0.88);
  --wood-2: rgba(32, 20, 12, 0.92);
  --parchment-1: rgba(228, 212, 177, 0.14);
  --parchment-2: rgba(196, 171, 120, 0.10);
  --line: rgba(205, 170, 102, 0.28);
  --line-strong: rgba(232, 196, 121, 0.42);
  --text: #f2ead8;
  --muted: #c7b89a;
  --gold: #d9b56a;
  --gold-soft: rgba(217, 181, 106, 0.2);
  --accent: #b58a4a;
  --shadow: rgba(0,0,0,0.42);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  overflow: hidden;
  background: #0b0907;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
}
canvas { display: block; }
#topBar {
  position: fixed;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 70;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(280px, 380px) minmax(360px, 1fr);
  align-items: start;
  gap: 12px;
  pointer-events: none;
}
.topMenu, .topStats, .compassWrap {
  position: relative;
  background:
    linear-gradient(180deg, rgba(90,56,27,0.94), rgba(44,27,16,0.96)),
    linear-gradient(135deg, var(--parchment-1), transparent 55%),
    linear-gradient(225deg, var(--parchment-2), transparent 60%);
  border: 1px solid var(--line-strong);
  box-shadow:
    0 14px 34px var(--shadow),
    inset 0 1px 0 rgba(255,233,189,0.12),
    inset 0 -1px 0 rgba(0,0,0,0.35);
  border-radius: 16px;
  padding: 10px 12px;
  pointer-events: auto;
}
.topMenu::before, .topStats::before, .compassWrap::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(236, 203, 141, 0.12);
  border-radius: 12px;
  pointer-events: none;
}
.topMenu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}
.topStats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.topStats .pill { font-size: 11px; padding: 6px 10px; }
.topTabBtn {
  white-space: nowrap;
}
.compassWrap {
  text-align: center;
  overflow: hidden;
  padding-top: 9px;
}
.compassLabel {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
  opacity: 0.9;
}
.compassWindow {
  position: relative;
  height: 30px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid rgba(232,196,121,0.22);
  background: linear-gradient(180deg, rgba(19,12,8,0.74), rgba(44,28,16,0.82));
  box-shadow: inset 0 1px 0 rgba(255,231,189,0.08), inset 0 -10px 24px rgba(0,0,0,0.22);
}
#compassStrip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  font-size: 13px;
  letter-spacing: 0.34em;
  color: #f1e4c6;
  text-shadow: 0 1px 0 rgba(0,0,0,0.55);
  will-change: transform;
}
.compassMarker {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 50%;
  width: 3px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #f6d992, #b8832b);
  box-shadow: 0 0 12px rgba(217,181,106,0.35);
}
#compassHeading {
  margin-top: 7px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
#hud {
  position: fixed;
  inset: 92px 12px auto 12px;
  z-index: 30;
  pointer-events: none;
}
.brand, .stats, .questBox, .menuPanel, .panelCard, .shopRow, .itemRow, .dialogueLine {
  background:
    linear-gradient(180deg, rgba(58,36,22,0.92), rgba(28,18,11,0.95)),
    linear-gradient(135deg, rgba(255,239,205,0.06), transparent 65%);
  border: 1px solid var(--line);
  box-shadow: 0 14px 34px var(--shadow), inset 0 1px 0 rgba(255,233,189,0.08);
}
.brand {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 16px;
  opacity: 0.95;
}
.title {
  font-size: 28px;
  letter-spacing: 0.24em;
  font-weight: 700;
  color: #f3e6cb;
}
.subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding: 10px;
  border-radius: 14px;
}
.pill {
  border: 1px solid rgba(232,196,121,0.20);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  background: linear-gradient(180deg, rgba(255,243,217,0.07), rgba(0,0,0,0.05));
  color: #f3ead7;
}
.questBox {
  margin-top: 10px;
  width: min(640px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 16px;
}
.questTitle {
  font-size: 11px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 5px;
}
#questObjective { font-size: 15px; }
#crosshair {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  font-size: 20px;
  color: rgba(252, 236, 195, 0.92);
  text-shadow: 0 0 10px rgba(0,0,0,0.6);
  pointer-events: none;
  user-select: none;
}
#centerMessage {
  position: fixed;
  left: 50%;
  bottom: 46px;
  transform: translateX(-50%);
  z-index: 40;
  padding: 10px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(42,26,16,0.92), rgba(18,12,8,0.94));
  border: 1px solid rgba(232,196,121,0.22);
  color: #fff1c7;
  box-shadow: 0 10px 24px rgba(0,0,0,0.32);
  max-width: min(92vw, 820px);
  text-align: center;
}
.hidden { display: none !important; }
#menu {
  position: fixed;
  top: 78px;
  left: 12px;
  right: 12px;
  z-index: 80;
  display: block;
  background: none;
  pointer-events: none;
}
.menuPanel {
  width: min(1100px, calc(100vw - 24px));
  max-height: min(calc(100vh - 112px), 920px);
  overflow: auto;
  padding: 18px;
  border-radius: 20px;
  margin: 0 auto;
  pointer-events: auto;
}
.menuHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.menuHeader h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0.08em;
  color: #f3e6cb;
}
.menuTabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0 16px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(232,196,121,0.12);
}
.tabBody { min-height: 260px; }
.stack { display: flex; gap: 10px; flex-wrap: wrap; }
.panelCard, .dialogueLine, .shopRow, .itemRow {
  padding: 12px 14px;
  border-radius: 14px;
  margin-bottom: 10px;
}
.itemRow, .shopRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.itemMeta, .questMeta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.dialogueLine { line-height: 1.5; }
.questStep { color: var(--muted); margin-top: 5px; }
.questDone { color: #b9d8a5; }
.questActive { color: #d8c38a; }
button {
  appearance: none;
  border: 1px solid rgba(224, 188, 115, 0.24);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(125,83,42,0.40), rgba(64,40,21,0.54));
  color: #f3ead7;
  padding: 10px 14px;
  cursor: pointer;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0.03em;
  box-shadow: inset 0 1px 0 rgba(255,235,196,0.08);
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}
button:hover {
  background: linear-gradient(180deg, rgba(144,96,50,0.50), rgba(74,47,25,0.64));
  border-color: rgba(232,196,121,0.38);
  transform: translateY(-1px);
}
button.active {
  border-color: rgba(232,196,121,0.55);
  background: linear-gradient(180deg, rgba(162,113,61,0.58), rgba(88,56,28,0.74));
  box-shadow: inset 0 0 0 1px rgba(255,230,175,0.08), 0 0 16px rgba(217,181,106,0.10);
}
.topMenu .topTabBtn.active,
.topMenu .topTabBtn.active:hover,
.topMenu .topTabBtn:focus-visible {
  border-color: rgba(96, 255, 140, 0.95);
  background: linear-gradient(180deg, rgba(34, 210, 92, 0.98), rgba(10, 110, 42, 0.99));
  color: #f4fff4;
  box-shadow: inset 0 0 0 1px rgba(220, 255, 228, 0.38), 0 0 22px rgba(73, 255, 128, 0.45), 0 0 6px rgba(214, 255, 225, 0.42);
  text-shadow: 0 0 10px rgba(214, 255, 225, 0.35);
}
.menuTabs .tabBtn.active,
.menuTabs .tabBtn.active:hover,
.menuTabs .tabBtn:focus-visible {
  border-color: rgba(96, 255, 140, 0.98);
  background: linear-gradient(180deg, rgba(38, 220, 98, 0.98), rgba(10, 118, 44, 0.99));
  color: #f4fff4;
  box-shadow: inset 0 0 0 1px rgba(220, 255, 228, 0.42), 0 0 24px rgba(73, 255, 128, 0.52), 0 0 8px rgba(214, 255, 225, 0.46);
  text-shadow: 0 0 12px rgba(214, 255, 225, 0.4);
}
.buyBtn { white-space: nowrap; }
.buildHint { color: var(--gold); margin-top: 8px; font-size: 13px; }
.saveSlotCard { margin-top: 10px; }
.saveSlotActive {
  border-color: rgba(243,207,119,0.45);
  box-shadow: 0 14px 34px rgba(0,0,0,0.35), 0 0 0 1px rgba(243,207,119,0.16) inset;
}
.saveSlotHead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: rgba(217,181,106,0.28);
  border-radius: 999px;
}
::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.04);
}

@media (max-width: 1100px) {
  #topBar {
    grid-template-columns: 1fr;
  }
  .topStats {
    justify-content: flex-start;
  }
  #hud {
    inset: 178px 12px auto 12px;
  }
  #menu {
    top: 164px;
  }
}
@media (max-width: 720px) {
  .topMenu, .topStats {
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  .brand { display: none; }
  #hud { inset: 160px 12px auto 12px; }
  #menu { top: 150px; }
}


.topTabBtn, .tabBtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.tabIcon, .itemIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  min-width: 1.25rem;
  text-align: center;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,0.35));
}
.iconHeading { display: inline-flex; align-items: center; gap: 8px; }
.menuCrest {
  display: inline-block;
  margin-right: 10px;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,0.45));
}
.menuPanel {
  background:
    linear-gradient(180deg, rgba(61,40,24,0.96), rgba(21,14,10,0.97)),
    radial-gradient(circle at top, rgba(255,236,190,0.08), transparent 35%);
  border: 1px solid rgba(232,196,121,0.28);
}
.menuHeader, .menuTabs {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(49,31,19,0.95), rgba(49,31,19,0.72));
  backdrop-filter: blur(4px);
}
.menuHeader {
  padding: 10px 8px 12px;
  border-bottom: 1px solid rgba(232,196,121,0.12);
  margin: -8px -8px 8px;
}
.menuTabs {
  padding-top: 8px;
  padding-bottom: 10px;
}
.itemRow, .shopRow {
  padding: 14px 16px;
  border: 1px solid rgba(232,196,121,0.14);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,243,217,0.04), rgba(0,0,0,0.08));
}
.itemRow:hover, .shopRow:hover {
  border-color: rgba(232,196,121,0.26);
  box-shadow: inset 0 0 0 1px rgba(255,230,175,0.04);
}
.itemMeta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.itemMeta .tag, .itemTag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(232,196,121,0.16);
  background: rgba(255,241,209,0.04);
}
#centerMessage.isPrompt {
  border-radius: 18px;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(59,38,24,0.96), rgba(20,13,9,0.96));
  border: 1px solid rgba(241,209,133,0.34);
  box-shadow: 0 16px 36px rgba(0,0,0,0.38), inset 0 1px 0 rgba(255,231,189,0.08);
}
.promptWrap {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.promptKey {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(241,209,133,0.34);
  background: linear-gradient(180deg, rgba(181,138,74,0.34), rgba(74,47,25,0.72));
  color: #fff1c7;
  font-weight: 700;
  font-size: 18px;
}
.promptTitle {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 3px;
}
.promptText {
  font-size: 15px;
  color: #f3ead7;
}
.questBox {
  background:
    linear-gradient(180deg, rgba(59,38,24,0.94), rgba(25,16,10,0.95)),
    linear-gradient(135deg, rgba(255,239,205,0.08), transparent 65%);
}




/* Final bottom-only HUD layout - Firestorm style single bottom row */
.brand { display: none !important; }
#topBar { display:none !important; }
#topCompassBar {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: min(312px, calc(100vw - 24px));
  z-index: 90;
  pointer-events: none;
}
#topCompassBar .compassWrap {
  position: relative;
  background: linear-gradient(180deg, rgba(34,39,46,0.94), rgba(16,18,24,0.96));
  border: 1px solid rgba(138, 152, 168, 0.35);
  box-shadow:
    0 10px 24px rgba(0,0,0,0.34),
    inset 0 1px 0 rgba(255,255,255,0.06),
    inset 0 -1px 0 rgba(0,0,0,0.5);
  border-radius: 12px;
  padding: 6px 10px 8px;
  overflow: hidden;
}
#topCompassBar .compassWrap::before,
#bottomHudBar::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 10px;
  pointer-events: none;
}
#topCompassBar .compassLabel {
  font-size: 9px;
  letter-spacing: 0.26em;
  margin-bottom: 4px;
  color: #b7c4d6;
  opacity: 0.9;
}
#topCompassBar .compassWindow {
  height: 18px;
  border-radius: 8px;
  border: 1px solid rgba(138, 152, 168, 0.28);
  background: linear-gradient(180deg, rgba(10,12,16,0.95), rgba(36,40,48,0.9));
}
#compassStrip {
  font-size: 11px;
  letter-spacing: 0.24em;
  line-height: 18px;
  color: #e6edf7;
}
#topCompassBar .compassMarker {
  width: 2px;
  top: 2px;
  bottom: 2px;
  background: linear-gradient(180deg, rgba(255,255,255,0.15), #d6b36b, rgba(255,255,255,0.15));
}
#compassHeading {
  font-size: 11px;
  margin-top: 4px;
  color: #d6b36b;
}

#bottomHudBar {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 10px;
  height: 56px;
  display: grid;
  grid-template-columns: minmax(220px, 0.95fr) minmax(560px, 1.5fr) minmax(360px, 1.1fr);
  gap: 10px;
  align-items: center;
  z-index: 80;
  pointer-events: none;
  padding: 8px 12px;
  background: linear-gradient(180deg, rgba(34,39,46,0.94), rgba(16,18,24,0.96));
  border: 1px solid rgba(138, 152, 168, 0.35);
  border-radius: 14px;
  box-shadow:
    0 14px 34px rgba(0,0,0,0.36),
    inset 0 1px 0 rgba(255,255,255,0.05),
    inset 0 -1px 0 rgba(0,0,0,0.45);
}
#bottomHudBar .topMenu,
#bottomHudBar .topStats,
#bottomHudBar .questBox {
  position: relative;
  margin: 0;
  min-width: 0;
  pointer-events: auto;
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  backdrop-filter: none;
}
#bottomHudBar .questBox {
  width: auto;
  padding: 0 10px 0 4px;
  border-right: 1px solid rgba(138, 152, 168, 0.25);
  overflow: hidden;
}
#bottomHudBar .questTitle {
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #aeb9c8;
  margin-bottom: 2px;
}
#bottomHudBar #questObjective {
  font-size: 13px;
  line-height: 1.2;
  color: #eef3fb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#bottomHudBar .topMenu {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  overflow: hidden;
}
#bottomHudBar .topStats {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  padding: 0 0 0 10px;
  border-left: 1px solid rgba(138, 152, 168, 0.25);
  overflow: hidden;
}
#bottomHudBar .topTabBtn {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(69,78,90,0.95), rgba(43,48,57,0.98));
  border: 1px solid rgba(138, 152, 168, 0.32);
  color: #e8eef8;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  white-space: nowrap;
}
#bottomHudBar .topTabBtn.active,
#bottomHudBar .topTabBtn:hover {
  background: linear-gradient(180deg, rgba(182,146,79,0.98), rgba(104,78,36,0.99));
  border-color: rgba(255,228,154,0.88);
  color: #fff9e8;
  box-shadow: inset 0 0 0 1px rgba(255,244,201,0.34), 0 0 18px rgba(243,208,118,0.34), 0 0 4px rgba(255,245,212,0.35);
  text-shadow: 0 0 10px rgba(255,236,183,0.4);
}
#bottomHudBar .topStats .pill {
  font-size: 11px;
  line-height: 1;
  padding: 7px 8px;
  border-radius: 8px;
  white-space: nowrap;
  background: linear-gradient(180deg, rgba(54,60,70,0.96), rgba(28,31,38,0.98));
  border: 1px solid rgba(138, 152, 168, 0.24);
  color: #e7edf8;
}
#bottomHudBar .topStats .pill span { color: #f4d797; }

#hud {
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: 30;
}
#centerMessage { bottom: 74px; z-index: 85; }
#menu {
  top: 66px;
  bottom: 76px;
  left: 10px;
  right: 10px;
}
.menuPanel { max-height: min(calc(100vh - 150px), 920px); }

@media (max-width: 1360px) {
  #bottomHudBar {
    grid-template-columns: minmax(180px, 0.9fr) minmax(480px, 1.5fr) minmax(300px, 1fr);
    gap: 8px;
    padding: 8px 10px;
  }
  #bottomHudBar .topTabBtn { font-size: 11px; padding: 7px 8px; }
  #bottomHudBar .topStats .pill { font-size: 10px; padding: 7px 7px; }
}

@media (max-width: 1100px) {
  #topCompassBar { width: min(280px, calc(100vw - 20px)); }
  #bottomHudBar {
    left: 8px;
    right: 8px;
    bottom: 8px;
    height: auto;
    min-height: 56px;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 6px;
    padding: 8px;
  }
  #bottomHudBar .questBox,
  #bottomHudBar .topStats {
    border: 0;
    padding: 0;
  }
  #bottomHudBar .topMenu,
  #bottomHudBar .topStats {
    overflow-x: auto;
    justify-content: flex-start;
    scrollbar-width: thin;
  }
  #menu { top: 62px; bottom: 134px; left: 8px; right: 8px; }
  .menuPanel { max-height: min(calc(100vh - 206px), 920px); }
  #centerMessage { bottom: 126px; }
}



/* Quest button popup refinement */
#bottomHudBar {
  grid-template-columns: auto minmax(520px, 1.55fr) auto;
}
#bottomHudBar .questBox {
  position: relative;
  display: flex;
  align-items: center;
  width: auto;
  padding: 0 10px 0 0;
  border-right: 1px solid rgba(138, 152, 168, 0.25);
  overflow: visible;
}
#bottomHudBar .questButton {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  max-width: 230px;
  padding: 7px 10px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(69,78,90,0.95), rgba(43,48,57,0.98));
  border: 1px solid rgba(138, 152, 168, 0.32);
  color: #e8eef8;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
#bottomHudBar .questButton:hover,
#bottomHudBar .questButton.active {
  background: linear-gradient(180deg, rgba(110,90,54,0.96), rgba(71,55,29,0.98));
  border-color: rgba(214,179,107,0.45);
  color: #fff4da;
}
.questButtonLabel {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #aeb9c8;
  flex: 0 0 auto;
}
.questButtonText {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.questPopup {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  width: min(340px, 42vw);
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(34,39,46,0.98), rgba(16,18,24,0.98));
  border: 1px solid rgba(138, 152, 168, 0.35);
  box-shadow: 0 14px 34px rgba(0,0,0,0.38), inset 0 1px 0 rgba(255,255,255,0.05);
}
.questPopup::after {
  content: '';
  position: absolute;
  left: 20px;
  top: 100%;
  width: 12px;
  height: 12px;
  background: rgba(16,18,24,0.98);
  border-right: 1px solid rgba(138, 152, 168, 0.35);
  border-bottom: 1px solid rgba(138, 152, 168, 0.35);
  transform: translateY(-6px) rotate(45deg);
}
#bottomHudBar .questTitle {
  margin-bottom: 6px;
}
#bottomHudBar #questObjective {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  font-size: 13px;
  line-height: 1.35;
}
#bottomHudBar .topStats {
  gap: 4px;
}
#bottomHudBar .topStats .pill {
  font-size: 10px;
  padding: 7px 6px;
}
#bottomHudBar .topTabBtn {
  padding: 7px 8px;
}
@media (max-width: 1360px) {
  #bottomHudBar { grid-template-columns: auto minmax(420px, 1.45fr) auto; }
  #bottomHudBar .questButton { max-width: 190px; }
}
@media (max-width: 1100px) {
  #bottomHudBar .questBox { padding: 0; border-right: 0; }
  .questPopup { width: min(320px, calc(100vw - 24px)); }
}


button:focus-visible {
  outline: 3px solid #f3d27a;
  outline-offset: 2px;
}


.questToast {
  position: fixed;
  left: 18px;
  bottom: 96px;
  width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(214, 182, 118, 0.44);
  background: linear-gradient(180deg, rgba(24, 18, 12, 0.96), rgba(12, 9, 7, 0.94));
  box-shadow: 0 14px 28px rgba(0,0,0,0.34);
  z-index: 85;
  pointer-events: none;
  opacity: 1;
  transform: translateY(0);
  transition: opacity .45s ease, transform .45s ease;
}
.questToast.hidden {
  display: block !important;
  opacity: 0;
  transform: translateY(8px);
}
.questToastLabel {
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(232, 212, 170, 0.84);
  margin-bottom: 4px;
}
.questToastTitle {
  font-size: 15px;
  font-weight: 800;
  color: #f7eed9;
  margin-bottom: 4px;
}
.questToastObjective {
  font-size: 13px;
  line-height: 1.35;
  color: rgba(245, 236, 214, 0.9);
}
.questCardHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.questReadBtn {
  min-width: 76px;
}
.questDetails.hidden {
  display: none;
}
.questReadHint {
  margin-top: 6px;
}

.compassTarget {
  display: none;
}
.rewardFeed {
  position: fixed;
  left: 50%;
  top: 98px;
  transform: translateX(-50%);
  z-index: 65;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(420px, calc(100vw - 32px));
}
.rewardToast {
  opacity: 0;
  transform: translateY(-12px) scale(0.98);
  transition: opacity .22s ease, transform .22s ease;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(232,196,121,0.26);
  background: linear-gradient(180deg, rgba(44,28,16,0.94), rgba(18,12,8,0.96));
  color: #f6e8c4;
  box-shadow: 0 10px 24px rgba(0,0,0,0.28);
  font-size: 13px;
  text-align: center;
  width: 100%;
  max-width: 360px;
}

.rewardToast.show { opacity: 1; transform: translateY(0) scale(1); }
.reward-gold { border-color: rgba(214,176,76,0.5); color: #ffe18d; }
.reward-xp { border-color: rgba(126,185,234,0.45); color: #d6f0ff; }
.reward-badge { border-color: rgba(236,197,105,0.62); color: #fff2bf; box-shadow: 0 0 18px rgba(236,197,105,0.18), 0 10px 24px rgba(0,0,0,0.28); }
.nameInput {
  min-width: 180px;
  background: rgba(16,12,10,0.75);
  color: var(--text);
  border: 1px solid rgba(232,196,121,0.22);
  border-radius: 10px;
  padding: 8px 10px;
}
.coronationOverlay {
  position: fixed;
  inset: 120px 50% auto 50%;
  transform: translateX(-50%);
  z-index: 95;
  width: min(720px, calc(100vw - 40px));
  padding: 18px 22px;
  border-radius: 18px;
  text-align: center;
  background: radial-gradient(circle at top, rgba(255,224,138,0.18), rgba(56,34,14,0.96) 58%, rgba(14,10,8,0.98));
  border: 1px solid rgba(237,203,120,0.5);
  box-shadow: 0 18px 44px rgba(0,0,0,0.4);
}
.coronationTitle {
  font-size: 28px;
  letter-spacing: 0.14em;
  color: #ffe9ac;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.coronationText {
  color: #f7e5bf;
  font-size: 15px;
  line-height: 1.5;
}


body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
  z-index: 4;
  background: radial-gradient(circle at center, rgba(255,255,255,0.12), rgba(255,255,255,0) 55%);
}
body.uiPulse-gold::after {
  opacity: 0.55;
  background: radial-gradient(circle at center, rgba(255,212,111,0.24), rgba(255,212,111,0) 58%);
}
body.uiPulse-badge::after {
  opacity: 0.72;
  background: radial-gradient(circle at center, rgba(255,234,164,0.28), rgba(150,109,37,0.08) 42%, rgba(0,0,0,0) 68%);
}
body.uiPulse-xp::after {
  opacity: 0.5;
  background: radial-gradient(circle at center, rgba(144,194,255,0.22), rgba(144,194,255,0) 58%);
}
.topMenu, .topStats, .compassWrap, .menuPanel, .panelCard, .shopRow, .itemRow, .dialogueLine, .questToast, .rewardToast {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.rewardToast {
  box-shadow: 0 10px 24px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.05) inset;
}
.reward-badge {
  box-shadow: 0 10px 26px rgba(87,58,12,0.35), 0 0 18px rgba(255,215,120,0.18);
}
.questToast, .menuPanel {
  box-shadow: 0 18px 42px rgba(0,0,0,0.36), 0 0 0 1px rgba(255,245,220,0.06) inset;
}
.panelCard, .dialogueLine, .shopRow, .itemRow {
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}
.panelCard:hover, .dialogueLine:hover, .shopRow:hover, .itemRow:hover {
  box-shadow: 0 10px 24px rgba(0,0,0,0.22);
  transform: translateY(-1px);
}
#topCompassBar .compassWrap {
  transform: scale(0.98);
  transform-origin: top center;
}


/* Dark fantasy UI pass */
:root{color-scheme:dark;}
body{color:#ead7b3;}


.embeddedBuilderOverlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(6, 7, 10, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 18px;
}
.embeddedBuilderShell {
  width: 100%;
  height: 100%;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(232,196,121,0.3);
  box-shadow: 0 28px 80px rgba(0,0,0,0.45);
  background: linear-gradient(180deg, rgba(40,26,14,0.98), rgba(20,14,10,0.98));
  display: flex;
  flex-direction: column;
}
.embeddedBuilderHeader {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(232,196,121,0.22);
  background: linear-gradient(180deg, rgba(90,56,27,0.92), rgba(44,27,16,0.96));
}
.embeddedBuilderTitle { font-size: 18px; font-weight: 700; color: #f3e4c2; }
.embeddedBuilderSubtitle { font-size: 12px; color: #dcc8a0; margin-top: 2px; }
.embeddedBuilderActions { display:flex; gap:10px; flex-wrap:wrap; }
#embeddedBuilderFrame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #0b1017;
}
body.embeddedBuilderOpen #menu,
body.embeddedBuilderOpen #topCompassBar,
body.embeddedBuilderOpen #bottomHudBar,
body.embeddedBuilderOpen #hud,
body.embeddedBuilderOpen #crosshair,
body.embeddedBuilderOpen #questToast,
body.embeddedBuilderOpen #centerMessage,
body.embeddedBuilderOpen #rewardFeed {
  visibility: hidden;
}


.meshAssetInspector { display:flex; gap:14px; align-items:flex-start; flex-wrap:wrap; }
.meshAssetPreview, .meshAssetPreviewPlaceholder {
  width:128px; height:128px; object-fit:contain; border:1px solid rgba(255,255,255,0.18);
  background:rgba(0,0,0,0.18); border-radius:10px; display:flex; align-items:center; justify-content:center;
  color:var(--muted); font-size:13px; text-align:center; padding:8px;
}
.compactHint { flex:1; min-width:220px; }
.builderAssetForm {
  display:grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap:12px;
}
.builderAssetForm label { display:flex; flex-direction:column; gap:6px; }


.builderAssetFilters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.meshAssetBrowserGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.meshAssetCard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  padding: 10px;
  cursor: pointer;
}
.meshAssetCard.active {
  border-color: rgba(255,255,255,0.4);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.15) inset;
}
.meshAssetCardThumb {
  width: 100%;
  aspect-ratio: 1.2 / 1;
  object-fit: cover;
  border-radius: 10px;
  background: rgba(0,0,0,0.25);
}
.meshAssetCardThumbPlaceholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.65);
}
.meshAssetCardBody {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
