:root {
  color: #172033;
  background: #f5f7fb;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 18px;
}

* { box-sizing: border-box; }
html { overflow-x: hidden; scroll-padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
body { min-width: 0; margin: 0; overflow-x: hidden; }
button, input, textarea { max-width: 100%; font: inherit; }
button, input:not([type="range"]) { min-height: 56px; }
button {
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  background: #165dff;
  color: #fff;
  font-weight: 750;
  line-height: 1.25;
  overflow-wrap: anywhere;
  touch-action: manipulation;
}
button.secondary { background: #e9edf5; color: #263149; }
button.ghost { border: 1px solid #aeb8c9; background: #fff; color: #263149; }
button.danger { background: #fff0f0; color: #a51d28; }
button.compact { min-height: 48px; padding: 9px 12px; font-size: .9rem; }
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 4px solid #ffb020;
  outline-offset: 3px;
}
button:disabled, input:disabled, textarea:disabled { cursor: not-allowed; opacity: .52; }

.shell { width: min(100%, 940px); margin: 0 auto; padding: 24px 16px 150px; }
.page-header { min-width: 0; margin-bottom: 22px; }
.eyebrow { margin: 0 0 8px; color: #165dff; font-weight: 800; }
h1 { margin: 0; font-size: clamp(1.8rem, 8vw, 2.8rem); line-height: 1.15; overflow-wrap: anywhere; }
h2, h3 { overflow-wrap: anywhere; }
h2 { margin: 0 0 10px; font-size: 1.35rem; }
h3 { margin: 0 0 10px; font-size: 1.12rem; }
p { overflow-wrap: anywhere; }
.status { color: #5d6678; line-height: 1.6; }
.panel, .progress-panel, .clip, .omission-card {
  min-width: 0;
  border: 1px solid #d8deea;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 26px rgba(25, 39, 71, .07);
}
.panel { padding: 20px; }
form { display: grid; gap: 12px; }
label, legend { font-weight: 700; }
fieldset { min-width: 0; margin: 0; border: 0; padding: 0; }
legend { margin-bottom: 10px; }
input:not([type="range"]), textarea {
  width: 100%;
  border: 2px solid #aeb8c9;
  border-radius: 10px;
  padding: 12px;
  background: #fff;
  color: #172033;
}
input[type="range"] { width: 100%; min-height: 44px; accent-color: #165dff; }
textarea { min-height: 112px; resize: vertical; }
.comment-adjustment textarea { scroll-margin-block: 80px calc(160px + env(safe-area-inset-bottom)); }

.progress-panel {
  position: sticky;
  top: 8px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 16px;
}
.progress-panel span { color: #586174; }
#draft-state { color: #b54708; font-weight: 750; }
.reference-panel, .unavailable, .candidate-section { min-width: 0; margin-top: 20px; }
.candidate-section > h2 { margin-top: 26px; }
.section-help, .timeline-legend, .position-copy, .context-copy, .media-time, .empty-state {
  margin: 6px 0 12px;
  color: #5d6678;
  font-size: .92rem;
  line-height: 1.55;
}
.unavailable { border-left: 5px solid #91a0b8; }
.terminal { border-left: 5px solid #b54708; }

.segments, .saved-omissions { display: grid; min-width: 0; gap: 20px; }
.segments { margin-top: 16px; }
.clip { min-width: 0; padding: 16px; }
.source-bounds { margin: 0 0 6px; color: #172033; font-variant-numeric: tabular-nums; font-weight: 800; }
.candidate-rail, .reference-timeline {
  position: relative;
  width: 100%;
  height: 14px;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe5ef;
}
.candidate-rail-fill, .coverage-block {
  position: absolute;
  inset-block: 0;
  border-radius: 999px;
  background: #165dff;
}
.candidate-rail-fill { left: var(--candidate-start); width: var(--candidate-width); }
.coverage-block { left: var(--coverage-start); width: var(--coverage-width); }
video { display: block; width: 100%; max-height: 65vh; border-radius: 12px; background: #0e1524; }
.decision-group { margin-top: 16px; }
.decision-row, .mark-row, .refine-row, .editor-actions, .omission-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
.decision { background: #e9edf5; color: #263149; }
.decision[aria-pressed="true"] { background: #165dff; color: #fff; }
.adjustment, .omission-editor { display: grid; min-width: 0; gap: 12px; margin-top: 14px; }
.problem-types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; border: 0; }
.problem-types legend { grid-column: 1 / -1; margin-bottom: 2px; font-weight: 750; }
.problem-option { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 12px; border: 1px solid #d8deea; border-radius: 12px; background: #fff; }
.problem-option input { width: 20px; height: 20px; margin: 0; }
.suggested-range, .range-value {
  display: block;
  color: #172033;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  overflow-wrap: anywhere;
}
.boundary-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  border: 1px solid #d8deea;
  border-radius: 12px;
  padding: 12px;
}
.boundary-group legend { padding: 0 4px; }
.omission-boundary { align-content: start; }

.reference-timeline { height: 18px; margin-top: 16px; }
.marker { margin-top: 22px; border-top: 1px solid #d8deea; padding-top: 18px; }
.mark-status { margin: 10px 0 0; color: #33415d; font-variant-numeric: tabular-nums; }
.new-omission-host { min-width: 0; }
.saved-heading { margin-top: 28px; }
.omission-card { min-width: 0; padding: 16px; }
.omission-note { margin: 8px 0 14px; white-space: pre-wrap; }

.submit-bar {
  position: fixed;
  inset: auto 0 0;
  z-index: 3;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid #d8deea;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
}
.submit-bar button, .submit-bar p { display: block; width: min(100%, 908px); margin: 0 auto; }
.submit-bar p { margin-top: 6px; color: #5d6678; font-size: .78rem; text-align: center; }
[hidden] { display: none !important; }

@media (min-width: 560px) {
  .mark-row, .editor-actions, .omission-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .refine-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 720px) {
  .shell { padding-inline: 28px; }
  .decision-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .comment-only .decision-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .boundary-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .boundary-group legend { grid-column: 1 / -1; }
  .refine-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .clip, .omission-card { padding: 24px; }
}

@media (max-width: 360px) {
  .problem-types { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
