@import url("./theme.css");
@import url("./theme-toggle.css");
@import url("./global-header.css");

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  --detail-frame-width: calc(100% - 20px);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.detail-topbar {
  position: sticky;
  z-index: 20;
  top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: var(--detail-frame-width);
  min-height: 60px;
  margin: 10px auto 0;
  padding: 0 18px;
  overflow: hidden;
  border: 1px solid transparent;
  border-bottom-color: var(--line-soft);
  background: var(--bg);
  box-shadow: 0 -12px 0 2px var(--bg);
  border-radius: var(--radius-control);
}

.detail-identity {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-width: 0;
}

.detail-topbar__actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  align-items: center;
}

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  font-family: var(--sans);
  font-size: 12px;
}

.detail-identity h1 {
  min-width: 0;
  margin: 0 18px 0 0;
  overflow: hidden;
  color: var(--strong);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-back {
  flex: 0 0 auto;
  color: var(--muted);
}

.detail-back:hover,
.detail-back:focus-visible {
  color: var(--text-strong);
}

.detail-main {
  width: var(--detail-frame-width);
  margin: 0 auto;
  padding: 12px 0 56px;
}

.workbench,
.advanced-editor__shell,
.detail-panel {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-shell);
  background: var(--panel);
}

.detail-kicker,
.detail-panel h2,
.detail-preview__bar,
.detail-package-label,
.editor-rail__header,
.related-rail__header,
.developer-config > div,
.advanced-editor__shell > summary {
  font-family: var(--sans);
}

.detail-kicker {
  margin: 0;
  color: var(--muted-low);
  font-size: 11px;
  letter-spacing: 0.025em;
}

.detail-summary {
  max-width: 690px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(14px, 1.2vw, 18px);
}

.detail-tag-list,
.detail-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-tag-list {
  margin-top: 18px;
}

.detail-chip {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-control);
  background: var(--panel-raised);
  color: var(--muted-low);
  font-family: var(--sans);
  font-size: 11px;
}

.detail-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text);
  font-size: 12px;
  box-shadow: var(--control-raised-shadow);
}

.detail-action:hover {
  border-color: var(--accent-soft);
  background: var(--accent-soft);
  color: var(--text-on-action);
}

.detail-action:active {
  border-color: var(--accent-pressed);
  background: var(--accent-pressed);
  color: var(--text-on-action-pressed);
  box-shadow: var(--control-inset-shadow);
}

.detail-action:disabled { box-shadow: none; }

.workbench {
  container-type: inline-size;
  overflow: hidden;
  scroll-margin-top: 76px;
}

.editor-preview-tools { display: flex; align-items: center; gap: 12px; min-width: 0; }
@media (max-width: 600px) {
  .editor-preview-tools { gap: 8px; }
}

.editor-viewport {
  display: inline-grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 4px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-control);
  background: transparent;
}

.editor-viewport button {
  min-height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--muted-low);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.editor-viewport button[data-active="true"] {
  background: var(--action-active-surface);
  color: var(--strong);
  box-shadow: inset 0 -2px 0 var(--accent), var(--control-inset-shadow);
}

.editor-viewport button:hover:not([data-active="true"]) {
  background: var(--accent-soft-wash);
  color: var(--action-emphasis);
}

.editor-viewport button:active {
  background: var(--accent-pressed);
  color: var(--text-on-action-pressed);
}

.detail-preview__controls {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
}

.editor-preview-state {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workbench__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 1px;
  height: calc(56.25cqw - 163px);
  min-height: 0;
  background: var(--line);
}

.related-rail,
.editor-rail {
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  background: var(--panel);
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
}

.related-rail__header,
.editor-rail__header {
  position: sticky;
  z-index: 3;
  top: 0;
  display: grid;
  gap: 9px;
  min-height: 74px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-translucent);
  backdrop-filter: blur(12px);
}

.related-rail__header {
  align-content: center;
}

.related-rail__header span,
.related-rail__header strong {
  color: var(--muted-low);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.09em;
}

.related-rail__header strong {
  color: var(--text);
}

.related-rail__list {
  display: grid;
}

.related-template {
  display: grid;
  grid-template-columns: minmax(120px, 0.72fr) minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-shell);
  background: var(--panel-raised);
  transition: border-color 140ms ease, background 140ms ease;
}

.related-template:hover {
  border-color: var(--line-strong);
  background: var(--panel-active);
}

.related-template img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--line-soft);
  object-fit: cover;
}

.related-template__copy {
  display: grid;
  align-content: center;
  gap: 6px;
  min-width: 0;
}

.related-template__copy small,
.related-template__copy > span {
  overflow: hidden;
  color: var(--muted-low);
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.025em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.related-template__copy strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
}

.related-template--compact {
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 12px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: var(--radius-shell);
}

.related-template--compact .related-template__copy {
  align-content: start;
}

.related-template--compact .related-template__copy strong {
  font-size: 11px;
}

.detail-preview {
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

.detail-preview__bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  height: 48px;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted-low);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

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

.detail-preview__bar [data-state="ready"] {
  color: var(--ready);
}

.detail-preview__bar [data-state="error"] {
  color: var(--accent);
}

.detail-preview__status span:last-child {
  color: var(--muted);
}

.detail-preview__canvas {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: stretch center;
  padding: 10px;
  overflow: hidden;
  background: var(--bg);
}

