/* Interaktive Bauanleitung - Optik an das PDF angelehnt */

:root {
  --dark:  #26292f;
  --gray:  #74787e;
  --light: #e0e3e6;
  --accent:#cc1a1a;
  --note:  #8c6b0d;
  --box:   #f7f7fa;
  --hl:    #ffcd00;   /* Markierungsfarbe wie im PDF */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #ffffff;
  color: var(--dark);
  font-family: "Segoe UI", Tahoma, Verdana, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#gl {
  position: fixed;
  left: 0; top: 0;
  width: 100%; height: 100%;
  display: block;
  z-index: 0;
}

#ui {
  position: fixed;
  left: 0; top: 0; right: 0; bottom: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

/* ------------------------------------------------------------- Kopfzeile */
#header { flex: 0 0 auto; }

.hdr {
  background: var(--dark);
  color: #fff;
  height: 46px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 14px;
}
.hdr-title {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hdr-sub {
  margin-left: auto;
  font-size: 13px;
  font-weight: 400;
  opacity: .8;
  white-space: nowrap;
}
.badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  border-radius: 6px;
  padding: 4px 14px;
  white-space: nowrap;
}
.hdr-cover { height: 70px; }
.hdr-cover .hdr-title { font-size: 28px; }

/* --------------------------------------------------------------- Inhalt */
#content {
  flex: 1 1 auto;
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 22px 4px 22px;
}

.stage {
  flex: 1 1 auto;
  min-height: 0;
  pointer-events: auto;
  cursor: grab;
}
.stage.dragging { cursor: grabbing; }

.pagetitle {
  font-size: 20px;
  font-weight: 700;
  margin: 6px 0 10px 2px;
}

/* Schrittnummer + Callout */
.steprow {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.stepno {
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  padding-top: 16px;
  min-width: 50px;
  text-align: right;
  color: var(--dark);
}
/* Die Callout-Box darf KEINEN deckenden Hintergrund haben: die Bauteile
 * darin werden live auf dem darunterliegenden Canvas gezeichnet. */
.callout {
  flex: 1 1 auto;
  background: none;
  border: 1px solid var(--light);
  border-radius: 7px;
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-height: 124px;
  overflow: hidden;
}
.co-item {
  flex: 0 1 176px;
  min-width: 92px;
  text-align: center;
  font-size: 13px;
  color: var(--gray);
  line-height: 1.2;
}
/* drehbare 3D-Flaeche einer Callout-Zelle (Scissor-Rendering) */
.co-view {
  pointer-events: auto;
  cursor: grab;
}
.co-view:active { cursor: grabbing; }
.co-item .co-view {
  display: block;
  width: 100%;
  height: 104px;
  margin: 0 auto 2px auto;
}
.co-item .cnt {
  font-size: 15px;
  font-weight: 700;
  color: var(--dark);
}
.co-sub {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 0 0 auto;
  padding-right: 20px;
  margin-right: 12px;
  border-right: 1px solid var(--light);
}
.co-sub .co-view {
  flex: 0 0 auto;
  width: 236px;
  height: 148px;
}
.co-sub .cnt { font-size: 17px; font-weight: 700; }
.co-sub .lnk {
  font-size: 19px;
  font-weight: 700;
  color: var(--dark);
  text-decoration: none;
  border-bottom: 1px dotted var(--gray);
  cursor: pointer;
  pointer-events: auto;
}
.co-sub .lnk:hover { color: var(--accent); border-color: var(--accent); }
.co-sub .nm { font-size: 14px; color: var(--gray); }

/* Angeklicktes Bauteil: outline statt border, damit nichts umbricht */
.co-hl {
  outline: 3px solid var(--hl);
  outline-offset: 2px;
  border-radius: 4px;
  background: rgba(255, 205, 0, .16);
}

/* Hinweistext bewusst gross: doppelte Groesse der urspruenglichen 12px */
.note {
  flex: 0 0 auto;
  color: var(--note);
  font-style: italic;
  font-size: 24px;
  line-height: 1.25;
  margin: 8px 0 0 62px;
}

/* ------------------------------------------------------- Uebersichtsraster */
.grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  gap: 8px;
}
/* WICHTIG: Kacheln duerfen KEINEN Hintergrund haben - sie liegen ueber dem
 * Canvas, ein opaker Hintergrund wuerde die 3D-Darstellung verdecken.
 * Rueckmeldung beim Ueberfahren daher nur ueber die Rahmenfarbe. */
.tile {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 2px;
}
.tile:hover { border-color: var(--accent); }
.tile:hover .tile-lbl { color: var(--accent); }
.tileview {
  flex: 1 1 auto;
  min-height: 0;
  pointer-events: auto;
  cursor: pointer;
}
.tile-lbl {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: auto;
  cursor: pointer;
}
.tile-sub {
  flex: 0 0 auto;
  font-size: 10px;
  color: var(--gray);
}

/* Teileliste */
.bom-cell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.bom-cell img {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  object-fit: contain;
  background: #fff;
}
.bom-cnt { font-size: 12px; font-weight: 700; }
.bom-cnt span { font-weight: 400; color: var(--gray); font-size: 10px; margin-left: 6px; }
.bom-desc {
  font-size: 10px;
  color: var(--gray);
  line-height: 1.15;
  max-height: 24px;
  overflow: hidden;
}

/* (Die frueheren Cover-Angaben stehen jetzt in der Navigationsleiste.) */

/* -------------------------------------------------------------- Fusszeile */
/* Navigationsleiste: alles auf EINER Zeile, vertikal zentriert */
#footer {
  flex: 0 0 auto;
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  font-size: 14px;
  color: var(--gray);
  gap: 14px;
}
.ftr-left, .ftr-right { display: flex; align-items: center; gap: 10px; }
.ftr-mid { flex: 1 1 auto; text-align: center; white-space: nowrap; }
.ftr-right { justify-content: flex-end; }
.ftr-info {
  font-size: 13px;
  color: var(--gray);
  white-space: nowrap;
}

.navbtn {
  pointer-events: auto;
  width: 42px; height: 36px;
  border: 1px solid var(--light);
  background: #fff;
  color: var(--dark);
  border-radius: 6px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.navbtn:hover { background: var(--dark); color: #fff; }
.txtbtn {
  pointer-events: auto;
  border: 1px solid var(--light);
  background: #fff;
  color: var(--dark);
  border-radius: 6px;
  font-size: 14px;
  padding: 8px 14px;
  cursor: pointer;
}
.txtbtn:hover { background: var(--dark); color: #fff; }
#jump {
  pointer-events: auto;
  max-width: 320px;
  font-size: 14px;
  border: 1px solid var(--light);
  border-radius: 6px;
  background: #fff;
  color: var(--dark);
  padding: 6px 8px;
}

/* Bei schmalen Fenstern hat die Herkunftsangabe die geringste Prioritaet */
@media (max-width: 1200px) {
  .ftr-src { display: none; }
}
@media (max-width: 900px) {
  #ftr-parts { display: none; }
}

#splash {
  position: fixed;
  left: 0; top: 0; right: 0; bottom: 0;
  z-index: 5;
  background: #fff;
  color: var(--gray);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
#splash.hidden { display: none; }

.err {
  padding: 40px;
  font-size: 15px;
  color: var(--accent);
}
