/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #FF6B6B;
    --secondary: #4ECDC4;
    --accent: #FFE66D;
    --purple: #A78BFA;
    --blue: #60A5FA;
    --green: #34D399;
    --orange: #FB923C;
    --pink: #F472B6;
    --bg: #FFF5F5;
    --card-bg: #FFFFFF;
    --text: #2D3436;
    --text-light: #636E72;
    --shadow: 0 4px 15px rgba(0,0,0,0.1);
    --radius: 20px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 80px;
    overflow-x: hidden;
}

/* 页面切换 */
.page {
    display: none;
    padding: 20px;
    padding-bottom: 100px;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

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

/* 首页样式 */
.header {
    text-align: center;
    padding: 20px 0;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.logo .emoji {
    font-size: 48px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.logo h1 {
    font-size: 32px;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-light);
    margin-top: 8px;
    font-size: 16px;
}

/* 版本号 + 更新按钮行 */
.version-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
}

.version-text {
    color: var(--text-light);
    font-size: 12px;
    opacity: 0.7;
}

.update-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 2px solid var(--primary);
    border-radius: 50%;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.3s;
    padding: 0;
}

.update-icon-btn:active {
    background: var(--primary);
    color: white;
    transform: scale(0.9);
}

.update-icon-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.update-icon-btn:disabled .update-arrow {
    animation: spin 0.8s linear infinite;
}

.update-arrow {
    display: block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 虚拟宠物猫 */
.cat-mascot {
    position: fixed;
    top: 10px;
    right: 15px;
    z-index: 200;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
    width: 100px;
    height: 100px;
    overflow: visible;
}

.cat-mascot:active {
    cursor: grabbing;
}

.cat-mascot.dragging .cat-image {
    animation: catWobble 0.4s ease-in-out infinite;
}

.cat-mascot.dropping .cat-image {
    animation: catDrop 0.5s ease-out;
}

/* 真实猫咪图片 / SVG (inline) */
.cat-image {
    width: 100px;
    height: 100px;
    display: block;
    background: transparent;
}

.cat-image svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* 眼睛眨眼动画 */
.cat-eye {
    transform-origin: 50% 50%;
    transform-box: fill-box;
    animation: catBlink 4s infinite;
    animation-delay: 1.5s;
}
.cat-eye-right {
    transform-origin: 50% 50%;
    transform-box: fill-box;
    animation: catBlink 4s infinite;
    animation-delay: 1.5s;
}

@keyframes catBlink {
    0%, 92%, 100% { transform: scaleY(1); }
    96% { transform: scaleY(0.08); }
}

/* 语音气泡 - 3D popup 设计 */
.cat-speech-bubble {
    position: fixed;
    background: linear-gradient(135deg, #FFFFFF 0%, #F0F4FF 100%);
    border-radius: 16px;
    padding: 10px 18px;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.08),
        0 10px 24px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(100, 140, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    max-width: 250px;
    overflow: visible;
    z-index: 210;
    pointer-events: auto;
    animation: bubblePop3D 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: none;
    max-width: 300px;
    white-space: normal;
    border: 2px solid rgba(100, 140, 255, 0.2);
}

@keyframes bubblePop3D {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(-10px);
    }
    60% {
        transform: scale(1.08) translateY(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.cat-speech-bubble::after {
    content: '';
    position: absolute;
    top: 14px;
    left: -8px;
    transform: none;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid #F0F4FF;
    filter: drop-shadow(-1px 1px 1px rgba(0, 0, 0, 0.1));
}

.cat-speech-bubble::before {
    content: '';
    position: absolute;
    top: 12px;
    left: -11px;
    transform: none;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 10px solid rgba(100, 140, 255, 0.2);
}

/* Arrow on right side (bubble left of pet) */
.cat-speech-bubble.arrow-right::after {
    left: auto;
    right: -8px;
    border-right: none;
    border-left: 8px solid #F0F4FF;
    filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.1));
}

.cat-speech-bubble.arrow-right::before {
    left: auto;
    right: -11px;
    border-right: none;
    border-left: 10px solid rgba(100, 140, 255, 0.2);
}

/* Arrow on top (bubble below pet) */
.cat-speech-bubble.arrow-top::after {
    top: -8px;
    left: 50%;
    margin-left: -8px;
    border-top: none;
    border-bottom: 8px solid #F0F4FF;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    filter: drop-shadow(0 -1px 1px rgba(0, 0, 0, 0.1));
}

.cat-speech-bubble.arrow-top::before {
    top: -11px;
    left: 50%;
    margin-left: -10px;
    border-top: none;
    border-bottom: 10px solid rgba(100, 140, 255, 0.2);
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
}

/* Arrow on bottom (bubble above pet) */
.cat-speech-bubble.arrow-bottom::after {
    bottom: -8px;
    top: auto;
    left: 50%;
    margin-left: -8px;
    border-bottom: none;
    border-top: 8px solid #F0F4FF;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
}

.cat-speech-bubble.arrow-bottom::before {
    bottom: -11px;
    top: auto;
    left: 50%;
    margin-left: -10px;
    border-bottom: none;
    border-top: 10px solid rgba(100, 140, 255, 0.2);
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
}

/* 每日进度 */
.daily-progress {
    display: flex;
    gap: 15px;
    margin: 20px 0;
}

.progress-card {
    flex: 1;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow);
}

.progress-icon {
    font-size: 32px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border-radius: 15px;
}

.progress-info {
    display: flex;
    flex-direction: column;
}

.progress-title {
    font-size: 12px;
    color: var(--text-light);
}

.progress-count {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary);
}

