:root {
	--bg: #efe9df;
	--sheet: #fffdf8;
	--text: #1d2427;
	--muted: #5a656c;
	--line: #ddd1bf;
	--aqua: #1d8f8d;
	--blue: #1e5fa8;
	--sand: #f4d6a8;
	--ok: #2f8f4e;
	--warn: #9b6b2e;
	--shadow: 0 14px 30px rgba(29, 36, 39, 0.1);
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: "Avenir Next", "Segoe UI", sans-serif;
	line-height: 1.55;
	color: var(--text);
	background:
		radial-gradient(circle at 10% 0, #f8e6cb 0 20%, transparent 26%),
		radial-gradient(circle at 90% 8%, #cce8e8 0 18%, transparent 24%),
		var(--bg);
}

h1,
h2,
h3 {
	font-family: "Palatino Linotype", "Book Antiqua", serif;
	line-height: 1.2;
	margin-top: 0;
}

.wrap {
	width: min(1140px, 93%);
	margin: 0 auto;
}

.topbar {
	position: sticky;
	top: 0;
	z-index: 25;
	background: rgba(255, 253, 248, 0.9);
	backdrop-filter: blur(8px);
	border-bottom: 1px solid var(--line);
}

.topbar-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	padding: 12px 0;
}

.brand {
	font-size: 1.08rem;
	font-weight: 800;
	letter-spacing: 0.02em;
	text-decoration: none;
	color: var(--blue);
}

.global-progress {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 0.92rem;
	color: var(--muted);
}

.meter {
	width: 140px;
	height: 9px;
	border-radius: 999px;
	overflow: hidden;
	background: #e9dfd1;
	border: 1px solid #d6c8b6;
}

.meter-fill {
	height: 100%;
	width: 0;
	background: linear-gradient(130deg, var(--blue), var(--aqua));
	transition: width 0.2s ease;
}

.hero-home {
	padding: 64px 0 54px;
	background:
		linear-gradient(118deg, rgba(30, 95, 168, 0.95), rgba(29, 143, 141, 0.92)),
		linear-gradient(50deg, #1d8f8d, #1e5fa8);
	color: #fff;
	clip-path: polygon(0 0, 100% 0, 100% 92%, 0 100%);
}

.hero-home-inner {
	max-width: 780px;
	padding: 0 0 18px;
}

.kicker {
	display: inline-block;
	padding: 4px 11px;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, 0.4);
	font-size: 0.78rem;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	margin: 0 0 12px;
}

.hero-home h1 {
	font-size: clamp(2rem, 4vw, 3.2rem);
	margin-bottom: 14px;
}

main.wrap {
	margin-top: -18px;
	padding-bottom: 34px;
}

.panel {
	background: var(--sheet);
	border: 1px solid var(--line);
	border-radius: 16px;
	box-shadow: var(--shadow);
	padding: 18px;
	margin-bottom: 16px;
}

.stats-row {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 10px;
}

.stat-box {
	border: 1px solid var(--line);
	border-radius: 12px;
	background: linear-gradient(180deg, #fff, #fff7eb);
	padding: 12px;
}

.stat-label {
	font-size: 0.84rem;
	color: var(--muted);
	margin-bottom: 4px;
}

.stat-value {
	font-size: 1.3rem;
	font-weight: 800;
}

.chapter-cards {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 14px;
	padding-bottom: 24px;
}

.chapter-card {
	background: var(--sheet);
	border: 1px solid var(--line);
	border-radius: 16px;
	box-shadow: var(--shadow);
	padding: 16px;
	display: grid;
	gap: 10px;
}

.chapter-card h3 {
	margin: 0;
	font-size: 1.3rem;
}

.chapter-card p {
	margin: 0;
	color: var(--muted);
}

.chapter-meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
	font-size: 0.9rem;
	color: var(--muted);
}

.status-pill {
	padding: 4px 8px;
	border-radius: 999px;
	font-size: 0.78rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	border: 1px solid transparent;
}

.status-pill.status-not-started {
	background: #fff3df;
	color: var(--warn);
	border-color: #f1d1a5;
}

.status-pill.status-in-progress {
	background: #e4f3ff;
	color: var(--blue);
	border-color: #b7d9f8;
}

.status-pill.status-completed {
	background: #e5f7e9;
	color: var(--ok);
	border-color: #b9debf;
}

.open-link {
	display: inline-flex;
	justify-content: center;
	align-items: center;
	padding: 10px 12px;
	border-radius: 10px;
	text-decoration: none;
	font-weight: 800;
	color: #fff;
	background: linear-gradient(130deg, var(--blue), var(--aqua));
}

.site-foot {
	padding: 18px;
	text-align: center;
	background: #1d2427;
	color: #f5f5f5;
}

.chapter-shell {
	padding: 20px 0 28px;
	display: grid;
	grid-template-columns: 320px minmax(0, 1fr);
	gap: 14px;
}

.side-panel {
	background: var(--sheet);
	border: 1px solid var(--line);
	border-radius: 16px;
	padding: 16px;
	box-shadow: var(--shadow);
	height: fit-content;
	position: sticky;
	top: 74px;
}

.side-panel h1 {
	font-size: 1.45rem;
	margin-bottom: 8px;
}

.side-panel p {
	color: var(--muted);
	margin-top: 0;
}

.chapter-progress {
	font-size: 0.9rem;
	color: var(--muted);
	margin-bottom: 12px;
	display: grid;
	gap: 6px;
}

.lesson-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 8px;
}

