:root {
  color-scheme: light;
  --font-heading: Inter, ui-sans-serif, system-ui, sans-serif;
  --bg: #fbf8f2;
  --surface: #ffffff;
  --ink: #172026;
  --muted: #687276;
  --line: #ded7ca;
  --teal: #7342e2;
  --teal-dark: #5d34c2;
  --coral: #d95f44;
  --amber: #d99a21;
  --green: #2d7c4b;
  --blue: #3d679d;
  --shadow: 0 18px 48px rgba(32, 35, 34, 0.1);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
}

.bg-video,
.page-overlay {
  position: fixed;
  inset: 0;
}

.bg-video {
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.page-overlay {
  z-index: -1;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.68), transparent 34rem),
    linear-gradient(90deg, rgba(251, 248, 242, 0.96), rgba(251, 248, 242, 0.72));
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.eyebrow,
.token-balance,
small,
.hero-copy p,
.prompt-box span,
.simple-settings span,
.submit-row span {
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.user-chip[hidden] {
  display: none;
}

.user-chip span {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  font-weight: 900;
  text-transform: uppercase;
}

.token-balance {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.token-balance b {
  color: var(--ink);
}

.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 800;
  white-space: nowrap;
}

.primary-button {
  border-color: var(--teal-dark);
  background: var(--teal);
  color: #fff;
  box-shadow: 0 4px 24px rgba(115, 66, 226, 0.24);
}

.primary-button.small {
  min-height: 40px;
}

.ghost-button {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.user-main {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 48px;
}

.tool-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(420px, 1.22fr);
  gap: 28px;
  align-items: center;
  min-height: calc(100vh - 140px);
}

.tool-hero > *,
.generator-card,
.hero-copy {
  min-width: 0;
}

.hero-copy {
  display: grid;
  gap: 16px;
}

.eyebrow {
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 12ch;
  font-family: var(--font-heading);
  font-size: clamp(44px, 7vw, 82px);
  line-height: 0.98;
  overflow-wrap: anywhere;
}

.mobile-title-line {
  display: block;
}

.hero-copy p {
  width: 100%;
  max-width: 480px;
  font-size: 18px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.hero-copy p span {
  display: block;
}

.generator-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mode-button,
.quick-prompts button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.mode-button.is-active {
  border-color: rgba(15, 138, 125, 0.35);
  background: #e4f4f1;
  color: var(--teal-dark);
}

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

.prompt-box span,
.simple-settings span {
  font-size: 13px;
  font-weight: 800;
}

textarea,
select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 180px;
  padding: 16px;
  resize: vertical;
  font-size: 16px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

select,
input {
  min-height: 46px;
  padding: 0 12px;
}

textarea:focus,
select:focus,
input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 138, 125, 0.14);
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-prompts button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.upload-line {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px dashed #b7ad9f;
  border-radius: 8px;
  background: #fffaf1;
}

.upload-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #e4f4f1;
  color: var(--teal-dark);
  font-size: 24px;
  font-weight: 800;
}

.upload-line strong,
.upload-line small {
  display: block;
}

.simple-settings {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr 0.7fr;
  gap: 12px;
}

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

.submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(115, 66, 226, 0.11);
}

.submit-row strong {
  display: block;
  margin-top: 2px;
  font-size: 28px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

h2 {
  font-size: 30px;
}

.text-link {
  color: var(--teal-dark);
  font-weight: 800;
  text-decoration: none;
}

.result-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.9fr;
  gap: 12px;
}

.result-tile {
  display: flex;
  min-height: 220px;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px;
  border-radius: 8px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.12), transparent 38%),
    linear-gradient(130deg, #23303a, #3d679d 42%, #d95f44);
  color: #fff;
}

.result-tile span,
.result-tile small {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 800;
}

.result-tile strong {
  max-width: 12ch;
  font-size: 28px;
  line-height: 1.05;
}

