/* Woki v2 — "Field radio"
 * Light, warm paper for browsing. Dark "on-air" mode for the live channel.
 * Color = meaning:  orange = I transmit · green = I receive · violet = translating. */
:root {
  /* light / browse */
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface-2: #ece9e3;
  --ink: #121417;
  --ink-2: #3a3f47;
  --mute: #6b7079;
  --line: #e2ded6;

  /* signal colors */
  --tx: #ff5a1f;
  --tx-deep: #e8460c;
  --tx-soft: rgba(255, 90, 31, 0.12);
  --rx: #0fa877;
  --rx-bright: #2ee0a0;
  --rx-soft: rgba(15, 168, 119, 0.12);
  --think: #9d8cff;
  --danger: #e5383b;

  /* live / on-air */
  --live-bg: #0c0e11;
  --live-surface: #16191e;
  --live-line: rgba(255, 255, 255, 0.08);
  --live-ink: #f3f4f6;
  --live-mute: #9aa1ac;

  --radius: 18px;
  --radius-lg: 26px;
  --shadow-1: 0 1px 2px rgba(18, 20, 23, 0.04), 0 6px 18px rgba(18, 20, 23, 0.05);
  --shadow-tx: 0 10px 30px rgba(255, 90, 31, 0.35);

  --level: 0;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --font: "Heebo", "Noto Sans Arabic", "Noto Sans Devanagari", system-ui, sans-serif;
  --display: "Rubik", "Heebo", "Noto Sans Devanagari", system-ui, sans-serif;

  /* legacy aliases (still referenced by older markup) */
  --accent: var(--tx);
  --accent-deep: var(--tx-deep);
  --calm: var(--rx);
  --chalk: var(--surface);
  --asphalt: var(--ink);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

input {
  user-select: text;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid rgba(255, 90, 31, 0.55);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.screen {
  height: 100%;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.dust-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 60% at 50% -10%, #ffffff 0%, rgba(255, 255, 255, 0) 60%), var(--bg);
  z-index: 0;
}

#screenOnboard,
#screenHome {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.onboard,
.home-top,
.home-main,
.radio-header,
.radio-face {
  position: relative;
  z-index: 1;
}

/* ——— Brand ——— */
.brand-wordmark {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 2.6rem;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
  direction: ltr;
}

.brand-wordmark::after {
  content: ".";
  color: var(--tx);
}

.brand-wordmark.sm {
  font-size: 1.5rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--ink);
  margin-bottom: 14px;
  box-shadow: 0 12px 28px rgba(18, 20, 23, 0.18);
}

.brand-mark span {
  width: 6px;
  border-radius: 3px;
  background: var(--tx);
  animation: markBar 1.4s ease-in-out infinite;
}

.brand-mark span:nth-child(1) {
  height: 16px;
}
.brand-mark span:nth-child(2) {
  height: 30px;
  animation-delay: 0.2s;
}
.brand-mark span:nth-child(3) {
  height: 20px;
  animation-delay: 0.4s;
}

@keyframes markBar {
  0%,
  100% {
    transform: scaleY(0.7);
  }
  50% {
    transform: scaleY(1);
  }
}

.brand-hero {
  padding: calc(36px + var(--safe-top)) 24px 4px;
  text-align: center;
}

.brand-tag {
  margin: 10px auto 0;
  max-width: 28ch;
  color: var(--ink-2);
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.4;
  text-wrap: balance;
}

/* ——— Onboard ——— */
.onboard {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(28px + var(--safe-bottom));
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}

.ob-progress {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 22px 0 6px;
}

.ob-progress span {
  width: 22px;
  height: 4px;
  border-radius: 4px;
  background: var(--line);
  transition: background 0.3s ease, width 0.3s ease;
}

.ob-progress span.on {
  width: 34px;
  background: var(--tx);
}

.ob-step {
  padding: 12px 20px 24px;
  animation: rise 0.45s ease both;
}

.ob-step h2 {
  margin: 10px 0 18px;
  font-family: var(--display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-align: center;
}

.multi-title span {
  display: inline-block;
  animation: rise 0.4s ease both;
}

.ob-body {
  margin: -6px auto 22px;
  max-width: 30ch;
  text-align: center;
  color: var(--ink-2);
  font-size: 1.02rem;
  line-height: 1.5;
}

.ob-error {
  margin: -10px 0 16px;
  text-align: center;
  color: var(--danger);
  font-size: 0.92rem;
}

.lang-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.lang-list .choice-card {
  min-height: 84px;
  justify-content: center;
  position: relative;
}

.lang-list .choice-card strong {
  font-size: 1.2rem;
}

.choice-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: start;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.choice-card:active {
  transform: scale(0.98);
}

.choice-card strong {
  font-size: 1.06rem;
  font-weight: 700;
}

.choice-card span {
  color: var(--mute);
  font-size: 0.9rem;
}

.choice-card.selected {
  border-color: var(--tx);
  background: #fff7f3;
  box-shadow: 0 0 0 3px var(--tx-soft);
}

.gender-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 22px;
}

.gender-row .gender-btn {
  align-items: center;
  text-align: center;
  font-weight: 600;
  min-height: 52px;
  justify-content: center;
}

.field-label {
  margin: 4px 0 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--mute);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--mute);
}

