:root {
  --background: #100e0c;
  --foreground: #f4efe6;
  --card: #1a1714;
  --muted: #2a241e;
  --muted-foreground: #b5a898;
  --border: #3a3229;
  --primary: #d4a054;
  --primary-foreground: #1a1308;
  --accent: #c46a3a;
  --destructive: #d45a4a;
  --opticon: #2ee6c8;
  --radius: 0.75rem;
}

* { box-sizing: border-box; border-color: var(--border); }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0; font-weight: 600; }
h1 { font-size: 1.5rem; letter-spacing: -0.02em; }
h2 { font-size: 0.95rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.muted { color: var(--muted-foreground); }
.small { font-size: 0.8rem; }
.tiny { font-size: 0.65rem; }
.primary { color: var(--primary); }
.error { color: var(--destructive); margin: 0; }
.hint { font-size: 0.75rem; color: var(--muted-foreground); }
.ml-auto { margin-left: auto; }

.topbar { border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent); }
.topbar-inner {
  max-width: 72rem;
  margin: 0 auto;
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 1rem;
}
.brand { display: flex; align-items: center; gap: 0.6rem; color: inherit; font-weight: 600; font-size: 0.9rem; }
.brand img { border-radius: 0.4rem; }
.nav { display: flex; align-items: center; gap: 0.75rem; font-size: 0.75rem; color: var(--muted-foreground); }
.nav button {
  background: none; border: 0; color: inherit; cursor: pointer; font: inherit;
}
.nav button:hover, .nav a:hover { color: var(--foreground); text-decoration: none; }
.nav-meta { display: none; }
@media (min-width: 640px) { .nav-meta { display: inline; } }

.page { width: 100%; max-width: 72rem; margin: 0 auto; padding: 2rem 1rem; flex: 1; }
.page-head { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2rem; }
@media (min-width: 720px) {
  .page-head { flex-direction: row; align-items: flex-end; justify-content: space-between; }
}
.auth {
  width: 100%; max-width: 28rem; margin: 0 auto; padding: 3rem 1rem; flex: 1;
  display: flex; flex-direction: column; justify-content: center;
}
.auth-hero { text-align: center; margin-bottom: 2rem; }
.auth-hero img { border-radius: 0.6rem; }
.auth-hero h1 { margin-top: 1rem; }
.auth-hero p { color: var(--muted-foreground); font-size: 0.9rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.card.compact { max-width: 20rem; }
.card.hover:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); }
.grid { display: grid; gap: 1rem; list-style: none; padding: 0; margin: 0; }
@media (min-width: 640px) { .grid { grid-template-columns: 1fr 1fr; } }

.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.row { display: flex; align-items: center; gap: 0.5rem; }
.row.wrap { flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }

