/* 3D-тренажёр «Съёмка на гимбал» — урок 6.3 (Claude, 23.11.2026). Светлый стиль виджетов BRAND_KIT §6.8. */
[data-matis-gimbal3d] {
  --g3-paper: #fbfaf6;
  --g3-panel: #f2efe8;
  --g3-line: #d8d0c0;
  --g3-ink: #2e2720;
  --g3-muted: #63594c;
  --g3-brown: #894a1f;
  --g3-cream: #e8e3d7;
  --g3-orange: #fd7e2f;
  container-type: inline-size;
  color: var(--g3-ink);
  font: 400 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
[data-matis-gimbal3d] *, [data-matis-gimbal3d] *::before, [data-matis-gimbal3d] *::after { box-sizing: border-box; }
[data-matis-gimbal3d] [hidden] { display: none !important; }
[data-matis-gimbal3d] :is(h3, h4, p, figure) { margin: 0; }
[data-matis-gimbal3d] :is(button, select, input) { font: inherit; }
[data-matis-gimbal3d] :is(button, select, input, a, canvas, summary, [tabindex]):focus-visible { outline: 3px solid var(--g3-brown); outline-offset: 3px; }

.g3d-shell { background: var(--g3-paper); border: 1px solid var(--g3-line); border-radius: 20px; padding: 24px; }
.g3d-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 20px; align-items: start; margin-bottom: 16px; }
.g3d-head h3 { display: flex; align-items: center; gap: 10px; font: 400 21px/1.2 "Russo One", system-ui, sans-serif; text-transform: uppercase; letter-spacing: .01em; }
.g3d-ico { flex: none; width: 24px; height: 24px; fill: none; stroke: var(--g3-brown); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.g3d-head p { color: var(--g3-muted); margin-top: 6px; }
.g3d-tabs { display: flex; gap: 3px; padding: 3px; border-radius: 24px; background: var(--g3-cream); margin-bottom: 14px; width: max-content; max-width: 100%; }

[data-matis-gimbal3d] button:where(:not(.mrg-b)) {
  appearance: none; color: inherit; cursor: pointer; min-height: 44px; padding: 6px 14px;
  border: 1px solid var(--g3-line); border-radius: 14px; background: var(--g3-paper);
  font-weight: 650; line-height: 1.2; touch-action: manipulation;
}
[data-matis-gimbal3d] .g3d-tabs button, [data-matis-gimbal3d] .g3d-seg button { border-color: transparent; background: transparent; border-radius: 22px; white-space: nowrap; }
[data-matis-gimbal3d] button[aria-pressed="true"], [data-matis-gimbal3d] .g3d-primary { background: var(--g3-brown); border-color: var(--g3-brown); color: #fff; }
[data-matis-gimbal3d] button:where(:not(.mrg-b)):disabled { opacity: .45; cursor: default; }
@media (hover: hover) {
  [data-matis-gimbal3d] button:not([aria-pressed="true"]):not(.g3d-primary):where(:not(.mrg-b)):not(:disabled):hover { background: var(--g3-cream); border-color: var(--g3-line); }
}
.g3d-seg { display: flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 24px; background: var(--g3-cream); width: max-content; max-width: 100%; }
[data-matis-gimbal3d] .g3d-fsbtn { font-size: 14px; border-radius: 22px; white-space: nowrap; }
.g3d-fsbox { display: grid; justify-items: end; gap: 6px; }
.g3d-fshint { max-width: 260px; font-size: 13px; line-height: 1.4; color: var(--g3-muted); text-align: right; }

/* обёртка сцены и шкалы: в обычном виде не влияет на раскладку */
.g3d-stage { display: contents; }

/* окна: кадр камеры + площадка */
.g3d-view { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 10px; margin-bottom: 10px; }
.g3d-shot, .g3d-over { position: relative; min-width: 0; overflow: hidden; border-radius: 14px; background: #e9d6b8; }
.g3d-shot canvas { display: block; width: 100%; aspect-ratio: 16 / 9; }
.g3d-over { background: var(--g3-panel); border: 1px solid var(--g3-line); min-height: 180px; }
.g3d-over canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.g3d-over canvas:active { cursor: grabbing; }
.g3d-chip { position: absolute; left: 10px; top: 10px; padding: 4px 9px; background: rgba(251, 250, 246, .92); border-radius: 7px; font-size: 12px; font-weight: 650; pointer-events: none; }
.g3d-rec { position: absolute; right: 10px; top: 10px; padding: 4px 9px; background: rgba(30, 26, 22, .62); color: #fff; border-radius: 7px; font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; pointer-events: none; }
.g3d-rec::before { content: "●"; color: #e5482d; margin-right: 5px; }
.g3d-phase { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); padding: 3px 10px; background: rgba(251, 250, 246, .9); border-radius: 20px; font-size: 12px; font-weight: 650; pointer-events: none; white-space: nowrap; }
.g3d-warns { position: absolute; left: 10px; right: 10px; bottom: 40px; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; pointer-events: none; }
.g3d-warns span { background: #fff4ec; color: #7a3412; border: 1px solid #f3b98f; border-radius: 9px; padding: 4px 9px; font-size: 13px; font-weight: 650; }
.g3d-warns span::before { content: "!"; display: inline-grid; place-items: center; width: 17px; height: 17px; margin-right: 6px; border-radius: 50%; background: var(--g3-orange); color: #fff; font-size: 11px; font-weight: 800; }
.g3d-overbar { position: absolute; right: 8px; top: 8px; display: flex; gap: 3px; padding: 3px; background: rgba(232, 227, 215, .92); border-radius: 20px; }
[data-matis-gimbal3d] .g3d-overbar button { min-height: 32px; min-width: 32px; padding: 3px 10px; font-size: 12px; border-radius: 16px; border-color: transparent; background: transparent; }
[data-matis-gimbal3d] .g3d-overbar button[aria-pressed="true"] { background: var(--g3-brown); color: #fff; }
[data-matis-gimbal3d] .g3d-overbar [data-zoom] { font-size: 16px; padding: 0 8px; }
.g3d-overhint { position: absolute; left: 10px; bottom: 8px; font-size: 12px; color: var(--g3-muted); pointer-events: none; }
.g3d-msg { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: var(--g3-muted); font-size: 14px; }

/* шкала дубля */
.g3d-transport { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; margin-bottom: 14px; container: g3dtr / inline-size; }
.g3d-track { display: grid; gap: 3px; min-width: 0; container: g3dtrack / inline-size; }
/* узкая строка шкалы (и во весь экран, где сцена уже тренажёра): ползунок с фазами — своим рядом под кнопками (ревью Codex UI3 №2) */
@container g3dtr (max-width: 700px) {
  .g3d-track { grid-column: 1 / -1; grid-row: 2; }
  .g3d-transport output { grid-column: 3 / -1; grid-row: 1; justify-self: end; }
}
[data-matis-gimbal3d] input[type="range"] { accent-color: var(--g3-brown); width: 100%; min-width: 0; height: 30px; margin: 0; cursor: pointer; }
/* сайт (mu-plugin matis-range) обрамляет ползунок кнопками − / + (32 px + зазор 10 px, бегунок 22 px): шкала фаз — точно под ходом бегунка */
.g3d-track .mrg ~ .g3d-anat { margin-inline: 53px; }
@media (max-width: 640px), (pointer: coarse) { .g3d-track .mrg ~ .g3d-anat { margin-inline: 66px; } }
.g3d-anat { display: grid; grid-template-columns: 2fr 6fr 2fr; gap: 3px; font-size: 11px; color: var(--g3-muted); }
.g3d-anat span { border-top: 3px solid var(--g3-line); padding-top: 2px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* подписи фаз переносим по ширине самой шкалы, а не всего тренажёра — после базового правила, иначе оно перебивает (ревью Codex UI3-2 №1) */
@container g3dtrack (max-width: 480px) {
  .g3d-anat span { overflow: visible; text-overflow: clip; white-space: normal; line-height: 1.2; }
}
.g3d-anat span.on { border-color: var(--g3-brown); color: var(--g3-ink); font-weight: 650; }
.g3d-transport output { color: var(--g3-muted); font-variant-numeric: tabular-nums; font-size: 13px; white-space: nowrap; }

/* панели управления */
.g3d-ctrl { display: grid; gap: 12px; }
.g3d-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.g3d-box { min-width: 0; padding: 13px; background: var(--g3-panel); border: 1px solid var(--g3-line); border-radius: 14px; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 10px; }
.g3d-box > * { min-width: 0; }
.g3d-box h4 { font-size: 15px; font-weight: 750; line-height: 1.3; }
/* 7 траекторий — два ровных ряда 4 + 3 (сетка на 12 колонок): подписи в одну строку, по центру (владелец 24.11.2026) */
.g3d-choices { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; }
.g3d-choices > button { grid-column: span 3; }
.g3d-choices > button:nth-child(n+5) { grid-column: span 4; }
[data-matis-gimbal3d] .g3d-choices button { font-size: 14px; padding-inline: 10px; white-space: nowrap; text-align: center; overflow: hidden; text-overflow: ellipsis; }
.g3d-select { display: none; }
[data-matis-gimbal3d] select { width: 100%; min-height: 44px; background: var(--g3-paper); border: 1px solid var(--g3-line); border-radius: 12px; padding: 8px 12px; color: inherit; }
.g3d-opts { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.g3d-label { font-size: 13px; color: var(--g3-muted); font-weight: 650; }
[data-matis-gimbal3d] .g3d-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; font-weight: 650; font-size: 14px; color: var(--g3-ink); opacity: 1; }
.g3d-check input { width: 20px; height: 20px; accent-color: var(--g3-brown); margin: 0; }
.g3d-note { background: var(--g3-cream); border-inline-start: 3px solid var(--g3-brown); border-radius: 0 10px 10px 0; padding: 9px 12px; }
.g3d-small { color: var(--g3-muted); font-size: 13px; }
.g3d-axis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.g3d-axis div { padding: 6px; background: var(--g3-paper); border: 1px solid var(--g3-line); border-radius: 8px; text-align: center; font-size: 13px; }
.g3d-axis div.lock { border-color: var(--g3-brown); }
.g3d-axis span, .g3d-axis strong, .g3d-axis small { display: block; }
.g3d-axis strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.g3d-axis small { color: var(--g3-muted); font-size: 11px; }
.g3d-param { font-size: 14px; font-weight: 650; display: flex; justify-content: space-between; gap: 8px; }
.g3d-param output { font-variant-numeric: tabular-nums; color: var(--g3-brown); }
.g3d-pad { position: relative; min-height: 110px; border: 1px solid var(--g3-line); border-radius: 12px; touch-action: none; cursor: grab;
  background: linear-gradient(var(--g3-line), var(--g3-line)) center / 1px 78% no-repeat, linear-gradient(90deg, var(--g3-line), var(--g3-line)) center / 84% 1px no-repeat, var(--g3-paper); }
.g3d-pad::after { content: ""; position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; border-radius: 50%; background: var(--g3-brown); transform: translate(calc(-50% + var(--px, 0px)), calc(-50% + var(--py, 0px))); }
.g3d-btns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
[data-matis-gimbal3d] .g3d-lock[aria-pressed="true"] { background: var(--g3-brown); color: #fff; }
.g3d-settings summary { font-weight: 650; cursor: pointer; width: fit-content; min-height: 44px; padding-top: 11px; }
.g3d-settings p { margin-top: 6px; }
.g3d-source { color: var(--g3-brown); text-underline-offset: 3px; }
.g3d-sr { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* во весь экран */
.g3d-fs { position: fixed !important; inset: 0; z-index: 2147483000; overflow: auto; background: var(--g3-paper); }
.g3d-fs .g3d-shell { border: 0; border-radius: 0; min-height: 100%; }
.g3d-fs .g3d-wrap { max-width: 1280px; margin: 0 auto; }
.g3d-fs .g3d-fshint { display: none; }
/* во весь экран на широком экране и телефоне боком: слева сцена и шкала, справа своя прокручиваемая колонка управления под полосой «Свернуть» */
@media (min-aspect-ratio: 4/3) {
  .g3d-fs { overflow: hidden; }
  .g3d-fs .g3d-wrap { max-width: none; height: 100%; }
  .g3d-fs .g3d-shell {
    display: grid; height: 100%; box-sizing: border-box; gap: 8px 16px;
    grid-template-columns: minmax(0, 1fr) clamp(290px, 31vw, 420px);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: "stage head" "stage tabs" "stage ctrl";
    padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  .g3d-fs .g3d-head { grid-area: head; margin: 0; display: flex; justify-content: flex-end; min-height: 44px; }
  .g3d-fs .g3d-head > div:first-child { display: none; }
  .g3d-fs .g3d-tabs { grid-area: tabs; width: 100%; margin: 0; }
  .g3d-fs .g3d-tabs button { flex: 1; white-space: normal; font-size: 13px; padding-inline: 6px; }
  /* окно сцены — контейнер по размеру: кадр и «Площадка» одной ширины (друг под другом) или одной высоты (рядом на широком экране) */
  .g3d-fs .g3d-stage { grid-area: stage; display: flex; flex-direction: column; justify-content: center; gap: 8px; min-height: 0; }
  .g3d-fs .g3d-view { flex: 1 1 auto; container: g3dview / size; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; margin: 0; min-height: 0; position: relative; }
  .g3d-fs .g3d-shot { flex: none; width: min(100cqw, calc(62cqh * 16 / 9)); }
  .g3d-fs .g3d-over { flex: 1 1 0; width: min(100cqw, calc(62cqh * 16 / 9)); min-height: 140px; aspect-ratio: auto; }
  /* переключатели в колонке управления — на всю ширину карточки, кнопки поровну и по центру */
  .g3d-fs .g3d-ctrl .g3d-seg { width: 100%; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .g3d-fs .g3d-ctrl .g3d-seg button { min-width: 0; padding-inline: 6px; white-space: normal; text-align: center; justify-content: center; }
  /* фокусные расстояния: число и «мм» не разрываем (владелец 24.11.2026: «надписи разделены некрасиво») */
  .g3d-fs .g3d-ctrl .g3d-seg > button[data-lens] { white-space: nowrap; padding-inline: 2px; font-size: 14px; }
  .g3d-fs .g3d-ctrl .g3d-btns { grid-template-columns: 1fr 1fr; }
  .g3d-fs .g3d-transport { margin: 0; flex: none; }
  .g3d-fs .g3d-ctrl { grid-area: ctrl; overflow-y: auto; min-height: 0; align-content: start; overscroll-behavior: contain; padding-bottom: 8px; }
  .g3d-fs .g3d-row { grid-template-columns: minmax(0, 1fr); }
  .g3d-fs .g3d-choices { display: none; }
  .g3d-fs .g3d-select { display: block; }
}
/* очень широкий экран: кадр и «Площадка» рядом, одной высоты, блоком по центру */
@media (min-aspect-ratio: 22/10) and (min-height: 601px) {
  /* высота блока картинок — по ширине левой колонки; шкала сразу под ним, всё вместе по центру */
  .g3d-fs .g3d-view { flex: none; flex-direction: row; height: min(calc((100vw - clamp(290px, 31vw, 420px) - 52px) * .62 * 9 / 16), calc(100dvh - 110px)); }
  .g3d-fs .g3d-shot { width: min(62cqw, calc(100cqh * 16 / 9)); }
  .g3d-fs .g3d-over { flex: 1 1 0; width: auto; min-height: 0; height: calc(min(62cqw, calc(100cqh * 16 / 9)) * 9 / 16); }
}
@media (min-aspect-ratio: 4/3) and (max-height: 600px) {
  /* телефон боком: кадр на всю высоту, «Площадка» — окошком в правом нижнем углу кадра */
  .g3d-fs .g3d-view { flex-direction: column; }
  .g3d-fs .g3d-shot { width: min(100cqw, calc(100cqh * 16 / 9)); }
  /* окошко — в правом верхнем углу самой картинки, под таймером; размер от ширины кадра; низ кадра свободен для фазы и предупреждений (ревью Codex F1/F2) */
  .g3d-fs .g3d-over { position: absolute; flex: none; right: calc((100cqw - min(100cqw, calc(100cqh * 16 / 9))) / 2 + 8px); top: calc((100cqh - min(100cqh, calc(100cqw * 9 / 16))) / 2 + 40px); bottom: auto; width: calc(min(100cqw, calc(100cqh * 16 / 9)) * .34); max-width: 280px; height: auto; aspect-ratio: 16 / 10; min-height: 0; z-index: 3; box-shadow: 0 6px 18px rgba(30, 26, 22, .28); }
  .g3d-fs .g3d-over .g3d-overbar, .g3d-fs .g3d-over .g3d-overhint { display: none; }
  .g3d-fs .g3d-over .g3d-chip { font-size: 10px; padding: 2px 6px; left: 6px; top: 6px; }
  /* предупреждения — в левой части кадра, правая занята окошком (ревью Codex FS2 F1) */
  .g3d-fs .g3d-warns { right: calc(34% + 16px); }

  .g3d-fs .g3d-transport { grid-template-columns: auto auto minmax(0, 1fr) auto; }
  .g3d-fs .g3d-anat { display: none; }
}

@container (max-width: 760px) {
  .g3d-shell { padding: 14px; border-radius: 16px; }
  .g3d-choices { display: none; }
  .g3d-select { display: block; }
  .g3d-view { grid-template-columns: minmax(0, 1fr); }
  .g3d-over { aspect-ratio: 16 / 10; }
  .g3d-row { grid-template-columns: minmax(0, 1fr); }
  .g3d-head { grid-template-columns: minmax(0, 1fr); }
  .g3d-fsbox { justify-items: start; }
  .g3d-fshint { text-align: left; max-width: none; }
  .g3d-tabs { width: 100%; }
  .g3d-tabs button { flex: 1; padding-inline: 6px; white-space: normal !important; font-size: 13px; }
}
@container (max-width: 430px) {
  .g3d-transport { grid-template-columns: auto auto minmax(0, 1fr); }
  .g3d-track { grid-column: 1 / -1; grid-row: 2; }
  .g3d-transport output { grid-column: 3 / -1; grid-row: 1; justify-self: end; }
  .g3d-overhint { display: none; }
  .g3d-warns span { font-size: 12px; }
  [data-matis-gimbal3d] .g3d-seg button { white-space: normal; padding-inline: 11px; }
  .g3d-phase { font-size: 11px; }
}
@media (pointer: coarse) {
  [data-matis-gimbal3d] input[type="range"] { height: 44px; }
  [data-matis-gimbal3d] .g3d-overbar button { min-height: 44px; min-width: 44px; }
}
