:root {
  --bg: #0b1622;
  --card: #13202f;
  --accent: #0081cc;
  --green: #16a34a;
  --green-press: #128a3e;
  --red: #dc2626;
  --text: #e8eef5;
  --muted: #8aa0b5;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 80% at 50% -10%, #16324d 0%, var(--bg) 55%) var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Thai", sans-serif;
  -webkit-font-smoothing: antialiased;
}
#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 4px 8px;
}
.brand { font-weight: 700; font-size: 18px; letter-spacing: .2px; }
.status {
  font-size: 13px; color: var(--muted);
  padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.06);
}
.state-ready .status { color: #bdf0cf; }
.state-incall .status { color: #bfe3ff; }

.stage {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
}

/* The phone "logo" call button */
.fab {
  width: 116px; height: 116px; border-radius: 50%;
  border: none; cursor: pointer; color: #fff;
  background: linear-gradient(160deg, #1fd065, var(--green));
  box-shadow: 0 14px 34px rgba(22,163,74,.45), inset 0 2px 0 rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center;
  transition: transform .08s ease, box-shadow .2s ease, opacity .2s ease;
}
.fab:active { transform: scale(.95); background: var(--green-press); }
.fab:disabled { opacity: .45; cursor: default; box-shadow: none; filter: grayscale(.3); }
.fab.ringing { animation: pulse 1.1s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(22,163,74,.55); }
  70% { box-shadow: 0 0 0 22px rgba(22,163,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); }
}
.call-label { font-size: 17px; color: var(--muted); }

/* In-call panel */
.incall { display: flex; flex-direction: column; align-items: center; gap: 26px; }
.timer { font-size: 30px; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.incall-actions { display: flex; gap: 40px; }
.circle-btn {
  width: 78px; height: 78px; border-radius: 50%;
  border: none; cursor: pointer; color: #fff;
  background: rgba(255,255,255,.10);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 12px;
}
.circle-btn span { color: var(--text); }
.circle-btn.active { background: rgba(255,255,255,.28); }
.circle-btn.danger { background: var(--red); }
.circle-btn:active { transform: scale(.94); }

/* Diagnostic log */
.logbox {
  margin: 8px 0 6px; background: var(--card); border-radius: 12px; padding: 8px 12px;
  font-size: 12px; color: var(--muted);
}
.logbox summary { cursor: pointer; color: var(--muted); user-select: none; }
.logbox pre {
  margin: 8px 0 0; max-height: 32vh; overflow: auto; white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px;
  color: #9fb6cc;
}

.diag {
  margin: 6px 0; padding: 10px 12px; border-radius: 10px;
  background: #0e2a1a; border: 1px solid #1f5f3a; color: #b8f0cf;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px; line-height: 1.5; word-break: break-word;
}

.soundbtn {
  margin: 4px 0; padding: 14px 18px; border: none; border-radius: 999px; cursor: pointer;
  background: #f59e0b; color: #1a1206; font-size: 15px; font-weight: 700;
  box-shadow: 0 8px 20px rgba(245,158,11,.4);
}
.soundbtn:active { transform: scale(.96); }

.copybtn {
  margin: 4px 0 8px; padding: 10px 14px; border: 1px solid #2a3a4d; border-radius: 10px;
  cursor: pointer; background: #16243400; color: var(--muted); font-size: 13px; width: 100%;
}
.copybtn:active { transform: scale(.98); }

.banner {
  margin: 6px 0 10px; padding: 12px 14px; border-radius: 12px; line-height: 1.5;
  background: #3a2a07; color: #ffe9b3; font-size: 13px; border: 1px solid #6b5212;
}
