:root {
	--bg: #f1f5f9;
	--surface: #ffffff;
	--surface-2: #f8fafc;
	--border: #e2e8f0;
	--border-2: #cbd5e1;
	--ink: #0f172a;
	--ink-2: #334155;
	--muted: #64748b;
	--accent: #f59e0b;
	--accent-d: #d97706;
	--accent-bg: #fffbeb;
	--blue: #3b82f6;
	--blue-d: #2563eb;
	--blue-bg: #eff6ff;
	--danger: #ef4444;
	--danger-bg: #fef2f2;
	--ok: #22c55e;
	--ok-bg: #f0fdf4;
	--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05);
	--shadow:
		0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
	--shadow-md:
		0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

* {
	box-sizing: border-box;
}

::-webkit-scrollbar {
	width: 6px;
	height: 6px;
}
::-webkit-scrollbar-track {
	background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
	background: #cbd5e1;
	border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
	background: #94a3b8;
}

body {
	margin: 0;
	font-family:
		'Inter', 'IBM Plex Sans', 'Avenir Next', 'PingFang SC', 'Microsoft YaHei',
		sans-serif;
	color: var(--ink);
	background: var(--bg);
	min-height: 100vh;
}

.wrap {
	max-width: 1240px;
	margin: 0 auto;
	padding: 32px 20px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* ── Hero ─────────────────────────────────────────────── */
.hero {
	position: relative;
	padding: 28px 32px 24px;
	border-radius: 16px;
	border: 1px solid var(--border);
	background: linear-gradient(135deg, #ffffff 0%, #fefce8 100%);
	box-shadow: var(--shadow-md);
	overflow: hidden;
}

.hero::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(
		90deg,
		var(--blue) 0%,
		var(--accent) 50%,
		var(--ok) 100%
	);
	border-radius: 16px 16px 0 0;
}

.hero::after {
	content: '';
	position: absolute;
	top: -80px;
	right: -80px;
	width: 300px;
	height: 300px;
	border-radius: 50%;
	background: radial-gradient(
		circle,
		rgba(245, 158, 11, 0.1) 0%,
		transparent 70%
	);
	pointer-events: none;
}

.hero-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.hero h1 {
	margin: 0;
	font-size: 28px;
	font-weight: 800;
	letter-spacing: -0.02em;
	color: var(--ink);
}

.lang-btn {
	flex-shrink: 0;
	padding: 6px 14px;
	border-radius: 7px;
	border: 1px solid var(--border-2);
	background: var(--surface);
	color: var(--ink-2);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.05em;
	cursor: pointer;
	transition: all 0.15s ease;
	box-shadow: var(--shadow-sm);
}

.lang-btn:hover {
	border-color: var(--blue);
	color: var(--blue-d);
	background: var(--blue-bg);
}

.hero p {
	margin: 6px 0 0;
	color: var(--muted);
	font-size: 13px;
}

.source-note {
	margin-top: 4px;
	font-size: 12px;
	color: #94a3b8;
}

.hero-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.jump-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 9px 18px;
	border-radius: 8px;
	border: 1px solid #f4cf8b;
	background: #fff7e6;
	color: #92400e;
	text-decoration: none;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.01em;
	box-shadow: 0 1px 2px rgba(217, 119, 6, 0.12);
	transition: all 0.15s ease;
}

.jump-btn:hover {
	background: #ffedd5;
	box-shadow: 0 4px 12px rgba(217, 119, 6, 0.2);
	transform: translateY(-1px);
}

/* ── Progress Grid ────────────────────────────────────── */
.grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(188px, 1fr));
	gap: 12px;
}

.card {
	position: relative;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 16px 16px 14px;
	box-shadow: var(--shadow-sm);
	transition:
		transform 0.15s ease,
		box-shadow 0.15s ease;
	overflow: hidden;
}

.card:hover {
	transform: translateY(-2px);
	box-shadow: var(--shadow-md);
}

.card::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 3px;
	border-radius: 12px 12px 0 0;
	background: linear-gradient(90deg, var(--accent) 0%, var(--accent-d) 100%);
}

.card h3 {
	margin: 0;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--muted);
}

.card .value {
	margin-top: 10px;
	font-size: 20px;
	font-weight: 800;
	color: var(--ink);
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
}

.card .meta {
	margin-top: 4px;
	font-size: 11px;
	color: #94a3b8;
}

/* ── Section cards ────────────────────────────────────── */
.returns,
.abbr-card,
.process-card,
.sources-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 14px;
	padding: 24px 24px 20px;
	box-shadow: var(--shadow-sm);
}

