:root {
  color-scheme: light;
  font-family: "Avenir Next", "Helvetica Neue", sans-serif;
  --paper: #f6f0e3;
  --paper-2: #efe5d5;
  --ink: #2b241d;
  --muted: #7a6d5c;
  --line: rgba(43, 36, 29, 0.14);
  --line-strong: rgba(43, 36, 29, 0.22);
  --warm: #d88c5f;
  --warm-soft: rgba(216, 140, 95, 0.14);
  --cool: #7da3b8;
  --mint: #99b7a4;
  --shadow: 0 22px 40px rgba(72, 56, 32, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.54), transparent 24%),
    linear-gradient(180deg, #f8f3ea 0%, #eee3d1 100%);
}

body.theme-night {
  color-scheme: dark;
  --paper: #121827;
  --paper-2: #1a2233;
  --ink: #ebf2ff;
  --muted: #8fa0c7;
  --line: rgba(173, 195, 255, 0.16);
  --line-strong: rgba(173, 195, 255, 0.24);
  --warm-soft: rgba(132, 170, 255, 0.14);
  --shadow: 0 24px 42px rgba(3, 7, 18, 0.42);
  background:
    radial-gradient(circle at top left, rgba(91, 126, 255, 0.2), transparent 26%),
    radial-gradient(circle at top right, rgba(70, 209, 255, 0.12), transparent 20%),
    linear-gradient(180deg, #0f1420 0%, #171d2a 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(43, 36, 29, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(43, 36, 29, 0.018) 1px, transparent 1px);
  background-size: 36px 36px;
}

body.theme-night::before {
  background-image:
    linear-gradient(rgba(173, 195, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(173, 195, 255, 0.05) 1px, transparent 1px);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1440px, calc(100vw - 28px));
  margin: 18px auto 24px;
  display: grid;
  gap: 16px;
}

.topbar,
.selector-rail,
.board-shell {
  border: 2px solid var(--line-strong);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 252, 245, 0.92), rgba(245, 236, 223, 0.9));
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
  padding: 10px 14px;
}

.sample-actions {
  flex: 0 1 368px;
  min-width: 252px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-lockup {
  --brand-title: #7d8fb5;
  --brand-title-shadow: rgba(125, 143, 181, 0.16);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: filter 180ms ease, color 180ms ease;
}

.brand-lockup.is-live {
  filter: saturate(1.04);
}

.brand-copy {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--brand-title);
  text-shadow: 0 2px 10px var(--brand-title-shadow);
  transition: color 180ms ease, text-shadow 180ms ease;
}

.brand-link {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: lowercase;
  text-decoration: none;
}

.brand-link:hover {
  color: var(--ink);
}

.sample-pill {
  flex: 1 1 260px;
  min-width: 0;
}

.sample-pill select,
.export-pill select {
  width: 100%;
  min-height: 40px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
}

.toolbar-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.toolbar-btn {
  min-height: 40px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
}

.toolbar-btn.is-active {
  background: rgba(125, 163, 184, 0.16);
  border-color: rgba(125, 163, 184, 0.44);
}

body.theme-night .toolbar-btn.is-active,
body.theme-night .mode-tab.is-active,
body.theme-night .picker-chip.is-active,
body.theme-night .plus-circle:focus-visible,
body.theme-night .sample-pill select:focus,
body.theme-night .export-pill select:focus,
body.theme-night .sound-select:focus {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 14px rgba(98, 157, 255, 0.22),
    0 0 28px rgba(98, 157, 255, 0.1);
}

body.theme-night .toolbar-btn.is-active,
body.theme-night .mode-tab.is-active,
body.theme-night .picker-chip.is-active {
  border-color: rgba(112, 168, 255, 0.54);
}

.toolbar-btn-meta {
  min-width: 46px;
  padding: 0;
  font-weight: 700;
}

