:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --text: #221d17;
  --muted: #7a7065;
  --line: #e9e2d8;
  --accent: #d9572b;
  --accent-text: #ffffff;
  --ok: #2f8a4f;
  --err: #c0392b;
  --radius: 16px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16130f;
    --surface: #221e19;
    --text: #f3ede5;
    --muted: #a39887;
    --line: #3a332b;
    --accent: #f07a4b;
    --accent-text: #1b120c;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 20px; text-decoration: none; letter-spacing: -0.02em; }
.top nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
main { max-width: 560px; margin: 0 auto; padding: 16px; }
h1 { font-size: 24px; margin: 4px 0 16px; letter-spacing: -0.02em; }
h2 { font-size: 18px; margin: 24px 0 8px; }
p.muted, .muted { color: var(--muted); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
}
label { display: block; font-weight: 600; margin: 14px 0 6px; }
input[type=password], input[type=text], textarea, select {
  width: 100%; font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 16px;
}
textarea { min-height: 96px; resize: vertical; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 50px; padding: 12px 16px; margin-top: 12px;
  font: inherit; font-weight: 700; border-radius: 14px; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-text); text-decoration: none;
}
.btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--err); border: 1px solid var(--line); }
.btn:disabled { opacity: 0.5; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button {
  flex: 1; padding: 10px 4px; font: inherit; font-weight: 600; border: 0;
  background: transparent; color: var(--muted);
}
.seg button.on { background: var(--accent); color: var(--accent-text); }
.list { display: grid; gap: 10px; }
.item {
  display: flex; gap: 12px; align-items: center; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px;
}
.thumb {
  width: 54px; height: 96px; border-radius: 10px; object-fit: cover; background: var(--line); flex: none;
}
.item .meta { min-width: 0; }
.item .title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.badge {
  display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--line); color: var(--muted); margin-top: 4px;
}
.badge.done { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge.failed { background: color-mix(in srgb, var(--err) 18%, transparent); color: var(--err); }
.badge.work { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.fab {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  width: auto; padding: 0 22px; box-shadow: 0 8px 24px rgba(0,0,0,0.18); border-radius: 999px;
}
video.player {
  width: 100%; aspect-ratio: 9 / 16; max-height: 70vh; background: #000; border-radius: var(--radius); display: block;
}
.files { margin: 8px 0 0; padding: 0; list-style: none; font-size: 14px; }
.files li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width 0.2s; }
.status { display: flex; align-items: center; gap: 12px; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.chip {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent;
  font: inherit; font-weight: 600; color: var(--muted);
}
.chip.on { border-color: var(--accent); color: var(--accent); }
.notes { white-space: pre-wrap; }
.error { color: var(--err); font-weight: 600; }
.feedback-quote { font-style: italic; color: var(--muted); margin: 8px 0 0; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom));
  max-width: 528px; margin: 0 auto; padding: 12px 16px; border-radius: 12px;
  background: var(--text); color: var(--bg); font-weight: 600; z-index: 20;
}

.picker {
  display: flex; align-items: center; justify-content: center; min-height: 64px; margin: 0;
  border: 2px dashed var(--line); border-radius: 14px; color: var(--accent); font-weight: 700; cursor: pointer;
}
.hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
