:root {
  --bg: #1a1a1a;
  --bg-soft: #1f1f1e;
  --surface: #262626;
  --surface-2: #303030;
  --border: #383838;
  --text: #ededed;
  --muted: #9ca3af;
  --subtle: #6b7280;
  --brand: #e56a4a;
  --brand-2: #f3a15f;
  --green: #22c55e;
  --yellow: #fbbf24;
  --red: #ef4444;
  --blue: #60a5fa;
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(860px 420px at 8% -8%, rgba(229, 106, 74, 0.14), transparent 60%),
    radial-gradient(680px 360px at 92% 2%, rgba(96, 165, 250, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
}

body.theme-apple {
  --bg: #f6f7fb;
  --bg-soft: rgba(255, 255, 255, 0.66);
  --surface: rgba(255, 255, 255, 0.7);
  --surface-2: rgba(255, 255, 255, 0.88);
  --border: rgba(255, 255, 255, 0.58);
  --text: #111827;
  --muted: #6b7280;
  --subtle: #9ca3af;
  --brand: #2563eb;
  --brand-2: #1e3a8a;
  --green: #1f7d38;
  --yellow: #ff9500;
  --red: #ff2d55;
  --blue: #2563eb;
  color-scheme: light;
  background:
    radial-gradient(60% 50% at 85% 5%, rgba(255, 200, 220, 0.55), transparent 60%),
    radial-gradient(55% 50% at 5% 25%, rgba(180, 215, 255, 0.55), transparent 65%),
    radial-gradient(55% 50% at 95% 95%, rgba(200, 230, 255, 0.50), transparent 60%),
    radial-gradient(70% 60% at 0% 100%, rgba(230, 215, 255, 0.50), transparent 65%),
    linear-gradient(180deg, #f6f7fb 0%, #eef0f7 100%);
  background-attachment: fixed;
}

body.theme-apple .brand h1 {
  background: linear-gradient(to right, #0f172a 0%, #2563eb 100%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

body.theme-apple .brand-icon,
body.theme-apple .brand-mark,
body.theme-apple .icon-btn.primary,
body.theme-apple .btn-primary,
body.theme-apple .tab.active {
  border-color: rgba(37, 99, 235, 0.22);
  background: #2563eb;
  color: #fff;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.12), 0 1px 2px rgba(0, 0, 0, 0.04);
}

body.theme-apple .panel,
body.theme-apple .metric,
body.theme-apple .status-pill,
body.theme-apple .version-pill,
body.theme-apple .page-info,
body.theme-apple .tabs,
body.theme-apple .modal,
body.theme-apple .agent-panel,
body.theme-apple .loading-card {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}

body.theme-apple .panel {
  border-radius: 24px;
}

body.theme-apple .panel-title {
  border-color: rgba(229, 231, 235, 0.72);
  background: rgba(255, 255, 255, 0.42);
  color: #0f172a;
}

body.theme-apple input,
body.theme-apple select,
body.theme-apple textarea {
  border-color: rgba(229, 231, 235, 0.95);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  color: #111827;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

body.theme-apple input:focus,
body.theme-apple select:focus,
body.theme-apple textarea:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

body.theme-apple .tab,
body.theme-apple .icon-btn,
body.theme-apple .btn-secondary,
body.theme-apple .settings-subtab,
body.theme-apple .skill-chip {
  border-color: rgba(229, 231, 235, 0.86);
  background: rgba(255, 255, 255, 0.72);
  color: #111827;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

body.theme-apple .tab:hover,
body.theme-apple .icon-btn:hover,
body.theme-apple .btn-secondary:hover,
body.theme-apple .settings-subtab:hover,
body.theme-apple .version-pill:hover,
body.theme-apple .metric:hover {
  border-color: rgba(37, 99, 235, 0.4);
  background: rgba(239, 246, 255, 0.82);
}

body.theme-apple .summary-tile,
body.theme-apple .project-card,
body.theme-apple .channel-thumb-card,
body.theme-apple .image-tile,
body.theme-apple .logo-card,
body.theme-apple .editor-mobile-qa,
body.theme-apple .settings-tools-nav,
body.theme-apple .rule-card,
body.theme-apple .quality-item,
body.theme-apple .attraction-suggestion-card,
body.theme-apple .attraction-formula-card,
body.theme-apple .thumb-analysis-block,
body.theme-apple .editor-transform-tools,
body.theme-apple .env-panel,
body.theme-apple .character-frame,
body.theme-apple .character-progress,
body.theme-apple .character-log-manager,
body.theme-apple .log-row,
body.theme-apple .bubble,
body.theme-apple .doc-view,
body.theme-apple .text-view {
  border-color: rgba(229, 231, 235, 0.88);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
}

body.theme-apple .summary-tile:hover,
body.theme-apple .project-card:hover {
  border-color: rgba(37, 99, 235, 0.36);
  background: rgba(239, 246, 255, 0.74);
}

body.theme-apple .project-card.active,
body.theme-apple .list-item.active,
body.theme-apple .channel-list-item.active,
body.theme-apple .settings-subtab.active {
  border-color: rgba(37, 99, 235, 0.42);
  background: rgba(219, 234, 254, 0.68);
}

body.theme-apple .badge.brand,
body.theme-apple .suggestion-rank,
body.theme-apple .quality-score strong,
body.theme-apple .character-preview strong,
body.theme-apple .character-log-head strong {
  color: #2563eb;
}

body.theme-apple .badge.good,
body.theme-apple .quality-item.ok,
body.theme-apple .env-panel strong,
body.theme-apple .log-row .info {
  color: #1f7d38;
}

body.theme-apple .badge.warn,
body.theme-apple .log-row .warn {
  color: #a86200;
}

body.theme-apple .suggestion-body strong,
body.theme-apple .formula-card-head strong,
body.theme-apple .summary-tile strong,
body.theme-apple .project-card strong,
body.theme-apple .channel-thumb-meta strong {
  color: #0f172a;
}

body.theme-apple .formula-card-head span {
  background: rgba(239, 246, 255, 0.9);
}

body.theme-apple .modal-backdrop {
  background: rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

body.theme-apple #thumbCanvas {
  border-color: rgba(229, 231, 235, 0.9);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

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

button {
  cursor: pointer;
}

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

.draft-library-view {
  padding-bottom: 32px;
}

.draft-library-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
  padding: 4px 0 14px;
  border-bottom: 1px solid var(--border);
}

.draft-library-head h2 {
  margin: 4px 0 0;
  font-size: 24px;
}

.section-kicker {
  color: var(--brand-2);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.draft-library-counts {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.draft-library-counts span {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  white-space: nowrap;
}

.draft-library-counts strong {
  color: var(--text);
}

.toolbar.draft-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 180px 38px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.draft-toolbar input,
.draft-toolbar select {
  min-width: 0;
  height: 38px;
}

.draft-library-status {
  min-height: 26px;
  padding: 4px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

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

.draft-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.draft-card:hover {
  border-color: color-mix(in srgb, var(--brand) 62%, var(--border));
}

.draft-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: #101010;
  color: var(--muted);
}

.draft-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 160ms ease;
}

.draft-preview:hover img { transform: scale(1.02); }
.draft-preview.empty { display: grid; place-items: center; }

.draft-kind {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 3px;
  background: rgba(16, 16, 16, 0.84);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.draft-kind.workflow { color: var(--blue); }
.draft-kind.layered { color: var(--yellow); }

.draft-card-body {
  display: grid;
  gap: 11px;
  padding: 13px;
}

.draft-card-title {
  min-width: 0;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.draft-card-title > div { min-width: 0; }
.draft-card-title strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draft-card-title small {
  display: block;
  margin-top: 3px;
  color: var(--subtle);
}

.draft-card-title > span {
  flex: 0 0 auto;
  color: var(--brand-2);
  font-size: 11px;
  font-weight: 700;
}

.draft-card-body p {
  min-height: 38px;
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.draft-files {
  min-height: 58px;
  display: flex;
  align-content: start;
  flex-wrap: wrap;
  gap: 5px;
}

.draft-file {
  max-width: 100%;
  height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draft-file:hover { border-color: var(--blue); color: var(--text); }
.draft-file span { color: var(--blue); font-weight: 800; text-transform: uppercase; }
.draft-no-files { color: var(--subtle); font-size: 11px; }

.draft-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 36px;
}

.draft-actions .btn-primary,
.draft-actions .btn-secondary {
  min-width: 0;
  min-height: 34px;
  padding: 0 10px;
}

.draft-actions .icon-btn { margin-left: auto; }

.draft-empty {
  grid-column: 1 / -1;
  padding: 34px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-gate[hidden] { display: none; }

.login-card {
  width: min(420px, calc(100vw - 48px));
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(38, 38, 38, 0.98);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 18px;
}

.login-brand strong,
.login-brand span {
  display: block;
}

.login-brand span {
  margin-top: 5px;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-field {
  display: grid;
  gap: 7px;
}

.login-field span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.login-field input {
  width: 100%;
}

.login-error {
  min-height: 18px;
  color: var(--red);
  font-size: 12px;
}

.login-actions {
  display: flex;
  justify-content: flex-end;
}

.loading {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: var(--bg);
}

.loading[hidden] { display: none; }

body.app-locked {
  overflow: hidden;
}

body.app-locked .app-shell {
  visibility: hidden;
  pointer-events: none;
}

.loading-card {
  width: min(360px, calc(100vw - 48px));
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(38, 38, 38, 0.96);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.brand-mark,
.brand-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 900;
}

.loading-card strong,
.loading-card span {
  display: block;
}

.loading-card span {
  margin-top: 5px;
  color: var(--muted);
}

.loading-bar {
  grid-column: 1 / -1;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--border);
}

.loading-bar span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  animation: slide 1s ease-in-out infinite;
}

@keyframes slide {
  0% { transform: translateX(-110%); }
  55% { transform: translateX(90%); }
  100% { transform: translateX(260%); }
}

.app-shell {
  width: min(1380px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.top-actions,
.toolbar,
.panel-actions,
.agent-head-actions,
.modal-actions,
.settings-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.metric {
  min-width: 74px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(38, 38, 38, 0.88);
  color: var(--text);
}

.metric span {
  color: var(--brand);
  font-size: 16px;
}

.metric strong {
  font-size: 17px;
}

.status-pill,
.version-pill {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(38, 38, 38, 0.9);
  color: var(--text);
  padding: 0 12px;
  font-weight: 700;
  font-size: 12px;
}

.status-pill span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--yellow);
}

.status-pill.on span { background: var(--green); box-shadow: 0 0 10px rgba(34, 197, 94, 0.55); }
.status-pill.bad span { background: var(--red); }

.tabs {
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 16px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(31, 31, 30, 0.82);
  -webkit-overflow-scrolling: touch;
}

.tab,
.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.tab {
  flex: 0 0 34px;
}

.tab.active,
.icon-btn.primary,
.btn-primary {
  border-color: rgba(229, 106, 74, 0.8);
  background: rgba(229, 106, 74, 0.18);
  color: #fff;
}

.icon-btn:hover,
.tab:hover,
.version-pill:hover,
.metric:hover {
  border-color: var(--brand);
}

.view { display: none; }
.view.active { display: block; }

.settings-tools-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(31, 31, 30, 0.72);
}

.settings-subtab {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

.settings-subtab:hover {
  border-color: var(--brand);
  color: var(--text);
}

.settings-subtab.active {
  border-color: rgba(229, 106, 74, 0.8);
  background: rgba(229, 106, 74, 0.18);
  color: #fff;
}

.split-view {
  grid-template-columns: minmax(280px, 0.55fr) minmax(0, 1.45fr);
  gap: 16px;
}

.split-view.active { display: grid; }

.split-view.active > .settings-tools-nav {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.editor-view.active {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 360px;
  gap: 16px;
}

.editor-view.active.tools-collapsed {
  grid-template-columns: minmax(0, 1fr) 56px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(38, 38, 38, 0.9);
  overflow: hidden;
}

.panel + .panel { margin-top: 16px; }
.split-view .panel + .panel { margin-top: 0; }

.panel-title {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(31, 31, 30, 0.9);
  font-weight: 800;
}

.panel-title span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.editor-stage-panel .panel-title {
  align-items: flex-start;
  flex-wrap: wrap;
}

.editor-toolbar {
  flex: 1 1 520px;
  justify-content: flex-end;
  flex-wrap: wrap;
  min-width: 0;
}

.editor-toolbar select {
  min-width: 0;
  max-width: 100%;
}

#editorDesignSelect {
  flex: 1 1 320px;
  max-width: 460px;
}

.draft-picker-trigger {
  flex: 1 1 320px;
  max-width: 460px;
  min-width: 220px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  text-align: left;
}

.draft-picker-trigger:hover {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(255, 255, 255, 0.07);
}

.draft-picker-trigger span {
  flex: 0 0 auto;
  color: var(--blue);
  font-weight: 900;
}

.draft-picker-trigger strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#editorProjectSelect {
  flex: 1 1 220px;
}

#editorAssetSelect {
  flex: 1 1 180px;
}

input,
select,
textarea {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #1d1d1c;
  color: var(--text);
  padding: 0 10px;
  outline: none;
}

textarea {
  padding: 9px 10px;
  resize: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-tile {
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(48, 48, 48, 0.95), rgba(38, 38, 38, 0.96));
  color: var(--text);
  text-align: left;
  padding: 16px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.summary-tile:hover {
  border-color: var(--brand);
  background: linear-gradient(180deg, rgba(58, 58, 57, 0.98), rgba(42, 42, 41, 0.98));
  transform: translateY(-1px);
}

.summary-tile span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-tile strong {
  font-size: 34px;
  line-height: 1;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  padding: 14px;
}

.project-card {
  min-height: 172px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  padding: 12px;
  cursor: pointer;
}

.project-card.active {
  border-color: var(--brand);
}

.project-card:hover {
  border-color: var(--brand);
  background: rgba(255, 255, 255, 0.045);
}

.project-thumb {
  width: 100%;
  aspect-ratio: 16 / 8;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: #111;
  color: var(--subtle);
}

.project-thumb[data-preview-src] {
  cursor: zoom-in;
}

.project-thumb[data-preview-src]::after,
.image-tile[data-preview-src]::after {
  content: "Preview";
  position: absolute;
  right: 8px;
  bottom: 8px;
  opacity: 0;
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  transition: opacity 160ms ease;
}

.project-thumb[data-preview-src]:hover::after,
.image-tile[data-preview-src]:hover::after {
  opacity: 1;
}

.project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.project-preview-link {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--brand) 45%, var(--border));
  border-radius: 7px;
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  color: var(--text);
  padding: 0 10px;
  font-size: 11px;
  font-weight: 850;
}

.project-preview-link:hover {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 22%, var(--surface));
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 11px;
}

.badge.good { color: var(--green); background: rgba(34, 197, 94, 0.1); }
.badge.warn { color: var(--yellow); background: rgba(251, 191, 36, 0.1); }
.badge.brand { color: var(--brand-2); background: rgba(229, 106, 74, 0.12); }

.compact-list {
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding: 10px;
}

.list-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 10px;
  text-align: left;
}

.list-item:hover,
.list-item.active {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.list-item small {
  color: var(--muted);
}

.list-item-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.list-tool-btn {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--brand) 44%, var(--border));
  border-radius: 7px;
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  color: var(--text);
  padding: 0 9px;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.list-tool-btn:hover {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 22%, var(--surface));
}

.doc-view,
.text-view {
  min-height: 480px;
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding: 20px 24px;
  line-height: 1.65;
}

.doc-view {
  color: #e5e7eb;
  font-size: 13px;
}

.doc-view.small {
  min-height: 120px;
  max-height: 220px;
}

.doc-view h1,
.doc-view h2,
.doc-view h3 {
  margin: 24px 0 10px;
  line-height: 1.25;
}

.doc-view h1 {
  margin-top: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  color: #fff;
  font-size: 24px;
}

.doc-view h2 {
  padding-top: 8px;
  color: var(--brand-2);
  font-size: 18px;
}

.doc-view h3 {
  color: var(--blue);
  font-size: 15px;
}

.doc-view p {
  margin: 9px 0;
  color: #dedede;
}

.doc-view ul,
.doc-view ol {
  margin: 10px 0 14px;
  padding-left: 24px;
  color: #dedede;
}

.doc-view li {
  margin: 5px 0;
}

.doc-view blockquote {
  margin: 14px 0;
  padding: 10px 14px;
  border-left: 3px solid var(--brand);
  border-radius: 0 8px 8px 0;
  background: rgba(229, 106, 74, 0.08);
  color: var(--muted);
}

.doc-view blockquote p {
  margin: 4px 0;
}

.doc-view a {
  color: var(--blue);
  text-decoration: none;
}

.doc-view a:hover {
  text-decoration: underline;
}

.doc-view code,
.text-view {
  font-family: "DM Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.doc-view :not(pre) > code {
  padding: 2px 5px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.22);
  color: #f8fafc;
}

.doc-view pre {
  overflow: auto;
  margin: 14px 0;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
}

.doc-view pre code {
  color: #e5e7eb;
  white-space: pre;
}

.doc-view table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 8px;
  font-size: 12px;
}

.doc-view th,
.doc-view td {
  border: 1px solid var(--border);
  padding: 8px 9px;
  vertical-align: top;
}

.doc-view th {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-align: left;
}

.doc-view td {
  color: #d8d8d8;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 14px;
}

.image-tile {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  overflow: hidden;
  cursor: zoom-in;
}

.image-tile img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.image-tile span {
  display: block;
  padding: 8px;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#keyframesView .panel-title {
  align-items: flex-start;
  flex-wrap: wrap;
}

#keyframesView .toolbar {
  flex: 1 1 760px;
  justify-content: flex-end;
  flex-wrap: wrap;
  min-width: 0;
}

#keyframesView .toolbar input {
  flex: 1 1 190px;
  min-width: 150px;
}

#keyframesView .toolbar select {
  flex: 0 1 140px;
  min-width: 112px;
}

