/* Kelime Defteri: a quiet notebook. Light by default, dark via prefers-color-scheme. 4px grid, 10px radius. */

:root {
	--bg: #f7f5ef;
	--surface: #ffffff;
	--raised: #fbfaf6;
	--hair: rgba(0, 0, 0, 0.09);
	--hair-strong: rgba(0, 0, 0, 0.16);
	--text: #1b1b18;
	--muted: #6b6a63;
	--accent: #8a5a00;
	--hl: #ffd166;
	--ink: #1a1400;
	--ok: #2c7a3f;
	--ok-bg: rgba(44, 122, 63, 0.1);
	--danger: #b42318;
	--danger-bg: rgba(180, 35, 24, 0.08);
	--focus: #8a5a00;
	--ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--serif: "New York", ui-serif, Georgia, serif;
	--r: 10px;
	--nav-h: 56px;
	--safe-b: env(safe-area-inset-bottom, 0px);
	--safe-t: env(safe-area-inset-top, 0px);
	--pad: 20px;
	color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #101114;
		--surface: #191b20;
		--raised: #22252c;
		--hair: rgba(255, 255, 255, 0.08);
		--hair-strong: rgba(255, 255, 255, 0.16);
		--text: #eceae4;
		--muted: #9a9a94;
		--accent: #ffd166;
		--ok: #7bd88f;
		--ok-bg: rgba(123, 216, 143, 0.1);
		--danger: #ff7a7a;
		--danger-bg: rgba(255, 122, 122, 0.1);
		--focus: #ffd166;
	}
}

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

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	background: var(--bg);
}

body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	background: var(--bg);
	color: var(--text);
	font: 16px/1.5 var(--ui);
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
	padding-bottom: calc(var(--nav-h) + var(--safe-b) + 24px);
}

body.signed-out {
	padding-bottom: 0;
}

h1,
h2,
h3,
p {
	margin: 0;
}

a {
	color: var(--accent);
	text-underline-offset: 3px;
	text-decoration-thickness: 1px;
}

button,
input,
select,
textarea {
	font: inherit;
	color: inherit;
}

:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: 2px;
	border-radius: 6px;
}

[hidden] {
	display: none !important;
}

.sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.skip {
	position: absolute;
	left: 12px;
	top: -60px;
	z-index: 50;
	padding: 8px 12px;
	background: var(--hl);
	color: var(--ink);
	border-radius: var(--r);
}

.skip:focus {
	top: calc(var(--safe-t) + 12px);
}

