:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f0f1f3;
  background: #101114;
  font-synthesis: none;
  --muted: #a1a5af;
  /* Telegram chrome and the device notch can both take space. */
  --safe-top: max(env(safe-area-inset-top), calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)));
  --safe-right: max(env(safe-area-inset-right), calc(var(--tg-safe-area-inset-right, 0px) + var(--tg-content-safe-area-inset-right, 0px)));
  --safe-bottom: max(env(safe-area-inset-bottom), calc(var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px)));
  --safe-left: max(env(safe-area-inset-left), calc(var(--tg-safe-area-inset-left, 0px) + var(--tg-content-safe-area-inset-left, 0px)));
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: var(--tg-viewport-stable-height, 100svh);
  padding: max(32px, var(--safe-top)) max(16px, var(--safe-right)) max(24px, var(--safe-bottom)) max(16px, var(--safe-left));
  display: grid;
  place-items: center;
}
button, input { font: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .45; }
:focus-visible { outline: 2px solid #9fb0ff; outline-offset: 4px; }
.call-shell { width: 100%; max-width: 440px; background: #191b20; border: 1px solid #2b2e36; border-radius: 20px; overflow: hidden; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 24px; }
h1 { font-size: 19px; font-weight: 600; letter-spacing: -.4px; margin: 0; }
.text-button { padding: 8px 0 8px 8px; border: 0; color: var(--muted); background: transparent; font-size: 13px; }
.call-stage { display: flex; flex-direction: column; align-items: center; padding: 12px 24px 28px; }
.connection { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #777d8b; }
.voice-icon { display: grid; place-items: center; width: 96px; height: 96px; margin: 28px 0 24px; border: 1px solid #373d52; border-radius: 50%; background: #252a3b; color: #a5b4fc; }
.voice-icon svg { width: 34px; height: 34px; }
#duration { font-size: 40px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
#mic-state { margin-top: 8px; font-size: 13px; color: var(--muted); }
.call-panel { padding: 0 24px 24px; }
#status { min-height: 20px; margin: 0 0 18px; color: var(--muted); text-align: center; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
label { display: block; margin-bottom: 8px; font-size: 13px; }
input { width: 100%; min-height: 48px; padding: 12px; border: 1px solid #424754; border-radius: 10px; color: inherit; background: #101114; font-size: 16px; }
#key-field { margin-bottom: 14px; }
.primary-button, .secondary-button, .end-button { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; min-height: 50px; padding: 12px; border: 1px solid transparent; border-radius: 10px; font-size: 14px; font-weight: 600; }
.primary-button { background: #a5b4fc; color: #14182c; }
.secondary-button { background: #272b34; border-color: #3c424f; color: #edf0f7; }
.end-button { background: #b93e4b; color: #fff; }
.call-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
button svg { width: 20px; height: 20px; flex-shrink: 0; }
#mute[aria-pressed="true"] { color: #f8d08b; border-color: #8a6b3d; }
.mute-slash { display: none; }
#mute[aria-pressed="true"] .mute-slash { display: block; }
#resume { margin-bottom: 14px; }
.call-note { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: 12px; }
body[data-state="connected"] .status-dot { background: #79d4a0; }
body[data-state="connecting"] .status-dot, body[data-state="reconnecting"] .status-dot { background: #efc47b; }
body[data-state="ending"] .status-dot { background: #f18c98; }
@media (hover: hover) {
  button:hover:not(:disabled) { filter: brightness(1.12); }
  .text-button:hover { color: #f0f1f3; }
}
@media (max-width: 380px) {
  .page-header { padding: 20px; }
  .call-panel { padding: 0 20px 20px; }
}
