/* PolyBuddy 小学数学练习站 - 卡通儿童风格 */

:root {
    --primary: #FF9F43;
    --primary-dark: #EE5A24;
    --secondary: #54A0FF;
    --success: #2ED573;
    --danger: #FF4757;
    --warning: #FFC312;
    --bg: #FFF8E7;
    --card: #FFFFFF;
    --text: #2F3542;
    --text-light: #747D8C;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    --radius: 20px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: "Nunito", "Microsoft YaHei", "PingFang SC", sans-serif;
    background: linear-gradient(135deg, #FFF8E7 0%, #E0F7FA 100%);
    color: var(--text);
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.site-header {
    text-align: center;
    padding: 30px 0 20px;
}

.logo {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-dark);
    text-shadow: 2px 2px 0 #FFE5B0;
    margin: 0;
}

.logo span {
    color: var(--secondary);
}

.subtitle {
    color: var(--text-light);
    margin-top: 8px;
    font-size: 1.1rem;
}

/* Cards */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 24px;
}

.card-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 16px;
    color: var(--text);
}

/* Forms */
.form-group {
    margin-bottom: 18px;
}

label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

input[type="text"],
input[type="password"],
input[type="number"] {
    width: 100%;
    padding: 14px 18px;
    border: 3px solid #ECECEC;
    border-radius: 14px;
    font-size: 1.1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 4px rgba(84, 160, 255, 0.15);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 6px 16px rgba(238, 90, 36, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), #2E86DE);
    color: white;
    box-shadow: 0 6px 16px rgba(46, 134, 222, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #1E90FF);
    color: white;
    box-shadow: 0 6px 16px rgba(46, 213, 115, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #FF6B81);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Auth links */
.auth-link {
    text-align: center;
    margin-top: 18px;
    color: var(--text-light);
}

.auth-link a {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 700;
}

/* Practice page */
.welcome-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.welcome-text {
    font-size: 1.2rem;
    font-weight: 700;
}

.category-select {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.category-card {
    background: var(--card);
    border: 4px solid transparent;
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    box-shadow: var(--shadow);
}

.category-card:hover {
    transform: translateY(-4px);
}

.category-card.active {
    border-color: var(--secondary);
    background: #F0F8FF;
}

.category-card .icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.category-card .name {
    font-weight: 800;
    font-size: 1.1rem;
}

/* Question card */
.question-list {
    display: grid;
    gap: 16px;
}

.question-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #FFFDF5;
    border-radius: 16px;
    padding: 18px;
    border: 3px solid #FFE5B0;
}

.question-number {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--warning);
    color: var(--text);
    font-weight: 800;
    border-radius: 50%;
    flex-shrink: 0;
}

.question-expr {
    font-size: 1.4rem;
    font-weight: 800;
    flex: 1;
    min-width: 0;
}

.question-answer {
    width: 100px;
    flex-shrink: 0;
}

.question-answer input {
    text-align: center;
    font-weight: 800;
}

/* Result */
.result-box {
    text-align: center;
    padding: 30px;
}

.result-score {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.result-message {
    font-size: 1.3rem;
    margin: 12px 0 24px;
}

.wrong-list {
    text-align: left;
    margin-top: 20px;
}

.wrong-item {
    background: #FFF0F0;
    border-left: 5px solid var(--danger);
    padding: 12px 16px;
    margin-bottom: 10px;
    border-radius: 10px;
}

/* Progress */
.progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.progress-card {
    background: linear-gradient(135deg, #FFF8E7, #FFFFFF);
    border-radius: 16px;
    padding: 18px;
    text-align: center;
    box-shadow: var(--shadow);
}

.progress-card .label {
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 8px;
}

.progress-card .value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary-dark);
}

/* Utilities */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 16px;
}

.mb-2 {
    margin-bottom: 16px;
}

/* Animations */
@keyframes pop {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.card {
    animation: pop 0.4s ease-out;
}

/* Responsive */
@media (max-width: 600px) {
    .logo {
        font-size: 1.8rem;
    }

    .question-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .question-answer {
        width: 100%;
    }

    .welcome-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}
