/* =========================================================
   Game Name Generator
   Single stylesheet. No frameworks, no external fonts.
   ========================================================= */

:root{
  --bg:            #f5f6fa;
  --bg-tint-a:     #eef0ff;
  --bg-tint-b:     #fdf0e4;
  --surface:       #ffffff;
  --surface-2:     #fafbfe;
  --surface-3:     #f3f5fa;

  --ink:           #0c1017;
  --ink-2:         #333c4a;
  --muted:         #6a7383;
  --muted-2:       #8b93a3;

  --line:          #e7eaf1;
  --line-2:        #d8dde8;

  --primary:       #4f46e5;
  --primary-600:   #4338ca;
  --primary-soft:  #eef0ff;
  --primary-ring:  rgba(79,70,229,.28);

  --accent:        #e07b1f;
  --accent-soft:   #fdf3e7;

  --ok:            #0f8a5f;
  --ok-soft:       #e8f7f0;
  --danger:        #c62828;
  --danger-soft:   #fdecec;

  --r-sm: 9px;
  --r:    13px;
  --r-lg: 20px;
  --r-xl: 26px;

  --sh-1: 0 1px 2px rgba(14,22,44,.05);
  --sh-2: 0 6px 18px -10px rgba(14,22,44,.22), 0 1px 3px rgba(14,22,44,.04);
  --sh-3: 0 28px 60px -34px rgba(24,32,72,.38), 0 4px 14px -8px rgba(24,32,72,.12);

  --ff: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ff-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --ease: cubic-bezier(.22,.61,.36,1);
  --dur: 180ms;
}

*,*::before,*::after{ box-sizing:border-box; }

html{ -webkit-text-size-adjust:100%; }

body{
  margin:0;
  font-family:var(--ff);
  font-size:16px;
  line-height:1.6;
  color:var(--ink);
  background:var(--bg);
  background-image:
    radial-gradient(1100px 520px at 12% -12%, var(--bg-tint-a) 0%, rgba(238,240,255,0) 62%),
    radial-gradient(880px 460px at 104% -4%, var(--bg-tint-b) 0%, rgba(253,240,228,0) 58%);
  background-repeat:no-repeat;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

.wrap{
  width:100%;
  max-width:1080px;
  margin-inline:auto;
  padding-inline:24px;
}

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

:focus-visible{
  outline:2px solid var(--primary);
  outline-offset:2px;
  border-radius:6px;
}

/* ---------- top bar ---------- */

.topbar{
  position:sticky;
  top:0;
  z-index:20;
  background:rgba(245,246,250,.82);
  backdrop-filter:saturate(180%) blur(14px);
  -webkit-backdrop-filter:saturate(180%) blur(14px);
  border-bottom:1px solid var(--line);
}

.topbar__inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  min-height:58px;
}

.brand{
  display:inline-flex;
  align-items:center;
  gap:9px;
  text-decoration:none;
  color:var(--ink);
  font-weight:700;
  letter-spacing:-.015em;
}

.brand__mark{
  width:19px;height:19px;
  color:var(--primary);
  flex:none;
}

.brand__name{ font-size:15.5px; }

.topbar__note{
  font-size:12.5px;
  color:var(--muted);
  letter-spacing:.005em;
}

/* ---------- tool (first screen) ---------- */

.tool{ padding-top:38px; }

.tool__head{ margin-bottom:18px; }

h1{
  margin:0 0 8px;
  font-size:clamp(30px, 4.6vw, 44px);
  line-height:1.06;
  letter-spacing:-.032em;
  font-weight:800;
  color:var(--ink);
}

.tool__sub{
  margin:0;
  max-width:60ch;
  font-size:15.5px;
  color:var(--muted);
  line-height:1.55;
}

.panel{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--r-xl);
  box-shadow:var(--sh-3);
  padding:24px;
}

/* ---------- controls ---------- */

.controls{
  display:grid;
  grid-template-columns:repeat(6, minmax(0,1fr));
  gap:18px 16px;
}