.icon {
	width: 22px;
	height: 22px;
	flex: none;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.7;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.icon-sm {
	width: 16px;
	height: 16px;
}

/* ---------- highlighter ---------- */

mark.hl,
.hl {
	color: inherit;
	background-color: transparent;
	background-image: linear-gradient(100deg, rgba(255, 209, 102, 0.15) 0, var(--hl) 6px, var(--hl) calc(100% - 4px), rgba(255, 209, 102, 0.3) 100%);
	background-repeat: no-repeat;
	background-size: 100% 62%;
	background-position: 0 85%;
	padding: 0 0.12em;
	margin: 0 -0.04em;
	border-radius: 0.18em;
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
}

@media (prefers-color-scheme: dark) {
	mark.hl,
	.hl {
		color: var(--ink);
		background-image: none;
		background-color: var(--hl);
		padding: 0.02em 0.16em;
	}
}

/* ---------- layout ---------- */

main {
	display: block;
	max-width: 720px;
	margin: 0 auto;
	padding: calc(var(--safe-t) + 20px) max(var(--pad), env(safe-area-inset-right)) 0 max(var(--pad), env(safe-area-inset-left));
	outline: none;
}

main.enter > .view {
	animation: enter 0.18s ease-out;
}

@keyframes enter {
	from {
		opacity: 0;
		transform: translateY(4px);
	}
}

.page-head {
	margin-bottom: 20px;
}

.page-head h1,
.review-title,
.summary-title {
	font: 600 30px/1.15 var(--serif);
	letter-spacing: -0.01em;
}

.page-sub {
	margin-top: 8px;
	color: var(--muted);
}

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

.fine {
	margin-top: 32px;
	font-size: 13px;
	color: var(--muted);
}

/* ---------- nav: bottom tab bar on phones, top bar on wide screens ---------- */

.nav {
	position: fixed;
	z-index: 20;
	left: 0;
	right: 0;
	bottom: 0;
	background: color-mix(in srgb, var(--bg) 92%, transparent);
	-webkit-backdrop-filter: saturate(1.4) blur(14px);
	backdrop-filter: saturate(1.4) blur(14px);
	border-top: 1px solid var(--hair);
	padding: 0 max(8px, env(safe-area-inset-right)) var(--safe-b) max(8px, env(safe-area-inset-left));
}

.nav-brand {
	display: none;
}

.tabs {
	display: flex;
	max-width: 560px;
	margin: 0 auto;
}

.tab {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	min-height: var(--nav-h);
	color: var(--muted);
	text-decoration: none;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.01em;
}

.tab .icon {
	width: 24px;
	height: 24px;
}

.tab[aria-current="page"] {
	color: var(--text);
}

.tab[aria-current="page"] .icon {
	stroke-width: 2;
}

.tab-icon {
	position: relative;
	display: inline-flex;
}

.badge {
	position: absolute;
	top: -4px;
	left: 15px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: 9px;
	background: var(--hl);
	color: var(--ink);
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
	box-shadow: 0 0 0 2px var(--bg);
}

@media (min-width: 860px) {
	body {
		padding-bottom: 64px;
	}
	.nav {
		position: sticky;
		top: 0;
		bottom: auto;
		border-top: 0;
		border-bottom: 1px solid var(--hair);
		padding: 0 24px;
		display: flex;
		align-items: center;
		justify-content: space-between;
		max-width: none;
	}
	.nav-brand {
		display: block;
		font: 600 19px/1 var(--serif);
		color: var(--text);
		text-decoration: none;
		width: 200px;
	}
	.tabs {
		margin: 0;
		gap: 4px;
		max-width: none;
	}
	.tab {
		flex-direction: row;
		gap: 8px;
		min-height: 60px;
		padding: 0 14px;
		font-size: 15px;
		border-bottom: 2px solid transparent;
	}
	.tab .icon {
		width: 20px;
		height: 20px;
	}
	.tab[aria-current="page"] {
		border-bottom-color: var(--hl);
	}
	.tab:hover {
		color: var(--text);
	}
	.badge {
		top: -6px;
		left: 12px;
	}
	main {
		padding-top: 40px;
	}
	.page-head h1,
	.review-title,
	.summary-title {
		font-size: 36px;
	}
}

/* ---------- buttons and fields ---------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 48px;
	padding: 0 18px;
	border-radius: var(--r);
	border: 1px solid var(--hair-strong);
	background: var(--surface);
	color: var(--text);
	font-size: 16px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.12s, border-color 0.12s, transform 0.08s;
	touch-action: manipulation;
}

.btn:hover {
	border-color: var(--muted);
}

.btn:active {
	transform: scale(0.98);
}

.btn:disabled {
	opacity: 0.55;
	cursor: default;
	transform: none;
}

.btn.primary {
	background: var(--hl);
	border-color: var(--hl);
	color: var(--ink);
}

.btn.primary:hover {
	background: #ffc94d;
	border-color: #ffc94d;
}

.btn.ghost {
	background: transparent;
	border-color: transparent;
	color: var(--accent);
}

.btn.ghost:hover {
	background: var(--hair);
}

.btn.small {
	min-height: 40px;
	padding: 0 12px;
	font-size: 15px;
}

.btn.block {
	width: 100%;
}

.btn.danger {
	background: var(--danger);
	border-color: var(--danger);
	color: #fff;
}

@media (prefers-color-scheme: dark) {
	.btn.danger {
		color: #1a0505;
	}
}

.btn.danger-text {
	background: transparent;
	border-color: transparent;
	color: var(--danger);
	padding: 0 4px;
}

.icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: -10px -10px -10px 0;
	border: 0;
	border-radius: var(--r);
	background: transparent;
	color: var(--muted);
	cursor: pointer;
}

.icon-btn:hover {
	color: var(--text);
	background: var(--hair);
}

.linklike {
	border: 0;
	background: none;
	padding: 8px 0;
	color: var(--accent);
	font-size: 15px;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.row-actions,
.empty-actions,
.fb-actions,
.ask-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: center;
}

.field-label {
	display: block;
	margin-bottom: 8px;
	font-size: 14px;
	font-weight: 600;
}

input[type="text"],
input[type="search"],
input[type="password"],
textarea,
select {
	font-size: 17px;
}

input[type="text"],
input[type="search"],
input[type="password"],
textarea {
	width: 100%;
	min-height: 50px;
	padding: 12px 14px;
	border: 1px solid var(--hair-strong);
	border-radius: var(--r);
	background: var(--surface);
	color: var(--text);
	-webkit-appearance: none;
	appearance: none;
}

textarea {
	font: 17px/1.55 var(--serif);
	resize: vertical;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
	outline-offset: 0;
	border-color: var(--focus);
}

input::placeholder {
	color: var(--muted);
	opacity: 0.8;
}

.help {
	margin-top: 8px;
	font-size: 14px;
	color: var(--muted);
}

.form-error {
	color: var(--danger);
	font-size: 15px;
	font-weight: 500;
}

.form-error:empty {
	display: none;
}

/* ---------- login ---------- */

.login {
	max-width: 400px;
	margin: 0 auto;
	padding-top: min(18vh, 140px);
}

.brand-mark {
	font: 600 40px/1 var(--serif);
	margin-bottom: 20px;
}

.login-title {
	font: 600 34px/1.1 var(--serif);
}

.login-sub {
	margin-top: 6px;
	color: var(--muted);
	font: 19px/1.4 var(--serif);
	font-style: italic;
}

.login-form {
	margin-top: 36px;
	display: grid;
	gap: 0;
}

.login-form .form-error {
	margin-top: 12px;
}

.login-form .btn {
	margin-top: 20px;
}

/* ---------- notebook tools ---------- */

.seg {
	display: inline-flex;
	margin-top: 16px;
	padding: 3px;
	border-radius: 12px;
	background: var(--hair);
}

.seg-item {
	min-height: 38px;
	display: inline-flex;
	align-items: center;
	padding: 0 16px;
	border-radius: 9px;
	color: var(--muted);
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
}

.seg-item[aria-current="page"] {
	background: var(--surface);
	color: var(--text);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
	.seg-item[aria-current="page"] {
		background: var(--raised);
	}
}

.tools {
	display: grid;
	gap: 12px;
	margin-bottom: 20px;
}

.search {
	position: relative;
}

.search-icon {
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--muted);
	width: 20px;
	height: 20px;
	pointer-events: none;
}

