@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #10131a;
  --bg-raised: #171b24;
  --bg-raised-2: #1f2430;
  --line: #2b3140;
  --text: #e9e7e1;
  --text-dim: #9aa0ae;
  --amber: #e0a63a;
  --amber-dim: #7a5a22;
  --red: #d6534a;
  --green: #4caf7d;
  --radius: 10px;
  --font-head: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100%;
}

body {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

h1, h2, h3 {
  font-family: var(--font-head);
  margin: 0 0 0.4em 0;
  letter-spacing: -0.01em;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 20px 18px 32px;
}

.view { display: flex; flex-direction: column; gap: 16px; flex: 1; }

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}
.brand .dot { color: var(--red); font-size: 1.4rem; }
.brand h1 { font-size: 1.5rem; }

p.sub { color: var(--text-dim); margin: 0; font-size: 0.95rem; line-height: 1.5; }

.card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease;
  text-decoration: none;
  width: 100%;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--amber); color: #1a1305; }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--line); }
.btn-danger { background: var(--red); color: #2a0805; }
.btn-success { background: var(--green); color: #05261a; }
.btn-ghost { background: transparent; color: var(--text-dim); border: none; padding: 8px; width: auto; }

.input, select {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-raised-2);
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font-body);
}
.input::placeholder { color: var(--text-dim); }

label { font-size: 0.85rem; color: var(--text-dim); display: block; margin-bottom: 6px; }
.field { display: flex; flex-direction: column; gap: 4px; }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.player-list { display: flex; flex-direction: column; gap: 8px; }
.player-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-raised-2);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  cursor: pointer;
}
.player-chip.selected { border-color: var(--amber); background: #2a2110; }
.player-chip.is-mrx { border-color: var(--red); }
.player-chip .name { font-weight: 600; }
.player-chip .tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.qr-box {
  background: #fff;
  padding: 16px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.code-display {
  font-family: 'Space Grotesk', monospace;
  font-size: 1.8rem;
  letter-spacing: 0.12em;
  text-align: center;
  color: var(--amber);
}

#map { width: 100%; height: 340px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }

.timer-display {
  text-align: center;
  padding: 18px;
}
.timer-display .value {
  font-family: var(--font-head);
  font-size: 2.6rem;
  font-weight: 700;
}
.timer-display .label { color: var(--text-dim); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; }
.timer-display.urgent .value { color: var(--red); }
.timer-display.paused .value { color: var(--text-dim); }

.banner {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
}
.banner-red { background: rgba(214, 83, 74, 0.16); color: #f0a49e; border: 1px solid rgba(214,83,74,0.4); }
.banner-amber { background: rgba(224, 166, 58, 0.14); color: var(--amber); border: 1px solid rgba(224,166,58,0.4); }
.banner-green { background: rgba(76, 175, 125, 0.14); color: var(--green); border: 1px solid rgba(76,175,125,0.4); }

.photo-preview { width: 100%; border-radius: var(--radius); display: block; }

.pending-photo-review {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.spacer { flex: 1; }

.footer-note { text-align: center; color: var(--text-dim); font-size: 0.78rem; margin-top: 8px; }

.hidden { display: none !important; }

/* ---------- Chat ---------- */

.chat-card { display: flex; flex-direction: column; gap: 10px; }

.chat-title {
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-badge {
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  min-width: 18px;
  text-align: center;
}

.chat-messages {
  height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 2px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--line);
}

.chat-empty { padding: 10px; }

.chat-bubble-row { display: flex; }
.chat-bubble-row.mine { justify-content: flex-end; }

.chat-bubble {
  max-width: 78%;
  background: var(--bg-raised-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 7px 10px;
  font-size: 0.9rem;
  line-height: 1.35;
  word-break: break-word;
}
.chat-bubble-row.mine .chat-bubble { background: var(--amber-dim); border-color: var(--amber); }
.chat-bubble.host { border-color: var(--red); }

.chat-sender {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.chat-text { color: var(--text); }

.chat-input-row { display: flex; gap: 8px; }
.chat-input-row .input { flex: 1; }
.chat-send-btn { width: auto; padding: 13px 16px; }

.chat-tabs { display: flex; gap: 8px; margin-bottom: 4px; }
.chat-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  font-weight: 600;
  cursor: pointer;
  position: relative;
}
.chat-tab.active { background: var(--bg-raised-2); color: var(--text); border-color: var(--amber); }
.chat-tab .chat-badge { position: absolute; top: -6px; right: -6px; }

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    /* App ist bewusst dunkel gehalten (Nacht-/Detektiv-Optik), unabhängig vom Systemmodus */
  }
}
