:root {
  --bg: #0e1116;
  --panel: #171c24;
  --text: #e8ecf1;
  --muted: #8b95a5;
  --accent: #3b82f6;
  --danger: #ef4444;
  --ok: #22c55e;
  --radius: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans Tamil", "Latha", sans-serif;
  line-height: 1.5;
  overscroll-behavior: none;
}
#app { height: 100dvh; position: relative; overflow: hidden; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }

.center {
  margin: auto;
  width: 100%;
  max-width: 420px;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  text-align: center;
}
.logo { font-size: 56px; margin-bottom: 8px; }
h1 { font-size: 28px; margin: 0 0 8px; }
h2 { font-size: 22px; margin: 16px 0 8px; }
.sub { color: var(--muted); margin: 0 0 24px; font-size: 15px; }

.actions { display: flex; flex-direction: column; gap: 12px; }
.actions.row { flex-direction: row; }
.actions.row button { flex: 1; }

button {
  font: inherit;
  font-size: 17px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid #263041;
  border-radius: var(--radius);
  padding: 16px 20px;
  cursor: pointer;
  min-height: 52px;
}
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); margin-top: 12px; }
button.small { min-height: 36px; padding: 6px 16px; font-size: 14px; margin-top: 8px; }

input#link {
  width: 100%;
  background: var(--panel);
  border: 1px solid #263041;
  border-radius: var(--radius);
  color: var(--text);
  padding: 14px;
  font-size: 14px;
  margin-bottom: 12px;
  text-overflow: ellipsis;
}
.error { color: #fca5a5; background: #3b1414; border-radius: 12px; padding: 12px; margin-top: 16px; font-size: 15px; }

.pulse {
  width: 64px; height: 64px; margin: 0 auto;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(59,130,246,.6); }
  100% { box-shadow: 0 0 0 32px rgba(59,130,246,0); }
}

/* call screen */
#screen-call { background: #000; }
#remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
#remote.audio-only { visibility: hidden; }
.voice-view { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 40%, #1b2430, #0a0d12); }
.voice-view.hidden { display: none; }
.avatar { font-size: 96px; opacity: .85; }
#local {
  position: absolute; right: 12px; top: calc(56px + env(safe-area-inset-top));
  width: 96px; height: 128px; object-fit: cover; border-radius: 12px;
  border: 2px solid rgba(255,255,255,.25); background: #111; transform: scaleX(-1);
}
.topbar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(12px + env(safe-area-inset-top)) 12px 12px;
  background: linear-gradient(#000a, transparent);
}
.badge { background: rgba(0,0,0,.55); padding: 6px 12px; border-radius: 999px; font-size: 14px; }
.badge.ok { color: var(--ok); }

.safety {
  position: absolute; left: 12px; right: 12px; top: calc(64px + env(safe-area-inset-top));
  margin-right: 120px;
  background: rgba(23,28,36,.94); border: 1px solid #263041; border-radius: var(--radius);
  padding: 12px 14px; text-align: center;
}
.safety-label { color: var(--muted); font-size: 12px; }
.safety-code { font-size: 28px; letter-spacing: 3px; font-variant-numeric: tabular-nums; font-weight: 700; }
.safety-hint { color: var(--muted); font-size: 12px; }

.controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center; gap: 20px;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, #000b);
}
button.round {
  width: 64px; height: 64px; min-height: 0; padding: 0; border-radius: 50%;
  font-size: 26px; background: rgba(255,255,255,.14); border: none;
}
button.round.off { background: #fff; }
button.round.danger { background: var(--danger); }
