/* The Gravity Monarch — Playable 3D Action-RPG HUD (Dune / Brutalist Cosmic) */
:root {
  --obsidian: #0b0c0e;
  --obsidian-panel: rgba(11, 12, 14, 0.84);
  --slate: #2f343a;
  --silver: #9aa2a9;
  --white: #ffffff;
  --brass: #c29b61;
  --danger: #b85c5c;
  --font-display: 'Montserrat', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--obsidian);
  color: var(--white);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

#gameCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.hud-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.hud-layer button,
.hud-layer a {
  pointer-events: auto;
}

/* TOP BAR */
.hud-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(11, 12, 14, 0.92) 0%, rgba(11, 12, 14, 0) 100%);
  pointer-events: none;
}

.top-left,
.top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  background: var(--obsidian-panel);
  border: 1px solid var(--slate);
  color: var(--white);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.brand-pill img {
  width: 18px;
  height: 18px;
}

.meta-pill,
.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--obsidian-panel);
  border: 1px solid var(--slate);
  color: var(--silver);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.16s, color 0.16s;
}

.hud-btn:hover,
.hud-btn.is-active {
  border-color: var(--brass);
  color: var(--white);
}

.hud-btn-brass {
  border-color: rgba(194, 155, 97, 0.65);
  color: var(--brass);
}

.free-badge {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  background: var(--brass);
  color: var(--obsidian);
  font-weight: 600;
  font-size: 10px;
}

/* TOP-RIGHT QUEST TRACKER */
.quest-card {
  position: fixed;
  top: 56px;
  right: 16px;
  width: min(320px, calc(100vw - 32px));
  padding: 12px 14px;
  background: var(--obsidian-panel);
  border: 1px solid var(--slate);
  border-left: 2px solid var(--brass);
  backdrop-filter: blur(8px);
}

.quest-chapter {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--brass);
  text-transform: uppercase;
}

.quest-title {
  margin-top: 3px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--white);
}

.quest-obj {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.48;
  color: #d4dade;
}

.quest-dist {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(154, 162, 169, 0.18);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--silver);
}

.combat-log {
  position: fixed;
  top: 215px;
  right: 16px;
  width: min(320px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-line {
  padding: 5px 9px;
  background: rgba(11, 12, 14, 0.7);
  border-left: 1px solid var(--slate);
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.38;
  color: var(--silver);
}

.log-line.is-latest {
  border-left-color: var(--brass);
  color: var(--white);
}

/* BOSS BAR */
.boss-bar-wrap {
  position: fixed;
  top: 62px;
  left: 50%;
  transform: translateX(-50%);
  width: min(460px, calc(100vw - 32px));
  padding: 10px 14px;
  background: rgba(11, 12, 14, 0.9);
  border: 1px solid rgba(194, 155, 97, 0.65);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.boss-bar-wrap.is-visible {
  opacity: 1;
}

.boss-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.boss-name {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--white);
}

.boss-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--brass);
}

.boss-rail {
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
}

.boss-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brass), #ffffff);
  transition: width 0.14s;
}

/* BOTTOM-LEFT VITALS */
.vitals-panel {
  position: fixed;
  bottom: 16px;
  left: 16px;
  width: min(296px, calc(100vw - 32px));
  padding: 12px 14px;
  background: var(--obsidian-panel);
  border: 1px solid var(--slate);
  backdrop-filter: blur(8px);
}

.track-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--silver);
  margin-bottom: 9px;
}

.vital-row {
  margin-bottom: 7px;
}

.vital-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--silver);
  margin-bottom: 3px;
}

.vital-bar {
  height: 5px;
  background: rgba(154, 162, 169, 0.18);
}

.vital-fill {
  height: 100%;
  transition: width 0.12s;
}

.fill-hp {
  background: #e2e6ea;
}

.fill-mp {
  background: var(--brass);
}

.fill-stam {
  background: #7c8791;
}

.vector-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgba(154, 162, 169, 0.18);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--silver);
}

.vector-pips {
  display: flex;
  gap: 5px;
}

.vec-pip {
  width: 14px;
  height: 5px;
  border: 1px solid var(--slate);
  background: transparent;
}

