/* Lively for Web — flat design tokens mirrored from the iOS app's FlatTheme.
   Solid fills, hairline borders, no shadows, no gradients (the vignette
   overlay is photographic content, not chrome). */

:root {
  --accent: #FF6B6B;
  --accent-deep: #E85555;
  --amber: #FFB84C;
  --ocean: #3D7DFF;
  --mint: #2ECC9B;
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --surface-2: #EEF0F4;
  --ink: #1B1F27;
  --ink-2: #6B7280;
  --hairline: #E2E5EA;
  --canvas: #14161A;
  --radius: 14px;
  --chip: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1115;
    --surface: #1A1D24;
    --surface-2: #252A33;
    --ink: #F2F4F8;
    --ink-2: #9AA1AD;
    --hairline: #2E333D;
    --canvas: #0A0C0F;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
}
a { color: var(--ocean); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h1, h2 { font-weight: 700; letter-spacing: -0.01em; }

/* ---------- header / intro ---------- */

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
}
.mark { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.mark:hover { text-decoration: none; }
.mark-copy { display: flex; flex-direction: column; line-height: 1.1; }
.mark-copy strong { font-size: 1rem; }
.mark-copy span { font-size: 0.72rem; color: var(--ink-2); }
.top-links { display: flex; gap: 18px; font-size: 0.88rem; font-weight: 600; }
.top-links .quiet { color: var(--ink-2); }

.intro { max-width: 860px; margin: 0 auto; padding: 34px 20px 8px; text-align: center; }
.intro h1 { font-size: clamp(1.5rem, 3.6vw, 2.1rem); margin-bottom: 10px; }
.intro p { color: var(--ink-2); max-width: 640px; margin: 0 auto; font-size: 0.95rem; }

/* ---------- layout ---------- */

.stage-wrap {
  display: flex; flex-wrap: wrap; gap: 28px;
  justify-content: center; align-items: flex-start;
  padding: 26px 16px 40px;
}
.aside { max-width: 330px; padding-top: 6px; }
.aside h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--ink-2); margin: 18px 0 8px; }
.aside h2:first-child { margin-top: 0; }
.aside ul { list-style: none; }
.aside li { margin: 0 0 10px; font-size: 0.9rem; padding-left: 18px; position: relative; }
.aside li::before { content: ""; position: absolute; left: 0; top: 0.5em; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.aside p { font-size: 0.9rem; color: var(--ink-2); }
.aside .aside-foot { margin-top: 16px; font-size: 0.85rem; }

.foot {
  border-top: 1px solid var(--hairline);
  padding: 18px 20px 30px; text-align: center;
  color: var(--ink-2); font-size: 0.85rem; background: var(--surface);
}

/* ---------- the editor "phone" ---------- */

.phone {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 22px;
  overflow: hidden;
  flex-shrink: 0;
}

.editor-top {
  display: grid; grid-template-columns: 40px 1fr 40px; align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
}
.editor-title { text-align: center; font-weight: 600; font-size: 0.95rem; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink);
  transition: transform 0.1s ease;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn.small { width: 30px; height: 30px; flex-shrink: 0; }

/* canvas */

.canvas-well { position: relative; background: var(--canvas); aspect-ratio: 3 / 4; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; }
.vignette { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.live-badge {
  position: absolute; top: 12px; left: 12px;
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--amber); color: #3A2A08;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em;
  padding: 4px 9px; border-radius: 999px;
}
.playhead {
  position: absolute; bottom: 10px; right: 12px;
  font-variant-numeric: tabular-nums;
  font-size: 0.7rem; color: #EAECEF; background: rgba(10, 12, 15, 0.55);
  padding: 3px 8px; border-radius: 999px;
}

/* start overlay */

.start-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 26px; text-align: center;
  background: var(--canvas);
}
.start-tagline { color: #C9CEDA; font-size: 0.9rem; margin-bottom: 6px; }
.start-note { color: #7C8494; font-size: 0.72rem; margin-top: 4px; }

.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px 16px;
  border-radius: var(--radius);
  font-weight: 600; font-size: 0.95rem;
  transition: transform 0.1s ease, opacity 0.1s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--surface-2); color: var(--ink); border: 1px solid var(--hairline); }
