:root {
  --bg: #f7faf9;
  --surface: #ffffff;
  --surface-2: #eef5f5;
  --text: #1f272b;
  --muted: #65727a;
  --border: #d7e0e4;
  --accent: #17858a;
  --accent-strong: #0f6b70;
  --accent-soft: #e1f4f4;
  --amber: #f5a400;
  --amber-strong: #e27d00;
  --amber-soft: #fff3d7;
  --graphite: #4f4939;
  --danger: #a23b3b;
  --shadow: 0 14px 34px rgba(24, 68, 72, 0.11);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

[hidden] {
  display: none !important;
}

.app-shell {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow-x: hidden;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  background: linear-gradient(90deg, #ffffff 0%, #ffffff 72%, var(--amber-soft) 100%);
  border-bottom: 1px solid #cbdfe1;
}

.brand,
.top-actions,
.status-left,
.status-right,
.zoom-row {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  flex: 0 0 auto;
  border-radius: 6px;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.15rem, 2.2vw, 1.6rem);
  line-height: 1;
  color: var(--accent-strong);
  font-weight: 750;
}

.top-actions {
  gap: 8px;
}

.workspace {
  min-height: 0;
  padding: 18px 18px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 16px;
}

.stage-area {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(320px, 1fr);
  gap: 14px;
}

.controls {
  display: grid;
  grid-template-columns: minmax(210px, 1.35fr) minmax(160px, 0.9fr) minmax(210px, 1fr) repeat(4, minmax(82px, auto));
  align-items: end;
  gap: 10px;
}

.field,
.zoom-control {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field span,
.zoom-control > span {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 650;
}

select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0 34px 0 12px;
}

.zoom-row {
  gap: 10px;
  min-height: 42px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.zoom-row input[type="range"] {
  flex: 1 1 0;
  min-width: 64px;
  width: 0;
}

output {
  min-width: 44px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.icon-button,
.tool-button,
.start-button {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.icon-button:hover,
.tool-button:hover,
.start-button:hover {
  border-color: #9fc9cc;
  background: #fbfefd;
}

.icon-button:active,
.tool-button:active,
.start-button:active {
  transform: translateY(1px);
}

.icon-button {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.icon-button.small {
  width: 36px;
  height: 36px;
}

.icon-button svg,
.tool-button svg {
  width: 21px;
  height: 21px;
}

.tool-button {
  min-height: 42px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.86rem;
  font-weight: 650;
  white-space: nowrap;
}

.tool-button.primary {
  color: #ffffff;
  border-color: var(--amber-strong);
  background: linear-gradient(180deg, var(--amber) 0%, var(--amber-strong) 100%);
}

.tool-button.primary:hover {
  border-color: #c96f00;
  background: linear-gradient(180deg, #ffb321 0%, #d87400 100%);
}

.tool-button[aria-pressed="true"] {
  color: var(--accent-strong);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.settings-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.settings-panel summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--text);
  font-weight: 750;
  cursor: pointer;
}

.settings-panel summary::marker {
  color: var(--amber);
}

.image-controls,
.annotation-controls {
  display: grid;
  grid-template-columns: minmax(132px, 0.8fr) repeat(7, minmax(110px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 12px;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface);
}

.image-controls-header,
.annotation-header {
  display: grid;
  gap: 8px;
  align-self: stretch;
}

.image-controls h2,
.annotation-controls h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.annotation-controls {
  grid-template-columns: minmax(132px, 0.7fr) minmax(170px, 1.2fr) minmax(220px, 1.8fr) minmax(110px, 0.8fr) minmax(110px, 0.8fr) minmax(130px, 0.8fr) minmax(150px, 1fr);
}

.point-text {
  grid-column: span 2;
}

.place-button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--amber-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--amber) 0%, var(--amber-strong) 100%);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 720;
}

.place-button.active {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.point-list {
  grid-column: span 2;
  min-height: 38px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.point-edit-actions {
  grid-column: span 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.point-list p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.point-chip {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 650;
}

.point-chip.selected {
  border-color: var(--amber);
  background: var(--amber-soft);
  color: var(--graphite);
}

.point-chip .select-point {
  width: auto;
  padding: 0;
  color: inherit;
  font-weight: 750;
}

.point-chip button {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.reset-button {
  width: fit-content;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 650;
}

.reset-button.active {
  border-color: var(--amber);
  background: var(--amber-soft);
  color: var(--graphite);
}

.slider-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 8px;
  min-width: 0;
  overflow: hidden;
  font-size: 0.82rem;
}

.slider-field span {
  color: var(--text);
  font-weight: 650;
}

.slider-field output {
  min-width: 42px;
  text-align: right;
  font-size: 0.78rem;
}

.slider-field input {
  grid-column: 1 / -1;
  min-width: 0;
  max-width: 100%;
}

.text-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.text-field span,
.checkbox-field span {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 650;
}

.text-field input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
}

.checkbox-field {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.slider-field.red input {
  accent-color: #c94040;
}

.slider-field.green input {
  accent-color: #21814c;
}

.slider-field.blue input {
  accent-color: #2563b8;
}

.filter-defs {
  position: absolute;
  width: 0;
  height: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.viewer {
  position: relative;
  overflow: hidden;
  min-height: 360px;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.08), transparent 34%),
    #191b1d;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  display: grid;
  place-items: center;
}

.editor-preview.placing-point {
  cursor: crosshair;
}

.viewer video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #111315;
  transform-origin: center;
}

.viewer-annotations {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 18px 20px;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.72);
}

.point-arrows,
.point-labels {
  position: absolute;
  inset: 0;
}

.point-arrows {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.point-arrows line,
.point-arrows path {
  stroke: #ffffff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.75));
}

.point-arrows .calibration-segment {
  stroke: var(--amber);
  stroke-width: 3;
  stroke-dasharray: 10 6;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.55));
}

.point-arrows .calibration-dot {
  fill: var(--amber);
  stroke: #ffffff;
  stroke-width: 2;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.55));
}