.channel-library-view.active {
  grid-template-columns: 300px minmax(0, 1fr);
}

.channel-library-view .panel-title {
  align-items: flex-start;
  flex-wrap: wrap;
}

.channel-library-view .toolbar {
  flex: 1 1 620px;
  justify-content: flex-end;
  flex-wrap: wrap;
  min-width: 0;
}

.channel-library-view .toolbar input {
  flex: 1 1 220px;
  min-width: 180px;
}

.channel-library-view .toolbar select {
  flex: 0 1 132px;
  min-width: 112px;
}

.page-info {
  min-width: 54px;
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
}

.channel-list {
  max-height: calc(100vh - 230px);
}

.channel-list-item strong {
  text-transform: capitalize;
}

.asset-library-view.active,
.logo-library-view.active,
.border-library-view.active {
  grid-template-columns: 300px minmax(0, 1fr);
}

.asset-library-view .panel-title,
.logo-library-view .panel-title,
.border-library-view .panel-title {
  align-items: flex-start;
  flex-wrap: wrap;
}

.asset-library-view .toolbar,
.logo-library-view .toolbar,
.border-library-view .toolbar {
  flex: 1 1 620px;
  justify-content: flex-end;
  flex-wrap: wrap;
  min-width: 0;
}

.asset-library-view .toolbar input,
.logo-library-view .toolbar input,
.border-library-view .toolbar input {
  flex: 1 1 220px;
  min-width: 180px;
}

