/* =====================================================================
   RETROLENS — Retro sci-fi, kamera ke panel kontrol
   ===================================================================== */
:root {
  --bg: #070510;
  --panel: #100b1f;
  --panel-2: #170f2e;
  --cyan: #00f0ff;
  --magenta: #ff2dd7;
  --yellow: #ffe600;
  --green: #39ff88;
  --red: #ff3b5c;
  --text: #e8e6f5;
  --dim: #8d87a8;
  --border: rgba(139, 92, 246, 0.22);
}

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

html, body { height: 100%; }

body {
  font-family: 'Share Tech Mono', monospace;
  background:
    radial-gradient(1200px 800px at 80% -10%, rgba(255, 45, 215, 0.08), transparent 60%),
    radial-gradient(1000px 700px at -10% 110%, rgba(0, 240, 255, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  overflow: hidden;
}

.app {
  height: 100vh;
  height: 100dvh; /* mobile: hindari terpotong oleh address bar */
  display: flex;
  gap: 14px;
  padding: 14px;
  min-height: 0;
}

/* ============================ STAGE / KAMERA ============================ */
.stage {
  position: relative;
  flex: 1;
  min-width: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(139, 92, 246, 0.12),
    inset 0 0 80px rgba(0, 0, 0, 0.5);
}

.stage::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 240, 255, 0.05), transparent 30%, transparent 70%, rgba(255, 45, 215, 0.05));
  pointer-events: none;
  z-index: 3;
}

.stage::after {
  content: '● REC';
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 6;
  color: var(--red);
  font-size: 12px;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(255, 59, 92, 0.8);
  animation: pulse 2s infinite;
  pointer-events: none;
}

#video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* tersembunyi: preview di-render di #overlay (mirror + portal) */
  visibility: hidden;
}

/* ============================ BAR INFO ============================ */
.info-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(7, 5, 16, 0.82);
  border-top: 1px solid rgba(139, 92, 246, 0.25);
  backdrop-filter: blur(6px);
  font-family: 'Share Tech Mono', monospace;
  pointer-events: none;
}

.info-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 4px;
  border-right: 1px solid rgba(139, 92, 246, 0.15);
}

.info-item:last-child { border-right: none; }

.info-k {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--dim);
}

.info-v {
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
}

.info-v.warn { color: var(--yellow); text-shadow: 0 0 8px rgba(255, 230, 0, 0.5); }

#infoDev { color: var(--magenta); text-shadow: 0 0 8px rgba(255, 45, 215, 0.5); }

#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

/* Scanlines + vignette */
.scanlines {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.12) 0px,
    rgba(0, 0, 0, 0.12) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.45;
  mix-blend-mode: multiply;
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

/* ============================ SPLASH ============================ */
.splash {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1b1233 0%, #0a0616 70%, #050310 100%);
}

.splash-inner {
  text-align: center;
  max-width: 520px;
  padding: 24px;
}

.logo {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: clamp(44px, 6vw, 72px);
  letter-spacing: 6px;
  color: #fff;
  text-shadow: 0 0 12px var(--cyan), 0 0 40px var(--cyan), 4px 4px 0 var(--magenta);
}

.logo.small {
  font-size: 20px;
  letter-spacing: 3px;
  text-shadow: 0 0 8px var(--cyan), 2px 2px 0 var(--magenta);
}

.logo span { color: var(--cyan); }

.tagline {
  margin: 14px 0 26px;
  color: var(--dim);
  letter-spacing: 6px;
  font-size: 12px;
}

.btn-primary {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 3px;
  padding: 16px 34px;
  border-radius: 12px;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.06);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.15), inset 0 0 20px rgba(0, 240, 255, 0.05);
  text-transform: uppercase;
}

.btn-primary:hover {
  background: var(--cyan);
  color: #06030f;
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.5);
  transform: translateY(-2px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: wait;
  transform: none;
}

.splash-note {
  margin-top: 16px;
  color: var(--dim);
  font-size: 13px;
}

.splash-hint {
  margin-top: 28px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--dim);
  font-size: 13px;
  line-height: 1.7;
}

.splash-hint b { color: var(--cyan); }

.hidden { display: none !important; }

.loader-ring {
  width: 56px;
  height: 56px;
  margin: 0 auto 22px;
  border-radius: 50%;
  border: 3px solid rgba(0, 240, 255, 0.15);
  border-top-color: var(--cyan);
  animation: spin 1s linear infinite;
}

.loading-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 18px;
  letter-spacing: 3px;
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.5);
}

/* ============================ PANEL ============================ */
.panel {
  width: 340px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, var(--panel), var(--bg));
  border: 1px solid var(--border);
  position: relative;
  /* panel boleh scroll bila layar pendek — tombol tidak terpotong */
  max-height: 100%;
  overflow-y: auto;
}

.panel::-webkit-scrollbar { width: 6px; }
.panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status {
  font-size: 11px;
  letter-spacing: 2px;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--red);
  color: var(--red);
  background: rgba(255, 59, 92, 0.08);
  animation: pulse 2s infinite;
}

.status.on {
  border-color: var(--green);
  color: var(--green);
  background: rgba(57, 255, 136, 0.08);
  animation: none;
}

.status.on::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 6px;
  animation: pulse 1.5s infinite;
}

