:root {
  --bg: #f4f4f2;
  --workspace: #e8e8e5;
  --surface: #ffffff;
  --canvas: #080c18;
  --ink: #111827;
  --muted: #6b7280;
  --line: #d8ddd7;
  --accent: #18a66a;
  --accent-soft: rgba(24, 166, 106, 0.12);
  --danger: #c24141;
  --shadow: 0 18px 44px rgba(17, 24, 39, 0.08);
  --drawer: 310px;
  --topbar-height: 56px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.hidden-file-meta,
.hidden-project-actions,
.hidden-export-option,
.hidden-pitch-control {
  display: none !important;
}

.hidden-export-option *,
.hidden-pitch-control * {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body:not(.has-session) {
  overflow: auto;
  color: #f8fafc;
  background:
    linear-gradient(135deg, rgba(45, 227, 154, 0.12), transparent 38%),
    linear-gradient(155deg, #050814 0%, #0a1322 48%, #07110f 100%);
}

body:not(.has-session) .topbar,
body:not(.has-session) .workspace {
  display: none;
}

body:not(.has-session) .app-shell {
  min-height: 0;
  height: 0;
  overflow: visible;
  background: transparent;
}

body.has-session .landing-page {
  display: none;
}

.landing-page {
  min-height: 100vh;
  padding: 24px clamp(18px, 4vw, 58px) 56px;
  color: #f8fafc;
}

.landing-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
}

.landing-brand .brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  color: #04100b;
  background: linear-gradient(135deg, #2de39a, #caffea);
  font-size: 17px;
  box-shadow: 0 18px 50px rgba(45, 227, 154, 0.2);
}

.landing-brand h1 {
  color: #fff;
  font-size: 20px;
}

.landing-brand p {
  color: rgba(248, 250, 252, 0.58);
}

.landing-actions,
.landing-cta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.landing-page .primary-button,
.landing-page .panel-button,
.landing-page .ghost-button {
  min-height: 46px;
  display: inline-grid;
  place-items: center;
  padding: 0 20px;
  border-radius: 999px;
  text-align: center;
  white-space: nowrap;
}

.landing-page .primary-button {
  border: 1px solid rgba(202, 255, 236, 0.7);
  color: #04100b;
  background: linear-gradient(135deg, #2de39a, #caffea);
  box-shadow: 0 18px 44px rgba(45, 227, 154, 0.24);
}

.landing-page .panel-button,
.landing-page .ghost-button {
  border-color: rgba(255, 255, 255, 0.14);
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.075);
}

.landing-main {
  max-width: 1180px;
  margin: 78px auto 0;
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 0.82fr);
  gap: clamp(28px, 5vw, 70px);
  align-items: center;
}

.landing-copy {
  min-width: 0;
}

.landing-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin: 0 0 22px;
  padding: 0 14px;
  border: 1px solid rgba(45, 227, 154, 0.3);
  border-radius: 999px;
  color: #6fffc0;
  background: rgba(45, 227, 154, 0.11);
  font-size: 13px;
  font-weight: 850;
}

.landing-copy h2 {
  max-width: 780px;
  margin: 0;
  color: #fff;
  font-size: clamp(44px, 6.3vw, 76px);
  line-height: 0.96;
  letter-spacing: 0;
}

.landing-subcopy {
  max-width: 690px;
  margin: 24px 0 0;
  color: rgba(248, 250, 252, 0.72);
  font-size: clamp(17px, 2vw, 21px);
  font-weight: 650;
  line-height: 1.5;
}

.landing-cta-row {
  margin-top: 34px;
}

.landing-product-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 34px 110px rgba(0, 0, 0, 0.34);
}

.landing-reel {
  position: relative;
  min-height: 390px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  background: #070d19;
}

.reel-slide {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px;
  opacity: 0;
  transform: translateY(12px) scale(0.985);
  animation: landingReel 15s infinite;
}

.reel-code {
  animation-delay: 0s;
}

.reel-library {
  animation-delay: 5s;
}

.reel-library .reel-library-window {
  grid-row: 2 / 4;
}

.reel-annotate {
  animation-delay: 10s;
}

.reel-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 38px;
  padding: 0 4px;
}

.reel-topline strong {
  color: #fff;
  font-size: 15px;
}

.reel-topline span {
  display: inline-grid;
  place-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: rgba(248, 250, 252, 0.72);
  background: rgba(255, 255, 255, 0.07);
  font-size: 12px;
  font-weight: 850;
}

.reel-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: #09101e;
}

.reel-video-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 70px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.055) 0 1px, transparent 1px 76px),
    repeating-linear-gradient(90deg, #426d31 0 58px, #4f7a39 58px 116px);
}

.field-line,
.field-circle,
.player-dot,
.demo-ring,
.demo-arrow,
.demo-zone {
  position: absolute;
}

.field-line {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: rgba(255, 255, 255, 0.62);
}

.field-circle {
  left: 50%;
  top: 50%;
  width: 132px;
  height: 132px;
  border: 3px solid rgba(255, 255, 255, 0.62);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.player-dot {
  width: 14px;
  height: 14px;
  border: 3px solid rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  background: #18263b;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}

.player-dot-one {
  left: 26%;
  top: 57%;
  animation: playerDotOne 5s ease-in-out infinite;
}

.player-dot-two {
  left: 62%;
  top: 43%;
  animation: playerDotTwo 5s ease-in-out infinite;
}

.player-dot-three {
  left: 74%;
  top: 66%;
  animation: playerDotThree 5s ease-in-out infinite;
}

.reel-code-tray {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.code-chip {
  min-height: 50px;
  display: grid;
  align-content: center;
  justify-items: start;
  padding: 10px 12px;
  border-radius: 16px;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.code-chip.green {
  background: linear-gradient(135deg, #1eaa70, #61d69b);
}

.code-chip.amber {
  background: linear-gradient(135deg, #d78a15, #ffc759);
}

.code-chip.blue {
  background: linear-gradient(135deg, #2d7fe6, #63b3ff);
}

.reel-library-window {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(7, 13, 25, 0.98), rgba(7, 13, 25, 0.76)),
    rgba(255, 255, 255, 0.05);
}

.reel-library-window::before,
.reel-library-window::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  height: 44px;
  pointer-events: none;
}

.reel-library-window::before {
  top: 0;
  background: linear-gradient(180deg, #070d19, rgba(7, 13, 25, 0));
}

.reel-library-window::after {
  bottom: 0;
  background: linear-gradient(0deg, #070d19, rgba(7, 13, 25, 0));
}

.reel-library-grid {
  display: grid;
  gap: 10px;
  padding: 18px;
  animation: libraryClipScroll 5s ease-in-out infinite;
}

.reel-clip-card {
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
}

.reel-clip-card.active {
  border-color: rgba(45, 227, 154, 0.42);
  background: rgba(45, 227, 154, 0.13);
}

.reel-clip-card strong {
  color: #fff;
  font-size: 14px;
}

.reel-clip-card span {
  color: rgba(248, 250, 252, 0.62);
  font-size: 12px;
  font-weight: 800;
}

.reel-stage.annotated {
  min-height: 250px;
}

.demo-ring {
  left: 27%;
  top: 60%;
  width: 70px;
  height: 22px;
  border: 6px solid #fff;
  border-radius: 50%;
  transform: rotate(-7deg);
  filter: drop-shadow(0 8px 13px rgba(0, 0, 0, 0.24));
  animation: demoRingPulse 2s ease-in-out infinite;
}

.demo-arrow {
  left: 41%;
  top: 47%;
  width: 150px;
  height: 7px;
  border-radius: 999px;
  background: #fff;
  transform: rotate(-16deg);
  transform-origin: left center;
}

.demo-arrow::after {
  content: "";
  position: absolute;
  right: -3px;
  top: 50%;
  width: 0;
  height: 0;
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  border-left: 22px solid #fff;
  transform: translateY(-50%);
}

.demo-zone {
  right: 10%;
  bottom: 25%;
  width: 112px;
  height: 76px;
  border: 4px solid #2de39a;
  border-radius: 14px;
  background: rgba(45, 227, 154, 0.18);
}

.reel-timeline {
  position: relative;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background:
    linear-gradient(90deg, transparent 0 24%, rgba(255, 255, 255, 0.08) 24% 24.4%, transparent 24.4% 49%, rgba(255, 255, 255, 0.08) 49% 49.4%, transparent 49.4% 74%, rgba(255, 255, 255, 0.08) 74% 74.4%, transparent 74.4%),
    rgba(255, 255, 255, 0.055);
}

.timeline-freeze,
.timeline-ring {
  position: absolute;
  top: 15px;
  height: 18px;
  border-radius: 999px;
}

.timeline-freeze {
  left: 22%;
  width: 24%;
  background: #e23d5f;
}

.timeline-ring {
  left: 48%;
  width: 34%;
  background: #2de39a;
}

.landing-video-preview {
  position: relative;
  overflow: hidden;
  min-height: 310px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 64px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(90deg, #426d31 0 56px, #4f7a39 56px 112px);
}

.preview-score {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 2;
  min-height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0 12px;
  border-radius: 10px;
  color: #fff;
  background: rgba(5, 8, 20, 0.72);
  font-size: 12px;
  font-weight: 900;
}

.preview-pitch {
  position: absolute;
  inset: 0;
}

.preview-pitch::before,
.preview-pitch::after {
  content: "";
  position: absolute;
  border: 3px solid rgba(255, 255, 255, 0.62);
}

.preview-pitch::before {
  left: 50%;
  top: 0;
  bottom: 0;
  width: 0;
}

.preview-pitch::after {
  left: 50%;
  top: 50%;
  width: 134px;
  height: 134px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.preview-ring {
  position: absolute;
  left: 30%;
  top: 58%;
  width: 76px;
  height: 24px;
  border: 7px solid #fff;
  border-radius: 50%;
  transform: rotate(-7deg);
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.26));
}

.preview-arrow {
  position: absolute;
  left: 42%;
  top: 46%;
  width: 170px;
  height: 7px;
  border-radius: 999px;
  background: #fff;
  transform: rotate(-16deg);
}

.preview-arrow::after {
  content: "";
  position: absolute;
  right: -3px;
  top: 50%;
  width: 0;
  height: 0;
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  border-left: 22px solid #fff;
  transform: translateY(-50%);
}

.preview-zone {
  position: absolute;
  right: 11%;
  bottom: 22%;
  width: 120px;
  height: 86px;
  border: 4px solid #2de39a;
  border-radius: 16px;
  background: rgba(45, 227, 154, 0.18);
}

.preview-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  gap: 4px;
  padding: 18px 22px;
  border-left: 7px solid #2de39a;
  background: rgba(5, 8, 20, 0.76);
}

.preview-footer strong {
  color: #fff;
  font-size: 20px;
}

.preview-footer span {
  color: rgba(248, 250, 252, 0.72);
  font-weight: 700;
}

.landing-workflow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.landing-workflow span {
  min-height: 48px;
  display: grid;
  place-items: center;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  color: rgba(248, 250, 252, 0.74);
  background: rgba(255, 255, 255, 0.055);
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.plan-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 64px;
}

.plan-card {
  min-width: 0;
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.07);
}

.plan-card.featured {
  border-color: rgba(45, 227, 154, 0.42);
  background: linear-gradient(135deg, rgba(45, 227, 154, 0.14), rgba(255, 255, 255, 0.07));
}

.plan-eyebrow {
  margin: 0 0 12px;
  color: #6fffc0;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.plan-card h3 {
  margin: 0;
  color: #fff;
  font-size: 24px;
}

.plan-price {
  display: block;
  margin: 14px 0 18px;
  color: #fff;
  font-size: 34px;
  line-height: 1;
}

.plan-price span {
  color: rgba(248, 250, 252, 0.58);
  font-size: 15px;
  font-weight: 850;
}

.plan-note {
  min-height: 44px;
  margin: -6px 0 18px;
  color: rgba(248, 250, 252, 0.62);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.42;
}

.plan-card ul {
  display: grid;
  gap: 10px;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}

.plan-card li {
  position: relative;
  padding-left: 24px;
  color: rgba(248, 250, 252, 0.76);
  font-weight: 750;
  line-height: 1.35;
}

.plan-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.52em;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #2de39a;
}

button,
input,
select,
textarea {
  min-width: 0;
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-rows: 56px 1fr;
  background: var(--workspace);
  overflow: hidden;
}

.topbar {
  display: grid;
  grid-template-columns: 270px minmax(360px, 560px) auto;
  gap: 20px;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid rgba(216, 221, 215, 0.75);
  background: rgba(244, 244, 242, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: var(--canvas);
  font-size: 13px;
  font-weight: 700;
}

.brand h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.05;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(216, 221, 215, 0.8);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.tab,
.ghost-button,
.panel-button,
.primary-button,
.icon-button,
.tool-button,
.drawer-toggle,
.skip-button,
.mini-button {
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ink);
  background: transparent;
  font-weight: 650;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.tab {
  height: 30px;
  color: var(--muted);
  font-size: 12px;
}

.tab:hover,
.ghost-button:hover,
.panel-button:hover,
.skip-button:hover,
.tool-button:hover,
.mini-button:hover {
  background: rgba(17, 24, 39, 0.045);
}

.tab.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px rgba(24, 166, 106, 0.26);
}

.ghost-button {
  justify-self: end;
  height: 34px;
  min-width: 118px;
  padding: 0 16px;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.52);
  font-size: 12px;
}

.topbar-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.topbar-actions .ghost-button {
  justify-self: auto;
}

.account-pill.pro {
  border-color: rgba(24, 166, 106, 0.45);
  color: #0f7d51;
  background: var(--accent-soft);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 7, 18, 0.72);
  backdrop-filter: blur(18px);
}

.modal-card {
  width: min(980px, calc(100vw - 32px));
  max-height: min(780px, calc(100vh - 32px));
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 28px;
  color: #f8fafc;
  background: linear-gradient(145deg, rgba(17, 24, 39, 0.98), rgba(8, 13, 27, 0.98));
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.48);
}

.modal-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: start;
  padding: 28px 30px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-eyebrow {
  margin: 0 0 8px;
  color: #2de39a;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.modal-head h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.modal-head p:not(.modal-eyebrow) {
  max-width: 680px;
  margin: 10px 0 0;
  color: rgba(248, 250, 252, 0.7);
  font-weight: 700;
  line-height: 1.45;
}

.modal-close {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.08);
  font-size: 24px;
  font-weight: 800;
}

