/* =========================================================
   AI English Coach · 白色主題 Light Theme
   ========================================================= */

/* ----- Reset & Base ----- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-primary: #fdfaf5;
    --bg-secondary: #fffefb;
    --bg-card: #ffffff;
    --bg-hover: #faf6ef;
    --border-color: #ede4d8;
    --text-primary: #3d3226;
    --text-secondary: #8b7a65;
    --text-muted: #bfb09a;
    --accent-blue: #a0b8d0;
    --accent-purple: #c8b0c8;
    --accent-green: #a0b898;
    --accent-orange: #d4a860;
    --accent-pink: #d4b0a8;
    --gradient-main: linear-gradient(135deg, #d4a860, #c89850);
    --gradient-warm: linear-gradient(135deg, #e0c080, #d4a860);
    --gradient-cool: linear-gradient(135deg, #a0b898, #a0b8d0);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.03);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.05);
    --shadow-glow: 0 0 20px rgba(200, 160, 100, 0.08);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', 'Gaegu', 'ZCOOL KuaiLe', 'M PLUS Rounded 1c', 'PingFang SC', sans-serif;
    background: #fdfaf5;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    font-weight: 400;
    letter-spacing: 0;
}

/* ----- Scrollbar ----- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-blue); }

/* ----- Header ----- */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icon {
    font-size: 2rem;
    animation: float 3s ease-in-out infinite;
}

.header-title {
    font-family: 'Gaegu', 'Nunito', cursive;
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, #e8a850, #d4956c, #c88060);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.3;
    letter-spacing: 0.02em;
}

.header-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.header-motto {
    text-align: center;
    font-size: 0.85rem;
    color: #8b6914;
    font-weight: 500;
    padding: 6px 18px;
    background: rgba(212, 168, 83, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(212, 168, 83, 0.2);
    animation: pulse-glow 3s ease-in-out infinite;
    max-width: 400px;
}

.header-stats .stat-badge {
    font-size: 0.8rem;
    padding: 6px 14px;
    background: var(--bg-card);
    border-radius: 20px;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* ----- Main Layout ----- */
.main-layout {
    display: grid;
    grid-template-columns: 220px 1fr 300px;
    height: calc(100vh - 68px);
    gap: 0;
}

/* ----- Sidebar ----- */
.sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    box-shadow: 1px 0 4px rgba(0,0,0,0.03);
    padding: 20px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-title {
    font-size: 1rem;
    text-align: center;
    color: var(--text-primary);
}

.sidebar-title small,
.sidebar-label small {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.75rem;
}

.sidebar-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.sidebar-divider {
    height: 1px;
    background: var(--border-color);
    opacity: 0.5;
}

.scene-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.scene-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 12px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.scene-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-blue);
    transform: translateX(4px);
}

.scene-btn.active {
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.15), rgba(200, 149, 108, 0.08));
    border-color: #d4a853;
    color: #5c3d1a;
    box-shadow: 0 0 20px rgba(212, 168, 83, 0.12);
}

.scene-icon { font-size: 1.5rem; }
.scene-name { font-size: 0.85rem; font-weight: 600; }
.scene-en { font-size: 0.7rem; color: var(--text-muted); }

/* Difficulty */
.difficulty-selector {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.diff-btn {
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.8rem;
    text-align: center;
}

.diff-btn:hover {
    background: var(--bg-hover);
}

.diff-btn.active {
    background: rgba(52, 211, 153, 0.15);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

/* Daily Challenge */
.daily-challenge {
    background: linear-gradient(135deg, rgba(251, 146, 60, 0.1), rgba(239, 68, 68, 0.05));
    border: 1px solid rgba(251, 146, 60, 0.2);
    border-radius: var(--radius-md);
    padding: 14px;
    text-align: center;
}

.challenge-text {
    font-size: 0.85rem;
    color: var(--accent-orange);
    margin: 8px 0;
    line-height: 1.5;
}

.challenge-btn {
    padding: 8px 20px;
    background: var(--gradient-warm);
    border: none;
    border-radius: 20px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.8rem;
}

.challenge-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(251, 146, 60, 0.4);
}

/* ----- Chat Area ----- */
.chat-area {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    position: relative;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeInUp 0.4s ease;
}

.message.coach { align-self: flex-start; }
.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background: var(--bg-card);
    flex-shrink: 0;
}

.message.user .msg-avatar {
    background: rgba(99, 102, 241, 0.2);
}

.msg-content {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    position: relative;
}

.message.coach .msg-content {
    border-top-left-radius: 4px;
    border: 1px solid var(--border-color);
}

.message.user .msg-content {
    border-top-right-radius: 4px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.04));
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.msg-text p {
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 4px;
}

.msg-text p:last-child { margin-bottom: 0; }
.msg-text p.en {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.msg-emotion {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(251, 146, 60, 0.1);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--accent-orange);
    border-left: 3px solid var(--accent-orange);
}

.msg-correction {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(52, 211, 153, 0.1);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-green);
    font-size: 0.8rem;
}

.msg-correction .corr-label {
    color: var(--accent-green);
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.msg-correction .corr-original {
    color: var(--text-muted);
    text-decoration: line-through;
}

.msg-correction .corr-corrected {
    color: var(--accent-green);
}

.msg-analysis-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.tag {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.tag.fluency { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }
.tag.vocab { background: rgba(52, 211, 153, 0.15); color: var(--accent-green); }
.tag.pron { background: rgba(251, 146, 60, 0.15); color: var(--accent-orange); }
.tag.grammar { background: rgba(167, 139, 250, 0.15); color: var(--accent-purple); }

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-blue);
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

.typing-label {
    margin-left: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Voice Controls */
.voice-controls {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.voice-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: var(--transition);
}

.status-dot.listening {
    background: var(--accent-green);
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.5);
    animation: pulse-dot 1s ease-in-out infinite;
}

.status-dot.processing {
    background: var(--accent-orange);
    box-shadow: 0 0 10px rgba(251, 146, 60, 0.5);
    animation: pulse-dot 0.6s ease-in-out infinite;
}

.voice-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

.mic-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--border-color);
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.mic-btn:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.2);
}

.mic-btn:active,
.mic-btn.recording {
    border-color: var(--accent-green);
    background: rgba(52, 211, 153, 0.1);
    box-shadow: 0 0 40px rgba(52, 211, 153, 0.3);
    transform: scale(1.05);
}

.mic-btn.recording::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--accent-green);
    animation: ripple 1.5s ease-out infinite;
}

.mic-icon { font-size: 1.8rem; }
.mic-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.mic-label small { display: block; }

.speak-btn, .clear-btn {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.8rem;
}

.speak-btn:hover, .clear-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Transcript */
.transcript-box {
    padding: 12px 16px;
    background: rgba(52, 211, 153, 0.05);
    border: 1px solid rgba(52, 211, 153, 0.2);
    border-radius: var(--radius-md);
    animation: fadeIn 0.3s ease;
}

.transcript-label {
    font-size: 0.75rem;
    color: var(--accent-green);
    margin-bottom: 6px;
}

