:root {
    --bg-color: #f0f8ff;
    --card-bg: #ffffff;
    --primary-color: #ff7b54;
    --secondary-color: #4facfe;
    --text-color: #333333;
    --green: #4ade80;
    --red: #f87171;
    --shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    --radius: 20px;
}

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

body {
    font-family: 'ZCOOL KuaiLe', cursive, 'Comic Sans MS', sans-serif;
    background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    max-width: 600px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px;
    margin: 20px;
    position: relative;
    overflow: hidden;
}

.page {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.page.active {
    display: block;
}

h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 25px;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.settings-card, .stats-card {
    background: #fdfbfb;
    border: 2px dashed #a1c4fd;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
}

.setting-item {
    margin-bottom: 15px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.setting-item input[type="number"] {
    width: 80px;
    padding: 8px;
    font-size: 1.2rem;
    border: 2px solid #a1c4fd;
    border-radius: 8px;
    text-align: center;
    outline: none;
}

.setting-item input[type="number"]:focus {
    border-color: var(--primary-color);
}

.checkbox-group {
    flex-direction: column;
    align-items: flex-start;
}

.checkbox-group label {
    margin-bottom: 10px;
}

.checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

.checkboxes label {
    cursor: pointer;
    background: #eef2f3;
    padding: 8px 15px;
    border-radius: 20px;
    transition: all 0.2s;
    user-select: none;
}

.checkboxes label:hover {
    background: #d4e0e5;
}

.checkboxes input[type="checkbox"] {
    accent-color: var(--primary-color);
    transform: scale(1.3);
    margin-right: 5px;
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn {
    width: 100%;
    padding: 15px;
    font-size: 1.5rem;
    font-family: inherit;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: bold;
    color: white;
}

.btn:active {
    transform: scale(0.95);
}

.primary-btn {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
    background: var(--primary-color);
    box-shadow: 0 4px 10px rgba(255, 123, 84, 0.4);
}
.primary-btn:hover {
    background: #ff6a3d;
    box-shadow: 0 6px 15px rgba(255, 123, 84, 0.5);
}

.secondary-btn {
    background: var(--secondary-color);
    box-shadow: 0 4px 10px rgba(79, 172, 254, 0.4);
}
.secondary-btn:hover {
    background: #3a97ea;
    box-shadow: 0 6px 15px rgba(79, 172, 254, 0.5);
}

.normal-btn {
    background: #9ca3af;
}
.normal-btn:hover {
    background: #6b7280;
}

/* 练习页 */
.header {
    display: flex;
    justify-content: space-between;
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.timer-bar-container {
    width: 100%;
    height: 15px;
    background: #eef2f3;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 40px;
}

.timer-bar {
    height: 100%;
    background: var(--green);
    width: 100%;
    transition: width 0.1s linear, background-color 0.3s;
}

.question-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    font-size: 4rem;
    font-weight: bold;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.number, .operator {
    color: var(--primary-color);
    text-shadow: 2px 2px 0px #ffe4cc;
    font-family: Arial, Helvetica, sans-serif;
}

#answer-input {
    width: 120px;
    height: 80px;
    font-size: 3.5rem;
    font-family: Arial, Helvetica, sans-serif;
    text-align: center;
    border: 4px solid var(--secondary-color);
    border-radius: 15px;
    outline: none;
    color: var(--text-color);
    transition: border-color 0.3s;
}

#answer-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(255, 123, 84, 0.3);
}

.mic-btn {
    font-size: 2.5rem;
    background: #eef2f3;
    border: 2px solid #a1c4fd;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    outline: none;
    margin-left: 10px;
}
.mic-btn:hover {
    background: #d4e0e5;
}
.mic-btn.listening {
    background: #ff9a9e;
    border-color: #ff7b54;
    animation: pulse 1s infinite;
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.feedback {
    text-align: center;
    font-size: 3rem;
    height: 60px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
}

.feedback.show {
    opacity: 1;
    transform: scale(1.2);
}

.feedback.correct {
    color: var(--green);
}

.feedback.wrong {
    color: var(--red);
}

/* 结果页 */
.stats-card p {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.text-green { color: var(--green); font-weight: bold; }
.text-red { color: var(--red); font-weight: bold; }

.wrong-list-container {
    margin: 20px 0;
    max-height: 200px;
    overflow-y: auto;
    border: 2px solid #fee2e2;
    border-radius: 10px;
    padding: 10px;
    background: #fff5f5;
}

.wrong-list-container h3 {
    color: var(--red);
    margin-bottom: 10px;
    text-align: center;
}

#wrong-list {
    list-style: none;
    font-size: 1.2rem;
}

#wrong-list li {
    padding: 5px 0;
    border-bottom: 1px dashed #fca5a5;
    display: flex;
    justify-content: space-between;
    font-family: Arial, Helvetica, sans-serif;
}

#wrong-list li:last-child {
    border-bottom: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}
.shake {
    animation: shake 0.4s;
}