/* 菜单网格 */
.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
}

.menu-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 25px 15px;
    text-align: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.menu-item:active {
    transform: scale(0.95);
}

.menu-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.menu-item:nth-child(1) .menu-icon { background: linear-gradient(135deg, var(--blue), var(--secondary)); }
.menu-item:nth-child(2) .menu-icon { background: linear-gradient(135deg, var(--purple), var(--pink)); }
.menu-item:nth-child(3) .menu-icon { background: linear-gradient(135deg, var(--green), var(--secondary)); }
.menu-item:nth-child(4) .menu-icon { background: linear-gradient(135deg, var(--orange), var(--primary)); }

.menu-icon {
    width: 70px;
    height: 70px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
}

.menu-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.menu-desc {
    font-size: 12px;
    color: var(--text-light);
}

/* 页面头部 */
.page-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.back-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: none;
    background: var(--card-bg);
    box-shadow: var(--shadow);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-header h2 {
    font-size: 24px;
    margin: 0;
}

.page-header .header-sub {
    font-size: 13px;
    color: var(--text-light);
    margin: 0 0 0 0;
}

/* 词汇标签 */
.vocab-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.tab {
    padding: 10px 18px;
    border-radius: 25px;
    border: 2px solid var(--secondary);
    background: transparent;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.tab.active {
    background: var(--secondary);
    color: white;
}

/* 闪卡 */
.flashcard-container {
    perspective: 1000px;
    margin: 20px 0;
}

.flashcard {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-height: 350px;
    cursor: pointer;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    position: relative;
}

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

.card-front, .card-back {
    padding: 30px;
    text-align: center;
    backface-visibility: hidden;
}

.card-back {
    transform: rotateY(180deg);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-emoji {
    font-size: 80px;
    margin-bottom: 20px;
}

.card-meaning {
    font-size: 20px;
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 15px;
}

.meaning-malay {
    font-size: 28px;
    font-weight: bold;
    color: var(--primary);
}

.meaning-english {
    font-size: 18px;
    color: var(--text);
}

.meaning-chinese {
    font-size: 18px;
    color: var(--text-light);
}

.card-sentence-section {
    margin-top: 10px;
}

.card-sentence {
    font-size: 18px;
    color: var(--text);
    margin-bottom: 10px;
    font-style: italic;
}

.card-sentence-meaning {
    font-size: 16px;
    color: var(--text-light);
}

/* 卡片操作按钮 */
.card-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.action-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid var(--secondary);
    background: transparent;
    color: var(--secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.action-btn.active {
    background: var(--secondary);
    color: white;
}

.action-btn:hover {
    background: var(--secondary);
    color: white;
}

/* 卡片导航 */
.card-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
}

.nav-btn {
    padding: 12px 20px;
    border-radius: 25px;
    border: none;
    background: var(--secondary);
    color: white;
    font-size: 14px;
    cursor: pointer;
}

.card-counter {
    font-size: 16px;
    color: var(--text-light);
}

/* 语法列表 */
.grammar-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.grammar-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s;
}

.grammar-item:active {
    transform: scale(0.98);
}

.grammar-icon {
    width: 50px;
    height: 50px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: white;
}

.grammar-item:nth-child(1) .grammar-icon { background: var(--blue); }
.grammar-item:nth-child(2) .grammar-icon { background: var(--green); }
.grammar-item:nth-child(3) .grammar-icon { background: var(--purple); }
.grammar-item:nth-child(4) .grammar-icon { background: var(--orange); }
.grammar-item:nth-child(5) .grammar-icon { background: var(--pink); }
.grammar-item:nth-child(6) .grammar-icon { background: var(--secondary); }

.grammar-info h3 {
    font-size: 18px;
    margin-bottom: 4px;
}

.grammar-info p {
    font-size: 14px;
    color: var(--text-light);
}

/* 语法详情 */
.grammar-detail {
    display: none;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.grammar-detail.active {
    display: block;
}

.grammar-detail h3 {
    font-size: 22px;
    color: var(--primary);
    margin-bottom: 15px;
}

.grammar-detail .rule {
    background: var(--bg);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 15px;
}

.grammar-detail .rule h4 {
    font-size: 16px;
    margin-bottom: 8px;
}

.grammar-detail .example {
    padding: 10px 15px;
    background: white;
    border-radius: 10px;
    margin: 8px 0;
    border-left: 4px solid var(--secondary);
}

.grammar-detail .example .ms {
    font-size: 16px;
    font-weight: bold;
}

.grammar-detail .example .cn {
    font-size: 14px;
    color: var(--text-light);
}

.grammar-detail .example .ta {
    font-size: 14px;
    color: var(--text-light);
}

.grammar-detail .example .audio-btn {
    margin-top: 8px;
    padding: 4px 12px;
    border-radius: 15px;
    border: 1px solid var(--secondary);
    background: transparent;
    color: var(--secondary);
    font-size: 12px;
    cursor: pointer;
}

.grammar-detail .example .audio-btn:active {
    background: var(--secondary);
    color: white;
}

/* 练习样式 */
.exercise-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.exercise-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.exercise-type {
    font-size: 14px;
    color: var(--text-light);
}

.exercise-progress {
    font-size: 14px;
    color: var(--primary);
    font-weight: bold;
}

.exercise-image {
    text-align: center;
    margin: 20px 0;
}

.exercise-emoji {
    font-size: 80px;
}

.exercise-question {
    font-size: 20px;
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background: var(--bg);
    border-radius: 15px;
}

.exercise-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}

.option-btn {
    padding: 15px;
    border-radius: 15px;
    border: 2px solid #E0E0E0;
    background: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.option-btn.correct {
    border-color: var(--green);
    background: #E8F5E9;
}

.option-btn.wrong {
    border-color: var(--primary);
    background: #FFEBEE;
}

.exercise-feedback {
    text-align: center;
    margin-top: 15px;
    font-size: 16px;
    min-height: 30px;
}

/* 结果页面 */
.exercise-result, .quiz-result {
    text-align: center;
    padding: 40px 20px;
}

.result-emoji {
    font-size: 80px;
    margin-bottom: 20px;
}

.result-stars {
    font-size: 40px;
    margin: 20px 0;
}

.btn-primary, .btn-secondary {
    padding: 15px 30px;
    border-radius: 25px;
    border: none;
    font-size: 16px;
    cursor: pointer;
    margin: 10px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text);
    box-shadow: var(--shadow);
}

/* 测试样式 */
.quiz-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.quiz-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 18px;
    margin-bottom: 15px;
}

