:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #111111);
  --muted: var(--tg-theme-hint-color, #8a8f98);
  --surface: var(--tg-theme-secondary-bg-color, #f1f2f5);
  --accent: var(--tg-theme-button-color, #2481cc);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --danger: #e5484d;
  --ok: #30a46c;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

main { max-width: 420px; margin: 0 auto; padding: 16px; min-height: 100%; }
.view { display: flex; flex-direction: column; gap: 12px; }
.view[hidden] { display: none; }
.center { align-items: center; justify-content: center; text-align: center; min-height: 80vh; }
.muted { color: var(--muted); margin: 0; }
h1 { margin: 0; font-size: 22px; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; }

form { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 280px; }
input[type="password"] {
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--surface);
  background: var(--surface); color: var(--text); font-size: 17px; outline: none;
}
button { font: inherit; border: 0; cursor: pointer; color: inherit; }
button.primary { padding: 12px; border-radius: 12px; background: var(--accent); color: var(--accent-text); font-weight: 600; }
.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

header { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.pill { padding: 3px 10px; border-radius: 999px; background: var(--surface); }
.pill.ready { color: var(--ok); }
.pill.down { color: var(--danger); }

.display { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
#number {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text);
  font-size: 30px; text-align: center; letter-spacing: 1px; outline: none;
}
.icon { background: transparent; font-size: 24px; padding: 8px; color: var(--muted); }
.call-state { text-align: center; min-height: 22px; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 8px 0 16px; }
.keypad button {
  aspect-ratio: 1.35; border-radius: 18px; background: var(--surface);
  font-size: 28px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  user-select: none;
}
.keypad button:active { filter: brightness(.9); }
.keypad small { font-size: 10px; color: var(--muted); letter-spacing: 1px; }

.actions { display: flex; justify-content: center; align-items: center; gap: 28px; }
.round { width: 68px; height: 68px; border-radius: 50%; font-size: 28px; }
.round[hidden] { display: none; }
.call { background: var(--ok); }
.hangup { background: var(--danger); }
.secondary { background: var(--surface); }
.secondary.active { background: var(--danger); }
.call:disabled { opacity: .4; }

.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--surface); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