.toolbar-btn-primary {
  background: linear-gradient(180deg, #f4be6c, var(--warm));
  border-color: rgba(181, 110, 69, 0.42);
  font-weight: 700;
}

body.theme-night .topbar,
body.theme-night .selector-rail,
body.theme-night .board-shell {
  background: linear-gradient(180deg, rgba(20, 26, 40, 0.96), rgba(14, 18, 29, 0.94));
  box-shadow: var(--shadow);
}

body.theme-night .selector-card,
body.theme-night .section-lane,
body.theme-night .metadata-modal,
body.theme-night .toast {
  background: linear-gradient(180deg, rgba(21, 29, 44, 0.94), rgba(15, 20, 32, 0.92));
}

body.theme-night .sample-pill select,
body.theme-night .export-pill select,
body.theme-night .toolbar-btn,
body.theme-night .mode-tab,
body.theme-night .picker-chip,
body.theme-night .field-stack input,
body.theme-night .field-stack textarea,
body.theme-night .modal-close,
body.theme-night .plus-circle {
  background: rgba(20, 27, 41, 0.9);
  color: var(--ink);
}

body.theme-night .sample-pill select,
body.theme-night .export-pill select {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 0 0 rgba(96, 158, 255, 0);
  transition: box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

body.theme-night .toolbar-btn-primary {
  background: linear-gradient(180deg, #6eb8ff, #4b7dff);
  border-color: rgba(99, 146, 255, 0.46);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 16px rgba(88, 138, 255, 0.24);
}

body.theme-night .brand-link,
body.theme-night .shape-empty,
body.theme-night .field-stack,
body.theme-night .modal-kicker {
  color: var(--muted);
}

body.theme-night .brand-link:hover {
  color: var(--ink);
}

.toolbar-btn:hover,
.mode-tab:hover,
.picker-chip:hover,
.sound-block:hover,
.plus-circle:hover,
.block-delete:hover {
  transform: translateY(-1px);
}

.workspace-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.selector-rail {
  padding: 14px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.selector-card {
  position: relative;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.44);
}

.selector-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.selector-card-head h2 {
  margin: 0;
  font-size: 0.98rem;
}

.selector-card-action {
  min-height: 26px;
  padding: 0 10px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.selector-card-action:disabled {
  opacity: 0.58;
  cursor: default;
}

.mode-tabs {
  display: inline-flex;
  gap: 6px;
}

.mode-tab {
  min-width: 38px;
  min-height: 28px;
  padding: 0 10px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--ink);
}

.mode-tab.is-active {
  background: var(--warm-soft);
  border-color: rgba(216, 140, 95, 0.46);
}

body.theme-night .mode-tab.is-active {
  background: linear-gradient(180deg, rgba(35, 52, 82, 0.96), rgba(24, 35, 58, 0.96));
}

body.theme-night .selector-card-action {
  background: rgba(20, 27, 41, 0.9);
  color: var(--muted);
}

.picker-list {
  display: grid;
  gap: 7px;
}

.root-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.quality-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-height: 214px;
  overflow-y: auto;
  padding-right: 4px;
  align-content: start;
}

.quality-list .picker-chip {
  min-width: 0;
  min-height: 28px;
  padding: 4px 6px;
  font-size: 0.68rem;
  line-height: 1.08;
  text-align: center;
}

.measure-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.measure-control-inline {
  grid-column: 2 / span 2;
  min-height: 32px;
  justify-self: stretch;
  align-self: stretch;
  padding: 0 0 0 4px;
}

.measure-control.is-disabled {
  opacity: 0.58;
}

.measure-select-wrap {
  position: relative;
  min-width: 0;
  flex: 1 1 auto;
}

.measure-select {
  width: 100%;
  min-height: 32px;
  padding: 0 28px 0 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  appearance: none;
}

.measure-select-wrap::after {
  content: "▾";
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.76rem;
  pointer-events: none;
}

.measure-suffix {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.picker-chip {
  min-height: 32px;
  padding: 6px 8px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  text-align: left;
  font-size: 0.8rem;
}

.picker-chip.is-active {
  background: var(--warm-soft);
  border-color: rgba(216, 140, 95, 0.48);
}

body.theme-night .picker-chip.is-active {
  background: linear-gradient(180deg, rgba(33, 48, 76, 0.96), rgba(24, 34, 56, 0.96));
}

body.theme-night .measure-select {
  background: rgba(20, 27, 41, 0.9);
  color: var(--ink);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 0 0 rgba(96, 158, 255, 0);
}

body.theme-night .measure-select:focus {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 14px rgba(98, 157, 255, 0.22),
    0 0 28px rgba(98, 157, 255, 0.1);
}

.sound-controls {
  display: grid;
  gap: 10px;
}

.sound-field,
.sound-group {
  display: grid;
  gap: 6px;
}

.sound-field-label {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sound-select {
  width: 100%;
  min-height: 34px;
  padding: 0 30px 0 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  appearance: none;
}

.sound-field {
  position: relative;
}

.sound-field::after {
  content: "▾";
  position: absolute;
  right: 12px;
  bottom: 10px;
  color: var(--muted);
  font-size: 0.76rem;
  pointer-events: none;
}

.sound-chip-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.sound-chip {
  min-height: 30px;
  padding: 5px 7px;
  font-size: 0.72rem;
  text-align: center;
}

.sound-chip:disabled,
.sound-select:disabled {
  opacity: 0.58;
  cursor: default;
}

.board-shell {
  min-height: 520px;
  padding: 16px;
  overflow: hidden;
}

.board-canvas {
  display: grid;
  gap: 16px;
}

.timeline-title {
  margin: 0;
  padding: 0 6px;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.section-lane {
  position: relative;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.42);
}

.section-strip {
  display: flex;
  align-items: stretch;
  align-content: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  overflow: visible;
  padding-bottom: 2px;
}

.sound-block {
  position: relative;
  flex: 0 1 190px;
  width: 190px;
  max-width: 100%;
  min-height: 112px;
  overflow: hidden;
  padding: 14px 44px 14px 16px;
  display: grid;
  gap: 10px;
  align-content: space-between;
  border: 2px solid var(--block-edge, var(--line));
  border-radius: 22px;
  background:
    linear-gradient(180deg, var(--block-gloss, rgba(255, 255, 255, 0.34)), transparent 32%),
    linear-gradient(155deg, var(--block-top, rgba(255, 255, 255, 0.92)) 0%, var(--block-surface, rgba(255, 255, 255, 0.78)) 54%, var(--block-bottom, rgba(216, 140, 95, 0.22)) 100%);
  cursor: grab;
  box-shadow:
    inset 0 1px 0 var(--block-gloss-strong, rgba(255, 255, 255, 0.62)),
    inset 0 -10px 14px rgba(36, 28, 21, 0.08),
    0 4px 0 var(--block-shadow, rgba(72, 56, 32, 0.12)),
    0 16px 24px rgba(72, 56, 32, 0.12);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

body.theme-night .sound-block {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 30%),
    linear-gradient(155deg, var(--block-top, rgba(255, 255, 255, 0.92)) 0%, var(--block-surface, rgba(255, 255, 255, 0.78)) 54%, var(--block-bottom, rgba(216, 140, 95, 0.22)) 100%),
    linear-gradient(180deg, rgba(13, 18, 27, 0.2), rgba(8, 10, 17, 0.18));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -12px 16px rgba(7, 10, 18, 0.22),
    0 4px 0 rgba(5, 7, 14, 0.32),
    0 0 18px var(--block-ring, rgba(125, 163, 184, 0.12)),
    0 16px 28px rgba(3, 7, 18, 0.28);
}

.sound-block:active {
  cursor: grabbing;
}

.sound-block.is-selected {
  border-color: var(--block-edge-strong, rgba(125, 163, 184, 0.62));
  box-shadow:
    inset 0 1px 0 var(--block-gloss-strong, rgba(255, 255, 255, 0.62)),
    inset 0 0 0 2px var(--block-ring, rgba(125, 163, 184, 0.12)),
    inset 0 -10px 14px rgba(36, 28, 21, 0.08),
    0 4px 0 var(--block-shadow, rgba(72, 56, 32, 0.12)),
    0 16px 24px rgba(72, 56, 32, 0.12);
}

body.theme-night .sound-block.is-selected {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 0 0 2px var(--block-ring, rgba(125, 163, 184, 0.18)),
    inset 0 -12px 16px rgba(7, 10, 18, 0.22),
    0 4px 0 rgba(5, 7, 14, 0.32),
    0 0 16px var(--block-ring, rgba(125, 163, 184, 0.18)),
    0 16px 28px rgba(3, 7, 18, 0.28);
}

.sound-block.is-playing {
  border-color: var(--block-edge-strong, rgba(216, 140, 95, 0.64));
  background:
    radial-gradient(circle at 24% 18%, var(--block-gloss-strong, rgba(255, 255, 255, 0.72)), transparent 30%),
    linear-gradient(155deg, var(--block-top, rgba(255, 255, 255, 0.92)) 0%, var(--block-surface, rgba(255, 255, 255, 0.78)) 48%, var(--block-bottom, rgba(216, 140, 95, 0.22)) 100%);
  box-shadow:
    inset 0 0 0 1px var(--block-edge-strong, rgba(216, 140, 95, 0.64)),
    inset 0 1px 0 var(--block-gloss-strong, rgba(255, 255, 255, 0.62)),
    inset 0 -12px 16px rgba(36, 28, 21, 0.1),
    0 4px 0 var(--block-shadow, rgba(72, 56, 32, 0.14)),
    0 18px 28px rgba(72, 56, 32, 0.16);
}

body.theme-night .sound-block.is-playing {
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.14), transparent 28%),
    linear-gradient(155deg, var(--block-top, rgba(255, 255, 255, 0.92)) 0%, var(--block-surface, rgba(255, 255, 255, 0.78)) 50%, var(--block-bottom, rgba(216, 140, 95, 0.22)) 100%),
    linear-gradient(180deg, rgba(14, 19, 30, 0.08), rgba(10, 14, 22, 0.18));
  box-shadow:
    inset 0 0 0 1px var(--block-edge-strong, rgba(216, 140, 95, 0.56)),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -12px 16px rgba(7, 10, 18, 0.22),
    0 4px 0 rgba(5, 7, 14, 0.34),
    0 0 24px var(--block-edge-strong, rgba(216, 140, 95, 0.36)),
    0 0 42px var(--block-ring, rgba(125, 163, 184, 0.18)),
    0 18px 30px rgba(3, 7, 18, 0.32);
}

.sound-block.is-selected.is-playing {
  box-shadow:
    inset 0 0 0 1px var(--block-edge-strong, rgba(216, 140, 95, 0.64)),
    inset 0 1px 0 var(--block-gloss-strong, rgba(255, 255, 255, 0.62)),
    inset 0 0 0 3px var(--block-ring, rgba(125, 163, 184, 0.12)),
    inset 0 -12px 16px rgba(36, 28, 21, 0.1),
    0 4px 0 var(--block-shadow, rgba(72, 56, 32, 0.14)),
    0 18px 28px rgba(72, 56, 32, 0.16);
}

body.theme-night .sound-block.is-selected.is-playing {
  box-shadow:
    inset 0 0 0 1px var(--block-edge-strong, rgba(216, 140, 95, 0.56)),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 0 0 3px var(--block-ring, rgba(125, 163, 184, 0.18)),
    inset 0 -12px 16px rgba(7, 10, 18, 0.22),
    0 4px 0 rgba(5, 7, 14, 0.34),
    0 0 24px var(--block-edge-strong, rgba(216, 140, 95, 0.4)),
    0 0 48px var(--block-ring, rgba(125, 163, 184, 0.2)),
    0 18px 30px rgba(3, 7, 18, 0.32);
}

.sound-block-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.block-grabber {
  position: absolute;
  left: 14px;
  bottom: 12px;
  width: 16px;
  height: 22px;
  opacity: 0.55;
  background-image:
    radial-gradient(circle, rgba(43, 36, 29, 0.46) 1.6px, transparent 1.7px),
    radial-gradient(circle, rgba(43, 36, 29, 0.46) 1.6px, transparent 1.7px);
  background-size: 8px 8px;
  background-position: 0 0, 8px 4px;
  pointer-events: none;
}

body.theme-night .block-grabber {
  background-image:
    radial-gradient(circle, rgba(235, 242, 255, 0.44) 1.6px, transparent 1.7px),
    radial-gradient(circle, rgba(235, 242, 255, 0.44) 1.6px, transparent 1.7px);
}

.sound-block-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.08;
}

.block-measure {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--block-measure, rgba(43, 36, 29, 0.06));
  font-size: 0.74rem;
  font-weight: 700;
}