.quiz-progress-bar {
    height: 8px;
    background: #E0E0E0;
    border-radius: 4px;
    margin-bottom: 20px;
    overflow: hidden;
}

.quiz-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary), var(--blue));
    border-radius: 4px;
    transition: width 0.3s;
}

.quiz-question {
    font-size: 18px;
    text-align: center;
    margin: 20px 0;
    padding: 20px;
    background: var(--bg);
    border-radius: 15px;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quiz-option {
    padding: 15px 20px;
    border-radius: 15px;
    border: 2px solid #E0E0E0;
    background: white;
    font-size: 16px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.quiz-option:active {
    transform: scale(0.98);
}

.quiz-option.correct {
    border-color: var(--green);
    background: #E8F5E9;
}

.quiz-option.wrong {
    border-color: var(--primary);
    background: #FFEBEE;
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.1);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 5px 15px;
    border-radius: 10px;
    transition: all 0.2s;
}

.nav-item.active {
    background: var(--bg);
}

.nav-icon {
    font-size: 24px;
}

.nav-label {
    font-size: 10px;
    color: var(--text-light);
}

.nav-item.active .nav-label {
    color: var(--primary);
    font-weight: bold;
}

/* 动画 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.3s ease;
}

@keyframes celebrate {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.celebrate {
    animation: celebrate 0.5s ease;
}

/* 更新提示条 */
#update-bar {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    z-index: 300;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: bold;
    animation: slideUp 0.3s ease;
}

