:root {
  color-scheme: dark;
  --bg: #070809;
  --sidebar: #090a0b;
  --panel: #111316;
  --panel-2: #181b20;
  --panel-3: #20242a;
  --text: #f4f5f2;
  --muted: #9299a3;
  --line: rgba(255, 255, 255, 0.1);
  --lime: #d8ff64;
  --cyan: #76e4ff;
  --pink: #ff77b7;
  --amber: #ffbd63;
  --green: #74e39a;
  --red: #ff6f6f;
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

button,
input,
textarea,
select {
  max-width: 100%;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}

.brand,
.nav-item,
.chip,
.mode-button,
.ghost-button,
.text-button,
.avatar-button,
.primary-button,
.secondary-button,
.icon-button,
.close-button,
.price-card,
.quick-card {
  border: 0;
  color: var(--text);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 6px;
  background: transparent;
  color: var(--text);
  font-weight: 820;
  text-decoration: none;
}

.brand > span:not(.brand-mark) {
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0;
}

.brand-mark,
.avatar-button,
.profile-avatar {
  display: grid;
  place-items: center;
  background: var(--text);
  color: #0b0c0d;
  font-weight: 900;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.nav-list {
  display: grid;
  gap: 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 11px;
  border-radius: 8px;
  background: transparent;
  color: #d9dee3;
  text-decoration: none;
  text-align: left;
}

.nav-item:hover,
.nav-item.is-active {
  background: #1a1d21;
  color: #fff;
}

.count {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--lime);
  color: #141608;
  font-size: 12px;
  text-align: center;
}

.credit-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.muted,
.section-kicker {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.section-kicker {
  margin-bottom: 6px;
  color: var(--lime);
  font-weight: 760;
  text-transform: uppercase;
}

.credit-card strong {
  display: block;
  margin-top: 3px;
  font-size: 28px;
}

.workspace {
  min-width: 0;
  overflow-y: auto;
  background:
    radial-gradient(circle at 30% -12%, rgba(118, 228, 255, 0.11), transparent 25%),
    radial-gradient(circle at 86% 0%, rgba(216, 255, 100, 0.08), transparent 24%),
    #070809;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  background: rgba(7, 8, 9, 0.8);
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.view {
  display: none;
  padding: 24px;
}

.view.is-visible {
  display: block;
}

#view-chat.is-visible {
  display: block;
  height: calc(100vh - 71px);
  overflow: hidden;
}

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

h1 {
  max-width: 840px;
  font-size: clamp(42px, 5.5vw, 82px);
  line-height: 0.97;
  letter-spacing: 0;
}

h2 {
  font-size: 26px;
}

h3 {
  font-size: 18px;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(340px, 0.92fr) minmax(380px, 1fr);
  gap: 22px;
  min-height: 460px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(130deg, rgba(255, 255, 255, 0.12), transparent 42%),
    var(--panel);
  box-shadow: var(--shadow);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.eyebrow {
  width: max-content;
  margin-bottom: 16px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(216, 255, 100, 0.12);
  color: var(--lime);
  font-size: 12px;
  font-weight: 780;
  text-transform: uppercase;
}

.hero-subtitle {
  max-width: 650px;
  margin-top: 18px;
  color: #c5cbd2;
  font-size: 18px;
  line-height: 1.45;
}

.hero-actions,
.composer-actions,
.card-actions,
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

.hero-actions,
.composer-actions {
  margin-top: 22px;
}

.hero-media {
  position: relative;
  min-height: 390px;
  overflow: hidden;
  border-radius: 8px;
  background: #0c0e10;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.motion-card {
  position: absolute;
  min-width: 86px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.56);
  color: #fff;
  font-weight: 780;
  backdrop-filter: blur(12px);
}

.card-one {
  left: 22px;
  bottom: 28px;
}

.card-two {
  top: 24px;
  right: 28px;
}

.card-three {
  right: 32px;
  bottom: 38px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.text-button,
.chip,
.mode-button {
  min-height: 40px;
  border-radius: 8px;
}

.primary-button {
  padding: 0 18px;
  background: var(--lime);
  color: #121408;
  font-weight: 840;
}

.secondary-button,
.ghost-button {
  padding: 0 15px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
}

.icon-button {
  width: 38px;
  background: #252a31;
  font-weight: 840;
}

.text-button {
  background: transparent;
  color: var(--lime);
}

.avatar-button {
  width: 42px;
  height: 42px;
  border-radius: 8px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.quick-card {
  display: grid;
  gap: 7px;
  min-height: 106px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  text-align: left;
}

.quick-card:hover,
.app-card:hover,
.preset-card:hover,
.community-card:hover,
.project-card:hover,
.enhance-card:hover,
.feature-card:hover {
  border-color: rgba(216, 255, 100, 0.38);
  background: #171a1f;
}

.quick-card span,
.app-meta span,
.preset-meta span,
.library-meta span,
.community-meta span,
.community-meta small,
.feature-card span,
.motion-card-large span,
.enhance-card span,
.project-card p,
.lesson-card p,
.story-card p,
.price-card p,
.mini-project span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.section-head,
.studio-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin: 34px 0 16px;
}

.compact-head {
  margin-top: 0;
}

.chip,
.mode-button {
  padding: 0 11px;
  background: rgba(255, 255, 255, 0.055);
  color: #c8ced5;
}

.chip.is-active,
.mode-button.is-active {
  background: #f2f3ee;
  color: #080909;
}

.app-grid,
.feature-grid,
.motion-grid,
.enhance-grid,
.cinema-grid,
.skills-grid,
.community-grid,
.project-grid,
.lesson-grid,
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.app-card,
.preset-card,
.library-card,
.community-card,
.project-card,
.enhance-card,
.feature-card,
.lesson-card,
.story-card,
.composer,
.result-panel,
.profile-card,
.settings-card,
.metric-card,
.price-card,
.credit-history,
.mini-project {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.app-card,
.feature-card,
.enhance-card,
.lesson-card,
.project-card,
.story-card {
  padding: 14px;
}

.app-card button,
.preset-card button,
.quick-card {
  width: 100%;
}

.app-card button,
.preset-card button {
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.app-thumb,
.preset-thumb,
.library-thumb,
.community-art,
.feature-art,
.motion-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #12151a;
}

.thumb-a { background-image: url("./assets/thumb-a.webp"); }
.thumb-b { background-image: url("./assets/thumb-b.webp"); }
.thumb-c { background-image: url("./assets/thumb-c.webp"); }
.thumb-d { background-image: url("./assets/thumb-d.webp"); }
.thumb-e { background-image: url("./assets/thumb-e.webp"); }
.thumb-f { background-image: url("./assets/thumb-f.webp"); }

.app-meta,
.preset-meta,
.library-meta,
.community-meta {
  display: grid;
  gap: 5px;
  padding-top: 12px;
}

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

.preset-card {
  overflow: hidden;
}

.preset-meta,
.library-meta,
.community-meta {
  padding: 12px;
}

.split-section {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.8fr);
  gap: 18px;
  margin-top: 30px;
}

.project-list {
  display: grid;
  gap: 10px;
}

.mini-project {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.generate-layout {
  display: grid;
  grid-template-columns: minmax(390px, 520px) minmax(460px, 1fr);
  gap: 18px;
  align-items: start;
}

.composer,
.result-panel {
  padding: 18px;
}

.composer-head,
.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.mode-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.workflow-steps span {
  min-height: 34px;
  padding: 9px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #d8dde2;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  text-align: center;
}

.field-label,
.control-grid label span,
.form-row label span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

textarea,
input.text-input,
input.login-input,
select,
.file-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: #0b0d0f;
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 150px;
  padding: 14px;
}

input.text-input,
input.login-input,
select,
.file-input {
  min-height: 42px;
  padding: 0 12px;
}

.file-input {
  padding-top: 9px;
}

.prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 16px;
}

.prompt-chip {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: #dce1e6;
  font-size: 13px;
}

.field-help {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.form-row,
.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.prompt-generate-row {
  display: flex;
  justify-content: flex-start;
  margin: 10px 0 16px;
}

.prompt-generate-row .primary-button {
  min-width: 190px;
}

.control-grid {
  margin: 16px 0;
}

.standalone-controls {
  max-width: 920px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.result-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: calc(100vh - 178px);
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 36%),
    #090a0b;
}

.preview-art {
  position: relative;
  overflow: hidden;
  width: min(72%, 560px);
  aspect-ratio: 4 / 5;
  border-radius: 8px;
  background-image: url("./assets/thumb-b.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #111315;
  box-shadow: 0 36px 90px rgba(0, 0, 0, 0.58);
  transition: transform 260ms ease, filter 260ms ease;
}

.result-preview.is-video .preview-art {
  animation: motionPreview 4s ease-in-out infinite alternate;
}

.result-preview.is-working .preview-art {
  filter: blur(8px) saturate(1.6);
  transform: scale(0.96);
}

@keyframes motionPreview {
  from {
    transform: scale(1) translateX(-8px);
  }
  to {
    transform: scale(1.08) translateX(8px);
  }
}

.preview-caption,
.video-badge,
.asset-type,
.status-pill,
.balance-pill {
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  color: #dfe4e9;
}

.preview-caption {
  position: absolute;
  align-self: end;
  margin-bottom: 34px;
  padding: 8px 12px;
  color: var(--muted);
}

.video-badge {
  position: absolute;
  top: 18px;
  left: 18px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 760;
}

.preview-text-overlay {
  position: absolute;
  left: 50%;
  z-index: 2;
  display: none;
  width: min(62%, 520px);
  transform: translateX(-50%);
  padding: 12px 18px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.44);
  color: #ffffff;
  font-size: clamp(24px, 4vw, 58px);
  font-weight: 900;
  line-height: 1;
  text-align: center;
  overflow-wrap: anywhere;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.86);
}

.preview-text-overlay.is-visible {
  display: block;
}

.preview-text-overlay.text-top {
  top: 11%;
}

.preview-text-overlay.text-center {
  top: 50%;
  transform: translate(-50%, -50%);
}

.preview-text-overlay.text-bottom {
  bottom: 12%;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.compare-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101216;
}

.compare-art {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.compare-art span {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  padding: 5px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.56);
  text-align: center;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.motion-card-large {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.motion-0 { background: linear-gradient(135deg, #232f42, #75e5ff); }
.motion-1 { background: linear-gradient(135deg, #241f35, #ff77b7); }
.motion-2 { background: linear-gradient(135deg, #242919, #d8ff64); }
.motion-3 { background: linear-gradient(135deg, #352817, #ffbd63); }

.library-thumb-wrap {
  position: relative;
  overflow: hidden;
}

.library-thumb,
.community-art {
  aspect-ratio: 4 / 5;
}

.library-text-overlay {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  padding: 6px 8px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 15px;
  font-weight: 850;
  line-height: 1.05;
  text-align: center;
  overflow-wrap: anywhere;
}

.asset-type {
  position: absolute;
  top: 9px;
  left: 9px;
  padding: 5px 8px;
  font-size: 11px;
  text-transform: uppercase;
}

.library-actions,
.card-actions {
  padding: 0 12px 12px;
}

.community-card {
  overflow: hidden;
}

.project-card {
  min-height: 178px;
}

.status-pill,
.balance-pill {
  width: max-content;
  padding: 6px 10px;
  color: var(--lime);
  font-size: 12px;
}

.storyboard {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
}

.story-card span {
  display: block;
  margin-bottom: 32px;
  color: var(--lime);
  font-weight: 800;
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 18px;
  height: 100%;
  min-height: 0;
}

.chat-panel,
.history-panel {
  display: flex;
  min-height: 0;
  max-height: 100%;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.chat-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
  padding: 18px;
}

.history-panel {
  overflow: hidden;
  padding: 16px;
}

.chat-mode-select {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  color-scheme: light;
}

.chat-mode-select option {
  background: #ffffff;
  color: #111827;
}

.chat-mode-select option:checked,
.chat-mode-select option:hover,
.chat-mode-select option:focus {
  background: #2f80ed;
  color: #ffffff;
}

.chat-model-field {
  display: grid;
  gap: 4px;
  min-width: 210px;
}

.chat-model-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.chat-head-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-left: auto;
}

.new-chat-button,
.chat-history-new {
  min-height: 38px;
  white-space: nowrap;
}

.chat-head-actions .new-chat-button {
  min-width: 124px;
}

.chat-history-new {
  width: 100%;
  margin-bottom: 12px;
}

.chat-thread {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #08090a;
}

.chat-message {
  display: flex;
}

.chat-message.is-user {
  justify-content: flex-end;
}

.chat-bubble {
  max-width: min(720px, 82%);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15181d;
  color: #eef2f5;
}

.chat-message.is-user .chat-bubble {
  border-color: rgba(216, 255, 100, 0.42);
  background: rgba(216, 255, 100, 0.12);
}

.chat-bubble.is-typing {
  width: auto;
  min-width: 64px;
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 18px;
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d8ff64;
  opacity: 0.28;
  animation: typing-dot 1.15s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.16s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes typing-dot {
  0%,
  80%,
  100% {
    opacity: 0.28;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.chat-bubble p {
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
}

.chat-bubble span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.chat-image {
  display: block;
  width: 100%;
  max-height: 520px;
  margin-top: 8px;
  border-radius: 8px;
  object-fit: contain;
  background: #050607;
}

.chat-composer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.chat-document-panel {
  display: none;
  gap: 8px;
  margin-top: 10px;
}

.chat-document-panel.has-documents {
  display: grid;
}

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

.chat-document-item strong,
.chat-document-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-document-item strong {
  color: var(--text);
  font-size: 13px;
}

.chat-document-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.chat-document-item.is-ready {
  border-color: rgba(216, 255, 100, 0.45);
}

.chat-document-item.is-error {
  border-color: rgba(255, 91, 91, 0.55);
}

.chat-drop-overlay {
  pointer-events: none;
  position: absolute;
  inset: 96px 18px 154px;
  z-index: 5;
  display: none;
  place-items: center;
  border: 2px dashed rgba(216, 255, 100, 0.68);
  border-radius: 8px;
  background: rgba(8, 9, 10, 0.82);
  color: #d8ff64;
  font-weight: 900;
}

.chat-panel.is-drag-over .chat-drop-overlay {
  display: grid;
}

.chat-document-remove {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
}

.chat-composer-actions {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: end;
  gap: 10px;
  align-items: center;
}

.chat-composer-actions #chatGenerateButton {
  min-width: 156px;
  min-height: 42px;
  padding-inline: 22px;
}

.chat-attach-button {
  position: relative;
  display: inline-grid;
  width: 42px;
  height: 42px;
  min-width: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
}

.chat-attach-button:hover {
  border-color: rgba(216, 255, 100, 0.48);
  background: rgba(216, 255, 100, 0.12);
}

.paperclip-icon {
  position: relative;
  display: block;
  width: 14px;
  height: 24px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  transform: rotate(42deg);
}

.paperclip-icon::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 3px;
  width: 6px;
  height: 15px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.paperclip-icon::after {
  content: "";
  position: absolute;
  right: -2px;
  bottom: -4px;
  width: 2px;
  height: 8px;
  border-radius: 2px;
  background: currentColor;
}

.chat-composer textarea {
  width: 100%;
  min-height: 112px;
  max-height: 220px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  resize: vertical;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.chat-session-list {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
}

.chat-session-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101216;
  color: var(--text);
  text-align: left;
}

.chat-session-item:hover,
.chat-session-item.is-active {
  border-color: rgba(216, 255, 100, 0.48);
  background: rgba(216, 255, 100, 0.1);
}

.chat-session-open {
  display: grid;
  gap: 6px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.chat-session-open strong,
.chat-session-open span,
.chat-session-open small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-session-open span {
  color: #c8ced5;
  font-size: 13px;
}

.chat-session-open small {
  color: var(--muted);
  font-size: 12px;
}

.chat-session-rename {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #dce3e8;
  font-size: 12px;
}

.chat-session-rename:hover {
  border-color: rgba(216, 255, 100, 0.48);
  color: var(--lime);
}

.generation-history-list {
  display: grid;
  gap: 10px;
  overflow-y: auto;
  padding-right: 2px;
}

.home-history-section {
  margin: 16px 0 24px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.studio-history-section {
  width: 100%;
}

.home-history-list {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  max-height: 360px;
}

.generation-history-item {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101216;
}

.generation-history-item div:first-child,
.history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.generation-history-item strong {
  text-transform: capitalize;
}

.generation-history-item span,
.generation-history-item p,
.history-meta {
  color: var(--muted);
}

.generation-history-item p {
  margin: 0;
  line-height: 1.4;
}

.history-thumb-link {
  display: block;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #070809;
  text-decoration: none;
}

.history-thumb-link.is-video {
  aspect-ratio: 16 / 9;
}

.history-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #070809;
}

.history-prompt {
  display: -webkit-box;
  overflow: hidden;
  min-height: 38px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 12px;
}

.history-meta b {
  color: var(--lime);
}

.inline-empty {
  display: grid;
  min-height: 160px;
}

.profile-layout {
  display: grid;
  grid-template-columns: 320px minmax(360px, 1fr);
  gap: 18px;
}

.profile-card,
.settings-card {
  padding: 22px;
}

.profile-avatar {
  width: 92px;
  height: 92px;
  margin-bottom: 18px;
  border-radius: 8px;
  font-size: 28px;
}

.profile-card p {
  margin: 8px 0 22px;
  color: var(--muted);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  border-bottom: 1px solid var(--line);
}

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

.price-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.price-card {
  display: grid;
  gap: 12px;
  min-height: 230px;
  padding: 16px;
  text-align: left;
}

.price-card strong {
  font-size: 24px;
}

.plan-price {
  display: block;
  color: var(--lime);
  font-size: 18px;
  font-weight: 850;
}

.price-card.is-featured {
  border-color: rgba(216, 255, 100, 0.58);
  background: rgba(216, 255, 100, 0.1);
}

.credit-history {
  margin-top: 16px;
  padding: 16px;
}

.history-row {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.history-row span,
.history-row em {
  color: var(--muted);
  font-style: normal;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric-card {
  display: grid;
  gap: 8px;
  padding: 16px;
}

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

.metric-card strong {
  font-size: 30px;
}

.admin-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.admin-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.empty-state {
  display: none;
  place-items: center;
  gap: 16px;
  min-height: 320px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.empty-state.is-visible {
  display: grid;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
}

.modal.is-open {
  display: grid;
}

.modal-panel {
  width: min(420px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111315;
  box-shadow: var(--shadow);
}

.login-panel {
  display: grid;
  gap: 12px;
}

.login-hint {
  color: var(--muted);
}

.admin-only {
  display: none;
}

body.is-admin .admin-only {
  display: flex;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  transform: translateY(18px);
  opacity: 0;
  max-width: min(380px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2f3ee;
  color: #080909;
  font-weight: 740;
  transition: opacity 160ms ease, transform 160ms ease;
}

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

.seo-page {
  min-height: 100vh;
  padding: 24px;
  background: var(--bg);
}

.seo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.seo-content {
  max-width: 980px;
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.seo-content h2,
.seo-content h3 {
  margin-top: 20px;
}

.seo-content p {
  margin-top: 8px;
  color: #c8ced5;
  line-height: 1.6;
}

.video-provider-body {
  overflow: auto;
}

.video-provider-page {
  min-height: 100vh;
  padding: 22px;
  background:
    radial-gradient(circle at 22% 0%, rgba(118, 228, 255, 0.13), transparent 26%),
    radial-gradient(circle at 92% 8%, rgba(255, 119, 183, 0.09), transparent 24%),
    #070809;
}

.provider-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.provider-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.provider-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #dce2e8;
  text-decoration: none;
}

.provider-chip.is-active {
  border-color: rgba(216, 255, 100, 0.8);
  background: rgba(216, 255, 100, 0.13);
  color: #f7ffd4;
}

.provider-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  gap: 18px;
  align-items: stretch;
}

.provider-copy,
.provider-generator,
.provider-info,
.provider-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 19, 22, 0.86);
  box-shadow: var(--shadow);
}

.provider-copy {
  padding: 26px;
}

.provider-copy h1 {
  max-width: 760px;
  margin: 8px 0 12px;
  font-size: clamp(34px, 6vw, 72px);
  line-height: 0.95;
}

.provider-copy p {
  max-width: 780px;
  color: #c8ced5;
  line-height: 1.6;
}

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

.provider-fact {
  min-height: 92px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.provider-fact strong {
  display: block;
  margin-top: 5px;
  line-height: 1.25;
}

.provider-generator {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.provider-generator label {
  display: grid;
  gap: 7px;
  color: #cdd4dc;
  font-size: 13px;
  font-weight: 720;
}

.provider-generator textarea,
.provider-generator input,
.provider-generator select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.provider-generator textarea {
  min-height: 140px;
  padding: 13px;
  resize: vertical;
}

.provider-generator input,
.provider-generator select {
  min-height: 42px;
  padding: 0 12px;
}

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

.provider-result {
  margin-top: 18px;
  padding: 18px;
}

.provider-result-frame {
  display: grid;
  min-height: 360px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050607;
}

.provider-result-frame img {
  width: 100%;
  height: 100%;
  max-height: 520px;
  object-fit: contain;
}

.provider-result-frame video,
.preview-art video {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 560px;
  object-fit: contain;
  background: #050607;
}

.preview-art video {
  position: absolute;
  inset: 0;
  max-height: none;
}

.provider-status {
  margin-top: 12px;
  color: #c8ced5;
  line-height: 1.55;
}

.provider-info {
  margin-top: 18px;
  padding: 22px;
}

.provider-info-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 10px;
}

.provider-info-card {
  min-height: 150px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.provider-info-card p {
  color: #c8ced5;
  line-height: 1.45;
}

.provider-output-link {
  color: var(--lime);
}

.script-page {
  max-width: 1320px;
}

.script-hero {
  align-items: stretch;
}

.script-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.script-output {
  min-height: 520px;
  margin: 0;
  overflow: visible;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: #050607;
  color: #eef2f4;
  font: 14px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.provider-status[data-tone="success"] {
  color: var(--lime);
}

.provider-status[data-tone="warning"] {
  color: #ffd37a;
}

.provider-status[data-tone="error"] {
  color: #ff9a9a;
}

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

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    max-height: none;
  }

  .nav-list {
    grid-template-columns: repeat(4, 1fr);
  }

  .dashboard-hero,
  .generate-layout,
  .split-section,
  .profile-layout,
  .chat-layout {
    grid-template-columns: 1fr;
  }

  .quick-grid,
  .price-grid,
  .admin-grid,
  .storyboard,
  .home-history-list {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .result-preview {
    min-height: 560px;
  }

  .chat-layout {
    height: auto;
    min-height: auto;
  }

  .chat-panel,
  .history-panel {
    max-height: none;
  }

  .chat-panel {
    display: flex;
  }

  .chat-thread {
    min-height: 360px;
  }
}

@media (max-width: 680px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .ghost-button {
    display: none;
  }

  .view {
    padding: 14px;
  }

  .dashboard-hero {
    padding: 20px;
  }

  h1 {
    font-size: 42px;
  }

  .nav-list,
  .quick-grid,
  .app-grid,
  .preset-grid,
  .feature-grid,
  .motion-grid,
  .enhance-grid,
  .community-grid,
  .project-grid,
  .lesson-grid,
  .library-grid,
  .control-grid,
  .form-row,
  .compare-grid,
  .price-grid,
  .admin-grid,
  .storyboard,
  .workflow-steps,
  .history-row,
  .home-history-list,
  .chat-layout {
    grid-template-columns: 1fr;
  }

  .section-head,
  .studio-header,
  .composer-head,
  .result-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .chat-head-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .chat-model-field {
    width: 100%;
  }

  .new-chat-button,
  .chat-mode-select {
    width: 100%;
  }

  .chat-composer-actions {
    grid-template-columns: auto auto;
    justify-content: end;
  }

  .chat-attach-button {
    justify-self: end;
  }

  .chat-session-item {
    grid-template-columns: 1fr;
  }

  .chat-session-rename {
    width: 100%;
  }

  .chat-bubble {
    max-width: 100%;
  }
}