.field input,
.field select,
.share-input {
  font: inherit;
  font-size: 1.08rem;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 15px 16px;
  outline: none;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder {
  color: #a3a7ae;
}

.field input:focus,
.share-input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(18, 20, 23, 0.06);
}

/* Mic permission step */
.mic-step {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.mic-hero {
  position: relative;
  width: 132px;
  height: 132px;
  margin: 18px auto 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(160deg, var(--tx), var(--tx-deep));
  box-shadow: var(--shadow-tx);
}

.mic-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--tx);
  animation: ripple 2.4s ease-out infinite;
}

.mic-ring.r2 {
  animation-delay: 1.2s;
}

@keyframes ripple {
  from {
    transform: scale(1);
    opacity: 0.5;
  }
  to {
    transform: scale(1.7);
    opacity: 0;
  }
}

/* ——— Buttons ——— */
.primary-btn,
.secondary-btn,
.ghost-btn,
.text-link {
  font: inherit;
  cursor: pointer;
}

.primary-btn {
  width: 100%;
  min-height: 56px;
  border: none;
  border-radius: 16px;
  padding: 15px 18px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: 0.005em;
  transition: transform 0.12s ease, opacity 0.2s ease;
}

.primary-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.primary-btn:disabled {
  opacity: 0.28;
}

.primary-btn.sm {
  width: auto;
  min-height: 0;
  padding: 10px 16px;
  font-size: 0.95rem;
  border-radius: 12px;
}

.secondary-btn {
  width: 100%;
  min-height: 52px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 13px 18px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  margin-top: 10px;
}

.secondary-btn.danger {
  color: var(--danger);
  background: transparent;
  border-color: transparent;
  margin-top: 6px;
}

.ghost-btn {
  border: none;
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  padding: 8px 4px;
}

.text-link {
  display: block;
  margin: 14px auto 0;
  border: none;
  background: none;
  color: var(--mute);
  font-weight: 600;
  padding: 8px 12px;
}

/* ——— Avatars (shared) ——— */
.chip-avatar,
.contact-avatar,
.participant-avatar,
.channel-avatar,
.ic-avatar {
  --h: 24;
  border-radius: 50%;
  background-color: hsl(var(--h) 70% 92%);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  color: hsl(var(--h) 55% 32%);
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 4px 0 18px;
  color: var(--mute);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.avatar-preview {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--surface) center/cover no-repeat;
  border: 2px dashed #cfcac0;
  display: grid;
  place-items: center;
  font-size: 1.8rem;
  font-weight: 300;
  color: var(--mute);
  overflow: hidden;
}

