/* ==========================================================================
   Cero Flashcard – styles of the /learn/ pages (on top of the Cero Portal theme stylesheet)
   ========================================================================== */
/* ---------- Chinese & Japanese serif (Song / Mincho: thick-and-thin strokes) ---------- */
:root {
	--font-zh-serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", "Source Han Serif SC", serif;
	--font-zh-tw-serif: "Noto Serif TC", "Songti TC", "PMingLiU", "MingLiU", serif;
	--font-ja-serif: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "MS Mincho", serif;
}
/* Characters only: UI text, pinyin and Vietnamese keep the sans-serif font. */
.fc-card__term:lang(zh), .fc-card__answer:lang(zh), .fc-quiz__prompt:lang(zh), .fc-quiz__opt span:lang(zh),
.fc-table__term:lang(zh), .fc-page__native:lang(zh), .fc-lang-tile__card:lang(zh), .fc-hero__card:lang(zh),
.fc-lang-zh .fc-bg__glyph {
	font-family: var(--font-zh-serif);
}
.fc-card__term:lang(ja), .fc-card__answer:lang(ja), .fc-card__reading:lang(ja), .fc-quiz__prompt:lang(ja), .fc-quiz__opt span:lang(ja),
.fc-table__term:lang(ja), .fc-table__reading:lang(ja), .fc-page__native:lang(ja), .fc-lang-tile__card:lang(ja), .fc-hero__card:lang(ja),
.fc-lang-ja .fc-bg__glyph {
	font-family: var(--font-ja-serif);
}
.fc-table__term small:lang(zh-TW) { font-family: var(--font-zh-tw-serif); }
/* Word list: Chinese / Japanese characters large enough to read every stroke. */
.fc-table td.fc-table__term:lang(zh), .fc-table td.fc-table__term:lang(ja) { font-size: 1.8rem; line-height: 1.25; letter-spacing: .02em; font-weight: 300; }
.fc-table td.fc-table__term:lang(zh) small, .fc-table td.fc-table__term:lang(ja) small { display: block; font-size: .95rem; letter-spacing: 0; margin-top: 2px; }
.fc-table td.fc-table__reading { font-size: 1.2rem; }
/* Japanese kana readings: close to the size of the word itself, a bit brighter than other muted text. */
.fc-table td.fc-table__reading:lang(ja) { font-size: 1.45rem; line-height: 1.3; color: color-mix(in srgb, var(--text) 75%, var(--muted)); }
.fc-table td.fc-table__reading:lang(zh) { font-size: 1.25rem; }
.fc-table td.fc-table__term:lang(zh), .fc-table td.fc-table__term:lang(ja) { white-space: nowrap; } /* keep 明るい on one line */
/* Vietnamese: own column on wide screens, under the English meaning on phones (no sideways scrolling). */
/* Stroke-order button next to each Chinese / Japanese word in the word list. */
.fc-table__stroke {
	display: inline-grid; place-items: center; width: 30px; height: 30px; margin-left: 6px; vertical-align: middle;
	border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--muted);
	font-size: 15px; line-height: 1; cursor: pointer; font-family: var(--font);
}
.fc-table__stroke:hover { color: var(--zh); border-color: var(--zh); }
.fc-lang-ja .fc-table__stroke:hover { color: var(--ja); border-color: var(--ja); }
@media (max-width: 560px) { .fc-table__stroke { display: grid; margin: 6px 0 0; } }

/* Romaji (Japanese pronunciation in Latin letters). */
.fc-table td.fc-table__romaji { color: var(--ja); font-weight: 600; white-space: nowrap; }
.fc-card__romaji { font-size: 1.05rem; font-weight: 600; color: var(--muted); letter-spacing: .04em; margin-top: -6px; }
.fc-card__romaji:empty { display: none; }
.fc-table__vi-inline, .fc-table__reading-inline { display: none; }
@media (max-width: 560px) {
	.fc-table th.fc-table__romaji-th, .fc-table td.fc-table__romaji { display: none; }
	.fc-table th.fc-table__reading-th, .fc-table td.fc-table__reading { display: none; }
	.fc-table__reading-inline { display: block; margin-top: 2px; font-size: 1.02rem; font-weight: 500; color: var(--muted); white-space: normal; font-family: var(--font); letter-spacing: 0; }
	.fc-table__reading-inline:lang(ja) { font-family: var(--font-ja-serif); font-size: 1.15rem; }
	.fc-table td.fc-table__meaning { min-width: 9em; }
	.fc-table td.fc-table__term:lang(zh), .fc-table td.fc-table__term:lang(ja) { font-size: 1.6rem; white-space: nowrap; }
	.fc-table th.fc-table__vi-th, .fc-table td.fc-table__vi { display: none; }
	.fc-table__vi-inline { display: block; margin-top: 4px; color: var(--good); font-weight: 600; }
}
/* Big display characters: medium weight shows the stroke contrast best; table/list text a little bolder. */
.fc-card__term:lang(zh), .fc-card__term:lang(ja), .fc-card__answer:lang(zh), .fc-card__answer:lang(ja),
.fc-quiz__prompt:lang(zh), .fc-quiz__prompt:lang(ja), .fc-hero__card:lang(zh), .fc-hero__card:lang(ja) {
	font-weight: 600; letter-spacing: .02em;
}
.fc-table__term:lang(zh), .fc-table__term:lang(ja), .fc-page__native:lang(zh), .fc-page__native:lang(ja),
.fc-lang-tile__card:lang(zh), .fc-lang-tile__card:lang(ja), .fc-lang-zh .fc-bg__glyph, .fc-lang-ja .fc-bg__glyph {
	font-weight: 700;
}
.fc-card__reading:lang(ja) { font-weight: 600; }