.point-label {
  position: absolute;
  max-width: 210px;
  transform: translate(-50%, -50%);
  padding: 6px 9px;
  border-radius: 6px;
  background: rgba(10, 16, 18, 0.76);
  color: #ffffff;
  font-size: clamp(0.78rem, 1.3vw, 0.95rem);
  font-weight: 750;
  line-height: 1.15;
  overflow-wrap: anywhere;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.point-target {
  position: absolute;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.64);
}

.annotation-top,
.annotation-bottom {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.annotation-top {
  grid-row: 1;
  justify-content: center;
  text-align: center;
}

.annotation-bottom {
  grid-row: 3;
  align-items: flex-end;
  justify-content: space-between;
}

.annotation-top strong {
  max-width: 84%;
  overflow-wrap: anywhere;
  font-size: clamp(1rem, 2vw, 1.55rem);
  line-height: 1.15;
}

.editor-annotations[data-title-position="bottom"] .annotation-top {
  grid-row: 3;
  align-self: end;
  padding-bottom: clamp(28px, 5vw, 54px);
}

.annotation-top span,
.annotation-bottom span {
  font-size: clamp(0.86rem, 1.4vw, 1.05rem);
  font-weight: 700;
}

.scale-preview {
  display: grid;
  justify-items: start;
  gap: 7px;
  min-width: 120px;
}

#previewMagnification {
  justify-self: end;
  text-align: right;
}

.scale-line {
  display: block;
  width: 24%;
  min-width: 72px;
  max-width: 260px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28);
}

.viewer-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
  padding: 24px;
}

.viewer-empty svg,
.viewer-empty .viewer-logo {
  width: min(132px, 28vw);
}

.viewer-empty svg {
  stroke-width: 3;
}

