* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
  background: #111;
  color: #eee;
}

h1 {
  font-size: 1.1rem;
  margin: 0 0 12px;
  text-align: center;
}

.video-wrap {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

#camera {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 14px auto;
  max-width: 640px;
}

button {
  font-size: 1rem;
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  background: #2b6cff;
  color: white;
  min-width: 96px;
}

button:disabled {
  background: #555;
  color: #999;
}

.status {
  color: #aaa;
  font-size: 0.9rem;
}

.params {
  max-width: 640px;
  margin: 0 auto;
  background: #1c1c1e;
  border-radius: 12px;
  padding: 14px 16px;
}

.params-title {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: #aaa;
}

.slider-row {
  display: block;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: #ddd;
}

.slider-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.slider-line input[type="range"] {
  flex: 1;
  height: 32px;
}

.value {
  width: 3.5em;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #6b8afd;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.checkbox-row input {
  width: 20px;
  height: 20px;
}

.advanced {
  margin-top: 10px;
  border-top: 1px solid #333;
  padding-top: 10px;
}

.advanced summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 10px;
}

.advanced[open] summary {
  margin-bottom: 14px;
}

.note {
  max-width: 640px;
  margin: 14px auto 0;
  font-size: 0.8rem;
  color: #888;
  text-align: center;
}

.dim-btn {
  display: block;
  width: 100%;
  background: #333;
  margin-top: 4px;
}

.dim-btn:disabled {
  background: #2a2a2a;
  color: #777;
}

.dim-note {
  margin-top: 8px;
  text-align: left;
}

.dim-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  font-size: 0.9rem;
  line-height: 1.6;
  z-index: 1000;
}

.dim-overlay[hidden] {
  display: none;
}
