/* =======================================================
   Buzzr – Hauptstylesheet
   Modern · Clean · Mobile-first · Beamer-tauglich
   ======================================================= */

/* --- Reset & Basis --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:        #0f1117;
  --surface:   #1a1d27;
  --surface2:  #252836;
  --border:    #2e3149;
  --text:      #f0f1f5;
  --text-sub:  #8b8fa8;
  --primary:   #4f6ef7;
  --primary-h: #3a56d4;
  --danger:    #e03e3e;
  --danger-h:  #c42f2f;
  --success:   #2dce89;
  --radius:    12px;
  --radius-lg: 20px;
  --shadow:    0 4px 24px rgba(0,0,0,.5);
  --font:      'Segoe UI', system-ui, -apple-system, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* =======================================================
   Typografie
   ======================================================= */
h1, h2, h3 { font-weight: 700; line-height: 1.2; }

/* =======================================================
   Buttons
   ======================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  padding: .6rem 1.2rem;
  transition: background .15s, transform .1s, opacity .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(.97); }

.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-h); }

.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }

.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-h); }

.btn-ghost     { background: transparent; color: var(--text-sub); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--text-sub); }

.btn-large  { padding: .8rem 1.8rem; font-size: 1.1rem; }
.btn-xl     { padding: 1rem 2.5rem; font-size: 1.2rem; border-radius: var(--radius-lg); }
.btn-sm     { padding: .35rem .8rem; font-size: .82rem; }

/* =======================================================
   Inputs
   ======================================================= */
.inp {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  padding: .65rem 1rem;
  outline: none;
  transition: border-color .15s;
  width: 100%;
}
.inp:focus { border-color: var(--primary); }

.inp-code {
  text-align: center;
  letter-spacing: .3em;
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  max-width: 180px;
}

.inp-name {
  max-width: 300px;
}

/* =======================================================
   Flash-Meldungen
   ======================================================= */
.flash {
  padding: .7rem 1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  margin-top: .75rem;
}
.flash-error { background: rgba(224,62,62,.18); border: 1px solid #e03e3e; color: #ff8080; }

/* =======================================================
   STARTSEITE
   ======================================================= */
.page-home {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1rem;
}

.home-wrap {
  width: 100%;
  max-width: 700px;
  text-align: center;
}

.logo {
  font-size: 3.5rem;
  font-weight: 900;
  letter-spacing: -.02em;
  margin-bottom: .3rem;
}
.logo-b {
  color: var(--primary);
  display: inline-block;
}

.home-sub {
  color: var(--text-sub);
  margin-bottom: 2.5rem;
  font-size: 1.05rem;
}

.home-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 520px) {
  .home-cards { grid-template-columns: 1fr; }
}

.home-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.home-card h2 {
  font-size: 1.2rem;
  color: var(--text);
}

.home-card p {
  color: var(--text-sub);
  font-size: .9rem;
  flex: 1;
}

/* =======================================================
   HOST – allgemein
   ======================================================= */
.page-host {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.host-screen {
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 1.5rem;
}

/* Alle Screens im Host standardmäßig column + scroll */

.host-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.host-badge {
  background: var(--primary);
  color: #fff;
  font-size: .7rem;
  font-weight: 800;
  padding: .2rem .5rem;
  border-radius: 6px;
  letter-spacing: .1em;
}

.room-code-label {
  color: var(--text-sub);
  font-size: .95rem;
}
.room-code-label strong { color: var(--text); }

/* -------------------------------------------------------
   Host – Warten / Vorstart
   ------------------------------------------------------- */
.host-screen-waiting {
  display: flex;
}

.prestart-info {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.prestart-code-block {
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
}

.prestart-label {
  font-size: .8rem;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: .1em;
}

.prestart-code {
  font-size: 3.5rem;
  font-weight: 900;
  letter-spacing: .25em;
  color: var(--primary);
}

.prestart-qr {
  border-radius: var(--radius);
  border: 3px solid var(--border);
}

.prestart-url {
  font-size: .78rem;
  color: var(--text-sub);
  word-break: break-all;
}

/* -------------------------------------------------------
   QR-Panel
   ------------------------------------------------------- */
.qr-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.qr-panel-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-start;
}
.qr-panel-inner h3 {
  width: 100%;
  font-size: .95rem;
  color: var(--text-sub);
  font-weight: 600;
}
.qr-link-text {
  font-size: .78rem;
  color: var(--text-sub);
  display: block;
  word-break: break-all;
}

.team-qr-list {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}
.team-qr-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
}
.team-qr-label {
  font-weight: 700;
  font-size: .9rem;
}
.team-qr-item img {
  border-radius: 8px;
  border: 2px solid var(--border);
}

/* -------------------------------------------------------
   Team-Übersicht (Host)
   ------------------------------------------------------- */
.team-overview {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.5rem;
}

.team-card {
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 180px;
  flex: 1 1 200px;
  position: relative;
}
.team-card.team-locked {
  opacity: .55;
}

.team-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}

.team-card-info {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  flex: 1;
}

.team-card-name {
  font-weight: 700;
  font-size: .95rem;
}

.team-card-count {
  font-size: .78rem;
  color: var(--text-sub);
}