.account-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  padding: 22px 30px 30px;
}

.account-card {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.055);
}

.account-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.account-card label {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  color: rgba(248, 250, 252, 0.78);
  font-weight: 850;
}

.account-card input {
  width: 100%;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 0 14px;
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 800;
}

.account-card .button-row {
  margin-top: 18px;
}

.account-form-status {
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(99, 179, 255, 0.32);
  border-radius: 14px;
  color: #dbeafe;
  background: rgba(99, 179, 255, 0.12);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.45;
}

.account-form-status[data-kind="success"] {
  border-color: rgba(45, 227, 154, 0.4);
  color: #bfffea;
  background: rgba(45, 227, 154, 0.12);
}

.account-form-status[data-kind="error"] {
  border-color: rgba(255, 128, 128, 0.44);
  color: #ffd6d6;
  background: rgba(255, 96, 96, 0.12);
}

.account-card .button-row button:disabled {
  cursor: wait;
  opacity: 0.64;
}

.upgrade-button {
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  border: 1px solid rgba(45, 227, 154, 0.42);
  border-radius: 999px;
  color: #07111f;
  background: linear-gradient(135deg, #2de39a, #c8ffe8);
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 18px 40px rgba(45, 227, 154, 0.18);
}

.upgrade-button:disabled {
  cursor: not-allowed;
  color: rgba(248, 250, 252, 0.46);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.account-plan {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(45, 227, 154, 0.25);
  border-radius: 14px;
  color: #bfffea;
  background: rgba(45, 227, 154, 0.1);
  font-weight: 850;
}

.cloud-sync-status {
  display: block;
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(99, 179, 255, 0.26);
  border-radius: 14px;
  color: rgba(248, 250, 252, 0.74);
  background: rgba(99, 179, 255, 0.08);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.45;
}

.cloud-sync-status.connected {
  border-color: rgba(45, 227, 154, 0.32);
  color: #bfffea;
  background: rgba(45, 227, 154, 0.1);
}

.project-library-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

.project-library-head .primary-button {
  min-width: 190px;
}

.current-project-card {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid rgba(45, 227, 154, 0.24);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(45, 227, 154, 0.12), rgba(99, 179, 255, 0.08));
}

.current-project-card label {
  margin: 0;
}

.project-summary {
  margin: 0;
  color: rgba(248, 250, 252, 0.68);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.45;
}

.project-list {
  display: grid;
  gap: 12px;
  max-height: 420px;
  margin-top: 18px;
  overflow: auto;
  padding-right: 4px;
}

.project-list.empty {
  min-height: 150px;
  place-items: center;
  padding: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  color: rgba(248, 250, 252, 0.68);
  text-align: center;
  font-weight: 800;
}

.project-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
}

.project-card.active {
  border-color: rgba(45, 227, 154, 0.5);
  background: rgba(45, 227, 154, 0.12);
}

.project-card strong,
.project-card span,
.project-card small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.project-card strong {
  color: #f8fafc;
  font-size: 15px;
}

.project-card span {
  margin-top: 5px;
  color: rgba(248, 250, 252, 0.68);
  font-size: 13px;
  font-weight: 800;
}

.project-card small {
  margin-top: 5px;
  color: rgba(248, 250, 252, 0.48);
  font-weight: 800;
}

.project-card-actions {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr) minmax(0, 0.9fr);
  gap: 8px;
}

.project-card-actions .panel-button {
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 12px;
}

.project-card-actions .panel-button.subtle {
  color: rgba(248, 250, 252, 0.8);
  background: rgba(255, 255, 255, 0.08);
}

.project-card-actions .panel-button.danger {
  border-color: rgba(255, 139, 139, 0.26);
  color: #ffc2c2;
  background: rgba(255, 139, 139, 0.08);
}

.workspace {
  min-height: 0;
  overflow: hidden;
}

.mode-view {
  position: relative;
  display: none;
  height: 100%;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  padding: 18px 22px 20px;
  overflow: hidden;
}

.mode-view.active {
  display: grid;
}

.stage-column,
.clip-browser {
  grid-column: 1;
  min-width: 0;
  min-height: 0;
  align-self: stretch;
  justify-self: center;
  width: min(100%, 1500px);
}

.stage-column {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 10px;
}

#codeView .stage-column {
  position: fixed;
  top: calc(var(--topbar-height) + 18px);
  bottom: 20px;
  left: 50vw;
  z-index: 1;
  width: min(calc(100vw - 120px), 1280px);
  transform: translateX(-50%);
}

#codeView .video-shell {
  align-self: start;
  aspect-ratio: 16 / 9;
  height: auto;
}

.video-shell {
  min-height: 0;
  overflow: hidden;
  border-radius: 10px;
  background: var(--canvas);
  box-shadow: 0 22px 70px rgba(8, 12, 24, 0.18);
}

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--canvas);
}

#video,
#overlay,
#annotateOverlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#video {
  object-fit: contain;
  background: var(--canvas);
}

#overlay {
  pointer-events: none;
}

#annotateOverlay {
  pointer-events: auto;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.92);
  text-align: center;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.06), transparent 32%),
    var(--canvas);
}

.empty-state strong {
  font-size: clamp(24px, 3vw, 42px);
  font-weight: 680;
}

.empty-state span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 14px;
}

.mobile-stage-upload {
  justify-self: center;
  min-height: 44px;
  margin-top: 10px;
  padding: 0 20px;
  border: 1px solid rgba(104, 239, 189, 0.52);
  border-radius: 999px;
  color: #06120f;
  background: linear-gradient(135deg, #34eba3, #c8ffeb);
  box-shadow: 0 14px 34px rgba(45, 227, 154, 0.18);
  font-size: 13px;
  font-weight: 850;
}

.transport {
  display: grid;
  grid-template-columns: 44px 40px 44px minmax(0, 1fr) 76px 92px;
  gap: 8px;
  align-items: center;
  min-height: 54px;
  padding: 8px 10px;
  border: 1px solid rgba(216, 221, 215, 0.72);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
}

.icon-button {
  width: 38px;
  height: 38px;
  color: #fff;
  background: var(--accent);
}

.icon-button:hover,
.primary-button:hover {
  background: #15945f;
}

.skip-button {
  width: 38px;
  height: 38px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  display: inline-grid;
  place-items: center;
  background: rgba(17, 24, 39, 0.045);
}

.speed-select {
  width: 76px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(216, 221, 215, 0.82);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

.speed-select.compact {
  width: 66px;
  height: 32px;
}

input[type="range"] {
  accent-color: var(--accent);
}

output {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-align: right;
}

.left-panel,
.right-panel {
  position: absolute;
  top: 18px;
  bottom: 20px;
  z-index: 20;
  width: var(--drawer);
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  overflow: auto;
  border: 1px solid rgba(216, 221, 215, 0.8);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  transition: transform 220ms ease, opacity 220ms ease;
}

.left-panel {
  left: 22px;
}

.right-panel {
  right: 22px;
  scrollbar-color: rgba(17, 24, 39, 0.24) transparent;
  scrollbar-width: thin;
}

.right-panel::-webkit-scrollbar,
.left-panel::-webkit-scrollbar {
  width: 6px;
}

.right-panel::-webkit-scrollbar-thumb,
.left-panel::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.22);
}

.drawer-left-collapsed .left-panel {
  transform: translateX(calc(-100% - 34px));
  opacity: 0;
  pointer-events: none;
}

.drawer-right-collapsed .right-panel {
  transform: translateX(calc(100% + 34px));
  opacity: 0;
  pointer-events: none;
}

.drawer-toggle {
  position: absolute;
  top: 22px;
  z-index: 30;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-color: rgba(216, 221, 215, 0.88);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.08);
}

.drawer-toggle-left {
  left: 22px;
}

.drawer-toggle-right {
  right: 22px;
}

.mode-view:not(.drawer-left-collapsed) .drawer-toggle-left {
  left: calc(var(--drawer) + 34px);
}

.mode-view:not(.drawer-right-collapsed) .drawer-toggle-right {
  right: calc(var(--drawer) + 34px);
}

.panel-section,
.clip-browser {
  min-height: 0;
  overflow: visible;
  padding: 12px 4px;
  border: 0;
  border-top: 1px solid rgba(216, 221, 215, 0.76);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.panel-section:first-child {
  border-top: 0;
}

.panel-section h2,
.clip-browser h2 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 680;
}

.panel-section.collapsible-section {
  overflow: visible;
}

.panel-section.collapsible-section > h2 {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
  cursor: pointer;
  user-select: none;
}

.panel-section.collapsible-section > h2::after {
  content: "⌄";
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(17, 24, 39, 0.04);
  font-size: 12px;
  transition: transform 160ms ease, background 160ms ease;
}

.panel-section.collapsible-section > h2:hover::after {
  background: rgba(24, 166, 106, 0.1);
}

.panel-section.collapsible-section > h2:focus-visible {
  border-radius: 8px;
  outline: 3px solid rgba(24, 166, 106, 0.14);
}

.panel-section.collapsible-section.is-collapsed {
  min-height: 0;
  padding-top: 8px;
  padding-bottom: 8px;
  overflow: visible;
}

.panel-section.collapsible-section.is-collapsed > h2 {
  margin-bottom: 0;
}

.panel-section.collapsible-section.is-collapsed > h2::after {
  transform: rotate(-90deg);
}

.panel-section.collapsible-section.is-collapsed > :not(h2) {
  display: none !important;
}

.panel-section.accent {
  border-color: rgba(216, 221, 215, 0.76);
}

.upload-drop {
  min-height: 48px;
  display: grid;
  place-items: center;
  padding: 10px;
  border: 1px dashed rgba(17, 24, 39, 0.22);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(244, 244, 242, 0.68);
  text-align: center;
  font-size: 12px;
  font-weight: 650;
}

#videoInput {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.file-meta {
  margin: 8px 0 0;
}

.file-meta div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px solid rgba(216, 221, 215, 0.68);
  font-size: 11px;
}

.file-meta dt,
label,
.status,
.empty-copy,
.export-progress,
.privacy-note,
.event-meta,
.clip-meta,
.pause-meta,
.annotation-meta {
  color: var(--muted);
  font-size: 11px;
  font-weight: 580;
  line-height: 1.35;
}

.file-meta dd {
  margin: 0;
  color: var(--ink);
  text-align: right;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(216, 221, 215, 0.9);
  border-radius: 9px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  font-weight: 520;
  outline: none;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  border-color: rgba(24, 166, 106, 0.72);
  box-shadow: 0 0 0 3px rgba(24, 166, 106, 0.12);
}

input,
select {
  height: 32px;
  padding: 0 9px;
}

textarea {
  min-height: 72px;
  padding: 9px;
  resize: vertical;
}

label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.field-help {
  margin: -2px 0 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  margin-top: 2px;
}

.toggle-row input {
  flex: 0 0 auto;
  width: auto;
  height: auto;
}

.toggle-row span {
  min-width: 0;
  line-height: 1.25;
}

.panel-button,
.primary-button {
  width: 100%;
  min-height: 34px;
  margin-top: 6px;
  padding: 0 12px;
  font-size: 12px;
}

.panel-button {
  border-color: rgba(216, 221, 215, 0.88);
  background: rgba(255, 255, 255, 0.54);
  color: var(--ink);
}

.primary-button {
  color: #fff;
  background: var(--accent);
}

.danger-button {
  color: var(--danger);
  background: rgba(194, 65, 65, 0.06);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.privacy-note {
  margin: 0 0 8px;
}

.workflow-steps {
  display: none;
}

.code-form,
.annotation-properties {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.code-form label:first-child,
.code-form label:nth-child(2),
.code-editor-actions,
#deleteCodeButton,
.annotation-properties label:nth-child(5),
.annotation-properties label:nth-child(6),
.annotation-properties .button-row {
  grid-column: 1 / -1;
}

.code-form input[type="color"] {
  min-height: 34px;
  padding: 4px;
}

.button-row,
.code-editor-actions,
.pause-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.code-grid,
.event-list,
.clip-list,
.pause-list,
.annotation-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

.code-grid {
  min-width: 0;
}

.code-tray {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 92px;
  padding: 10px;
  border: 1px solid rgba(216, 221, 215, 0.72);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
}

.code-tray-head {
  width: 118px;
  display: grid;
  gap: 3px;
}

.code-tray-head strong {
  font-size: 13px;
  font-weight: 720;
}

.code-tray-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 580;
  line-height: 1.25;
}

.code-tray .code-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, 190px);
  gap: 9px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(17, 24, 39, 0.22) transparent;
}

.code-tray .code-grid::-webkit-scrollbar {
  height: 6px;
}

.code-tray .code-grid::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.22);
}

.event-list {
  max-height: none;
}