.vec-pip.is-live {
  background: var(--white);
  border-color: var(--white);
}

.brace-tag {
  margin-top: 8px;
  padding: 4px 7px;
  border: 1px solid var(--slate);
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-align: center;
  letter-spacing: 0.08em;
  color: var(--silver);
}

.brace-tag.is-active {
  border-color: var(--brass);
  color: var(--brass);
  background: rgba(194, 155, 97, 0.12);
}

/* BOTTOM-CENTER ACTION BAR */
.action-bar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 6px;
  background: var(--obsidian-panel);
  border: 1px solid var(--slate);
  backdrop-filter: blur(8px);
}

.act-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(154, 162, 169, 0.2);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
}

.act-slot:hover {
  border-color: var(--brass);
}

.act-slot kbd {
  font-size: 9.5px;
  color: var(--brass);
  margin-bottom: 3px;
}

.act-slot.is-locked {
  opacity: 0.42;
}

.act-slot.is-awakened {
  border-color: rgba(255, 255, 255, 0.72);
}

/* INTERACT PROMPT */
.interact-banner {
  position: fixed;
  bottom: 92px;
  left: 50%;
  transform: translateX(-50%);
  padding: 9px 18px;
  background: rgba(11, 12, 14, 0.92);
  border: 1px solid var(--brass);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}

.interact-banner.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* FLOATING 3D->2D ENEMY TAGS */
.enemy-tags-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.enemy-tag {
  position: absolute;
  top: 0;
  left: 0;
  padding: 3px 7px;
  background: rgba(11, 12, 14, 0.8);
  border: 1px solid var(--slate);
  min-width: 112px;
}

.enemy-tag.is-staggered {
  border-color: var(--white);
}

.enemy-tag-name {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--white);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.enemy-tag-name span {
  color: var(--brass);
}

.enemy-tag-bar {
  margin-top: 3px;
  height: 3px;
  background: rgba(255, 255, 255, 0.16);
}

.enemy-tag-bar div {
  height: 100%;
  background: var(--brass);
}

/* SYSTEM TOASTS */
.toast-stack {
  position: fixed;
  top: 132px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(520px, calc(100vw - 32px));
  pointer-events: none;
  z-index: 25;
}

.sys-toast {
  padding: 9px 14px;
  background: rgba(11, 12, 14, 0.94);
  border: 1px solid var(--slate);
  border-left: 3px solid var(--silver);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--white);
  text-align: center;
  transition: opacity 0.4s;
}

.sys-toast-brass {
  border-left-color: var(--brass);
}

.sys-toast-bloodline {
  border-color: var(--white);
  border-left: 3px solid var(--white);
  background: rgba(16, 18, 22, 0.98);
}

.sys-toast.is-fading {
  opacity: 0;
}