.search input {
	padding-left: 44px;
}

.chips {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	scrollbar-width: none;
	margin: 0 calc(var(--pad) * -1);
	padding: 2px var(--pad);
}

.chips::-webkit-scrollbar {
	display: none;
}

.chip-select select {
	min-height: 40px;
	max-width: 220px;
	padding: 0 32px 0 14px;
	border-radius: 20px;
	border: 1px solid var(--hair-strong);
	background-color: var(--surface);
	background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
	background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%;
	background-size: 5px 5px;
	background-repeat: no-repeat;
	font-size: 16px;
	font-weight: 500;
	color: var(--text);
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
	text-overflow: ellipsis;
}

.chip-select select.active {
	border-color: var(--hl);
	background-color: color-mix(in srgb, var(--hl) 22%, var(--surface));
}

.count {
	font-size: 14px;
	color: var(--muted);
	margin-bottom: 8px;
}

/* ---------- source groups ---------- */

.group {
	margin-top: 16px;
	background: var(--surface);
	border: 1px solid var(--hair);
	border-radius: var(--r);
	overflow: hidden;
}

.group-head {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 16px 16px 12px;
}

.src-badge {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 9px;
	background: var(--raised);
	border: 1px solid var(--hair);
	color: var(--muted);
}

.src-badge .icon {
	width: 20px;
	height: 20px;
}

.group-text {
	flex: 1;
	min-width: 0;
}

.group-title {
	font-size: 16px;
	font-weight: 650;
	line-height: 1.3;
	overflow-wrap: anywhere;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.group-meta {
	margin-top: 2px;
	font-size: 13px;
	color: var(--muted);
}

.group-head .icon-btn {
	margin: -4px -8px 0 0;
}

.items {
	list-style: none;
	margin: 0;
	padding: 0;
}

.item {
	padding: 14px 16px 12px;
	border-top: 1px solid var(--hair);
}

.item-head {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 4px 10px;
}

.phrase {
	font: 600 19px/1.3 var(--serif);
	color: var(--text);
	text-decoration: none;
	overflow-wrap: anywhere;
}

a.phrase:hover {
	text-decoration: underline;
}

.kind {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--muted);
	white-space: nowrap;
}

.sentence {
	margin-top: 6px;
	font: 17px/1.55 var(--serif);
	color: var(--text);
	overflow-wrap: break-word;
}

.item-expl {
	margin-top: 6px;
	font: 16px/1.5 var(--serif);
	color: var(--muted);
	font-style: italic;
}

