.ofv {
  --v-ink: var(--color-text);
  --v-line: var(--color-rule);
  --v-accent: var(--color-selected);
  --v-paper: var(--color-surface);
  width: 100%;
  min-width: 0;
  color: var(--v-ink);
  text-align: left;
  font: var(--weight-regular) var(--text-sm)/1.45 var(--font-text);
}
.ofv *,
.ofv *::before,
.ofv *::after {
  box-sizing: border-box;
}
.ofv [hidden] {
  display: none !important;
}
.ofv-panel {
  overflow: hidden;
  border: 1px solid var(--v-line);
  border-radius: var(--radius-lg);
  background: var(--v-paper);
}
.ofv button,
.ofv select {
  min-height: var(--size-target);
  margin: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--v-ink);
  font: var(--weight-bold) var(--text-xs)/1.15 var(--font-text);
  cursor: pointer;
}
.ofv button {
  padding: var(--space-2) var(--space-3);
}
.ofv button:hover:not(:disabled),
.ofv select:hover {
  border-color: var(--v-accent);
  background: var(--color-surface-sunken);
}
.ofv button:focus-visible,
.ofv select:focus-visible,
.ofv summary:focus-visible,
.ofv input:focus-visible,
.ofv-stage:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}
.ofv button:disabled {
  cursor: default;
  opacity: 0.62;
}
.ofv-top {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
}
.ofv-mode {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--weight-bold);
  font-size: var(--text-xs);
}
.ofv-mode::before {
  content: '';
  width: 9px;
  height: 9px;
  background: var(--color-action);
  border-radius: var(--radius-sm);
  transform: rotate(45deg);
}
.ofv[data-mode='flight'] .ofv-mode::before {
  border-radius: 50%;
  background: var(--color-selected);
}
.ofv-camera-tools,
.ofv-camera-tools label {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  align-items: center;
  margin: 0;
}
.ofv-camera-tools label span {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
}
.ofv select {
  appearance: auto;
  width: auto;
  padding: var(--space-1) var(--space-1);
}
.ofv-stage {
  position: relative;
  aspect-ratio: 1.92;
  min-height: 215px;
  max-height: 355px;
  isolation: isolate;
  cursor: grab;
  touch-action: pan-y;
  background: radial-gradient(ellipse at 51% 43%, var(--color-page) 3%, transparent 69%),
    linear-gradient(138deg, var(--color-surface-sunken), var(--color-surface-sunken) 58%, var(--color-surface-sunken));
  overflow: hidden;
  outline-offset: -4px !important;
}
.ofv-stage:active {
  cursor: grabbing;
}
.ofv[data-mode='flight'] .ofv-stage {
  background: radial-gradient(ellipse at 47% 50%, var(--color-page) 0%, transparent 62%),
    linear-gradient(159deg, var(--color-surface-sunken), var(--color-surface-sunken) 65%, var(--color-surface-success));
}
.ofv-canvas,
.ofv-canvas canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}
.ofv-compass {
  position: absolute;
  left: 11px;
  bottom: 10px;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
  pointer-events: none;
  font: var(--weight-bold) var(--text-xs)/1.45 var(--font-text);
}
.ofv-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--v-line);
}
.ofv .ofv-replay {
  background: var(--color-action);
  color: var(--color-action-text);
  border-color: var(--color-action);
}
.ofv .ofv-replay:hover:not(:disabled) {
  background: var(--color-action-hover);
  color: var(--color-text-inverse);
}
.ofv-progress {
  flex: 1 1 155px;
  display: grid;
  grid-template-columns: minmax(58px, 1fr) auto;
  align-items: center;
  column-gap: var(--space-2);
  font-weight: var(--weight-bold);
  font-size: var(--text-xs);
  margin: 0;
}
.ofv-progress span {
  grid-column: 1;
}
.ofv-progress input {
  grid-column: 1;
  grid-row: 2;
}
.ofv-progress output {
  grid-column: 2;
  grid-row: 1/3;
  font-variant-numeric: tabular-nums;
  min-width: 3.3ch;
  font-size: var(--text-xs);
}
.ofv input[type='range'] {
  appearance: auto;
  -webkit-appearance: auto;
  accent-color: var(--color-border);
  background: transparent;
  margin: 0;
  padding: 0;
  border: 0;
  height: 20px;
  min-width: 0;
  width: 100%;
  display: block;
}
.ofv .ofv-marks {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin: 0;
  font-size: var(--text-xs);
  cursor: pointer;
}
.ofv-marks input {
  width: 16px;
  height: 16px;
  accent-color: var(--v-accent);
  margin: 0;
}
.ofv-lesson {
  padding: var(--space-3) var(--space-3) var(--space-2);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  align-items: flex-start;
}
.ofv-step-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 1px 0;
}
.ofv-step-nav span {
  font-weight: var(--weight-bold);
  font-size: var(--text-xs);
}
.ofv-step-nav button {
  padding: 0;
  min-width: 34px;
  min-height: var(--size-target);
  font-size: var(--text-md);
}
.ofv-lesson-copy {
  flex: 1 1 175px;
}
.ofv-lesson-copy strong {
  font: var(--weight-bold) var(--text-sm)/1.28 var(--font-text);
}
.ofv-lesson-copy p,
.ofv-adjust p {
  margin: var(--space-1) 0;
  color: var(--color-text-muted);
  font: var(--text-xs)/1.45 var(--font-text);
}
.ofv-lesson-copy small {
  display: block;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  margin: var(--space-1) 0 0;
}
.ofv-adjust {
  padding: 0 var(--space-3);
  border-top: 1px solid var(--v-line);
}
.ofv-adjust summary {
  cursor: pointer;
  width: fit-content;
  padding: var(--space-2) 0;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
}
.ofv-sliders {
  display: grid;
  grid-template-columns: repeat(2, minmax(100px, 1fr));
  gap: var(--space-2) var(--space-5);
  margin: var(--space-2) 0;
}
.ofv-sliders label {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px var(--space-2);
  margin: 0;
  font-weight: var(--weight-bold);
  font-size: var(--text-xs);
}
.ofv-sliders input {
  grid-column: 1/3;
}
.ofv-sliders output {
  font-variant-numeric: tabular-nums;
}
.ofv .ofv-reset {
  margin-bottom: var(--space-3);
}
.ofv-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 520px) {
  .ofv-top,
  .ofv-controls,
  .ofv-lesson {
    padding: var(--space-2) var(--space-2);
  }
  .ofv-stage {
    min-height: 215px;
    max-height: 290px;
    aspect-ratio: 1.54;
  }
  .ofv-camera-tools label span {
    display: none;
  }
  .ofv-camera-tools select,
  .ofv-camera-tools button {
    min-height: var(--size-target);
  }
  .ofv .ofv-replay {
    min-height: var(--size-target);
  }
  .ofv-sliders {
    gap: var(--space-2) var(--space-3);
  }
  .ofv-lesson-copy {
    flex-basis: 100%;
  }
}
.ofv-key {
  position: absolute;
  right: 11px;
  bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-1) var(--space-2);
  max-width: 70%;
  padding: var(--space-1) var(--space-2);
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-surface) 91%, transparent);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: var(--weight-bold) var(--text-xs)/1.45 var(--font-text);
  pointer-events: none;
}
.ofv-key[data-flight='true'] span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}
.ofv-key[data-flight='true'] span::before {
  content: '';
  width: 8px;
  height: 8px;
  border: 2px solid var(--color-border);
  border-radius: 50%;
}
.ofv-key[data-flight='true'] span + span::before {
  background: var(--color-action);
  border-color: var(--color-mark);
}
@media (max-width: 520px) {
  .ofv-key:not([data-flight='true']) {
    flex-direction: column;
    gap: 0;
    right: 5px;
    bottom: 6px;
  }
}
.ofv-circuit,
.ofv-readings {
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--v-line);
}
.ofv-circuit p,
.ofv-readings p {
  margin: var(--space-1) 0;
}
.ofv-circuit label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
}
.ofv-circuit select {
  max-width: 100%;
}
.ofv-readings p:first-child {
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xs);
  min-height: 3.45em;
}
.ofv-readings [data-v='result'] {
  font-weight: var(--weight-bold);
}
.ofv[data-renderer='text'] .ofv-canvas {
  padding: var(--space-4);
  max-height: calc(100% - 40px);
  overflow: auto;
}
.ofv-scorecard {
  display: none;
}
@media print {
  body.ofv-printing {
    background: var(--color-surface) !important;
    color: var(--color-text);
    display: block !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    overflow: visible !important;
  }
  body.ofv-printing > :not(.ofv-scorecard) {
    display: none !important;
  }
  body.ofv-printing > .ofv-scorecard {
    display: block !important;
    font: var(--text-xs)/1.3 var(--font-text);
  }
  .ofv-scorecard h1 {
    margin: 0 0 0.5em;
    font-size: var(--text-lg);
  }
  .ofv-scorecard h2 {
    font-size: var(--text-sm);
    margin: 0.5em 0 0;
  }
  .ofv-scorecard p {
    margin: 0.25em 0 0.5em;
  }
  .ofv-scorecard ul {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    padding: 0;
    list-style: none;
  }
  .ofv-scorecard section {
    break-inside: avoid;
  }
  .ofv-scorecard table {
    width: 100%;
    border-collapse: collapse;
  }
  .ofv-scorecard th,
  .ofv-scorecard td {
    height: 1.6em;
    padding: 0.1em 0.4em;
    border: 1px solid var(--color-border-strong);
    text-align: left;
  }
}
.ofv .ofv-notes {
  display: grid;
  gap: var(--space-1);
  margin-top: var(--space-2);
  font-weight: var(--weight-bold);
}
.ofv-notes textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-1);
  background: var(--color-surface);
  color: var(--v-ink);
  font: inherit;
  font-weight: var(--weight-regular);
}
.ofv-notes textarea:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}
.ofv-circuit > small {
  display: block;
  margin: var(--space-1) 0 var(--space-2);
}
.ofv-gates {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
}
.ofv-gates summary {
  cursor: pointer;
  font-weight: var(--weight-bold);
}
.ofv-gates li + li {
  margin-top: var(--space-1);
}
