:root {
  --brand: #c41e2a;
  --brand-dark: #9f1822;
  --brand-soft: #FBECEE;
  --ink: #1a1a1a;
  --muted: #666666;
  --muted-soft: #999999;
  --canvas: #ffffff;
  --mist: #f7f7f8;
  --mist-soft: #f0f0f2;
  --line: rgba(0, 0, 0, 0.1);
  --ok: #1f8a70;
  --danger: #c41e2a;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --touch: 48px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --font: "Space Grotesk", "Archivo", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --display: "Space Grotesk", "PingFang SC", "Microsoft YaHei", sans-serif;
  color-scheme: light;
  font-family: var(--font);
  color: var(--ink);
  background: var(--canvas);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { height: 100%; }
body {
  min-height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-font-smoothing: antialiased;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-color: var(--canvas);
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
}
.bg::after {
  content: "";
  position: absolute;
  width: min(72vw, 520px);
  height: min(72vw, 520px);
  right: -12%;
  top: -8%;
  border-radius: 50%;
  border: 1px solid rgba(196, 30, 42, 0.12);
  pointer-events: none;
}
.grain { display: none; }

.shell {
  width: min(440px, calc(100% - 32px - var(--safe-left) - var(--safe-right)));
  margin: 0 auto;
  padding:
    calc(40px + var(--safe-top))
    max(0px, var(--safe-right))
    calc(40px + var(--safe-bottom))
    max(0px, var(--safe-left));
}

.brand h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2rem, 8vw, 2.75rem);
  margin: 0.15em 0 0.3em;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--ink);
}
.eyebrow {
  margin: 0;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  color: var(--brand);
  font-weight: 700;
}
.sub {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.95rem;
}

.panel {
  padding: 0;
  border-radius: 22px;
  background: var(--canvas);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.panel-inner {
  display: grid;
  gap: 14px;
  padding: 22px 20px;
  border-radius: 22px;
  background: var(--canvas);
}
.panel[hidden] { display: none !important; }

.caller-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--mist);
  padding: 14px 16px;
}
.caller-label {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted-soft);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.caller-name {
  margin: 6px 0 0;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 700;
}
.caller-meta {
  margin: 6px 0 0;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.45;
  word-break: break-all;
}
.caller-ext {
  margin: 10px 0 0;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--brand);
}
.field-label {
  display: block;
  margin: 4px 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}
.field-input {
  width: 100%;
  min-height: var(--touch);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  font-size: 1rem;
  background: var(--mist);
  color: var(--ink);
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 500;
}
.field { display: grid; gap: 8px; }
.field-label {
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 500;
}
.skill-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.skill-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  background: var(--canvas);
  color: var(--ink);
  border-radius: 980px;
  min-height: var(--touch);
  padding: 12px 16px;
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.skill-btn.selected {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.skill-btn:focus-visible {
  outline: 2px solid rgba(196, 30, 42, 0.35);
  outline-offset: 2px;
}
input, select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  background: var(--canvas);
  border-radius: 980px;
  padding: 14px 16px;
  min-height: var(--touch);
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  width: 100%;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(196, 30, 42, 0.12);
}
input::placeholder { color: var(--muted-soft); }

.hint { margin: 0; font-size: 0.8rem; color: var(--muted); line-height: 1.45; }
.mic-status {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}
.mic-status.ok { color: var(--ok); font-weight: 600; }
.mic-status.bad { color: var(--danger); font-weight: 600; }
.mic-check { width: 100%; }
.err { margin: 0; color: var(--brand); font-size: 0.9rem; line-height: 1.4; }

.cta, .danger, .ghost {
  border: 0;
  border-radius: 980px;
  min-height: var(--touch);
  padding: 14px 18px;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease);
}
.cta {
  background: var(--brand);
  color: #fff;
  width: 100%;
}
.cta:hover { background: var(--brand-dark); transform: translateY(-1px); }
.cta:active { transform: scale(0.98); }
.cta:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(196, 30, 42, 0.28);
}
.cta:disabled { opacity: 0.5; cursor: wait; transform: none; }
.danger { background: var(--danger); color: #fff; }
.ghost {
  background: var(--canvas);
  border: 1px solid var(--line);
  color: var(--ink);
}

.panel.ring {
  border: 1px solid rgba(196, 30, 42, 0.28);
  box-shadow: 0 0 0 1px rgba(196, 30, 42, 0.06), var(--shadow);
  animation: ringPulse 1.6s var(--ease) infinite;
}
@keyframes ringPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196, 30, 42, 0.12), var(--shadow); }
  50% { box-shadow: 0 0 0 8px rgba(196, 30, 42, 0.05), var(--shadow); }
}
.ring-eyebrow {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
}
.ring-title {
  margin: 4px 0 0;
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.25;
}
.ring-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}
.ring-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}
.ring-actions .cta,
.ring-actions .danger { width: 100%; }
.ghost:hover { background: var(--mist); }
.ghost:focus-visible,
.danger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(196, 30, 42, 0.2);
}

.call-inner {
  text-align: center;
  place-items: center;
  padding: 28px 18px 20px;
}
.pulse {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 0 rgba(196, 30, 42, 0.35);
  animation: ring 1.8s ease-out infinite;
  margin: 0 auto 18px;
}
.pulse.active {
  background: var(--ok);
  animation: none;
}
@keyframes ring {
  0% { box-shadow: 0 0 0 0 rgba(196, 30, 42, 0.4); }
  70% { box-shadow: 0 0 0 28px rgba(196, 30, 42, 0); }
  100% { box-shadow: 0 0 0 0 rgba(196, 30, 42, 0); }
}
.status {
  font-family: var(--display);
  font-size: clamp(1.35rem, 5.5vw, 1.65rem);
  font-weight: 700;
  margin: 0;
  line-height: 1.25;
  color: var(--ink);
  text-wrap: balance;
}
.meta {
  margin: 4px 0 18px;
  color: var(--muted);
  min-height: 1.2em;
  font-size: 0.95rem;
  line-height: 1.45;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  margin: 0 0 8px;
  padding: 4px 12px;
  border-radius: 980px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid rgba(196, 30, 42, 0.18);
}
.status-pill.connected {
  color: var(--ok);
  background: #e8f6f2;
  border-color: rgba(31, 138, 112, 0.25);
}
.status-pill.ended {
  color: var(--muted);
  background: var(--mist);
  border-color: var(--line);
}
.actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  width: 100%;
}
.actions .ghost,
.actions .danger {
  flex: 1 1 0;
  max-width: 180px;
}

.foot-link {
  margin: 22px 0 0;
  text-align: center;
  font-size: 0.86rem;
}
.foot-link a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.foot-link a:hover { color: var(--brand); }

@media (max-width: 480px) {
  .shell {
    width: calc(100% - 24px - var(--safe-left) - var(--safe-right));
    padding-top: calc(28px + var(--safe-top));
    padding-bottom: calc(28px + var(--safe-bottom));
  }
  .brand h1 { font-size: clamp(1.85rem, 10vw, 2.4rem); }
  .sub { margin-bottom: 18px; font-size: 0.92rem; }
  .actions { flex-direction: column; }
  .actions .ghost,
  .actions .danger { max-width: none; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .pulse { animation: none; }
  .cta, .ghost, .skill-btn { transition: none; }
}
