:root {
  --bg: #10131a;
  --bg-soft: #171b25;
  --bg-raised: #1e2330;
  --border: #2a2f3d;
  --text: #f5efe6;
  --text-dim: #8b93a6;
  --accent: #f2a65a;
  --accent-dim: #a9743a;
  --rose: #d88c9a;
  --radius: 14px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  position: relative;
  overflow: hidden;
}

/* subtle film-grain texture, purely decorative */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: radial-gradient(circle, #fff 1px, transparent 1px);
  background-size: 3px 3px;
  z-index: 1;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
}
.screen.active { display: flex; }

.screen--center {
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 20%, rgba(242, 166, 90, 0.08), transparent 60%), var(--bg);
}

.ticket {
  width: 100%;
  max-width: 360px;
  text-align: left;
}
.ticket--wide { max-width: 480px; }

.ticket__eyebrow {
  color: var(--accent);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  margin: 0 0 12px;
}

.ticket__title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 7vw, 2.8rem);
  line-height: 1.1;
  margin: 0 0 28px;
}

.input {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  outline: none;
}
.input:focus { border-color: var(--accent-dim); }
.input--small { margin-bottom: 0; padding: 10px 14px; font-size: 0.9rem; }

.btn {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1rem;
  padding: 14px 22px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
}
.btn--primary {
  background: var(--accent);
  color: #1a1206;
  width: 100%;
}
.btn--primary:hover { background: #f5b876; }
.btn--small { padding: 10px 16px; font-size: 0.9rem; }

.error {
  color: var(--rose);
  min-height: 1.2em;
  font-size: 0.9rem;
  margin: 10px 0 0;
}

.hint {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.5;
}
.hint code {
  background: var(--bg-soft);
  padding: 2px 6px;
  border-radius: 6px;
}

.video-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  max-height: 60vh;
  overflow-y: auto;
}

.video-card {
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  transition: border-color 0.15s, transform 0.15s;
}
.video-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-2px);
}

.video-card__thumb {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--bg-raised), var(--bg-soft));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.video-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.video-card__thumb--empty::after {
  content: "🎬";
  font-size: 1.8rem;
  opacity: 0.5;
}
.video-card__thumb--empty img { display: none; }

.video-card__title {
  padding: 10px 12px;
  font-size: 0.9rem;
  line-height: 1.3;
  color: var(--text);
}

/* --- Kinosaal --- */
.cinema {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
}

#video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

.cinema__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55), transparent 18%, transparent 75%, rgba(0,0,0,0.65));
  pointer-events: none;
}
.cinema__overlay > * { pointer-events: auto; }

.cinema__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.presence-pill {
  background: rgba(23, 27, 37, 0.75);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: 999px;
}

/* Zeigt live, bei welcher Sekunde jede Person gerade ist */
.presence-detail {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.presence-detail__row {
  background: rgba(23, 27, 37, 0.75);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  color: var(--text-dim);
  display: flex;
  gap: 8px;
}
.presence-detail__row span:first-child { color: var(--text); }
.presence-detail__row span:last-child { color: var(--accent); font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  .presence-detail { display: none; }
}

.icon-btn {
  background: rgba(23, 27, 37, 0.75);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1rem;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.icon-btn--big {
  font-size: 1.1rem;
  padding: 10px 16px;
}
.icon-btn--spinning { animation: spin 0.5s linear; }
@keyframes spin { to { transform: rotate(360deg); } }

.cinema__bottom {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(16, 19, 26, 0.6);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
}

.seek {
  flex: 1;
  accent-color: var(--accent);
}

.time-label {
  color: var(--text-dim);
  font-size: 0.8rem;
  white-space: nowrap;
  min-width: 84px;
  text-align: center;
}

.chat-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 85vw);
  background: rgba(16, 19, 26, 0.92);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.2s ease;
}
.chat-panel.open { transform: translateX(0); }

.chat-panel__header {
  padding: 16px 18px;
  font-family: var(--serif);
  font-size: 1.1rem;
  border-bottom: 1px solid var(--border);
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.9rem;
}

.chat-log__msg strong { color: var(--accent); font-weight: 600; }
.chat-log__msg span { color: var(--text-dim); }

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

@media (max-width: 520px) {
  .time-label { display: none; }
  .chat-panel { width: 100vw; }
  .cinema__bottom { gap: 6px; padding: 6px 8px; }
  .icon-btn { padding: 8px 10px; font-size: 0.9rem; }
}
