:root {
  --bg: #07080a;
  --panel: rgba(13, 17, 22, 0.92);
  --panel-strong: rgba(18, 24, 32, 0.97);
  --line: rgba(131, 164, 194, 0.18);
  --text: #edf3f8;
  --muted: #9caab5;
  --hot: #ff6b2c;
  --ice: #79c2ff;
  --acid: #b5ff6d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Lucida Sans Unicode", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 107, 44, 0.16), transparent 26%),
    radial-gradient(circle at top right, rgba(121, 194, 255, 0.14), transparent 28%),
    linear-gradient(160deg, #050608 0%, #0b1015 48%, #10161d 100%);
}
button, input, select, textarea { font: inherit; }
.page-shell { max-width: 1720px; margin: 0 auto; padding: 10px 10px 20px; }
.panel { border: 1px solid var(--line); border-radius: 22px; background: var(--panel); backdrop-filter: blur(16px); box-shadow: var(--shadow); }
.topbar {
  position: relative;
  z-index: 100000;
  overflow: visible;
  min-height: 78px;
  padding: 10px 16px;
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.3fr);
  gap: 12px;
  align-items: center;
}
.brand-lockup { display: flex; flex-direction: column; gap: 4px; }
.brand-home-button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  cursor: pointer;
}
.brand-home-button:hover h1,
.brand-home-button:focus-visible h1 { color: var(--ice); }
.brand-row { display: flex; flex-direction: column; gap: 5px; }
.eyebrow { margin: 0; font-family: Impact, "Arial Narrow Bold", sans-serif; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ice); font-size: 0.68rem; }
h1, h2, .panel-title { font-family: Impact, "Franklin Gothic Medium", sans-serif; letter-spacing: 0.03em; }
h1 { margin: 0; font-size: clamp(1.42rem, 2.8vw, 2.42rem); line-height: 0.9; }
h2 { margin: 0; font-size: clamp(1.1rem, 2vw, 1.55rem); }
.lede { margin: 0; color: var(--muted); font-size: 0.82rem; max-width: 56ch; line-height: 1.32; }
.header-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-strong);
}
.toolbar-pill, .auth-chip, .status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.toolbar-status strong {
  color: var(--text);
  font-size: 0.76rem;
  letter-spacing: 0;
}
.toolbar-label { color: var(--muted); }
.badge-live { color: #09110b; background: var(--acid); border-color: transparent; }
.tab, .toolbar-action { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.tab.is-active { border-color: transparent; background: linear-gradient(135deg, var(--hot), #ff954f); color: #130904; }
.user-menu {
  position: relative;
  display: inline-flex;
  z-index: 100000;
}
.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 100001;
  display: grid;
  gap: 6px;
  min-width: 190px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(12, 18, 28, 0.98);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.48);
}
.user-menu-panel.hidden,
.user-menu.hidden {
  display: none !important;
}
.user-menu-item {
  width: 100%;
  justify-content: flex-start;
}
.toolbar-action { font-size: 0.74rem; }
.main-grid { margin-top: 10px; }
.bottom-status-dock {
  margin-top: 10px;
  padding: 8px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: center;
  background: rgba(13, 17, 22, 0.82);
}
.workspace { padding: 10px; }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }
body.canvas-workspace-active #canvas-workspace-view:not(.hidden) {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  max-height: calc(100dvh - 132px);
  padding: 12px;
}
body.canvas-workspace-active #canvas-workspace-view .mode-card-head {
  margin-bottom: 10px;
}
.chat-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-items: stretch; min-height: 0; }
body.text-workspace-active #tab-text.is-active {
  display: grid;
  grid-template-columns: minmax(240px, 310px) minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}
