:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1a202c;
  --muted: #64748b;
  --border: #e2e8f0;
  --available: #16a34a;
  --available-bg: #f0fdf4;
  --taken: #dc2626;
  --taken-bg: #fef2f2;
  --unknown: #d97706;
  --unknown-bg: #fffbeb;
  --invalid: #64748b;
  --invalid-bg: #f8fafc;
  --accent: #4f46e5;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --card: #1e293b;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: #334155;
    --available-bg: #052e16;
    --taken-bg: #450a0a;
    --unknown-bg: #451a03;
    --invalid-bg: #1e293b;
    --accent: #818cf8;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
main { max-width: 760px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.masthead {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem;
  max-width: 760px; margin: 0 auto; padding: 1.5rem 1.25rem 0;
}
h1 { font-size: 1.6rem; margin: 0; }
.brand {
  font-size: .85rem; font-weight: 600; color: var(--accent);
  text-decoration: none; vertical-align: middle; margin-left: .3rem;
}
.brand:hover { text-decoration: underline; }
.tagline { color: var(--muted); margin: .3rem 0 0; font-size: .95rem; max-width: 760px; }
.tagline-wrap { max-width: 760px; margin: 0 auto; padding: 0 1.25rem; }
#userchip {
  font-size: .85rem; font-weight: 600; color: var(--accent);
  text-decoration: none; border: 1px solid var(--accent);
  padding: .35rem .8rem; border-radius: 999px; cursor: pointer; background: none;
}

/* tabs */
.tabs {
  display: flex; gap: .25rem; flex-wrap: wrap;
  max-width: 760px; margin: 1rem auto 0; padding: 0 1.25rem;
  border-bottom: 1.5px solid var(--border);
}
.tabs button {
  font-size: .92rem; font-weight: 600;
  padding: .55rem .9rem; border: none; background: none; cursor: pointer;
  color: var(--muted); border-bottom: 2.5px solid transparent; margin-bottom: -1.5px;
}
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab { display: none; }
.tab.active { display: block; }

