/* Minna no Nihongo flashcards: practice app (inline + full-screen modal) and single card page.
   Loaded after vocab.css (uses .mn-type, .mn-extra, .mn-ex, .mn-wcard …). */

/* Tokens are repeated on the modal because it is moved to <body> (outside .mn). */
.mn, .mn-fc-modal {
    --fc-ink: #14181f; --fc-ink-2: #2b3340; --fc-muted: #6b7280; --fc-line: #e2ddd4; --fc-paper: #f7f5f1;
    --fc-accent: #0d6efd; --fc-ok: #16a34a; --fc-ng: #dc2626;
    --v-noun:#2563eb; --v-verb:#c0392b; --v-adj:#7c3aed; --v-adv:#0f766e; --v-expr:#b45309; --v-other:#475569;
}
.mn-fc-app, .mn-fc-modal { font-family: "Inter", -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif; color: var(--fc-ink); }
.mn-fc-app .jp, .mn-fc-modal .jp, .mn-fc-single .jp { font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif; }
.mn-fc-app p, .mn-fc-modal p { color: inherit; margin: 0; }
.mn-fc-app [hidden], .mn-fc-single [hidden] { display: none !important; }
.mn-fc-app kbd, .mn-fc-single kbd {
    font: 600 .68rem/1 "Inter", sans-serif; background: rgba(0,0,0,.07); color: inherit; border-radius: 4px;
    padding: .2rem .35rem; margin-left: .35rem; box-shadow: none;
}
@media (pointer: coarse) { .mn-fc-app kbd { display: none; } }

