:root {
  --glass: rgba(255, 255, 255, 0.2);
  --accent: #ff0055;
}

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

#wrap {
  position: relative;
  background: #000;
  overflow: hidden;
  height: 100vh;
}

@media (max-width: 1023px) {
  #wrap {
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 100svh;
    border-radius: 0;
    border: none;
    margin: 0;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  #wrap {
    height: 100svh;
    max-width: 1200px;
    margin: 0 auto;
    border: 5px solid #333;
  }
}

#cam { display: none; }

#out {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  z-index: 1;
}

#status {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-family: sans-serif;
  font-size: 14px;
  z-index: 20;
  text-align: center;
  background: rgba(0,0,0,0.6);
  padding: 10px 16px;
  border-radius: 10px;
}

.ui-overlay {
  position: absolute;
  top: 0; left: 0;
  z-index: 10;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  pointer-events: none;
  box-sizing: border-box;
}

.ui-overlay button,
.ui-overlay select,
.ui-overlay input { pointer-events: auto; }

.top-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.glass-input {
  background: var(--glass);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  flex: 1;
  padding: 5px;
  display: flex;
  gap: 5px;
}

.format-btn {
  background: transparent;
  border: none;
  color: white;
  flex: 1;
  padding: 8px 4px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.3s;
  white-space: nowrap;
}
.format-btn.active { background: rgba(255,255,255,0.3); }

.secondary-btn {
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  color: white;
  font-size: 20px;
  cursor: pointer;
}

.controls-panel {
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 8px;
  pointer-events: auto;
}

.ctrl-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ctrl-label {
  color: rgba(255,255,255,0.7);
  font-size: 11px;
  width: 90px;
  flex-shrink: 0;
}

input[type=range] {
  -webkit-appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.2);
  outline: none;
  cursor: pointer;
  accent-color: var(--accent);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 4px rgba(0,0,0,0.5);
}
input[type=range]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  border: none;
}

.ctrl-row select {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  padding: 4px 6px;
  cursor: pointer;
  outline: none;
  flex: 1;
}
.ctrl-row select option { background: #222; color: #fff; }

.bottom-controls {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-bottom: 30px;
}

.record-container { text-align: center; }

.record-btn {
  width: 70px; height: 70px;
  border-radius: 50%;
  border: 5px solid white;
  background: transparent;
  position: relative;
  transition: all 0.3s;
  padding: 0;
  cursor: pointer;
}
.record-btn::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 50px; height: 50px;
  background: white;
  border-radius: 50%;
  transition: all 0.3s;
}
.recording .record-btn::after {
  background: var(--accent);
  width: 25px; height: 25px;
  border-radius: 4px;
}

.label {
  color: white;
  display: block;
  font-size: 10px;
  margin-top: 5px;
  font-weight: bold;
  text-align: center;
}

#recTimer {
  color: var(--accent);
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 1px;
  text-align: center;
  min-height: 18px;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}