.avatar-preview[style*="background-image"] {
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1.5px var(--line), var(--shadow-1);
}

.avatar-preview.room-photo {
  border-radius: 26px;
}

/* ——— Home ——— */
.screen.has-tabs {
  padding-bottom: calc(76px + var(--safe-bottom));
}

.home-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + var(--safe-top)) 20px 0;
}

.home-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-quiet {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.icon-quiet:active {
  background: var(--surface-2);
}

.plus-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--tx);
  color: #fff;
  font-size: 1.7rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(255, 90, 31, 0.35);
  display: grid;
  place-items: center;
  padding: 0 0 2px;
}

.home-main {
  padding: 8px 20px 16px;
  flex: 1;
}

.home-title {
  margin: 18px 0 14px;
  font-family: var(--display);
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.app-tabs {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(12px + var(--safe-bottom));
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: min(320px, calc(100% - 40px));
  padding: 6px;
  background: rgba(18, 20, 23, 0.94);
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(18, 20, 23, 0.25);
  backdrop-filter: blur(14px);
}

.app-tabs .tab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 11px 10px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.app-tabs .tab-btn svg {
  width: 20px;
  height: 20px;
}

.app-tabs .tab-btn.active {
  color: var(--ink);
  background: #fff;
}

.app-tabs .tab-btn.active svg {
  color: var(--tx);
}

.channels-list {
  display: grid;
  gap: 10px;
}

.channel-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 12px 14px;
  min-height: 76px;
  text-align: start;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: transform 0.15s ease;
}

.channel-chip:active {
  transform: scale(0.985);
}

.channel-chip .chip-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.channel-chip .chip-avatar {
  width: 50px;
  height: 50px;
  font-size: 1.2rem;
}

.channel-chip strong {
  display: block;
  font-size: 1.08rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-chip .chip-sub {
  display: block;
  margin-top: 3px;
  font-size: 0.88rem;
  color: var(--mute);
}

.channel-chip .chip-go {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 1.3rem;
  flex-shrink: 0;
}

.channel-chip.incoming {
  border-color: var(--rx);
  box-shadow: 0 0 0 4px var(--rx-soft), var(--shadow-1);
}

.channel-chip.incoming .chip-sub {
  color: var(--rx);
  font-weight: 600;
}

.channel-chip.incoming .chip-go {
  background: var(--rx);
  color: #fff;
  font-size: 0.7rem;
  animation: chipPulse 1.4s ease-in-out infinite;
}

@keyframes chipPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(15, 168, 119, 0.45);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(15, 168, 119, 0);
  }
}

.home-empty {
  margin: 28px auto 0;
  padding: 28px 22px;
  max-width: 340px;
  text-align: center;
  color: var(--mute);
  font-size: 0.98rem;
  line-height: 1.55;
  white-space: pre-line;
  border: 1.5px dashed #d6d1c7;
  border-radius: var(--radius-lg);
}

.home-empty::before {
  content: "";
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background:
    linear-gradient(var(--tx), var(--tx)) 17px 22px / 5px 12px no-repeat,
    linear-gradient(var(--tx), var(--tx)) 25px 15px / 5px 26px no-repeat,
    linear-gradient(var(--tx), var(--tx)) 33px 19px / 5px 18px no-repeat,
    var(--ink);
}

.invite-banner {
  position: relative;
  z-index: 2;
  margin: 14px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-1);
}

.invite-banner .muted {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.9rem;
}

.invite-banner .primary-btn {
  background: var(--rx);
}

.invite-banner.ringing {
  background: var(--rx);
}

.invite-banner.ringing .primary-btn {
  background: #fff;
  color: var(--rx);
}

/* ——— Contacts ——— */
.contacts-list {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  max-height: min(48vh, 380px);
  overflow-y: auto;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: none;
  background: transparent;
  border-radius: 14px;
  padding: 10px 8px;
  text-align: start;
  cursor: pointer;
}