label { display: block; font-size: 0.85rem; }
label.row { display: flex; align-items: center; gap: 0.5rem; }
input, textarea, button.btn {
  font: inherit; color: inherit;
}
input[type="text"], input[type="email"], input[type="password"], input[type="file"], textarea, input:not([type]) {
  width: 100%;
  margin-top: 0.25rem;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
}
textarea { min-height: 5rem; resize: vertical; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 2.25rem; padding: 0 1rem; border-radius: 0.5rem;
  border: 1px solid var(--border); background: var(--muted); cursor: pointer;
}
.btn.primary { background: var(--primary); color: var(--primary-foreground); border-color: transparent; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.icon-btn {
  width: 2.25rem; height: 2.25rem; border: 0; border-radius: 0.5rem;
  background: var(--muted); color: inherit; cursor: pointer;
}

.badge {
  display: inline-flex; align-items: center;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 0.1rem 0.55rem; font-size: 0.7rem;
}
.badge.opticon { border-color: color-mix(in srgb, var(--opticon) 40%, transparent); color: var(--opticon); }
.badge.danger { border-color: color-mix(in srgb, var(--destructive) 50%, transparent); background: color-mix(in srgb, var(--destructive) 15%, transparent); color: var(--destructive); }
.badge.open { border-color: color-mix(in srgb, var(--destructive) 50%, transparent); color: var(--destructive); }
.badge.closed { border-color: color-mix(in srgb, var(--opticon) 40%, transparent); color: var(--opticon); }
.badge.dropped { color: var(--muted-foreground); }

.review {
  width: 100%; max-width: 110rem; margin: 0 auto;
  padding: 1.5rem 1rem; flex: 1;
  display: flex; flex-direction: column; gap: 1.5rem;
}
@media (min-width: 1200px) {
  .review { flex-direction: row; align-items: flex-start; }
  .sheet { order: 1; }
  .player-col { order: 2; flex: 1; min-width: 0; }
  .comments { order: 3; width: 22rem; }
}
.sheet {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
@media (min-width: 1200px) {
  .sheet { width: 28rem; }
}
@media (min-width: 1400px) {
  .sheet { width: 31rem; }
}
.sheet-head { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); }
.chips, .substories { display: flex; flex-wrap: wrap; gap: 0.25rem; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border); margin: 0; list-style: none; }
.chip {
  border: 1px solid var(--border); background: transparent; color: var(--muted-foreground);
  border-radius: 999px; padding: 0.15rem 0.6rem; font-size: 0.7rem; cursor: pointer;
}
.chip.active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary); }
.clip-rows { list-style: none; margin: 0; padding: 0.4rem 0.5rem; max-height: 78vh; overflow: auto; display: flex; flex-direction: column; gap: 0.25rem; }
.clip { border: 1px solid color-mix(in srgb, var(--border) 80%, transparent); border-radius: 0.4rem; padding: 0.35rem 0.5rem; background: color-mix(in srgb, var(--muted) 30%, transparent); }
.clip.unused { border-style: dashed; opacity: 0.9; background: transparent; }
.clip.used { cursor: pointer; }
.clip-file { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roll {
  display: inline-flex; border-radius: 999px; padding: 0 0.4rem; font-size: 0.65rem; font-weight: 600; border: 1px solid;
}
.roll.a { border-color: color-mix(in srgb, var(--primary) 50%, transparent); background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary); }
.roll.b { border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.seqs { list-style: none; margin: 0.15rem 0 0; padding: 0; }
.seq {
  width: 100%; text-align: left; border: 0; border-radius: 0.3rem; padding: 0.15rem 0.35rem;
  background: color-mix(in srgb, var(--background) 50%, transparent); color: inherit; cursor: pointer;
}
.seq.active { background: color-mix(in srgb, var(--primary) 15%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 40%, transparent); }
.fields { display: grid; gap: 0.15rem; margin-top: 0.35rem; }
.field-label { margin: 0; font-size: 0.6rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted-foreground); }
.field-value { margin: 0; font-size: 0.7rem; line-height: 1.3; }
.note-edit {
  margin-top: 0.15rem; min-height: 2.4rem; font-size: 0.8rem;
}

.player-col { display: flex; flex-direction: column; gap: 0.75rem; min-width: 0; flex: 1; }
.stage { position: relative; overflow: hidden; border-radius: 0.75rem; border: 1px solid var(--border); background: #000; }
.video { width: 100%; aspect-ratio: 16/9; background: #000; display: block; }
.lut-banner {
  position: absolute; inset: 0 0 auto; z-index: 2;
  background: color-mix(in srgb, var(--destructive) 90%, transparent);
  color: #fff; font-size: 0.7rem; font-weight: 600; text-align: center; padding: 0.35rem 0.75rem;
}
.video-error {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.8); padding: 1rem; text-align: center;
}
.scrub { position: relative; padding-top: 1rem; }
.marks { position: absolute; inset: 0 0 auto; height: 1rem; pointer-events: none; }
.marks button {
  pointer-events: auto; position: absolute; top: 0; width: 0.35rem; height: 0.75rem;
  border: 0; border-radius: 0.15rem; transform: translateX(-50%); cursor: pointer; padding: 0;
  background: var(--primary);
}
.marks button.resolved { background: color-mix(in srgb, var(--muted-foreground) 60%, transparent); }
input[type="range"].timeline {
  appearance: none; width: 100%; height: 6px; border-radius: 999px; background: #3a3229;
}
input[type="range"].timeline::-webkit-slider-thumb {
  appearance: none; width: 14px; height: 14px; border-radius: 999px; background: #d4a054; cursor: pointer;
}

.comments { width: 100%; display: flex; flex-direction: column; gap: 1rem; }
@media (min-width: 1200px) { .comments { width: 24rem; } }
.comment { background: color-mix(in srgb, var(--muted) 40%, transparent); border-radius: 0.5rem; padding: 0.5rem 0.75rem; }
.comment.resolved { opacity: 0.7; }
.comment p { margin: 0.25rem 0 0; font-size: 0.9rem; }
.comment.resolved p { text-decoration: line-through; }
.comment button.linkish {
  background: none; border: 0; color: var(--muted-foreground); font-size: 0.7rem; cursor: pointer; padding: 0; margin-top: 0.4rem;
}
.comment button.linkish:hover { color: var(--foreground); text-decoration: underline; }