.asset-library-view .toolbar select,
.logo-library-view .toolbar select,
.border-library-view .toolbar select {
  flex: 0 1 150px;
  min-width: 120px;
}

.asset-collection-list,
.logo-collection-list,
.border-collection-list {
  max-height: calc(100vh - 230px);
}

.asset-collection-list .list-item,
.logo-collection-list .list-item,
.border-collection-list .list-item {
  align-items: flex-start;
}

.asset-collection-list .list-item span,
.logo-collection-list .list-item span,
.border-collection-list .list-item span {
  min-width: 0;
}

.asset-collection-list .list-item strong,
.asset-collection-list .list-item small,
.logo-collection-list .list-item strong,
.logo-collection-list .list-item small,
.border-collection-list .list-item strong,
.border-collection-list .list-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-library-summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 0;
  color: var(--muted);
  font-size: 11px;
}

.asset-library-summary strong {
  color: var(--text);
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  padding: 14px;
}

.gradient-library-view.active {
  display: grid;
  gap: 16px;
  align-items: start;
}

.gradient-intro-panel .panel-title {
  align-items: flex-start;
  flex-wrap: wrap;
}

.gradient-intro-panel .toolbar {
  flex: 1 1 620px;
  justify-content: flex-end;
  flex-wrap: wrap;
  min-width: 0;
}

.gradient-intro-panel .toolbar input {
  flex: 1 1 220px;
  min-width: 180px;
}

.gradient-intro-panel .toolbar select {
  flex: 0 1 160px;
  min-width: 140px;
}

.gradient-rule-strip {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 11px 14px 0;
  color: var(--muted);
  line-height: 1.45;
}

.gradient-rule-strip strong {
  flex: 0 0 auto;
  color: var(--text);
}

.gradient-builder {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(280px, 1fr);
  gap: 14px;
  padding: 14px;
  align-items: start;
}

.gradient-builder-preview {
  min-height: 220px;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(135deg, #93c5fd, #22d3ee, #020617);
}

.gradient-builder-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.gradient-builder-controls label {
  display: grid;
  gap: 6px;
}

.gradient-builder-controls label span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.gradient-builder-controls input,
.gradient-builder-controls select {
  width: 100%;
}

.gradient-builder-controls input[type="color"] {
  min-height: 36px;
  padding: 2px;
}

.gradient-builder-css {
  grid-column: 1 / -1;
  min-height: 44px;
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.22);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gradient-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
  padding: 14px;
}

.gradient-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
}

.gradient-card.is-favorite {
  border-color: rgba(251, 191, 36, 0.48);
}

.gradient-card.is-recent:not(.is-favorite) {
  border-color: rgba(96, 165, 250, 0.34);
}

.gradient-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: 0;
  border-bottom: 1px solid var(--border);
}

.gradient-preview:hover {
  filter: saturate(1.12) contrast(1.04);
}

.gradient-card-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.gradient-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.gradient-card-head > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.gradient-card-head strong,
.gradient-card-head small,
.gradient-card-body p {
  min-width: 0;
}

.gradient-card-head strong {
  color: var(--text);
  font-size: 13px;
}

.gradient-card-head small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.gradient-favorite-btn {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}

.gradient-favorite-btn.active {
  border-color: rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.14);
  color: var(--yellow);
}

.gradient-card-body p {
  min-height: 48px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.gradient-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.gradient-chips span {
  padding: 3px 7px;
  border: 1px solid rgba(96, 165, 250, 0.22);
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.1);
  color: #93c5fd;
  font-size: 9px;
  font-weight: 800;
}

.gradient-target {
  display: grid;
  gap: 5px;
}

.gradient-target span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.gradient-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 7px;
}

.gradient-actions button {
  min-width: 0;
}

