:root {
  --bg: #0c121c;
  --panel: #141c2b;
  --text: #e8e4d9;
  --muted: #9aa3b0;
  --border: #2a3548;
  --accent: #d4af37;
  --keep: #3d8b6e;
  --reject: #a35d5d;
  --maybe: #b8860b;
  --font: "Segoe UI", system-ui, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --panel-w: 22rem;
  --strip-h: 7.6rem;
  --hero-scale: 1;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

body { display: flex; flex-direction: column; }
.hidden { display: none !important; }
.file { display: none; }

.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 0.5rem; top: 0.5rem; z-index: 20; }

.top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  min-height: 3rem;
  flex: 0 0 auto;
}
.brand { font-family: var(--serif); color: var(--accent); white-space: nowrap; }
.meta { flex: 1; color: var(--muted); font-size: 0.95rem; min-width: 0; }
.saved { color: var(--accent); font-size: 0.85rem; white-space: nowrap; }
.zoom-row, .help-btn, .hide-rejects { flex: 0 0 auto; }
.zoom-row button.active { border-color: var(--accent); color: var(--accent); }
.zoom-row button,
.help-btn,
.sweep button {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  min-height: 2.2rem;
  cursor: pointer;
  font: inherit;
}
.hide-rejects {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: auto;
}
.login-card {
  width: min(26rem, calc(100% - 2rem));
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.4rem 1.3rem 1.6rem;
}
.login-card h1 { font-family: var(--serif); font-size: 1.6rem; margin: 0.2rem 0 0.5rem; }
.login-lead { color: var(--muted); margin: 0 0 1rem; }
.login-card a { color: var(--accent); }
.login-card input {
  width: 100%;
  background: #101825;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.6rem;
  font: inherit;
}
.login-go {
  margin-top: 0.8rem;
  width: 100%;
  min-height: 2.5rem;
  background: #101825;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}
.login-error { color: #f0c4c4; margin: 0.7rem 0 0; }

.shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--panel-w);
  grid-template-rows: minmax(0, 1fr);
}

.work {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #070b12;
  overflow: hidden;
}
.stage img,
.stage video {
  max-width: calc(100% * var(--hero-scale));
  max-height: calc(100% * var(--hero-scale));
  width: auto;
  height: auto;
  object-fit: contain;
}

.nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 999px;
  background: rgba(20, 28, 43, 0.8);
  color: var(--text);
  font-size: 1.6rem;
  cursor: pointer;
}
.nav.prev { left: 0.6rem; }
.nav.next { right: 0.6rem; }

.strip-bar {
  flex: 0 0 var(--strip-h);
  height: var(--strip-h);
  border-top: 1px solid var(--border);
  background: #101825;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sweep {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem 0;
  flex: 0 0 auto;
}
.sweep-label { color: var(--muted); font-size: 0.8rem; margin-right: 0.2rem; }
.sweep button.active[data-paint="keep"] { border-color: var(--keep); color: #b7e0cf; }
.sweep button.active[data-paint="maybe"] { border-color: var(--maybe); color: var(--accent); }
.sweep button.active[data-paint="reject"] { border-color: var(--reject); color: #f0c4c4; }

.strip {
  display: flex;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem 0.4rem;
  overflow-x: auto;
  min-width: 0;
  flex: 1 1 auto;
}
.strip .cell {
  position: relative;
  flex: 0 0 auto;
  cursor: pointer;
  border: 2px solid transparent;
  height: 4.6rem;
  padding: 0;
  background: transparent;
}
.strip .cell img,
.strip .cell video {
  height: 100%;
  width: auto;
  display: block;
  opacity: 0.8;
}
.strip .cell.current { border-color: var(--accent); }
.strip .cell.current img,
.strip .cell.current video { opacity: 1; }
.strip .mark {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  font-size: 0.7rem;
  line-height: 1.15rem;
  text-align: center;
  background: #070b12;
  color: var(--text);
}
.strip .cell.keep .mark { color: #b7e0cf; }
.strip .cell.maybe .mark { color: var(--accent); }
.strip .cell.reject .mark { color: #f0c4c4; }
.strip .cell.reject img,
.strip .cell.reject video { opacity: 0.35; }

.panel {
  min-height: 0;
  overflow: auto;
  padding: 0.8rem 1rem 1.2rem;
  background: var(--panel);
  border-left: 1px solid var(--border);
}
.filename { margin: 0; font-weight: 600; word-break: break-all; }
.sub { margin: 0.2rem 0 0.8rem; color: var(--muted); font-size: 0.85rem; }

fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0 0 0.7rem;
  padding: 0.5rem;
}
legend { color: var(--muted); font-size: 0.8rem; padding: 0 0.3rem; }

.row, .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.row button, .chips button, .panel button {
  background: #101825;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  min-height: 2.2rem;
  font: inherit;
}
.row button.active[data-status="keep"] { border-color: var(--keep); color: #b7e0cf; }
.row button.active[data-status="reject"] { border-color: var(--reject); color: #f0c4c4; }
.row button.active[data-status="maybe"] { border-color: var(--maybe); color: var(--accent); }

label.stack { flex-direction: column; display: flex; margin-top: 0.5rem; gap: 0.25rem; }
textarea, .panel input[type="text"] {
  width: 100%;
  background: #101825;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem;
  font: inherit;
}
.yt-list { list-style: none; padding: 0; margin: 0 0 0.6rem; }
.yt-list li { display: flex; justify-content: space-between; gap: 0.4rem; font-size: 0.82rem; color: var(--muted); margin: 0.25rem 0; }

.help {
  position: fixed;
  right: 1rem;
  top: 3.6rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  max-width: 24rem;
  z-index: 10;
}
.help h2 { margin: 0 0 0.4rem; font-size: 1rem; font-family: var(--serif); }
.help p { margin: 0.25rem 0; color: var(--muted); }

@media (max-width: 900px) {
  html, body { overflow: auto; height: auto; }
  .shell { grid-template-columns: 1fr; height: auto; }
  .work { min-height: 70vh; }
  .stage { min-height: 50vh; }
}