.pause-list {
  max-height: 190px;
  margin-top: 8px;
}

.annotation-list {
  max-height: 300px;
}

.clip-browser {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 26px min(5vw, 72px);
  border: 0;
}

.library-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.library-header h2 {
  font-size: 24px;
  font-weight: 650;
}

.library-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.clip-list {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  align-content: start;
  gap: 14px;
}

.code-card,
.event-item,
.clip-card,
.pause-item,
.annotation-item {
  width: 100%;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(216, 221, 215, 0.78);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.62);
  text-align: left;
}

.clip-card {
  position: relative;
  min-height: 156px;
  align-content: end;
  overflow: hidden;
  border: 1px solid rgba(216, 221, 215, 0.78);
  background:
    linear-gradient(180deg, rgba(8, 12, 24, 0.04), rgba(8, 12, 24, 0.1)),
    var(--surface);
}

.clip-card::before {
  content: "";
  position: absolute;
  inset: 12px 12px auto;
  height: 72px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 49%, rgba(255, 255, 255, 0.42) 50%, transparent 51%),
    repeating-linear-gradient(90deg, rgba(24, 166, 106, 0.12) 0 28px, rgba(24, 166, 106, 0.18) 28px 56px);
  opacity: 0.75;
}

.clip-card > * {
  position: relative;
}

.clip-card.active {
  border-color: rgba(24, 166, 106, 0.64);
  box-shadow: inset 0 0 0 1px rgba(24, 166, 106, 0.3), 0 18px 44px rgba(17, 24, 39, 0.08);
}

.clip-card.in-playlist {
  box-shadow: inset 0 0 0 1px rgba(24, 166, 106, 0.38);
}

.clip-card.in-playlist::after {
  content: "Playlist";
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.78);
  font-size: 10px;
  font-weight: 680;
}

.code-card {
  position: relative;
  padding: 0;
  overflow: hidden;
  border-color: transparent;
}

.code-card.active {
  border-color: rgba(17, 24, 39, 0.4);
}

.code-card.timing {
  border-color: rgba(194, 65, 65, 0.5);
}

.code-card.timing .code-button {
  animation: timingPulse 1.2s ease-in-out infinite;
}

@keyframes landingReel {
  0%,
  27% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  33%,
  100% {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
}

@keyframes playerDotOne {
  0%,
  100% {
    transform: translate(0, 0);
  }

  50% {
    transform: translate(22px, -16px);
  }
}

@keyframes playerDotTwo {
  0%,
  100% {
    transform: translate(0, 0);
  }

  50% {
    transform: translate(-18px, 20px);
  }
}

@keyframes playerDotThree {
  0%,
  100% {
    transform: translate(0, 0);
  }

  50% {
    transform: translate(-30px, -10px);
  }
}

@keyframes libraryClipScroll {
  0%,
  22% {
    transform: translateY(0);
  }

  48%,
  68% {
    transform: translateY(-86px);
  }

  92%,
  100% {
    transform: translateY(-172px);
  }
}

@keyframes demoRingPulse {
  0%,
  100% {
    opacity: 0.92;
    transform: rotate(-7deg) scale(1);
  }

  50% {
    opacity: 1;
    transform: rotate(-7deg) scale(1.06);
  }
}

@media (prefers-reduced-motion: reduce) {
  .reel-slide,
  .reel-library-grid,
  .player-dot,
  .demo-ring {
    animation: none;
  }

  .reel-slide {
    opacity: 0;
    transform: none;
  }

  .reel-code {
    opacity: 1;
  }
}

@keyframes timingPulse {
  0%,
  100% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(1.08);
  }
}

.code-button {
  width: 100%;
  min-height: 66px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  justify-content: center;
  padding: 11px 46px 11px 13px;
  color: #fff;
  border: 0;
  border-radius: 10px;
  text-align: center;
}

.code-mode-toggle {
  margin-bottom: 8px;
}

.code-edit-button {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.82);
}

.code-button strong,
.event-title,
.clip-title,
.pause-title,
.annotation-title {
  font-weight: 680;
}

.code-button strong {
  overflow: hidden;
  font-size: 15px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: normal;
}

.code-button span {
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  line-height: 1.25;
}

.clip-card .clip-actions,
.event-head,
.pause-actions,
.annotation-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.event-head {
  justify-content: space-between;
}

.event-note-input {
  min-height: 54px;
  resize: vertical;
  font-size: 12px;
  line-height: 1.35;
}

.mini-button {
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.05);
  color: var(--ink);
  font-size: 11px;
}

.library-preview {
  display: grid;
  gap: 10px;
}

.library-preview video {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border-radius: 10px;
  background: var(--canvas);
  object-fit: contain;
}

.library-preview-controls {
  display: grid;
  grid-template-columns: 38px 38px 38px 66px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 38px;
  padding-bottom: 2px;
  border-bottom: 1px solid rgba(216, 221, 215, 0.62);
}

.library-preview-controls .status {
  justify-self: end;
}

.preview-skip {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 999px;
  font-size: 14px;
  display: inline-grid;
  place-items: center;
}

.preview-play {
  width: 34px;
  height: 34px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.tool-button {
  position: relative;
  width: 100%;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 0 10px;
  overflow: hidden;
  border-color: rgba(216, 221, 215, 0.9);
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
  font-size: 11px;
}

.tool-button::before {
  width: 16px;
  flex: 0 0 16px;
  color: var(--ink);
  font-size: 14px;
  text-align: center;
}

.tool-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-button[data-tool="select"]::before { content: "↖"; }
.tool-button[data-tool="arrow"]::before { content: "↗"; }
.tool-button[data-tool="line"]::before { content: "╱"; }
.tool-button[data-tool="circle"]::before { content: "○"; }
.tool-button[data-tool="track-ring"]::before { content: "◎"; }
.tool-button[data-tool="zone"]::before { content: "▱"; }
.tool-button[data-tool="spotlight"]::before { content: "◉"; }
.tool-button[data-tool="label"]::before { content: "T"; }
.tool-button[data-tool="freehand"]::before { content: "⌁"; }

.iphone-no-tracking .tool-button[data-tool="track-ring"],
.iphone-no-tracking .tracking-section {
  display: none !important;
}

@media (hover: hover) and (pointer: fine) {
  #annotateView.active .premium-tool-dock .tool-button[data-tooltip] {
    position: relative;
  }

  #annotateView.active .premium-tool-dock .tool-button[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 12px);
    z-index: 120;
    width: max-content;
    max-width: 260px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    color: var(--suite-ink);
    background: rgba(11, 18, 35, 0.96);
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.42);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: 0;
    text-align: center;
    white-space: normal;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 6px);
    transition: opacity 150ms ease, transform 150ms ease;
  }

  #annotateView.active .premium-tool-dock .tool-button[data-tooltip]:hover::after,
  #annotateView.active .premium-tool-dock .tool-button[data-tooltip]:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.tool-button.active {
  border-color: rgba(24, 166, 106, 0.55);
  background: var(--accent-soft);
  color: var(--accent);
}

.tool-button.active::before {
  color: var(--accent);
}

#annotateView {
  --drawer: 330px;
}

#annotateView .left-panel,
#annotateView .right-panel {
  gap: 8px;
  padding: 12px;
  overflow-x: hidden;
}

#annotateView .panel-section {
  display: grid;
  gap: 8px;
  padding: 10px 0;
  overflow: hidden;
}

#annotateView .panel-section:first-child {
  padding-top: 0;
}

#annotateView .panel-section > h2 {
  margin: 0;
  font-size: 12px;
}

#annotateView .panel-section.collapsible-section {
  overflow: hidden;
}

#annotateView .panel-section.collapsible-section > h2 {
  margin: 0;
}

#annotateView .panel-section.collapsible-section.is-collapsed {
  padding-top: 9px;
  padding-bottom: 9px;
  overflow: hidden;
}

#annotateView input,
#annotateView select,
#annotateView textarea {
  width: 100%;
}

#annotateView input,
#annotateView select {
  height: 34px;
}

#annotateView textarea {
  min-height: 68px;
  max-height: 110px;
  resize: vertical;
  line-height: 1.35;
}

#annotateView label {
  gap: 5px;
}

#annotateView .status,
#annotateView .empty-copy {
  margin: 0;
  line-height: 1.35;
}

#annotateView .button-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.annotation-panel .tool-section {
  padding-bottom: 12px;
}

.annotation-panel .tool-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.annotation-panel .tool-button {
  height: 36px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
}

.annotation-panel .tool-button::before {
  width: 18px;
  flex-basis: 18px;
}

.clip-footer-section {
  gap: 7px;
}

.clip-footer-section .toggle-row {
  min-height: 28px;
  align-items: center;
  padding: 2px 0;
}

.pitch-surface-section .button-row,
.pitch-surface-section .pitch-actions {
  gap: 7px;
}

.pitch-surface-section .panel-button,
.export-section .panel-button,
.export-section .primary-button {
  min-height: 36px;
}

.graphic-section .annotation-properties {
  grid-template-columns: 1fr;
  gap: 9px;
}

.graphic-section .annotation-properties label,
.graphic-section .annotation-properties .button-row {
  grid-column: auto;
}

.graphic-section .annotation-properties label:nth-child(1),
.graphic-section .annotation-properties label:nth-child(2) {
  display: grid;
  grid-template-columns: minmax(72px, 0.6fr) minmax(0, 1fr);
  align-items: center;
}

.graphic-section .annotation-properties label:nth-child(1) input {
  height: 32px;
}

.layers-section .annotation-list,
.annotate-pause-section .pause-list,
.annotate-playlist-section .playlist-list {
  max-height: 180px;
  overflow: auto;
}

.annotate-workflow-panel .panel-button,
.annotation-panel .panel-button,
.annotation-panel .primary-button {
  white-space: normal;
  line-height: 1.2;
}

.telestration-panel,
.clip-editor {
  display: grid;
  gap: 8px;
}

#libraryView .right-panel,
#libraryView .left-panel {
  gap: 8px;
}

#libraryView .panel-section {
  padding: 11px 4px;
  overflow: visible;
}

#libraryView .panel-section:not(.is-collapsed) {
  display: grid;
  gap: 8px;
}

#libraryView .panel-section > h2 {
  margin-bottom: 0;
}

#libraryView .panel-section:not(.is-collapsed) > h2 {
  margin-bottom: 2px;
}

#libraryView label {
  gap: 6px;
}

#libraryView input,
#libraryView select {
  height: 36px;
}

#libraryView textarea {
  min-height: 86px;
  max-height: 140px;
}

#libraryView .clip-editor {
  gap: 10px;
}

#libraryView .clip-editor .toggle-row {
  margin-top: 0;
}

#libraryView .playlist-list {
  max-height: 150px;
}

#libraryView .button-row {
  align-items: center;
}

#libraryView .panel-button,
#libraryView .primary-button {
  margin-top: 0;
}

.reference-list {
  display: grid;
  gap: 4px;
  max-height: 86px;
  overflow: auto;
  padding: 6px;
  border: 1px solid rgba(216, 221, 215, 0.86);
  border-radius: 9px;
  background: rgba(244, 244, 242, 0.64);
}

.reference-item {
  color: var(--ink);
  font-size: 11px;
  font-weight: 580;
  line-height: 1.25;
}

.playlist-list {
  display: grid;
  gap: 7px;
  max-height: 220px;
  overflow: auto;
}

.playlist-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 28px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(216, 221, 215, 0.76);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.58);
}

.playlist-item.selectable {
  cursor: pointer;
}

.playlist-item.selectable:hover {
  background: rgba(24, 166, 106, 0.07);
}

.playlist-item.active {
  border-color: rgba(24, 166, 106, 0.5);
  background: rgba(24, 166, 106, 0.1);
}

.playlist-index {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 680;
}

.playlist-item strong,
.playlist-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-item strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
}

.playlist-item small {
  color: var(--muted);
  font-size: 10px;
}

.empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 520;
}

@media (max-width: 1180px) {
  :root {
    --drawer: 280px;
  }

  .app-shell {
    grid-template-rows: 52px 1fr;
  }

  :root {
    --topbar-height: 52px;
  }

  .topbar {
    grid-template-columns: minmax(160px, 1fr) minmax(250px, 1.5fr) auto;
    gap: 8px;
    padding: 0 12px;
  }

  .brand p {
    display: none;
  }

  .brand-mark {
    width: 31px;
    height: 31px;
  }

  .tab {
    font-size: 11px;
  }

  .mode-view {
    padding: 12px;
  }

  #codeView .stage-column {
    top: calc(var(--topbar-height) + 12px);
    bottom: 12px;
    left: 50vw;
    width: calc(100vw - 24px);
    transform: translateX(-50%);
  }

  .left-panel {
    left: 12px;
  }

  .right-panel {
    right: 12px;
  }

  .drawer-toggle-left {
    left: 12px;
  }

  .drawer-toggle-right {
    right: 12px;
  }

  .mode-view:not(.drawer-left-collapsed) .drawer-toggle-left {
    left: calc(var(--drawer) + 22px);
  }

  .mode-view:not(.drawer-right-collapsed) .drawer-toggle-right {
    right: calc(var(--drawer) + 22px);
  }
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    grid-template-columns: 1fr;
    height: auto;
    padding: 12px;
  }

  .ghost-button {
    justify-self: stretch;
  }

  .mode-view {
    min-height: 760px;
    overflow: visible;
  }

  .left-panel,
  .right-panel {
    width: min(92vw, 320px);
  }

  .transport {
    grid-template-columns: 40px 40px 40px minmax(0, 1fr);
  }

  .code-tray {
    grid-template-columns: 1fr;
  }

  .code-tray-head {
    width: auto;
  }

  .code-tray .code-grid {
    grid-auto-columns: minmax(138px, 170px);
  }

  output {
    grid-column: 1 / -1;
    text-align: left;
  }
}