.block-lines {
  display: flex;
  align-items: end;
  gap: 6px;
  min-height: 36px;
  padding-left: 22px;
  padding-right: 30px;
}

.line-pill {
  display: inline-block;
  min-width: 15px;
  border-radius: 999px 999px 8px 8px;
  background: linear-gradient(180deg, var(--block-line-top, var(--cool)), var(--block-line-bottom, var(--mint)));
}

.shape-empty {
  color: var(--muted);
  font-size: 0.8rem;
}

.block-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: rgba(43, 36, 29, 0.06);
  color: rgba(43, 36, 29, 0.54);
}

body.theme-night .block-delete {
  background: rgba(235, 242, 255, 0.08);
  color: rgba(235, 242, 255, 0.76);
}

body.theme-night .sound-select {
  background: rgba(20, 27, 41, 0.9);
  color: var(--ink);
}

.block-cube {
  position: absolute;
  right: 12px;
  bottom: 10px;
  width: 22px;
  height: 22px;
  opacity: 0.94;
  filter: drop-shadow(0 4px 6px rgba(43, 36, 29, 0.18));
  pointer-events: none;
}

.block-cube .cube-top {
  fill: var(--block-cube-top, rgba(255, 255, 255, 0.9));
}

.block-cube .cube-left {
  fill: var(--block-cube-left, rgba(255, 255, 255, 0.7));
}

