@font-face {
  font-family: "Hanken Grotesk";
  src: url("hanken-grotesk.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  font: 16px "Hanken Grotesk", system-ui, sans-serif;
  --bg: #f6f8fd;
  --surface: #fff;
  --inset: #f0f4ff;
  --line: #d9e3f1;
  --muted: #51647d;
  --ink: #193153;
  --primary: #003399;
  --navy: #223d6b;
  --accent: #f08b2d;
  --accent-ink: #47260b;
  --shadow: 0 1px 2px #0f172a0d, 0 8px 24px #243b6310;
  background: var(--bg);
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden], .symbols { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled, select:disabled { cursor: default; opacity: .42; }
button, input, select, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid #245edf; outline-offset: 3px; }
svg { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.masthead { background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 2px 12px #223d6b0a; }
.masthead-inner, main { width: min(100% - 64px, 1336px); margin-inline: auto; }
.masthead-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--navy); text-decoration: none; font-size: 1.38rem; font-weight: 850; letter-spacing: -.045em; white-space: nowrap; }
.brand-mark { display: block; flex: none; margin-right: 3px; }
.studio-label { color: #9b4712; background: #fff1e3; border-radius: 6px; padding: 3px 7px; font-size: .9rem; font-weight: 780; letter-spacing: -.01em; }
.header-actions, .draft-actions { display: flex; align-items: center; gap: 10px; }
.button, .icon-button, select { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 14px; border-radius: 8px; border: 1px solid transparent; color: var(--ink); background: transparent; font-size: .9rem; font-weight: 700; white-space: nowrap; }
.primary { background: var(--primary); color: #fff; }
.primary:hover:enabled { background: #002779; }
.capture { background: #ffac62; border-color: var(--accent); color: var(--accent-ink); }
.capture:hover:enabled { background: #ffa04e; }
.secondary, .icon-button, select { background: #f3f6fc; border-color: #d6e0ee; }
.secondary:hover:enabled, .icon-button:hover:enabled, select:hover:enabled, .camera-mode:hover:enabled { background: #e8effa; }
.icon-button { padding-inline: 11px; }
.light { color: var(--navy); border-color: #dce9ff; background: #fff; }
.light:hover:enabled { background: #eaf1ff; }

main { padding-block: 27px 40px; }
.project-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.project-identification { flex: 1; min-width: 0; }
.project-identification label { display: block; color: var(--muted); font-size: .875rem; font-weight: 600; margin-bottom: 2px; }
#projectName { border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--ink); width: min(100%, 580px); padding: 2px 7px 3px; margin-left: -8px; font-size: clamp(1.65rem, 3.1vw, 2.4rem); font-weight: 725; letter-spacing: -.045em; }
#projectName:hover, #projectName:focus { border-color: var(--line); background: var(--surface); }
select { appearance: none; max-width: 190px; padding-right: 33px; background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%2351647d' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; text-overflow: ellipsis; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(245px, 280px); gap: 18px; align-items: start; }
.monitor, .side-card, .timeline { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.viewfinder { display: grid; place-items: center; position: relative; isolation: isolate; overflow: hidden; width: 100%; aspect-ratio: 16 / 9; min-height: 290px; max-height: clamp(300px, calc(100dvh - 475px), 535px); background: radial-gradient(ellipse at 50% 40%, #2e548e 0, #1d3c6c 53%, #142a4e 100%); color: #fff; }
.viewfinder::before { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at center, #c7ddff58 1px, transparent 1.3px); background-size: 20px 20px; mask-image: radial-gradient(ellipse at center, #0008, #0000 74%); }
.viewfinder video, .viewfinder img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: contain; background: #101d34; }
.camera-empty { padding: 22px; text-align: center; }
.viewfinder-outline {
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  width: 66px;
  height: 58px;
  color: #ffc58d;
  background: #12305c94;
  border: 1px solid #9bbcf16b;
  border-radius: 14px;
}
.viewfinder-outline svg { width: 32px; height: 32px; }
h1, h2, p, dl, dd { margin: 0; }
.camera-empty h1 { font-size: clamp(1.35rem, 2.9vw, 2.05rem); letter-spacing: -.045em; }
.camera-empty p { color: #e1ebfe; line-height: 1.5; margin: 8px 0 19px; }
.monitor-status { position: absolute; left: 14px; top: 14px; padding: 6px 9px; background: #132749ed; border: 1px solid #7e98c3; border-radius: 6px; font-size: .875rem; }
.transport { min-height: 68px; padding: 10px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 9px; border-top: 1px solid var(--line); }
.capture { padding-inline: 16px; }
.capture-dot { border-radius: 50%; height: 12px; width: 12px; background: currentColor; border: 2px solid #ffac62; outline: 1px solid currentColor; }
.camera-mode { padding-inline: 9px; }
.speed-control { display: flex; margin-left: auto; align-items: center; gap: 9px; }
.speed-control label { color: var(--muted); font-size: .875rem; }
.speed-control select { min-height: 39px; }

.sidebar { display: grid; gap: 14px; }
.side-card { padding: 18px; }
h2 { font-size: 1rem; font-weight: 700; letter-spacing: -.015em; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); margin-block: 15px; padding-bottom: 13px; border-bottom: 1px solid var(--line); gap: 12px; }
.stats dt { color: var(--muted); font-size: .875rem; }
.stats dd { font-weight: 670; font-size: 1.45rem; font-variant-numeric: tabular-nums; letter-spacing: -.04em; margin-top: 2px; }
.save-status { color: #24633b; font-size: .875rem; line-height: 1.45; }
.save-status[data-state="error"] { color: #9d3525; }
.video-export { display: grid; gap: 6px; margin-top: 15px; }
.video-export p { color: var(--muted); font-size: .875rem; line-height: 1.4; }
#exportMeter { display: block; width: 100%; height: 9px; margin-block: 2px 6px; accent-color: var(--primary); }
.export-progress-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.handoff { background: #fff7ee; border-color: #f1ddc8; }
.side-icon { display: grid; place-items: center; width: 34px; height: 34px; color: #a44e16; background: #ffe9d2; border-radius: 8px; margin-bottom: 12px; }
.handoff p { color: #5f5660; font-size: .9rem; line-height: 1.55; margin-block: 7px 12px; }
.handoff strong { font-weight: 650; color: var(--ink); }
.text-button { padding: 3px 0; border: 0; background: none; color: var(--primary); text-decoration: underline; text-underline-offset: 3px; font-size: .875rem; font-weight: 700; }

.timeline { grid-column: 1 / -1; padding: 15px 16px 16px; }
.timeline-heading, .timeline-title, .edit-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.timeline-heading { justify-content: space-between; margin-bottom: 11px; min-height: 42px; }
.edit-actions .button { min-height: 36px; padding: 6px 10px; }
.edit-actions select { min-height: 36px; padding-block: 6px; padding-left: 10px; }
#timelineSummary { color: var(--muted); font-size: .875rem; }
#reorderHint { color: var(--muted); font-size: .875rem; margin-right: 4px; }
.timeline-empty { display: grid; align-items: center; padding: 11px; min-height: 75px; text-align: center; background: var(--inset); border: 1px dashed #becee5; border-radius: 8px; color: var(--muted); font-size: .9rem; }
.frame-strip { display: flex; gap: 11px; list-style: none; margin: 0; padding: 7px 9px 9px; overflow-x: auto; min-height: 85px; background: var(--inset); border: 1px solid #e0e8f6; border-radius: 9px; }
.frame-strip li { position: relative; flex-shrink: 0; }
.frame-strip [data-insert]::after { content: ''; position: absolute; z-index: 1; top: -2px; bottom: -2px; width: 3px; border-radius: 3px; background: #245edf; pointer-events: none; }
.frame-strip [data-insert="before"]::after { left: -7px; }
.frame-strip [data-insert="after"]::after { right: -7px; }
.frame { position: relative; display: block; width: 100px; aspect-ratio: 4 / 3; padding: 0; overflow: hidden; border: 1px solid #a8bbd8; border-radius: 7px; background: var(--navy); color: #fff; cursor: grab; user-select: none; touch-action: pan-x pan-y; }
.frame-strip[data-dragging="true"], .frame-strip[data-dragging="true"] .frame { cursor: grabbing; }
.frame[data-grabbed="true"] { opacity: .48; }
.frame[aria-pressed="true"] { outline: 2px solid #245edf; outline-offset: 1px; }
.frame:focus-visible { outline-offset: 3px; }
.frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.frame-number { position: absolute; bottom: 4px; left: 5px; padding: 2px 6px; background: #172f57ed; border-radius: 4px; font-size: .8rem; }
.frame-grip { position: absolute; top: 3px; right: 3px; display: grid; place-items: center; width: 30px; height: 28px; border-radius: 5px; background: #172f57ed; touch-action: none; }
.frame-grip::before { content: ''; width: 14px; height: 16px; background: radial-gradient(circle, #fff 1.35px, transparent 1.6px) 0 0 / 7px 5px; pointer-events: none; }
.audio-track { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding: 12px 0 0; margin-top: 10px; }
.audio-label { display: flex; align-items: center; min-width: 138px; gap: 9px; }
.audio-label svg { color: var(--primary); }
.audio-label h3 { margin: 0; font-size: .9rem; }
.audio-label p { color: var(--muted); font-size: .8rem; margin-top: 1px; }
.audio-actions { margin-left: auto; display: flex; gap: 7px; flex-wrap: wrap; }
.audio-actions .button { min-height: 36px; padding: 6px 10px; }
.record-dot { width: 9px; height: 9px; background: #d7473f; border-radius: 50%; }
.audio-clip { display: flex; align-items: center; justify-content: flex-start; gap: 4px; min-height: 34px; min-width: 130px; flex: 1; padding-inline: 12px; border: 1px solid #c2d2ee; border-radius: 6px; background: #eaf1ff; }
.audio-clip span { width: 3px; height: 8px; background: #4875ba; border-radius: 4px; }
.audio-clip span:nth-child(3n) { height: 16px; }
.audio-clip span:nth-child(4n) { height: 22px; }

.studio-footer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.teacher-mark { display: block; width: 44px; height: 44px; background: #fff1e3; border-radius: 10px; }
.teacher-copy p { margin-top: 2px; color: var(--muted); font-size: .875rem; line-height: 1.4; }
.studio-footer a { text-decoration: none; }

.notice { position: fixed; z-index: 2; bottom: 20px; right: 20px; width: min(calc(100vw - 40px), 440px); display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #edf5ff; border: 1px solid #a9c4ec; border-radius: 10px; box-shadow: var(--shadow); line-height: 1.45; }
.notice[data-error="true"] { background: #fff0ed; border-color: #e7a297; }
.notice span { flex: 1; }
.notice button { color: var(--ink); background: transparent; border: 0; min-width: 34px; min-height: 36px; font-size: 1.3rem; }

@media (max-width: 800px) {
  .masthead-inner, main { width: calc(100% - 32px); }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .viewfinder { max-height: none; }
  .timeline { grid-row: 2; }
  .sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 540px) {
  .masthead-inner { flex-wrap: wrap; justify-content: flex-start; gap: 11px; padding-block: 12px; }
  .header-actions { width: 100%; }
  .header-actions .button { flex: 1; padding-inline: 8px; }
  .project-heading { flex-wrap: wrap; gap: 10px; }
  .project-identification { flex-basis: 100%; }
  .sidebar { grid-template-columns: minmax(0, 1fr); }
  .viewfinder { min-height: 270px; }
  .transport { padding-inline: 9px; }
  .studio-footer { grid-template-columns: auto minmax(0, 1fr); gap: 10px 12px; }
  .studio-footer a { grid-column: 2; justify-self: start; }
}