.item-foot {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px 14px;
	margin-top: 8px;
	font-size: 14px;
	color: var(--muted);
	min-height: 28px;
}

.item-foot a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 36px;
	margin: -4px 0;
	font-weight: 600;
	text-decoration: none;
}

.item-foot a:hover {
	text-decoration: underline;
}

.item-foot .when {
	margin-left: auto;
}

.item-foot .icon-btn {
	margin: -8px -10px -8px -4px;
}

.tag {
	display: inline-block;
	padding: 1px 8px;
	border-radius: 6px;
	background: var(--hair);
	font-size: 12px;
	font-weight: 600;
	color: var(--muted);
}

.tag.seen {
	background: color-mix(in srgb, var(--hl) 28%, transparent);
	color: var(--text);
}

/* ---------- words list ---------- */

.words {
	list-style: none;
	margin: 0;
	padding: 0;
	background: var(--surface);
	border: 1px solid var(--hair);
	border-radius: var(--r);
	overflow: hidden;
}

.words li + li {
	border-top: 1px solid var(--hair);
}

.word-row {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 64px;
	padding: 12px 16px;
	color: inherit;
	text-decoration: none;
}

.word-row:hover {
	background: var(--raised);
}

.word-main {
	flex: 1;
	min-width: 0;
}

.word-top {
	display: flex;
	align-items: baseline;
	gap: 10px;
	min-width: 0;
}

.word-top .phrase {
	font-size: 18px;
}

.word-expl {
	margin-top: 2px;
	font-size: 14px;
	color: var(--muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.word-side {
	flex: none;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 6px;
	text-align: right;
}

.status {
	font-size: 13px;
	color: var(--muted);
	white-space: nowrap;
}

.status.due {
	padding: 1px 8px;
	border-radius: 6px;
	background: var(--hl);
	color: var(--ink);
	font-weight: 700;
}

.side-meta {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 12px;
	color: var(--muted);
}

.dots {
	display: inline-flex;
	gap: 3px;
}

.dot {
	width: 6px;
	height: 6px;
	border-radius: 3px;
	background: var(--hair-strong);
}

.dot.on {
	background: var(--ok);
}

/* ---------- word page ---------- */

.back {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	min-height: 44px;
	margin: -8px 0 8px -4px;
	padding-right: 8px;
	font-weight: 600;
	text-decoration: none;
}

.word-head {
	margin-bottom: 8px;
}

.word-title {
	font: 600 38px/1.1 var(--serif);
	letter-spacing: -0.015em;
	overflow-wrap: anywhere;
	hyphens: auto;
}

@media (min-width: 860px) {
	.word-title {
		font-size: 48px;
	}
}

.word-sub {
	display: flex;
	align-items: baseline;
	gap: 12px;
	margin-top: 10px;
	font-size: 14px;
	color: var(--muted);
}

.forms {
	margin-top: 8px;
	font: 16px/1.5 var(--serif);
	font-style: italic;
	color: var(--muted);
}

.forms-label {
	font: 600 12px/1 var(--ui);
	font-style: normal;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	margin-right: 8px;
}

.section {
	margin-top: 32px;
}

.section.end {
	margin-top: 40px;
	padding-top: 16px;
	border-top: 1px solid var(--hair);
}

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

.section-title {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--muted);
	margin-bottom: 12px;
}

.section-bar .section-title {
	margin-bottom: 0;
}

.section-bar {
	margin-bottom: 8px;
}

.section-count {
	margin-left: 4px;
	font-weight: 600;
	color: var(--muted);
	opacity: 0.8;
}

.expl p + p {
	margin-top: 8px;
}

.expl {
	font: 17px/1.6 var(--serif);
}

.expl.big {
	font-size: 19px;
}

.expl-label {
	font: 600 12px/1 var(--ui);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--muted);
	padding: 3px 6px;
	border-radius: 5px;
	background: var(--hair);
	vertical-align: 2px;
	margin-right: 2px;
}

.eg {
	font-style: italic;
	color: var(--muted);
	padding-left: 14px;
	border-left: 2px solid var(--hl);
}

.eg-label {
	font-style: normal;
	font-weight: 600;
	color: var(--text);
}

.edit-form textarea {
	min-height: 150px;
}

.edit-form .row-actions {
	margin-top: 12px;
}

.facts {
	margin: 0 0 16px;
	display: grid;
	gap: 0;
	background: var(--surface);
	border: 1px solid var(--hair);
	border-radius: var(--r);
}

.facts > div {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 16px;
}

.facts > div + div {
	border-top: 1px solid var(--hair);
}

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