.detail-preview__device {
  /* Preserve the backdrop beneath transparent demos independently of the shell. */
  --detail-preview-background: #090b0c;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

:root.theme-light .detail-preview__device {
  --detail-preview-background: #e7eaec;
}

.detail-preview__device--kinetic {
  position: relative;
  overflow: hidden;
}

.detail-preview__device--kinetic::before,
.detail-preview__device--kinetic::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.kinetic-example-context {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: none;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgb(5 7 11 / 90%) 0%, rgb(5 7 11 / 57%) 25%, transparent 50%),
    linear-gradient(180deg, rgb(5 7 11 / 48%) 0%, transparent 22%, transparent 78%, rgb(5 7 11 / 56%) 100%);
  color: #f2f1ef;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  pointer-events: none;
}

.detail-preview__device--kinetic[data-preview-state="example"] {
  isolation: isolate;
  background:
    radial-gradient(circle at 78% 28%, rgb(113 99 176 / 15%), transparent 36%),
    radial-gradient(circle at 34% 78%, rgb(149 47 64 / 10%), transparent 34%),
    linear-gradient(135deg, #11131a 0%, #08090e 52%, #0d1016 100%);
}

.detail-preview__device--kinetic[data-preview-state="example"]::before {
  z-index: 0;
  inset: -24%;
  background:
    radial-gradient(ellipse at 72% 36%, rgb(117 98 203 / 21%) 0%, transparent 35%),
    radial-gradient(ellipse at 40% 78%, rgb(181 56 75 / 13%) 0%, transparent 30%),
    radial-gradient(ellipse at 90% 82%, rgb(67 146 167 / 12%) 0%, transparent 28%);
  filter: blur(54px);
  opacity: 0.76;
  transform: translate3d(-1.5%, -1%, 0) scale(1.02);
  animation: kinetic-example-atmosphere 16s ease-in-out infinite alternate;
}

.detail-preview__device--kinetic[data-preview-state="example"]::after {
  z-index: 3;
  inset: 0;
  padding: 1px;
  background: linear-gradient(
    112deg,
    rgb(255 255 255 / 42%),
    rgb(183 146 255 / 24%) 18%,
    rgb(255 255 255 / 6%) 42%,
    rgb(104 208 231 / 18%) 72%,
    rgb(255 131 151 / 18%)
  );
  box-shadow:
    inset 0 1px 18px rgb(255 255 255 / 4%),
    inset 0 -1px 20px rgb(106 162 203 / 4%);
  opacity: 0.66;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.detail-preview__device--kinetic[data-preview-state="example"] .kinetic-example-context {
  display: block;
}

.detail-preview__device--kinetic[data-preview-state="example"] iframe {
  position: absolute;
  z-index: 1;
  top: 0;
  right: 0;
  width: 82%;
  height: 100%;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  box-shadow: none;
}

.kinetic-example-context__header,
.kinetic-example-context__footer {
  position: absolute;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: 54px;
  font-family: var(--mono);
  text-transform: uppercase;
}

.kinetic-example-context__header {
  top: 0;
  height: 96px;
  border-bottom: 1px solid rgb(255 255 255 / 11%);
  background: linear-gradient(180deg, rgb(255 255 255 / 4%), transparent);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  backdrop-filter: blur(16px) saturate(120%);
}

.kinetic-example-context__header strong {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.kinetic-example-context__header div {
  display: flex;
  gap: 32px;
  color: rgb(231 232 234 / 62%);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.kinetic-example-context__intro {
  position: absolute;
  top: 236px;
  left: 64px;
  width: 430px;
}

.kinetic-example-context__intro p,
.kinetic-example-context__footer {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.kinetic-example-context__intro p {
  margin: 0 0 26px;
  color: #df656d;
}

.kinetic-example-context__intro h2 {
  margin: 0;
  font-size: 58px;
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.98;
  text-shadow: 0 12px 40px rgb(0 0 0 / 36%);
}

.kinetic-example-context__intro > span {
  display: none;
}

.kinetic-example-context__intro b {
  display: none;
}

.kinetic-example-context__intro i {
  color: #c62e35;
  font-size: 18px;
  font-style: normal;
}

.kinetic-example-context__footer {
  bottom: 0;
  height: 72px;
  border-top: 1px solid rgb(255 255 255 / 9%);
  color: rgb(231 232 234 / 48%);
  background: linear-gradient(0deg, rgb(255 255 255 / 3%), transparent);
}

@keyframes kinetic-example-atmosphere {
  0% {
    opacity: 0.62;
    transform: translate3d(-1.5%, -1%, 0) scale(1.02);
  }

  55% {
    opacity: 0.78;
    transform: translate3d(1.5%, 1%, 0) scale(1.08);
  }

  100% {
    opacity: 0.68;
    transform: translate3d(-0.5%, 2%, 0) scale(1.04);
  }
}

.detail-preview__canvas:not([data-viewport="fit"]) .detail-preview__device {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--preview-width);
  height: var(--preview-height);
  transform: translate(-50%, -50%) scale(var(--preview-scale));
  transform-origin: center;
}

.detail-preview iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--detail-preview-background);
  box-shadow: 0 22px 80px var(--shadow-soft);
  transition: border-color 160ms ease;
}

.editor-rail__header {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 7px 12px;
}

.editor-rail {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editor-rail__header div,
.developer-config > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted-low);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.07em;
}

.editor-rail__header strong,
.developer-config strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.editor-preset-list {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: auto 34px minmax(0, 1fr) 34px;
  gap: 7px;
  align-items: center;
  order: 1;
  padding: 5px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.editor-preset-list__label-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.editor-preset-list__label {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
}

.editor-preset-select,
.editor-preset-step {
  min-width: 0;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--control);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  box-shadow: var(--control-raised-shadow);
}

.editor-preset-select {
  width: 100%;
  padding: 6px 9px;
}

.editor-preset-step {
  padding: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 18px;
  cursor: pointer;
}

.editor-preset-select:hover,
.editor-preset-step:hover:not(:disabled) {
  border-color: var(--action-emphasis);
  background: var(--accent-soft-wash);
  color: var(--action-emphasis);
}

.editor-preset-step:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  box-shadow: none;
}

