:root {
  color-scheme: dark;
  --bg: #04070a;
  --panel: rgba(10, 19, 27, .78);
  --panel-2: rgba(14, 28, 39, .72);
  --panel-3: rgba(18, 42, 52, .66);
  --line: rgba(124, 160, 178, .18);
  --line-strong: rgba(43, 232, 218, .5);
  --text: #eef8f6;
  --muted: #91a6ab;
  --faint: #64797f;
  --cyan: #2ee8da;
  --cyan-2: #7cf8ed;
  --amber: #f0a540;
  --blue: #4b8cff;
  --red: #ff6a66;
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow: 0 26px 80px rgba(0, 0, 0, .36);
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 78% 10%, rgba(31, 228, 210, .18), transparent 28%),
    radial-gradient(circle at 14% 92%, rgba(240, 165, 64, .1), transparent 28%),
    linear-gradient(180deg, #071014, var(--bg));
  font-family: Inter, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  letter-spacing: 0;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    linear-gradient(90deg, rgba(46, 232, 218, .035) 1px, transparent 1px),
    linear-gradient(rgba(46, 232, 218, .028) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 60% 20%, black, transparent 70%);
}

body::after {
  opacity: .28;
  background: linear-gradient(112deg, transparent 0%, rgba(255, 255, 255, .06) 46%, transparent 58%);
  transform: translateX(-55%);
  animation: lightSweep 10s cubic-bezier(.22, 1, .36, 1) infinite;
}

@keyframes lightSweep {
  0%, 44% { transform: translateX(-55%); }
  78%, 100% { transform: translateX(55%); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

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

button {
  border: 0;
  color: inherit;
  background: none;
  cursor: pointer;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(4, 11, 16, .72);
  outline: 0;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(46, 232, 218, .6);
  box-shadow: 0 0 0 3px rgba(46, 232, 218, .09);
}

h1,
h2,
h3,
p {
  margin: 0;
}

.studio-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr);
  gap: 16px;
  height: 100vh;
  padding: 14px;
}

.side-rail,
.panel-glass,
.ai-dock,
.command-card {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(13, 30, 40, .78), rgba(6, 14, 20, .78));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .045);
  backdrop-filter: blur(22px);
}

.side-rail {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 18px;
  min-height: 0;
  padding: 18px;
  border-radius: 28px;
}

.brand-lockup,
.profile-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.brand-mark,
.profile-avatar {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 17px;
  color: white;
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, .38), transparent 26%),
    linear-gradient(145deg, #3df5e2, #087d79 76%);
  box-shadow: 0 16px 36px rgba(35, 214, 201, .24), inset 0 0 0 1px rgba(255,255,255,.2);
  font-family: "Songti SC", "STSong", serif;
  font-size: 29px;
  font-weight: 900;
}

.brand-lockup strong,
.profile-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-lockup span,
.profile-card span,
.usage-card p {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.side-nav {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
}

.side-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: #97abad;
  font-weight: 760;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease;
}

.side-nav i {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  color: var(--cyan);
  font-style: normal;
  font-size: 18px;
  font-weight: 900;
}

.side-nav button:hover,
.side-nav button.active {
  border-color: rgba(46, 232, 218, .32);
  color: #f3fffd;
  background: linear-gradient(90deg, rgba(32, 191, 180, .24), rgba(32, 191, 180, .06));
  transform: translateX(2px);
}

.side-nav button.active i {
  color: #041517;
  background: linear-gradient(145deg, var(--cyan-2), var(--cyan));
}

.usage-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(124, 160, 178, .16);
  border-radius: 18px;
  background: rgba(5, 14, 20, .56);
}

.usage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.usage-meter {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
}

.usage-meter i {
  display: block;
  width: 68%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
}

.usage-card button,
.back-chip {
  min-height: 34px;
  border: 1px solid rgba(124, 160, 178, .2);
  border-radius: 11px;
  color: var(--cyan-2);
  background: rgba(255, 255, 255, .035);
  font-size: 13px;
  font-weight: 760;
}

.profile-card {
  grid-template-columns: 42px minmax(0, 1fr) auto;
  padding: 9px;
  border: 1px solid rgba(124, 160, 178, .18);
  border-radius: 17px;
  background: rgba(5, 14, 20, .56);
}

.profile-avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  font-size: 22px;
}

.profile-card i {
  color: var(--muted);
  font-style: normal;
}

.workspace {
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  min-height: 0;
}

.workspace-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}

.breadcrumb,
.top-actions,
.canvas-tools,
.page-dock,
.page-nav,
.stage-pills,
.section-caption,
.color-row,
.palette-row {
  display: flex;
  align-items: center;
}

.breadcrumb {
  gap: 8px;
  min-width: 0;
}

