:root {
  --gold: #f1cc88;
  --gold-deep: #e5a960;
  --gold-text: #f6dba8;
  --ink: #1a1208;
  --hud-dark: rgba(10, 20, 30, 0.72);
  --hud-edge: rgba(70, 110, 140, 0.45);
  --cyan: #3ce8e4;
  --cyan-deep: #18c8c4;
  --hull: #15e21b;
  --paper: #f4ead2;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b0a08;
  font-family: "Rajdhani", "Trebuchet MS", sans-serif;
  color: #fff;
  user-select: none;
}

#stage {
  position: fixed;
  inset: 0;
}

#c {
  display: block;
  width: 100%;
  height: 100%;
}

.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

#title-block {
  position: absolute;
  top: 0.6%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  text-shadow:
    0 2px 0 #3a2a12,
    0 3px 10px rgba(0, 0, 0, 0.55);
}

.title-main {
  font-family: "Cinzel Decorative", "Cinzel", "Palatino Linotype", serif;
  font-weight: 700;
  font-size: clamp(28px, 3.4vw, 52px);
  letter-spacing: 0.14em;
  line-height: 1;
  background: linear-gradient(180deg, #fff4d2 0%, #f1cc88 42%, #c98a3e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 0 #5a3d18);
}

.title-sub {
  font-family: "Cinzel", "Palatino Linotype", serif;
  font-weight: 700;
  font-size: clamp(11px, 1.15vw, 17px);
  letter-spacing: 0.42em;
  color: #e8c07a;
  margin-top: 2px;
  margin-left: 0.42em;
}

/* Top-right resource bars */
#stats {
  position: absolute;
  top: 10px;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  min-width: 210px;
}

.stat {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 4px 14px 4px 48px;
  background: linear-gradient(90deg, rgba(12, 28, 42, 0) 0%, rgba(14, 32, 48, 0.82) 38%, rgba(10, 24, 38, 0.9) 100%);
  min-width: 200px;
}

.stat-num {
  font-weight: 700;
  font-size: clamp(16px, 1.45vw, 22px);
  color: #e7f4fc;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 3px #000;
}

.stat.gold .stat-num { color: #f0c85a; }

.stat-ico {
  width: 26px;
  height: 26px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px #000);
}

/* First-person gun */
#gun {
  position: absolute;
  right: -1%;
  bottom: -10%;
  width: min(44vw, 620px);
  pointer-events: none;
  z-index: 6;
  transform-origin: 78% 90%;
  transform: rotate(-12deg);
  filter: drop-shadow(0 18px 18px rgba(0, 0, 0, 0.45));
  transition: transform 0.08s linear;
}

#gun.recoil {
  transform: rotate(-4deg) translate(10px, 8px);
}

#gun.bob {
  transform: rotate(-7deg) translateY(6px);
}

/* Objective sits under the gun arm */
#objective {
  position: absolute;
  left: 50%;
  bottom: 2.4%;
  transform: translateX(-50%);
  text-align: center;
  padding: 8px 36px 10px;
  background: linear-gradient(90deg, rgba(30, 22, 10, 0) 0%, rgba(28, 22, 12, 0.72) 22%, rgba(28, 22, 12, 0.72) 78%, rgba(30, 22, 10, 0) 100%);
  z-index: 4;
  min-width: 360px;
}

.obj-label {
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.22em;
  color: #f3e0b0;
  text-shadow: 0 1px 3px #000;
}

.obj-text {
  font-weight: 600;
  font-size: clamp(14px, 1.25vw, 18px);
  color: #fff8e8;
  text-shadow: 0 1px 4px #000;
}

/* Compass */
#compass-wrap {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 8;
}

.compass-label {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.16em;
  color: #f4ead2;
  text-shadow: 0 2px 4px #000;
  margin: 0 0 4px 8px;
}

#compass {
  position: relative;
  width: 196px;
  height: 196px;
  border-radius: 50%;
  overflow: hidden;
  background: #1a120c;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45), inset 0 0 0 3px #3a2a18;
}

#compass-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45));
}

#radar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#radar-ship {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  filter: drop-shadow(0 1px 2px #000);
}

.cardinal {
  position: absolute;
  font-weight: 700;
  font-size: 14px;
  color: #f7ecd4;
  text-shadow: 0 1px 3px #000;
}

.cardinal.n { top: 16px; left: 50%; transform: translateX(-50%); }
.cardinal.s { bottom: 16px; left: 50%; transform: translateX(-50%); }
.cardinal.e { right: 16px; top: 50%; transform: translateY(-50%); }
.cardinal.w { left: 16px; top: 50%; transform: translateY(-50%); }

/* Hull bar */
#hull {
  position: absolute;
  left: 228px;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 0;
  z-index: 8;
}

.hull-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #2a2218, #14100c 70%);
  border: 3px solid #1a140e;
  box-shadow: inset 0 0 0 2px #3a3024, 0 2px 6px #000;
  display: grid;
  place-items: center;
  z-index: 2;
  margin-right: -10px;
}

