/* ---------------------------------------------------------------- tokens -- */
:root {
  --cyan:    #00dce9;
  --magenta: #ff3399;
  --orange:  #ffa84f;

  --bg:        #0a1526;
  --bg-deep:   #060e1b;
  --surface:   #10203a;
  --surface-2: #16294a;
  --line:      #223a60;
  --ink:       #eaf2ff;
  --ink-dim:   #93a8c8;

  --ring: 0 0 0 3px rgba(0, 220, 233, .28);
  --tile: 148px;
  --radius: 18px;
  --font-title: "Merriweather", Georgia, "Times New Roman", serif;
  --font-body:  "Mulish", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  --bg:        #f4f7fc;
  --bg-deep:   #e7edf7;
  --surface:   #ffffff;
  --surface-2: #eef3fb;
  --line:      #d3ddee;
  --ink:       #0a1526;
  --ink-dim:   #5a6b87;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 12% -10%, rgba(0, 220, 233, .14), transparent 60%),
    radial-gradient(900px 560px at 96% 6%,   rgba(255, 51, 153, .13), transparent 62%),
    radial-gradient(800px 520px at 60% 108%, rgba(255, 168, 79, .11), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

/* ----------------------------------------------------------------- shell -- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 34px 24px 90px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.brandmark { display: flex; align-items: center; }

/* Both logos are white type built for a dark ground — on the light theme they
   vanish. So they sit on a navy marquee plate, which is on-brand anyway.
   Sized so the "By anecdotes.ai" byline in the lockup stays readable. The
   Arcade lockup is wide and short (4.3:1), so height drives the width hard —
   96px tall is ~420px wide, which is why mobile steps down further. */
.brandmark img {
  display: block;
  height: 96px;
  width: auto;
  padding: 12px 22px;
  border-radius: 18px;
  background: #0a1526;
}
@media (max-width: 620px) {
  .brandmark img { height: 62px; padding: 9px 14px; }
}
:root[data-theme="light"] .brandmark img { box-shadow: 0 6px 18px -8px rgba(10, 21, 38, .55); }

.colophon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 74px auto 0;
  padding: 14px 22px;
  border-radius: 999px;
  background: #0a1526;
  width: max-content;
  max-width: 100%;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #93a8c8;
}
.colophon img { height: 22px; width: auto; display: block; }

.icon-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-dim);
  border-radius: 999px;
  padding: 8px 14px;
  font: 600 12.5px/1 var(--font-body);
  letter-spacing: .04em;
  cursor: pointer;
  transition: color .15s, border-color .15s, transform .15s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--cyan); transform: translateY(-1px); }

/* ------------------------------------------------------------- step rail -- */
.rail { display: flex; align-items: center; gap: 8px; margin: 30px 0 8px; flex-wrap: wrap; }

.rail-step {
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-dim);
  background: none; border: 0; padding: 0;
  cursor: default;
}
.rail-step[data-clickable="1"] { cursor: pointer; }
.rail-step[data-clickable="1"]:hover { color: var(--ink); }
.rail-step .dot {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12px; letter-spacing: 0;
}
.rail-step[aria-current="step"] { color: var(--ink); }
.rail-step[aria-current="step"] .dot {
  border-color: transparent;
  background: linear-gradient(135deg, var(--cyan), var(--magenta));
  color: #06121f;
}
.rail-step[data-done="1"] .dot { border-color: var(--cyan); color: var(--cyan); }
.rail-line { flex: 0 0 22px; height: 1px; background: var(--line); }

/* Five steps is a lot of horizontal room — drop to numbered dots when the
   labels stop fitting rather than letting the rail wrap onto two lines. */
@media (max-width: 620px) {
  .rail .lbl { display: none; }
  .rail-line { flex: 0 0 16px; }
}

/* ------------------------------------------------------------- headings -- */
h1 {
  font-family: var(--font-title);
  font-weight: 900;
  font-size: clamp(28px, 4.6vw, 44px);
  line-height: 1.14;
  margin: 20px 0 8px;
  letter-spacing: -.01em;
}
h1 em {
  font-style: normal;
  background: linear-gradient(96deg, var(--cyan), var(--magenta) 60%, var(--orange));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sub { color: var(--ink-dim); font-size: 15.5px; margin: 0 0 26px; max-width: 62ch; }

/* ----------------------------------------------------------------- grids -- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--tile), 1fr));
  gap: 16px;
}
.grid.variants { --tile: 116px; gap: 12px; }

.card {
  position: relative;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border-radius: var(--radius);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  text-align: center;
  font-family: inherit;
  color: inherit;
  transition: transform .16s cubic-bezier(.2,.7,.3,1), border-color .16s, box-shadow .16s;
}
.card:hover { transform: translateY(-3px); border-color: var(--cyan); box-shadow: var(--ring); }
.card:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }

.card[aria-pressed="true"] {
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--cyan), 0 12px 30px -14px rgba(0, 220, 233, .8);
}
.card[aria-pressed="true"]::after {
  content: "✓";
  position: absolute; top: 8px; right: 8px;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 900; color: #06121f;
  background: linear-gradient(135deg, var(--cyan), var(--magenta));
}

.card .art {
  display: block;
  width: 100%;
  /* Sheets crop to different proportions, so the tile owns the shape and the
     art is fitted inside it — every character lines up regardless of sheet. */
  aspect-ratio: 1 / 1;
  object-fit: contain;
  object-position: center bottom;
  background: radial-gradient(120% 90% at 50% 100%, rgba(0, 220, 233, .13), transparent 70%);
}
.card .cap {
  /* Two-line captions are common ("Very Deep Neutral"), so reserve the room —
     otherwise one long name makes its whole row taller than the rest. */
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.1em;
  padding: 7px 8px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.card[aria-pressed="true"] .cap { color: var(--ink); }
.card:not(:has(.cap)) .art { border-radius: var(--radius); }

/* -------------------------------------------------------------- step 3 -- */
.finish {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(280px, 1fr);
  gap: 34px;
  align-items: start;
}

/* One avatar is only ~190-240px of real pixels, so the preview is capped to
   just past life size (--art-w is set from the image's natural width). Blowing
   it up further only makes the softness bigger. */
.preview {
  max-width: calc(var(--art-w, 240px) * 1.15 + 44px);
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  padding: 22px 22px 26px;
  text-align: center;
}
.preview .art {
  width: 100%;
  max-width: calc(var(--art-w, 240px) * 1.15);
  aspect-ratio: 1 / 1;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, .38));
}
.preview .who {
  font-family: var(--font-title);
  font-weight: 900;
  font-size: 21px;
  margin: 14px 0 4px;
  word-break: break-word;
}
.preview .who:empty::before { content: "Your name here"; color: var(--ink-dim); font-weight: 400; }
.preview .meta { font-size: 12px; color: var(--ink-dim); letter-spacing: .06em; text-transform: uppercase; }

