@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;700&family=ZCOOL+KuaiLe&family=Kosugi+Maru&family=Mochiy+Pop+One&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Always reserve space for the vertical scrollbar, on every page, whether
   or not that page actually needs to scroll. Without this, switching to a
   taller tab pushes all content left by the scrollbar's width the instant
   it appears (and back right when it disappears) - a jarring shift.
   `scrollbar-gutter` only has an effect once `overflow-y` is something
   other than its default `visible`, so it must be paired with `overflow-y:
   auto` here (this doesn't change scroll behavior, just makes it explicit). */
html {
    scrollbar-gutter: stable;
    overflow-x: hidden;
    overflow-y: auto;
}

/* No overflow-x/overflow-y here: html already clips horizontal overflow as
   the root scrolling element, and setting only overflow-x on body would
   mismatch its unset (visible) overflow-y — the CSS spec force-converts
   that visible side to auto, turning body into a second, redundant
   scrollable box right next to html's (a "double scrollbar" bug). */
body {
    font-family: "Noto Sans TC", "Microsoft JhengHei", Arial, sans-serif;
    background: linear-gradient(160deg, var(--bg-body-1) 0%, var(--bg-body-2) 35%, var(--bg-body-1) 60%, var(--bg-body-3) 100%);
    color: var(--text);
    min-height: 100vh;
}

/* ===== Cute Japanese-style font for headings and buttons ===== */
h1, h2, h3, h4,
.nav-btn, .lang-pill, .lang-btn, .mode-btn, .tool-btn, .btn {
    font-family: 'Kosugi Maru', 'ZCOOL KuaiLe', 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
}

/* ===== Cyrillic fallback (the decorative CJK fonts above have no Cyrillic glyphs) ===== */
:lang(ru) {
    font-family: Arial, "Helvetica Neue", sans-serif;
}

/* ===== Main ===== */
main {
    position: relative;
    z-index: 10;
    max-width: 720px;
    margin: 30px auto;
    padding: 0 20px;
    transition: opacity 0.2s ease;
}

/* ===== Card Corners ===== */
.card-corner {
    position: absolute;
    width: 20px; height: 20px;
    border-color: rgba(244,114,182,0.4);
    border-style: solid;
}
.card-corner.tl { top: 6px; left: 6px; border-width: 2px 0 0 2px; border-radius: 4px 0 0 0; }
.card-corner.tr { top: 6px; right: 6px; border-width: 2px 2px 0 0; border-radius: 0 4px 0 0; }
.card-corner.bl { bottom: 6px; left: 6px; border-width: 0 0 2px 2px; border-radius: 0 0 0 4px; }
.card-corner.br { bottom: 6px; right: 6px; border-width: 0 2px 2px 0; border-radius: 0 0 4px 0; }

/* ===== Cards ===== */
.lang-card,
.setup-card,
.mode-card {
    position: relative;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    padding: 28px 24px;
    border-radius: 16px;
    margin-bottom: 20px;
    border: 1px solid var(--border-card);
    box-shadow:
        var(--shadow-card),
        var(--shadow-card-inset);
}

.lang-card h3,
.setup-card h3,
.mode-card h3 {
    margin: 0 0 18px;
    text-align: center;
    font-size: 1.1rem;
    background: linear-gradient(90deg, var(--text-pink), var(--accent-light-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 3px;
}

.examquiz-hint {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.6;
    margin: -6px 0 18px;
}

/* A heading that follows a button group (e.g. "選擇答案語言" after mode buttons
   in a multi-step flow) needs breathing room above it, not just below. */
.mode-buttons + h3 {
    margin-top: 22px;
}

/* ===== Footer ===== */
footer {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 25px 20px 20px;
}

.footer-sakura {
    color: var(--text-pink);
    font-size: 1.2rem;
    margin-bottom: 6px;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 0 6px rgba(244,114,182,0.4));
}

footer p {
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 2px;
}

.footer-support-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 20px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
    color: #fff;
    font-size: 0.85rem;
    text-decoration: none;
    letter-spacing: 1px;
    box-shadow: 0 4px 14px rgba(var(--accent-pink-rgb), 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.footer-support-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(var(--accent-pink-rgb), 0.5);
}

.footer-links {
    margin-top: 10px;
    letter-spacing: normal;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-decoration: underline;
}

.footer-links a:hover {
    color: var(--text-pink);
}

/* ===== Splash ===== */
.splash-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--bg-splash);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}
.splash-overlay.hide {
    opacity: 0;
    visibility: hidden;
}
.splash-content {
    text-align: center;
}
.splash-logo {
    font-size: 3rem;
    margin-bottom: 16px;
    animation: splashPulse 1.5s ease-in-out infinite;
}
.splash-text {
    font-size: 1.6rem;
    font-weight: bold;
    color: var(--text-pink);
    letter-spacing: 3px;
    margin-bottom: 10px;
}
.splash-sub {
    font-size: 0.85rem;
    color: var(--text-dim);
    animation: splashBlink 1.2s ease-in-out infinite;
}
@keyframes splashPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
}
@keyframes splashBlink {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}
