/* TeamGen — shared styles. Vanilla CSS, no frameworks. */

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1a1d29;
  --muted: #5b6072;
  --border: #e4e7f0;
  --primary: #4f46e5;       /* indigo */
  --primary-dark: #4338ca;
  --primary-soft: #eef0ff;
  --success: #16a34a;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(26, 29, 41, 0.07);
  --max-width: 1024px;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ---------- Layout ---------- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
}
.brand {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand:hover { text-decoration: none; }
.brand .dice {
  background: var(--primary);
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 8px 12px;
  border-radius: 8px;
}
.main-nav a:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.main-nav a.active { color: var(--primary); background: var(--primary-soft); }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 44px 0 8px; }
.hero h1 { font-size: 2.1rem; margin: 0 0 10px; line-height: 1.25; }
.hero p.lead { color: var(--muted); font-size: 1.1rem; max-width: 640px; margin: 0 auto; }

/* ---------- Tool card ---------- */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin: 28px 0;
}
.tool-card h2 { margin-top: 0; font-size: 1.25rem; }

label.field-label { display: block; font-weight: 700; margin: 18px 0 8px; }
label.field-label .hint { font-weight: 400; color: var(--muted); font-size: 0.9rem; }

textarea#names-input {
  width: 100%;
  min-height: 170px;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  resize: vertical;
}
textarea#names-input:focus, input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.name-count { font-size: 0.9rem; color: var(--muted); margin-top: 6px; }

/* Segmented control: number of teams vs team size */
.segmented {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}
.segmented button {
  border: none;
  background: transparent;
  padding: 9px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  border-radius: 7px;
  cursor: pointer;
}
.segmented button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

.controls-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.number-field input[type="number"] {
  width: 110px;
  padding: 10px 12px;
  font-size: 1rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
}

.button-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }

.btn {
  border: none;
  border-radius: 10px;
  padding: 13px 26px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--primary-soft); color: var(--primary); }
.btn-secondary:hover { background: #e0e4ff; }
.btn-ghost { background: transparent; color: var(--muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { color: var(--danger); border-color: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.error-msg {
  display: none;
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 10px 14px;
  margin-top: 16px;
  font-weight: 600;
}
.error-msg.show { display: block; }

/* ---------- Results ---------- */
.results-section { margin-top: 30px; display: none; }
.results-section.show { display: block; }
.results-section h2 { font-size: 1.25rem; margin-bottom: 4px; }
.results-meta { color: var(--muted); font-size: 0.95rem; margin-bottom: 16px; }

.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.team-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.team-card header {
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.team-card header .count {
  background: rgba(255,255,255,0.22);
  border-radius: 20px;
  padding: 1px 10px;
  font-size: 0.85rem;
  font-weight: 600;
}
.team-card ul { list-style: none; margin: 0; padding: 12px 16px 16px; }
.team-card li {
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.98rem;
}
.team-card li:last-child { border-bottom: none; }

.copy-feedback { color: var(--success); font-weight: 600; font-size: 0.95rem; margin-left: 8px; }

/* ---------- Content sections ---------- */
.content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; margin: 24px 0; box-shadow: var(--shadow); }
.content h1 { font-size: 1.9rem; margin-top: 0; line-height: 1.3; }
.content h2 { font-size: 1.35rem; margin-top: 30px; }
.content h3 { font-size: 1.1rem; margin-top: 22px; }
.content ul, .content ol { padding-left: 22px; }
.content li { margin-bottom: 8px; }

.steps { counter-reset: step; list-style: none; padding-left: 0; }
.steps li { counter-increment: step; position: relative; padding-left: 44px; margin-bottom: 16px; }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 2px;
  width: 30px; height: 30px;
  background: var(--primary-soft); color: var(--primary);
  border-radius: 50%;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}

/* FAQ */
.faq { margin-top: 12px; }
.faq details {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  background: var(--surface);
}
.faq summary { padding: 14px 18px; font-weight: 700; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+ "; color: var(--primary); font-weight: 800; }
.faq details[open] summary::before { content: "− "; }
.faq details p { padding: 0 18px 16px; margin: 0; color: var(--muted); }

/* Feature cards on homepage */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 24px 0; }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.feature-card h3 { margin: 0 0 8px; font-size: 1.05rem; }
.feature-card p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* ---------- Ad placeholders (styled box shown only when ad code is pasted in) ---------- */
.ad-slot {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 10px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 24px 0;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 48px;
  padding: 32px 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); }
.copyright { margin-top: 16px; font-size: 0.85rem; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .hero h1 { font-size: 1.6rem; }
  .tool-card { padding: 20px; }
  .content { padding: 22px; }
  .main-nav a { padding: 6px 8px; font-size: 0.88rem; }
  .controls-row { align-items: stretch; flex-direction: column; }
  .button-row .btn { flex: 1 1 100%; }
}