.contact-row:active {
  background: var(--surface-2);
}

.contact-avatar {
  width: 44px;
  height: 44px;
}

.contact-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.contact-meta strong {
  font-size: 1.02rem;
}

.contact-meta span {
  color: var(--mute);
  font-size: 0.86rem;
}

/* ——— Live channel (on-air, dark) ——— */
.radio-screen {
  background:
    radial-gradient(90% 55% at 50% 42%, rgba(255, 255, 255, 0.045), transparent 70%),
    var(--live-bg);
  color: var(--live-ink);
  transition: background-color 0.4s ease;
}

.radio-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  background: radial-gradient(80% 50% at 50% 45%, var(--mode-glow, transparent), transparent 70%);
}

.radio-screen[data-mode="listening"] {
  --mode-glow: rgba(255, 90, 31, 0.16);
}
.radio-screen[data-mode="speaking"] {
  --mode-glow: rgba(46, 224, 160, 0.13);
}
.radio-screen[data-mode="thinking"] {
  --mode-glow: rgba(157, 140, 255, 0.12);
}
.radio-screen[data-mode="listening"]::before,
.radio-screen[data-mode="speaking"]::before,
.radio-screen[data-mode="thinking"]::before {
  opacity: 1;
}

.radio-header {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  padding: calc(10px + var(--safe-top)) 14px 6px;
}

.radio-screen .icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  color: var(--live-ink);
  opacity: 1;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 1.7rem;
}

.radio-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px;
}

.channel-avatar {
  width: 38px;
  height: 38px;
  font-size: 1rem;
}

.radio-heading-text {
  min-width: 0;
  text-align: start;
}

.radio-heading strong {
  display: block;
  font-family: var(--display);
  font-size: 1.08rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.radio-desc {
  display: none;
}

.radio-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--live-mute);
  margin-top: 1px;
}

.radio-meta::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rx-bright);
  box-shadow: 0 0 0 3px rgba(46, 224, 160, 0.18);
}

.radio-meta:empty::before {
  display: none;
}

.lang-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px 0;
  min-height: 34px;
}

.lang-pill {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--live-mute);
  border: 1px solid var(--live-line);
}

.lang-pill.mine {
  background: rgba(255, 90, 31, 0.14);
  border-color: rgba(255, 90, 31, 0.3);
  color: #ff9a6e;
}

.icon-btn {
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  padding: 8px;
  cursor: pointer;
}

.conn-banner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 4px 16px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(229, 56, 59, 0.16);
  color: #ff8a8c;
  font-size: 0.9rem;
  font-weight: 500;
}

.conn-banner .text-link {
  margin: 0;
  color: #fff;
  padding: 4px 8px;
  text-decoration: underline;
}

.radio-face {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0 20px calc(22px + var(--safe-bottom));
}

.speaker-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 240px;
  --level: 0;
  --ring: rgba(255, 255, 255, 0.14);
}

.speaker-stage[data-mode="listening"] {
  --ring: var(--tx);
}
.speaker-stage[data-mode="speaking"] {
  --ring: var(--rx-bright);
}
.speaker-stage[data-mode="thinking"] {
  --ring: var(--think);
}

.speaker-core {
  position: relative;
  flex-shrink: 0;
  --core: min(72vw, 290px, 34dvh);
  width: var(--core);
  height: var(--core);
  /* photo is 40% of the core: pull the text up into the halo's empty lower band */
  margin-bottom: calc(var(--core) * -0.12);
  display: grid;
  place-items: center;
}

.voice-orb-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.speaker-orb {
  position: relative;
  z-index: 1;
  width: 40%;
  height: 40%;
  border-radius: 50%;
  padding: 4px;
  background: var(--live-bg);
  box-shadow: 0 0 0 2px var(--ring);
  transform: scale(calc(1 + var(--level) * 0.06));
  transition: transform 70ms linear, box-shadow 0.3s ease;
}

