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

:root {
  --bg: #f7f4f0;
  --bg-card: #ffffff;
  --bg-card-border: #e2dbd0;
  --text: #2d2520;
  --text-muted: #7a6f66;
  --accent: #b06820;
  --green: #2a7a4a;
  --orange: #c05818;
  --red: #c43028;
  --purple: #6a50a0;
  --cyan: #2070a0;
  --yellow: #987018;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html { font-size: 15px; }

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

/* ─── Header ─── */
header {
  border-bottom: 1px solid var(--bg-card-border);
  padding: 24px 32px 20px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.header-inner { max-width: 1200px; margin: 0 auto; }

h1 { font-size: 1.4rem; font-weight: 600; letter-spacing: -0.3px; }
h1 .accent { color: var(--accent); }

.subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

/* ─── Step indicator ─── */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 16px;
}

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--bg-card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.step-dot.active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(176, 104, 32, 0.15);
}

.step-dot.done {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.step-dot.done span::before { content: '✓'; }
.step-dot.done span { font-size: 0; }
.step-dot.done span::before { font-size: 0.75rem; }

.step-connector {
  flex: 1;
  height: 2px;
  background: var(--bg-card-border);
  min-width: 12px;
}

/* ─── Main columns ─── */
main { max-width: 1200px; margin: 0 auto; padding: 24px 32px 40px; }

.columns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.column {
  border: 1px solid var(--bg-card-border);
  border-radius: 12px;
  overflow: hidden;
}

.column-header {
  background: var(--bg-card);
  padding: 16px;
  text-align: center;
  border-bottom: 1px solid var(--bg-card-border);
}

.col-icon { font-size: 1.4rem; margin-bottom: 6px; }

.column-header h2 {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.col-role {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.messages {
  padding: 16px;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ─── Terminal card ─── */
.terminal-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 8px;
  overflow: hidden;
  animation: cardAppear 0.35s ease forwards;
  opacity: 0;
}

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

.terminal-titlebar {
  background: #ede7dc;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-red    { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green  { background: #28c840; }

.terminal-title {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: 4px;
  font-family: var(--font-mono);
}

.terminal-body {
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
  position: relative;
  background: #faf7f2;
}

/* Syntax highlighting */
.hl-method  { color: var(--accent); font-weight: 600; }
.hl-path    { color: var(--text); }
.hl-version { color: var(--text-muted); }
.hl-status-200 { color: var(--green); font-weight: 600; }
.hl-status-402 { color: var(--orange); font-weight: 600; }
.hl-header-name { color: var(--purple); }
.hl-header-val  { color: var(--cyan); }
.hl-key   { color: var(--cyan); }
.hl-str   { color: var(--green); }
.hl-num   { color: var(--orange); }
.hl-bool  { color: var(--purple); }

/* Annotation bubble */
.annotation {
  background: rgba(176, 104, 32, 0.06);
  border: 1px solid rgba(176, 104, 32, 0.2);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 8px;
  animation: cardAppear 0.35s ease forwards;
  opacity: 0;
}

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

/* Check list (step 6) */
.check-list { display: flex; flex-direction: column; gap: 6px; }

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  animation: cardAppear 0.3s ease forwards;
  opacity: 0;
}

.check-pass { color: var(--green); }
.check-fail { color: var(--red); }

/* ─── Action area ─── */
.action-area {
  margin-top: 24px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.step-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  white-space: nowrap;
}

.step-desc {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.action-buttons { display: flex; gap: 10px; flex-wrap: wrap; }

.btn-next {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
}
.btn-next:hover { opacity: 0.85; }
.btn-next:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-replay {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-replay:hover { background: rgba(196, 48, 40, 0.08); }

.btn-reset {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--bg-card-border);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-reset:hover { color: var(--text); border-color: var(--text-muted); }

.hidden { display: none !important; }

/* Success pulse */
@keyframes successPulse {
  0%   { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.4); }
  70%  { box-shadow: 0 0 0 12px rgba(63, 185, 80, 0); }
  100% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0); }
}
.success-pulse { animation: successPulse 1s ease 2; }

/* ─── Mobile ─── */
@media (max-width: 768px) {
  header { padding: 16px; }
  main   { padding: 16px; }

  .columns {
    grid-template-columns: 1fr;
  }

  .step-indicator { flex-wrap: wrap; gap: 8px; }
  .step-connector { display: none; }

  .action-area {
    flex-direction: column;
    align-items: flex-start;
  }
}