:root {
  --bg0: #0f1c17;
  --bg1: #173328;
  --ink: #f2f7f3;
  --muted: #a7bdb2;
  --line: rgba(242, 247, 243, 0.12);
  --accent: #3ecf8e;
  --accent-2: #e8c468;
  --danger: #ef6b6b;
  --panel: rgba(18, 36, 28, 0.78);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --font: "Noto Sans SC", "DM Sans", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg0);
  line-height: 1.5;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(62, 207, 142, 0.28), transparent 55%),
    radial-gradient(700px 420px at 90% 0%, rgba(232, 196, 104, 0.18), transparent 50%),
    linear-gradient(165deg, #0c1612 0%, #15261f 45%, #0f1c17 100%);
}
.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
  pointer-events: none;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem 0.4rem;
  max-width: 980px;
  margin: 0 auto;
}
.brand { display: flex; gap: 0.75rem; align-items: center; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), #1f8f5f);
  color: #062016; font-weight: 700; font-size: 1.15rem;
}
.brand-name { margin: 0; font-weight: 700; letter-spacing: 0.02em; }
.brand-sub { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.85rem; }

.status-pill {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.status-pill.live { color: var(--accent); border-color: rgba(62,207,142,0.45); }
.status-pill.err { color: var(--danger); border-color: rgba(239,107,107,0.45); }

.layout {
  max-width: 980px;
  margin: 0 auto;
  padding: 0.8rem 1.2rem 2.5rem;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.25rem 1.4rem;
  backdrop-filter: blur(10px);
}
.panel.hidden { display: none; }
.panel h1, .panel h2 { margin: 0 0 0.4rem; font-size: 1.45rem; }
.lede { margin: 0 0 1rem; color: var(--muted); }

.role-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin-bottom: 0.7rem;
}
.role-card {
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--ink);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  cursor: pointer;
  transition: border-color .2s, transform .2s, background .2s;
}
.role-card strong { display: block; margin-bottom: 0.2rem; }
.role-card span { color: var(--muted); font-size: 0.85rem; }
.role-card:hover { transform: translateY(-1px); border-color: rgba(62,207,142,0.35); }
.role-card.active {
  border-color: rgba(62,207,142,0.7);
  background: linear-gradient(160deg, rgba(62,207,142,0.16), rgba(255,255,255,0.02));
}
.role-hint { margin: 0 0 1rem; color: var(--accent-2); font-size: 0.9rem; }

.section-label {
  margin: 0 0 0.55rem;
  font-size: 0.92rem;
  color: var(--muted);
  font-weight: 600;
}
.voice-block { margin-bottom: 1rem; }
.voice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
}
.voice-card {
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--ink);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.voice-card strong { display: block; margin-bottom: 0.15rem; }
.voice-card span { color: var(--muted); font-size: 0.78rem; }
.voice-card.active {
  border-color: rgba(62,207,142,0.7);
  background: linear-gradient(160deg, rgba(62,207,142,0.16), rgba(255,255,255,0.02));
}
.voice-hint {
  margin: 0.55rem 0 0;
  color: var(--accent-2);
  font-size: 0.88rem;
}
@media (max-width: 640px) {
  .voice-grid { grid-template-columns: 1fr 1fr; }
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.scenario-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem;
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  transition: border-color .2s, transform .2s;
}
.scenario-card:hover { transform: translateY(-1px); border-color: rgba(232,196,104,0.4); }
.scenario-card.active {
  border-color: rgba(232,196,104,0.75);
  background: linear-gradient(160deg, rgba(232,196,104,0.12), rgba(255,255,255,0.02));
}
.scenario-card h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.meta-row { display: flex; gap: 0.4rem; margin-bottom: 0.35rem; }
.tag {
  font-size: 0.72rem;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  border: 1px solid var(--line);
  color: var(--muted);
}
.tag.level { color: var(--accent); border-color: rgba(62,207,142,0.35); }
.scenario-card p { margin: 0; color: var(--muted); font-size: 0.86rem; }

.product-box {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 1rem;
  color: var(--muted);
}
.product-box summary { cursor: pointer; color: var(--ink); }
.product-fields {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.7rem;
}
.product-fields label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.86rem;
  color: var(--muted);
}
input, textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.25);
  color: var(--ink);
  padding: 0.55rem 0.7rem;
  font: inherit;
}
input:focus, textarea:focus {
  outline: 1px solid rgba(62,207,142,0.55);
  border-color: transparent;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 0.75rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), #2aa56e);
  color: #062016;
}
.btn.danger { background: var(--danger); color: #1a0808; min-width: 120px; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  min-width: 120px;
}

.call-stage { text-align: center; padding: 0.4rem 0 1rem; }
.avatar-ring {
  width: 108px; height: 108px; margin: 0.4rem auto 0.8rem;
  border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.2), transparent 45%),
              linear-gradient(145deg, rgba(62,207,142,0.35), rgba(232,196,104,0.2));
  border: 1px solid rgba(255,255,255,0.14);
  animation: pulse 2.4s ease-in-out infinite;
}
.avatar-core {
  width: 78px; height: 78px; border-radius: 50%;
  display: grid; place-items: center;
  background: #102119;
  font-size: 1.6rem; font-weight: 700;
}
.call-sub { margin: 0.2rem 0; color: var(--muted); }
.timer {
  margin: 0.35rem 0 0.8rem;
  font-family: "DM Sans", sans-serif;
  letter-spacing: 0.08em;
  color: var(--accent-2);
}
.wave {
  height: 28px;
  display: flex; gap: 5px; justify-content: center; align-items: flex-end;
  margin-bottom: 1rem; opacity: 0.35;
}
.wave.live { opacity: 1; }
.wave span {
  width: 5px; height: 8px; border-radius: 99px;
  background: var(--accent);
  animation: bar 1s ease-in-out infinite;
}
.wave span:nth-child(2) { animation-delay: .1s; }
.wave span:nth-child(3) { animation-delay: .2s; }
.wave span:nth-child(4) { animation-delay: .15s; }
.wave span:nth-child(5) { animation-delay: .05s; }
.call-actions { display: flex; gap: 0.7rem; justify-content: center; }

.transcript {
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
}
.transcript-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 0.5rem;
}
.transcript-head h3 { margin: 0; font-size: 1rem; }
#asrHint { color: var(--muted); font-size: 0.82rem; }
.transcript-body {
  max-height: 280px;
  overflow: auto;
  display: grid;
  gap: 0.55rem;
}
.transcript-body.compact { max-height: 220px; margin: 0.8rem 0 1rem; }
.bubble {
  max-width: 92%;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  font-size: 0.92rem;
  white-space: pre-wrap;
}
.bubble.user {
  justify-self: end;
  background: rgba(62,207,142,0.16);
  border: 1px solid rgba(62,207,142,0.25);
}
.bubble.ai {
  justify-self: start;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
}
.bubble .who {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.hints {
  margin: 0 0 0.8rem;
  padding-left: 1.1rem;
  color: var(--muted);
}
.hints li { margin-bottom: 0.35rem; }

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 0 1rem 1.5rem;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(62,207,142,0.25); }
  50% { box-shadow: 0 0 0 12px rgba(62,207,142,0); }
}
@keyframes bar {
  0%, 100% { height: 8px; }
  50% { height: 24px; }
}

@media (max-width: 640px) {
  .role-switch { grid-template-columns: 1fr; }
  .top { padding-inline: 1rem; }
  .layout { padding-inline: 0.85rem; }
}