.speaker-photo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--live-surface) center/cover no-repeat;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--live-mute);
  overflow: hidden;
}

.speaker-stage.idle .speaker-photo:empty::before,
.speaker-stage[data-mode="idle"] .speaker-photo:empty::before {
  content: "";
  width: 34%;
  height: 34%;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 14a3 3 0 0 0 3-3V6a3 3 0 1 0-6 0v5a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.92V21h2v-3.08A7 7 0 0 0 19 11h-2z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 14a3 3 0 0 0 3-3V6a3 3 0 1 0-6 0v5a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.92V21h2v-3.08A7 7 0 0 0 19 11h-2z'/%3E%3C/svg%3E") center/contain no-repeat;
  opacity: 0.5;
}

.stage-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 13%;
  translate: -50% 0;
  white-space: nowrap;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ring);
  background: var(--live-bg);
  border: 1px solid currentColor;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.stage-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: blink 1s ease-in-out infinite;
}

.speaker-stage[data-mode="listening"] .stage-state,
.speaker-stage[data-mode="thinking"] .stage-state {
  opacity: 1;
  transform: none;
}

@keyframes blink {
  50% {
    opacity: 0.25;
  }
}

.speaker-name {
  margin-top: 6px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--live-ink);
  min-height: 1.4em;
}

.speaker-stage.idle .speaker-name {
  color: var(--live-mute);
  font-weight: 500;
  font-family: var(--font);
  font-size: 1rem;
}

.speaker-stage[data-mode="speaking"] .speaker-name {
  color: var(--rx-bright);
}

.burst-text {
  margin-top: 6px;
  font-size: clamp(1.12rem, 4.6vw, 1.6rem);
  font-weight: 600;
  line-height: 1.4;
  max-width: 22ch;
  color: var(--live-ink);
  min-height: 2.8em;
  text-wrap: balance;
  user-select: text;
}

.burst-text:not(:empty) {
  animation: burstIn 0.25s ease both;
}

.speaker-stage.idle .burst-text {
  color: var(--live-mute);
}

/* PTT */
.ptt-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 6px;
}

.ptt-dial {
  position: relative;
  width: min(44vw, 172px, 22dvh);
  height: min(44vw, 172px, 22dvh);
  border: none;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  cursor: pointer;
  touch-action: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* track ring */
.ptt-dial::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  transition: border-color 0.2s ease, transform 0.3s ease;
}

.ptt-glow {
  position: absolute;
  inset: -14%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 90, 31, 0.45), transparent 65%);
  opacity: 0.35;
  animation: glowBreath 3s ease-in-out infinite;
  pointer-events: none;
}