.viewer-empty .viewer-logo {
  height: min(132px, 28vw);
  object-fit: contain;
  border-radius: 8px;
}
.viewer-empty p {
  margin: 0;
  font-size: clamp(1.2rem, 2.7vw, 1.8rem);
  font-weight: 500;
}

.start-button {
  min-height: 44px;
  padding: 0 18px;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  background: linear-gradient(180deg, var(--amber) 0%, var(--amber-strong) 100%);
  font-weight: 720;
}

.captures-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-header {
  min-height: 60px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.panel-header h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.2;
}

.captures-list {
  min-height: 0;
  overflow: auto;
  padding: 12px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.capture-item {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.capture-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.capture-item img {
  width: 116px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.capture-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.capture-meta strong,
.capture-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.capture-meta strong {
  font-size: 0.9rem;
  font-weight: 650;
}

.capture-meta span {
  font-size: 0.84rem;
  color: var(--muted);
}

.capture-actions {
  display: grid;
  gap: 6px;
}

.edit-capture-button {
  width: 100%;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  background: var(--amber-soft);
  color: var(--graphite);
  font-size: 0.78rem;
  font-weight: 750;
}

.empty-captures {
  min-height: 200px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.compare-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.compare-panel h3 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.2;
}

.statusbar {
  min-height: 56px;
  padding: 0 22px;
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(0, 1.2fr) minmax(170px, 1fr);
  gap: 18px;
  align-items: center;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.92rem;
}

.status-left {
  gap: 10px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 133, 138, 0.14);
}

.status-dot.warn {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(245, 164, 0, 0.16);
}

.status-dot.error {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(162, 59, 59, 0.14);
}

.status-right {
  justify-content: end;
  gap: 14px;
  font-variant-numeric: tabular-nums;
}

.offline-status {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.offline-status.ready {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.offline-status.offline {
  border-color: var(--amber);
  background: var(--amber-soft);
  color: var(--graphite);
}

.status-action {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--amber-strong);
  border-radius: 999px;
  background: var(--amber);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 800;
}

.divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

#cameraInfo {
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

dialog {
  width: min(460px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0;
}

.annotation-dialog {
  width: min(1180px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
}

.annotation-dialog form {
  padding: 0;
}

.annotation-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 440px);
  gap: 14px;
  padding: 18px;
}

.editor-preview {
  position: relative;
  min-height: 380px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius);
  background: #111315;
}

.editor-preview.white-margin {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(79, 73, 57, 0.16);
}

.editor-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.editor-annotations {
  z-index: 2;
}

.editor-preview.white-margin .annotation-top,
.editor-preview.white-margin .annotation-bottom {
  color: var(--graphite);
  text-shadow: none;
}

.editor-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-content: start;
  max-height: calc(100vh - 72px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding-bottom: 14px;
}

.editor-controls .annotation-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
}

.editor-controls .point-text,
.editor-controls .point-list,
.editor-controls .point-edit-actions {
  grid-column: auto;
}

.editor-controls .point-edit-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.editor-controls .slider-field,
.editor-controls .text-field,
.editor-controls .checkbox-field,
.editor-controls .margin-sides,
.editor-controls .calibration-fields,
.editor-controls .calibration-profile,
.editor-controls .student-sheet-fields {
  width: 100%;
}

.calibration-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.calibration-fields .text-field:first-child {
  grid-column: 1 / -1;
}

.calibration-calculation {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 107, 112, 0.22);
  border-radius: var(--radius);
  background: rgba(15, 107, 112, 0.08);
  color: var(--graphite);
  font-size: 0.84rem;
  line-height: 1.35;
}

.calibration-calculation[hidden] {
  display: none;
}

.calibration-calculation strong {
  color: var(--teal);
}

.calibration-calculation .student-scale-answer {
  margin-top: 4px;
}

#scaleAnswerFeedback {
  font-weight: 800;
}