/* ============================ SLOT FILTER ============================ */
.section-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--dim);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ============================ SLOT SELECTOR ============================ */
.slot-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.slot-sel {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.5px;
  padding: 8px 2px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--dim);
  cursor: pointer;
  transition: all 0.15s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: uppercase;
}

.slot-sel:hover { border-color: var(--cyan); color: var(--text); }

.slot-sel.active {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.1);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

.slot-sel.filled { color: var(--yellow); border-color: rgba(255, 230, 0, 0.3); }

/* ============================ NAMA FILTER AKTIF ============================ */
.filter-name {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 24px;
  text-align: center;
  letter-spacing: 2px;
  color: var(--cyan);
  text-shadow: 0 0 14px rgba(0, 240, 255, 0.55);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.filter-name.empty { color: var(--dim); text-shadow: none; font-size: 20px; }

/* ============================ GRID FILTER ============================ */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-height: 34vh;
  overflow-y: auto;
  padding: 2px;
}

.filter-grid::-webkit-scrollbar { width: 6px; }
.filter-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.filter-chip {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.5px;
  padding: 9px 4px;
  text-align: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--dim);
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-chip:hover {
  border-color: var(--cyan);
  color: var(--text);
  transform: translateY(-1px);
}

.filter-chip.used {
  color: var(--yellow);
  border-color: rgba(255, 230, 0, 0.35);
  background: rgba(255, 230, 0, 0.05);
}

.filter-chip.current {
  color: var(--cyan);
  border-color: var(--cyan);
  background: rgba(0, 240, 255, 0.12);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.3);
}

/* ============================ TOMBOL LAIN ============================ */
.clear-btn {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 59, 92, 0.4);
  background: rgba(255, 59, 92, 0.06);
  color: var(--red);
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
}

.clear-btn:hover {
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 14px rgba(255, 59, 92, 0.5);
}

.ctrl-btn {
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  color: var(--cyan);
  width: 46px;
  height: 46px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.ctrl-btn:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.3);
}

/* ============================ KUALITAS ============================ */
.quality-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.q-btn {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 1px;
  padding: 8px 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--dim);
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
}

.q-btn:hover { border-color: var(--cyan); color: var(--text); }

.q-btn.active {
  border-color: var(--green);
  color: var(--green);
  background: rgba(57, 255, 136, 0.08);
  box-shadow: 0 0 10px rgba(57, 255, 136, 0.25);
}

.q-btn:disabled { opacity: 0.4; cursor: wait; }

/* Kontrol */
.controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.ctrl-btn {
  font-family: 'Orbitron', sans-serif;
  font-size: 18px;
  color: var(--cyan);
  width: 46px;
  height: 46px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ctrl-btn.nav:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.3);
  background: rgba(0, 240, 255, 0.08);
}

.ctrl-btn.nav.off {
  color: var(--red);
  border-color: rgba(255, 59, 92, 0.4);
}

.ctrl-btn.nav.off:hover {
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 14px rgba(255, 59, 92, 0.5);
}

/* Ikon play/pause */
.ic-play::before { content: '▶'; font-size: 18px; }
.ic-pause::before { content: '❚❚'; font-size: 18px; letter-spacing: -1px; }

/* Tombol REKAM & FOTO */
.ctrl-btn.rec-btn,
.ctrl-btn.shot-btn {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  flex: 1;
  width: auto;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-transform: uppercase;
}

.ctrl-btn.rec-btn { color: var(--red); border-color: rgba(255, 59, 92, 0.45); }
.ctrl-btn.rec-btn:hover { background: rgba(255, 59, 92, 0.1); }

.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px rgba(255, 59, 92, 0.8);
  flex-shrink: 0;
}

.ctrl-btn.rec-btn.recording {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  box-shadow: 0 0 16px rgba(255, 59, 92, 0.6);
  animation: pulse 1s infinite;
}

.ctrl-btn.rec-btn.recording .rec-dot {
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
  border-radius: 2px;
  width: 8px;
  height: 8px;
}

.ctrl-btn.shot-btn { color: var(--yellow); border-color: rgba(255, 230, 0, 0.4); }
.ctrl-btn.shot-btn:hover { background: rgba(255, 230, 0, 0.1); }

.shot-ic { font-size: 16px; }

/* Hint / legenda */
.hint {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hint-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--dim);
  font-size: 12px;
}

.kbd {
  flex-shrink: 0;
  min-width: 128px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 1px;
  padding: 4px 8px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--yellow);
}

/* ============================ FLASH MESSAGE ============================ */
.flash-msg {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  padding: 8px 18px;
  border-radius: 20px;
  border: 1px solid var(--green);
  background: rgba(7, 5, 16, 0.85);
  color: var(--green);
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  letter-spacing: 1px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  box-shadow: 0 0 18px rgba(57, 255, 136, 0.3);
}

.flash-msg.show { opacity: 1; }

/* ============================ ANIMASI ============================ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ============================ RESPONSIF ============================ */
@media (max-width: 860px) {
  .app { flex-direction: column; padding: 8px; gap: 8px; }
  .panel {
    width: 100%;
    max-height: 46vh;
    overflow-y: auto;
    border-radius: 12px;
  }
  .filter-grid { max-height: 26vh; }
  .info-bar { grid-template-columns: repeat(2, 1fr); }
}