/* Studio migration: approved visual direction applied over the stable app wiring. */
:root {
  --bg: #e9ebe7;
  --workspace: #eef0ed;
  --surface: #fbfcf8;
  --canvas: #070d1c;
  --ink: #101827;
  --muted: #677083;
  --line: rgba(16, 24, 39, 0.12);
  --accent: #18a66a;
  --accent-soft: rgba(24, 166, 106, 0.14);
  --danger: #c24141;
  --shadow: 0 22px 70px rgba(16, 24, 39, 0.12);
  --drawer: 300px;
  --topbar-height: 66px;
}

body {
  background:
    radial-gradient(circle at 16% 8%, rgba(24, 166, 106, 0.12), transparent 28%),
    linear-gradient(135deg, #f7f8f3, var(--workspace));
}

.app-shell {
  grid-template-rows: var(--topbar-height) 1fr;
  background: transparent;
}

.topbar {
  grid-template-columns: 280px minmax(420px, 620px) 1fr;
  gap: 24px;
  height: var(--topbar-height);
  padding: 0 26px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(248, 249, 246, 0.86);
  backdrop-filter: blur(22px);
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  font-weight: 900;
}

.brand h1 {
  font-size: 17px;
  font-weight: 800;
}

.brand p {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.tabs {
  gap: 4px;
  padding: 4px;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.tab {
  height: 34px;
  font-size: 13px;
  font-weight: 850;
}

.tab.active {
  color: #0f7d51;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(24, 166, 106, 0.28);
}

.ghost-button {
  height: 36px;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.64);
  font-weight: 850;
}

.mode-view {
  padding: 18px 22px 22px;
}

.left-panel,
.right-panel {
  top: 18px;
  bottom: 22px;
  width: var(--drawer);
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 34px rgba(16, 24, 39, 0.08);
}

.left-panel {
  left: 22px;
}

.right-panel {
  right: 22px;
}

.drawer-toggle {
  top: 24px;
  width: 36px;
  height: 36px;
  border-color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 28px rgba(16, 24, 39, 0.1);
}

.mode-view:not(.drawer-left-collapsed) .drawer-toggle-left {
  left: calc(var(--drawer) + 34px);
}

.mode-view:not(.drawer-right-collapsed) .drawer-toggle-right {
  right: calc(var(--drawer) + 34px);
}

.panel-section {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 10px 28px rgba(16, 24, 39, 0.06);
}

.panel-section:first-child {
  border-top: 1px solid rgba(255, 255, 255, 0.92);
}

.panel-section h2,
.clip-browser h2 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.panel-section.collapsible-section {
  padding: 12px 14px;
  overflow: hidden;
}

.panel-section.collapsible-section > h2 {
  min-height: 24px;
  margin: 0;
}

.panel-section.collapsible-section:not(.is-collapsed) > h2 {
  margin-bottom: 10px;
}

.panel-section.collapsible-section > h2::after {
  background: rgba(16, 24, 39, 0.05);
}

.upload-drop {
  min-height: 42px;
  border-color: rgba(24, 166, 106, 0.35);
  border-radius: 999px;
  color: #0f7d51;
  background: var(--accent-soft);
  font-weight: 850;
}

input,
select,
textarea {
  border-color: var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  font-weight: 650;
}

input,
select {
  height: 36px;
}

textarea {
  line-height: 1.35;
}

.panel-button,
.primary-button,
.skip-button,
.mini-button {
  font-weight: 850;
}

.panel-button,
.primary-button {
  min-height: 38px;
  margin-top: 8px;
  border-radius: 999px;
}

.panel-button {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.primary-button,
.icon-button {
  background: var(--accent);
}

.danger-button {
  color: var(--danger);
  background: rgba(194, 65, 65, 0.06);
}

.video-shell {
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.stage {
  overflow: hidden;
}

.transport {
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 34px rgba(16, 24, 39, 0.08);
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.skip-button {
  height: 36px;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

/* Phase 1: Code Match as the main studio entry point. */
#codeView .stage-column {
  top: calc(var(--topbar-height) + 18px);
  bottom: 22px;
  left: 50vw;
  width: min(calc(100vw - 700px), 1240px);
  max-width: 1240px;
  min-width: 720px;
  transform: translateX(-50%);
}

#codeView.drawer-left-collapsed.drawer-right-collapsed .stage-column {
  width: min(calc(100vw - 120px), 1360px);
}

#codeView.drawer-left-collapsed:not(.drawer-right-collapsed) .stage-column,
#codeView:not(.drawer-left-collapsed).drawer-right-collapsed .stage-column {
  width: min(calc(100vw - 390px), 1280px);
}

#codeView .left-panel {
  display: grid;
  align-content: start;
}

#codeView .left-panel::before {
  content: "Today\A Match Workflow";
  white-space: pre-line;
  display: block;
  padding: 2px 4px 4px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 850;
  line-height: 1.1;
}

#codeView .left-panel::after {
  content: "1  Load Match\A 2  Code Moments\A 3  Build Playlist\A 4  Explain Clip\A 5  Export MP4";
  white-space: pre-line;
  display: grid;
  gap: 10px;
  order: -1;
  padding: 12px;
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.52);
  font-size: 12px;
  font-weight: 850;
  line-height: 2.15;
}

#codeView .left-panel .code-builder {
  order: 2;
}

#codeView .left-panel .panel-section:first-of-type {
  order: 1;
}

#codeView .right-panel .accent {
  background: var(--accent-soft);
}

#codeView .right-panel .log-section {
  flex: 1 1 auto;
  overflow: hidden;
}

#codeView .event-list {
  max-height: none;
  overflow: auto;
}

#codeView .stage-column {
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 12px;
}

#codeView .video-shell {
  align-self: stretch;
  aspect-ratio: auto;
}

.code-tray {
  min-height: 96px;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 34px rgba(16, 24, 39, 0.08);
}

.code-tray-head strong {
  font-size: 14px;
  font-weight: 850;
}

.code-tray-head span {
  font-weight: 700;
}

.code-tray .code-grid {
  grid-auto-columns: minmax(160px, 210px);
  gap: 10px;
  padding-bottom: 4px;
}

.code-card {
  border-radius: 16px;
}

.code-button {
  min-height: 72px;
  border-radius: 16px;
  padding: 13px 48px 13px 14px;
}

.code-button strong {
  font-size: 16px;
  font-weight: 850;
}

.code-button span {
  font-size: 12px;
  font-weight: 750;
}

.code-edit-button {
  top: 10px;
  right: 10px;
  width: auto;
  min-width: 42px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
}

/* Phase 2: Clip Library as a browse/edit/playlist workspace. */
#libraryView {
  grid-template-columns: var(--drawer) minmax(0, 1fr) var(--drawer);
  gap: 16px;
}

#libraryView .left-panel,
#libraryView .right-panel,
#libraryView .clip-browser {
  position: relative;
  inset: auto;
  grid-column: auto;
  width: auto;
  transform: none;
  opacity: 1;
}

#libraryView .left-panel,
#libraryView .right-panel {
  align-self: stretch;
}

#libraryView.drawer-left-collapsed .left-panel,
#libraryView.drawer-right-collapsed .right-panel {
  display: none;
}

#libraryView.drawer-left-collapsed:not(.drawer-right-collapsed) {
  grid-template-columns: minmax(0, 1fr) var(--drawer);
}

#libraryView:not(.drawer-left-collapsed).drawer-right-collapsed {
  grid-template-columns: var(--drawer) minmax(0, 1fr);
}

#libraryView.drawer-left-collapsed.drawer-right-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

#libraryView .clip-browser {
  justify-self: stretch;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.48);
  box-shadow: 0 12px 34px rgba(16, 24, 39, 0.08);
}

#libraryView .library-header {
  align-items: end;
  margin-bottom: 18px;
}

#libraryView .library-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 28px;
  letter-spacing: -0.02em;
  text-transform: none;
}

#libraryView .library-header p {
  font-weight: 700;
}

#libraryView .clip-list {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.clip-card {
  min-height: 170px;
  border-color: rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(7, 13, 28, 0.02), rgba(7, 13, 28, 0.08)),
    rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 28px rgba(16, 24, 39, 0.07);
}

.clip-card::before {
  inset: 12px 12px auto;
  height: 76px;
  border-radius: 14px;
  background:
    linear-gradient(90deg, transparent 49%, rgba(255, 255, 255, 0.72) 50%, transparent 51%),
    repeating-linear-gradient(105deg, rgba(24, 166, 106, 0.18) 0 34px, rgba(24, 166, 106, 0.26) 34px 68px);
}

.clip-card.active {
  border-color: rgba(24, 166, 106, 0.55);
  box-shadow: inset 0 0 0 1px rgba(24, 166, 106, 0.3), var(--shadow);
}

.library-preview video {
  border-radius: 16px;
}

.playlist-list,
.annotation-list,
.pause-list,
.event-list {
  scrollbar-color: rgba(16, 24, 39, 0.22) transparent;
  scrollbar-width: thin;
}

.playlist-item,
.event-item,
.pause-item,
.annotation-item {
  border-color: var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

/* Phase 3: Annotate + Export as video-first telestration studio. */
#annotateView {
  --drawer: 310px;
  grid-template-columns: var(--drawer) minmax(0, 1fr) var(--drawer);
  gap: 16px;
}

#annotateView.drawer-left-collapsed,
#annotateView.drawer-right-collapsed {
  grid-template-columns: var(--drawer) minmax(0, 1fr) var(--drawer);
}

#annotateView .left-panel,
#annotateView .right-panel,
#annotateView .stage-column {
  position: relative;
  inset: auto;
  grid-column: auto;
  width: auto;
  min-width: 0;
  transform: none;
  opacity: 1;
}

#annotateView.drawer-left-collapsed .left-panel,
#annotateView.drawer-right-collapsed .right-panel {
  display: none;
}

#annotateView.drawer-left-collapsed:not(.drawer-right-collapsed) {
  grid-template-columns: minmax(0, 1fr) var(--drawer);
}

#annotateView:not(.drawer-left-collapsed).drawer-right-collapsed {
  grid-template-columns: var(--drawer) minmax(0, 1fr);
}

#annotateView.drawer-left-collapsed.drawer-right-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

#annotateView .stage-column {
  justify-self: stretch;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
}

#annotateView .video-shell {
  min-height: 0;
}

#annotateView .annotate-workflow-panel,
#annotateView .annotation-panel {
  align-self: stretch;
}

#annotateView .annotate-workflow-panel {
  display: grid;
  align-content: start;
}

#annotateView .annotation-panel {
  display: grid;
  align-content: start;
}

#annotateView .tool-section {
  order: -1;
}

.annotation-panel .tool-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.annotation-panel .tool-button {
  height: 40px;
  border-radius: 999px;
  border-color: var(--line);
}

.annotation-panel .tool-button.active {
  color: #0f7d51;
  background: var(--accent-soft);
}

.clip-footer-section,
.pitch-surface-section,
.graphic-section,
.layers-section,
.annotate-clip-section,
.annotate-playlist-section,
.annotate-pause-section,
.export-section {
  background: rgba(255, 255, 255, 0.66);
}

.export-section .primary-button {
  background: linear-gradient(135deg, var(--accent), #11b678);
}

.graphic-section .annotation-properties label:nth-child(1),
.graphic-section .annotation-properties label:nth-child(2) {
  grid-template-columns: 82px minmax(0, 1fr);
}

#annotationColor {
  padding: 4px;
}

@media (max-width: 1320px) {
  :root {
    --drawer: 280px;
  }

  .topbar {
    grid-template-columns: 240px minmax(360px, 520px) 1fr;
    gap: 14px;
    padding: 0 18px;
  }

  #codeView .stage-column {
    width: min(calc(100vw - 620px), 1120px);
    min-width: 600px;
  }

  #libraryView {
    grid-template-columns: 260px minmax(0, 1fr) 300px;
  }

  #annotateView {
    grid-template-columns: 270px minmax(0, 1fr) 300px;
  }
}

@media (max-width: 1040px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    grid-template-columns: 1fr;
    height: auto;
    padding: 14px;
  }

  .ghost-button {
    justify-self: stretch;
  }

  .mode-view,
  #libraryView,
  #annotateView,
  #annotateView.drawer-left-collapsed,
  #annotateView.drawer-right-collapsed,
  #annotateView.drawer-left-collapsed:not(.drawer-right-collapsed),
  #annotateView:not(.drawer-left-collapsed).drawer-right-collapsed,
  #annotateView.drawer-left-collapsed.drawer-right-collapsed {
    height: auto;
    min-height: calc(100vh - 150px);
    display: none;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .mode-view.active {
    display: grid;
  }

  #libraryView.active,
  #annotateView.active,
  #codeView.active {
    display: grid;
  }

  #codeView .stage-column,
  #libraryView .left-panel,
  #libraryView .right-panel,
  #libraryView .clip-browser,
  #annotateView .left-panel,
  #annotateView .right-panel,
  #annotateView .stage-column,
  .left-panel,
  .right-panel {
    position: relative;
    inset: auto;
    width: auto;
    min-width: 0;
    transform: none !important;
    opacity: 1 !important;
  }

  #libraryView.drawer-left-collapsed .left-panel,
  #libraryView.drawer-right-collapsed .right-panel,
  #annotateView.drawer-left-collapsed .left-panel,
  #annotateView.drawer-right-collapsed .right-panel {
    display: grid;
  }

  #codeView {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  #codeView .stage-column {
    order: 1;
  }

  #codeView .left-panel {
    order: 2;
  }

  #codeView .right-panel {
    order: 3;
  }

  .drawer-toggle {
    display: none;
  }

  .code-tray {
    grid-template-columns: 1fr;
  }

  .code-tray-head {
    width: auto;
  }

  .code-tray .code-grid {
    grid-auto-columns: minmax(170px, 220px);
  }
}