/* Brush calligraphy for CJK titles (毛笔 / 筆): 中文 · 日本語 labels, language tiles, hero cards. */
:root {
	--font-zh-brush: "Ma Shan Zheng", "STKaiti", "KaiTi", "Kaiti SC", var(--font-zh-serif);
	--font-ja-brush: "Yuji Syuku", "HGSeikaishotaiPRO", "HG正楷書体-PRO", var(--font-ja-serif);
}
.fc-page__native:lang(zh), .fc-lang-tile__card:lang(zh), .fc-hero__card:lang(zh) { font-family: var(--font-zh-brush); font-weight: 400; }
.fc-page__native:lang(ja), .fc-lang-tile__card:lang(ja), .fc-hero__card:lang(ja) { font-family: var(--font-ja-brush); font-weight: 400; }
.fc-page__native:lang(zh), .fc-page__native:lang(ja) {
	display: block; font-size: clamp(2.6rem, 7vw, 3.8rem); line-height: 1.05; margin-bottom: 6px; letter-spacing: .04em;
	text-shadow: 0 2px 0 color-mix(in srgb, currentColor 18%, transparent);
}
.fc-page__head--compact .fc-page__native:lang(zh), .fc-page__head--compact .fc-page__native:lang(ja) { font-size: clamp(2rem, 5vw, 2.8rem); }
.fc-lang-tile__card:lang(zh), .fc-lang-tile__card:lang(ja) { font-size: 2.1rem; padding: 6px 18px 10px; letter-spacing: .04em; }
.fc-hero__card:lang(zh), .fc-hero__card:lang(ja) { font-size: 3.4rem; }

/* ---------- hero ---------- */
.fc-hero { padding: 48px 0 24px; }
.fc-hero__inner { display: grid; gap: 32px; align-items: center; }
@media (min-width: 860px) { .fc-hero__inner { grid-template-columns: 1.3fr 1fr; padding-top: 24px; } }
.fc-hero__title { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 800; letter-spacing: -.03em; }
.fc-hero__lead { font-size: 1.15rem; color: var(--muted); max-width: 36em; }
.fc-hero__lead strong { color: var(--text); }
.fc-hero__stack { position: relative; height: 220px; max-width: 360px; width: 100%; margin: 0 auto; }
.fc-hero__card {
	position: absolute; inset: 20px 30px; display: grid; place-items: center;
	background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
	box-shadow: var(--shadow-lg); font-size: 3rem; font-weight: 700;
}
.fc-hero__card--1 { color: var(--en); transform: rotate(-4deg); }
.fc-hero__card--2 { color: var(--zh); transform: rotate(5deg) translate(24px, -10px); }
.fc-hero__card--3 { color: var(--ja); transform: rotate(12deg) translate(44px, -18px); }
@media (prefers-reduced-motion: no-preference) {
	.fc-hero__card--1 { animation: fc-float 6s ease-in-out infinite; }
}
@keyframes fc-float { 50% { transform: rotate(-2deg) translateY(-6px); } }

/* ---------- language tiles & how it works ---------- */
.fc-lang-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.fc-lang-tile {
	--accent: var(--primary);
	display: flex; flex-direction: column; gap: 14px; padding: 22px; border-radius: var(--radius-lg);
	background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none;
	box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease;
}
.fc-lang-tile--en { --accent: var(--en); }
.fc-lang-tile--zh { --accent: var(--zh); }
.fc-lang-tile--ja { --accent: var(--ja); }
.fc-lang-tile--fr { --accent: var(--fr); }
.fc-lang-tile--ko { --accent: var(--ko); }
.fc-lang-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.fc-lang-tile__card {
	align-self: flex-start; padding: 10px 18px; border-radius: 12px; font-size: 1.6rem; font-weight: 700;
	background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent);
}
.fc-lang-tile__body { display: flex; flex-direction: column; gap: 4px; }
.fc-lang-tile__name { font-size: 1.35rem; font-weight: 750; }
.fc-lang-tile__meta { color: var(--muted); font-weight: 550; }
.fc-lang-tile__levels { color: var(--muted); font-size: .9rem; }
.fc-lang-tile__cta { margin-top: auto; font-weight: 650; color: var(--accent); }