.facts dd {
	margin: 0;
	font-weight: 600;
	text-align: right;
}

.facts .due-now {
	color: var(--accent);
}

.group.small .group-head {
	padding: 12px 16px 8px;
}

.group.small .src-badge {
	width: 30px;
	height: 30px;
	border-radius: 8px;
}

.group.small .src-badge .icon {
	width: 17px;
	height: 17px;
}

.group.small .group-title {
	font-size: 15px;
}

.places-list .group:first-child {
	margin-top: 0;
}

.confirm {
	flex-basis: 100%;
	padding: 14px;
	margin-top: 4px;
	border-radius: var(--r);
	background: var(--danger-bg);
	color: var(--text);
}

.confirm-q {
	font-weight: 600;
	margin-bottom: 12px;
}

.confirm-actions {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
}

/* ---------- review ---------- */

.review-head {
	margin-bottom: 20px;
}

.review-head-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
}

.review-count {
	font-size: 15px;
	font-weight: 600;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}

.bar {
	margin-top: 12px;
	height: 4px;
	border-radius: 2px;
	background: var(--hair);
	overflow: hidden;
}

.bar-fill {
	display: block;
	height: 100%;
	width: 0;
	background: var(--hl);
	transition: width 0.25s ease;
}

.q-card {
	padding: 22px 20px 24px;
	background: var(--surface);
	border: 1px solid var(--hair);
	border-radius: var(--r);
}

.q-type {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--muted);
	margin-bottom: 12px;
}

.q-sentence {
	font: 21px/1.55 var(--serif);
	overflow-wrap: break-word;
}

.blank {
	display: inline-block;
	min-width: 3.2em;
	border-bottom: 2px solid var(--text);
	margin: 0 0.1em;
	line-height: 1;
	vertical-align: baseline;
}

.q-hint {
	margin-top: 14px;
	font-size: 14px;
	color: var(--muted);
}

.q-hint-title {
	font-weight: 600;
	color: var(--text);
}

.q-def {
	font-size: 20px;
	line-height: 1.55;
}

.answer-area {
	margin-top: 16px;
}

.options {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 10px;
}

.option {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 14px;
	min-height: 60px;
	padding: 10px 16px 10px 12px;
	border: 1px solid var(--hair-strong);
	border-radius: var(--r);
	background: var(--surface);
	text-align: left;
	cursor: pointer;
	touch-action: manipulation;
	transition: border-color 0.12s, background-color 0.12s;
}

.option:hover:not(:disabled) {
	border-color: var(--muted);
}

.option:active:not(:disabled) {
	background: var(--raised);
}

.key {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 7px;
	border: 1px solid var(--hair-strong);
	font-size: 13px;
	font-weight: 700;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}

.opt-text {
	flex: 1;
	font: 19px/1.3 var(--serif);
	overflow-wrap: anywhere;
}

.opt-mark {
	width: 22px;
	height: 22px;
	stroke-width: 2.2;
}

.option:disabled {
	cursor: default;
	color: var(--text);
}

.option.right {
	border-color: var(--ok);
	background: var(--ok-bg);
	color: var(--text);
}

.option.right .key,
.option.right .opt-mark {
	color: var(--ok);
	border-color: var(--ok);
}

.option.wrong {
	border-color: var(--danger);
	background: var(--danger-bg);
}

.option.wrong .key,
.option.wrong .opt-mark {
	color: var(--danger);
	border-color: var(--danger);
}

.option.dim {
	opacity: 0.5;
}

.switch {
	margin-top: 8px;
	text-align: center;
}

.typed .row-actions {
	margin-top: 12px;
}

.typed input.right {
	border-color: var(--ok);
	background: var(--ok-bg);
}

.typed input.wrong {
	border-color: var(--danger);
	background: var(--danger-bg);
	text-decoration: line-through;
	text-decoration-color: var(--danger);
}

.feedback {
	margin-top: 20px;
	padding-top: 20px;
	border-top: 1px solid var(--hair);
}

.verdict {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 18px;
	font-weight: 650;
	line-height: 1.4;
}

.verdict .icon {
	margin-top: 1px;
	width: 24px;
	height: 24px;
	stroke-width: 2.4;
}

.verdict.ok {
	color: var(--ok);
}

.verdict.bad {
	color: var(--danger);
}

.verdict strong {
	font: 600 20px/1.3 var(--serif);
	color: var(--text);
}

.fb-block {
	margin-top: 18px;
}

.fb-label {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--muted);
	margin-bottom: 6px;
}