body.text-workspace-active #text-dashboard-view .mode-card {
  height: min(81vh, calc(100vh - 192px));
  display: flex;
  flex-direction: column;
  gap: 10px;
}
body.text-workspace-active #text-workspace-view .section-nav-row {
  display: none;
}
body.text-workspace-active #text-conversation-list {
  flex: 1;
  min-height: 0;
}
body.text-workspace-active #text-workspace-view {
  min-width: 0;
}
.chat-column { display: flex; flex-direction: column; min-height: 0; height: min(81vh, calc(100vh - 192px)); max-height: min(81vh, calc(100vh - 192px)); }
.thread-wrap, .composer-wrap, .mode-card, .knowledge-item, .control-rail {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-strong);
}
.thread-wrap { flex: 1; min-height: 0; padding: 14px; overflow-y: auto; }
.chat-thread { display: flex; flex-direction: column; gap: 12px; }
.empty-thread { padding: 16px; border-radius: 16px; border: 1px dashed var(--line); color: var(--muted); line-height: 1.45; }
.chat-message { padding: 14px 16px; border-radius: 18px; line-height: 1.58; white-space: pre-wrap; }
.chat-message-user { align-self: flex-end; max-width: 90%; background: linear-gradient(135deg, rgba(255, 107, 44, 0.2), rgba(255, 149, 79, 0.14)); border: 1px solid rgba(255, 107, 44, 0.28); }
.chat-message-assistant { align-self: flex-start; width: min(100%, 1180px); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.chat-message-pending { border-style: dashed; }
.chat-message-error { border-color: rgba(255, 107, 44, 0.45); background: rgba(255, 107, 44, 0.08); }
.chat-role { display: block; margin-bottom: 8px; color: var(--ice); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; }
.chat-message-meta {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(121, 194, 255, 0.18);
  color: var(--muted);
  font-size: 0.78rem;
}
.thinking-line { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.thinking-dots { display: inline-flex; gap: 6px; }
.thinking-dots span { width: 8px; height: 8px; border-radius: 999px; background: var(--ice); animation: blink 1s infinite ease-in-out; }
.thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.3s; }
.composer-wrap { margin-top: 8px; padding: 10px 12px 12px; position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(18, 24, 32, 0.95), rgba(14, 18, 24, 0.99)); }
.composer-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; color: var(--muted); font-size: 0.78rem; }
.composer-head-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.status-dock { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.status-chip { font-size: 0.68rem; }
.status-chip-live { color: var(--ice); }
.status-chip-model { max-width: min(32vw, 320px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; letter-spacing: 0.01em; }
.composer-state { white-space: nowrap; }
.composer-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
#prompt-input { min-height: 96px; max-height: min(46vh, 420px); resize: vertical; }
.control-rail { display: flex; flex-direction: column; gap: 10px; padding: 12px 10px 12px 12px; min-height: 0; height: min(81vh, calc(100vh - 192px)); max-height: min(81vh, calc(100vh - 192px)); overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-gutter: stable; }
.control-rail > * { min-width: 0; flex: 0 0 auto; }
.rail-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 2px 2px 0; }
.rail-label { margin: 0 0 4px; color: var(--ice); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; }
.rail-button { padding-inline: 12px; }
.rail-section { border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 255, 255, 0.03); overflow: visible; flex: 0 0 auto; }
.rail-section summary { display: flex; justify-content: space-between; gap: 10px; align-items: center; cursor: pointer; list-style: none; padding: 12px 14px; font-family: Impact, "Franklin Gothic Medium", sans-serif; letter-spacing: 0.03em; }
.rail-section summary::-webkit-details-marker { display: none; }
.rail-section summary span:last-child { color: var(--muted); font-family: "Trebuchet MS", "Lucida Sans Unicode", sans-serif; font-size: 0.78rem; letter-spacing: 0; }
.rail-section-body { display: flex; flex-direction: column; gap: 10px; padding: 0 14px 14px; }
.rail-section-body > * { min-width: 0; }
.auth-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.auth-action-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.auth-action-row .send-button, .auth-action-row .ghost-button { width: 100%; min-width: 0; }
.auth-action-row.auth-action-row-signed-in { grid-template-columns: 1fr; }
.auth-note { padding-top: 2px; }
body.signed-out-shell .header-toolbar { display: none; }
body.signed-out-shell .bottom-status-dock { display: none; }
body.signed-out-shell .context-help-button { display: none; }
body.signed-out-shell .topbar { grid-template-columns: 1fr; justify-items: center; text-align: center; }
body.signed-out-shell .brand-lockup { align-items: center; }
body.signed-out-shell .lede { max-width: 62ch; }
body.signed-out-shell .chat-column { display: none; }
body.signed-out-shell .chat-layout { grid-template-columns: minmax(320px, 560px); justify-content: center; }
body.signed-out-shell .workspace { padding: 22px 12px; }
body.signed-out-shell .control-rail { width: min(100%, 560px); height: auto; max-height: none; margin: 0 auto; }
body.signed-out-shell .rail-top,
body.signed-out-shell .control-rail .rail-section:not(:first-of-type) { display: none; }
body.signed-out-shell .auth-action-row { grid-template-columns: 1fr; }
body.signed-out-shell .auth-chip { background: rgba(255, 107, 44, 0.12); }
.auth-create-panel { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px dashed rgba(121, 194, 255, 0.16); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span, .field-inline span { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; }
.field-help { color: var(--muted); font-size: 0.72rem; line-height: 1.35; text-transform: none; letter-spacing: 0; }
textarea, input[type="number"], input[type="text"], input[type="password"], select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 12px 14px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
textarea.tom2-autogrow-textarea { overflow-y: hidden; transition: height 120ms ease; }
select {
  appearance: none;
  color-scheme: dark;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
select option, select optgroup {
  background: #16202b;
  color: var(--text);
}
.compact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.image-tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.image-settings-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}
input[type="range"] { flex: 1; accent-color: var(--hot); }
.send-button, .action-link, .ghost-button {
  border-radius: 16px;
  padding: 10px 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
}
.send-button, .action-link { border: 0; background: linear-gradient(135deg, var(--ice), #d7f0ff); color: #071015; }
.ghost-button { border: 1px solid var(--line); background: transparent; color: var(--text); }
.ghost-link { color: var(--text); background: rgba(255, 255, 255, 0.03); }
.send-button:disabled, .ghost-button:disabled { opacity: 0.5; cursor: not-allowed; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; }
.canvas-recovery-banner {
  display: block;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid rgba(142, 209, 255, 0.42);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(142, 209, 255, 0.14), rgba(255, 122, 47, 0.08));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  position: relative;
  z-index: 4;
  clear: both;
}
.canvas-recovery-banner strong { display: block; color: var(--text); }
.canvas-recovery-banner span { color: var(--muted); font-size: 0.9rem; }
.canvas-recovery-banner .action-row {
  justify-content: flex-end;
  min-width: 0;
}
.canvas-recovery-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 24px;
  border: 0;
  border-radius: 0;
  background: rgba(4, 9, 14, 0.72);
  box-shadow: none;
  backdrop-filter: blur(8px);
}
.canvas-recovery-dialog {
  width: min(560px, calc(100vw - 32px));
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(142, 209, 255, 0.42);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(17, 24, 33, 0.98), rgba(24, 33, 44, 0.98));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}
.sidebar-copy, #auth-feedback, .mode-card p, .knowledge-item p, .mode-card-copy { color: var(--muted); line-height: 1.45; margin: 0; }
.rail-actions { gap: 8px; }
.auth-action-row #logout-button:not(.hidden) { grid-column: 1 / -1; }
.auth-nav-button {
  border-color: rgba(121, 194, 255, 0.32);
}
.text-brain-card {
  border-radius: 16px;
  background: rgba(121, 194, 255, 0.045);
}
.text-brain-card summary {
  padding: 10px 12px;
}
.text-brain-card .rail-section-body {
  padding: 0 12px 12px;
}
.text-brain-quick-grid {
  grid-template-columns: 1fr;
}
.tone-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 4px 0 8px;
  padding: 4px;
  border: 1px solid rgba(121, 194, 255, 0.22);
  border-radius: 999px;
  background: rgba(5, 10, 16, 0.42);
}
.tone-toggle-button {
  border: 1px solid transparent;
  border-radius: 999px;
  min-height: 36px;
  padding: 8px 12px;
  color: var(--muted);
  background: transparent;
  font-family: inherit;
  font-weight: 900;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.tone-toggle-button:hover,
.tone-toggle-button:focus-visible {
  color: var(--text);
  border-color: rgba(121, 194, 255, 0.35);
}
.tone-toggle-button.is-active {
  color: #08111a;
  border-color: rgba(170, 219, 255, 0.85);
  background: linear-gradient(135deg, #a6d9ff, #ff7b38);
  box-shadow: 0 10px 28px rgba(255, 123, 56, 0.22);
}
.text-new-chat-row {
  display: block;
}
.text-new-chat-row .send-button {
  width: 100%;
}
.text-world-search-field {
  margin-top: 0;
}
.conversation-list, .knowledge-list { display: flex; flex-direction: column; gap: 8px; }
.conversation-item, .knowledge-item {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  text-align: left;
}
.conversation-item strong, .knowledge-item strong { display: block; font-size: 0.92rem; }
.conversation-item span, .knowledge-meta { display: block; margin-top: 5px; color: var(--muted); font-size: 0.76rem; }
.conversation-item.is-active { border-color: rgba(121, 194, 255, 0.52); background: rgba(121, 194, 255, 0.12); }
.training-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 8px 0 2px; }
.hidden { display: none; }
.hidden-file-input { display: none; }
.section-view.hidden { display: none !important; }
.mode-card { padding: 18px; }
.mode-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.mode-card-head h2,
.mode-card-head h3,
.rail-section summary span:first-child,
.settings-section-tab,
.admin-section-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.context-help-button {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(121, 194, 255, 0.42);
  border-radius: 999px;
  background: rgba(121, 194, 255, 0.08);
  color: var(--ice);
  font-weight: 900;
  cursor: pointer;
  line-height: 1;
  flex: 0 0 auto;
}
.context-help-button:hover,
.context-help-button:focus-visible {
  border-color: transparent;
  background: var(--ice);
  color: #071015;
}
.help-tooltip-popover {
  position: fixed;
  z-index: 1000;
  width: min(310px, calc(100vw - 20px));
  padding: 12px;
  border: 1px solid rgba(121, 194, 255, 0.35);
  border-radius: 16px;
  background: rgba(10, 15, 21, 0.98);
  box-shadow: var(--shadow);
}
.help-tooltip-popover strong { display: block; margin-bottom: 5px; }
.help-tooltip-popover p { margin: 0 0 10px; color: var(--muted); line-height: 1.4; font-size: 0.82rem; }
.help-layout {
  display: grid;
  grid-template-columns: minmax(250px, 340px) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}
.help-sidebar,
.help-article {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}
.help-sidebar {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(76vh, 820px);
  min-height: 0;
}
.help-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
}
.help-category-label {
  margin-top: 8px;
  color: var(--ice);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.help-card {
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  cursor: pointer;
}
.help-card.is-active {
  border-color: rgba(255, 107, 44, 0.55);
  background: rgba(255, 107, 44, 0.11);
}
.help-card strong,
.help-card span {
  display: block;
}
.help-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}
.help-status {
  color: var(--muted);
  font-size: 0.78rem;
}
.help-article {
  padding: 18px;
  max-height: min(76vh, 820px);
  overflow-y: auto;
}
.help-article-head {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.help-article-head p:last-child {
  color: var(--muted);
  line-height: 1.5;
}
.help-article-section {
  scroll-margin-top: 20px;
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid rgba(121, 194, 255, 0.13);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
}
.help-article-section h3 {
  margin: 0 0 10px;
}
.help-article-section li {
  margin-bottom: 8px;
  line-height: 1.5;
}
.section-dashboard { display: grid; gap: 12px; }
.section-nav-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  grid-column: 1 / -1;
}
.dashboard-list {
  display: grid;
  gap: 10px;
  max-height: min(68vh, 720px);
  overflow: auto;
  padding-right: 4px;
}
.dashboard-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.media-dashboard-grid[data-thumb-size="small"] { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.media-dashboard-grid[data-thumb-size="medium"] { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.media-dashboard-grid[data-thumb-size="large"] { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.dashboard-row,
.dashboard-card-button {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  padding: 12px 14px;
}
.dashboard-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.dashboard-row-main { min-width: 0; flex: 1; }
.dashboard-row-main strong,
.dashboard-row-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.media-dashboard-card {
  align-items: stretch;
  min-height: 122px;
}
.object-thumb {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(121, 194, 255, 0.08);
  display: grid;
  place-items: center;
  color: var(--ice);
  font-family: Impact, "Franklin Gothic Medium", sans-serif;
  letter-spacing: 0.05em;
}
.object-thumb-small { width: 72px; height: 72px; }
.object-thumb-medium { width: 104px; height: 104px; }
.object-thumb-large { width: 150px; height: 150px; }
.object-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; background: rgba(0, 0, 0, 0.22); }
.object-thumb-folder {
  background: linear-gradient(135deg, rgba(121, 194, 255, 0.16), rgba(255, 178, 87, 0.12));
}
.explorer-dashboard {
  display: block;
}
.explorer-shell {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.explorer-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
}
.explorer-path {
  flex: 1 1 220px;
  min-width: 180px;
  color: var(--ice);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.explorer-sort {
  width: auto;
  min-height: 36px;
}
.explorer-status {
  color: var(--muted);
  font-size: 0.78rem;
}
.explorer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  max-height: min(62vh, 680px);
  overflow: auto;
  padding-right: 4px;
}
.explorer-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  padding: 10px;
  min-width: 0;
}
.explorer-card.is-selected {
  border-color: rgba(173, 255, 102, 0.55);
  background: rgba(173, 255, 102, 0.08);
}
.explorer-card-main {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  display: grid;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}
.explorer-card-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.explorer-card-main em {
  color: var(--muted);
  font-style: normal;
  font-size: 0.74rem;
  overflow-wrap: anywhere;
}
.explorer-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  margin-bottom: 6px;
}
.explorer-checkbox input {
  width: auto;
  min-height: 16px;
}
.explorer-load-more {
  justify-self: center;
}
.folder-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.72);
}
.folder-picker {
  width: min(820px, 94vw);
  max-height: 86vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #101821;
  padding: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}
