
/* ==================================
   VINASEN FLASHCARDS V6.1
================================== */

.flashcard-page {
    --fc-green: #174c45;
    --fc-gold: #d5a85b;
    --fc-light: #f5f8f7;
    --fc-border: #dce7e3;

    background: var(--fc-light);
    min-height: 85vh;
    padding: 45px 20px;
    font-family: "Times New Roman", serif;
}

.flashcard-page *,
.flashcard-page *::before,
.flashcard-page *::after {
    box-sizing: border-box;
}

.flashcard-page [hidden] {
    display: none !important;
}

.flashcard-container {
    max-width: 850px;
    margin: 0 auto;
}

.flashcard-page [lang="zh-Hant"] {
    font-family: "SimSun", "Microsoft JhengHei", serif;
}

/* TIÊU ĐỀ */

.flashcard-heading {
    text-align: center;
    margin-bottom: 30px;
}

.flashcard-subtitle {
    color: #a47b36;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 3px;
}

.flashcard-heading h1 {
    color: var(--fc-green);
    font-size: 38px;
    margin: 12px 0;
}

.flashcard-heading p {
    color: #64746e;
    font-size: 18px;
}

.text-chinese {
    font-size: 24px !important;
    margin-top: 12px;
}

/* BỘ LỌC */

.flashcard-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
    background: white;
    padding: 20px;
    border: 1px solid var(--fc-border);
    border-radius: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    color: var(--fc-green);
    font-size: 17px;
    font-weight: bold;
}

.flashcard-page select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccd9d4;
    border-radius: 8px;
    background: white;
    color: var(--fc-green);
    font-family: inherit;
    font-size: 16px;
    cursor: pointer;
}

/* CÀI ĐẶT HỌC TẬP */

.settings-panel,
.keyboard-guide {
    background: white;
    border: 1px solid var(--fc-border);
    border-radius: 14px;
    margin-top: 20px;
    overflow: hidden;
}

.settings-panel summary,
.keyboard-guide summary {
    padding: 18px 20px;
    color: var(--fc-green);
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
}

.settings-content {
    padding: 0 20px 20px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.setting-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px;
    background: var(--fc-light);
    border-radius: 9px;
    color: var(--fc-green);
    font-size: 17px;
    cursor: pointer;
}

.setting-option input {
    width: 18px;
    height: 18px;
    accent-color: var(--fc-green);
    cursor: pointer;
    flex-shrink: 0;
}

.settings-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

#autoPlayBtn {
    background: var(--fc-green);
    color: white;
    border: 1px solid var(--fc-green);
}

#autoPlayBtn.playing {
    background: #a47b36;
    border-color: #a47b36;
}

#fullscreenBtn {
    background: white;
    color: var(--fc-green);
    border: 1px solid var(--fc-green);
}

#sessionNotice {
    color: #64746e;
    font-size: 14px;
    margin-top: 14px;
}

/* THỐNG KÊ */

.flashcard-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
    margin: 25px 0;
}

.stat-box {
    padding: 20px 10px;
    background: white;
    border: 1px solid var(--fc-border);
    border-radius: 12px;
    text-align: center;
}

.stat-box span {
    display: block;
    color: #64746e;
    font-size: 16px;
}

.stat-box strong {
    display: block;
    color: var(--fc-green);
    font-size: 32px;
    margin-top: 8px;
}

#knownWords {
    color: #27865b;
}

#unknownWords {
    color: #a47b36;
}

/* TIẾN ĐỘ */

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    color: var(--fc-green);
    font-size: 17px;
}

.progress-track,
.auto-progress-track {
    height: 8px;
    background: var(--fc-border);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 12px;
}

#progressBar {
    width: 0;
    height: 100%;
    background: var(--fc-green);
    transition: width 0.25s ease;
}

.auto-progress-track {
    height: 4px;
}

#autoProgress {
    width: 0;
    height: 100%;
    background: var(--fc-gold);
}

#flashcardStatus {
    text-align: center;
    color: var(--fc-green);
    padding: 15px;
}

/* FLASHCARD */

#studyArea {
    perspective: 1500px;
}

.flashcard {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;

    position: relative;
    width: 100%;
    min-height: 360px;
    padding: 65px 30px 40px;

    border: 2px solid var(--fc-green);
    border-radius: 24px;

    background: var(--fc-green);
    color: white;

    font-family: inherit;
    overflow-wrap: anywhere;
    cursor: pointer;

    box-shadow: 0 12px 30px rgba(23, 76, 69, 0.12);

    transform-style: preserve-3d;
    transform-origin: center;

    transition:
        transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        background-color 0.3s ease,
        box-shadow 0.3s ease;
}

.flashcard.flipped {
    background: white;
    color: var(--fc-green);
}

/* HIỆU ỨNG LẬT THẺ 3D */

.flashcard.flip-out {
    transform: rotateY(90deg) scale(0.97);
}

.flashcard.flip-in {
    transform: rotateY(-90deg) scale(0.97);
    transition: none;
}