.hull-icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.hull-body {
  background: linear-gradient(180deg, #2a241c, #16120e);
  border: 2px solid #1c1610;
  border-radius: 8px;
  padding: 4px 12px 6px 18px;
  min-width: 210px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
}

.hull-label {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #efe3c4;
}

.hull-track {
  position: relative;
  height: 16px;
  background: #1a120c;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #0c0a08;
}

.hull-fill {
  height: 100%;
  width: 75%;
  background: linear-gradient(180deg, #6cff62 0%, #15e21b 45%, #0aa310 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.hull-pct {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  text-shadow: 0 1px 2px #000;
}

/* Terrain paint */
#paint-panel {
  position: absolute;
  right: 132px;
  bottom: 148px;
  z-index: 8;
  min-width: 230px;
}

.paint-label {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.18em;
  color: #f3e2b4;
  text-align: right;
  margin-right: 72px;
  text-shadow: 0 2px 4px #000;
}

.paint-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.paint-col { flex: 1; }

.paint-track {
  position: relative;
  height: 22px;
  background: #1a140e;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #2a2218;
  box-shadow: 0 2px 6px #0008;
}

.paint-fill {
  height: 100%;
  width: 78%;
  background: linear-gradient(180deg, #9efef8 0%, #3ce8e4 40%, #14b8c0 100%);
}

.paint-pct {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  text-shadow: 0 1px 2px #000;
}

.paint-name {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.16em;
  color: #5ce8e8;
  text-align: center;
  margin-top: 4px;
  text-shadow: 0 1px 4px #063;
}

.vial {
  width: 58px;
  height: 88px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px #000a);
}

/* Speedometer */
#speedo {
  position: absolute;
  right: 16px;
  bottom: 14px;
  width: 148px;
  height: 148px;
  z-index: 8;
}

#speedo-bg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px #0008);
}

.speedo-read {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 8px;
}

.speedo-num {
  font-weight: 700;
  font-size: 34px;
  line-height: 1;
  color: #f7f0dc;
  text-shadow: 0 2px 4px #000;
}

.speedo-unit {
  font-weight: 700;
  font-size: 14px;
  color: #efe3c0;
  letter-spacing: 0.04em;
}

/* Menu */
#menu, #pause {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
}

.menu-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 10, 16, 0.35) 0%, rgba(8, 10, 16, 0.55) 100%),
    url("../assets/bg/menu_bg.png") center / cover no-repeat;
}

#pause .menu-shade {
  background: rgba(6, 8, 12, 0.62);
}

.menu-card {
  position: relative;
  text-align: center;
  padding: 36px 48px 28px;
  max-width: 560px;
  background: linear-gradient(180deg, rgba(18, 16, 12, 0.78), rgba(10, 12, 16, 0.86));
  border: 1px solid rgba(225, 190, 120, 0.35);
  box-shadow: 0 20px 60px #000a, inset 0 0 40px rgba(80, 50, 10, 0.15);
}

.menu-card.slim { padding: 28px 40px; }

.menu-kicker {
  letter-spacing: 0.38em;
  font-size: 12px;
  color: #d8c090;
  margin-bottom: 8px;
}

.menu-card h1 {
  font-family: "Cinzel Decorative", "Cinzel", serif;
  font-size: 58px;
  letter-spacing: 0.12em;
  line-height: 0.95;
  background: linear-gradient(180deg, #fff4d2, #e5a960);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.menu-card h2 {
  font-family: "Cinzel", serif;
  letter-spacing: 0.42em;
  font-size: 18px;
  color: #e8c07a;
  margin: 6px 0 18px;
}

.menu-blurb {
  color: #efe6d2;
  font-size: 16px;
  line-height: 1.45;
  margin-bottom: 22px;
}

#btn-embark, #btn-resume {
  pointer-events: auto;
  cursor: pointer;
  border: 0;
  padding: 12px 42px;
  font-family: "Cinzel", serif;
  font-weight: 700;
  letter-spacing: 0.28em;
  font-size: 16px;
  color: #2a1a08;
  background: linear-gradient(180deg, #ffe7b0, #d4a04a);
  box-shadow: 0 4px 0 #7a5018, 0 8px 18px #0006;
}

#btn-embark:hover, #btn-resume:hover {
  filter: brightness(1.08);
}

.menu-controls {
  margin-top: 22px;
  color: #d8cbb0;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 1px 6px;
  margin: 0 2px;
  border: 1px solid #8a7350;
  border-bottom-width: 2px;
  border-radius: 3px;
  background: #2a2218;
  color: #f3e2b4;
  font-family: inherit;
  font-size: 12px;
}

.hint { margin-top: 14px; color: #d8cbb0; font-size: 14px; }

#toast {
  position: absolute;
  top: 14%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  font-family: "Cinzel", serif;
  font-size: 20px;
  color: #fff4d0;
  text-shadow: 0 2px 8px #000;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

#toast.show { opacity: 1; }

#hint-bar {
  position: absolute;
  bottom: 118px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #efe3c4;
  text-shadow: 0 1px 4px #000;
  opacity: 0;
  pointer-events: none;
}

#hint-bar.show { opacity: 1; }

@media (max-width: 900px) {
  #compass { width: 150px; height: 150px; }
  #hull { left: 172px; transform: scale(0.86); transform-origin: left bottom; }
  #paint-panel { right: 100px; bottom: 118px; transform: scale(0.86); transform-origin: right bottom; }
  #speedo { width: 112px; height: 112px; }
  #gun { width: 62vw; }
  .title-main { font-size: 26px; }
}