/* Premium telestration direction: applied to the real Annotate + Export workspace. */
#annotateView.active {
  --tele-ink: #f7f8fb;
  --tele-muted: rgba(247, 248, 251, 0.66);
  --tele-line: rgba(255, 255, 255, 0.13);
  --tele-panel: rgba(13, 18, 31, 0.76);
  --tele-panel-strong: rgba(17, 24, 39, 0.9);
  --tele-green: #2de39a;
  --tele-green-soft: rgba(45, 227, 154, 0.15);
  --tele-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  grid-template-columns: 290px minmax(0, 1fr) 330px;
  gap: 14px;
  padding: 16px;
  color: var(--tele-ink);
  background:
    radial-gradient(circle at 18% 10%, rgba(45, 227, 154, 0.18), transparent 28%),
    radial-gradient(circle at 80% 0%, rgba(99, 179, 255, 0.12), transparent 28%),
    linear-gradient(135deg, #060914, #111827 52%, #090d18);
}

#annotateView.active .left-panel,
#annotateView.active .right-panel {
  gap: 12px;
  padding: 14px;
  overflow-x: hidden;
  border: 1px solid var(--tele-line);
  border-radius: 22px;
  background: var(--tele-panel);
  box-shadow: var(--tele-shadow);
  backdrop-filter: blur(22px) saturate(1.16);
}

#annotateView.active .panel-section {
  gap: 10px;
  padding: 14px;
  overflow: hidden;
  border: 1px solid var(--tele-line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: none;
}

#annotateView.active .panel-section:first-child {
  border-top: 1px solid var(--tele-line);
}

#annotateView.active .panel-section > h2 {
  color: var(--tele-muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#annotateView.active .status,
#annotateView.active .empty-copy,
#annotateView.active label,
#annotateView.active .export-progress,
#annotateView.active .pause-meta,
#annotateView.active .annotation-meta {
  color: var(--tele-muted);
}

#annotateView.active input,
#annotateView.active select,
#annotateView.active textarea {
  border-color: var(--tele-line);
  color: var(--tele-ink);
  background: rgba(255, 255, 255, 0.08);
}

#annotateView.active textarea::placeholder,
#annotateView.active input::placeholder {
  color: rgba(247, 248, 251, 0.38);
}

#annotateView.active .panel-button,
#annotateView.active .primary-button,
#annotateView.active .mini-button {
  min-height: 38px;
  border-color: var(--tele-line);
  color: var(--tele-ink);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 900;
}

#annotateView.active .primary-button,
#annotateView.active .export-section .primary-button {
  color: #06110d;
  border-color: transparent;
  background: linear-gradient(135deg, var(--tele-green), #eafff5);
  box-shadow: 0 0 30px rgba(45, 227, 154, 0.14);
}

#annotateView.active .danger-button {
  color: #ff9c9c;
  background: rgba(194, 65, 65, 0.12);
}

#annotateView.active .stage-column {
  position: relative;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 12px;
}

.premium-stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.surface-status-pill {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid rgba(45, 227, 154, 0.22);
  border-radius: 999px;
  color: var(--tele-green, #2de39a);
  background: var(--tele-green-soft, rgba(45, 227, 154, 0.15));
  font-size: 12px;
  font-weight: 900;
}

.surface-status-pill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 18px currentColor;
}

#annotateView.active .video-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 28px;
  background: #060914;
  box-shadow: var(--tele-shadow);
}

#annotateView.active .stage {
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.05), transparent 34%),
    #060914;
}

#annotateView.active .premium-tool-dock {
  justify-self: center;
  max-width: min(100%, 880px);
  display: block;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(7, 13, 28, 0.72);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(22px) saturate(1.16);
}

#annotateView.active .premium-tool-dock h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

#annotateView.active .premium-tool-dock .tool-grid {
  display: flex;
  grid-template-columns: none;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

#annotateView.active .premium-tool-dock .tool-grid::-webkit-scrollbar {
  display: none;
}

#annotateView.active .premium-tool-dock .tool-button {
  width: auto;
  min-width: 86px;
  height: 44px;
  flex: 0 0 auto;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--tele-muted);
  background: transparent;
  font-size: 12px;
  font-weight: 900;
}

#annotateView.active .premium-tool-dock .tool-button::before {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 16px;
}

#annotateView.active .premium-tool-dock .tool-button.active {
  color: var(--tele-green);
  border-color: rgba(45, 227, 154, 0.24);
  background: var(--tele-green-soft);
  box-shadow: 0 0 22px rgba(45, 227, 154, 0.12);
}

#annotateView.active .transport {
  border: 1px solid var(--tele-line);
  border-radius: 18px;
  background: var(--tele-panel);
  box-shadow: var(--tele-shadow);
  backdrop-filter: blur(22px) saturate(1.16);
}

#annotateView.active .skip-button {
  border-color: var(--tele-line);
  color: var(--tele-ink);
  background: rgba(255, 255, 255, 0.08);
}

#annotateView.active .icon-button {
  color: #06110d;
  background: var(--tele-green);
}

#annotateView.active input[type="range"] {
  accent-color: var(--tele-green);
}

#annotateView.active output {
  color: var(--tele-muted);
}

#annotateView.active .graphic-section {
  order: -2;
}

.telestration-swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.telestration-swatches button {
  height: 34px;
  border: 1px solid var(--tele-line, rgba(255, 255, 255, 0.13));
  border-radius: 12px;
  box-shadow: none;
}

.telestration-swatches .swatch-white { background: #fff; }
.telestration-swatches .swatch-green { background: #2de39a; }
.telestration-swatches .swatch-blue { background: #63b3ff; }
.telestration-swatches .swatch-amber { background: #ffc75a; }

.telestration-swatches .active {
  box-shadow: 0 0 0 3px rgba(45, 227, 154, 0.18);
}

#annotateView.active .annotation-properties {
  gap: 11px;
}

#annotateView.active .annotation-properties label:nth-child(1),
#annotateView.active .annotation-properties label:nth-child(2) {
  grid-template-columns: 78px minmax(0, 1fr);
}

#annotateView.active .pitch-surface-section {
  border-color: rgba(45, 227, 154, 0.16);
}

#annotateView.active .pitch-surface-section #pitchMaskStatus::before {
  content: "";
  width: 8px;
  height: 8px;
  display: inline-block;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--tele-green);
  box-shadow: 0 0 14px var(--tele-green);
}

#annotateView.active .pause-item,
#annotateView.active .annotation-item,
#annotateView.active .playlist-item {
  border-color: var(--tele-line);
  color: var(--tele-ink);
  background: rgba(255, 255, 255, 0.07);
}

#annotateView.active .pause-item.active,
#annotateView.active .annotation-item.active,
#annotateView.active .playlist-item.active {
  border-color: rgba(45, 227, 154, 0.35);
  background: var(--tele-green-soft);
}

#annotateView.active .annotation-title,
#annotateView.active .pause-title,
#annotateView.active .playlist-item strong {
  color: var(--tele-ink);
}

#annotateView.active .clip-footer-section {
  order: 2;
}

#annotateView.active .pitch-surface-section {
  order: 1;
}

#annotateView.active .layers-section {
  order: 3;
}

@media (min-width: 1041px) {
  #annotateView.active.drawer-left-collapsed:not(.drawer-right-collapsed) {
    grid-template-columns: minmax(0, 1fr) 330px;
  }

  #annotateView.active:not(.drawer-left-collapsed).drawer-right-collapsed {
    grid-template-columns: 290px minmax(0, 1fr);
  }
}

@media (max-width: 1180px) {
  #annotateView.active {
    grid-template-columns: 1fr;
  }

  #annotateView.active .premium-tool-dock {
    justify-self: stretch;
    border-radius: 22px;
  }

  .premium-stage-top {
    display: grid;
  }
}

/* Premium suite shell: carries the telestration direction through every workspace. */
:root {
  --suite-bg: #070b14;
  --suite-bg-soft: #0d1321;
  --suite-panel: rgba(13, 18, 31, 0.78);
  --suite-panel-strong: rgba(17, 24, 39, 0.9);
  --suite-panel-soft: rgba(255, 255, 255, 0.065);
  --suite-ink: #f7f8fb;
  --suite-muted: rgba(247, 248, 251, 0.64);
  --suite-faint: rgba(247, 248, 251, 0.42);
  --suite-line: rgba(255, 255, 255, 0.13);
  --suite-line-strong: rgba(255, 255, 255, 0.2);
  --suite-green: #2de39a;
  --suite-green-soft: rgba(45, 227, 154, 0.15);
  --suite-blue: #63b3ff;
  --suite-amber: #ffc75a;
  --suite-danger: #ff9c9c;
  --suite-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  --bg: var(--suite-bg);
  --workspace: var(--suite-bg-soft);
  --surface: var(--suite-panel);
  --canvas: #050814;
  --ink: var(--suite-ink);
  --muted: var(--suite-muted);
  --line: var(--suite-line);
  --accent: var(--suite-green);
  --accent-soft: var(--suite-green-soft);
  --danger: var(--suite-danger);
  --shadow: var(--suite-shadow);
}

body {
  color: var(--suite-ink);
  background:
    radial-gradient(circle at 14% 8%, rgba(45, 227, 154, 0.16), transparent 30%),
    radial-gradient(circle at 86% 4%, rgba(99, 179, 255, 0.12), transparent 28%),
    linear-gradient(135deg, #050814, #111827 54%, #070b14);
}

.app-shell {
  background: transparent;
}

.topbar {
  border-bottom: 1px solid var(--suite-line);
  background: rgba(5, 8, 20, 0.78);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(24px) saturate(1.16);
}

.brand-mark {
  color: #06110d;
  background: linear-gradient(135deg, var(--suite-green), #eafff5);
  box-shadow: 0 0 34px rgba(45, 227, 154, 0.18);
}

.brand h1 {
  color: var(--suite-ink);
}

.brand p {
  color: var(--suite-muted);
}

.tabs {
  border-color: var(--suite-line);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.tab {
  color: var(--suite-muted);
}

.tab:hover {
  color: var(--suite-ink);
  background: rgba(255, 255, 255, 0.07);
}

.tab.active {
  color: #06110d;
  background: linear-gradient(135deg, var(--suite-green), #eafff5);
  box-shadow: 0 0 28px rgba(45, 227, 154, 0.14);
}

.ghost-button,
.drawer-toggle {
  border-color: var(--suite-line);
  color: var(--suite-ink);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
}

.ghost-button:hover,
.drawer-toggle:hover,
.panel-button:hover,
.skip-button:hover,
.mini-button:hover {
  border-color: rgba(45, 227, 154, 0.24);
  color: var(--suite-ink);
  background: rgba(255, 255, 255, 0.1);
}

.mode-view.active {
  color: var(--suite-ink);
  background:
    radial-gradient(circle at 20% 0%, rgba(45, 227, 154, 0.12), transparent 30%),
    radial-gradient(circle at 82% 6%, rgba(99, 179, 255, 0.1), transparent 26%),
    linear-gradient(135deg, rgba(5, 8, 20, 0.96), rgba(15, 23, 42, 0.94));
}

.left-panel,
.right-panel,
#libraryView .clip-browser,
.code-tray,
.transport,
.video-shell {
  border-color: var(--suite-line);
  color: var(--suite-ink);
  background: var(--suite-panel);
  box-shadow: var(--suite-shadow);
  backdrop-filter: blur(24px) saturate(1.16);
}

.panel-section,
.clip-footer-section,
.pitch-surface-section,
.graphic-section,
.layers-section,
.annotate-clip-section,
.annotate-playlist-section,
.annotate-pause-section,
.export-section {
  border-color: var(--suite-line);
  color: var(--suite-ink);
  background: var(--suite-panel-soft);
}

.panel-section:first-child {
  border-top-color: var(--suite-line);
}

.panel-section h2,
.clip-browser h2,
#libraryView .panel-section > h2,
#annotateView.active .panel-section > h2 {
  color: var(--suite-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status,
.empty,
.empty-copy,
.privacy-note,
.file-meta dt,
label,
.event-meta,
.clip-meta,
.pause-meta,
.annotation-meta,
.export-progress,
.library-header p,
.code-tray-head span,
output {
  color: var(--suite-muted);
}

input,
select,
textarea,
#annotateView.active input,
#annotateView.active select,
#annotateView.active textarea {
  border-color: var(--suite-line);
  color: var(--suite-ink);
  background: rgba(255, 255, 255, 0.08);
}

input::placeholder,
textarea::placeholder,
#annotateView.active input::placeholder,
#annotateView.active textarea::placeholder {
  color: var(--suite-faint);
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  border-color: rgba(45, 227, 154, 0.72);
  box-shadow: 0 0 0 3px rgba(45, 227, 154, 0.14);
}

.panel-button,
.primary-button,
.skip-button,
.mini-button,
#annotateView.active .panel-button,
#annotateView.active .primary-button,
#annotateView.active .mini-button {
  border-color: var(--suite-line);
  color: var(--suite-ink);
  background: rgba(255, 255, 255, 0.08);
}

.primary-button,
.icon-button,
#annotateView.active .primary-button,
#annotateView.active .export-section .primary-button,
#annotateView.active .icon-button {
  color: #06110d;
  border-color: transparent;
  background: linear-gradient(135deg, var(--suite-green), #eafff5);
  box-shadow: 0 0 30px rgba(45, 227, 154, 0.14);
}

.danger-button,
#annotateView.active .danger-button {
  color: var(--suite-danger);
  background: rgba(255, 156, 156, 0.09);
}

.upload-drop {
  border-color: rgba(45, 227, 154, 0.28);
  color: var(--suite-green);
  background: var(--suite-green-soft);
}

.stage,
#annotateView.active .stage {
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.05), transparent 34%),
    #050814;
}

