/* Forsaken Bailey — all styles. Owned entirely by src/ui/hud.js (HUD agent). */

:root {
  --gold: #c9a86a;
  --gold-faint: rgba(201, 168, 106, 0.45);
  --gold-ghost: rgba(201, 168, 106, 0.2);
  --parchment: #e6ddc8;
  --parchment-dim: #b3a88e;
  --panel-bg: rgba(12, 9, 6, 0.72);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #000;
  overflow: hidden;
}

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  font-family: Georgia, 'Palatino Linotype', 'Times New Roman', serif;
  color: var(--parchment);
  user-select: none;
  -webkit-user-select: none;
}

#hud button {
  pointer-events: auto;
  font-family: inherit;
}

.hidden {
  display: none !important;
}

/* ---- screen-edge vignettes & flashes ---- */

.vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 50%,
    rgba(0, 0, 0, 0.34) 78%,
    rgba(0, 0, 0, 0.62) 100%
  );
}

.damage-vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 38%,
    rgba(122, 12, 8, 0.55) 82%,
    rgba(80, 4, 2, 0.85) 100%
  );
  opacity: 0;
}

.rest-flash {
  position: fixed;
  inset: 0;
  background: radial-gradient(
    circle at 50% 62%,
    rgba(255, 186, 92, 0.55),
    rgba(255, 128, 36, 0.18) 55%,
    transparent 80%
  );
  opacity: 0;
}

/* ---- hp / stamina / boss bars ---- */

.status {
  position: fixed;
  top: 22px;
  left: 24px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.bar {
  position: relative;
  height: 15px;
  background: linear-gradient(rgba(0, 0, 0, 0.78), rgba(20, 16, 10, 0.78));
  border: 1px solid var(--gold-faint);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.75), inset 0 1px 3px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

.bar .ghost,
.bar .fill,
.bar .bar-flash {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 100%;
}

.bar .ghost {
  background: #e3dbc2;
}

/* subtle bevel: light top edge, dark bottom, over the per-bar color */
.bar .fill {
  background-image: linear-gradient(
    rgba(255, 255, 255, 0.28),
    rgba(255, 255, 255, 0.04) 40%,
    rgba(0, 0, 0, 0.28)
  );
}

.bar.hp {
  width: 320px;
}

.bar.hp .fill {
  background-color: #8e1f17;
}

.bar.stamina {
  height: 12px;
  width: 280px;
}

.bar.stamina .fill {
  background-color: #4a7a30;
}

.bar .bar-flash {
  background: #f4e8c8;
  opacity: 0;
}

/* ---- lock-on reticle ---- */

.lock-dot {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  transform: rotate(45deg);
  border: 1.5px solid #efe3b8;
  background: rgba(239, 227, 184, 0.25);
  box-shadow: 0 0 9px rgba(239, 227, 184, 0.75);
  animation: lock-pulse 1.5s ease-in-out infinite;
}

@keyframes lock-pulse {
  50% {
    box-shadow: 0 0 16px rgba(239, 227, 184, 0.95);
  }
}

/* ---- message banner / interact prompt / pickup toast ---- */

.banner {
  position: fixed;
  top: 16%;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 56px;
  font-size: clamp(26px, 3.6vw, 42px);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #ece3cb;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 0, 0, 0.55) 18%,
    rgba(0, 0, 0, 0.55) 82%,
    transparent
  );
  opacity: 0;
  transition: opacity 0.7s ease;
}

.banner.show {
  opacity: 1;
  transition: opacity 0.3s ease;
}

.prompt {
  position: fixed;
  left: 50%;
  bottom: 33%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  font-size: 17px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  background: var(--panel-bg);
  border: 1px solid var(--gold-faint);
}

.keycap {
  display: inline-block;
  padding: 1px 7px;
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--gold);
  border: 1px solid var(--gold-faint);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.55);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 25%;
  transform: translateX(-50%);
  min-width: 230px;
  padding: 10px 26px 12px;
  text-align: center;
  background: var(--panel-bg);
  border: 1px solid var(--gold-faint);
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.6s ease;
}

.toast.show {
  opacity: 1;
  transition: opacity 0.25s ease;
}

.toast-caption {
  font-variant: small-caps;
  letter-spacing: 0.22em;
  font-size: 12px;
  color: var(--parchment-dim);
}

.toast-label {
  margin-top: 2px;
  font-size: 19px;
  letter-spacing: 0.08em;
  color: #f0e6c8;
}

/* ---- souls counter ---- */

.souls-panel {
  position: fixed;
  right: 24px;
  bottom: 20px;
  min-width: 132px;
  padding: 7px 16px 9px;
  text-align: right;
  background: var(--panel-bg);
  border: 1px solid var(--gold-faint);
}