.field{
  grid-column:span 2;
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:7px;
}

.field > label,
.field__label{
  font-size:12.5px;
  font-weight:650;
  letter-spacing:.045em;
  text-transform:uppercase;
  color:var(--muted);
}

.opt{
  font-weight:500;
  text-transform:none;
  letter-spacing:0;
  color:var(--muted-2);
}

.selectwrap{ position:relative; }

.selectwrap__caret{
  position:absolute;
  right:12px;
  top:50%;
  width:18px;height:18px;
  transform:translateY(-50%);
  color:var(--muted-2);
  pointer-events:none;
}

select,
input[type="text"]{
  width:100%;
  min-height:46px;
  padding:0 14px;
  font-family:inherit;
  font-size:15px;
  color:var(--ink);
  background:var(--surface-2);
  border:1px solid var(--line-2);
  border-radius:var(--r);
  transition:border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease);
  appearance:none;
  -webkit-appearance:none;
}

select{ padding-right:38px; cursor:pointer; }

input[type="text"]::placeholder{ color:var(--muted-2); }

select:hover,
input[type="text"]:hover{ border-color:#c6ccda; }

select:focus,
input[type="text"]:focus{
  outline:none;
  background:var(--surface);
  border-color:var(--primary);
  box-shadow:0 0 0 4px var(--primary-ring);
}

input[type="text"].is-invalid{
  border-color:var(--danger);
  box-shadow:0 0 0 4px rgba(198,40,40,.14);
}

.field__hint{
  margin:0;
  font-size:12px;
  line-height:1.45;
  color:var(--accent);
}

.field__hint[data-kind="error"]{ color:var(--danger); }

/* segmented controls */

.seg{
  display:flex;
  gap:4px;
  padding:4px;
  background:var(--surface-3);
  border:1px solid var(--line);
  border-radius:var(--r);
}

.seg button{
  flex:1 1 0;
  min-width:0;
  min-height:36px;
  padding:0 6px;
  font-family:inherit;
  font-size:14px;
  font-weight:600;
  font-variant-numeric:tabular-nums;
  color:var(--ink-2);
  background:transparent;
  border:0;
  border-radius:9px;
  cursor:pointer;
  transition:background-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.seg button:hover{ background:rgba(255,255,255,.75); color:var(--ink); }

.seg button[aria-pressed="true"]{
  background:var(--surface);
  color:var(--primary-600);
  box-shadow:var(--sh-1), inset 0 0 0 1px rgba(79,70,229,.18);
}

/* ---------- buttons ---------- */

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  font-family:inherit;
  font-weight:650;
  letter-spacing:-.005em;
  border:1px solid transparent;
  border-radius:var(--r);
  cursor:pointer;
  white-space:nowrap;
  transition:background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
             color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform 90ms var(--ease);
}

.btn:active{ transform:translateY(1px); }

.btn--lg{ min-height:54px; padding:0 26px; font-size:16.5px; width:100%; }

.btn--primary{
  color:#fff;
  background:linear-gradient(180deg, #5b52ea 0%, var(--primary-600) 100%);
  box-shadow:0 1px 0 rgba(255,255,255,.22) inset, 0 10px 22px -12px rgba(67,56,202,.85);
}

.btn--primary:hover{ background:linear-gradient(180deg, #635bed 0%, #3d33bd 100%); }

.btn--ghost{
  color:var(--ink-2);
  background:var(--surface);
  border-color:var(--line-2);
  box-shadow:var(--sh-1);
}

.btn--ghost:hover{ background:var(--surface-3); border-color:#c6ccda; color:var(--ink); }

.btn--sm{ min-height:36px; padding:0 14px; font-size:13.5px; }

.btn:disabled{ opacity:.45; cursor:not-allowed; box-shadow:none; }

.btn__icon{ width:17px;height:17px; flex:none; }

.actions{ margin-top:20px; }

.fineprint{
  margin:13px 0 0;
  font-size:12.5px;
  color:var(--muted-2);
  text-align:center;
}

/* ---------- results ---------- */

.results{
  margin-top:22px;
  scroll-margin-top:72px; /* clears the sticky bar when scrolled into view */
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--r-xl);
  box-shadow:var(--sh-2);
  overflow:hidden;
}

.results__bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
  padding:14px 18px;
  border-bottom:1px solid var(--line);
  background:linear-gradient(180deg, var(--surface-2), var(--surface));
}

.results__meta{
  margin:0;
  font-size:13.5px;
  color:var(--muted);
  font-variant-numeric:tabular-nums;
}

.results__meta strong{ color:var(--ink); font-weight:700; }

.results__meta .sep{
  display:inline-block;
  width:4px;height:4px;
  margin:0 8px;
  border-radius:50%;
  background:var(--line-2);
  vertical-align:middle;
}

.results__tools{ display:flex; gap:8px; flex-wrap:wrap; }

.namelist{
  list-style:none;
  margin:0;
  padding:0;
}

.nameitem{
  display:flex;
  align-items:center;
  gap:14px;
  padding:13px 18px;
  border-bottom:1px solid var(--line);
  transition:background-color var(--dur) var(--ease);
  animation:rise 320ms var(--ease) both;
}

.nameitem:last-child{ border-bottom:0; }

.nameitem:hover{ background:var(--surface-2); }

@keyframes rise{
  from{ opacity:0; transform:translateY(6px); }
  to  { opacity:1; transform:none; }
}

.nameitem__idx{
  flex:none;
  width:26px;
  font-family:var(--ff-mono);
  font-size:12px;
  color:var(--muted-2);
  font-variant-numeric:tabular-nums;
  text-align:right;
}

/* takes all the slack, so the length chip and the actions stay right-aligned */
.nameitem__main{
  min-width:0;
  flex:1 1 auto;
  display:flex;
  align-items:baseline;
  gap:10px;
  flex-wrap:wrap;
}

.nameitem__name{
  font-size:19px;
  font-weight:680;
  letter-spacing:-.018em;
  color:var(--ink);
  line-height:1.25;
  word-break:break-word;
}

.chip{
  display:inline-block;
  padding:2px 8px;
  font-size:11px;
  font-weight:600;
  letter-spacing:.02em;
  color:var(--muted);
  background:var(--surface-3);
  border:1px solid var(--line);
  border-radius:999px;
  white-space:nowrap;
}

.chip--shape{ color:var(--primary-600); background:var(--primary-soft); border-color:rgba(79,70,229,.16); }

/* fixed width + tabular figures so the counts form a clean numeric column */
.chip--len{
  flex:none;
  min-width:66px;
  text-align:center;
  font-family:var(--ff-mono);
  font-variant-numeric:tabular-nums;
  color:var(--ink-2);
}

.nameitem__acts{
  flex:none;
  display:flex;
  gap:6px;
}

.iconbtn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:40px;height:40px;
  color:var(--muted);
  background:transparent;
  border:1px solid transparent;
  border-radius:10px;
  cursor:pointer;
  transition:background-color var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.iconbtn:hover{ background:var(--surface-3); color:var(--ink); border-color:var(--line); }
.iconbtn svg{ width:18px;height:18px; }

.iconbtn.is-done{ color:var(--ok); background:var(--ok-soft); border-color:rgba(15,138,95,.22); }

.results__note{
  margin:0;
  padding:13px 18px;
  font-size:13.5px;
  border-top:1px solid var(--line);
  background:var(--accent-soft);
  color:#8a4c0c;
}

.results__note[data-kind="error"]{ background:var(--danger-soft); color:var(--danger); }

/* ---------- body content ---------- */

.content{ padding-top:64px; padding-bottom:40px; }

.block{ margin-bottom:60px; }
.block:last-child{ margin-bottom:0; }

h2{
  margin:0 0 12px;
  font-size:clamp(21px, 2.6vw, 27px);
  line-height:1.2;
  letter-spacing:-.024em;
  font-weight:750;
}

.h3{
  margin:34px 0 10px;
  font-size:16.5px;
  letter-spacing:-.012em;
  font-weight:700;
}

.lede{
  margin:0 0 20px;
  max-width:74ch;
  font-size:15.5px;
  color:var(--ink-2);
  line-height:1.68;
}

.steps{ list-style:none; margin:0; padding:0; display:grid; gap:16px; max-width:78ch; }

.steps li{ display:flex; gap:14px; align-items:flex-start; }

.steps__n{
  flex:none;
  width:28px;height:28px;
  display:grid;place-items:center;
  font-size:13px;font-weight:700;
  font-variant-numeric:tabular-nums;
  color:var(--primary-600);
  background:var(--primary-soft);
  border:1px solid rgba(79,70,229,.16);
  border-radius:9px;
}

.steps li div{ font-size:15.5px; color:var(--ink-2); line-height:1.62; }
.steps strong{ color:var(--ink); font-weight:680; }
.steps em{ font-style:normal; font-weight:600; color:var(--primary-600); }

.tablewrap{
  overflow-x:auto;
  border:1px solid var(--line);
  border-radius:var(--r-lg);
  background:var(--surface);
  box-shadow:var(--sh-1);
}

.tbl{
  width:100%;
  min-width:520px;
  border-collapse:collapse;
  font-size:14.5px;
}

.tbl caption{ text-align:left; }

.tbl th,
.tbl td{
  padding:12px 16px;
  text-align:left;
  vertical-align:top;
  border-bottom:1px solid var(--line);
}

.tbl thead th{
  font-size:12px;
  font-weight:650;
  letter-spacing:.05em;
  text-transform:uppercase;
  color:var(--muted);
  background:var(--surface-2);
  white-space:nowrap;
}

.tbl tbody tr:last-child td{ border-bottom:0; }
.tbl tbody tr:hover{ background:var(--surface-2); }

.tbl td:first-child{ font-weight:650; color:var(--ink); white-space:nowrap; }
.tbl td{ color:var(--ink-2); }

.mono{ font-family:var(--ff-mono); font-size:13.5px; color:var(--ink-2); }

.counter{
  margin:18px 0 0;
  padding:14px 18px;
  font-size:14px;
  color:var(--ink-2);
  background:var(--surface);
  border:1px dashed var(--line-2);
  border-radius:var(--r);
}

.counter b{ font-variant-numeric:tabular-nums; color:var(--primary-600); }

.plain{
  margin:0;
  padding:0;
  list-style:none;
  display:grid;
  gap:14px;
  max-width:78ch;
}

.plain li{
  position:relative;
  padding-left:20px;
  font-size:15.5px;
  color:var(--ink-2);
  line-height:1.62;
}

.plain li::before{
  content:"";
  position:absolute;
  left:2px; top:11px;
  width:6px;height:6px;
  border-radius:2px;
  background:var(--accent);
}

.plain strong{ color:var(--ink); font-weight:680; }

.faq{
  display:grid;
  gap:10px;
  max-width:84ch;
}

.faq details{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--r);
  box-shadow:var(--sh-1);
  overflow:hidden;
  transition:border-color var(--dur) var(--ease);
}

.faq details[open]{ border-color:var(--line-2); }

.faq summary{
  padding:15px 18px;
  font-size:15.5px;
  font-weight:640;
  color:var(--ink);
  cursor:pointer;
  list-style:none;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}

.faq summary::-webkit-details-marker{ display:none; }

.faq summary::after{
  content:"";
  flex:none;
  width:9px;height:9px;
  border-right:1.7px solid var(--muted);
  border-bottom:1.7px solid var(--muted);
  transform:rotate(45deg) translateY(-2px);
  transition:transform var(--dur) var(--ease);
}

.faq details[open] summary::after{ transform:rotate(225deg) translateY(-2px); }

.faq p{
  margin:0;
  padding:0 18px 17px;
  font-size:15px;
  color:var(--ink-2);
  line-height:1.66;
}

/* ---------- footer ---------- */

.foot{
  border-top:1px solid var(--line);
  background:rgba(255,255,255,.6);
}

.foot__inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  padding-block:22px;
  font-size:13px;
  color:var(--muted);
}

.foot__muted{ color:var(--muted-2); font-variant-numeric:tabular-nums; }

/* ---------- responsive ---------- */

@media (max-width:860px){
  .controls{ grid-template-columns:repeat(2, minmax(0,1fr)); }
  .field{ grid-column:span 1; }
  .field:nth-child(4){ grid-column:span 2; } /* keywords gets the full row */
}

@media (max-width:640px){
  .wrap{ padding-inline:16px; }

  .tool{ padding-top:26px; }

  .panel{ padding:18px; border-radius:var(--r-lg); }

  /* genre, tone, starts-with and keywords each take a full row;
     the two segmented controls share one, which pulls the button up */
  .controls{ grid-template-columns:repeat(2, minmax(0,1fr)); gap:14px 12px; }
  .field{ grid-column:span 2; }
  .field:nth-child(5),
  .field:nth-child(6){ grid-column:span 1; }

  .topbar__note{ display:none; }

  h1{ font-size:27px; }

  .tool__sub{ font-size:15px; }

  .nameitem{
    /* flex-start, not center: when a long name wraps to two lines the row
       number must stay level with the name instead of drifting to the middle */
    align-items:flex-start;
    flex-wrap:wrap;
    row-gap:9px;
    padding:13px 14px;
    gap:10px;
  }

  .nameitem__idx{ width:20px; padding-top:4px; }

  .nameitem__main{ flex:1 1 calc(100% - 30px); }

  .nameitem__name{ font-size:18px; }

  .nameitem__len{ order:3; }
  .nameitem__acts{ order:4; margin-left:auto; }

  .iconbtn{ width:44px;height:44px; }

  .results__bar{ padding:13px 14px; }

  .results__tools{ width:100%; }
  .results__tools .btn{ flex:1 1 auto; }

  .content{ padding-top:46px; }
  .block{ margin-bottom:44px; }

  /* Stack tables into blocks on narrow screens so nothing scrolls sideways */
  .tablewrap{ overflow-x:visible; }
  .tbl{ min-width:0; font-size:14px; }
  .tbl thead{ display:none; }
  .tbl tr{
    display:block;
    padding:13px 15px;
    border-bottom:1px solid var(--line);
  }
  .tbl tbody tr:last-child{ border-bottom:0; }
  .tbl tbody tr:hover{ background:transparent; }
  .tbl td{
    display:block;
    padding:0;
    border:0;
  }
  .tbl td:first-child{ font-size:15px; }
  .tbl td + td{ margin-top:4px; color:var(--muted); }
  .tbl td.mono{ margin-top:6px; }
}

/* ---------- motion preferences ---------- */

@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{
    animation-duration:.001ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.001ms !important;
    scroll-behavior:auto !important;
  }
  .btn:active{ transform:none; }
}

/* ---------- static pages (about / privacy) ---------- */

.h1{
  font-size:clamp(28px,4.4vw,40px);
  line-height:1.15;
  letter-spacing:-.02em;
  margin:0 0 16px;
}

.content a{
  color:var(--primary);
  text-decoration:underline;
  text-underline-offset:2px;
  text-decoration-thickness:1px;
}
.content a:hover{ text-decoration-thickness:2px; }

.foot__links{
  display:flex;
  gap:18px;
  flex-wrap:wrap;
}
.foot__links a{
  color:var(--muted);
  text-decoration:none;
}
.foot__links a:hover{ color:var(--primary); text-decoration:underline; }

@media (max-width:640px){
  .foot__inner{ flex-direction:column; align-items:flex-start; gap:10px; }
  .foot__links{ gap:14px; }
}