body.theme-apple .gradient-card {
  border-color: rgba(229, 231, 235, 0.88);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

body.theme-apple .gradient-builder-css {
  background: rgba(255, 255, 255, 0.62);
}

.comment-analysis-view.active {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.comment-analysis-view .panel + .panel { margin-top: 0; }

.comment-run-panel {
  grid-column: 1 / -1;
}

.comment-run-panel .panel-title {
  min-height: 44px;
}

.comment-run-status {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.comment-mine-form {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 140px 110px auto;
  gap: 8px;
  padding: 12px 14px;
}

.comment-mine-form input,
.comment-mine-form select,
.comment-toolbar input,
.comment-toolbar select {
  width: 100%;
  min-width: 0;
}

.comment-session-list {
  max-height: calc(100vh - 270px);
}

.comment-session-item {
  align-items: flex-start;
}

.comment-session-item > span {
  min-width: 0;
  text-align: left;
}

.comment-session-item strong,
.comment-session-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment-session-item small + small { margin-top: 4px; }

.comment-session-item time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
}

.comment-detail-panel {
  min-width: 0;
}

.comment-detail-titlebar > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment-detail-actions {
  flex: 0 0 auto;
}

.comment-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
}

.comment-kpis > div {
  min-width: 0;
  padding: 12px 14px;
  border-right: 1px solid var(--border);
}

.comment-kpis > div:last-child { border-right: 0; }

.comment-kpis strong,
.comment-kpis span {
  display: block;
}

.comment-kpis strong {
  font-size: 20px;
  line-height: 1.1;
}

.comment-kpis span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.comment-cluster-list {
  display: flex;
  gap: 7px;
  padding: 10px 14px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}

.comment-cluster-btn {
  flex: 0 0 auto;
  min-width: 136px;
  max-width: 220px;
  min-height: 42px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  text-align: left;
}

.comment-cluster-btn:hover,
.comment-cluster-btn.active {
  border-color: rgba(229, 106, 74, 0.75);
  background: rgba(229, 106, 74, 0.14);
}

.comment-cluster-btn strong,
.comment-cluster-btn span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment-cluster-btn strong { font-size: 11px; }
.comment-cluster-btn span { margin-top: 4px; color: var(--muted); font-size: 10px; }

.comment-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto 140px;
  gap: 8px;
  padding: 10px 14px 6px;
}

.comment-filter-segments {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.comment-filter-segments button {
  min-width: 68px;
  min-height: 34px;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.comment-filter-segments button:last-child { border-right: 0; }
.comment-filter-segments button.active { background: var(--surface-hover); color: var(--text); }

.comment-result-meta {
  min-height: 25px;
  padding: 3px 14px 8px;
  color: var(--muted);
  font-size: 10px;
}

.comment-rows {
  max-height: calc(100vh - 430px);
  min-height: 240px;
  overflow: auto;
  border-top: 1px solid var(--border);
}

.comment-analysis-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  min-width: 0;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}

.comment-analysis-row.reply {
  padding-left: 34px;
  background: rgba(255, 255, 255, 0.018);
}

.comment-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.18);
  color: var(--text);
  font-size: 10px;
  font-weight: 900;
}

.comment-copy { min-width: 0; }

.comment-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.comment-meta strong {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.comment-meta span { color: var(--muted); font-size: 10px; }

.comment-meta em {
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(250, 204, 21, 0.15);
  color: var(--yellow);
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
}

.comment-meta em.reply { background: rgba(96, 165, 250, 0.14); color: #93c5fd; }
.comment-meta em.repeated { background: rgba(34, 197, 94, 0.14); color: #86efac; }
.comment-meta em.pain { background: rgba(244, 63, 94, 0.15); color: #fda4af; }

.comment-copy p {
  margin: 5px 0 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.48;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-likes {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.comment-empty {
  padding: 32px 18px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

body.theme-apple .comment-cluster-btn,
body.theme-apple .comment-filter-segments button,
body.theme-apple .comment-analysis-row.reply {
  background: rgba(255, 255, 255, 0.46);
}

.asset-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.asset-card:hover {
  border-color: var(--brand);
  background: rgba(255, 255, 255, 0.045);
  transform: translateY(-1px);
}

.asset-card-preview {
  min-height: 150px;
  display: grid;
  place-items: center;
  padding: 10px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.035) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.035) 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.asset-card-preview img {
  width: 100%;
  height: 150px;
  display: block;
  object-fit: contain;
}

.asset-card-meta {
  display: grid;
  gap: 5px;
  padding: 9px 10px 10px;
}

.asset-card-meta strong,
.asset-card-meta span,
.asset-card-meta small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-card-meta strong {
  color: var(--text);
  font-size: 12px;
}

.asset-card-meta span,
.asset-card-meta small {
  color: var(--muted);
  font-size: 10px;
}

.logo-grid {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

.logo-card-preview {
  min-height: 170px;
  padding: 16px;
}

.logo-card-preview img {
  height: 140px;
  max-width: 100%;
}

.logo-card-meta {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.logo-library-summary {
  padding-bottom: 0;
}

.asset-type-chip {
  width: fit-content;
  max-width: 100%;
  padding: 3px 6px;
  border: 1px solid rgba(96, 165, 250, 0.22);
  border-radius: 999px;
  color: #93c5fd;
  background: rgba(96, 165, 250, 0.12);
  font-size: 9px;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}

.channel-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  padding: 14px;
}

.channel-thumb-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.channel-thumb-card:hover {
  border-color: var(--brand);
  background: rgba(255, 255, 255, 0.045);
  transform: translateY(-1px);
}

.channel-thumb-card::after {
  content: "Click để xem chi tiết";
  position: absolute;
  right: 8px;
  top: 44px;
  opacity: 0;
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  transition: opacity 160ms ease;
}

.channel-thumb-card:hover::after {
  opacity: 1;
}

.channel-thumb-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #111;
}

.channel-thumb-frame {
  position: relative;
}

.thumb-run-analysis-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 58px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 7px;
  background: rgba(7, 10, 18, 0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
  z-index: 2;
}

.thumb-apply-draft-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  min-width: 70px;
  height: 28px;
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: 7px;
  background: rgba(37, 99, 235, 0.82);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
  z-index: 2;
}

.thumb-apply-draft-btn:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(34, 197, 94, 0.86);
  transform: translateY(-1px);
}

.thumb-run-analysis-btn:hover:not(:disabled) {
  border-color: var(--brand);
  background: rgba(56, 189, 248, 0.86);
  transform: translateY(-1px);
}

.thumb-run-analysis-btn:disabled {
  cursor: wait;
  opacity: 0.72;
}

.channel-thumb-meta {
  display: grid;
  gap: 4px;
  padding: 9px 10px 10px;
}

.channel-thumb-meta strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-thumb-meta span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-thumb-status-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 20px;
  margin-top: 2px;
}

.channel-thumb-status-tag {
  max-width: 100%;
  padding: 3px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-thumb-status-tag.good {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.18);
  background: rgba(34, 197, 94, 0.13);
}

.channel-thumb-status-tag.blue {
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.2);
  background: rgba(96, 165, 250, 0.13);
}

.channel-thumb-status-tag.brand {
  color: #fdba74;
  border-color: rgba(229, 106, 74, 0.22);
  background: rgba(229, 106, 74, 0.14);
}

.channel-thumb-status-tag.warn {
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.22);
  background: rgba(251, 191, 36, 0.13);
}

.channel-thumb-analysis-state {
  width: fit-content;
  max-width: 100%;
  padding: 3px 6px;
  border-radius: 6px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.06);
}

.channel-thumb-analysis-state.done {
  color: #86efac;
  background: rgba(34, 197, 94, 0.13);
}

.channel-thumb-analysis-state.error {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.13);
}

.modal.thumb-analysis-modal {
  width: min(1680px, calc(100vw - 16px));
  max-height: calc(100vh - 24px);
}

