/* =====================================================================
   style.css – Rahmen um die Leinwand.

   Das Spiel ist die Leinwand; CSS macht hier nur Boot-Overlay, Messwerte
   und den schwarzen Hintergrund, damit beim Laden nichts aufblitzt.
   Palette und Ton kommen aus dem 2D-KARST (lab/cave/style.css).
   ===================================================================== */

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

html,
body {
  height: 100%;
  background: #05070a;
  color: #d6d2c4;
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
}

#game {
  display: block;
  width: 100vw;
  height: 100vh;
  /* Bis der Pointer-Lock greift, soll der Mauszeiger nicht stören. */
  cursor: default;
}

body.locked #game {
  cursor: none;
}

/* ---------- Overlays ---------- */

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #05070a;
  z-index: 10;
  transition: opacity 0.6s ease;
}

.overlay.fading {
  opacity: 0;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

.boot-inner {
  text-align: center;
  max-width: 34rem;
  padding: 2rem;
}

.boot-inner h1 {
  font-size: clamp(2.5rem, 9vw, 4.5rem);
  font-weight: 300;
  letter-spacing: 0.42em;
  /* Sperrung optisch ausgleichen: das letzte Zeichen schiebt nach rechts */
  text-indent: 0.42em;
  color: #e8e4d8;
}

.subtitle {
  margin-top: 0.4rem;
  font-size: 0.82rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #6b6f74;
}

.boot-status {
  margin-top: 2.6rem;
  font-size: 0.9rem;
  color: #8a8d90;
  min-height: 1.4em;
}

.boot-status.error {
  color: #b87a6a;
}

.prompt {
  margin-top: 1.6rem;
  font-size: 0.9rem;
  color: #d6d2c4;
}

/* ---------- HUD ----------

   Grundsatz: KARST hat keine Balken und keine Prozente. Was hier steht,
   stünde auf einem Zettel im Overall – Aufgabe, Uhr, Ganglänge. Die
   Lampe meldet sich erst, wenn sie schwächer wird. */

.hud {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.hud-top {
  position: absolute;
  top: 1.4rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: 32rem;
  text-align: center;
  color: #a9b0b4;
  text-shadow: 0 1px 6px #05070a;
}

.hud-side {
  position: absolute;
  top: 1.3rem;
  right: 1.4rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.22rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: #8d9498;
  text-shadow: 0 1px 6px #05070a;
}

#hud-length {
  color: #cfc9b8;
}

#hud-lamp {
  color: #9a8f74;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
}

#hud-lamp.warn {
  color: #c07a5e;
}

/* ---------- Handlungsaufforderung ---------- */

