* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
  color: #f4f8fb;
  background: #0b1014;
  --accent: #4f80b8;
  --accent-strong: #2f5f8f;
  --accent-soft: #d8e9f7;
  --danger: #9f3f36;
  --panel: rgba(17, 22, 25, 0.9);
  --line: rgba(255, 255, 255, 0.14);
  --camera-top: 104px;
  --dock-height: 78px;
}

button,
input,
select {
  font: inherit;
}

h1,
h2,
p {
  margin: 0;
}

.motor-app {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(79, 128, 184, 0.18), rgba(12, 18, 23, 0.02) 34%),
    linear-gradient(180deg, #121a20 0%, #0b1014 100%);
}

.motor-app:has(.side-panel:not(.is-collapsed)) {
  --dock-height: 78px;
}

.motor-topbar {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 24px;
  z-index: 20;
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(210px, auto) minmax(380px, 620px) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(12, 18, 23, 0.76);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
}

.eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--accent-soft);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  color: #f4f8fb;
  font-size: 16px;
  line-height: 1.1;
  letter-spacing: 0;
}

.top-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.top-actions {
  position: absolute;
  left: 50%;
  top: 50%;
  min-width: 0;
  transform: translate(-50%, -50%);
  justify-content: center;
  gap: 7px;
}

.motor-app:has(#bigTimer:not([hidden])) .top-actions {
  position: static;
  transform: none;
  grid-column: 3;
  justify-self: end;
  justify-content: flex-end;
}

