:root {
  color-scheme: dark;
  --page-top: #272727;
  --page-base: #171717;
  --page-glow-a: rgba(232, 170, 72, 0.12);
  --page-glow-b: rgba(255, 255, 255, 0.03);
  --panel: rgba(34, 34, 34, 0.92);
  --panel-soft: rgba(42, 42, 42, 0.9);
  --section: rgba(48, 48, 48, 0.66);
  --surface: #262626;
  --surface-alt: #1d1d1d;
  --surface-strong: #303030;
  --button-bg: #353535;
  --button-hover: #404040;
  --button-active: rgba(217, 163, 74, 0.2);
  --input-bg: #171717;
  --input-border: rgba(255, 255, 255, 0.14);
  --button-border: rgba(255, 255, 255, 0.11);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #ececec;
  --muted: #ababab;
  --accent: #d9a34a;
  --accent-strong: #f0c36a;
  --danger: #d86969;
  --shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
  --radius-panel: 5px;
  --radius-section: 5px;
  --radius-item: 5px;
  --radius-input: 5px;
  --timeline-frame-width: 18px;
  --timeline-label-width: 148px;
  --timeline-ruler-height: 18px;
  --timeline-row-height: 24px;
  --timeline-event-height: 16px;
  font-family: "Yu Gothic UI", "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --page-top: #f3f4f6;
  --page-base: #e4e6ea;
  --page-glow-a: rgba(217, 163, 74, 0.14);
  --page-glow-b: rgba(255, 255, 255, 0.4);
  --panel: rgba(255, 255, 255, 0.9);
  --panel-soft: rgba(248, 249, 251, 0.92);
  --section: rgba(240, 242, 245, 0.9);
  --surface: #f0f2f5;
  --surface-alt: #e6e9ee;
  --surface-strong: #ffffff;
  --button-bg: #e2e5ea;
  --button-hover: #d7dce3;
  --button-active: rgba(217, 163, 74, 0.22);
  --input-bg: #fbfcfd;
  --input-border: rgba(32, 37, 44, 0.12);
  --button-border: rgba(32, 37, 44, 0.1);
  --line: rgba(32, 37, 44, 0.1);
  --line-strong: rgba(32, 37, 44, 0.18);
  --text: #20252c;
  --muted: #68717c;
  --accent: #b88020;
  --accent-strong: #9a670f;
  --danger: #b94c4c;
  --shadow: 0 14px 28px rgba(66, 70, 76, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  margin: 0;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, var(--page-glow-a), transparent 28%),
    radial-gradient(circle at top right, var(--page-glow-b), transparent 26%),
    linear-gradient(180deg, var(--page-top) 0%, var(--page-base) 100%);
  color: var(--text);
}

body {
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

button,
.text-input,
select,
.range-input {
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    color 140ms ease;
}

button {
  border: 1px solid var(--button-border);
  background: var(--button-bg);
  color: var(--text);
  border-radius: var(--radius-input);
  padding: 0.48rem 0.72rem;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
}

button:hover {
  border-color: var(--line-strong);
  background: var(--button-hover);
}

button.active {
  border-color: rgba(217, 163, 74, 0.45);
  background: var(--button-active);
  color: var(--accent-strong);
}

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

button.danger {
  border-color: rgba(216, 105, 105, 0.36);
  color: var(--danger);
}

.icon-button {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.icon-button svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: currentColor;
  stroke: none;
}

.text-input,
select,
.range-input {
  width: 100%;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  border-radius: var(--radius-input);
  padding: 0.55rem 0.65rem;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

button:focus-visible,
.text-input:focus-visible,
select:focus-visible,
.range-input:focus-visible {
  outline: none;
  border-color: rgba(217, 163, 74, 0.45);
  box-shadow: 0 0 0 2px rgba(217, 163, 74, 0.16);
}

small {
  color: var(--muted);
}

.app-shell {
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 0.65rem;
  padding: 0.65rem;
  overflow: hidden;
}

.app-menu-shell {
  display: flex;
  align-items: center;
  min-height: 2.1rem;
  padding: 0 0.15rem;
  border-bottom: 1px solid var(--line);
}

.app-toolbar,
.status-bar,
.panel,
.section {
  backdrop-filter: blur(16px);
}

.app-toolbar,
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius-panel);
  padding: 0.65rem 0.75rem;
  box-shadow: var(--shadow);
}

.toolbar-brand {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}