.asset-picker {
  width: min(1080px, 96vw);
}
.folder-picker-grid {
  max-height: min(54vh, 520px);
}
.text-explorer-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}
.text-explorer-tools strong {
  flex: 1 1 100%;
  color: var(--ice);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.video-lab-grid {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.8rem;
}
.video-lab-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(12, 18, 28, 0.84);
  padding: 0.85rem;
}
.video-lab-card video,
.video-lab-card img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 12px;
  background: #05080d;
}
.dashboard-row strong,
.dashboard-card-button strong {
  display: block;
  font-size: 0.92rem;
}
.dashboard-row span,
.dashboard-card-button span,
.dashboard-card-button em {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-style: normal;
}
.dashboard-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.dashboard-card-button {
  min-height: 118px;
  text-align: left;
  cursor: pointer;
}
.dashboard-card-button:hover,
.dashboard-row:hover {
  border-color: rgba(121, 194, 255, 0.45);
  background: rgba(121, 194, 255, 0.08);
}
.audio-dashboard-worlds,
.audio-dashboard-library-head {
  display: grid;
  gap: 10px;
}
.audio-dashboard-world-head {
  margin-bottom: 0;
}
.audio-world-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.audio-world-card {
  min-height: 132px;
}
.audio-dashboard-library-head {
  margin-top: 8px;
}
.bounded-list { max-height: min(58vh, 620px); overflow: auto; padding-right: 4px; }
.asset-browser-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}
.asset-browser-head span { color: var(--muted); font-size: 0.82rem; }
.asset-browser-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}
.universal-picker-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  max-height: min(58vh, 560px);
}
.asset-browser-tile {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  padding: 12px;
  text-align: left;
  display: grid;
  gap: 7px;
  min-height: 132px;
}
.asset-browser-tile.is-selected,
.asset-picker-item.is-selected {
  border-color: rgba(173, 255, 102, 0.7);
  background: rgba(173, 255, 102, 0.1);
  box-shadow: inset 0 0 0 1px rgba(173, 255, 102, 0.28);
}
.asset-browser-tile strong { font-size: 0.9rem; }
.asset-browser-tile em { color: var(--muted); font-style: normal; font-size: 0.76rem; }
.object-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(121, 194, 255, 0.08);
  color: var(--ice);
  font-size: 0.72rem;
  font-weight: 900;
  overflow: hidden;
}
.object-icon img { width: 100%; height: 100%; object-fit: cover; }
.backup-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.image-layout { display: grid; grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.35fr); gap: 12px; align-items: start; }
.bug-layout { display: grid; grid-template-columns: minmax(320px, 0.92fr) minmax(0, 1.08fr); gap: 12px; align-items: start; }
.code-layout { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.image-upscale-layout { grid-template-columns: minmax(320px, 0.92fr) minmax(0, 1.08fr); }
.video-layout { display: grid; grid-template-columns: minmax(320px, 0.92fr) minmax(0, 1.08fr); gap: 12px; }
.soundtrack-lab-grid { display: grid; grid-template-columns: minmax(320px, 0.92fr) minmax(0, 1.08fr); gap: 12px; }
.audio-tab-shell { display: flex; flex-direction: column; gap: 12px; }
.image-tab-shell { display: flex; flex-direction: column; gap: 12px; }
.image-section-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 2px 0; }
.image-section-tab { border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); color: var(--text); padding: 10px 14px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer; }
.image-section-tab.is-active { border-color: transparent; background: linear-gradient(135deg, var(--hot), #ff954f); color: #130904; }
.image-section-panel { display: none; }
.image-section-panel.is-active { display: block; }
.image-section-panel .mode-card:first-child { margin-top: 0; }
.audio-section-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 2px 0; }
.audio-section-tab { border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); color: var(--text); padding: 10px 14px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer; }
.audio-section-tab.is-active { border-color: transparent; background: linear-gradient(135deg, var(--hot), #ff954f); color: #130904; }
.audio-section-panel { display: none; }
.audio-section-panel.is-active { display: block; }
.audio-section-panel .mode-card:first-child { margin-top: 0; }
.audio-section-panel > * { margin-top: 0; }
.audio-voices-layout { display: grid; grid-template-columns: minmax(320px, 1.18fr) minmax(280px, 0.82fr); gap: 12px; align-items: start; }
.admin-tab-shell { display: flex; flex-direction: column; gap: 12px; }
.admin-section-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 2px 0; }
.admin-section-tab { border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); color: var(--text); padding: 10px 14px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer; }
.admin-section-tab.is-active { border-color: transparent; background: linear-gradient(135deg, var(--ice), #d7f0ff); color: #071015; }
.admin-section-panel { display: none; }
.admin-section-panel.is-active { display: block; }
.settings-section-panel { display: none; }
.settings-section-panel.is-active { display: block; }
.settings-section-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.settings-section-tab { border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); color: var(--text); padding: 10px 14px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer; }
.settings-section-tab.is-active { border-color: transparent; background: linear-gradient(135deg, var(--ice), #d7f0ff); color: #071015; }
.admin-tab-feedback { margin: 0 2px; }
.soundtrack-lab-builder, .soundtrack-project-column, .soundtrack-project-board, .audio-collection-column, .audio-collection-board { min-height: 100%; }
.image-builder, .image-gallery-card, .video-builder, .video-board, .bug-builder-card, .bug-board-card, .code-builder-card, .code-workspace-card { min-height: auto; }
.image-upscale-builder { gap: 12px; }
.image-action-bar { align-items: flex-end; }
.compact-field { min-width: 144px; }
.image-variant-field select { min-width: 132px; }
.image-gallery-card { display: flex; flex-direction: column; gap: 12px; }
.image-aspect-buttons, .quick-prompt-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.aspect-button, .quick-prompt-button {
  font-size: 0.78rem;
  padding: 9px 12px;
}
.aspect-button.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, rgba(255, 107, 44, 0.92), rgba(255, 149, 79, 0.88));
  color: #130904;
}
.quick-prompt-field { gap: 8px; }
.image-jobs-grid, .audio-jobs-grid, .audio-assets-grid, .audio-profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.image-jobs-grid.media-chat-thread,
.video-jobs-grid.media-chat-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: min(58vh, 640px);
  overflow: auto;
}
.image-jobs-grid.media-viewer-thread,
.video-jobs-grid.media-viewer-thread {
  display: block;
}
.media-chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.media-chat-composer textarea {
  min-height: 112px;
  resize: vertical;
}
.media-chat-composer .send-button {
  min-height: 48px;
  padding-inline: 20px;
}
.code-desktop-status:empty {
  display: none;
}
.soundtrack-selected-wrap {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}
.soundtrack-selected-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 10px;
}
.soundtrack-selected-head span {
  color: var(--muted);
  font-size: 0.78rem;
}
.soundtrack-selected-assets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.soundtrack-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}
.soundtrack-chip strong {
  font-size: 0.82rem;
}
.soundtrack-chip span {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.soundtrack-project-column, .audio-collection-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.soundtrack-project-board {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.soundtrack-brief-text {
  margin-top: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  color: var(--text);
  line-height: 1.55;
  font-size: 0.92rem;
}
.image-job-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.image-job-card.is-pending { border-style: dashed; }
.image-job-card.is-selected { border-color: rgba(121, 194, 255, 0.5); box-shadow: inset 0 0 0 1px rgba(121, 194, 255, 0.18); }
.image-job-card.is-failed { border-color: rgba(255, 107, 44, 0.45); }
.image-job-preview {
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, rgba(121, 194, 255, 0.12), rgba(255, 107, 44, 0.12));
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.image-job-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.video-job-preview video, .video-job-preview audio, .audio-preview-card audio {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

.audio-preview-card {
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, rgba(121, 194, 255, 0.12), rgba(255, 107, 44, 0.12));
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 14px;
}
.audio-download-link {
  align-self: flex-start;
}
.audio-warning {
  color: #ffb59a;
}
.field.is-disabled {
  opacity: 0.6;
}
.field.is-disabled input {
  cursor: not-allowed;
}
.compact-note {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: -2px;
}
.range-field-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 10px;
  align-items: center;
}
.range-field-control input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}
.range-field-control input[type="number"] {
  text-align: right;
}
.compact-range-field {
  min-width: 0;
}
.compact-range-field > span {
  display: block;
  margin-bottom: 6px;
}
.compact-range-field .range-field-control {
  grid-template-columns: minmax(0, 1fr) 70px;
}
.media-viewer-card,
.chat-media-result {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.025);
}
.media-viewer-stage {
  min-height: min(74vh, 760px);
  display: grid;
  place-items: center;
  padding: 12px;
  background:
    radial-gradient(circle at 30% 20%, rgba(121, 194, 255, 0.12), transparent 28%),
    radial-gradient(circle at 70% 80%, rgba(255, 107, 44, 0.12), transparent 32%),
    rgba(0, 0, 0, 0.28);
}
.media-viewer-stage img,
.media-viewer-stage video {
  max-width: 100%;
  max-height: min(74vh, 760px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 14px;
}
.media-viewer-meta {
  padding: 12px 14px 0;
}
.media-viewer-meta h3 {
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}
.chat-media-result {
  margin-top: 12px;
  max-width: min(100%, 760px);
}
.chat-media-result img,
.chat-media-result video {
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  display: block;
  background: rgba(0, 0, 0, 0.22);
}
.chat-media-pending {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border-style: dashed;
}
.audio-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}
.audio-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.audio-progress-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(121, 194, 255, 0.9), rgba(187, 255, 83, 0.95));
  box-shadow: 0 0 12px rgba(121, 194, 255, 0.28);
  transition: width 0.35s ease;
}
.audio-progress-copy {
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.45;
}

