/* Colors follow the app theme (wikilinked/src/theme.ts) */
:root {
	--bg: #F9F9F9;
	--surface: #ffffff;
	--card: #f3f3f4;
	--card-border: #d8e2ed;
	--prompt-bg: #eef5fc;
	--track: #e6eaef;
	--text: #000000;
	--text-2: #777777;
	--text-3: #333333;
	--primary: #2582C7;
	--links: #245a8f;
	--link-sep: #c5d3e0;
	--success: #68b587;
	--fail: #d56a6a;
	--heart: #AD2B4E;
	--gold: #d4a807;
	--answer-bg: #2582C7;
	--answer-corner: #C4576B;
	--chip-bg: #e9eef3;
	--shadow: 0 2px 6px rgba(0, 0, 0, .12);
	--shadow-hover: 0 6px 16px rgba(0, 0, 0, .16);
	--hero-1: #1f5fbf;
	--hero-2: #2d8be0;
	--accent: #ffd34d;
	--ease: cubic-bezier(.2, .8, .2, 1);
	/* Page zoom on large screens, set by app.js from the window size */
	--z: 1;
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #1c1c1c;
		--surface: #1e1e1e;
		--card: #272727;
		--card-border: #3a3a3a;
		--prompt-bg: #22303c;
		--track: #3b3b3b;
		--text: #e5e5e5;
		--text-2: #aaaaaa;
		--text-3: #cccccc;
		--primary: #4683ae;
		--links: #6bb6ff;
		--link-sep: #3d4a56;
		--success: #577d66;
		--fail: #975656;
		--heart: #e67a7a;
		--gold: #FFD700;
		--answer-bg: #2c668f;
		--answer-corner: #5e1d29;
		--chip-bg: #2f2f2f;
		--shadow: 0 2px 6px rgba(0, 0, 0, .5);
		--shadow-hover: 0 6px 16px rgba(0, 0, 0, .6);
		--hero-1: #183f73;
		--hero-2: #22629a;
		color-scheme: dark;
	}
}

:root[data-theme="dark"] {
	--bg: #1c1c1c;
	--surface: #1e1e1e;
	--card: #272727;
	--card-border: #3a3a3a;
	--prompt-bg: #22303c;
	--track: #3b3b3b;
	--text: #e5e5e5;
	--text-2: #aaaaaa;
	--text-3: #cccccc;
	--primary: #4683ae;
	--links: #6bb6ff;
	--link-sep: #3d4a56;
	--success: #577d66;
	--fail: #975656;
	--heart: #e67a7a;
	--gold: #FFD700;
	--answer-bg: #2c668f;
	--answer-corner: #5e1d29;
	--chip-bg: #2f2f2f;
	--shadow: 0 2px 6px rgba(0, 0, 0, .5);
	--shadow-hover: 0 6px 16px rgba(0, 0, 0, .6);
	--hero-1: #183f73;
	--hero-2: #22629a;
	color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: Roboto, system-ui, -apple-system, 'Segoe UI', sans-serif;
	-webkit-tap-highlight-color: transparent;
	transition: background-color .3s ease, color .3s ease;
}

button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--links); }

/* The whole page scales up on large screens, like the app on a tablet */
.app {
	zoom: var(--z);
	max-width: 520px;
	margin: 0 auto;
	/* A few px of slack: zoom rounding must not add a scrollbar */
	min-height: calc((100dvh - 4px) / var(--z));
	padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
	display: flex;
	flex-direction: column;
}
.wide .app { max-width: 600px; }

.boot { margin: auto; color: var(--text-2); }

.screen-in > * { animation: screen-in .4s var(--ease) both; }
.screen-in > *:nth-child(2) { animation-delay: .04s; }
.screen-in > *:nth-child(3) { animation-delay: .08s; }
.screen-in > *:nth-child(4) { animation-delay: .12s; }
.screen-in > *:nth-child(5) { animation-delay: .16s; }
.screen-in > *:nth-child(n + 6) { animation-delay: .2s; }
@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } }

