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

:root {
  --bg: #0a0a0a;
  --surface: #161616;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --text-dim: #888;
  --red: #ff3b30;
  --red-glow: rgba(255, 59, 48, 0.3);
  --accent: #fff;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

#app {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  color: var(--text-dim);
  margin-top: 0.25rem;
  font-size: 0.95rem;
}

.video-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

#preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#preview.mirrored {
  transform: scaleX(-1);
}

#rec-indicator {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.rec-dot {
  width: 10px;
  height: 10px;
  background: var(--red);
  border-radius: 50%;
  animation: pulse 1s ease-in-out infinite;
}

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

.controls {
  margin-top: 1.5rem;
}

.settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.settings label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.settings select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  appearance: none;
  cursor: pointer;
}

.settings select:focus {
  outline: none;
  border-color: var(--text-dim);
}

.checkbox-label {
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.5rem !important;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--red);
  cursor: pointer;
}

.btn-group {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.btn {
  padding: 0.85rem 2.5rem;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-record {
  background: var(--red);
  color: #fff;
}

.btn-record:not(:disabled):hover {
  box-shadow: 0 0 20px var(--red-glow);
  transform: scale(1.02);
}

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

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

.hidden {
  display: none !important;
}

.downloads {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.downloads h2 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--text-dim);
  font-weight: 500;
}

#downloadList {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#downloadList li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

#downloadList li span {
  font-size: 0.9rem;
}

#downloadList li .file-size {
  color: var(--text-dim);
  font-size: 0.8rem;
}

#downloadList li a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.4rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: background 0.15s;
}

#downloadList li a:hover {
  background: var(--border);
}

footer {
  text-align: center;
  margin-top: 3rem;
  color: var(--text-dim);
  font-size: 0.8rem;
}

@media (max-width: 600px) {
  #app {
    padding: 1rem;
  }
  .settings {
    grid-template-columns: 1fr;
  }
  .btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
  }
}
