/* 36 Stratagems Flashcard Trainer — 水墨 (ink-wash) treatment.
   Built on the shared oriental theme (assets/css/oriental.css): rice paper,
   ink, and a single cinnabar seal per card. Class names are fixed by app.js. */

#fc {
    max-width: 700px;
    margin: 0 auto;
    color: var(--o-ink);
}
#fc-app { transition: opacity .3s ease; opacity: 0; }

/* The entrance fade is a nice-to-have; being visible is not. #fc-app starts at
   opacity 0 and is revealed by a rAF callback in app.js — so a script error, or
   any context where rAF never fires, would leave the tool permanently blank.
   This animation forces the resting state visible after 1.2s; the reveal class
   cancels it, so a healthy load still gets the fade and nothing else changes. */
#fc-app { animation: fc-failsafe 0s linear 1.2s forwards; }
#fc-app.fc-in { animation: none; }
@keyframes fc-failsafe { to { opacity: 1; } }

#fc-app.fc-in { opacity: 1; }

/* ── Home ───────────────────────────────────────────────────────────────── */
.fc-head { text-align: center; padding: .5rem 0 1.6rem; position: relative; }
.fc-title {
    font-family: var(--o-serif);
    font-size: clamp(1.9rem, 5.6vw, 2.6rem);
    color: var(--o-ink);
    margin: 0 0 .55rem;
    line-height: 1.1;
}
/* seal-red rule under the title, like a brush underline */
.fc-title::after {
    content: '';
    display: block;
    width: 62px;
    height: 3px;
    margin: .7rem auto 0;
    background: linear-gradient(90deg, transparent, var(--o-seal), transparent);
    border-radius: 2px;
}
.fc-sub {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--o-ink-soft);
    max-width: 46ch;
    margin: 0 auto 1rem;
}
.fc-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-family: var(--o-mono);
    font-size: .7rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--o-seal);
    background: rgba(157, 43, 37, .07);
    border: 1px solid rgba(157, 43, 37, .25);
    padding: .3rem .85rem;
    border-radius: 999px;
}

/* Mode cards — three hanging scrolls 立轴 */
.fc-modes { display: grid; gap: 1rem; }
@media (min-width: 620px) { .fc-modes { grid-template-columns: repeat(3, 1fr); } }
.fc-mode {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: .45rem;
    padding: 1.5rem 1.15rem 1.2rem;
    min-height: 178px;
    text-align: left;
    cursor: pointer;
    border: 1px solid var(--o-line);
    border-radius: 2px;
    background-color: var(--o-paper);
    background-image:
        radial-gradient(120% 80% at 15% 0%, rgba(255, 253, 246, .9) 0%, rgba(255, 253, 246, 0) 60%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)' opacity='0.45'/%3E%3C/svg%3E");
    background-blend-mode: normal, multiply;
    box-shadow: inset 0 0 0 1px rgba(255, 253, 246, .6);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
/* the scroll's top rod */
.fc-mode::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, var(--o-gold), rgba(168, 135, 60, .35));
}
.fc-mode:hover {
    transform: translateY(-4px);
    border-color: var(--o-ink);
    box-shadow: inset 0 0 0 1px rgba(255, 253, 246, .6), 0 16px 32px rgba(22, 21, 15, .16);
}
.fc-mode-t {
    font-family: var(--o-serif);
    font-size: 1.4rem;
    color: var(--o-ink);
    line-height: 1.15;
}
.fc-mode-s { font-size: .9rem; line-height: 1.6; color: var(--o-ink-soft); flex: 1; }
.fc-mode-go { font-family: var(--o-mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--o-seal); }

/* ── Study bar ──────────────────────────────────────────────────────────── */
.fc-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .7rem;
    flex-wrap: wrap;
    padding-bottom: .8rem;
    margin-bottom: 1.1rem;
    border-bottom: 1px solid var(--o-line-soft);
}
.fc-count { font-family: var(--o-mono); font-size: .76rem; letter-spacing: .1em; color: var(--o-ink-soft); }
.fc-check { display: inline-flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--o-ink-soft); cursor: pointer; }
.fc-check input { accent-color: var(--o-seal); }
.fc-mini {
    font-family: var(--o-mono);
    font-size: .72rem;
    letter-spacing: .08em;
    color: var(--o-ink);
    background: transparent;
    border: 1px solid var(--o-line);
    border-radius: 2px;
    padding: .42rem .8rem;
    min-height: 36px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.fc-mini:hover { border-color: var(--o-ink); background: rgba(22, 21, 15, .04); }

/* ── The card 卡 ────────────────────────────────────────────────────────── */
.fc-card {
    perspective: 1600px;
    height: clamp(300px, 52vw, 392px);
    margin-bottom: 1.1rem;
    cursor: pointer;
}
.fc-card .fc-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2.2rem 1.8rem;
    transition: transform .62s cubic-bezier(.36, .12, .2, 1);
}

