:root {
  --ink: #102223;
  --muted: #607071;
  --paper: #f4f7f2;
  --white: #fff;
  --mint: #b9ff62;
  --mint-dark: #74c623;
  --lilac: #c7b8ff;
  --coral: #ff9d7d;
  --line: #dce5de;
  --danger: #b74135;
  --shadow: 0 24px 70px rgba(20, 49, 42, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 4% 12%, rgba(199,184,255,.25), transparent 26rem),
    radial-gradient(circle at 96% 30%, rgba(185,255,98,.16), transparent 28rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(116,198,35,.3);
  outline-offset: 2px;
}

.topbar, main, footer { width: min(1460px, calc(100% - 36px)); margin-inline: auto; }
.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 1.22rem;
  font-weight: 950;
  letter-spacing: -.04em;
}
.brand-mark {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--ink);
  color: var(--mint);
  transform: rotate(-3deg);
}
.nav { display: flex; align-items: center; gap: 26px; color: #425354; font-size: .9rem; font-weight: 800; }
.nav a { text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"] { padding-bottom: 4px; border-bottom: 3px solid var(--mint-dark); }
.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.68);
  color: #425354;
  font-size: .77rem;
  font-weight: 850;
}
.privacy-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #68c72f; box-shadow: 0 0 0 4px rgba(104,199,47,.13); }

