/* CaptionCraft Studio — design tokens (shared with the marketing site) */
:root {
  --navy: #0b1220;
  --violet: #7c3aed;
  --cyan: #06b6d4;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --danger: #dc2626;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}
a { color: var(--violet); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

/* Top bar */
.topbar {
  background: var(--navy);
  color: #fff;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.topbar .brand { font-weight: 800; font-size: 1.15rem; text-decoration: none; color: #fff; }
.topbar .brand span { color: var(--cyan); }
.topbar nav { display: flex; gap: 1rem; margin-left: auto; }
.topbar nav a { color: #cbd5e1; text-decoration: none; font-size: 0.95rem; }
.topbar nav a:hover { color: #fff; }
.topbar nav a.active { color: #fff; font-weight: 600; }

.studio {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}
.studio h1 { font-size: 1.9rem; margin: 0.25rem 0 0.5rem; }
.studio h2 { font-size: 1.25rem; margin: 2rem 0 0.75rem; }
.lede { color: var(--muted); max-width: 70ch; margin: 0 0 1.5rem; }
.privacy-note {
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}

/* Buttons */
.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.6rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  text-decoration: none;
}
.btn-primary { background: var(--violet); color: #fff; }
.btn-primary:hover { background: #6d28d9; }
.btn-primary:disabled { background: #c4b5fd; cursor: not-allowed; }
.btn-secondary { background: var(--navy); color: #fff; }
.btn-secondary:disabled { background: #94a3b8; cursor: not-allowed; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--violet); color: var(--violet); }
.btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-small { padding: 0.35rem 0.6rem; font-size: 0.85rem; }

/* Upload */
.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  background: var(--bg-soft);
}
.dropzone:hover, .dropzone.dragging { border-color: var(--violet); background: #f5f3ff; }
.dropzone:focus { outline: 3px solid var(--cyan); outline-offset: 2px; }
.dropzone .big { font-size: 2rem; }
.file-info { margin-top: 0.75rem; font-size: 0.95rem; }
.file-info strong { display: block; }

/* Video + overlay */
.video-wrap {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  max-width: 860px;
}
.video-wrap video { display: block; width: 100%; max-height: 480px; }
.caption-overlay {
  position: absolute;
  left: 0; right: 0;
  bottom: 7%;
  text-align: center;
  padding: 0 8%;
  pointer-events: none;
  font-weight: 700;
  line-height: 1.3;
  z-index: 2;
}
.caption-overlay.style-karaoke {
  color: #fff;
  font-size: clamp(1.1rem, 3.2vw, 1.9rem);
  text-shadow: 0 2px 4px rgba(0,0,0,.9), 0 0 2px #000;
}
.caption-overlay.style-karaoke .kw { opacity: .55; transition: opacity .12s; }
.caption-overlay.style-karaoke .kw-spoken { opacity: .95; color: #e2e8f0; }
.caption-overlay.style-karaoke .kw-active { opacity: 1; color: #22d3ee; }
.caption-overlay.style-bold {
  color: #fff;
  font-size: clamp(1.25rem, 3.6vw, 2.1rem);
  text-transform: uppercase;
  letter-spacing: .02em;
  -webkit-text-stroke: 1px #000;
  text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 0 4px 8px rgba(0,0,0,.7);
}
.caption-overlay.style-minimal {
  color: #fff;
  font-size: clamp(0.95rem, 2.4vw, 1.25rem);
  font-weight: 500;
}
.caption-overlay.style-minimal::before {
  content: "";
  display: block;
}
.caption-overlay.style-pop {
  color: #fff;
  font-size: clamp(1.15rem, 3.4vw, 2rem);
  text-shadow: 0 2px 6px rgba(0,0,0,.85);
}
.caption-overlay.style-pop .pop-word { display: inline-block; opacity: .6; }
.caption-overlay.style-pop .pop-active { opacity: 1; color: #fde047; animation: pop .25s ease-out; }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
/* Minimal style gets its dark bar via a wrapper span in the overlay text node */
.caption-overlay.style-minimal { background: linear-gradient(transparent, rgba(11,18,32,.0)); }
.caption-overlay.style-minimal:not(:empty) { padding-top: .4rem; padding-bottom: .4rem; }

.progress-wrap { margin-top: 1rem; }
.progress-track { height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--violet), var(--cyan)); transition: width .3s; }
.progress-label { font-size: 0.9rem; color: var(--muted); margin-top: 0.35rem; }
.status { margin-top: 1rem; padding: 0.75rem 1rem; border-radius: 8px; background: var(--bg-soft); border: 1px solid var(--line); }
.status.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.usage { font-size: 0.9rem; color: var(--muted); margin-top: 0.75rem; }

/* Style picker */
.style-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.75rem; }
.style-card {
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem;
  background: #fff;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
}
.style-card:hover { border-color: var(--violet); }
.style-card.active { border-color: var(--violet); background: #f5f3ff; }
.style-card strong { display: block; margin-bottom: 0.25rem; }
.style-card p { margin: 0; font-size: 0.875rem; color: var(--muted); }
.style-demo { font-weight: 800; font-size: 1.05rem; margin-bottom: 0.5rem; color: var(--navy); }
.style-card[data-style="bold"] .style-demo { text-transform: uppercase; text-shadow: 1px 1px 0 #000; color: #fff; background: var(--navy); padding: 0.15rem 0.4rem; display: inline-block; }
.style-card[data-style="minimal"] .style-demo { font-weight: 500; background: rgba(11,18,32,.8); color: #fff; padding: 0.15rem 0.5rem; display: inline-block; font-size: 0.9rem; }
.style-card[data-style="pop"] .style-demo { color: var(--violet); }
.style-card[data-style="karaoke"] .style-demo .on { color: var(--cyan); }

/* Editor */
.project-bar { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.75rem; }
.project-bar input {
  flex: 1; min-width: 200px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line); border-radius: 8px;
  font-family: var(--font); font-size: 0.95rem;
}
.segment {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  background: #fff;
}
.segment-head { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.5rem; }
.segment-head label { font-size: 0.85rem; color: var(--muted); display: flex; gap: 0.3rem; align-items: center; }
.segment-head input { width: 5.5rem; padding: 0.35rem 0.5rem; border: 1px solid var(--line); border-radius: 6px; font-family: var(--font); }
.segment-index { font-weight: 700; color: var(--violet); }
.seg-text {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line); border-radius: 8px;
  font-family: var(--font); font-size: 1rem; resize: vertical;
}
.word-chips { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.5rem; align-items: center; }
.word-chip {
  border: 1px solid var(--line); background: var(--bg-soft);
  border-radius: 999px; padding: 0.2rem 0.6rem;
  font-size: 0.85rem; cursor: pointer; font-family: var(--font);
}
.word-chip:hover { border-color: var(--violet); color: var(--violet); }

/* Export / Pro / History */
.export-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }
.pro-box {
  border: 2px solid var(--violet);
  border-radius: 12px;
  padding: 1.25rem;
  background: #f5f3ff;
  margin-top: 2rem;
}
.pro-box h2 { margin-top: 0; }
.history-row {
  display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 0.6rem 0.75rem; margin-bottom: 0.5rem;
}
.history-main { flex: 1; min-width: 200px; }
.history-main strong { display: block; }
.history-main span { font-size: 0.875rem; }
.footer { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; }
@media (max-width: 640px) {
  .studio h1 { font-size: 1.5rem; }
  .topbar nav { margin-left: 0; }
}