.breadcrumb strong {
  max-width: 360px;
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ghost-icon,
.ghost-action,
.solid-action,
.primary-action,
.tool-chip,
.ai-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: rgba(8, 18, 26, .68);
  font-weight: 800;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.ghost-icon {
  width: 36px;
  padding: 0;
}

.ghost-action,
.solid-action,
.primary-action,
.ai-button {
  padding: 0 15px;
}

.solid-action {
  border-color: rgba(46, 232, 218, .28);
  color: var(--cyan-2);
  background: rgba(46, 232, 218, .1);
}

.primary-action {
  border-color: transparent;
  color: #031011;
  background: linear-gradient(145deg, #60f8eb, #16c3b5);
  box-shadow: 0 16px 42px rgba(35, 214, 201, .25);
}

.ghost-icon:hover,
.ghost-action:hover,
.solid-action:hover,
.primary-action:hover,
.tool-chip:hover,
.ai-button:hover {
  transform: translateY(-1px);
  border-color: rgba(46, 232, 218, .5);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .22);
}

.save-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.save-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 14px var(--cyan);
}

.top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.ai-panel .top-actions {
  display: none;
}

.ai-panel .save-state {
  display: none;
}

.view-panel {
  display: none;
  min-height: 0;
}

.view-panel.active {
  display: block;
}

.ai-generate-view.active {
  display: grid;
  grid-template-columns: minmax(0, min(860px, 100%));
  justify-content: center;
  gap: 16px;
  min-height: 0;
}

.ai-generate-view.active.preview-visible {
  grid-template-columns: minmax(500px, .82fr) minmax(580px, 1.18fr);
  justify-content: stretch;
}

.ai-generate-view.active:not(.preview-visible) .ai-preview-panel {
  display: none;
}

.ai-generate-view.active:not(.preview-visible) #goWorkbenchBtn {
  display: none;
}

.ai-generate-view.active:not(.preview-visible):not(.busy) .ai-dock {
  display: none;
}

.ai-composer {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 0;
  padding: 18px;
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 86% 10%, rgba(46, 232, 218, .14), transparent 30%),
    linear-gradient(180deg, rgba(13, 30, 40, .84), rgba(5, 13, 19, .86));
}

.ai-composer:has(.ai-chat-feed:empty) {
  grid-template-rows: auto auto;
  align-content: center;
}

.ai-generate-view.active:not(.preview-visible) .ai-composer {
  align-self: center;
  min-height: min(700px, calc(100vh - 112px));
  padding: 20px;
}

.ai-generate-view.active:not(.preview-visible) .ai-composer:has(.ai-chat-feed:empty) {
  min-height: 420px;
}

.ai-conversation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 38px;
}

.ai-conversation-head .ghost-action {
  flex: 0 0 auto;
  min-width: 112px;
  white-space: nowrap;
}

.ai-conversation-head span {
  display: none;
}

.ai-conversation-head h1 {
  font-family: inherit;
  font-size: clamp(18px, 1.1vw, 22px);
  line-height: 1.2;
}

.ai-conversation-head p {
  display: none;
}

.ai-thread {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(124, 160, 178, .12);
  border-radius: 20px;
  background: rgba(3, 10, 15, .36);
}

.ai-thread:has(.ai-chat-feed:empty),
.ai-chat-feed:empty {
  display: none;
}

.ai-thread::-webkit-scrollbar,
.ai-chat-feed::-webkit-scrollbar {
  width: 8px;
}

.ai-thread::-webkit-scrollbar-thumb,
.ai-chat-feed::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(130, 162, 176, .28);
}

.ai-welcome-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(46, 232, 218, .2);
  border-radius: 20px;
  background:
    radial-gradient(circle at 96% 0%, rgba(46, 232, 218, .14), transparent 30%),
    rgba(4, 12, 17, .58);
}

.ai-welcome-card strong {
  font-size: 17px;
}

.ai-welcome-card p {
  color: var(--muted);
  line-height: 1.7;
}

.ai-welcome-card div,
.ai-compose-actions,
.ai-aspect-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ai-welcome-card button,
.ai-aspect-chips button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(46, 232, 218, .25);
  border-radius: 999px;
  color: var(--cyan-2);
  background: rgba(46, 232, 218, .08);
  font-weight: 800;
}

.ai-aspect-chips button.active {
  color: #031011;
  border-color: transparent;
  background: var(--cyan);
}

.ai-compose-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 9px;
  border: 1px solid rgba(46, 232, 218, .18);
  border-radius: 20px;
  background: rgba(3, 10, 15, .62);
  box-shadow: 0 -16px 50px rgba(0, 0, 0, .18);
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.ai-compose-box.dragover {
  border-color: rgba(46, 232, 218, .74);
  background: rgba(46, 232, 218, .09);
  transform: translateY(-1px);
}

.ai-prompt-input {
  min-height: 96px;
  max-height: 320px;
  padding: 12px 13px;
  border-radius: 16px;
  resize: vertical;
  color: #f6fffd;
  background:
    linear-gradient(90deg, rgba(46, 232, 218, .04) 1px, transparent 1px),
    linear-gradient(rgba(46, 232, 218, .035) 1px, transparent 1px),
    rgba(3, 11, 16, .72);
  background-size: 34px 34px;
  font-size: 14px;
  line-height: 1.68;
}

.ai-generate-view.active:not(.preview-visible) .ai-prompt-input {
  min-height: min(300px, 42vh);
  max-height: min(520px, 54vh);
  font-size: 15px;
}