.thumb-analysis-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(420px, 0.72fr) minmax(720px, 1.28fr);
  gap: 16px;
  padding: 14px;
  overflow: auto;
}

.thumb-analysis-preview {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 10px;
}

.thumb-analysis-preview img {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #111;
  object-fit: cover;
}

.thumb-analysis-meta {
  display: grid;
  gap: 6px;
}

.thumb-analysis-meta span {
  color: var(--muted);
  font-size: 12px;
}

.thumb-analysis-meta strong {
  color: var(--brand-2);
  font-size: 22px;
  line-height: 1.15;
}

.thumb-analysis-detail {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 10px;
}

.thumb-analysis-block {
  min-width: 0;
  display: grid;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 12px;
}

.thumb-analysis-block.primary {
  border-color: rgba(243, 161, 95, 0.42);
  background: rgba(229, 106, 74, 0.10);
}

.thumb-analysis-block.cockpit {
  border-color: rgba(96, 165, 250, 0.42);
  background: rgba(96, 165, 250, 0.08);
}

.thumb-analysis-block.cockpit.bad {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.08);
}

.thumb-analysis-block.asset-extraction {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
}

.thumb-analysis-block.asset-extraction.running {
  border-color: rgba(96, 165, 250, 0.42);
  background: rgba(96, 165, 250, 0.08);
}

.thumb-analysis-block.asset-extraction.bad {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.08);
}

.thumb-analysis-block span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.thumb-analysis-block strong {
  color: #fff;
  font-size: 16px;
  line-height: 1.35;
}

.thumb-analysis-block p {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}

.thumb-cockpit-progress {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.28);
}

.thumb-cockpit-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.thumb-cockpit-progress-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thumb-cockpit-progress-head strong {
  flex: 0 0 auto;
  color: var(--brand-2);
  font-size: 12px;
  line-height: 1;
}

.thumb-cockpit-progress-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
}

.thumb-cockpit-progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width 420ms ease;
}

.cockpit-analysis-text {
  min-width: 0;
  display: grid;
  gap: 8px;
  color: var(--text);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.cockpit-analysis-text h1,
.cockpit-analysis-text h2,
.cockpit-analysis-text h3,
.cockpit-analysis-text p,
.cockpit-analysis-text ul,
.cockpit-analysis-text ol {
  margin: 0;
}

.cockpit-analysis-text ul,
.cockpit-analysis-text ol {
  padding-left: 20px;
}

.cockpit-analysis-text pre,
.cockpit-analysis-text table {
  max-width: 100%;
  overflow: auto;
}

.thumb-analysis-block small {
  color: var(--muted);
  font-size: 11px;
}

.thumb-analysis-artifacts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}

.thumb-analysis-artifacts small {
  min-width: 180px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-btn {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
}

body.theme-apple .thumb-analysis-block.primary {
  border-color: rgba(37, 99, 235, 0.28);
  background: rgba(219, 234, 254, 0.66);
}

body.theme-apple .thumb-analysis-block.cockpit {
  border-color: rgba(37, 99, 235, 0.24);
  background: rgba(239, 246, 255, 0.72);
}

body.theme-apple .thumb-analysis-block.cockpit.bad {
  border-color: rgba(255, 45, 85, 0.32);
  background: rgba(252, 229, 235, 0.72);
}

.thumb-analysis-block.extracted-draft {
  border-color: rgba(96, 165, 250, 0.28);
  background: rgba(96, 165, 250, 0.1);
}

body.theme-apple .thumb-analysis-block.extracted-draft {
  border-color: rgba(37, 99, 235, 0.28);
  background: rgba(219, 234, 254, 0.72);
}

body.theme-apple .thumb-cockpit-progress {
  border-color: rgba(37, 99, 235, 0.18);
  background: rgba(255, 255, 255, 0.52);
}

body.theme-apple .thumb-cockpit-progress-bar {
  background: rgba(148, 163, 184, 0.24);
}

body.theme-apple .thumb-analysis-meta strong,
body.theme-apple .thumb-analysis-block strong {
  color: #0f172a;
}

.attraction-view.active {
  display: grid;
  gap: 16px;
}

.attraction-composer {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.attraction-composer label {
  display: grid;
  gap: 7px;
}

.attraction-composer label span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#attractionTitleInput {
  min-height: 92px;
  resize: vertical;
}

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

.attraction-suggestion-card {
  min-height: 220px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 12px;
}

.suggestion-rank {
  width: max-content;
  border: 1px solid rgba(243, 161, 95, 0.42);
  border-radius: 8px;
  background: rgba(229, 106, 74, 0.16);
  color: var(--brand-2);
  padding: 4px 8px;
  font-weight: 900;
}

.suggestion-body {
  display: grid;
  align-content: start;
  gap: 7px;
}

.suggestion-body strong {
  color: #fff;
  font-size: 21px;
  line-height: 1.12;
}

.suggestion-body span {
  color: var(--brand-2);
  font-weight: 800;
}

.suggestion-body p,
.suggestion-body small {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.attraction-formula-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.attraction-formula-card {
  min-height: 190px;
  display: grid;
  align-content: start;
  gap: 10px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--formula-color, var(--brand));
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
}

.formula-card-head {
  display: grid;
  gap: 7px;
}

.formula-card-head span {
  width: max-content;
  max-width: 100%;
  border: 1px solid var(--formula-color, var(--brand));
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--formula-color, var(--brand));
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 1000;
}

.formula-card-head strong {
  color: #fff;
  font-size: 17px;
}

.attraction-formula-card p,
.attraction-formula-card small,
.formula-proof {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.formula-proof {
  border-top: 1px solid var(--border);
  padding-top: 9px;
  color: var(--text);
  font-size: 12px;
}

.editor-stage-panel,
.editor-tools-panel {
  min-height: 0;
}

.editor-tools-panel .panel-title {
  cursor: pointer;
}

.editor-tools-panel .panel-title .icon-btn {
  position: relative;
  z-index: 1;
}

.editor-tools-panel.collapsed .panel-title {
  min-height: 100%;
  align-items: flex-start;
  justify-content: center;
  padding: 10px 8px;
}

.editor-tools-panel.collapsed .panel-title span,
.editor-tools-panel.collapsed .editor-tools,
.editor-tools-panel.collapsed .quality-checklist,
.editor-tools-panel.collapsed .editor-mobile-qa,
.editor-tools-panel.collapsed .rule-cards {
  display: none;
}

.editor-canvas-wrap {
  position: relative;
  padding: 14px;
  background:
    linear-gradient(45deg, rgba(255,255,255,0.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,0.035) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.035) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.035) 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}

.editor-quick-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 14px;
}

.editor-action-btn {
  min-height: 36px;
  flex: 0 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 86%, #ffffff);
  color: var(--text);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.editor-action-btn:hover {
  border-color: color-mix(in srgb, var(--brand) 56%, var(--border));
  background: color-mix(in srgb, var(--brand) 14%, var(--surface));
}

.editor-action-btn kbd,
.editor-shortcut-panel kbd {
  min-width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--border) 78%, #ffffff);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-family: inherit;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.editor-action-btn kbd {
  margin-left: 2px;
}

.editor-action-emoji {
  width: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
}

.editor-shortcut-panel {
  margin: 0 14px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  overflow: hidden;
}

.editor-shortcut-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}

.editor-shortcut-panel-head strong {
  font-size: 13px;
}

.editor-shortcut-panel-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.editor-shortcut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
  padding: 10px;
}

.editor-shortcut-grid span {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.2;
}

.editor-layer-panel {
  margin: 0 14px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  overflow: hidden;
}

.editor-layer-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}

.editor-layer-panel-head strong {
  font-size: 13px;
}

.editor-layer-panel-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.editor-layer-stack {
  display: grid;
  gap: 1px;
  max-height: 260px;
  overflow: auto;
  background: rgba(255, 255, 255, 0.035);
}