.start-overlay .btn-secondary { background: #1E232C; color: #EAECEF; border-color: #333A46; }
.btn-primary:active, .btn-secondary:active { transform: scale(0.97); }
.btn-primary:disabled, .btn-secondary:disabled { opacity: 0.5; cursor: default; }
.btn-primary.compact, .btn-secondary.compact { width: auto; padding: 8px 14px; font-size: 0.85rem; }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }

/* ---------- panel ---------- */

.panel { height: 252px; overflow: hidden; border-top: 1px solid var(--hairline); }
.pane { height: 100%; overflow-y: auto; padding: 12px 14px 16px; }
.pane-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 10px;
}
.pane-head.sub { margin-top: 16px; }
.pane-head h2 {
  font-size: 0.72rem; font-weight: 700; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: 0.09em;
}
.text-btn { color: var(--accent); font-size: 0.8rem; font-weight: 600; }
.text-btn.danger { color: var(--accent); }
.pane-note { font-size: 0.74rem; color: var(--ink-2); margin-top: 10px; }
.pane-note.warn { color: var(--amber); }

/* filter strip */

.filter-strip {
  display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px;
  scrollbar-width: thin;
}
.filter-chip { flex-shrink: 0; width: 64px; text-align: center; }
.filter-chip canvas {
  width: 64px; height: 64px; border-radius: var(--chip);
  background: var(--surface-2);
  border: 2px solid transparent; display: block;
}
.filter-chip.is-active canvas { border-color: var(--accent); }
.filter-chip span {
  display: block; margin-top: 4px;
  font-size: 0.66rem; font-weight: 600; color: var(--ink-2);
}
.filter-chip.is-active span { color: var(--accent); }

/* sliders */

.slider-row {
  display: grid; grid-template-columns: 82px 1fr 52px;
  align-items: center; gap: 10px;
  padding: 7px 0;
}
.slider-row label { font-size: 0.8rem; font-weight: 600; }
.slider-row output {
  font-size: 0.72rem; color: var(--ink-2); text-align: right;
  font-variant-numeric: tabular-nums;
}
.slider-row.disabled { opacity: 0.4; pointer-events: none; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 26px; background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px; background: var(--surface-2);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); margin-top: -7px;
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--surface-2); }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--accent); }

/* audio pane */

.record-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.rec-time { font-variant-numeric: tabular-nums; font-size: 0.8rem; }
.rec-meter { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.rec-meter span { display: block; height: 100%; width: 0%; background: var(--accent); }
.track-title { font-size: 0.84rem; font-weight: 600; margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.wave-well, .film-well {
  position: relative; border-radius: var(--chip); overflow: hidden;
  background: var(--surface-2); height: 64px; margin-bottom: 6px;
}
#waveform { position: absolute; inset: 0; width: 100%; height: 100%; }
.filmstrip { position: absolute; inset: 0; display: flex; }
.filmstrip canvas { flex: 1; height: 100%; min-width: 0; }

/* range selector (two handles) */

.range { position: absolute; inset: 0; }
.range .dim { position: absolute; top: 0; bottom: 0; background: rgba(10, 12, 15, 0.55); }
.range .win { position: absolute; top: 0; bottom: 0; border: 2px solid var(--accent); border-left-width: 12px; border-right-width: 12px; border-radius: 8px; }
.range .grip {
  position: absolute; top: 0; bottom: 0; width: 34px;
  display: flex; align-items: center; justify-content: center;
  touch-action: none; cursor: ew-resize;
}
.range .grip::after { content: ""; width: 3px; height: 18px; border-radius: 2px; background: #fff; }
.range .grip.lo { left: -17px; }
.range .grip.hi { right: -17px; }

.timecodes {
  display: flex; justify-content: space-between;
  font-size: 0.72rem; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.tc-mid { color: var(--ink); font-weight: 600; }

/* export pane */

.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin: 18px 0 10px; }
.progress div { height: 100%; width: 0%; background: var(--accent); transition: width 0.2s linear; }
.export-ok { color: var(--mint); font-weight: 700; margin: 14px 0 10px; }

/* toolbar */

.toolbar {
  display: flex; border-top: 1px solid var(--hairline);
  background: var(--surface);
}
.tool {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 11px; color: var(--ink-2);
}
.tool span { font-size: 0.62rem; font-weight: 600; }
.tool.is-active { color: var(--accent); }
.tool:disabled { opacity: 0.35; }

/* small screens: stack aside under the phone */
@media (max-width: 820px) {
  .aside { max-width: min(400px, 100%); }
}