.tile-warm {
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.16), transparent 38%),
    linear-gradient(130deg, #733527, #d95f44 46%, #d99a21);
}

.tile-green {
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.14), transparent 38%),
    linear-gradient(130deg, #143d3c, #0f8a7d 46%, #6cae72);
}

.model-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
}

.model-hint {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(25, 40, 55, 0.06);
  color: var(--muted);
  line-height: 1.5;
}

.model-strip span {
  color: var(--muted);
}

.model-strip b {
  padding: 8px 10px;
  border: 1px solid #474747;
  border-radius: 9999px;
  background: transparent;
  color: #ffffff;
  font-size: 13px;
  font-weight: 400;
}

.admin-main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 48px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.admin-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.admin-card h1 {
  max-width: 100%;
  font-size: 42px;
}

.admin-form,
.admin-model-list {
  display: grid;
  gap: 12px;
}

.admin-form label {
  display: grid;
  gap: 8px;
}

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

.admin-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.admin-model-row small {
  display: block;
  margin-top: 3px;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
}

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

.auth-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(6, 6, 6, 0.72);
  cursor: default;
}

.auth-panel {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(460px, 100%);
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.auth-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9999px;
  background: transparent;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 8px;
}

.auth-form span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.auth-error {
  min-height: 20px;
  color: #ff9b85;
  font-size: 13px;
  line-height: 1.5;
}

.auth-switch {
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
}

.toggle {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e4f4f1;
  color: var(--teal-dark);
  font-weight: 800;
}

.toggle.danger {
  background: rgba(217, 95, 68, 0.12);
  color: #d95f44;
}

@media (max-width: 920px) {
  .tool-hero,
  .admin-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .tool-hero {
    min-height: auto;
    padding: 18px 0 32px;
  }

  h1 {
    max-width: 100%;
    font-size: 46px;
  }
}

@media (max-width: 640px) {
  .site-header,
  .user-main {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
  }

  .tool-hero,
  .generator-card {
    width: 100%;
    max-width: 100%;
  }

  .site-header,
  .top-actions,
  .submit-row,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .primary-button,
  .ghost-button,
  .user-chip,
  .user-chip .chip-name {
    width: 100%;
  }

  .user-chip {
    display: grid;
    grid-template-columns: 40px 1fr auto;
  }

  .mode-switch,
  .simple-settings {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 38px;
    line-height: 1.04;
  }

  .hero-copy,
  .hero-copy p {
    max-width: 100%;
    overflow: hidden;
  }

  .mobile-title-line {
    display: block;
  }

  .generator-card {
    padding: 14px;
  }

  .upload-line {
    grid-template-columns: 1fr;
  }
}

/* xAI-inspired client theme override */
:root {
  --bg: #0c0c0b;
  --surface: #0c0c0b;
  --ink: #ffffff;
  --muted: #7d8187;
  --line: #1f2228;
  --teal: #ffffff;
  --teal-dark: #ffffff;
  --shadow: none;
}

body {
  background: #0c0c0b;
  color: #ffffff;
  font-weight: 400;
  letter-spacing: -0.025em;
}

.bg-video {
  display: none;
}

.page-overlay {
  background:
    radial-gradient(circle at 78% 42%, rgba(255, 255, 255, 0.18), transparent 10rem),
    radial-gradient(circle at 82% 46%, rgba(37, 99, 235, 0.16), transparent 22rem),
    linear-gradient(to top, rgba(255, 99, 8, 0.1), rgba(151, 196, 255, 0.04), transparent 36%),
    #0c0c0b;
}

.brand-mark {
  border: 1px solid #1f2228;
  background: #0c0c0b;
  color: #ffffff;
  font-weight: 400;
}

.user-chip span {
  border-color: #1f2228;
  background: #0c0c0b;
  color: #ffffff;
  font-weight: 400;
}

.brand strong,
.result-tile strong,
.upload-line strong,
.admin-model-row strong,
.token-balance b {
  font-weight: 400;
}

