:root {
  color-scheme: dark;
  --ink: #f8fbf4;
  --muted: #aab5ad;
  --dark: #101820;
  --dark-2: #17242b;
  --panel: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.16);
  --acid: #c9ff3d;
  --cyan: #2ee7d2;
  --coral: #ff6b5b;
  --yellow: #ffd166;
  --pink: #ff4faf;
  --blue: #4b8cff;
  --radius: 8px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--dark);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(46, 231, 210, 0.12), transparent 24rem),
    linear-gradient(135deg, #101820 0%, #17242b 52%, #1f1518 100%);
}

button,
input,
a {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.topbar,
.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: rgba(16, 24, 32, 0.82);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  color: #101820;
  background: linear-gradient(135deg, var(--acid), var(--cyan));
  font-weight: 950;
}

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

.brand strong {
  font-size: 0.98rem;
}

.brand small {
  color: var(--muted);
  font-size: 0.72rem;
}

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

.site-nav nav a {
  color: var(--muted);
  font-size: 0.95rem;
}

.site-nav nav .nav-cta,
.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

.icon-btn,
.text-button,
.ghost-action,
.mode-tabs button,
.style-swatches button,
.primary-btn,
.secondary-btn,
.icon-text-btn {
  cursor: pointer;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
}

.app-layout {
  display: grid;
  grid-template-columns: minmax(320px, 520px) minmax(360px, 1fr);
  gap: clamp(18px, 3vw, 34px);
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: clamp(16px, 3vw, 32px);
}

.tool-panel,
.result-stage {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.075);
  box-shadow: var(--shadow);
}

.creator-panel {
  align-self: start;
  display: grid;
  gap: 18px;
  padding: clamp(16px, 3vw, 24px);
}

.panel-head,
.result-head,
.section-label,
.quiz-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  max-width: 14ch;
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4.8rem);
  line-height: 0.95;
}

.creator-panel h1 {
  max-width: 12ch;
  font-size: clamp(1.95rem, 4.6vw, 3.4rem);
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.25rem, 2.5vw, 2.1rem);
  line-height: 1.08;
}

.quota,
.ai-badge,
.rarity-badge,
.sample-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(201, 255, 61, 0.4);
  border-radius: var(--radius);
  color: var(--acid);
  background: rgba(201, 255, 61, 0.08);
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.status-stack {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.ai-badge {
  border-color: rgba(46, 231, 210, 0.36);
  color: var(--cyan);
  background: rgba(46, 231, 210, 0.08);
}

.ai-badge.ready {
  border-color: rgba(201, 255, 61, 0.45);
  color: var(--acid);
  background: rgba(201, 255, 61, 0.08);
}

.ai-badge.offline {
  border-color: rgba(255, 209, 102, 0.45);
  color: var(--yellow);
  background: rgba(255, 209, 102, 0.08);
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.18);
}

.mode-tabs button {
  min-height: 42px;
  padding: 8px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 780;
}

.mode-tabs button.active {
  color: #101820;
  background: var(--acid);
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 108px;
  gap: 10px;
  min-height: 188px;
}

.upload-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 188px;
  overflow: hidden;
  border: 1px dashed rgba(255, 255, 255, 0.32);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(75, 140, 255, 0.18), transparent 50%),
    rgba(255, 255, 255, 0.045);
  cursor: pointer;
}

.upload-zone.dragover {
  border-color: var(--acid);
  background: rgba(201, 255, 61, 0.12);
}

.upload-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.upload-zone img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 18px;
  text-align: center;
}

.upload-empty svg {
  width: 34px;
  height: 34px;
  color: var(--cyan);
}

.upload-empty strong {
  font-size: 1.05rem;
}

.upload-empty small {
  color: var(--muted);
}

.upload-actions {
  display: grid;
  gap: 10px;
}

.ghost-action {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 88px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.065);
  font-size: 0.86rem;
  font-weight: 800;
  text-align: center;
}

.ghost-action svg {
  color: var(--yellow);
}

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

.quiz-topline,
.section-label {
  color: var(--muted);
  font-size: 0.86rem;
}

.text-button {
  border: 0;
  color: var(--cyan);
  background: transparent;
  font-weight: 800;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
}

.progress-track div {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--acid), var(--cyan), var(--coral));
  transition: width 180ms ease;
}

.quiz-panel h2 {
  min-height: 58px;
  font-size: clamp(1.2rem, 2.5vw, 1.55rem);
}

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

.choice-grid button {
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.065);
  text-align: left;
  font-weight: 750;
}

.choice-grid button.selected {
  border-color: rgba(201, 255, 61, 0.85);
  color: #101820;
  background: var(--acid);
}

.style-panel {
  display: grid;
  gap: 10px;
}

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

.style-swatches button {
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--swatch);
  color: #101820;
  font-size: 0;
}

.style-swatches button.active {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.16);
}

.consent-line {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.consent-line a,
.legal-page a {
  color: var(--cyan);
  font-weight: 800;
}

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

.primary-actions,
.result-actions,
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-btn,
.secondary-btn,
.icon-text-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 16px;
  border-radius: var(--radius);
  font-weight: 900;
}

.primary-btn {
  flex: 1 1 190px;
  border: 0;
  color: #101820;
  background: var(--acid);
}

.primary-btn:disabled,
.icon-text-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.secondary-btn,
.icon-text-btn {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.07);
}