.ptt-disc {
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: radial-gradient(120% 120% at 30% 20%, #ff7a45 0%, var(--tx) 45%, var(--tx-deep) 100%);
  box-shadow:
    0 18px 40px rgba(255, 90, 31, 0.35),
    inset 0 2px 0 rgba(255, 255, 255, 0.28),
    inset 0 -6px 14px rgba(0, 0, 0, 0.12);
  transition: transform 0.14s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.ptt-disc .mic {
  width: 44px;
  height: 44px;
}

.ptt-dial:disabled {
  cursor: default;
}

.ptt-dial:disabled .ptt-disc {
  background: var(--live-surface);
  color: var(--live-mute);
  box-shadow: inset 0 0 0 1.5px var(--live-line);
}

.ptt-dial:disabled .ptt-glow {
  opacity: 0;
}

.ptt-dial.recording .ptt-disc,
.ptt-dial:active:not(:disabled) .ptt-disc {
  transform: scale(0.93);
}

.ptt-dial.recording::before {
  border-color: var(--tx);
  transform: scale(calc(1.04 + var(--level, 0) * 0.08));
}

.ptt-dial.recording .ptt-glow {
  opacity: 1;
  animation: glowHot 0.9s ease-in-out infinite;
}

.ptt-dial.busy .ptt-disc {
  background: radial-gradient(120% 120% at 30% 20%, #b3a6ff 0%, var(--think) 55%, #7a67f0 100%);
  box-shadow: 0 18px 40px rgba(157, 140, 255, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.28);
}

.ptt-dial.busy .ptt-glow {
  background: radial-gradient(circle, rgba(157, 140, 255, 0.45), transparent 65%);
}

/* someone else holds the floor */
.ptt-stage.floor-locked .ptt-disc {
  background: var(--live-surface);
  color: var(--rx-bright);
  box-shadow: inset 0 0 0 2px rgba(46, 224, 160, 0.4);
}

.ptt-stage.floor-locked .ptt-glow {
  background: radial-gradient(circle, rgba(46, 224, 160, 0.3), transparent 65%);
}

.ptt-stage.floor-locked .ptt-caption {
  color: var(--rx-bright);
}

.ptt-caption {
  margin: 14px 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--live-mute);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.rec-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 1.6rem;
  margin-bottom: 6px;
  color: #ff9a6e;
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  opacity: 0;
  transform: translateY(6px) scale(0.96);
  pointer-events: none;
  transition:
    opacity 0.28s ease,
    transform 0.28s ease;
}

.rec-strip::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--tx);
  animation: blink 1s ease-in-out infinite;
}

.ptt-stage.is-recording .rec-strip {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.ptt-stage.is-recording .ptt-caption {
  opacity: 0;
  transform: translateY(4px);
}

.rec-timer {
  font-variant-numeric: tabular-nums;
}

/* ——— Incoming call ——— */
.incoming-call {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(72px + var(--safe-top)) 24px calc(48px + var(--safe-bottom));
  background:
    radial-gradient(90% 50% at 50% 30%, rgba(46, 224, 160, 0.16), transparent 70%),
    var(--live-bg);
  color: var(--live-ink);
  text-align: center;
  animation: fadeIn 0.25s ease both;
}

.ic-top h2 {
  margin: 34px 0 6px;
  font-family: var(--display);
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ic-sub {
  margin: 0;
  color: var(--live-mute);
  font-size: 1.02rem;
}

.ic-avatar-wrap {
  position: relative;
  width: 132px;
  height: 132px;
  margin: 0 auto;
}

.ic-avatar {
  position: relative;
  width: 100%;
  height: 100%;
  font-size: 3rem;
  box-shadow: 0 0 0 4px var(--live-bg), 0 0 0 6px var(--rx-bright);
}

.ic-wave {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--rx-bright);
  animation: ripple 2.1s ease-out infinite;
}

.ic-wave.w2 {
  animation-delay: 0.7s;
}

.ic-wave.w3 {
  animation-delay: 1.4s;
}

.ic-actions {
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
}

.ic-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border: none;
  background: none;
  color: var(--live-ink);
  font-weight: 600;
  cursor: pointer;
}

.ic-circle {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  transition: transform 0.12s ease;
}

.ic-btn:active .ic-circle {
  transform: scale(0.92);
}

.ic-btn.decline .ic-circle {
  background: var(--danger);
}

.ic-btn.accept .ic-circle {
  background: var(--rx);
  box-shadow: 0 0 0 0 rgba(46, 224, 160, 0.5);
  animation: acceptPulse 1.6s ease-out infinite;
}

@keyframes acceptPulse {
  to {
    box-shadow: 0 0 0 18px rgba(46, 224, 160, 0);
  }
}

/* ——— Participants ——— */
.participants-list {
  display: grid;
}

#editRoomBtn {
  margin-top: 18px;
}

.live-listen-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  background: var(--surface-2);
}

.live-listen-row strong {
  display: block;
  font-size: 0.98rem;
}

.live-listen-row small {
  display: block;
  margin-top: 4px;
  color: var(--mute);
  font-size: 0.82rem;
  line-height: 1.4;
}