.empty-state {
  color: var(--suite-ink);
  background:
    radial-gradient(circle at 50% 45%, rgba(45, 227, 154, 0.13), transparent 32%),
    linear-gradient(135deg, #050814, #111827);
}

.empty-state span {
  color: var(--suite-muted);
}

input[type="range"] {
  accent-color: var(--suite-green);
}

.code-tray {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035)),
    var(--suite-panel);
}

.code-tray-head strong,
.library-header h2,
#libraryView .library-header h2,
.file-meta dd,
.clip-title,
.event-title,
.pause-title,
.annotation-title,
.playlist-item strong,
#annotateView.active .annotation-title,
#annotateView.active .pause-title,
#annotateView.active .playlist-item strong {
  color: var(--suite-ink);
}

.code-card {
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
}

.code-button {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.code-edit-button {
  color: #06110d;
  background: rgba(255, 255, 255, 0.82);
}

#codeView .left-panel::before {
  color: var(--suite-ink);
}

#codeView .left-panel::after {
  color: var(--suite-muted);
  border: 1px solid var(--suite-line);
  background: rgba(255, 255, 255, 0.055);
}

#codeView .right-panel .accent,
#libraryView .right-panel .accent {
  border-color: rgba(45, 227, 154, 0.18);
  background: var(--suite-green-soft);
}

.event-item,
.clip-card,
.pause-item,
.annotation-item,
.playlist-item,
#annotateView.active .pause-item,
#annotateView.active .annotation-item,
#annotateView.active .playlist-item {
  border-color: var(--suite-line);
  color: var(--suite-ink);
  background: rgba(255, 255, 255, 0.07);
}

.event-item:hover,
.clip-card:hover,
.playlist-item.selectable:hover {
  border-color: rgba(45, 227, 154, 0.25);
  background: rgba(255, 255, 255, 0.1);
}

.clip-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.08)),
    rgba(8, 13, 26, 0.82);
}

.clip-card::before {
  background:
    linear-gradient(90deg, transparent 49%, rgba(255, 255, 255, 0.4) 50%, transparent 51%),
    repeating-linear-gradient(105deg, rgba(45, 227, 154, 0.16) 0 34px, rgba(99, 179, 255, 0.11) 34px 68px);
  opacity: 0.86;
}

.clip-card.active,
.clip-card.in-playlist,
.pause-item.active,
.annotation-item.active,
.playlist-item.active,
#annotateView.active .pause-item.active,
#annotateView.active .annotation-item.active,
#annotateView.active .playlist-item.active {
  border-color: rgba(45, 227, 154, 0.38);
  background: var(--suite-green-soft);
  box-shadow: inset 0 0 0 1px rgba(45, 227, 154, 0.16), 0 18px 46px rgba(0, 0, 0, 0.22);
}

.clip-card.in-playlist::after {
  color: #06110d;
  background: linear-gradient(135deg, var(--suite-green), #eafff5);
}

.library-preview video {
  border: 1px solid var(--suite-line);
  background: #050814;
}

.library-preview-controls {
  border-bottom-color: var(--suite-line);
}

.reference-list {
  border-color: var(--suite-line);
  background: rgba(255, 255, 255, 0.06);
}

.reference-item {
  color: var(--suite-ink);
}

.playlist-index {
  color: #06110d;
  background: var(--suite-green);
}

.drawer-left-collapsed .drawer-toggle-left,
.drawer-right-collapsed .drawer-toggle-right {
  color: var(--suite-green);
  border-color: rgba(45, 227, 154, 0.22);
  background: var(--suite-green-soft);
}

#libraryView {
  background:
    radial-gradient(circle at 18% 10%, rgba(45, 227, 154, 0.13), transparent 30%),
    linear-gradient(135deg, rgba(5, 8, 20, 0.98), rgba(15, 23, 42, 0.94));
}

#libraryView .clip-browser {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035)),
    var(--suite-panel);
}

#annotateView.active {
  --tele-ink: var(--suite-ink);
  --tele-muted: var(--suite-muted);
  --tele-line: var(--suite-line);
  --tele-panel: var(--suite-panel);
  --tele-panel-strong: var(--suite-panel-strong);
  --tele-green: var(--suite-green);
  --tele-green-soft: var(--suite-green-soft);
  --tele-shadow: var(--suite-shadow);
}

#annotateView.active .left-panel,
#annotateView.active .right-panel,
#annotateView.active .transport,
#annotateView.active .premium-tool-dock,
#annotateView.active .video-shell {
  background: var(--suite-panel);
}

#annotateView.active .stage-column {
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto minmax(150px, 0.32fr);
}

#annotateView.active .video-shell {
  width: 100%;
  height: clamp(320px, 58vh, 760px);
  min-height: 320px;
}

#annotateView.active #annotateStage {
  width: 100%;
  height: 100%;
  min-height: 320px;
}

#annotateView.active #annotateStage #video,
#annotateView.active #annotateOverlay {
  display: block;
}

@media (min-width: 1041px) {
  #annotateView.active .video-shell {
    width: calc(100% - 74px);
    margin-left: 74px;
  }

  #annotateView.active .premium-tool-dock {
    position: absolute;
    top: 58px;
    left: 0;
    z-index: 35;
    width: 58px;
    max-width: none;
    max-height: calc(100% - 250px);
    display: grid;
    justify-self: auto;
    align-content: start;
    gap: 7px;
    padding: 7px 6px;
    overflow: hidden auto;
    border-radius: 18px;
    background: rgba(7, 13, 28, 0.82);
  }

  #annotateView.active .premium-tool-dock h2 {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  #annotateView.active .premium-tool-dock .tool-grid {
    display: grid;
    gap: 6px;
    justify-items: center;
    overflow: visible;
  }

  #annotateView.active .premium-tool-dock .tool-button {
    width: 46px;
    min-width: 46px;
    max-width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 14px;
  }

  #annotateView.active .premium-tool-dock .tool-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  #annotateView.active .premium-tool-dock .tool-button::before {
    width: auto;
    height: auto;
    flex: 0 0 auto;
    margin: 0;
    line-height: 1;
    font-size: 21px;
    text-align: center;
  }
}

.studio-timeline {
  min-height: 150px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
  overflow: hidden;
  border: 1px solid var(--tele-line, rgba(255, 255, 255, 0.13));
  border-radius: 18px;
  background: rgba(7, 13, 28, 0.82);
  box-shadow: var(--tele-shadow, 0 28px 80px rgba(0, 0, 0, 0.34));
}

.studio-timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.studio-timeline-head div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.studio-timeline-head strong {
  color: var(--tele-ink, #f7f8fb);
  font-size: 13px;
}

.studio-timeline-head span {
  min-width: 0;
  overflow: hidden;
  color: var(--tele-muted, rgba(247, 248, 251, 0.66));
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-stage {
  position: relative;
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 0;
  overflow: auto;
  padding: 20px 0 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px) 124px 0 / calc((100% - 124px) / 6) 100%,
    rgba(255, 255, 255, 0.035);
}

.timeline-stage.empty {
  place-items: center;
  padding: 18px;
  color: var(--tele-muted, rgba(247, 248, 251, 0.66));
  font-size: 12px;
  text-align: center;
}

.timeline-empty {
  display: grid;
  gap: 4px;
}

.timeline-empty strong {
  color: var(--tele-ink, #f7f8fb);
}

.timeline-ruler {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 18px;
  margin-left: 124px;
  color: rgba(247, 248, 251, 0.5);
  font-size: 10px;
}

.timeline-ruler span {
  position: absolute;
  top: 0;
  translate: -50% 0;
  white-space: nowrap;
}

.timeline-playhead {
  position: absolute;
  z-index: 8;
  top: 18px;
  bottom: 4px;
  left: calc(124px + ((100% - 124px) * var(--playhead, 0) / 100));
  width: 2px;
  background: #ff8a2a;
  box-shadow: 0 0 18px rgba(255, 138, 42, 0.42);
  pointer-events: none;
}

.timeline-playhead::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  width: 12px;
  height: 12px;
  translate: -50% 0;
  rotate: 45deg;
  border-radius: 3px;
  background: #ff8a2a;
}

.timeline-lane {
  display: grid;
  grid-template-columns: 124px minmax(360px, 1fr);
  min-height: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.timeline-lane-label {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 0 10px;
  overflow: hidden;
  color: var(--tele-muted, rgba(247, 248, 251, 0.66));
  font-size: 11px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-track {
  position: relative;
  min-height: 28px;
}

.timeline-block {
  position: absolute;
  top: 5px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pause-block {
  background: linear-gradient(90deg, #c91935, rgba(201, 25, 53, 0.7));
}

.annotation-block {
  background: linear-gradient(90deg, rgba(74, 122, 157, 0.95), rgba(74, 122, 157, 0.64));
}

.annotation-block.empty {
  color: rgba(247, 248, 251, 0.48);
  background: rgba(255, 255, 255, 0.08);
}

.tracked-ring-block {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--ring-color, #2de39a) 92%, transparent), color-mix(in srgb, var(--ring-color, #2de39a) 48%, transparent));
}

.timeline-keyframe-dot {
  position: absolute;
  top: 50%;
  z-index: 4;
  width: 8px;
  height: 8px;
  translate: -50% -50%;
  border: 1px solid rgba(8, 14, 27, 0.82);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(45, 227, 154, 0.22);
}

.timeline-block.active,
.timeline-lane.active .timeline-block {
  border-color: rgba(45, 227, 154, 0.72);
  box-shadow: 0 0 0 2px rgba(45, 227, 154, 0.12), 0 0 18px rgba(45, 227, 154, 0.16);
}

.tracked-ring-list {
  display: grid;
  gap: 8px;
}

.tracked-ring-list.empty {
  color: var(--tele-muted, rgba(247, 248, 251, 0.66));
  font-size: 12px;
  font-weight: 750;
}

.tracked-ring-item {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--tele-ink, #f7f8fb);
  text-align: left;
}

.tracked-ring-item.active {
  border-color: rgba(45, 227, 154, 0.72);
  background: rgba(45, 227, 154, 0.14);
}

.tracked-ring-item strong,
.tracked-ring-item small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tracked-ring-item small {
  margin-top: 2px;
  color: var(--tele-muted, rgba(247, 248, 251, 0.66));
  font-size: 11px;
  font-weight: 800;
}

.tracked-ring-swatch {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.68);
  border-radius: 999px;
  box-shadow: inset 0 0 0 5px rgba(8, 14, 27, 0.64);
}

.tracked-ring-properties {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.tracked-ring-properties .inline-check {
  min-height: 34px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.tracked-ring-properties .inline-check input {
  width: 18px !important;
  height: 18px !important;
  flex: 0 0 auto;
}

.left-panel::-webkit-scrollbar-thumb,
.right-panel::-webkit-scrollbar-thumb,
.code-tray .code-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.24);
}

@media (max-width: 1320px) {
  .topbar {
    grid-template-columns: 240px minmax(360px, 520px) 1fr;
  }
}

@media (max-width: 1040px) {
  .topbar {
    background: rgba(5, 8, 20, 0.9);
  }

  .mode-view.active {
    min-height: calc(100vh - 150px);
  }

  .left-panel,
  .right-panel,
  #libraryView .clip-browser {
    background: rgba(13, 18, 31, 0.84);
  }

  #annotateView.active .video-shell,
  #annotateView.active #annotateStage {
    min-height: 240px;
    height: clamp(240px, 48vh, 520px);
  }
}

/* Final polish: stage guidance and consistent pill/button text alignment. */
.stage-guide {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 14px;
  align-items: center;
  min-width: 0;
  padding: 14px 14px 14px 16px;
  border: 1px solid var(--suite-line);
  border-radius: 20px;
  color: var(--suite-ink);
  background:
    linear-gradient(135deg, rgba(45, 227, 154, 0.14), rgba(99, 179, 255, 0.07)),
    rgba(255, 255, 255, 0.065);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px) saturate(1.12);
}

.stage-guide[hidden] {
  display: none !important;
}

.stage-guide strong {
  display: block;
  margin-bottom: 3px;
  color: var(--suite-ink);
  font-size: 13px;
  font-weight: 900;
}

.stage-guide p {
  margin: 0;
  color: var(--suite-muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.42;
}

.stage-guide b {
  color: var(--suite-green);
  font-weight: 900;
}

.text-tool-help {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(45, 227, 154, 0.2);
  border-radius: 14px;
  color: var(--suite-muted);
  background: rgba(45, 227, 154, 0.09);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
}

.text-tool-help strong {
  color: var(--suite-green);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.annotation-properties[data-annotation-type="label"] .annotation-text-editor {
  padding: 12px;
  border: 1px solid rgba(45, 227, 154, 0.28);
  border-radius: 16px;
  background: rgba(45, 227, 154, 0.1);
  color: var(--suite-ink);
}

.annotation-properties[data-annotation-type="label"] .annotation-text-editor textarea {
  min-height: 104px;
  font-size: 14px;
  font-weight: 750;
}

.guide-dismiss {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--suite-line);
  border-radius: 999px;
  color: var(--suite-ink);
  background: rgba(255, 255, 255, 0.08);
  font-size: 18px;
  font-weight: 750;
}

#libraryView .clip-browser {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.tab,
.ghost-button,
.panel-button,
.primary-button,
.icon-button,
.tool-button,
.drawer-toggle,
.skip-button,
.mini-button,
.code-edit-button,
.guide-dismiss,
.telestration-swatches button,
.upload-drop,
.clip-card .mini-button,
.event-item .mini-button,
.pause-item .mini-button,
.annotation-item .mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.12;
  white-space: normal;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.panel-button,
.primary-button,
.ghost-button,
.skip-button,
.tab,
.tool-button {
  min-width: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.panel-button,
.primary-button {
  min-height: 40px;
}

.button-row .panel-button,
.button-row .primary-button {
  height: auto;
}

.mini-button {
  min-width: 28px;
  min-height: 28px;
  padding: 0 8px;
}

.icon-button,
.drawer-toggle,
.guide-dismiss,
.telestration-swatches button {
  flex: 0 0 auto;
}

.tool-button span,
.tab,
.panel-button,
.primary-button,
.ghost-button,
.skip-button,
.mini-button {
  min-width: 0;
  max-width: 100%;
}

.tool-button span {
  display: inline-block;
  text-align: center;
  line-height: 1.12;
}

#annotateView.active .premium-tool-dock .tool-button {
  min-width: 82px;
  max-width: 116px;
}

#annotateView.active .premium-tool-dock .tool-button span {
  white-space: nowrap;
}

@media (min-width: 1041px) {
  #annotateView.active .premium-tool-dock .tool-button {
    width: 46px;
    min-width: 46px;
    max-width: 46px;
  }

  #annotateView.active .premium-tool-dock .tool-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
}