.result-stage {
  display: grid;
  gap: 16px;
  padding: clamp(16px, 3vw, 24px);
}

.canvas-shell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: min(68vh, 760px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 107, 91, 0.14), transparent 40%),
    linear-gradient(315deg, rgba(46, 231, 210, 0.14), transparent 42%),
    rgba(0, 0, 0, 0.22);
}

.canvas-shell img {
  display: block;
  width: min(100%, 540px);
  max-height: min(66vh, 760px);
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.empty-result {
  display: grid;
  place-items: center;
  width: min(100%, 480px);
  padding: 28px;
}

.sample-card {
  display: grid;
  gap: 12px;
  width: min(100%, 310px);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  transform: rotate(-2deg);
}

.sample-photo {
  min-height: 260px;
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(201, 255, 61, 0.85), transparent 42%),
    linear-gradient(315deg, rgba(255, 79, 175, 0.75), transparent 44%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.16) 0 2px, transparent 2px 9px),
    #17242b;
}

.sample-card strong {
  font-size: 1.25rem;
  line-height: 1.05;
}

.sample-card small {
  color: var(--muted);
}

.processing {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 28px;
  background: rgba(16, 24, 32, 0.9);
  text-align: center;
}

.processing[hidden] {
  display: none !important;
}

.pulse-ring {
  width: 74px;
  height: 74px;
  border: 2px solid var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(46, 231, 210, 0.4);
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 28px rgba(46, 231, 210, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(46, 231, 210, 0);
  }
}

.processing-bar {
  width: min(100%, 280px);
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.14);
}

.processing-bar div {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--coral), var(--yellow), var(--cyan));
  transition: width 260ms ease;
}

.history-panel {
  display: grid;
  gap: 10px;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}

.history-grid button {
  min-height: 132px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.history-grid img {
  width: 100%;
  height: 132px;
  object-fit: cover;
  display: block;
}

.history-empty {
  grid-column: 1 / -1;
  min-height: 80px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 50;
  max-width: min(92vw, 460px);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(16, 24, 32, 0.94);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.site-shell {
  overflow-x: hidden;
}

.site-hero {
  position: relative;
  display: grid;
  align-items: center;
  min-height: 86vh;
  padding: clamp(96px, 12vh, 150px) clamp(18px, 6vw, 84px) clamp(52px, 9vh, 90px);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.site-hero canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.site-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(16, 24, 32, 0.94), rgba(16, 24, 32, 0.46) 54%, rgba(16, 24, 32, 0.16));
}

.hero-copy {
  position: relative;
  z-index: 2;
  width: min(680px, 100%);
}

.hero-copy h1 {
  max-width: 10ch;
  margin-bottom: 20px;
  font-size: clamp(4rem, 13vw, 10.5rem);
}

.hero-copy p:not(.eyebrow) {
  width: min(620px, 100%);
  color: #d5ddd6;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.45;
}

.feature-band,
.split-band,
.cta-band {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(54px, 8vw, 92px) clamp(18px, 5vw, 40px);
}

.feature-band {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
}

.band-copy p,
.split-band p {
  color: var(--muted);
  line-height: 1.65;
}

.feature-grid {
  display: grid;
  gap: 12px;
}

.feature-grid article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
}

.feature-grid span {
  display: inline-flex;
  margin-bottom: 16px;
  color: var(--acid);
  font-weight: 950;
}

.feature-grid h3 {
  margin-bottom: 8px;
}

.feature-grid p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.split-band {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 420px);
  gap: clamp(28px, 5vw, 64px);
  border-top: 1px solid var(--line);
}

.safety-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.safety-list li {
  padding: 14px 16px;
  border-left: 4px solid var(--cyan);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
}

.cta-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid var(--line);
}

.cta-band .primary-btn {
  flex: 0 0 auto;
}

.legal-page {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: clamp(26px, 6vw, 72px) clamp(18px, 5vw, 40px);
}

.legal-page h1 {
  max-width: 12ch;
  margin-bottom: 22px;
}

.legal-page h2 {
  margin-top: 34px;
  margin-bottom: 12px;
  font-size: 1.25rem;
}

.legal-page p,
.legal-page li {
  color: #d5ddd6;
  line-height: 1.65;
}

.legal-page ul {
  padding-left: 22px;
}

@media (max-width: 980px) {
  .app-layout,
  .feature-band,
  .split-band {
    grid-template-columns: 1fr;
  }

  .result-stage {
    min-height: auto;
  }

  .canvas-shell {
    min-height: 520px;
  }
}

@media (max-width: 640px) {
  .topbar,
  .site-nav {
    min-height: 64px;
    padding: 10px 14px;
  }

  .brand small,
  .site-nav nav a:not(.nav-cta) {
    display: none;
  }

  .app-layout {
    padding: 12px;
  }

  .panel-head,
  .result-head,
  .cta-band {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-stack {
    justify-items: start;
  }

  .mode-tabs {
    grid-template-columns: 1fr 1fr;
  }

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

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

  .choice-grid,
  .style-swatches {
    grid-template-columns: 1fr;
  }

  .style-swatches button {
    min-height: 42px;
  }

  .canvas-shell {
    min-height: 420px;
  }

  .site-hero {
    min-height: 84vh;
    padding: 88px 18px 42px;
  }

  .site-hero::after {
    background: linear-gradient(180deg, rgba(16, 24, 32, 0.9), rgba(16, 24, 32, 0.54));
  }
}
