/* ASP Review. Brand: black and white, Outfit (display), DM Sans (body), DM Mono (timecode). */

:root {
  --black: #111111;
  --ink: #161616;
  --panel: #1c1c1d;
  --charcoal: #323132;
  --line: #2b2b2c;
  --dark: #555555;
  --gray: #999999;
  --soft: #c9c9c9;
  --white: #ffffff;
  --alert: #ec6a5e;
  --display: 'Outfit', system-ui, -apple-system, sans-serif;
  --body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --mono: 'DM Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --radius: 4px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--black);
  color: var(--white);
  font: 15px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }
::selection { background: var(--white); color: var(--black); }

/* ---------- logo ---------- */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.brand-sprockets { display: grid; grid-template-rows: repeat(8, 3px); gap: 2px; }
.brand-sprockets i { display: block; width: 4px; height: 3px; background: var(--white); border-radius: 0.5px; }
.brand-words { display: flex; flex-direction: column; line-height: 1; }
.brand-words b { font: 600 13px/1 var(--display); letter-spacing: 0.1em; }
.brand-words span { font: 400 7.5px/1 var(--body); letter-spacing: 0.5em; color: var(--gray); margin-top: 4px; }

/* ---------- buttons and fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--dark); border-radius: var(--radius);
  background: transparent; color: var(--white);
  font-weight: 500; font-size: 14px; white-space: nowrap;
  cursor: pointer; text-decoration: none;
  transition: background-color .12s, border-color .12s, color .12s;
}
.btn:hover { border-color: var(--gray); background: var(--charcoal); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--white); color: var(--black); border-color: var(--white); }
.btn-primary:hover { background: var(--soft); border-color: var(--soft); }
.btn-quiet { border-color: transparent; color: var(--gray); padding: 0 8px; }
.btn-quiet:hover { color: var(--white); background: var(--charcoal); border-color: transparent; }
.btn-danger { color: var(--alert); border-color: transparent; padding: 0 8px; }
.btn-danger:hover { background: rgba(236, 106, 94, .1); border-color: transparent; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--gray); }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 8px 12px;
  background: var(--ink); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .12s;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--dark); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--gray); }
.textarea { resize: vertical; min-height: 76px; line-height: 1.45; }
.select { appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23999' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--white); color: var(--black); padding: 10px 16px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500; z-index: 50; box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
.toast.is-error { background: var(--alert); color: var(--black); }

/* ---------- review page ---------- */
.review { display: flex; flex-direction: column; height: 100dvh; }
.topbar {
  display: flex; align-items: center; gap: 20px;
  min-height: 60px; padding: 10px 20px;
  border-bottom: 1px solid var(--line);
}
.topbar-title { min-width: 0; flex: 1; padding-left: 20px; border-left: 1px solid var(--line); }
.topbar-title h1 { margin: 0; font: 600 17px/1.2 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { margin: 2px 0 0; font-size: 13px; color: var(--gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.version-select { width: auto; min-height: 36px; height: 36px; padding-top: 0; padding-bottom: 0; font-weight: 500; }
.approved-tag { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  border: 1px solid var(--white); border-radius: var(--radius); font-size: 13px; font-weight: 500; }
.approved-tag svg { flex: none; }

.stage { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 380px; }
.viewer { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 16px 20px 14px; gap: 12px; }
.screen { position: relative; flex: 1; min-height: 200px; background: #000; border-radius: 2px; overflow: hidden; }
.screen video, .screen iframe, .screen .yt-host { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: contain; background: #000; }
.screen-click { position: absolute; inset: 0; cursor: pointer; }
.screen-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--gray); padding: 24px; }
.screen-empty strong { display: block; color: var(--white); font: 600 18px/1.3 var(--display); margin-bottom: 4px; }
.older-banner { position: absolute; left: 12px; top: 12px; z-index: 2; display: flex; align-items: center; gap: 10px;
  background: rgba(17,17,17,.88); border: 1px solid var(--line); padding: 6px 6px 6px 12px; border-radius: var(--radius); font-size: 13px; }

/* Film strip scrubber: the signature element. Sprocket holes top and bottom, notes as frames. */
.strip {
  --pct: 0%;
  position: relative; height: 40px; flex: none;
  background: var(--charcoal); border-radius: 2px;
  cursor: pointer; touch-action: none; user-select: none;
}
.strip::before, .strip::after {
  content: ''; position: absolute; left: 6px; right: 6px; height: 4px; pointer-events: none;
  background: repeating-linear-gradient(90deg, var(--black) 0 6px, transparent 6px 13px);
  border-radius: 1px;
}
.strip::before { top: 4px; }
.strip::after { bottom: 4px; }
.strip-band { position: absolute; left: 0; right: 0; top: 12px; bottom: 12px; overflow: hidden; }
.strip-played { position: absolute; left: 0; top: 0; bottom: 0; width: var(--pct); background: #4b4a4b; }
.strip-buffer { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(255,255,255,.05); }
.strip-head { position: absolute; top: -2px; bottom: -2px; left: var(--pct); width: 2px; margin-left: -1px; background: var(--white); pointer-events: none; z-index: 3; }
.strip-hover { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,.35); pointer-events: none; z-index: 2; }
.marker {
  position: absolute; top: 12px; bottom: 12px; width: 7px; margin-left: -3.5px; padding: 0;
  background: var(--white); border: 0; border-radius: 1px; cursor: pointer; z-index: 2;
  transition: transform .12s, background-color .12s;
}
.marker.is-resolved { background: var(--dark); }
.marker.is-owner { background: var(--soft); }
.marker:hover, .marker.is-active { transform: scaleY(1.45); }
.strip-tip {
  position: absolute; bottom: calc(100% + 8px); z-index: 5; width: max-content; max-width: 260px;
  transform: translateX(-50%); pointer-events: none;
  background: var(--white); color: var(--black); padding: 7px 10px; border-radius: var(--radius);
  font-size: 13px; line-height: 1.35; box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.strip-tip b { display: block; font-weight: 600; }
.strip-tip .tc { font-family: var(--mono); font-size: 11px; color: var(--dark); }

.transport { display: flex; align-items: center; gap: 4px; flex: none; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--white); cursor: pointer; }
.icon-btn:hover { background: var(--charcoal); }
.icon-btn svg { width: 18px; height: 18px; }
.timecode { margin-left: 10px; white-space: nowrap; font: 400 15px/1 var(--mono); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.timecode span { color: var(--dark); }
.transport-spacer { flex: 1; }
.kbd-hint { font-size: 12px; color: var(--dark); margin-right: 8px; }

/* Notes panel */
.notes { min-height: 0; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); }
.notes-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 12px; }
.notes-head h2 { margin: 0; font: 600 17px/1 var(--display); display: flex; align-items: baseline; gap: 8px; }
.notes-head h2 span { font: 400 13px/1 var(--body); color: var(--gray); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--gray); cursor: pointer; }
.check input { accent-color: var(--white); width: 15px; height: 15px; margin: 0; }
.notes-tools { display: flex; gap: 4px; padding: 0 14px 10px; }

.note-list { list-style: none; margin: 0; padding: 0 12px 12px; overflow-y: auto; flex: 1; min-height: 0; }
.note-empty { padding: 28px 10px; color: var(--gray); font-size: 14px; }
.note-empty strong { display: block; color: var(--white); font-weight: 600; margin-bottom: 2px; }
.note { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 12px 8px; border-top: 1px solid var(--line); border-radius: 2px; }
.note:first-child { border-top: 0; }
.note.is-active { background: rgba(255,255,255,.04); }
.note.is-resolved > .note-body > .note-text { color: var(--gray); text-decoration: line-through; text-decoration-color: var(--dark); }
.note-time {
  align-self: start; height: 24px; padding: 0 7px; border: 0; border-radius: 2px;
  background: var(--charcoal); color: var(--white); font: 400 12px/24px var(--mono); cursor: pointer; font-variant-numeric: tabular-nums;
}
.note-time:hover { background: var(--white); color: var(--black); }
.note-time.is-general { background: transparent; border: 1px solid var(--line); color: var(--gray); cursor: default; line-height: 22px; }
.note-meta { margin: 0 0 3px; font-size: 13px; color: var(--gray); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.note-meta b { color: var(--white); font-weight: 600; }
.owner-mark { display: inline-block; width: 4px; height: 3px; background: var(--white); box-shadow: 0 5px 0 var(--white); margin: 0 2px 4px 0; vertical-align: middle; }
.note-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-actions { display: flex; gap: 2px; margin: 6px 0 0 -8px; }
.replies { list-style: none; margin: 8px 0 0; padding: 0 0 0 12px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.reply-box { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.reply-box .textarea { min-height: 56px; }
.reply-box div { display: flex; gap: 6px; justify-content: flex-end; }

.composer { border-top: 1px solid var(--line); padding: 14px 20px 16px; display: flex; flex-direction: column; gap: 10px; flex: none; }
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stamp {
  display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 10px;
  border: 1px solid var(--white); border-radius: 2px; background: var(--white); color: var(--black);
  font: 400 12px/1 var(--mono); cursor: pointer;
}
.stamp[aria-pressed="false"] { background: transparent; color: var(--gray); border-color: var(--line); font-family: var(--body); font-size: 13px; }
.who { font-size: 13px; color: var(--gray); }
.who button { border: 0; background: none; color: var(--white); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; padding: 0; }
.composer-hint { font-size: 12px; color: var(--dark); }

/* Sign in / gate */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.gate-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 18px; }
.gate-card h1 { margin: 12px 0 0; font: 600 26px/1.2 var(--display); }
.gate-card p { margin: 0; color: var(--gray); }
.form-error { color: var(--alert); font-size: 14px; margin: 0; }

/* ---------- admin ---------- */
.admin-top { display: flex; align-items: center; gap: 20px; height: 60px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.admin-top .spacer { flex: 1; }
.admin-main { max-width: 1040px; margin: 0 auto; padding: 36px 24px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font: 600 34px/1.1 var(--display); letter-spacing: -0.01em; }
.page-head p { margin: 6px 0 0; color: var(--gray); }
.usage { min-width: 220px; }
.usage-bar { height: 4px; background: var(--charcoal); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.usage-bar i { display: block; height: 100%; background: var(--white); }
.usage small { font-size: 13px; color: var(--gray); }

.project-table { width: 100%; border-collapse: collapse; }
.project-table th { text-align: left; font-weight: 500; font-size: 13px; color: var(--gray); padding: 0 12px 10px; border-bottom: 1px solid var(--line); }
.project-table td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.project-table tr.row { cursor: pointer; }
.project-table tr.row:hover td { background: var(--ink); }
.project-table .t { font: 600 16px/1.3 var(--display); }
.project-table .c { color: var(--gray); font-size: 13px; }
.project-table .num { font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 2px; font-size: 12px; font-weight: 500; background: var(--charcoal); }
.pill-white { background: var(--white); color: var(--black); }
.pill-line { background: transparent; border: 1px solid var(--line); color: var(--gray); }
.muted { color: var(--gray); }

.empty-state { border: 1px dashed var(--dark); border-radius: var(--radius); padding: 48px 24px; text-align: center; color: var(--gray); }
.empty-state strong { display: block; color: var(--white); font: 600 20px/1.3 var(--display); margin-bottom: 6px; }

dialog { background: var(--panel); color: var(--white); border: 1px solid var(--line); border-radius: 6px; padding: 24px; width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.7); }
dialog h2 { margin: 0 0 18px; font: 600 20px/1.2 var(--display); }
dialog form { display: flex; flex-direction: column; gap: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

.detail-back { display: inline-flex; align-items: center; gap: 6px; color: var(--gray); text-decoration: none; font-size: 14px; margin-bottom: 18px; }
.detail-back:hover { color: var(--white); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
.section { margin-bottom: 36px; }
.section h2 { font: 600 18px/1.2 var(--display); margin: 0 0 12px; }
.share-box { display: flex; gap: 8px; }
.share-box .input { font-family: var(--mono); font-size: 13px; }
.share-note { font-size: 13px; color: var(--gray); margin: 8px 0 0; }
.share-note .btn { margin-left: -8px; }

.dropzone {
  position: relative; border: 1px dashed var(--dark); border-radius: var(--radius); padding: 28px 20px;
  text-align: center; color: var(--gray); transition: border-color .12s, background-color .12s;
}
.dropzone.is-over { border-color: var(--white); background: var(--ink); }
.dropzone strong { display: block; color: var(--white); font-weight: 600; margin-bottom: 4px; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.or-line { display: flex; align-items: center; gap: 12px; color: var(--dark); font-size: 13px; margin: 14px 0; }
.or-line::before, .or-line::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.add-row { display: flex; gap: 8px; }
.progress { margin-top: 14px; }
.progress-bar { height: 4px; background: var(--charcoal); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.progress-bar i { display: block; height: 100%; width: 0; background: var(--white); transition: width .2s; }
.progress small { font-size: 13px; color: var(--gray); font-variant-numeric: tabular-nums; }

.version-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.version-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.version-num { font: 600 22px/1 var(--display); }
.version-info { min-width: 0; }
.version-info b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.version-info small { color: var(--gray); font-size: 13px; }
.version-actions { display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }

.settings { display: flex; flex-direction: column; gap: 14px; padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.settings h2 { margin: 0; font: 600 16px/1.2 var(--display); }
.settings hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .review { height: auto; min-height: 100dvh; }
  .stage { grid-template-columns: 1fr; }
  .viewer { padding: 12px; }
  .screen { flex: none; aspect-ratio: 16 / 9; max-height: 70dvh; }
  .screen.is-vertical { aspect-ratio: 9 / 16; max-height: 70dvh; width: auto; margin: 0 auto; }
  .notes { border-left: 0; border-top: 1px solid var(--line); }
  .note-list { max-height: none; overflow: visible; }
  .kbd-hint { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 12px; padding: 10px 12px; }
  .topbar-title { order: 3; flex-basis: 100%; border-left: 0; padding-left: 0; }
  .topbar-actions { order: 4; width: 100%; flex-wrap: wrap; }
  .topbar-actions .version-select { flex: 1; min-width: 0; }
  .timecode { font-size: 13px; margin-left: 4px; }
  .transport .icon-btn { width: 32px; }
  .brand-words { display: none; }
  .project-table .hide-sm { display: none; }
  .admin-main { padding: 24px 16px 60px; }
  .page-head h1 { font-size: 28px; }
  .version-row { grid-template-columns: 40px minmax(0, 1fr); }
  .version-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
