/* ─────────────────────────────────────────────────────────
   AI Skin Generator — single stylesheet
   "Pixel arcade": night-navy grid, lime accent, chunky stepped UI.
   ───────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
[id] { scroll-margin-top: 84px; } /* keep anchored sections clear of the sticky header */

:root {
  --bg:          #0f1420;
  --bg-2:        #131a29;
  --panel:       #1a2234;
  --panel-2:     #222c42;
  --border:      #2e3a55;
  --border-hi:   #3d4b6d;
  --text:        #eef2ff;
  --text-mid:    #b6bfd8;
  --text-dim:    #8089a6;
  --accent:      #7cff4f;
  --accent-deep: #3e9f19;
  --accent-ink:  #0d1a05;
  --gold:        #ffcc33;
  --danger:      #ff6b78;
  --radius:      4px;
  --mono:        ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans:        system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  --px:          4px; /* one "pixel" of the chunky UI */
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(124, 255, 79, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 255, 79, 0.035) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--mono); line-height: 1.2; margin: 0 0 .6em; letter-spacing: .01em; }
h1 { font-size: clamp(1.8rem, 4.2vw, 2.9rem); text-transform: uppercase; }
h2 { font-size: clamp(1.25rem, 2.4vw, 1.6rem); text-transform: uppercase; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
code { font-family: var(--mono); font-size: .92em; background: var(--panel-2); padding: 1px 6px; border-radius: 2px; }
.muted { color: var(--text-dim); }
.small { font-size: .88rem; }
.lead { font-size: 1.12rem; color: var(--text-mid); max-width: 60ch; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: 8px 14px; font-weight: 700;
}
.skip-link:focus { left: 8px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Stepped "pixel" frame: a border drawn with offset shadows, corners left out. */
.pixel-frame {
  background: var(--panel);
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--border),
    0 var(--px) 0 0 var(--border),
    calc(var(--px) * -1) 0 0 0 var(--border),
    var(--px) 0 0 0 var(--border);
}

/* ── HEADER ───────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15, 20, 32, 0.92);
  border-bottom: var(--px) solid var(--border);
  backdrop-filter: blur(6px);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--mono); font-size: 1.15rem; letter-spacing: .08em; }
.logo:hover { text-decoration: none; color: var(--text); }
.logo strong { color: var(--accent); }
.logo img { image-rendering: pixelated; }
.site-nav { display: flex; gap: 6px; }
.site-nav a {
  color: var(--text-mid); font-family: var(--mono); font-size: .9rem; text-transform: uppercase;
  letter-spacing: .04em; padding: 8px 12px; border-radius: 2px;
}
.site-nav a:hover { color: var(--accent-ink); background: var(--accent); text-decoration: none; }
.nav-toggle {
  display: none; width: 44px; height: 44px; padding: 10px; border: 0;
  background: var(--panel-2); box-shadow: inset 0 -3px 0 rgba(0,0,0,.35);
}
.nav-toggle span { display: block; height: 3px; margin: 4px 0; background: var(--text); }

/* ── BUTTONS ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border: 0; border-radius: 2px;
  font-family: var(--mono); font-weight: 700; font-size: .92rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text); background: var(--panel-2);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.35), 0 0 0 2px var(--border-hi);
  transition: transform .05s, filter .15s;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.12); text-decoration: none; color: var(--text); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(0,0,0,.35), 0 0 0 2px var(--border-hi); }
.btn[disabled] { opacity: .55; cursor: not-allowed; filter: none; transform: none; }
.btn--primary { color: var(--accent-ink); background: var(--accent); box-shadow: inset 0 -4px 0 var(--accent-deep), 0 0 0 2px #0a0e16; }
.btn--primary:hover { color: var(--accent-ink); }
.btn--primary:active { box-shadow: inset 0 -2px 0 var(--accent-deep), 0 0 0 2px #0a0e16; }
.btn--lg { min-height: 52px; padding: 12px 26px; font-size: 1rem; }
.btn--sm { min-height: 34px; padding: 6px 10px; font-size: .78rem; }

/* ── HERO ─────────────────────────────────────────────── */
.hero { padding-top: 42px; padding-bottom: 18px; }
.eyebrow { display: inline-block; font-family: var(--mono); font-size: .8rem; color: var(--gold); text-transform: uppercase; letter-spacing: .12em; margin-bottom: 14px; }
.hero h1 span { color: var(--accent); }

/* ── GENERATOR ────────────────────────────────────────── */
.gen { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 28px; align-items: start; padding-bottom: 28px; }
.gen__panel { padding: 22px; }
.prompt__label { display: block; font-family: var(--mono); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.prompt__box { position: relative; }
.prompt__box textarea {
  display: block; width: 100%; min-height: 108px; resize: vertical; padding: 14px 14px 30px;
  background: #0b101a; color: var(--text); border: 0; border-radius: 2px;
  box-shadow: inset 0 0 0 2px var(--border-hi); font-size: 1.05rem; line-height: 1.45;
}
.prompt__box textarea::placeholder { color: var(--text-dim); }
.prompt__box textarea:focus { outline: none; box-shadow: inset 0 0 0 3px var(--accent); }
.prompt__count { position: absolute; right: 10px; bottom: 6px; font-family: var(--mono); font-size: .75rem; color: var(--text-dim); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.chip {
  border: 0; border-radius: 2px; padding: 7px 11px; font-size: .86rem;
  background: var(--bg-2); color: var(--text-mid); box-shadow: inset 0 0 0 2px var(--border);
}
.chip:hover { color: var(--accent-ink); background: var(--accent); box-shadow: none; }
.prompt__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.form-note { margin: 14px 0 0; font-size: .86rem; color: var(--text-dim); }

.status { margin-top: 18px; }
.status__bar { height: 18px; background: #0b101a; box-shadow: inset 0 0 0 2px var(--border-hi); padding: 3px; }
.status__bar span {
  display: block; height: 100%; width: 3%;
  background: repeating-linear-gradient(90deg, var(--accent) 0 10px, var(--accent-deep) 10px 12px);
  transition: width .6s steps(8);
}
.status p { margin: 8px 0 0; font-family: var(--mono); font-size: .88rem; color: var(--text-mid); }
.error { margin: 16px 0 0; padding: 10px 12px; color: #ffe3e6; background: rgba(255,107,120,.12); box-shadow: inset 4px 0 0 var(--danger); font-size: .95rem; }

.gen__stage { display: flex; flex-direction: column; gap: 16px; }
.stage {
  position: relative; height: 440px; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(124,255,79,.10), transparent 62%),
    linear-gradient(180deg, #121a2b 0%, #0c111c 100%);
  box-shadow: inset 0 0 0 var(--px) var(--border);
}
.stage::after { /* pixel floor */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 22%;
  background:
    linear-gradient(rgba(124,255,79,.08) 2px, transparent 2px) 0 0 / 100% 16px,
    linear-gradient(90deg, rgba(124,255,79,.08) 2px, transparent 2px) 0 0 / 16px 100%;
  pointer-events: none;
}
.stage canvas { position: relative; z-index: 1; display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.stage canvas.is-dragging { cursor: grabbing; }
.stage__empty {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  font-family: var(--mono); color: var(--text-dim); text-transform: uppercase; letter-spacing: .08em; font-size: .9rem; text-align: center; padding: 20px;
}
.stage__empty svg { width: 72px; height: 72px; image-rendering: pixelated; opacity: .8; }
.stage__tools { position: absolute; z-index: 3; top: 12px; right: 12px; display: flex; gap: 8px; }
.stage__tools .btn.is-active { color: var(--accent-ink); background: var(--accent); }

.result { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; padding: 18px; }
.result__tex {
  width: 128px; height: 128px; image-rendering: pixelated;
  background-color: #0b101a;
  background-image: linear-gradient(45deg, #182033 25%, transparent 25%, transparent 75%, #182033 75%), linear-gradient(45deg, #182033 25%, transparent 25%, transparent 75%, #182033 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px;
  box-shadow: 0 0 0 2px var(--border-hi);
}
.result__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.result p { margin: 0; }

/* ── RECENT ───────────────────────────────────────────── */
.recent { padding-top: 12px; padding-bottom: 30px; }
.recent__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; }
.recent__item { position: relative; padding: 10px; text-align: left; }
.recent__item button.recent__open { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; }
.recent__item img { display: block; width: 96px; height: 96px; margin: 0 auto 8px; image-rendering: pixelated; }
.recent__item span { display: block; font-size: .78rem; color: var(--text-mid); line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.recent__del {
  position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border: 0; border-radius: 2px;
  background: var(--panel-2); color: var(--text-dim); font-size: 1rem; line-height: 1;
}
.recent__del:hover { color: #fff; background: var(--danger); }

/* ── CONTENT ──────────────────────────────────────────── */
.section { padding: 40px 0; }
.section > .container > p { max-width: 75ch; }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; counter-reset: step; }
.step { padding: 22px 20px 18px; position: relative; }
.step::before {
  counter-increment: step; content: counter(step);
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin-bottom: 12px;
  font-family: var(--mono); font-weight: 700; color: var(--accent-ink); background: var(--accent);
}
.step p { margin: 0; color: var(--text-mid); }
.tips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 26px; padding: 0; list-style: none; }
.tips li { padding-left: 22px; position: relative; color: var(--text-mid); }
.tips li::before { content: ""; position: absolute; left: 0; top: .55em; width: 10px; height: 10px; background: var(--accent); }
.tips strong { color: var(--text); }

.ideas { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.idea { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.idea h3 { margin: 0; color: var(--gold); }
.idea p { margin: 0; color: var(--text-mid); flex: 1; }
.idea .btn { align-self: flex-start; }

.faq details { margin-bottom: 14px; padding: 14px 18px; }
.faq summary { cursor: pointer; font-weight: 700; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+"; display: inline-block; width: 1.4em; font-family: var(--mono); color: var(--accent); }
.faq details[open] summary::before { content: "−"; }
.faq details p { margin: 10px 0 0; color: var(--text-mid); }

.prose { max-width: 780px; padding-top: 28px; padding-bottom: 40px; }
.prose--wide { max-width: 1180px; }
.prose h2 { margin-top: 1.8em; font-size: 1.2rem; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .45em; }
.breadcrumb { font-family: var(--mono); font-size: .82rem; color: var(--text-dim); margin-bottom: 18px; text-transform: uppercase; letter-spacing: .04em; }
.breadcrumb a { color: var(--text-mid); }
.callout { padding: 16px 18px; margin: 20px 0; }
.callout p:last-child { margin-bottom: 0; }

/* ── FOOTER ───────────────────────────────────────────── */
.site-footer { margin-top: 30px; padding: 36px 0 20px; border-top: var(--px) solid var(--border); background: var(--bg-2); }
.footer-inner { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 26px; }
.footer-col { display: flex; flex-direction: column; gap: 6px; }
.footer-col strong { font-family: var(--mono); text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; margin-bottom: 4px; }
.footer-col a { color: var(--text-mid); font-size: .92rem; }
.footer-col p { color: var(--text-dim); font-size: .9rem; margin: 0; }
.footer-bottom { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--border); }
.footer-bottom p { margin: 0; color: var(--text-dim); font-size: .82rem; }

/* ── TOAST ────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 90; transform: translate(-50%, 20px); opacity: 0;
  padding: 10px 16px; font-family: var(--mono); font-size: .9rem; color: var(--accent-ink); background: var(--accent);
  box-shadow: 0 4px 0 var(--accent-deep); transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 900px) {
  .gen { grid-template-columns: minmax(0, 1fr); }
  .stage { height: 380px; }
  .steps { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .nav-toggle { display: block; }
  .site-nav {
    display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; gap: 0;
    padding: 8px 20px 16px; background: var(--bg-2); border-bottom: var(--px) solid var(--border);
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 12px 6px; }
  .hero { padding-top: 28px; }
  .gen__panel { padding: 18px 14px; }
  .tips { grid-template-columns: minmax(0, 1fr); }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-col--about { grid-column: 1 / -1; }
  .result { grid-template-columns: minmax(0, 1fr); justify-items: start; }
  .stage { height: 340px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .status__bar span, .btn, .toast { transition: none; }
}