.toolbar-title-row {
  display: inline-flex;
  align-items: flex-end;
  gap: 0.45rem;
}

.toolbar-brand strong {
  font-size: 1.16rem;
  line-height: 1.05;
  letter-spacing: 0.02em;
}

.toolbar-brand span {
  color: var(--muted);
}

.toolbar-version {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1;
  margin-bottom: 0.12rem;
}

.menu-bar {
  display: flex;
  gap: 0.2rem;
  align-items: center;
}

.menu-group {
  position: relative;
}

.menu-trigger {
  min-width: auto;
  padding: 0.28rem 0.5rem;
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
}

.menu-trigger:hover,
.menu-trigger.active {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
  color: var(--accent-strong);
}

.menu-dropdown {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  min-width: 13rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-section);
  background: var(--panel-soft);
  box-shadow: var(--shadow);
  z-index: 40;
}

.menu-item {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.context-menu-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
}

.context-menu-root {
  position: absolute;
}

.context-menu {
  min-width: 10.5rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-section);
  background: var(--panel-soft);
  box-shadow: var(--shadow);
}

.context-menu-item-group {
  position: relative;
}

.context-menu-item {
  width: 100%;
  min-width: auto;
  justify-content: flex-start;
  text-align: left;
  padding: 0.1rem 0.52rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius-input) - 1px);
  background: transparent;
  box-shadow: none;
  line-height: 1.22;
}

.context-menu-parent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.context-menu-caret {
  color: var(--muted);
  font-size: 0.72rem;
}

.context-submenu {
  position: absolute;
  top: -0.1rem;
  left: calc(100% - 0.04rem);
}

.context-menu-item:hover,
.context-menu-item.active,
.context-menu-parent.submenu-open {
  border-color: var(--line);
  background: var(--button-active);
  color: var(--accent-strong);
}

.context-menu-item.danger {
  color: var(--danger);
}

.context-menu-item.danger:hover,
.context-menu-item.danger.active {
  border-color: rgba(216, 105, 105, 0.36);
  background: rgba(216, 105, 105, 0.16);
  color: #ffd9d9;
}