.lesson-btn {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	border-radius: 11px;
	border: 1px solid #d9cdbd;
	background: #fffefb;
	text-align: left;
	font: inherit;
	color: var(--text);
	cursor: pointer;
	transition: transform 0.12s ease, border-color 0.12s ease;
}

.lesson-btn:hover {
	transform: translateY(-1px);
	border-color: #b9d6d6;
}

.lesson-btn.active {
	background: #dbf0f0;
	border-color: #81b8b8;
}

.lesson-btn.opened {
	background: #e8f5ff;
	border-color: #9ec8ed;
}

.lesson-btn:disabled,
.lesson-btn.lesson-missing {
	cursor: not-allowed;
	background: #f6f0e8;
	opacity: 0.6;
}

.lesson-num {
	display: inline-block;
	min-width: 44px;
	padding: 2px 7px;
	text-align: center;
	border-radius: 999px;
	font-size: 0.83rem;
	font-weight: 800;
	border: 1px solid #d3c5b2;
	background: #fff8ea;
}

.viewer {
	background: var(--sheet);
	border: 1px solid var(--line);
	border-radius: 16px;
	box-shadow: var(--shadow);
	overflow: hidden;
}

.viewer-head {
	padding: 16px 18px;
	border-bottom: 1px solid var(--line);
	background: linear-gradient(180deg, #fff, #fff6e8);
}

.viewer-head h2 {
	margin: 0 0 5px;
	font-size: 1.5rem;
}

.viewer-head p {
	margin: 0;
	color: var(--muted);
}

.viewer-body {
	padding: 18px;
	background: #fff;
	min-height: 360px;
}

.lesson-content {
	max-width: 100%;
	color: var(--text);
	font-family: "Avenir Next", "Segoe UI", sans-serif;
	line-height: 1.65;
	word-break: break-word;
}

.lesson-content :is(h1, h2, h3, h4) {
	font-family: "Palatino Linotype", "Book Antiqua", serif;
	margin-top: 0;
	color: var(--text);
}

.lesson-content pre {
	padding: 14px;
	border-radius: 12px;
	background: #2d3642;
	color: #f3f6fb;
	overflow-x: auto;
	font-size: 0.95rem;
}

.lesson-content code {
	font-family: "Consolas", "Courier New", monospace;
	font-size: 0.95em;
}

.lesson-content img,
.lesson-content video,
.lesson-content iframe {
	max-width: 100%;
	height: auto;
	border-radius: 8px;
}

.lesson-content table {
	width: 100%;
	border-collapse: collapse;
	display: block;
	overflow-x: auto;
}

.lesson-content td,
.lesson-content th {
	border: 1px solid #d9cdbd;
	padding: 8px;
}

.viewer-empty {
	margin: 0;
	color: var(--muted);
}

.top-tools {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-top: 10px;
}

.ghost-btn {
	padding: 7px 10px;
	border-radius: 8px;
	border: 1px solid #bfccd8;
	background: #f2f8ff;
	color: #29455f;
	cursor: pointer;
	font: inherit;
	font-size: 0.88rem;
}

.ghost-btn:hover {
	filter: brightness(0.98);
}

@media (max-width: 980px) {
	.chapter-shell {
		grid-template-columns: 1fr;
	}

	.side-panel {
		position: static;
	}
}

@media (max-width: 760px) {
	.topbar-inner {
		flex-direction: column;
		align-items: flex-start;
	}

	.global-progress {
		width: 100%;
	}

	.meter {
		flex: 1;
	}

	.stats-row {
		grid-template-columns: 1fr;
	}

	.chapter-cards {
		grid-template-columns: 1fr;
	}

	.hero-home {
		padding-top: 48px;
	}

	.hero-home h1 {
		font-size: 1.8rem;
	}

	.viewer-body {
		padding: 14px;
		min-height: 280px;
	}
}
