:root {
  color-scheme: light;
  --ink: #151515;
  --muted: #6c6a63;
  --line: #ded9ce;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-strong: #0b4f4a;
  --amber: #d97706;
  --shadow: 0 18px 45px rgba(31, 28, 20, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(15, 118, 110, 0.06) 1px, transparent 1px),
    var(--paper);
  background-size: 36px 36px;
  color: var(--ink);
  font-family: ui-serif, Georgia, "Times New Roman", "Noto Serif SC", serif;
}

button,
input,
select {
  font: inherit;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.auth-subtitle {
  margin: -6px 0 0;
  color: var(--muted);
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
}

.auth-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
}

.auth-field input,
.admin-form input,
.admin-form select {
  min-height: 40px;
  border: 1px solid var(--line);
  padding: 0 10px;
  background: #fff;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 24px;
  min-height: 100vh;
  padding: 24px;
}

.workspace,
.preview {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.workspace {
  padding: 28px;
}

.preview {
  position: sticky;
  top: 24px;
  align-self: start;
  padding: 22px;
}

.topbar,
.section-title,
.progress-head,
.control-row,
.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.user-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.user-badge {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
  font-size: 13px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(34px, 5vw, 62px);
}

h2 {
  font-size: 24px;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.dropzone {
  min-height: 176px;
  display: grid;
  gap: 10px;
  align-content: center;
  padding: 24px;
  border: 1px dashed #aaa394;
  background: #fffdf8;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.dropzone:hover,
.dropzone.active {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: #f2fbf8;
}

.dropzone input {
  display: none;
}

.file-type {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.dropzone strong {
  font-size: 22px;
}

.dropzone small,
.notes,
.logs {
  color: var(--muted);
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
}

.control-row {
  margin-top: 18px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

button,
.download {
  border: 0;
  min-height: 42px;
  padding: 0 16px;
  color: #fff;
  background: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

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

.secondary {
  background: var(--accent-strong);
}

.ghost {
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
}

.progress-panel,
.result-panel,
.admin-panel,
.history-panel {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.admin-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 120px minmax(170px, 0.8fr) auto;
  gap: 10px;
  margin-top: 14px;
}

.user-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
  font-size: 13px;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 110px minmax(120px, 0.8fr) minmax(170px, 0.9fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  background: #f5f1e9;
}

.user-main {
  display: grid;
  gap: 2px;
}

.user-main strong {
  color: var(--ink);
}

.user-row input,
.user-row select {
  min-height: 36px;
  min-width: 0;
  border: 1px solid var(--line);
  padding: 0 8px;
  background: #fff;
}

.user-row button {
  min-height: 36px;
  padding: 0 12px;
}

.history-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: #f5f1e9;
  border: 1px solid #ebe4d8;
}

.history-row strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.history-row p,
.empty-history {
  margin: 3px 0 0;
  color: var(--muted);
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
  font-size: 13px;
}

.progress-track {
  height: 10px;
  margin-top: 12px;
  overflow: hidden;
  background: #ece6da;
}

#progressBar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--amber));
  transition: width 220ms ease;
}

.logs {
  min-height: 64px;
  max-height: 140px;
  overflow: auto;
  margin-top: 12px;
  padding: 12px;
  background: #f5f1e9;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.timeline {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr) 120px 120px;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fffdf9;
}

.timeline-row img {
  width: 148px;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #eee8dc;
}

.slide-meta {
  min-width: 0;
}

.slide-meta strong {
  display: block;
  margin-bottom: 6px;
}

.slide-meta p {
  margin: 0;
  color: var(--muted);
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
  font-size: 13px;
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.time-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
  font-size: 12px;
}

.time-field b {
  margin-left: 6px;
  color: var(--ink);
  font-weight: 700;
}

.time-field input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  padding: 0 8px;
  background: #fff;
}

.video-box {
  position: relative;
  aspect-ratio: 16 / 9;
  margin-top: 14px;
  background: #1f1d19;
}

video,
.empty-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

video {
  object-fit: contain;
}

.empty-preview {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: #efe9dc;
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
}

.empty-preview span {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.download {
  width: 100%;
  margin-top: 12px;
  background: var(--amber);
}

.notes {
  margin-top: 18px;
  font-size: 13px;
  line-height: 1.55;
}

.form-error {
  min-height: 18px;
  margin: 8px 0 0;
  color: #b42318;
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
  font-size: 13px;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .preview {
    position: static;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 12px;
  }

  .workspace,
  .preview {
    padding: 16px;
  }

  .upload-grid,
  .timeline-row,
  .user-row,
  .history-row {
    grid-template-columns: 1fr;
  }

  .control-row,
  .topbar,
  .section-title,
  .admin-form {
    align-items: flex-start;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .timeline-row img {
    width: 100%;
  }
}
