/* Maple dialer, call screens and the live business phone.
   Shared visual language: midnight glass, violet light, green to call,
   red to end. Every loop honours prefers-reduced-motion (end of file). */

:root {
  --call-green: #1fbf6a;
  --call-green-2: #16a35a;
  --call-red: #ff3b4c;
  --call-red-2: #e5243a;
  --glass: #ffffff14;
  --glass-2: #ffffff22;
  --glass-line: #ffffff1f;
  --night: #0f1330;
  --night-2: #1a1f4a;
}

/* ---------- Shared keypad (dialpad.js) ---------- */
.dialpad-display {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 6px 4px 14px;
}
.dialpad-input,
input.dialpad-input {
  width: 100%;
  min-height: 52px;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
  color: inherit;
  padding: 4px 8px;
  caret-color: #8b7bff;
}
.dialpad-input:focus,
input.dialpad-input:focus {
  box-shadow: none;
  border: 0;
}
.dialpad-input::placeholder {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0;
}
.dialpad-match {
  min-height: 18px;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: #a9b0ff;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 220ms ease, transform 320ms var(--ease-spring, ease);
}
.dialpad-match.visible {
  opacity: 1;
  transform: none;
}
.dialpad-keys {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  justify-content: center;
  gap: 14px 22px;
  margin: 4px 0 18px;
}
.dialpad-key {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  width: 72px;
  height: 72px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--glass-line);
  background: radial-gradient(120% 120% at 30% 20%, #ffffff1f, #ffffff08 60%);
  color: #fff;
  cursor: pointer;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow:
    inset 0 1px 0 #ffffff1a,
    0 6px 16px #05081d40;
  transition:
    transform 160ms var(--ease-spring, ease),
    background-color 200ms ease,
    box-shadow 240ms ease,
    border-color 200ms ease;
}
.dialpad-key:hover {
  border-color: #ffffff38;
  box-shadow:
    inset 0 1px 0 #ffffff26,
    0 0 0 4px #8b7bff14,
    0 8px 22px #05081d55;
}
.dialpad-key:active,
.dialpad-key.pressed {
  transform: scale(0.9);
  background: radial-gradient(120% 120% at 50% 50%, #8b7bff66, #5843ce33 70%);
  border-color: #b3a8ff80;
  box-shadow:
    0 0 0 6px #8b7bff22,
    0 0 26px #8b7bff66;
  transition-duration: 60ms;
}
.dialpad-key.long {
  background: radial-gradient(circle, #1fbf6a66, #1fbf6a22 70%);
}
.dialpad-digit {
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.5px;
}
.dialpad-letters {
  margin-top: 3px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #ffffff8c;
  line-height: 1;
}
.dialpad-key .ripple {
  background: #c9c0ff;
}
.dialer-actions {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  justify-content: center;
  gap: 22px;
  align-items: center;
}
.call-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(160deg, #34d77f, var(--call-green-2));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 26px #1fbf6a55;
  transition: transform 200ms var(--ease-spring, ease), box-shadow 240ms ease, filter 200ms;
}
.call-button > .icon {
  width: 30px;
  height: 30px;
  transition: transform 300ms var(--ease-spring, ease);
}
.call-button::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid #34d77f;
  opacity: 0;
}
.has-number .call-button::after {
  animation: call-ready 2s ease-out infinite;
}
.call-button:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 14px 34px #1fbf6a77;
}
.call-button:hover > .icon {
  transform: rotate(-12deg);
}
.call-button:active {
  transform: scale(0.92);
}
.dialpad-backspace {
  justify-self: center;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #ffffffb3;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
  transition: opacity 200ms ease, transform 280ms var(--ease-spring, ease), background-color 200ms, color 200ms;
}
.dialpad-backspace > .icon {
  width: 26px;
  height: 26px;
}
.has-number .dialpad-backspace {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.dialpad-backspace:hover {
  background: var(--glass);
  color: #fff;
}
.dialpad-backspace:active {
  transform: scale(0.88);
}
@keyframes call-ready {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.55); opacity: 0; }
}

