:root {
	--ink: #1a1a1a;
	--text: #374151;
	--muted: #6b7280;
	--line: #e5e7eb;
	--bg: #f0f2f5;
	--card: #ffffff;
	--soft: #f9fafb;
	--accent: #667eea;
	--accent-soft: rgba(102, 126, 234, 0.08);
	--red: #dc2626;
	--red-soft: #fef2f2;
	--green: #059669;
	--green-soft: #ecfdf5;
	--amber: #b45309;
	--amber-soft: #fffbeb;
}

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

html, body {
	height: 100%;
	background: #111827;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	color: var(--text);
	overflow: hidden;
}

.deck {
	position: absolute;
	left: 0;
	top: 0;
	width: 1280px;
	height: 720px;
	transform-origin: 0 0;
}

.slide {
	position: absolute;
	inset: 0;
	background: var(--card);
	padding: 56px 72px 48px 72px;
	display: none;
	flex-direction: column;
	line-height: 1.3;
	font-size: 24px;
}

.slide.on {
	display: flex;
}

.slide h1 {
	font-size: 44px;
	color: var(--ink);
	font-weight: 650;
	line-height: 1.15;
	margin-bottom: 8px;
}

.slide h2 {
	font-size: 36px;
	color: var(--ink);
	font-weight: 650;
	border-bottom: 2px solid var(--line);
	padding-bottom: 12px;
	margin-bottom: 24px;
}

.slide h3 {
	font-size: 24px;
	color: var(--ink);
	margin-bottom: 8px;
}

.slide p {
	margin: 0 0 14px 0;
}

.slide ul {
	padding-left: 1.1em;
	margin: 0 0 14px 0;
}

.slide li {
	margin: 0 0 10px 0;
}

.slide strong {
	color: var(--ink);
	font-weight: 650;
}

.slide code, .slide pre {
	font-family: 'Cascadia Mono', 'Consolas', 'Menlo', monospace;
}

.slide code {
	background: #f3f4f6;
	padding: 0.1em 0.35em;
	border-radius: 4px;
	font-size: 0.9em;
}

.slide pre {
	background: var(--soft);
	border: 1px solid var(--line);
	border-radius: 8px;
	padding: 14px 18px;
	font-size: 17px;
	line-height: 1.35;
	color: var(--ink);
	white-space: pre;
	tab-size: 3;
}

.slide table {
	border-collapse: collapse;
	font-size: 19px;
	width: 100%;
}

.slide th, .slide td {
	border: 1px solid var(--line);
	padding: 8px 12px;
	text-align: left;
	vertical-align: top;
}

.slide th {
	background: var(--soft);
	font-weight: 650;
	color: var(--ink);
}

.kicker {
	font-size: 18px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--accent);
	font-weight: 650;
	margin-bottom: 10px;
}

.sub {
	font-size: 26px;
	color: var(--muted);
}

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

.small {
	font-size: 18px;
}

.tiny {
	font-size: 15px;
	color: var(--muted);
}

.foot {
	margin-top: auto;
	font-size: 15px;
	color: var(--muted);
	border-top: 1px solid var(--line);
	padding-top: 8px;
}

.cols {
	display: flex;
	gap: 36px;
	align-items: flex-start;
}

.cols > * {
	flex: 1 1 0;
	min-width: 0;
}

.big {
	font-size: 96px;
	font-weight: 700;
	color: var(--ink);
	line-height: 1;
}

.big.red {
	color: var(--red);
}