/* Header */
.bar {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
}
.bar .spacer { flex: 1; }
.logo {
	display: flex;
	align-items: center;
	gap: 8px;
	font-family: Nunito, Roboto, sans-serif;
	font-weight: 900;
	font-size: 22px;
	text-decoration: none;
	color: var(--text);
}
.logo img { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: none;
	background: var(--surface);
	box-shadow: var(--shadow);
	display: grid;
	place-items: center;
	flex-shrink: 0;
	transition: transform .15s ease, box-shadow .2s ease, background-color .3s ease;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:active { transform: scale(.92); }
/* The native select covers the button, so phones show their own list */
.lang-btn { position: relative; font-size: 13px; font-weight: 700; color: var(--text); cursor: pointer; }
.lang-btn select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.lang-btn:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Start screen */
.hero {
	margin-top: 12px;
	border-radius: 18px;
	padding: 26px 20px 22px;
	color: #fff;
	text-align: center;
	background: linear-gradient(165deg, var(--hero-1), var(--hero-2));
	box-shadow: var(--shadow);
}
.hero h1 {
	margin: 0;
	font-family: Nunito, Roboto, sans-serif;
	font-weight: 900;
	font-size: clamp(28px, 8vw, 38px);
	line-height: 1.1;
	text-shadow: 0 3px 12px rgba(0, 0, 0, .18);
}
.hero h1 em { font-style: normal; color: var(--accent); display: inline-block; animation: wiggle 3.5s ease-in-out 1s infinite; }
@keyframes wiggle { 0%, 88%, 100% { transform: none; } 92% { transform: rotate(-4deg) scale(1.06); } 96% { transform: rotate(3deg) scale(1.06); } }
.hero p { margin: 10px 0 0; font-size: 16px; opacity: .93; line-height: 1.4; }

.example {
	margin: 18px auto 0;
	max-width: 340px;
	background: rgba(255, 255, 255, .12);
	border-radius: 12px;
	padding: 10px 14px;
	font-size: 15px;
	line-height: 1.7;
}
.example .q { opacity: .85; font-size: 13px; }
.example .nw { white-space: nowrap; }
.example .a { margin-top: 4px; font-weight: 700; color: var(--accent); }

.section-title {
	margin: 24px 2px 10px;
	font-family: Nunito, Roboto, sans-serif;
	font-weight: 900;
	font-size: 20px;
}

.topics {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
}
.wide .topics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.topic {
	border: 1px solid var(--card-border);
	background: var(--surface);
	border-radius: 14px;
	padding: 14px 12px;
	display: flex;
	align-items: center;
	gap: 10px;
	text-align: left;
	box-shadow: var(--shadow);
	transition: transform .18s var(--ease), box-shadow .18s ease, background-color .3s ease;
	min-height: 58px;
}
.topic:active { transform: scale(.97); }
.topic .emoji { font-size: 24px; line-height: 1; transition: transform .25s var(--ease); }
/* Long words break with a hyphen: "Достопримеча-тельности" */
.topic .name { font-weight: 500; font-size: 16px; min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
.topic.mix {
	grid-column: 1 / -1;
	justify-content: center;
	color: #fff;
	border: none;
	background: linear-gradient(115deg, var(--answer-corner) 0%, transparent 80%), var(--answer-bg);
}
.topic.mix .name { font-weight: 700; font-size: 18px; text-shadow: 0 0 10px #585858; }

.get-app {
	margin-top: 26px;
	text-align: center;
	color: var(--text-2);
	font-size: 14px;
}
.badges {
	display: flex;
	gap: 10px;
	justify-content: center;
	flex-wrap: wrap;
	margin-top: 10px;
}
.badges a { display: block; line-height: 0; transition: transform .18s var(--ease); }
.badges img { height: 44px; width: auto; }

.footer {
	margin-top: auto;
	padding-top: 26px;
	text-align: center;
	font-size: 12px;
	color: var(--text-2);
	line-height: 1.5;
}
.footer a { color: var(--text-2); }

/* Game */
.game {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.status {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 22px;
	font-size: 20px;
	font-weight: 500;
}
.status .hearts { display: flex; align-items: center; gap: 6px; color: var(--text); }
.status .hearts svg { width: 22px; height: 22px; color: var(--heart); }
.status .hearts.lost svg { animation: heart-lost .6s ease; }
@keyframes heart-lost { 20% { transform: scale(1.35); } 40% { transform: scale(.85) rotate(-12deg); } 60% { transform: rotate(10deg); } }
.status .count { color: var(--text-2); font-size: 16px; font-variant-numeric: tabular-nums; }

.progress {
	position: relative;
	height: 54px;
	margin: 10px 4px 8px;
	display: flex;
	align-items: center;
	flex-shrink: 0;
}
/* A gap on both ends, so the bar doesn't touch the flame and the trophy */
.progress .track {
	position: absolute;
	left: 54px;
	right: 52px;
	height: 20px;
	border-radius: 10px;
	background: var(--track);
	overflow: hidden;
}
.progress .fill {
	height: 100%;
	width: 0;
	border-radius: 10px;
	background: linear-gradient(90deg, #ff8a00, #ffc400);
	transition: width .6s var(--ease);
}
.flame {
	position: absolute;
	left: -6px;
	top: -6px;
	width: 58px;
	height: 58px;
	display: grid;
	place-items: center;
	z-index: 1;
}
.flame .anim { position: absolute; inset: 0; }
.flame .fallback { position: absolute; font-size: 34px; }
.flame .num {
	position: relative;
	margin-top: 14px;
	font-weight: 700;
	font-size: 15px;
	color: #fff;
	text-shadow: 0 0 4px rgba(120, 40, 0, .9);
}
.flame.bump { animation: bump .5s var(--ease); }
.flame.out { animation: flame-out .5s ease; }
@keyframes bump { 35% { transform: scale(1.3); } }
@keyframes flame-out { 40% { transform: scale(.75); filter: grayscale(1); } }
.trophy {
	position: absolute;
	right: -4px;
	width: 44px;
	height: 44px;
	color: var(--gold);
	z-index: 1;
}
.trophy span {
	position: absolute;
	top: 7px;
	left: 0;
	right: 0;
	text-align: center;
	font-weight: 700;
	font-size: 13px;
	color: #000;
}

#stage {
	display: flex;
	flex-direction: column;
	flex: 1;
	max-height: 820px;
}

/* Question card: keeps its size between the question and the answer */
.card {
	flex: 1 1 0;
	min-height: 300px;
	max-height: 470px;
	border: 1px solid var(--card-border);
	background: var(--card);
	border-radius: 12px;
	box-shadow: var(--shadow);
	padding: 12px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transition: background-color .3s ease, border-color .3s ease;
}
.prompt {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	border-radius: 10px;
	background: var(--prompt-bg);
	font-size: 18px;
	line-height: 1.3;
	flex-shrink: 0;
}
.prompt .cat {
	width: 34px;
	height: 34px;
	flex-shrink: 0;
	border-radius: 50%;
	background: var(--primary);
	display: grid;
	place-items: center;
	font-size: 18px;
}
.links {
	list-style: none;
	margin: auto 0;
	padding: 14px 0;
	text-align: center;
}
.links li {
	color: var(--links);
	font-size: 19px;
	padding: 9px 8px;
	margin: 0 auto;
	max-width: 360px;
	position: relative;
}
.links li + li::before {
	content: '';
	position: absolute;
	top: 0;
	left: 25%;
	right: 25%;
	border-top: 1px solid var(--link-sep);
}
.links.appear li { animation: link-in .45s var(--ease) both; }
.links.appear li:nth-child(1) { animation-delay: .08s; }
.links.appear li:nth-child(2) { animation-delay: .16s; }
.links.appear li:nth-child(3) { animation-delay: .24s; }
.links.appear li:nth-child(4) { animation-delay: .32s; }
.links.appear li:nth-child(5) { animation-delay: .4s; }
@keyframes link-in { from { opacity: 0; transform: translateY(8px); filter: blur(2px); } }

.question { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.q-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.q-body.swap, .reveal-body.swap { animation: fade-in .3s ease both; }

/* Links open their article's description */
.link {
	border: none;
	background: none;
	padding: 0 4px;
	color: var(--links);
	font-size: inherit;
	line-height: 1.35;
	border-radius: 6px;
	text-decoration: underline dotted transparent;
	text-underline-offset: 4px;
	transition: background-color .2s ease, text-decoration-color .2s ease;
}
.link:active { background: var(--prompt-bg); }
.links-hint {
	margin: 0 0 2px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	font-size: 13px;
	color: var(--text-2);
}
.links-hint svg { width: 14px; height: 14px; }

.link-view { display: flex; flex-direction: column; flex: 1; min-height: 0; margin-top: 10px; }
.lv-head { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.lv-back {
	width: 36px;
	height: 36px;
	flex-shrink: 0;
	border: none;
	border-radius: 50%;
	background: var(--chip-bg);
	color: var(--text);
	display: grid;
	place-items: center;
	transition: transform .15s ease, background-color .2s ease;
}
.lv-back svg { width: 16px; height: 16px; }
.lv-back:active { transform: scale(.92); }
.lv-thumb:empty { display: none; }
.lv-thumb img { display: block; width: 44px; height: 44px; border-radius: 8px; object-fit: cover; animation: fade-in .3s ease both; }
.lv-title { min-width: 0; }
.lv-title h3 { margin: 0; font-size: 18px; line-height: 1.25; color: var(--links); }
.lv-title .desc { color: var(--text-2); font-size: 14px; margin-top: 2px; }
.lv-title .desc:empty { display: none; }
.lv-body {
	margin-top: 10px;
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	font-size: 16px;
	line-height: 1.55;
	color: var(--text-3);
}
.lv-body p { margin: 0; }
.lv-body.swap { animation: fade-in .3s ease both; }
.blank {
	display: inline-block;
	min-width: 2.2em;
	padding: 0 6px;
	border-radius: 5px;
	text-align: center;
	font-weight: 700;
	color: var(--primary);
	background: color-mix(in srgb, var(--primary) 18%, var(--card));
}
.lv-error { color: var(--text-2); }
.retry { border: none; background: none; padding: 0; color: var(--links); font-weight: 500; text-decoration: underline; }
.skeleton { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.skeleton span {
	height: 12px;
	border-radius: 6px;
	background: linear-gradient(90deg, var(--track) 0%, var(--chip-bg) 50%, var(--track) 100%);
	background-size: 200% 100%;
	animation: shimmer 1.2s linear infinite;
}
.skeleton span:last-child { width: 60%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.lv-chips {
	display: flex;
	gap: 6px;
	margin-top: 10px;
	overflow-x: auto;
	flex-shrink: 0;
	padding-bottom: 2px;
	scrollbar-width: none;
}
.lv-chips::-webkit-scrollbar { display: none; }
.chip {
	flex-shrink: 0;
	border: 1px solid var(--card-border);
	background: var(--surface);
	color: var(--links);
	border-radius: 16px;
	padding: 5px 12px;
	font-size: 14px;
	white-space: nowrap;
	transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.lv-open {
	flex-shrink: 0;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	margin-left: auto;
	color: var(--links);
	background: var(--chip-bg);
	text-decoration: none;
	transition: background-color .2s ease;
}
.lv-open svg { width: 15px; height: 15px; }
/* After the answer, a link's article takes the whole card body */
.reveal.lv-active .reveal-head, .reveal.lv-active > .source { display: none; }
.reveal.lv-active .reveal-body { margin-top: 0; }
.reveal.lv-active .link-view { margin-top: 0; }

/* Answer reveal inside the card */
.reveal { display: flex; flex-direction: column; min-height: 0; flex: 1; animation: reveal-in .4s var(--ease) both; }
@keyframes reveal-in { from { opacity: 0; transform: scale(.98); } }
.reveal-head { display: flex; gap: 12px; align-items: center; flex-shrink: 0; }
.reveal-head .thumb {
	width: 64px;
	height: 64px;
	border-radius: 10px;
	object-fit: cover;
	flex-shrink: 0;
	background: var(--track);
}
.reveal-head .thumb.icon { display: grid; place-items: center; font-size: 30px; }
.reveal-head h2 { margin: 0; font-size: 21px; line-height: 1.2; }
.reveal-head .desc { color: var(--text-2); font-size: 15px; margin-top: 3px; }
.reveal-body {
	margin-top: 10px;
	overflow-y: auto;
	font-size: 16px;
	line-height: 1.55;
	color: var(--text-3);
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
}
.reveal-body.swap { animation: fade-in .3s ease both; }
@keyframes fade-in { from { opacity: 0; } }
.reveal-body p { margin: 0; }
.reveal-body b { color: var(--primary); }
.reveal-body .links { margin: auto 0; padding: 4px 0; }
.reveal-body .links li { font-size: 17px; padding: 7px 8px; }

/* Image tab: the picture fills the area, a blurred copy fills the rest */
.photo {
	position: relative;
	flex: 1;
	min-height: 160px;
	border-radius: 10px;
	overflow: hidden;
	background: var(--track);
}
.photo .backdrop {
	position: absolute;
	inset: -20px;
	background-size: cover;
	background-position: center;
	filter: blur(18px) saturate(1.2);
	opacity: .55;
	transform: scale(1.1);
}
.photo img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	animation: photo-in .5s var(--ease) both;
}
@keyframes photo-in { from { opacity: 0; transform: scale(1.04); } }

.source {
	margin-top: 10px;
	font-size: 14px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}
.source .from { color: var(--text-2); }
.source a { text-decoration: none; font-weight: 500; }
.tabs {
	position: relative;
	display: flex;
	justify-content: center;
	margin-top: 10px;
	align-self: center;
	background: var(--chip-bg);
	border-radius: 20px;
	padding: 3px;
	flex-shrink: 0;
}
.tabs .pill {
	position: absolute;
	top: 3px;
	bottom: 3px;
	border-radius: 17px;
	background: var(--primary);
	transition: left .3s var(--ease), width .3s var(--ease);
}
.tabs button {
	position: relative;
	border: none;
	background: none;
	border-radius: 17px;
	padding: 6px 16px;
	font-size: 15px;
	font-weight: 500;
	color: var(--text-2);
	transition: color .25s ease;
}
.tabs button.on { color: #fff; }

/* Answers */
.answers {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: 14px;
	flex-shrink: 0;
}
.answer {
	position: relative;
	overflow: hidden;
	border: none;
	border-radius: 10px;
	min-height: 60px;
	padding: 8px 40px;
	color: #fff;
	font-size: 18px;
	text-shadow: 0 0 10px #585858;
	background-color: var(--answer-bg);
	box-shadow: 0 2px 4px rgba(0, 0, 0, .2);
	transition: transform .2s var(--ease), opacity .35s ease, background-color .35s ease, box-shadow .2s ease, filter .2s ease;
	isolation: isolate;
}
/* The app's corner gradient, as a layer so the color change can fade */
.answer::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: -1;
	background: linear-gradient(115deg, var(--answer-corner) 0%, transparent 80%);
	transition: opacity .35s ease;
}
.answer.correct, .answer.wrong { opacity: 1; }
.answer.correct { background-color: var(--success); }
.answer.wrong { background-color: var(--fail); animation: shake .4s ease; }
.answer.correct::before, .answer.wrong::before { opacity: 0; }
.answer.correct.picked { animation: pop .45s var(--ease); }
.answer.dim { opacity: .45; }
.answer:active:not(:disabled) { transform: scale(.98); }
.answer:disabled { cursor: default; }
.answer .mark {
	position: absolute;
	top: 6px;
	left: 8px;
	width: 16px;
	height: 16px;
	animation: mark-in .35s var(--ease) .1s both;
}
@keyframes mark-in { from { opacity: 0; transform: scale(0) rotate(-30deg); } }
.answer .key {
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 12px;
	opacity: .55;
	text-shadow: none;
}
.answers.enter .answer { animation: answer-in .4s var(--ease) both; }
.answers.enter .answer:nth-child(1) { animation-delay: .12s; }
.answers.enter .answer:nth-child(2) { animation-delay: .17s; }
.answers.enter .answer:nth-child(3) { animation-delay: .22s; }
@keyframes answer-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }
@keyframes pop { 40% { transform: scale(1.035); } }
@media (hover: none) { .answer .key { display: none; } }

/* Next: its place is kept from the start, so nothing below jumps. It takes
   the right half only, so it doesn't look like one more answer */
.next-slot {
	height: 66px;
	padding-top: 12px;
	flex-shrink: 0;
}
.next {
	width: 50%;
	margin-left: auto;
	height: 54px;
	border: none;
	border-radius: 10px;
	background: var(--primary);
	color: #fff;
	font-size: 18px;
	font-weight: 500;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	box-shadow: var(--shadow);
	opacity: 0;
	transform: translateY(8px);
	pointer-events: none;
	transition: opacity .3s ease, transform .35s var(--ease), filter .2s ease;
}
.next.show { opacity: 1; transform: none; pointer-events: auto; }
.next svg { width: 20px; height: 20px; transition: transform .2s var(--ease); }

/* Round change: the old round slides out, the new one comes in */
#stage.leave .card, #stage.leave .answers { opacity: 0; transform: translateX(-24px); transition: opacity .2s ease, transform .2s ease; }
#stage.leave .next { opacity: 0; }
#stage.enter .card { animation: card-in .4s var(--ease) both; }
@keyframes card-in { from { opacity: 0; transform: translateX(28px); } }

.nudge {
	margin-top: 12px;
	border-radius: 12px;
	padding: 12px 14px;
	background: var(--prompt-bg);
	font-size: 15px;
	line-height: 1.4;
	display: flex;
	align-items: center;
	gap: 12px;
	animation: nudge-in .45s var(--ease) .3s both;
	flex-shrink: 0;
}
@keyframes nudge-in { from { opacity: 0; transform: translateY(10px); } }
.nudge .txt { flex: 1; }
.nudge a { font-weight: 700; white-space: nowrap; text-decoration: none; }
.nudge .close { border: none; background: none; color: var(--text-2); font-size: 20px; padding: 0 2px; }

/* End screen */
.result {
	margin-top: 10px;
	border: 1px solid var(--card-border);
	background: var(--card);
	border-radius: 14px;
	box-shadow: var(--shadow);
	padding: 22px 16px;
	text-align: center;
}
.result .big-icon { display: inline-block; width: 64px; height: 64px; color: var(--gold); animation: trophy-in .7s var(--ease) .1s both; }
.result .big-icon.lost { color: var(--heart); }
.result .big-icon svg { width: 100%; height: 100%; }
@keyframes trophy-in { 0% { opacity: 0; transform: scale(.3) rotate(-15deg); } 60% { transform: scale(1.12) rotate(4deg); } }
.result h2 {
	margin: 6px 0 0;
	font-family: Nunito, Roboto, sans-serif;
	font-weight: 900;
	font-size: 26px;
}
.result .score { font-size: 44px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.result .score small { font-size: 22px; color: var(--text-2); font-weight: 500; }
.result .meta { color: var(--text-2); margin-top: 4px; }
.result .grid { display: flex; justify-content: center; gap: 6px; margin-top: 14px; }
.result .grid .cell { width: 20px; height: 20px; border-radius: 5px; background: var(--track); animation: cell-in .35s var(--ease) both; }
.result .grid .cell.ok { background: var(--success); }
.result .grid .cell.bad { background: var(--fail); }
@keyframes cell-in { from { opacity: 0; transform: scale(.4); } }
.row-btns { display: flex; gap: 10px; margin-top: 16px; }
.row-btns button {
	flex: 1;
	border: none;
	border-radius: 10px;
	min-height: 50px;
	font-size: 16px;
	font-weight: 500;
	box-shadow: var(--shadow);
	transition: transform .18s var(--ease), box-shadow .18s ease, filter .2s ease;
}
.row-btns button:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--card-border) !important; }

.promo {
	margin-top: 16px;
	border-radius: 14px;
	overflow: hidden;
	background: var(--surface);
	border: 1px solid var(--card-border);
	box-shadow: var(--shadow);
}
.promo .art { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.promo .body { padding: 16px; }
.promo h3 {
	margin: 0;
	font-family: Nunito, Roboto, sans-serif;
	font-weight: 900;
	font-size: 21px;
}
.promo ul { margin: 10px 0 0; padding-left: 20px; line-height: 1.6; color: var(--text-3); }
.promo .qr {
	display: none;
	margin-top: 14px;
	align-items: center;
	gap: 14px;
	color: var(--text-2);
	font-size: 14px;
}
.promo .qr .code { background: #fff; padding: 6px; border-radius: 8px; line-height: 0; }
.promo .qr .code svg { width: 96px; height: 96px; }
@media (hover: hover) and (pointer: fine) { .promo .qr.ready { display: flex; } }

.other-topics { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.other-topics button {
	border: 1px solid var(--card-border);
	background: var(--surface);
	border-radius: 18px;
	padding: 7px 12px;
	font-size: 14px;
	transition: transform .18s var(--ease), box-shadow .18s ease;
}

/* Desktop hover */
@media (hover: hover) and (pointer: fine) {
	.icon-btn:hover { box-shadow: var(--shadow-hover); }
	.topic:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
	.topic:hover .emoji { transform: scale(1.15) rotate(-6deg); }
	.answer:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0, 0, 0, .22); filter: brightness(1.06); }
	.next.show:hover, .btn-primary:hover { filter: brightness(1.08); }
	.next.show:hover svg { transform: translateX(4px); }
	.row-btns button:hover, .other-topics button:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
	.badges a:hover { transform: translateY(-2px); }
	.tabs button:not(.on):hover { color: var(--text); }
	.link:hover { background: var(--prompt-bg); text-decoration-color: currentColor; }
	.lv-back:hover, .lv-open:hover { background: var(--track); }
	.chip:not(.on):hover { border-color: var(--primary); }
}

.toast {
	position: fixed;
	left: 50%;
	bottom: calc(24px + env(safe-area-inset-bottom));
	transform: translate(-50%, 20px);
	background: #333;
	color: #fff;
	border-radius: 20px;
	padding: 10px 18px;
	font-size: 15px;
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s, transform .25s var(--ease);
	zoom: var(--z);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; }
	.next.show { opacity: 1; }
}

/* Wide screens: Mix is one of the tiles, so 3 columns stay even */
.wide .topic.mix { grid-column: auto; justify-content: flex-start; }
.wide .topic.mix .name { font-size: 16px; }

/* Short screens (laptops, phones with browser bars): a tighter game */
@media (max-height: 780px) {
	.progress { height: 46px; margin: 4px 4px 4px; }
	.card { min-height: 240px; }
	.links { padding: 8px 0; }
	.links li { font-size: 18px; padding: 7px 8px; }
	.answers { gap: 8px; margin-top: 10px; }
	.answer { min-height: 52px; font-size: 17px; }
	.next-slot { height: 60px; padding-top: 10px; }
	.next { height: 50px; }
}
