/* =========================================================
   AI English Coach · 深色主題 Dark Theme
   ========================================================= */

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

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: #1a2236;
    --bg-hover: #243050;
    --border-color: #2a3a5c;
    --text-primary: #e8edf5;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-blue: #60a5fa;
    --accent-purple: #a78bfa;
    --accent-green: #34d399;
    --accent-orange: #fb923c;
    --accent-pink: #f472b6;
    --gradient-main: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);
    --gradient-warm: linear-gradient(135deg, #f59e0b, #ef4444);
    --gradient-cool: linear-gradient(135deg, #06b6d4, #3b82f6);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ----- 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);
    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-size: 1.25rem;
    font-weight: 800;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

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

.header-motto {
    text-align: center;
    font-size: 0.85rem;
    color: var(--accent-orange);
    font-weight: 500;
    padding: 6px 18px;
    background: rgba(251, 146, 60, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(251, 146, 60, 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);
    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(99, 102, 241, 0.2), rgba(139, 92, 246, 0.1));
    border-color: var(--accent-purple);
    color: var(--text-primary);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.1);
}

.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.15), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.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);
    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);
}

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

.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.7);
    backdrop-filter: blur(8px);
    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);
    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); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(251, 146, 60, 0.1); }
    50% { box-shadow: 0 0 25px rgba(251, 146, 60, 0.25); }
}

@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); }
}

/* ----- 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: var(--radius-lg);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

.pet-widget:hover {
    border-color: var(--accent-purple);
    transform: translateY(-2px);
}

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

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

.pet-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(251, 146, 60, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.pet-emoji {
    font-size: 1.8rem;
    animation: petBounce 2s ease-in-out infinite;
}

.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: rgba(255,255,255,0.1);
    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: var(--accent-orange);
    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); }
    30% { transform: translateY(-6px); }
    60% { transform: translateY(0); }
}

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

.pet-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    animation: scaleIn 0.3s ease;
}

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

.pet-panel-header h2 { font-size: 1rem; }

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

.pet-showcase {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, rgba(251,146,60,0.05), rgba(244,114,182,0.05));
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.pet-big-emoji {
    font-size: 4rem;
    animation: petBounce 2.5s ease-in-out infinite;
}

.pet-name-display {
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 6px;
}

.pet-edit-name {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 6px;
}

.pet-mood-display {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.pet-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.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: 70px; }

.pet-bar {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    overflow: hidden;
}

.pet-bar-fill {
    height: 100%;
    border-radius: 3px;
    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: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

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

.pet-action-btn:hover { background: var(--bg-hover); }
.pet-action-btn.feed { border-color: rgba(52,211,153,0.3); }
.pet-action-btn.talk { border-color: rgba(251,146,60,0.3); }
.pet-action-btn.shop { border-color: rgba(167,139,250,0.3); }
.pet-action-btn.switch { border-color: rgba(96,165,250,0.3); }

/* =========================================================
   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: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

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

.pet-select-card.active {
    border-color: var(--accent-green);
    background: rgba(52,211,153,0.1);
}

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

.pet-select-name {
    font-size: 0.85rem;
    font-weight: 600;
}

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

/* =========================================================
   SHOP — 寵物商店
   ========================================================= */
.shop-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.shop-tab {
    padding: 8px 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
    border-radius: 6px;
}

.shop-tab:hover { color: var(--text-primary); }
.shop-tab.active {
    color: var(--accent-purple);
    background: rgba(167,139,250,0.1);
}

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

.shop-item {
    padding: 14px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

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

.shop-item.owned {
    border-color: rgba(52,211,153,0.4);
    background: rgba(52,211,153,0.05);
}

.shop-item.equipped {
    border-color: var(--accent-green);
    box-shadow: 0 0 12px rgba(52,211,153,0.2);
}

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

.shop-item-name {
    font-size: 0.75rem;
    margin: 4px 0;
    color: var(--text-secondary);
}

.shop-item-price {
    font-size: 0.7rem;
    color: var(--accent-orange);
    font-weight: 600;
}

.shop-item-badge {
    font-size: 0.65rem;
    color: var(--accent-green);
}

/* =========================================================
   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: var(--accent-green);
    background: rgba(52,211,153,0.1);
    cursor: default;
    opacity: 0.7;
}

/* 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);
}

/* 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); }

.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 var(--accent-green);
    background: rgba(52,211,153,0.08);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--accent-green);
}

.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); }

/* =========================================================
   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);
}

/* =========================================================
   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; }
}