.ai-upload-strip {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  padding: 12px 14px;
  border: 1px dashed rgba(46, 232, 218, .34);
  border-radius: 18px;
  background: rgba(46, 232, 218, .055);
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.ai-upload-strip.dragover {
  border-color: var(--cyan);
  background: rgba(46, 232, 218, .12);
  transform: translateY(-1px);
}

.ai-upload-strip i {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: #031011;
  background: linear-gradient(145deg, #69fff3, #1bc6b9);
  font-style: normal;
  font-weight: 900;
}

.ai-upload-strip strong,
.ai-upload-strip span {
  display: block;
}

.ai-upload-strip span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.ai-upload-strip label {
  display: grid;
  place-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--cyan-2);
  cursor: pointer;
}

.ai-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-compose-actions {
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 10px;
}

.ai-action-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ai-action-left span,
.ai-compose-actions span {
  color: var(--muted);
  font-size: 12px;
}

.ai-upload-button {
  display: grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid rgba(46, 232, 218, .28);
  border-radius: 999px;
  color: var(--cyan-2);
  background: rgba(46, 232, 218, .07);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.ai-preset-select {
  flex: 0 0 136px;
  width: 136px;
  min-height: 34px;
  padding: 0 34px 0 12px;
  border-color: rgba(46, 232, 218, .24);
  border-radius: 999px;
  color: var(--cyan-2);
  background-color: rgba(46, 232, 218, .055);
  font-size: 12px;
  font-weight: 850;
}

.ai-prompt-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.ai-prompt-chips button {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid rgba(46, 232, 218, .22);
  border-radius: 999px;
  color: var(--cyan-2);
  background: rgba(46, 232, 218, .055);
  font-size: 12px;
  font-weight: 850;
}

.ai-chat-feed {
  display: grid;
  gap: 12px;
  overflow: visible;
}

.ai-message {
  position: relative;
  width: fit-content;
  max-width: min(92%, 780px);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: #d9ecec;
  background: rgba(255,255,255,.04);
  font-size: 14px;
  line-height: 1.72;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ai-message.thinking {
  padding-left: 14px;
}

.ai-message.thinking::after {
  content: "";
  position: absolute;
  left: -18px;
  top: 28px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--cyan);
  box-shadow: 0 0 0 0 rgba(46, 232, 218, .5);
  animation: pulseDot 1.15s ease-out infinite;
}

@keyframes pulseDot {
  70% { box-shadow: 0 0 0 10px rgba(46, 232, 218, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 232, 218, 0); }
}

.ai-message.user {
  justify-self: end;
  max-width: calc(100% - 54px);
  margin-right: 44px;
  color: #031011;
  background: linear-gradient(145deg, #60f8eb, #16c3b5);
}

.ai-message.user::after,
.ai-message.assistant::before {
  position: absolute;
  top: 0;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 950;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .25);
}

.ai-message.user::after {
  content: "我";
  right: -44px;
  color: #061314;
  background: linear-gradient(145deg, #e9fffb, #54e8dc);
}

.ai-message.assistant {
  margin-left: 44px;
  border-color: rgba(46, 232, 218, .28);
  background: rgba(46, 232, 218, .08);
}

.ai-message.assistant::before {
  content: "会";
  left: -44px;
  color: #f9fffd;
  background:
    radial-gradient(circle at 32% 22%, rgba(255,255,255,.78), transparent 18%),
    linear-gradient(145deg, #53f1e3, #078b83);
}

.ai-preview-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 14px;
  min-height: 0;
  padding: 18px;
  border-radius: 28px;
}

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

.ai-preview-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.ai-preview-head h2 {
  font-size: 21px;
}

.ai-preview-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.ai-preview-stage {
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  padding: 16px;
  border: 1px solid rgba(124, 160, 178, .14);
  border-radius: 22px;
  background: radial-gradient(circle at 50% 36%, rgba(46, 232, 218, .18), transparent 32%), rgba(3, 10, 15, .64);
}

.ai-preview-stage .poster {
  width: min(100%, 820px);
  max-height: 100%;
}

.ai-gui-panel {
  display: grid;
  gap: 10px;
  padding: 0;
  border: 1px solid rgba(124, 160, 178, .14);
  border-radius: 18px;
  background: rgba(3, 10, 15, .54);
  overflow: hidden;
}

.ai-gui-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 0 12px;
  cursor: pointer;
  list-style: none;
}

.ai-gui-head::-webkit-details-marker {
  display: none;
}

.ai-gui-head strong {
  font-size: 14px;
}

.ai-gui-head span {
  color: var(--muted);
  font-size: 12px;
}

.ai-gui-head::after {
  content: "⌄";
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(124, 160, 178, .16);
  border-radius: 999px;
  color: var(--cyan-2);
  transition: transform .18s ease;
}

.ai-gui-panel[open] .ai-gui-head::after {
  transform: rotate(180deg);
}

.ai-template-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 0 12px;
}

.ai-template-strip button {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(124, 160, 178, .16);
  border-radius: 14px;
  color: var(--text);
  background: rgba(8, 18, 26, .56);
  text-align: left;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.ai-template-strip button:hover,
.ai-template-strip button.active {
  border-color: rgba(46, 232, 218, .62);
  background: rgba(30, 83, 86, .38);
  transform: translateY(-1px);
}

.ai-template-strip i {
  height: 48px;
  border-radius: 10px;
  background-position: center;
  background-size: cover;
}

.ai-template-strip strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-template-center {
  min-height: 34px;
  margin: 0 12px 12px;
}

.ai-aspect-chips {
  padding: 0 12px;
}

.ai-preview-actions {
  justify-content: flex-end;
}

.workbench-view.active {
  display: block;
  min-height: 0;
}

.utility-view.active {
  display: grid;
  grid-template-columns: minmax(280px, .48fr) minmax(0, 1fr);
  gap: 24px;
  padding: 26px;
  border-radius: 28px;
}

.utility-copy span {
  color: var(--cyan-2);
  font-size: 13px;
  font-weight: 900;
}

.utility-copy h1 {
  margin-top: 10px;
  font-family: "Songti SC", "STSong", serif;
  font-size: 42px;
}

.utility-copy p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.7;
}

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

.utility-template-card,
.utility-mini-card {
  display: grid;
  gap: 10px;
  min-height: 150px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--text);
  background: rgba(4, 12, 17, .62);
  text-align: left;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.utility-template-card:hover,
.utility-mini-card:hover {
  transform: translateY(-2px);
  border-color: rgba(46, 232, 218, .48);
  background: rgba(18, 48, 56, .68);
}

.utility-template-card i {
  height: 92px;
  border-radius: 13px;
  background-position: center;
  background-size: cover;
}

.utility-template-card span,
.utility-mini-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.rail-toggle {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--cyan-2);
  background: rgba(255,255,255,.04);
  font-size: 20px;
}