/* iOS-style switch */
.live-listen-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 50px;
  height: 30px;
  border-radius: 999px;
  background: #cfcac0;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.2s ease;
}

.live-listen-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: inset-inline-start 0.2s ease;
}

.live-listen-row input[type="checkbox"]:checked {
  background: var(--rx);
}

.live-listen-row input[type="checkbox"]:checked::after {
  inset-inline-start: 23px;
}

.participant-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
}

.participant-row:last-child {
  border-bottom: none;
}

.participant-avatar {
  width: 46px;
  height: 46px;
}

.participant-meta strong {
  display: block;
  font-size: 1.02rem;
}

.participant-meta span {
  color: var(--mute);
  font-size: 0.86rem;
}

/* ——— Sheets ——— */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(12, 14, 17, 0.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease both;
}

.sheet-panel {
  width: min(520px, 100%);
  max-height: min(88vh, 760px);
  overflow: auto;
  background: var(--bg);
  color: var(--ink);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 8px 20px calc(24px + var(--safe-bottom));
  animation: sheetUp 0.3s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

.sheet-panel.tall {
  max-height: min(92vh, 800px);
}

.sheet-grab {
  width: 40px;
  height: 5px;
  border-radius: 5px;
  background: #d3cec4;
  margin: 4px auto 12px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.sheet-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sheet-head .icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 1rem;
  display: grid;
  place-items: center;
}

#plusSheet .choice-card {
  margin-bottom: 10px;
  padding: 16px 16px 16px 16px;
  padding-inline-start: 70px;
  position: relative;
  min-height: 74px;
  justify-content: center;
}

#plusSheet .choice-card::before {
  content: "";
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  width: 42px;
  height: 42px;
  margin-top: -21px;
  border-radius: 14px;
  background: var(--tx-soft) center / 22px no-repeat;
}

#plusNewChat::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23e8460c' d='M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm0 2c-3.3 0-8 1.7-8 5v1h16v-1c0-3.3-4.7-5-8-5z'/%3E%3C/svg%3E") !important;
}

#plusNewRoom::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23e8460c' d='M9 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm7.5-1a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM9 14c-3.3 0-7 1.6-7 4v2h14v-2c0-2.4-3.7-4-7-4zm7.5-1c-.5 0-1 0-1.6.1 1.3.9 2.1 2.2 2.1 3.9v3h6v-2.5c0-2.3-3.6-4.5-6.5-4.5z'/%3E%3C/svg%3E") !important;
}

#plusJoinCode::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23e8460c' d='M10.6 13.4a1 1 0 0 1 0-1.4l3.5-3.5a3 3 0 1 1 4.2 4.2l-2 2-1.4-1.4 2-2a1 1 0 0 0-1.4-1.4L12 13.4a1 1 0 0 1-1.4 0zm2.8-2.8a1 1 0 0 1 0 1.4l-3.5 3.5a3 3 0 1 1-4.2-4.2l2-2 1.4 1.4-2 2a1 1 0 0 0 1.4 1.4l3.5-3.5a1 1 0 0 1 1.4 0z'/%3E%3C/svg%3E") !important;
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
  align-items: stretch;
}

.sheet-actions .secondary-btn,
.sheet-actions .primary-btn {
  margin: 0;
  width: 100%;
  min-height: 52px;
}

.share-label {
  margin: 0 0 8px;
  font-weight: 600;
}

.share-input {
  direction: ltr;
  font-size: 0.95rem;
  color: var(--ink-2);
}

.me-card {
  text-align: center;
  padding: 0 0 4px;
}

.me-card h2 {
  margin: 0 0 14px;
  font-family: var(--display);
  font-size: 1.4rem;
}

.me-meta {
  display: grid;
  gap: 0;
  text-align: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.me-meta > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
}

.me-meta > div + div {
  border-top: 1px solid var(--line);
}

.me-meta .muted {
  color: var(--mute);
  margin-inline-end: 8px;
}

