/* Kinosaal: tiefes Schwarzgrün, warmes Gold, Cinzel-Titel, handschriftliche Akzente */
:root {
  --bg: #121614;
  --ink: #f1e9d6;
  --muted: #b6ad97;
  --amber: #d9b25f;
  --amber-ink: #121614;
  --card: #1c211e;
  --line: #39423d;
  --danger: #e07a64;
  --ok: #9cc597;
  --radius: 12px;
  --serif: "Cinzel", "Playfair Display", Georgia, serif;
  --body: "Lora", Georgia, serif;
  --hand: "Caveat", cursive;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121614;
    --ink: #f1e9d6;
  }
}
:root[data-theme="dark"] {
  --bg: #121614;
  --ink: #f1e9d6;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 50% -10%, rgba(217, 178, 95, 0.09) 0, transparent 55%),
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.035) 0, transparent 42%),
    radial-gradient(circle at 88% 65%, rgba(255, 255, 255, 0.025) 0, transparent 46%);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: 80px;
}

h1, h2, h3 { font-family: var(--serif); line-height: 1.25; margin: 0.4em 0 0.5em; }
h1 { font-size: 2rem; color: var(--amber); letter-spacing: 0.02em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p { margin: 0.5em 0; }
a { color: var(--amber); }
blockquote { margin: 0.5em 0; font-style: italic; font-size: 1.15rem; }
ul { padding-left: 1.2em; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.ok { color: var(--ok); }
.hand { font-family: var(--hand); font-size: 1.4rem; color: var(--amber); margin: 0 0 0.2em; }
.hidden { display: none !important; }

/* Kopfzeile */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 16px;
  background: rgba(18, 22, 20, 0.96);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; flex-direction: column; text-decoration: none; line-height: 1.1; }
.brand-main { font-family: var(--serif); font-weight: 700; font-size: 1.35rem; letter-spacing: 0.12em; color: var(--amber); }
.brand-sub { font-family: var(--hand); font-size: 1rem; color: var(--muted); letter-spacing: 0.02em; }
.card.manifesto { border-left: 3px solid var(--amber); }
.card.manifesto .pre { font-size: 1.02rem; }
.x-word { color: var(--amber); font-weight: 600; }
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 0.98rem; }
nav a { text-decoration: none; padding: 6px 2px; min-height: 36px; display: inline-flex; align-items: center; }
nav a.on { color: var(--ink); border-bottom: 2px solid var(--amber); }
.who { color: var(--muted); font-size: 0.92rem; }

/* Online-Anzeige */
.presence { position: relative; }
.presence-btn {
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 2px;
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
}
.presence-btn:hover, .presence-btn[aria-expanded="true"] { color: var(--amber); }
.presence-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 6px var(--ok);
}
.presence-list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 190px;
  max-width: min(260px, calc(100vw - 32px));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.presence-list p { margin: 0; }
.presence-list ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.presence-list li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Layout */
.wrap { max-width: 720px; margin: 0 auto; padding: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin: 14px 0;
}
.card.important { border-color: var(--amber); }
.card.gate { max-width: 420px; margin: 40px auto; text-align: center; }
.card.thought { border-style: dashed; }
.card.thought blockquote { color: var(--ink); }
.card.event h2 { font-size: 1.7rem; }
.row { display: flex; gap: 12px; align-items: center; }
.between { justify-content: space-between; }
.wrap-row { flex-wrap: wrap; }
.stack { display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 10px; }
.meta { color: var(--muted); }

/* Formulare */
label { display: grid; gap: 6px; font-size: 0.98rem; }
label.check { display: flex; align-items: center; gap: 10px; }
label small { color: var(--muted); font-weight: normal; }
input, textarea, select {
  font: inherit;
  font-size: 16px; /* verhindert Zoom auf iOS */
  color: var(--ink);
  background: #1a1e1b;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 44px;
  width: 100%;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}
fieldset { border: 0; padding: 0; margin: 0; }
legend { color: var(--muted); font-size: 0.95rem; padding: 0; margin-bottom: 6px; }
input[type="checkbox"] { width: 22px; min-height: 22px; }

.picker { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { position: relative; display: inline-block; }
.pick input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; padding: 0; }
.pick span {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid var(--line);
  font-size: 1.4rem;
  cursor: pointer;
}
.pick.swatch span { width: 36px; height: 36px; border-radius: 8px; }
.pick input:checked + span { border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber) inset; }

/* Buttons */
.btn {
  font: inherit;
  font-weight: 600;
  background: var(--amber);
  color: var(--amber-ink);
  border: 0;
  border-radius: 999px;
  padding: 10px 20px;
  min-height: 44px;
  cursor: pointer;
  justify-self: start;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--amber); border: 1px solid var(--amber); }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: 0.92rem; }