.editor-layer-row {
  min-width: 0;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  background: color-mix(in srgb, var(--surface) 92%, #ffffff);
  padding: 7px;
  border-left: 4px solid var(--layer-color, var(--brand));
}

.editor-layer-row.active {
  background: color-mix(in srgb, var(--layer-color, var(--brand)) 16%, var(--surface));
}

.editor-layer-row.is-hidden {
  opacity: 0.58;
}

.editor-layer-row.is-locked {
  opacity: 0.76;
}

.editor-layer-row.is-locked .editor-layer-icon::after {
  content: " locked";
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}

.editor-layer-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  text-align: left;
}

.editor-layer-swatch {
  width: 10px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--layer-color, var(--brand));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--layer-color, var(--brand)) 18%, transparent);
}

.editor-layer-main:disabled {
  cursor: default;
  opacity: 0.72;
}

.editor-layer-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--layer-color, var(--brand)) 48%, var(--border));
  border-radius: 6px;
  background: color-mix(in srgb, var(--layer-color, var(--brand)) 16%, rgba(0, 0, 0, 0.16));
}

.editor-layer-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.editor-layer-copy strong,
.editor-layer-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-layer-copy small {
  color: var(--muted);
  font-size: 11px;
}

.editor-layer-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.editor-layer-actions .icon-btn {
  width: 30px;
  height: 30px;
  min-height: 30px;
  border-radius: 7px;
}

.editor-layer-actions .icon-btn.danger {
  color: var(--red);
}

#thumbCanvas {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #050505;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.35);
  cursor: default;
}

#thumbCanvas.is-editing {
  cursor: move;
}

.editor-inline-text-input {
  position: absolute;
  z-index: 8;
  box-sizing: border-box;
  min-width: 96px;
  min-height: 42px;
  resize: none;
  overflow: hidden;
  border: 2px solid var(--brand);
  border-radius: 8px;
  background: rgba(5, 8, 16, 0.82);
  color: #fff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.42);
  outline: none;
}

.editor-mobile-qa {
  display: grid;
  gap: 10px;
  margin: 0 14px 14px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.editor-mobile-qa-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.editor-mobile-qa-head strong {
  color: var(--brand-2);
  font-size: 13px;
}

.editor-mobile-qa-score {
  min-width: 64px;
  text-align: right;
  color: var(--green);
  font-size: 18px;
  font-weight: 950;
}

.editor-mobile-qa-grid {
  display: grid;
  grid-template-columns: 256px 160px 96px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.editor-mobile-shot {
  display: grid;
  gap: 5px;
}

.editor-mobile-shot img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: #050505;
}

.editor-mobile-shot span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.editor-mobile-qa-list {
  display: grid;
  gap: 6px;
}

.editor-mobile-qa-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.editor-mobile-qa-item strong {
  color: var(--text);
}

.editor-mobile-qa-item.ok {
  color: var(--green);
}

.editor-mobile-qa-item.warn {
  color: var(--yellow);
}

.editor-mobile-qa-item.bad {
  color: var(--red);
}

.editor-tools {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.editor-transform-tools {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.editor-layer-text-controls,
.editor-layer-style-controls {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.subtitle-style-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.subtitle-style-grid input[type="color"] {
  width: 100%;
  padding: 3px 8px;
}

.subtitle-style-grid .inline-check {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.subtitle-style-grid .inline-check input {
  min-height: 18px;
  width: 18px;
}

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

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

.template-actions .btn-secondary {
  min-width: 0;
  padding: 0 8px;
  font-size: 11px;
}

.editor-tools label {
  display: grid;
  gap: 6px;
}

.editor-tools label span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.editor-tools textarea {
  min-height: 70px;
}

.rule-cards {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  padding: 0 14px 14px;
}

.quality-checklist {
  display: grid;
  gap: 8px;
  padding: 0 14px 12px;
}

.quality-score {
  display: grid;
  gap: 6px;
}

.quality-score strong {
  color: var(--brand-2);
}

.quality-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--border);
}

.quality-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--green));
}

.quality-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.quality-item.ok {
  color: var(--green);
}

.quality-item:hover,
.quality-item:focus {
  border-color: rgba(243, 161, 95, 0.55);
  background: rgba(255, 255, 255, 0.055);
}

.character-view .panel {
  max-width: 1180px;
}

.character-view .toolbar {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.character-workbench {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 14px;
}

.character-preview {
  display: grid;
  gap: 8px;
}

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

.character-preview strong {
  color: var(--brand-2);
}

.model-status {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.model-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--yellow);
}

.model-status.ready {
  border-color: rgba(34, 197, 94, 0.45);
  color: var(--green);
}

.model-status.ready::before {
  background: var(--green);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

.model-status.bad {
  border-color: rgba(239, 68, 68, 0.45);
  color: var(--red);
}

.model-status.bad::before {
  background: var(--red);
}

#characterCheckpointSelect {
  min-width: 220px;
  max-width: 320px;
}

.character-frame {
  min-height: 280px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #111;
}

.character-frame.checkerboard,
.character-output {
  background:
    linear-gradient(45deg, rgba(255,255,255,0.055) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,0.055) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.055) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.055) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.character-frame img {
  max-width: 100%;
  max-height: 420px;
  display: block;
  object-fit: contain;
}

.character-frame img:not([src]) {
  display: none;
}

.character-controls {
  display: grid;
  gap: 12px;
  padding: 0 14px 14px;
}

.character-controls label {
  display: grid;
  gap: 6px;
}

.character-controls label span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.character-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.character-actions .compact-select {
  min-height: 36px;
  min-width: 132px;
  font-weight: 800;
}

.character-actions .color-select {
  min-width: 118px;
}

.auto-save-status {
  min-width: 104px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.auto-save-status.bad {
  color: var(--red);
}

.button-icon {
  display: inline-grid;
  place-items: center;
  width: 16px;
  min-width: 16px;
  color: var(--brand-2);
  font-weight: 900;
  line-height: 1;
}

.character-progress {
  display: grid;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 10px;
}

.character-progress[hidden] {
  display: none;
}

.character-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.character-progress-head strong {
  color: var(--brand-2);
}

.character-progress-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--border);
}

.character-progress-bar span {
  width: 0%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--green));
  transition: width 240ms ease;
}

.character-log-manager {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  overflow: hidden;
}

.character-log-head {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
}

.character-log-head strong {
  color: var(--brand-2);
}

.character-log-head span {
  margin-right: auto;
  color: var(--muted);
  font-size: 12px;
}

.character-log-body {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding: 10px;
}

.character-log-body[hidden] {
  display: none;
}

.character-undo-row {
  display: flex;
  justify-content: flex-end;
}

.character-log-file,
.character-log-empty {
  color: var(--muted);
  font-size: 12px;
}

.character-log-list {
  display: grid;
  gap: 7px;
  max-height: 360px;
  overflow: auto;
}

.character-log-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
}

.character-log-row.warn {
  border-color: rgba(251, 191, 36, 0.36);
}

.character-log-row.error {
  border-color: rgba(239, 68, 68, 0.42);
}

.character-log-row summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  color: var(--muted);
  font-size: 12px;
}

.character-log-row summary strong {
  color: var(--text);
  font-size: 12px;
}

.character-log-row summary b {
  color: var(--brand-2);
  text-transform: uppercase;
}

.character-log-row pre {
  max-height: 280px;
  overflow: auto;
  margin: 0;
  border-top: 1px solid var(--border);
  padding: 10px;
  color: #e5e7eb;
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
}

.character-output {
  margin: 0 14px 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
}

#characterGeneratedCanvas {
  width: min(100%, 520px);
  height: auto;
  display: block;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
}

.rule-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 10px;
}

.rule-card strong {
  display: block;
  margin-bottom: 5px;
  color: var(--brand-2);
}

.rule-card small {
  color: var(--muted);
}