.audio-ingest-card, .soundtrack-lab-card, .riff-tank-card { margin-top: 12px; }
.image-upscale-preview-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.025);
}
.image-upscale-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 280px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(121, 194, 255, 0.12), rgba(255, 107, 44, 0.12));
  color: var(--muted);
  text-align: center;
}
.image-upscale-preview img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(52vh, 520px);
  object-fit: contain;
  display: block;
  border-radius: 14px;
}
.image-upscale-preview span {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  line-height: 1.45;
}
.audio-batch-toolbar { margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 255, 255, 0.025); display: flex; flex-direction: column; gap: 10px; }
.audio-batch-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.audio-batch-head span { color: var(--muted); font-size: 0.8rem; }
.audio-batch-actions { align-items: center; }
.soundtrack-project-card .image-job-body { gap: 8px; }
.field-toggle { justify-content: flex-end; }
.field-toggle input { width: auto; min-height: 20px; }
.audio-collection-board { display: grid; grid-template-columns: 1fr; gap: 12px; }
.image-job-preview span {
  padding: 20px;
  color: var(--muted);
  text-align: center;
}
.image-job-body { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 14px; }
.image-job-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.image-job-top strong { font-size: 0.95rem; line-height: 1.25; }
.image-job-meta { color: var(--muted); font-size: 0.78rem; line-height: 1.4; }
.image-job-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.image-job-actions .danger-button { border-color: rgba(255, 107, 44, 0.28); color: #ffb59a; }
.image-job-actions .danger-button:hover { background: rgba(255, 107, 44, 0.16); color: #fff1eb; }
.image-job-actions .ghost-button, .image-job-actions .action-link { font-size: 0.76rem; padding: 8px 11px; }
.image-job-actions .ghost-button.is-selected { border-color: rgba(121, 194, 255, 0.52); background: rgba(121, 194, 255, 0.12); color: var(--ice); }
.job-status { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; border: 1px solid var(--line); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; }
.job-status.status-queued, .job-status.status-running { color: var(--ice); }
.job-status.status-completed { color: var(--acid); }
.job-status.status-failed { color: #ff9d79; }

@keyframes blink {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
  40% { transform: translateY(-4px); opacity: 1; }
}

@media (max-width: 1360px) {
  .chat-layout { grid-template-columns: minmax(0, 1fr); }
  .image-layout, .video-layout, .soundtrack-lab-grid, .audio-voices-layout, .admin-layout, .admin-layout-bottom, .admin-system-grid, .admin-activity-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1220px) {
  .topbar, .chat-layout { grid-template-columns: 1fr; }
  .header-toolbar { justify-content: flex-start; }
  .chat-column, .control-rail { min-height: 72vh; height: auto; max-height: none; }
  .thread-wrap { max-height: 58vh; }
}

@media (max-width: 720px) {
  .page-shell { padding: 8px; }
  .topbar, .workspace, .control-rail, .mode-card { padding: 12px; }
  .brand-row, .composer-row, .header-toolbar, .action-row, .compact-grid, .training-grid, .image-settings-grid, .image-tool-grid, .image-aspect-buttons, .quick-prompt-row, .video-settings-grid { display: flex; flex-direction: column; align-items: stretch; }
  .composer-head, .composer-head-right, .mode-card-head { flex-direction: column; align-items: flex-start; }
  .help-layout { grid-template-columns: 1fr; }
  .help-sidebar, .help-article { max-height: none; }
  .status-dock { justify-content: flex-start; }
  .status-chip-model { max-width: 100%; white-space: normal; }
  .chat-message-user, .chat-message-assistant { max-width: 100%; width: 100%; }
  .rail-top, .rail-section summary { flex-direction: column; align-items: flex-start; }
}


.voice-builder-card { margin-top: 12px; }
.voice-builder-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr); gap: 12px; }
.voice-builder-main, .voice-builder-side { display: flex; flex-direction: column; gap: 10px; }
.voice-builder-headline { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,0.03); }
.voice-builder-headline strong { font-size: 0.92rem; }
.voice-builder-headline span { color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.voice-builder-prompt { padding: 18px; border: 1px solid rgba(121, 194, 255, 0.2); border-radius: 18px; background: linear-gradient(135deg, rgba(121, 194, 255, 0.08), rgba(255, 107, 44, 0.08)); font-size: 1rem; line-height: 1.5; }
.voice-builder-actions .send-button { min-width: 160px; }
.voice-builder-preview-copy { color: var(--muted); font-size: 0.78rem; }
.voice-builder-takes { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 980px) { .voice-builder-grid { grid-template-columns: 1fr; } }




.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr);
  gap: 12px;
  margin-bottom: 12px;
}
.admin-layout-bottom {
  grid-template-columns: minmax(0, 1.16fr) minmax(0, 0.84fr);
}
.admin-section-panel .mode-card:first-child { margin-top: 0; }
.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.admin-stat-card, .admin-subcard, .admin-user-card, .admin-secret-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,0.03);
  padding: 14px;
}
.admin-stat-card span, .admin-kv-item span, .admin-inline-meta {
  color: var(--muted);
  font-size: 0.76rem;
}
.admin-stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.5rem;
  line-height: 1;
}
.admin-system-grid, .admin-activity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.admin-subcard h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}
.admin-kv-list, .admin-list, .admin-api-key-list, .admin-user-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-kv-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.admin-kv-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.admin-list-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,0.025);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-list-item p, .admin-card-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}
.admin-user-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.admin-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.admin-secret-card code {
  display: block;
  margin-top: 8px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(0,0,0,0.28);
  overflow-wrap: anywhere;
}
.field-checkbox {
  justify-content: flex-end;
}
.field-checkbox input {
  width: auto;
  min-height: 22px;
}

