:root {
  color-scheme: light;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --bg: #FFFFFF;
  --text: #1F1F1F;
  --text-muted: #666666;
  --border: #E6E6E6;
  --divider: #EFEFEF;
  --accent-sage: #CCD5AE;
  --accent-clay: #D4A373;
  --live-red: #E53935;
  --active-blue: #3B82F6;
  --muted-red: #D9534F;
  --warning-amber: #E0A84B;
  --success-green: #4E9F6E;
  --selected-bg: rgba(204, 213, 174, 0.16);

  /* Base */
  --rr-bg: var(--bg);
  --rr-surface: #ffffff;
  --rr-surface-alt: #ffffff;
  --rr-accent-soft: var(--selected-bg);
  --rr-accent: var(--accent-clay);

  /* Text */
  --rr-text: var(--text);
  --rr-text-muted: var(--text-muted);
  --rr-text-faint: #9A9A9A;

  /* Borders */
  --rr-border: var(--border);
  --rr-border-light: var(--divider);

  /* Interaction */
  --rr-hover: rgba(0, 0, 0, 0.03);
  --rr-focus-ring: rgba(0, 0, 0, 0.12);

  /* Semantic states */
  --rr-active: var(--active-blue);
  --rr-active-glow: rgba(59, 130, 246, 0.25);
  --rr-muted: var(--muted-red);
  --rr-warning: var(--warning-amber);
  --rr-success: var(--success-green);

  /* Components */
  --rr-btn-bg: var(--accent-clay);
  --rr-btn-text: #ffffff;
  --rr-btn-hover: #C8925F;
  --rr-pill-border: var(--border);
  --rr-pill-text: var(--text-muted);
  --rr-card-bg: #ffffff;
  --rr-card-hover-bg: #ffffff;
  --rr-card-radius: 12px;
  --rr-sidebar-bg: #ffffff;
  --rr-sidebar-active-bg: var(--selected-bg);
  --rr-transcript-meta: #9A9A9A;

  --bg: var(--rr-bg);
  --ink: var(--rr-text);
  --muted: var(--rr-text-muted);
  --line: var(--rr-border);
  --panel: var(--rr-surface);
  --live: var(--live-red);
  --live-ink: var(--rr-btn-text);
  --idle: var(--rr-surface);
  --idle-ink: var(--rr-text-muted);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html,
body,
.enterPage,
.phonePage {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
.enterPage::-webkit-scrollbar,
.phonePage::-webkit-scrollbar {
  display: none;
}

.enterPage {
  min-height: 100vh;
  width: 100%;
  display: grid;
  place-items: center;
  padding: max(22px, env(safe-area-inset-top)) 20px max(22px, env(safe-area-inset-bottom)) 20px;
  overflow: auto;
}

.enterShell {
  width: 380px;
  min-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px 20px 0px 20px;
  display: grid;
  gap: 14px;
  box-shadow: 0 18px 40px color-mix(in srgb, var(--rr-text) 8%, transparent);
}

.enterHeader {
  display: grid;
  gap: 6px;
  text-align: center;
}

.enterTitle {
  margin: 0;
  font-size: clamp(28px, 7.2vw, 34px);
  font-weight: 750;
  letter-spacing: -0.01em;
  color: var(--rr-text);
}

.enterSubtitle {
  margin: 0;
  font-size: 13px;
  color: var(--rr-text-muted);
}

.enterSubtitleBottom {
  text-align: center;
  margin-top: 4px;
}

.enterStatus {
  min-height: 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--rr-text-muted);
}

.enterStatusEmpty {
  display: none;
}

.pinInputWrap {
  display: grid;
  gap: 6px;
}

.pinLabel {
  font-size: 13px;
  font-weight: 600;
  color: var(--rr-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pinInput {
  width: 100%;
  border: 1px solid var(--rr-border);
  border-radius: 16px;
  padding: 16px 18px;
  font-size: clamp(28px, 9vw, 40px);
  font-weight: 750;
  letter-spacing: 0.16em;
  text-align: center;
  color: var(--rr-text);
  background: var(--rr-surface);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.pinInput::placeholder {
  color: var(--rr-text-faint);
  letter-spacing: 0.12em;
}

.pinInput:focus-visible {
  border-color: var(--rr-text);
  box-shadow: 0 0 0 4px var(--rr-focus-ring);
  background: var(--rr-surface);
}

.enterActions {
  display: grid;
}

.enterSubmit {
  border: none;
  border-radius: 15px;
  padding: 13px 18px;
  font-size: 16px;
  font-weight: 750;
  color: var(--rr-btn-text);
  background: var(--rr-text);
  cursor: pointer;
  transition: transform 80ms ease, filter 120ms ease;
}

.enterSubmit:hover {
  filter: brightness(1.02);
}

.enterSubmit:active {
  transform: translateY(1px);
}

.enterDetail {
  min-height: 18px;
  margin: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--rr-warning);
}

.phonePage {
  min-height: 100vh;
  width: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: max(18px, env(safe-area-inset-top)) 22px max(18px, env(safe-area-inset-bottom)) 22px;
  gap: 16px;
}

.topBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.liveBadge {
  min-width: 96px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}

.liveBadgeIdle {
  background: var(--idle);
  color: var(--idle-ink);
  border-color: var(--rr-border);
}

.liveBadgeActive {
  background: var(--live);
  color: var(--live-ink);
  border-color: var(--live-red);
}

.meetingCode {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--rr-text);
}

.reconnectButton {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  margin-right: 2px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--rr-text-muted);
  cursor: pointer;
  border-radius: 8px;
}

.reconnectButton svg {
  width: 22px;
  height: 22px;
}

.reconnectButton:hover {
  background: var(--rr-hover);
  color: var(--rr-text);
}

.reconnectButton:focus-visible {
  outline: 2px solid var(--rr-focus-ring);
  outline-offset: 2px;
}

.meetingCodeLabel {
  font-size: clamp(18px, 4.8vw, 24px);
  font-weight: 500;
}

.meetingCodeValue {
  font-weight: 800;
  font-size: clamp(20px, 5.6vw, 28px);
  letter-spacing: 0.06em;
}

.centerStage {
  display: flex;
    flex-direction: column;
    align-items: center;
    justify-items: center;
    text-align: center;
    gap: 10px;
    padding: 15% 0 8px;
}

.micVisual {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  width: min(34vw, 190px);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  position: relative;
  transition: color 160ms ease;
  color: var(--rr-text);
  cursor: pointer;
  padding: 0;
}

.micOn {
  color: var(--rr-text);
}

.micOff {
  color: var(--rr-muted);
}

.micIcon {
  width: 100%;
  height: 100%;
}

.micSlash {
  position: absolute;
  width: 96%;
  height: 5px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(-26deg);
  opacity: 0;
  transition: opacity 140ms ease;
}

.micVisual.micOff .micSlash {
  opacity: 1;
}

.micVisual:focus-visible {
  outline: 2px solid var(--rr-focus-ring);
  outline-offset: 6px;
  border-radius: 18px;
}

.meterStack {
  width: 200px;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.meterBars {
  width: 100%;
  height: 36px;
  display: grid;
  grid-template-columns: repeat(20, minmax(0, 1fr));
  align-items: end;
  gap: 3px;
  padding: 0 2px;
}

.meterBar {
  width: 100%;
  height: 50%;
  border-radius: 5px;
  background: var(--rr-surface-alt);
  transition: background-color 120ms ease;
}

.meterBarActive {
  background: var(--rr-active);
}

.permissionHint {
  min-height: 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--rr-warning);
}

.soundState {
  font-size: 15px;
  font-weight: 600;
  color: var(--rr-text-muted);
}

.bottomBar {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding-top: 2px;
}

.connectionState {
  font-size: 14px;
  color: var(--muted);
  min-height: 18px;
}

.disconnectButton {
  border: none;
  padding: 6px 8px;
  font-weight: 600;
  background: transparent;
  color: var(--rr-warning);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
}

.disconnectButton:active {
  transform: translateY(1px);
}

.disconnectIcon {
  width: 22px;
  height: 22px;
}

.retryButton {
  border: 1px solid var(--rr-border);
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 700;
  background: var(--rr-text);
  color: var(--rr-btn-text);
  cursor: pointer;
}

.retryButton:active {
  transform: translateY(1px);
}

.startFallback {
  display: none;
}

.toggles {
  position: fixed;
  left: 14px;
  bottom: max(14px, env(safe-area-inset-bottom));
  display: grid;
  gap: 6px;
  text-align: left;
  font-size: 12px;
  color: var(--rr-text-muted);
  background: color-mix(in srgb, var(--rr-surface) 96%, transparent);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--rr-text) 12%, transparent);
  z-index: 20;
}

.toggleRow {
  display: flex;
  gap: 8px;
  align-items: center;
}

.hiddenAudio {
  width: 1px;
  height: 1px;
  opacity: 0;
  position: absolute;
  pointer-events: none;
}

.debugDropdown {
  position: fixed;
  right: 14px;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 30;
}

.debugButton {
  border: 1px solid var(--rr-border);
  background: var(--rr-surface);
  color: var(--rr-text-muted);
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.debugMenu {
  position: absolute;
  right: 0;
  bottom: 34px;
  min-width: 190px;
  background: var(--rr-surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 20px color-mix(in srgb, var(--rr-text) 14%, transparent);
  padding: 6px;
  text-align: left;
}

.debugMenuItem {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 7px 8px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--rr-text);
  cursor: pointer;
}

.debugMenuItem:hover {
  background: var(--rr-hover);
}
