:root {
	--ink: #212425;
	--ink-2: #3f4344;
	--muted: #747877;
	--faint: #9ea19f;
	--paper: #f8f7f2;
	--paper-2: #f1f0ea;
	--canvas: #e7e7e1;
	--line: #d5d5ce;
	--line-strong: #b9bbb6;
	--accent: #d46f2c;
	--accent-dark: #9e4c1a;
	--accent-wash: #f4e4d8;
	--green: #4d725d;
	--green-wash: #e1eae3;
	--red: #9a4c42;
	--red-wash: #f1e0dc;
	--shadow: 0 14px 42px rgba(42, 43, 40, 0.08);
	font-family: "Avenir Next", Avenir, "PingFang SC", "Hiragino Sans GB", sans-serif;
	font-synthesis: none;
	color-scheme: light;
}

* { box-sizing: border-box; }

html,
body { min-width: 320px; min-height: 100%; margin: 0; }

body {
	display: grid;
	height: 100vh;
	height: 100dvh;
	grid-template-columns: 246px minmax(0, 1fr);
	overflow: hidden;
	background:
		linear-gradient(rgba(33, 36, 37, 0.025) 1px, transparent 1px),
		linear-gradient(90deg, rgba(33, 36, 37, 0.025) 1px, transparent 1px),
		var(--canvas);
	background-size: 32px 32px;
	color: var(--ink);
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	-webkit-font-smoothing: antialiased;
}

button,
input,
select { font: inherit; }

button,
a,
input,
select { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

button { color: inherit; }

.app-rail {
	position: relative;
	z-index: 3;
	display: flex;
	min-height: 0;
	flex-direction: column;
	overflow-y: auto;
	border-right: 1px solid var(--line-strong);
	background: rgba(247, 246, 241, 0.97);
}

.app-rail::before {
	position: absolute;
	top: 0;
	right: -1px;
	width: 3px;
	height: 92px;
	background: var(--accent);
	content: "";
}

.brand {
	display: flex;
	min-height: 78px;
	align-items: center;
	gap: 11px;
	padding: 0 22px;
	border-bottom: 1px solid var(--line);
	color: inherit;
	text-decoration: none;
}

.brand-mark {
	display: grid;
	width: 34px;
	height: 34px;
	place-items: center;
	border-radius: 2px;
	background: var(--ink);
	box-shadow: inset 0 -3px var(--accent);
	color: var(--paper);
	font-family: "Iowan Old Style", "Songti SC", serif;
	font-size: 20px;
	font-weight: 700;
}

.brand > span:last-child { display: grid; gap: 2px; }
.brand strong { font-size: 13px; letter-spacing: 0.025em; }
.brand small,
.eyebrow,
.rail-protocol p,
.rail-footer,
.section-heading p,
.section-heading > small,
.setting-card header > span,
.header-state,
.library-progress span {
	color: var(--muted);
	font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.12em;
}

.rail-date {
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 25px 22px 22px;
	border-bottom: 1px solid var(--line);
}

.rail-date > strong {
	font-family: "Iowan Old Style", "Songti SC", serif;
	font-size: 48px;
	font-weight: 500;
	letter-spacing: -0.05em;
	line-height: 0.82;
}

.rail-date > span { display: grid; gap: 3px; padding-top: 3px; }
.rail-date b { color: var(--accent-dark); font-size: 11px; letter-spacing: 0.08em; }
.rail-date small { color: var(--muted); font-size: 11px; }

.rail-nav { display: grid; padding: 16px 0; }

.nav-item {
	position: relative;
	display: grid;
	min-height: 52px;
	grid-template-columns: 25px 1fr auto;
	align-items: center;
	gap: 10px;
	padding: 0 20px 0 22px;
	border: 0;
	background: transparent;
	cursor: pointer;
	text-align: left;
}

.nav-item::before {
	position: absolute;
	top: 10px;
	bottom: 10px;
	left: 0;
	width: 3px;
	background: var(--accent);
	content: "";
	opacity: 0;
	transform: scaleY(0.4);
	transition: 160ms ease;
}

.nav-item:hover { background: rgba(33, 36, 37, 0.035); }
.nav-item.is-active { background: var(--paper-2); }
.nav-item.is-active::before { opacity: 1; transform: scaleY(1); }
.nav-item strong { font-size: 13px; font-weight: 650; }
.nav-item small { color: var(--faint); font-family: "SFMono-Regular", Consolas, monospace; font-size: 8px; letter-spacing: 0.08em; }
.nav-item.is-active small { color: var(--accent-dark); }
.nav-index { color: var(--faint); font-family: "Iowan Old Style", serif; font-size: 12px; font-style: italic; }
.nav-item.is-active .nav-index { color: var(--accent); }

.rail-protocol {
	display: grid;
	gap: 0;
	margin: auto 20px 18px;
	border-top: 1px solid var(--line-strong);
	border-bottom: 1px solid var(--line);
}

.rail-protocol p { margin: 0; padding: 12px 0 7px; }
.rail-protocol div { display: flex; justify-content: space-between; padding: 6px 0; color: var(--muted); font-size: 10px; }
.rail-protocol div:last-child { padding-bottom: 12px; }
.rail-protocol strong { color: var(--ink-2); font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; letter-spacing: 0.04em; }

.rail-footer { display: flex; justify-content: flex-end; padding: 0 20px 18px; }
.rail-footer a { color: var(--muted); text-decoration: none; }
.rail-footer a:hover { color: var(--accent-dark); }

.workspace {
	display: grid;
	min-width: 0;
	min-height: 0;
	grid-template-rows: 78px minmax(0, 1fr);
	overflow: hidden;
}

.workspace-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 clamp(24px, 3.5vw, 54px);
	border-bottom: 1px solid var(--line-strong);
	background: rgba(248, 247, 242, 0.9);
	backdrop-filter: blur(14px);
}