.team-card-members {
  font-size: .75rem;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.team-locked-badge {
  font-size: .68rem;
  background: var(--danger);
  color: #fff;
  padding: .1rem .4rem;
  border-radius: 4px;
  font-weight: 700;
}

.btn-delete-team {
  position: absolute;
  top: .4rem;
  right: .4rem;
  padding: .15rem .4rem;
  font-size: .75rem;
  color: var(--text-sub);
}

.host-controls-bottom {
  margin-top: auto;
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
}

.team-manage-row {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* -------------------------------------------------------
   Host – Countdown
   ------------------------------------------------------- */
.host-screen-countdown {
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.countdown-number {
  font-size: min(40vw, 280px);
  font-weight: 900;
  color: var(--primary);
  animation: countdown-pulse .8s ease-in-out infinite alternate;
  line-height: 1;
}

@keyframes countdown-pulse {
  from { transform: scale(1); opacity: 1; }
  to   { transform: scale(1.06); opacity: .85; }
}

/* -------------------------------------------------------
   Host – Aktiv (Buzzer offen)
   ------------------------------------------------------- */
.host-screen-active {
  align-items: center;
  justify-content: center;
}
.host-header-active {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
}

.active-waiting {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.waiting-text {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-sub);
}

/* Animierte Dots */
.waiting-dots {
  display: flex;
  gap: 10px;
}
.waiting-dots span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  animation: dot-bounce 1.2s ease-in-out infinite;
}
.waiting-dots span:nth-child(2) { animation-delay: .2s; }
.waiting-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes dot-bounce {
  0%,80%,100% { transform: translateY(0); opacity: .5; }
  40%          { transform: translateY(-14px); opacity: 1; }
}

/* -------------------------------------------------------
   Host – Buzz-Screen
   ------------------------------------------------------- */
.host-screen-buzz {
  align-items: center;
  justify-content: center;
  background: #111; /* wird per JS überschrieben */
  transition: background .3s;
}

.buzz-team-name {
  font-size: min(18vw, 130px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 4px 30px rgba(0,0,0,.5);
  text-align: center;
  line-height: 1.1;
  padding: 0 1rem;
}

.buzz-member-name {
  font-size: min(9vw, 64px);
  font-weight: 700;
  color: rgba(255,255,255,.9);
  text-align: center;
  padding: 0 1rem;
  margin-top: .5rem;
}

.buzz-controls {
  flex-direction: row;
  justify-content: center;
  flex-wrap: wrap;
}

/* =======================================================
   TEILNEHMER
   ======================================================= */
.page-participant {
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  min-height: 100vh;
}

.p-screen {
  display: none;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  padding: 1.25rem;
}

.p-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.logo-sm {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--primary);
}

.p-team-badge {
  display: inline-block;
  padding: .3rem .9rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: .9rem;
  color: #fff;
  background: var(--primary);
}

.p-title {
  font-size: 1.4rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.p-name-row {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
  align-items: center;
}

/* -------------------------------------------------------
   Teilnehmer – Team-Auswahl
   ------------------------------------------------------- */
.team-list {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin-bottom: 1.5rem;
}

.team-join-btn {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .9rem 1.1rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
  text-align: left;
  color: var(--text);
}
.team-join-btn:hover:not(:disabled) {
  background: var(--surface2);
  transform: translateX(4px);
}
.team-join-btn.team-full {
  opacity: .45;
  cursor: not-allowed;
}

.tj-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tj-name { flex: 1; }

.tj-count {
  font-size: .8rem;
  color: var(--text-sub);
}

.tj-full {
  font-size: .75rem;
  background: var(--danger);
  color: #fff;
  padding: .1rem .4rem;
  border-radius: 4px;
}

/* -------------------------------------------------------
   Teilnehmer – Buzzer
   ------------------------------------------------------- */
.p-name-row-buzzer {
  display: flex;
  gap: .5rem;
  align-items: center;
}

.buzzer-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1rem 0;
}

.buzzer-btn {
  width: min(280px, 80vw);
  height: min(280px, 80vw);
  border-radius: 50%;
  background: var(--surface2);
  border: 5px solid var(--border);
  color: var(--text-sub);
  font-family: var(--font);
  font-size: clamp(1.8rem, 7vw, 3rem);
  font-weight: 900;
  cursor: not-allowed;
  transition: background .2s, border-color .2s, color .2s, transform .1s, box-shadow .2s;
  user-select: none;
  -webkit-user-select: none;
  letter-spacing: .05em;
}

.buzzer-btn.buzzer-ready {
  background: #e03e3e;
  border-color: #ff6060;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 0 40px rgba(224,62,62,.5), 0 0 80px rgba(224,62,62,.25);
  animation: buzzer-pulse 1.5s ease-in-out infinite;
}

.buzzer-btn.buzzer-ready:active {
  transform: scale(.93);
  box-shadow: 0 0 20px rgba(224,62,62,.4);
}

@keyframes buzzer-pulse {
  0%,100% { box-shadow: 0 0 40px rgba(224,62,62,.5), 0 0 80px rgba(224,62,62,.2); }
  50%      { box-shadow: 0 0 60px rgba(224,62,62,.75), 0 0 120px rgba(224,62,62,.35); }
}

.buzz-status {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-sub);
  min-height: 1.5rem;
  text-align: center;
}

.p-bottom {
  margin-top: auto;
  padding-top: 1rem;
  display: flex;
  justify-content: center;
}

/* -------------------------------------------------------
   Teilnehmer – gesperrt / Gewinner-Anzeige
   ------------------------------------------------------- */
.p-screen-locked {
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}

.p-team-badge-large {
  display: inline-block;
  padding: .5rem 1.5rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1.6rem;
  color: #fff;
}

.locked-msg {
  font-size: clamp(1.4rem, 5vw, 2.5rem);
  font-weight: 800;
  text-align: center;
  color: var(--text);
}

.locked-sub {
  font-size: 1rem;
  color: var(--text-sub);
  text-align: center;
}

/* =======================================================
   Scrollbar (subtil)
   ======================================================= */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* =======================================================
   Responsive
   ======================================================= */
@media (max-width: 480px) {
  .prestart-code { font-size: 2.5rem; }
  .buzz-team-name { font-size: 18vw; }
}