.code-button {
  align-items: center;
  justify-items: center;
  justify-content: center;
}

.code-button strong,
.code-button span {
  max-width: 100%;
}

.surface-status-pill {
  min-width: 0;
  text-align: center;
  line-height: 1.12;
}

.playlist-item .mini-button {
  width: 28px;
  height: 28px;
  padding: 0;
}

.topbar .ghost-button {
  min-width: 128px;
  width: auto;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .stage-guide {
    grid-template-columns: minmax(0, 1fr) 34px;
  }

  #annotateView.active .premium-tool-dock .tool-button {
    min-width: 76px;
  }
}

/* Tablet and phone support: keep the same workflow, but make every workspace touch-first. */
@media (max-width: 1180px), (pointer: coarse) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  body {
    overflow: auto;
  }

  button,
  input,
  select,
  textarea {
    font-size: 16px;
  }

  .app-shell {
    height: auto;
    min-height: 100svh;
    grid-template-rows: auto 1fr;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 90;
    grid-template-columns: minmax(150px, 1fr) minmax(280px, 1.4fr) auto;
    gap: 10px;
    padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
  }

  .brand h1 {
    font-size: 14px;
  }

  .brand p {
    display: none;
  }

  .tabs {
    min-width: 0;
  }

  .tab,
  .ghost-button,
  .panel-button,
  .primary-button,
  .skip-button,
  .tool-button,
  .mini-button {
    min-height: 44px;
  }

  .icon-button,
  .drawer-toggle,
  .guide-dismiss {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .mode-view,
  #libraryView,
  #annotateView,
  #annotateView.drawer-left-collapsed,
  #annotateView.drawer-right-collapsed,
  #annotateView.drawer-left-collapsed:not(.drawer-right-collapsed),
  #annotateView:not(.drawer-left-collapsed).drawer-right-collapsed,
  #annotateView.drawer-left-collapsed.drawer-right-collapsed {
    height: auto;
    min-height: calc(100svh - 72px);
    display: none;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 14px max(14px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    overflow: visible;
  }

  .mode-view.active,
  #codeView.active,
  #libraryView.active,
  #annotateView.active {
    display: grid;
  }

  #codeView .stage-column,
  #libraryView .left-panel,
  #libraryView .right-panel,
  #libraryView .clip-browser,
  #annotateView .left-panel,
  #annotateView .right-panel,
  #annotateView .stage-column,
  .left-panel,
  .right-panel {
    position: relative;
    inset: auto;
    width: 100%;
    min-width: 0;
    max-width: none;
    transform: none !important;
    opacity: 1 !important;
  }

  .drawer-toggle {
    display: none;
  }

  .stage-column {
    justify-self: stretch;
  }

  #codeView .stage-column {
    order: 1;
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  #codeView .left-panel {
    order: 2;
  }

  #codeView .right-panel {
    order: 3;
  }

  #codeView .video-shell,
  #annotateView.active .video-shell {
    aspect-ratio: 16 / 9;
    height: auto;
    min-height: 0;
  }

  #codeView .stage,
  #annotateView.active #annotateStage {
    min-height: 0;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  #codeView .video-shell {
    display: block;
    width: 100%;
    min-height: clamp(190px, 56vw, 420px);
    background: var(--canvas);
  }

  #codeView .stage {
    height: 100%;
    min-height: inherit;
    overflow: hidden;
  }

  #codeView #video {
    z-index: 1;
    display: block;
    opacity: 1;
  }

  #codeView #overlay {
    z-index: 2;
  }

  #codeView #emptyState {
    z-index: 3;
  }

  #video,
  #overlay,
  #annotateOverlay {
    touch-action: none;
  }

  .transport {
    grid-template-columns: 54px 54px 54px minmax(0, 1fr) 76px auto;
    gap: 10px;
    padding: 10px;
  }

  .transport input[type="range"] {
    min-width: 90px;
  }

  .code-tray {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .code-tray-head {
    width: auto;
  }

  .code-tray .code-grid,
  #toolGrid {
    -webkit-overflow-scrolling: touch;
  }

  .code-tray .code-grid {
    grid-auto-columns: minmax(180px, 230px);
  }

  .code-button {
    min-height: 78px;
  }

  .panel-section,
  #libraryView .clip-browser,
  .left-panel,
  .right-panel {
    border-radius: 22px;
  }

  #libraryView .clip-browser {
    order: 1;
    padding: 18px;
  }

  #libraryView .left-panel {
    order: 2;
  }

  #libraryView .right-panel {
    order: 3;
  }

  #libraryView .clip-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  #annotateView.active .stage-column {
    order: 1;
    grid-template-rows: auto auto auto auto;
  }

  #annotateView.active .left-panel {
    order: 2;
  }

  #annotateView.active .right-panel {
    order: 3;
  }

  #annotateView.active .premium-stage-top {
    grid-template-columns: minmax(0, 1fr);
  }

  #annotateView.active .premium-tool-dock {
    position: sticky;
    top: 78px;
    z-index: 40;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 10px;
  }

  #annotateView.active .premium-tool-dock h2 {
    margin: 0;
  }

  #annotateView.active .premium-tool-dock .tool-grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(92px, max-content);
    grid-template-columns: none;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding-bottom: 2px;
  }

  #annotateView.active .premium-tool-dock .tool-button {
    min-width: 92px;
    max-width: none;
    padding-inline: 14px;
  }

  .annotation-properties {
    gap: 10px;
  }

  .button-row {
    gap: 10px;
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .brand {
    justify-content: center;
  }

  .tabs {
    overflow-x: auto;
    grid-template-columns: repeat(3, minmax(136px, 1fr));
    border-radius: 18px;
    -webkit-overflow-scrolling: touch;
  }

  .tab {
    font-size: 13px;
    white-space: nowrap;
  }

  .ghost-button {
    justify-self: stretch;
    width: 100%;
  }

  .mode-view,
  #libraryView,
  #annotateView {
    padding-inline: 10px;
    gap: 12px;
  }

  .stage-guide {
    grid-template-columns: minmax(0, 1fr) 40px;
    padding: 12px;
  }

  .stage-guide p {
    font-size: 12px;
  }

  .transport {
    grid-template-columns: 48px 48px 48px minmax(96px, 1fr) 76px;
  }

  .transport output {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .code-tray .code-grid {
    grid-auto-columns: minmax(160px, 76vw);
  }

  .code-form {
    grid-template-columns: 1fr;
  }

  .code-form label,
  .graphic-section .annotation-properties label:nth-child(1),
  .graphic-section .annotation-properties label:nth-child(2),
  #annotateView.active .annotation-properties label:nth-child(1),
  #annotateView.active .annotation-properties label:nth-child(2) {
    grid-template-columns: 1fr;
  }

  #libraryView .clip-list {
    grid-template-columns: 1fr;
  }

  #annotateView.active .premium-tool-dock {
    top: 132px;
    grid-template-columns: 1fr;
  }

  #annotateView.active .premium-tool-dock .tool-grid {
    grid-auto-columns: minmax(86px, max-content);
  }

  .telestration-swatches,
  .pitch-actions,
  .button-row {
    grid-template-columns: 1fr;
  }

  .playlist-item,
  .event-item,
  .pause-item,
  .annotation-item {
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand h1 {
    font-size: 15px;
  }

  .mode-view,
  #libraryView,
  #annotateView {
    padding-inline: 8px;
  }

  .panel-section,
  #libraryView .clip-browser,
  .code-tray,
  .transport,
  #annotateView.active .premium-tool-dock {
    border-radius: 18px;
  }

  #codeView .stage-column,
  #annotateView.active .stage-column {
    gap: 8px;
  }

  .video-shell {
    border-radius: 14px;
  }

  #codeView .video-shell {
    min-height: clamp(176px, 57vw, 300px);
  }

  .transport {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .transport input[type="range"],
  .transport output,
  .transport .speed-select {
    grid-column: 1 / -1;
  }

  .transport .speed-select {
    width: 100%;
  }

  .skip-button,
  .icon-button {
    width: 100%;
  }

  #annotateView.active .premium-stage-top {
    display: none;
  }

  #annotateView.active .premium-tool-dock {
    top: 126px;
  }

  #annotateView.active .premium-tool-dock .tool-button {
    min-width: 82px;
  }

  .clip-card {
    min-height: 150px;
  }
}

/* Mobile annotate cleanup: keep the video first and make tools reachable. */
@media (max-width: 760px) {
  #annotateView.active {
    align-content: start;
  }

  #annotateView.active .stage-column {
    display: grid;
    grid-template-rows: auto auto auto auto auto auto;
    gap: 10px;
  }

  #annotateView.active .annotate-guide {
    order: 1;
  }

  #annotateView.active .premium-stage-top {
    order: 2;
  }

  #annotateView.active .video-shell {
    order: 3;
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
    border-radius: 20px;
  }

  #annotateView.active #annotateStage {
    min-height: 0;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  #annotateView.active .transport {
    order: 4;
  }

  #annotateView.active .premium-tool-dock {
    order: 5;
    position: sticky;
    top: auto;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 70;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
    border-radius: 20px;
    background: rgba(7, 13, 28, 0.94);
  }

  #annotateView.active .premium-tool-dock h2 {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
    margin: 0;
    color: var(--tele-muted);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  #annotateView.active .premium-tool-dock .tool-grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(74px, 1fr);
    gap: 8px;
    overflow-x: auto;
    padding: 0 2px 3px;
  }

  #annotateView.active .premium-tool-dock .tool-button {
    min-width: 74px;
    height: 54px;
    display: grid;
    grid-template-rows: 22px 1fr;
    place-items: center;
    gap: 2px;
    padding: 6px 8px;
    border-radius: 16px;
  }

  #annotateView.active .premium-tool-dock .tool-button::before {
    width: 22px;
    height: 22px;
    margin: 0;
    font-size: 18px;
    line-height: 1;
  }

  #annotateView.active .premium-tool-dock .tool-button span {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
    overflow: hidden;
    max-width: 100%;
    font-size: 10px;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #annotateView.active .studio-timeline {
    order: 6;
  }

  #annotateView.active .right-panel {
    max-height: none;
  }

  #annotateView.active .clip-footer-section {
    order: 1;
  }

  #annotateView.active .graphic-section {
    order: 2;
  }

  #annotateView.active .pitch-surface-section {
    order: 3;
  }

  #annotateView.active .layers-section {
    order: 4;
  }
}

@media (max-width: 480px) {
  #annotateView.active .annotate-guide {
    display: none;
  }

  #annotateView.active .premium-stage-top {
    display: flex;
  }

  #annotateView.active .surface-status-pill {
    width: 100%;
    justify-content: center;
    height: 34px;
    font-size: 11px;
  }

  #annotateView.active .premium-tool-dock {
    margin-inline: 0;
  }

  #annotateView.active .premium-tool-dock .tool-grid {
    grid-auto-columns: minmax(68px, 1fr);
  }

  #annotateView.active .premium-tool-dock .tool-button {
    min-width: 68px;
  }
}

/* iPad/tablet annotate flow: keep the player compact and remove the unused
   vertical gulf between the video and the controls. */
@media (min-width: 761px) and (max-width: 1180px) {
  #annotateView.active {
    align-content: start;
  }

  #annotateView.active .stage-column {
    display: grid;
    grid-template-rows: auto auto auto auto auto auto;
    align-content: start;
    gap: 12px;
    min-height: 0;
  }

  #annotateView.active .annotate-guide {
    order: 1;
  }

  #annotateView.active .premium-stage-top {
    order: 2;
    margin-bottom: 0;
  }

  #annotateView.active .video-shell {
    order: 3;
    align-self: start;
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: min(58svh, 620px);
    aspect-ratio: 16 / 9;
  }

  #annotateView.active #annotateStage {
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
  }

  #annotateView.active .transport {
    order: 4;
  }

  #annotateView.active .premium-tool-dock {
    order: 5;
  }

  #annotateView.active .studio-timeline {
    order: 6;
  }
}