.log-list {
  height: calc(100vh - 230px);
  overflow: auto;
  padding: 10px;
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 12px;
}

.log-row {
  border: 1px solid transparent;
  border-bottom-color: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.log-row[open] {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.035);
}

.log-row summary {
  display: grid;
  grid-template-columns: 86px 58px 110px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 9px;
  cursor: pointer;
}

.log-row summary::-webkit-details-marker {
  display: none;
}

.log-row summary strong {
  color: var(--text);
  font-weight: 700;
}

.log-row summary em {
  color: var(--muted);
  font-style: normal;
}

.log-row summary b {
  text-transform: uppercase;
}

.log-row pre {
  max-height: 340px;
  overflow: auto;
  margin: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  border-top: 1px solid var(--border);
  padding: 11px 13px;
  color: #dfe5ee;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-row .warn { color: var(--yellow); }
.log-row .error { color: var(--red); }
.log-row .info { color: var(--green); }

.settings-panel {
  max-width: 980px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.env-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.06);
  padding: 12px;
}

.env-panel strong {
  color: var(--green);
}

.env-panel span,
.env-panel small {
  color: var(--muted);
}

.settings-grid label {
  display: grid;
  gap: 6px;
}

.settings-grid span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.settings-actions {
  padding: 0 14px 14px;
}

.btn-primary,
.btn-secondary {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 8px;
  padding: 0 13px;
  font-weight: 800;
  white-space: nowrap;
}

.btn-secondary {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.btn-secondary.danger {
  border-color: color-mix(in srgb, var(--red) 42%, var(--border));
  color: var(--red);
}

.btn-secondary.danger:hover {
  background: color-mix(in srgb, var(--red) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--red) 70%, var(--border));
}

.status-text {
  color: var(--muted);
}

.agent-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(229, 106, 74, 0.8);
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-size: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.agent-panel {
  position: fixed;
  right: 24px;
  bottom: 94px;
  z-index: 31;
  width: min(520px, calc(100vw - 48px));
  height: min(720px, calc(100vh - 128px));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(31, 31, 30, 0.98);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

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

.agent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.agent-head strong,
.agent-head span {
  display: block;
}

.agent-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.skill-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}

.skill-chip {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  padding: 5px 9px;
  font-size: 11px;
}

.agent-messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.message {
  margin-bottom: 12px;
}

.bubble {
  max-width: 92%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 10px 12px;
  line-height: 1.55;
}

.message.user .bubble {
  margin-left: auto;
  border-color: rgba(229, 106, 74, 0.35);
  background: rgba(229, 106, 74, 0.14);
}

.message .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
}

.step {
  margin-top: 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.step summary {
  padding: 7px 9px;
  color: var(--brand-2);
  cursor: pointer;
}

.step pre {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  color: #ddd;
  font-size: 11px;
}

.agent-input-row {
  display: grid;
  grid-template-columns: 1fr 40px;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.58);
}

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

.modal {
  width: min(520px, calc(100vw - 48px));
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-soft);
  overflow: hidden;
}

.modal-head {
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-head > strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px;
  overflow: auto;
}

.thumb-prompt-modal {
  width: min(760px, calc(100vw - 32px));
}

.thumb-banana-modal {
  width: min(720px, calc(100vw - 32px));
}

.editor-draft-picker-modal {
  width: min(1120px, calc(100vw - 32px));
  max-height: min(860px, calc(100vh - 32px));
}

.editor-library-picker-modal {
  width: min(980px, calc(100vw - 32px));
  max-height: min(820px, calc(100vh - 32px));
}

.editor-hook-picker-modal {
  width: min(1060px, calc(100vw - 32px));
  max-height: min(840px, calc(100vh - 32px));
}

.editor-draft-picker-body {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.editor-draft-picker-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 150px 150px 140px 112px;
  gap: 8px;
}

.editor-draft-picker-toolbar input,
.editor-draft-picker-toolbar select {
  width: 100%;
  min-width: 0;
}

.editor-library-picker-body {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.editor-library-picker-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 118px;
  gap: 8px;
}

.editor-library-picker-toolbar input,
.editor-library-picker-toolbar select {
  width: 100%;
  min-width: 0;
}

.editor-library-picker-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}

.editor-library-card {
  min-width: 0;
  min-height: 207px;
  overflow: hidden;
  display: grid;
  grid-template-rows: 132px auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--text);
  padding: 0;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
  appearance: none;
}

.editor-library-card:hover {
  border-color: var(--brand);
  background: rgba(255, 255, 255, 0.045);
  transform: translateY(-1px);
}

.editor-library-card-preview {
  min-width: 0;
  display: grid;
  place-items: center;
  padding: 10px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.035) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.035) 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.editor-library-card-preview img {
  max-width: 100%;
  max-height: 112px;
  display: block;
  object-fit: contain;
}

.editor-library-card-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 9px 10px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.editor-library-card-copy strong,
.editor-library-card-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-library-card-copy strong {
  font-size: 12px;
}

.editor-library-card-copy small {
  color: var(--muted);
  font-size: 10px;
}

.editor-library-card-copy em {
  width: fit-content;
  max-width: 100%;
  padding: 3px 6px;
  border: 1px solid rgba(96, 165, 250, 0.22);
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.12);
  color: #93c5fd;
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}

.editor-library-picker-actions {
  justify-content: flex-end;
}

.editor-library-picker-actions #editorLibraryPickLocalBtn {
  margin-right: auto;
}

.editor-hook-picker-body {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.editor-hook-picker-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 150px 118px;
  gap: 8px;
}

.editor-hook-picker-toolbar input,
.editor-hook-picker-toolbar select {
  width: 100%;
  min-width: 0;
}

.editor-hook-formula-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}

.editor-hook-formula-card {
  min-width: 0;
  min-height: 132px;
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--formula-color, var(--brand));
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--text);
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.editor-hook-formula-card:hover,
.editor-hook-formula-card.active {
  border-color: var(--formula-color, var(--brand));
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

.editor-hook-formula-head {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.editor-hook-formula-head strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-hook-formula-head em {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--formula-color, var(--brand)) 22%, transparent);
  color: var(--text);
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.editor-hook-formula-card small,
.editor-hook-formula-card span:last-child {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.editor-hook-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  padding-top: 2px;
}

.editor-hook-compose label {
  display: grid;
  gap: 6px;
}

.editor-hook-compose label > span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.editor-hook-compose textarea {
  min-height: 62px;
  resize: vertical;
}

.editor-hook-result {
  grid-column: 1 / -1;
  min-height: 66px;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.editor-hook-result strong {
  color: var(--brand-2);
  font-size: 16px;
}

.editor-hook-result span,
.editor-hook-result small {
  color: var(--muted);
  line-height: 1.4;
}

.editor-hook-alts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.editor-hook-alt {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.1);
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
}

.editor-hook-picker-actions {
  justify-content: flex-end;
}

.editor-hook-picker-actions #editorGenerateHookBtn {
  margin-left: auto;
}

.editor-draft-picker-meta {
  min-height: 18px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.editor-draft-picker-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: max-content;
  gap: 10px;
  max-height: none;
  overflow: auto;
  padding-right: 2px;
}

.editor-draft-option {
  min-width: 0;
  min-height: 150px;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
}

.editor-draft-option:hover {
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(255, 255, 255, 0.045);
}

.editor-draft-option-preview {
  flex: 0 0 168px;
  width: 168px;
  min-width: 0;
  min-height: 148px;
  height: 100%;
  display: block;
  overflow: hidden;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: #060606;
  cursor: zoom-in;
}

.editor-draft-option-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.editor-draft-option-preview.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  cursor: default;
}

.editor-draft-option-body {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 148px;
  display: grid;
  grid-template-rows: auto auto minmax(34px, 1fr) auto;
  gap: 8px;
  padding: 10px;
}

