* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f3f4f6;
    color: #1f2937;
    font-family: Arial, Helvetica, sans-serif;
}

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px 60px;
}

.site-header {
    text-align: center;
    margin-bottom: 24px;
}

.site-header h1 {
    margin: 0 0 8px;
    font-size: 2rem;
}

.site-header p,
.muted,
.hint {
    color: #6b7280;
}

.control-panel,
.audio-panel {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,.08);
    margin-bottom: 20px;
}

.control-grid,
.mode-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.mode-grid {
    grid-template-columns: repeat(3, 1fr);
}

label span {
    display: block;
    font-weight: 700;
    margin-bottom: 7px;
}

select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    font-size: 1rem;
}

.validation {
    min-height: 24px;
    color: #b91c1c;
    margin-bottom: 8px;
    font-size: .95rem;
}

button {
    border: 0;
    border-radius: 8px;
    padding: 11px 18px;
    font-size: 1rem;
    cursor: pointer;
}

button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.primary-button {
    background: #2563eb;
    color: white;
}

.secondary-button {
    background: #e5e7eb;
    color: #111827;
}

.audio-panel audio {
    width: 100%;
}

.lesson-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.lesson-heading h2 {
    margin: 0 0 4px;
}

.lesson-heading p {
    margin: 0;
}

.flashcard-section {
    text-align: center;
}

.flashcard {
    width: 100%;
    max-width: 760px;
    height: 330px;
    margin: 20px auto 8px;
    perspective: 1200px;
    cursor: pointer;
    outline: none;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform .55s ease;
    transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-face {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 35px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0,0,0,.12);
    backface-visibility: hidden;
    overflow: auto;
}

.flashcard-back {
    transform: rotateY(180deg);
}

.card-line {
    margin: 8px 0;
    line-height: 1.35;
}

.card-line-english {
    font-size: 2rem;
}

.card-line-hanzi {
    font-size: 3rem;
}

.card-line-pinyin {
    font-size: 1.5rem;
    color: #4b5563;
}

.card-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.hidden {
    display: none;
}

.delete-button {
    background: #b42318;
    color: #ffffff;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
}

.delete-button:hover {
    background: #8f1d15;
}

.delete-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.load-button-container {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.management-link {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 14px;
    text-decoration: none;
    border-radius: 6px;
    background: #666;
    color: white;
    font-size: 14px;
}

.management-link:hover {
    background: #444;
}

@media (max-width: 700px) {
    .control-grid,
    .mode-grid {
        grid-template-columns: 1fr;
    }

    .flashcard {
        height: 280px;
    }

    .card-line-hanzi {
        font-size: 2.4rem;
    }

    .card-line-english {
        font-size: 1.6rem;
    }
}