/* FRONT — rice paper, the character inked on it */
.fc-face-front {
    transform: rotateY(0deg);
    color: var(--o-ink);
    background-color: var(--o-paper);
    background-image:
        radial-gradient(120% 85% at 15% 0%, rgba(255, 253, 246, .95) 0%, rgba(255, 253, 246, 0) 58%),
        radial-gradient(80% 70% at 100% 100%, rgba(196, 180, 146, .38) 0%, rgba(196, 180, 146, 0) 62%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)' opacity='0.5'/%3E%3C/svg%3E");
    background-blend-mode: normal, normal, multiply;
    border: 1px solid var(--o-line);
    box-shadow: inset 0 0 0 1px rgba(255, 253, 246, .7), inset 0 0 0 9px transparent, inset 0 0 0 10px rgba(22, 21, 15, .09), 0 20px 46px rgba(22, 21, 15, .2);
}
/* BACK — ink wash, the meaning revealed */
.fc-face-back {
    transform: rotateY(180deg);
    color: var(--o-paper);
    background-color: #14140f;
    background-image:
        radial-gradient(130% 95% at 22% 0%, rgba(92, 96, 86, .5) 0%, rgba(20, 20, 15, 0) 60%),
        radial-gradient(95% 85% at 88% 100%, rgba(60, 66, 60, .48) 0%, rgba(20, 20, 15, 0) 56%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)' opacity='0.2'/%3E%3C/svg%3E");
    box-shadow: inset 0 0 0 10px rgba(242, 235, 218, .09), 0 20px 46px rgba(22, 21, 15, .3);
}
.fc-card.flipped .fc-face-front { transform: rotateY(-180deg); }
.fc-card.flipped .fc-face-back { transform: rotateY(0deg); }
@media (prefers-reduced-motion: reduce) { .fc-face { transition: none; } }

/* the stratagem itself */
.fc-hz {
    font-family: var(--o-han);
    font-size: clamp(2.7rem, 13vw, 4.2rem);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: .1em;
    text-indent: .1em;           /* balance the trailing letter-spacing */
    color: var(--o-ink);
}
.fc-face-back .fc-hz { color: var(--o-paper); }
.fc-py {
    font-family: var(--o-serif);
    font-style: italic;
    font-size: 1.06rem;
    letter-spacing: .07em;
    color: var(--o-ink-soft);
    margin-top: .7rem;
}
.fc-face-back .fc-py { color: rgba(242, 235, 218, .62); }
.fc-lit-front { font-family: var(--o-serif); font-size: clamp(1.4rem, 5.6vw, 2rem); line-height: 1.32; color: var(--o-ink); }
.fc-lit { font-family: var(--o-serif); font-size: clamp(1.35rem, 5vw, 1.75rem); color: var(--o-paper); margin-bottom: .7rem; line-height: 1.3; }
.fc-gist { font-size: .96rem; line-height: 1.75; color: rgba(242, 235, 218, .8); max-width: 40ch; }
.fc-read {
    display: inline-block;
    margin-top: 1.1rem;
    font-family: var(--o-mono);
    font-size: .72rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--o-gold);
    text-decoration: none;
    border-bottom: 1px solid rgba(168, 135, 60, .45);
    padding-bottom: 2px;
}
.fc-read:hover { color: #d8b463; border-color: #d8b463; }

/* set rubric — reads vertically down the right edge, like a scroll's column */
.fc-set {
    position: absolute;
    top: 22px;
    right: 20px;
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-family: var(--o-han);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .3em;
    color: var(--sc, var(--o-ink-soft));
    opacity: .78;
    max-height: calc(100% - 44px);
    overflow: hidden;
    text-transform: none;
}
.fc-face-back .fc-set { color: rgba(242, 235, 218, .5); }

/* cinnabar seal carrying the stratagem number */
.fc-seal {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--o-han);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.05;
    color: #fdf6ec;
    background: linear-gradient(150deg, var(--o-seal-2), var(--o-seal));
    border-radius: 3px;
    box-shadow: inset 0 0 0 2px rgba(253, 246, 236, .55), 0 2px 7px rgba(157, 43, 37, .32);
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: .02em;
    transform: rotate(-3deg);      /* a chop is never stamped square */
}
.fc-face-back .fc-seal { opacity: .9; }