label.field { display: block; font-weight: 800; font-size: 13px; letter-spacing: .07em; text-transform: uppercase; margin-bottom: 9px; }

input[type="text"] {
  width: 100%;
  padding: 15px 17px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: 600 17px var(--font-body);
  transition: border-color .15s, box-shadow .15s;
}
input[type="text"]::placeholder { color: var(--ink-dim); font-weight: 400; }
input[type="text"]:focus { outline: 0; border-color: var(--cyan); box-shadow: var(--ring); }
input[type="text"][aria-invalid="true"] { border-color: var(--magenta); }

.hint { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: 12.5px; color: var(--ink-dim); }
.hint .err { color: var(--magenta); font-weight: 700; }

.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }

.btn {
  border: 0;
  border-radius: 999px;
  padding: 14px 28px;
  font: 800 14px/1 var(--font-body);
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .15s, filter .15s, opacity .15s;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.06); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn.primary { background: linear-gradient(96deg, var(--cyan), var(--magenta) 62%, var(--orange)); color: #06121f; }
.btn.ghost { background: transparent; color: var(--ink-dim); border: 1px solid var(--line); }
.btn.ghost:hover { color: var(--ink); border-color: var(--cyan); }

/* --------------------------------------------------------------- states -- */
.step[hidden] { display: none; }
.step { animation: rise .3s cubic-bezier(.2,.7,.3,1); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  color: var(--ink-dim);
  font-size: 14px;
}
.empty code { color: var(--cyan); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.done-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  padding: 18px 20px;
  margin-top: 26px;
  font-size: 13.5px;
  color: var(--ink-dim);
}
.done-card b { color: var(--ink); }

@media (max-width: 720px) {
  .finish { grid-template-columns: 1fr; }
  .preview { margin: 0 auto; }
  .grid { --tile: 124px; }
  .grid.variants { --tile: 100px; }
}

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

/* ------------------------------------------------------------- step 4/5 -- */
.cities {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.city {
  position: relative;
  text-align: left;
  padding: 22px 22px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  color: inherit;
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: transform .16s cubic-bezier(.2,.7,.3,1), border-color .16s, box-shadow .16s;
}
.city::before {
  content: "";
  position: absolute; inset: 0 auto 0 0; width: 4px;
  background: linear-gradient(180deg, var(--cyan), var(--magenta) 55%, var(--orange));
  opacity: .55;
}
.city:hover { transform: translateY(-3px); border-color: var(--cyan); box-shadow: var(--ring); }
.city:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
.city[aria-pressed="true"] { border-color: transparent; box-shadow: 0 0 0 2px var(--cyan); }
.city[aria-pressed="true"]::before { opacity: 1; }

.city .when {
  font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--cyan);
}
.city .where { font-family: var(--font-title); font-weight: 900; font-size: 25px; margin: 7px 0 3px; }
.city .area { font-size: 13px; color: var(--ink-dim); }
.city .venue { font-size: 14px; color: var(--ink-dim); margin-top: 11px; }

.share { display: grid; grid-template-columns: minmax(260px, 420px) minmax(300px, 1fr); gap: 34px; align-items: start; }

.share-card { margin: 0; }
.share-card canvas {
  width: 100%; height: auto; display: block;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--bg-deep);
}

textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: 400 15px/1.55 var(--font-body);
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
textarea:focus { outline: 0; border-color: var(--cyan); box-shadow: var(--ring); }

.share-actions { margin-top: 14px; }
.btn.social { color: #06121f; }
.btn.social.linkedin  { background: linear-gradient(96deg, var(--cyan), #4aa8ff); }
.btn.social.instagram { background: linear-gradient(96deg, var(--orange), var(--magenta) 70%, #9b5cff); }

.fineprint { font-size: 12.5px; line-height: 1.6; color: var(--ink-dim); margin: 18px 0 0; max-width: 52ch; }

#share-status { color: var(--cyan); font-weight: 700; }

@media (max-width: 860px) {
  .share { grid-template-columns: 1fr; }
  .share-card { max-width: 420px; }
}