.fc-how__list { list-style: none; counter-reset: how; padding: 0; margin: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.fc-how__list li {
	counter-increment: how; display: flex; flex-direction: column; gap: 6px; padding: 20px;
	background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
}
.fc-how__list li::before {
	content: counter(how); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
	background: var(--primary-soft); color: var(--primary); font-weight: 750;
}
.fc-how__list span { color: var(--muted); }

/* ---------- deck tiles ---------- */
.fc-deck-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.fc-deck-grid__ad { grid-column: 1 / -1; }
.fc-deck-grid__ad .fc-ad { margin: 4px 0; }
.fc-deck-tile {
	display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: var(--radius);
	background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none;
	box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease;
}
.fc-deck-tile:hover { transform: translateY(-2px); border-color: var(--primary); }
.fc-deck-tile__level { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; }
.fc-deck-tile__title { font-size: 1.3rem; font-weight: 750; }
.fc-deck-tile__meta { color: var(--muted); font-size: .92rem; }
.fc-deck-tile__known { color: var(--good); font-size: .85rem; font-weight: 600; min-height: 1.2em; }

.fc-progress { display: block; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.fc-progress__bar { display: block; height: 100%; width: 0; background: var(--good); border-radius: inherit; transition: width .3s ease; }

/* ---------- flashcard app ---------- */
.fc-app {
	background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
	padding: 16px; box-shadow: var(--shadow);
}
@media (min-width: 720px) { .fc-app { padding: 24px; } }
.fc-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.fc-part-form { display: flex; gap: 6px; align-items: center; }
.fc-part-go { min-height: 42px; padding: 8px 14px; }
.fc-select select {
	appearance: none; padding: 9px 36px 9px 14px; border-radius: 10px; border: 1px solid var(--border);
	background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%23888' d='M0 0h12L6 8z'/%3E%3C/svg%3E") no-repeat right 12px center;
	font-weight: 600; max-width: 100%; cursor: pointer;
}
.fc-modes { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.fc-mode { border: 0; background: transparent; padding: 6px 16px; border-radius: 8px; font-weight: 650; cursor: pointer; color: var(--muted); }
.fc-mode.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.fc-settings { position: relative; margin-left: auto; }
.fc-settings summary {
	list-style: none; cursor: pointer; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border); font-weight: 600;
}
.fc-settings summary::-webkit-details-marker { display: none; }
.fc-settings summary::after { content: " ▾"; color: var(--muted); }
.fc-settings__panel {
	position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; min-width: 240px; display: flex; flex-direction: column; gap: 10px;
	background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 14px;
}
.fc-settings__panel label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.fc-voice { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.fc-voice[hidden] { display: none; }
.fc-voice__row { justify-content: space-between; }
.fc-voice__row span { color: var(--muted); font-size: .9rem; }
.fc-voice select {
	max-width: 200px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border);
	background: var(--surface-2); color: var(--text); font: inherit; font-size: .9rem; cursor: pointer;
}
@media (max-width: 560px) {
	.fc-settings { margin-left: 0; }
	.fc-settings__panel { right: auto; left: 0; }
	.fc-part-form { width: 100%; }
	.fc-part-form .fc-select { flex: 1; }
	.fc-select, .fc-select select { width: 100%; }
}

.fc-progress--app { margin: 16px 0 6px; }
.fc-status { display: flex; justify-content: space-between; color: var(--muted); font-size: .9rem; margin: 0 0 14px; font-variant-numeric: tabular-nums; }
.fc-status__known { color: var(--good); font-weight: 600; }

.fc-card-wrap { position: relative; perspective: 1400px; }
/* One fixed card height for every card, so the buttons below never jump when moving to the next card.
   470px fits the longest backs measured (radical / HSK / kids picture / Korean example cards ≈ 440–470px with
   the padding below); short screens get a smaller card and the rare overflow scrolls inside the face. */
.fc-card {
	--card-h: clamp(360px, 64vh, 470px);
	display: block; width: 100%; height: var(--card-h); padding: 0; border: 0; background: none; cursor: pointer;
	border-radius: var(--radius-lg); text-align: center; color: var(--text);
}
.fc-card__inner {
	position: relative; display: grid; grid-template: 100% / 100%; width: 100%; height: 100%;
	transform-style: preserve-3d; transition: transform .5s cubic-bezier(.3, .7, .3, 1);
}
.fc-card.is-flipped .fc-card__inner { transform: rotateY(180deg); }
@media (prefers-reduced-motion: reduce) { .fc-card__inner { transition: none; } }
.fc-card__face {
	position: relative; grid-area: 1 / 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: center;
	/* "safe": when content is taller than the card it starts at the top (and scrolls) instead of being cut off above. */
	justify-content: center; justify-content: safe center; gap: 10px;
	padding: 28px 24px; border-radius: var(--radius-lg); backface-visibility: hidden; -webkit-backface-visibility: hidden;
	background: var(--bg); border: 1px solid var(--border);
	background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--muted) 18%, transparent) 1px, transparent 0);
	background-size: 22px 22px;
}
.fc-card__back { transform: rotateY(180deg); background-color: var(--surface-2); }
.fc-card.is-known .fc-card__front { box-shadow: inset 0 0 0 2px var(--good); }
.fc-card__term { font-size: clamp(2.6rem, 9vw, 4.6rem); font-weight: 700; line-height: 1.15; word-break: break-word; }
.fc-lang-en .fc-card__term, .fc-lang-fr .fc-card__term { font-size: clamp(2.2rem, 7vw, 3.6rem); }
.fc-card__term--long { font-size: clamp(2rem, 7vw, 3.4rem); }
.fc-card__term--meaning { font-size: clamp(1.2rem, 3.6vw, 1.7rem); font-weight: 600; display: flex; flex-direction: column; gap: 8px; }
.fc-card__hint { color: var(--muted); font-size: 1.15rem; min-height: 1.4em; }
.fc-lang-en .fc-card__hint, .fc-lang-fr .fc-card__hint { font-style: italic; }
.fc-card__tap { position: absolute; bottom: 14px; font-size: .78rem; color: var(--muted); }
.fc-card__reading { font-size: 1.6rem; font-weight: 600; color: var(--primary); }
.fc-lang-zh .fc-card__reading { color: var(--zh); }
.fc-lang-ja .fc-card__reading { color: var(--ja); }
.fc-card__meaning { font-size: clamp(1.1rem, 3vw, 1.4rem); display: flex; flex-direction: column; gap: 8px; max-width: 34em; }
.fc-card__sense--alt { font-size: .85em; color: var(--muted); }
.fc-card__answer { font-size: clamp(2.2rem, 7vw, 3.6rem); font-weight: 700; }
.fc-card__extra { color: var(--muted); font-style: italic; max-width: 34em; }
.fc-speak {
	position: absolute; top: 12px; right: 12px; z-index: 2; width: 44px; height: 44px; border-radius: 50%;
	border: 1px solid var(--border); background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer;
	box-shadow: var(--shadow);
}
.fc-speak:hover { color: var(--primary); }