.brand-lockup {
  grid-template-columns: 52px minmax(0, 1fr) 32px;
}

.rail-collapsed .studio-shell {
  grid-template-columns: 96px minmax(0, 1fr);
}

.rail-collapsed .brand-lockup {
  grid-template-columns: 1fr;
  justify-items: center;
}

.rail-collapsed .brand-lockup div:not(.brand-mark),
.rail-collapsed .side-nav span,
.rail-collapsed .usage-card,
.rail-collapsed .profile-card div:not(.profile-avatar),
.rail-collapsed .profile-card i {
  display: none;
}

.rail-collapsed .rail-toggle {
  width: 40px;
}

.rail-collapsed .side-nav button {
  justify-content: center;
  padding: 0;
}

.rail-collapsed .profile-card {
  grid-template-columns: 1fr;
  justify-items: center;
}

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

.inspector-head button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(255,255,255,.035);
  font-size: 12px;
  font-weight: 800;
}

.inspector-collapsed .studio-grid {
  grid-template-columns: minmax(360px, .75fr) minmax(620px, 1.25fr);
}

.inspector-collapsed .inspector-panel {
  display: none;
}

.studio-grid {
  display: grid;
  grid-template-columns: minmax(340px, .92fr) minmax(620px, 1.34fr) minmax(330px, .78fr);
  gap: 12px;
  min-width: 0;
  min-height: 0;
}

.panel-glass {
  min-width: 0;
  min-height: 0;
  border-radius: 22px;
  overflow: hidden;
}

.outline-panel,
.canvas-panel,
.inspector-panel {
  display: grid;
  padding: 16px;
}

.outline-panel {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 14px;
}

.canvas-panel {
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
}

.inspector-panel {
  grid-template-rows: auto minmax(0, auto) minmax(0, auto) minmax(0, 1fr);
  gap: 14px;
  overflow: auto;
}

.panel-title,
.canvas-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-title h1,
.canvas-toolbar h2 {
  font-size: 19px;
  line-height: 1.2;
}

.panel-title p,
.canvas-toolbar p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.title-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.title-fields input,
.inspector-panel input,
.inspector-panel textarea,
.inspector-panel select,
.canvas-tools select {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 12px;
}

.inspector-panel textarea,
#rawInput {
  padding: 12px;
  resize: none;
  line-height: 1.7;
}

.items-list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.items-list::-webkit-scrollbar,
.inspector-panel::-webkit-scrollbar,
.canvas-stage::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.items-list::-webkit-scrollbar-thumb,
.inspector-panel::-webkit-scrollbar-thumb,
.canvas-stage::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(130, 162, 176, .28);
}

.item-card {
  position: relative;
  display: grid;
  grid-template-columns: 22px 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 13px;
  border: 1px solid rgba(124, 160, 178, .16);
  border-radius: 17px;
  background:
    linear-gradient(180deg, rgba(18, 39, 50, .82), rgba(9, 20, 28, .78));
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
  animation: itemRise .42s cubic-bezier(.22, 1, .36, 1) both;
  animation-delay: var(--delay, 0ms);
}

@keyframes itemRise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.item-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: 17px 0 0 17px;
  background: var(--accent);
  opacity: 0;
  transition: opacity .18s ease;
}

.item-card:hover,
.item-card.active {
  border-color: rgba(46, 232, 218, .34);
  background:
    linear-gradient(180deg, rgba(22, 50, 62, .92), rgba(10, 25, 34, .86));
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, .2);
}

.item-card.active::before {
  opacity: 1;
}

.drag-handle {
  color: var(--faint);
  cursor: grab;
  font-weight: 900;
  letter-spacing: -2px;
}