.soundtrack-preset-row { align-items: stretch; }
.soundtrack-preset-field { margin-top: 8px; }
.soundtrack-preset-button { flex: 1 1 160px; }

.video-preset-row { align-items: stretch; }
.video-preset-field { margin-top: 8px; }
.video-preset-button { flex: 1 1 150px; }
.video-source-image-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  padding: 12px;
  display: grid;
  gap: 10px;
  margin: 12px 0;
}
.video-source-head,
.video-source-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.video-source-head span,
.video-source-empty span,
.video-source-selected span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}
.video-source-preview {
  min-height: 88px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.16);
}
.video-source-selected {
  justify-content: flex-start;
}
.video-source-selected img,
.video-progress-source img {
  width: 82px;
  height: 82px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #05080d;
}
.video-source-actions {
  align-items: stretch;
}
.video-progress-source {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}
.video-progress-source img {
  width: 54px;
  height: 54px;
}

.admin-scope-preset-field { margin-top: 8px; }
.admin-scope-preset-row { align-items: stretch; }
.admin-scope-preset-button { flex: 1 1 130px; }
.admin-scope-preset-button.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, rgba(255, 107, 44, 0.92), rgba(255, 149, 79, 0.88));
  color: #130904;
}

.code-list-view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }
.code-safety-card { margin-top: 12px; }
.code-builder-card { min-height: auto; }
.code-project-board-card { min-height: auto; }
.code-workspace-card { display: flex; flex-direction: column; gap: 12px; min-height: auto; }
.code-editor-top-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(320px, 1.05fr);
  gap: 12px;
  align-items: stretch;
}
.code-conversation-card,
.code-plan-card,
.code-preview-controls-card,
.code-assets-card {
  min-width: 0;
}
.code-export-center {
  display: grid;
  gap: 12px;
}
.export-button-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.code-export-history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.code-export-history {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}
.code-export-card {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}
.code-export-card div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.code-export-card span,
.code-export-card small {
  color: var(--muted);
  overflow-wrap: anywhere;
}
.game-layout {
  display: grid;
  gap: 1rem;
}
.game-project-list,
.game-lore-list {
  display: grid;
  gap: 0.65rem;
  max-height: min(58vh, 720px);
  overflow: auto;
  padding-right: 0.25rem;
}
.game-editor-top-grid,
.game-detail-grid {
  display: grid;
  gap: 1rem;
}
.game-editor-top-grid {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
}
.game-detail-grid {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  align-items: start;
}
.game-lore-card,
.game-build-card,
.game-version-card,
.game-file-card,
.game-job-card {
  min-width: 0;
}
.game-lore-card {
  grid-row: span 2;
}
.game-wizard-card,
.game-asset-board-card {
  min-width: 0;
}
.game-stage-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0;
}
.game-stage-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--mono-font);
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  text-transform: uppercase;
}
.game-stage-pill.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #111;
}
.game-question-list,
.game-asset-request-list {
  display: grid;
  gap: 0.55rem;
  max-height: 360px;
  overflow: auto;
}
.game-question-card,
.game-asset-card {
  background: rgba(255,255,255,0.035);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem;
}
.game-asset-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.55rem;
}
.file-button {
  align-items: center;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
}
.checkbox-field .inline-check {
  align-items: center;
  display: flex;
  gap: 0.45rem;
  min-height: 40px;
}
.game-build-card .code-export-history,
.game-job-card #game-job-status {
  max-height: 360px;
  overflow: auto;
}
.code-message-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 340px;
  overflow: auto;
  padding-right: 4px;
  margin-bottom: 12px;
}
.code-message {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.2);
}
.code-message-user {
  border-color: rgba(173, 255, 102, 0.25);
  background: rgba(173, 255, 102, 0.06);
}
.code-message-assistant {
  border-color: rgba(121, 194, 255, 0.25);
  background: rgba(121, 194, 255, 0.06);
}
.code-message-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.code-message-head span {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.code-message p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
}
.code-plan-card textarea {
  min-height: 270px;
  font-family: "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1.45;
}
.code-workspace-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  min-height: 0;
  flex: 1;
}
.code-project-rail {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.025);
  padding: 12px;
  min-height: 0;
}
.code-project-rail h3,
.code-preview-head strong {
  margin: 0;
  font-family: Impact, "Franklin Gothic Medium", sans-serif;
  letter-spacing: 0.03em;
}
.code-project-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}
.code-project-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 14px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.code-project-card.is-active {
  border-color: rgba(121, 194, 255, 0.58);
  background: rgba(121, 194, 255, 0.09);
}
.code-project-open {
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 0;
  cursor: pointer;
  flex: 1 1 auto;
  min-width: 0;
}
.code-project-open strong,
.code-project-open span {
  display: block;
}
.code-project-open strong {
  font-size: 1rem;
}
.code-project-open span,
.code-preview-head span,
.code-file-link small {
  color: var(--muted);
  font-size: 0.76rem;
  margin-top: 5px;
}
.code-preview-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.code-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.code-preview-stage {
  width: 100%;
  min-height: 0;
  border-radius: 22px;
  background: #050608;
  overflow: auto;
  padding: 0;
}
.code-preview-stage.is-device-preview {
  display: grid;
  place-items: start center;
  padding: 18px;
  border: 1px solid rgba(121, 194, 255, 0.16);
  background:
    radial-gradient(circle at top left, rgba(121, 194, 255, 0.12), transparent 32%),
    #050608;
}
.code-preview-stage:fullscreen {
  width: 100vw;
  height: 100vh;
  padding: 16px;
  background: #020307;
  display: grid;
  place-items: center;
}
.code-preview-stage:fullscreen .code-preview-frame {
  width: min(100%, 1920px);
  height: min(100%, 1080px);
  min-height: 0;
}
.code-preview-stage.is-device-preview .code-preview-frame {
  width: min(100%, var(--preview-width));
  height: min(82vh, var(--preview-height));
  min-height: 0;
}
.code-preview-frame {
  width: 100%;
  min-height: min(70vh, 760px);
  height: min(70vh, 760px);
  border: 1px solid rgba(121, 194, 255, 0.25);
  border-radius: 18px;
  background: #050608;
  display: block;
}
.code-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.code-assets-card {
  grid-column: span 2;
}
.code-project-assets,
.code-available-assets {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.code-asset-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
}
.code-asset-card.is-linked {
  grid-template-columns: minmax(0, 1fr) auto;
  border-color: rgba(173, 255, 102, 0.28);
  background: rgba(173, 255, 102, 0.055);
}
.code-asset-card img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.code-asset-card strong,
.code-asset-card span {
  display: block;
}
.code-asset-card span {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.code-job-card, .code-version-card-wrap { min-height: 160px; }
.code-version-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.code-version-card {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
}
.code-version-card span,
.code-version-card small {
  color: var(--muted);
  font-size: 0.76rem;
}
.danger-text { color: #ff9c8f; }
.code-file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.code-file-link {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.code-preset-button { flex: 1 1 150px; }
.admin-secret-head { margin-bottom: 10px; }
.admin-example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.admin-example-grid .admin-subcard {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-example-grid code {
  display: block;
  white-space: pre-wrap;
  font-size: 0.76rem;
  line-height: 1.45;
  padding: 12px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.28);
  overflow-wrap: anywhere;
}
.admin-key-scope-row { margin: 10px 0 6px; }
.scope-chip {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.waveform-placeholder,
.model3d-preview {
  min-height: 180px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(157, 255, 103, 0.08), rgba(121, 214, 255, 0.08)),
    rgba(0, 0, 0, 0.18);
  color: var(--muted);
  padding: 16px;
  overflow: hidden;
}
.waveform-placeholder {
  min-height: 90px;
  background-image:
    repeating-linear-gradient(90deg, rgba(121, 214, 255, 0.28) 0 3px, transparent 3px 14px),
    linear-gradient(135deg, rgba(157, 255, 103, 0.06), rgba(255, 139, 56, 0.06));
}
.model3d-preview img {
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 14px;
}

.model3d-wireframe {
  width: 100%;
  min-height: 280px;
  margin-top: 12px;
  border: 1px solid rgba(151, 211, 255, 0.24);
  border-radius: 16px;
  background: #071017;
  box-shadow: inset 0 0 24px rgba(40, 173, 255, 0.08);
}

.canvas-editor-shell {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr) minmax(260px, 330px);
  gap: 10px;
  align-items: stretch;
  height: clamp(520px, calc(100dvh - 236px), 860px);
  min-height: 0;
  overflow: hidden;
}

body.canvas-workspace-active .canvas-editor-shell {
  height: calc(100dvh - 226px);
  min-height: 0;
}

.canvas-tool-rail,
.canvas-side-panel,
.canvas-main-stage {
  display: grid;
  gap: 12px;
  min-width: 0;
  min-height: 0;
}

.canvas-tool-rail,
.canvas-side-panel {
  align-content: start;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.canvas-main-stage {
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
}

.stacked-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.canvas-align-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.canvas-align-grid .ghost-button {
  padding-inline: 8px;
}

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

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.checkbox-line input {
  inline-size: 16px;
  block-size: 16px;
  accent-color: var(--accent);
}

.canvas-tool-rail input[type="range"] {
  width: 100%;
}

.canvas-stage-toolbar {
  display: grid;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
}

.canvas-stage-toolbar select {
  width: 100%;
  min-width: 92px;
}

.canvas-stage-wrap {
  display: grid;
  place-items: center;
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(142, 209, 255, 0.24);
  border-radius: 22px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, .035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, .035) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, .035) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, .035) 75%);
  background-size: 28px 28px;
  background-position: 0 0, 0 14px, 14px -14px, -14px 0;
}

