:root {
  color-scheme: dark;
  --canvas: #0c0911;
  --surface: #15111d;
  --ink: #f6f2fb;
  --muted: #aaa1b7;
  --line: #30283a;
  --soft: #241d2d;
  --primary: #a878ff;
  --primary-hover: #bb92ff;
  --signal: #d792ff;
  --signal-ink: #170c22;
  --focus: 0 0 0 3px rgba(168, 120, 255, 0.3);
  --shadow: 0 20px 64px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(168, 120, 255, 0.04);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
  color: var(--ink);
  font-family: "DM Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 87% 18%, rgba(143, 93, 255, 0.13), transparent 28rem),
    radial-gradient(circle at 16% 84%, rgba(224, 91, 178, 0.07), transparent 26rem),
    linear-gradient(rgba(75, 62, 91, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(75, 62, 91, 0.2) 1px, transparent 1px),
    var(--canvas);
  background-position: -1px -1px;
  background-size: 72px 72px;
}

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

button,
label[for],
.upload-zone {
  cursor: pointer;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.upload-zone:focus-within {
  outline: none;
  box-shadow: var(--focus);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 9, 17, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  font-weight: 800;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 31px;
  height: 31px;
  border: 1px solid #d9c9ed;
  border-radius: 9px;
  background: linear-gradient(145deg, #7b52e7, #e48dcc);
  box-shadow: 0 0 22px rgba(168, 120, 255, 0.26);
}

.brand-mark::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 21px;
  height: 21px;
  border: 1px solid #d9c9ed;
  border-radius: 6px;
  background: var(--surface);
}

.brand-note {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.account-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.account-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

[data-user-name],
.account-nav .account-link:last-child {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-link:hover,
.account-signin,
.account-balance { color: var(--ink); border-color: var(--primary); }

@media (max-width: 680px) {
  .account-nav .account-link:first-child:not(:last-child) { display: none; }
  .account-link { min-width: 44px; min-height: 44px; padding: 0 10px; }
}

.language-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--canvas);
}

.language-switch button {
  min-width: 42px;
  min-height: 36px;
  padding: 0 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.language-switch button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--primary-hover);
  box-shadow: inset 0 0 0 1px #654783, 0 1px 5px rgba(0, 0, 0, 0.28);
}

.retention-badge,
.home-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.retention-badge {
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #594071;
  background: #21172d;
  color: #e4d0ff;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  white-space: nowrap;
}

.retention-badge svg,
.home-link svg {
  width: 17px;
  height: 17px;
}

.home-link {
  gap: 7px;
  padding: 0 13px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.page-shell {
  width: min(1400px, calc(100% - 48px));
  margin: 0 auto;
  padding: 44px 0 36px;
}

.eyebrow,
.panel-kicker,
.result-label,
.field-label,
.meta-label {
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  color: #b8adc5;
  font-size: 12px;
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 8px;
  border: 1px solid #cbb7e4;
  border-radius: 3px;
  background: linear-gradient(90deg, #8b61ff, #dd83c9);
}

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

h1,
h2,
h3 {
  font-family: "Manrope", sans-serif;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 440px);
  align-items: end;
  gap: 48px;
  min-height: 300px;
  padding: 34px 0 42px;
}

.home-hero h1 {
  max-width: 780px;
  margin-bottom: 0;
  font-size: clamp(50px, 6vw, 86px);
  line-height: 0.96;
  letter-spacing: -0.065em;
}

.hero-copy {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.hero-copy strong {
  color: var(--ink);
}

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

.tool-entry {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 230px;
  overflow: hidden;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(25, 20, 34, 0.98), rgba(16, 13, 22, 0.98));
  color: var(--ink);
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.tool-entry::before,
.tool-link[aria-current="page"]::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: linear-gradient(90deg, #8b61ff, #dd83c9);
}

.tool-entry:hover {
  border-color: #6f5685;
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.tool-entry h2 {
  margin: 2px 0 14px;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.tool-cover {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 1;
  flex: 0 0 auto;
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid #4d3a5e;
  border-radius: 12px;
  background: #100d16;
}

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

.tool-entry:hover .tool-cover img {
  transform: scale(1.018);
}

.tool-entry p {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.open-tool {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.open-tool svg {
  width: 16px;
  height: 16px;
}

.home-foot,
.prototype-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 16px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(21, 17, 29, 0.9);
  color: var(--muted);
  font-size: 12px;
}

.home-foot strong,
.prototype-note strong {
  color: var(--ink);
}

.tool-page-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  align-items: end;
  gap: 36px;
  margin-bottom: 26px;
}

.tool-page-head h1 {
  margin-bottom: 8px;
  font-size: clamp(38px, 4vw, 58px);
  line-height: 1;
  letter-spacing: -0.055em;
}

.tool-page-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.tool-switcher {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.tool-link {
  position: relative;
  min-height: 70px;
  overflow: hidden;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(21, 17, 29, 0.92);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
}

.tool-link span {
  display: block;
  margin-bottom: 5px;
  color: #8f849c;
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.05em;
}

.tool-link[aria-current="page"] {
  border-color: #7859a0;
  background: linear-gradient(160deg, #21172d, #100d16);
  color: var(--ink);
}

.tool-link[aria-current="page"] span {
  color: #d8b8ff;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
  min-height: 650px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.input-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.panel-head {
  padding: 28px 26px 22px;
  border-bottom: 1px solid var(--line);
}

.panel-kicker,
.result-label,
.meta-label {
  color: var(--muted);
  font-size: 10px;
}

.panel-head h2 {
  margin: 8px 0;
  font-size: 25px;
  letter-spacing: -0.04em;
}

.panel-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.tool-form {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.form-scroll {
  flex: 1;
  padding: 22px 26px;
}

.field + .field {
  margin-top: 20px;
}

.field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.field-label {
  font-size: 10px;
  font-weight: 600;
}

.field-hint {
  color: var(--muted);
  font-size: 11px;
}

.required {
  color: #ff8294;
}

.upload-zone {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 12px;
  min-height: 96px;
  padding: 14px;
  overflow: hidden;
  border: 1px dashed #665875;
  border-radius: 14px;
  background: #100d16;
  transition: 160ms ease;
}

.upload-zone:hover,
.upload-zone.is-dragging {
  border-color: var(--primary);
  background: #1c1328;
}

.upload-zone.has-file {
  border-style: solid;
  border-color: #9f73d2;
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-visual {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--soft);
}

.upload-visual svg {
  width: 21px;
  height: 21px;
}

.upload-visual img,
.upload-visual video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.upload-title,
.upload-help {
  display: block;
}

.upload-title {
  overflow: hidden;
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-help {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.upload-action {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.upload-action svg {
  width: 17px;
  height: 17px;
}

.select,
.textarea,
.text-input {
  width: 100%;
  border: 1px solid #705c82;
  border-radius: 11px;
  background: #100d16;
  color: var(--ink);
}

.select,
.text-input {
  min-height: 48px;
  padding: 0 13px;
}

.textarea {
  min-height: 104px;
  padding: 12px 13px;
  line-height: 1.5;
  resize: vertical;
}

.toggle-row,
.fixed-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #100d16;
}

.toggle-copy strong,
.toggle-copy span {
  display: block;
}

.toggle-copy strong {
  font-size: 13px;
}

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

.toggle {
  position: relative;
  width: 48px;
  height: 30px;
  flex: 0 0 auto;
}

.toggle input {
  position: absolute;
  opacity: 0;
}

.toggle-track {
  position: absolute;
  inset: 0;
  border: 1px solid #5d506a;
  border-radius: 999px;
  background: #30283a;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f7f1ff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  transition: transform 160ms ease;
}

.toggle input:checked + .toggle-track {
  border-color: var(--primary);
  background: linear-gradient(90deg, #7c52e7, #b86ff2);
  box-shadow: 0 0 14px rgba(168, 120, 255, 0.24);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(18px);
}

.form-action {
  padding: 18px 26px 22px;
  border-top: 1px solid var(--line);
}

.cost-note {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
  color: var(--muted);
  font-size: 11px;
}

.cost-note strong {
  color: var(--ink);
}

.generate-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(90deg, #7c52e7, #b86ff2);
  color: var(--signal-ink);
  font-family: "Manrope", sans-serif;
  font-weight: 750;
  box-shadow: 0 10px 28px rgba(139, 88, 230, 0.2);
}

.generate-button:hover:not(:disabled) {
  background: linear-gradient(90deg, #8e64ef, #ca84ff);
}

.generate-button:disabled {
  cursor: not-allowed;
  background: #2a2431;
  color: #746b7e;
  box-shadow: none;
}

.generate-button svg {
  width: 18px;
  height: 18px;
}

.result-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  background: #0f0c14;
}

.result-head,
.result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 24px;
  background: rgba(21, 17, 29, 0.94);
}

.result-head {
  min-height: 82px;
  border-bottom: 1px solid var(--line);
}

.result-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.result-title-wrap h3 {
  margin: 2px 0 0;
  font-size: 18px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #100d16;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #776d83;
}

.status-chip.is-running .status-dot {
  background: #c994ff;
  box-shadow: 0 0 10px rgba(201, 148, 255, 0.65);
}

.status-chip.is-success .status-dot {
  background: #53d6a5;
}

.status-chip.is-error .status-dot {
  background: #ff8294;
}

.save-policy {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 330px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  text-align: right;
}

.save-policy svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--ink);
}

.result-stage {
  display: grid;
  place-items: center;
  min-height: 430px;
  padding: 34px;
}

.empty-result {
  width: min(100%, 650px);
  padding: 54px 28px;
  border: 1px dashed #5f526d;
  border-radius: 18px;
  background: rgba(20, 16, 27, 0.78);
  text-align: center;
}

.empty-visual {
  position: relative;
  width: 118px;
  height: 118px;
  margin: 0 auto 24px;
}

.empty-frame {
  position: absolute;
  width: 82px;
  height: 96px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: #17121f;
}

.empty-frame:first-child {
  top: 0;
  left: 0;
}

.empty-frame:last-child {
  right: 0;
  bottom: 0;
  background: linear-gradient(145deg, #855ce8, #e18bcf);
  box-shadow: 0 0 30px rgba(168, 120, 255, 0.2);
}

.empty-frame:last-child::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: translate(-58%, -54%) rotate(-45deg);
}

.empty-result h3 {
  margin-bottom: 8px;
  font-size: 20px;
  letter-spacing: -0.025em;
}

.empty-result p {
  max-width: 420px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.generated-result {
  display: grid;
  width: 100%;
  min-height: 360px;
  place-items: center;
}

.generated-result img,
.generated-result video {
  display: block;
  max-width: 100%;
  max-height: 620px;
  border: 1px solid var(--line);
  border-radius: 16px;
  object-fit: contain;
  box-shadow: var(--shadow);
}

.generated-result video {
  width: auto;
  height: auto;
  background: #000;
}

.job-receipt {
  width: 100%;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
  overflow-wrap: anywhere;
}
.job-receipt h3 { margin: 0 0 10px; font-size: 18px; }
.job-receipt p { margin: 8px 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.job-receipt [data-receipt-billing] { color: var(--ink); }
.job-receipt-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.job-receipt-actions [hidden] { display: none; }
.job-receipt-actions .action-chip { min-height: 44px; white-space: normal; text-align: center; }
.result-stage:has(.job-receipt) { align-content: start; gap: 20px; }
.status-chip { max-width: 100%; }
.status-text { overflow-wrap: anywhere; }
.status-dot { flex: 0 0 auto; }

.result-actions {
  min-height: 84px;
  border-top: 1px solid var(--line);
}

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

.next-label {
  margin-right: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.action-chip,
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.action-chip {
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #18131f;
  color: #c2b7ce;
}

.action-chip:hover {
  border-color: #755a8d;
  color: var(--ink);
}

.download-button {
  gap: 8px;
  padding: 0 15px;
  border: 1px solid #7a5ba0;
  background: #2b2038;
  color: white;
  cursor: not-allowed;
  opacity: 0.38;
}

.download-button:not(:disabled) {
  cursor: pointer;
  opacity: 1;
}

.download-button svg {
  width: 16px;
  height: 16px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  max-width: 360px;
  padding: 13px 16px;
  border: 1px solid #6a4e83;
  border-radius: 12px;
  background: #21172d;
  color: white;
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: 180ms ease;
}

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

@media (max-width: 960px) {
  .tool-grid,
  .tool-switcher {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workbench {
    grid-template-columns: minmax(330px, 390px) minmax(0, 1fr);
  }

  .save-policy span {
    display: none;
  }
}

@media (max-width: 760px) {
  body:not(.home-page) .retention-badge,
  body:not(.home-page) .home-link,
  .account-nav .account-link:not(.account-balance):not(.account-signin) {
    display: none;
  }

  .account-balance {
    max-width: 98px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .page-shell {
    width: min(100% - 28px, 680px);
    padding-top: 28px;
  }

  .home-hero,
  .tool-page-head {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .home-hero {
    min-height: 0;
    padding-top: 18px;
  }

  .workbench {
    grid-template-columns: 1fr;
  }

  .input-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .result-stage {
    min-height: 330px;
  }
}

@media (max-width: 520px) {
  .topbar {
    min-height: 64px;
    padding: 0 15px;
  }

  .brand-note,
  .retention-badge span {
    display: none;
  }

  [data-user-name] { max-width: 92px; }

  .page-shell {
    width: calc(100% - 20px);
    padding-top: 18px;
  }

  .home-hero {
    padding-bottom: 24px;
  }

  .home-hero h1 {
    font-size: 42px;
  }

  .hero-copy {
    font-size: 15px;
  }

  .tool-entry {
    min-height: 190px;
    padding: 17px;
  }

  .tool-entry h2 {
    font-size: 17px;
  }

  .tool-entry p {
    display: none;
  }

  .tool-page-head h1 {
    font-size: 40px;
  }

  .tool-switcher {
    gap: 7px;
  }

  .tool-link {
    min-height: 66px;
    padding: 13px;
    font-size: 12px;
  }

  .panel-head,
  .form-scroll,
  .form-action {
    padding-right: 17px;
    padding-left: 17px;
  }

  .result-head,
  .result-actions {
    padding-right: 16px;
    padding-left: 16px;
  }

  .result-head {
    flex-wrap: wrap;
  }

  .save-policy {
    max-width: none;
    text-align: left;
  }

  .save-policy span {
    display: inline;
  }

  .result-stage {
    padding: 20px 16px;
  }

  .generated-result {
    min-height: 260px;
  }

  .job-receipt { padding: 16px; }
  .job-receipt-actions { flex-direction: column; }

  .empty-result {
    padding: 38px 18px;
  }

  .result-actions,
  .home-foot,
  .prototype-note {
    align-items: flex-start;
    flex-direction: column;
  }

  .download-button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .retention-badge {
    display: none;
  }

  .top-actions {
    gap: 7px;
  }

  .language-switch button {
    min-width: 38px;
  }
}

/* Homepage: compact tool launcher */
body.home-page {
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 8%, rgba(92, 44, 202, 0.35), transparent 28rem),
    radial-gradient(circle at 92% 4%, rgba(156, 39, 84, 0.24), transparent 30rem),
    radial-gradient(circle at 76% 94%, rgba(154, 104, 25, 0.2), transparent 27rem),
    #07060b;
  background-position: 0 0;
  background-size: auto;
}

body.home-page::before {
  content: "";
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

.home-page a,
.home-page button {
  touch-action: manipulation;
}

.home-page .topbar {
  top: 10px;
  width: min(1120px, calc(100% - 40px));
  min-height: 58px;
  margin: 18px auto 0;
  padding: 7px 10px 7px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(13, 10, 18, 0.72);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.home-page .brand {
  gap: 10px;
  min-height: 44px;
  font-size: 15px;
}

.home-page .brand-mark {
  width: 25px;
  height: 25px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(145deg, #9b73ff, #e879c9);
  box-shadow: 0 0 22px rgba(155, 115, 255, 0.34);
}

.home-page .brand-mark::after {
  display: none;
}

.home-page .brand-note {
  color: #837c8e;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.home-page .top-actions {
  gap: 7px;
}

.home-page .language-switch {
  padding: 2px;
  border-color: rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  background: #121019;
}

.home-page .language-switch button {
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
}

.home-page .home-nav-cta,
.home-page .hero-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.home-page .home-nav-cta {
  padding: 0 20px;
  background: linear-gradient(100deg, #8b61ff, #d36fd0);
  box-shadow: 0 0 24px rgba(143, 89, 255, 0.28);
}

.home-page .home-nav-cta:hover,
.home-page .hero-cta-primary:hover {
  box-shadow: 0 0 32px rgba(143, 89, 255, 0.42);
  transform: translateY(-1px);
}

.home-page .page-shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 40px));
  padding: 0 0 40px;
}

.home-page .home-hero {
  display: block;
  min-height: 0;
  padding: 76px 0 48px;
  text-align: center;
}

.home-page .eyebrow {
  gap: 8px;
  margin: 0 0 20px;
  padding: 8px 13px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(16, 13, 22, 0.72);
  color: #c9c2d3;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
}

.home-page .eyebrow::before {
  width: 7px;
  height: 7px;
  border: 0;
  border-radius: 50%;
  background: #e879c9;
  box-shadow: 0 0 12px #e879c9;
}

.home-page .home-hero h1 {
  max-width: 920px;
  margin: 0 auto;
  font-size: clamp(44px, 5.4vw, 72px);
  line-height: 1.05;
  letter-spacing: -0.055em;
}

.home-page .gradient-copy {
  background: linear-gradient(90deg, #bd8bff 5%, #e97fca 53%, #f2a06f 96%);
  background-clip: text;
  color: transparent;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.home-page .hero-copy {
  max-width: 630px;
  margin: 22px auto 0;
  color: #aaa4b3;
  font-size: 16px;
  line-height: 1.8;
}

.home-page .hero-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
}

.home-page .hero-cta {
  min-width: 148px;
  padding: 0 24px;
}

.home-page .hero-cta-primary {
  background: linear-gradient(100deg, #8b61ff, #d36fd0);
  box-shadow: 0 0 28px rgba(143, 89, 255, 0.3);
}

.home-page .hero-cta-secondary {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(18, 15, 25, 0.76);
  color: #d7d1dd;
}

.home-page .hero-cta-secondary:hover {
  border-color: rgba(196, 153, 255, 0.36);
  transform: translateY(-1px);
}

.home-page .home-tools {
  scroll-margin-top: 88px;
}

.home-page .home-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 14px;
}

.home-page .home-section-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.025em;
}

.home-page .home-section-head p {
  margin: 0;
  color: #827b8d;
  font-size: 12px;
}

.home-page .tool-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.home-page .tool-entry {
  display: grid;
  grid-template-columns: 178px minmax(0, 1fr);
  gap: 18px;
  min-height: 156px;
  padding: 14px;
  border-color: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(19, 16, 26, 0.95), rgba(11, 9, 15, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025), 0 18px 40px rgba(0, 0, 0, 0.18);
  transition: transform 200ms ease, border-color 200ms ease, background 200ms ease;
}

.home-page .tool-entry::before {
  display: none;
}

.home-page .tool-entry:hover {
  border-color: rgba(177, 126, 255, 0.38);
  background: linear-gradient(145deg, rgba(25, 19, 34, 0.98), rgba(12, 10, 17, 0.98));
  transform: translateY(-2px);
}

.home-page .tool-cover {
  min-height: 126px;
  aspect-ratio: auto;
  margin: 0;
  border-color: rgba(255, 255, 255, 0.07);
  border-radius: 14px;
}

.home-page .tool-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 2px 4px 2px 0;
}

.home-page .tool-type {
  color: #9a91a5;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.home-page .tool-entry h2 {
  margin: 8px 0 5px;
  font-size: 18px;
  letter-spacing: -0.025em;
}

.home-page .tool-entry p {
  margin: 0;
  color: #9c95a6;
  font-size: 12px;
  line-height: 1.55;
}

.home-page .open-tool {
  min-height: 44px;
  gap: 8px;
  color: #c79aff;
  font-size: 12px;
}

.home-page .open-tool svg {
  width: 24px;
  height: 24px;
  padding: 5px;
  border: 1px solid rgba(199, 154, 255, 0.25);
  border-radius: 50%;
  background: rgba(157, 99, 255, 0.08);
}

.home-page .home-foot {
  margin-top: 14px;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(13, 10, 18, 0.62);
}

@media (max-width: 820px) {
  .home-page .brand-note {
    display: none;
  }

  .home-page .home-hero {
    padding-top: 58px;
  }

  .home-page .tool-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .home-page .topbar {
    top: 8px;
    width: calc(100% - 24px);
    min-height: 56px;
    margin-top: 10px;
    padding: 5px 6px 5px 12px;
  }

  .home-page .home-nav-cta {
    display: none;
  }

  .home-page .language-switch button {
    min-width: 44px;
    min-height: 44px;
  }

  .home-page .page-shell {
    width: calc(100% - 24px);
    padding-top: 0;
  }

  .home-page .home-hero {
    padding: 48px 0 36px;
    text-align: left;
  }

  .home-page .home-hero h1 {
    font-size: 40px;
  }

  .home-page .hero-copy {
    margin-left: 0;
    font-size: 14px;
  }

  .home-page .hero-actions {
    justify-content: flex-start;
  }

  .home-page .hero-cta {
    min-width: 0;
    flex: 1;
    padding: 0 14px;
  }

  .home-page .home-section-head p {
    display: none;
  }

  .home-page .tool-entry {
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 13px;
    min-height: 136px;
    padding: 11px;
    border-radius: 17px;
  }

  .home-page .tool-cover {
    min-height: 112px;
  }

  .home-page .tool-entry h2 {
    font-size: 16px;
  }

  .home-page .tool-entry p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
}

@media (max-width: 380px) {
  .home-page .home-hero h1 {
    font-size: 36px;
  }

  .home-page .tool-entry {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .home-page .tool-cover {
    min-height: 104px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
