:root {
  --ink: #f5f3ff;
  --muted: #b6b0d6;
  --bg: #14102b;
  --panel: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.14);
  --pink: #ff4f9a;
  --orange: #ffa14a;
  --violet: #8b5cf6;
  --water: #76bbe0;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--water); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }

.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 50% at 80% 0%, rgba(255, 79, 154, 0.55), transparent 70%),
    radial-gradient(50% 45% at 10% 20%, rgba(139, 92, 246, 0.45), transparent 70%),
    radial-gradient(70% 40% at 50% 100%, rgba(255, 161, 74, 0.35), transparent 70%),
    var(--bg);
}

.top, main, footer { width: min(1180px, 100% - 2rem); margin-inline: auto; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 1.2rem 0; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: .9rem; }
.brand .dot { width: .9rem; height: .9rem; border-radius: 4px; background: linear-gradient(135deg, var(--pink), var(--orange)); }
.gh { color: var(--muted); text-decoration: none; font-size: .9rem; }
.gh:hover { color: var(--ink); }

.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem; align-items: center; padding: 3rem 0 4rem; }
.kicker { margin: 0 0 .8rem; color: var(--orange); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: .78rem; }
h1 { margin: 0; font-size: clamp(2.6rem, 6vw, 4.8rem); line-height: 1.02; font-weight: 900; letter-spacing: -.02em; }
.grad { background: linear-gradient(90deg, var(--pink), var(--orange)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { max-width: 34rem; margin: 1.2rem 0 1.8rem; color: var(--muted); font-size: 1.1rem; }

.search { display: flex; gap: .5rem; padding: .45rem; max-width: 36rem; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(10px); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.search:focus-within { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(255, 161, 74, .18), 0 20px 60px rgba(0, 0, 0, .35); }
.search input { flex: 1; min-width: 0; padding: .9rem 1rem; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 1.15rem; }
.search input::placeholder { color: rgba(255, 255, 255, .35); }

button { font: inherit; cursor: pointer; }
.search button, .primary {
  border: 0; border-radius: 12px; padding: .8rem 1.4rem; font-weight: 800; color: #1b1030;
  background: linear-gradient(90deg, var(--pink), var(--orange));
  transition: transform .12s, filter .12s;
}
.search button:hover, .primary:not(:disabled):hover { transform: translateY(-1px); filter: brightness(1.08); }
.primary:disabled { opacity: .4; cursor: not-allowed; }

.chips { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: 1.1rem; color: var(--muted); font-size: .9rem; }
.chips button { border: 1px solid var(--line); background: transparent; color: var(--ink); padding: .3rem .8rem; border-radius: 999px; font-size: .88rem; }
.chips button:hover { background: var(--panel); border-color: var(--orange); }

.hero-card { margin: 0; position: relative; transform: rotate(2.5deg); border-radius: 22px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(255, 79, 154, .25), 0 10px 40px rgba(0, 0, 0, .5); transition: transform .4s; }
.hero-card:hover { transform: rotate(0deg) scale(1.01); }
.hero-card img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
.hero-card figcaption { position: absolute; left: 1rem; bottom: 1rem; padding: .25rem .8rem; border-radius: 999px; background: rgba(15, 22, 35, .6); backdrop-filter: blur(6px); font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

.result { margin: 0 0 4rem; padding: 1.4rem; border-radius: 26px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(12px); scroll-margin-top: 1rem; }
.result-head { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-end; margin-bottom: 1rem; }
.result-head h2 { margin: 0; font-size: 1.5rem; line-height: 1.2; }
.result-head p { margin: .2rem 0 0; font-size: .9rem; max-width: 40rem; }
.controls { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; }
.controls label { display: grid; gap: .2rem; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
select { padding: .6rem .8rem; border-radius: 10px; border: 1px solid var(--line); background: #1d1840; color: var(--ink); font: inherit; font-size: .95rem; text-transform: none; letter-spacing: 0; }
.controls .primary { padding: .65rem 1.2rem; }

.stage { position: relative; width: min(100%, 78vh); margin: 0 auto; aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: #a5b2c3; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
.stage canvas { display: block; width: 100%; height: 100%; }
.progress { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.2rem 1.2rem 1rem; background: linear-gradient(transparent, rgba(15, 12, 35, .85)); transition: opacity .4s; }
.progress.done { opacity: 0; pointer-events: none; }
.bar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 5%; border-radius: 6px; background: linear-gradient(90deg, var(--pink), var(--orange)); transition: width .4s; }
.progress p { margin: .6rem 0 0; font-size: .9rem; }

.error { max-width: 40rem; margin: 1rem auto 0; padding: .8rem 1rem; border-radius: 12px; background: rgba(255, 79, 79, .15); border: 1px solid rgba(255, 79, 79, .5); }
.result-foot { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin-top: 1rem; font-size: .85rem; }
.ghost { border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 10px; padding: .45rem 1rem; }
.ghost:hover { background: var(--panel); }

.info { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 4rem; }
.info article { padding: 1.3rem; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.info h3 { margin: 0 0 .4rem; font-size: 1.05rem; }
.info p { margin: 0; color: var(--muted); font-size: .95rem; }

footer { padding: 2rem 0 3rem; color: var(--muted); font-size: .82rem; border-top: 1px solid var(--line); }
footer p { margin: .2rem 0; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 2rem; padding-top: 1rem; }
  .hero-card { max-width: 420px; transform: none; }
  .search button { padding-inline: 1rem; }
  .controls { width: 100%; }
  .controls .primary { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
