:root { --bg:#0f1115; --card:#171a21; --text:#e6e6e6; --muted:#9aa0a6; --accent:#5b9cff; }
* { box-sizing: border-box; }
html, body { margin:0; padding:0; background:var(--bg); color:var(--text); font-family: system-ui, sans-serif; }
.wrap { max-width: 900px; margin: 0 auto; padding: 12px; }

header { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; }
h1 { font-size: 1.2rem; margin: 0; }
.card { min-height: 5.2em; background: var(--card); border-radius: 16px; padding: 12px; margin-bottom: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.final .big { font-size: 1.4rem; line-height: 1.8; }
.row { display:flex; gap: 8px; align-items: end; flex-wrap: wrap; }
label { display:flex; flex-direction: column; gap: 6px; min-width: 180px; }
input { background:#0e1015; border:1px solid #2a2f3a; color:var(--text); border-radius: 10px; padding: 10px; font-size: 1rem; }
button { padding: 10px 14px; border: 0; border-radius: 12px; cursor: pointer; }
button.primary { background: var(--accent); color: #041022; font-weight: 700; }
button.secondary { background: #2a2f3a; color: var(--text); }
.preview { justify-content: space-between; }
code { background:#0e1015; border:1px solid #2a2f3a; border-radius:8px; padding:6px 10px; }
.explain { color: var(--muted); margin-bottom: 8px; min-height: 5.2em; }

.status { display:flex; align-items:center; gap: 8px; }
#onlineBadge { display:inline-block; padding:4px 8px; border-radius: 8px; background:#144d2a; color:#b8f5ce; }
.offline #onlineBadge { background:#4d1421; color:#ffd3d3; }

.saved-list { display: grid; gap: 8px; }
.saved-item { display:flex; justify-content:space-between; align-items:center; padding:8px; background:#0e1015; border:1px solid #2a2f3a; border-radius:10px; }
.badge { font-size:.8rem; padding:2px 6px; border-radius:6px; border:1px solid #2a2f3a; }
.badge.synced { color:#b8f5ce; border-color:#1f5131; }
.badge.pending { color:#ffd3d3; border-color:#5d2a2a; }

section.card {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

section.card[hidden] {
  opacity: 0;
  transform: scale(0.98);
  pointer-events: none;
}

/* ===== Foto-Ansicht (Landscape, Final-Modus) ===== */
body.final-mode.landscape {
  /* optional: Status-/Adressleiste „verdrängen“ (so gut es PWAs erlauben) */
  background: #0b0d12;
}

/* Header & nicht benötigte Karten in Foto-Ansicht ausblenden */
body.final-mode.landscape header,
body.final-mode.landscape #formSection,
body.final-mode.landscape #componentSection,
body.final-mode.landscape #pomSection,
body.final-mode.landscape #savedSection {
  display: none !important;
}

/* Ergebniskarte: Vollfläche, Mitte, große Typo */
body.final-mode.landscape #finalSection {
  /*position: fixed;*/
  inset: 0;
  display: grid !important;
  place-items: center;
  background: var(--bg);
  box-shadow: none;
  border-radius: 0;
  margin: 0;
  padding: 2.5vh 3vw;
}

/* Typo groß & fotofreundlich */
body.final-mode.landscape #finalSection .big {
  text-align: center;
  line-height: 1.25;
}

body.final-mode.landscape #finalSection .big > div {
  margin: 1.8vh 0;
}

/* Fette Anzeige */
body.final-mode.landscape #finalSection .big span {
  color: var(--muted);
  font-size: clamp(16px, 2.2vh, 22px);
  margin-right: .4em;
}

body.final-mode.landscape #finalSection .big strong {
  font-size: clamp(22px, 4.5vh, 42px);
}

body.final-mode.landscape #finalSection code {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  letter-spacing: .06em;
  font-size: clamp(22px, 5.5vh, 56px);
  padding: .25em .45em;
  border-radius: 14px;
  border-width: 2px;
}

/* Floating-Action-Bar: Edit / Save / View am Rand */
.fab-bar {
  position: fixed;
  right: 1.4rem;
  bottom: 1.2rem;
  display: flex;
  gap: .6rem;
  z-index: 20;
}

.fab-bar button {
  padding: .7rem .9rem;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}

/* In Landscape nur im Final-Modus anzeigen */
body.final-mode.landscape .fab-bar { display: flex; }
body:not(.final-mode).landscape .fab-bar,
body.final-mode:not(.landscape) .fab-bar { display: none; }

/* Allgemein: Erkennung von Landscape */
@media (orientation: landscape) {
  body { }
  body.landscape #actions {
    /* Platz unten lassen, wenn Aktionen Leiste schwebt */
    padding-bottom: 56px;
  }
}

/* ===== Kamera-Ansicht ===== */
.camera-viewport {
  position: relative;
  width: 100%;
  max-height: 70vh;
  overflow: hidden;
  border-radius: 16px;
  background: #000;
}

#cameraVideo,
#cameraCanvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Fokusrahmen */
#cameraFrame {
  position: absolute;
  border: 2px dashed rgba(200,200,200,0.8);
  border-radius: 12px;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.4);
  pointer-events: none;
}

/* Label-Box für Abkürzungen */
#cameraLabel {
  position: absolute;
  background: rgba(10,12,20,0.85);
  color: #f5f5f5;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.9rem;
  max-width: 60%;
}

/* Textformat im Label */
#cameraLabel div {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Portrait: Rahmen oben 2/3, Label unten links */
body:not(.landscape) #cameraFrame {
  width: 90%;
  height: 65%;
  top: 13%;
  left: 5%;
}
body:not(.landscape) #cameraLabel {
  bottom: 2%;
  left: 5%;
}

/* Landscape: Rahmen rechts 2/3, Label links unten */
body.landscape #cameraFrame {
  width: 65%;
  height: 90%;
  top: 5%;
  right: 5%;
}
body.landscape #cameraLabel {
  bottom: 5%;
  left: 2%;
}

.num-control {
  display: flex;
  align-items: flex-end;
  gap: 4px;
}

.num-inc-btn {
  padding: 8px 10px;
  min-width: 36px;
  font-weight: 700;
}

/* Temporär alle FAB-Buttons ausblenden */
.fab-bar {
  display: none !important;
}
