:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #f0f4f1;
  --text: #18211f;
  --muted: #66706a;
  --line: #d8ded8;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #d9f1ed;
  --warn-soft: #f4ead7;
  --warn-text: #7c4a03;
  --danger: #b91c1c;
  --success: #166534;
  --focus: #2563eb;
  --red: #d93025;
  --shadow: 0 16px 40px rgba(29, 42, 37, 0.08);
  font-family: "Segoe UI", "Yu Gothic UI", "Meiryo", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), transparent 300px),
    var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
  outline: none;
}

input:focus,
select:focus,
button:focus-visible {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
  outline: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px clamp(18px, 4vw, 42px) 18px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.video-brand {
  min-width: 0;
}

.site-switcher {
  position: relative;
  flex: 0 0 auto;
}

.site-menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: auto;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #27323c;
  padding: 0 12px 0 10px;
  font-size: 12px;
  font-weight: 900;
}

.site-menu-button:hover {
  background: var(--surface-soft);
}

.switcher-grid {
  display: grid;
  grid-template-columns: repeat(2, 5px);
  gap: 3px;
}

.switcher-grid i {
  width: 5px;
  height: 5px;
  border-radius: 2px;
  background: var(--red);
}

.switcher-copy {
  line-height: 1;
  white-space: nowrap;
}

.site-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  display: grid;
  gap: 4px;
  width: min(330px, calc(100vw - 28px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(23, 32, 42, 0.18);
  padding: 8px;
}

.site-menu-panel[hidden] {
  display: none;
}

.site-menu-head {
  display: grid;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
  padding: 4px 8px 10px;
}

.site-menu-head span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.site-menu-head strong {
  font-size: 14px;
  line-height: 1.35;
}

.site-menu-panel a {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border-radius: 7px;
  color: var(--text);
  padding: 10px;
  text-decoration: none;
}

.site-menu-panel a:hover,
.site-menu-panel a[aria-current="page"] {
  background: var(--surface-soft);
}

.site-menu-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 34px;
  border-radius: 8px;
  background: #eef2f6;
  color: #34404b;
  font-size: 10px;
  font-weight: 900;
}

.site-menu-mark.main {
  background: #f2f4f7;
}

.site-menu-mark.upload {
  background: #fff1f3;
  color: #b42318;
}

.site-menu-mark.article {
  background: #e7f5f1;
  color: var(--accent-strong);
}

.site-menu-mark.scale {
  background: #e9f0ff;
  color: #1d4ed8;
}

.site-menu-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.site-menu-copy strong {
  font-size: 13px;
  line-height: 1.35;
}

.site-menu-copy em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.12;
}

h2 {
  font-size: 18px;
  line-height: 1.3;
}

.server-pill,
.quiet-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.server-pill {
  max-width: 52vw;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
}

.quiet-badge {
  background: var(--warn-soft);
  color: var(--warn-text);
}

.status-badge {
  background: var(--surface-soft);
  color: var(--muted);
}

