:root {
  color-scheme: dark;
  --bg: #0b1020;
  --bg-soft: #141b33;
  --card: #171f3a;
  --line: #2a3457;
  --text: #e8ecf7;
  --muted: #9aa6c7;
  --accent: #5b8cff;
  --accent-strong: #3f6fe6;
  --ok: #43d19e;
  --warn: #f5c451;
  --error: #ff6b7a;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family:
    system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1a2650, transparent),
    radial-gradient(1000px 500px at -10% 0%, #241a44, transparent), var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.shell {
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 40px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.masthead .brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  font-size: 34px;
  filter: drop-shadow(0 2px 6px rgba(91, 140, 255, 0.5));
}

h1 {
  margin: 0;
  font-size: clamp(24px, 5vw, 34px);
  letter-spacing: -0.02em;
}

.tagline {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.card {
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(18px, 4vw, 28px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.card h2 {
  margin: 0 0 6px;
  font-size: 19px;
}

.card h2 + .muted {
  margin-top: 0;
}

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

.hint {
  color: var(--muted);
  font-size: 13px;
  margin: 8px 0 0;
}

.hidden {
  display: none !important;
}

/* Media options */
.media-opts {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 18px 0;
}

.media-opts legend {
  padding: 0 8px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.media-opts label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 20px;
  font-size: 15px;
}

.media-opts input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* Buttons */
button {
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 11px 18px;
  transition: transform 0.05s ease, background 0.15s ease, opacity 0.15s ease;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.primary {
  background: var(--accent);
  color: #05122f;
  font-weight: 650;
}

.primary:hover:not(:disabled) {
  background: var(--accent-strong);
  color: #fff;
}

.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.ghost:hover:not(:disabled) {
  border-color: var(--accent);
}

.ghost.off {
  color: var(--warn);
  border-color: var(--warn);
}

.ghost.active {
  color: #cfe0ff;
  border-color: var(--accent);
  background: rgba(91, 140, 255, 0.14);
}

.danger {
  background: transparent;
  color: var(--error);
  border-color: var(--error);
}

.danger:hover:not(:disabled) {
  background: rgba(255, 107, 122, 0.14);
}

/* Inputs */
input[type="text"],
textarea {
  width: 100%;
  background: #0e1428;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
}

textarea {
  resize: vertical;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.copy-row {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.copy-row input {
  flex: 1;
}

#answer-input,
#answer-connect {
  margin-bottom: 10px;
}

#copy-reply {
  margin-top: 12px;
}

/* Status text */
.status {
  min-height: 20px;
  font-size: 14px;
  margin: 12px 0 0;
}

.status[data-kind="ok"] {
  color: var(--ok);
}

.status[data-kind="warn"] {
  color: var(--warn);
}

.status[data-kind="error"] {
  color: var(--error);
}

/* Call screen */
.videos {
  position: relative;
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.video-wrap {
  position: relative;
  background: #05070f;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.video-wrap.remote {
  aspect-ratio: 16 / 9;
}

.video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-wrap.local {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 28%;
  max-width: 180px;
  aspect-ratio: 4 / 3;
  z-index: 2;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.video-wrap.local video {
  transform: scaleX(-1);
}

.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 12px;
}

/* Live captions overlaid on the video */
.caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  margin: 0;
  padding: 10px 14px;
  color: #fff;
  font-size: 15px;
  line-height: 1.35;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.75), transparent);
  pointer-events: none;
}

.video-wrap.local .caption {
  padding: 4px 6px;
  font-size: 11px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

/* Chat + files */
.talk {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 18px;
}

@media (min-width: 720px) {
  .talk {
    grid-template-columns: 1.3fr 1fr;
  }
}

.chat {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  min-height: 260px;
}

.chat-log {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
}

.chat-line {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  padding: 8px 11px;
  border-radius: 12px;
  background: #0e1428;
  border: 1px solid var(--line);
}

.chat-line.me {
  align-self: flex-end;
  background: rgba(91, 140, 255, 0.16);
  border-color: rgba(91, 140, 255, 0.4);
}

.chat-who {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.chat-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-compose {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: #0c1226;
}

.chat-compose input {
  flex: 1;
}

.files {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

.file-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  cursor: pointer;
  color: var(--muted);
}

.file-picker:hover {
  border-color: var(--accent);
  color: var(--text);
}

.file-picker input {
  display: none;
}

.file-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-row {
  background: #0e1428;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.file-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.file-arrow {
  color: var(--accent);
  font-weight: 700;
}

.file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  color: var(--muted);
  font-size: 12px;
}

.file-row progress {
  width: 100%;
  height: 6px;
  margin: 8px 0 4px;
  accent-color: var(--accent);
}

.file-note {
  font-size: 12px;
  color: var(--muted);
  min-height: 16px;
}

.file-download {
  color: var(--accent);
  font-weight: 600;
}

/* QR codes */
.qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 6px 0 20px;
}

.qr canvas {
  width: min(340px, 86vw);
  height: auto;
  image-rendering: pixelated;
  border-radius: 10px;
  border: 6px solid #fff;
  background: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.qr-caption {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

/* Camera scanner overlay */
.scanner {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(4, 7, 15, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.scanner-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 420px;
  width: 100%;
}

.scanner-inner video {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #05070f;
}

/* Caption translation + text-to-speech controls */
.caption-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
}

.caption-settings select {
  background: #0e1428;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
}

.caption-settings .hint {
  margin: 0;
  flex-basis: 100%;
}

/* Extras: location sharing */
.extras {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

.extras-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.extras-log {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.extras-log:empty {
  display: none;
}

.extra-card {
  background: #0e1428;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}

.extra-card.me {
  border-color: rgba(91, 140, 255, 0.4);
  background: rgba(91, 140, 255, 0.1);
}

.extra-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.extra-who {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.extra-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(67, 209, 158, 0.16);
  color: var(--ok);
}

.extra-badge.live {
  background: rgba(245, 196, 81, 0.18);
  color: var(--warn);
}

.extra-body {
  color: var(--text);
}

.extra-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.extra-link {
  color: var(--accent);
  font-weight: 600;
}

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

.extra-status {
  font-size: 12px;
  color: var(--muted);
}

.extra-status.ok {
  color: var(--ok);
}

.extra-status.warn {
  color: var(--warn);
}

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

.footnote {
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.footnote strong {
  color: var(--text);
}
