*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #ccfbf1;
  --danger: #ef4444;
  --danger-dark: #dc2626;
  --bg: #f0fdfa;
  --surface: #ffffff;
  --text: #134e4a;
  --text-secondary: #64748b;
  --border: #99f6e4;
  --shadow: 0 4px 24px rgba(13, 148, 136, 0.12);
  --radius: 16px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  box-shadow: 0 1px 8px rgba(0,0,0,0.04);
}

.header-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  color: var(--primary-dark);
}

.ar-badge {
  background: linear-gradient(135deg, #0d9488, #0891b2);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 1px;
}

.ward-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.ward-tag .label {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
}

.ward-tag .value {
  color: var(--text-secondary);
}

.main {
  flex: 1;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px;
}

.scenario-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #ecfdf5, #f0fdfa);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.scenario-icon { font-size: 32px; }

.scenario-banner h3 {
  font-size: 16px;
  color: var(--primary-dark);
  margin-bottom: 2px;
}

.scenario-banner p {
  font-size: 13px;
  color: var(--text-secondary);
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}

.info-card h4 {
  font-size: 13px;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.info-list {
  list-style: none;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.info-list li::before {
  content: '· ';
  color: var(--primary);
  font-weight: bold;
}

.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 40px;
  gap: 0;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0.4;
  transition: opacity var(--transition);
}

.step.active, .step.done { opacity: 1; }

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}

.step.active .step-dot {
  background: var(--primary);
  color: white;
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.2);
}

.step.done .step-dot {
  background: var(--primary-dark);
  color: white;
}

.step span {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.step.active span {
  color: var(--primary-dark);
  font-weight: 500;
}

.step-line {
  width: 48px;
  height: 2px;
  background: var(--border);
  margin: 0 4px;
  margin-bottom: 22px;
  transition: background var(--transition);
}

.step-line.done { background: var(--primary); }

.panel {
  display: none;
  animation: fadeIn 0.4s ease;
}

.panel.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.record-area {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 48px 32px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.mic-wrapper {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mic-icon {
  width: 80px;
  height: 80px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  position: relative;
  z-index: 2;
  transition: all var(--transition);
}

.mic-wrapper.recording .mic-icon {
  background: #fee2e2;
  color: var(--danger);
}

.mic-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--primary);
  opacity: 0;
  transition: all var(--transition);
}

.mic-wrapper.recording .mic-ring {
  opacity: 1;
  animation: pulse 2s ease-out infinite;
  border-color: var(--danger);
}

.ring-1 { width: 100px; height: 100px; animation-delay: 0s !important; }
.ring-2 { width: 110px; height: 110px; animation-delay: 0.4s !important; }
.ring-3 { width: 120px; height: 120px; animation-delay: 0.8s !important; }

@keyframes pulse {
  0% { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}

.status-text {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.timer {
  font-size: 32px;
  font-weight: 700;
  color: var(--danger);
  font-variant-numeric: tabular-nums;
  margin-bottom: 16px;
  letter-spacing: 2px;
}

.live-preview {
  margin: 0 auto 20px;
  max-width: 100%;
  text-align: left;
  background: #fff;
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 2px 12px rgba(13, 148, 136, 0.15);
}

.live-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.live-preview-label {
  font-size: 13px;
  color: var(--primary-dark);
  font-weight: 600;
}

.live-badge {
  font-size: 11px;
  color: var(--danger);
  background: #fff1f0;
  padding: 2px 8px;
  border-radius: 10px;
  animation: pulse-badge 1.5s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.live-preview-text {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text);
  min-height: 72px;
  max-height: 160px;
  overflow-y: auto;
  word-break: break-word;
}

.live-preview-text .interim {
  color: #64748b;
  font-style: italic;
}

.live-preview-text .interim.empty {
  color: var(--text-secondary);
}

.live-cursor {
  color: var(--primary);
  animation: blink 0.8s step-end infinite;
  font-weight: 300;
}

.live-preview:not(.active) .live-cursor {
  display: none;
}

.waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 40px;
  margin-bottom: 24px;
}

.waveform span {
  display: block;
  width: 4px;
  background: var(--danger);
  border-radius: 2px;
  animation: wave 1s ease-in-out infinite;
}

.waveform span:nth-child(1) { animation-delay: 0.0s; height: 12px; }
.waveform span:nth-child(2) { animation-delay: 0.1s; height: 20px; }
.waveform span:nth-child(3) { animation-delay: 0.2s; height: 28px; }
.waveform span:nth-child(4) { animation-delay: 0.3s; height: 16px; }
.waveform span:nth-child(5) { animation-delay: 0.4s; height: 32px; }
.waveform span:nth-child(6) { animation-delay: 0.5s; height: 24px; }
.waveform span:nth-child(7) { animation-delay: 0.6s; height: 18px; }
.waveform span:nth-child(8) { animation-delay: 0.7s; height: 30px; }
.waveform span:nth-child(9) { animation-delay: 0.8s; height: 14px; }
.waveform span:nth-child(10) { animation-delay: 0.9s; height: 22px; }

@keyframes wave {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1.2); }
}