.workspace-header > div:first-child { display: grid; gap: 3px; }
.workspace-header p { margin: 0; }
.workspace-header h1 { margin: 0; font-family: "Iowan Old Style", "Songti SC", serif; font-size: 24px; font-weight: 600; letter-spacing: 0.01em; }
.header-state { display: flex; align-items: center; gap: 18px; }
.save-state { display: flex; align-items: center; gap: 7px; }
.save-state i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(77, 114, 93, 0.12); }

.resume-entry {
	display: grid;
	min-width: 132px;
	height: 42px;
	grid-template-columns: 27px 1fr 13px;
	align-items: center;
	gap: 8px;
	padding: 0 8px 0 7px;
	border: 1px solid var(--line-strong);
	border-radius: 3px;
	background: var(--paper);
	color: var(--ink);
	text-decoration: none;
	transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.resume-entry-mark {
	display: grid;
	width: 27px;
	height: 27px;
	place-items: center;
	border-radius: 2px;
	background: var(--ink);
	box-shadow: inset 0 -2px var(--accent);
	color: #fff;
	font-family: "Iowan Old Style", "Songti SC", serif;
	font-size: 15px;
	font-weight: 700;
}

.resume-entry-copy { display: grid; gap: 1px; }
.resume-entry-copy strong { font-size: 11px; font-weight: 760; letter-spacing: 0.015em; }
.resume-entry-copy small { color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 7px; font-weight: 750; letter-spacing: 0.11em; }
.resume-entry-arrow { color: var(--accent-dark); font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; transition: transform 150ms ease; }
.resume-entry:hover { border-color: var(--ink); background: var(--ink); color: #fff; }
.resume-entry:hover .resume-entry-mark { background: #fff; color: var(--ink); }
.resume-entry:hover .resume-entry-copy small,
.resume-entry:hover .resume-entry-arrow { color: #d9d9d5; }
.resume-entry:hover .resume-entry-arrow { transform: translateX(-2px); }

.view {
	min-height: 0;
	overflow-y: auto;
	padding: 32px clamp(24px, 3.5vw, 54px) 54px;
	scrollbar-color: var(--line-strong) transparent;
}

.view[hidden] { display: none; }
.view.is-active { animation: view-in 260ms ease both; }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } }

.today-layout {
	display: grid;
	max-width: 1420px;
	grid-template-columns: minmax(0, 1fr) 286px;
	gap: 32px;
	margin: 0 auto;
}

.training-column { min-width: 0; }

.daily-brief {
	position: relative;
	display: flex;
	min-height: 188px;
	align-items: center;
	justify-content: space-between;
	gap: 30px;
	overflow: hidden;
	padding: 34px 38px;
	border: 1px solid var(--line-strong);
	background: var(--ink);
	box-shadow: var(--shadow);
	color: var(--paper);
}

.daily-brief::before {
	position: absolute;
	top: -110px;
	right: 110px;
	width: 250px;
	height: 250px;
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 50%;
	box-shadow: 0 0 0 34px rgba(255, 255, 255, 0.02), 0 0 0 68px rgba(255, 255, 255, 0.018);
	content: "";
}

.daily-brief::after {
	position: absolute;
	top: 0;
	right: 0;
	width: 92px;
	height: 6px;
	background: var(--accent);
	content: "";
}

.brief-copy { position: relative; z-index: 1; max-width: 630px; }
.brief-copy .eyebrow { color: #b9bbb6; }
.brief-copy h2 { margin: 9px 0 10px; font-family: "Iowan Old Style", "Songti SC", serif; font-size: clamp(27px, 3vw, 40px); font-weight: 500; letter-spacing: -0.025em; line-height: 1.15; }
.brief-copy > p:last-child { max-width: 570px; margin: 0; color: #bbbdb8; font-size: 13px; line-height: 1.7; }

.completion-gauge { position: relative; z-index: 1; display: grid; width: 116px; height: 116px; flex: 0 0 auto; place-items: center; }
.completion-gauge svg { position: absolute; inset: 0; width: 100%; transform: rotate(-90deg); }
.completion-gauge circle { fill: none; stroke-width: 7; }
.gauge-track { stroke: rgba(255, 255, 255, 0.12); }
.gauge-value { stroke: var(--accent); stroke-dasharray: 307.88; stroke-dashoffset: 307.88; stroke-linecap: square; transition: stroke-dashoffset 500ms ease; }
.completion-gauge span { display: grid; gap: 2px; text-align: center; }
.completion-gauge strong { font-family: "Iowan Old Style", serif; font-size: 23px; font-weight: 500; }
.completion-gauge small { color: #aeb0ac; font-size: 9px; letter-spacing: 0.08em; }

.task-section { margin-top: 34px; }
.task-section.is-empty { display: none; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 12px; }
.section-heading > div { display: flex; align-items: center; gap: 12px; }
.section-heading p,
.section-heading h2 { margin: 0; }
.section-heading h2 { margin-top: 2px; font-family: "Iowan Old Style", "Songti SC", serif; font-size: 21px; font-weight: 600; }
.section-index { display: grid; width: 29px; height: 29px; place-items: center; border: 1px solid var(--line-strong); color: var(--accent-dark); font-family: "Iowan Old Style", serif; font-size: 13px; font-style: italic; }

.task-list { display: grid; border-top: 1px solid var(--line-strong); }

.task-card {
	position: relative;
	display: grid;
	min-height: 94px;
	grid-template-columns: 52px minmax(0, 1fr) auto;
	align-items: center;
	gap: 18px;
	padding: 14px 18px 14px 12px;
	border-bottom: 1px solid var(--line);
	background: rgba(248, 247, 242, 0.72);
	transition: background 150ms ease, transform 150ms ease;
}

.task-card:hover { z-index: 1; background: var(--paper); transform: translateX(3px); }
.task-card.is-complete { background: rgba(241, 240, 234, 0.72); }
.task-card.is-complete::before { position: absolute; top: 0; bottom: 0; left: 0; width: 3px; background: var(--green); content: ""; }

.complete-control {
	display: grid;
	width: 38px;
	height: 38px;
	place-items: center;
	border: 1px solid var(--line-strong);
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
	transition: 150ms ease;
}

.complete-control span { display: grid; width: 24px; height: 24px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: transparent; font-size: 12px; }
.complete-control:hover { border-color: var(--accent); transform: scale(1.04); }
.is-complete .complete-control { border-color: var(--green); background: var(--green-wash); }
.is-complete .complete-control span { border-color: var(--green); background: var(--green); color: white; }

.task-copy { min-width: 0; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.task-meta span { color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; font-weight: 700; letter-spacing: 0.08em; }
.task-meta .difficulty { padding-left: 8px; border-left: 1px solid var(--line); }
.difficulty.easy { color: var(--green); }
.difficulty.medium { color: var(--accent-dark); }
.difficulty.hard { color: var(--red); }
.task-copy h3 { overflow: hidden; margin: 0; font-size: 15px; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.task-copy h3 span { margin-left: 8px; color: var(--muted); font-size: 11px; font-weight: 450; }
.task-copy > small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }

.task-actions { display: flex; align-items: center; gap: 8px; }
.result-chip { padding: 6px 8px; border: 1px solid var(--line); background: var(--paper-2); color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 8px; font-weight: 700; letter-spacing: 0.06em; }
.solution-link {
	display: inline-flex;
	height: 34px;
	align-items: center;
	gap: 7px;
	padding: 0 11px;
	border: 1px solid var(--line-strong);
	background: var(--paper);
	color: var(--ink-2);
	cursor: pointer;
	font-size: 10px;
	font-weight: 700;
}
.solution-link span { color: var(--accent-dark); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; transition: transform 150ms ease; }
.solution-link:hover { border-color: var(--accent-dark); color: var(--accent-dark); }
.solution-link:hover span { transform: translateX(2px); }
.problem-link { display: inline-flex; height: 34px; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--ink); background: var(--ink); color: white; font-size: 11px; font-weight: 650; text-decoration: none; }
.problem-link span { color: #d0d1cd; font-size: 10px; transition: transform 150ms ease; }
.problem-link:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.problem-link:hover span { transform: translate(2px, -2px); }

.insight-column { display: grid; align-content: start; gap: 18px; }
.metric-board,
.review-forecast,
.level-legend { border: 1px solid var(--line-strong); background: rgba(248, 247, 242, 0.82); box-shadow: 0 8px 30px rgba(42, 43, 40, 0.04); }
.metric-board { padding: 21px; }
.metric-board header,
.review-forecast header { display: flex; align-items: start; justify-content: space-between; }
.metric-board header p,
.review-forecast header p,
.review-forecast header h2 { margin: 0; }
.metric-board header > span { color: var(--accent-dark); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; font-weight: 700; }
.mastery-number { display: flex; align-items: end; gap: 9px; margin: 26px 0 13px; }
.mastery-number strong { font-family: "Iowan Old Style", serif; font-size: 55px; font-weight: 500; letter-spacing: -0.06em; line-height: 0.78; }
.mastery-number span { color: var(--muted); font-size: 9px; font-weight: 650; line-height: 1.45; }
.mastery-track { height: 4px; overflow: hidden; background: var(--line); }
.mastery-track i { display: block; width: 0; height: 100%; background: var(--accent); transition: width 450ms ease; }
.metric-board dl { display: grid; grid-template-columns: 1fr 1fr; margin: 20px 0 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.metric-board dl div { display: grid; gap: 5px; padding: 11px 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric-board dt { color: var(--muted); font-size: 9px; }
.metric-board dd { margin: 0; font-family: "Iowan Old Style", serif; font-size: 18px; font-weight: 600; }
.metric-board dd span { font: inherit; }

.review-forecast { padding: 20px 20px 17px; }
.review-forecast h2 { margin-top: 3px !important; font-family: "Iowan Old Style", "Songti SC", serif; font-size: 18px; font-weight: 600; }
.review-forecast header > small { color: var(--muted); font-size: 9px; }
.forecast-chart { display: grid; height: 102px; grid-template-columns: repeat(7, 1fr); align-items: end; gap: 7px; margin-top: 18px; }
.forecast-day { display: grid; height: 100%; grid-template-rows: 1fr auto; align-items: end; gap: 7px; text-align: center; }
.forecast-bar { position: relative; display: flex; height: 100%; align-items: end; justify-content: center; background: linear-gradient(to top, rgba(33,36,37,0.035), transparent); }
.forecast-bar i { display: block; width: 9px; min-height: 2px; background: var(--ink-2); transition: height 400ms ease; }
.forecast-bar b { position: absolute; top: 1px; color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 8px; }
.forecast-day:first-child .forecast-bar i { background: var(--accent); }
.forecast-day small { color: var(--muted); font-size: 8px; }

.level-legend { display: grid; gap: 0; padding: 19px 20px 15px; }
.level-legend > p { margin: 0 0 10px; }
.level-legend div { display: grid; grid-template-columns: 34px 1fr; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.level-legend b { color: var(--accent-dark); font-family: "Iowan Old Style", serif; font-size: 14px; }
.level-legend span { color: var(--muted); font-size: 10px; }

.library-intro {
	display: flex;
	max-width: 1380px;
	align-items: end;
	justify-content: space-between;
	gap: 30px;
	margin: 0 auto 28px;
	padding-bottom: 26px;
	border-bottom: 1px solid var(--line-strong);
}

.library-intro p,
.library-intro h2 { margin: 0; }
.library-intro h2 { margin: 8px 0; font-family: "Iowan Old Style", "Songti SC", serif; font-size: clamp(28px, 3vw, 42px); font-weight: 500; letter-spacing: -0.025em; }
.library-intro > div:first-child > p:last-child { max-width: 640px; color: var(--muted); line-height: 1.7; }
.library-progress { display: flex; align-items: end; gap: 9px; }
.library-progress strong { font-family: "Iowan Old Style", serif; font-size: 48px; font-weight: 500; letter-spacing: -0.05em; line-height: 0.8; }
.library-progress span { line-height: 1.5; }

.library-toolbar {
	display: grid;
	max-width: 1380px;
	grid-template-columns: minmax(240px, 1fr) 190px 170px;
	gap: 10px;
	margin: 0 auto 14px;
}

.library-toolbar label { display: grid; align-content: start; gap: 6px; }
.library-toolbar label > span { color: var(--muted); font-size: 9px; font-weight: 650; }
.library-toolbar input,
.library-toolbar select { width: 100%; height: 42px; border: 1px solid var(--line-strong); border-radius: 0; background: var(--paper); color: var(--ink); }
.library-toolbar select { padding: 0 12px; }
.search-control { position: relative; display: block; }
.search-control > i { position: absolute; z-index: 1; top: 50%; left: 13px; color: var(--muted); font-size: 16px; font-style: normal; line-height: 1; transform: translateY(-50%); }
.search-field input { padding: 0 12px 0 39px; }

.problem-table { display: grid; max-width: 1380px; margin: 0 auto; border-top: 1px solid var(--line-strong); }
.problem-row { display: grid; min-height: 65px; grid-template-columns: 58px minmax(240px, 1.4fr) 120px 88px 100px 226px; align-items: center; gap: 15px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: rgba(248,247,242,0.66); }
.problem-row:hover { background: var(--paper); }
.problem-row > span,
.problem-number { color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; }
.problem-number { color: var(--ink-2); font-weight: 700; }
.problem-name { min-width: 0; }
.problem-name strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.problem-name small { display: block; overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.level-badge { display: inline-flex; flex: 0 0 auto; width: fit-content; min-width: 38px; height: 24px; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--paper-2); color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; font-weight: 700; }
.level-badge.level-3 { border-color: var(--green); background: var(--green-wash); color: var(--green); }
.level-badge.level-2 { border-color: var(--accent); background: var(--accent-wash); color: var(--accent-dark); }
.problem-row-actions { display: flex; min-width: 0; align-items: center; justify-content: end; gap: 6px; }
.row-button { display: inline-flex; flex: 0 0 auto; height: 29px; align-items: center; padding: 0 10px; border: 1px solid var(--line-strong); background: transparent; color: var(--ink-2); cursor: pointer; font-size: 9px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.row-button:hover { border-color: var(--ink); background: var(--ink); color: white; }
.empty-library { padding: 60px 20px; border-bottom: 1px solid var(--line); color: var(--muted); text-align: center; }

.settings-grid { display: grid; max-width: 1180px; grid-template-columns: minmax(0, 0.9fr) minmax(400px, 1.1fr); gap: clamp(32px, 7vw, 100px); margin: 0 auto; }
.settings-intro { padding-top: 12px; }
.settings-intro p,
.settings-intro h2 { margin: 0; }
.settings-intro h2 { max-width: 460px; margin: 13px 0 18px; font-family: "Iowan Old Style", "Songti SC", serif; font-size: clamp(35px, 4.5vw, 58px); font-weight: 500; letter-spacing: -0.04em; line-height: 1.12; }
.settings-intro > p:nth-child(3) { max-width: 490px; color: var(--muted); font-size: 14px; line-height: 1.8; }
.settings-intro ol { display: grid; gap: 0; margin: 38px 0 0; padding: 0; border-top: 1px solid var(--line-strong); list-style: none; }
.settings-intro li { display: grid; grid-template-columns: 38px 1fr; gap: 9px; padding: 14px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); line-height: 1.6; }
.settings-intro li span { color: var(--accent-dark); font-family: "Iowan Old Style", serif; font-size: 12px; font-style: italic; }

.settings-stack { display: grid; align-content: start; gap: 16px; }
.setting-card { display: grid; gap: 17px; padding: 23px; border: 1px solid var(--line-strong); background: rgba(248,247,242,0.86); box-shadow: var(--shadow); }
.setting-card header { display: flex; align-items: start; justify-content: space-between; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.setting-card h2,
.setting-card p { margin: 0; }
.setting-card h2 { margin-top: 4px; font-family: "Iowan Old Style", "Songti SC", serif; font-size: 20px; font-weight: 600; }
.setting-card > p { color: var(--muted); font-size: 12px; line-height: 1.7; }
.setting-card > label { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.setting-card label > span { display: grid; gap: 3px; }
.setting-card label strong { font-size: 12px; }
.setting-card label small { color: var(--muted); font-size: 10px; }
.setting-card select,
.setting-card input[type="date"] { width: 150px; height: 38px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 0; background: var(--paper); color: var(--ink); }
.setting-card label.is-disabled { opacity: 0.42; }
.pace-readout { display: grid; grid-template-columns: 108px 1fr; align-items: center; gap: 17px; padding: 15px; border: 1px solid var(--line-strong); background: var(--ink); color: var(--paper); }
.pace-readout > div { display: flex; align-items: end; gap: 8px; }
.pace-readout strong { font-family: "Iowan Old Style", serif; font-size: 42px; font-weight: 500; letter-spacing: -0.05em; line-height: 0.78; }
.pace-readout span { color: #adafaa; font-family: "SFMono-Regular", Consolas, monospace; font-size: 8px; font-weight: 700; line-height: 1.35; }
.pace-readout p { color: #c2c4bf; font-size: 10px; line-height: 1.6; }
.button-row { display: flex; gap: 8px; }
.button { min-height: 38px; padding: 0 14px; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; font-size: 10px; font-weight: 700; letter-spacing: 0.025em; }
.button:hover { border-color: var(--ink); }
.button.primary { border-color: var(--ink); background: var(--ink); color: white; }
.button.primary:hover { border-color: var(--accent-dark); background: var(--accent-dark); }
.danger-card { box-shadow: none; }
.button.danger { width: fit-content; border-color: #cba9a2; color: var(--red); }
.button.danger:hover { border-color: var(--red); background: var(--red); color: white; }

.solution-dialog {
	width: min(880px, calc(100vw - 48px));
	max-width: none;
	max-height: calc(100dvh - 48px);
	padding: 0;
	overflow: hidden;
	border: 1px solid #868985;
	border-radius: 0;
	background: var(--paper);
	box-shadow: 0 34px 110px rgba(20, 22, 21, 0.38);
	color: var(--ink);
}

.solution-dialog::backdrop {
	background: rgba(24, 26, 25, 0.66);
	backdrop-filter: blur(5px) saturate(0.72);
}

.solution-shell {
	display: grid;
	height: min(800px, calc(100dvh - 48px));
	grid-template-rows: auto minmax(0, 1fr) auto;
}

.solution-header {
	position: relative;
	display: flex;
	min-height: 92px;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	padding: 18px 24px 17px 28px;
	overflow: hidden;
	background: var(--ink);
	color: var(--paper);
}

.solution-header::after {
	position: absolute;
	top: 0;
	right: 84px;
	width: 150px;
	height: 5px;
	background: var(--accent);
	content: "";
}

.solution-header > div { position: relative; z-index: 1; }
.solution-header p,
.solution-header h2 { margin: 0; }
.solution-header .eyebrow { color: #9fa29e; }
.solution-header h2 { margin: 6px 0 2px; font-family: "Iowan Old Style", "Songti SC", serif; font-size: 27px; font-weight: 560; letter-spacing: -0.015em; }
.solution-header #solution-meta { color: #b9bbb7; font-size: 10px; }
.solution-close { position: relative; z-index: 1; width: 42px; height: 42px; flex: 0 0 auto; border: 1px solid #525654; background: transparent; color: #c7c9c5; cursor: pointer; font-family: "Iowan Old Style", serif; font-size: 28px; font-weight: 300; line-height: 1; }
.solution-close:hover { border-color: var(--accent); color: white; }

.solution-content {
	min-height: 0;
	overflow-y: auto;
	background: var(--paper);
	scrollbar-color: var(--line-strong) transparent;
}

.solution-standard,
.solution-steps,
.solution-code,
.solution-more { max-width: 760px; margin-right: auto; margin-left: auto; }

.solution-standard { padding: 34px 34px 30px; border-bottom: 1px solid var(--line-strong); }
.solution-label,
.solution-steps header p,
.solution-code header p,
.solution-more summary p {
	margin: 0;
	color: var(--accent-dark);
	font-family: "SFMono-Regular", Consolas, monospace;
	font-size: 8px;
	font-weight: 750;
	letter-spacing: 0.11em;
	text-transform: uppercase;
}
.solution-standard h3 { margin: 8px 0 9px; font-family: "Iowan Old Style", "Songti SC", serif; font-size: 29px; font-weight: 600; letter-spacing: -0.02em; }
.solution-summary { max-width: 680px; margin: 0; color: var(--ink-2); font-family: "Iowan Old Style", "Songti SC", serif; font-size: 16px; line-height: 1.75; }
.complexity-strip { display: flex; gap: 18px; margin-top: 18px; }
.complexity-strip span { color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; }
.complexity-strip b { margin-left: 6px; color: var(--ink); font-size: 10px; }

.solution-steps,
.solution-code { padding: 28px 34px 31px; border-bottom: 1px solid var(--line-strong); }
.solution-steps > header,
.solution-code > header { display: grid; grid-template-columns: 38px 1fr; align-items: center; margin-bottom: 17px; }
.solution-steps header > span,
.solution-code header > span,
.solution-more summary > span { color: var(--accent-dark); font-family: "Iowan Old Style", serif; font-size: 13px; font-style: italic; }
.solution-steps header p,
.solution-steps header h3,
.solution-code header p,
.solution-code header h3 { margin: 0; }
.solution-steps header h3,
.solution-code header h3 { margin-top: 2px; font-size: 14px; font-weight: 650; }
.solution-steps > ol { display: grid; gap: 0; margin: 0; padding: 0; border-top: 1px solid var(--line); list-style: none; counter-reset: solution-step; }
.solution-steps > ol li { position: relative; min-height: 48px; padding: 14px 12px 13px 48px; border-bottom: 1px solid var(--line); color: var(--ink-2); font-size: 12px; line-height: 1.65; counter-increment: solution-step; }
.solution-steps > ol li::before { position: absolute; top: 14px; left: 10px; color: var(--faint); font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; content: "0" counter(solution-step); }

.solution-code { background: var(--paper-2); }
.solution-code pre { max-height: 440px; margin: 0; overflow: auto; padding: 20px 22px 23px; border: 1px solid var(--ink); background: #1b1e1f; scrollbar-color: #555a58 transparent; }
.solution-code code { color: #e8e9e4; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 11px; line-height: 1.68; tab-size: 4; }

.solution-more { border-bottom: 1px solid var(--line-strong); }
.solution-more > summary { display: grid; min-height: 72px; grid-template-columns: 38px 1fr 24px; align-items: center; gap: 0; padding: 0 34px; cursor: pointer; list-style: none; }
.solution-more > summary::-webkit-details-marker { display: none; }
.solution-more summary strong { display: block; margin-top: 3px; font-size: 13px; }
.solution-more summary > i { color: var(--accent-dark); font-family: "SFMono-Regular", Consolas, monospace; font-size: 17px; font-style: normal; transition: transform 150ms ease; }
.solution-more[open] summary > i { transform: rotate(45deg); }
.solution-more-content { display: grid; gap: 28px; padding: 4px 34px 34px; }
.solution-more-content > section > h4,
.pitfall-panel > h4 { margin: 0 0 10px; color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; letter-spacing: 0.08em; }

.alternative-list { display: grid; border-top: 1px solid var(--line); }
.alternative-list article { display: grid; grid-template-columns: 38px 1fr; gap: 10px; padding: 13px 8px 13px 2px; border-bottom: 1px solid var(--line); }
.alternative-list article > b { color: var(--faint); font-family: "Iowan Old Style", serif; font-size: 11px; font-style: italic; }
.alternative-list h5,
.alternative-list p { margin: 0; }
.alternative-list h5 { font-size: 12px; }
.alternative-list p { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.6; }

.pitfall-panel { padding: 15px 17px; border-left: 3px solid var(--red); background: var(--red-wash); }
.pitfall-panel > h4 { color: var(--red); }
.pitfall-panel ul { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.pitfall-panel li { position: relative; padding-left: 13px; color: #654944; font-size: 11px; line-height: 1.65; }
.pitfall-panel li::before { position: absolute; left: 0; content: "×"; }
.followup-list { display: grid; border-top: 1px solid var(--line-strong); }
.followup-list details { border-bottom: 1px solid var(--line); }
.followup-list summary { display: grid; min-height: 46px; grid-template-columns: 34px 1fr 18px; align-items: center; gap: 8px; cursor: pointer; font-size: 11px; font-weight: 650; list-style: none; }
.followup-list summary::-webkit-details-marker { display: none; }
.followup-list summary span { color: var(--accent-dark); font-family: "Iowan Old Style", serif; font-size: 12px; font-style: italic; }
.followup-list summary i { color: var(--faint); font-size: 15px; font-style: normal; transition: transform 150ms ease; }
.followup-list details[open] summary i { transform: rotate(45deg); }
.followup-list details > p { margin: -1px 24px 14px 42px; color: var(--muted); font-size: 11px; line-height: 1.7; }

.solution-footer { display: flex; min-height: 64px; align-items: center; justify-content: space-between; gap: 20px; padding: 10px 18px 10px 28px; border-top: 1px solid var(--line-strong); background: #eeede7; }
.solution-footer > span { color: var(--muted); font-size: 10px; }
.solution-footer > div { display: flex; gap: 7px; }
.solution-footer-button { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; padding: 0 13px; border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink-2); cursor: pointer; font-size: 9px; font-weight: 700; text-decoration: none; }
.solution-footer-button:hover { border-color: var(--ink); }
.solution-footer-button.primary { border-color: var(--ink); background: var(--ink); color: white; }
.solution-footer-button.primary:hover { border-color: var(--accent-dark); background: var(--accent-dark); }

.result-dialog {
	width: min(680px, calc(100vw - 32px));
	padding: 0;
	border: 1px solid var(--line-strong);
	border-radius: 0;
	background: var(--paper);
	box-shadow: 0 30px 90px rgba(25, 26, 24, 0.28);
	color: var(--ink);
}

.result-dialog::backdrop { background: rgba(31, 33, 32, 0.48); backdrop-filter: blur(3px); }
.result-dialog form { padding: 26px; }
.result-dialog header { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 19px; border-bottom: 1px solid var(--line); }
.result-dialog header p,
.result-dialog header h2 { margin: 0; }
.result-dialog header h2 { margin: 5px 0 4px; font-family: "Iowan Old Style", "Songti SC", serif; font-size: 24px; font-weight: 600; }
.result-dialog header #dialog-context { color: var(--muted); font-size: 11px; }
.dialog-close { width: 32px; height: 32px; flex: 0 0 auto; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-family: "Iowan Old Style", serif; font-size: 25px; }
.outcome-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 18px 0; }
.outcome-grid button { position: relative; display: grid; min-height: 122px; grid-template-columns: 31px 1fr; grid-template-rows: auto auto 1fr; column-gap: 10px; padding: 16px; border: 1px solid var(--line); background: var(--paper-2); cursor: pointer; text-align: left; }
.outcome-grid button:hover { border-color: var(--accent); background: white; transform: translateY(-1px); }
.outcome-mark { display: grid; width: 28px; height: 28px; grid-row: 1 / 4; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--accent-dark); font-family: "Iowan Old Style", serif; font-size: 14px; }
.outcome-grid strong { align-self: end; font-size: 13px; }
.outcome-grid small { align-self: start; margin-top: 3px; color: var(--muted); font-size: 9px; }
.outcome-grid b { align-self: end; color: var(--faint); font-family: "SFMono-Regular", Consolas, monospace; font-size: 8px; letter-spacing: 0.08em; }
.result-dialog footer { display: flex; min-height: 32px; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.text-button { padding: 6px 0; border: 0; background: transparent; color: var(--red); cursor: pointer; font-size: 9px; text-decoration: underline; text-underline-offset: 3px; }

.confirm-dialog {
	width: min(430px, calc(100vw - 32px));
	padding: 0;
	border: 1px solid var(--line-strong);
	border-radius: 0;
	background: var(--paper);
	box-shadow: 0 30px 90px rgba(25, 26, 24, 0.28);
	color: var(--ink);
}
.confirm-dialog::backdrop { background: rgba(31, 33, 32, 0.48); backdrop-filter: blur(3px); }
.confirm-dialog form { padding: 27px; }
.confirm-dialog p,
.confirm-dialog h2 { margin: 0; }
.confirm-dialog h2 { margin: 8px 0 12px; font-family: "Iowan Old Style", "Songti SC", serif; font-size: 25px; font-weight: 600; line-height: 1.28; }
.confirm-dialog form > p:nth-child(3) { color: var(--muted); font-size: 11px; line-height: 1.75; }
.confirm-dialog form > div { display: flex; justify-content: end; gap: 8px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.button.danger-solid { border-color: var(--red); background: var(--red); color: white; }
.button.danger-solid:hover { border-color: #71342e; background: #71342e; }

.toast {
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 20;
	max-width: 360px;
	padding: 12px 15px;
	border-left: 3px solid var(--accent);
	background: var(--ink);
	box-shadow: 0 15px 40px rgba(25,26,24,0.24);
	color: white;
	font-size: 11px;
	opacity: 0;
	pointer-events: none;
	transform: translateY(8px);
	transition: 180ms ease;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }

.save-state[data-state="saving"] i,
.save-state[data-state="loading"] i { background: var(--accent); animation: sync-pulse 900ms ease-in-out infinite alternate; }
.save-state[data-state="error"] { color: var(--red); }
.save-state[data-state="error"] i { background: var(--red); }
.save-state[data-state="offline"] i { background: var(--faint); }

@keyframes sync-pulse {
	to { opacity: 0.28; transform: scale(0.72); }
}

body[data-ready="false"] .workspace { opacity: 0; }
body[data-ready="true"] .workspace { opacity: 1; transition: opacity 220ms ease; }

@media (max-width: 1100px) {
	body { grid-template-columns: 210px minmax(0, 1fr); }
	.today-layout { grid-template-columns: minmax(0, 1fr) 248px; gap: 22px; }
	.problem-row { grid-template-columns: 50px minmax(180px, 1fr) 90px 70px 212px; gap: 10px; }
	.problem-row > .problem-due { display: none; }
}

@media (max-width: 880px) {
	body { grid-template-columns: 72px minmax(0, 1fr); }
	.brand { justify-content: center; padding: 0; }
	.brand > span:last-child,
	.rail-date,
	.nav-item strong,
	.nav-item small,
	.rail-protocol,
	.rail-footer { display: none; }
	.rail-nav { gap: 6px; padding-top: 20px; }
	.nav-item { min-height: 50px; grid-template-columns: 1fr; place-items: center; padding: 0; }
	.nav-index { font-size: 15px; }
	.today-layout { grid-template-columns: minmax(0, 1fr); }
	.insight-column { grid-template-columns: 1fr 1fr; }
	.level-legend { grid-column: 1 / -1; }
	.settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
	body { display: block; height: auto; min-height: 100dvh; overflow: auto; padding-bottom: 58px; }
	.app-rail { position: fixed; right: 0; bottom: 0; left: 0; z-index: 10; display: block; min-height: 58px; height: 58px; overflow: hidden; border-top: 1px solid var(--line-strong); border-right: 0; }
	.app-rail::before,
	.brand { display: none; }
	.rail-nav { display: grid; height: 100%; grid-template-columns: repeat(3, 1fr); gap: 0; padding: 0; }
	.nav-item { display: grid; min-height: 58px; grid-template-columns: 1fr; grid-template-rows: auto auto; gap: 0; padding: 7px 0 5px; border-right: 1px solid var(--line); }
	.nav-item::before { top: auto; right: 22%; bottom: 0; left: 22%; width: auto; height: 3px; transform: scaleX(0.4); }
	.nav-item.is-active::before { transform: scaleX(1); }
	.nav-item strong { display: block; font-size: 9px; }
	.nav-item .nav-index { font-size: 12px; }
	.workspace { display: block; overflow: visible; }
	.workspace-header { position: sticky; top: 0; z-index: 5; min-height: 64px; padding: 0 16px; }
	.workspace-header h1 { font-size: 20px; }
	.header-state .save-state { display: none; }
	.resume-entry { min-width: 36px; width: 36px; grid-template-columns: 1fr; padding: 0 4px; }
	.resume-entry-copy,
	.resume-entry-arrow { display: none; }
	.resume-entry-mark { margin: auto; }
	.view { overflow: visible; padding: 18px 14px 36px; }
	.daily-brief { min-height: 206px; padding: 26px 22px; }
	.brief-copy h2 { font-size: 28px; }
	.brief-copy > p:last-child { padding-right: 88px; font-size: 11px; }
	.completion-gauge { position: absolute; right: 14px; bottom: 18px; width: 86px; height: 86px; }
	.completion-gauge strong { font-size: 18px; }
	.task-card { grid-template-columns: 42px minmax(0, 1fr); gap: 10px; padding-right: 10px; }
	.task-actions { grid-column: 2; justify-content: space-between; }
	.problem-link { height: 31px; }
	.insight-column { grid-template-columns: 1fr; }
	.level-legend { grid-column: auto; }
	.library-intro { align-items: start; }
	.library-progress { display: none; }
	.library-toolbar { grid-template-columns: 1fr 1fr; }
	.search-field { grid-column: 1 / -1; }
	.problem-row { grid-template-columns: 42px minmax(0, 1fr) 116px; gap: 8px; }
	.problem-row > .problem-topic,
	.problem-row > .difficulty,
	.problem-row > .problem-due { display: none; }
	.problem-row-actions { gap: 4px; }
	.problem-row-actions .row-button:first-child { display: none; }
	.problem-row-actions .level-badge { display: none; }
	.settings-grid { display: block; }
	.settings-intro { margin-bottom: 28px; }
	.settings-intro h2 { font-size: 39px; }
	.settings-stack { gap: 12px; }
	.setting-card { padding: 18px; }
	.outcome-grid { grid-template-columns: 1fr; }
	.outcome-grid button { min-height: 94px; }
	.result-dialog form { padding: 18px; }
	.result-dialog footer span { display: none; }
}

@media (max-width: 760px) {
	.solution-dialog { width: 100vw; height: 100dvh; max-height: none; margin: 0; border: 0; }
	.solution-shell { height: 100dvh; }
	.solution-header { min-height: 88px; padding: 17px 17px 15px 20px; }
	.solution-header::after { right: 68px; width: 84px; }
	.solution-header h2 { overflow: hidden; max-width: calc(100vw - 88px); font-size: 23px; text-overflow: ellipsis; white-space: nowrap; }
	.solution-header #solution-meta { overflow: hidden; max-width: calc(100vw - 88px); text-overflow: ellipsis; white-space: nowrap; }
	.solution-close { width: 38px; height: 38px; }
	.solution-standard { padding: 25px 20px 23px; }
	.solution-standard h3 { font-size: 25px; }
	.solution-summary { font-size: 14px; }
	.complexity-strip { display: grid; gap: 7px; }
	.solution-steps,
	.solution-code { padding: 23px 20px 25px; }
	.solution-code pre { max-height: 50dvh; padding: 16px; }
	.solution-code code { font-size: 10px; }
	.solution-more > summary { min-height: 68px; padding: 0 20px; }
	.solution-more-content { padding: 3px 20px 27px; }
	.solution-footer { min-height: 58px; padding: 9px 12px; }
	.solution-footer > span { display: none; }
	.solution-footer > div { width: 100%; }
	.solution-footer-button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