.prompt-line {
  position: fixed;
  bottom: 4.6rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 16;
  pointer-events: none;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: #cfcabb;
  background: rgba(5, 7, 10, 0.55);
  text-shadow: 0 1px 6px #05070a;
  white-space: nowrap;
  max-width: calc(100vw - 2rem);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Meldung ---------- */

.toast {
  position: fixed;
  bottom: 7.4rem;
  left: 50%;
  transform: translateX(-50%) translateY(0.5rem);
  z-index: 16;
  pointer-events: none;
  padding: 0.5rem 1rem;
  max-width: min(38rem, calc(100vw - 2rem));
  text-align: center;
  font-size: 0.84rem;
  line-height: 1.5;
  color: #ded9c9;
  background: rgba(5, 7, 10, 0.72);
  border-left: 2px solid #6d7a6f;
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.toast.in {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Blatt: Briefing, Debrief, Abbruch ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 42%, #0d1116 0%, #05070a 62%);
}

.sheet-inner {
  width: min(34rem, calc(100vw - 3rem));
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  padding: 2.2rem 2.4rem;
  border: 1px solid rgba(125, 138, 128, 0.18);
  background: rgba(9, 12, 16, 0.86);
}

.sheet-kind {
  font-size: 0.64rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: #5f6669;
}

.sheet-inner h2 {
  margin-top: 0.5rem;
  font-size: 1.9rem;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: #e8e4d8;
}

.sheet-sub {
  margin-top: 0.5rem;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #8f9599;
}

.sheet-rows {
  margin-top: 1.8rem;
  border-top: 1px solid rgba(125, 138, 128, 0.14);
}

.sheet-rows .row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(125, 138, 128, 0.14);
  font-size: 0.86rem;
  color: #cfc9b8;
}

.sheet-rows .row span:first-child {
  color: #7d8488;
}

.sheet-rows .row.dim {
  color: #8b9195;
}

.sheet-body {
  margin-top: 1.6rem;
  font-size: 0.85rem;
  line-height: 1.72;
  color: #9aa0a4;
}

.sheet-actions {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.sheet-actions button {
  flex: 1 1 8rem;
  padding: 0.66rem 1.2rem;
  font: inherit;
  font-size: 0.84rem;
  letter-spacing: 0.1em;
  color: #b9bec1;
  background: transparent;
  border: 1px solid rgba(125, 138, 128, 0.3);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.sheet-actions button:hover,
.sheet-actions button:focus-visible {
  color: #e8e4d8;
  border-color: rgba(125, 138, 128, 0.6);
  background: rgba(125, 138, 128, 0.1);
}

.sheet-actions button.primary {
  color: #e8e4d8;
  border-color: rgba(200, 190, 160, 0.42);
}

/* ---------- Notizbuch neben der Karte ---------- */

.notebook {
  position: fixed;
  top: 1.4rem;
  left: 1.4rem;
  z-index: 22;
  width: min(19rem, calc(100vw - 2.8rem));
  padding: 1rem 1.1rem;
  font-size: 0.78rem;
  line-height: 1.6;
  color: #b6b1a2;
  background: rgba(9, 12, 16, 0.78);
  border: 1px solid rgba(125, 138, 128, 0.18);
}

.notebook h3 {
  font-size: 0.64rem;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #5f6669;
  margin-bottom: 0.7rem;
}

.notebook ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.notebook li b {
  font-weight: 500;
  color: #8fae9d;
  margin-right: 0.4rem;
}

.notebook li.done {
  color: #5f6669;
  text-decoration: line-through;
}

.notebook li.empty {
  color: #5f6669;
}

.notebook-foot {
  margin-top: 0.9rem;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(125, 138, 128, 0.14);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: #5f6669;
}

/* ---------- Messwerte (nur Entwicklung) ---------- */

.stats {
  position: fixed;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 20;
  padding: 0.4rem 0.6rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.72rem;
  line-height: 1.5;
  color: #7d8a80;
  background: rgba(5, 7, 10, 0.6);
  border: 1px solid rgba(125, 138, 128, 0.16);
  white-space: pre;
  pointer-events: none;
}

/* ---------- Sprungmarken (nur Entwicklungsvorschau) ---------- */

.places {
  position: fixed;
  bottom: 0.7rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.15rem;
  padding: 0.35rem 0.5rem;
  max-width: calc(100vw - 1.4rem);
  font-size: 0.72rem;
  background: rgba(5, 7, 10, 0.72);
  border: 1px solid rgba(125, 138, 128, 0.18);
  backdrop-filter: blur(3px);
}

.places-label {
  margin-right: 0.4rem;
  color: #5f6669;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.62rem;
}

.places a {
  padding: 0.2rem 0.5rem;
  color: #9aa3a7;
  text-decoration: none;
  border-radius: 2px;
}

.places a:hover,
.places a:focus-visible {
  color: #e8e4d8;
  background: rgba(125, 138, 128, 0.14);
}

/* Beim Spielen im Weg – ausblenden, sobald die Maus gefangen ist. */
body.locked .places {
  opacity: 0;
  pointer-events: none;
}

/* Über der Karte hätten sie nichts zu suchen. */
#notebook:not(.hidden)~.places,
#notebook:not(.hidden)~.stats {
  display: none;
}