/* ---------------------------------------------------------------- buttons */
.mn-fc-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 1px solid var(--fc-line);
    background: #fff; color: var(--fc-ink-2); font-weight: 700; font-size: .95rem; padding: .7rem 1.2rem;
    border-radius: 999px; cursor: pointer; text-decoration: none; transition: transform .12s ease, filter .12s ease, background .12s ease;
}
.mn-fc-btn:hover { border-color: var(--fc-ink); }
.mn-fc-btn.primary { background: var(--fc-accent); border-color: var(--fc-accent); color: #fff !important; box-shadow: 0 8px 20px -10px rgba(13,110,253,.8); }
.mn-fc-btn.primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.mn-fc-btn.primary kbd { background: rgba(255,255,255,.2); }
.mn-fc-btn.big { font-size: 1.05rem; padding: .9rem 1.6rem; }
.mn-fc-btn:disabled { opacity: .45; cursor: default; transform: none; }
.mn-fc-link { border: 0; background: none; color: var(--fc-accent); font-weight: 600; font-size: .9rem; cursor: pointer; padding: .3rem 0; }
.mn-fc-link:hover { text-decoration: underline; }
.mn-fc-link.danger { color: #9aa1ab; font-size: .8rem; }
.mn-fc-link.danger:hover { color: var(--fc-ng); }
.mn-fc-icon {
    width: 2.6rem; height: 2.6rem; flex: 0 0 auto; border-radius: 50%; border: 1px solid var(--fc-line); background: #fff;
    display: inline-flex; align-items: center; justify-content: center; color: var(--fc-ink-2); font-size: 1.05rem; cursor: pointer;
}
.mn-fc-icon:hover { background: var(--fc-ink); color: #fff; border-color: var(--fc-ink); }
.mn-fc-icon[aria-pressed="true"] { color: #f59e0b; }
.mn-fc-icon[aria-pressed="true"]:hover { color: #fff; }

/* ---------------------------------------------------------------- loading */
.mn-fc-loading { padding: 3rem 1rem; text-align: center; color: var(--fc-muted); display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.mn-fc-spin { width: 30px; height: 30px; border: 3px solid var(--fc-line); border-top-color: var(--fc-accent); border-radius: 50%; animation: mnFcSpin .7s linear infinite; }
@keyframes mnFcSpin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- setup screen */
.mn-fc-setup { display: grid; gap: 1.4rem; }
.mn-fc-h { font-family: "Inter", sans-serif !important; font-size: .74rem !important; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--fc-muted) !important; margin: 0 0 .6rem !important; }
.mn-fc-stats { background: #fff; border: 1px solid var(--fc-line); border-radius: 16px; padding: 1rem 1.15rem; }
.mn-fc-stats-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .7rem; font-size: .95rem; color: var(--fc-ink-2); }
.mn-fc-stats-top b { font-size: 1.5rem; color: var(--fc-ink); }
.mn-fc-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: #eef0f3; gap: 2px; }
.mn-fc-bar span { min-width: 4px; }
.mn-fc-legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; list-style: none; margin: .7rem 0 0; padding: 0; font-size: .8rem; color: var(--fc-muted); }
.mn-fc-legend i { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .35rem; }
.mn-fc-legend b { color: var(--fc-ink); }

.mn-fc-modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .6rem; }
.mn-fc-mode {
    display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: .1rem .7rem; align-items: center;
    text-align: left; background: #fff; border: 1.5px solid var(--fc-line); border-radius: 14px; padding: .8rem .9rem; cursor: pointer;
    color: var(--fc-ink); transition: border-color .12s ease, box-shadow .12s ease;
}
.mn-fc-mode i { grid-row: 1 / span 2; font-size: 1.3rem; width: 2.4rem; height: 2.4rem; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--fc-paper); color: var(--fc-ink-2); }
.mn-fc-mode b { font-size: .92rem; }
.mn-fc-mode small { font-size: .76rem; color: var(--fc-muted); line-height: 1.3; }
.mn-fc-mode:hover { border-color: #b9c3d3; }
.mn-fc-mode[aria-pressed="true"] { border-color: var(--fc-accent); box-shadow: 0 0 0 3px rgba(13,110,253,.12); }
.mn-fc-mode[aria-pressed="true"] i { background: var(--fc-accent); color: #fff; }
.mn-fc-mode:disabled { opacity: .4; cursor: default; }

.mn-fc-chips-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.mn-fc-chips-row + .mn-fc-chips-row { margin-top: .55rem; }
.mn-fc-chip {
    border: 1px solid var(--fc-line); background: #fff; border-radius: 999px; padding: .42rem .85rem; font-size: .84rem; font-weight: 600;
    color: var(--fc-ink-2); cursor: pointer; white-space: nowrap;
}
.mn-fc-chip small { opacity: .6; font-weight: 600; margin-left: .15rem; }
.mn-fc-chip[aria-pressed="true"] { background: var(--fc-ink); border-color: var(--fc-ink); color: #fff; }
.mn-fc-chip:disabled { opacity: .4; cursor: default; }
.mn-fc-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem 1.5rem; }
.mn-fc-start { display: flex; flex-direction: column; align-items: center; gap: .6rem; padding: .4rem 0 .2rem; }
.mn-fc-start .mn-fc-btn { min-width: min(100%, 320px); }
.mn-fc-note { font-size: .85rem; color: var(--fc-muted); }

/* ---------------------------------------------------------------- play screen */
.mn-fc-play { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }
.mn-fc-top { display: flex; align-items: center; gap: .75rem; }
.mn-fc-progress { flex: 1; min-width: 0; }
.mn-fc-progress-bar { height: 8px; background: #e7e9ee; border-radius: 99px; overflow: hidden; }
.mn-fc-progress-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--fc-accent), #6ea8fe); border-radius: 99px; transition: width .3s ease; }
.mn-fc-progress-txt { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 600; color: var(--fc-muted); margin-top: .35rem; }

/* the card (3D flip) */
.mn-fc-card { position: relative; perspective: 1400px; min-height: clamp(260px, 42vh, 380px); cursor: pointer; outline: none; display: grid; }
.mn-fc-card.static { cursor: default; }
.mn-fc-card:focus-visible .mn-fc-face { box-shadow: 0 0 0 3px rgba(13,110,253,.35), 0 18px 40px -22px rgba(20,24,31,.45); }
.mn-fc-face {
    grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 22px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .3rem;
    padding: 2.2rem 1.5rem 1.6rem; transition: transform .5s cubic-bezier(.2,.8,.2,1); position: relative;
    box-shadow: 0 18px 40px -22px rgba(20,24,31,.45), 0 0 0 1px rgba(20,24,31,.06);
}
.mn-fc-face.front { background: #fff; }
.mn-fc-face.back { background: linear-gradient(160deg, #fff 0%, #f3f7ff 100%); transform: rotateY(180deg); justify-content: flex-start; overflow: auto; }
.mn-fc-card[data-flipped="true"] .front { transform: rotateY(-180deg); }
.mn-fc-card[data-flipped="true"] .back { transform: rotateY(0); }
/* choice / typing: the back drops in under the front instead of flipping */
.mn-fc-card.static .back { display: none; }

.mn-fc-card[data-flipped="true"]:not(.static) { cursor: default; }
.mn-fc-play[data-mode^="choice_"] .mn-fc-card[data-flipped="true"],
.mn-fc-play[data-mode="typing"] .mn-fc-card[data-flipped="true"] { perspective: none; }
.mn-fc-play[data-mode^="choice_"] .mn-fc-card[data-flipped="true"] .mn-fc-face,
.mn-fc-play[data-mode="typing"] .mn-fc-card[data-flipped="true"] .mn-fc-face { transform: none; grid-area: auto; }
.mn-fc-play[data-mode^="choice_"] .mn-fc-card[data-flipped="true"] .front,
.mn-fc-play[data-mode="typing"] .mn-fc-card[data-flipped="true"] .front { display: none; }

.mn-fc-face-meta { position: absolute; top: .9rem; left: 1rem; right: 1rem; display: flex; justify-content: space-between; font-size: .72rem; font-weight: 600; color: #9aa1ab; letter-spacing: .06em; text-transform: uppercase; }
.mn-fc-level { --c: #94a3b8; color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); border-radius: 99px; padding: .15rem .55rem; }
.mn-fc-prompt { font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #9aa1ab; margin-bottom: .4rem; }
.mn-fc-word { font-size: clamp(2.4rem, 8vw, 4rem); font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; color: var(--fc-ink); }
.mn-fc-back-inner .mn-fc-word { font-size: clamp(2rem, 6vw, 3rem); }
.mn-fc-reading { font-size: 1.25rem; color: var(--fc-ink-2); }
.mn-fc-romaji { font-size: 1rem; color: #9aa1ab; font-style: italic; }
.mn-fc-meaning { font-size: clamp(1.3rem, 4vw, 1.8rem); font-weight: 700; line-height: 1.3; color: var(--fc-ink); margin-top: .35rem; overflow-wrap: anywhere; }
.mn-fc-chips { display: flex; gap: .4rem; justify-content: center; flex-wrap: wrap; margin-top: .4rem; }
.mn-fc-tap { position: absolute; bottom: .9rem; font-size: .78rem; color: #b0b6bf; }
@media (pointer: coarse) { .mn-fc-tap { font-size: 0; } .mn-fc-tap i { font-size: .9rem; } .mn-fc-tap::after { content: "Tap to flip"; font-size: .78rem; margin-left: .3rem; } }
.mn-fc-back-inner { width: 100%; display: flex; flex-direction: column; align-items: center; gap: .25rem; margin: auto 0; }
.mn-fc-ex { margin-top: 1rem; width: 100%; max-width: 520px; text-align: left; background: #fff; border: 1px solid var(--fc-line); border-left: 3px solid var(--fc-accent); border-radius: 12px; padding: .75rem .9rem; font-size: 1.02rem; }
.mn-fc-ex-m { font-size: .88rem; color: var(--fc-muted); margin-top: .25rem; }
.mn-fc-mini { border: 0; background: none; color: var(--fc-accent); padding: 0 .2rem; cursor: pointer; }
.mn-fc-more { margin-top: .8rem; font-size: .85rem; font-weight: 600; color: var(--fc-accent); text-decoration: none; }
.mn-fc-more:hover { text-decoration: underline; }
.mn-fc-cloze { font-size: clamp(1.35rem, 4.5vw, 1.9rem); font-weight: 600; line-height: 1.55; color: var(--fc-ink); }
.mn-fc-blank { display: inline-block; min-width: 3.5em; border-bottom: 3px solid var(--fc-accent); color: transparent; margin: 0 .1em; }
.mn-fc-blank.filled { color: var(--fc-accent); min-width: 0; padding: 0 .15em; }
.mn-fc-cloze-en { font-size: 1rem; color: var(--fc-muted); margin-top: .4rem; }
.mn-fc-cloze-h { font-size: .92rem; color: var(--fc-muted); margin-bottom: .6rem; }
.mn-fc-play-audio {
    width: 6rem; height: 6rem; border-radius: 50%; border: 0; background: var(--fc-accent); color: #fff; font-size: 2.6rem;
    cursor: pointer; box-shadow: 0 14px 30px -12px rgba(13,110,253,.8); margin: .5rem 0; transition: transform .12s ease;
}
.mn-fc-play-audio:hover { transform: scale(1.05); }

/* hints + tools */
.mn-fc-tools { display: flex; flex-wrap: wrap; gap: .45rem; justify-content: center; }
.mn-fc-tool {
    display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--fc-line); background: #fff; border-radius: 999px;
    padding: .45rem .9rem; font-size: .85rem; font-weight: 600; color: var(--fc-ink-2); cursor: pointer; text-decoration: none;
}
.mn-fc-tool:hover { border-color: var(--fc-ink); color: var(--fc-ink); }
.mn-fc-tool small { color: #9aa1ab; }
.mn-fc-tool:disabled { opacity: .5; cursor: default; }
.mn-fc-hints { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.mn-fc-hints:empty { display: none; }
.mn-fc-hints li { background: #fff8e6; border: 1px solid #fde7b0; border-radius: 10px; padding: .55rem .8rem; font-size: .92rem; color: #7a5a12; }
.mn-fc-hints li::before { content: "💡 "; }

/* answers */
.mn-fc-answer { display: flex; flex-direction: column; gap: .8rem; }
.mn-fc-actions { display: flex; justify-content: center; }
.mn-fc-actions .mn-fc-btn { min-width: min(100%, 320px); }
.mn-fc-ask { text-align: center; font-size: .85rem; font-weight: 600; color: var(--fc-muted); }
.mn-fc-grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.mn-fc-grade {
    --g: #64748b; display: flex; flex-direction: column; align-items: center; gap: .1rem; border: 1.5px solid color-mix(in srgb, var(--g) 35%, #fff);
    background: color-mix(in srgb, var(--g) 7%, #fff); color: var(--g); border-radius: 14px; padding: .7rem .4rem; cursor: pointer; font-size: .95rem;
    transition: transform .1s ease, background .1s ease;
}
.mn-fc-grade small { font-size: .72rem; opacity: .8; font-weight: 600; }
.mn-fc-grade kbd { margin: .2rem 0 0; }
.mn-fc-grade:hover { background: var(--g); color: #fff; transform: translateY(-1px); }
.mn-fc-grade[data-g="again"] { --g: #dc2626; }
.mn-fc-grade[data-g="hard"]  { --g: #d97706; }
.mn-fc-grade[data-g="good"]  { --g: #16a34a; }
.mn-fc-grade[data-g="easy"]  { --g: #2563eb; }

.mn-fc-choices { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.mn-fc-choice {
    display: flex; align-items: center; gap: .6rem; text-align: left; border: 1.5px solid var(--fc-line); background: #fff; border-radius: 14px;
    padding: .85rem 1rem; font-size: 1rem; font-weight: 600; color: var(--fc-ink); cursor: pointer; min-height: 3.6rem; transition: border-color .1s ease;
}
.mn-fc-choices.jp .mn-fc-choice { font-size: 1.15rem; }
.mn-fc-choice kbd { margin: 0; flex: 0 0 auto; }
.mn-fc-choice span { overflow-wrap: anywhere; }
.mn-fc-choice:hover:not(:disabled) { border-color: var(--fc-accent); }
.mn-fc-choice.right { border-color: var(--fc-ok); background: #ecfdf3; color: #166534; }
.mn-fc-choice.wrong { border-color: var(--fc-ng); background: #fef2f2; color: #991b1b; }
.mn-fc-choice:disabled { cursor: default; }
.mn-fc-choice:disabled:not(.right):not(.wrong) { opacity: .55; }

.mn-fc-type { display: flex; gap: .5rem; }
.mn-fc-type input {
    flex: 1; min-width: 0; border: 1.5px solid var(--fc-line); border-radius: 14px; padding: .8rem 1rem; font-size: 1.15rem; outline: none; background: #fff;
}
.mn-fc-type input:focus { border-color: var(--fc-accent); }
.mn-fc-type input.right { border-color: var(--fc-ok); background: #ecfdf3; }
.mn-fc-type input.wrong { border-color: var(--fc-ng); background: #fef2f2; }

.mn-fc-result { border-radius: 14px; padding: .85rem 1rem; display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; }
.mn-fc-result.ok { background: #ecfdf3; color: #166534; }
.mn-fc-result.ng { background: #fef2f2; color: #991b1b; }
.mn-fc-result > span { flex: 1 1 200px; font-size: .92rem; }
.mn-fc-result-btns { display: flex; gap: .6rem; align-items: center; margin-left: auto; }

/* ---------------------------------------------------------------- done screen */
.mn-fc-done { max-width: 640px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 1rem 0; }
.mn-fc-done h3 { font-size: 1.35rem; font-weight: 700; margin: 0; }
.mn-fc-ring {
    --p: 0; width: 9rem; height: 9rem; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: radial-gradient(closest-side, #fff 79%, transparent 80% 100%), conic-gradient(var(--fc-accent) calc(var(--p) * 1%), #e7e9ee 0);
}
.mn-fc-ring b { font-size: 2rem; line-height: 1; }
.mn-fc-ring small { color: var(--fc-muted); font-weight: 600; }
.mn-fc-done-btns { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.mn-fc-missed { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .5rem; text-align: left; }
.mn-fc-missed a { display: block; height: 100%; background: #fff; border: 1px solid var(--fc-line); border-radius: 12px; padding: .6rem .75rem; text-decoration: none; color: var(--fc-ink); }
.mn-fc-missed a:hover { border-color: var(--fc-accent); }
.mn-fc-missed b { display: block; font-size: 1.1rem; }
.mn-fc-missed span { display: block; font-size: .8rem; color: var(--fc-muted); }
.mn-fc-missed em { display: block; font-style: normal; font-size: .85rem; color: var(--fc-ink-2); }

/* ================================================================ full-screen modal (word list page)
   Covers the whole viewport ABOVE the fixed site header (header z-index is up to 1065 !important),
   with its own top bar: title · "Open full page" · Close. Nothing of the page shows through. */
.mn-fc-modal {
    position: fixed; inset: 0; z-index: 2147483000 !important; display: none; flex-direction: column;
    background: var(--fc-paper); height: 100vh; height: 100dvh;
}
.mn-fc-modal.open { display: flex; animation: mnFcIn .22s ease; }
@keyframes mnFcIn { from { opacity: 0; transform: translateY(12px); } }
.mn-fc-modal-bar {
    flex: 0 0 auto; display: flex; align-items: center; gap: .75rem; padding: .7rem 1.25rem; padding-top: calc(.7rem + env(safe-area-inset-top));
    background: linear-gradient(135deg, #14181f 0%, #1d2433 100%); color: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.mn-fc-modal-title { flex: 1; min-width: 0; }
.mn-fc-modal-title b { display: block; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.mn-fc-modal-title span { display: block; font-size: .75rem; color: #9aa9c0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mn-fc-modal-page {
    display: inline-flex; align-items: center; gap: .4rem; color: #fff !important; text-decoration: none; font-weight: 600; font-size: .88rem;
    border: 1px solid rgba(255,255,255,.28); border-radius: 999px; padding: .5rem .95rem; white-space: nowrap;
}
.mn-fc-modal-page:hover { background: rgba(255,255,255,.12); }
.mn-fc-modal-close {
    display: inline-flex; align-items: center; gap: .4rem; border: 0; background: #fff; color: var(--fc-ink); font-weight: 700; font-size: .9rem;
    border-radius: 999px; padding: .55rem 1rem; cursor: pointer; white-space: nowrap;
}
.mn-fc-modal-close:hover { background: #ffc107; }
.mn-fc-modal-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 1.5rem 1.25rem calc(5rem + env(safe-area-inset-bottom)); }
.mn-fc-modal .mn-fc-start { padding-bottom: 1.5rem; }
/* iframe version: the real flashcard page fills the modal under the top bar */
.mn-fc-modal-body.mn-fc-modal-framebody { padding: 0; overflow: hidden; position: relative; display: flex; }
.mn-fc-frame { flex: 1; width: 100%; height: 100%; border: 0; display: block; background: var(--fc-paper); }
.mn-fc-frame-loading { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; color: var(--fc-muted); background: var(--fc-paper); }
.mn-fc-modal.loading .mn-fc-frame-loading { display: flex; }
/* the page inside the iframe: extra room at the bottom so the last buttons are never under the screen edge */
html.mn-fc-in-modal body { padding-bottom: 4rem; }
.mn-fc-modal-body > .mn-fc-app { max-width: 980px; margin: 0 auto; }
@media (max-width: 575.98px) {
    .mn-fc-modal-bar { padding-left: .8rem; padding-right: .8rem; gap: .5rem; }
    .mn-fc-modal-page span { display: none; }
    .mn-fc-modal-page { width: 2.5rem; height: 2.5rem; padding: 0; justify-content: center; font-size: 1.05rem; }
    .mn-fc-modal-close { padding: .55rem .85rem; }
    .mn-fc-modal-body { padding: 1rem .85rem calc(6rem + env(safe-area-inset-bottom)); }
    .mn-fc-modal-body.mn-fc-modal-framebody { padding: 0; }
}
body.mn-modal-lock { overflow: hidden; }

/* ================================================================ flashcard page (inline app) */
.mn-top.mn-fctop::before { content: "単語"; }

.mn-fc-wrap { background: var(--fc-paper); border: 1px solid var(--fc-line); border-radius: 20px; margin-bottom: 1.5rem; overflow: hidden; }
.mn-fc-wrap-bar { display: flex; align-items: center; gap: .6rem; padding: .8rem 1.1rem; border-bottom: 1px solid var(--fc-line); background: #fff; }
.mn-fc-wrap-bar h2 { flex: 1; margin: 0; font-size: 1.05rem !important; font-weight: 700; font-family: "Inter", sans-serif !important; }
.mn-fc-wrap-bar .mn-fc-btn { padding: .5rem .95rem; font-size: .85rem; }
.mn-fc-wrap .mn-fc-app { padding: 1.4rem 1.25rem 1.6rem; }
/* "Full screen" on the page: same look as the modal, above the fixed header */
.mn-fc-wrap.mn-fc-full {
    position: fixed; inset: 0; z-index: 2147483000 !important; border-radius: 0; margin: 0; border: 0;
    display: flex; flex-direction: column; height: 100vh; height: 100dvh;
}
.mn-fc-wrap.mn-fc-full .mn-fc-wrap-bar { padding-top: calc(.8rem + env(safe-area-inset-top)); }
.mn-fc-wrap.mn-fc-full .mn-fc-app { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.mn-fc-wrap.mn-fc-full .mn-fc-app > * { max-width: 980px; margin-left: auto; margin-right: auto; }
@media (max-width: 575.98px) {
    .mn-fc-wrap { border-radius: 16px; margin-left: -.25rem; margin-right: -.25rem; }
    .mn-fc-wrap .mn-fc-app { padding: 1rem .8rem 1.2rem; }
    .mn-fc-wrap-bar h2 { font-size: .95rem !important; }
}

/* card list on the flashcard page (crawlable) */
.mn-fc-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .6rem; }
.mn-fc-list a {
    display: flex; flex-direction: column; height: 100%; background: var(--fc-paper); border: 1px solid var(--fc-line); border-radius: 12px;
    padding: .7rem .85rem; text-decoration: none; color: var(--fc-ink); transition: border-color .12s ease, transform .12s ease;
}
.mn-fc-list a:hover { border-color: var(--fc-accent); background: #fff; transform: translateY(-1px); }
.mn-fc-list b { font-size: 1.2rem; overflow-wrap: anywhere; }
.mn-fc-list .r { font-size: .82rem; color: var(--fc-muted); }
.mn-fc-list .m { font-size: .88rem; color: var(--fc-ink-2); margin-top: .2rem; overflow-wrap: anywhere; }

/* CTA on the word list page */
.mn-fc-cta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin-bottom: 1.25rem; padding: 1.15rem 1.3rem;
    border-radius: 18px; color: #fff; position: relative; overflow: hidden;
    background: radial-gradient(120% 160% at 100% 0%, rgba(13,110,253,.5) 0%, rgba(13,110,253,0) 55%), linear-gradient(135deg, #14181f 0%, #1d2433 100%);
}
.mn-fc-cta::after { content: "札"; position: absolute; right: .8rem; bottom: -1.6rem; font-size: 7rem; font-weight: 700; color: rgba(255,255,255,.06); pointer-events: none; font-family: "Noto Serif JP", serif; }
.mn-fc-cta-txt { flex: 1 1 260px; position: relative; z-index: 1; }
.mn-fc-cta-txt b { display: block; font-size: 1.15rem; color: #fff; }
.mn-fc-cta-txt span { display: block; font-size: .88rem; color: #b8c3d6; margin-top: .2rem; }
.mn-fc-cta-btns { display: flex; flex-wrap: wrap; gap: .5rem; position: relative; z-index: 1; }
.mn-fc-cta .mn-fc-btn.ghost { background: transparent; color: #fff !important; border-color: rgba(255,255,255,.35); }
.mn-fc-cta .mn-fc-btn.ghost:hover { background: rgba(255,255,255,.12); }
.mn-top-links a.mn-fc-toplink { background: #ffc107; color: #14181f !important; border-color: #ffc107; }
@media (max-width: 575.98px) {
    .mn-fc-cta { padding: 1rem; }
    .mn-fc-cta-btns { width: 100%; }
    .mn-fc-cta-btns .mn-fc-btn { flex: 1 1 auto; }
}

/* ================================================================ single card page */
.mn-fc-single .mn-fc-card { min-height: clamp(280px, 45vh, 400px); margin-bottom: 1rem; }
.mn-fc-single .mn-fc-face { padding-top: 2.6rem; }
.mn-fc-single-bar { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; align-items: center; margin-bottom: 1rem; }
.mn-fc-single-grades { background: #fff; border: 1px solid var(--fc-line); border-radius: 16px; padding: 1rem; margin-bottom: 1.5rem; }
.mn-fc-single-grades .mn-fc-ask { margin-bottom: .6rem; }
.mn-fc-saved { text-align: center; font-size: .88rem; font-weight: 600; color: var(--fc-ok); margin-top: .6rem; }
.mn-fc-stat { font-size: .82rem; color: var(--fc-muted); text-align: center; }
.mn-fc-hintlist { list-style: none; margin: 0 0 .8rem; padding: 0; display: grid; gap: .4rem; }
.mn-fc-hintlist li { background: #fff8e6; border: 1px solid #fde7b0; border-radius: 10px; padding: .55rem .8rem; font-size: .95rem; color: #7a5a12; }
.mn-fc-quiz .mn-fc-choices { margin-bottom: .6rem; }
.mn-fc-quiz-result { border-radius: 12px; padding: .7rem .9rem; font-size: .95rem; }
.mn-fc-quiz-result.ok { background: #ecfdf3; color: #166534; }
.mn-fc-quiz-result.ng { background: #fef2f2; color: #991b1b; }
.mn-fc-quiz + .mn-fc-quiz { margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px dashed var(--fc-line); }
.mn-fc-quiz h3 { font-size: 1rem; font-weight: 700; margin: 0 0 .7rem; }
.mn-fc-clozes { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.mn-fc-clozes li { background: var(--fc-paper); border: 1px solid var(--fc-line); border-radius: 12px; padding: .85rem 1rem; }
.mn-fc-clozes .q { font-size: 1.15rem; font-weight: 600; }
.mn-fc-clozes .a { display: none; color: var(--fc-accent); }
.mn-fc-clozes li.revealed .a { display: inline; }
.mn-fc-clozes li.revealed .mn-fc-blank { display: none; }
.mn-fc-clozes .en { font-size: .9rem; color: var(--fc-muted); margin-top: .2rem; }
.mn-fc-clozes .h { display: none; font-size: .88rem; color: var(--fc-muted); }
.mn-fc-clozes li.revealed .h { display: block; }
.mn-fc-clozes .mn-fc-link { margin-top: .3rem; }

@media (max-width: 575.98px) {
    .mn-fc-grades { grid-template-columns: repeat(2, 1fr); }
    .mn-fc-choices { grid-template-columns: 1fr; }
    .mn-fc-choice { min-height: 3.1rem; padding: .7rem .85rem; }
    .mn-fc-face { padding: 2.3rem 1rem 1.4rem; border-radius: 18px; }
    .mn-fc-modes { grid-template-columns: 1fr 1fr; gap: .45rem; }
    .mn-fc-mode { grid-template-columns: 1fr; padding: .7rem; }
    .mn-fc-mode i { grid-row: auto; width: 2rem; height: 2rem; font-size: 1.1rem; }
    .mn-fc-mode small { display: none; }
    .mn-fc-result-btns { width: 100%; justify-content: space-between; }
    .mn-fc-result-btns .mn-fc-btn { flex: 1; }
    .mn-fc-type { flex-direction: column; }
    .mn-fc-type input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .mn-fc-face { transition: none; }
    .mn-fc-modal.open { animation: none; }
}

/* ================================================================ ads (inc/flashcard_lib.php → mn_fc_ad())
   Same style as the Resume Builder ads: slim banner with "Sponsored Ads" label + "Why ads?".
   Size follows the box it sits in (container queries) — never a huge block. */
.mn-fc-ad { container-type: inline-size; width: 100%; max-width: 780px; margin: 1.5rem auto; padding: 8px 10px 10px; border: 1px dashed #d9dce7; border-radius: 12px; background: #fafbfe; text-align: center; }
.mn-fc-ad[hidden] { display: none; }
.mn-fc-ad-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.mn-fc-ad-label { color: #8a90a2; font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; }
.mn-fc-ad-why { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px; border: 0; background: none; color: var(--fc-accent, #0d6efd); font-size: 12px; font-weight: 600; cursor: pointer; }
.mn-fc-ad-why:hover { text-decoration: underline; }
.mn-fc-ad-slot { display: flex; justify-content: center; overflow: hidden; }
.mn-fc-ad-ins { width: 300px; height: 100px; max-width: 100%; }                        /* phones */
@container (min-width: 490px) { .mn-fc-ad-ins { width: 468px; height: 60px; } }       /* tablets / narrow columns */
@container (min-width: 728px) { .mn-fc-ad-ins { width: 728px; height: 90px; } }       /* desktop */
.mn-fc-ad:has(ins[data-ad-status="unfilled"]) { display: none; }                       /* no ad available → no empty box */

/* "Why ads?" dialog + optional ad-blocker popup (above the fixed header and full-screen practice) */
.mn-fc-ads-modal { position: fixed; inset: 0; z-index: 2147483200 !important; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 23, 42, .55); }
.mn-fc-ads-modal[hidden] { display: none; }
.mn-fc-ads-box { position: relative; width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 28px 24px 22px; border-radius: 18px; background: #fff; color: #334155; font-size: 14.5px; line-height: 1.6; text-align: left; box-shadow: 0 30px 70px rgba(15, 23, 42, .35); font-family: "Inter", -apple-system, sans-serif; }
.mn-fc-ads-box h3 { margin: 0 0 10px; color: #0f172a; font-size: 20px; font-weight: 800; }
.mn-fc-ads-box p { margin: 0 0 10px; color: #334155; }
.mn-fc-ads-box ul { margin: 4px 0 12px; padding: 0; list-style: none; }
.mn-fc-ads-box ul li { display: flex; gap: 9px; margin-bottom: 7px; }
.mn-fc-ads-box ul li i { flex-shrink: 0; color: #16a34a; }
.mn-fc-ads-icon { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; margin-bottom: 12px; border-radius: 14px; background: #eef4ff; color: var(--fc-accent, #0d6efd); font-size: 22px; }
.mn-fc-ads-box .mn-fc-ads-thanks { color: var(--fc-accent, #0d6efd); font-weight: 700; }
.mn-fc-ads-x { position: absolute; top: 12px; right: 12px; display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 0; border-radius: 10px; background: #f1f5f9; color: #475569; cursor: pointer; }
.mn-fc-ads-ok { width: 100%; padding: 12px; border: 0; border-radius: 12px; background: var(--fc-accent, #0d6efd); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; }
.mn-fc-ads-ok:hover { filter: brightness(1.08); }
.mn-fc-ads-ok i { margin-right: 6px; }
html.mn-fc-ads-lock { overflow: hidden; }
.mn-fc-adblock { background: rgba(15, 23, 42, .78); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.mn-fc-adblock-icon { background: #fef2f2; color: #dc2626; }
.mn-fc-adblock-steps { margin: 4px 0 12px; padding-left: 22px; }
.mn-fc-adblock-steps li { margin-bottom: 4px; }

/* simple quiz: direction switch above the card */
.mn-fc-dir { display: flex; justify-content: center; gap: .35rem; flex-wrap: wrap; }
.mn-fc-dir button { border: 1px solid var(--fc-line); background: #fff; border-radius: 999px; padding: .4rem .9rem; font-size: .84rem; font-weight: 600; color: var(--fc-ink-2); cursor: pointer; }
.mn-fc-dir button[aria-pressed="true"] { background: var(--fc-ink); border-color: var(--fc-ink); color: #fff; }

/* ================================================================ flip-card deck (practice app)
   Front: the word · tap / Space → 3D flip → back: meaning · "Didn't know" / "I knew it" → card slides away. */
.mn-fc-play .mn-fc-card { animation: mnFcCardIn .32s cubic-bezier(.2,.8,.2,1); }
@keyframes mnFcCardIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
/* a little stack of cards behind the top one */
.mn-fc-play .mn-fc-card::before, .mn-fc-play .mn-fc-card::after {
    content: ""; position: absolute; left: 4%; right: 4%; bottom: -8px; height: 40px; border-radius: 0 0 22px 22px;
    background: #ebe7df; z-index: -1; box-shadow: 0 6px 14px -10px rgba(20,24,31,.4);
}
.mn-fc-play .mn-fc-card::after { left: 8%; right: 8%; bottom: -16px; background: #dfdad0; z-index: -2; }
.mn-fc-play .mn-fc-card { z-index: 0; margin-bottom: 14px; }
.mn-fc-play .mn-fc-face.front { border: 2px solid transparent; }
.mn-fc-play .mn-fc-card[data-fc-flip]:hover .mn-fc-face.front { border-color: rgba(13,110,253,.25); }
.mn-fc-play .mn-fc-face.back { border: 2px solid rgba(13,110,253,.18); }
/* leaving: knew it → right (green glow), didn't know → left (red glow) */
.mn-fc-card.leave-right { animation: mnFcOutR .26s ease-in forwards; }
.mn-fc-card.leave-left  { animation: mnFcOutL .26s ease-in forwards; }
.mn-fc-card.leave-right .mn-fc-face { box-shadow: 0 0 0 3px rgba(22,163,74,.55), 0 18px 40px -22px rgba(20,24,31,.45); }
.mn-fc-card.leave-left  .mn-fc-face { box-shadow: 0 0 0 3px rgba(220,38,38,.5), 0 18px 40px -22px rgba(20,24,31,.45); }
@keyframes mnFcOutR { to { opacity: 0; transform: translateX(60%) rotate(8deg); } }
@keyframes mnFcOutL { to { opacity: 0; transform: translateX(-60%) rotate(-8deg); } }
.mn-fc-card.leave-right::before, .mn-fc-card.leave-right::after, .mn-fc-card.leave-left::before, .mn-fc-card.leave-left::after { display: none; }
/* two big answer buttons */
.mn-fc-grades.two { grid-template-columns: 1fr 1fr; gap: .7rem; }
.mn-fc-grades.two .mn-fc-grade { flex-direction: row; justify-content: center; gap: .5rem; padding: 1rem .6rem; font-size: 1.05rem; border-radius: 16px; }
.mn-fc-grades.two .mn-fc-grade b { display: inline-flex; align-items: center; gap: .4rem; }
.mn-fc-grades.two .mn-fc-grade kbd { margin: 0; }
.mn-fc-grades.two .mn-fc-grade { animation: mnFcCardIn .25s ease; }
/* page: anchors / scrolling stop below the fixed site header */
.mn-fc-wrap, #practice { scroll-margin-top: var(--mn-fc-top, 96px); }
@media (prefers-reduced-motion: reduce) {
    .mn-fc-play .mn-fc-card, .mn-fc-grades.two .mn-fc-grade { animation: none; }
}

/* Modal + page "Full screen" start below the site's fixed bars (marquee + header): JS sets --mn-fc-modal-top. */
.mn-fc-modal, .mn-fc-wrap.mn-fc-full {
    top: var(--mn-fc-modal-top, 0px); bottom: auto;
    height: calc(100vh - var(--mn-fc-modal-top, 0px)); height: calc(100dvh - var(--mn-fc-modal-top, 0px));
}
.mn-fc-modal { border-radius: 16px 16px 0 0; overflow: hidden; box-shadow: 0 -10px 40px -10px rgba(0,0,0,.35); }
.mn-fc-wrap.mn-fc-full { border-radius: 16px 16px 0 0; }
.mn-fc-modal-bar { padding-top: .7rem; }

/* ================================================================ flashcard modal = word modal look (vocab.css .mn-modal …)
   Only the differences: a compact head, a fixed box height, and the iframe filling the body. */
#mnFc .mn-modal-box.mn-fc-box { width: min(980px, 100%); height: min(900px, calc(100vh - 112px)); max-height: none; }
#mnFc .mn-fc-head { padding: 1.1rem 1.75rem 1.15rem; }
#mnFc .mn-fc-head::after { font-size: 6rem; }
#mnFc .mn-fc-head .mn-modal-meta { margin-bottom: .45rem; }
#mnFc .mn-fc-head-title { color: #fff; font-size: clamp(1.35rem, 3vw, 1.75rem); font-weight: 700; line-height: 1.2; margin: 0; position: relative; z-index: 1; font-family: "Inter", sans-serif; }
#mnFc .mn-fc-head .mn-modal-sub { margin-top: .2rem; }
#mnFc .mn-modal-body.mn-fc-framebody { flex: 1; min-height: 0; padding: 0; overflow: hidden; position: relative; display: flex; }
#mnFc .mn-fc-frame { flex: 1; width: 100%; height: 100%; border: 0; display: block; background: var(--paper, #f7f5f1); }
#mnFc .mn-fc-frame-loading { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; color: var(--muted, #6b7280); background: var(--paper, #f7f5f1); z-index: 1; }
#mnFc.loading .mn-fc-frame-loading { display: flex; }
@media (max-width: 575.98px) {
    #mnFc .mn-modal-box.mn-fc-box { height: 92vh; height: 92dvh; }
    #mnFc .mn-fc-head { padding: 1.2rem 1.1rem .9rem; }
    #mnFc .mn-modal-pos { display: none; }
}

/* Leave room for an AdSense anchor ad that covers the top / bottom edge (JS sets --mn-fc-cover-top / -bottom),
   so the ✕, Close and "Open full page" buttons are never under the ad. */
#mnFc { padding-top: calc(88px + var(--mn-fc-cover-top, 0px)); padding-bottom: calc(24px + var(--mn-fc-cover-bottom, 0px)); }
#mnFc .mn-modal-box.mn-fc-box { height: min(900px, calc(100vh - 112px - var(--mn-fc-cover-top, 0px) - var(--mn-fc-cover-bottom, 0px))); }
@media (max-width: 575.98px) {
    #mnFc { padding-top: var(--mn-fc-cover-top, 0px); padding-bottom: var(--mn-fc-cover-bottom, 0px); }
    #mnFc .mn-modal-box.mn-fc-box {
        height: min(92vh, calc(100vh - 12px - var(--mn-fc-cover-top, 0px) - var(--mn-fc-cover-bottom, 0px)));
        height: min(92dvh, calc(100dvh - 12px - var(--mn-fc-cover-top, 0px) - var(--mn-fc-cover-bottom, 0px)));
    }
    /* when an ad sits under the sheet, round the bottom corners too so it reads as a separate box */
    #mnFc[style*="--mn-fc-cover-bottom: 0px"] .mn-modal-box.mn-fc-box { border-radius: 22px 22px 0 0; }
    #mnFc .mn-modal-box.mn-fc-box { border-radius: 22px; }
}

/* "Didn't know / I knew it" also say "Next card →" so people know they move on */
.mn-fc-grades.two .mn-fc-grade { flex-direction: column; gap: .15rem; padding: .8rem .6rem; }
.mn-fc-grades.two .mn-fc-grade small { font-size: .78rem; font-weight: 600; opacity: .85; display: inline-flex; align-items: center; gap: .25rem; }
.mn-fc-grades.two .mn-fc-grade kbd { display: none; }
.mn-fc-ask b { color: var(--fc-ink); }

/* modal head = one row: title on the left, "Open full page" + "Close" on the right. No footer → the flashcards get the space. */
#mnFc .mn-fc-head { display: flex; align-items: center; gap: .6rem; padding: .9rem 1rem .9rem 1.5rem; }
#mnFc .mn-fc-head::after { font-size: 4.5rem; right: 13rem; bottom: -.3em; }
#mnFc .mn-fc-head-text { flex: 1; min-width: 0; position: relative; z-index: 1; }
#mnFc .mn-fc-head-title { font-size: clamp(1.1rem, 2.4vw, 1.4rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mnFc .mn-fc-head-sub { font-size: .8rem; color: #9aa9c0; margin-top: .15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mnFc .mn-fc-hbtn {
    position: relative; z-index: 1; flex: 0 0 auto; display: inline-flex; align-items: center; gap: .45rem;
    height: 2.6rem; padding: 0 1rem; border-radius: 999px; font: 700 .9rem/1 "Inter", sans-serif; cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
#mnFc .mn-fc-hbtn.page { color: #fff !important; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.3); }
#mnFc .mn-fc-hbtn.page:hover { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.55); }
#mnFc .mn-fc-hbtn.close { color: #14181f; background: #fff; border: 1px solid #fff; }
#mnFc .mn-fc-hbtn.close:hover { background: #ffc107; border-color: #ffc107; }
@media (max-width: 575.98px) {
    #mnFc .mn-fc-head { padding: 1.15rem .75rem .75rem 1rem; gap: .45rem; }     /* top: room for the sheet handle */
    #mnFc .mn-fc-head::after { display: none; }
    #mnFc .mn-fc-hbtn { height: 2.4rem; padding: 0 .8rem; font-size: .85rem; }
    /* phones: "Open full page" keeps its text; the title shortens (…) to make room */
    #mnFc .mn-fc-hbtn { height: 2.3rem; padding: 0 .7rem; font-size: .8rem; gap: .35rem; }
    #mnFc .mn-fc-head-title { font-size: 1rem; }
    #mnFc .mn-fc-head-sub { font-size: .72rem; }
}

/* "Show: Hiragana · Romaji" switches above the card (remembered on this device) */
.mn-fc-show { display: flex; justify-content: center; align-items: center; gap: .4rem; flex-wrap: wrap; margin-top: -.35rem; font-size: .8rem; color: var(--fc-muted); }
.mn-fc-show > span { font-weight: 600; }
.mn-fc-switch { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--fc-line); background: #fff; border-radius: 999px; padding: .3rem .75rem; font-size: .8rem; font-weight: 600; color: var(--fc-muted); cursor: pointer; }
.mn-fc-switch i { font-size: .9rem; }
.mn-fc-switch[aria-pressed="true"] { color: var(--fc-accent); border-color: rgba(13,110,253,.45); background: #eef4ff; }
.mn-fc-switch:hover { border-color: var(--fc-accent); }

/* phones: title "Lesson 1" + "Flashcards · 53 cards …" underneath, so the head buttons keep their text */
#mnFc .mn-fc-s-word { display: none; }
@media (max-width: 575.98px) {
    #mnFc .mn-fc-t-word { display: none; }
    #mnFc .mn-fc-s-word { display: inline; }
}
