/* ============================================================
   AI Harness Engineering with DeepSeek
   ============================================================ */

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

:root {
  --bg-start: #667eea;
  --bg-end: #764ba2;
  --dark: #2c3e50;
  --ink: #1a1a2e;
  --muted: #555;
  --accent: #667eea;
  --light: #f7f9fc;
  --border: #eef0f4;
  --code-bg: #2c3e50;
  --code-fg: #ecf0f1;
  --warn: #e67e22;
  --warn-bg: #fef5e7;
  --tip-bg: #eef3ff;
  --tip-border: #667eea;
  --good: #27ae60;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-end) 100%);
  min-height: 100vh;
  color: var(--ink);
  line-height: 1.65;
}

.app-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.app-header {
  text-align: center;
  color: white;
  padding: 2rem 0 1.5rem;
}

.back-link {
  display: inline-block;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  padding: 0.4rem 1rem;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 25px;
  transition: background 0.25s, border-color 0.25s;
}

.back-link:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.65);
  color: white;
}

.app-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.5px;
}

.app-subtitle {
  font-size: 1.1rem;
  opacity: 0.92;
  max-width: 820px;
  margin: 0 auto;
  line-height: 1.7;
}

.toc {
  background: white;
  border-radius: 15px;
  padding: 1.5rem 1.75rem;
  margin: 1.75rem 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.toc h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 0.9rem;
}

.toc ol {
  list-style: none;
  counter-reset: toc;
}

.toc li {
  counter-increment: toc;
  margin-bottom: 0.35rem;
}

.toc a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  display: inline-block;
  padding: 0.15rem 0;
  transition: color 0.2s;
}

.toc a::before {
  content: counter(toc) ". ";
  color: var(--accent);
  font-weight: 700;
}

.toc a:hover {
  color: var(--accent);
}

.section {
  background: white;
  border-radius: 15px;
  padding: 2.25rem 2.25rem;
  margin-bottom: 1.75rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.section h2 {
  font-size: 1.7rem;
  color: var(--ink);
  margin-bottom: 0.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 3px solid var(--accent);
  display: inline-block;
}

.section h3 {
  font-size: 1.25rem;
  color: var(--accent);
  margin: 1.75rem 0 0.6rem;
}

.section h4 {
  font-size: 1.05rem;
  color: var(--ink);
  margin: 1.25rem 0 0.4rem;
}

.section p {
  color: var(--muted);
  margin-bottom: 0.9rem;
}

.section ul, .section ol {
  margin: 0.5rem 0 1rem 1.4rem;
  color: var(--muted);
}

.section li {
  margin-bottom: 0.45rem;
}

.section li strong {
  color: var(--ink);
}

.code-block {
  position: relative;
  background: var(--code-bg);
  border-radius: 10px;
  margin: 1rem 0 1.25rem;
  overflow: hidden;
}

.code-block pre {
  padding: 0.6rem 1rem 1rem;
  overflow-x: auto;
}

.code-block code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.86rem;
  color: var(--code-fg);
  line-height: 1.65;
  white-space: pre;
}

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.32rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  color: white;
  border-color: rgba(255, 255, 255, 0.5);
}

.copy-btn.copied {
  background: #27ae60;
  border-color: #27ae60;
  color: white;
}

.pro-tip, .warning {
  border-radius: 10px;
  padding: 0.95rem 1.15rem;
  margin: 1rem 0;
  font-size: 0.94rem;
  line-height: 1.6;
}

.pro-tip {
  background: var(--tip-bg);
  border-left: 4px solid var(--tip-border);
  color: #2c3e50;
}

.warning {
  background: var(--warn-bg);
  border-left: 4px solid var(--warn);
  color: #5a3d12;
}

.pro-tip .label, .warning .label {
  font-weight: 800;
  letter-spacing: 0.3px;
}

.table-wrap {
  overflow-x: auto;
  margin: 1rem 0 1.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  background: var(--light);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

td {
  color: var(--muted);
}

td code, p code, li code, .flow-node code, .pro-tip code, .warning code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.85em;
  background: var(--light);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  color: #5a3fc0;
}

.flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1.25rem 0;
}

.flow-node {
  background: white;
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  padding: 0.7rem 1.1rem;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  width: 100%;
  max-width: 460px;
}

.flow-node small {
  display: block;
  font-weight: 500;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.15rem;
}

.flow-arrow {
  color: var(--accent);
  font-size: 1.3rem;
  line-height: 1;
  margin: 0.15rem 0;
  font-weight: 700;
}

.widget {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  margin: 1.1rem 0 1.4rem;
  background: var(--light);
}

.widget-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.widget-head h4 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
}

.widget-btns {
  display: flex;
  gap: 0.5rem;
}

.step-btn, .reset-btn {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.42rem 0.95rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, opacity 0.2s;
}

.step-btn {
  background: var(--accent);
  color: white;
  border: 1px solid var(--accent);
}

.step-btn:hover {
  background: #5568d8;
}

.step-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.reset-btn {
  background: white;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.reset-btn:hover {
  background: var(--tip-bg);
}

.step-progress {
  height: 6px;
  background: #e3e7f0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.9rem;
}

.step-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--bg-end));
  transition: width 0.35s ease;
}

.step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
}

.step-list li {
  position: relative;
  padding: 0.55rem 0.7rem 0.55rem 2.6rem;
  margin: 0;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  opacity: 0.5;
  transition: opacity 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.step-list li + li {
  margin-top: 0.3rem;
}

.step-list li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0.7rem;
  top: 0.55rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: #d9deee;
  color: #5a5f7a;
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-list li.active {
  background: white;
  opacity: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.step-list li.done {
  opacity: 0.85;
}

.step-list li.done::before {
  background: #27ae60;
  color: white;
}

.step-list li.active::before {
  background: var(--accent);
  color: white;
}

.step-list code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.85em;
  background: #eceef5;
  padding: 0.08rem 0.32rem;
  border-radius: 4px;
  color: #5a3fc0;
}

.app-footer {
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  padding: 2.5rem 0 1rem;
  font-size: 0.85rem;
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--dark);
  color: white;
  padding: 0.65rem 1.5rem;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.25);
  z-index: 1000;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275),
              opacity 0.3s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media (max-width: 768px) {
  .app-title { font-size: 1.9rem; }
  .app-subtitle { font-size: 0.95rem; }
  .section { padding: 1.5rem 1.25rem; }
  .section h2 { font-size: 1.4rem; }
  .widget-head { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .app-container { padding: 1rem 0.75rem 2rem; }
  .app-title { font-size: 1.55rem; }
  .section { padding: 1.15rem 0.9rem; }
  .code-block code { font-size: 0.78rem; }
  .toc { padding: 1.1rem 1rem; }
}