.returns h2,
.abbr-card h2,
.process-card h2,
.sources-card h2 {
	margin: 0 0 4px;
	font-size: 17px;
	font-weight: 700;
	color: var(--ink);
	letter-spacing: -0.01em;
}

/* ── Diagram card ────────────────────────────────────── */
.diagram-card {
	padding-top: 2px;
}

.diagram-card h3 {
	margin: 0 0 14px;
	font-size: 17px;
	font-weight: 700;
	color: var(--ink);
}

.flow-embed {
	width: 100%;
	min-height: 88vh;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: #fff;
	box-shadow: var(--shadow-sm);
}

/* ── Return count & chart ─────────────────────────────── */
.return-count {
	margin: 6px 0 16px;
	font-size: 13px;
	color: var(--danger);
	font-weight: 700;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--danger-bg);
	padding: 4px 10px;
	border-radius: 20px;
	border: 1px solid #fecaca;
}

.reason-chart {
	display: grid;
	gap: 8px;
}

.reason-row {
	display: grid;
	grid-template-columns: minmax(160px, 280px) 1fr;
	gap: 12px;
	align-items: center;
	padding: 5px 0;
	border-bottom: 1px solid #f1f5f9;
}

.reason-row:last-child {
	border-bottom: none;
}

.reason-label {
	font-size: 12.5px;
	color: var(--ink-2);
	line-height: 1.4;
	word-break: break-word;
}

.reason-bar-wrap {
	position: relative;
	height: 26px;
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: 6px;
	overflow: hidden;
}

.reason-bar {
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	background: linear-gradient(90deg, var(--accent) 0%, var(--accent-d) 100%);
	border-radius: 5px;
	transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reason-value {
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 11px;
	font-weight: 700;
	color: var(--ink);
	z-index: 1;
}

.reason-empty,
.abbr-tip,
.process-tip,
.sources-tip {
	font-size: 12.5px;
	color: var(--muted);
	margin: 4px 0 14px;
	line-height: 1.5;
}

/* ── Abbreviation table ───────────────────────────────── */
.abbr-table-wrap {
	margin-top: 14px;
	overflow: auto;
	border-radius: 10px;
	border: 1px solid var(--border);
}

.abbr-table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	min-width: 480px;
}

.abbr-table th,
.abbr-table td {
	border-bottom: 1px solid var(--border);
	text-align: left;
	vertical-align: top;
	padding: 10px 14px;
	font-size: 13.5px;
	line-height: 1.45;
}

.abbr-table thead th {
	position: sticky;
	top: 0;
	z-index: 1;
	background: var(--surface-2);
	color: var(--muted);
	font-size: 10px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	font-weight: 700;
	border-bottom: 1px solid var(--border-2);
}

.abbr-table td:first-child strong {
	color: var(--blue-d);
	font-size: 12.5px;
	font-weight: 700;
	font-family: 'IBM Plex Mono', 'Fira Code', monospace;
	letter-spacing: 0.03em;
}

.abbr-table tbody tr {
	transition: background 0.1s;
}

.abbr-table tbody tr:hover td {
	background: var(--blue-bg);
}

.abbr-table tbody tr:nth-child(2n) td {
	background: var(--surface-2);
}

.abbr-table tbody tr:hover td {
	background: var(--blue-bg);
}

.abbr-table tbody tr:last-child td {
	border-bottom: none;
}

