:root {
  --bg: #0b0f14;
  --panel: #141b23;
  --text: #e8eef4;
  --muted: #93a2b1;
  --accent: #3b82f6;
  --danger: #ef4444;
  --border: #232d38;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabs {
  display: flex;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.tab {
  flex: 1;
  padding: 14px 8px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.badge {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  font-size: 11px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
}

main {
  flex: 1;
  overflow-y: auto;
}

.view {
  display: none;
  padding: 16px;
}

.view.active {
  display: block;
}

.camera-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
}

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

.rec-indicator {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0,0,0,0.55);
  padding: 6px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rec-indicator .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

.perm-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  color: var(--muted);
  background: rgba(0,0,0,0.3);
}

.hidden { display: none !important; }

.controls {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.btn {
  flex: 1;
  padding: 14px;
  border-radius: 10px;
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.btn.primary { background: var(--accent); color: white; }
.btn.danger { background: var(--danger); color: white; }
.btn.ghost { background: var(--panel); color: var(--text); border: 1px solid var(--border); flex: 0 0 auto; }
.btn.small { padding: 8px 14px; font-size: 13px; }

.status {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  min-height: 18px;
  text-align: center;
}

.storage-bar-wrap { margin-bottom: 12px; }

.storage-bar {
  width: 100%;
  height: 8px;
  background: var(--panel);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.storage-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.3s;
}

.storage-fill.full { background: var(--danger); }

.storage-label {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.clips-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.clip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.clip-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.clip-info {
  flex: 1;
  min-width: 0;
}

.clip-info .ts {
  font-weight: 600;
  font-size: 14px;
}

.clip-info .meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.clip-buttons {
  display: flex;
  gap: 6px;
}

.icon-btn {
  background: #1c2530;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}

.icon-btn.delete { color: var(--danger); }

.empty-state {
  display: none;
  text-align: center;
  color: var(--muted);
  margin-top: 40px;
}

.empty-state.show { display: block; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.setting-row label {
  font-size: 14px;
}

.setting-row select,
.setting-row input {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  width: 130px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 14px;
  line-height: 1.5;
}

.hint.warn {
  color: #f0b429;
}

.player-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.player-box {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.player-box video {
  width: 100%;
  border-radius: 10px;
  background: black;
}