.canvas-stage-wrap .canvas-container {
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.36);
  border-radius: 10px;
}

.canvas-stage-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.78rem;
}

.canvas-stage-stats,
.canvas-footer-controls {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.canvas-footer-controls .action-row {
  justify-content: flex-end;
}

.canvas-footer-quick-row {
  align-items: center;
}

.canvas-footer-controls #canvas-zoom-select {
  min-width: 64px;
  width: 72px;
  max-width: 72px;
  padding-left: 10px;
  padding-right: 8px;
}

.canvas-output-details {
  border: 1px solid rgba(121, 194, 255, 0.16);
  border-radius: 14px;
  padding: 6px 8px;
  background: rgba(7, 16, 23, 0.25);
}

.canvas-output-details summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 800;
  list-style-position: inside;
}

.canvas-output-details[open] summary {
  margin-bottom: 8px;
}

.canvas-resize-footer-grid {
  grid-template-columns: minmax(120px, 1fr) minmax(80px, 0.65fr) minmax(80px, 0.65fr) auto;
  align-items: end;
}

.canvas-brand-summary {
  display: grid;
  gap: 8px;
}

.canvas-brand-summary-name {
  color: var(--text);
  font-weight: 900;
}

#canvas-stage {
  width: auto;
  max-width: none;
  height: auto;
  border-radius: 8px;
  background: #f5f1e8;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .46);
  cursor: grab;
}

