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

[hidden] { display: none !important; }

body {
  background: #0b0b0f;
  color: #e8e6e1;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid #1d1d26;
}
.brand { font-size: 17px; font-weight: 700; letter-spacing: 0.04em; color: #e8e6e1; text-decoration: none; }
.brand span { color: #d4a94e; }
.brand em { font-style: normal; font-weight: 500; color: #8a8794; margin-left: 6px; }
.ffmpeg-note { font-size: 12px; color: #c98a3d; }

main {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: #111118;
  border: 1px solid #1f1f29;
  border-radius: 16px;
  padding: 22px;
}

h2 { font-size: 17px; font-weight: 650; }

.embed-banner {
  background: #2b2113;
  border: 1px solid #4a3a1c;
  border-radius: 12px;
  color: #d4a94e;
  font-size: 13.5px;
  padding: 12px 16px;
  line-height: 1.6;
}
.embed-banner a { color: #e0b95f; font-weight: 700; margin: 0 4px; }

/* Preview */
.preview-wrap {
  position: relative;
  background: #08080b;
  border: 1px solid #1f1f29;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
#preview { width: 100%; height: 100%; object-fit: contain; }
.placeholder { text-align: center; color: #8a8794; font-size: 14px; line-height: 1.7; padding: 20px; }
.placeholder strong { color: #d4a94e; }
.placeholder-icon { font-size: 40px; margin-bottom: 10px; color: #2e2e3a; }
.rec-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 10, 14, 0.85);
  border: 1px solid #2b2b36;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.rec-badge .dot { width: 9px; height: 9px; border-radius: 50%; background: #e5484d; animation: pulse 1.2s infinite; }
.rec-badge.paused .dot { background: #c98a3d; animation: none; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Controls */
.controls { display: flex; flex-direction: column; gap: 14px; }
#titleInput {
  width: 100%;
  background: #0b0b0f;
  border: 1px solid #2b2b36;
  border-radius: 10px;
  color: #e8e6e1;
  font-size: 14px;
  padding: 11px 14px;
  outline: none;
  font-family: inherit;
}
#titleInput:focus { border-color: #d4a94e; }
.toggles { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.toggle { display: flex; align-items: center; gap: 7px; font-size: 14px; color: #b8b5c0; cursor: pointer; user-select: none; }
.toggle input { accent-color: #d4a94e; width: 15px; height: 15px; cursor: pointer; }
.dev-group { display: flex; align-items: center; gap: 8px; }
.dev-select {
  background: #0b0b0f;
  border: 1px solid #2b2b36;
  border-radius: 8px;
  color: #b8b5c0;
  font-size: 12.5px;
  font-family: inherit;
  padding: 5px 8px;
  max-width: 190px;
  cursor: pointer;
  text-overflow: ellipsis;
}
.dev-select:hover, .dev-select:focus { border-color: #d4a94e; outline: none; }
.dev-select:disabled { opacity: 0.4; cursor: not-allowed; }
.main-buttons { display: flex; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid #2b2b36;
  background: #15151c;
  color: #e8e6e1;
  transition: all 0.15s;
}
.btn:hover { border-color: #d4a94e; color: #d4a94e; }
.btn.gold { background: #d4a94e; border-color: #d4a94e; color: #14120a; }
.btn.gold:hover { background: #e0b95f; color: #14120a; }
.btn.danger { background: #3a1518; border-color: #5c2126; color: #f2a9ad; }
.btn.danger:hover { border-color: #e5484d; color: #ff8f94; }
.btn.big { padding: 13px 26px; font-size: 15px; }
.btn.small { padding: 6px 12px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.status { font-size: 13px; color: #8a8794; min-height: 18px; }
.status.error { color: #f2a9ad; }
.status .local-save { color: #d4a94e; font-weight: 600; margin-left: 4px; }

/* Share card */
.share-card h2 { margin-bottom: 14px; }
.share-row { display: flex; gap: 10px; flex-wrap: wrap; }
#shareLink {
  flex: 1;
  min-width: 220px;
  background: #0b0b0f;
  border: 1px solid #2b2b36;
  border-radius: 10px;
  color: #d4a94e;
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.share-note { font-size: 12.5px; color: #8a8794; margin-top: 10px; }

/* Library */
.lib-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.empty { color: #57545f; font-size: 14px; padding: 8px 2px; }
.item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #0d0d13;
  border: 1px solid #1d1d26;
  border-radius: 12px;
  padding: 12px 14px;
}
.item .thumb {
  width: 84px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: #000;
  border: 1px solid #22222c;
  flex-shrink: 0;
}
.item .thumb.blank { display: flex; align-items: center; justify-content: center; color: #2e2e3a; font-size: 20px; }
.item .info { flex: 1; min-width: 0; }
.item .title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sub { font-size: 12.5px; color: #8a8794; margin-top: 2px; }
.item .chip {
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 9px;
  margin-left: 8px;
  vertical-align: 1px;
}
.chip.processing { background: #2b2113; color: #d4a94e; }
.chip.mp4 { background: #12281a; color: #6fcf8f; }
.chip.webm { background: #1c1c26; color: #8a8794; }
.item .actions { display: flex; gap: 8px; flex-shrink: 0; }

footer { text-align: center; padding: 22px; color: #57545f; font-size: 13px; border-top: 1px solid #1d1d26; }

@media (max-width: 640px) {
  .item .thumb { display: none; }
  .main-buttons { flex-direction: column; }
}