/* ---------- Keypad dialog ---------- */
dialog.dialer-modal {
  width: 380px;
  max-width: calc(100vw - 24px);
  border: 1px solid #ffffff1a;
  border-radius: 28px;
  color: #fff;
  background:
    radial-gradient(90% 60% at 50% 0%, #3a2d8c 0%, transparent 70%),
    radial-gradient(70% 50% at 100% 100%, #5b1f4a66 0%, transparent 70%),
    linear-gradient(180deg, var(--night-2), var(--night));
  box-shadow: 0 30px 90px #05061acc, inset 0 1px 0 #ffffff14;
}
.dialer-modal .modal-header {
  border: 0;
  padding: 22px 22px 0;
}
.dialer-modal .modal-header h2 {
  color: #fff;
  font-size: 17px;
}
.dialer-modal .modal-header p {
  color: #a7abd3;
  font-size: 12px;
}
.dialer-modal .close {
  color: #c9cbe6;
  background: var(--glass);
  border-radius: 50%;
}
.dialer-modal .close:hover {
  background: var(--glass-2);
}
.dialer-modal .modal-body {
  padding: 8px 22px 26px;
}
.dialer-modal .dialpad-input::placeholder {
  color: #ffffff4d;
}
.dialer-modal .dialpad-key {
  animation: key-in 420ms var(--ease-spring, ease) both;
}
.dialer-modal .dialpad-key:nth-child(1) { animation-delay: 20ms; }
.dialer-modal .dialpad-key:nth-child(2) { animation-delay: 45ms; }
.dialer-modal .dialpad-key:nth-child(3) { animation-delay: 70ms; }
.dialer-modal .dialpad-key:nth-child(4) { animation-delay: 95ms; }
.dialer-modal .dialpad-key:nth-child(5) { animation-delay: 120ms; }
.dialer-modal .dialpad-key:nth-child(6) { animation-delay: 145ms; }
.dialer-modal .dialpad-key:nth-child(7) { animation-delay: 170ms; }
.dialer-modal .dialpad-key:nth-child(8) { animation-delay: 195ms; }
.dialer-modal .dialpad-key:nth-child(9) { animation-delay: 220ms; }
.dialer-modal .dialpad-key:nth-child(10) { animation-delay: 245ms; }
.dialer-modal .dialpad-key:nth-child(11) { animation-delay: 270ms; }
.dialer-modal .dialpad-key:nth-child(12) { animation-delay: 295ms; }
.dialer-modal .call-button {
  animation: key-in 520ms var(--ease-spring, ease) 320ms both;
}
@keyframes key-in {
  from { opacity: 0; transform: translateY(10px) scale(0.85); }
  to { opacity: 1; transform: none; }
}

/* ---------- Call screen (preview call) ---------- */
dialog.call-preview {
  background:
    radial-gradient(80% 50% at 50% 18%, #4a35b866 0%, transparent 70%),
    #181331 url("/assets/call-background.png") center/cover no-repeat;
}
dialog.call-preview.ending {
  animation: call-end 420ms cubic-bezier(0.4, 0, 1, 1) forwards;
}
dialog.call-preview.ending::backdrop {
  animation: fade-in 420ms ease reverse forwards;
}
@keyframes call-end {
  to { opacity: 0; transform: scale(0.92) translateY(20px); filter: blur(3px); }
}
.call-avatar-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin: 0 auto 18px;
}
.call-avatar-wrap .call-large-avatar {
  position: relative;
  z-index: 1;
  margin: 0;
  width: 92px;
  height: 92px;
  background: linear-gradient(150deg, #a283e6, #6b49c8);
  border: 2px solid #ffffff2e;
  box-shadow: 0 10px 34px #2a0f6a88;
  animation: avatar-in 600ms var(--ease-spring, ease) both;
}
.call-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid #b8a2ff;
  opacity: 0;
}
.calling .call-ring {
  animation: call-ring 1.8s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
}
.calling .call-ring:nth-child(2) { animation-delay: 0.6s; }
.calling .call-ring:nth-child(3) { animation-delay: 1.2s; }
.connected .call-large-avatar {
  animation: avatar-in 600ms var(--ease-spring, ease) both, avatar-breathe 3.2s ease-in-out 600ms infinite;
}
@keyframes call-ring {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(2.1); opacity: 0; }
}
@keyframes avatar-in {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes avatar-breathe {
  0%, 100% { box-shadow: 0 10px 34px #2a0f6a88, 0 0 0 0 #a283e655; }
  50% { box-shadow: 0 10px 34px #2a0f6a88, 0 0 0 12px #a283e600; }
}
.call-identity h2 {
  animation: rise-in 520ms var(--ease-out, ease) 120ms both;
}
.call-identity > p:not(.call-state):not(.call-connecting) {
  animation: rise-in 520ms var(--ease-out, ease) 180ms both;
}
.call-connecting {
  display: none;
  margin: 18px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: #d9ccff;
  letter-spacing: 0.4px;
}
.call-connecting span {
  animation: dot-blink 1.2s infinite;
}
.call-connecting span:nth-child(2) { animation-delay: 0.2s; }
.call-connecting span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-blink {
  0%, 20% { opacity: 0.2; }
  50% { opacity: 1; }
  100% { opacity: 0.2; }
}
.calling .call-connecting {
  display: block;
}
.calling #call-clock,
.calling .call-wave {
  display: none;
}
.connected #call-clock {
  animation: fade-in 400ms ease both;
}
/* Live voice waveform */
.call-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 28px;
  margin: 10px auto 0;
}
.call-wave i {
  width: 3px;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(180deg, #7cf0b0, #2fd27f);
  transform: scaleY(0.2);
  animation: wave 1.1s ease-in-out infinite;
}
.call-wave i:nth-child(3n) { animation-duration: 0.9s; }
.call-wave i:nth-child(3n + 1) { animation-duration: 1.3s; }
.call-wave i:nth-child(4n) { animation-delay: -0.4s; }
.call-wave i:nth-child(5n) { animation-delay: -0.7s; }
.call-wave i:nth-child(2n) { animation-delay: -0.2s; }
.connected .call-wave {
  animation: fade-in 500ms ease both;
}
.is-muted .call-wave i,
.is-held .call-wave i {
  animation: none;
  transform: scaleY(0.14);
  background: #ffffff55;
  transition: transform 300ms ease;
}
@keyframes wave {
  0%, 100% { transform: scaleY(0.2); }
  50% { transform: scaleY(1); }
}
.is-recording .call-preview-label {
  border-color: #ff3b4c66;
  color: #ffc2c8;
}
.is-recording .call-preview-label::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--call-red);
  vertical-align: 1px;
  animation: rec-blink 1.2s ease-in-out infinite;
}
@keyframes rec-blink {
  50% { opacity: 0.25; }
}
.call-identity > strong,
#call-clock {
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}
.call-identity .call-state {
  font-size: 11px;
}
/* Controls */
.call-controls button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.call-controls button > span {
  width: 60px;
  height: 60px;
  background: radial-gradient(120% 120% at 30% 20%, #ffffff26, #ffffff0d 65%);
  border: 1px solid #ffffff1f;
  backdrop-filter: blur(10px);
  transition: transform 180ms var(--ease-spring, ease), background-color 220ms ease, color 220ms ease, box-shadow 240ms ease;
}
.call-controls button:hover > span {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px #0b052a66, 0 0 0 4px #ffffff0d;
}
.call-controls button:active > span {
  transform: scale(0.88);
  transition-duration: 60ms;
}
.call-controls button.is-on > span {
  background: #fff;
  color: #2b1663;
  animation: control-on 360ms var(--ease-spring, ease);
}
.call-controls button[data-call-control="record"].is-on > span {
  background: var(--call-red);
  color: #fff;
  box-shadow: 0 0 0 0 #ff3b4c88;
  animation: control-on 360ms var(--ease-spring, ease), rec-glow 1.6s ease-in-out infinite;
}
@keyframes control-on {
  0% { transform: scale(0.8); }
  60% { transform: scale(1.08); }
  100% { transform: none; }
}
@keyframes rec-glow {
  50% { box-shadow: 0 0 0 8px #ff3b4c00; }
}
.call-controls small {
  font-size: 11px;
  font-weight: 500;
}
.call-controls button {
  animation: key-in 460ms var(--ease-spring, ease) both;
}
.call-controls button:nth-child(1) { animation-delay: 160ms; }
.call-controls button:nth-child(2) { animation-delay: 195ms; }
.call-controls button:nth-child(3) { animation-delay: 230ms; }
.call-controls button:nth-child(4) { animation-delay: 265ms; }
.call-controls button:nth-child(5) { animation-delay: 300ms; }
.call-controls button:nth-child(6) { animation-delay: 335ms; }
.call-controls button:nth-child(7) { animation-delay: 370ms; }
.call-controls button:nth-child(8) { animation-delay: 405ms; }
.call-controls button:nth-child(9) { animation-delay: 440ms; }
/* Controls redraw on every toggle; only animate them on the first draw */
.connected .call-controls button,
.call-preview:not(.calling) .call-controls button {
  animation: none;
}
.call-control-message {
  font-size: 12px;
  color: #d4c3f2;
}
.end-call {
  width: 68px;
  height: 68px;
  border: 0;
  cursor: pointer;
  background: linear-gradient(160deg, #ff5a68, var(--call-red-2));
  box-shadow: 0 10px 28px #ff3b4c55;
  transition: transform 220ms var(--ease-spring, ease), box-shadow 240ms ease;
  animation: key-in 520ms var(--ease-spring, ease) 420ms both;
}
.connected .end-call,
.call-preview:not(.calling) .end-call {
  animation: none;
}
.end-call > .icon {
  transition: transform 320ms var(--ease-spring, ease);
}
.end-call:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 14px 34px #ff3b4c77;
}
.end-call:hover > .icon {
  transform: rotate(-135deg);
}
.end-call:active {
  transform: scale(0.9);
}
/* In-call keypad */
.call-keypad {
  gap: 12px 18px;
  max-width: 260px;
  justify-items: center;
}
.call-keypad input {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 2px;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.call-keypad button[data-dtmf] {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  font-size: 24px;
  border: 1px solid #ffffff1f;
  background: radial-gradient(120% 120% at 30% 20%, #ffffff26, #ffffff0d 65%);
  cursor: pointer;
  transition: transform 160ms var(--ease-spring, ease), background-color 200ms, box-shadow 200ms;
  animation: key-in 360ms var(--ease-spring, ease) both;
}
.call-keypad button[data-dtmf]:active {
  transform: scale(0.88);
  background: #8b7bff55;
  box-shadow: 0 0 22px #8b7bff66;
}
.call-keypad .hide-keypad {
  border: 0;
  background: none;
  color: #d4c3f2;
  cursor: pointer;
}

/* ---------- Live business phone (phone.js markup) ---------- */
.phone-pill {
  background: linear-gradient(160deg, #1d2450, #11172c);
  border: 1px solid #ffffff1a;
  transition: transform 220ms var(--ease-spring, ease), box-shadow 260ms ease;
}
.phone-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px #11172c66;
}
.phone-pill:active {
  transform: scale(0.96);
}
.phone-pill-dot.ready {
  background: #2fd27f;
  box-shadow: 0 0 0 0 #2fd27f88;
  animation: ready-dot 2.4s ease-out infinite;
}
@keyframes ready-dot {
  0% { box-shadow: 0 0 0 0 #2fd27f88; }
  70%, 100% { box-shadow: 0 0 0 9px #2fd27f00; }
}
#real-phone:not([hidden]):not(.collapsed) {
  border-radius: 24px;
  box-shadow: 0 30px 80px #0b0f2a66;
  animation: phone-open 420ms var(--ease-spring, ease) both;
}
@keyframes phone-open {
  from { opacity: 0; transform: translateY(16px) scale(0.96); transform-origin: 100% 100%; }
  to { opacity: 1; transform: none; transform-origin: 100% 100%; }
}
.real-phone-panel {
  color: #fff;
  border: 1px solid #ffffff1a;
  border-radius: 24px;
  padding: 18px 18px 16px;
  background:
    radial-gradient(90% 50% at 50% 0%, #3a2d8c 0%, transparent 70%),
    linear-gradient(180deg, var(--night-2), var(--night));
}
.real-phone-panel .panel-header {
  border: 0;
  min-height: 0;
}
.real-phone-panel .panel-header h2 {
  color: #fff;
  font-size: 15px;
}
.real-phone-panel .badge {
  background: #ffffff14;
  border: 1px solid #ffffff1f;
  color: #d8dbf3;
}
.real-phone-panel .badge:not(.gray) {
  color: #8ff0bb;
  border-color: #2fd27f55;
  background: #2fd27f1a;
}
.real-phone-panel .badge:not(.gray)::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: #2fd27f;
  vertical-align: 1px;
  animation: ready-dot 2.4s ease-out infinite;
}
.phone-minimize {
  background: #ffffff14;
  color: #fff;
  transition: background-color 200ms, transform 200ms var(--ease-spring, ease);
}
.phone-minimize:hover {
  background: #ffffff26;
  transform: scale(1.08);
}
.real-phone-panel label.field > span,
.real-phone-panel .field-help {
  color: #a7abd3;
}
.real-phone-panel select,
.real-phone-panel input {
  background-color: #ffffff0f;
  border-color: #ffffff24;
  color: #fff;
}
.real-phone-panel select option {
  color: #14172b;
}
.real-phone-panel .button.secondary {
  background: #ffffff14;
  border-color: #ffffff26;
  color: #fff;
}
.real-phone-panel .button.secondary:hover {
  background: #ffffff24;
}
/* During a call the line details step aside so the call has the stage */
.phone-device.is-live .phone-line,
.phone-device.is-incoming .phone-line,
.phone-device.is-calling .phone-line,
.phone-device.is-ended .phone-line {
  display: none;
}
.phone-line {
  display: grid;
  gap: 8px;
  padding: 12px;
  margin: 2px 0 14px;
  border-radius: 16px;
  background: #ffffff0a;
  border: 1px solid #ffffff12;
}
.phone-line label.field {
  margin: 0;
}
.phone-line .field-help {
  margin: 0;
  font-size: 11px;
}
.real-phone-panel .phone-connection {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
}
.real-phone-panel .phone-connection > span {
  display: grid;
  font-weight: 600;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.real-phone-panel .phone-connection > span small {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #8f94bd;
}
#phone-connect {
  min-height: 36px;
  padding: 0 16px;
  border-radius: 999px;
}
#phone-connect:not(.secondary) {
  background: linear-gradient(160deg, #34d77f, var(--call-green-2));
  box-shadow: 0 8px 20px #1fbf6a40;
}
.real-phone-panel .badge.connecting::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--amber-ui, #f5a524);
  vertical-align: 1px;
  animation: dot-blink 1s infinite;
}
.phone-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #ff3b4c1f;
  border: 1px solid #ff3b4c44;
  color: #ffc2c8;
  font-size: 12px;
  animation: shake 420ms var(--ease-out, ease);
}
/* Each screen (dial, calling, incoming, live) eases in when it changes */
.phone-stage.enter {
  animation: rise-in 380ms var(--ease-out, ease) both;
}
/* Dial screen (shared keypad, a little smaller to fit the panel) */
.phone-dialer .dialpad-display {
  padding: 0 0 8px;
}
.phone-dialer .dialpad-input,
.phone-dialer input.dialpad-input {
  font-size: 26px;
  min-height: 46px;
  background: transparent;
  border: 0;
}
.phone-dialer .dialpad-keys,
.phone-dialer .dialer-actions {
  grid-template-columns: repeat(3, 62px);
  gap: 10px 20px;
}
.phone-dialer .dialpad-key,
.phone-dialer .call-button {
  width: 62px;
  height: 62px;
}
.phone-dialer .dialpad-digit {
  font-size: 24px;
}
.phone-dialer .call-button:disabled {
  background: #ffffff1a;
  box-shadow: none;
  color: #ffffff66;
  cursor: not-allowed;
  transform: none;
}
.phone-dialer .call-button:disabled::after {
  display: none;
}
.phone-dial-hint {
  margin: 10px 0 0;
  text-align: center;
  font-size: 12px;
  color: #a7abd3;
}
/* Calling, incoming and live screens share the avatar stage */
.phone-calling,
.phone-incoming,
.phone-live-call {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin: 4px 0 6px;
  padding: 18px 12px 14px;
  border-radius: 20px;
  text-align: center;
  background: radial-gradient(90% 70% at 50% 0%, #5843ce33, transparent 70%), #ffffff08;
  border: 1px solid #ffffff14;
}
.phone-device .call-avatar-wrap {
  width: 76px;
  height: 76px;
  margin: 0 auto 10px;
}
.phone-device .call-large-avatar {
  width: 72px;
  height: 72px;
  color: #fff;
}
.phone-device .call-large-avatar > .icon {
  width: 30px;
  height: 30px;
}
.phone-device .call-avatar-wrap.ringing .call-ring {
  animation: call-ring 1.8s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
}
.phone-device .call-avatar-wrap.ringing .call-ring:nth-child(2) { animation-delay: 0.6s; }
.phone-device .call-avatar-wrap.ringing .call-ring:nth-child(3) { animation-delay: 1.2s; }
.phone-calling > strong,
.phone-incoming > strong,
.phone-live-call > strong {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #b9b0ff;
}
.phone-party {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.3px;
  font-variant-numeric: tabular-nums;
}
.phone-calling-note {
  margin: 6px 0 0;
  font-size: 12px;
  color: #a7abd3;
}
/* Incoming: green glow, shaking phone, pulsing answer */
.phone-incoming {
  background: radial-gradient(90% 70% at 50% 0%, #2fd27f33, transparent 70%), #ffffff08;
  border-color: #2fd27f44;
  animation: incoming-glow 1.6s ease-in-out infinite;
}
.phone-incoming.enter {
  animation: rise-in 380ms var(--ease-out, ease) both, incoming-glow 1.6s ease-in-out 380ms infinite;
}
.phone-incoming > strong {
  color: #8ff0bb;
}
.phone-incoming .call-large-avatar {
  background: linear-gradient(150deg, #34d77f, #16a35a);
}
.phone-incoming .call-large-avatar > .icon {
  animation: phone-shake 1.2s ease-in-out infinite;
}
.phone-incoming .call-ring {
  border-color: #6cf0a8;
}
.phone-answer-row {
  display: flex;
  justify-content: center;
  gap: 44px;
  margin-top: 16px;
}
.phone-round {
  display: grid;
  justify-items: center;
  gap: 6px;
  border: 0;
  background: none;
  color: #fff;
  cursor: pointer;
  font: inherit;
}
.phone-round > .icon {
  box-sizing: content-box;
  width: 26px;
  height: 26px;
  padding: 18px;
  border-radius: 50%;
  transition: transform 200ms var(--ease-spring, ease), box-shadow 240ms ease;
}
.phone-round small {
  font-size: 11px;
  font-weight: 500;
  color: #d8dbf3;
}
.phone-round.answer > .icon {
  background: linear-gradient(160deg, #34d77f, var(--call-green-2));
  animation: answer-pulse 1.6s ease-out infinite;
}
.phone-round.decline > .icon {
  background: linear-gradient(160deg, #ff5a68, var(--call-red-2));
  box-shadow: 0 8px 20px #ff3b4c44;
}
.phone-round:hover > .icon {
  transform: translateY(-2px) scale(1.06);
}
.phone-round:active > .icon {
  transform: scale(0.9);
}
.phone-round.answer:hover > .icon {
  transform: translateY(-2px) scale(1.06) rotate(-12deg);
}
/* Live call */
.phone-live-call.is-active .call-large-avatar {
  animation: avatar-breathe 3.2s ease-in-out infinite;
}
.phone-live-call .call-wave {
  height: 22px;
  margin: 6px auto 2px;
}
.phone-live-call.is-connecting .call-wave {
  display: none;
}
.phone-live-call.is-muted .call-wave i {
  animation: none;
  transform: scaleY(0.14);
  background: #ffffff55;
}
#phone-timer {
  font-size: 14px;
  font-weight: 600;
  color: #c6c9e8;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}
.phone-live-call.is-connecting #phone-timer {
  display: none;
}
.phone-controls {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 12px;
}
.phone-action {
  display: grid;
  justify-items: center;
  gap: 6px;
  border: 0;
  background: none;
  color: #fff;
  cursor: pointer;
  font: inherit;
  padding: 0;
}
.phone-action > .icon {
  box-sizing: content-box;
  width: 22px;
  height: 22px;
  padding: 15px;
  border-radius: 50%;
  border: 1px solid #ffffff1f;
  background: radial-gradient(120% 120% at 30% 20%, #ffffff26, #ffffff0d 65%);
  transition: transform 180ms var(--ease-spring, ease), background-color 220ms, color 220ms, box-shadow 240ms;
}
.phone-action small {
  font-size: 11px;
  font-weight: 500;
  color: #d8dbf3;
}
.phone-action:hover:not(:disabled) > .icon {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px #05081d66;
}
.phone-action:active:not(:disabled) > .icon {
  transform: scale(0.88);
}
.phone-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.phone-action.is-on > .icon {
  background: #fff;
  color: #2b1663;
  animation: control-on 360ms var(--ease-spring, ease);
}
.phone-action.is-end > .icon {
  border: 0;
  background: linear-gradient(160deg, #ff5a68, var(--call-red-2));
  box-shadow: 0 8px 22px #ff3b4c55;
}
.phone-action.is-end:hover > .icon {
  transform: translateY(-2px) rotate(-135deg);
}
.phone-dtmf {
  width: 100%;
  margin-top: 12px;
  animation: rise-in 300ms var(--ease-out, ease) both;
}
.phone-dtmf .dialpad-keys {
  grid-template-columns: repeat(3, 52px);
  gap: 8px 18px;
  margin: 0;
}
.phone-dtmf .dialpad-key {
  width: 52px;
  height: 52px;
}
.phone-dtmf .dialpad-digit {
  font-size: 20px;
}
.phone-add-caller {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #ffffff12;
  text-align: left;
}
.phone-add-caller label.field {
  flex: 1;
  margin: 0;
}
.phone-add-caller .button {
  min-height: 40px;
  border-radius: 12px;
}
.phone-add-caller .button > .icon {
  width: 15px;
  height: 15px;
}
.real-phone-panel .emergency-notice {
  color: #ffb3ba;
  opacity: 0.85;
  text-align: center;
}

/* Calling: animated dots, Cancel control, manual pick-up fallback */
.phone-dots i {
  font-style: normal;
  animation: dot-blink 1.2s infinite;
}
.phone-dots i:nth-child(2) { animation-delay: 0.2s; }
.phone-dots i:nth-child(3) { animation-delay: 0.4s; }
.phone-calling .phone-controls {
  margin-top: 16px;
}
.phone-calling.far-ringing .call-ring {
  border-color: #7cf0b0;
}
.phone-fallback {
  margin-top: 12px;
  border-radius: 999px;
  background: linear-gradient(160deg, #34d77f, var(--call-green-2)) !important;
  animation: fade-up 400ms var(--ease-out, ease) both, answer-pulse 1.6s ease-out 400ms infinite;
}
.phone-fallback > .icon {
  width: 16px;
  height: 16px;
}
/* Call ended summary */
.phone-ended {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin: 4px 0 6px;
  padding: 26px 12px 22px;
  border-radius: 20px;
  text-align: center;
  background: #ffffff08;
  border: 1px solid #ffffff14;
}
.phone-ended-icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: #ff3b4c26;
  color: #ff8a95;
  animation: pop-in 360ms var(--ease-spring, ease) both;
}
.phone-ended-icon > .icon {
  width: 26px;
  height: 26px;
}
.phone-ended > strong {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #ff9aa4;
}
.phone-ended .phone-calling-note {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: #c6c9e8;
}

/* ---------- Mobile ---------- */
@media (max-width: 420px) {
  .dialpad-keys,
  .dialer-actions {
    grid-template-columns: repeat(3, 66px);
    gap: 12px 20px;
  }
  .dialpad-key,
  .call-button {
    width: 66px;
    height: 66px;
  }
  dialog.dialer-modal {
    border-radius: 24px;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .call-wave i,
  .call-ring,
  .phone-incoming,
  .phone-incoming .call-large-avatar > .icon,
  .phone-round.answer > .icon,
  .phone-stage.enter,
  .has-number .call-button::after {
    animation: none !important;
  }
}

/* In-call keypad fits above the hang-up button */
.call-keypad button[data-dtmf] {
  width: 56px;
  height: 56px;
  font-size: 22px;
}
.call-keypad {
  gap: 10px 18px;
  margin-top: 16px;
}

/* Desktop top-bar call button */
.topbar-call {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px 0 12px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(160deg, #34d77f, var(--call-green-2));
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 16px #1fbf6a40;
  transition: transform 200ms var(--ease-spring, ease), box-shadow 240ms ease;
}
.topbar-call > .icon {
  width: 18px;
  height: 18px;
  transition: transform 300ms var(--ease-spring, ease);
}
.topbar-call:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px #1fbf6a55;
}
.topbar-call:hover > .icon {
  transform: rotate(90deg) scale(1.1);
}
.topbar-call:active {
  transform: scale(0.95);
}
@media (max-width: 900px) {
  .topbar-call {
    display: none;
  }
}