#canvas-stage:active {
  cursor: grabbing;
}

.canvas-ai-card {
  border-color: rgba(255, 122, 47, .28);
}

.collapsible-panel > h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: default;
}

.collapsible-panel-toggle {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 24px;
  border: 1px solid rgba(151, 211, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
}

.collapsible-panel-toggle:hover,
.collapsible-panel-toggle:focus-visible {
  color: var(--text);
  border-color: rgba(142, 209, 255, 0.58);
}

.collapsible-panel.is-collapsed > :not(h3) {
  display: none !important;
}

.canvas-image-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-height: 240px;
  overflow: auto;
  padding: 4px;
  border: 1px solid rgba(151, 211, 255, 0.16);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.16);
}

.canvas-image-pick {
  display: grid;
  gap: 4px;
  padding: 5px;
  border: 1px solid rgba(151, 211, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.canvas-image-pick:hover,
.canvas-image-pick:focus-visible {
  border-color: rgba(142, 209, 255, 0.6);
  color: var(--text);
}

.canvas-image-pick img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #071017;
}

.canvas-image-pick span {
  font-size: 0.68rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-layers-list {
  display: grid;
  gap: 6px;
  max-height: 280px;
  overflow: auto;
}

.canvas-layer-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border: 1px solid rgba(151, 211, 255, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.canvas-layer-delete-button {
  min-width: 28px;
  min-height: 26px;
  padding: 0 8px;
  color: #ffb7a8;
}

.canvas-layer-row[draggable="true"] {
  cursor: grab;
}

.canvas-layer-row.is-dragging {
  opacity: 0.48;
  border-style: dashed;
}

.canvas-layer-row.is-drop-target {
  border-color: rgba(181, 255, 109, 0.78);
  box-shadow: 0 0 0 2px rgba(181, 255, 109, 0.16);
}

.canvas-layer-row.is-active,
.canvas-layer-row:hover,
.canvas-layer-row:focus-visible {
  border-color: rgba(142, 209, 255, 0.66);
  color: var(--text);
  background: rgba(142, 209, 255, 0.08);
}

.canvas-layer-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.canvas-layer-type {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
}

.icon-button {
  min-width: 34px;
  min-height: 30px;
  border: 1px solid rgba(151, 211, 255, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: rgba(142, 209, 255, 0.66);
}

.inline-spinner {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: 6px;
  border: 2px solid rgba(142, 209, 255, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: tom2-spin 0.9s linear infinite;
}

.canvas-font-picker {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  padding: 6px;
  border: 1px solid rgba(151, 211, 255, 0.16);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.16);
}

.canvas-font-search {
  margin-bottom: 7px;
}

.canvas-font-group-label {
  padding: 4px 3px 1px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.canvas-font-option {
  width: 100%;
  display: grid;
  gap: 2px;
  padding: 7px 9px;
  border: 1px solid rgba(151, 211, 255, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.canvas-font-option:hover,
.canvas-font-option:focus-visible,
.canvas-font-option.is-active {
  border-color: rgba(142, 209, 255, 0.66);
  background: rgba(142, 209, 255, 0.08);
}

.canvas-font-preview {
  font-size: 1.1rem;
  line-height: 1.1;
}

.canvas-font-meta {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.canvas-template-generator-grid {
  display: grid;
  gap: 8px;
  margin: 8px 0 10px;
}

.canvas-template-color-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.canvas-template-color-row input[type="color"] {
  width: 44px;
  min-width: 44px;
  height: 34px;
  padding: 3px;
}

.canvas-template-browser {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  margin: 12px 0;
  padding: 4px;
}

.canvas-template-card {
  display: grid;
  gap: 4px;
  text-align: left;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.72);
  color: var(--text, #f8fafc);
  padding: 12px;
  cursor: pointer;
}

.canvas-template-card:hover,
.canvas-template-card.selected {
  border-color: rgba(255, 122, 47, 0.86);
  box-shadow: 0 0 0 1px rgba(255, 122, 47, 0.28);
}

.canvas-template-card-title {
  font-weight: 800;
}

.canvas-template-card-meta,
.canvas-template-card-copy {
  color: var(--muted, #aab4c4);
  font-size: 0.78rem;
  line-height: 1.35;
}

.canvas-export-warning {
  display: block;
  margin-top: 4px;
  color: #ffd08a;
  font-size: 0.72rem;
  line-height: 1.25;
}

.canvas-engine-note {
  color: var(--muted);
  font-size: 0.74rem;
}

.canvas-ai-options {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

[data-canvas-ai].is-busy::before {
  content: "";
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin-right: 6px;
  border: 2px solid rgba(142, 209, 255, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: tom2-spin 0.9s linear infinite;
}

.canvas-brand-color-grid {
  display: grid;
  gap: 7px;
  margin: 8px 0;
}

.canvas-brand-swatch-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(151, 211, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.canvas-brand-swatch,
.canvas-mini-swatch {
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 9px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.canvas-brand-swatch {
  width: 30px;
  height: 30px;
}

.canvas-mini-swatch-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-height: 25px;
  margin: 4px 0 7px;
  line-height: 0;
}

.canvas-mini-swatch {
  display: inline-block;
  flex: 0 0 auto;
  width: 23px;
  height: 23px;
  padding: 0;
  vertical-align: middle;
}

@keyframes tom2-spin {
  to { transform: rotate(360deg); }
}

.bug-context-card { margin-top: 4px; }
.bug-context-preview { margin: 0; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.22); color: var(--muted); font-size: 0.78rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.bug-context-preview-card { margin-top: 10px; }
.bug-context-details summary { cursor: pointer; color: var(--muted); font-size: 0.82rem; }
.admin-bug-filter-grid { margin: 10px 0 14px; }

@media (max-width: 1100px) {
  .canvas-recovery-banner {
    grid-template-columns: 1fr;
  }
  .canvas-recovery-banner .action-row {
    justify-content: flex-start;
  }
  body.canvas-workspace-active {
    overflow: auto;
  }
  body.canvas-workspace-active .page-shell,
  body.canvas-workspace-active .main-grid,
  body.canvas-workspace-active .workspace,
  body.canvas-workspace-active #tab-canvas.is-active,
  body.canvas-workspace-active #canvas-workspace-view:not(.hidden) {
    height: auto;
    overflow: visible;
  }
  body.text-workspace-active #tab-text.is-active {
    display: block;
  }
  body.text-workspace-active #text-dashboard-view {
    display: none !important;
  }
  .code-layout,
  .code-list-view,
  .code-editor-top-grid,
  .code-workspace-grid,
  .code-detail-grid,
  .game-editor-top-grid,
  .game-detail-grid,
  .canvas-editor-shell {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .canvas-stage-footer {
    grid-template-columns: 1fr;
  }
  .canvas-resize-footer-grid {
    grid-template-columns: 1fr;
  }
  .canvas-tool-rail,
  .canvas-side-panel {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
  .code-export-history-grid {
    grid-template-columns: 1fr;
  }
  .code-assets-card {
    grid-column: auto;
  }
  .code-project-list {
    max-height: none;
  }
  .code-project-card {
    align-items: stretch;
    flex-direction: column;
  }
  .code-preview-frame {
    min-height: 360px;
  }
}
