:root {
  color-scheme: dark;
  --ink: #11131a;
  --paper: #f7f4eb;
  --yellow: #ffce57;
  --orange: #f19142;
  --muted: #a7a7ad;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 14%, rgba(255, 206, 87, .15), transparent 25rem),
    radial-gradient(circle at 90% 86%, rgba(120, 90, 255, .13), transparent 26rem),
    var(--ink);
  color: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.app-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding-bottom: 48px; }

.topbar {
  min-height: 82px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,.11);
}

.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-weight: 900; letter-spacing: .08em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border: 3px solid var(--ink); border-radius: 11px; background: var(--yellow); color: var(--ink); font-size: .78rem; box-shadow: 0 0 0 2px var(--yellow); }
.free-badge { padding: 8px 11px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; color: #d5d5d8; font-size: .76rem; font-weight: 800; letter-spacing: .08em; }

.generator { padding: 48px 0 24px; }
.intro { max-width: 720px; margin-bottom: 30px; }
.eyebrow { margin: 0 0 12px; color: var(--yellow) !important; font-weight: 900; font-size: .8rem !important; letter-spacing: .16em; }
.intro h1 { margin: 0; font-size: clamp(2.4rem, 6vw, 5.4rem); line-height: .95; letter-spacing: -.055em; }
.intro > p { margin: 18px 0 0; max-width: 620px; color: #bdbdc3; font-size: 1.05rem; line-height: 1.55; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 28px; align-items: stretch; }
.portrait-card { position: relative; overflow: hidden; border: 1px solid rgba(255,255,255,.14); border-radius: 28px; background: #262833; box-shadow: 0 30px 80px rgba(0,0,0,.28); aspect-ratio: 1; }
#pfpCanvas { display: block; width: 100%; height: 100%; }
.edition { position: absolute; left: 18px; bottom: 18px; padding: 9px 13px; border-radius: 999px; background: rgba(17,19,26,.76); border: 1px solid rgba(255,255,255,.22); color: #fff; font-size: .75rem; font-weight: 900; letter-spacing: .09em; backdrop-filter: blur(10px); }

.controls { display: flex; flex-direction: column; padding: 24px; border-radius: 28px; background: #1a1c24; border: 1px solid rgba(255,255,255,.1); }
.rarity-row { display: flex; align-items: center; gap: 9px; min-height: 28px; font-size: .79rem; font-weight: 900; letter-spacing: .13em; }
.rarity-dot { width: 10px; height: 10px; border-radius: 50%; background: #bfc2c8; box-shadow: 0 0 14px currentColor; }
.traits { display: grid; gap: 1px; margin: 21px 0 24px; overflow: hidden; border: 1px solid rgba(255,255,255,.1); border-radius: 16px; background: rgba(255,255,255,.1); }
.trait { display: flex; justify-content: space-between; gap: 14px; padding: 14px 15px; background: #20232c; }
.trait span:first-child { color: #94969e; font-size: .82rem; }
.trait strong { text-align: right; font-size: .82rem; }

button { width: 100%; border: 0; border-radius: 14px; min-height: 54px; padding: 0 18px; font: inherit; font-size: .95rem; font-weight: 850; cursor: pointer; transition: transform .16s ease, filter .16s ease, background .16s ease; }
button:hover { filter: brightness(1.06); transform: translateY(-1px); }
button:active { transform: translateY(1px) scale(.99); }
button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.generate-btn { display: flex; justify-content: space-between; align-items: center; margin-top: auto; background: var(--yellow); color: var(--ink); }
.generate-btn span:last-child { font-size: 1.35rem; }
.download-btn { margin-top: 10px; background: #f4f1e8; color: var(--ink); }
.privacy { margin: 18px 5px 0; color: #7e8089; font-size: .76rem; line-height: 1.45; text-align: center; }

@media (max-width: 820px) {
  .generator { padding-top: 34px; }
  .workspace { grid-template-columns: 1fr; }
  .controls { min-height: 0; }
  .generate-btn { margin-top: 0; }
}

@media (max-width: 480px) {
  .app-shell { width: min(100% - 20px, 1180px); }
  .topbar { min-height: 68px; }
  .free-badge { font-size: .64rem; }
  .brand { font-size: .82rem; }
  .generator { padding-top: 28px; }
  .intro { margin-bottom: 22px; }
  .intro > p { font-size: .96rem; }
  .portrait-card, .controls { border-radius: 21px; }
}

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