.btn.danger { background: var(--danger); color: #1d211e; }
.linkbtn {
  font: inherit;
  background: none;
  border: 0;
  color: var(--muted);
  padding: 8px 0;
  min-height: 36px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.linkbtn:hover, .linkbtn.on { color: var(--amber); }
.linkbtn.danger:hover { color: var(--danger); }
.admin-link {
  position: fixed;
  right: 12px;
  bottom: 12px;
  font-size: 0.8rem;
  color: var(--muted);
  opacity: 0.55;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
}
.admin-link:hover { opacity: 1; }

/* Tabs & Chips */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tabs button, .chip {
  font: inherit;
  font-size: 0.95rem;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  min-height: 36px;
  cursor: pointer;
}
.tabs button.on, .chip.on { color: var(--amber-ink); background: var(--amber); border-color: var(--amber); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }

/* Badges & Tags */
.badge, .tag {
  display: inline-block;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--amber);
  border: 1px solid var(--amber);
  border-radius: 6px;
  padding: 1px 8px;
  margin-right: 6px;
}
.tag.alt { color: var(--muted); border-color: var(--muted); }

/* Board */
a.thread-link { display: block; text-decoration: none; color: var(--ink); }
a.thread-link:hover h3 { color: var(--amber); }
a.thread-link h3 { margin-top: 6px; }
.card.thread:hover { border-color: var(--amber); }
.back { display: inline-block; margin-top: 8px; }
.comment { border-left: 2px solid var(--line); padding: 4px 0 4px 14px; margin: 14px 0; }
.comment.reply { margin-left: 22px; border-left-style: dotted; }

/* Chat */
.chat-log {
  max-height: min(58vh, 540px);
  min-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px;
}
.chat-msg { border-left: 2px solid var(--line); padding: 4px 0 4px 12px; }
.chat-msg.mine {
  border-left-color: var(--amber);
  background: rgba(224, 169, 74, 0.06);
  border-radius: 0 8px 8px 0;
}
.chat-meta { margin: 0; font-size: 0.85rem; color: var(--muted); }
.chat-msg .pre { margin: 4px 0 0; }
.chat-msg .linkbtn { font-size: 0.85rem; min-height: 28px; padding: 2px 0; }
.chat-form { display: flex; gap: 10px; margin-top: 14px; }
.chat-form input { flex: 1; }
.chat-form .btn { flex: 0 0 auto; }

/* Kommentare unter Ankündigungen und im Archiv */
.announcement-comments, .archive-comments { border-top: 1px dashed var(--line); margin-top: 16px; padding-top: 6px; }
.announcement-comments h4, .archive-comments h4 { font-family: var(--serif); font-size: 1.05rem; margin: 10px 0 4px; }
.announcement-comment, .archive-comment { margin: 12px 0; }
.announcement-comment-form, .archive-comment-form { margin-top: 12px; }

/* Termin */
.card.note {
  background: linear-gradient(180deg, #2e2b22, #27251e);
  border-color: #6d5c3d;
  border-left: 4px solid var(--amber);
}
.card.note .hand { color: var(--amber); }
.card.note .pre { color: var(--ink); }
.note-preview { border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 10px; }
.note-edit { margin-top: 12px; }
.meter { height: 10px; background: #1a1e1b; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin: 12px 0 8px; }
.meter span { display: block; height: 100%; background: var(--amber); width: 0; transition: width .4s ease; }
.people { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.people li { background: #1a1e1b; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }
.reg-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 8px 0; border-top: 1px dashed var(--line); }
.regs { margin-top: 8px; }

/* Medien in Ankündigungen */
.media { display: block; width: 100%; max-width: 100%; border-radius: 8px; margin: 12px 0 6px; background: #1a1e1b; }
img.media { height: auto; }
.media.admin-thumb { width: auto; max-height: 180px; object-fit: contain; }
.media.yt { position: relative; aspect-ratio: 16 / 9; height: auto; background: none; }
.media.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 8px; }

/* Admin */
.admin-card-actions { margin-top: 6px; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 56px;
  background: var(--card);
  border: 1px solid var(--amber);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 10px;
  max-width: calc(100% - 32px);
  z-index: 20;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  animation: fade 3.5s ease forwards;
}
.toast.error { border-color: var(--danger); }
@keyframes fade { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }

/* Mobile */
@media (max-width: 520px) {
  .grid2 { grid-template-columns: 1fr; }
  h1 { font-size: 1.7rem; }
  .card { padding: 14px; }
  .chat-form { flex-direction: column; }
  .chat-form .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