.item-index,
.poster-index {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #031011;
  background: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

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

.item-copy strong,
.poster-item strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  line-height: 1.38;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.poster-item strong {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.item-copy p,
.poster-item p {
  display: -webkit-box;
  margin-top: 5px;
  overflow: hidden;
  color: #a5b8ba;
  font-size: 12px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.poster-item p {
  -webkit-line-clamp: 3;
  overflow-wrap: anywhere;
}

.poster .poster-item p {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

.item-actions {
  display: flex;
  gap: 6px;
}

.item-actions button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(255,255,255,.03);
}

.item-actions button:hover {
  color: var(--cyan);
  border-color: rgba(46, 232, 218, .38);
}

.add-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 12px;
  border: 1px dashed rgba(46, 232, 218, .32);
  border-radius: 16px;
  color: var(--cyan-2);
  background: rgba(46, 232, 218, .055);
  text-align: left;
}

.add-item span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  color: #031011;
  background: var(--cyan);
}

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

.canvas-tools {
  gap: 7px;
}

.canvas-tools select {
  width: 84px;
  min-height: 34px;
}

.tool-chip {
  min-width: 34px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 12px;
}

.canvas-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(124, 160, 178, .14);
  border-radius: 20px;
  background:
    radial-gradient(circle at 78% 16%, rgba(46, 232, 218, .16), transparent 30%),
    linear-gradient(90deg, rgba(46, 232, 218, .045) 1px, transparent 1px),
    linear-gradient(rgba(46, 232, 218, .04) 1px, transparent 1px),
    rgba(4, 12, 17, .54);
  background-size: auto, 28px 28px, 28px 28px, auto;
}