.souls-value {
  font-size: 25px;
  color: #efe6ca;
  transform-origin: right center;
  transition: transform 0.18s ease, color 0.35s ease;
}

.souls-value.bump {
  transform: scale(1.13);
  color: #ffd98c;
}

.souls-caption {
  font-variant: small-caps;
  letter-spacing: 0.26em;
  font-size: 11px;
  color: var(--parchment-dim);
}

.soul-float {
  position: fixed;
  right: 40px;
  bottom: 84px;
  font-size: 16px;
  letter-spacing: 0.08em;
  color: var(--gold);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
  animation: soul-float 1.6s ease-out forwards;
}

@keyframes soul-float {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(-52px);
    opacity: 0;
  }
}

/* ---- equip slots ---- */

.equip-slots {
  position: fixed;
  left: 24px;
  bottom: 20px;
  display: flex;
  gap: 8px;
}

.slot {
  min-width: 104px;
  padding: 6px 12px 8px;
  background: var(--panel-bg);
  border: 1px solid var(--gold-ghost);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.slot-caption {
  font-variant: small-caps;
  letter-spacing: 0.2em;
  font-size: 11px;
  color: var(--parchment-dim);
}

.slot-value {
  margin-top: 2px;
  font-size: 14px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: #e9dfc4;
}

.slot.sipping {
  border-color: #ffce7e;
  box-shadow: 0 0 14px rgba(255, 196, 110, 0.5), inset 0 0 10px rgba(255, 196, 110, 0.18);
}

/* ---- boss bar ---- */

.boss {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  width: min(64vw, 760px);
  text-align: center;
  opacity: 0;
  transition: opacity 0.9s ease;
}

.boss.visible {
  opacity: 1;
  transition: opacity 0.45s ease;
}

.boss-name {
  margin-bottom: 4px;
  font-size: 22px;
  font-variant: small-caps;
  letter-spacing: 0.3em;
  color: #eee3c6;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95);
}

.boss-bar {
  width: 100%;
  height: 13px;
}

.boss-bar .fill {
  background-color: #7c1812;
}

.boss.phase2 .boss-bar {
  animation: boss-pulse 1.5s ease-in-out infinite;
}

@keyframes boss-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.75), inset 0 1px 3px rgba(0, 0, 0, 0.9);
  }
  50% {
    box-shadow: 0 0 14px rgba(255, 46, 22, 0.5), 0 0 0 1px rgba(120, 10, 5, 0.9),
      inset 0 0 12px rgba(255, 46, 22, 0.3);
  }
}

/* ---- credits ---- */
.credits-panel {
  max-width: 460px;
}

.credits-body {
  text-align: center;
}

.credits-line {
  font-style: italic;
  color: #d8cdb2;
  font-size: 14px;
  line-height: 1.6;
}

/* ---- NPC dialogue (subtitle style) ---- */
.dialogue {
  position: fixed;
  left: 50%;
  bottom: 150px;
  transform: translateX(-50%);
  max-width: 620px;
  padding: 10px 22px;
  background: rgba(8, 7, 5, 0.78);
  border: 1px solid rgba(201, 168, 106, 0.45);
  text-align: center;
  pointer-events: none;
}

.dialogue-speaker {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #c9a86a;
  margin-bottom: 4px;
}

.dialogue-text {
  font-size: 15px;
  font-style: italic;
  color: #e8dfc8;
  line-height: 1.45;
}

/* status buildup meters: thin strips under the stamina bar */
.bar.buildup {
  height: 5px;
  width: 220px;
  margin-top: 3px;
}

.bleed-bar .fill {
  background: linear-gradient(#8c2018, #5e120c);
}

.frost-bar .fill {
  background: linear-gradient(#7fb4d8, #4a7fa6);
}

.frost-bar.active .fill {
  animation: frost-pulse 1.2s ease-in-out infinite;
}

@keyframes frost-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.5); }
}

.menu-btn-danger {
  border-color: rgba(160, 50, 40, 0.7) !important;
  color: #c97a6a !important;
}

/* ---- controls help ---- */

.controls {
  position: fixed;
  left: 50%;
  /* sits above the equip-slot row so they never overlap at narrow widths */
  bottom: 96px;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  max-width: 56vw;
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--parchment-dim);
  opacity: 0.85;
  transition: opacity 3s ease;
}

.controls.faded {
  opacity: 0;
}

.control {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

/* ---- YOU DIED / VICTORY overlays ---- */

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
}

.overlay-text {
  white-space: nowrap;
}

