/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d0f1a;
  --surface:   #131629;
  --border:    #2a2f55;
  --accent:    #9d7cf5;
  --accent2:   #5ec4d6;
  --gold:      #d4af5a;
  --text:      #d8ddf5;
  --muted:     #7a82b0;
  --danger:    #e05252;
  --success:   #52c97a;
  --radius:    14px;
  --glow:      0 0 24px rgba(157,124,245,.25);
}

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Lato', sans-serif;
  font-weight: 300;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 1rem 4rem;
  overflow-x: hidden;
}

/* ── Starfield ── */
.stars {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(100,60,200,.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 70%, rgba(50,180,200,.07) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}
body > * { position: relative; z-index: 1; }

/* ── Header ── */
header {
  text-align: center;
  padding: 3rem 1rem 1.5rem;
  max-width: 700px;
  width: 100%;
}

.rune-line {
  color: var(--accent);
  font-size: .85rem;
  letter-spacing: .15rem;
  opacity: .5;
  margin: .6rem 0;
}

header h1 {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold) 0%, var(--accent) 60%, var(--accent2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
  margin: .4rem 0;
}

.subtitle {
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.5;
}

/* ── Main layout ── */
main {
  width: 100%;
  max-width: 700px;
  margin-top: 2rem;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.5rem;
}

.tab {
  flex: 1;
  padding: .75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-family: 'Cinzel', serif;
  font-size: .85rem;
  cursor: pointer;
  transition: all .2s;
}

.tab:hover { border-color: var(--accent); color: var(--text); }

.tab.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(157,124,245,.1);
  box-shadow: var(--glow);
}

/* ── Tab content ── */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: 0 4px 32px rgba(0,0,0,.4);
}

.card h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: .35rem;
}

.card-desc {
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

/* ── Forms ── */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  flex: 1;
  min-width: 160px;
  margin-bottom: 1.5rem;
}

label {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1rem;
  color: var(--muted);
}

/* ── Gender buttons ── */
.gender-buttons, .count-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.gender-btn, .count-btn, .gen-count-btn {
  padding: .5rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-family: 'Lato', sans-serif;
  font-size: .9rem;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}

.gender-btn:hover, .count-btn:hover, .gen-count-btn:hover {
  border-color: var(--accent2);
  color: var(--text);
}

.gender-btn.active, .count-btn.active, .gen-count-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(157,124,245,.12);
}

/* ── Textarea ── */
textarea {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Lato', sans-serif;
  font-size: .95rem;
  line-height: 1.6;
  padding: .85rem 1rem;
  resize: vertical;
  transition: border-color .2s;
  width: 100%;
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(157,124,245,.15);
}

textarea::placeholder { color: var(--muted); opacity: .6; }

/* ── Primary button ── */
.btn-primary {
  display: block;
  width: 100%;
  padding: .9rem 1.5rem;
  background: linear-gradient(135deg, var(--accent), #6b4fd4);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .05rem;
  cursor: pointer;
  transition: all .25s;
  box-shadow: 0 4px 20px rgba(157,124,245,.3);
  margin-top: .5rem;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(157,124,245,.5);
}

.btn-primary:active { transform: translateY(0); }

.btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

/* ── Status badge ── */
.status-badge {
  font-size: .8rem;
  padding: .35rem .8rem;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: .75rem;
  font-weight: 700;
}

.status-badge.online  { background: rgba(82,201,122,.15); color: var(--success); border: 1px solid rgba(82,201,122,.3); }
.status-badge.offline { background: rgba(224,82,82,.15);  color: var(--danger);  border: 1px solid rgba(224,82,82,.3); }
.status-badge.checking { background: rgba(157,124,245,.1); color: var(--muted); border: 1px solid var(--border); }

/* ── Results ── */
.results {
  margin-top: 1.75rem;
}

.name-list {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.name-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .9rem 1.2rem;
  animation: fadeSlide .3s ease both;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}

.name-card:hover {
  border-color: var(--accent2);
  background: rgba(94,196,214,.05);
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.name-card .name-text {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.name-card .copy-hint {
  font-size: .75rem;
  color: var(--muted);
  opacity: 0;
  transition: opacity .2s;
}

.name-card:hover .copy-hint { opacity: 1; }

.name-card .gem { font-size: 1.1rem; }

.reasoning-box {
  margin-top: 1rem;
  background: rgba(157,124,245,.07);
  border: 1px solid rgba(157,124,245,.2);
  border-radius: 10px;
  padding: .9rem 1.1rem;
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.6;
  animation: fadeSlide .4s ease .1s both;
}

.reasoning-box strong {
  color: var(--accent);
  font-weight: 700;
  display: block;
  margin-bottom: .5rem;
}

.reasoning-box p {
  margin-bottom: .75rem;
}

.reasoning-box p:last-child {
  margin-bottom: 0;
}

/* ── Loading spinner ── */
.spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 1.5rem;
  color: var(--muted);
  font-size: .9rem;
}

.spinner::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error ── */
.error-msg {
  background: rgba(224,82,82,.1);
  border: 1px solid rgba(224,82,82,.3);
  border-radius: 10px;
  padding: .9rem 1.1rem;
  color: var(--danger);
  font-size: .9rem;
}

/* ── Footer ── */
footer {
  margin-top: 3rem;
  text-align: center;
  font-size: .8rem;
  color: var(--muted);
}

.accent { color: var(--accent); }

/* ── Responsive ── */
@media (max-width: 500px) {
  .card { padding: 1.25rem; }
  .form-row { flex-direction: column; gap: 0; }
  .tabs { flex-direction: column; }
}

header h1::before {
  content: '◆';
  display: inline-block;
  margin-right: .5rem;
  background: linear-gradient(135deg, var(--gold), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  font-size: 70%;
  vertical-align: middle;
}

/* About / GEO section */
.about-section {
  margin-top: 2rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.75rem 2rem;
  font-size: .9rem; line-height: 1.75; color: var(--muted);
}
.about-section h2 {
  font-family: 'Cinzel', serif; font-size: 1rem; font-weight: 600;
  color: var(--gold); margin-bottom: .75rem;
}
.about-section p { margin-bottom: .75rem; }
.about-section p:last-of-type { margin-bottom: 1rem; }
.about-section strong { color: var(--text); }
.about-section em { color: var(--accent); font-style: normal; }
.about-section details { margin-top: .5rem; }
.about-section summary {
  cursor: pointer; color: var(--accent); font-size: .85rem;
  font-weight: 700; letter-spacing: .05rem; text-transform: uppercase;
  padding: .5rem 0; list-style: none; outline: none;
}
.about-section summary::-webkit-details-marker { display: none; }
.about-section summary::before { content: '+ '; }
details[open] summary::before { content: '- '; }
.about-section dl { margin-top: .75rem; }
.about-section dt { color: var(--text); font-weight: 700; margin-top: .75rem; }
.about-section dd { margin: .2rem 0 0 1rem; }