.poster {
  --accent: #2ee8da;
  --title-size: 42px;
  --body-size: 14px;
  position: relative;
  width: min(100%, 760px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(46, 232, 218, .28);
  border-radius: 28px;
  color: var(--text);
  background: #071215;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .45);
  transform: translateZ(0);
  animation: canvasIn .45s cubic-bezier(.22, 1, .36, 1);
}

@keyframes canvasIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.poster[data-aspect="4:3"] {
  width: min(100%, 680px);
  aspect-ratio: 4 / 3;
}

.poster[data-aspect="3:4"] {
  width: min(100%, 500px);
  aspect-ratio: 3 / 4;
}

.poster[data-aspect="9:16"] {
  width: min(100%, 430px);
  aspect-ratio: 9 / 16;
}

.poster-bg {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  opacity: .92;
}

.poster::before {
  content: "";
  position: absolute;
  inset: 24px;
  z-index: 1;
  border: 1px solid rgba(46, 232, 218, .28);
  border-radius: 22px;
  pointer-events: none;
}

.poster-content {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  height: 100%;
  padding: 48px 58px 36px;
}

.poster[data-aspect="16:9"] .poster-content {
  gap: 9px;
  padding: 22px 34px 18px;
}

.poster[data-aspect="4:3"] .poster-content {
  padding: 44px 54px 34px;
}

.poster[data-aspect="3:4"] .poster-content,
.poster[data-aspect="9:16"] .poster-content {
  padding: 52px 42px 38px;
}

.poster-head {
  display: grid;
  gap: 8px;
  padding-left: 18px;
  border-left: 5px solid var(--accent);
}

.poster-title {
  color: var(--poster-title, #f3fffd);
  font-family: var(--title-font);
  font-size: var(--title-size);
  font-weight: 900;
  line-height: 1.08;
  text-shadow: 0 0 24px rgba(46, 232, 218, .18);
}

.poster[data-aspect="16:9"] .poster-title {
  font-size: min(var(--title-size), 24px);
}

.poster[data-aspect="4:3"] .poster-title {
  font-size: min(var(--title-size), 38px);
}

.poster-subtitle {
  color: var(--poster-subtitle, #a9c3c6);
  font-size: calc(var(--body-size) * .9);
  font-weight: 760;
}

.poster-list {
  display: grid;
  align-content: center;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.poster[data-aspect="16:9"] .poster-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 8px;
}

.poster[data-aspect="4:3"] .poster-list {
  align-content: start;
  gap: 10px;
}

.poster-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid rgba(46, 232, 218, .24);
  border-radius: 14px;
  background: rgba(3, 13, 17, .66);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .045);
  backdrop-filter: blur(9px);
}

.poster[data-aspect="16:9"] .poster-item {
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 8px;
  min-height: 64px;
  padding: 8px 10px;
}

.poster[data-aspect="16:9"] .poster-index {
  width: 26px;
  height: 26px;
  font-size: 10px;
}

.poster-item p {
  font-size: var(--body-size);
}

.poster[data-aspect="16:9"] .poster-item strong {
  font-size: 11px;
  line-height: 1.22;
}

.poster[data-aspect="16:9"] .poster-item p {
  margin-top: 2px;
  font-size: min(var(--body-size), 11px);
  line-height: 1.35;
  -webkit-line-clamp: unset;
}

.poster-item [data-text-field] {
  user-select: text;
}

.text-mark-highlight {
  padding: 0 .16em;
  border-radius: .28em;
  color: #061314;
  background: rgba(240, 165, 64, .92);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.text-mark-underline {
  text-decoration: underline;
  text-decoration-thickness: .14em;
  text-decoration-color: var(--accent);
  text-underline-offset: .18em;
}

.poster-footer {
  display: flex;
  justify-content: center;
  gap: 10px;
  color: #9eb4b8;
  font-size: 12px;
}

.template-paper .poster-bg {
  background:
    linear-gradient(145deg, rgba(255,255,255,.94), rgba(231,241,239,.96)),
    url("/assets/background-paper.png");
}

.template-paper,
.template-frame,
.template-minimal,
.template-vellum,
.template-cards {
  color: #172b2f;
}

.template-paper .poster-title,
.template-frame .poster-title,
.template-minimal .poster-title,
.template-vellum .poster-title,
.template-cards .poster-title {
  color: #183539;
  text-shadow: none;
}

.template-paper .poster-subtitle,
.template-frame .poster-subtitle,
.template-minimal .poster-subtitle,
.template-vellum .poster-subtitle,
.template-cards .poster-subtitle {
  color: #587277;
}

.template-paper .poster-item,
.template-frame .poster-item,
.template-minimal .poster-item,
.template-vellum .poster-item,
.template-cards .poster-item {
  border-color: rgba(24, 84, 84, .18);
  color: #172b2f;
  background: rgba(255,255,255,.78);
}

.template-paper .poster-item strong,
.template-frame .poster-item strong,
.template-minimal .poster-item strong,
.template-vellum .poster-item strong,
.template-cards .poster-item strong {
  color: #17373a;
}

.template-paper .poster-item p,
.template-frame .poster-item p,
.template-minimal .poster-item p,
.template-vellum .poster-item p,
.template-cards .poster-item p {
  color: #5d7276;
}

.template-cosmos .poster-bg {
  background-image:
    radial-gradient(circle at 86% 18%, rgba(51, 232, 220, .32), transparent 20%),
    linear-gradient(90deg, rgba(46, 232, 218, .08) 1px, transparent 1px),
    linear-gradient(rgba(46, 232, 218, .08) 1px, transparent 1px),
    url("/assets/generated/studio-glass-grid.jpg");
}

.template-aurora .poster-bg {
  background-image:
    linear-gradient(180deg, rgba(0,0,0,.16), rgba(0,0,0,.38)),
    url("/assets/generated/studio-aurora.jpg");
}

.template-carbon .poster-bg {
  background-image:
    linear-gradient(180deg, rgba(0,0,0,.12), rgba(0,0,0,.38)),
    url("/assets/generated/studio-carbon.jpg");
}

.template-blueprint .poster-bg {
  background-image:
    linear-gradient(180deg, rgba(0,0,0,.08), rgba(0,0,0,.3)),
    url("/assets/generated/studio-blueprint.jpg");
}

.template-vellum .poster-bg {
  background-image:
    linear-gradient(145deg, rgba(255,255,255,.86), rgba(231,244,241,.78)),
    url("/assets/generated/studio-vellum.jpg");
}

.template-frame .poster-bg {
  background:
    radial-gradient(circle at 88% 12%, rgba(48, 180, 168, .13), transparent 24%),
    linear-gradient(145deg, #fbfffd, #e8f4f0);
}

.template-frame::before {
  border-color: rgba(24, 143, 131, .22);
}

.template-minimal .poster-bg {
  background:
    linear-gradient(90deg, rgba(15, 143, 137, .05) 1px, transparent 1px),
    linear-gradient(rgba(15, 143, 137, .04) 1px, transparent 1px),
    #f8fbfb;
  background-size: 34px 34px;
}

.template-cards .poster-bg {
  background:
    radial-gradient(circle at 14% 14%, rgba(46, 232, 218, .14), transparent 22%),
    linear-gradient(145deg, #f8fcff, #e7f1f7);
}

.template-pixel .poster-bg {
  background-image:
    linear-gradient(180deg, rgba(0,0,0,.2), rgba(0,0,0,.46)),
    url("/assets/background-pixel.png");
  image-rendering: auto;
}

.template-pixel::before {
  border-style: dashed;
  border-color: rgba(124, 248, 237, .34);
}

.page-dock {
  gap: 10px;
}

.page-thumb {
  width: 58px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(46, 232, 218, .12);
}

.page-thumb span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: url("/assets/generated/studio-glass-grid.jpg") center / cover;
}

.page-add {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(255,255,255,.035);
}

.page-nav {
  gap: 10px;
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}

.page-nav button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--muted);
  background: rgba(255,255,255,.04);
}

.inspector-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(4, 11, 16, .58);
}