.editor-draft-option-head {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.editor-draft-option-head strong,
.editor-draft-name-button {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-draft-name-button {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.editor-draft-name-button:hover {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.editor-draft-name-input {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  padding: 0 7px;
  font-size: 13px;
  font-weight: 800;
}

.editor-draft-option-head small {
  flex: 0 0 auto;
  color: var(--subtle);
  font-size: 10px;
}

.editor-draft-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.editor-draft-tag {
  max-width: 100%;
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.editor-draft-tag.layered { color: var(--yellow); border-color: rgba(250, 204, 21, 0.25); background: rgba(250, 204, 21, 0.09); }
.editor-draft-tag.workflow { color: var(--blue); border-color: rgba(96, 165, 250, 0.28); background: rgba(96, 165, 250, 0.1); }
.editor-draft-tag.design { color: #c4b5fd; border-color: rgba(196, 181, 253, 0.28); background: rgba(196, 181, 253, 0.1); }
.editor-draft-tag.loadable { color: var(--green); border-color: rgba(34, 197, 94, 0.25); background: rgba(34, 197, 94, 0.09); }
.editor-draft-tag.preview { color: #fca5a5; border-color: rgba(248, 113, 113, 0.25); background: rgba(248, 113, 113, 0.09); }
.editor-draft-tag.image,
.editor-draft-tag.text,
.editor-draft-tag.file { color: var(--muted); }

.editor-draft-option-body p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.editor-draft-option-actions {
  display: flex;
  gap: 7px;
  min-height: 34px;
}

.editor-draft-option-actions .btn-primary,
.editor-draft-option-actions .btn-secondary {
  min-width: 0;
  min-height: 32px;
  padding: 0 10px;
}

.editor-draft-picker-actions {
  justify-content: center;
}

.editor-draft-picker-actions #editorCreateBlankDraftBtn {
  margin-right: auto;
}

.editor-new-draft-name-modal {
  width: min(520px, calc(100vw - 32px));
}

.editor-new-draft-name-body {
  display: grid;
  gap: 12px;
}

.editor-new-draft-name-body label {
  display: grid;
  gap: 8px;
}

.editor-new-draft-name-body label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.editor-new-draft-name-body input {
  width: 100%;
}

.editor-new-draft-name-actions {
  justify-content: flex-end;
}

.editor-new-draft-name-actions #editorNewDraftAutoNameBtn {
  margin-right: auto;
}

.thumb-banana-body {
  display: grid;
  gap: 14px;
}

.banana-mode-segment {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 4px;
}

.banana-mode-btn {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.banana-mode-btn.active {
  background: rgba(229, 106, 74, 0.2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(243, 161, 95, 0.34);
}

.banana-reference-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.banana-reference-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.banana-reference-row strong {
  flex: 0 0 auto;
  color: var(--green);
}

.banana-reference-row strong.bad {
  color: var(--red);
}

.thumb-banana-body label {
  display: grid;
  gap: 8px;
}

.thumb-banana-body label > span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.thumb-banana-body textarea {
  min-height: 160px;
  resize: vertical;
  line-height: 1.5;
}

body.theme-apple .banana-mode-segment {
  border-color: rgba(229, 231, 235, 0.92);
  background: rgba(255, 255, 255, 0.52);
}

body.theme-apple .banana-mode-btn.active {
  background: rgba(219, 234, 254, 0.88);
  color: #0f172a;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.24);
}

.thumb-prompt-body {
  display: grid;
  gap: 10px;
}

.thumb-prompt-body label {
  display: grid;
  gap: 8px;
}

.thumb-prompt-body label span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.thumb-prompt-body textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.5;
}

.thumb-prompt-body small {
  color: var(--muted);
  line-height: 1.45;
}

.version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.version-row span {
  color: var(--muted);
}

.modal-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
  padding: 0 14px 14px;
}

.modal-actions.compact {
  padding: 0;
}

.image-preview-modal {
  width: min(1120px, calc(100vw - 36px));
}

.image-preview-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  max-height: calc(100vh - 180px);
  padding: 14px;
  overflow: auto;
  background:
    linear-gradient(45deg, rgba(255,255,255,0.045) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,0.045) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.045) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.045) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.image-preview-body img {
  max-width: 100%;
  max-height: calc(100vh - 220px);
  display: block;
  border: 1px solid var(--border);
  border-radius: 8px;
  object-fit: contain;
}

@media (max-width: 900px) {
  .topbar { flex-direction: column; }
  .top-actions { flex-wrap: wrap; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-view.active { display: block; }
  .editor-view.active,
  .editor-view.active.tools-collapsed {
    display: block;
  }
  .editor-tools-panel,
  .editor-tools-panel.collapsed {
    margin-top: 16px;
  }
  .editor-tools-panel.collapsed .panel-title {
    min-height: 50px;
    align-items: center;
    justify-content: flex-end;
  }
  .character-workbench {
    grid-template-columns: 1fr;
  }
  .attraction-suggestions,
  .attraction-formula-grid {
    grid-template-columns: 1fr;
  }
  .thumb-analysis-body {
    grid-template-columns: 1fr;
  }
  .settings-grid { grid-template-columns: 1fr; }
  .comment-analysis-view.active { display: block; }
  .comment-analysis-view .panel + .panel { margin-top: 16px; }
  .comment-mine-form { grid-template-columns: 1fr 1fr; }
  .comment-mine-form input { grid-column: 1 / -1; }
  .comment-mine-form button { grid-column: 1 / -1; }
  .comment-toolbar { grid-template-columns: 1fr; }
  .comment-filter-segments button { flex: 1; }
  .comment-session-list,
  .comment-rows { max-height: none; }
  .editor-draft-picker-toolbar { grid-template-columns: 1fr 1fr; }
  .editor-draft-picker-toolbar input { grid-column: 1 / -1; }
  .editor-draft-picker-grid { grid-template-columns: 1fr; }
  .editor-library-picker-toolbar { grid-template-columns: 1fr; }
  .editor-library-picker-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
  .editor-hook-picker-toolbar { grid-template-columns: 1fr; }
  .editor-hook-formula-grid { grid-template-columns: 1fr; }
  .editor-hook-compose { grid-template-columns: 1fr; }
  .gradient-builder { grid-template-columns: 1fr; }
  .gradient-builder-controls { grid-template-columns: 1fr 1fr; }
  .draft-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .draft-picker-trigger {
    flex-basis: 100%;
    max-width: none;
  }
  .editor-draft-picker-toolbar { grid-template-columns: 1fr; }
  .editor-draft-option {
    flex-direction: column;
    min-height: 0;
  }
  .editor-draft-option-preview {
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .editor-draft-option-preview img {
    height: 100%;
    min-height: 0;
  }
  .draft-library-head { align-items: start; flex-direction: column; }
  .draft-library-counts { width: 100%; overflow-x: auto; }
  .toolbar.draft-toolbar { grid-template-columns: minmax(0, 1fr) 44px; }
  .toolbar.draft-toolbar input { width: 100%; grid-column: 1 / -1; }
  .toolbar.draft-toolbar select { width: 100%; }
  .draft-grid { grid-template-columns: 1fr; }
  .draft-card-body p { min-height: 0; }
  .gradient-builder-controls,
  .gradient-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .editor-draft-option {
    min-height: 150px;
    flex-direction: row;
  }

  .editor-draft-option-preview {
    flex: 0 0 150px;
    width: 150px;
    height: 100%;
    min-height: 148px;
    aspect-ratio: auto;
    border-right: 1px solid var(--border);
    border-bottom: 0;
  }

  .editor-draft-option-preview img {
    height: 100%;
  }
}

@media (max-width: 480px) {
  .editor-draft-option {
    min-height: 0;
    flex-direction: column;
  }

  .editor-draft-option-preview {
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .editor-draft-option-preview img {
    height: 100%;
  }
}