.fc-controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; margin-top: 16px; }
.fc-controls--secondary { justify-content: space-between; margin-top: 10px; }
.fc-controls .fc-known, .fc-controls .fc-learning { flex: 1 1 140px; max-width: 220px; }
.fc-keys { font-size: .8rem; color: var(--muted); }
@media (max-width: 560px) {
	.fc-prev span, .fc-next span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }
	.fc-keys { display: none; }
	.fc-controls { gap: 8px; }
}

.fc-quiz__q { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 12px; text-align: center; border-radius: var(--radius-lg); background: var(--bg); border: 1px solid var(--border); }
.fc-quiz__prompt { font-size: clamp(2rem, 7vw, 3.4rem); font-weight: 700; line-height: 1.2; }
.fc-quiz__prompt:lang(en) { font-size: clamp(1.15rem, 3.4vw, 1.6rem); font-weight: 600; }
.fc-lang-en .fc-quiz__prompt:lang(en), .fc-lang-fr .fc-quiz__prompt:lang(fr) { font-size: clamp(2rem, 6vw, 3rem); font-weight: 700; }
.fc-quiz__sub { color: var(--muted); }
.fc-quiz__options { display: grid; gap: 10px; margin-top: 14px; }
@media (min-width: 720px) { .fc-quiz__options { grid-template-columns: 1fr 1fr; } }
.fc-quiz__opt {
	display: flex; align-items: flex-start; gap: 10px; text-align: left; padding: 14px; border-radius: 12px;
	border: 1px solid var(--border); background: var(--surface); cursor: pointer; line-height: 1.4;
}
.fc-quiz__opt:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
.fc-quiz__opt kbd {
	flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px;
	background: var(--surface-2); font: 600 12px var(--font); color: var(--muted);
}
.fc-quiz__opt.is-correct { border-color: var(--good); background: var(--good-soft); }
.fc-quiz__opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.fc-quiz__opt.is-correct::after, .fc-quiz__opt.is-wrong::after { margin-left: auto; font-weight: 800; font-size: 1.1rem; line-height: 1; }
.fc-quiz__opt.is-correct::after { content: "✓"; content: "✓" / ""; color: var(--good); }
.fc-quiz__opt.is-wrong::after { content: "✗"; content: "✗" / ""; color: var(--bad); }
.fc-quiz__opt:disabled { cursor: default; }
.fc-quiz__feedback { min-height: 1.6em; margin: 12px 0 0; text-align: center; font-weight: 600; }
.fc-quiz__feedback.is-good { color: var(--good); }
.fc-quiz__feedback.is-bad { color: var(--bad); }
.fc-quiz__score { color: var(--muted); font-weight: 600; margin-right: auto; }