#update-bar button {
    background: white;
    color: var(--primary);
    border: none;
    padding: 6px 16px;
    border-radius: 15px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
}

#update-bar button:active {
    transform: scale(0.95);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 单词详情页 */
.word-detail-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.word-hero {
    text-align: center;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px 20px;
    box-shadow: var(--shadow);
}

.word-emoji {
    font-size: 80px;
    display: block;
    margin-bottom: 10px;
    animation: bounce 2s infinite;
}

.word-main {
    font-size: 32px;
    font-weight: bold;
    color: var(--primary);
}

.word-languages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.word-lang-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lang-flag {
    font-size: 22px;
}

.lang-label {
    font-size: 12px;
    color: var(--text-light);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.lang-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.lang-text {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
}

.word-read-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--secondary);
    background: transparent;
    color: var(--secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.word-read-btn:active {
    background: var(--secondary);
    color: white;
    transform: scale(0.9);
}

.word-sample {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.word-sample h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--text);
}

.word-sample p {
    font-size: 18px;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.5;
}

.sample-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.sample-row:last-child {
    border-bottom: none;
}

.sample-flag {
    font-size: 20px;
    flex-shrink: 0;
}

.sample-text {
    font-size: 16px;
    color: var(--text);
    flex: 1;
    line-height: 1.5;
    word-break: break-word;
}

.sample-read-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--secondary);
    background: transparent;
    color: var(--secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.sample-read-btn:active {
    background: var(--secondary);
    color: white;
    transform: scale(0.9);
}

.sample-meaning {
    font-size: 14px !important;
    color: var(--text-light) !important;
}

/* Pet Settings Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-card {
    background: white;
    border-radius: 24px;
    padding: 0;
    width: 90%;
    max-width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 12px;
}

.modal-header h3 {
    font-size: 18px;
    color: var(--text);
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #F0F0F0;
    color: #666;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:active {
    background: #DDD;
    transform: scale(0.9);
}

.pet-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 24px 24px;
}

.pet-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 2px solid #E8E8E8;
    background: white;
    cursor: pointer;
    transition: all 0.25s;
}

.pet-option:active {
    transform: scale(0.97);
}

.pet-option.active {
    border-color: var(--primary);
    background: #FFF5F5;
    box-shadow: 0 4px 15px rgba(255,107,107,0.2);
}

.pet-option[data-pet="unicorn"].active {
    border-color: var(--purple);
    background: #F5F0FF;
    box-shadow: 0 4px 15px rgba(167,139,250,0.2);
}

.pet-option[data-pet="pony"].active {
    border-color: var(--pink);
    background: #FFF0F7;
    box-shadow: 0 4px 15px rgba(244,114,182,0.2);
}

.pet-option[data-pet="owl"].active {
    border-color: var(--blue);
    background: #F0F5FF;
    box-shadow: 0 4px 15px rgba(96,165,250,0.2);
}

.pet-preview {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #FFE66D, #FF6B6B);
}

.pet-option[data-pet="unicorn"] .pet-preview {
    background: linear-gradient(135deg, #E0C3FC, #8EC5FC);
}

.pet-option[data-pet="pony"] .pet-preview {
    background: linear-gradient(135deg, #FCC8DD, #FF8FAB);
}

.pet-option[data-pet="owl"] .pet-preview {
    background: linear-gradient(135deg, #A2D2FF, #BDE0FE);
}

.pet-name {
    font-size: 15px;
    font-weight: bold;
    color: var(--text);
}

.pet-desc {
    font-size: 12px;
    color: var(--text-light);
}

/* Pet settings extra: size and pitch sliders */
.pet-settings-extra {
    padding: 0 24px 24px;
    border-top: 1px solid #EEE;
    padding-top: 16px;
}

.setting-row {
    margin-bottom: 16px;
}

.setting-row label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.setting-row input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #E8E8E8;
    outline: none;
    -webkit-appearance: none;
}