.inspector-tabs button {
  min-height: 34px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.inspector-tabs button.active {
  color: #031011;
  background: var(--cyan);
}

.inspector-section {
  display: grid;
  gap: 12px;
}

.inspector-section.hidden {
  display: none;
}

.section-caption {
  justify-content: space-between;
  gap: 10px;
}

.section-caption h3,
.settings-section h3 {
  color: #f0fbf8;
  font-size: 15px;
}

.section-caption span {
  color: var(--muted);
  font-size: 12px;
}

.section-caption select {
  width: 110px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 12px;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  max-height: 260px;
  overflow: auto;
  padding-right: 2px;
}

.template-card {
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(4, 12, 17, .58);
  text-align: left;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.template-card.active,
.template-card:hover {
  border-color: rgba(46, 232, 218, .72);
  background: rgba(24, 63, 65, .5);
  transform: translateY(-1px);
}

.template-thumb {
  height: 72px;
  overflow: hidden;
  border: 1px solid rgba(124, 160, 178, .15);
  border-radius: 10px;
  background-position: center;
  background-size: cover;
}

.template-card strong {
  font-size: 12px;
}

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

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

.size-grid button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(4, 12, 17, .58);
  font-weight: 800;
}

.size-grid button.active {
  border-color: var(--line-strong);
  color: var(--cyan-2);
  background: rgba(46, 232, 218, .1);
}

.font-grid {
  display: grid;
  grid-template-columns: 1.3fr .7fr;
  gap: 10px;
}

.color-row,
.palette-row {
  flex-wrap: wrap;
  gap: 8px;
}

.color-dot,
.palette-dot {
  width: 26px;
  height: 26px;
  border: 2px solid rgba(255,255,255,.15);
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 1px rgba(0,0,0,.3);
}

.color-dot.active,
.palette-dot.active {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(46, 232, 218, .14);
}

.switch-line {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 9px;
}

.switch-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--cyan);
}

.wide {
  width: 100%;
}

.ai-dock {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 128px;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 15px;
}

.ai-orb {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(46, 232, 218, .1);
}

.ai-orb span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 24px var(--cyan);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(.86); opacity: .68; }
  50% { transform: scale(1.06); opacity: 1; }
}

.ai-dock strong {
  display: block;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-dock p {
  display: none;
}

.progress-wrap {
  display: grid;
  gap: 4px;
}

.progress-bar {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
}

.ai-dock .stage-pills {
  display: none;
}

.progress-bar i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
  transition: width .35s ease;
}

.progress-wrap span {
  color: var(--muted);
  font-size: 11px;
}

.stage-pills {
  gap: 6px;
}

.stage-pills span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.stage-pills span.done,
.stage-pills span.active {
  color: var(--cyan-2);
  border-color: rgba(46, 232, 218, .35);
  background: rgba(46, 232, 218, .08);
}

.command-dialog {
  width: min(820px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  background: transparent;
}

.preview-dialog {
  width: min(1120px, calc(100vw - 36px));
  padding: 0;
  border: 0;
  background: transparent;
}

.preview-dialog::backdrop {
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(14px);
}

.preview-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    radial-gradient(circle at 75% 8%, rgba(46, 232, 218, .16), transparent 26%),
    linear-gradient(180deg, rgba(13, 30, 40, .95), rgba(5, 13, 19, .96));
  box-shadow: var(--shadow);
}

.preview-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preview-card header button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
}

.preview-stage-large {
  display: grid;
  place-items: center;
  min-height: 560px;
  overflow: auto;
  padding: 24px;
  border: 1px solid rgba(124, 160, 178, .14);
  border-radius: 22px;
  background: rgba(2, 8, 12, .62);
}

.preview-stage-large .poster {
  width: min(100%, 920px);
}

.template-preview-card {
  width: min(860px, calc(100vw - 36px));
}

.template-preview-body {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr);
  gap: 18px;
  align-items: stretch;
}

.template-preview-body i {
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background-position: center;
  background-size: cover;
}

.template-preview-body p {
  color: var(--muted);
  line-height: 1.7;
}

.command-dialog::backdrop {
  background: rgba(0, 0, 0, .64);
  backdrop-filter: blur(10px);
}

.command-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 24px;
}

.command-card header,
.command-card footer,
.drop-zone {
  display: flex;
  align-items: center;
  gap: 12px;
}

.command-card header {
  justify-content: space-between;
}

.command-card header strong {
  display: block;
  font-size: 20px;
}

.command-card header span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.command-card header button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
}

#rawInput {
  width: 100%;
  min-height: 280px;
  border-radius: 18px;
  font-size: 16px;
}

.drop-zone {
  padding: 14px;
  border: 1px dashed rgba(46, 232, 218, .36);
  border-radius: 16px;
  background: rgba(46, 232, 218, .055);
}

.drop-zone.dragover {
  border-color: var(--cyan);
  background: rgba(46, 232, 218, .11);
}

.drop-zone i {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: #031011;
  background: var(--cyan);
  font-style: normal;
  font-weight: 900;
}

.drop-zone div {
  flex: 1;
}

.drop-zone strong,
.drop-zone span {
  display: block;
}

.drop-zone span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.drop-zone label {
  display: grid;
  place-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--cyan-2);
  cursor: pointer;
}

.command-card footer {
  justify-content: flex-end;
}

#exportCanvas {
  position: fixed;
  left: -99999px;
  top: -99999px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: 360px;
  padding: 12px 14px;
  border: 1px solid rgba(46, 232, 218, .32);
  border-radius: 14px;
  color: var(--text);
  background: rgba(8, 20, 28, .92);
  box-shadow: var(--shadow);
  animation: toastIn .28s ease;
}

.text-mark-toolbar {
  position: fixed;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px;
  border: 1px solid rgba(46, 232, 218, .26);
  border-radius: 14px;
  background: rgba(5, 14, 20, .94);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
  backdrop-filter: blur(16px);
}

.text-mark-toolbar[hidden] {
  display: none;
}

.text-mark-toolbar button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(124, 160, 178, .2);
  border-radius: 10px;
  color: #dffcf8;
  background: rgba(255, 255, 255, .045);
  font-size: 12px;
  font-weight: 850;
}

