:root {
  color-scheme: dark;
  --page: #0b141a;
  --page-deep: #071017;
  --surface: #111b21;
  --surface-2: #1f2c33;
  --surface-3: #202c33;
  --chat: #0b141a;
  --line: rgba(207, 224, 230, .14);
  --line-strong: rgba(207, 224, 230, .24);
  --text: #e9edef;
  --muted: #aebac1;
  --muted-dark: #8696a0;
  --accent: #25d366;
  --accent-strong: #00a884;
  --accent-ink: #062b22;
  --bubble-in: #202c33;
  --bubble-out: #005c4b;
  --notice: #182229;
  --warning-bg: rgba(157, 101, 0, .18);
  --warning-line: rgba(250, 190, 75, .55);
  --danger: #ff9aa5;
  --shadow: 0 22px 64px rgba(0, 0, 0, .36);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page-deep);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 0% 0%, rgba(0, 168, 132, .16), transparent 33rem),
    linear-gradient(145deg, #0c171d 0%, #091217 56%, #071017 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .58;
}

button,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(37, 211, 102, .33);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

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

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 48px;
  padding: 0 2px 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 760;
  letter-spacing: -.02em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #003828;
  border-radius: 11px;
  background: linear-gradient(135deg, #89efd0, #25d366);
  font-size: 17px;
  font-weight: 900;
  box-shadow: 0 6px 18px rgba(37, 211, 102, .18);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(17, 27, 33, .78);
  padding: 7px 11px;
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f6be4b;
  box-shadow: 0 0 0 3px rgba(246, 190, 75, .12);
}

.status-pill.connected .status-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, .12);
}

/* Welcome / create-or-join screen */
.setup-card {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr);
  gap: clamp(28px, 6vw, 72px);
  align-items: center;
  min-height: 620px;
  padding: clamp(26px, 6vw, 70px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(circle at 8% 0%, rgba(37, 211, 102, .12), transparent 20rem),
    rgba(17, 27, 33, .94);
  box-shadow: var(--shadow);
}

.welcome-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  margin-bottom: 23px;
  border: 1px solid rgba(147, 240, 204, .25);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(37, 211, 102, .24), rgba(0, 168, 132, .1));
  font-size: 26px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #80e7bd;
  font-size: 11px;
  font-weight: 780;
  letter-spacing: .09em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 620px;
  margin-bottom: 18px;
  font-size: clamp(40px, 5.1vw, 62px);
  line-height: 1.02;
  letter-spacing: -.052em;
}

h2 {
  margin: 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 730;
  letter-spacing: -.02em;
}

h3 {
  margin: 0;
  font-size: 14px;
}

.lead-copy {
  max-width: 620px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 17px;
}

.creator-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 640px;
  padding: 14px 15px;
  border: 1px solid rgba(37, 211, 102, .26);
  border-radius: 14px;
  background: rgba(0, 168, 132, .10);
}

.note-icon {
  display: grid;
  flex: 0 0 auto;
  width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 50%;
  color: #012d21;
  background: var(--accent);
  font-size: 14px;
  font-weight: 900;
}

.creator-note strong {
  display: block;
  color: #d9fff1;
  font-size: 14px;
}

.creator-note p {
  margin: 3px 0 0;
  color: #b7d8ce;
  font-size: 13px;
}

.permission-gate {
  max-width: 640px;
  margin-top: 18px;
  padding: 13px 15px;
  border: 1px solid var(--warning-line);
  border-radius: 13px;
  background: var(--warning-bg);
  color: #fff0c7;
}

.permission-gate strong {
  display: block;
  font-size: 14px;
}

.permission-gate p {
  margin: 5px 0 0;
  color: #f7dfa8;
  font-size: 13px;
}

.setup-form {
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: #162128;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .19);
}

.form-title-row {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 24px;
}

.form-avatar,
.contact-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: #d9fff1;
  border-radius: 50%;
  background: linear-gradient(145deg, #00a884, #006f5a);
  font-weight: 800;
}

.form-avatar {
  width: 39px;
  height: 39px;
  font-size: 17px;
}

.form-title-row strong,
.form-title-row span {
  display: block;
}

.form-title-row strong {
  color: var(--text);
  font-size: 15px;
}

.form-title-row span {
  margin-top: 1px;
  color: var(--muted-dark);
  font-size: 12px;
}

label {
  display: block;
  margin: 0 0 7px;
  color: #d9e4e7;
  font-size: 13px;
  font-weight: 680;
}