.setting-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.reset-btn {
    margin-top: 6px;
    padding: 6px 14px;
    border: 1px solid #DDD;
    border-radius: 8px;
    background: #F8F8F8;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.reset-btn:active {
    background: #EEE;
    transform: scale(0.97);
}

.pet-desc {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

/* === Celebration: Party Popper & Confetti === */
.confetti-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 190;
    overflow: hidden;
}

.confetti-particle {
    position: absolute;
    top: -20px;
    width: 8px;
    height: 14px;
    border-radius: 1px;
    opacity: 0;
    will-change: transform, opacity;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(0) translateX(0) rotateZ(0deg);
    }
    70% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) translateX(var(--drift)) rotateZ(var(--spin));
    }
}

.party-popper {
    position: fixed;
    font-size: 48px;
    z-index: 220;
    pointer-events: none;
    animation: popperBurst 0.6s ease-out forwards;
}

@keyframes popperBurst {
    0% {
        transform: scale(0.3) rotate(-20deg);
        opacity: 1;
    }
    40% {
        transform: scale(1.4) rotate(10deg);
        opacity: 1;
    }
    100% {
        transform: scale(1.8) rotate(25deg) translateY(-30px);
        opacity: 0;
    }
}

@keyframes petDance {
    0%   { transform: translateY(0) scaleX(1) rotate(0deg); }
    15%  { transform: translateY(-12px) scaleX(1.08) rotate(-5deg); }
    30%  { transform: translateY(0) scaleX(0.95) rotate(3deg); }
    45%  { transform: translateY(-8px) scaleX(1.05) rotate(-3deg); }
    60%  { transform: translateY(0) scaleX(1) rotate(5deg); }
    75%  { transform: translateY(-15px) scaleX(1.1) rotate(-2deg); }
    100% { transform: translateY(0) scaleX(1) rotate(0deg); }
}

.pet-dancing {
    animation: petDance 0.8s ease-in-out 4;
}

/* Pony dizzy stars animation */
@keyframes dizzyStarPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

.dizzy-star {
    animation: dizzyStarPulse 0.6s ease-in-out infinite;
    filter: drop-shadow(0 0 4px rgba(255, 200, 0, 0.8));
    user-select: none;
    pointer-events: none;
}

/* Comic BOOM hit effect */
@keyframes boomPop {
    0% { transform: scale(0) rotate(-20deg); opacity: 0; }
    50% { transform: scale(1.5) rotate(10deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 0.8; }
}

@keyframes bamPop {
    0% { transform: scale(0) rotate(-30deg); opacity: 0; }
    60% { transform: scale(1.3) rotate(5deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 0.9; }
}

@keyframes sparkBurst {
    0% { transform: scale(0) translate(0, 0); opacity: 0; }
    30% { opacity: 1; }
    100% { transform: scale(1.2) translate(0, -30px); opacity: 0; }
}