.stat {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.stat .lbl {
	font-size: 20px;
	color: var(--muted);
}

.box {
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 16px 20px;
	background: var(--soft);
}

.box.accent {
	border-color: var(--accent);
	background: var(--accent-soft);
}

.box.red {
	border-color: var(--red);
	background: var(--red-soft);
}

.box.green {
	border-color: var(--green);
	background: var(--green-soft);
}

.box.amber {
	border-color: var(--amber);
	background: var(--amber-soft);
}

.tag {
	display: inline-block;
	font-size: 15px;
	font-weight: 650;
	padding: 2px 8px;
	border-radius: 999px;
	vertical-align: middle;
}

.tag.core {
	background: var(--green-soft);
	color: var(--green);
	border: 1px solid var(--green);
}

.tag.ext {
	background: var(--accent-soft);
	color: var(--accent);
	border: 1px solid var(--accent);
}

.tag.txt {
	background: var(--amber-soft);
	color: var(--amber);
	border: 1px solid var(--amber);
}

.dl {
	font-family: 'Cambria Math', 'Cambria', 'Times New Roman', serif;
	font-size: 26px;
	line-height: 1.5;
	color: var(--ink);
}

.roles {
	font-size: 17px;
	line-height: 1.5;
	color: var(--ink);
}

.roles div {
	padding-left: 1.1em;
}

.roles .k {
	color: var(--accent);
	font-weight: 650;
}

.portrait {
	position: absolute;
	top: 46px;
	right: 60px;
	width: 160px;
	height: 160px;
	border-radius: 50%;
	object-fit: cover;
	object-position: center top;
	border: 4px solid var(--card);
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.portrait + h2 {
	padding-right: 190px;
	margin-bottom: 64px;
}

.cols > .illus {
	flex: none;
	margin: 0;
	text-align: center;
}

.illus img {
	display: block;
	height: 270px;
	border-radius: 6px;
	border: 4px solid var(--card);
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.illus figcaption {
	font-size: 13px;
	color: var(--muted, #6b7280);
	margin-top: 6px;
}

.portrait-inline {
	width: 72px;
	height: 72px;
	border-radius: 50%;
	object-fit: cover;
	object-position: center top;
	vertical-align: middle;
	margin-right: 8px;
	box-shadow: 0 1px 5px rgba(0, 0, 0, 0.18);
}

.hl {
	color: var(--red);
	font-weight: 650;
}

.acc {
	color: var(--accent);
	font-weight: 650;
}

.timeline {
	display: flex;
	gap: 0;
	margin: 12px 0 20px 0;
}

.timeline .t {
	flex: 1 1 0;
	border-top: 4px solid var(--accent);
	padding: 10px 10px 0 0;
	position: relative;
}

.timeline .t::before {
	content: "";
	position: absolute;
	top: -10px;
	left: 0;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--accent);
}

.timeline .y {
	font-weight: 700;
	color: var(--ink);
	font-size: 20px;
}

.timeline .d {
	font-size: 16px;
	color: var(--text);
}

.notes {
	display: none;
}

body.show-notes .notes {
	display: block;
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	max-height: 45%;
	background: rgba(17, 24, 39, 0.94);
	color: #e5e7eb;
	font-size: 18px;
	line-height: 1.4;
	padding: 14px 24px;
}

.counter {
	position: absolute;
	right: 24px;
	bottom: 14px;
	font-size: 14px;
	color: var(--muted);
}

.title-slide {
	justify-content: center;
	background: linear-gradient(135deg, #ffffff 0%, #eef0fb 100%);
}

.title-slide h1 {
	font-size: 58px;
	margin-bottom: 20px;
}

.narr {
	display: none;
}

body:not(.notation-dl) .nt-dl, body.notation-dl .nt-cz {
	display: none !important;
}

.formal {
	margin: 12px 0 0 0;
	padding: 10px 14px;
	border-left: 4px solid var(--accent);
	background: var(--accent-soft);
	border-radius: 0 6px 6px 0;
}

.formal .ft {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--accent);
	margin-bottom: 6px;
}

.formal .f {
	font-family: 'Cambria Math', 'Cambria', 'Times New Roman', serif;
	font-size: 17px;
	line-height: 1.5;
	color: var(--ink);
	margin: 0 0 6px 0;
}

.mode-bar {
	position: fixed;
	top: 10px;
	right: 12px;
	z-index: 50;
	display: flex;
	gap: 8px;
}

.mode-btn {
	font: 600 14px -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	padding: 6px 12px;
	border-radius: 8px;
	border: 1px solid var(--line);
	background: var(--card);
	color: var(--ink);
	cursor: pointer;
	opacity: 0.35;
	transition: opacity 0.2s;
}

.mode-bar:hover .mode-btn, body.study .mode-btn {
	opacity: 1;
}

@media (orientation: portrait) and (max-width: 600px) {
	body:not(.study)::after {
		content: "Otočte telefon naležato · přejeďte prstem pro další slide";
		position: fixed;
		left: 0;
		right: 0;
		bottom: 18%;
		text-align: center;
		font-size: 13px;
		color: rgba(255, 255, 255, 0.55);
		pointer-events: none;
	}
}

@media (max-height: 500px), (max-width: 500px) {
	.mode-bar {
		top: 4px;
		right: 4px;
		gap: 4px;
	}

	.mode-btn {
		font-size: 11px;
		padding: 3px 7px;
		border-radius: 6px;
	}
}

body.study {
	overflow: auto;
	background: var(--bg);
}

body.study .deck {
	position: static;
	transform: none !important;
	width: auto;
	height: auto;
	max-width: 1500px;
	margin: 0 auto;
	padding: 56px 16px 24px 16px;
}

.study-item {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 28px;
	align-items: start;
	margin-bottom: 24px;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 20px;
}

.frame {
	position: relative;
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: 6px;
}

.frame .slide {
	display: flex;
	position: absolute;
	left: 0;
	top: 0;
	right: auto;
	bottom: auto;
	width: 1280px;
	height: 720px;
	transform-origin: 0 0;
}

.study-item .narr {
	display: block;
	font-size: 17px;
	line-height: 1.55;
	color: var(--text);
}

.study-item .narr p {
	margin: 0 0 12px 0;
}

.study-item .narr .num {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--accent);
	margin-bottom: 6px;
}

.study-item .narr code {
	background: #f3f4f6;
	padding: 0.1em 0.35em;
	border-radius: 4px;
	font-size: 0.9em;
	font-family: 'Cascadia Mono', 'Consolas', 'Menlo', monospace;
}

.study-item .narr .refs {
	font-size: 14px;
	color: var(--muted);
	margin-top: 10px;
}

.study-item .narr a {
	color: var(--accent);
	text-decoration: none;
	border-bottom: 1px solid transparent;
}

.study-item .narr a:hover {
	border-bottom-color: var(--accent);
}

.study-item .narr strong {
	color: var(--ink);
}

@media (max-width: 900px) {
	.study-item {
		grid-template-columns: 1fr;
	}
}

@media print {
	html, body {
		background: white;
		overflow: visible;
		height: auto;
	}

	.mode-bar, .notes, .counter {
		display: none !important;
	}

	body:not(.study) .deck {
		position: static;
		transform: none !important;
		width: 1280px;
		height: auto;
	}

	body:not(.study) .slide {
		position: relative;
		display: flex !important;
		width: 1280px;
		height: 720px;
		page-break-after: always;
		break-after: page;
	}

	body.study .deck {
		padding: 0;
		max-width: none;
	}

	.study-item {
		break-inside: avoid;
		page-break-inside: avoid;
		border: none;
		border-bottom: 1px solid var(--line);
		border-radius: 0;
		padding: 0 0 14px 0;
		margin-bottom: 14px;
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	}

	.study-item .narr {
		font-size: 11pt;
	}
}