/* Annotate inspector scroll fix: the sidebar scrolls as one surface, while
   each card keeps its own contents contained so sections never overlap. */
#annotateView.active .right-panel {
  min-height: 0;
  max-height: calc(100dvh - 126px);
  align-content: start;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-block: 14px;
  -webkit-overflow-scrolling: touch;
}

#annotateView.active .right-panel .panel-section,
#annotateView.active .right-panel .panel-section.collapsible-section,
#annotateView.active .right-panel .panel-section:not(.is-collapsed) {
  min-height: 0;
  overflow: hidden;
}

#annotateView.active .right-panel .panel-section.is-collapsed {
  overflow: hidden;
}

#annotateView.active .right-panel .panel-section > * {
  min-width: 0;
}

#annotateView.active .right-panel .tracked-ring-list,
#annotateView.active .right-panel .annotation-list {
  max-height: none;
  overflow: hidden;
}

#annotateView.active .right-panel textarea {
  max-height: none;
}

#annotateView.active .right-panel .pitch-surface-section:not(.is-collapsed) {
  max-height: 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#annotateView.active .right-panel .pitch-surface-section:not(.is-collapsed)::-webkit-scrollbar {
  width: 6px;
}

#annotateView.active .right-panel .pitch-surface-section:not(.is-collapsed)::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

@media (min-width: 761px) and (max-width: 1180px) {
  #annotateView.active .right-panel {
    max-height: none;
  }
}

/* Inspector cleanup: use simple document flow in the right toolbar. Nested
   scroll panes were making section contents clip and collide. */
#annotateView.active .right-panel.annotation-panel {
  display: block;
  align-content: initial;
  padding-bottom: 18px;
}

#annotateView.active .right-panel.annotation-panel .panel-section {
  display: grid;
  height: auto;
  min-height: auto;
  margin: 0 0 14px;
  overflow: visible;
}

#annotateView.active .right-panel.annotation-panel .panel-section:last-child {
  margin-bottom: 0;
}

#annotateView.active .right-panel.annotation-panel .panel-section.is-collapsed {
  overflow: hidden;
}

#annotateView.active .graphic-section .text-tool-help,
#annotateView.active .graphic-section #annotationEmpty,
#annotateView.active .pitch-surface-section #pitchMaskStatus,
#annotateView.active .tracking-section .empty-copy,
#annotateView.active .layers-section .empty-copy {
  display: block;
  white-space: normal;
  overflow: visible;
}

#annotateView.active .pitch-surface-section:not(.is-collapsed) {
  max-height: none !important;
  overflow: visible !important;
}

#annotateView.active .pitch-surface-section #maskPreview,
#annotateView.active .pitch-surface-section label:has(#maskPreview),
#annotateView.active .pitch-surface-section #clearPitchCalibration,
#annotateView.active .pitch-surface-section #exportFramePng {
  display: none !important;
}

#annotateView.active .pitch-surface-section .pitch-actions {
  grid-template-columns: 1fr;
}

#annotateView.active .clip-footer-section textarea {
  min-height: 96px;
}

/* Panel polish: keep inspector cards readable and let the sidebar do the scrolling. */
#annotateView.active .premium-stage-top,
#annotateView.active .surface-status-pill {
  display: none !important;
}

#annotateView.active .right-panel.annotation-panel,
#libraryView .right-panel {
  display: block !important;
  align-content: initial !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 22px;
}

#annotateView.active .right-panel.annotation-panel {
  max-height: calc(100dvh - 126px);
}

#libraryView .right-panel {
  max-height: calc(100dvh - 126px);
}

#annotateView.active .right-panel.annotation-panel::-webkit-scrollbar,
#libraryView .right-panel::-webkit-scrollbar {
  width: 8px;
}

#annotateView.active .right-panel.annotation-panel::-webkit-scrollbar-thumb,
#libraryView .right-panel::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  background-clip: content-box;
}

#annotateView.active .right-panel.annotation-panel .panel-section,
#libraryView .right-panel .panel-section {
  position: relative;
  display: grid !important;
  gap: 14px;
  width: 100%;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 0 16px !important;
  overflow: hidden !important;
  box-sizing: border-box;
}

#annotateView.active .right-panel.annotation-panel .panel-section:not(.is-collapsed),
#libraryView .right-panel .panel-section:not(.is-collapsed) {
  overflow: visible !important;
}

#annotateView.active .right-panel.annotation-panel .panel-section.is-collapsed,
#libraryView .right-panel .panel-section.is-collapsed {
  overflow: hidden !important;
}

#annotateView.active .right-panel.annotation-panel .panel-section > *,
#libraryView .right-panel .panel-section > * {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

#annotateView.active .right-panel.annotation-panel label,
#libraryView .right-panel label {
  display: grid;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

#annotateView.active .right-panel.annotation-panel input,
#annotateView.active .right-panel.annotation-panel textarea,
#annotateView.active .right-panel.annotation-panel select,
#libraryView .right-panel input,
#libraryView .right-panel textarea,
#libraryView .right-panel select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

#annotateView.active .clip-footer-section .toggle-row,
#libraryView .clip-editor .toggle-row {
  display: grid !important;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  column-gap: 10px;
  row-gap: 0;
  width: 100%;
  margin: 0;
  padding: 8px 0 0;
}

#annotateView.active .clip-footer-section .toggle-row input,
#libraryView .clip-editor .toggle-row input {
  grid-column: 1;
  width: 22px !important;
  min-width: 22px;
  height: 22px !important;
  margin: 2px 0 0;
}

#annotateView.active .clip-footer-section .toggle-row span,
#libraryView .clip-editor .toggle-row span {
  grid-column: 2;
  display: block;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

#annotateView.active .clip-footer-section textarea,
#libraryView .clip-editor textarea {
  min-height: 104px;
  max-height: none;
  resize: vertical;
}

#libraryView .library-preview {
  gap: 12px;
}

#libraryView .library-preview-controls {
  display: grid !important;
  grid-template-columns: 48px 60px 48px;
  gap: 10px;
  align-items: center;
  justify-content: start;
  min-height: 0;
  padding: 0 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

#libraryView .library-preview-controls .preview-skip,
#libraryView .library-preview-controls .preview-play {
  width: 48px;
  min-width: 48px;
  height: 48px;
  border-radius: 18px;
}

#libraryView .library-preview-controls .preview-play {
  background: linear-gradient(135deg, #31e59b, #caffec);
  color: #06110d;
  box-shadow: 0 14px 34px rgba(45, 227, 154, 0.24);
}

#libraryView .library-preview-controls .speed-select {
  grid-column: 1 / -1;
  min-height: 42px;
  border-color: rgba(45, 227, 154, 0.38);
  background:
    linear-gradient(135deg, rgba(45, 227, 154, 0.96), rgba(202, 255, 236, 0.96));
  color: #06110d;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 12px 30px rgba(45, 227, 154, 0.16);
}

#libraryView .library-preview-controls .status {
  grid-column: 1 / -1;
  justify-self: stretch;
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(244, 248, 255, 0.9);
  font-size: 13px;
  line-height: 1.3;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

#libraryView #libraryPreviewStatus {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

#libraryView .playlist-list {
  max-height: none;
  overflow: visible;
}

.topbar-actions {
  min-width: 0;
}

.topbar-actions .ghost-button {
  min-width: 0;
  white-space: nowrap;
}

.topbar-actions .account-pill {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions .account-pill.pro {
  border-color: rgba(45, 227, 154, 0.44);
  color: var(--suite-green, #2de39a);
  background: rgba(45, 227, 154, 0.14);
}

.modal-card .primary-button,
.modal-card .panel-button {
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  text-align: center;
}

.modal-card .panel-button {
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.075);
}

.modal-card .primary-button {
  color: #04100b;
  background: linear-gradient(135deg, #2de39a, #caffea);
}

@media (max-width: 1180px) {
  .landing-hero {
    grid-template-columns: 1fr;
  }

  .landing-product-card {
    max-width: 720px;
  }

  .topbar {
    grid-template-columns: minmax(170px, 0.72fr) minmax(280px, 1fr) minmax(220px, auto);
  }

  .topbar-actions {
    gap: 6px;
  }

  .topbar-actions .ghost-button {
    min-width: auto;
    padding-inline: 12px;
  }
}

@media (max-width: 820px) {
  .landing-page {
    padding: 18px 14px 34px;
  }

  .landing-nav {
    grid-template-columns: 1fr;
  }

  .landing-actions,
  .landing-cta-row {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .landing-page .primary-button,
  .landing-page .panel-button,
  .landing-page .ghost-button {
    width: 100%;
  }

  .landing-main {
    margin-top: 44px;
  }

  .landing-copy h2 {
    font-size: clamp(38px, 12vw, 54px);
  }

  .landing-subcopy {
    font-size: 16px;
  }

  .landing-product-card {
    padding: 12px;
    border-radius: 24px;
  }

  .landing-reel {
    min-height: 330px;
    border-radius: 18px;
  }

  .reel-slide {
    gap: 10px;
    padding: 12px;
  }

  .reel-topline {
    min-height: 34px;
  }

  .reel-code-tray {
    grid-template-columns: 1fr;
  }

  .code-chip {
    min-height: 42px;
  }

  .reel-stage.annotated {
    min-height: 220px;
  }

  .demo-ring {
    width: 58px;
    height: 18px;
    border-width: 5px;
  }

  .demo-arrow {
    width: 112px;
    height: 6px;
  }

  .demo-zone {
    width: 82px;
    height: 58px;
  }

  .reel-preview-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .landing-video-preview {
    min-height: 240px;
    border-radius: 18px;
  }

  .preview-ring {
    width: 58px;
    height: 18px;
    border-width: 5px;
  }

  .preview-arrow {
    width: 118px;
    height: 6px;
  }

  .preview-zone {
    width: 86px;
    height: 62px;
  }

  .landing-workflow {
    grid-template-columns: 1fr;
  }

  .plan-section {
    grid-template-columns: 1fr;
    margin-top: 42px;
  }

  .plan-card {
    padding: 22px;
  }

  .topbar-actions {
    justify-content: stretch;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .topbar-actions .ghost-button {
    width: 100%;
  }

  .topbar-actions .logout-button {
    display: none;
  }

  .modal-backdrop {
    align-items: start;
    padding: max(14px, env(safe-area-inset-top)) 12px 14px;
    overflow: auto;
  }

  .modal-card {
    width: 100%;
    max-height: none;
    border-radius: 22px;
  }

  .modal-head {
    padding: 22px 20px 18px;
  }

  .modal-head h2 {
    font-size: 22px;
  }

  .account-grid {
    grid-template-columns: 1fr;
    padding: 18px 16px 20px;
  }

  .project-library-head {
    grid-template-columns: 1fr;
  }

  .project-library-head .primary-button {
    width: 100%;
    min-width: 0;
  }
}

.drawer-toggle-label {
  display: none;
}

/* iPad annotate workspace: preserve the proven three-column studio and add a
   reliable control that can remove the right-hand tools column on demand. */
@media (min-width: 761px) and (max-width: 1400px) {
  #annotateView.active,
  #annotateView.active.drawer-left-collapsed,
  #annotateView.active.drawer-right-collapsed,
  #annotateView.active.drawer-left-collapsed.drawer-right-collapsed,
  #annotateView.active.drawer-left-collapsed:not(.drawer-right-collapsed),
  #annotateView.active:not(.drawer-left-collapsed).drawer-right-collapsed {
    display: grid !important;
    grid-template-columns: 280px minmax(0, 1fr) 330px !important;
    align-items: stretch;
    gap: 14px;
    padding: 16px;
    overflow: hidden;
  }

  #annotateView.active.drawer-right-collapsed,
  #annotateView.active.drawer-left-collapsed.drawer-right-collapsed,
  #annotateView.active:not(.drawer-left-collapsed).drawer-right-collapsed {
    grid-template-columns: 280px minmax(0, 1fr) !important;
  }

  #annotateView.active .left-panel {
    grid-column: 1;
    order: initial;
  }

  #annotateView.active .stage-column {
    grid-column: 2;
    order: initial;
    width: 100%;
    max-width: none;
  }

  #annotateView.active .right-panel {
    grid-column: 3;
    order: initial;
  }

  #annotateView.active .left-panel,
  #annotateView.active .right-panel,
  #annotateView.active .stage-column {
    position: relative !important;
    inset: auto !important;
    min-width: 0;
    transform: none !important;
    opacity: 1 !important;
  }

  #annotateView.active.drawer-right-collapsed .right-panel {
    display: none !important;
  }

  #annotateView.active .drawer-toggle-left {
    display: none !important;
  }

  #annotateView.active .drawer-toggle-right,
  #annotateView.active:not(.drawer-right-collapsed) .drawer-toggle-right {
    position: absolute;
    top: 24px;
    right: 24px !important;
    z-index: 120;
    width: auto;
    min-width: 0;
    height: 46px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 15px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    color: var(--tele-ink, #f7f8fb);
    background: rgba(13, 18, 31, 0.94);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(20px) saturate(1.15);
  }

  #annotateView.active .drawer-toggle-right .drawer-toggle-label {
    display: inline;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.01em;
  }

  #annotateView.active .drawer-toggle-right .drawer-toggle-icon {
    font-size: 16px;
    line-height: 1;
  }
}