.brand small,
.eyebrow,
.token-balance,
small,
.hero-copy p,
.prompt-box span,
.simple-settings span,
.submit-row span,
.model-strip span,
.upload-line small {
  color: #7d8187;
}

.eyebrow {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.1em;
}

h1,
h2 {
  font-weight: 900;
  color: #ffffff;
}

#hero-title {
  font-family: SimHei, "Microsoft YaHei", Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 900;
}

.token-balance,
.generator-card,
.upload-line,
.submit-row,
.model-strip,
.admin-card,
.admin-model-row {
  border-color: #1f2228;
  background: transparent;
  box-shadow: none;
}

.generator-card,
.admin-card,
.admin-model-row,
.result-tile,
.model-strip,
.auth-panel {
  border-radius: 0;
}

.generator-card {
  border: 1px solid #1f2228;
  backdrop-filter: none;
}

.primary-button,
.ghost-button,
.mode-button,
.quick-prompts button,
.toggle,
.auth-close,
.auth-switch {
  border-color: #474747;
  border-radius: 9999px;
  background: transparent;
  color: #ffffff;
  box-shadow: none;
  font-weight: 400;
}

.primary-button {
  border-color: #ffffff;
}

.primary-button:hover,
.ghost-button:hover,
.mode-button:hover,
.quick-prompts button:hover,
.auth-close:hover,
.auth-switch:hover,
.toggle:hover {
  border-color: #ffffff;
  color: #ffffff;
}

.mode-button,
.quick-prompts button {
  color: #7d8187;
}

.mode-button.is-active {
  border-color: #ffffff;
  background: transparent;
  color: #ffffff;
}

textarea,
select,
input {
  border-color: #1f2228;
  border-radius: 24px;
  background: #0c0c0b;
  color: #ffffff;
}

textarea::placeholder,
input::placeholder {
  color: #7d8187;
}

textarea:focus,
select:focus,
input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px #71717a;
}

.upload-icon {
  border: 1px solid #1f2228;
  border-radius: 9999px;
  background: #0c0c0b;
  color: #ffffff;
}

.model-hint {
  border: 1px solid #1f2228;
  border-radius: 0;
  background: transparent;
  color: #7d8187;
}

.auth-panel {
  border-color: #1f2228;
  background: #0c0c0b;
  box-shadow: none;
}

.auth-form span,
.auth-panel p {
  color: #7d8187;
}

.toggle.danger {
  border-color: #5b2a25;
  background: transparent;
  color: #ff9b85;
}

.result-tile {
  border: 1px solid #1f2228;
  background:
    linear-gradient(135deg, transparent 0 44%, rgba(31, 34, 40, 0.9) 44% 45%, transparent 45% 100%),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.12), transparent 9rem),
    #0c0c0b;
}

.tile-warm,
.tile-green {
  background:
    linear-gradient(135deg, transparent 0 44%, rgba(31, 34, 40, 0.9) 44% 45%, transparent 45% 100%),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.12), transparent 9rem),
    #0c0c0b;
}

.result-tile span,
.result-tile small {
  color: #7d8187;
}

.text-link {
  color: #ffffff;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 48px));
  padding: 12px 16px;
  border: 1px solid #474747;
  border-radius: 9999px;
  background: #0c0c0b;
  color: #ffffff;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

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

@media (max-width: 640px) {
  .site-header,
  .user-main {
    width: 100%;
    max-width: 100%;
    padding-left: 24px;
    padding-right: 24px;
  }

  .tool-hero {
    display: block;
  }

  .generator-card {
    width: 100%;
    max-width: 100%;
    padding: 14px;
    overflow: hidden;
  }

  .generator-card *,
  .mode-switch,
  .quick-prompts,
  .simple-settings,
  textarea,
  select,
  input {
    min-width: 0;
    max-width: 100%;
  }

  .mode-switch,
  .simple-settings {
    grid-template-columns: 1fr;
  }
}
