:root {
  --bg: #16181d;
  --card: #21242c;
  --line: #343943;
  --text: #e8eaed;
  --muted: #9aa1ad;
  --accent: #25d366;
  --warn: #f7a600;
  --bad: #ff6b6b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  padding: 12px 12px calc(24px + env(safe-area-inset-bottom));
}

.hide { display: none !important; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 12px;
}

h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 18px 4px 10px; }

.hint { color: var(--muted); font-size: 13px; margin: 6px 4px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.card h2 { margin: 0 0 8px; }
.card p { margin: 0 0 10px; color: var(--muted); font-size: 14px; }

.notice {
  background: #3a2f14;
  border: 1px solid #6b5518;
  color: #f0d79a;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}

button {
  font: inherit;
  font-weight: 600;
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  background: #333944;
  color: var(--text);
  cursor: pointer;
  -webkit-appearance: none;
}
button.primary { background: var(--accent); color: #08130c; }
button.linklike {
  background: none;
  color: var(--muted);
  padding: 6px 4px;
  font-weight: 500;
}

/* --- Ordnerliste --- */

.folder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 10px;
}
.folder .fname { font-size: 17px; font-weight: 600; }
.folder .fmeta { color: var(--muted); font-size: 13px; font-weight: 400; }

/* --- Bildraster --- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tile img {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  display: block;
  background: #000;
  cursor: pointer;
}

.tile .tmeta {
  font-size: 11px;
  color: var(--muted);
  padding: 6px 8px 0;
  /* Dateinamen sind handvergeben und koennen beliebig lang oder seltsam sein.
     Deshalb bewusst schlicht: eine Zeile, abgeschnitten, kein Umbruch. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile button {
  margin: 6px 8px 8px;
  padding: 10px;
  font-size: 14px;
}

/* Videos: sichtbar, aber nicht teilbar. Lieber eine graue Kachel als eine
   Datei, die spurlos fehlt und die jemand lange sucht. */
.tile.skip {
  align-items: center;
  justify-content: center;
  padding: 20px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  aspect-ratio: 9 / 16;
}

/* --- Vollbild --- */

.full {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 20;
  display: none;
  flex-direction: column;
}
.full.an { display: flex; }
.full img {
  flex: 1;
  min-height: 0;
  width: 100%;
  object-fit: contain;
}
.fullbar {
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  background: #0c0d10;
}
.fullbar p { color: var(--muted); font-size: 13px; margin: 0 0 10px; text-align: center; }
.fullbtns { display: flex; gap: 10px; }
.fullbtns button { flex: 1; }

/* --- Kurzmeldung --- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: #2b3039;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 30;
  max-width: 90vw;
  text-align: center;
}
