*, *::before, *::after { box-sizing: border-box; }
:root {
  color-scheme: light dark;
  font-family: system-ui, sans-serif;
  line-height: 1.5;
  --bg: #f4f1ea; --surface: #ffffff; --text: #20201e; --muted: #625f58;
  --accent: #165d55; --accent-text: #ffffff; --border: #79766f;
  --danger: #9d2334; --notice: #e4eee9;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171816; --surface: #252723; --text: #eeece5; --muted: #bcb8ae;
    --accent: #8bd5c2; --accent-text: #162a25; --border: #a19d92;
    --danger: #ff9ea9; --notice: #243a32;
  }
}
body { margin: 0; background: var(--bg); color: var(--text); }
main { width: calc(100% - 32px); max-width: 1200px; margin-inline: auto; padding-block: 2rem 4rem; }
main.home { max-width: 640px; padding-block: clamp(2rem, 8vw, 5rem); }
[hidden] { display: none !important; }
h1 { margin-block: 0.5rem 1rem; font-size: clamp(1.8rem, 5vw, 3rem); line-height: 1.15; }
h2 { font-size: 1.25rem; }
p, h1, h2, a, label, summary { overflow-wrap: anywhere; }
.eyebrow { color: var(--muted); font-size: 0.875rem; font-weight: 700; letter-spacing: 0.06em; margin-block: 1rem 0; }
.muted, .meta { color: var(--muted); }
.notice { padding: 1rem; border-radius: 0.6rem; background: var(--notice); }
a { color: var(--accent); font-weight: 650; text-underline-offset: 0.2em; }
nav, .toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
nav { margin-top: 2rem; }
nav a, .back, .source-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0.5rem; }
button, input { font: inherit; }
button { min-height: 44px; padding: 0.6rem 1rem; border: 1px solid var(--accent); border-radius: 0.45rem; background: var(--surface); color: var(--accent); font-weight: 650; cursor: pointer; overflow-wrap: anywhere; }
button[type=submit], #preview-button { background: var(--accent); color: var(--accent-text); }
button:disabled { cursor: not-allowed; opacity: 0.65; }
button.danger { color: var(--danger); border-color: var(--danger); }
input:not([type=checkbox]) { display: block; width: 100%; min-height: 48px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 0.4rem; padding: 0.65rem; }
form label { display: block; font-weight: 650; margin-block: 1rem 0.4rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
#selection-tools { position: sticky; top: 0; z-index: 2; max-height: 45vh; overflow-y: auto; margin-block: 1.5rem; padding: 1rem; border: 1px solid var(--border); border-radius: 0.6rem; background: var(--surface); }
.video-card { scroll-margin-top: 45vh; }
.more-controls { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.75rem; margin-block: 2rem; text-align: center; }
.more-controls button { min-width: 180px; }
.video-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.5rem; margin-block: 1rem 2rem; }
.video-card { background: var(--surface); border: 1px solid var(--border); border-radius: 0.7rem; overflow: hidden; }
.cover { aspect-ratio: 3 / 4; position: relative; background: var(--notice); display: grid; place-items: center; }
.cover img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.cover .placeholder { padding: 0.5rem; text-align: center; color: var(--text); font-size: 0.75rem; }
.badge-photo { position: absolute; top: 6px; right: 6px; background: #d32f2f; color: #ffffff; font-size: 0.65rem; font-weight: 700; padding: 2px 6px; border-radius: 4px; z-index: 2; box-shadow: 0 1px 3px rgba(0,0,0,0.4); letter-spacing: 0.02em; pointer-events: none; }
.card-body { padding: 0.5rem; }
.check-label { display: flex; align-items: flex-start; gap: 0.4rem; min-height: 44px; cursor: pointer; font-weight: 650; }
.check-label input { width: 22px; height: 22px; margin: 0.35rem 0; flex-shrink: 0; accent-color: var(--accent); }
.check-label span { padding-block: 0.35rem; }
.caption { margin-block: 0.35rem; font-size: 0.85rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; line-height: 1.35; max-height: 2.7em; }
details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--accent); }
.meta { font-size: 0.8rem; }
#preview { background: var(--surface); padding: 1rem; border: 1px solid var(--border); border-radius: 0.6rem; margin-block: 1.5rem; }
.google-panel { margin-block: 1.5rem; padding: 1rem; border: 1px solid var(--border); border-radius: 0.6rem; background: var(--surface); }
.google-panel h2 { margin-block: 0 0.5rem; }
#google-message { min-height: 1.5em; }
#preview li { margin-block: 0.75rem; overflow-wrap: anywhere; }
.batch-panel { background: var(--surface); padding: 1rem; border: 1px solid var(--border); border-radius: 0.6rem; margin-block: 1.5rem; }
.batch-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.batch-progress { background: var(--notice); border-radius: 0.4rem; padding: 0.5rem 1rem; margin-block: 0.5rem; font-weight: 650; }
.batch-jobs-list { list-style: none; padding: 0; margin-block: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.batch-jobs-list li { padding: 0.5rem; border: 1px solid var(--border); border-radius: 0.4rem; background: var(--bg); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.batch-jobs-list a { display: inline-flex; align-items: center; min-height: 44px; padding: 0.25rem 0.5rem; }
#download-button, #drive-save-button { background: var(--accent); color: var(--accent-text); }
@media (max-width: 600px) {
  .video-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.35rem; }
  .card-body { padding: 0.35rem; font-size: 0.75rem; }
  .caption { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-block: 0.25rem; font-size: 0.7rem; }
  .meta { font-size: 0.65rem; }
  .source-link { font-size: 0.7rem; padding: 0.25rem 0; }
}
@media (min-width: 1200px) { .video-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1rem; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