.fb-phrase {
	font: 600 20px/1.3 var(--serif);
	letter-spacing: 0;
	text-transform: none;
	color: var(--text);
}

.fb-source {
	margin-top: 12px;
	font-size: 15px;
}

.fb-source a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 40px;
	font-weight: 600;
	text-decoration: none;
}

.schedule {
	margin-top: 16px;
	font-size: 14px;
}

.schedule .bad {
	color: var(--danger);
}

.fb-actions {
	margin-top: 20px;
}

.fb-actions .continue {
	flex: 1 1 100%;
}

.kbd-hint {
	display: none;
	font: 600 12px/1 var(--ui);
	padding: 3px 6px;
	border-radius: 5px;
	background: rgba(26, 20, 0, 0.12);
	color: var(--ink);
}

@media (hover: hover) and (pointer: fine) {
	.kbd-hint {
		display: inline-block;
	}
}

@media (min-width: 600px) {
	.fb-actions .continue {
		flex: 0 1 auto;
		min-width: 240px;
	}
}

.summary {
	padding-top: 8px;
}

.summary-score {
	margin-top: 16px;
	font-size: 18px;
	color: var(--muted);
}

.big-num {
	font: 600 44px/1 var(--serif);
	color: var(--text);
	margin-right: 4px;
}

.summary-list {
	list-style: none;
	margin: 24px 0 16px;
	padding: 0;
	border-top: 1px solid var(--hair);
}

.summary-list li {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 52px;
	border-bottom: 1px solid var(--hair);
}

.summary-list li.ok .icon {
	color: var(--ok);
}

.summary-list li.bad .icon {
	color: var(--danger);
}

.summary .empty-actions {
	margin-top: 24px;
}

.calm {
	padding: 40px 0 0;
}

.calm-title {
	font: 600 28px/1.2 var(--serif);
	margin-bottom: 10px;
}

.calm p + p {
	margin-top: 6px;
	color: var(--muted);
}

.calm-next {
	margin-top: 28px !important;
	padding: 16px;
	border-radius: var(--r);
	background: var(--surface);
	border: 1px solid var(--hair);
	display: grid;
	gap: 2px;
}

.calm-when {
	font: 600 18px/1.4 var(--serif);
	color: var(--text);
}

.calm .empty-actions {
	margin-top: 24px;
}

/* ---------- ask ---------- */

.ask-row {
	display: flex;
	gap: 8px;
}

.ask-row input {
	flex: 1;
	min-width: 0;
}

.ask-row .btn {
	flex: none;
	min-height: 50px;
}

.ask-out:not(:empty),
.shot-out:not(:empty) {
	margin-top: 20px;
}

.answer-card {
	padding: 20px;
	background: var(--surface);
	border: 1px solid var(--hair);
	border-radius: var(--r);
}

.answer-head {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 6px 12px;
	margin-bottom: 12px;
}

.answer-title {
	font: 600 28px/1.15 var(--serif);
	overflow-wrap: anywhere;
}

.answer-title.small {
	font-size: 20px;
	margin-bottom: 8px;
}

.answer-base {
	flex-basis: 100%;
	font-size: 14px;
	color: var(--muted);
}

.ask-status {
	display: flex;
	align-items: center;
	gap: 10px;
	color: var(--muted);
}

.pulse {
	width: 10px;
	height: 10px;
	border-radius: 5px;
	background: var(--hl);
	animation: pulse 1s ease-in-out infinite alternate;
}

@keyframes pulse {
	from {
		opacity: 0.35;
		transform: scale(0.8);
	}
}

.caret {
	display: inline-block;
	width: 2px;
	height: 1.1em;
	margin-left: 2px;
	vertical-align: -0.15em;
	background: var(--text);
	animation: blink 1s steps(2) infinite;
}

.stream .expl > p:last-child .caret,
.stream .expl > .caret {
	display: inline-block;
}

@keyframes blink {
	50% {
		opacity: 0;
	}
}

.ask-actions:not(:empty) {
	margin-top: 20px;
}

.save-slot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
}

.saved {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--ok);
	font-weight: 600;
}

.shot {
	margin-top: 40px;
	padding-top: 24px;
	border-top: 1px solid var(--hair);
}

.shot .muted {
	margin-bottom: 16px;
}

.file-wrap {
	position: relative;
}

.file-input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	overflow: hidden;
}

.file-input:focus-visible + .file-btn {
	outline: 2px solid var(--focus);
	outline-offset: 2px;
}