.transcript-text {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.transcript-confidence {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ----- Analysis Panel ----- */
.analysis-panel {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: -1px 0 4px rgba(0,0,0,0.03);
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel-title {
    font-size: 1rem;
    text-align: center;
    color: var(--text-primary);
}

.panel-title small {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.7rem;
}

.panel-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.metric-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: var(--shadow-md);
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.metric-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.metric-score {
    font-size: 1.1rem;
    font-weight: 800;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.metric-bar {
    height: 4px;
    background: rgba(255,255,255,0.05);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.metric-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--gradient-main);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.metric-fill.fluency { background: linear-gradient(90deg, #06b6d4, #3b82f6); }
.metric-fill.vocab { background: linear-gradient(90deg, #34d399, #10b981); }
.metric-fill.pron { background: linear-gradient(90deg, #fb923c, #f472b6); }
.metric-fill.grammar { background: linear-gradient(90deg, #a78bfa, #8b5cf6); }

.metric-level {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.metric-detail {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.metric-detail strong {
    color: var(--text-primary);
}

/* CEFR Badges */
.cefr-badges {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.cefr-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: var(--transition);
}

.cefr-badge.active {
    background: rgba(52, 211, 153, 0.15);
    color: var(--accent-green);
    border-color: var(--accent-green);
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.2);
}

/* Achievements */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.achievement {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.03);
    transition: var(--transition);
    cursor: default;
}

.achievement.unlocked {
    background: rgba(251, 146, 60, 0.1);
    border: 1px solid rgba(251, 146, 60, 0.2);
}

.achievement.unlocked .ach-icon {
    animation: bounce 0.6s ease;
}

.achievement.locked {
    opacity: 0.4;
    filter: grayscale(0.8);
}

.ach-icon { font-size: 1.2rem; }
.ach-name { font-size: 0.6rem; color: var(--text-muted); text-align: center; }
.achievement.unlocked .ach-name { color: var(--accent-orange); }

/* Emotion Feed */
.emotion-feed {
    margin-top: auto;
    padding-top: 8px;
}

.emotion-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(251, 146, 60, 0.08), rgba(244, 114, 182, 0.05));
    border: 1px solid rgba(251, 146, 60, 0.15);
    border-radius: var(--radius-md);
    animation: slideInRight 0.5s ease;
}

.emotion-icon { font-size: 1.3rem; }
.emotion-text {
    font-size: 0.8rem;
    color: var(--accent-orange);
    line-height: 1.4;
}

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

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    animation: scaleIn 0.3s ease;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.modal-header h2 { font-size: 1.2rem; }
.modal-header h3.en {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.modal-body {
    padding: 20px 24px;
}

.report-section {
    margin-bottom: 20px;
}

.report-section h3 {
    font-size: 0.95rem;
    color: var(--accent-blue);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.report-item {
    padding: 10px 14px;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius-sm);
}

.report-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
}

.report-item .value {
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 4px;
}

.report-item .value.good { color: var(--accent-green); }
.report-item .value.fair { color: var(--accent-orange); }
.report-item .value.needs-work { color: #f87171; }

.report-suggestions {
    list-style: none;
    padding: 0;
}

.report-suggestions li {
    padding: 8px 12px;
    margin-bottom: 6px;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    border-left: 3px solid var(--accent-purple);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
}

.modal-btn:hover {
    background: var(--bg-hover);
}

.modal-btn.primary {
    background: var(--gradient-main);
    border: none;
    font-weight: 600;
}

.modal-btn.primary:hover {
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

/* ----- Animations ----- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

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

/* Cat pet float animation */
.cat {
    animation: float 2s ease-in-out infinite;
}

@keyframes catFloat {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0px); }
}

@keyframes floatSlow {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-4px) rotate(3deg); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(232, 184, 120, 0.1); }
    50% { box-shadow: 0 0 25px rgba(232, 184, 120, 0.2); }
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@keyframes ripple {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.5); opacity: 0; }
}

@keyframes typingBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-8px); }
}

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

@keyframes petWiggle {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-3deg) scale(1.05); }
    75% { transform: rotate(3deg) scale(1.05); }
}

@keyframes sparkle {
    0%, 100% { opacity: 0; transform: scale(0); }
    50% { opacity: 1; transform: scale(1); }
}

/* ----- Responsive ----- */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 180px 1fr 260px;
    }
}

@media (max-width: 768px) {
    .main-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        height: auto;
    }

    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        flex-direction: row;
        flex-wrap: wrap;
        padding: 12px;
    }

    .scene-list {
        flex-direction: row;
    }

    .scene-btn {
        flex: 1;
    }

    .analysis-panel {
        border-left: none;
        border-top: 1px solid var(--border-color);
    }

    .header-motto {
        display: none;
    }

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

@media (max-width: 480px) {
    .report-grid {
        grid-template-columns: 1fr;
    }

    .mic-btn {
        width: 64px;
        height: 64px;
    }
}

/* ----- Smooth Entrance ----- */
body { animation: fadeIn 0.5s ease; }

/* ----- Highlight animation for new data ----- */
@keyframes highlightFlash {
    0% { background: rgba(99, 102, 241, 0.2); }
    100% { background: transparent; }
}

.highlight-new {
    animation: highlightFlash 1s ease;
}

/* =========================================================
   PET WIDGET — 寵物浮動小工具
   ========================================================= */
.pet-widget {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 500;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
}

.pet-widget:hover {
    border-color: var(--accent-purple);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}

.pet-speech-bubble {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid #fcd34d;
    border-radius: var(--radius-md);
    padding: 8px 14px;
    font-size: 0.75rem;
    color: #b45309;
    white-space: nowrap;
    max-width: 220px;
    margin-bottom: 8px;
    animation: fadeInUp 0.3s ease;
    box-shadow: var(--shadow-md);
}

.pet-speech-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #fcd34d;
}

.pet-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5e8d8, #e8d5c0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    border: 2px solid #d4a853;
    box-shadow: 0 2px 8px rgba(180,140,100,0.2);
}

.pet-emoji {
    font-size: 2.2rem;
    animation: petBounce 2s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.pet-status-mini {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.65rem;
    align-items: center;
}

.pet-hunger-bar-mini {
    width: 40px;
    height: 3px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.pet-hunger-fill {
    height: 100%;
    background: var(--accent-green);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.pet-coins-mini {
    font-size: 0.7rem;
    color: #b45309;
    font-weight: 600;
}

.pet-expand-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px;
}

.pet-expand-btn:hover { color: var(--text-primary); }

@keyframes petBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    15% { transform: translateY(-10px) rotate(-2deg); }
    30% { transform: translateY(0) rotate(0deg); }
    45% { transform: translateY(-5px) rotate(2deg); }
    60% { transform: translateY(0) rotate(0deg); }
}

/* =========================================================
   PET PANEL — 寵物詳細面板
   ========================================================= */
.pet-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 600;
    animation: fadeIn 0.3s ease;
}

.pet-panel {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.12);
    width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    animation: scaleIn 0.3s ease;
}

