@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

:root {
    --font-family: 'Poppins', sans-serif;
    --card-bg-color: rgba(255, 255, 255, 0.7);
    --card-border-color: rgba(255, 255, 255, 0.3);
    --text-primary: #1d2129;
    --text-secondary: #4b4f56;
    --shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
    --border-radius: 16px;
    --accent-blue: #4a69bd;
    --positive-green: #00b894;
    --negative-red: #d63031;
}

body {
    font-family: var(--font-family);
    margin: 0;
    background: linear-gradient(45deg, #6a82fb, #fc5c7d, #5de6de, #b983ff);
    background-size: 400% 400%;
    animation: gradientBG 18s ease infinite;
    /* New Flexbox Layout */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.page-header {
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.progress-container {
    background: var(--card-bg-color);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--card-border-color);
    box-shadow: var(--shadow);
    padding: 8px 10px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: fit-content; /* Make it only as wide as its content */
}

/* --- Main Content Area --- */
.main-content {
    flex-grow: 1; /* This makes the main section take up all available space */
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.card-container {
    background: var(--card-bg-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border-color);
    padding: 30px 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    width: 100%;
    max-width: 550px;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

.card-container.fading {
    transform: scale(0.98);
    opacity: 0;
}

#flashcard { min-height: 250px; display: flex; flex-direction: column; justify-content: center; margin-bottom: 20px; }
.kanji { font-size: 4.5em; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; }
.reading { font-size: 1.7em; font-weight: 600; color: var(--text-secondary); margin-bottom: 15px; }
.english { font-size: 1.2em; color: var(--text-secondary); }

/* --- Footer --- */
.page-footer {
    width: 100%;
    padding: 15px 30px;
    box-sizing: border-box;
    color: var(--text-secondary);
}
.footer-content { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; font-size: 0.9em; }

/* --- Other styles (buttons, modals, etc.) remain largely the same --- */
.icon-button { background: none; border: none; font-size: 1.5em; cursor: pointer; padding: 0; line-height: 1; transition: transform 0.2s; color: var(--text-secondary); }
.icon-button:hover { transform: scale(1.2); color: var(--text-primary); }
.reading, .english { line-height: 1.6; opacity: 0; transform: translateY(10px); transition: opacity 0.4s ease-out, transform 0.4s ease-out; }
.reading.visible, .english.visible { opacity: 1; transform: translateY(0); }
#button-container { height: 50px; display: flex; justify-content: center; gap: 15px; }
button { font-family: var(--font-family); font-weight: 600; color: white; border: none; padding: 12px 25px; font-size: 1.2em; border-radius: 10px; cursor: pointer; transition: all 0.2s ease-in-out; min-width: 180px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
button:hover { transform: translateY(-3px); box-shadow: 0 7px 14px rgba(0,0,0,0.1); filter: brightness(1.1); }
button:active { transform: translateY(1px); box-shadow: 0 2px 3px rgba(0,0,0,0.15); filter: brightness(0.95); }
#reveal-button { background: linear-gradient(45deg, #5c7eec, var(--accent-blue)); }
#hard-button { background: linear-gradient(45deg, #e55d5d, var(--negative-red)); }
#easy-button { background: linear-gradient(45deg, #10ac84, var(--positive-green)); }
#clear-hard-words-button { background-color: var(--text-secondary); min-width: 120px; font-size: 1em; }
.modal-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); display: flex; justify-content: center; align-items: center; z-index: 100; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.modal-backdrop:not(.hidden) { opacity: 1; pointer-events: all; }
.modal-content { background: var(--card-bg-color); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--card-border-color); padding: 30px; border-radius: var(--border-radius); width: 90%; max-width: 500px; position: relative; box-shadow: var(--shadow); }
.close-button { position: absolute; top: 15px; right: 15px; font-size: 1.5em; cursor: pointer; color: var(--text-secondary); }
.list-container { max-height: 40vh; overflow-y: auto; margin: 20px 0; text-align: left; padding-right: 10px; }
#hard-words-list { list-style: none; padding: 0; }
#hard-words-list li { padding: 10px; border-bottom: 1px solid rgba(0,0,0,0.1); }
#hard-words-list li:last-child { border-bottom: none; }
#hard-words-list .kanji-item { font-weight: 600; font-size: 1.2em; }
.hidden { display: none !important; }
.social-links { display: flex; align-items: center; }
.social-links a { color: var(--text-secondary); font-size: 1.5em; margin-left: 20px; transition: all 0.2s ease-in-out; }
.social-links a:hover { color: var(--accent-blue); transform: scale(1.2); }

/* --- RESPONSIVE DESIGN FOR MOBILE --- */
@media (max-width: 600px) {
    body {
        /* Allow body to scroll slightly if needed on small screens */
        min-height: auto;
    }
    .page-header, .page-footer {
        position: static; /* Let header/footer be part of the normal flow */
        padding: 15px;
    }
    .main-content {
        padding: 15px;
    }
    .kanji {
        font-size: 3.5em; /* Smaller font on mobile */
    }
    .reading {
        font-size: 1.5em;
    }
    .english {
        font-size: 1.1em;
    }
    .button-container {
        flex-direction: column; /* Stack buttons vertically */
        height: auto;
        margin-top: 15px;
    }
    button {
        width: 100%;
        min-width: unset;
    }
    .footer-content {
        flex-direction: column; /* Stack footer content */
        gap: 10px;
    }
}