.block-cube .cube-right {
  fill: var(--block-cube-right, rgba(255, 255, 255, 0.56));
}

body.theme-night .block-cube {
  filter:
    drop-shadow(0 0 8px var(--block-ring, rgba(125, 163, 184, 0.2)))
    drop-shadow(0 4px 8px rgba(3, 7, 18, 0.3));
}

.plus-circle {
  flex: 0 0 72px;
  align-self: center;
  width: 72px;
  height: 72px;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--ink);
  font-size: 2rem;
  line-height: 1;
}

.drop-indicator {
  position: absolute;
  width: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #5e9dff, #2f6de8);
  box-shadow:
    0 0 0 3px rgba(84, 140, 255, 0.22),
    0 8px 14px rgba(47, 109, 232, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) scaleY(0.7);
  transition: opacity 120ms ease, transform 120ms ease;
}

.drop-indicator.is-visible {
  opacity: 1;
  transform: translateX(-50%) scaleY(1);
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
}

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

.metadata-modal {
  position: relative;
  border: 2px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(255, 252, 245, 0.98), rgba(245, 236, 223, 0.96));
  box-shadow: 0 26px 42px rgba(72, 56, 32, 0.18);
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(43, 36, 29, 0.28);
  backdrop-filter: blur(3px);
}

body.theme-night .modal-backdrop {
  background: rgba(5, 9, 16, 0.58);
}

.metadata-modal {
  width: min(480px, calc(100vw - 28px));
  padding: 18px;
  display: grid;
  gap: 14px;
  border-radius: 26px;
}

.metadata-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.modal-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.metadata-head h2 {
  margin: 0;
  font-size: 1.24rem;
}

.modal-close {
  width: 34px;
  height: 34px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
}

.field-stack {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

.field-stack input,
.field-stack textarea {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.field-stack textarea {
  resize: vertical;
  min-height: 112px;
}

.metadata-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 12px 16px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 251, 244, 0.95);
  box-shadow: 0 18px 30px rgba(72, 56, 32, 0.1);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

body.theme-night .toast {
  box-shadow: 0 20px 30px rgba(3, 7, 18, 0.4);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .workspace-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100vw - 14px, 100%);
    margin: 8px auto 18px;
    gap: 12px;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .sample-actions {
    width: 100%;
    flex: 1 1 100%;
  }

  .toolbar-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-left: 0;
  }
}