label span {
  color: var(--muted-dark);
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  color: var(--text);
  border: 1px solid rgba(207, 224, 230, .19);
  border-radius: 10px;
  background: #0e171d;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

input,
select {
  min-height: 46px;
  margin-bottom: 17px;
  padding: 0 12px;
}

input::placeholder,
textarea::placeholder {
  color: #73828c;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(37, 211, 102, .75);
  background: #0b151a;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, .10);
  outline: 0;
}

.setup-help {
  min-height: 37px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.primary-button {
  width: 100%;
  min-height: 47px;
  color: #062d23;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #4bdea0, #25d366);
  box-shadow: 0 7px 19px rgba(37, 211, 102, .18);
  font-weight: 780;
  transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}

.primary-button:hover:not(:disabled) {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(37, 211, 102, .24);
}

.form-privacy {
  margin: 14px 2px 0;
  color: var(--muted-dark);
  font-size: 12px;
  text-align: center;
}

/* Private chat room */
.app-card {
  display: flex;
  min-height: min(780px, calc(100vh - 92px));
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.room-toolbar {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 17px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-3);
}

.contact-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.contact-avatar {
  width: 42px;
  height: 42px;
  font-size: 13px;
  letter-spacing: .03em;
}

.contact-copy {
  min-width: 0;
}

.contact-copy h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-copy p {
  overflow: hidden;
  margin: 1px 0 0;
  color: var(--muted-dark);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #dbe5e8;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  font-size: 23px;
  line-height: 1;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}

.icon-button:hover {
  color: #eafff7;
  border-color: rgba(37, 211, 102, .28);
  background: rgba(37, 211, 102, .10);
}

.leave-button {
  color: var(--danger);
  font-size: 28px;
  font-weight: 300;
}

.leave-button:hover {
  color: #ffb7be;
  border-color: rgba(255, 154, 165, .28);
  background: rgba(255, 154, 165, .1);
}

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 17px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: #182229;
  font-size: 12px;
}

.privacy-note strong {
  color: #dce7e9;
}

.privacy-lock {
  color: #77e4b8;
  font-size: 16px;
  line-height: 1;
}

.call-panel {
  padding: 13px 17px 14px;
  border-bottom: 1px solid var(--line);
  background: #10191f;
}

.role-note {
  margin-bottom: 10px;
  padding: 8px 10px;
  color: #bde3d6;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: rgba(0, 168, 132, .1);
  font-size: 12px;
}

.video-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.video-tile {
  position: relative;
  overflow: hidden;
  min-height: 270px;
  border: 1px solid rgba(207, 224, 230, .13);
  border-radius: 13px;
  background: #071017;
}

.video-tile video {
  display: block;
  width: 100%;
  min-height: 270px;
  max-height: 420px;
  object-fit: cover;
  background: #050a0e;
}

.video-label {
  position: absolute;
  z-index: 3;
  top: 10px;
  left: 10px;
  padding: 5px 9px;
  color: #edfff8;
  border: 1px solid rgba(228, 249, 242, .21);
  border-radius: 999px;
  background: rgba(6, 15, 18, .72);
  box-shadow: 0 3px 12px rgba(0,0,0,.18);
  font-size: 12px;
}

.video-placeholder {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  padding: 22px;
  color: var(--muted);
  text-align: center;
  background:
    radial-gradient(circle at 50% 39%, rgba(37, 211, 102, .14), transparent 9rem),
    #0b151a;
  font-size: 13px;
}

.video-placeholder strong {
  margin-top: 5px;
  color: #dce9e5;
  font-size: 14px;
}

.placeholder-avatar {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  color: #c8ffeb;
  border: 1px solid rgba(37, 211, 102, .24);
  border-radius: 50%;
  background: rgba(0, 168, 132, .18);
  font-size: 23px;
}

.guest-media-view {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(37, 211, 102, .22);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 168, 132, .15), rgba(37, 211, 102, .06));
}

.guest-media-icon {
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  place-items: center;
  color: #ddfff2;
  border-radius: 50%;
  background: #007d68;
  font-size: 20px;
}

.guest-media-view strong,
.guest-media-view span {
  display: block;
}

.guest-media-view strong {
  color: #e1fff5;
  font-size: 14px;
}

.guest-media-view span {
  margin-top: 2px;
  color: #b6dccc;
  font-size: 12px;
}

.call-state {
  margin: 10px 3px 0;
  color: var(--muted-dark);
  font-size: 12px;
}

/* Message area */
.chat-panel {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  padding: 11px 17px 14px;
  background:
    radial-gradient(circle at 0 0, rgba(255,255,255,.025) 1px, transparent 1.4px) 0 0/18px 18px,
    radial-gradient(circle at 10px 10px, rgba(37,211,102,.026) 1px, transparent 1.7px) 0 0/25px 25px,
    var(--chat);
}

.chat-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
  padding: 0 2px 10px;
  color: var(--muted-dark);
  font-size: 12px;
}

.encryption-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #bbdfd2;
  font-size: 11px;
}

.messages {
  display: flex;
  min-height: 260px;
  max-height: 470px;
  flex: 1 1 auto;
  overflow-y: auto;
  flex-direction: column;
  gap: 7px;
  padding: 8px 4px 14px;
  scroll-behavior: smooth;
  scrollbar-color: rgba(134, 150, 160, .4) transparent;
  scrollbar-width: thin;
}

