:root {
  --ink: #16120f;
  --silk: #f4efe3;
  --gold: #d9a441;
  --cinnabar: #c8342f;
  --jade: #2f8f7a;
  --panel: rgba(20, 17, 14, 0.62);
  --edge: rgba(217, 164, 65, 0.42);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0d12;
  color: var(--silk);
  font-family: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif CJK SC", "SimSun", Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

#scene { display: block; width: 100vw; height: 100vh; cursor: crosshair; }

.hidden { display: none !important; }

#boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 42%, #2a3a4e 0%, #12171f 58%, #07090c 100%);
  z-index: 200;
  transition: opacity 0.7s ease;
}
.boot-inner { text-align: center; }
.boot-seal {
  width: 84px; margin: 0 auto 26px;
  padding: 12px 0;
  font-size: 26px; line-height: 1.16; letter-spacing: 2px;
  color: #f6e7c8;
  background: linear-gradient(160deg, #b8342c, #8d221d);
  border: 2px solid rgba(246, 231, 200, 0.5);
  border-radius: 4px;
  box-shadow: 0 0 40px rgba(200, 52, 47, 0.4);
}
.boot-title { font-size: 20px; letter-spacing: 10px; color: #e8dcc4; }
.boot-sub { margin-top: 12px; font-size: 13px; letter-spacing: 4px; color: #8fa3b5; }
.boot-bar {
  width: 260px; height: 2px; margin: 26px auto 0;
  background: rgba(255, 255, 255, 0.12); overflow: hidden;
}
.boot-bar i {
  display: block; height: 100%; width: 40%;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: sweep 1.4s ease-in-out infinite;
}
@keyframes sweep { 0% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }
.boot-tip { margin-top: 20px; font-size: 12px; color: #6d8092; letter-spacing: 3px; }

#crosshair {
  position: fixed; left: 50%; top: 50%;
  width: 22px; height: 22px; margin: -11px 0 0 -11px;
  pointer-events: none; z-index: 30; opacity: 0.85;
}
#crosshair span {
  position: absolute; background: rgba(255, 248, 232, 0.9);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.7);
}
#crosshair span:nth-child(1) { left: 10px; top: 0; width: 1.5px; height: 7px; }
#crosshair span:nth-child(2) { left: 10px; bottom: 0; width: 1.5px; height: 7px; }
#crosshar span:nth-child(3) { }
#crosshair span:nth-child(3) { left: 0; top: 10px; height: 1.5px; width: 7px; }
#crosshair span:nth-child(4) { right: 0; top: 10px; height: 1.5px; width: 7px; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 20; }

#compass {
  position: absolute; left: 50%; top: 18px; transform: translateX(-50%);
  width: 460px; height: 30px; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent);
}
#compassStrip {
  position: absolute; top: 0; left: 0; height: 100%;
  display: flex; align-items: center;
  font-size: 12px; letter-spacing: 1px; color: rgba(255, 246, 228, 0.82);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}
#compassStrip i { font-style: normal; display: inline-block; width: 40px; text-align: center; }
#compassStrip i.card { color: var(--gold); font-size: 14px; }
#compassNeedle {
  position: absolute; left: 50%; top: 2px; width: 1px; height: 12px;
  background: var(--gold); transform: translateX(-50%);
  box-shadow: 0 0 6px rgba(217, 164, 65, 0.9);
}

#modeTag {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  text-align: center;
}
#modeName {
  display: block; font-size: 20px; letter-spacing: 8px; color: #f6ecd6;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}
#modeHint {
  display: block; margin-top: 6px; font-size: 11px; letter-spacing: 2px;
  color: rgba(232, 220, 196, 0.62); font-style: normal;
}

#placeName {
  position: absolute; left: 50%; top: 54px; transform: translateX(-50%);
  font-size: 15px; letter-spacing: 6px; color: rgba(244, 236, 218, 0.9);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
  opacity: 0; transition: opacity 0.5s ease;
}

#minimap {
  position: absolute; right: 20px; bottom: 20px;
  width: 188px; height: 188px;
  border: 1px solid var(--edge);
  border-radius: 50%;
  background: rgba(10, 14, 18, 0.55);
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.5);
}

#stats {
  position: absolute; left: 20px; bottom: 20px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px; line-height: 1.7;
  color: rgba(200, 214, 226, 0.6);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

#keycard {
  position: fixed; left: 20px; top: 20px; z-index: 40;
  padding: 16px 20px 18px;
  background: var(--panel);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  border: 1px solid var(--edge);
  border-radius: 6px;
  max-width: 330px;
}
.kc-title {
  font-size: 13px; letter-spacing: 6px; color: var(--gold);
  padding-bottom: 10px; margin-bottom: 10px;
  border-bottom: 1px solid rgba(217, 164, 65, 0.22);
}
.kc-grid > div {
  display: flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: rgba(238, 230, 212, 0.78);
  margin: 7px 0;
}
.kc-grid span { margin-left: 6px; opacity: 0.72; }
kbd {
  display: inline-block; min-width: 20px; padding: 2px 6px;
  font-family: ui-monospace, Menlo, monospace; font-size: 10.5px;
  text-align: center; color: #f2e8d2;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-bottom-width: 2px;
  border-radius: 4px;
}

#toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  z-index: 60; pointer-events: none;
  font-size: 26px; letter-spacing: 10px; color: #f7ecd2;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.95);
  opacity: 0; transition: opacity 0.35s ease;
}
#toast.show { opacity: 1; }

#lockHint {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: rgba(6, 9, 13, 0.55);
  backdrop-filter: blur(3px);
  cursor: pointer;
}
.lock-card {
  text-align: center; padding: 40px 64px;
  border: 1px solid var(--edge); border-radius: 8px;
  background: rgba(14, 18, 24, 0.6);
}
.lock-big { font-size: 30px; letter-spacing: 14px; color: #f6e9cf; }
.lock-sub { margin-top: 12px; font-size: 12.5px; letter-spacing: 4px; color: #93a6b8; }
.lock-keys { margin-top: 26px; font-size: 11.5px; color: rgba(220, 212, 196, 0.7); }
.lock-keys kbd { margin: 0 2px; }

#fatal {
  position: fixed; inset: 0; z-index: 300; display: grid; place-items: center;
  background: #0b0e12; color: #d8c9ab; padding: 40px;
  font-family: ui-monospace, Menlo, monospace; font-size: 13px; white-space: pre-wrap;
  overflow: auto;
}
