/* ── Casual Coder ─────────────────────────────────────── */
/* Screen-share friendly: large text, high contrast, clean  */

:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --text: #111827;
  --text-muted: #6b7280;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --error: #ef4444;
  --error-bg: #fef2f2;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.04);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

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

html {
  font-size: 20px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

main {
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  overflow-x: hidden;
}

/* ── Screens ──────────────────────────────────────────── */

.screen {
  display: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.screen.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* ── Card ─────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  overflow-wrap: break-word;
  word-break: break-word;
  overflow: hidden;
}

/* ── Typography ───────────────────────────────────────── */

h1 {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.success-badge {
  color: var(--success);
}

/* ── Form elements ────────────────────────────────────── */

input[type="text"],
textarea {
  display: block;
  width: 100%;
  font-family: var(--font);
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease;
  margin-bottom: 1rem;
}

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

textarea {
  resize: vertical;
  min-height: 5rem;
}

button.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.7rem 2rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

button.primary:hover {
  background: var(--accent-hover);
}

button.primary:active {
  transform: scale(0.98);
}

button.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── Buttons ──────────────────────────────────────────── */

button.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.7rem 2rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.1s ease;
}

button.secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

button.secondary:active {
  transform: scale(0.98);
}

.button-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* ── Discovery ────────────────────────────────────────── */

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
}

.step-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.question-counter {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.question-text {
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.question-why {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 1rem;
  line-height: 1.4;
}

/* ── Analyzing screen ─────────────────────────────────── */

.analyzing-card {
  text-align: center;
  padding: 3rem 2rem;
}

.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1.5rem;
}

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

.hidden {
  display: none !important;
}

/* ── Conversation history ─────────────────────────────── */

.history {
  margin-top: 1.5rem;
}

.history-item {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.7;
  overflow-wrap: break-word;
  word-break: break-word;
}

.history-q {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.history-a {
  font-size: 0.85rem;
  color: var(--text);
}

/* ── Review ───────────────────────────────────────────── */

.review-list {
  margin-bottom: 1.5rem;
  max-height: 50vh;
  overflow-y: auto;
}

.review-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.review-item:last-child {
  border-bottom: none;
}

.review-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.15rem;
}

.review-q {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.review-a {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* ── Build checklist ──────────────────────────────────── */

.checklist {
  list-style: none;
  margin-top: 1.5rem;
}

.checklist li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  transition: color 0.3s ease;
}

.checklist li:last-child {
  border-bottom: none;
}

.checklist li.running {
  color: var(--text);
  font-weight: 500;
}

.checklist li.done {
  color: var(--success);
}

.checklist li.error {
  color: var(--error);
}

.check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: all 0.3s ease;
  font-size: 0.65rem;
}

.running .check {
  border-color: var(--accent);
  animation: spin 1s linear infinite;
  border-top-color: transparent;
}

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

.done .check {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.done .check::after {
  content: '✓';
}

.error .check {
  border-color: var(--error);
  background: var(--error);
  color: #fff;
}

.error .check::after {
  content: '✗';
}

/* ── Done screen ──────────────────────────────────────── */

.stats {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.command-block {
  margin-bottom: 1.25rem;
}

.command-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.command-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.4rem;
}

.command-line code {
  flex: 1;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
  overflow-x: auto;
}

.copy-btn {
  font-family: var(--font);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

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

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

/* ── Error overlay ────────────────────────────────────── */

.error-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
}

.error-card {
  max-width: 500px;
  width: 100%;
}

.error-card h2 {
  color: var(--error);
}

.error-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  word-break: break-word;
}

/* ── Submissions list ─────────────────────────────────── */

.submissions {
  margin-top: 1.5rem;
}

.submissions-header {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.submission-item {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: border-color 0.2s ease;
  border: 2px solid transparent;
}

.submission-item:hover {
  border-color: var(--accent);
}

.submission-name {
  font-size: 0.95rem;
  font-weight: 600;
}

.submission-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ── Character counter ────────────────────────────────── */

.char-counter {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: -0.75rem;
  margin-bottom: 1rem;
}

.char-counter.over-limit {
  color: var(--error);
  font-weight: 600;
}

/* ── Contact fields ──────────────────────────────────── */

.contact-fields {
  margin-bottom: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.contact-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* ── Contact banner (admin) ──────────────────────────── */

.contact-banner {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  background: var(--bg);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.contact-banner-item strong {
  color: var(--text-muted);
  font-weight: 600;
}

/* ── Submit status ────────────────────────────────────── */

.submit-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

.submit-status.success {
  color: var(--success);
}

/* ── Responsive ───────────────────────────────────────── */

@media (max-width: 600px) {
  html { font-size: 17px; }
  main { padding: 1rem; }
  .card { padding: 1.5rem 1.25rem; }
}

@media print {
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  button, .copy-btn { display: none; }
}