.editor-history,
.editor-action-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  flex: 0 0 auto;
  padding: 5px 12px;
  border-top: 1px solid var(--line-soft);
  background: var(--panel);
}

.editor-history {
  order: 4;
}

.editor-reset-options { position: relative; flex: 0 0 auto; }
.editor-reset-options summary { display: grid; place-items: center; min-width: 28px; min-height: 36px; list-style: none; cursor: pointer; }
.editor-reset-options summary::-webkit-details-marker { display: none; }
.editor-reset-options summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.editor-reset-options > button { position: absolute; z-index: 5; right: 0; bottom: calc(100% + 8px); width: max-content; max-width: 240px; padding: 10px 12px; text-align: left; }

.editor-history [data-editor-save] { display: inline-flex; align-items: center; gap: 6px; }
.editor-history [data-editor-save] svg { width: 15px; height: 15px; flex: none; }
.editor-history [data-editor-save][aria-pressed="true"] svg { fill: currentColor; }
.editor-history button,
.editor-action {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--control);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--control-raised-shadow);
}

.editor-history button:hover:not(:disabled),
.editor-action:hover:not(:disabled) {
  border-color: var(--action-emphasis);
  background: var(--accent-soft-wash);
  color: var(--action-emphasis);
}

.editor-history button:active:not(:disabled),
.editor-action:active:not(:disabled) {
  border-color: var(--accent-pressed);
  background: var(--accent-pressed);
  color: var(--text-on-action-pressed);
  box-shadow: var(--control-inset-shadow);
}

.editor-history button:disabled,
.editor-action:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  box-shadow: none;
}

.editor-action-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  order: 3;
}

.editor-action {
  min-height: 38px;
}

.editor-action-list > .editor-field {
  grid-column: 1 / -1;
}

.editor-control-deck {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--panel);
}

.editor-control-deck--simple {
  flex: 1 1 auto;
  order: 2;
  overflow: hidden;
}

.editor-control-deck__navigation {
  position: relative;
  flex: 0 0 auto;
  min-width: 0;
  background: var(--panel);
}

.editor-control-deck__navigation::before,
.editor-control-deck__navigation::after {
  position: absolute;
  z-index: 1;
  top: 0;
  bottom: 1px;
  width: 42px;
  opacity: 0;
  pointer-events: none;
  content: "";
  transition: opacity 140ms ease;
}

.editor-control-deck__navigation::before {
  left: 0;
  background: linear-gradient(90deg, var(--panel) 20%, transparent 100%);
}

.editor-control-deck__navigation::after {
  right: 0;
  background: linear-gradient(270deg, var(--panel) 20%, transparent 100%);
}

.editor-control-deck__navigation[data-overflow-previous="true"]::before,
.editor-control-deck__navigation[data-overflow-next="true"]::after {
  opacity: 1;
}

.editor-control-deck__tabs {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid var(--line-soft);
  background: var(--panel);
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
}

.editor-control-deck__scroll {
  position: absolute;
  z-index: 2;
  top: 4px;
  width: 24px;
  min-height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--panel-active);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.editor-control-deck__scroll--previous {
  left: 4px;
}

.editor-control-deck__scroll--next {
  right: 4px;
}

.editor-control-deck__scroll:hover:not(:disabled) {
  border-color: var(--action-emphasis);
  background: var(--accent-soft-wash);
  color: var(--action-emphasis);
}

.editor-control-deck__scroll[hidden] {
  display: none;
}

.editor-control-deck__tab {
  flex: 1 0 auto;
  min-width: max-content;
  min-height: 38px;
  padding: 0 9px;
  border: 0;
  border-right: 1px solid var(--line-soft);
  background: var(--panel);
  color: var(--muted-low);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
  border-radius: var(--radius-control);
}

.editor-control-deck__tab:hover:not([aria-selected="true"]) {
  background: var(--accent-soft-wash);
  color: var(--action-emphasis);
}

.editor-control-deck__tab[aria-selected="true"] {
  background: var(--action-active-surface);
  color: var(--strong);
  box-shadow: inset 0 -2px 0 var(--accent), var(--control-inset-shadow);
}

.editor-control-deck__tab:focus-visible {
  outline-offset: -3px;
}

.editor-control-deck__workspace {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  background: var(--panel-raised);
  scrollbar-color: var(--line) transparent;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.editor-control-panel {
  min-height: 100%;
  background: var(--panel-raised);
}

.editor-control-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 28px;
  padding: 3px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--panel-raised);
}