.fc-hint {
    position: absolute;
    bottom: 18px;
    left: 0; right: 0;
    font-family: var(--o-mono);
    font-size: .64rem;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--o-ink-faint);
}
.fc-face-back .fc-hint { color: rgba(242, 235, 218, .38); }

/* ── Controls ───────────────────────────────────────────────────────────── */
.fc-btn {
    min-height: 46px;
    padding: .68rem 1.15rem;
    font-family: var(--o-serif);
    font-size: .96rem;
    color: var(--o-paper);
    background: linear-gradient(160deg, var(--o-ink-2), var(--o-ink));
    border: 1px solid var(--o-ink);
    border-radius: 2px;
    cursor: pointer;
    box-shadow: 0 2px 0 rgba(22, 21, 15, .25);
    transition: transform .15s, box-shadow .15s, background .15s;
}
.fc-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 rgba(22, 21, 15, .2); }
.fc-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(22, 21, 15, .3); }
.fc-btn.ghost { background: transparent; color: var(--o-ink); border-color: var(--o-line); box-shadow: none; }
.fc-btn.ghost:hover { border-color: var(--o-ink); background: rgba(22, 21, 15, .04); }
.fc-btn.known { background: linear-gradient(150deg, var(--o-jade), #3b5647); border-color: #3b5647; }
.fc-controls { display: flex; gap: .55rem; }
.fc-controls .fc-btn { flex: 1; }
.fc-controls2 { display: flex; align-items: center; justify-content: space-between; gap: .55rem; margin-top: 1rem; flex-wrap: wrap; }

/* ── Quiz ───────────────────────────────────────────────────────────────── */
.fc-qcard {
    position: relative;
    padding: 2.2rem 1.6rem 1.9rem;
    margin-bottom: 1.1rem;
    text-align: center;
    color: var(--o-paper);
    background-color: #14140f;
    background-image:
        radial-gradient(130% 95% at 22% 0%, rgba(92, 96, 86, .5) 0%, rgba(20, 20, 15, 0) 60%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)' opacity='0.2'/%3E%3C/svg%3E");
    border-radius: 3px;
    box-shadow: inset 0 0 0 10px rgba(242, 235, 218, .09);
}
.fc-q-hz { font-family: var(--o-han); font-size: clamp(2.4rem, 12vw, 3.6rem); font-weight: 700; letter-spacing: .1em; text-indent: .1em; }
.fc-q-py { font-family: var(--o-serif); font-style: italic; font-size: 1rem; color: rgba(242, 235, 218, .6); margin-top: .35rem; }
.fc-q-prompt { font-size: .95rem; color: rgba(242, 235, 218, .78); margin-top: .95rem; }
.fc-opts { display: grid; gap: .6rem; }
.fc-opt {
    padding: .95rem 1.15rem;
    text-align: left;
    font-family: var(--o-serif);
    font-size: 1.02rem;
    color: var(--o-ink);
    background: rgba(255, 253, 246, .72);
    border: 1px solid var(--o-line);
    border-radius: 2px;
    min-height: 52px;
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .15s;
}
.fc-opt:hover:not(:disabled) { border-color: var(--o-ink); background: #fffdf6; transform: translateX(3px); }
.fc-opt.right { border-color: var(--o-jade); background: rgba(77, 107, 88, .12); box-shadow: inset 3px 0 0 var(--o-jade); }
.fc-opt.wrong { border-color: var(--o-seal); background: rgba(157, 43, 37, .09); box-shadow: inset 3px 0 0 var(--o-seal); }
.fc-fb { margin: 1rem 0; padding: .95rem 1.15rem; border-radius: 2px; font-size: .96rem; line-height: 1.6; }
.fc-fb.ok { background: rgba(77, 107, 88, .12); color: #2f4a3a; border-left: 3px solid var(--o-jade); }
.fc-fb.no { background: rgba(157, 43, 37, .09); color: #7d231e; border-left: 3px solid var(--o-seal); }
.fc-fb a { color: inherit; font-weight: 700; }

/* ── Browse ─────────────────────────────────────────────────────────────── */
.fc-b-set { margin-bottom: 1.9rem; }
.fc-b-h {
    display: flex;
    align-items: baseline;
    gap: .6rem;
    font-family: var(--o-serif);
    font-size: 1.1rem;
    color: var(--o-ink);
    margin: 0 0 .8rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--o-line-soft);
}
.fc-b-h span { font-family: var(--o-han); font-weight: 700; font-size: 1.3rem; letter-spacing: .08em; }
.fc-b-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: .6rem; }
.fc-b-card {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    padding: .85rem .95rem;
    text-decoration: none;
    border: 1px solid var(--o-line-soft);
    border-radius: 2px;
    background: rgba(255, 253, 246, .6);
    min-height: 44px;
    transition: border-color .15s, background .15s, transform .15s;
}
.fc-b-card:hover { border-color: var(--o-ink); background: #fffdf6; transform: translateY(-2px); }
.fc-b-hz { font-family: var(--o-han); font-size: 1.28rem; font-weight: 700; letter-spacing: .06em; color: var(--o-ink); }
.fc-b-lit { font-size: .78rem; line-height: 1.45; color: var(--o-ink-soft); }

/* ── Misc ───────────────────────────────────────────────────────────────── */
.fc-empty { text-align: center; padding: 2.6rem 1rem; color: var(--o-ink-soft); font-family: var(--o-serif); font-size: 1.1rem; }
.fc-actions { margin-top: 1.1rem; display: flex; justify-content: center; }
.fc-err { text-align: center; padding: 2rem; color: var(--o-seal); }
.fc-share-row { display: flex; gap: .55rem; justify-content: center; margin-top: 1.5rem; }

/* ── Share Studio card (offscreen 1080×1350 export) ─────────────────────── */
.fc-sc-holder { position: absolute; left: -99999px; top: 0; width: 1080px; height: 1350px; overflow: hidden; pointer-events: none; }
.fc-sc { align-items: center; text-align: center; background: radial-gradient(120% 90% at 50% 0%, #24241c 0%, #14140f 62%); color: #f2ebda; }
.fc-sc .sc-eyebrow { font-family: ui-monospace, monospace; font-size: 28px; letter-spacing: .2em; text-transform: uppercase; color: #a8873c; margin: 0 0 60px; }
.fc-sc-num { font-family: 'DM Serif Display', Georgia, serif; font-size: 320px; line-height: .9; color: #bf3a2b; }
.fc-sc-num span { font-size: 130px; color: rgba(242, 235, 218, .5); }
.fc-sc-label { font-size: 44px; color: rgba(242, 235, 218, .65); letter-spacing: .05em; margin: 10px 0 60px; }
.fc-sc-title { font-family: 'DM Serif Display', Georgia, serif; font-size: 70px; line-height: 1.12; max-width: 840px; margin-bottom: 34px; }
.fc-sc-hz { font-family: 'Songti SC', 'SimSun', serif; font-size: 150px; font-weight: 800; color: rgba(242, 235, 218, .13); }
.fc-sc-cta { font-size: 38px; color: #a8873c; margin-bottom: 30px; }
.fc-sc .sc-footer { margin-top: auto; }

/* ── Hero banner — mirrors the strategy finder's, so the pair reads as one set */
.fc-hero-banner {
    position: relative;
    height: clamp(150px, 27vw, 230px);
    border-radius: 3px;
    margin-bottom: 1.5rem;
    background: var(--hero) center 42% / cover no-repeat, var(--o-paper);
    box-shadow: inset 0 0 0 1px var(--o-line-soft);
}
.fc-hero-banner::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--o-gold), transparent);
    opacity: .8;
}

/* mode-card plate — image last and small, per the card rule */
.fc-mode-plate {
    display: block;
    width: 100%;
    height: 84px;
    object-fit: cover;
    border-radius: 2px;
    margin-top: .85rem;
    border-top: 1px solid var(--o-line-soft);
    padding-top: .55rem;
}
