/* $HOODIE PFP maker: a light page of its own, no scroll effects, nothing animated in a loop */
@font-face { font-family: 'Bungee'; src: url('../assets/fonts/bungee-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Geologica'; src: url('../assets/fonts/geologica-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Geologica'; src: url('../assets/fonts/geologica-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Silkscreen'; src: url('../assets/fonts/silkscreen-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }

:root {
  --night: #02040a;
  --panel: #0b0f17;
  --panel-2: #121826;
  --lime: #c4fb07;
  --lime-hover: #d6ff45;
  --lime-ink: #0d1500;
  --paper: #eef1e6;
  --fog: #a7aec2;
  --line: rgba(196, 251, 7, 0.32);
  --sign: 'Bungee', 'Arial Black', Impact, sans-serif;
  --ui: 'Geologica', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --pixel: 'Silkscreen', ui-monospace, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 48px);
}
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; background: var(--night); }
body {
  margin: 0;
  min-height: 100svh;
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(196, 251, 7, .10), transparent 70%),
    linear-gradient(rgba(196, 251, 7, .035) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(196, 251, 7, .035) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--night);
  color: var(--paper);
  font-family: var(--ui);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
button { font: inherit; color: inherit; }
img, canvas, svg { display: block; }
:focus-visible { outline: 3px solid var(--paper); outline-offset: 3px; border-radius: 8px; }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px var(--gutter);
  padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(2, 4, 10, .94);
  border-bottom: 1px solid rgba(196, 251, 7, .14);
}
.top__back { display: inline-flex; align-items: center; gap: 8px; color: var(--paper); text-decoration: none; font: 400 1.05rem/1 var(--sign); }
.top__back svg { width: 20px; height: 20px; color: var(--lime); }
.top__back img { border-radius: 8px; }
.top__links { display: flex; align-items: center; gap: 8px; }
.top__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); color: var(--lime); }
.top__icon svg { width: 18px; height: 18px; fill: currentColor; }
.top__icon:hover { background: rgba(196, 251, 7, .1); }
.top__buy {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 12px;
  background: var(--lime); color: var(--lime-ink); text-decoration: none; font: 400 .9rem/1 var(--sign);
  box-shadow: 0 0 0 2px #000, 3px 3px 0 2px #000;
}
.top__buy:hover { background: var(--lime-hover); }
@media (max-width: 420px) { .top__icon { display: none; } }

/* ---------- intro ---------- */
.maker { max-width: 1120px; margin: 0 auto; padding: clamp(28px, 5vw, 64px) var(--gutter) 40px; }
.intro { text-align: center; max-width: 680px; margin: 0 auto clamp(24px, 4vw, 44px); }
.intro__eyebrow { margin: 0 0 .7em; font: 400 .8rem/1 var(--pixel); letter-spacing: .12em; text-transform: uppercase; color: var(--lime); }
.intro__title { margin: 0; font: 400 clamp(2.3rem, 7vw, 4.4rem)/.95 var(--sign); }
.intro__title span { color: var(--lime); text-shadow: 4px 4px 0 #000; }
.intro__lede { margin: 1em auto 0; max-width: 34em; color: var(--fog); font-size: clamp(1rem, 1.6vw, 1.12rem); }
.intro__lede b { color: var(--paper); font-weight: 600; }

/* ---------- studio ---------- */
.studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(20px, 3.5vw, 44px);
  align-items: start;
}
@media (max-width: 820px) { .studio { grid-template-columns: minmax(0, 1fr); } }