.editor-control-panel__header strong {
  color: var(--strong);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
}

.editor-control-panel__fields {
  display: grid;
  gap: 2px;
  padding: 4px 12px;
}

.editor-repeat {
  display: grid;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-control);
  background: var(--panel);
}

.editor-repeat__navigation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px 58px 32px;
  gap: 6px;
  align-items: center;
}

.editor-repeat__label {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-repeat__step {
  min-height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--control);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 17px;
  cursor: pointer;
  box-shadow: var(--control-raised-shadow);
}

.editor-repeat__step:hover:not(:disabled) {
  border-color: var(--action-emphasis);
  background: var(--accent-soft-wash);
  color: var(--action-emphasis);
}

.editor-preset-select:active,
.editor-preset-step:active:not(:disabled),
.editor-control-deck__scroll:active:not(:disabled),
.editor-control-deck__tab:active,
.editor-repeat__step:active:not(:disabled) {
  border-color: var(--accent-pressed);
  background: var(--accent-pressed);
  color: var(--text-on-action-pressed);
  box-shadow: var(--control-inset-shadow);
}

.editor-repeat__step:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  box-shadow: none;
}

.editor-repeat__counter {
  color: var(--strong);
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.editor-repeat__fields {
  display: grid;
  gap: 4px;
  padding-top: 1px;
}

.advanced-editor__shell > summary::-webkit-details-marker {
  display: none;
}

.editor-field {
  display: grid;
  grid-template-columns: minmax(124px, 1.05fr) minmax(94px, 1.15fr) minmax(54px, 0.5fr);
  gap: 9px;
  align-items: center;
  min-width: 0;
  min-height: 36px;
}

.editor-control-panel .editor-field {
  min-height: 30px;
}

.editor-field__color-picker {
  grid-column: 1 / -1;
}

.editor-control-panel .editor-field select,
.editor-control-panel .editor-field input[type="text"],
.editor-control-panel .editor-field textarea,
.editor-control-panel .editor-field input[type="color"] {
  min-height: 34px;
}

.editor-control-panel .editor-segmented {
  grid-template-columns: repeat(auto-fit, minmax(46px, 1fr));
  gap: 2px;
  padding: 2px;
}

.editor-control-panel .editor-segmented__option > .editor-option__copy {
  min-height: 30px;
}

.editor-control-panel .editor-segmented__option--visual > .editor-option__copy {
  min-height: 40px;
  gap: 2px;
  padding: 2px;
}

.editor-control-panel .editor-segmented__option--visual .editor-option__preview {
  width: 14px;
  max-height: 14px;
}

.editor-control-panel .editor-segmented__option--visual .editor-option__label {
  font-size: 11px;
}

.editor-field__heading {
  display: contents;
}

.editor-field__label-group {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  grid-column: 1;
  grid-row: 1;
}

.editor-field__label,
.editor-field__output {
  font-size: 12px;
  line-height: 1.3;
}

.editor-field__label {
  color: var(--text);
  font-weight: 600;
}

.editor-field__output {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  color: var(--muted-low);
  font-family: var(--mono);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  white-space: nowrap;
}


.editor-help {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.editor-help__button {
  display: grid;
  width: 18px;
  height: 18px;
  padding: 0;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted-low);
  line-height: 1;
  opacity: 0.68;
  cursor: help;
  transition: color 120ms ease, opacity 120ms ease;
  border-radius: var(--radius-control);
}

.editor-help__button:hover,
.editor-help__button:focus-visible {
  background: transparent;
  color: var(--action-emphasis);
  opacity: 1;
}

.editor-help__button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.6;
}

.editor-help__button svg circle:last-child {
  fill: currentColor;
  stroke: none;
}

.editor-help__tooltip {
  position: absolute;
  z-index: 20;
  top: calc(100% + 7px);
  left: 0;
  width: min(260px, 74vw);
  padding: 10px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--panel-active);
  box-shadow: var(--menu-shadow);
  color: var(--text);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  text-transform: none;
  transform: translateY(-3px);
  transition: opacity 120ms ease, transform 120ms ease;
  visibility: hidden;
}

.editor-control-panel__header .editor-help__tooltip {
  right: 0;
  left: auto;
}

.editor-control-panel__fields .editor-help__tooltip {
  width: min(220px, 70vw);
}

.editor-control-deck .editor-help__tooltip {
  display: none;
}

.editor-control-deck .editor-help:hover .editor-help__tooltip,
.editor-control-deck .editor-help:focus-within .editor-help__tooltip {
  display: block;
}

.editor-help:hover .editor-help__tooltip,
.editor-help:focus-within .editor-help__tooltip {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

.editor-help .editor-help__tooltip[popover] {
  position: fixed;
  inset: auto;
  margin: 0;
  max-height: calc(100dvh - 16px);
  overflow: auto;
  white-space: normal;
  overflow-wrap: anywhere;
  transform: none;
  transition: none;
  display: none;
}

.editor-help .editor-help__tooltip[popover]:popover-open {
  display: block;
  opacity: 1;
  visibility: visible;
}

.editor-field input[type="range"] {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  height: 24px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: ew-resize;
}

.editor-field input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: var(--radius-round);
  background: var(--line);
  box-shadow: var(--control-inset-shadow);
}