.file-btn.busy {
	opacity: 0.6;
	pointer-events: none;
}

.shot-where {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--muted);
	margin-bottom: 10px;
}

.shot-text {
	margin: 0 0 16px;
	padding: 2px 0 2px 16px;
	border-left: 3px solid var(--hair-strong);
	font: 19px/1.55 var(--serif);
	overflow-wrap: break-word;
}

.phrase-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.phrase-list li {
	padding: 14px 0;
	border-top: 1px solid var(--hair);
	display: grid;
	gap: 6px;
}

.pl-head {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 4px 10px;
}

.pl-meaning {
	font: 17px/1.5 var(--serif);
}

.phrase-list .save-slot {
	margin-top: 4px;
}

/* ---------- settings ---------- */

.stats {
	margin: 0;
	background: var(--surface);
	border: 1px solid var(--hair);
	border-radius: var(--r);
}

.stat {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	padding: 12px 16px;
	min-height: 52px;
}

.stat + .stat {
	border-top: 1px solid var(--hair);
}

.stat dt {
	color: var(--text);
}

.stat dd {
	margin: 0;
	text-align: right;
	display: grid;
}

.stat-value {
	font: 600 20px/1.2 var(--serif);
	font-variant-numeric: tabular-nums;
}

.stat-note {
	font-size: 12px;
	color: var(--muted);
}

.section .muted + .btn,
.section .muted + .row-actions {
	margin-top: 16px;
}

.plain {
	font-weight: 600;
	color: var(--text);
}

/* ---------- states ---------- */

.empty {
	padding: 32px 0 8px;
}

.empty-title {
	font: 600 24px/1.25 var(--serif);
	margin-bottom: 10px;
}

.empty p {
	color: var(--muted);
	max-width: 46ch;
}

.empty p + p {
	margin-top: 6px;
}

.empty .empty-actions {
	margin-top: 20px;
}

.empty.error .empty-title {
	color: var(--danger);
}

.loading {
	display: flex;
	justify-content: center;
	padding: 48px 0;
}

.spinner {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	border: 2px solid var(--hair-strong);
	border-top-color: var(--hl);
	animation: spin 0.7s linear infinite;
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

.toast {
	position: fixed;
	z-index: 40;
	left: 50%;
	bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
	transform: translate(-50%, 12px);
	max-width: calc(100% - 40px);
	padding: 12px 16px;
	border-radius: var(--r);
	background: var(--text);
	color: var(--bg);
	font-size: 15px;
	font-weight: 500;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.18s, transform 0.18s;
}

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

.toast.bad {
	background: var(--danger);
	color: #fff;
}

@media (min-width: 860px) {
	.toast {
		bottom: 32px;
	}
}

.noscript {
	padding: 40px 20px;
	text-align: center;
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
	}
	.pulse,
	.caret {
		animation: none;
	}
}

/* ---------- refinements ---------- */

mark.hl,
.hl {
	padding: 0 0.1em;
	margin: 0 -0.1em;
}

.chip-select select {
	max-width: 70vw;
}

.status.new {
	padding: 0 7px;
	border-radius: 6px;
	border: 1px solid var(--hair-strong);
	font-weight: 600;
}

.save-slot .saved {
	flex-basis: 100%;
	margin-bottom: 4px;
}

.verdict p + p {
	margin-top: 4px;
}

.verdict-answer {
	color: var(--text);
	font-weight: 500;
}

.stat-value {
	font: 600 19px/1.2 var(--ui);
	font-variant-numeric: tabular-nums lining-nums;
}

.big-num {
	font-variant-numeric: lining-nums;
}

@media (min-width: 860px) {
	.tab {
		position: relative;
	}
	.tab-icon {
		position: static;
	}
	.tab:has(.badge:not([hidden])) {
		padding-right: 44px;
	}
	.badge {
		top: 50%;
		left: auto;
		right: 12px;
		transform: translateY(-50%);
		box-shadow: none;
	}
}

.phrase-list li {
	grid-template-columns: 1fr auto;
	column-gap: 16px;
	align-items: start;
}

.phrase-list .pl-head,
.phrase-list .pl-meaning {
	grid-column: 1;
}

.phrase-list .save-slot {
	grid-column: 2;
	grid-row: 1 / span 2;
	margin-top: 0;
	align-self: center;
}

.saved-link {
	min-height: 40px;
	text-decoration: none;
	font-size: 15px;
}

@media (prefers-color-scheme: dark) {
	mark.hl,
	.hl {
		margin: 0;
	}
}