.empty-state {
  display: flex;
  min-height: 100%;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 30px;
  color: var(--muted-dark);
  text-align: center;
}

.empty-state strong {
  margin-top: 4px;
  color: #d3dfe1;
  font-size: 14px;
}

.empty-state span {
  max-width: 320px;
  font-size: 13px;
}

.empty-state-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  color: #a7f5d1;
  border-radius: 50%;
  background: rgba(37, 211, 102, .12);
  font-size: 23px;
}

.message {
  align-self: flex-start;
  max-width: min(78%, 640px);
  padding: 7px 9px 5px;
  color: var(--text);
  border: 1px solid rgba(207, 224, 230, .07);
  border-radius: 8px 8px 8px 2px;
  background: var(--bubble-in);
  box-shadow: 0 1px 1px rgba(0,0,0,.18);
}

.message.mine {
  align-self: flex-end;
  border-color: rgba(37, 211, 102, .10);
  border-radius: 8px 8px 2px 8px;
  background: var(--bubble-out);
}

.message-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.38;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 3px;
  color: #a9bcb9;
  font-size: 10px;
  line-height: 1;
}

.message:not(.mine) .message-meta {
  color: #8ea0a7;
}

.message-meta span {
  overflow: hidden;
  max-width: 112px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-translation {
  margin-top: 6px;
  padding-top: 5px;
  color: #b1c6c4;
  border-top: 1px solid rgba(207, 224, 230, .13);
  font-size: 11px;
}

.original-button {
  display: inline-block;
  margin: 6px 0 0;
  padding: 0;
  color: #9ceac8;
  border: 0;
  background: transparent;
  font-size: 11px;
  font-weight: 680;
}

.original-button:hover {
  color: #c6ffe4;
  text-decoration: underline;
}

.original-copy {
  margin-top: 5px;
  padding-top: 5px;
  color: #d1e3e2;
  border-top: 1px solid rgba(207, 224, 230, .13);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.message-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding-top: 10px;
}

.message-form textarea {
  min-height: 46px;
  max-height: 136px;
  padding: 12px 15px;
  resize: none;
  border-radius: 23px;
  background: var(--surface-2);
  line-height: 1.35;
}

.send-button {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0 0 1px 2px;
  color: #042b20;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 4px 13px rgba(37, 211, 102, .18);
  font-size: 21px;
  transition: transform .15s ease, filter .15s ease;
}

.send-button:hover {
  filter: brightness(1.05);
  transform: scale(1.04);
}

.chat-footnote {
  margin: 9px 2px 0;
  color: #7f9299;
  font-size: 10px;
  text-align: center;
}

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 22px;
  max-width: min(520px, calc(100% - 32px));
  padding: 11px 14px;
  color: #eafff6;
  border: 1px solid rgba(37, 211, 102, .29);
  border-radius: 11px;
  background: #173c32;
  box-shadow: 0 18px 46px rgba(0, 0, 0, .38);
  transform: translateX(-50%);
  font-size: 13px;
}

@media (max-width: 780px) {
  .shell {
    width: min(100% - 16px, 1120px);
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .topbar {
    min-height: 44px;
    padding-bottom: 10px;
  }

  .setup-card {
    grid-template-columns: 1fr;
    min-height: auto;
    gap: 26px;
    padding: 27px 20px;
    border-radius: 17px;
  }

  .welcome-mark {
    margin-bottom: 17px;
  }

  h1 {
    font-size: clamp(35px, 11vw, 49px);
  }

  .lead-copy {
    font-size: 15px;
  }

  .app-card {
    min-height: calc(100vh - 62px);
    border-radius: 14px;
  }

  .room-toolbar {
    min-height: 67px;
    padding: 10px 12px;
  }

  .privacy-note,
  .call-panel,
  .chat-panel {
    padding-right: 12px;
    padding-left: 12px;
  }

  .video-tile,
  .video-tile video {
    min-height: 205px;
  }

  .messages {
    min-height: 250px;
    max-height: none;
  }

  .message {
    max-width: 88%;
  }

  .chat-footnote {
    display: none;
  }
}

@media (max-width: 390px) {
  .status-pill {
    padding: 6px 8px;
    font-size: 11px;
  }

  .brand {
    font-size: 14px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .creator-note {
    padding: 12px;
  }

  .setup-form {
    padding: 19px 16px;
  }

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

  .message {
    max-width: 92%;
  }
}


/* Only appears when a browser blocks automatic playback of incoming sound. */
.audio-unlock {
  position: absolute;
  z-index: 4;
  right: 10px;
  bottom: 10px;
  padding: 9px 12px;
  color: #06251c;
  border: 0;
  border-radius: 999px;
  background: #76e8c6;
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
  font: inherit;
  font-size: 12px;
  font-weight: 760;
  cursor: pointer;
}