.editor-field input[type="range"]::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  margin-top: -5px;
  appearance: none;
  border: 1px solid var(--accent);
  border-radius: var(--radius-circle);
  background: var(--accent-soft);
  box-shadow: var(--control-raised-shadow);
}

.editor-field input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: var(--radius-round);
  background: var(--line);
  box-shadow: var(--control-inset-shadow);
}

.editor-field input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-circle);
  background: var(--accent-soft);
  box-shadow: var(--control-raised-shadow);
}

.editor-field select,
.editor-field input[type="text"],
.editor-field textarea {
  grid-column: 2 / 4;
  grid-row: 1;
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--control);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
}

.editor-field select { box-shadow: var(--control-raised-shadow); }
.editor-field input:is([type="text"], [type="url"], [type="number"], [type="color"]),
.editor-field textarea { box-shadow: var(--control-inset-shadow); }

:root:not([data-focus-input="pointer"]) .editor-field select:focus-visible,
:root:not([data-focus-input="pointer"]) .editor-field input[type="text"]:focus-visible,
:root:not([data-focus-input="pointer"]) .editor-field textarea:focus-visible,
:root:not([data-focus-input="pointer"]) .editor-field input[type="color"]:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--control-inset-shadow);
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

.editor-field textarea {
  resize: vertical;
  line-height: 1.4;
}

.editor-menu-rows { grid-column: 1 / -1; min-width: 0; display: grid; gap: 8px; }
.editor-menu-rows__list { display: grid; gap: 8px; }
.editor-menu-row { padding: 8px; border: 1px solid var(--line); background: var(--control); border-radius: var(--radius-control); }
.editor-menu-row__heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.editor-menu-row__number, .editor-menu-rows__status { color: var(--muted); font-size: 11px; }
.editor-menu-row__actions { display: flex; gap: 3px; }
.editor-menu-row__actions button { width: 32px; min-height: 32px; padding: 0; font-size: 17px; }
.editor-menu-row__actions button, .editor-menu-rows__add { border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--control); color: var(--text); cursor: pointer; }
.editor-menu-row__actions button:disabled, .editor-menu-rows__add:disabled { opacity: .35; cursor: default; }
.editor-menu-row__fields { display: grid; grid-template-columns: minmax(110px, .9fr) minmax(0, 1fr); gap: 8px; }
.editor-menu-row__fields > label { display: grid; gap: 4px; min-width: 0; color: var(--muted); font-size: 10px; }
.editor-menu-row__picker { display: flex; align-items: center; gap: 4px; min-width: 0; }
.editor-menu-row__picker svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--text); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.editor-field .editor-menu-row input[type="text"], .editor-field .editor-menu-row select { grid-column: auto; grid-row: auto; }
.editor-menu-row__divider { display: flex; align-items: center; gap: 6px; min-height: 32px; margin-top: 4px; font-size: 11px; color: var(--muted); cursor: pointer; }
.editor-menu-row__divider input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.editor-menu-row__more { margin-top: 6px; }
.editor-menu-row__more > summary { min-height: 28px; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; cursor: pointer; list-style: none; }
.editor-menu-row__more > summary::-webkit-details-marker { display: none; }
.editor-menu-row__more > summary::before { content: "+"; width: 10px; text-align: center; font-size: 13px; }
.editor-menu-row__more[open] > summary::before { content: "−"; }
.editor-menu-row__more > .editor-menu-row__fields { margin-top: 4px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.editor-menu-row__more :is(input, select) { width: 100%; min-width: 0; box-sizing: border-box; }
.editor-menu-rows :is(summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.editor-menu-rows__add { min-height: 36px; font-size: 12px; }
.editor-menu-rows :is(button,input,select):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.editor-field input[type="color"] {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  height: 34px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--control);
  cursor: pointer;
}

.editor-switch {
  position: relative;
  display: block;
  grid-column: 2 / 4;
  grid-row: 1;
  justify-self: end;
  width: 42px;
  cursor: pointer;
}

.editor-switch input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  opacity: 0;
  cursor: pointer;
}

.editor-switch__track {
  position: relative;
  display: block;
  width: 42px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-round);
  background: var(--control);
  transition: background 140ms ease, border-color 140ms ease;
  pointer-events: none;
  box-shadow: var(--control-inset-shadow);
}

.editor-switch__track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-circle);
  background: var(--muted-low);
  content: "";
  transition: transform 140ms ease, background 140ms ease;
  box-shadow: var(--control-raised-shadow);
}

.editor-switch input:checked + .editor-switch__track {
  border-color: var(--action-emphasis);
  background: var(--accent-soft-wash);
}

.editor-switch input:checked + .editor-switch__track::after {
  background: var(--accent);
  transform: translateX(18px);
}

.editor-switch input:focus-visible + .editor-switch__track {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

.editor-segmented {
  display: grid;
  grid-column: 2 / 4;
  grid-row: 1;
  grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--control);
}

.editor-segmented__option {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.editor-segmented__option input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.editor-segmented__option > .editor-option__copy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 7px;
  border-radius: var(--radius-control);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-align: center;
}

.editor-segmented__option input:checked + .editor-option__copy {
  background: var(--action-active-surface);
  color: var(--strong);
  box-shadow: inset 0 -2px 0 var(--accent), var(--control-inset-shadow);
}

