/* style.css - the look of the HUD and menus (not the 3D world) */

body {
  margin: 0;
  overflow: hidden;
  background: #000;
  font-family: "Segoe UI", Arial, sans-serif;
  color: #fff;
  user-select: none;
}

#game canvas { display: block; }

.panel {
  position: fixed;
  background: rgba(20, 28, 22, 0.6);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 10px 14px;
  z-index: 2;
}

#title-panel { top: 12px; left: 12px; line-height: 1.5; }
.era { color: #ffcf7a; font-size: 14px; }
.small { font-size: 12px; opacity: 0.7; }

#bars { bottom: 16px; left: 16px; width: 220px; }
.bar-label { font-size: 12px; margin-top: 4px; }
.bar {
  height: 10px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 6px;
  overflow: hidden;
  margin: 3px 0 6px;
}
.fill { height: 100%; transition: width 0.15s; }
.fill.health { background: linear-gradient(90deg, #d13a3a, #ff6b5a); }
.fill.stamina { background: linear-gradient(90deg, #e0a020, #ffe066); }
.bar.low { animation: pulse 0.8s infinite alternate; }
.bar.swim .fill.stamina { background: linear-gradient(90deg, #2a8ad0, #7ad0ff); }
@keyframes pulse { to { box-shadow: 0 0 10px #ff3030; } }

#message {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translate(-50%, -10px);
  font-size: 22px;
  font-weight: bold;
  text-shadow: 0 2px 8px #000;
  opacity: 0;
  transition: opacity 0.4s, transform 0.4s;
  pointer-events: none;
  text-align: center;
  z-index: 3;
}
#message.show { opacity: 1; transform: translate(-50%, 0); }

#hint {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 15px;
  text-shadow: 0 1px 4px #000;
  pointer-events: none;
}

#damage-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle, transparent 40%, rgba(200, 0, 0, 0.7));
  opacity: 0;
  z-index: 4;
}
#damage-flash.hit { animation: flash 0.7s ease-out; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

#start-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  z-index: 10;
  cursor: pointer;
}
#start-screen.hidden { display: none; }
.card {
  background: rgba(25, 30, 24, 0.85);
  border: 1px solid rgba(255, 207, 122, 0.4);
  border-radius: 14px;
  padding: 24px 32px;
  max-width: 560px;
  width: calc(100% - 32px);
  box-sizing: border-box;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.card h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: 1px; }
.card { max-height: 94vh; overflow-y: auto; }
/* Controls in two columns so the start screen fits on small screens */
.card table { margin: 10px auto; border-collapse: collapse; font-size: 13px; }
.card table tbody { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; }
.card table tr { display: flex; }
.card td { padding: 2px 6px; text-align: left; }
.card td:first-child { min-width: 92px; }
@media (max-width: 520px) { .card table tbody { grid-template-columns: 1fr; } }
.card td:first-child { color: #ffcf7a; font-weight: bold; text-align: right; }
.card button {
  margin-top: 8px;
  padding: 10px 28px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  background: #e8a33a;
  color: #241405;
  font-weight: bold;
  cursor: pointer;
}
.card button:hover { background: #ffbe55; }
.card button.secondary { background: transparent; color: #ffcf7a; border: 1px solid #ffcf7a; margin-left: 8px; }
.card button.secondary:hover { background: rgba(255, 207, 122, 0.15); }
#save-info { margin: 0 0 6px; }
.volume-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 4px 0 10px; font-size: 14px; }
.volume-row input { width: 160px; accent-color: #e8a33a; }

.save-panel { margin: 6px 0 12px; padding: 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.05); }
.save-buttons { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.card button.small-btn { margin: 0; padding: 5px 10px; font-size: 12px; }

#saved-icon { opacity: 0; transition: opacity 0.5s; }
#saved-icon.show { opacity: 0.8; }

#inventory { bottom: 16px; right: 16px; min-width: 200px; }
.inv-row { display: flex; gap: 14px; font-size: 16px; margin-bottom: 4px; }

#camp-compass {
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 14px;
}
#camp-arrow { display: inline-block; font-size: 18px; color: #ffcf7a; transition: transform 0.1s linear; }

#minimap {
  position: fixed;
  left: 16px;
  bottom: 124px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  z-index: 2;
}

.bubble {
  position: fixed;
  transform: translate(-50%, -100%);
  background: rgba(255, 250, 238, 0.95);
  color: #2a1d14;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
  max-width: 220px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 3;
  display: none;
}
.bubble.show { opacity: 1; }
.bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  margin-left: -6px;
  border: 6px solid transparent;
  border-top-color: rgba(255, 250, 238, 0.95);
  border-bottom: 0;
}

#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 2;
}

#craft-menu {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 11;
}
#craft-menu.show { display: flex; }
.craft-card-wrap { max-width: 560px; width: calc(100% - 32px); max-height: 88vh; overflow-y: auto; text-align: left; }
.craft-card-wrap h2 { margin: 0 0 4px; text-align: center; }
.craft-card-wrap > p { text-align: center; }
#craft-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.craft-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.craft-card.locked { opacity: 0.7; }
.craft-icon { font-size: 28px; width: 36px; text-align: center; }
.craft-info { flex: 1; font-size: 14px; }
.craft-info .small { margin: 2px 0 4px; }
.costs { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.cost.ok { color: #9be38a; }
.cost.short { color: #ff8a7a; }
.craft-card button {
  margin: 0;
  padding: 8px 14px;
  font-size: 13px;
  white-space: nowrap;
}
.card .craft-card button:disabled { background: #555; color: #bbb; cursor: default; }
#craft-close { display: block; margin: 0 auto; }

#quest-panel { top: 12px; right: 12px; width: 250px; font-size: 13px; }
.quest-title { font-weight: bold; color: #ffcf7a; margin-bottom: 4px; }
.quest { margin: 6px 0; }
.qbar { height: 5px; background: rgba(0, 0, 0, 0.4); border-radius: 3px; margin-top: 3px; overflow: hidden; }
.qbar div { height: 100%; background: linear-gradient(90deg, #7ac74f, #c8f07a); transition: width 0.3s; }

#quest-banner {
  position: fixed;
  top: 26%;
  left: 50%;
  transform: translate(-50%, -20px) scale(0.9);
  padding: 14px 26px;
  border-radius: 14px;
  background: rgba(30, 40, 20, 0.85);
  border: 2px solid #ffcf7a;
  text-align: center;
  opacity: 0;
  transition: opacity 0.4s, transform 0.4s;
  pointer-events: none;
  z-index: 5;
}
#quest-banner.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
#quest-banner-title { font-size: 22px; font-weight: bold; color: #ffe08a; }
#quest-banner-text { font-size: 16px; margin-top: 4px; }

#journal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 11;
}
#journal.show { display: flex; }
.journal-card { max-width: 760px; width: calc(100% - 32px); max-height: 90vh; overflow-y: auto; text-align: left; }
.journal-card h2 { margin: 0 0 8px; text-align: center; }
.tabs { display: flex; gap: 6px; justify-content: center; margin-bottom: 10px; }
.card .tabs .tab { margin: 0; padding: 6px 14px; font-size: 13px; background: rgba(255, 255, 255, 0.08); color: #fff; }
.card .tabs .tab.active { background: #e8a33a; color: #241405; }
.center { text-align: center; }
.jrow { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; margin-bottom: 4px; background: rgba(255, 255, 255, 0.05); }
.jrow.done { opacity: 0.65; }
.jrow.later { opacity: 0.45; }
.jstatus { font-size: 18px; }
.jinfo { flex: 1; font-size: 14px; }
.jgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.jcard { padding: 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 207, 122, 0.25); font-size: 14px; }
.jcard.locked { opacity: 0.55; border-style: dashed; }
.jcard .small { margin-top: 4px; line-height: 1.35; }
.jicon { font-size: 34px; }
.danger { font-weight: bold; }
.dim { opacity: 0.7; }
#journal-close { display: block; margin: 12px auto 0; }

#faint-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 28px;
  background: rgba(0, 0, 0, 0.85);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s;
  z-index: 9;
}
#faint-screen.show { opacity: 1; }