/* MODALS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(6, 7, 10, 0.78);
  backdrop-filter: blur(8px);
}

.modal-backdrop.is-open {
  display: flex;
}

.modal-box {
  width: min(760px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 18px 20px;
  background: #0e1014;
  border: 1px solid var(--slate);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.72);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--slate);
  margin-bottom: 10px;
}

.modal-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--brass);
  text-transform: uppercase;
}

.modal-head h2 {
  margin-top: 4px;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 20px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.modal-close,
.btn-mini {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--slate);
  color: var(--silver);
  font-family: var(--font-mono);
  font-size: 11px;
  text-decoration: none;
  cursor: pointer;
}

.modal-close:hover,
.btn-mini:hover {
  border-color: var(--brass);
  color: var(--white);
}

.btn-danger:hover {
  border-color: var(--danger);
  color: #f09e9e;
}

.modal-lead {
  font-size: 13px;
  line-height: 1.55;
  color: #d2d8dd;
  margin-bottom: 14px;
}

.status-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 14px;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.status-meta span {
  display: block;
  font-size: 9.5px;
  color: var(--silver);
  text-transform: uppercase;
}

.status-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 0 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--silver);
}

.free-pts-label.has-points {
  color: var(--brass);
  font-weight: 600;
}

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

.stat-cell {
  padding: 7px 9px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--slate);
  font-family: var(--font-mono);
}

.stat-cell.is-boosted {
  border-color: rgba(194, 155, 97, 0.6);
}

.stat-cell-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-k {
  font-size: 10.5px;
  color: var(--silver);
}

.stat-plus {
  padding: 1px 6px;
  background: var(--brass);
  color: var(--obsidian);
  border: none;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}

.stat-val {
  margin-top: 4px;
  font-size: 14px;
  color: var(--white);
}

.stat-eff {
  font-size: 11px;
  color: var(--brass);
}

.status-sums {
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(154, 162, 169, 0.2);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--silver);
}

.chip-row,
.travel-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 4px 9px;
  border: 1px solid var(--slate);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.chip-brass {
  border-color: var(--brass);
  color: var(--brass);
}

.skills-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.skill-row {
  padding: 8px 10px;
  border: 1px solid rgba(154, 162, 169, 0.2);
  background: rgba(255, 255, 255, 0.015);
}

.skill-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.skill-head kbd {
  padding: 1px 5px;
  border: 1px solid var(--brass);
  color: var(--brass);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.skill-rarity {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--silver);
}

.skill-row p {
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.42;
  color: var(--silver);
}

.class-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.class-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--slate);
}

.class-card.is-canon {
  border-color: var(--brass);
  background: rgba(194, 155, 97, 0.07);
}

.class-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.class-num {
  font-family: var(--font-mono);
  color: var(--brass);
}

.canon-badge {
  margin-left: auto;
  padding: 2px 6px;
  background: var(--brass);
  color: var(--obsidian);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
}

.class-summary {
  font-size: 12px;
  color: #d6dce1;
}

.class-growth {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--brass);
}

.class-note {
  font-size: 11px;
  font-style: italic;
  color: var(--silver);
  margin-bottom: 6px;
}

.btn-select-class {
  margin-top: auto;
  padding: 8px 12px;
  background: var(--white);
  color: var(--obsidian);
  border: none;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.btn-select-class:hover {
  background: var(--brass);
}

.dlg-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.dlg-line {
  font-size: 13.5px;
  line-height: 1.6;
  color: #e4e8ec;
}

.dlg-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dlg-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--slate);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.dlg-choice:hover {
  border-color: var(--brass);
  background: rgba(194, 155, 97, 0.1);
}

.dlg-idx {
  font-family: var(--font-mono);
  color: var(--brass);
}

.bloodline-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13.5px;
  line-height: 1.6;
}

.bloodline-stats {
  padding: 12px;
  border: 1px solid var(--white);
  background: rgba(255, 255, 255, 0.04);
  font-family: var(--font-mono);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--slate);
}

.muted-text {
  color: var(--silver);
  font-size: 12px;
}

.text-white {
  color: var(--white);
}

/* MOBILE RESPONSIVE (390px SAFE) */
@media (max-width: 820px) {
  .hide-mobile {
    display: none !important;
  }

  .hud-topbar {
    padding: 8px 10px;
    gap: 6px;
    flex-wrap: nowrap;
  }

  .top-left,
  .top-right {
    flex-wrap: nowrap;
    gap: 5px;
  }

  .brand-pill {
    padding: 5px 7px;
    font-size: 9.5px;
    letter-spacing: 0.1em;
    white-space: nowrap;
  }

  .brand-pill span {
    display: none;
  }

  #hudDayClock {
    display: none;
  }

  .hud-btn {
    padding: 5px 7px;
    font-size: 9.5px;
    white-space: nowrap;
  }

  .quest-card {
    top: 48px;
    right: 10px;
    left: 10px;
    width: auto;
    padding: 8px 10px;
  }

  .toast-stack {
    top: auto;
    bottom: 206px;
  }

  .combat-log {
    display: none;
  }

  .vitals-panel {
    bottom: 64px;
    left: 10px;
    right: 10px;
    width: auto;
    padding: 8px 10px;
  }

  .action-bar {
    bottom: 8px;
    left: 10px;
    right: 10px;
    transform: none;
    justify-content: space-between;
  }

  .act-slot {
    min-width: 0;
    flex: 1;
    padding: 5px 4px;
    font-size: 9px;
  }

  .stats-grid,
  .class-grid,
  .skills-list,
  .status-meta {
    grid-template-columns: 1fr;
  }
}
