/* carbo-diktat — Oberfläche für das iPhone.
   Farben: Catppuccin Mocha, wie im übrigen carbo-Joplin-Umfeld.
   Grundsatz: große Flächen, blind treffbar, nichts Wichtiges klein. */

:root {
  --grund:      #1e1e2e;
  --flaeche:    #313244;
  --flaeche-2:  #45475a;
  --schrift:    #cdd6f4;
  --gedaempft:  #a6adc8;
  --akzent:     #89b4fa;
  --gruen:      #a6e3a1;
  --rot:        #f38ba8;
  --gelb:       #f9e2af;
  --lila:       #cba6f7;
  --rand:       12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Muss ganz oben stehen und muss `!important` sein: `hidden` bekommt sein
   `display: none` nur aus dem Browser-Standardstylesheet und verliert damit
   gegen jede eigene Regel. Ohne diese Zeile schlagen `.deckblatt` und `#app`
   (beide `display: flex`) das Attribut — Anmeldung und Hauptansicht waeren
   gleichzeitig sichtbar, untereinander gestapelt. */
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%;
  background: var(--grund); color: var(--schrift);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  overscroll-behavior: none;
}

body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---------------------------------------------------------------- Anmeldung */

.deckblatt {
  height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; padding: 24px;
}
.deckblatt h1 { margin: 0; font-size: 34px; letter-spacing: -.5px; }
.deckblatt form { display: flex; flex-direction: column; gap: 12px; width: min(340px, 100%); }

input[type=password], input[type=text], select {
  width: 100%; padding: 14px; font-size: 17px;
  background: var(--flaeche); color: var(--schrift);
  border: 1px solid var(--flaeche-2); border-radius: var(--rand);
}

.haupttaste {
  padding: 14px; font-size: 17px; font-weight: 600;
  background: var(--akzent); color: #11111b;
  border: 0; border-radius: var(--rand);
}

.hinweis { color: var(--gedaempft); font-size: 14px; margin: 4px 0; text-align: center; }
.fehler  { color: var(--rot); font-size: 14px; text-align: center; }

/* ------------------------------------------------------------------- Aufbau */

#app {
  height: 100%; display: flex; flex-direction: column; gap: 8px; padding: 8px;
}

#kopf {
  display: flex; align-items: center; gap: 10px;
  padding: 2px 6px; font-size: 14px; color: var(--gedaempft);
}
.zustand { font-weight: 600; }
.zustand.laeuft   { color: var(--rot); }
.zustand.arbeitet { color: var(--gelb); }
.zustand.fertig   { color: var(--gruen); }
.uhr { font-variant-numeric: tabular-nums; }
.wartend { margin-left: auto; color: var(--gelb); font-size: 13px; }
#menuetaste { margin-left: auto; }
.wartend:not([hidden]) + #menuetaste { margin-left: 10px; }

.klein {
  padding: 8px 12px; font-size: 14px;
  background: var(--flaeche); color: var(--schrift);
  border: 1px solid var(--flaeche-2); border-radius: 999px;
}
.klein.gefahr { color: var(--rot); }

/* --------------------------------------------------------- Aufnahmefläche */

.aufnahmeflaeche {
  flex: 0 0 28vh; min-height: 150px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: var(--flaeche); color: var(--schrift);
  border: 2px solid var(--flaeche-2); border-radius: 20px;
  font-size: 17px; transition: background .15s, border-color .15s;
}
.aufnahmeflaeche.laeuft {
  background: #45283a; border-color: var(--rot);
}
.aufnahmeflaeche:active { transform: scale(.995); }
.symbol { font-size: 40px; line-height: 1; }
.aufnahmeflaeche.laeuft .symbol { animation: pulsieren 1.4s ease-in-out infinite; }
@keyframes pulsieren { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
.flaechentext { font-weight: 600; }
.pegel { width: 80%; height: 28px; opacity: .8; }

/* --------------------------------------------------------------- Absatz */

.absatztaste {
  flex: 0 0 auto; padding: 18px; font-size: 19px; font-weight: 700;
  background: var(--lila); color: #11111b;
  border: 0; border-radius: var(--rand);
}
.absatztaste:disabled { background: var(--flaeche); color: var(--gedaempft); }

/* --------------------------------------------------------------- Format */

.formatleiste {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: none;
}
.formatleiste::-webkit-scrollbar { display: none; }
.formatleiste button {
  flex: 1 0 auto; min-width: 46px; padding: 12px 10px; font-size: 15px;
  background: var(--flaeche); color: var(--schrift);
  border: 1px solid var(--flaeche-2); border-radius: 10px;
}
.formatleiste button.vorgewaehlt {
  background: var(--akzent); color: #11111b; border-color: var(--akzent);
}

/* ----------------------------------------------------------------- Text */

.text {
  flex: 1 1 auto; min-height: 90px; padding: 12px; resize: none;
  background: var(--flaeche); color: var(--schrift);
  border: 1px solid var(--flaeche-2); border-radius: var(--rand);
  font: 16px/1.5 ui-monospace, "SF Mono", Menlo, monospace;
  -webkit-user-select: text; user-select: text;
}

/* ------------------------------------------------------------------ Fuß */

#fuss { display: flex; gap: 6px; }
.fusstaste {
  flex: 1; padding: 14px 8px; font-size: 15px; font-weight: 600;
  background: var(--flaeche); color: var(--schrift);
  border: 1px solid var(--flaeche-2); border-radius: var(--rand);
}
.fusstaste.haupt { background: var(--gruen); color: #11111b; border-color: var(--gruen); }
.fusstaste:disabled { opacity: .5; }

/* ----------------------------------------------------------------- Menü */

dialog {
  width: min(420px, 92vw); padding: 20px; border: 0; border-radius: 18px;
  background: var(--grund); color: var(--schrift);
}
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h2 { margin: 0 0 14px; font-size: 20px; }
.zeile { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 15px; }
.zeile.umschalter { flex-direction: row; align-items: center; justify-content: space-between; }
.zeile.umschalter input { width: 52px; height: 30px; }
.fassungen { display: flex; gap: 6px; margin-bottom: 12px; }
.fassungen button { flex: 1; }
.fassungen button.aktiv { background: var(--akzent); color: #11111b; border-color: var(--akzent); }
.menuefuss { display: flex; gap: 8px; align-items: center; }
.menuefuss .haupttaste { flex: 1; }

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

.meldung {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 84px);
  max-width: 90vw; padding: 12px 18px; border-radius: 999px;
  background: var(--flaeche-2); color: var(--schrift);
  font-size: 15px; text-align: center; z-index: 10;
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
.meldung.gut    { background: var(--gruen); color: #11111b; }
.meldung.schlimm { background: var(--rot);  color: #11111b; }

/* Querformat: Aufnahmefläche schrumpft, Text bekommt den Platz. */
@media (orientation: landscape) and (max-height: 500px) {
  .aufnahmeflaeche { flex-basis: 22vh; min-height: 90px; }
  .symbol { font-size: 26px; }
  .absatztaste { padding: 12px; }
}