.btn svg,
.view-mode-btn svg,
.dock-toggle-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn svg *,
.view-mode-btn svg *,
.dock-toggle-btn svg * {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn {
  width: 38px;
  min-width: 38px;
  padding: 0;
  gap: 0;
  color: #f4f8fb;
}

.icon-btn .btn-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  z-index: 60;
  max-width: 180px;
  padding: 5px 7px;
  border-radius: 7px;
  background: rgba(8, 13, 17, 0.94);
  color: #f4f8fb;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -3px);
  transition: opacity 120ms ease, transform 120ms ease;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.26);
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.view-switch {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(178, 210, 235, 0.28);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow:
    0 0 18px rgba(79, 128, 184, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.view-mode-btn {
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: rgba(244, 248, 251, 0.86);
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.view-mode-btn.is-active {
  color: #eef6ff;
  background: linear-gradient(180deg, #5f93c7, #2f5f8f);
  border-color: rgba(206, 229, 245, 0.68);
  box-shadow:
    0 0 0 1px rgba(206, 229, 245, 0.24),
    0 0 18px rgba(79, 128, 184, 0.35),
    0 8px 22px rgba(47, 95, 143, 0.28);
}

.view-mode-btn:not(.is-active):hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.btn {
  min-height: 38px;
  border: 1px solid rgba(222, 235, 245, 0.24);
  border-radius: 9px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #f4f8fb;
  font-size: 15px;
  font-weight: 900;
  text-decoration: none;
  letter-spacing: 0;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 0 16px rgba(79, 128, 184, 0.14),
    0 12px 26px rgba(0, 0, 0, 0.26);
}

.btn:not(:disabled):hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn:not(:disabled):active,
.view-mode-btn:not(:disabled):active {
  transform: translateY(1px) scale(0.99);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
  filter: saturate(0.58) brightness(0.74);
  border-color: rgba(222, 235, 245, 0.16);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 0 12px rgba(79, 128, 184, 0.08);
}

.btn.primary {
  background: linear-gradient(180deg, #5f93c7, #2f5f8f);
  color: #eef6ff;
  border-color: rgba(206, 229, 245, 0.68);
  box-shadow:
    0 0 0 1px rgba(206, 229, 245, 0.22),
    0 0 20px rgba(79, 128, 184, 0.34),
    0 12px 30px rgba(47, 95, 143, 0.28);
}

.btn.secondary {
  background: linear-gradient(180deg, #536775, #2f3d46);
  color: #f4f8fb;
  border-color: rgba(204, 229, 241, 0.32);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 0 18px rgba(154, 204, 228, 0.24),
    0 12px 26px rgba(0, 0, 0, 0.26);
}

.btn.ghost {
  background: linear-gradient(180deg, #536775, #33424b);
  color: #f4f8fb;
  border-color: rgba(225, 237, 242, 0.4);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 0 16px rgba(215, 234, 241, 0.22),
    0 12px 26px rgba(0, 0, 0, 0.26);
}

.btn.danger {
  background: linear-gradient(180deg, #d76c60, #9f4038);
  color: #fff7f5;
  border-color: rgba(255, 211, 206, 0.62);
  box-shadow:
    0 0 0 1px rgba(255, 191, 184, 0.2),
    0 0 18px rgba(255, 111, 99, 0.34),
    0 12px 26px rgba(159, 64, 56, 0.28);
}

.notice {
  display: none;
  position: absolute;
  left: 24px;
  top: calc(var(--camera-top) + 18px);
  z-index: 9;
  width: 220px;
  padding: 10px;
  border: 1px solid rgba(178, 210, 235, 0.2);
  border-radius: 10px;
  background: rgba(8, 10, 12, 0.58);
  backdrop-filter: blur(10px);
  color: rgba(244, 248, 251, 0.84);
  font-size: 11px;
  line-height: 1.35;
}

.notice strong {
  color: #f4f8fb;
}

.workspace {
  min-height: 100vh;
}

.video-stage {
  position: absolute;
  left: 50%;
  top: var(--camera-top);
  z-index: 1;
  width: min(calc(100vw - 48px), calc((100vh - var(--camera-top) - var(--dock-height) - 18px) * 32 / 9 + 14px));
  min-width: min(92vw, 900px);
  max-width: 1480px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  transform: translateX(-50%);
}

.video-stage[data-rotation-demo="on"] {
  width: min(calc(100vw - 48px), calc((100vh - var(--camera-top) - var(--dock-height) - 18px) * 48 / 9 + 28px));
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(190px, 0.42fr);
}

.video-stage[data-view-mode="reco"],
.video-stage[data-view-mode="vibra"] {
  width: min(calc(100vw - 48px), calc((100vh - var(--camera-top) - var(--dock-height) - 18px) * 16 / 9));
  max-width: 1480px;
  grid-template-columns: minmax(0, 1fr);
}

.video-stage[data-rotation-demo="on"][data-view-mode="reco"],
.video-stage[data-rotation-demo="on"][data-view-mode="vibra"] {
  width: min(calc(100vw - 48px), calc((100vh - var(--camera-top) - var(--dock-height) - 18px) * 32 / 9 + 14px));
  grid-template-columns: minmax(0, 1fr) minmax(190px, 0.42fr);
}

.video-stage[data-view-mode="reco"] .stress-shell,
.video-stage[data-view-mode="vibra"] .raw-shell {
  display: none;
}

.big-timer {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  min-height: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 5px 12px;
  border: 1px solid rgba(202, 228, 247, 0.24);
  border-radius: 14px;
  background: rgba(8, 14, 18, 0.46);
  backdrop-filter: blur(14px);
  box-shadow:
    0 22px 62px rgba(0, 0, 0, 0.32),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  pointer-events: none;
  transform: none;
}

.big-timer span {
  display: block;
  color: #eef7ff;
  font-size: clamp(15px, 1.45vw, 24px);
  font-weight: 900;
  line-height: 1.06;
  text-transform: none;
  text-wrap: balance;
}

.big-timer strong {
  display: block;
  min-width: 58px;
  color: #ffffff;
  font-size: clamp(30px, 3.2vw, 46px);
  line-height: 0.86;
  letter-spacing: 0;
  text-align: center;
  text-shadow: 0 0 24px rgba(111, 189, 255, 0.34);
}

.big-timer[data-phase="prep"] {
  border-color: rgba(111, 189, 255, 0.42);
  background: rgba(21, 56, 82, 0.5);
}

.big-timer[data-phase="trial"] {
  border-color: rgba(95, 147, 199, 0.36);
  background: rgba(9, 18, 25, 0.42);
}

.big-timer[hidden] {
  display: none;
}

.video-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 18px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0) 38%),
    #101417;
  box-shadow:
    0 22px 72px rgba(0, 0, 0, 0.36),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

video,
canvas,
.rotation-demo-shell img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

video {
  object-fit: cover;
  transform: scaleX(-1);
  background: #0f1110;
}

.rotation-demo-shell {
  align-self: start;
  aspect-ratio: 3 / 4;
  border-color: rgba(111, 189, 255, 0.36);
  background: #ebe8e3;
  box-shadow:
    0 22px 72px rgba(0, 0, 0, 0.36),
    0 0 0 1px rgba(111, 189, 255, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.rotation-demo-shell[hidden] {
  display: none;
}

.rotation-demo-shell img,
.rotation-demo-shell video {
  transform: none;
  object-fit: cover;
  background: #ebe8e3;
}

.rotation-demo-shell.is-mirrored-demo img,
.rotation-demo-shell.is-mirrored-demo video {
  transform: scaleX(-1);
}

.rotation-demo-shell.is-body-demo {
  aspect-ratio: 16 / 9;
}

.rotation-demo-shell img[hidden],
.rotation-demo-shell video[hidden] {
  display: none;
}

.demo-caption {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 8;
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9px;
  background: rgba(8, 13, 17, 0.72);
  color: #f4f8fb;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}

.demo-caption strong {
  font-size: 14px;
  line-height: 1.05;
  font-weight: 950;
}

.demo-caption span {
  color: rgba(244, 248, 251, 0.82);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.2;
}

canvas {
  pointer-events: none;
}

.panel-title {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 7;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(16, 20, 23, 0.78);
  color: #f4f8fb;
  font-size: 12px;
  font-weight: 900;
}

.step-card {
  display: none;
}

.step-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-soft);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.step-card h2 {
  margin-bottom: 5px;
  font-size: 19px;
  letter-spacing: 0;
}

.step-card p {
  font-size: 13px;
  color: rgba(244, 248, 251, 0.76);
  line-height: 1.42;
}

.quality-pill {
  position: absolute;
  right: 16px;
  top: 16px;
  z-index: 7;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(16, 20, 23, 0.58);
  color: #f4f8fb;
  font-size: 12px;
  font-weight: 800;
}

.side-panel {
  position: absolute;
  left: 18px;
  right: auto;
  bottom: 14px;
  z-index: 18;
  width: calc(100% - 36px);
  min-height: 0;
  display: grid;
  grid-template-columns: 360px 130px 160px 170px minmax(210px, 1fr) 96px 280px 130px;
  grid-template-rows: auto auto;
  grid-template-areas:
    "steps steps steps steps status status status status"
    "name camera audio audio timer metrics metrics actions";
  gap: 8px;
  align-items: stretch;
  padding: 10px;
  transform: none;
  border: 1px solid rgba(222, 235, 245, 0.1);
  border-radius: 16px;
  background: rgba(12, 18, 23, 0.26);
  backdrop-filter: blur(8px);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.18);
}

label {
  display: grid;
  gap: 6px;
  color: rgba(244, 248, 251, 0.68);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.side-panel > label,
.audio-controls,
.status,
.timer-card,
.metric-grid,
.result-actions {
  min-width: 0;
}

input,
select {
  min-height: 36px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 0 10px;
  color: #f4f8fb;
  background: rgba(255, 255, 255, 0.08);
}

select option {
  color: #1c2328;
}

.status {
  min-height: 54px;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(244, 248, 251, 0.82);
  line-height: 1.35;
  font-size: 12px;
}

.audio-controls {
  display: grid;
  gap: 6px;
}

.inline-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #f4f8fb;
  font-size: 13px;
  text-transform: none;
}

.inline-toggle input {
  min-height: 0;
  width: 18px;
  height: 18px;
  padding: 0;
}

.timer-card {
  min-height: 64px;
  padding: 10px;
  border: 1px solid rgba(178, 210, 235, 0.28);
  border-radius: 10px;
  background: rgba(79, 128, 184, 0.14);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}

.timer-card span {
  display: block;
  color: rgba(244, 248, 251, 0.72);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.timer-card strong {
  display: block;
  margin-top: 5px;
  color: #f4f8fb;
  font-size: 42px;
  line-height: 1;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  min-height: 70px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.metric span {
  display: block;
  color: rgba(244, 248, 251, 0.62);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 5px;
  color: #f4f8fb;
  font-size: 16px;
  letter-spacing: 0;
}

.step-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.side-panel .step-list {
  grid-area: steps;
}

.side-panel .field-name {
  grid-area: name;
}

.side-panel .field-camera {
  grid-area: camera;
}

.side-panel .audio-controls {
  grid-area: audio;
}

.side-panel .status {
  grid-area: status;
}

.side-panel .timer-card {
  grid-area: timer;
}

.side-panel .metric-grid {
  grid-area: metrics;
}

.side-panel .result-actions {
  grid-area: actions;
}

.step-list li {
  display: grid;
  gap: 3px;
  min-height: 46px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.step-list li.is-active {
  border-color: rgba(178, 210, 235, 0.58);
  background: rgba(79, 128, 184, 0.2);
}

.step-list li.is-done {
  border-color: rgba(143, 164, 123, 0.56);
  background: rgba(143, 164, 123, 0.16);
}

.step-list strong {
  color: #f4f8fb;
  font-size: 12px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.step-list span {
  color: rgba(244, 248, 251, 0.58);
  font-size: 10px;
}

.result-actions {
  display: grid;
  gap: 6px;
  align-self: stretch;
  margin: 0;
}

.result-actions .btn {
  flex: 1;
  min-height: 36px;
}

.result-actions .btn:disabled {
  display: inline-flex;
}

@media (max-width: 1280px) {
  body {
    --camera-top: 92px;
  }

  .motor-topbar {
    left: 14px;
    right: 14px;
    top: 12px;
    gap: 10px;
    padding: 7px 8px;
  }

  h1 {
    font-size: 16px;
  }

  .btn {
    min-height: 38px;
    padding: 0 12px;
    font-size: 13px;
  }

  .view-switch {
    min-height: 38px;
  }

  .view-mode-btn {
    min-height: 30px;
    padding: 0 9px;
    font-size: 12px;
  }

  .side-panel {
    grid-template-columns: 280px 92px 112px 130px minmax(150px, 1fr) 72px 204px 112px;
    grid-template-areas:
      "steps steps steps steps status status status status"
      "name camera audio audio timer metrics metrics actions";
  }

  .step-list {
    width: auto;
  }

}

@media (max-width: 900px) {
  body {
    --camera-top: 148px;
    --dock-height: 330px;
  }

  .motor-topbar {
    left: 12px;
    right: 12px;
    top: 12px;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .top-actions {
    justify-content: stretch;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .view-switch {
    grid-column: span 2;
    justify-content: center;
  }

  .notice {
    display: none;
  }

  .video-shell {
    width: 100%;
    min-width: 0;
    border-radius: 16px;
  }

  .video-stage {
    width: calc(100vw - 24px);
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .video-stage[data-rotation-demo="on"] {
    width: calc(100vw - 24px);
    grid-template-columns: 1fr;
  }

  .big-timer {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 7px 10px;
    gap: 10px;
    border-radius: 14px;
  }

  .big-timer strong {
    min-width: 74px;
  }

  .video-stage[data-view-mode="reco"],
  .video-stage[data-view-mode="vibra"] {
    width: calc(100vw - 24px);
  }

  .video-stage[data-rotation-demo="on"][data-view-mode="reco"],
  .video-stage[data-rotation-demo="on"][data-view-mode="vibra"] {
    width: calc(100vw - 24px);
    grid-template-columns: 1fr;
  }

  .side-panel {
    left: 12px;
    right: 12px;
    width: auto;
    bottom: 12px;
    max-height: 42vh;
    overflow: auto;
    transform: none;
    grid-template-columns: 1fr;
    grid-template-areas: none;
  }

  .metric-grid,
  .result-actions {
    grid-column: auto;
  }

  .side-panel .step-list,
  .side-panel .field-name,
  .side-panel .field-camera,
  .side-panel .audio-controls,
  .side-panel .status,
  .side-panel .timer-card,
  .side-panel .metric-grid,
  .side-panel .result-actions {
    grid-area: auto;
  }

  .metric-grid {
    width: auto;
  }

  .step-list,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 16px;
  }

  .top-actions,
  .metric-grid,
  .step-list {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    display: none;
  }

  .step-card {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    padding: 12px;
  }

  .step-card h2 {
    font-size: 18px;
  }
}

/* Compact translucent dock for motor controls. Overrides the legacy wide grid. */
.side-panel {
  left: 50%;
  right: auto;
  bottom: 12px;
  width: min(calc(100vw - 48px), 1180px);
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  grid-template-areas: none;
  gap: 4px;
  align-items: stretch;
  padding: 6px 8px;
  transform: translateX(-50%);
  border-color: rgba(204, 229, 241, 0.16);
  border-radius: 14px;
  background: rgba(12, 18, 23, 0.48);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.28);
}

.motor-dock-summary {
  display: none;
}

.dock-summary-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.dock-summary-main span,
.dock-summary-metrics span {
  color: rgba(216, 233, 247, 0.68);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.dock-summary-main strong {
  overflow: hidden;
  color: #f4f8fb;
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dock-summary-metrics {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: end;
}

.dock-summary-metrics span {
  min-width: 72px;
  padding: 3px 6px;
  border: 1px solid rgba(222, 235, 245, 0.12);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.045);
}

.dock-summary-metrics strong {
  display: block;
  margin-top: 2px;
  color: #f4f8fb;
  font-size: 13px;
}

.dock-toggle-btn {
  min-height: 24px;
  border: 1px solid rgba(204, 229, 241, 0.28);
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: rgba(47, 61, 70, 0.64);
  color: #f4f8fb;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.side-panel:not(.is-collapsed) .dock-toggle-btn svg {
  transform: rotate(180deg);
}

.motor-dock-body {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(150px, 0.38fr) 78px minmax(620px, 1.8fr);
  gap: 6px;
  align-items: stretch;
}

.side-panel.is-collapsed .motor-dock-body {
  display: grid;
}

.side-panel.is-collapsed {
  background: rgba(12, 18, 23, 0.22);
  backdrop-filter: blur(8px);
}

.motor-dock-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  gap: 4px;
}

.motor-panel-card {
  padding: 6px;
  border: 1px solid rgba(222, 235, 245, 0.08);
  border-radius: 11px;
  background: rgba(18, 26, 32, 0.24);
}

.motor-panel-card h2 {
  color: rgba(216, 233, 247, 0.78);
  font-size: 10px;
  line-height: 1;
  text-transform: uppercase;
  font-weight: 900;
}

.motor-dock-panel[data-motor-panel="test"] {
  grid-template-rows: auto minmax(0, 1fr);
  align-items: stretch;
}

.motor-dock-panel[data-motor-panel="capture"] {
  grid-template-rows: 1fr;
  align-items: stretch;
}

.motor-dock-panel[data-motor-panel="capture"] h2 {
  color: rgba(216, 233, 247, 0.7);
}

.field-camera {
  align-self: stretch;
}

.field-camera select {
  min-height: 28px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #f4f8fb;
  font-size: 12px;
  font-weight: 900;
  background: rgba(18, 26, 32, 0.38);
}

.motor-dock-panel[data-motor-panel="voice"] .audio-controls {
  grid-template-columns: 1fr;
  align-items: center;
}

.motor-dock-panel[data-motor-panel="voice"] {
  display: grid;
}

.motor-dock-panel[data-motor-panel="voice"] h2 {
  display: none;
}

.side-panel.is-collapsed .motor-dock-panel[data-motor-panel="voice"] h2 {
  display: none;
}

.side-panel.is-collapsed .motor-dock-panel[data-motor-panel="voice"] .audio-controls {
  grid-template-columns: 1fr;
  align-items: center;
}

.motor-dock-panel.results-panel {
  grid-template-columns: 94px minmax(360px, 1fr);
  grid-template-rows: auto;
  align-items: stretch;
}

.motor-dock-panel.results-panel h2 {
  display: none;
}

.side-panel .step-list,
.side-panel .field-name,
.side-panel .field-camera,
.side-panel .audio-controls,
.side-panel .status,
.side-panel .timer-card,
.side-panel .metric-grid,
.side-panel .result-actions {
  grid-area: auto;
}

.side-panel .status {
  min-height: 28px;
  padding: 4px 8px;
  align-content: center;
  white-space: nowrap;
}

.motor-dock-panel.results-panel .status {
  display: none;
}

.step-list {
  grid-template-columns: repeat(5, minmax(90px, 1fr));
}

.audio-controls {
  display: grid;
}

.timer-card {
  min-height: 28px;
  padding: 4px 6px;
  background: rgba(79, 128, 184, 0.1);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

.timer-card span {
  font-size: 8px;
}

.timer-card strong {
  font-size: 14px;
}

.metric-grid {
  align-self: stretch;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.metric {
  min-height: 28px;
  padding: 3px 5px;
  background: rgba(255, 255, 255, 0.04);
}

.metric span {
  font-size: 8px;
}

.metric strong {
  margin-top: 1px;
  font-size: 13px;
}

.result-actions {
  display: none;
}

.result-actions .btn {
  min-height: 28px;
  font-size: 11px;
}

#saveBtn[data-mode="open"] {
  background: linear-gradient(180deg, #536775, #2f3d46);
  border-color: rgba(204, 229, 241, 0.38);
}

#repeatAudioBtn {
  width: 100%;
  height: 40px;
  min-height: 34px;
  padding: 0 12px;
  align-self: center;
  border-color: rgba(255, 221, 120, 0.75);
  background: linear-gradient(180deg, #ffd46b, #d89a1e);
  color: #121820;
  font-size: 12px;
  font-weight: 950;
  box-shadow: 0 0 18px rgba(255, 202, 80, 0.22);
}

.step-list li {
  position: relative;
  min-height: 36px;
  padding: 5px 44px 5px 7px;
  overflow: hidden;
  border-color: rgba(178, 210, 235, 0.14);
  background: rgba(18, 26, 32, 0.22);
}

.step-list li.is-active {
  border-color: rgba(111, 189, 255, 0.9);
  background: rgba(62, 128, 184, 0.2);
  box-shadow:
    inset 0 0 0 1px rgba(196, 229, 255, 0.14),
    0 0 18px rgba(79, 152, 218, 0.18);
}

.step-list li.is-done {
  border-color: rgba(83, 189, 144, 0.42);
  background: rgba(42, 117, 88, 0.14);
}

.step-list strong {
  font-size: 11px;
  line-height: 1.12;
}

.step-list span {
  font-size: 9px;
  line-height: 1.15;
}

.step-countdown {
  position: absolute;
  right: 8px;
  top: 50%;
  min-width: 34px;
  padding: 3px 5px;
  border-radius: 8px;
  transform: translateY(-50%);
  border: 1px solid rgba(222, 235, 245, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: #f4f8fb;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  text-align: center;
}

.step-list li.is-active .step-countdown {
  background: rgba(79, 128, 184, 0.5);
  border-color: rgba(206, 229, 245, 0.62);
}

@media (max-width: 1280px) {
  .motor-dock-body {
    grid-template-columns: 130px 74px minmax(460px, 1fr);
  }

  .motor-dock-panel.results-panel {
    grid-column: auto;
    grid-template-columns: 86px minmax(300px, 1fr);
    grid-template-rows: auto;
    align-items: stretch;
  }
}

@media (max-width: 900px) {
  .side-panel {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-height: 52vh;
    overflow: auto;
    transform: none;
    grid-template-columns: 1fr;
  }

  .motor-dock-summary {
    grid-template-columns: 1fr 82px;
  }

  .dock-summary-metrics {
    display: none;
  }

  .motor-dock-body {
    grid-template-columns: 1fr;
  }

  .motor-dock-panel.results-panel,
  .motor-dock-panel[data-motor-panel="voice"] .audio-controls {
    grid-template-columns: 1fr;
  }

  .step-list,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
