:root {
  --bg: #f1f5fb;
  --card: #ffffff;
  --ink: #0f2747;
  --muted: #6b7c93;
  --line: #e3eaf3;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --shadow: 0 18px 45px rgba(15, 39, 71, 0.12);
  --radius: 18px;
}

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

/* Honor the hidden attribute even when .panel sets display:flex */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #dbe8ff 0%, var(--bg) 55%);
  color: var(--ink);
}

.phone-shell {
  max-width: 380px;
  margin: 0 auto;
  min-height: 100%;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.phone-header { display: flex; align-items: center; gap: 12px; }
.brand-dot {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--blue), #4f8cff);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
}
.brand-text { display: flex; flex-direction: column; }
.brand-text strong { font-size: 17px; }
.brand-text span { font-size: 12.5px; color: var(--muted); }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.field input,
.number-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
  color: var(--ink);
  background: #f8fafd;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus,
.number-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  background: #fff;
}

.switch-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

.btn {
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .08s, background .15s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; padding: 13px; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-small { font-size: 12.5px; padding: 6px 10px; }

.error-text { color: var(--red); font-size: 13px; margin: 0; }

.state-badge {
  align-self: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--blue);
  background: #e8f0ff;
  padding: 5px 12px;
  border-radius: 999px;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.key {
  border: 1px solid var(--line);
  background: #f8fafd;
  border-radius: 14px;
  padding: 14px 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.key:active { background: #e8f0ff; }
.key small { display: block; font-size: 9.5px; font-weight: 500; color: var(--muted); letter-spacing: 1px; }

.call-actions { display: flex; justify-content: center; gap: 26px; margin-top: 4px; }
.btn-call, .btn-hangup {
  width: 66px; height: 66px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
}
.btn-call { background: var(--green); box-shadow: 0 10px 24px rgba(22, 163, 74, .35); }
.btn-hangup { background: var(--red); box-shadow: 0 10px 24px rgba(220, 38, 38, .35); }
.call-ico { font-size: 24px; }

.call-meta { display: flex; align-items: center; justify-content: space-between; }
.call-meta #call-timer { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }

.mic-meter { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.mic-meter-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.mic-meter-track { flex: 1; height: 8px; border-radius: 999px; background: rgba(15, 23, 42, 0.08); overflow: hidden; }
.mic-meter-fill {
  display: block; height: 100%; width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #22c55e);
  transition: width 60ms linear;
}

.inbound-hud {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-top: 12px; font-size: 12px; color: var(--muted);
}
.inbound-hud #inbound-hud-pkts { font-variant-numeric: tabular-nums; }

.phone-footer { text-align: center; font-size: 11.5px; color: var(--muted); margin-top: auto; }

/* ---- Standalone on-page debug card (?debug=1) ---- */
#wp-debug-card {
  position: fixed; right: 14px; bottom: 14px; z-index: 9999;
  width: min(440px, calc(100vw - 28px));
  max-height: 56vh; display: flex; flex-direction: column;
  background: #0b1220; color: #d7e3f4;
  border-radius: 12px; box-shadow: 0 20px 50px rgba(2, 8, 20, 0.5);
  overflow: hidden; font-size: 12px;
}
.wp-debug-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: #111c30; color: #9fb6d6;
  font-weight: 600; letter-spacing: .02em;
}
.wp-debug-head div { display: flex; gap: 6px; }
.wp-debug-head button {
  border: 1px solid #2a3c58; background: transparent; color: #9fb6d6;
  border-radius: 6px; padding: 2px 8px; font-size: 11px; cursor: pointer;
}
.wp-debug-head button:hover { background: #1b2942; color: #fff; }
.wp-debug-head button:disabled { opacity: 0.6; cursor: default; }
#wp-debug-log {
  margin: 0; padding: 10px 12px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.45;
}