.editor-segmented__option input:focus-visible + .editor-option__copy {
  outline: 1px solid var(--accent);
}

.editor-segmented__option--visual > .editor-option__copy {
  min-height: 58px;
  flex-direction: column;
  gap: 4px;
  padding: 5px 4px;
}

.editor-option__preview {
  display: block;
  width: 21px;
  max-height: 22px;
  aspect-ratio: var(--option-aspect);
  border: 1px solid currentColor;
  border-radius: var(--option-radius);
  background: var(--panel-active);
}

.editor-option__label {
  min-width: 0;
}

.advanced-editor {
  margin-top: 14px;
  scroll-margin-top: 76px;
}

.advanced-editor__shell {
  overflow: hidden;
}

.advanced-editor__shell > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: 0 20px;
  list-style: none;
  color: var(--text);
  font-size: 12px;
  letter-spacing: 0.025em;
  cursor: pointer;
}

.advanced-editor__shell > summary small {
  color: var(--muted-low);
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
}

.advanced-editor__body {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.8fr);
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.editor-groups--advanced {
  min-width: 0;
  min-height: 230px;
  background: var(--panel);
}

.editor-control-deck--advanced .editor-control-deck__workspace {
  max-height: 620px;
}

.developer-config {
  min-width: 0;
  padding: 20px;
  background: var(--panel-raised);
}

.developer-config > p {
  margin: 12px 0 16px;
  color: var(--muted-low);
  font-size: 10px;
}

.developer-config pre {
  max-height: 620px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-shell);
  background: var(--bg);
  color: var(--muted);
  font: 9px/1.55 var(--mono);
  tab-size: 2;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.detail-panel {
  min-height: 230px;
  padding: 22px;
}

.detail-panel--wide {
  grid-column: span 2;
}

.detail-panel--full {
  grid-column: 1 / -1;
}

.detail-panel > .detail-kicker {
  margin-bottom: 9px;
}

.detail-panel h2 {
  margin: 0 0 18px;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.025em;
}

.detail-facts,
.detail-dependencies {
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-facts li {
  position: relative;
  padding: 11px 0 11px 18px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
}

.detail-facts li::before {
  position: absolute;
  top: 17px;
  left: 0;
  width: 4px;
  height: 4px;
  background: var(--accent);
  content: "";
}

.detail-dependencies li {
  display: grid;
  gap: 7px;
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
}

.detail-dependencies strong {
  color: var(--text);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
}

.detail-dependencies span {
  color: var(--muted-low);
}

.detail-integration {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 22px;
}

.detail-integration > div {
  min-width: 0;
}

.detail-integration .detail-package-label {
  margin-bottom: 10px;
}

.detail-package {
  display: grid;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}

.detail-package-label {
  margin: 0;
  color: var(--muted-low);
  font-size: 11px;
  letter-spacing: 0.025em;
}

.detail-delivery-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: max-content;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--control);
}

.detail-delivery-targets button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  cursor: pointer;
}

.detail-delivery-targets button:hover:not([data-active="true"]) {
  border-color: var(--accent-soft);
  background: var(--accent-soft-wash);
  color: var(--action-emphasis);
}

.detail-delivery-targets button[data-active="true"] {
  border-color: var(--accent);
  background: var(--action-active-surface);
  color: var(--strong);
  box-shadow: inset 0 -2px 0 var(--accent), var(--control-inset-shadow);
}

.detail-delivery-targets button:active {
  border-color: var(--accent-pressed);
  background: var(--accent-pressed);
  color: var(--text-on-action-pressed);
}

.detail-package code {
  display: block;
  padding: 13px;
  overflow: auto;
  border: 1px solid var(--line-soft);
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 10px;
  border-radius: var(--radius-control);
}

.detail-package p:last-of-type {
  margin: 0;
  color: var(--muted-low);
}

.detail-package .detail-download-file {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
  margin: 0;
  color: var(--muted-low);
  font-family: var(--mono);
  font-size: 9px;
}

.detail-package .detail-download-file code {
  display: inline;
  min-width: 0;
  padding: 0;
  overflow-wrap: anywhere;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: inherit;
  border-radius: var(--radius-control);
}

.detail-package__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.detail-action--primary {
  gap: 8px;
  min-height: 40px;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--text-on-action);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
}

.detail-action--primary img {
  filter: var(--action-on-primary-icon-filter);
}

.detail-action--primary:active img {
  filter: var(--action-on-pressed-icon-filter);
}

.detail-action--secondary {
  min-height: 35px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
}

.detail-commerce {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-height: 35px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--control);
  color: var(--muted-low);
  font-family: var(--sans);
  font-size: 11px;
  cursor: not-allowed;
}

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

.detail-noscript {
  margin: 40px;
  color: var(--muted);
}

