/* Huh — UI tokens from brand.virginia.edu (exact primaries)
   UVA Blue #232D4B · UVA Orange #E57200 */

:root {
  --uva-blue: #232D4B;
  --uva-orange: #E57200;
  --uva-blue-25: #C8CBD2;
  --uva-orange-25: #F9DCBF;
  --bg: #232D4B;
  /* Slight lift only (92% UVA Blue + 8% white) — primaries stay exact */
  --bg-elev: color-mix(in srgb, #232D4B 92%, #FFFFFF);
  --surface: color-mix(in srgb, #232D4B 92%, #FFFFFF);
  --border: #495E9D;
  --border-strong: #C8CBD2;
  --text: #FFFFFF;
  /* Brighter than Blue-25 for AA-friendlier secondary text on navy */
  --muted: #E2E5EC;
  --accent: #E57200;
  --accent-deep: #E57200;
  --accent-soft: color-mix(in srgb, #E57200 22%, transparent);
  --warn: #FDDA24;
  --danger: #DF1E43;
  --you-surface: color-mix(in srgb, #232D4B 92%, #FFFFFF);
  --you-border: #E57200;
  --radius: 14px;
  --radius-sm: 10px;
  --font-brand: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", "Segoe UI", sans-serif;
  --font-ui: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", "Segoe UI", sans-serif;
  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.28);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 520px at 50% -8%, color-mix(in srgb, #E57200 28%, transparent) 0%, transparent 58%),
    radial-gradient(700px 420px at 100% 100%, color-mix(in srgb, #495E9D 55%, transparent) 0%, transparent 42%),
    #232D4B;
  background-attachment: fixed;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 28px 20px 36px;
  gap: 22px;
}

/* ---- Voice enrollment (~30s read so this phone knows it’s you) ---- */
.enroll {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
  justify-content: center;
  animation: enter 0.45s var(--ease) both;
}

.enroll-title {
  margin: 18px 0 0;
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.enroll-steps {
  max-width: 34rem;
  margin: 14px auto 0;
  padding-left: 1.35rem;
  font-size: 17px;
  line-height: 1.5;
  color: var(--muted);
  text-align: left;
}

.enroll-steps li {
  margin-bottom: 10px;
}

.enroll-steps li:last-child {
  margin-bottom: 0;
}

.enroll-steps strong {
  color: var(--text);
  font-weight: 700;
}

.enroll-steps em {
  font-style: normal;
  color: var(--accent);
  font-weight: 600;
}

.enroll-mic-line {
  max-width: 34rem;
  margin: 12px auto 0;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  font-weight: 600;
  text-align: center;
}

.enroll-script {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-soft);
}

.enroll-script-label {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.enroll-script-text {
  margin: 0;
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
}

.enroll-progress-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.enroll-progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--bg-elev, #353E59);
  border: 1px solid var(--border);
  overflow: hidden;
}

.enroll-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.15s linear;
}

.enroll-progress-text {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
  text-align: center;
}

.enroll-error {
  color: var(--danger, #DF1E43);
}

.btn.link {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  text-decoration: underline;
  padding: 12px 8px;
  min-height: 44px;
  cursor: pointer;
  align-self: center;
}

.btn.link:hover {
  color: var(--text);
}

/* ---- Lobby (Airbnb hierarchy + Duolingo CTA) ---- */
.lobby {
  display: flex;
  flex-direction: column;
  gap: 28px;
  flex: 1;
  justify-content: center;
  animation: enter 0.45s var(--ease) both;
}

.hero {
  text-align: center;
}

.brand {
  margin: 0;
  font-family: var(--font-brand);
  font-size: clamp(56px, 14vw, 78px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 0.95;
  color: var(--text);
  animation: brandIn 0.55s var(--ease) both;
}

.tagline {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.lobby-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 22px 20px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
}

.field-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input[type="text"] {
  width: 100%;
  padding: 15px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 17px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input[type="text"]::placeholder {
  color: color-mix(in srgb, var(--muted) 75%, transparent);
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.join-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: enter 0.28s var(--ease) both;
}

.join-row {
  display: flex;
  gap: 10px;
}

.join-row input {
  flex: 1;
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-weight: 700;
  font-size: 22px;
  text-align: center;
  padding-left: 1.1em;
}

.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 15px 18px;
  min-height: 48px;
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.12s var(--ease),
    opacity 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn.primary {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #111111;
  box-shadow: 0 8px 20px rgba(245, 162, 74, 0.42);
}

.btn.primary:hover {
  filter: brightness(1.05);
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn.ghost:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.btn.small {
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  min-height: 44px;
}

.btn.stop {
  background: transparent;
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 55%, transparent);
  padding: 12px 16px;
  font-size: 15px;
  min-height: 44px;
}

.btn.stop:hover {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.hint.error {
  color: var(--danger);
  font-weight: 600;
}

/* ---- Live (Uber status + Slack transcript + Figma presence) ---- */
.live {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
  animation: enter 0.35s var(--ease) both;
  --caption-size: 22px;
  --interim-size: 18px;
}

.live[data-caption-size="small"] {
  --caption-size: 18px;
  --interim-size: 15px;
}

.live[data-caption-size="medium"] {
  --caption-size: 22px;
  --interim-size: 18px;
}

.live[data-caption-size="large"] {
  --caption-size: 26px;
  --interim-size: 21px;
}

.live[data-caption-size="xlarge"] {
  --caption-size: 32px;
  --interim-size: 24px;
}

.statusbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.status-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
  flex: 1 1 160px;
  min-width: 0;
  line-height: 1.35;
}

.caption-size {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  background: color-mix(in srgb, var(--bg-elev) 80%, transparent);
}

.caption-size-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-ui);
  font-weight: 700;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.caption-size-btn[data-size="small"] {
  font-size: 12px;
}

.caption-size-btn[data-size="medium"] {
  font-size: 15px;
}

.caption-size-btn[data-size="large"] {
  font-size: 18px;
}

.caption-size-btn[data-size="xlarge"] {
  font-size: 22px;
}

.caption-size-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--text);
}

.caption-size-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.mic-on {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
  line-height: 1.2;
  padding-left: 2px;
}

.statusbar #exportPdfBtn {
  flex: 0 0 auto;
}

.statusbar #exportPdfBtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.statusbar .btn.stop {
  flex: 0 0 auto;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  flex: 0 0 auto;
}

.dot.connecting,
.dot.reconnecting {
  background: var(--warn);
  animation: pulse 1.2s ease-out infinite;
}

.dot.live {
  background: var(--accent);
  animation: pulse 1.5s ease-out infinite;
}

.dot.backOnline {
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
}

.dot.error {
  background: var(--danger);
}

.table-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.table-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.table-code-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.table-code-value {
  font-family: var(--font-brand);
  font-size: clamp(28px, 8vw, 36px);
  font-weight: 800;
  letter-spacing: 0.22em;
  color: var(--text);
  line-height: 1.1;
}

.roster {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 28px;
  align-items: flex-start;
}

.chip-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 13px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  animation: enter 0.25s var(--ease) both;
}

.chip.me {
  border: 2px solid var(--accent);
  background: var(--accent-soft);
}

.chip-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.transcript-shell {
  position: relative;
  flex: 1;
  min-height: 240px;
  max-height: 52vh;
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.transcript {
  flex: 1;
  min-height: 0; /* let this flex child scroll instead of growing forever */
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) color-mix(in srgb, var(--bg-elev) 80%, transparent);
}

.transcript::-webkit-scrollbar {
  width: 10px;
}

.transcript::-webkit-scrollbar-track {
  background: transparent;
  margin: 6px 0;
}

.transcript::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.transcript::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
  background-clip: padding-box;
  border: 2px solid transparent;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  pointer-events: none;
}

.empty-state.hidden {
  display: none;
}

.bubble {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 11px 14px;
  max-width: 88%;
  align-self: flex-start;
  animation: rise 0.22s var(--ease);
}

.bubble.me {
  align-self: flex-end;
  background: var(--you-surface);
  border: 1px solid var(--you-border);
  border-left: 4px solid var(--accent);
}

.bubble .meta {
  font-size: 13px;
  margin-bottom: 4px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.bubble.me .meta {
  color: var(--accent);
}

.bubble .text {
  /* Default medium; .live[data-caption-size] overrides via --caption-size */
  font-size: var(--caption-size, 22px);
  line-height: 1.5;
  font-weight: 500;
  color: var(--text);
}

.interim {
  min-height: 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 4px 2px;
}

.interim-line {
  color: color-mix(in srgb, var(--muted) 88%, transparent);
  font-size: var(--interim-size, 18px);
  font-style: italic;
  font-weight: 500;
  opacity: 0.85;
}

.interim-line .who {
  font-style: normal;
  font-weight: 700;
}

.footer {
  text-align: center;
  color: color-mix(in srgb, var(--muted) 80%, transparent);
  font-size: 14px;
  font-weight: 500;
  margin-top: auto;
  letter-spacing: 0.02em;
}

.hidden {
  display: none !important;
}

/* ---- Mic / setup help sheet ---- */
.help-sheet {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, #000000 48%, transparent);
  animation: enter 0.25s var(--ease) both;
}

.help-sheet-card {
  width: min(100%, 420px);
  max-height: min(90dvh, 640px);
  overflow: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 22px 20px 18px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.help-sheet-title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.help-sheet-body {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--muted);
}

.help-sheet-body p {
  margin: 0 0 12px;
}

.help-sheet-body ol {
  margin: 0 0 14px;
  padding-left: 1.35rem;
}

.help-sheet-body li {
  margin-bottom: 8px;
}

.help-sheet-body strong {
  color: var(--text);
}

/* ---- Post-table save sheet ---- */
.save-sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, #000000 48%, transparent);
  animation: enter 0.25s var(--ease) both;
}

.save-sheet-card {
  width: min(100%, 400px);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 22px 20px 18px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.save-sheet-title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.save-sheet-body {
  margin: 0 0 6px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
}

/* ---- Join QR sheet ---- */
.qr-sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, #000000 48%, transparent);
  animation: enter 0.25s var(--ease) both;
}

.qr-sheet-card {
  width: min(100%, 360px);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 22px 20px 18px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.qr-sheet-title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.qr-sheet-body {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
}

.qr-canvas-wrap {
  background: #ffffff;
  border-radius: var(--radius-sm);
  padding: 14px;
  line-height: 0;
}

.qr-canvas-wrap canvas {
  display: block;
  width: 240px;
  height: 240px;
  max-width: min(240px, 70vw);
  max-height: min(240px, 70vw);
}

.qr-code-echo {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: var(--text);
}

.qr-close-btn {
  width: 100%;
  min-height: 56px;
  padding: 16px 20px;
  font-size: 18px;
  font-weight: 700;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes brandIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent);
  }
  70% {
    box-shadow: 0 0 0 9px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (min-width: 560px) {
  .actions {
    flex-direction: row;
  }

  .actions .btn {
    flex: 1;
  }

  .actions .btn.primary {
    flex: 1.15;
  }
}