.stage { margin: 0; position: sticky; top: 84px; }
@media (max-width: 820px) { .stage { position: static; max-width: 440px; margin: 0 auto; width: 100%; } }
.stage__frame {
  position: relative;
  border-radius: 22px;
  padding: 10px;
  background: #000;
  box-shadow: 0 0 0 2px var(--lime), 8px 8px 0 2px #000, 0 0 60px -10px rgba(196, 251, 7, .55);
}
.stage__canvas {
  width: 100%; aspect-ratio: 1; height: auto;
  border-radius: 14px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.stage__canvas.is-pop { animation: pop .22s ease-out; }
@keyframes pop { 0% { transform: scale(.97); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .stage__canvas.is-pop { animation: none; } }
.stage__tag {
  position: absolute; top: 20px; right: 20px;
  padding: 6px 10px; border-radius: 8px;
  font: 400 .72rem/1 var(--pixel); letter-spacing: .06em; text-transform: uppercase;
  background: #000; color: var(--lime); border: 1px solid var(--lime);
}
.stage__tag[data-tier="legendary"] { background: #ffc832; color: #241800; border-color: #000; }
.stage__id { margin-top: 18px; text-align: center; font: 400 .95rem/1 var(--pixel); color: var(--fog); letter-spacing: .08em; }
.stage__id span { color: var(--lime); }

.panel {
  min-width: 0;
  border-radius: 22px;
  padding: clamp(14px, 2.4vw, 22px);
  background: var(--panel);
  border: 1px solid rgba(196, 251, 7, .16);
}
.traits { display: grid; gap: 8px; }
.trait {
  display: grid;
  grid-template-columns: 7.2em 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 14px;
  background: var(--panel-2);
}
.trait__label { padding-left: 8px; font: 400 .74rem/1.2 var(--pixel); text-transform: uppercase; letter-spacing: .05em; color: var(--fog); }
.trait__btn {
  width: 44px; height: 44px; border: 0; border-radius: 10px; cursor: pointer;
  display: grid; place-items: center;
  background: #1c2433; color: var(--lime);
}
.trait__btn svg { width: 18px; height: 18px; }
.trait__btn:hover { background: #26324a; }
.trait__btn:active { transform: scale(.94); }
.trait__value {
  min-width: 0; height: 44px; border: 0; border-radius: 10px; cursor: pointer;
  background: transparent; text-align: center;
  font-weight: 600; font-size: 1rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.trait__value:hover { background: rgba(255, 255, 255, .04); }
.trait__value small { display: block; margin-top: 2px; font: 400 .62rem/1 var(--pixel); color: var(--fog); letter-spacing: .04em; }
@media (max-width: 420px) {
  .trait { grid-template-columns: 40px minmax(0, 1fr) 40px; grid-template-areas: "l l l" "p v n"; row-gap: 2px; }
  .trait__label { grid-area: l; padding: 4px 6px 0; }
  .trait__btn { width: 40px; height: 40px; }
  .trait__btn[data-dir="-1"] { grid-area: p; }
  .trait__value { grid-area: v; height: 40px; }
  .trait__btn[data-dir="1"] { grid-area: n; }
}

.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  min-height: 54px; padding: 0 18px; border-radius: 14px; cursor: pointer;
  font: 400 1rem/1 var(--sign); text-decoration: none; white-space: nowrap;
  transition: transform .12s, background-color .15s;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn--roll { grid-column: 1 / -1; border: 0; background: var(--lime); color: var(--lime-ink); box-shadow: 0 0 0 2px #000, 5px 5px 0 2px #000; min-height: 60px; font-size: 1.15rem; }
.btn--roll svg { fill: currentColor; }
.btn--roll:hover { background: var(--lime-hover); transform: translate(-2px, -2px); }
.btn--roll:active { transform: translate(1px, 1px); }
.btn--save { border: 2px solid var(--lime); background: transparent; color: var(--lime); }
.btn--save:hover { background: rgba(196, 251, 7, .1); }
.btn--x { border: 2px solid rgba(238, 241, 230, .4); background: transparent; color: var(--paper); }
.btn--x svg { width: 17px; height: 17px; fill: currentColor; }
.btn--x:hover { border-color: var(--paper); }
@media (max-width: 440px) { .btn { padding: 0 10px; font-size: .88rem; gap: .45em; } .btn--roll { font-size: 1.05rem; } }
@media (max-width: 350px) { .actions { grid-template-columns: minmax(0, 1fr); } }
.hint { margin: 14px 2px 0; font-size: .86rem; color: var(--fog); }
kbd { font: 400 .78rem/1 var(--pixel); padding: 2px 6px; border-radius: 5px; border: 1px solid rgba(238, 241, 230, .3); color: var(--paper); }

/* ---------- history ---------- */
.history { margin-top: clamp(36px, 6vw, 64px); }
.history[hidden] { display: none; }
.history__title { margin: 0 0 14px; font: 400 .85rem/1 var(--pixel); text-transform: uppercase; letter-spacing: .1em; color: var(--fog); }
.history__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.history__list button { display: block; width: 100%; padding: 0; border: 2px solid transparent; border-radius: 12px; background: #000; cursor: pointer; overflow: hidden; }
.history__list button:hover, .history__list button[aria-current="true"] { border-color: var(--lime); }
.history__list canvas { width: 100%; aspect-ratio: 1; height: auto; image-rendering: pixelated; }

/* ---------- footer ---------- */
.foot {
  max-width: 1120px; margin: 0 auto; padding: 28px var(--gutter) max(36px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(196, 251, 7, .12);
  display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; align-items: center;
  font-size: .84rem; color: var(--fog);
}
.foot p { margin: 0; max-width: 60ch; }
.foot a { color: var(--lime); }

/* country flag picker */
.trait--flag { grid-template-columns: 7.2em minmax(0, 1fr); }
.trait__select { position: relative; min-width: 0; }
.trait__select select {
  width: 100%; min-width: 0; max-width: 100%; height: 44px; padding: 0 40px 0 14px;
  border: 0; border-radius: 10px; appearance: none; -webkit-appearance: none;
  background: #1c2433; color: var(--paper); font: 600 1rem/1 var(--ui); cursor: pointer;
}
.trait__select select:hover { background: #26324a; }
.trait__select select:disabled { color: var(--fog); cursor: wait; }
.trait__select select option { background: #121826; color: var(--paper); }
.trait__select svg { position: absolute; right: 12px; top: 13px; width: 18px; height: 18px; color: var(--lime); pointer-events: none; }
@media (max-width: 420px) {
  .trait--flag { grid-template-columns: 1fr; grid-template-areas: "l" "s"; }
  .trait--flag .trait__select { grid-area: s; }
}
