:root {
  --bg: #eef0f3;
  --card-bg: #ffffff;
  --text: #111114;
  --muted: #5f636c;
  --border: #e7e7ea;
  --accent-yellow: #ffd60a;
  --accent-purple: #7c3aed;
  --host-color: #2f3138;
  --robot1-color: #7c3aed;
  --robot2-color: #f4c430;
  --danger: #b00020;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  font-family: Inter, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  overscroll-behavior-y: contain;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: 1.25rem;
}

.hub-card {
  width: min(760px, 100%);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: clamp(1.25rem, 4vw, 2rem);
  box-shadow: 0 18px 38px rgba(24, 28, 38, 0.14);
  position: relative;
}

.audience-card {
  width: min(620px, 100%);
}

.host-card {
  width: min(820px, 100%);
}

.kicker {
  display: block;
  width: 100%;
  margin-bottom: 0.55rem;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-purple);
  font-weight: 700;
  text-align: center;
}

.page-title {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.15rem);
  font-weight: 750;
  text-align: center;
}

.page-subtitle {
  margin: 0.7rem 0 1.4rem;
  color: var(--muted);
  text-align: center;
}

.host-header {
  text-align: center;
  margin-bottom: 1rem;
}

.stack-form,
.stack-section {
  display: grid;
  gap: 0.75rem;
}

.section-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 680;
  text-align: center;
}

.form-control {
  border-radius: 0.8rem;
  border-color: #dbdce2;
}

.form-control:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 0.2rem rgba(124, 58, 237, 0.16);
}

.btn-accent {
  background: linear-gradient(90deg, var(--accent-purple), #6d28d9);
  border: none;
  color: #fff;
  font-weight: 600;
}

.btn-accent:hover,
.btn-accent:focus-visible {
  background: linear-gradient(90deg, #6d28d9, #5b21b6);
  color: #fff;
}

.status {
  min-height: 1.25rem;
  margin: 0.8rem 0 0;
  font-size: 0.95rem;
  color: var(--muted);
  text-align: center;
}

.status.error {
  color: var(--danger);
}

.status.success {
  color: #1e7a33;
}

.hidden {
  display: none !important;
}

.panel-actions {
  display: flex;
  justify-content: center;
  margin-bottom: 0.35rem;
}

.panel-actions .section-title {
  margin: 0;
}

.panel-actions .btn {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
}

.speaker-switch {
  margin-top: 0.25rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: #f5f5f8;
  border: 1px solid #dddee6;
  border-radius: 1rem;
  overflow: hidden;
  touch-action: pan-y;
}

.speaker-segment {
  border: 0;
  background: transparent;
  padding: 0.82rem 0.45rem;
  display: grid;
  gap: 0.15rem;
  justify-items: center;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.speaker-segment .segment-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.speaker-segment .segment-subtitle {
  font-size: 0.75rem;
  color: #6b6f78;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.speaker-segment.active .segment-subtitle {
  color: inherit;
  opacity: 0.88;
}

.speaker-segment.active {
  color: #fff;
  transform: translateY(-1px);
}

.speaker-segment.speaker-host.active {
  background: var(--host-color);
}

.speaker-segment.speaker-robot1.active {
  background: var(--robot1-color);
}

.speaker-segment.speaker-robot2.active {
  background: var(--robot2-color);
  color: #171717;
}

#audience .stack-form,
.audience-card .stack-form {
  text-align: center;
}

.audience-card .form-control,
.audience-card .btn {
  margin-inline: auto;
}

.speaker-segment:focus-visible {
  outline: 2px solid var(--accent-purple);
  outline-offset: -2px;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

.warning {
  margin: 0.55rem 0 0.4rem;
  min-height: 1.25rem;
  color: var(--muted);
  text-align: center;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.warning.error {
  color: var(--danger);
}

.question-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.7rem;
}

.question-item {
  background: #fafafc;
  border: 1px solid #e2e4ec;
  border-radius: 0.9rem;
  padding: 0.9rem 1rem;
  touch-action: pan-y;
  user-select: none;
  position: relative;
  transition: transform 150ms ease, opacity 150ms ease;
}

.question-item.swiping {
  transition: none;
}

.question-item.dismissing {
  transform: translateX(calc(var(--dismiss-direction, -1) * 120%));
  opacity: 0;
}

.question-text {
  display: block;
  font-size: 0.98rem;
  line-height: 1.35;
}

.question-meta {
  margin-top: 0.35rem;
  color: #7a7f88;
  font-size: 0.76rem;
}

.rename-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 40;
}

.rename-modal-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 1rem;
  border: 1px solid #dfdfe6;
  padding: 1rem;
  display: grid;
  gap: 0.7rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
}

.rename-title {
  margin: 0;
  font-size: 1.15rem;
}

.rename-description {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.rename-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

@media (max-width: 640px) {
  .hub-card {
    border-radius: 1rem;
    padding: 1rem;
  }

  .panel-actions .btn {
    top: 0.65rem;
    right: 0.7rem;
  }

  .speaker-segment {
    padding: 0.75rem 0.25rem;
  }

  .speaker-segment .segment-title {
    font-size: 0.86rem;
  }

  .speaker-segment .segment-subtitle {
    font-size: 0.7rem;
  }

  #login .d-flex {
    flex-direction: column;
  }
}