.pet-panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #faf6ed;
    border-radius: 24px 24px 0 0;
}

.pet-panel-header h2 { font-size: 1.1rem; font-weight: 700; }

.pet-panel-body {
    padding: 20px 24px;
}

/* Pet Mini Shop */
.pet-mini-shop {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e8dcc8;
}
.pet-mini-shop-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}
.pet-mini-tab {
    flex: 1;
    padding: 6px 8px;
    background: #faf6ed;
    border: 1px solid #e8dcc8;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 600;
    color: #8b7355;
    transition: all 0.2s;
}
.pet-mini-tab.active {
    background: #e8b878;
    color: #fff;
    border-color: #d4a853;
}
.pet-mini-shop-grid {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.mini-shop-item {
    flex: 0 0 auto;
    min-width: 72px;
    text-align: center;
    padding: 10px 8px;
    background: #fffdf7;
    border: 1px solid #e8dcc8;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.mini-shop-item:hover { border-color: #e8b878; transform: translateY(-1px); }
.mini-shop-item.equipped { border-color: #10b981; background: #f0fdf4; }
.mini-shop-item.owned { border-color: #bbf7d0; }
.mini-shop-icon { font-size: 1.4rem; display: block; }
.mini-shop-name { font-size: 0.65rem; color: #5c4a32; font-weight: 600; }
.mini-shop-price { font-size: 0.65rem; color: #b45309; font-weight: 700; }
.mini-shop-badge { font-size: 0.6rem; color: #10b981; font-weight: 600; }
.mini-shop-badge.owned { color: #6366f1; }

/* ====== PET DOLLHOUSE ROOM ====== */
.pet-showcase {
    text-align: center;
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    margin-bottom: 20px;
    border: 4px solid #d4c4a8;
    box-shadow: 0 4px 20px rgba(120, 100, 70, 0.12);
    min-height: 320px;
    display: flex;
    flex-direction: column;
}

/* 房間牆壁 */
.pet-room-wall {
    flex: 1;
    background: linear-gradient(180deg, #fef9f2 0%, #faf3e6 60%, #f5e8d4 100%);
    position: relative;
    padding: 30px 20px 10px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    min-height: 240px;
}

/* 牆紙花紋 */
.pet-room-wall::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(232,200,160,0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 60%, rgba(200,180,150,0.08) 0%, transparent 50%);
    pointer-events: none;
}

/* 窗戶 */
.pet-room-window {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 70px;
    background: linear-gradient(180deg, #d4e8f8 0%, #e8f0f8 40%, #f0f4e8 100%);
    border: 3px solid #d4c4a8;
    border-radius: 10px 10px 0 0;
    box-shadow: inset 0 2px 8px rgba(150,180,200,0.2);
    z-index: 1;
    overflow: hidden;
}
/* 十字窗框 */
.pet-room-window::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 3px;
    background: #d4c4a8;
    transform: translateY(-50%);
}
.pet-room-window::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #d4c4a8;
    transform: translateX(-50%);
}

/* 地板 */
.pet-room-floor {
    height: 50px;
    background: linear-gradient(180deg, #e8d5b8 0%, #dcc8a8 40%, #d0b898 100%);
    position: relative;
    border-top: 2px solid #d4c4a8;
}

/* 地板木紋 */
.pet-room-floor::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 30px,
        rgba(180,150,120,0.1) 30px,
        rgba(180,150,120,0.1) 31px
    );
}

/* 寵物在房間中央 */
.pet-room-pet {
    position: relative;
    z-index: 3;
    margin-bottom: -10px;
}

.pet-room-pet-emoji {
    font-size: 5rem;
    display: block;
    animation: petWiggle 3s ease-in-out infinite;
    filter: drop-shadow(0 6px 12px rgba(120,100,70,0.2));
    transition: transform 0.2s ease;
}
.pet-room-pet-img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    display: block;
    animation: catFloat 2s ease-in-out infinite;
    filter: drop-shadow(0 6px 12px rgba(120,100,70,0.2));
    transition: transform 0.2s ease;
    cursor: pointer;
}
.pet-room-pet-img:active {
    transform: scale(1.2);
}

/* 寵物穿的衣服 */
.pet-room-outfit {
    position: absolute;
    top: -10px;
    right: -20px;
    font-size: 2rem;
    animation: floatSlow 2.5s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.12));
    z-index: 4;
}

/* 寵物腳下影子 */
.pet-room-shadow {
    width: 50px;
    height: 10px;
    background: rgba(150,120,90,0.2);
    border-radius: 50%;
    margin: -2px auto 0;
    animation: shadowPulse 2.5s ease-in-out infinite;
}

/* 家具擺放 */
.pet-room-furniture {
    position: absolute;
    font-size: 1.6rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    z-index: 3;
    animation: float 3s ease-in-out infinite;
}

/* 家具位置 */
.pet-furn-left { bottom: 30px; left: 25px; animation-delay: 0s; }
.pet-furn-right { bottom: 30px; right: 25px; animation-delay: 0.4s; }
.pet-furn-corner-tl { top: 85px; left: 18px; animation-delay: 0.8s; }
.pet-furn-corner-tr { top: 85px; right: 18px; animation-delay: 1.2s; }


.pet-name-display {
    font-size: 1.3rem;
    font-weight: 700;
    margin-top: 10px;
    color: #1e293b;
    position: relative;
    z-index: 1;
}

.pet-edit-name {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.85rem;
    margin-left: 6px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.pet-edit-name:hover { background: #e2e8f0; }

.pet-mood-display {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 6px;
    position: relative;
    z-index: 1;
}

.pet-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    background: #f8fafc;
    border-radius: 14px;
    padding: 14px;
    border: 1px solid #e2e8f0;
}

.pet-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.pet-bar-row span:first-child { width: 75px; font-weight: 600; }

.pet-bar {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.pet-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.pet-bar-fill.hunger { background: linear-gradient(90deg, #fbbf24, #34d399); }
.pet-bar-fill.intimacy { background: linear-gradient(90deg, #f472b6, #ef4444); }

.pet-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.pet-actions .pet-action-btn {
    flex: 1 1 auto;
    min-width: 55px;
    font-size: 0.75rem;
    padding: 10px 8px;
}

.pet-action-btn {
    padding: 12px 14px;
    border-radius: 18px;
    border: 2px solid var(--border-color);
    background: #fffdf7;
    color: #5c4a32;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    transition: var(--transition);
    box-shadow: 0 2px 6px rgba(180,150,120,0.06);
    letter-spacing: 0.02em;
}

.pet-action-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 4px 14px rgba(180,150,120,0.12);
}
.pet-action-btn.feed { background: #f5fae8; border-color: #c8d8b0; color: #6b8a50; }
.pet-action-btn.feed:hover { background: #eef5dd; }
.pet-action-btn.talk { background: #fef8f0; border-color: #e8ccb0; color: #a07050; }
.pet-action-btn.talk:hover { background: #fdf2e4; }
.pet-action-btn.shop { background: #faf5fc; border-color: #d8c8e0; color: #806898; }
.pet-action-btn.shop:hover { background: #f5ecf8; }
.pet-action-btn.switch { background: #f5f8fc; border-color: #bcc8e0; color: #607898; }
.pet-action-btn.switch:hover { background: #eaf0f8; }
.pet-action-btn.pet-pet-btn { background: #fff5f5; border-color: #f0c8c8; color: #b06060; }
.pet-action-btn.pet-pet-btn:hover { background: #ffe8e8; }

/* =========================================================
   PET SELECTION — 寵物選擇
   ========================================================= */
.modal-sm { max-width: 480px; }
.modal-lg { max-width: 680px; }

.pet-select-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.pet-select-card {
    padding: 20px 16px;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 18px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.pet-select-card:hover {
    border-color: var(--accent-purple);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.pet-select-card.active {
    border-color: #10b981;
    background: #f0fdf4;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.pet-select-icon {
    font-size: 2.8rem;
    display: block;
    margin-bottom: 8px;
}

.pet-select-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
}

.pet-select-name-en {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Pet lock states */
.pet-select-card.locked {
    opacity: 0.8;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background: #f8fafc;
}

.pet-select-card.locked:hover {
    border-color: var(--accent-orange);
    opacity: 1;
}

.pet-select-card.owned {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.pet-select-card.free {
    background: #fefce8;
    border-color: #fde68a;
}

.lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.75);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border-radius: 18px;
    transition: var(--transition);
}

.pet-select-card.locked:hover .lock-overlay {
    background: rgba(255,255,255,0.5);
}

.lock-icon {
    font-size: 1.5rem;
}

.lock-price {
    font-size: 0.85rem;
    font-weight: 700;
    color: #b45309;
}

.lock-price.cant-afford {
    color: #ef4444;
}

.lock-label {
    font-size: 0.65rem;
    color: #64748b;
}

.pet-badge {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 8px;
}

.pet-badge.active-badge {
    color: #166534;
    background: #dcfce7;
}

.pet-badge.owned-badge {
    color: #1e40af;
    background: #dbeafe;
}

.pet-badge.free-badge {
    color: #854d0e;
    background: #fef3c7;
}

/* =========================================================
   SHOP — 寵物商店
   ========================================================= */
.shop-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0;
}

.shop-tab {
    padding: 10px 18px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    transition: var(--transition);
    border-radius: 10px 10px 0 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.shop-tab:hover { color: var(--text-primary); background: #f8fafc; }
.shop-tab.active {
    color: var(--accent-purple);
    background: #faf5ff;
    border-bottom-color: var(--accent-purple);
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.shop-item {
    padding: 16px 10px;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.shop-item:hover {
    border-color: var(--accent-purple);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.shop-item.owned {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.shop-item.equipped {
    border-color: #10b981;
    background: #f0fdf4;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.shop-item-icon {
    font-size: 1.8rem;
    display: block;
}

.shop-item-name {
    font-size: 0.78rem;
    margin: 6px 0;
    color: #334155;
    font-weight: 600;
}

.shop-item-price {
    font-size: 0.72rem;
    color: #b45309;
    font-weight: 700;
}

.shop-item-badge {
    font-size: 0.65rem;
    color: #10b981;
    font-weight: 600;
}

/* =========================================================
   GAMES — 小遊戲
   ========================================================= */
.game-select-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.game-select-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 20px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.game-select-btn:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

.game-select-btn .game-icon {
    font-size: 2rem;
}

.game-select-btn small {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Match game cards */
.match-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 16px 0;
}

.match-card {
    padding: 16px 8px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
    font-weight: 600;
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.match-card:hover { border-color: var(--accent-blue); }
.match-card.selected {
    border-color: var(--accent-purple);
    background: rgba(167,139,250,0.15);
}
.match-card.matched {
    border-color: #4ade80;
    background: rgba(74,222,128,0.15);
    cursor: default;
    pointer-events: none;
    animation: matchPop 0.5s ease forwards;
}
@keyframes matchPop {
    0% { border-color: #4ade80; background: rgba(74,222,128,0.2); opacity: 1; transform: scale(1); }
    40% { border-color: #22c55e; background: rgba(34,197,94,0.25); opacity: 1; transform: scale(1.05); }
    100% { border-color: #a8c898; background: transparent; opacity: 0; transform: scale(0.8); }
}

/* Fill game */
.fill-round {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.fill-sentence {
    font-size: 1rem;
    margin-bottom: 10px;
}

.fill-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.fill-option {
    padding: 8px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.fill-option:hover { border-color: var(--accent-blue); }
.fill-option.correct {
    border-color: var(--accent-green);
    background: rgba(52,211,153,0.15);
}
.fill-option.wrong {
    border-color: #f87171;
    background: rgba(248,113,113,0.1);
}
.fill-option:disabled { pointer-events: none; opacity: 0.6; }

.fill-round-num { color: var(--text-muted); font-size: 0.8rem; }
.fill-hint { color: var(--text-muted); font-size: 0.75rem; margin-bottom: 8px; }

.fill-feedback {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    animation: fadeInUp 0.3s ease;
}
.fill-feedback.correct { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.fill-feedback.wrong { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.speed-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1.1rem;
    text-align: center;
    margin: 8px 0;
}
.speed-input:focus { outline: none; border-color: #e8b878; }
.speed-submit {
    padding: 10px 28px;
    background: linear-gradient(135deg, #e8b878, #d4a853);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Scramble game */
.scramble-round {
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    text-align: center;
}

.scramble-letters {
    font-size: 2rem;
    letter-spacing: 8px;
    font-weight: 700;
    margin: 12px 0;
    color: var(--accent-blue);
}

.scramble-input {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    text-align: center;
    width: 200px;
}

.scramble-submit {
    margin-left: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--accent-blue);
    color: white;
    cursor: pointer;
    font-weight: 600;
}

/* Quick fire */
.quickfire-round {
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    text-align: center;
}

.quickfire-prompt {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 12px 0;
}

.quickfire-input {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    width: 250px;
    text-align: center;
}

/* Game result */
.game-result {
    text-align: center;
    padding: 30px;
}

.game-result-stars {
    font-size: 3rem;
    margin: 16px 0;
}

.game-result-score {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 8px 0;
}

.game-result-coins {
    font-size: 1rem;
    color: var(--accent-orange);
}

/* =========================================================
   SKITS — 短劇
   ========================================================= */
.skit-select-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.skit-select-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.skit-select-item:hover {
    border-color: var(--accent-purple);
}

.skit-select-icon { font-size: 1.8rem; }
.skit-select-info { flex: 1; }
.skit-select-name { font-size: 0.9rem; font-weight: 600; }
.skit-select-name-en { font-size: 0.75rem; color: var(--text-muted); }
.skit-select-diff { font-size: 0.7rem; }

.skit-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 30px 20px;
}

.skit-role-a, .skit-role-b {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-lg);
}

.skit-role-a { background: rgba(99,102,241,0.1); }
.skit-role-b { background: rgba(52,211,153,0.1); }

.skit-role-icon { font-size: 1.5rem; }
.skit-role-name { font-weight: 600; }

.skit-dialogue-box {
    padding: 16px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: center;
    max-width: 100%;
    font-size: 1rem;
    line-height: 1.6;
    min-height: 60px;
}

.skit-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.skit-btn {
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.skit-btn.listen {
    background: var(--accent-green);
    color: #000;
}

.skit-btn.skip {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.skit-btn.listen:hover {
    box-shadow: 0 4px 16px rgba(52,211,153,0.3);
}

/* =========================================================
   SIDEBAR ACTIONS — 遊戲/短劇按鈕
   ========================================================= */
.sidebar-actions {
    display: flex;
    gap: 8px;
}

.sidebar-action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.8rem;
    text-align: center;
}

.sidebar-action-btn:hover {
    background: var(--bg-hover);
    transform: translateY(-1px);
}

.sidebar-action-btn.game:hover { border-color: var(--accent-blue); }
.sidebar-action-btn.skit:hover { border-color: var(--accent-purple); }

.vocab-big-btn {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 16px 10px;
    background: linear-gradient(135deg, #fef7e8, #fde8c0);
    border: 3px solid #e8b878;
    border-radius: 18px;
    color: #8b6914;
    cursor: pointer;
    font-weight: 800;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(200,160,100,0.15);
    animation: pulse-glow 3s ease-in-out infinite;
}
.vocab-big-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(200,160,100,0.25);
}
.vocab-big-btn small {
    font-size: 0.65rem;
    color: #a08050;
    font-weight: 400;
}

.sidebar-action-btn small {
    font-size: 0.6rem;
    color: var(--text-muted);
}

/* =========================================================
   VOCAB TRACKER — 詞彙追蹤
   ========================================================= */
.vocab-tracker {
    padding: 8px 0;
}

.vocab-count {
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 4px 0;
}

.vocab-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 8px 0;
}

.vocab-list .vocab-word {
    padding: 2px 8px;
    background: rgba(52,211,153,0.1);
    border-radius: 10px;
    font-size: 0.7rem;
    color: var(--accent-green);
}

.vocab-empty {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.vocab-milestone {
    margin: 8px 0;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.vocab-milestone strong {
    color: var(--accent-orange);
}

.milestone-bar {
    width: 100%;
    height: 3px;
    background: rgba(255,255,255,0.05);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.milestone-fill {
    height: 100%;
    background: linear-gradient(90deg, #fb923c, #fbbf24);
    border-radius: 2px;
    transition: width 0.5s ease;
}

.vocab-streak {
    font-size: 0.75rem;
    color: var(--accent-orange);
}

/* =========================================================
   MODAL SIZE HELPERS
   ========================================================= */
.modal-sm { max-width: 480px; }
.modal-lg { max-width: 680px; }

/* =========================================================
   PET FURNITURE
   ========================================================= */
.pet-furniture {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.pet-furniture .section-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 6px;
}

.pet-furniture-icons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pet-furniture-icons span {
    font-size: 1.2rem;
}

/* =========================================================
   LANGUAGE SWITCHER — 語言切換
   ========================================================= */
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lang-switcher {
    display: flex;
    gap: 3px;
}

.lang-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: var(--bg-card);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    padding: 0;
}

.lang-btn:hover { background: var(--bg-hover); transform: scale(1.1); }

.lang-btn.active {
    border-color: var(--accent-purple);
    background: rgba(167,139,250,0.2);
    box-shadow: 0 0 10px rgba(167,139,250,0.2);
}

/* =========================================================
   PHONE MODE — 電話模式按鈕
   ========================================================= */
.mode-toggle-btn {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.mode-toggle-btn:hover { border-color: var(--accent-green); }
.mode-toggle-btn.active {
    background: rgba(52,211,153,0.1);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.mode-toggle-btn .mode-icon { font-size: 1.3rem; }

.phone-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #8fbc8f;
    background: rgba(143,188,143,0.08);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6b9070;
}

.phone-btn:hover {
    box-shadow: 0 0 30px rgba(52,211,153,0.3);
    transform: scale(1.05);
}

.phone-btn.ringing {
    animation: phonePulse 1.5s ease-in-out infinite;
    border-color: #fbbf24;
}

@keyframes phonePulse {
    0%, 100% { box-shadow: 0 0 20px rgba(52,211,153,0.2); }
    50% { box-shadow: 0 0 50px rgba(52,211,153,0.5); transform: scale(1.08); }
}

.phone-btn.connected {
    border-color: var(--accent-green);
    background: rgba(52,211,153,0.15);
    animation: phoneConnected 3s ease-in-out infinite;
}

@keyframes phoneConnected {
    0%, 100% { box-shadow: 0 0 15px rgba(52,211,153,0.3); }
    50% { box-shadow: 0 0 40px rgba(52,211,153,0.5); }
}

.phone-btn .phone-icon { font-size: 1.8rem; }
.phone-btn .phone-label { font-size: 0.6rem; color: var(--text-secondary); }

/* Call timer */
.call-timer {
    font-size: 1.3rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--accent-green);
    background: #f0fdf4;
    padding: 6px 14px;
    border-radius: 12px;
    border: 2px solid #bbf7d0;
    animation: pulse-dot 1s ease-in-out infinite;
}

/* =========================================================
   IELTS EXAM BUTTON — 模擬考試掣
   ========================================================= */
.ielts-exam-btn {
    width: 100%;
    padding: 12px 10px;
    border-radius: var(--radius-md);
    border: 2px solid var(--accent-orange);
    background: rgba(251,146,60,0.1);
    color: var(--accent-orange);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    transition: var(--transition);
    text-align: center;
}

.ielts-exam-btn:hover {
    background: rgba(251,146,60,0.2);
    box-shadow: 0 0 20px rgba(251,146,60,0.2);
    transform: translateY(-1px);
}

.ielts-exam-btn small {
    display: block;
    font-size: 0.6rem;
    font-weight: 400;
    opacity: 0.7;
    margin-top: 2px;
}

/* =========================================================
   PERSONA SELECTOR — AI 角色選擇
   ========================================================= */
.persona-section { margin-top: 4px; }

.persona-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.persona-btn {
    padding: 8px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.78rem;
    transition: var(--transition);
    text-align: center;
    line-height: 1.3;
}

.persona-btn:hover { background: var(--bg-hover); }

.persona-btn.active {
    border-color: var(--accent-pink);
    background: rgba(244,114,182,0.1);
    color: var(--accent-pink);
}

.persona-btn small {
    display: block;
    font-size: 0.6rem;
    color: var(--text-muted);
}

/* =========================================================
   VOICE SETTINGS — 語音設定
   ========================================================= */
.voice-settings-section { margin-top: 4px; }

.voice-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.voice-select-btn {
    flex: 1;
    padding: 7px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.75rem;
    transition: var(--transition);
    text-align: center;
}

.voice-select-btn:hover { background: var(--bg-hover); }

.voice-select-btn.active {
    border-color: var(--accent-pink);
    color: var(--accent-pink);
    background: rgba(244,114,182,0.1);
}

.speed-slider {
    margin-top: 4px;
}

.speed-slider input[type=range] {
    margin: 4px 0;
}

/* =========================================================
   ACCENT SETTINGS — 口音設定
   ========================================================= */
.accent-section { margin-top: 4px; }

.accent-selector {
    display: flex;
    gap: 6px;
}

.accent-btn {
    flex: 1;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.78rem;
    transition: var(--transition);
    text-align: center;
}

.accent-btn:hover { background: var(--bg-hover); }

.accent-btn.active {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: rgba(96,165,250,0.1);
}

.native-lang-select {
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.78rem;
    cursor: pointer;
    margin-top: 6px;
}

.native-lang-select:focus {
    outline: none;
    border-color: var(--accent-purple);
}

/* =========================================================
   MY WORLD — 我的世界面板
   ========================================================= */

/* =========================================================
   ONBOARDING — 首次教學
   ========================================================= */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    animation: fadeIn 0.3s ease;
}
.onboarding-card {
    background: #fffdf7;
    border: 2px solid #e8b878;
    border-radius: 24px;
    padding: 32px 28px;
    max-width: 360px;
    width: 90%;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    animation: scaleIn 0.3s ease;
}
.onboarding-step {
    font-size: 0.7rem;
    color: #b8a890;
    margin-bottom: 8px;
}
.onboarding-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: #5c4a32;
    margin-bottom: 10px;
    font-family: 'ZCOOL KuaiLe', sans-serif;
}
.onboarding-text {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 20px;
}
.onboarding-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}
.onboarding-btn {
    padding: 10px 28px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.onboarding-btn.next {
    background: linear-gradient(135deg, #e8b878, #d4a853);
    color: #fff;
}
.onboarding-btn.back {
    background: #f1f5f9;
    color: #64748b;
}
.onboarding-skip {
    margin-top: 14px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.75rem;
}

/* =========================================================
   GOOGLE LOGIN — 登入按鈕
   ========================================================= */
.login-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 6px 12px;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.2;
}

.login-btn:hover {
    border-color: #4285f4;
    box-shadow: 0 2px 12px rgba(66, 133, 244, 0.2);
    transform: translateY(-1px);
}

.login-btn .login-icon { font-size: 1.3rem; }
.login-btn .login-text { font-size: 0.7rem; }
.login-btn .login-text small { font-size: 0.55rem; color: var(--text-muted); }

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #4285f4;
}

.user-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: #1e293b;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-btn {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 6px;
    transition: var(--transition);
}

.logout-btn:hover {
    background: #fee2e2;
}

/* Premium button */
.premium-btn {
    padding: 7px 14px;
    background: linear-gradient(135deg, #e8b878, #d4a853);
    border: none;
    border-radius: 16px;
    color: #fff;
    cursor: pointer;
    font-weight: 800;
    font-size: 0.75rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(212, 168, 83, 0.3);
}
.premium-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(212, 168, 83, 0.4);
}

.my-world-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 8px 14px;
    background: linear-gradient(135deg, #fef7e8, #fde8c0);
    border: 2px solid #e8b878;
    border-radius: 18px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.82rem;
    font-weight: 700;
    color: #8b6914;
    line-height: 1.2;
    box-shadow: 0 2px 8px rgba(180,150,120,0.1);
}

.my-world-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(200, 160, 100, 0.25);
}

.my-world-btn small {
    font-size: 0.6rem;
    font-weight: 400;
    color: #a08050;
}

.modal-xl {
    max-width: 900px;
    width: 92vw;
    max-height: 90vh;
}

.myworld-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 16px;
    padding-bottom: 0;
}

.myworld-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
    border-radius: 10px 10px 0 0;
}

.myworld-tab:hover { color: var(--text-primary); background: #f8fafc; }
.myworld-tab.active {
    color: var(--accent-purple);
    border-bottom-color: var(--accent-purple);
    background: #faf5ff;
}

.myworld-content {
    min-height: 300px;
}

/* ---- 寵物展示 ---- */
.mw-pet-showcase {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mw-showcase-stage {
    border-radius: 28px;
    overflow: hidden;
    position: relative;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(180,150,120,0.1);
}

.mw-showcase-sky {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px 50px;
    position: relative;
}

/* 背景主題 — Cat & Soup 風格暖色調 */
.mw-bg-garden .mw-showcase-sky {
    background: linear-gradient(180deg, #f0f4e8 0%, #e4edd8 40%, #d0e0c0 80%, #c0d4a8 100%);
}
.mw-bg-beach .mw-showcase-sky {
    background: linear-gradient(180deg, #eaf0f8 0%, #e0e8f4 40%, #f8f0e0 80%, #e8d8b8 100%);
}
.mw-bg-space .mw-showcase-sky {
    background: linear-gradient(180deg, #3a3050 0%, #4a4060 50%, #585078 100%);
}
.mw-bg-cozy .mw-showcase-sky {
    background: linear-gradient(180deg, #faf4e8 0%, #f5e8d4 40%, #f0dcc0 80%, #e8d0b0 100%);
}
.mw-bg-forest .mw-showcase-sky {
    background: linear-gradient(180deg, #e0ece0 0%, #d0e0d0 40%, #bcd4b8 80%, #a8c898 100%);
}

.mw-showcase-pet-wrap {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mw-showcase-pet {
    font-size: 7rem;
    animation: petBounce 2.5s ease-in-out infinite;
    filter: drop-shadow(0 8px 16px rgba(120, 100, 70, 0.2));
    display: block;
    line-height: 1;
    transition: transform 0.2s ease;
    cursor: pointer;
}
.mw-showcase-pet:active {
    transform: scale(1.15);
    animation: petWiggle 0.6s ease-in-out infinite;
}

/* 寵物陰影（腳下） */
.mw-showcase-shadow {
    width: 60px;
    height: 12px;
    background: rgba(150, 130, 100, 0.2);
    border-radius: 50%;
    margin-top: -4px;
    animation: shadowPulse 2.5s ease-in-out infinite;
}

@keyframes shadowPulse {
    0%, 100% { transform: scaleX(1); opacity: 0.3; }
    50% { transform: scaleX(0.7); opacity: 0.15; }
}

.mw-showcase-outfit {
    position: absolute;
    top: -8px;
    right: -20px;
    font-size: 2rem;
    animation: floatSlow 2.5s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    z-index: 3;
}

.mw-showcase-furniture {
    display: flex;
    gap: 16px;
    margin-top: 20px;
    z-index: 2;
}

.mw-furniture-icon {
    font-size: 1.8rem;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.08));
}

.mw-furniture-icon:nth-child(2) { animation-delay: 0.6s; }
.mw-furniture-icon:nth-child(3) { animation-delay: 1.2s; }
.mw-furniture-icon:nth-child(4) { animation-delay: 1.8s; }

.mw-showcase-ground {
    height: 28px;
    background: #c8d8b0;
    border-radius: 60% 60% 0 0;
    position: relative;
    z-index: 1;
    margin-top: -24px;
}

.mw-bg-beach .mw-showcase-ground { background: #e0d0a8; }
.mw-bg-space .mw-showcase-ground { background: #4a4060; }
.mw-bg-cozy .mw-showcase-ground { background: #d8ccb4; }
.mw-bg-forest .mw-showcase-ground { background: #90b880; }

.mw-pet-info {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 16px;
}

.mw-pet-name-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.mw-pet-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e293b;
}

.mw-pet-species {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.mw-pet-mood {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 12px;
}

.mw-pet-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.mw-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: #64748b;
}

.mw-stat span:first-child {
    width: 70px;
    font-weight: 600;
}

.mw-stat-bar {
    flex: 1;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.mw-stat-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.mw-stat-fill.hunger { background: linear-gradient(90deg, #fbbf24, #34d399); }
.mw-stat-fill.intimacy { background: linear-gradient(90deg, #f472b6, #ef4444); }

.mw-coin-val { color: #b45309; font-weight: 700; }
.mw-practice-val { color: #1e40af; font-weight: 700; }

.mw-pet-background-label {
    margin-top: 12px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: #f8fafc;
    padding: 6px 12px;
    border-radius: 8px;
}

/* ---- 戰利品 ---- */
.mw-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 8px;
}

.mw-stat-card {
    text-align: center;
    padding: 16px 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
}

.mw-stat-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 4px;
}

.mw-stat-num {
    font-size: 1.4rem;
    font-weight: 800;
    color: #1e293b;
    display: block;
}

.mw-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.mw-achievements {
    margin-top: 12px;
}

/* ---- Word Popover (點擊查字) ---- */
.word-popover {
    position: fixed;
    z-index: 2000;
    background: #fff;
    border: 2px solid #e8dcc8;
    border-radius: 16px;
    padding: 16px;
    min-width: 220px;
    max-width: 280px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    animation: fadeInUp 0.2s ease;
}
.word-popover-close {
    position: absolute;
    top: 6px; right: 10px;
    cursor: pointer;
    font-size: 1.2rem;
    color: #94a3b8;
}
.word-popover-word {
    font-size: 1.3rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 6px;
}
.word-popover-def {
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 10px;
}
.word-phonetic { font-size: 0.8rem; color: #94a3b8; }
.word-def-item { margin: 4px 0; }
.word-popover-actions {
    display: flex;
    gap: 8px;
}
.word-save-btn, .word-speak-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s;
}
.word-save-btn { background: #fef7e8; color: #92400e; border-color: #e8b878; }
.word-save-btn:hover { background: #fde8c0; }
.word-speak-btn { background: #f0f9ff; color: #1e40af; border-color: #bae6fd; }
.word-speak-btn:hover { background: #e0f2fe; }

/* Make words in chat subtly clickable */
.msg-text p, .msg-text div {
    cursor: default;
}
.msg-text p:hover, .msg-text div:hover {
    /* subtle indicator that words are interactive */
}

/* ---- 影片學習 ---- */
.video-learn-btn {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 12px 10px;
    background: linear-gradient(135deg, #e8f0f8, #d0e0f0);
    border: 2px solid #8b9dc3;
    border-radius: 16px;
    color: #3b5998;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    transition: all 0.3s;
}
.video-learn-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(139,157,195,0.2); }
.video-learn-btn small { font-size: 0.6rem; color: #5c7a9a; }
.video-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.video-card { cursor: pointer; border-radius: 14px; overflow: hidden; border: 1px solid #e8dcc8; transition: all 0.2s; }
.video-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.video-thumb { position: relative; }
.video-thumb img { width: 100%; display: block; aspect-ratio: 16/9; object-fit: cover; }
.video-level { position: absolute; top: 6px; right: 6px; padding: 2px 8px; border-radius: 6px; font-size: 0.65rem; font-weight: 700; color: #fff; }
.video-level.beginner { background: #8fbc8f; }
.video-level.intermediate { background: #e8b878; }
.video-level.advanced { background: #c88060; }
.video-info { padding: 8px 10px; background: #fffdf7; }
.video-title { font-size: 0.78rem; font-weight: 600; color: #5c4a32; }
.video-player-wrap { grid-column: 1 / -1; }
.video-back-btn { margin-bottom: 10px; padding: 6px 16px; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 10px; cursor: pointer; font-size: 0.8rem; }
.video-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: 14px; }
.video-container iframe { position: absolute; top:0; left:0; width:100%; height:100%; }
.video-caption { text-align: center; font-size: 0.75rem; color: #94a3b8; margin-top: 8px; }
.video-meta { font-size: 0.65rem; color: #b8a890; display: block; margin-top: 2px; }
.lesson-analysis { margin-top: 16px; }
.lesson-analysis h3 { font-size: 0.95rem; color: #5c4a32; margin-bottom: 10px; }
.lesson-analysis h3 small { font-size: 0.7rem; color: #b8a890; font-weight: 400; }
.lesson-sentence { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px; background: #fffdf7; border: 1px solid #ede4d8; border-radius: 10px; margin-bottom: 6px; }
.lesson-en { flex: 1; font-size: 0.82rem; color: #3d3226; line-height: 1.5; }
.kw-highlight { background: #fef3c7; padding: 1px 4px; border-radius: 3px; font-weight: 700; color: #92400e; }
.lesson-ai-btn { padding: 4px 12px; background: #fef7e8; border: 1px solid #e8b878; border-radius: 8px; cursor: pointer; font-size: 0.7rem; font-weight: 600; color: #92400e; white-space: nowrap; transition: all 0.2s; }
.lesson-ai-btn:hover { background: #fde8c0; }
.lesson-phrase { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px; margin-bottom: 6px; }
.lp-original { font-weight: 700; color: #166534; font-size: 0.85rem; }
.lp-meaning { font-size: 0.75rem; color: #5c4a32; }
.lp-example { font-size: 0.7rem; color: #94a3b8; font-style: italic; }

/* ---- 排行榜 ---- */
.mw-rank-badge {
    text-align: center;
    padding: 24px;
    background: linear-gradient(135deg, #fef7e8, #fde8c0);
    border: 2px solid #e8b878;
    border-radius: 20px;
    margin-bottom: 16px;
}
.mw-rank-icon { font-size: 3rem; }
.mw-rank-title { font-size: 1.3rem; font-weight: 800; color: #5c4a32; margin: 4px 0; }
.mw-rank-score { font-size: 0.9rem; color: #92400e; font-weight: 700; }
.mw-rank-stats { background: #fffdf7; border: 1px solid #e8dcc8; border-radius: 14px; padding: 12px 16px; margin-bottom: 12px; }
.mw-rank-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f0e8d8; font-size: 0.82rem; }
.mw-rank-row:last-child { border-bottom: none; }
.mw-rank-row span:first-child { color: #8b7355; }
.mw-rank-row span:last-child { color: #5c4a32; font-weight: 700; }
.mw-rank-next { text-align: center; font-size: 0.75rem; color: #b8a890; }

/* ---- 單詞庫 ---- */
.mw-vocab-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.mw-review-section {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 16px;
}

.mw-review-title {
    font-weight: 700;
    color: #92400e;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.mw-review-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mw-review-word {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border-radius: 10px;
}

.mw-review-en {
    flex: 1;
    font-weight: 700;
    color: #1e293b;
    font-size: 0.9rem;
}

.mw-review-ok, .mw-review-no {
    padding: 5px 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.72rem;
    transition: all 0.2s;
}
.mw-review-ok { background: #dcfce7; color: #166534; }
.mw-review-ok:hover { background: #bbf7d0; }
.mw-review-no { background: #fee2e2; color: #991b1b; }
.mw-review-no:hover { background: #fecaca; }

.mw-vocab-list-title {
    font-weight: 700;
    color: #5c4a32;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.mw-vocab-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mw-vocab-word {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #fffdf7;
    border: 1px solid #e8dcc8;
    border-radius: 12px;
    font-size: 0.78rem;
}

.mw-vocab-word.mastered {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.mw-vocab-en {
    font-weight: 700;
    color: #1e293b;
}

.mw-vocab-tr {
    color: #94a3b8;
    font-size: 0.7rem;
}

.mw-vocab-stage {
    font-size: 0.65rem;
    color: #b8a890;
    margin-left: auto;
}

/* Learning Path */
.learning-path-section {
    padding: 4px 0;
}
.lp-progress-bar {
    height: 8px;
    background: #f0e8d8;
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0 4px;
}
.lp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #e8b878, #d4a853);
    border-radius: 4px;
    transition: width 0.6s ease;
}
.lp-progress-text {
    font-size: 0.65rem;
    color: #b8a890;
    font-weight: 600;
}
.lp-today-mission {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #fef7e8, #fde8c0);
    border: 1px solid #e8b878;
    border-radius: 12px;
}
.lp-mission-icon {
    font-size: 0.75rem;
    font-weight: 800;
    color: #92400e;
    background: #fef3c7;
    padding: 2px 8px;
    border-radius: 6px;
}
.lp-mission-text {
    font-size: 0.78rem;
    font-weight: 600;
    color: #5c4a32;
}

/* ---- 學習紀錄 ---- */
.mw-history-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.mw-history-search {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.85rem;
    background: #fff;
    color: #1e293b;
}

.mw-history-search:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.mw-history-filter {
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.85rem;
    background: #fff;
    color: #1e293b;
    cursor: pointer;
}

.mw-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.history-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px 16px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.history-card:hover {
    border-color: #c4b5fd;
    box-shadow: var(--shadow-md);
}

.history-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 0.75rem;
}

.history-scene {
    font-weight: 600;
    color: #64748b;
}

.history-date {
    color: var(--text-muted);
}

.history-score {
    margin-left: auto;
    font-weight: 700;
    color: var(--accent-purple);
}

.history-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #94a3b8;
    margin-top: 6px;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.history-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #1e293b;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 10px;
    border-left: 3px solid var(--accent-blue);
}
.history-text.ai-response {
    border-left-color: #10b981;
    background: #f0fdf4;
}

.history-errors {
    margin-top: 10px;
    padding: 10px 14px;
    background: #fef2f2;
    border-radius: 10px;
    border-left: 3px solid #ef4444;
}

.history-error-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #dc2626;
    display: block;
    margin-bottom: 6px;
}

.history-error-tag {
    display: inline-block;
    padding: 3px 10px;
    background: #fff;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    font-size: 0.72rem;
    color: #b91c1c;
    margin: 2px 4px 2px 0;
}

/* 紅色波浪底線 - 錯誤詞彙 */
.error-word {
    text-decoration: underline wavy #ef4444;
    text-underline-offset: 3px;
    color: #dc2626;
    cursor: pointer;
    position: relative;
}

.error-word:hover {
    background: #fef2f2;
    border-radius: 2px;
}

.error-word:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    white-space: nowrap;
    z-index: 10;
}

/* 分頁 */
.mw-history-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.mw-page-btn {
    padding: 8px 18px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    color: #1e293b;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    transition: var(--transition);
}

.mw-page-btn:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: var(--accent-purple);
}

.mw-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.mw-page-info {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.mw-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.mw-empty span { font-size: 3rem; display: block; margin-bottom: 10px; }
.mw-empty p { font-size: 1rem; margin-bottom: 4px; }
.mw-empty small { font-size: 0.75rem; }

/* ---- 學習進度儀表板 ---- */
.mw-progress-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px;
    background: #fffdf7;
    border-radius: 18px;
    border: 1px solid #e8dcc8;
}

.mw-level-badge {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.mw-level-label {
    font-size: 1.5rem;
    font-weight: 800;
}

.mw-level-name {
    font-size: 0.65rem;
    font-weight: 600;
}

.mw-level-info {
    flex: 1;
}

.mw-level-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #5c4a32;
}

.mw-level-next {
    font-size: 0.78rem;
    color: #b8a890;
    margin-top: 4px;
}

.mw-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.mw-stat-box {
    text-align: center;
    padding: 16px 8px;
    background: #fffdf7;
    border: 1px solid #e8dcc8;
    border-radius: 16px;
}

.mw-stat-num {
    font-size: 1.4rem;
    font-weight: 800;
    color: #5c4a32;
}

.mw-stat-desc {
    font-size: 0.68rem;
    color: #b8a890;
    margin-top: 4px;
}

.mw-progress-bar-wrap {
    background: #fffdf7;
    border: 1px solid #e8dcc8;
    border-radius: 16px;
    padding: 16px;
}

.mw-progress-bar-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #5c4a32;
    margin-bottom: 8px;
}

.mw-progress-bar {
    height: 12px;
    background: #f0e8d8;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.mw-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #e8b878, #d4a853);
    border-radius: 6px;
    transition: width 0.8s ease;
}

.mw-progress-tip {
    font-size: 0.7rem;
    color: #c4b898;
    text-align: center;
}

/* ---- 手機響應 ---- */
@media (max-width: 768px) {
    .mw-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal-xl {
        width: 96vw;
    }

    .mw-history-toolbar {
        flex-direction: column;
    }
}

/* =========================================================
   RESPONSIVE PET
   ========================================================= */
@media (max-width: 768px) {
    .pet-widget {
        bottom: 10px;
        right: 10px;
        padding: 8px 10px;
        gap: 6px;
    }
    .pet-avatar { width: 36px; height: 36px; }
    .pet-emoji { font-size: 1.3rem; }
    .pet-panel { width: 95vw; }
    .match-grid { grid-template-columns: repeat(3, 1fr); }
    .shop-grid { grid-template-columns: repeat(2, 1fr); }
    .skit-stage { padding: 16px 10px; }
}

/* Settings */
.settings-btn {
    padding: 6px 14px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    transition: all 0.2s;
}
.settings-btn:hover { background: #e2e8f0; color: #1e293b; }
.setting-row { margin-bottom: 16px; }
.setting-row label { display: block; font-size: 0.82rem; font-weight: 600; color: #5c4a32; margin-bottom: 6px; }
.setting-row select { width: 100%; padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 10px; font-size: 0.85rem; background: #fff; color: #1e293b; }
