* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top Navigation Bar */
header {
  flex-shrink: 0;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-icon {
  font-size: 28px;
}
.brand-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}
.brand-meta {
  font-size: 13px;
  color: #64748b;
  margin-top: 2px;
}
.brand-pill {
  display: inline-block;
  background: #f1f5f9;
  color: #334155;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  margin-left: 6px;
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}
.btn:active {
  transform: translateY(1px);
}
.btn-start {
  background: #16a34a;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
}
.btn-start:hover {
  background: #15803d;
}
.btn-stop {
  background: #ea580c;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(234, 88, 12, 0.25);
}
.btn-stop:hover {
  background: #c2410c;
}
.btn-clear {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #cbd5e1;
}
.btn-clear:hover {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fca5a5;
}
.btn-logout {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}
.btn-logout:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Status Ribbon */
.status-ribbon {
  flex-shrink: 0;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  z-index: 90;
}
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}
.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
}
.status-stopped .pulse-dot {
  background: #94a3b8;
}
.status-listening .pulse-dot {
  background: #16a34a;
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7);
  animation: pulse 1.8s infinite;
}
.status-thinking .pulse-dot {
  background: #eab308;
  box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.7);
  animation: pulse 1.2s infinite;
}
.status-speaking .pulse-dot {
  background: #2563eb;
  box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
  animation: pulse 1.4s infinite;
}
.status-waiting .pulse-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  animation: pulse 1.5s infinite;
}
.pulse-dot.voice-active {
  transform: scale(1.5) !important;
  box-shadow: 0 0 10px #22c55e !important;
  transition: transform 0.08s ease;
}
@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(37, 99, 235, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* Chat Container */
main {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 10px 20px 8px 20px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.notice-banner {
  flex-shrink: 0;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-left: 4px solid #6366f1;
  color: #3730a3;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  margin-bottom: 8px;
  line-height: 1.4;
}
.chat-box {
  flex: 1;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px 22px;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

/* Message Bubbles */
.msg-group {
  display: flex;
  gap: 12px;
  max-width: 82%;
}
.msg-user {
  align-self: flex-start;
}
.msg-assistant {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.msg-system {
  align-self: center;
  max-width: 95%;
  text-align: center;
  margin: 6px 0;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.msg-user .avatar {
  background: #e0f2fe;
}
.msg-assistant .avatar {
  background: #dcfce7;
}

.msg-content-wrap {
  display: flex;
  flex-direction: column;
}
.msg-header {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.msg-assistant .msg-header {
  justify-content: flex-end;
}

.bubble {
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.55;
  word-break: break-word;
}
.msg-user .bubble {
  background: #f8fafc;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-top-left-radius: 4px;
}
.msg-assistant .bubble {
  background: #2563eb;
  color: #ffffff;
  border-top-right-radius: 4px;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.15);
}
.msg-system .bubble {
  background: #f1f5f9;
  color: #64748b;
  font-size: 13px;
  padding: 6px 16px;
  border-radius: 20px;
  display: inline-block;
}

/* Empty Placeholder */
.empty-state {
  margin: auto;
  text-align: center;
  color: #94a3b8;
  padding: 40px 20px;
}
.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* Notice Banner */
.notice-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-meta {
  font-size: 13px;
  color: #64748b;
}
.empty-subtext { font-size: 13px; margin-top: 4px; }

/* Bottom Dock Controls (Pure Voice Interaction) */
.dock-container {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 12px;
  background: #ffffff;
  padding: 12px 20px;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.btn-mic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 28px;
  padding: 12px 36px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.25);
  min-width: 220px;
}
.btn-mic .mic-icon {
  font-size: 18px;
}
.btn-mic:hover:not(:disabled) {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}
.btn-mic:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.6;
  transform: none;
}
.btn-mic.recording {
  background: #dc2626 !important;
  box-shadow: 0 3px 10px rgba(220, 38, 38, 0.35);
  animation: pulse-red 1.2s infinite;
}
@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.dock-footer {
  flex-shrink: 0;
  text-align: center;
  font-size: 11.5px;
  color: #94a3b8;
  margin-top: 5px;
  padding-bottom: 2px;
}

@media (max-width: 640px) {
  header {
    padding: 10px 14px;
  }
  .brand-title {
    font-size: 16px;
  }
  .brand-meta {
    font-size: 11px;
  }
  .header-actions {
    gap: 6px;
    flex-wrap: wrap;
  }
  .btn {
    padding: 6px 10px;
    font-size: 12px;
  }
  .status-ribbon {
    padding: 6px 14px;
    font-size: 12px;
  }
  main {
    padding: 6px 10px 4px 10px;
  }
  .chat-box {
    padding: 12px 14px;
    gap: 12px;
  }
  .dock-container {
    padding: 10px 14px;
  }
  .btn-mic {
    width: 100%;
    min-width: 0;
    padding: 12px 20px;
    font-size: 14px;
  }
}