/* ── Process list ─────────────────────────────────────── */
.process-list {
	margin: 14px 0 0;
	padding: 0;
	list-style: none;
	counter-reset: step;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.process-list li {
	counter-increment: step;
	display: grid;
	grid-template-columns: 32px 1fr;
	gap: 12px;
	align-items: start;
	line-height: 1.55;
	color: var(--ink-2);
	font-size: 13.5px;
	padding: 10px 12px 10px 0;
	border-bottom: 1px solid #f1f5f9;
	transition: background 0.1s;
	border-radius: 6px;
}

.process-list li:last-child {
	border-bottom: none;
}
.process-list li:hover {
	background: var(--surface-2);
}

.process-list li::before {
	content: counter(step);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 7px;
	background: var(--accent-bg);
	border: 1px solid #fde68a;
	color: var(--accent-d);
	font-size: 11px;
	font-weight: 800;
	flex-shrink: 0;
	margin-top: 2px;
}

/* ── Legacy SVG diagram (inlined in index.html) ─────── */
.diagram-wrap {
	margin-top: 10px;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: #f0f4f8;
	overflow: auto;
}

.diagram-wrap svg {
	display: block;
	width: 100%;
	min-width: 1280px;
	height: auto;
}

/* Flowchart node SVG classes (used by inlined flowchart in index.html) */
.node {
	stroke: #6f849b;
	stroke-width: 1.2;
}
.node.start {
	fill: #2563eb;
}
.node.main {
	fill: #f59e0b;
}
.node.review {
	fill: #1d2733;
}
.node.gray {
	fill: #263242;
}
.node.option {
	fill: #1d2733;
}
.node.milestone {
	fill: #16a34a;
}
.node.check {
	fill: #86efac;
}
.node.landing {
	fill: #0ea5e9;
}
.node.outland {
	fill: #7c3aed;
}
.node.return {
	fill: #ef4444;
}
.node.end {
	fill: #b91c1c;
}

.stage-frame {
	fill: rgba(134, 239, 172, 0.07);
	stroke: #84cc16;
	stroke-width: 2;
	stroke-dasharray: 10 8;
}

.node-text {
	font-size: 15px;
	font-weight: 700;
	fill: #e6edf8;
	dominant-baseline: middle;
}
.node-text.sm {
	font-size: 13px;
}
.node-text.xs {
	font-size: 11px;
	font-weight: 600;
}
.node-text.light {
	fill: #ffffff;
}

.flow {
	stroke: #90a2b7;
	stroke-width: 2;
	fill: none;
	marker-end: url(#arrow);
}
.flow.dashed,
.flow.depend {
	stroke: #ff6b6b;
	stroke-dasharray: 7 6;
}
.flow.parallel {
	stroke: #37d67a;
	stroke-dasharray: 8 6;
}
.legend {
	font-size: 12px;
	fill: #a5b3c5;
}

/* ── Remarks Stats Section ────────────────────────────── */
.remarks-stats-section {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 14px;
	padding: 24px 24px 20px;
	box-shadow: var(--shadow-sm);
}

.remarks-stats-section h2 {
	margin: 0 0 4px;
	font-size: 17px;
	font-weight: 700;
	color: var(--ink);
	letter-spacing: -0.01em;
}

.remarks-tip {
	font-size: 12.5px;
	color: var(--muted);
	margin: 4px 0 14px;
	line-height: 1.5;
}

.remarks-stats-section .card::before {
	background: linear-gradient(90deg, var(--blue) 0%, var(--blue-d) 100%);
}

.remarks-stats-section .card .value {
	font-size: 32px;
	color: var(--blue-d);
}

/* ── Footer ───────────────────────────────────────────── */
.site-footer {
	text-align: center;
	padding: 16px 20px;
	font-size: 13px;
	color: var(--muted);
	border-top: 1px solid var(--border);
	margin-top: 8px;
}
.footer-star {
	margin-top: 10px;
}
.star-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 16px;
	border-radius: 20px;
	background: var(--surface);
	border: 1px solid var(--border);
	color: var(--text);
	font-size: 13px;
	font-weight: 500;
	text-decoration: none;
	transition:
		border-color 0.2s,
		box-shadow 0.2s;
}
.star-btn:hover {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
	color: var(--accent);
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 860px) {
	.wrap {
		padding: 16px 12px;
		gap: 12px;
	}
	.hero {
		padding: 20px 18px 16px;
	}
	.hero h1 {
		font-size: 22px;
	}
	.hero-top {
		flex-direction: column;
		align-items: flex-start;
	}
	.lang-btn {
		align-self: flex-start;
	}

	.returns,
	.abbr-card,
	.process-card,
	.sources-card {
		padding: 16px 14px;
	}

	.reason-row {
		grid-template-columns: 1fr;
		gap: 6px;
	}

	.process-list li {
		grid-template-columns: 28px 1fr;
		gap: 10px;
	}
}

@media (max-width: 600px) {
	.hero {
		padding: 18px 16px 14px;
	}
	.hero h1 {
		font-size: 20px;
	}
	.hero p {
		font-size: 12px;
	}
	.source-note {
		font-size: 11px;
	}

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .jump-btn {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
  }

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

	.card {
		padding: 14px 14px 12px;
	}
	.card .value {
		font-size: 18px;
	}

	.abbr-table {
		min-width: 360px;
	}
	.abbr-table th,
	.abbr-table td {
		padding: 8px 10px;
		font-size: 12.5px;
	}

	.process-list li {
		font-size: 12.5px;
	}

	.fc-scroll {
		max-height: 70vh;
	}
}
