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

/* ─── Variables ──────────────────────────────────────── */
:root {
  --bg:             #0a0a0a;
  --surface:        #111111;
  --surface2:       #1a1a1a;
  --border:         rgba(255, 255, 255, 0.07);
  --border-hover:   rgba(255, 255, 255, 0.13);
  --text:           #ededed;
  --muted:          #777;
  --accent:         #00c896;
  --accent-dim:     rgba(0, 200, 150, 0.08);
  --accent-border:  rgba(0, 200, 150, 0.3);
  --green:          #00c896;
  --red:            #f56565;
  --yellow:         #f5c542;
  --radius:         10px;
  --radius-lg:      14px;
}

/* ─── Base ───────────────────────────────────────────── */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1.25rem 5rem;
}

/* ─── Layout ─────────────────────────────────────────── */
.wrap {
  width: 100%;
  max-width: 700px;
}

/* ─── Header ─────────────────────────────────────────── */
.header {
  margin-bottom: 2.5rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  display: block;
}

h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.6px;
  line-height: 1.2;
  margin-bottom: 10px;
  color: var(--text);
}

h1 em {
  font-style: normal;
  color: var(--accent);
}

.tagline {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

/* ─── Repo action buttons ────────────────────────────── */
.repo-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.repo-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: all 0.15s;
  border: 1px solid var(--border);
}

.star-btn {
  background: rgba(245, 197, 66, 0.08);
  color: var(--yellow);
  border-color: rgba(245, 197, 66, 0.3);
}

.star-btn:hover {
  background: rgba(245, 197, 66, 0.15);
  border-color: rgba(245, 197, 66, 0.5);
}

.contribute-btn {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent-border);
}

.contribute-btn:hover {
  background: rgba(0, 200, 150, 0.15);
  border-color: rgba(0, 200, 150, 0.5);
}

/* ─── Card ───────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.card-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

/* ─── Input ──────────────────────────────────────────── */
input[type="text"] {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus {
  border-color: var(--accent-border);
}

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

/* ─── Doc type selector ──────────────────────────────── */
.types {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

.type {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.type:hover {
  border-color: var(--border-hover);
}

.type.active {
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

.type .t-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  display: block;
}

.type .t-desc {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.type.active .t-name {
  color: var(--accent);
}

/* ─── Generate button ────────────────────────────────── */
#gen-btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  margin-top: 1rem;
  letter-spacing: 0.02em;
}

#gen-btn:hover:not(:disabled) {
  opacity: 0.88;
}

#gen-btn:active:not(:disabled) {
  transform: scale(0.99);
}

#gen-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ─── Spinner ────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: middle;
  margin-right: 7px;
}

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

/* ─── Error message ──────────────────────────────────── */
.error {
  font-size: 12px;
  color: var(--red);
  margin-top: 8px;
  min-height: 18px;
  line-height: 1.5;
}

/* ─── Output ─────────────────────────────────────────── */
#output {
  display: none;
  margin-top: 0.5rem;
}

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.output-tag {
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: 20px;
  padding: 3px 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.copy-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.copy-btn:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.copy-btn.copied {
  color: var(--green);
  border-color: var(--accent-border);
}

#doc-out {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 540px;
  overflow-y: auto;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

#doc-out::-webkit-scrollbar {
  width: 4px;
}

#doc-out::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 4px;
}

/* ─── Footer ─────────────────────────────────────────── */
.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 3rem;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  line-height: 2;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 500px) {
  h1 {
    font-size: 22px;
  }

  .repo-actions {
    flex-wrap: wrap;
  }
}