/* Playback bar (#nc-transport) and DRO (#nc-dro) for the NC viewer — owned by nc/player.
   Colours come from the shell tokens (--nc-*); the fallbacks only matter when nc_viewer.css is absent
   and equal the shell's values (B-12). Dark values switch on :root[data-theme="dark"] (the shell
   resolves the theme setting). */

#nc-transport.nc-player-transport,
#nc-dro.nc-dro-root {
  --ncp-panel: var(--nc-panel, #ffffff);
  --ncp-panel-2: var(--nc-panel-2, #f5f7fa);
  --ncp-border: var(--nc-border, #d8e0e9);
  --ncp-text: var(--nc-text, #172033);
  --ncp-dim: var(--nc-text-dim, #566377);
  --ncp-accent: var(--nc-accent, #0d73d9);
  --ncp-font: var(--nc-font, -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif);
  --ncp-mono: var(--nc-mono, ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace);
  --ncp-shadow: 0 6px 20px rgb(15 23 42 / 0.16), 0 1px 3px rgb(15 23 42 / 0.12);
  --ncp-rail: color-mix(in srgb, var(--ncp-dim) 32%, transparent);
  /* Axis letters: the shell's axis colours, the same as the 3D axes and view cube (B-12). */
  --ncp-x: var(--nc-axis-x, #c03a3a);
  --ncp-y: var(--nc-axis-y, #147b3a);
  --ncp-z: var(--nc-axis-z, #2f63c9);
  /* "Where the machine is now" (nc/model PLAYBACK_COLORS); nc/player sets them per theme. */
  --ncp-play-fill: #f5b700;
  --ncp-play-outline: #111827;
  /* Type scale from the shell (:root, readability round); the fallbacks keep the same sizes. */
  --ncp-fs-micro: var(--nc-fs-micro, 11px);
  --ncp-fs-sm: var(--nc-fs-sm, 12px);
  --ncp-fs-lg: var(--nc-fs-lg, 14px);
  --ncp-fs-xl: var(--nc-fs-xl, 18px);
  --ncp-fw-medium: var(--nc-fw-medium, 500);
  --ncp-fw-semibold: var(--nc-fw-semibold, 600);
  --ncp-fw-bold: var(--nc-fw-bold, 700);
}

:root[data-theme="dark"] #nc-transport.nc-player-transport,
:root[data-theme="dark"] #nc-dro.nc-dro-root {
  --ncp-panel: var(--nc-panel, #141a22);
  --ncp-panel-2: var(--nc-panel-2, #19202a);
  --ncp-border: var(--nc-border, #29323e);
  --ncp-text: var(--nc-text, #e1e7ef);
  --ncp-dim: var(--nc-text-dim, #8e9aab);
  --ncp-accent: var(--nc-accent, #3d95f2);
  --ncp-shadow: 0 6px 20px rgb(0 0 0 / 0.45), 0 1px 3px rgb(0 0 0 / 0.35);
  --ncp-rail: color-mix(in srgb, var(--ncp-dim) 38%, transparent);
  --ncp-x: var(--nc-axis-x, #f07474);
  --ncp-y: var(--nc-axis-y, #4cc38a);
  --ncp-z: var(--nc-axis-z, #6ea8ff);
  --ncp-play-fill: #ffd23f;
}

/* ------------------------------------------------------------------ transport */

/* Full-width, click-through strip at the bottom of the viewport; only the bar takes pointer input. */
#nc-transport.nc-player-transport {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  z-index: 6;
  display: flex;
  justify-content: center;
  padding: 0 12px;
  box-sizing: border-box;
  pointer-events: none;
}

#nc-transport.nc-player-transport[data-empty] {
  display: none;
}

.nc-player-bar {
  position: relative;
  pointer-events: auto;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  /* As wide as the viewport allows (the legend moves above the bar): the extra width goes to the
     scrubber, where 1 px is fewer segments (D-14). */
  max-width: min(1400px, 100%);
  min-height: 40px;
  padding: 4px 8px 4px 4px;
  border: 1px solid var(--ncp-border);
  border-radius: 10px;
  background: var(--ncp-panel);
  background: color-mix(in srgb, var(--ncp-panel) 92%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: var(--ncp-shadow);
  color: var(--ncp-text);
  font: var(--ncp-fs-sm)/1.2 var(--ncp-font);
  user-select: none;
  -webkit-user-select: none;
}

.nc-player-bar[data-layout="compact"] {
  min-height: 36px;
  gap: 4px;
  padding: 2px 4px;
}

/* Idle: not playing, pointer away, no keyboard focus → only the surface steps back so the 3D
   shows through; text and icons keep full contrast (the blur keeps them readable). */
.nc-player-bar[data-idle] {
  border-color: color-mix(in srgb, var(--ncp-border) 45%, transparent);
  background: color-mix(in srgb, var(--ncp-panel) 55%, transparent);
  box-shadow: none;
}

.nc-player-group {
  display: flex;
  align-items: center;
  gap: 1px;
  flex: none;
}

.nc-player-group:empty {
  display: none;
}

.nc-player-extras {
  gap: 6px;
}

.nc-player-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ncp-text);
  font: inherit;
  cursor: pointer;
}

.nc-player-btn[hidden] {
  display: none;
}

.nc-player-btn svg {
  display: block;
  fill: currentColor;
}

/* «op / op»: the double chevron plus the word, so op steps never read as start / end (MW-10). */
.nc-player-btn.has-text {
  width: auto;
  min-width: 40px;
  gap: 1px;
  padding: 0 5px 0 3px;
  grid-auto-flow: column;
}

.nc-player-btn-nextOp.has-text {
  padding: 0 3px 0 5px;
}

.nc-player-btn-word {
  font-size: var(--ncp-fs-sm);
  font-weight: var(--ncp-fw-semibold);
  line-height: 1;
}

.nc-player-btn:hover:not(:disabled) {
  background: var(--ncp-panel-2);
}

.nc-player-btn:active:not(:disabled) {
  background: color-mix(in srgb, var(--ncp-accent) 18%, transparent);
}

.nc-player-btn:focus-visible,
.nc-player-speed:focus-visible,
.nc-player-scrub:focus-visible,
.nc-player-future-btn:focus-visible {
  outline: 2px solid var(--ncp-accent);
  outline-offset: 2px;
}

.nc-player-btn:disabled {
  color: var(--ncp-dim);
  cursor: default;
}

.nc-player-btn-toggle {
  width: 32px;
  height: 32px;
  margin: 0 2px;
  border-radius: 50%;
  /* Accent icon on a tint of itself: readable whatever accent the shell picks, light or dark. */
  background: color-mix(in srgb, var(--ncp-accent) 16%, transparent);
  color: var(--ncp-accent);
}

.nc-player-btn-toggle:hover:not(:disabled) {
  background: color-mix(in srgb, var(--ncp-accent) 26%, transparent);
}

.nc-player-btn-toggle:disabled {
  background: transparent;
}

.nc-player-btn-toggle .nc-player-icon-pause,
.nc-player-bar[data-playing] .nc-player-btn-toggle .nc-player-icon-play {
  display: none;
}

.nc-player-bar[data-playing] .nc-player-btn-toggle .nc-player-icon-pause {
  display: inline;
}

/* Scrubber: 24 px hit area, 6 px rail, op blocks (canvas), thumb. --p is the progress 0..1 on the
   play timeline (nc/player). The rail shows through the gaps: the hidden-link moves between ops. */
.nc-player-scrub {
  position: relative;
  flex: 1 1 240px;
  min-width: 120px;
  height: 24px;
  margin: 0 4px;
  border-radius: 4px;
  cursor: pointer;
  touch-action: none;
}

.nc-player-bar[data-layout="compact"] .nc-player-scrub {
  min-width: 72px;
  margin: 0 2px;
}

.nc-player-scrub[aria-disabled="true"] {
  cursor: default;
}

.nc-player-rail {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 6px;
  margin-top: -3px;
  overflow: hidden;
  border-radius: 1px;
  background: var(--ncp-rail);
}

/* Played part of the rail: neutral, so only the op blocks carry colour. */
.nc-player-fill {
  width: calc(var(--p, 0) * 100%);
  height: 100%;
  background: color-mix(in srgb, var(--ncp-dim) 70%, transparent);
}

/* Op blocks: 6 px in the op colours, the current one framed in the playback colour (2 + 1 px). */
.nc-player-blocks {
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 14px;
  margin-top: -7px;
  pointer-events: none;
}

.nc-player-thumb {
  position: absolute;
  top: 50%;
  left: calc(var(--p, 0) * 100%);
  box-sizing: border-box;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid var(--ncp-play-outline);
  border-radius: 50%;
  background: var(--ncp-play-fill);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.35);
  pointer-events: none;
}

/* UX5-45: where a running 「다가가며 다시 재생」 stops — a bar across the rail in the text colour (dark
   on light, light on dark). REV-P-02: over the thumb (14–16 px) and taller than it, so a replay that
   starts close to its stop (1×, 5×) still shows it the whole way (the preview and ⋯ stay above). */
.nc-player-stop {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: calc(var(--stop, 0) * 100%);
  width: 3px;
  height: 22px;
  margin: -11px 0 0 -1.5px;
  border-radius: 1px;
  background: var(--ncp-text);
  box-shadow: 0 0 0 1px var(--ncp-panel);
  pointer-events: none;
}

.nc-player-stop[hidden] {
  display: none;
}

.nc-player-scrub:hover .nc-player-thumb,
.nc-player-bar[data-scrubbing] .nc-player-thumb {
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
}

.nc-player-preview {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 2;
  max-width: 320px;
  overflow: hidden;
  padding: 4px 8px;
  border: 1px solid var(--ncp-border);
  border-radius: 6px;
  background: var(--ncp-panel);
  box-shadow: var(--ncp-shadow);
  color: var(--ncp-text);
  font-size: var(--ncp-fs-sm);
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}

.nc-player-preview[hidden] {
  display: none;
}

.nc-player-time {
  flex: none;
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-family: var(--ncp-mono);
  font-size: var(--ncp-fs-sm);
  font-variant-numeric: tabular-nums;
  color: var(--ncp-dim);
  white-space: nowrap;
  cursor: default;
}

.nc-player-elapsed {
  color: var(--ncp-text);
  min-width: 4ch;
  text-align: right;
}

/* `op 19/31` next to the clock; min-width (from nc/player) keeps the scrubber still. */
.nc-player-opcount {
  margin-left: 6px;
  padding-left: 7px;
  border-left: 1px solid var(--ncp-border);
  color: var(--ncp-text);
  text-align: left;
}

.nc-player-opcount[hidden] {
  display: none;
}

.nc-player-bar[data-layout="compact"] .nc-player-time {
  gap: 1px;
}

.nc-player-bar[data-layout="compact"] .nc-player-opcount {
  margin-left: 4px;
  padding-left: 5px;
}

.nc-player-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nc-player-row[hidden] {
  display: none;
}

.nc-player-row-label {
  display: none;
  flex: none;
  min-width: 2.6em;
  color: var(--ncp-dim);
}

.nc-player-speed {
  flex: none;
  height: 26px;
  padding: 0 4px;
  border: 1px solid var(--ncp-border);
  border-radius: 6px;
  background: var(--ncp-panel-2);
  color: var(--ncp-text);
  font: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

/* Future-path mode: 전체 / 앞으로 갈 경로 흐리게 / 지난 경로만. */
.nc-player-future {
  display: inline-flex;
  flex: none;
  padding: 1px;
  border: 1px solid var(--ncp-border);
  border-radius: 7px;
  background: var(--ncp-panel-2);
}

.nc-player-future-btn {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ncp-dim);
  cursor: pointer;
}

.nc-player-future-btn svg {
  display: block;
  fill: currentColor;
}

.nc-player-future-btn:hover {
  color: var(--ncp-text);
}

.nc-player-future-btn[aria-checked="true"] {
  background: var(--ncp-panel);
  box-shadow: 0 0 0 1px var(--ncp-border);
  color: var(--ncp-accent);
}

/* `25×` next to the clock while the speed list is in the ⋯ popover (medium / compact, D-14). */
.nc-player-speedchip {
  flex: none;
  height: 24px; /* B-11: click targets at least 24 px (round 1 integration) */
  min-width: 34px;
  padding: 0 6px;
  border: 1px solid var(--ncp-border);
  border-radius: 6px;
  background: var(--ncp-panel-2);
  color: var(--ncp-text);
  font: var(--ncp-fw-semibold) var(--ncp-fs-sm)/1 var(--ncp-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
}

.nc-player-speedchip[hidden] {
  display: none;
}

.nc-player-speedchip:hover {
  border-color: color-mix(in srgb, var(--ncp-accent) 45%, var(--ncp-border));
}

.nc-player-speedchip:focus-visible {
  outline: 2px solid var(--ncp-accent);
  outline-offset: 2px;
}

.nc-player-bar[data-popover] .nc-player-speedchip {
  color: var(--ncp-accent);
}

/* Words that only the popover shows (B-15). */
.nc-player-btn-menu,
.nc-player-future-text {
  display: none;
}

/* ⋯ popover: controls that do not fit inline move here (nc/player applyLayout). */
.nc-player-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 200px;
  padding: 8px 10px;
  border: 1px solid var(--ncp-border);
  border-radius: 10px;
  background: var(--ncp-panel);
  box-shadow: var(--ncp-shadow);
}

.nc-player-popover[hidden] {
  display: none;
}

.nc-player-popover .nc-player-row-label {
  display: inline;
}

/* Steps in pairs, back on the left and forward on the right, arrows outwards like the bar's
   `«op … op»`: `‹ 이전 줄 | 다음 줄 ›` (B-15, round 2 U2-22). */
.nc-player-row.nc-player-pop-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.nc-player-pop-steps[hidden] {
  display: none;
}

/* UX5-45: 「다가가며 다시 재생」 across the popover's width, under the steps. */
.nc-player-row.nc-player-pop-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.nc-player-popover .nc-player-btn {
  width: auto;
  min-width: 0;
  gap: 5px;
  padding: 0 8px;
  grid-auto-flow: column;
  justify-content: start;
  border: 1px solid var(--ncp-border);
  font-size: var(--ncp-fs-sm);
  white-space: nowrap;
}

.nc-player-popover .nc-player-btn-nextLine,
.nc-player-popover .nc-player-btn-nextBlock,
.nc-player-popover .nc-player-btn-nextSegment,
.nc-player-popover .nc-player-btn-nextOp,
.nc-player-popover .nc-player-btn-last {
  justify-content: end; /* REV-P-07: every forward step, also the ⋯-only block / segment ones */
}

.nc-player-popover .nc-player-btn-word {
  display: none;
}

.nc-player-popover .nc-player-btn-menu {
  display: inline;
}

/* The path segment reads `진행 강조 | 모두 | 지난 것만` in the popover. */
.nc-player-popover .nc-player-future-btn {
  width: auto;
  padding: 0 8px;
  font-size: var(--ncp-fs-sm);
  white-space: nowrap;
}

.nc-player-popover .nc-player-future-btn svg {
  display: none;
}

.nc-player-popover .nc-player-future-text {
  display: inline;
}

.nc-player-bar[data-popover] .nc-player-more {
  background: var(--ncp-panel-2);
  color: var(--ncp-accent);
}

/* REV-P-08: the speed chip went into ⋯ (touch-sized op steps): ⋯ says the speed, `25× ⋯`. */
.nc-player-more.has-speed {
  width: auto;
  min-width: 40px;
  gap: 2px;
  padding: 0 4px;
  grid-auto-flow: column;
}

.nc-player-more-speed {
  font: var(--ncp-fw-semibold) var(--ncp-fs-sm)/1 var(--ncp-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.nc-player-more-speed[hidden] {
  display: none;
}

/* UX2-41: the speed chip opens the speed buttons alone; ⋯ opens the controls without them. */
.nc-player-popover[data-mode="speed"] > :not(.nc-player-speedgrid),
.nc-player-popover:not([data-mode="speed"]) > .nc-player-speedgrid {
  display: none;
}

.nc-player-speedgrid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}

.nc-player-speedopt {
  min-width: 46px;
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--ncp-border);
  border-radius: 6px;
  background: var(--ncp-panel-2);
  color: var(--ncp-text);
  font: var(--ncp-fw-semibold) var(--ncp-fs-sm)/1 var(--ncp-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
}

.nc-player-speedopt-auto {
  grid-column: 1 / -1;
  font-family: var(--ncp-font);
}

.nc-player-speedopt:hover {
  border-color: color-mix(in srgb, var(--ncp-accent) 45%, var(--ncp-border));
}

.nc-player-speedopt[aria-pressed="true"] {
  border-color: var(--ncp-accent);
  background: color-mix(in srgb, var(--ncp-accent) 14%, var(--ncp-panel));
  color: var(--ncp-accent);
}

.nc-player-speedopt:focus-visible {
  outline: 2px solid var(--ncp-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .nc-player-bar {
    transition: background-color 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
  }

  .nc-player-btn,
  .nc-player-future-btn,
  .nc-dro-toggle svg {
    transition: background-color 0.12s ease, color 0.12s ease, transform 0.15s ease;
  }
}

/* ------------------------------------------------------------------ DRO */

#nc-dro.nc-dro-root {
  display: block;
  /* The field grid adapts to the left panel width (NU-03). */
  container: nc-dro / inline-size;
  border-top: 1px solid var(--ncp-border);
  background: var(--ncp-panel);
  color: var(--ncp-text);
  font: var(--ncp-fs-sm)/1.35 var(--ncp-font);
}

#nc-dro.nc-dro-root[data-empty] {
  display: none;
}

.nc-dro-header {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 2px 8px 2px 2px;
  background: var(--ncp-panel-2);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

#nc-dro.nc-dro-root:not([data-collapsed]) .nc-dro-header {
  border-bottom: 1px solid var(--ncp-border);
}

.nc-dro-toggle {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ncp-dim);
  cursor: pointer;
}

.nc-dro-toggle:hover {
  background: color-mix(in srgb, var(--ncp-dim) 14%, transparent);
  color: var(--ncp-text);
}

.nc-dro-toggle:focus-visible {
  outline: 2px solid var(--ncp-accent);
  outline-offset: -2px;
}

.nc-dro-toggle svg {
  display: block;
}

#nc-dro.nc-dro-root[data-collapsed] .nc-dro-toggle svg {
  transform: rotate(-90deg);
}

.nc-dro-title {
  flex: none;
  font-weight: var(--ncp-fw-semibold);
}

#nc-dro.nc-dro-root[data-collapsed] .nc-dro-title,
#nc-dro.nc-dro-root[data-collapsed] .nc-dro-unit {
  display: none;
}

/* Collapsed one-line summary: fixed-width numbers so nothing shifts while playing. */
.nc-dro-summary {
  display: none;
  flex: 1 1 auto;
  align-items: baseline;
  column-gap: 5px;
  min-width: 0;
  overflow: hidden;
  font-family: var(--ncp-mono);
  font-size: var(--ncp-fs-sm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Fit by priority (nc/player fitSummary): X Y Z always, then F, then the tool; digits are never cut.
   `…` marks dropped items (they stay in its tooltip and in the expanded DRO). */
.nc-dro-summary[data-fit="no-tool"] .nc-dro-sum-tool,
.nc-dro-summary[data-fit="axes"] .nc-dro-sum-tool,
.nc-dro-summary[data-fit="axes"] .nc-dro-sum-feed,
.nc-dro-summary[data-fit="axes-tight"] .nc-dro-sum-tool,
.nc-dro-summary[data-fit="axes-tight"] .nc-dro-sum-feed,
.nc-dro-summary[data-fit="axes-tight"] .nc-dro-sum-unit,
.nc-dro-summary[data-fit="aux-tight"] .nc-dro-sum-tool,
.nc-dro-summary[data-fit="aux-tight"] .nc-dro-sum-unit,
.nc-dro-summary[data-fit="aux-bare"] .nc-dro-sum-tool,
.nc-dro-summary[data-fit="aux-bare"] .nc-dro-sum-unit,
.nc-dro-summary[data-fit="wrap"] .nc-dro-sum-tool,
.nc-dro-summary[data-fit="wrap"] .nc-dro-sum-feed {
  display: none;
}

/* Panels keep the depth when the summary wraps (RU-13: it never hides behind `+N`). */
#nc-dro.nc-dro-root[data-group="panel"] .nc-dro-summary[data-fit="wrap"] .nc-dro-sum-feed {
  display: block;
}

.nc-dro-summary[data-fit="wrap"] {
  flex-wrap: wrap;
  row-gap: 1px;
  padding: 2px 0;
}

/* `+N` chip: items the summary dropped (latin/numbers only, so the micro size is allowed). */
.nc-dro-sum-more {
  flex: none;
  align-self: center;
  padding: 0 4px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--ncp-dim) 16%, transparent);
  color: var(--ncp-text);
  font-size: var(--ncp-fs-micro);
  font-weight: var(--ncp-fw-semibold);
  line-height: 16px;
  cursor: help;
}

.nc-dro-sum-more[hidden] {
  display: none;
}

#nc-dro.nc-dro-root[data-collapsed] .nc-dro-summary {
  display: flex;
}

.nc-dro-sum-axis {
  display: inline-flex;
  flex: none;
  /* A fixed gap after the axis letter: 3-digit values no longer touch it (B-30/D-26). */
  gap: 0.35em;
}

.nc-dro-sum-label {
  font-weight: var(--ncp-fw-bold);
}

/* The unit follows Z, so it reads as the coordinates' unit and never as the feed's. */
.nc-dro-sum-unit {
  margin-left: 3px;
  color: var(--ncp-dim);
}

.nc-dro-sum-x .nc-dro-sum-label {
  color: var(--ncp-x);
}

.nc-dro-sum-y .nc-dro-sum-label {
  color: var(--ncp-y);
}

.nc-dro-sum-z .nc-dro-sum-label {
  color: var(--ncp-z);
}

/* min-width per program comes from nc/player (the widest value it can show). */
.nc-dro-sum-value {
  min-width: 7ch;
  text-align: right;
}

.nc-dro-sum-feed,
.nc-dro-sum-tool {
  flex: none;
  color: var(--ncp-dim);
}

.nc-dro-unit {
  flex: 1 1 auto;
  font-weight: var(--ncp-fw-medium);
  color: var(--ncp-dim);
}

.nc-dro-body[hidden] {
  display: none;
}

/* Axis letter and value side by side (RU-12): values right-aligned in a per-program min-width
   (nc/player) so the decimal points line up, instead of at the far edge of the panel. */
.nc-dro-axes {
  display: grid;
  grid-template-columns: 16px max-content;
  justify-content: start;
  align-items: baseline;
  column-gap: 10px;
  padding: 6px 12px 4px;
  font-family: var(--ncp-mono);
}

.nc-dro-axis-label {
  font-size: var(--ncp-fs-lg);
  font-weight: var(--ncp-fw-bold);
}

.nc-dro-axis-x {
  color: var(--ncp-x);
}

.nc-dro-axis-y {
  color: var(--ncp-y);
}

.nc-dro-axis-z {
  color: var(--ncp-z);
}

.nc-dro-axis-value {
  min-width: 9ch;
  overflow: hidden;
  font-size: var(--ncp-fs-xl);
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.nc-dro-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 14px;
  margin: 0;
  padding: 5px 12px 8px;
  border-top: 1px dashed var(--ncp-border);
}

.nc-dro-field {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.nc-dro-field.is-wide {
  grid-column: 1 / -1;
}

/* Every label is at most three Hangul (회전수), so one width lines the values up in each column. */
.nc-dro-field-label {
  flex: none;
  min-width: 3.2em;
  color: var(--ncp-dim);
}

.nc-dro-field-value {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-family: var(--ncp-mono);
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A narrow left panel (1024 px window): the tool gets its own row so `T600 Ø6 mm` is not cut. */
@container nc-dro (max-width: 279px) {
  .nc-dro-field[data-key="tool"] {
    grid-column: 1 / -1;
  }
}

/* Names (motion, op) are text, not numbers. */
.nc-dro-field.is-text .nc-dro-field-value {
  font-family: inherit;
}

/* `회전수 18,000 rpm ↻ … 좌표계 G54` in one row (B-29/D-12). */
.nc-dro-sub-label {
  min-width: 0;
  margin-left: 6px;
}

.nc-dro-field-value.nc-dro-offset {
  flex: none;
}

/* The block's own text (D-24) and the machine clock (D-13). */
.nc-dro-field[data-key="block"] .nc-dro-field-value {
  color: var(--ncp-text);
}

.nc-dro-field[data-key="time"] .nc-dro-field-label {
  min-width: 0;
}

.nc-dro-field[data-key="time"] .nc-dro-field-value {
  display: flex;
  flex-wrap: wrap;
  column-gap: 0.5em;
  overflow: visible;
}

.nc-dro-time-main,
.nc-dro-time-rest {
  white-space: nowrap;
}

/* ------------------------------------------------------------------ touch, high contrast */

/* UX3-30: a long press on the bar (over the 3D) neither selects text nor opens the callout menu. */
.nc-player-bar {
  -webkit-touch-callout: none;
}

/* UX3-23: #nc-viewport takes no browser gesture (touch-action: none); the ⋯ popover is the bar's
   only part that can be taller than the room above it, so it scrolls itself (pan-y). */
.nc-player-popover {
  max-height: min(70vh, 480px);
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

/* UX3-27: finger-sized controls (40–44 px) on a touch screen; the scrubber's hit area is 40 px. */
@media (pointer: coarse) {
  .nc-player-bar {
    min-height: 52px;
  }

  .nc-player-bar[data-layout="compact"] {
    min-height: 48px;
  }

  .nc-player-btn {
    width: 40px;
    height: 40px;
  }

  .nc-player-btn.has-text {
    min-width: 48px;
  }

  .nc-player-btn-toggle {
    width: 44px;
    height: 44px;
  }

  .nc-player-scrub {
    height: 40px;
  }

  .nc-player-bar[data-layout="compact"] .nc-player-scrub {
    min-width: 64px;
  }

  .nc-player-speedchip,
  .nc-player-speed {
    height: 40px;
    min-width: 44px;
  }

  .nc-player-future-btn {
    width: 40px;
    height: 36px;
  }

  .nc-player-popover .nc-player-btn {
    height: 44px;
  }

  .nc-player-speedopt {
    height: 40px;
  }
}

/* UX3-36: Windows high contrast — pressed choices fill with Highlight, the played part and the
   thumb stay visible; the op blocks are canvas pixels (not forced). */
@media (forced-colors: active) {
  /* forced-color-adjust: none — else the text backplate (Canvas) hides the HighlightText letters. */
  .nc-player-speedopt[aria-pressed="true"],
  .nc-player-future-btn[aria-checked="true"],
  .nc-player-bar[data-popover] .nc-player-more,
  .nc-player-bar[data-popover] .nc-player-speedchip {
    forced-color-adjust: none;
    border-color: HighlightText;
    background: Highlight;
    color: HighlightText;
  }

  .nc-player-rail {
    outline: 1px solid CanvasText;
  }

  .nc-player-fill {
    background: Highlight;
  }

  .nc-player-thumb {
    forced-color-adjust: none;
    border-color: CanvasText;
    background: Highlight;
  }

  /* UX5-45: the replay's stop stays visible — REV-P-02: also over the Highlight thumb (Canvas ring). */
  .nc-player-stop {
    forced-color-adjust: none;
    background: CanvasText;
    box-shadow: 0 0 0 1px Canvas;
  }
}
