:root {
  --parchment: #ece0c4;
  --ink: #2e2416;
  --accent: #8a2b1e;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: #cdbd97; font-family: Georgia, "Times New Roman", serif; color: var(--ink); }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(44,30,14,.26) 100%);
}

.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * { pointer-events: none; }

#hud-topleft { position: absolute; top: 16px; left: 18px; text-shadow: 0 1px 0 rgba(236,224,196,.6); }
#hud-title {
  font-size: 20px; letter-spacing: .22em; font-weight: 700; color: var(--ink);
}
#hud-title span { color: var(--accent); }
#hud-place {
  margin-top: 2px; font-style: italic; font-size: 15px; color: #4a3b24;
}

#hud-compass {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  width: 54px; height: 54px; border-radius: 50%;
  background: rgba(236,224,196,.85); border: 2px solid #5c4a2e;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(46,36,22,.35);
}
#compass-letter { font-weight: 700; font-size: 18px; }
#compass-needle {
  position: absolute; inset: 0; display: flex; justify-content: center;
  color: var(--accent); font-size: 11px; line-height: 1; padding-top: 2px;
  transform-origin: 50% 50%;
}

#hud-speed {
  position: absolute; right: 20px; top: 14px;
  background: rgba(236,224,196,.85); border: 2px solid #5c4a2e; border-radius: 10px;
  padding: 6px 14px 7px; text-align: center; box-shadow: 0 2px 8px rgba(46,36,22,.35);
}
#speed-num { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
#hud-speed .unit { margin-left: 5px; font-size: 12px; color: #6b5636; }

#hud-hints {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  font-size: 12.5px; color: #4a3b24; background: rgba(236,224,196,.72);
  padding: 4px 14px; border-radius: 999px; white-space: nowrap;
}

/* ---------- Minimap ---------- */
#minimap-box { position: absolute; left: 16px; bottom: 14px; pointer-events: auto; }
#minimap {
  display: block; border: 3px solid #5c4a2e; border-radius: 6px;
  box-shadow: 0 4px 14px rgba(46,36,22,.45); cursor: crosshair;
  background: var(--parchment);
}
#teleports { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 5px; max-width: 170px; }
#teleports button {
  font-family: Georgia, serif; font-size: 11px; cursor: pointer;
  background: rgba(236,224,196,.9); color: var(--ink);
  border: 1px solid #5c4a2e; border-radius: 999px; padding: 2px 9px;
}
#teleports button:hover { background: #fff3d6; }

/* ---------- Big map ---------- */
#bigmap {
  position: fixed; inset: 0; z-index: 40; background: rgba(30,23,12,.82);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
}
#bigmap-inner { position: relative; height: min(88vh, 1024px); }
#bigmap-inner img {
  height: 100%; display: block; border: 4px solid #3a2d1c; border-radius: 4px;
  box-shadow: 0 10px 50px rgba(0,0,0,.6); cursor: crosshair; user-select: none;
}
#bigmap-marker {
  position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%; background: var(--accent); border: 2px solid #fff;
  box-shadow: 0 0 0 3px rgba(138,43,30,.35), 0 0 12px rgba(0,0,0,.5);
  pointer-events: none;
}
#bigmap-caption { color: #e8dcc0; font-size: 13.5px; font-style: italic; }

/* ---------- Intro ---------- */
#intro {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at center, rgba(58,45,28,.25), rgba(30,23,12,.78)),
    url("images/map.jpg") center/cover;
}
#intro-card {
  width: min(620px, 92vw); max-height: 92vh; overflow: auto;
  background: var(--parchment); color: var(--ink);
  border: 3px solid #3a2d1c; border-radius: 8px; outline: 1px solid #a08c62; outline-offset: -8px;
  padding: 30px 38px 24px; box-shadow: 0 18px 70px rgba(0,0,0,.65);
  text-align: center;
}
#intro-card h1 { margin: 0; font-size: 42px; letter-spacing: .18em; }
#intro-card h1 em { font-style: normal; color: var(--accent); }
#intro-card .sub { margin: 8px 0 18px; font-style: italic; font-size: 16px; color: #4a3b24; }
#intro-card .cols { display: flex; gap: 28px; justify-content: center; text-align: left; }
#intro-card .cols h3 {
  margin: 0 0 6px; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: #6b5636;
  border-bottom: 1px solid #b7a67e; padding-bottom: 4px;
}
#intro-card ul { margin: 0; padding: 0; list-style: none; font-size: 14.5px; line-height: 1.75; }
#intro-card .note {
  margin: 18px 0 6px; font-size: 13.5px; font-style: italic; color: #55441f; line-height: 1.55;
}
#start-btn {
  margin-top: 12px; font-family: Georgia, serif; font-size: 19px; letter-spacing: .06em;
  background: var(--accent); color: #f5ead0; border: 2px solid #5a1b12;
  border-radius: 8px; padding: 11px 34px; cursor: pointer;
  box-shadow: 0 4px 0 #5a1b12;
}
#start-btn:hover { filter: brightness(1.1); }
#start-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #5a1b12; }
#intro-card .credit { margin: 16px 0 0; font-size: 11.5px; color: #80704e; }

#webgl-fail {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: var(--parchment); color: var(--ink); font-size: 18px; padding: 40px; text-align: center;
}

@media (max-width: 700px) {
  #hud-hints { display: none; }
  #intro-card .cols { flex-direction: column; gap: 10px; }
  #intro-card h1 { font-size: 30px; }
}