.text-mark-toolbar button:hover {
  color: #041011;
  border-color: transparent;
  background: var(--cyan);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1180px) {
  .studio-shell {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .brand-lockup,
  .profile-card {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .brand-lockup div:not(.brand-mark),
  .side-nav span,
  .usage-card,
  .profile-card div:not(.profile-avatar),
  .profile-card i {
    display: none;
  }

  .rail-toggle {
    display: grid;
  }

  .side-nav button {
    justify-content: center;
    padding: 0;
  }

  .side-nav i {
    margin: 0;
  }

  .studio-grid {
    grid-template-columns: minmax(330px, .9fr) minmax(520px, 1.25fr) minmax(300px, .76fr);
  }
}

@media (max-width: 1080px) {
  body {
    overflow: auto;
  }

  .studio-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .side-rail {
    grid-template-rows: auto auto;
  }

  .side-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workspace {
    grid-template-rows: auto auto auto;
  }

  .workspace-top,
  .studio-grid,
  .ai-generate-view.active,
  .utility-view.active,
  .ai-upload-strip,
  .ai-dock {
    grid-template-columns: 1fr;
  }

  .ai-dock {
    grid-template-columns: 20px minmax(0, 1fr) 120px;
  }

  .studio-grid {
    display: grid;
  }

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

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .studio-shell {
    gap: 10px;
    padding: 10px;
  }

  .side-rail {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto;
    align-items: center;
    gap: 10px;
    min-height: auto;
    padding: 10px;
    border-radius: 22px;
  }

  .brand-lockup {
    grid-template-columns: 42px minmax(0, 1fr) 32px;
    justify-items: start;
    gap: 9px;
  }

  .brand-lockup div:not(.brand-mark) {
    display: block;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    font-size: 23px;
  }

  .brand-lockup strong {
    font-size: 14px;
  }

  .brand-lockup span {
    font-size: 10px;
  }

  .side-nav {
    display: flex;
    gap: 6px;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .side-nav button {
    flex: 0 0 42px;
    min-height: 40px;
    border-radius: 13px;
  }

  .side-nav i {
    width: 26px;
    height: 26px;
  }

  .profile-card {
    display: grid;
    grid-template-columns: 34px;
    padding: 5px;
    border-radius: 14px;
  }

  .profile-avatar {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    font-size: 19px;
  }

  .workspace {
    grid-template-rows: auto auto auto;
    gap: 10px;
  }

  .workspace-top {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }

  .breadcrumb {
    min-width: 0;
  }

  .breadcrumb strong {
    max-width: 190px;
  }

  .save-state {
    display: none;
  }

  .top-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    overflow-x: visible;
    padding-bottom: 2px;
  }

  .top-actions > * {
    flex: 0 0 auto;
  }

  .studio-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .ai-generate-view.active,
  .utility-view.active {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .ai-preview-stage {
    min-height: 420px;
  }

  .ai-template-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ai-composer,
  .ai-preview-panel,
  .utility-view.active {
    padding: 14px;
    border-radius: 20px;
  }

  .template-preview-body,
  .utility-content {
    grid-template-columns: 1fr;
  }

  .ai-prompt-input {
    min-height: 86px;
  }

  .ai-generate-view.active:not(.preview-visible) .ai-prompt-input {
    min-height: 96px;
    max-height: 260px;
  }

  .ai-compose-actions {
    flex-wrap: wrap;
  }

  .ai-action-left span {
    display: none;
  }

  .ai-prompt-chips {
    flex: 1 1 160px;
    justify-content: flex-start;
  }

  .ai-compose-actions .primary-action {
    flex: 0 0 auto;
  }

  .outline-panel,
  .canvas-panel,
  .inspector-panel,
  .ai-dock {
    border-radius: 20px;
  }

  .outline-panel,
  .canvas-panel,
  .inspector-panel {
    padding: 14px;
  }

  .title-fields,
  .font-grid {
    grid-template-columns: 1fr;
  }

  .item-card {
    grid-template-columns: 18px 34px minmax(0, 1fr);
    gap: 8px;
  }

  .item-actions {
    grid-column: 3;
    justify-self: end;
  }

  .canvas-toolbar,
  .panel-title {
    display: grid;
  }

  .canvas-tools {
    flex-wrap: wrap;
  }

  .canvas-stage {
    min-height: 360px;
    padding: 12px;
  }

  .poster {
    width: min(100%, 360px);
    border-radius: 20px;
  }

  .poster[data-aspect="16:9"] .poster-content {
    padding: 22px 24px 18px;
  }

  .poster[data-aspect="16:9"] .poster-list {
    grid-template-columns: 1fr;
  }

  .poster[data-aspect="16:9"] .poster-item:nth-child(n+4) {
    display: none;
  }

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

  .ai-dock {
    grid-template-columns: 38px minmax(0, 1fr);
    padding: 10px;
  }

  .progress-wrap,
  .stage-pills {
    grid-column: 1 / -1;
  }

  .stage-pills {
    overflow-x: auto;
  }

  .command-card header,
  .command-card footer,
  .drop-zone {
    align-items: stretch;
    flex-direction: column;
  }
}
