/* Annotation-specific additions on top of study.css.
 * Tokens, buttons, cards, header and pause overlay all come from study.css. */

.task-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22rem;
  gap: 1.25rem;
  align-items: start;
}

.task-main {
  display: grid;
  gap: 0.9rem;
  min-width: 0;
}

.task-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.task-header .eyebrow {
  margin: 0;
}

.video-stage {
  background: #10201c;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 20rem;
}

.video-stage video {
  display: block;
  max-width: 100%;
  max-height: 62vh;
}

/* ------------------------------------------------------------- transport */
.transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.transport-gap {
  flex: 1 1 0.5rem;
}

.transport .is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.timecode {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 8.5rem;
  text-align: right;
}

/* ----------------------------------------------------------------- form */
.annot-form .interaction-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.annot-form .interaction-head h2 {
  margin: 0;
  font-size: 1rem;
  flex: 1 1 auto;
}

.annot-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.4rem;
}

.annot-table th {
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0 0.4rem 0.35rem;
  white-space: nowrap;
}

.annot-table td {
  padding: 0.28rem 0.4rem;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

.annot-table select,
.annot-table input {
  width: 100%;
  min-width: 4.5rem;
}

.annot-table .seek {
  width: 100%;
  font-variant-numeric: tabular-nums;
  text-align: left;
  white-space: nowrap;
}

.annot-table td:nth-child(1) { width: 5.6rem; }
.annot-table td:nth-child(2) { width: 9rem; }
.annot-table td:nth-child(3) { width: 8.5rem; }
.annot-table td:nth-child(4) { width: 5.4rem; }
.annot-table td:nth-child(5) { width: 13rem; }
.annot-table td:nth-child(7) { width: 2.6rem; }

.no-error-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--success-soft);
  border: 1px solid var(--success);
  color: var(--success);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  margin-top: 0.4rem;
}

.form-error {
  margin: 0;
  min-height: 1.2rem;
  color: var(--danger);
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.form-error.is-visible {
  opacity: 1;
}

/* ----------------------------------------------------------- peer strip */
.task-sidebar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.9rem;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 12rem);
  overflow-y: auto;
}

.task-sidebar h2 {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
}

.peer-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 0.7rem;
  background: #10201c;
}

.peer-card video {
  display: block;
  width: 100%;
}

.peer-label {
  margin: 0;
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface-2);
}

/* -------------------------------------------------------------- footer */
.task-footer {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.task-footer .key-guide {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--muted);
}

.hidden-input {
  display: none;
}

@media (max-width: 62rem) {
  .task-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .task-sidebar {
    position: static;
    max-height: none;
  }
}

/* ------------------------------------------------------- optional aids */
.aid-group {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

.aid {
  display: grid;
  gap: 0.3rem;
}

.aid-toggle {
  width: 100%;
  text-align: left;
}

.aid-toggle.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.aid-text {
  margin: 0 0 0.2rem;
  padding: 0.45rem 0.6rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.aid-heading {
  margin-top: 1rem;
}

/* ------------------------------------------------------------- consent */
.consent-wrap h2 {
  font-size: 1rem;
  margin: 1.2rem 0 0.35rem;
}

.consent-facts {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 0.2rem;
  font-size: 0.88rem;
}

.consent-list {
  margin: 0;
  /* study.css already draws the bullet as an ::before dot and reserves the
   * space for it. Leaving the native marker on as well renders two dots. */
  list-style: none;
  padding-left: 0;
}

.consent-agreement {
  display: grid;
  gap: 0.5rem;
  margin: 1.2rem 0;
  padding: 0.9rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
}

.checkbox-field {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  cursor: pointer;
}

.checkbox-field input {
  margin-top: 0.25rem;
  flex: 0 0 auto;
}

@media print {
  .study-header, .study-footer, .simulation-banner,
  .consent-agreement, .button-row { display: none !important; }
}

.signature-pad {
  display: block;
  width: 100%;
  max-width: 34rem;
  height: auto;
  aspect-ratio: 900 / 260;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  touch-action: none;      /* or a finger signature scrolls the page instead of drawing */
  cursor: crosshair;
  margin-bottom: 0.4rem;
}

.consent-identity .field select,
.consent-identity .field input {
  max-width: 34rem;
}

/* ------------------------------------------------- deviation cards */
.deviation {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.8rem 0.8rem;
  margin-bottom: 0.7rem;
}

.deviation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.deviation-index {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.deviation-grid {
  display: grid;
  grid-template-columns: 6rem 9rem 9rem 6.5rem minmax(0, 1fr);
  gap: 0.5rem;
  align-items: end;
}

.deviation-field {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.deviation-field .field-label {
  font-size: 0.72rem;
  margin: 0;
}

.deviation-field select,
.deviation-field .seek {
  width: 100%;
}

.deviation-description {
  display: grid;
  gap: 0.15rem;
  margin-top: 0.6rem;
}

.deviation-description .field-label {
  font-size: 0.72rem;
  margin: 0;
}

.deviation-description textarea {
  width: 100%;
  min-height: 5.5rem;
  resize: vertical;
  line-height: 1.5;
}

@media (max-width: 56rem) {
  .deviation-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ------------------------------------------------ hand-off copy fields */
.handoff-copy {
  display: grid;
  gap: 0.6rem;
  margin: 0.9rem 0;
}

.handoff-field .field-label {
  font-size: 0.75rem;
  margin: 0 0 0.15rem;
}

.handoff-line {
  display: flex;
  gap: 0.4rem;
  align-items: stretch;
}

.handoff-line input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.9rem;
  background: var(--surface-2);
}

.handoff-line .secondary-button {
  flex: 0 0 auto;
  min-width: 5.5rem;
}