.status-badge.running {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-badge.paused {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.stopping,
.status-badge.cancelled {
  background: #fee2e2;
  color: var(--danger);
}

.status-badge.completed {
  background: #dcfce7;
  color: var(--success);
}

.status-badge.failed {
  background: #fee2e2;
  color: var(--danger);
}

.layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.78fr) minmax(560px, 1.34fr) minmax(340px, 0.88fr);
  gap: 18px;
  padding: 0 clamp(18px, 4vw, 42px) 42px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  padding: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.count-text,
.mini-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.catalog-entry-row,
.catalog-header,
.catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.catalog-entry-row .catalog-open {
  min-height: 30px;
  padding: 4px 12px;
  font-size: 12px;
}

.catalog-dialog {
  width: min(760px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  padding: 20px;
  border: 1px solid var(--line, #d5ddda);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  overflow: auto;
}

.catalog-dialog[open] {
  display: flex;
  flex-direction: column;
}

.catalog-header,
.catalog-toolbar,
.catalog-status {
  flex-shrink: 0;
}

.catalog-dialog::backdrop {
  background: rgb(16 32 30 / 38%);
}

body:has(#backgroundCatalog[open]) {
  overflow: hidden;
}

.catalog-dialog .catalog-close {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.catalog-toolbar {
  margin: 12px 0;
}

.catalog-toolbar .primary-button {
  width: auto;
  min-width: 76px;
  margin: 0;
  padding: 8px 14px;
  white-space: nowrap;
}

.catalog-updated,
.catalog-status {
  margin: 0;
  font-size: 12px;
  color: #526965;
  overflow-wrap: anywhere;
}

.catalog-status:not(:empty) {
  margin-bottom: 12px;
}

.catalog-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.catalog-group h3 {
  margin: 0;
  padding: 8px 10px;
  border-bottom: 2px solid #10756f;
  background: #eff7f6;
  font-size: 14px;
}

.catalog-group:nth-child(2) h3 {
  border-color: #bd8b34;
  background: #fcf7ee;
}

.catalog-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.catalog-group li {
  padding: 9px 10px;
  border-bottom: 1px solid #e5ece9;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  user-select: text;
}

.catalog-empty {
  color: #657572;
}

@media (max-width: 600px) {
  .catalog-dialog { padding: 14px; }
  .catalog-groups { grid-template-columns: minmax(0, 1fr); }
}

.field-group {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.settings-panel > .section-heading {
  margin-bottom: 10px;
}

.settings-panel > .field-group {
  row-gap: 6px;
  margin-bottom: 12px;
}

.settings-panel .background-slot {
  row-gap: 6px;
  padding-block: 8px;
}

.settings-panel .background-controls {
  row-gap: 6px;
}

.settings-panel .background-control {
  row-gap: 4px;
}

.settings-panel .tail-loop-block {
  padding-top: 6px;
}

label,
.label-text {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.ghost-button,
.primary-button,
.secondary-button,
.small-button,
.tiny-button,
.slot-search button,
.mini-result button {
  min-height: 38px;
  border-radius: 8px;
  font-weight: 700;
}

.primary-button,
.slot-search button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover,
.slot-search button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  border: 1px solid #f1c36d;
  background: #fff7ed;
  color: #9a3412;
}

.secondary-button:hover {
  background: #ffedd5;
}

.ghost-button,
.small-button,
.tiny-button,
.mini-result button {
  border: 1px solid var(--line);
  background: #f4f0e8;
  color: #5b4630;
  padding: 0 10px;
}

.primary-button {
  width: 100%;
  font-size: 15px;
}

.secondary-button {
  width: 100%;
  font-size: 14px;
}

.bulk-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.bulk-format-grid,
.format-inline-grid,
.scale-compact-grid,
.placement-compact-grid,
.source-target-grid,
.editor-grid,
.project-grid {
  display: grid;
  gap: 6px;
}

.bulk-format-grid,
.format-inline-grid {
  grid-template-columns: repeat(3, minmax(70px, 1fr));
}

.scale-compact-grid {
  grid-template-columns: repeat(9, minmax(42px, 1fr));
}

.placement-compact-grid {
  grid-template-columns: repeat(5, minmax(44px, 1fr));
}

.source-target-grid {
  grid-template-columns: repeat(10, minmax(30px, 1fr));
}

.scale-compact-grid,
.source-target-grid {
  gap: 5px;
}

.scale-compact-grid .chip-option,
.source-target-grid .chip-option {
  min-height: 30px;
  gap: 4px;
  padding: 0 4px;
  font-size: 11px;
}

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

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

.main-action-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.status-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.action-heading {
  color: var(--text);
  font-size: 18px;
  line-height: 1.3;
  font-weight: 800;
  margin-bottom: 14px;
}

.status-action-grid .primary-button,
.status-action-grid .secondary-button {
  min-height: 42px;
}

.chip-option,
.project-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  padding: 0 8px;
}

.project-option {
  justify-content: flex-start;
  min-height: 40px;
  font-size: 13px;
}

.chip-option input,
.project-option input,
.switch-label input {
  width: auto;
  min-height: auto;
  accent-color: var(--accent);
}

.chip-option.disabled {
  background: var(--surface-soft);
  color: var(--muted);
}

.source-slot-list,
.background-slot-list {
  display: grid;
  gap: 10px;
}

.source-slot {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.extra-sources-toggle {
  display: none;
}

.extra-source-slots {
  display: contents;
}

@media (max-width: 760px) {
  .extra-sources-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    text-align: left;
  }

  .extra-sources-count {
    margin-left: auto;
    color: var(--muted);
    font-size: 11px;
    font-weight: 400;
    white-space: nowrap;
  }

  .extra-sources-toggle::after {
    content: "";
    flex: 0 0 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
  }

  .extra-sources-toggle[aria-expanded="true"]::after {
    transform: translateY(2px) rotate(225deg);
  }

  .extra-source-slots {
    display: grid;
    gap: 10px;
    min-width: 0;
  }

  .extra-source-slots.is-collapsed {
    display: none;
  }
}

.slot-top {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.slot-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.slot-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px;
  gap: 6px;
}

.cr-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.cr-name {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.cr-name strong,
.background-head span:not(.background-index) {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cr-name strong {
  font-size: 13px;
}

.full-name-trigger {
  cursor: help;
  outline-offset: 2px;
}

.full-name-trigger:focus-visible {
  outline: 2px solid var(--accent);
}

.full-name-preview {
  position: fixed;
  z-index: 1000;
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: #111916;
  color: #fff;
  box-shadow: 0 10px 28px rgba(10, 25, 20, 0.24);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
  overflow-wrap: anywhere;
  pointer-events: none;
}

.full-name-preview[hidden] {
  display: none;
}

.auto-format-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  padding: 0 8px;
  white-space: nowrap;
}

.slot-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(250px, 0.86fr);
  gap: 10px;
}

.slot-control {
  display: grid;
  gap: 5px;
}

.inline-result-list {
  display: grid;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-gutter: stable;
  color: var(--muted);
  font-size: 12px;
}

.inline-result-list:empty {
  display: none;
}

.mini-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 8px;
}

.mini-result strong,
.mini-result span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-result span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.background-slot {
  display: grid;
  gap: 10px;
  border: 1px solid var(--slot-border, var(--line));
  border-left: 6px solid var(--slot-accent, var(--accent));
  border-radius: 8px;
  background:
    linear-gradient(90deg, var(--slot-soft, #fff) 0, #fff 126px),
    #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  padding: 10px 10px 10px 12px;
}

.slot-tone-1 {
  --slot-accent: #0f766e;
  --slot-strong: #115e59;
  --slot-soft: #eef8f6;
  --slot-border: #b9d9d4;
}

.slot-tone-2 {
  --slot-accent: #b45309;
  --slot-strong: #92400e;
  --slot-soft: #fff7ed;
  --slot-border: #ecd2ae;
}

.slot-tone-3 {
  --slot-accent: #2563eb;
  --slot-strong: #1d4ed8;
  --slot-soft: #eff6ff;
  --slot-border: #bfd2f6;
}

.slot-tone-4 {
  --slot-accent: #be185d;
  --slot-strong: #9d174d;
  --slot-soft: #fdf2f8;
  --slot-border: #ecc0d5;
}

.slot-tone-5 {
  --slot-accent: #4d7c0f;
  --slot-strong: #3f6212;
  --slot-soft: #f4f9e9;
  --slot-border: #cbdca6;
}

.intro-grid {
  display: grid;
  gap: 10px;
}

.intro-search-box {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.intro-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.intro-head strong {
  color: var(--accent-strong);
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.background-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 0.8fr) auto;
  gap: 8px;
  align-items: center;
}

.background-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 8px;
  background: var(--slot-soft, var(--accent-soft));
  color: var(--slot-strong, var(--accent-strong));
  border: 1px solid var(--slot-border, transparent);
  font-size: 11px;
  font-weight: 800;
  padding: 0 8px;
  white-space: nowrap;
}

.background-head strong {
  color: var(--slot-strong, var(--accent-strong));
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.background-head span:not(.background-index) {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.background-controls {
  display: grid;
  gap: 8px;
}

.background-control {
  display: grid;
  gap: 5px;
}

.tail-loop-block {
  padding-top: 8px;
  border-top: 1px solid var(--slot-border, var(--line));
}

.tail-loop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
}

.tail-loop-toggle {
  width: fit-content;
  color: var(--slot-strong, var(--text));
}

.like-intro-toggle {
  width: fit-content;
  max-width: 100%;
  color: var(--slot-strong, var(--text));
}

.like-intro-toggle input,
.tail-loop-toggle input {
  flex-shrink: 0;
}

.like-intro-toggle span {
  overflow-wrap: anywhere;
}

.like-intro-note {
  color: var(--slot-strong, var(--accent-strong));
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.like-intro-note.invalid {
  color: var(--danger);
}

.tail-loop-toggle[data-like-intro-disabled] {
  color: var(--muted);
}

.tail-duration-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.tail-duration-grid .chip-option {
  min-height: 30px;
  padding: 0 4px;
  font-size: 11px;
}

.target-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.background-actions {
  display: inline-flex;
  gap: 5px;
}

.tiny-button {
  min-height: 26px;
  border-radius: 7px;
  padding: 0 8px;
  font-size: 11px;
}

.setting-row {
  display: grid;
  gap: 10px;
  margin: 4px 0 18px;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: var(--muted);
  font-weight: 700;
}

.progress-shell {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #d97706);
  transition: width 180ms ease;
}

.progress-text {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.job-control-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.control-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.control-button:hover {
  background: var(--surface-soft);
}

.danger-button {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--danger);
}

.danger-button:hover {
  background: #fee2e2;
}

.output-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  max-height: 210px;
  overflow: auto;
}

.output-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px 10px;
}

.output-item span {
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.output-item a {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.log-view {
  min-height: 330px;
  max-height: 48vh;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #151916;
  color: #d7e7dd;
  padding: 12px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(440px, calc(100vw - 36px));
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
  background: #171f1c;
  color: #fff;
  padding: 12px 14px;
  font-size: 13px;
  box-shadow: var(--shadow);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1280px) {
  .layout {
    grid-template-columns: 1fr 1fr;
  }

  .source-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-left {
    align-items: flex-start;
    flex-direction: column;
    width: 100%;
  }

  .server-pill {
    max-width: 100%;
  }

  .layout,
  .slot-controls,
  .cr-line,
  .bulk-row {
    grid-template-columns: 1fr;
  }

  .slot-top {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .slot-top .small-button {
    grid-column: 1 / -1;
  }

  .bulk-format-grid,
  .format-inline-grid,
  .editor-grid,
  .project-grid {
    grid-template-columns: repeat(3, minmax(70px, 1fr));
  }

  .scale-compact-grid,
  .placement-compact-grid,
  .source-target-grid {
    grid-template-columns: repeat(2, minmax(86px, 1fr));
  }

  .background-head {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .background-head > span:not(.background-index),
  .background-head .small-button {
    grid-column: 1 / -1;
  }
}

/* 2026-09-14 UI refresh */
.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  min-height: 72px;
  border-top: 3px solid var(--accent);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  padding: 12px clamp(18px, 3vw, 42px);
  backdrop-filter: blur(10px);
}

h1 {
  font-size: 22px;
}

.site-menu-button {
  gap: 10px;
  height: 40px;
  border-color: transparent;
  border-radius: 999px;
  background: #17202a;
  color: #ffffff;
  padding: 0 14px 0 12px;
  box-shadow: 0 12px 26px rgba(23, 32, 42, 0.16);
}

.site-menu-button::after {
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  opacity: 0.72;
  content: "";
}

.site-menu-button:hover {
  border-color: transparent;
  background: #25313d;
}

.switcher-grid {
  grid-template-columns: repeat(2, 6px);
}

.switcher-grid i {
  width: 6px;
  height: 6px;
  border-radius: 2px;
}

.switcher-grid i:nth-child(1) {
  background: var(--red);
}

.switcher-grid i:nth-child(2) {
  background: var(--accent);
}

.switcher-grid i:nth-child(3) {
  background: #2463d4;
}

.switcher-grid i:nth-child(4) {
  background: #d18a14;
}

.site-menu-panel {
  width: min(360px, calc(100vw - 28px));
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(23, 32, 42, 0.2);
  padding: 10px;
}

.site-menu-head {
  border: 1px solid #e5ebf0;
  border-radius: 7px;
  background: #f7f9fb;
  margin: -2px -2px 6px;
  padding: 10px;
}

.site-menu-panel a {
  border: 1px solid transparent;
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.site-menu-panel a:hover,
.site-menu-panel a[aria-current="page"] {
  border-color: #e3e9ef;
  background: #f8fafc;
  transform: translateX(2px);
}

.layout {
  padding-top: 20px;
}

@media (max-width: 760px) {
  .topbar {
    position: static;
    backdrop-filter: none;
  }

  .topbar-left {
    flex-direction: row;
  }
}

@media (max-width: 520px) {
  .topbar-left {
    align-items: flex-start;
    flex-direction: column;
  }
}