/* inputs */
#idea {
  width: 100%; padding: .8rem .95rem; font-size: .95rem;
  border: 1.5px solid var(--border); border-radius: 12px;
  background: var(--card); color: var(--text); outline: none; margin-bottom: .6rem;
}
#idea:focus { border-color: var(--accent); }
.searchrow { display: flex; gap: .6rem; margin-bottom: 1.5rem; }
.searchbox { position: relative; flex: 1; }
.searchbox .at {
  position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 1.15rem; pointer-events: none;
}
#username {
  width: 100%; padding: .85rem 1rem .85rem 2.4rem; font-size: 1.15rem;
  border: 1.5px solid var(--border); border-radius: 12px;
  background: var(--card); color: var(--text); outline: none; transition: border-color .15s;
}
#username:focus { border-color: var(--accent); }
#go {
  padding: .85rem 1.5rem; font-size: 1.05rem; font-weight: 600;
  border: none; border-radius: 12px; background: var(--accent); color: #fff; cursor: pointer;
}
#go:hover { filter: brightness(1.1); }
#go:disabled { opacity: .6; cursor: default; }
#toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
#hint { color: var(--muted); font-size: .85rem; min-height: 1.2em; margin: .5rem 0 0 .25rem; }
.pillbtn {
  font-size: .85rem; font-weight: 600; padding: .45rem .9rem; border-radius: 999px;
  border: 1px solid var(--accent); background: transparent; color: var(--accent);
  cursor: pointer; white-space: nowrap;
}
.pillbtn:hover { background: var(--accent); color: #fff; }
#ideas { display: flex; flex-wrap: wrap; gap: .45rem; margin: .35rem 0 1.25rem; }
#ideas:empty { margin: 0 0 1.25rem; }
.chip {
  font-size: .85rem; padding: .35rem .75rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.label { border: none; background: none; color: var(--muted); cursor: default; padding-left: 0; }

/* result cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .75rem; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: .8rem .95rem; display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: .4rem .5rem; min-height: 64px;
}
.card .meta { min-width: 0; }
.card .platform { font-weight: 600; font-size: .95rem; }
.card .detail {
  color: var(--muted); font-size: .75rem; margin-top: .15rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.badge {
  flex-shrink: 0; font-size: .78rem; font-weight: 600;
  padding: .3rem .6rem; border-radius: 999px; white-space: nowrap; text-decoration: none;
}
.badge.available { color: var(--available); background: var(--available-bg); }
.badge.taken     { color: var(--taken);     background: var(--taken-bg); }
.badge.unknown   { color: var(--unknown);   background: var(--unknown-bg); }
.badge.invalid   { color: var(--invalid);   background: var(--invalid-bg); }
.badge.idle      { color: var(--muted);     background: var(--invalid-bg); }
.badge.claim     { color: var(--accent); background: transparent; border: 1px solid var(--accent); }
.regbtn {
  font-size: .78rem; font-weight: 600; padding: .3rem .6rem; border-radius: 999px;
  border: 1px solid var(--accent); background: transparent; color: var(--accent); cursor: pointer;
}
.regbtn:hover { background: var(--accent); color: #fff; }
.regbtn:disabled { opacity: .6; }
.spinner {
  width: 18px; height: 18px; flex-shrink: 0;
  border: 2.5px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.section { font-size: 1.05rem; margin: 1.75rem 0 .2rem; }
.section-sub { color: var(--muted); font-size: .8rem; margin: 0 0 .75rem; }
.stepnum {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.35rem; height: 1.35rem; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: .78rem; font-weight: 700;
  margin-right: .4rem; vertical-align: text-bottom;
}
.steplabel { font-weight: 600; font-size: .95rem; margin: 0 0 .5rem; }

/* idea generator */
.paramrow { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: .6rem; }
.paramlabel { color: var(--muted); font-size: .8rem; width: 52px; flex-shrink: 0; }
.pchip {
  font-size: .82rem; padding: .3rem .7rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); cursor: pointer;
}
.pchip.sel { border-color: var(--accent); color: var(--accent); background: var(--card); font-weight: 600; }
#notes {
  flex: 1; min-width: 200px; padding: .5rem .75rem; font-size: .85rem;
  border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); outline: none;
}
#notes:focus { border-color: var(--accent); }
.minor {
  font-size: .85rem; font-weight: 600; padding: .5rem 1rem; border-radius: 10px;
  border: none; background: var(--accent); color: #fff; cursor: pointer;
}
.minor:disabled { opacity: .6; }
#ideacards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .6rem; margin-top: .4rem; }
.ideacard { border: 1px solid var(--border); border-radius: 12px; padding: .75rem .85rem; background: var(--card); }
.ideacard h3 { font-size: .95rem; margin: 0 0 .3rem; }
.ideacard p { font-size: .82rem; color: var(--muted); margin: 0 0 .55rem; }
.ideacard .names { display: flex; flex-wrap: wrap; gap: .35rem; }

/* resources + sites */
.rescard { display: block; }
.rescard p { font-size: .8rem; color: var(--muted); margin: .25rem 0 .5rem; }
.notice {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 1rem 1.1rem; font-size: .92rem; margin-bottom: 1rem;
}
.sitecard .actions { display: flex; gap: .4rem; flex-wrap: wrap; }
#kitpanel .word-wrap svg { max-width: 100%; height: auto; }
#kitpanel .mono-wrap { width: 80px; flex-shrink: 0; }
#kitpanel .mono-wrap svg { width: 80px; height: 80px; display: block; }
.editform textarea { resize: vertical; }

footer {
  margin: 2.5rem auto 0; color: var(--muted); font-size: .8rem; line-height: 1.5;
  max-width: 760px; padding: 0 1.25rem 3rem;
}
footer a { color: var(--accent); }
