/* AI Game Generator — one stylesheet. Light, editorial, one primary + one accent. */
:root {
  --ink: #14161a;
  --muted: #6b7280;
  --line: #e7e7e4;
  --paper: #fbfaf7;
  --card: #ffffff;
  --primary: #1f5eff;      /* focused blue */
  --primary-ink: #143fb0;
  --accent: #ff5a36;       /* warm coral for the single memorable detail */
  --ok: #12855b;
  --err: #c0392b;
  --radius: 14px;
  --maxw: 860px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.shell {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(20px, 6vw, 72px) clamp(16px, 5vw, 40px) 48px;
}

.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;
}

/* ---- Tool: first screen ---- */
.tool { display: block; }
.tool__head { margin-bottom: 26px; }
h1 {
  font-size: clamp(34px, 6.4vw, 62px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 800;
  margin: 0 0 10px;
}
.tagline {
  margin: 0;
  color: var(--muted);
  font-size: clamp(15px, 2.4vw, 18px);
  letter-spacing: -0.01em;
}

.gen { margin: 0; }
.gen__row {
  display: flex;
  gap: 10px;
  padding: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 12px 34px -20px rgba(20,22,26,.28);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.gen__row:focus-within {
  border-color: var(--primary);
  box-shadow: 0 14px 40px -18px rgba(31,94,255,.35);
}
#prompt {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: clamp(15px, 2.3vw, 18px);
  color: var(--ink);
  padding: 12px 12px;
}
#prompt::placeholder { color: #9aa0aa; }

.btn {
  font: inherit;
  font-weight: 650;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .12s ease, background .18s ease, opacity .18s ease;
}
.btn:focus-visible { outline: 3px solid rgba(31,94,255,.35); outline-offset: 2px; }
.btn--primary {
  position: relative;
  flex: 0 0 auto;
  padding: 12px 22px;
  background: var(--primary);
  color: #fff;
  min-width: 128px;
}
.btn--primary:hover { background: #174fe0; }
.btn--primary:active { transform: translateY(1px); }
.btn--primary[aria-busy="true"] .btn__label { visibility: hidden; }
.btn__spinner { display: none; }
.btn--primary[aria-busy="true"] .btn__spinner {
  display: block; position: absolute; inset: 0; margin: auto;
  width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.5);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.gen__meta {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-top: 12px; color: var(--muted); font-size: 13px;
}
.hint { flex: 0 0 auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; }
.chip {
  font: inherit; font-size: 12px; padding: 3px 10px; cursor: pointer;
  color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 999px;
  transition: color .16s ease, border-color .16s ease;
}
.chip:hover { color: var(--primary); border-color: var(--primary); }
.chip:focus-visible { outline: 3px solid rgba(31,94,255,.35); outline-offset: 2px; }
.count { font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.error { color: var(--err); font-size: 14px; margin: 8px 2px 0; }

/* ---- Result ---- */
.result { margin-top: 28px; animation: rise .4s cubic-bezier(.2,.8,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.result__bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.result__tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: 12px; font-weight: 650; letter-spacing: .02em;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.tag--accent { border-color: rgba(255,90,54,.45); color: var(--accent); }
.result__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn--ghost {
  padding: 9px 14px; background: #fff; border-color: var(--line); color: var(--ink);
  font-size: 14px;
}
.btn--ghost:hover { border-color: var(--primary); color: var(--primary); }
.result__frame {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  background: #0e1015; border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 20px 50px -28px rgba(20,22,26,.5);
}
#game-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.result__note { color: var(--muted); font-size: 13px; margin: 12px 2px 0; }

/* ---- Prose below the fold ---- */
.prose { margin-top: clamp(48px, 9vw, 96px); border-top: 1px solid var(--line); }
.prose__block { padding: 26px 0; border-bottom: 1px solid var(--line); }
.prose__block h2 {
  font-size: clamp(19px, 3vw, 23px); letter-spacing: -.02em;
  margin: 0 0 10px; font-weight: 750;
}
.prose__block p { margin: 0; color: #3a3f47; }
.prose__block ol { margin: 0; padding-left: 20px; color: #3a3f47; }
.prose__block li { margin: 4px 0; }
.faq { margin: 0; }
.faq dt { font-weight: 700; margin-top: 14px; }
.faq dt:first-child { margin-top: 0; }
.faq dd { margin: 4px 0 0; color: #3a3f47; }

.foot {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  margin-top: 40px; color: var(--muted); font-size: 13px;
}

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  z-index: 50; box-shadow: 0 10px 30px -10px rgba(0,0,0,.4);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--err); }

/* ---- Responsive ---- */
@media (max-width: 560px) {
  .gen__row { flex-direction: column; }
  .btn--primary { width: 100%; }
  .result__bar { flex-direction: column; align-items: flex-start; }
  .result__actions { width: 100%; }
  .btn--ghost { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