main { padding: 38px 0 80px; }
.studio-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 28px;
}
.eyebrow {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.7);
  color: #536665;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: .67rem;
  font-weight: 900;
}
.eyebrow b { padding: 3px 6px; border-radius: 6px; background: var(--mint); color: #29400e; }
.studio-heading h1 { margin: 14px 0 8px; font-size: clamp(2.8rem, 6vw, 5.6rem); line-height: .92; letter-spacing: -.075em; }
.studio-heading h1 span { position: relative; z-index: 0; white-space: nowrap; }
.studio-heading h1 span::after { content: ""; position: absolute; z-index: -1; height: .22em; inset: auto -.03em .04em; border-radius: 50%; background: var(--mint); transform: rotate(-1deg); }
.studio-heading p { max-width: 710px; margin: 0; color: var(--muted); line-height: 1.6; font-size: 1rem; }
.project-actions { min-width: 420px; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 9px; }
.project-name { grid-column: 1 / -1; }
.project-name span, .dialog-card > label { display: grid; gap: 7px; color: var(--muted); font-size: .72rem; font-weight: 850; }
.project-name input, .dialog-card input, .dialog-card select, .dialog-card textarea {
  width: 100%;
  border: 1px solid #ccd8ce;
  border-radius: 12px;
  padding: 11px 13px;
  background: white;
  color: var(--ink);
  outline: none;
}
.save-state { align-self: center; color: #6c7b79; font-size: .72rem; }

.button {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 900;
  transition: .17s ease;
  white-space: nowrap;
}
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--ink); color: white; box-shadow: 0 8px 18px rgba(16,34,35,.14); }
.button.primary:hover { background: #203738; }
.button.secondary { background: white; border: 1px solid var(--line); }
.button.compact { padding: 9px 12px; font-size: .76rem; }
.button.danger-text { color: var(--danger); }

.workspace {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  min-height: 700px;
  border: 1px solid #d7e1d9;
  border-radius: 26px;
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(14px);
}
.media-panel { padding: 21px; background: #eef2ec; border-right: 1px solid var(--line); }
.panel-title { display: flex; align-items: end; justify-content: space-between; gap: 15px; margin-bottom: 14px; }
.kicker { color: #71807e; text-transform: uppercase; letter-spacing: .13em; font-size: .62rem; font-weight: 950; }
.panel-title h2, .dialog-head h2 { margin: 4px 0 0; font-size: 1.08rem; letter-spacing: -.03em; }
.text-button { padding: 4px 0; border: 0; background: transparent; color: #3f6330; cursor: pointer; font-size: .74rem; font-weight: 900; }
.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 16px;
  background: #102223;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.07);
}
.stage video { display: none; width: 100%; height: 100%; object-fit: contain; background: #0b1516; }
.stage.has-media video { display: block; }
.empty-stage { display: grid; justify-items: center; gap: 6px; color: #dbe5e1; text-align: center; padding: 20px; }
.stage.has-media .empty-stage { display: none; }
.empty-stage small { color: #8fa09e; font-size: .66rem; }
.empty-icon { width: 45px; height: 45px; display: grid; place-items: center; border-radius: 14px; background: var(--mint); color: var(--ink); padding-left: 3px; }
.subtitle-preview {
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: 9%;
  display: none;
  color: white;
  font-size: 25px;
  font-weight: 800;
  line-height: 1.22;
  text-align: center;
  white-space: pre-line;
  text-shadow: 0 2px 4px #000, 0 0 8px #000;
  pointer-events: none;
}
.subtitle-preview.visible { display: block; }
.safe-area { position: absolute; inset: 10%; display: none; border: 1px dashed rgba(185,255,98,.7); pointer-events: none; }
.safe-area.visible { display: block; }
.transport { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 10px; }
.transport button, .sync-actions button {
  border: 1px solid #d8e1da;
  border-radius: 9px;
  background: white;
  cursor: pointer;
  padding: 8px 4px;
  font-size: .66rem;
  font-weight: 850;
}
.transport .play-toggle { background: var(--ink); color: white; }
.time-readout { display: flex; justify-content: space-between; margin: 9px 2px 0; color: #758381; font: 700 .66rem ui-monospace, SFMono-Regular, Consolas, monospace; }
.sync-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 14px; }
.sync-actions kbd { display: inline-grid; place-items: center; min-width: 20px; padding: 2px 4px; border-radius: 5px; background: #edf1ed; font: 900 .6rem ui-monospace, monospace; }
.display-options { display: grid; gap: 10px; margin-top: 16px; padding: 14px 0; border-block: 1px solid #d8e1d9; color: #5b6d6b; font-size: .68rem; font-weight: 800; }
.display-options label { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.display-options input[type="range"] { width: 130px; accent-color: var(--mint-dark); }
.health-card { margin-top: 16px; padding: 16px; border-radius: 15px; background: white; border: 1px solid var(--line); }
.health-head { display: flex; justify-content: space-between; font-size: .75rem; }
.health-head span { color: #52851f; font-weight: 950; }
.health-track { height: 7px; overflow: hidden; border-radius: 99px; background: #e6ece6; margin: 10px 0 13px; }
.health-track span { display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--mint-dark); transition: width .2s; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; color: #788583; text-align: center; font-size: .58rem; }
.mini-stats b { display: block; color: var(--ink); font-size: .9rem; }

.editor-panel { min-width: 0; display: flex; flex-direction: column; padding: 18px; }
.editor-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding-bottom: 13px; }
.tool-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 10px; background: white; cursor: pointer; font-size: 1.1rem; font-weight: 900; }
.icon-button:disabled { opacity: .35; cursor: default; }
.find-bar { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(130px, 1fr) auto auto; gap: 7px; align-items: center; padding: 10px; border-radius: 13px; background: #f1f4ef; }
.find-bar input { width: 100%; padding: 9px 11px; border: 1px solid #d6dfd7; border-radius: 9px; outline: none; font-size: .78rem; }
.find-bar span { color: #758280; font-size: .68rem; }
.find-bar button { padding: 8px 10px; border: 0; border-radius: 8px; background: white; cursor: pointer; font-size: .69rem; font-weight: 900; }
.column-head, .cue-row {
  display: grid;
  grid-template-columns: 36px 126px 126px minmax(250px, 1fr) 80px 84px;
  gap: 8px;
  align-items: center;
}
.column-head { padding: 14px 10px 8px; color: #7a8785; text-transform: uppercase; letter-spacing: .07em; font-size: .58rem; font-weight: 950; }
.cue-list { max-height: 570px; overflow: auto; padding: 0 3px 8px 0; scroll-behavior: smooth; }
.cue-row {
  margin-bottom: 7px;
  padding: 9px 8px;
  border: 1px solid #e0e6e0;
  border-radius: 13px;
  background: #fbfcfa;
  transition: .15s ease;
}
.cue-row:hover { border-color: #c9d5cb; }
.cue-row.active { border-color: #88c94b; background: #f8fff1; box-shadow: 0 0 0 3px rgba(116,198,35,.1); }
.cue-row.match { background: #fff9dc; }
.cue-row.has-issue { border-left: 4px solid var(--coral); }
.cue-index {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: #edf1ec;
  cursor: pointer;
  font-weight: 950;
  font-size: .72rem;
}
.time-input, .speaker-input {
  width: 100%;
  border: 1px solid #d4ded6;
  border-radius: 9px;
  background: white;
  padding: 9px 8px;
  color: var(--ink);
  font: 750 .7rem ui-monospace, SFMono-Regular, Consolas, monospace;
  text-align: center;
  outline: none;
}
.time-input.invalid { color: var(--danger); border-color: var(--coral); background: #fff5f1; }
.cue-copy { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 6px; }
.speaker-input { font-family: inherit; text-align: left; }
.cue-text {
  width: 100%;
  min-height: 56px;
  max-height: 150px;
  resize: vertical;
  border: 1px solid #d4ded6;
  border-radius: 9px;
  padding: 9px 10px;
  background: white;
  color: var(--ink);
  line-height: 1.35;
  font-size: .82rem;
  outline: none;
}
.reading { display: grid; gap: 4px; text-align: center; font-size: .61rem; color: #788582; }
.reading strong { color: #3c6b1f; font-size: .76rem; }
.reading.warn strong { color: #c15c2f; }
.reading.bad strong { color: var(--danger); }
.row-actions { display: flex; justify-content: end; gap: 3px; }
.row-actions button { width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; color: #647472; }
.row-actions button:hover { background: #edf1ed; color: var(--ink); }
.row-actions .delete:hover { background: #fff0ec; color: var(--danger); }
.issue-note { grid-column: 2 / -1; margin: -3px 0 0; color: #a74b32; font-size: .62rem; }
.editor-footer { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding-top: 8px; color: #788582; font-size: .65rem; }
.add-wide { padding: 10px 14px; border: 1px dashed #aebdb1; border-radius: 10px; background: transparent; cursor: pointer; color: #45613e; font-size: .73rem; font-weight: 900; }

.workflow-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 74px 0 22px; }
.workflow-grid article { padding: 25px; border: 1px solid rgba(16,34,35,.08); border-radius: 22px; }
.workflow-grid article:nth-child(1) { background: #dfffba; }
.workflow-grid article:nth-child(2) { background: #dcd4ff; }
.workflow-grid article:nth-child(3) { background: #ffd8cb; }
.workflow-grid span { font-size: .66rem; font-weight: 950; letter-spacing: .12em; opacity: .55; }
.workflow-grid h2 { margin: 34px 0 8px; font-size: 1.2rem; letter-spacing: -.04em; }
.workflow-grid p { margin: 0; color: rgba(16,34,35,.68); font-size: .8rem; line-height: 1.55; }
footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 28px 0 38px; border-top: 1px solid var(--line); color: var(--muted); font-size: .77rem; }

dialog { width: min(520px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 22px; box-shadow: 0 24px 90px rgba(16,34,35,.28); }
dialog::backdrop { background: rgba(16,34,35,.55); backdrop-filter: blur(4px); }
.dialog-card { display: grid; gap: 16px; padding: 24px; }
.dialog-card.wide-dialog { width: min(720px, 100%); }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.dialog-close { width: 34px; height: 34px; border: 0; border-radius: 10px; background: #eff2ee; cursor: pointer; font-size: 1.3rem; }
.dialog-copy { margin: -6px 0 0; color: var(--muted); font-size: .8rem; }
.check-row { display: flex !important; grid-template-columns: auto 1fr; align-items: center; }
.check-row input { width: auto; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 3px; }
.inline-fields { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 9px; }
.inline-fields label { display: grid; gap: 6px; color: var(--muted); font-size: .67rem; font-weight: 850; }
.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 24px;
  width: min(470px, calc(100% - 28px));
  transform: translate(-50%, 28px);
  padding: 13px 16px;
  border-radius: 13px;
  background: var(--ink);
  color: white;
  box-shadow: 0 18px 40px rgba(16,34,35,.27);
  opacity: 0;
  pointer-events: none;
  transition: .23s ease;
  font-size: .78rem;
  font-weight: 800;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 1050px) {
  .studio-heading { align-items: start; flex-direction: column; }
  .project-actions { width: 100%; min-width: 0; grid-template-columns: 1fr auto auto; }
  .project-name { grid-column: auto; }
  .save-state { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .media-panel { display: grid; grid-template-columns: minmax(280px, 440px) 1fr; gap: 0 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .panel-title, .stage, .transport, .time-readout { grid-column: 1; }
  .sync-actions, .display-options, .health-card { grid-column: 2; }
  .sync-actions { grid-row: 1 / span 2; align-content: end; }
  .display-options { grid-row: 3; }
  .health-card { grid-row: 4 / span 2; }
}
@media (max-width: 760px) {
  .topbar, main, footer { width: min(100% - 24px, 1460px); }
  .nav { display: none; }
  .privacy-pill { font-size: 0; padding: 11px; }
  main { padding-top: 24px; }
  .studio-heading h1 { font-size: clamp(3rem, 14vw, 4.6rem); }
  .project-actions { grid-template-columns: 1fr 1fr; }
  .project-name { grid-column: 1 / -1; }
  .workspace { border-radius: 18px; }
  .media-panel { display: block; padding: 15px; }
  .editor-panel { padding: 12px; }
  .editor-toolbar { align-items: start; flex-direction: column; }
  .find-bar { grid-template-columns: 1fr 1fr; }
  .column-head { display: none; }
  .cue-list { max-height: none; }
  .cue-row { grid-template-columns: 35px 1fr 1fr 66px; gap: 7px; }
  .cue-index { grid-column: 1; }
  .time-input[data-field="start"] { grid-column: 2; }
  .time-input[data-field="end"] { grid-column: 3; }
  .cue-copy { grid-column: 1 / -1; grid-row: 2; grid-template-columns: 86px 1fr; }
  .reading { grid-column: 4; grid-row: 1; }
  .row-actions { grid-column: 1 / -1; justify-content: end; }
  .issue-note { grid-column: 1 / -1; }
  .workflow-grid { grid-template-columns: 1fr; }
  .editor-footer, footer { align-items: start; flex-direction: column; }
  .inline-fields { grid-template-columns: 1fr; }
}
@media (max-width: 460px) {
  .project-actions { grid-template-columns: 1fr; }
  .project-name { grid-column: auto; }
  .find-bar { grid-template-columns: 1fr; }
  .cue-copy { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