.died {
  background: linear-gradient(
    transparent 28%,
    rgba(0, 0, 0, 0.9) 45%,
    rgba(0, 0, 0, 0.9) 62%,
    transparent 78%
  );
  transition: opacity 1.1s ease; /* fade-out on respawn */
}

.died.show {
  opacity: 1;
  transition: opacity 2.6s ease; /* slow fade-in on death */
}

.died .overlay-text {
  color: #66100c;
  font-size: clamp(56px, 9vw, 124px);
  letter-spacing: 0.24em;
  text-shadow: 0 0 34px rgba(140, 18, 10, 0.85);
  transform: scale(1);
  transition: transform 1s ease;
}

.died.show .overlay-text {
  transform: scale(1.07);
  transition: transform 7s ease-out;
}

.victory {
  background: linear-gradient(
    transparent 30%,
    rgba(0, 0, 0, 0.82) 46%,
    rgba(0, 0, 0, 0.82) 60%,
    transparent 76%
  );
  transition: opacity 2.2s ease;
}

.victory.show {
  opacity: 1;
  transition: opacity 1.6s ease;
}

.victory .overlay-text {
  color: #d3a73e;
  font-size: clamp(40px, 6.4vw, 92px);
  letter-spacing: 0.3em;
  text-shadow: 0 0 30px rgba(255, 204, 92, 0.55);
}

/* ---- menus (bonfire / equipment) ---- */

.menu {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  pointer-events: auto;
}

.panel {
  min-width: 330px;
  max-width: 86vw;
  max-height: 84vh;
  overflow-y: auto;
  padding: 22px 34px 26px;
  background: rgba(13, 10, 6, 0.92);
  border: 1px solid rgba(201, 168, 106, 0.6);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.85), 0 10px 50px rgba(0, 0, 0, 0.75),
    inset 0 0 60px rgba(0, 0, 0, 0.55);
}

.menu-title {
  margin: 0 0 16px;
  padding-bottom: 10px;
  font-size: 24px;
  font-weight: normal;
  font-variant: small-caps;
  letter-spacing: 0.3em;
  text-align: center;
  color: var(--gold);
  border-bottom: 1px solid var(--gold-ghost);
}

.menu-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-btn {
  padding: 9px 14px;
  font-size: 17px;
  font-variant: small-caps;
  letter-spacing: 0.14em;
  color: var(--parchment);
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.menu-btn:hover:not(:disabled) {
  background: rgba(201, 168, 106, 0.13);
  border-color: var(--gold-faint);
}

.menu-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.back-btn,
.close-btn {
  margin-top: 14px;
}

.close-btn {
  width: 100%;
}

/* level-up panel */

.levelup-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--parchment-dim);
}

.stat-row {
  display: grid;
  grid-template-columns: 1fr 44px 34px;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
  border-bottom: 1px solid rgba(201, 168, 106, 0.12);
}

.stat-name {
  font-size: 16px;
  letter-spacing: 0.06em;
}

.stat-hint {
  display: block;
  font-style: normal;
  font-size: 11.5px;
  letter-spacing: 0.05em;
  color: var(--parchment-dim);
}

.stat-value {
  text-align: right;
  font-size: 17px;
  color: #f0e6c8;
}

.plus-btn {
  width: 30px;
  height: 27px;
  font-size: 17px;
  line-height: 1;
  color: var(--gold);
  background: none;
  border: 1px solid var(--gold-faint);
  cursor: pointer;
  transition: background 0.15s ease;
}

.plus-btn:hover:not(:disabled) {
  background: rgba(201, 168, 106, 0.18);
}

.plus-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* equipment menu */

.equip-panel {
  min-width: 560px;
}

.equip-cols {
  display: flex;
  gap: 28px;
}

.equip-col {
  flex: 1;
  min-width: 150px;
}

.col-title {
  margin-bottom: 8px;
  padding-bottom: 5px;
  font-size: 14px;
  font-variant: small-caps;
  letter-spacing: 0.22em;
  color: var(--gold);
  border-bottom: 1px solid var(--gold-ghost);
}

.equip-item {
  display: block;
  width: 100%;
  margin-bottom: 3px;
  padding: 7px 10px;
  text-align: left;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: #d9d0b6;
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.equip-item:hover {
  background: rgba(201, 168, 106, 0.1);
}

.equip-item.current {
  color: #f4ead0;
  background: rgba(201, 168, 106, 0.16);
  border-color: rgba(201, 168, 106, 0.6);
}

.equip-footer {
  margin-top: 16px;
  padding-top: 10px;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--parchment-dim);
  border-top: 1px solid var(--gold-ghost);
}