@media (max-width: 1120px) {
  .advanced-editor__body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1120px) {
  .workbench__layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .detail-preview {
    order: 1;
    height: min(680px, calc(100svh - 160px));
    min-height: 520px;
  }

  .detail-preview[data-preview-viewport="desktop"] {
    height: auto;
    min-height: 0;
  }

  .detail-preview[data-preview-viewport="desktop"] .detail-preview__canvas {
    aspect-ratio: 16 / 9;
  }

  .editor-rail {
    order: 2;
  }

  .related-rail {
    order: 3;
  }

  .related-rail,
  .editor-rail {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .related-rail__header,
  .editor-rail__header {
    position: static;
  }

  .related-rail__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .related-template--compact {
    grid-template-columns: minmax(120px, 0.7fr) minmax(0, 1fr);
    border-right: 1px solid var(--line-soft);
  }

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

  .editor-control-deck--simple {
    flex: 0 0 auto;
    overflow: visible;
  }

  .editor-control-deck--simple .editor-control-deck__workspace {
    overflow: visible;
  }

  .editor-control-deck--simple .editor-control-panel {
    min-height: 0;
  }

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

  .detail-panel--wide,
  .detail-panel--full {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  html {
    --detail-frame-width: calc(100% - 16px);
  }

  .detail-topbar {
    top: 8px;
    min-height: 55px;
    margin-top: 8px;
    gap: 8px;
    padding: 0 12px;
  }

  .detail-identity {
    display: flex;
  }

  .detail-identity h1 {
    margin: 0;
    font-size: 13px;
  }

  .detail-back {
    min-height: 32px;
  }

  .detail-topbar__actions {
    gap: 2px;
  }

  .detail-main {
    padding-top: 10px;
  }

  .detail-preview__bar {
    display: flex;
    justify-content: flex-end;
    height: auto;
    min-height: 58px;
    padding: 7px;
  }

  body[data-template-id="kinetic-carousel"] .detail-preview {
    grid-template-rows: auto minmax(0, 1fr);
  }

  body[data-template-id="kinetic-carousel"] .detail-preview__controls {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .detail-preview {
    height: min(680px, calc(100svh - 92px));
    min-height: 500px;
    grid-template-rows: 58px minmax(0, 1fr);
  }

  .detail-preview__canvas {
    padding: 6px;
  }

  .editor-viewport button {
    min-height: 27px;
    padding-inline: 5px;
    font-size: 9px;
  }

  .editor-field {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
  }

  .editor-field__label-group {
    grid-column: 1;
    grid-row: 1;
  }

  .editor-field__output,
  .editor-switch {
    grid-column: 2;
    grid-row: 1;
  }

  .editor-field input[type="range"],
  .editor-field select,
  .editor-field input[type="text"],
  .editor-field textarea,
  .editor-field input[type="color"],
  .editor-segmented {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .detail-grid,
  .detail-integration,
  .related-grid,
  .related-rail__list {
    grid-template-columns: 1fr;
  }

  .related-template--compact {
    grid-template-columns: minmax(110px, 0.68fr) minmax(0, 1fr);
    border-right: 0;
  }

  .advanced-editor__shell > summary {
    display: grid;
    gap: 5px;
    padding-block: 14px;
  }

  .detail-preview__canvas[data-viewport="fit"] .detail-preview__device--kinetic[data-preview-state="example"] iframe {
    top: auto;
    bottom: 0;
    width: 100%;
    height: 62%;
  }

  .detail-preview__canvas[data-viewport="fit"] .kinetic-example-context__header {
    height: 86px;
    padding-inline: 34px;
  }

  .detail-preview__canvas[data-viewport="fit"] .kinetic-example-context__header div,
  .detail-preview__canvas[data-viewport="fit"] .kinetic-example-context__footer {
    display: none;
  }

  .detail-preview__canvas[data-viewport="fit"] .kinetic-example-context__intro {
    top: 126px;
    left: 34px;
    width: calc(100% - 68px);
  }

  .detail-preview__canvas[data-viewport="fit"] .kinetic-example-context__intro p {
    margin-bottom: 22px;
  }

  .detail-preview__canvas[data-viewport="fit"] .kinetic-example-context__intro h2 {
    font-size: clamp(38px, 12vw, 52px);
  }

  .detail-preview__canvas[data-viewport="fit"] .kinetic-example-context__intro > span,
  .detail-preview__canvas[data-viewport="fit"] .kinetic-example-context__intro b {
    display: none;
  }
}

.detail-preview__canvas[data-viewport="tablet"] .detail-preview__device--kinetic[data-preview-state="example"] iframe,
.detail-preview__canvas[data-viewport="mobile"] .detail-preview__device--kinetic[data-preview-state="example"] iframe {
  top: auto;
  bottom: 0;
  width: 100%;
  height: 62%;
}

.detail-preview__canvas[data-viewport="tablet"] .kinetic-example-context__header,
.detail-preview__canvas[data-viewport="mobile"] .kinetic-example-context__header {
  height: 86px;
  padding-inline: 34px;
}

.detail-preview__canvas[data-viewport="tablet"] .kinetic-example-context__header div,
.detail-preview__canvas[data-viewport="mobile"] .kinetic-example-context__header div,
.detail-preview__canvas[data-viewport="tablet"] .kinetic-example-context__footer,
.detail-preview__canvas[data-viewport="mobile"] .kinetic-example-context__footer {
  display: none;
}

.detail-preview__canvas[data-viewport="tablet"] .kinetic-example-context__intro,
.detail-preview__canvas[data-viewport="mobile"] .kinetic-example-context__intro {
  top: 126px;
  left: 34px;
  width: calc(100% - 68px);
}

.detail-preview__canvas[data-viewport="tablet"] .kinetic-example-context__intro p,
.detail-preview__canvas[data-viewport="mobile"] .kinetic-example-context__intro p {
  margin-bottom: 22px;
}

.detail-preview__canvas[data-viewport="tablet"] .kinetic-example-context__intro h2,
.detail-preview__canvas[data-viewport="mobile"] .kinetic-example-context__intro h2 {
  font-size: clamp(38px, 8vw, 58px);
}

.detail-preview__canvas[data-viewport="tablet"] .kinetic-example-context__intro > span,
.detail-preview__canvas[data-viewport="mobile"] .kinetic-example-context__intro > span,
.detail-preview__canvas[data-viewport="tablet"] .kinetic-example-context__intro b,
.detail-preview__canvas[data-viewport="mobile"] .kinetic-example-context__intro b {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .detail-preview__device--kinetic[data-preview-state="example"]::before {
    animation: none !important;
  }

  .detail-preview iframe,
  .editor-control-deck__navigation::before,
  .editor-control-deck__navigation::after,
  .editor-control-deck__scroll,
  .editor-control-deck__tab,
  .editor-switch__track,
  .editor-switch__track::after {
    transition-duration: 1ms !important;
  }
}

/* Live catalogue previews with compact spacing and edge navigation. */
.related-strip { position: relative; width: 100%; min-width: 0; padding: 16px; }
.related-strip__track {
  display: flex; gap: 12px; overflow-x: auto;
  overscroll-behavior-x: contain; scrollbar-width: none;
}
.related-strip__track::-webkit-scrollbar { display: none; }
.related-strip__card { position: relative; flex: 0 0 clamp(280px, 36vw, 560px); min-width: 0; }
.related-strip__asset {
  position: relative; display: block;
  min-width: 0; aspect-ratio: 16 / 9; overflow: hidden; background: #000;
}
/* Recorded catalogue clips over their posters: identical in either site theme. */
.related-strip__poster { display: block; width: 100%; height: 100%; object-fit: cover; }
.related-strip__video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  border: 0; background: #000; pointer-events: none; opacity: 0;
  border-radius: var(--radius-control);
}
.related-strip__video[data-preview-lifecycle="ready"] { opacity: 1; }
.related-strip__asset:has(> .related-strip__video[data-preview-lifecycle="ready"]) > .related-strip__poster { visibility: hidden; }
.related-strip__asset:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.related-strip__arrow {
  position: absolute; z-index: 2; top: 16px; bottom: 16px; width: 48px;
  display: grid; place-items: center; padding: 0; border: 0;
  color: #fff; background: linear-gradient(90deg, #0009, transparent); cursor: pointer;
  border-radius: var(--radius-control);
}
.related-strip__arrow--previous { left: 16px; }
.related-strip__arrow--next { right: 16px; background: linear-gradient(270deg, #0009, transparent); }
.related-strip__arrow svg, .visual-asset-navigation__arrow svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.related-strip__arrow:disabled { opacity: 0; pointer-events: none; }
.related-strip__arrow:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .related-strip__arrow svg { transition: transform 160ms ease; }
  .related-strip__arrow:hover svg {
    transform: translate(var(--arrow-x, 0px), var(--arrow-y, 0px)) scale(1.15);
  }
}

/* Only shown when autoplay was refused; keep the detail link independent. */
.catalogue-preview-play {
  position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%, -50%);
  min-height: 44px; padding: 10px 16px; border: 1px solid #ffffff80; border-radius: 999px;
  background: #171717; color: #fff; font: inherit; cursor: pointer;
}
.catalogue-preview-play[hidden] { display: none; }
.catalogue-preview-play:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.catalogue-preview-play[data-preview-action="pause"] { top: auto; bottom: 12px; left: 12px; transform: none; }

/* Non-modal mobile note: no backdrop, focus trap or desktop viewport warning. */
.mobile-asset-notice[hidden] { display: none; }
.mobile-asset-notice {
  position: fixed;
  z-index: 110;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 36px;
  align-items: start;
  gap: 10px;
  max-width: 480px;
  max-height: 50dvh;
  overflow-y: auto;
  padding: 14px 10px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 8px 32px #0003;
  font-size: 12px;
  line-height: 1.5;
}
.mobile-asset-notice p { margin: 0; }
.mobile-asset-notice__icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-weight: 700;
}
.mobile-asset-notice summary {
  display: list-item;
  width: fit-content;
  padding: 12px 0;
  min-height: 44px;
  cursor: pointer;
  font-weight: 600;
}
.mobile-asset-notice details[open] p { padding-bottom: 4px; }
.mobile-asset-notice__dismiss {
  min-width: 44px;
  min-height: 44px;
  margin: -8px -4px 0 -4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
}
.mobile-asset-notice :focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
@media (min-width: 1025px), (pointer: fine) { .mobile-asset-notice { display: none; } }

/* An inline notice reserves its own row, including in the height-limited Fit view. */
.detail-preview > .mobile-asset-notice {
  position: static;
  max-width: calc(100vw - 24px);
  margin-bottom: 8px;
  flex: none;
}
body[data-editor-expanded] .detail-preview:has(> .mobile-asset-notice:not([hidden])) {
  display: flex;
  flex-direction: column;
  max-height: 100dvh;
}

/* A visible host preference beneath the preview, never an asset setting. */
.detail-preview > .site-motion-control { flex: none; justify-content: center; padding: 4px 12px; }
