:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #4a4a4a;
  --border: #c9c9c4;
  --primary: #0b57d0;
  --primary-hover: #0842a0;
  --primary-text: #ffffff;
  --error-bg: #fdecea;
  --error-text: #8a1c12;
  --error-border: #d93025;
  --notice-bg: #e8f0fe;
  --notice-text: #0b3d91;
  --ok: #137333;
  --focus: #f9ab00;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161616;
    --surface: #222222;
    --text: #f1f1f1;
    --muted: #c4c4c4;
    --border: #4a4a4a;
    --primary: #8ab4f8;
    --primary-hover: #aecbfa;
    --primary-text: #0b1f3a;
    --error-bg: #3b1714;
    --error-text: #ffb4a9;
    --error-border: #f28b82;
    --notice-bg: #1c2b45;
    --notice-text: #c6dafc;
    --ok: #81c995;
  }
}

* { box-sizing: border-box; }

html { font-size: 20px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

.site-header, main, .site-footer {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 16px;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.site-title { margin: 0; font-size: 1.6rem; }

.account { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.signed-in-as { color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }

main { padding-top: 24px; padding-bottom: 32px; min-height: 60vh; }

h2 { font-size: 1.4rem; margin: 0.5rem 0 0.75rem; }
.lead { font-size: 1.05rem; margin-top: 0; }
.help { color: var(--muted); font-size: 0.95rem; }

form { display: flex; flex-direction: column; max-width: 480px; }

label { font-weight: 600; margin-top: 16px; margin-bottom: 6px; }
label.checkbox { font-weight: normal; display: flex; align-items: center; gap: 10px; margin-top: 10px; cursor: pointer; }
label.checkbox input { width: 24px; height: 24px; }

input[type="email"], input[type="password"], input[type="text"] {
  font-size: 1.1rem;
  padding: 14px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  width: 100%;
}

input:focus, button:focus, a:focus { outline: 4px solid var(--focus); outline-offset: 2px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 12px 24px;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: var(--radius);
  border: 2px solid var(--primary);
  cursor: pointer;
  text-decoration: none;
}
.btn[disabled] { opacity: 0.6; cursor: wait; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover:not([disabled]) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--primary); }
.btn-secondary:hover:not([disabled]) { background: var(--notice-bg); }
.btn-small { min-height: 44px; padding: 8px 16px; font-size: 0.95rem; }
.btn-link { background: none; border: none; color: var(--primary); padding: 8px 0; min-height: 44px; font-weight: 600; text-decoration: underline; }

form .btn { margin-top: 24px; }

.error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 2px solid var(--error-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 16px;
  font-weight: 600;
}

.notice {
  background: var(--notice-bg);
  color: var(--notice-text);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
  font-weight: 600;
}

.rules-title { margin: 20px 0 4px; font-weight: 600; }
.rules { list-style: none; padding: 0; margin: 0; }
.rules li { padding: 4px 0 4px 36px; position: relative; color: var(--muted); }
.rules li::before { content: "○"; position: absolute; left: 6px; font-weight: 700; }
.rules li.ok { color: var(--ok); }
.rules li.ok::before { content: "✓"; }

.case-list, .video-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; }
.case-list .btn { width: 100%; justify-content: flex-start; text-align: left; }

.video-item {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.video-name { margin: 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.video-size { margin: 4px 0 12px; color: var(--muted); }
.video-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.video-actions .btn { flex: 1 1 200px; }

.player-wrap { background: #000; border-radius: var(--radius); overflow: hidden; margin: 12px 0; }
.player-wrap video { display: block; width: 100%; max-height: 70vh; background: #000; }

.empty { color: var(--muted); font-size: 1.05rem; }

.section-title { font-size: 1.2rem; margin: 28px 0 8px; }
#docs-section { margin-bottom: 8px; }

.site-footer { color: var(--muted); font-size: 0.85rem; padding-top: 16px; padding-bottom: 32px; border-top: 1px solid var(--border); }
.site-footer p { margin: 4px 0; }

[hidden] { display: none !important; }