.flashcard.is-animating {
    pointer-events: none;
    will-change: transform;
}

@media (hover: hover) {
    .flashcard:not(.is-animating):hover {
        box-shadow: 0 18px 40px rgba(23, 76, 69, 0.20);
    }
}

#cardBook {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 14px;
    color: var(--fc-gold);
}

#cardSide {
    color: var(--fc-gold);
    font-size: 14px;
    letter-spacing: 2px;
}

#cardWord {
    font-size: clamp(30px, 7vw, 58px);
    line-height: 1.4;
}

#cardPinyin {
    color: var(--fc-gold);
    font-size: 26px;
}

#cardZhuyin {
    font-size: 24px;
}

#cardReadingNote {
    font-size: 13px;
    opacity: 0.8;
}

#cardPos {
    font-size: 17px;
    line-height: 1.6;
}

#cardMeaning {
    font-size: 32px;
    font-weight: bold;
    line-height: 1.5;
}

.flip-hint {
    font-size: 14px;
    opacity: 0.8;
    margin-top: 15px;
}

/* CÁC NÚT */

.flashcard-page button:not(.flashcard) {
    padding: 12px 16px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 16px;
    cursor: pointer;

    transition:
        background-color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.flashcard-page button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.flashcard-page button:not(.flashcard):active:not(:disabled) {
    transform: scale(0.97);
}

.audio-controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
}

.audio-controls button,
#shuffleBtn,
#speakExample {
    background: white;
    color: var(--fc-green);
    border: 1px solid #ccd9d4;
}

#flashcardRate {
    width: auto;
}

.flashcard-navigation,
.flashcard-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.flashcard-navigation button {
    background: white;
    color: var(--fc-green);
    border: 1px solid var(--fc-green);
}

#unknownBtn {
    background: #fff5f2;
    color: #b34b3c;
    border: 1px solid #edc9c1;
}

#knownBtn {
    background: var(--fc-green);
    color: white;
    border: 1px solid var(--fc-green);
}

#knownBtn:hover {
    background: #24665d;
}

/* CÂU VÍ DỤ */

.flashcard-example {
    padding: 25px;
    margin-top: 25px;
    background: white;
    border: 1px solid var(--fc-border);
    border-left: 4px solid var(--fc-gold);
    border-radius: 12px;
}

.flashcard-example h3 {
    color: var(--fc-green);
    margin-bottom: 15px;
}

#exampleChinese {
    font-size: 25px;
    line-height: 1.7;
}

#examplePinyin {
    color: #a47b36;
    font-size: 18px;
    line-height: 1.6;
    margin: 10px 0;
}

#exampleMeaning {
    font-size: 19px;
    line-height: 1.6;
    margin-bottom: 15px;
}

/* PHÍM TẮT */

.keyboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
    padding: 0 20px 20px;
    color: var(--fc-green);
}

.keyboard-grid kbd {
    display: inline-block;
    min-width: 30px;
    padding: 5px 8px;
    margin-right: 6px;
    text-align: center;
    background: #e8f1ee;
    border: 1px solid #ccd9d4;
    border-radius: 5px;
    font-size: 13px;
}

/* TOÀN MÀN HÌNH */

.flashcard-page:fullscreen {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background: var(--fc-light);
    padding: 30px;
}

.flashcard-page:fullscreen .flashcard-container {
    max-width: 1000px;
}

.flashcard-page:fullscreen .flashcard {
    min-height: 420px;
}

/* CUỐI TRANG */

.flashcard-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 30px;
}

.flashcard-bottom a {
    color: var(--fc-green);
    text-decoration: none;
    font-weight: bold;
}

#resetProgress {
    background: transparent;
    color: #777;
    border: 1px solid #ccc;
}

.flashcard-footer {
    text-align: center;
    padding: 30px 15px;
    background: #174c45;
    color: white;
    font-family: "Times New Roman", serif;
    line-height: 1.8;
}

/* ĐIỆN THOẠI */

@media (max-width: 600px) {

    .flashcard-page {
        padding: 25px 15px;
    }

    .flashcard-heading h1 {
        font-size: 29px;
    }

    .flashcard-filters {
        grid-template-columns: 1fr;
    }

    .settings-grid {
        gap: 8px;
    }

    .setting-option {
        padding: 10px;
        font-size: 15px;
    }

    .flashcard-stats {
        gap: 8px;
    }

    .stat-box strong {
        font-size: 26px;
    }

    .stat-box span {
        font-size: 14px;
    }

    .flashcard {
        min-height: 300px;
        padding: 60px 20px 30px;
    }

    #cardPinyin {
        font-size: 22px;
    }

    #cardZhuyin {
        font-size: 20px;
    }

    #cardMeaning {
        font-size: 26px;
    }

    .keyboard-grid {
        grid-template-columns: 1fr;
    }

    .flashcard-page:fullscreen {
        padding: 15px;
    }

}

@media (prefers-reduced-motion: reduce) {

    .flashcard,
    #progressBar {
        transition: none !important;
    }

}
