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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif;
  background: #0f0f0f;
  color: #e0e0e0;
  min-height: 100vh;
}

.app {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 20px;
}

header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #4ade80;
  margin-bottom: 4px;
}

header p {
  font-size: 14px;
  color: #888;
}

main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.video-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #1a1a1a;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #333;
}

.video-container .input-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  opacity: 0;
}

.video-container .output-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: scaleX(-1);
}

.video-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 16px;
}

.video-placeholder .icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.control-panel {
  background: #1a1a1a;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #333;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.control-group label {
  font-size: 14px;
  color: #aaa;
  white-space: nowrap;
}

.control-group select {
  flex: 1;
  padding: 10px 14px;
  background: #252525;
  border: 1px solid #444;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 14px;
  cursor: pointer;
  outline: none;
}

.control-group select:focus {
  border-color: #4ade80;
}

.buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.buttons button {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: #4ade80;
  color: #0f0f0f;
}

.btn-primary:hover:not(:disabled) {
  background: #22c55e;
}

.btn-primary:disabled {
  background: #2d4a36;
  color: #666;
  cursor: not-allowed;
}

.btn-secondary {
  background: #333;
  color: #e0e0e0;
}

.btn-secondary:hover:not(:disabled) {
  background: #444;
}

.btn-secondary:disabled {
  background: #222;
  color: #555;
  cursor: not-allowed;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat-item {
  background: #252525;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  border: 1px solid #333;
}

.stat-label {
  display: block;
  font-size: 12px;
  color: #888;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  display: block;
  font-size: 32px;
  font-weight: 700;
  color: #4ade80;
  font-variant-numeric: tabular-nums;
}

#counter-display {
  color: #4ade80;
  font-size: 42px;
}

#angle-display {
  color: #60a5fa;
}

#fps-display {
  color: #fbbf24;
  font-size: 24px;
}

.status-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 100;
}

.status-toast.show {
  opacity: 1;
}

@media (max-width: 600px) {
  .app {
    padding: 12px;
  }
  header h1 {
    font-size: 22px;
  }
  .stat-value {
    font-size: 24px;
  }
  #counter-display {
    font-size: 32px;
  }
}