#scaleCorrectionOutput {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.calibration-profile,
.student-sheet-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.calibration-profile .text-field,
.calibration-profile select {
  grid-column: 1 / -1;
}

.calibration-profile select {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 12px;
  background: #ffffff;
  color: var(--graphite);
  font: inherit;
}

.method-card {
  padding: 10px 12px;
  border: 1px solid rgba(245, 164, 0, 0.34);
  border-radius: var(--radius);
  background: rgba(245, 164, 0, 0.09);
}

.method-card summary {
  cursor: pointer;
  color: var(--graphite);
  font-weight: 850;
}

.method-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.36;
}

.margin-sides {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
  margin: 0;
  padding: 10px 12px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.margin-sides legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.margin-sides label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 750;
  color: var(--graphite);
}

.editor-controls .slider-field {
  min-height: 58px;
}

.editor-controls .text-field input,
.editor-controls .text-field select {
  min-height: 42px;
}

.editor-controls .point-edit-actions .reset-button {
  width: 100%;
  min-height: 44px;
  white-space: normal;
  line-height: 1.18;
}

.editor-controls .point-list {
  align-items: flex-start;
  min-height: 42px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.annotation-hint {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--amber-soft);
  color: var(--graphite);
  font-size: 0.84rem;
  line-height: 1.35;
}

.editor-controls .point-chip {
  max-width: 100%;
}

.editor-controls .place-button,
.editor-controls .save-annotated {
  min-height: 48px;
}

.save-annotated {
  width: 100%;
}

dialog::backdrop {
  background: rgba(18, 25, 29, 0.4);
}

dialog form {
  position: relative;
  padding: 24px;
}

dialog h2 {
  margin: 0 42px 12px 0;
  font-size: 1.25rem;
}

dialog p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.5;
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

@media (max-width: 1400px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .captures-panel {
    max-height: 260px;
  }

  .controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .image-controls {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .annotation-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .point-text,
  .point-list,
  .point-edit-actions {
    grid-column: span 2;
  }

  .image-controls-header,
  .annotation-header {
    grid-column: 1 / -1;
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}

@media (max-width: 1600px) and (min-width: 1401px) {
  .controls {
    grid-template-columns: minmax(210px, 1.35fr) minmax(160px, 0.9fr) minmax(210px, 1fr) repeat(4, 42px);
  }

  .tool-button {
    width: 42px;
    padding: 0;
  }

  .tool-button span {
    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: 680px) {
  .topbar {
    height: auto;
    min-height: 58px;
    padding: 12px 14px;
  }

  .workspace {
    padding: 12px;
  }

  .controls {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .image-controls,
  .annotation-controls {
    grid-template-columns: 1fr;
  }

  .point-text,
  .point-list,
  .point-edit-actions {
    grid-column: auto;
  }

  .point-edit-actions {
    grid-template-columns: 1fr;
  }

  .image-controls-header,
  .annotation-header {
    grid-template-columns: 1fr;
  }

  .reset-button {
    width: 100%;
  }

  .tool-button {
    justify-content: flex-start;
  }

  .zoom-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
  }

  .zoom-row .icon-button {
    display: none;
  }

  .zoom-row output {
    display: none;
  }

  .zoom-row input[type="range"] {
    width: 100%;
    min-width: 0;
  }

  .slider-field input[type="range"] {
    width: calc(100% - 24px);
    margin: 0 12px;
  }

  .brand h1 {
    font-size: 1.3rem;
  }

  .viewer {
    min-height: 280px;
  }

  .viewer-annotations {
    padding: 12px;
  }

  .annotation-dialog {
    width: calc(100vw - 16px);
  }

  .annotation-editor {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .editor-preview {
    min-height: 260px;
  }

  .editor-controls {
    max-height: none;
  }

  .annotation-top strong {
    max-width: 84%;
  }

  .statusbar {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px 14px;
  }

  #cameraInfo {
    text-align: left;
  }

  .status-right {
    justify-content: flex-start;
  }
}