input[type="search"]::-webkit-search-cancel-button {
	filter: grayscale(1);
	opacity: 0.6;
}

/* ---------- listen buttons ---------- */

.listen {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: var(--r);
	background: transparent;
	color: var(--muted);
	cursor: pointer;
	touch-action: manipulation;
	transition: background-color 0.12s, color 0.12s;
}

.listen .icon {
	width: 20px;
	height: 20px;
}

.listen:hover {
	color: var(--text);
	background: var(--hair);
}

.listen .listen-stop,
.listen.speaking .listen-play {
	display: none;
}

.listen.speaking .listen-stop {
	display: block;
}

.listen.speaking,
.listen.speaking:hover {
	background: var(--hl);
	color: var(--ink);
}

.word-li {
	display: flex;
	align-items: center;
}

.word-li .word-row {
	flex: 1;
	min-width: 0;
	align-self: stretch;
}

.word-li.can-listen .word-row {
	padding-right: 6px;
}

.word-li > .listen {
	margin: 0 6px 0 0;
}

.word-top {
	flex-wrap: wrap;
	gap: 0 10px;
}

.word-tags {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	white-space: nowrap;
}

.has-chat {
	flex: none;
	display: inline-flex;
	color: var(--muted);
	opacity: 0.85;
}

.has-chat .icon {
	width: 15px;
	height: 15px;
}

.word-title-row {
	display: flex;
	align-items: center;
	gap: 12px;
}

.word-title-row .word-title {
	min-width: 0;
}

.listen.big {
	border: 1px solid var(--hair-strong);
	background: var(--surface);
}

.listen.big:hover {
	border-color: var(--muted);
	background: var(--surface);
}

.listen.big.speaking,
.listen.big.speaking:hover {
	border-color: var(--hl);
	background: var(--hl);
}

.listen.big .icon {
	width: 22px;
	height: 22px;
}

.sentence-row {
	display: flex;
	align-items: flex-start;
	gap: 8px;
}

.sentence-row .sentence {
	flex: 1;
	min-width: 0;
}

.listen.by-sentence {
	width: 40px;
	height: 40px;
	margin: 0 -10px -6px 0;
}

.listen.by-sentence .icon {
	width: 18px;
	height: 18px;
}

/* ---------- conversation on the word page ---------- */

.chat-card {
	background: var(--surface);
	border: 1px solid var(--hair);
	border-radius: var(--r);
	overflow: hidden;
}

.chat-thread {
	padding: 0 16px 18px;
}

.chat-seg {
	padding-top: 14px;
}

.chat-seg + .chat-seg {
	margin-top: 18px;
	border-top: 1px solid var(--hair);
}

.chat-cap {
	font-size: 13px;
	line-height: 1.45;
	color: var(--muted);
	overflow-wrap: anywhere;
}

.chat-line {
	font: italic 14px/1.45 var(--serif);
}

.chat-q {
	width: fit-content;
	max-width: 86%;
	margin: 14px 0 0 auto;
	padding: 8px 13px 9px;
	border: 1px solid var(--hair);
	border-radius: 12px 12px 4px 12px;
	background: var(--bg);
	font-size: 16px;
	line-height: 1.4;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.chat-cap + .chat-q {
	margin-top: 10px;
}

.chat-a {
	margin-top: 12px;
	overflow-wrap: anywhere;
}

.chat-a .ask-status {
	font-size: 15px;
}

.chat-hint {
	padding: 16px 16px 14px;
	font-size: 15px;
	color: var(--muted);
}

.chat-error {
	padding: 0 16px 14px;
}

.chat-card.empty-chat .chat-error {
	padding-top: 0;
	margin-top: -4px;
}

.chat-form {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid var(--hair);
	background: var(--raised);
	scroll-margin-bottom: calc(var(--nav-h) + var(--safe-b) + 20px);
}

.chat-form input {
	flex: 1;
	min-width: 0;
}

.chat-form input:disabled {
	opacity: 0.6;
}

.chat-send {
	flex: none;
	width: 50px;
	min-height: 50px;
	padding: 0;
}

.chat-send .icon {
	stroke-width: 2.1;
}

.chat-foot {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	margin-top: 6px;
	min-height: 40px;
}

.chat-foot:empty {
	display: none;
}

.btn.chat-clear {
	color: var(--muted);
	font-weight: 500;
	margin-right: -12px;
}

.btn.chat-clear:hover {
	color: var(--text);
}

@media (min-width: 860px) {
	.chat-form {
		scroll-margin-bottom: 24px;
	}
}