.toolbar-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar-label {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.panel-layout-row {
  align-items: flex-end;
  gap: 0.3rem;
}

.panel-layout-row .toolbar-label {
  font-size: 0.74rem;
}

.dock-control {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  color: var(--muted);
  font-size: 0.74rem;
}

.dock-select {
  min-width: 5.8rem;
}

.panel-layout-row .dock-control {
  gap: 0.14rem;
  font-size: 0.69rem;
}

.panel-layout-row .dock-select {
  min-width: 5.2rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.78rem;
}

.panel-layout-row button {
  padding: 0.38rem 0.6rem;
  font-size: 0.78rem;
}

.toolbar-row.compact {
  gap: 0.3rem;
}

.segmented-control {
  display: inline-flex;
  gap: 0.2rem;
  padding: 0.2rem;
  border-radius: calc(var(--radius-input) + 2px);
  border: 1px solid var(--line);
  background: var(--surface-alt);
}

.compact-range {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.compact-range input {
  width: 96px;
  padding: 0;
}

.app-grid {
  position: relative;
  min-height: 0;
  display: flex;
  gap: 0.5rem;
  overflow: hidden;
}

.workspace {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow: hidden;
}

.mode-surface {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.mode-surface > .panel {
  flex: 1;
}

.panel {
  min-height: 0;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.dock-slot {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
}

.dock-slot-bottom {
  width: 100%;
}

.dock-slot-header {
  display: flex;
  align-items: flex-end;
  min-height: 2rem;
  padding: 0.24rem 0.34rem 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.dock-tablist {
  display: flex;
  gap: 0.2rem;
  min-width: 0;
  overflow: auto;
}

.dock-tab {
  white-space: nowrap;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  padding: 0.3rem 0.52rem 0.32rem;
  font-size: 0.78rem;
  line-height: 1.1;
}

.dock-slot-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.dock-slot-body > * {
  flex: 1;
  min-height: 0;
}

.dock-divider {
  position: relative;
  flex: 0 0 auto;
}

.dock-divider::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: 999px;
  background: rgba(217, 163, 74, 0.18);
}

.dock-divider.vertical {
  width: 8px;
  cursor: col-resize;
}

.dock-divider.vertical::before {
  width: 2px;
  height: 72%;
}

.dock-divider.horizontal {
  height: 8px;
  cursor: row-resize;
}

.dock-divider.horizontal::before {
  width: 72%;
  height: 2px;
}

.floating-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 25;
}

.floating-panel {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 320px;
  min-height: 220px;
  pointer-events: auto;
  overflow: hidden;
}

.floating-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem 0.45rem 0.7rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  cursor: move;
}

.floating-panel-header strong {
  font-size: 0.82rem;
  letter-spacing: 0.03em;
}

.floating-panel-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.floating-panel-body > * {
  height: 100%;
}

.floating-panel-resize {
  position: absolute;
  right: 0.2rem;
  bottom: 0.2rem;
  width: 1rem;
  height: 1rem;
  cursor: nwse-resize;
}

.floating-panel-resize::before {
  content: "";
  position: absolute;
  inset: 0.12rem;
  border-right: 2px solid rgba(217, 163, 74, 0.4);
  border-bottom: 2px solid rgba(217, 163, 74, 0.4);
  border-bottom-right-radius: 0.2rem;
}

.sidebar,
.inspector {
  overflow: auto;
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sidebar > *,
.inspector > * {
  flex-shrink: 0;
}

.section {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--section);
  border-radius: var(--radius-section);
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--line);
}

.section-header h3 {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.section-actions,
.project-summary,
.preview-meta,
.list,
.sublist,
.checkbox-list,
.section-body,
.field,
.meta-stack {
  display: flex;
}

.section-actions,
.toolbar-row.compact {
  gap: 0.3rem;
}

.section-actions {
  flex-wrap: wrap;
}

.section-body,
.project-summary,
.preview-meta,
.list,
.sublist,
.checkbox-list,
.field,
.meta-stack {
  flex-direction: column;
}

.section-body {
  gap: 0.65rem;
  padding: 0.8rem 0.85rem 0.85rem;
}

.section-subtitle {
  margin: 0;
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.project-summary span,
.preview-meta span,
.status-bar span,
.timeline-toolbar span,
.field span {
  color: var(--muted);
}

.meta-stack {
  gap: 0.22rem;
}

.meta-stack span {
  overflow-wrap: anywhere;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

.action-grid button {
  width: 100%;
}

.wide-action {
  grid-column: 1 / -1;
}

.helper-text {
  color: var(--muted);
  font-size: 0.78rem;
}

.background-preview {
  display: grid;
  place-items: center;
  min-height: 140px;
  max-height: 220px;
  overflow: hidden;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  background: var(--surface-alt);
}

.background-preview img {
  width: 100%;
  height: 100%;
  max-height: 200px;
  object-fit: contain;
  display: block;
}

.library-list {
  max-height: min(24vh, 14rem);
  overflow: auto;
  padding-right: 0.15rem;
}

.library-item {
  align-items: center;
}

.library-name {
  font-weight: 600;
}

.library-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.compact-list-item .library-meta {
  gap: 0.24rem;
}

.compact-list-item .color-chip {
  width: 0.72rem;
  height: 0.72rem;
}

.color-chip {
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .color-chip {
  border-color: rgba(32, 37, 44, 0.18);
}

.list,
.sublist,
.checkbox-list {
  gap: 0.4rem;
}

.sublist {
  padding-left: 0.8rem;
  margin-top: 0.3rem;
}

.lamp-section,
.lamp-section .section-body {
  min-height: 0;
}

.lamp-list,
.compact-list {
  max-height: min(42vh, 28rem);
  overflow: auto;
  padding-right: 0;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  background: var(--surface-alt);
}

.library-list.compact-list {
  max-height: min(24vh, 14rem);
}

.list-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.62rem 0.68rem;
  text-align: left;
}

.list-item.active,
.timeline-track-label.active {
  border-color: rgba(217, 163, 74, 0.4);
  background: var(--button-active);
}

.lamp-list-item,
.compact-list-item {
  align-items: center;
  border-width: 0 0 1px;
  border-style: solid;
  border-color: var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  gap: 0.3rem;
  padding: 0.14rem 0.4rem;
  min-height: 1.3rem;
  font-size: 0.74rem;
  line-height: 1.05;
  white-space: nowrap;
}

.lamp-list-item:last-child,
.compact-list-item:last-child {
  border-bottom-width: 0;
}

.lamp-list-item:hover,
.compact-list-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.lamp-list-item.active,
.compact-list-item.active {
  border-color: rgba(217, 163, 74, 0.4);
  background: rgba(217, 163, 74, 0.14);
}

.lamp-list-label {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lamp-list-meta {
  flex: 0 0 auto;
  white-space: nowrap;
}

.lamp-list-item small,
.compact-list-item small {
  font-size: 0.66rem;
}

.pattern-library-section .section-body {
  gap: 0.35rem;
}

.pattern-library-section .timeline-library-list {
  gap: 0;
  max-height: min(28vh, 12rem);
  overflow: auto;
  padding-right: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  background: var(--surface-alt);
}

.pattern-library-section .timeline-library-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.35rem 1.45rem 2.45rem 2.45rem;
  align-items: center;
  gap: 0.18rem;
  padding: 0.14rem 0.26rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  min-height: 1.34rem;
  font-size: 0.74rem;
  line-height: 1.05;
}

.pattern-library-section .timeline-library-item:last-child {
  border-bottom-width: 0;
}

.pattern-library-section .timeline-library-item .text-input,
.pattern-library-section .timeline-library-item button {
  font-size: 0.74rem;
  line-height: 1.05;
  padding: 0.1rem 0.22rem;
  min-height: 1.2rem;
}

.pattern-library-section .timeline-library-name {
  min-width: 0;
  padding: 0.1rem 0.24rem;
}

.pattern-library-section .timeline-library-control {
  gap: 0;
  min-width: 0;
}

.pattern-library-section .timeline-library-control span {
  display: none;
}

.pattern-library-section .timeline-library-control input[type="number"] {
  width: 100%;
  min-width: 0;
  padding: 0.1rem 0.2rem;
  text-align: center;
}

.pattern-library-section .timeline-library-loop {
  justify-content: center;
}

.pattern-library-section .timeline-library-loop input[type="checkbox"] {
  width: 0.78rem;
  height: 0.78rem;
}

.pattern-library-section .timeline-library-item button {
  white-space: nowrap;
  text-align: center;
}

.sequence-block {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sequence-list {
  gap: 0.3rem;
}

.sequence-row {
  display: flex;
  align-items: stretch;
  gap: 0.2rem;
}

.sequence-toggle-button {
  flex: 0 0 1.5rem;
  width: 1.5rem;
  padding: 0;
  border-radius: var(--radius-input);
  background: transparent;
  box-shadow: none;
  font-size: 0.76rem;
}

.sequence-toggle-button:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sequence-item {
  flex: 1;
  min-width: 0;
}

.sequence-item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sequence-track-list {
  gap: 0;
  padding-left: 0;
  margin-top: 0;
  margin-left: 1.72rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  background: var(--surface-alt);
  overflow: hidden;
}

.sequence-track-item {
  border-width: 0 0 1px;
}

.sequence-track-item:last-child {
  border-bottom-width: 0;
}

.field {
  gap: 0.28rem;
}

.field span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.inspector .section-body {
  gap: 0.5rem;
}

.inspector .field-grid {
  gap: 0.45rem;
}

.inspector-field {
  display: grid;
  grid-template-columns: 6.2rem minmax(0, 1fr);
  align-items: center;
  column-gap: 0.55rem;
  row-gap: 0.2rem;
}

.inspector-field span {
  font-size: 0.68rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.inspector-field > :not(span) {
  min-width: 0;
}

.inspector .text-input,
.inspector select,
.inspector .range-input {
  padding: 0.38rem 0.52rem;
}

.inspector .color-field {
  gap: 0.35rem;
  grid-template-columns: 34px minmax(0, 1fr);
}

.inspector .color-picker {
  width: 34px;
  height: 32px;
}

.field-grid {
  display: grid;
  gap: 0.65rem;
}

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

.auto-show-settings-grid {
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}

.background-adjust-grid {
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.background-adjust-grid .inspector-field {
  grid-template-columns: 5.8rem minmax(0, 1fr);
}

.field-grid .field {
  min-width: 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.canvas-panel,
.preview-panel,
.timeline-panel {
  position: relative;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  overflow: hidden;
}

.canvas-hint,
.preview-toolbar,
.timeline-toolbar,
.timeline-toolbar-actions,
.timeline-playback {
  display: flex;
  align-items: center;
  gap: 0.28rem;
}

.canvas-hint,
.preview-toolbar,
.timeline-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.45rem;
}

.canvas-hint > .project-summary,
.preview-toolbar > .preview-meta,
.timeline-toolbar > .project-summary {
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.38rem;
  line-height: 1.15;
}

.canvas-hint > .project-summary strong,
.preview-toolbar > .preview-meta strong,
.timeline-toolbar > .project-summary strong {
  margin: 0;
  font-size: 0.86rem;
}

.canvas-hint > .project-summary span,
.preview-toolbar > .preview-meta span,
.timeline-toolbar > .project-summary span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.canvas-zoom-control,
.preview-zoom-control,
.timeline-playback {
  justify-self: center;
}

.timeline-playback {
  flex-wrap: nowrap;
  justify-content: center;
}

.timeline-toolbar-actions {
  justify-self: end;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.timeline-library {
  border: 1px solid var(--line);
  border-radius: var(--radius-section);
  background: var(--surface-alt);
  padding: 0.5rem 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.timeline-library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.timeline-library-header strong {
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.timeline-library-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: min(22vh, 10rem);
  overflow: auto;
  padding-right: 0.1rem;
}

.timeline-library-item {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) 5.1rem auto auto auto;
  align-items: center;
  gap: 0.3rem;
  padding: 0.24rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  background: rgba(255, 255, 255, 0.02);
}

.timeline-library-name {
  min-width: 0;
  padding: 0.3rem 0.4rem;
}

.timeline-library-control {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.timeline-library-control span {
  font-size: 0.66rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.timeline-library-control input[type="number"] {
  width: 3.9rem;
  padding: 0.28rem 0.32rem;
}

.timeline-library-loop {
  gap: 0.28rem;
}

.timeline-library-loop input[type="checkbox"] {
  margin: 0;
}

.timeline-library-item button {
  white-space: nowrap;
  padding: 0.25rem 0.4rem;
}

.timeline-library-empty {
  margin: 0;
}

.panel-toolbar-spacer {
  justify-self: end;
  width: 1px;
  height: 1px;
}

.canvas-zoom-control input {
  width: 124px;
}

.preview-zoom-control input {
  width: 124px;
}

.timeline-playback .compact-range {
  margin-left: 0.05rem;
}

.timeline-zoom-control input {
  width: 112px;
}

.timeline-placement-control .segmented-control {
  padding: 0.15rem;
}

.timeline-placement-control button {
  min-width: 2.15rem;
  padding: 0.28rem 0.5rem;
}

.canvas-scroll,
.preview-stage,
.timeline-scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  border-radius: var(--radius-section);
  background: var(--surface-alt);
  border: 1px solid var(--line);
}

.layout-canvas {
  display: block;
}

.canvas-drop-target {
  fill: rgba(217, 163, 74, 0.08);
  stroke: rgba(217, 163, 74, 0.55);
  stroke-width: 3;
  stroke-dasharray: 16 12;
}

.layout-grid line {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

:root[data-theme="light"] .layout-grid line {
  stroke: rgba(32, 37, 44, 0.08);
}

.layout-canvas text {
  fill: rgba(236, 236, 236, 0.88);
  font-size: 11px;
  font-weight: 600;
}

:root[data-theme="light"] .layout-canvas text {
  fill: rgba(32, 37, 44, 0.82);
}

.preview-canvas {
  display: block;
  min-height: 400px;
}

.timeline-scroll {
  padding: 0.5rem 0.58rem 0.62rem;
}

.timeline-ruler {
  position: relative;
  height: var(--timeline-ruler-height);
  margin-left: calc(var(--timeline-label-width) + 0.35rem);
}

.timeline-ruler-mark {
  position: absolute;
  top: 0;
  height: 100%;
  width: 1px;
  background: var(--line);
}

.timeline-ruler-mark span {
  position: absolute;
  top: 0;
  left: 3px;
  font-size: 0.62rem;
}

.timeline-row {
  display: grid;
  grid-template-columns: var(--timeline-label-width) minmax(0, 1fr);
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.24rem;
}

.timeline-row-audio {
  margin-bottom: 0.3rem;
}

.timeline-track-row {
  position: relative;
}

.timeline-track-row.dragging {
  opacity: 0.7;
}

.timeline-track-row.track-drop-before::before,
.timeline-track-row.track-drop-after::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 999px;
  background: var(--accent-strong);
  pointer-events: none;
  z-index: 5;
}

.timeline-track-row.track-drop-before::before {
  top: -0.18rem;
}

.timeline-track-row.track-drop-after::after {
  bottom: -0.18rem;
}

.timeline-track-row.preview-disabled .timeline-track-label,
.timeline-track-row.preview-disabled .timeline-track-lane {
  opacity: 0.72;
}

.timeline-track-label {
  width: 100%;
  height: var(--timeline-row-height);
  display: flex;
  align-items: center;
  gap: 0.12rem;
  padding: 0.08rem 0.16rem;
  border: 1px solid var(--button-border);
  border-radius: var(--radius-input);
  background: var(--button-bg);
}

.timeline-track-label:hover {
  border-color: var(--line-strong);
  background: var(--button-hover);
}

.timeline-track-label-button {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  text-align: left;
  cursor: grab;
}

.timeline-track-label-button:hover {
  border-color: transparent;
  background: transparent;
}

.timeline-track-label-button:focus-visible {
  outline: none;
  border-radius: calc(var(--radius-input) - 1px);
  box-shadow: inset 0 0 0 2px rgba(217, 163, 74, 0.18);
}

.timeline-track-label.dragging .timeline-track-label-button {
  cursor: grabbing;
}

.timeline-track-visibility {
  width: 1.5rem;
  height: 1.5rem;
  flex: 0 0 auto;
  color: var(--muted);
}

.timeline-track-visibility svg {
  width: 0.8rem;
  height: 0.8rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.timeline-track-label-text {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.7rem;
  line-height: 1.05;
}

.timeline-track-lane {
  position: relative;
  height: var(--timeline-row-height);
  border-radius: var(--radius-item);
  background:
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.05) 0,
      rgba(255, 255, 255, 0.05) 1px,
      transparent 1px,
      transparent var(--timeline-frame-width)
    );
  background-size: var(--timeline-frame-width) 100%;
  border: 1px solid var(--line);
}

:root[data-theme="light"] .timeline-track-lane {
  background:
    linear-gradient(
      90deg,
      rgba(32, 37, 44, 0.05) 0,
      rgba(32, 37, 44, 0.05) 1px,
      transparent 1px,
      transparent var(--timeline-frame-width)
    );
  background-size: var(--timeline-frame-width) 100%;
}

.timeline-audio-label {
  opacity: 0.95;
}

.timeline-audio-lane {
  overflow: hidden;
  background:
    linear-gradient(
      90deg,
      rgba(217, 163, 74, 0.07) 0,
      rgba(217, 163, 74, 0.07) 1px,
      transparent 1px,
      transparent var(--timeline-frame-width)
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
  background-size: var(--timeline-frame-width) 100%, auto;
}

:root[data-theme="light"] .timeline-audio-lane {
  background:
    linear-gradient(
      90deg,
      rgba(184, 128, 32, 0.08) 0,
      rgba(184, 128, 32, 0.08) 1px,
      transparent 1px,
      transparent var(--timeline-frame-width)
    ),
    linear-gradient(180deg, rgba(32, 37, 44, 0.025), rgba(32, 37, 44, 0.015));
  background-size: var(--timeline-frame-width) 100%, auto;
}

.timeline-waveform {
  position: absolute;
  inset: 0;
}

.timeline-waveform-bar {
  position: absolute;
  bottom: 50%;
  transform: translateY(50%);
  border-radius: 999px;
  background: rgba(217, 163, 74, 0.42);
  opacity: 0.9;
}

:root[data-theme="light"] .timeline-waveform-bar {
  background: rgba(184, 128, 32, 0.38);
}

.timeline-cursor {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: var(--accent-strong);
  z-index: 2;
}

.timeline-event {
  position: absolute;
  top: calc((var(--timeline-row-height) - var(--timeline-event-height)) / 2);
  height: var(--timeline-event-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.18rem;
  border-radius: var(--radius-item);
  padding: 0.08rem 0.18rem 0.08rem 0.32rem;
  text-transform: capitalize;
  z-index: 3;
  font-size: 0.68rem;
  line-height: 1.05;
}

.timeline-event span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-event.type-set {
  background: rgba(217, 163, 74, 0.24);
}

.timeline-event.type-fade {
  background: rgba(97, 179, 168, 0.22);
}

.timeline-event.type-blink {
  background: rgba(212, 196, 98, 0.24);
}

.timeline-event.type-pulse {
  background: rgba(102, 176, 124, 0.22);
}

.timeline-event.type-wave {
  background: rgba(125, 151, 188, 0.24);
}

.timeline-event.type-delay {
  background: rgba(128, 128, 128, 0.2);
}

.timeline-event.active {
  border-color: rgba(217, 163, 74, 0.48);
}

.resize-handle {
  width: 7px;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  flex: 0 0 auto;
}

:root[data-theme="light"] .resize-handle {
  background: rgba(32, 37, 44, 0.18);
}

.timeline-add-event {
  position: absolute;
  top: calc((var(--timeline-row-height) - 22px) / 2);
  height: 22px;
  padding: 0.12rem 0.48rem;
  font-size: 0.72rem;
}

.status-bar {
  align-items: center;
  overflow: hidden;
}

.color-field {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 0.45rem;
  align-items: center;
}

.color-picker {
  width: 42px;
  height: 38px;
  padding: 0.2rem;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-input);
  background: var(--input-bg);
}

.pie-menu-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  border-radius: inherit;
}

.pie-menu {
  position: absolute;
  width: 248px;
  height: 248px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.pie-menu-core,
.pie-menu-action {
  position: absolute;
  pointer-events: auto;
  transform: translate(-50%, -50%);
}

.pie-menu-core {
  top: 50%;
  left: 50%;
  width: 80px;
  height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.18rem;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  padding: 0;
  background: var(--surface-strong);
}

.pie-menu-core strong,
.pie-menu-core span {
  display: block;
}

.pie-menu-core strong {
  font-size: 0.76rem;
}

.pie-menu-core span {
  font-size: 0.68rem;
  color: var(--muted);
}

.pie-menu-action {
  min-width: 88px;
  padding: 0.34rem 0.58rem;
  border-radius: 999px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.help-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.48);
  z-index: 30;
}

.help-dialog {
  width: min(960px, 100%);
  max-height: 80vh;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--panel-soft);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.compact-dialog {
  width: min(560px, 100%);
}

.help-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
}

.help-markdown {
  padding: 1rem 1.1rem 1.2rem;
  overflow: auto;
  font-size: 0.88rem;
  color: var(--text);
}

.help-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  line-height: 1.7;
}

.help-content h1,
.help-content h2,
.help-content p,
.help-content ul,
.help-content ol {
  margin: 0;
}

.help-content h1 {
  font-size: 1.12rem;
  color: var(--accent-strong);
}

.help-content h2 {
  font-size: 0.92rem;
  color: var(--accent);
  margin-top: 0.3rem;
}

.help-content ul,
.help-content ol {
  padding-left: 1.25rem;
}

.preferences-body {
  gap: 0.85rem;
}

.preferences-body small {
  margin-top: 0.1rem;
}

.preferences-checkbox {
  padding-top: 0.15rem;
}

.help-code {
  margin: 0;
  padding: 0.72rem 0.85rem;
  overflow: auto;
  border-radius: var(--radius-input);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  font-family: "Cascadia Code", "Consolas", monospace;
}

.constraint-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0.68rem;
  border: 1px solid rgba(217, 163, 74, 0.18);
  border-radius: var(--radius-item);
  background: rgba(217, 163, 74, 0.08);
}

.constraint-item strong {
  font-size: 0.72rem;
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.constraint-item small {
  color: var(--text);
}

@media (max-width: 1360px) {
  .dock-select {
    min-width: 5rem;
  }
}

@media (max-width: 960px) {
  .app-grid {
    flex-direction: column;
  }

  .workspace {
    min-height: 360px;
  }

  .status-bar {
    align-items: stretch;
  }

  .dock-slot {
    width: auto !important;
    height: auto !important;
  }

  .dock-divider.vertical {
    display: none;
  }

  .canvas-hint,
  .preview-toolbar,
  .timeline-toolbar {
    grid-template-columns: 1fr;
  }

  .field-grid.two-column {
    grid-template-columns: 1fr;
  }

  .canvas-zoom-control,
  .preview-zoom-control,
  .timeline-playback,
  .timeline-toolbar-actions,
  .panel-toolbar-spacer {
    justify-self: stretch;
  }

  .timeline-toolbar-actions {
    justify-content: flex-start;
  }

  .timeline-library-item {
    grid-template-columns: minmax(0, 1fr) 4.9rem auto;
    grid-auto-rows: auto;
  }

  .timeline-library-loop {
    justify-self: start;
  }

  .pattern-library-section .timeline-library-item {
    grid-template-columns: minmax(0, 1fr) 2.2rem 1.4rem 2.3rem 2.3rem;
  }

  .pattern-library-section .timeline-library-loop {
    justify-self: center;
  }
}












