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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  background: #fafafa;
  color: #1d1d1f;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 24px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1 {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.3px;
  margin-bottom: 40px;
  color: #1d1d1f;
}

.camera-container {
  position: relative;
  width: 480px;
  max-width: 100%;
  aspect-ratio: 4/3;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 32px;
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

canvas { display: none; }

.camera-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 100px;
  letter-spacing: 0.2px;
}

.stream-indicator {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #86868b;
  transition: background 0.3s;
}

.stream-indicator.live {
  background: #ff3b30;
  box-shadow: 0 0 8px rgba(255, 59, 48, 0.6);
  animation: pulse 2s infinite;
}

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

.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  width: 480px;
  max-width: 100%;
}

.config-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
}

input:focus { border-color: #0071e3; }
input::placeholder { color: #86868b; }

.btn {
  padding: 10px 28px;
  border: none;
  border-radius: 980px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  letter-spacing: -0.1px;
}

.btn-primary {
  background: #0071e3;
  color: #fff;
}

.btn-primary:hover { background: #0077ed; }

.btn-primary:disabled {
  background: #d2d2d7;
  cursor: not-allowed;
}

.btn-stop {
  background: #ff3b30;
  color: #fff;
}

.btn-stop:hover { background: #ff453a; }

.options {
  display: flex;
  gap: 16px;
  align-items: center;
}

label {
  font-size: 13px;
  color: #86868b;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.stats {
  font-size: 12px;
  color: #86868b;
  margin-bottom: 24px;
  font-variant-numeric: tabular-nums;
  height: 16px;
}

.log-container {
  width: 480px;
  max-width: 100%;
  flex: 1;
}

.log-header {
  font-size: 13px;
  font-weight: 500;
  color: #86868b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.log {
  background: #fff;
  border: 1px solid #e8e8ed;
  border-radius: 12px;
  max-height: 360px;
  overflow-y: auto;
  font-size: 12px;
  font-family: "SF Mono", "Menlo", monospace;
  line-height: 1.6;
}

.log::-webkit-scrollbar { width: 6px; }
.log::-webkit-scrollbar-track { background: transparent; }
.log::-webkit-scrollbar-thumb { background: #d2d2d7; border-radius: 3px; }

.log-entry {
  padding: 6px 14px;
  border-bottom: 1px solid #f5f5f7;
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.log-entry:last-child { border-bottom: none; }

.log-time {
  color: #86868b;
  flex-shrink: 0;
  font-size: 11px;
}

.log-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.tag-send    { background: #e8f5e8; color: #1b7a1b; }
.tag-text    { background: #e3f2fd; color: #0d47a1; }
.tag-audio   { background: #f3e5f5; color: #6a1b9a; }
.tag-tool    { background: #fff3e0; color: #e65100; }
.tag-error   { background: #ffebee; color: #c62828; }
.tag-system  { background: #f5f5f7; color: #86868b; }

.log-msg {
  color: #1d1d1f;
  word-break: break-word;
  flex: 1;
}

.empty-log {
  padding: 32px;
  text-align: center;
  color: #86868b;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 13px;
}