.fc-done { text-align: center; padding: 40px 12px; }
.fc-done__title { font-size: 1.3rem; font-weight: 700; }
.fc-app.is-loading .fc-card { opacity: .4; }

/* ---------- fullscreen trainer ---------- */
.fc-fullscreen { min-height: 42px; padding: 8px 11px; }
.fc-fullscreen__off, .fc-app.is-fullscreen .fc-fullscreen__on { display: none; }
.fc-app.is-fullscreen .fc-fullscreen__off { display: block; }
html.fc-fs-lock, html.fc-fs-lock body { overflow: hidden; }
.fc-app.is-fullscreen {
	position: fixed; inset: 0; z-index: 9000; margin: 0; width: auto; height: 100%; height: 100dvh; max-width: none;
	display: flex; flex-direction: column; overflow-y: auto; border: 0; border-radius: 0; box-shadow: none;
	padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.fc-app.is-fullscreen::backdrop { background: var(--surface); }
.fc-app.is-fullscreen > * { width: 100%; max-width: 1100px; margin-left: auto; margin-right: auto; }
.fc-app.is-fullscreen .fc-study:not([hidden]) { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.fc-app.is-fullscreen .fc-card-wrap { flex: 1; display: flex; min-height: 320px; }
.fc-app.is-fullscreen .fc-card { flex: 1; height: auto; }
.fc-app.is-fullscreen .fc-card__term { font-size: clamp(3rem, 13vmin, 8rem); }
.fc-app.is-fullscreen .fc-card__term--long { font-size: clamp(2.4rem, 10vmin, 6rem); }
.fc-lang-en .fc-app.is-fullscreen .fc-card__term, .fc-lang-fr .fc-app.is-fullscreen .fc-card__term { font-size: clamp(2.4rem, 9vmin, 5.5rem); }
.fc-app.is-fullscreen .fc-card__term--meaning { font-size: clamp(1.3rem, 4.5vmin, 2.4rem); }
.fc-app.is-fullscreen .fc-card__answer { font-size: clamp(2.4rem, 10vmin, 6rem); }
.fc-app.is-fullscreen .fc-card__meaning { font-size: clamp(1.2rem, 4vmin, 2rem); }
.fc-app.is-fullscreen .fc-card__reading { font-size: clamp(1.6rem, 5vmin, 2.6rem); }
@media (min-width: 720px) { .fc-app.is-fullscreen { padding: 24px 32px; } }

/* ---------- English for Kids ---------- */
:root { --font-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif; }
.fc-lang-tile--kids { --accent: var(--kids); }
.fc-lang-tile--kids .fc-lang-tile__card { font-family: "Comic Sans MS", "Chalkboard SE", var(--font); letter-spacing: .08em; }
.fc-lang-kids .fc-page__native { color: var(--kids); font-family: "Comic Sans MS", "Chalkboard SE", var(--font); }
.fc-card__term--pic { font-size: clamp(5rem, 22vw, 9rem); line-height: 1; font-family: var(--font), var(--font-emoji); font-weight: 700; white-space: nowrap; }
.fc-card__reading--pic { font-size: clamp(3rem, 12vw, 5rem); line-height: 1; color: inherit !important; }
.fc-lang-kids .fc-card__answer { color: var(--kids); }
.fc-lang-kids .fc-card__term:not(.fc-card__term--pic) { font-size: clamp(2.4rem, 8vw, 4rem); }
.fc-quiz__prompt--pic { font-size: clamp(4.5rem, 18vw, 7rem); line-height: 1.1; }
.fc-quiz__options--pic .fc-quiz__opt { align-items: center; }
.fc-quiz__options--pic .fc-quiz__opt span { font-size: 2.6rem; line-height: 1.1; }
.fc-lang-kids .fc-quiz__opt span { font-size: 1.15rem; font-weight: 600; }
.fc-lang-kids .fc-quiz__options--pic .fc-quiz__opt span { font-size: 2.6rem; }
.fc-table__pic { font-size: 1.8rem; line-height: 1.1; color: inherit; }
.fc-deck-tile__icon { font-size: 2rem; line-height: 1; }
.fc-group-title { font-size: 1.35rem; font-weight: 750; margin: 32px 0 14px; }
.fc-group-title:first-of-type { margin-top: 8px; }

/* ---------- pictures & Vietnamese ---------- */
/* Mulberry SVGs have dark outlines on transparent; a light tile keeps them readable in dark mode. */
.fc-card__pic, .fc-quiz__pic { display: grid; place-items: center; line-height: 1; }
.fc-card__pic.is-svg, .fc-quiz__pic.is-svg { background: #fff; border-radius: 16px; padding: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.fc-card__pic.is-svg img { display: block; width: clamp(84px, 22vw, 120px); height: auto; aspect-ratio: 1; }
.fc-card__pic.is-emoji { font-size: clamp(3.2rem, 12vw, 4.6rem); font-family: var(--font), var(--font-emoji); }
.fc-card__pic--hero.is-svg img { width: clamp(150px, 42vw, 220px); }
.fc-card__pic--hero.is-emoji { font-size: clamp(5rem, 22vw, 9rem); font-weight: 700; white-space: nowrap; }
.fc-card__vi { font-size: clamp(1.05rem, 3vw, 1.3rem); font-weight: 650; color: var(--good); max-width: 32em; }
.fc-card__vi:empty { display: none; }
.fc-card__term .fc-card__vi { display: block; margin-top: 6px; }
.fc-card__face { overflow: hidden auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent; }
.fc-quiz__pic.is-svg img { width: 96px; height: auto; aspect-ratio: 1; display: block; }
.fc-quiz__pic.is-emoji { font-size: 3.2rem; }
.fc-quiz__pic--hero.is-svg img { width: clamp(140px, 36vw, 190px); }
.fc-quiz__pic--hero.is-emoji { font-size: clamp(4.5rem, 18vw, 7rem); }
.fc-quiz__opt span.is-svg { background: #fff; border-radius: 10px; padding: 4px; }
.fc-quiz__opt span.is-svg img { width: 72px; height: 72px; display: block; }
.fc-quiz__options--pic .fc-quiz__opt { justify-content: center; }

/* Hand-made kids illustrations (transparent WebP): large, no tile — like a sticker on the card. */
.fc-card__pic.is-ai img { display: block; width: clamp(170px, 46vw, 250px); height: auto; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 6px 14px rgba(0,0,0,.18)); }
.fc-card__back:has(.fc-card__pic.is-ai:not([hidden])) { gap: 6px; padding-top: 18px; padding-bottom: 18px; }
.fc-quiz__pic.is-ai img { width: clamp(150px, 40vw, 210px); height: auto; aspect-ratio: 1; display: block; object-fit: contain; }
.fc-quiz__opt span.is-ai img { width: 88px; height: 88px; display: block; object-fit: contain; }
.fc-table__pic img.is-ai { background: transparent; padding: 0; }
.fc-table__pic { width: 1%; padding-right: 0 !important; text-align: center; }
.fc-table__pic img { display: block; width: 100px; max-width: 100px; height: auto; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 10px; padding: 4px; }
.fc-table__pic .fc-emoji { font-size: 3.4rem; line-height: 100px; font-family: var(--font), var(--font-emoji); }
.fc-table__vi { color: var(--good); font-weight: 600; }
@media (max-width: 560px) {
	.fc-table__pic { width: 1%; }
	.fc-table__pic img { width: 64px; max-width: 64px; }
	.fc-table__pic .fc-emoji { font-size: 2.3rem; line-height: 64px; }
	.fc-table__meaning { font-size: .88rem; }
}

/* ---------- word list ---------- */
.fc-wordlist { margin-top: 28px; }
.fc-wordlist__title { font-size: 1.35rem; font-weight: 750; }
.fc-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.fc-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.fc-table th, .fc-table td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.fc-table thead th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.fc-table tbody tr:last-child td { border-bottom: 0; }
.fc-table__n { color: var(--muted); width: 1%; font-variant-numeric: tabular-nums; }
.fc-table__term { font-weight: 700; font-size: 1.15rem; white-space: nowrap; }
.fc-lang-en .fc-table__term { font-size: 1rem; }
.fc-table__term small { font-weight: 400; color: var(--muted); font-size: .8em; }
.fc-table__reading { color: var(--muted); }
/* Reading and Meaning columns: at most 30% of the table each; long text (kanji on/kun lists) wraps.
   Table cells ignore max-width, so the limit sits on the inner text (cqi = % of .fc-table-wrap). */
.fc-table-wrap { container-type: inline-size; }
.fc-table__reading-text { display: block; max-width: 30cqi; white-space: normal; overflow-wrap: break-word; }
.fc-table__meaning-text { overflow-wrap: break-word; }
/* Phones hide the Reading and Vietnamese columns, so Meaning keeps the remaining width there. */
@media (min-width: 561px) { .fc-table__meaning-text { max-width: 30cqi; } }
.fc-table__example { display: block; color: var(--muted); font-size: .88em; margin-top: 2px; }
.fc-table__ad td { background: var(--bg); }
.fc-table__ad .fc-ad { margin: 0; }
@media (max-width: 560px) {
	.fc-table th:first-child, .fc-table td:first-child { display: none; }
	.fc-table th, .fc-table td { padding: 9px 10px; }
	.fc-table__term, .fc-table__reading { white-space: normal; }
}

.fc-pager { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; margin-top: 20px; }
.fc-pager__list { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 0; }
.fc-pager__list a, .fc-pager__list span {
	display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 8px; border-radius: 10px;
	text-decoration: none; color: var(--text); font-weight: 600;
}
.fc-pager__list a:hover { background: var(--surface-2); }
.fc-pager__list [aria-current] { background: var(--text); color: var(--bg); }
.fc-pager__gap { padding: 0 4px; color: var(--muted); align-self: center; }

/* ---------- French ---------- */
.fc-lang-tile--fr .fc-lang-tile__card, .fc-lang-fr .fc-page__native { font-family: Georgia, "Times New Roman", serif; font-style: italic; }
.fc-lang-fr .fc-card__reading { color: var(--fr); }
.fc-lang-fr .fc-card__answer { color: var(--fr); }

/* ---------- Korean ---------- */
:root {
	--font-ko: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", "Nanum Gothic", sans-serif;
	--font-ko-brush: "Nanum Brush Script", var(--font-ko);
}
:lang(ko) { font-family: "Inter", var(--font-ko); word-break: keep-all; }
.fc-page__native:lang(ko), .fc-lang-tile__card:lang(ko) { font-family: var(--font-ko-brush); font-weight: 400; }
.fc-page__native:lang(ko) {
	display: block; font-size: clamp(2.8rem, 7vw, 4rem); line-height: 1.05; margin-bottom: 6px;
	text-shadow: 0 2px 0 color-mix(in srgb, currentColor 18%, transparent);
}
.fc-page__head--compact .fc-page__native:lang(ko) { font-size: clamp(2.2rem, 5vw, 3rem); }
.fc-lang-tile__card:lang(ko) { font-size: 2.3rem; padding: 4px 18px 8px; }
.fc-lang-ko .fc-card__reading { color: var(--ko); }
.fc-lang-ko .fc-card__extra { white-space: pre-line; }
.fc-table td.fc-table__term:lang(ko) { font-size: 1.45rem; white-space: nowrap; }
.fc-table__term small:lang(ko-Hani) { display: block; font-family: var(--font-zh-tw-serif); font-size: .95rem; color: var(--muted); }
.fc-table__term small .fc-table__hv { font-family: var(--font); font-size: .85rem; }
.fc-lang-ko .fc-bg__glyph { font-family: var(--font-ko); font-weight: 700; }


/* ---------- locked decks (see inc/access.php) ---------- */
.fc-locked {
	display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 36px 20px;
	background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.fc-locked__icon { font-size: 2.6rem; line-height: 1; }
.fc-locked__title { font-size: 1.4rem; font-weight: 750; margin: 0; }
.fc-locked__text { color: var(--muted); max-width: 34em; margin: 0; }
.fc-locked__cta { margin-top: 6px; }
.fc-locked__free { color: var(--muted); font-size: .92rem; margin: 6px 0 0; }
.fc-deck-tile.is-locked { border-style: dashed; }
/* Locked decks: everything blurred 3px except the deck name and the "Sign in" badge; clearer on hover. */
.fc-deck-tile.is-locked > :not(.fc-deck-tile__title):not(.fc-deck-tile__lock) { filter: blur(3px); opacity: .8; transition: filter .25s ease, opacity .25s ease; user-select: none; }
.fc-deck-tile.is-locked:hover > :not(.fc-deck-tile__title):not(.fc-deck-tile__lock),
.fc-deck-tile.is-locked:focus-visible > :not(.fc-deck-tile__title):not(.fc-deck-tile__lock) { filter: blur(1.5px); opacity: .9; }
@media (prefers-reduced-motion: reduce) { .fc-deck-tile.is-locked > * { transition: none; } }
.fc-deck-tile__lock { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--btn, #db2777); font-size: .78rem; font-weight: 700; }
.fc-lock-mark { font-size: .85em; }


/* ---------- conversations (templates/dialogue.php, assets/js/dialogue.js) ---------- */
.fc-dlg-app { display: flex; flex-direction: column; gap: 18px; }
.fc-dlg-toolbar {
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; padding: 12px 16px;
	background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
	position: sticky; top: 8px; z-index: 5; box-shadow: var(--shadow);
}
.fc-dlg-toggles { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .92rem; }
.fc-dlg-toggles label, .fc-dlg-role { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.fc-dlg-role { font-size: .92rem; color: var(--muted); }
.fc-dlg-role select { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; }
.fc-dlg-hint { margin: 0; padding: 10px 14px; border-radius: var(--radius); background: var(--primary-soft); font-size: .92rem; }
.fc-dlg-index ol { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: dlg; }
.fc-dlg-index li { counter-increment: dlg; }
.fc-dlg-index a {
	display: inline-block; padding: 5px 12px; border-radius: 999px; background: var(--surface-2); color: var(--text);
	font-size: .88rem; text-decoration: none;
}
.fc-dlg-index a::before { content: counter(dlg) ". "; color: var(--muted); }
.fc-dlg-index a:hover { background: var(--primary-soft); }

.fc-dlg {
	background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
	padding: 18px 18px 22px; scroll-margin-top: 90px;
}
.fc-dlg__head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.fc-dlg__head > div { flex: 1; min-width: 0; }
.fc-dlg__num {
	flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
	background: var(--primary-soft); color: var(--primary); font-weight: 750;
}
.fc-dlg__title { margin: 0; font-size: 1.25rem; line-height: 1.3; }
.fc-dlg__title small { display: block; font-size: .85rem; font-weight: 500; color: var(--muted); }
.fc-dlg__sub { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.fc-dlg__play { flex: none; }
.fc-dlg__play.is-playing { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }

.fc-dlg__lines { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.fc-dlg__line { display: flex; align-items: flex-end; gap: 8px; max-width: 88%; }
.fc-dlg__line.is-b { flex-direction: row-reverse; align-self: flex-end; }
.fc-dlg__who {
	flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
	background: var(--surface-2); color: var(--muted); font-size: .8rem; font-weight: 750;
}
.fc-dlg__line.is-b .fc-dlg__who { background: var(--primary-soft); color: var(--primary); }
.fc-dlg__bubble {
	min-width: 0; padding: 10px 14px; border-radius: 16px 16px 16px 4px; background: var(--surface-2);
	transition: box-shadow .2s, background .2s;
}
.fc-dlg__line.is-b .fc-dlg__bubble { border-radius: 16px 16px 4px 16px; background: var(--primary-soft); }
.fc-dlg__bubble p { margin: 0; overflow-wrap: anywhere; }
.fc-dlg__text { font-size: 1.12rem; font-weight: 600; line-height: 1.45; }
.fc-dlg__text:lang(zh) { font-family: var(--font-zh); font-size: 1.3rem; }
.fc-dlg__text:lang(ja) { font-family: var(--font-ja); font-size: 1.25rem; }
.fc-dlg__text:lang(ko) { font-size: 1.25rem; }
.fc-dlg__reading { color: var(--primary); font-size: .95rem; }
.fc-dlg__roman { color: var(--muted); font-size: .88rem; font-style: italic; }
.fc-dlg__en { font-size: .92rem; margin-top: 4px !important; }
.fc-dlg__vi { color: var(--muted); font-size: .92rem; }
.fc-dlg__say {
	flex: none; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
	background: transparent; color: var(--muted); cursor: pointer;
}
.fc-dlg__say:hover, .fc-dlg__say:focus-visible { background: var(--surface-2); color: var(--primary); }
.fc-dlg__line.is-speaking .fc-dlg__bubble { box-shadow: 0 0 0 2px var(--primary); }
.fc-dlg__line.is-turn .fc-dlg__bubble { box-shadow: 0 0 0 2px var(--good); animation: fc-dlg-pulse 1s ease-in-out infinite alternate; }
@keyframes fc-dlg-pulse { to { box-shadow: 0 0 0 5px color-mix(in srgb, var(--good) 35%, transparent); } }
@media (prefers-reduced-motion: reduce) { .fc-dlg__line.is-turn .fc-dlg__bubble { animation: none; } }

/* Show / hide parts */
.fc-dlg-app.hide-reading [data-part="reading"],
.fc-dlg-app.hide-roman [data-part="roman"],
.fc-dlg-app.hide-en [data-part="en"],
.fc-dlg-app.hide-vi [data-part="vi"] { display: none; }

/* Role-play: your lines are hidden until revealed */
.fc-dlg__line.is-hidden .fc-dlg__bubble > p { display: none; }
.fc-dlg__line.is-hidden .fc-dlg__bubble { background: transparent; border: 2px dashed var(--border); }
.fc-dlg__line.is-hidden .fc-dlg__say { visibility: hidden; }
.fc-dlg__reveal {
	border: 0; padding: 2px 0; background: none; color: var(--good); font: inherit; font-size: .92rem; font-weight: 650; cursor: pointer;
}
.fc-dlg__reveal:hover { text-decoration: underline; }

@media (max-width: 600px) {
	.fc-dlg { padding: 14px 12px 18px; }
	.fc-dlg__head { flex-wrap: wrap; }
	.fc-dlg__play { margin-left: 46px; }
	.fc-dlg__line { max-width: 100%; }
	.fc-dlg-toolbar { position: static; }
}