.btn-group {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  min-height: 48px;
  touch-action: manipulation;
}

.btn-lg {
  padding: 14px 36px;
  font-size: 17px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.analyzing-area {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.analyzing-area h2 {
  font-size: 22px;
  margin-bottom: 8px;
  color: var(--primary-dark);
}

.analyzing-desc {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 14px;
}

.analysis-steps {
  text-align: left;
  max-width: 400px;
  margin: 0 auto 20px;
}

.analysis-task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  background: #f8fafc;
  transition: all 0.3s;
}

.analysis-task.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 500;
}

.analysis-task.done { color: var(--primary-dark); }

.task-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

.analysis-task.active .task-icon {
  background: var(--primary);
  color: white;
}

.analysis-task.done .task-icon {
  background: var(--primary-dark);
  color: white;
}

.extracted-box, .conversation-box {
  text-align: left;
  background: #f8fafc;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 auto 16px;
  max-width: 520px;
  animation: fadeIn 0.4s ease;
}

.extracted-box h4, .conversation-box h4 {
  font-size: 13px;
  color: var(--primary-dark);
  margin-bottom: 10px;
}

.keyword-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.keyword-tag {
  background: white;
  border: 1px solid var(--primary);
  color: var(--primary-dark);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  animation: fadeIn 0.3s ease;
}

.conversation-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}

.progress-bar {
  max-width: 400px;
  margin: 16px auto 0;
  height: 6px;
  background: var(--primary-light);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s ease;
}

.edit-area {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.edit-header h2 {
  font-size: 20px;
  color: var(--primary-dark);
}

.badge {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  background: #fef3c7;
  color: #92400e;
}

.badge.done {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.transcript-box {
  position: relative;
  margin-bottom: 16px;
}

.transcript-box textarea {
  width: 100%;
  padding: 20px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
  line-height: 1.8;
  color: var(--text);
  background: #fafafa;
  resize: vertical;
  font-family: inherit;
  transition: border-color var(--transition);
}

.transcript-box textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
}

.transcript-box textarea:not([readonly]) {
  background: white;
}

.cursor-blink {
  position: absolute;
  bottom: 24px;
  left: 24px;
  font-size: 16px;
  color: var(--primary);
  animation: blink 0.8s step-end infinite;
  pointer-events: none;
  display: none;
}

.cursor-blink.visible { display: block; }

@keyframes blink { 50% { opacity: 0; } }

.edit-hint, .generate-hint {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.done-area {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 64px 32px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.done-icon {
  color: var(--primary);
  margin-bottom: 20px;
  animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.done-area h2 {
  font-size: 24px;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.done-desc {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.process-timeline {
  text-align: left;
  max-width: 480px;
  margin: 0 auto 24px;
}

.timeline-item {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 6px;
  flex-shrink: 0;
}

.timeline-content strong {
  font-size: 14px;
  color: var(--primary-dark);
}

.timeline-content p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.done-result {
  text-align: left;
  max-width: 100%;
  margin: 0 auto 24px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  max-height: 320px;
  overflow-y: auto;
}

.done-result-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 10px;
}

.done-result-text {
  font-size: 15px;
  line-height: 1.85;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.done-summary {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.summary-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-dark);
}

.footer {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
}

@media (max-width: 600px) {
  .steps { gap: 0; }
  .step-line { width: 24px; }
  .step span { font-size: 10px; }
  .info-grid { grid-template-columns: 1fr; }
  .record-area, .analyzing-area, .edit-area, .done-area { padding: 32px 20px; }
  .done-summary { gap: 20px; }
  .header-inner {
    flex-direction: column;
    height: auto;
    padding: 12px 0;
    gap: 8px;
  }
}
