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

:root {
  --bg: #fff;
  --bg-2: #f8f8f8;
  --text: #111;
  --text-2: #444;
  --text-3: #888;
  --border: #e5e5e5;
  --accent: #2563eb;
  --zone-work: #fef9c3;
  --zone-stage: #dbeafe;
  --zone-repo-bg: #1a1a1a;
  --zone-repo-text: #fff;
  --mono: 'Menlo', 'Monaco', monospace;
}

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

nav {
  padding: 16px 40px;
  border-bottom: 1px solid var(--border);
}
nav a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
}
nav a:hover { color: var(--accent); }

.page-header {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 32px 40px;
}
.page-header h1 { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.page-header .subtitle { font-size: 15px; color: var(--text-2); }

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 40px;
}

/* Progress */
.progress-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 24px 40px;
  max-width: 900px;
  margin: 0 auto;
}
.progress-label {
  font-size: 13px;
  color: var(--text-3);
  margin-right: 4px;
  white-space: nowrap;
}
.dots {
  display: flex;
  gap: 6px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s;
}
.dot.active { background: var(--accent); }

/* Diagram area */
.diagram-area {
  min-height: 300px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-2);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: stretch;
}

/* State 0-1: single box view */
.single-view {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  width: 100%;
  padding: 40px;
}

.folder-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 32px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--bg);
  min-width: 180px;
  text-align: center;
}
.folder-box .icon { font-size: 36px; }
.folder-box .label { font-size: 14px; font-weight: 600; color: var(--text); }
.folder-box .sublabel { font-size: 12px; color: var(--text-3); }
.folder-box.has-git { border-color: var(--accent); border-style: solid; }

.repo-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 28px;
  background: var(--zone-repo-bg);
  color: var(--zone-repo-text);
  border-radius: 12px;
  min-width: 160px;
  text-align: center;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.repo-badge.visible { opacity: 1; transform: translateX(0); }
.repo-badge .icon { font-size: 28px; }
.repo-badge .label { font-size: 13px; font-weight: 600; }
.repo-badge .check { font-size: 12px; color: #86efac; margin-top: 4px; }
.arrow-right {
  font-size: 24px;
  color: var(--text-3);
  opacity: 0;
  transition: opacity 0.4s ease 0.2s;
}
.arrow-right.visible { opacity: 1; }

/* Three zone view */
.three-zone {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  width: 100%;
}

.zone {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}
.zone-work { background: var(--zone-work); }
.zone-stage { background: var(--zone-stage); border-left: 1px solid rgba(0,0,0,.06); border-right: 1px solid rgba(0,0,0,.06); }
.zone-repo { background: var(--zone-repo-bg); color: var(--zone-repo-text); }

.zone-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .7;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0,0,0,.08);
}
.zone-repo .zone-label { border-color: rgba(255,255,255,.12); }

.file-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.85);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  border: 1px solid rgba(0,0,0,.08);
  transition: transform 0.5s cubic-bezier(.4,0,.2,1), opacity 0.4s ease;
}
.file-card .modified-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ca8a04;
  flex-shrink: 0;
}

/* Commit nodes */
.commit-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.commit-node {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  position: relative;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.commit-node.visible { opacity: 1; transform: translateY(0); }
.commit-timeline {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 20px;
  flex-shrink: 0;
}
.commit-circle {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid rgba(255,255,255,.3);
  flex-shrink: 0;
}
.commit-line {
  width: 2px;
  flex: 1;
  background: rgba(255,255,255,.2);
  min-height: 24px;
}
.commit-info { flex: 1; }
.commit-hash { font-family: var(--mono); font-size: 10px; color: #93c5fd; margin-bottom: 2px; }
.commit-msg { font-size: 12px; color: var(--zone-repo-text); font-weight: 500; }
.commit-time { font-size: 10px; color: rgba(255,255,255,.4); margin-top: 2px; }

/* Empty zone label */
.zone-empty {
  font-size: 12px;
  color: rgba(0,0,0,.3);
  font-style: italic;
  text-align: center;
  padding: 12px 0;
}
.zone-repo .zone-empty { color: rgba(255,255,255,.3); }

/* Terminal log */
.terminal-log {
  background: #0d1117;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 16px;
}
.terminal-titlebar {
  background: #1c2128;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.t-dot { width: 10px; height: 10px; border-radius: 50%; }
.t-dot-red { background: #ff5f57; }
.t-dot-yellow { background: #febc2e; }
.t-dot-green { background: #28c840; }
.terminal-body {
  padding: 16px 20px;
  font-family: var(--mono);
  font-size: 13px;
  color: #e2e8f0;
  min-height: 80px;
  max-height: 140px;
  overflow-y: auto;
  white-space: pre;
}
.terminal-body .cmd-line { color: #7dd3fc; }
.terminal-body .output-line { color: #94a3b8; }
.terminal-body .success-line { color: #86efac; }

/* Command explanation */
.cmd-explanation {
  margin-top: 16px;
  padding: 16px 20px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.cmd-explanation .cmd-code-block {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}
.cmd-explanation .cmd-desc-text {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
}

/* Navigation buttons */
.nav-buttons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  padding-bottom: 48px;
}
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s, opacity 0.2s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary {
  background: var(--bg-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }

.step-counter {
  font-size: 13px;
  color: var(--text-3);
}

/* Staging animation: file card flying */
.file-card.fly-to-stage {
  animation: flyToStage 0.5s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes flyToStage {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(40px); opacity: 0; }
}
.file-card.fly-to-repo {
  animation: flyToRepo 0.5s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes flyToRepo {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(40px); opacity: 0; }
}
.file-card.fade-in {
  animation: fadeInCard 0.4s ease forwards;
}
@keyframes fadeInCard {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Visibility helpers */
.hidden { display: none !important; }

@media (max-width: 640px) {
  nav, .page-header, .progress-bar { padding-left: 20px; padding-right: 20px; }
  .container { padding: 0 20px; }
  .three-zone { grid-template-columns: 1fr; }
  .zone-stage, .zone-repo { border-left: none; border-right: none; border-top: 1px solid rgba(0,0,0,.08); }
  .single-view { flex-direction: column; gap: 20px; }
}