.me-meta strong {
  font-weight: 600;
}

/* Metrics (dev) */
.avg {
  color: var(--mute);
  font-size: 0.9rem;
}

.table-wrap {
  overflow: auto;
  margin-top: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 4px 6px;
  text-align: start;
}

.log {
  max-height: 120px;
  overflow: auto;
  font-size: 0.7rem;
  background: var(--surface-2);
  padding: 8px;
  border-radius: 8px;
}

/* ——— Motion ——— */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
}

@keyframes sheetUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: none;
  }
}

@keyframes burstIn {
  from {
    opacity: 0.3;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes glowBreath {
  0%,
  100% {
    opacity: 0.25;
    transform: scale(0.95);
  }
  50% {
    opacity: 0.45;
    transform: scale(1.03);
  }
}

@keyframes glowHot {
  0%,
  100% {
    opacity: 0.75;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

@media (min-width: 700px) {
  .home-main,
  .home-top {
    max-width: 640px;
    width: 100%;
    margin-inline: auto;
  }
}

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

/* [hidden] must win over .icon-btn display:grid (share is rooms-only) */
.radio-screen .icon-btn[hidden] {
  display: grid !important;
  visibility: hidden;
  pointer-events: none;
}

/* ——— Last heard: a quiet "memory" of the last message, not a live signal ———
 * Live    = glowing orb, colored name, big white text, green-locked PTT.
 * Memory  = grey orb, small dim card with clock age + play, orange PTT (you're free). */
.speaker-stage.idle.has-last .speaker-name,
.speaker-stage.idle.has-last .burst-text {
  display: none;
}

.speaker-stage:not(.idle) .last-heard {
  display: none;
}

.last-heard {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, 340px);
  margin-top: 10px;
  padding: 10px 14px 12px;
  padding-inline-start: 10px;
  border: 1px solid var(--live-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--live-ink);
  text-align: start;
  cursor: pointer;
  overflow: hidden;
  animation: rise 0.35s ease both;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.last-heard:active {
  background: rgba(255, 255, 255, 0.07);
}

.lh-play {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--live-ink);
}

.lh-play .i-play {
  margin-inline-start: 2px;
}

/* media glyphs never mirror in RTL — play always points right */
[dir="rtl"] .lh-play .i-play {
  margin-inline-start: 0;
  margin-left: 3px;
}

.lh-play .i-bars {
  display: none;
  gap: 3px;
  align-items: center;
  height: 16px;
}

.lh-play .i-bars i {
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: currentColor;
  animation: lhBar 0.8s ease-in-out infinite;
}

.lh-play .i-bars i:nth-child(2) {
  animation-delay: 0.15s;
}
.lh-play .i-bars i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes lhBar {
  0%,
  100% {
    transform: scaleY(0.35);
  }
  50% {
    transform: scaleY(1);
  }
}

.lh-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.lh-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--live-mute);
}

.lh-meta b {
  font-weight: 600;
  color: var(--live-mute);
}

.lh-dot {
  opacity: 0.6;
}

.lh-text {
  font-size: 0.98rem;
  font-weight: 500;
  line-height: 1.35;
  color: rgba(243, 244, 246, 0.78);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-wrap: balance;
}

.lh-progress {
  position: absolute;
  inset-inline-start: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  background: var(--live-ink);
  opacity: 0.5;
}

/* replaying: still neutral white — green stays reserved for *live* */
.last-heard.playing {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
}

.last-heard.playing .lh-play {
  background: var(--live-ink);
  color: var(--live-bg);
}

.last-heard.playing .i-play {
  display: none;
}

.last-heard.playing .i-bars {
  display: flex;
}

.last-heard.playing .lh-text {
  color: var(--live-ink);
}

.last-heard.playing .lh-progress {
  animation: lhProgress var(--dur, 3s) linear forwards;
}

@keyframes lhProgress {
  to {
    width: 100%;
  }
}
