/* ========================================
   Spelling Practice - Shared Stylesheet
   Mobile-first responsive design
   ======================================== */

/* --- CSS Custom Properties --- */
:root {
    --color-primary: #0f3460;
    --color-primary-dark: #16213e;
    --color-primary-darker: #1a1a2e;
    --color-accent: #e94560;
    --color-accent-dark: #c23a4e;
    --color-success: #4CAF50;
    --color-success-dark: #388E3C;
    --color-gray: #6c757d;
    --color-gray-dark: #5a6268;
    --color-warning: #ffc107;
    --color-warning-dark: #856404;

    --surface-card: #ffffff;
    --surface-bg: #f0f4f8;

    --text-primary: #333;
    --text-secondary: #666;
    --text-muted: #888;
    --text-hint: #aaa;
    --text-light: rgba(255, 255, 255, 0.9);

    --font-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-chinese: 'Microsoft YaHei', 'SimHei', 'STHeiti', sans-serif;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-card: 0 10px 40px rgba(0, 0, 0, 0.3);
    --shadow-heavy: 0 25px 80px rgba(0, 0, 0, 0.4);
    --shadow-accent: 0 8px 25px rgba(233, 69, 96, 0.4);
    --shadow-primary: 0 8px 25px rgba(15, 52, 96, 0.4);

    --header-height: 56px;
    --bottom-nav-height: 64px;
    --container-max-desktop: 800px;
    --container-narrow-desktop: 520px;

    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* --- Reset & Base --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    touch-action: manipulation;
}

body {
    font-family: var(--font-system);
    background: linear-gradient(135deg, var(--color-primary-darker) 0%, var(--color-primary-dark) 50%, var(--color-primary) 100%);
    min-height: 100vh;
    position: relative;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('https://images.unsplash.com/photo-1516979187457-637abb4f9353?w=1920&q=80') center/cover no-repeat;
    opacity: 0.12;
    z-index: -1;
}

/* --- App Shell: Header --- */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(26, 26, 46, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-inner {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-back {
    color: var(--text-light);
    text-decoration: none;
    font-size: 22px;
    padding: 8px;
    margin-left: -8px;
    display: flex;
    align-items: center;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.header-back:active {
    background: rgba(255, 255, 255, 0.1);
}

.header-title {
    color: white;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.header-brand {
    color: var(--color-accent);
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: -0.3px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-badge.cn {
    background: rgba(233, 69, 96, 0.2);
    color: var(--color-accent);
}

.header-badge.en {
    background: rgba(76, 175, 80, 0.2);
    color: var(--color-success);
}

/* Desktop header nav - hidden on mobile */
.header-nav {
    display: none;
}

/* --- App Shell: Main Content --- */
.app-main {
    padding-top: calc(var(--header-height) + 16px);
    padding-bottom: calc(var(--bottom-nav-height) + 24px);
    min-height: 100vh;
    animation: fadeInUp 0.25s ease-out;
}

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

.app-main .container {
    padding: 0 12px;
    width: 100%;
}

.app-main .container--narrow {
    padding: 0 12px;
}

/* --- App Shell: Bottom Navigation (mobile only) --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: rgba(26, 26, 46, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.45);
    font-size: 11px;
    font-weight: 500;
    padding: 6px 16px;
    min-width: 64px;
    min-height: 48px;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast);
    gap: 2px;
}

.bottom-nav-item.active {
    color: var(--color-accent);
}

.bottom-nav-icon {
    font-size: 22px;
    line-height: 1;
}

.bottom-nav-label {
    font-size: 11px;
}

/* --- Page Title --- */
.page-title {
    text-align: center;
    color: white;
    font-size: 22px;
    margin-bottom: 16px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.page-subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    margin-bottom: 20px;
}

/* --- Cards --- */
.card {
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 20px;
    margin-bottom: 12px;
    backdrop-filter: blur(10px);
}

.word-card {
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    backdrop-filter: blur(10px);
}

.test-card {
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 20px;
    margin-bottom: 12px;
    display: none;
    backdrop-filter: blur(10px);
}

.test-card.visible {
    display: block;
}

.result-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 20px;
    margin-bottom: 12px;
    backdrop-filter: blur(10px);
}

.log-card {
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 16px;
    margin-bottom: 12px;
    backdrop-filter: blur(10px);
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: border-color 0.2s;
    border: 2px solid transparent;
}

.log-card:has(.log-checkbox:checked) {
    border-color: var(--color-accent);
    background: #fff5f7;
}

.log-select {
    padding-top: 2px;
    flex-shrink: 0;
}

.log-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--color-accent);
}

.log-body {
    flex: 1;
    min-width: 0;
}

.log-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    gap: 8px;
}

.log-use-btn {
    padding: 5px 12px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.log-lang-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.log-lang-badge.chinese {
    background: #fff3e0;
    color: #e65100;
}

.log-lang-badge.english {
    background: #e8f5e9;
    color: #2e7d32;
}

/* Floating selection bar */
.log-selection-bar {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--color-primary-dark);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
    z-index: 100;
}

.log-selection-bar.visible {
    transform: translateX(-50%) translateY(0);
}

.log-selection-bar span {
    font-size: 14px;
    font-weight: 600;
}

.log-selection-btn {
    padding: 8px 20px;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* --- Word Card Content --- */
.word-info {
    flex: 1;
    min-width: 0;
}

.word-display.hidden {
    display: none;
}

.chinese {
    font-size: 36px;
    font-family: var(--font-chinese);
    color: var(--color-primary);
    line-height: 1.2;
    margin-bottom: 6px;
}

.pinyin {
    font-size: 18px;
    color: var(--color-accent);
    font-weight: 500;
    margin-bottom: 6px;
}

.english {
    font-size: 16px;
    color: var(--text-secondary);
}

/* English word card styles */
.english-word {
    font-size: 32px;
    color: var(--color-primary);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 4px;
}

.phonetic {
    font-size: 16px;
    color: var(--color-accent);
    font-weight: 500;
    margin-bottom: 4px;
    font-style: italic;
}

.part-of-speech {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 6px;
}

.definition {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.word-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

/* --- Buttons --- */
button, .btn {
    font-family: var(--font-system);
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    text-align: center;
    display: block;
    text-decoration: none;
    min-height: 48px;
    -webkit-user-select: none;
    user-select: none;
}

button:active, .btn:active {
    transform: scale(0.97);
    opacity: 0.9;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
}

.btn-gray {
    background: linear-gradient(135deg, var(--color-gray) 0%, var(--color-gray-dark) 100%);
}

.btn-success {
    background: linear-gradient(135deg, var(--color-success) 0%, var(--color-success-dark) 100%);
}

/* Speak button */
.speak-btn {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    min-height: 56px;
    font-size: 26px;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

.speak-btn:active {
    transform: scale(0.93);
}

.speak-btn.playing {
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
    animation: pulse 1s infinite;
}

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

/* Edit button */
.edit-btn {
    background: linear-gradient(135deg, var(--color-gray) 0%, var(--color-gray-dark) 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    min-height: 40px;
    font-size: 18px;
    cursor: pointer;
    transition: transform var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

/* Navigation buttons */
.nav-buttons {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.nav-btn {
    flex: 1;
    padding: 16px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    min-height: 48px;
}

.nav-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

.nav-btn.result-btn {
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
}

/* Test buttons */
.test-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.test-btn {
    display: block;
    flex: 1;
    padding: 18px;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    min-height: 52px;
}

.test-btn-secondary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
}

/* Camera/Upload buttons */
.camera-btn-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.camera-btn-group .camera-btn {
    flex: 1;
    margin-bottom: 0;
}

.camera-btn {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    margin-bottom: 10px;
}

.camera-btn-alt {
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
}

.clear-btn {
    background: linear-gradient(135deg, var(--color-gray) 0%, var(--color-gray-dark) 100%);
    margin-bottom: 10px;
}

.upload-btn {
    display: block;
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    min-height: 48px;
}

.home-btn {
    display: block;
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    text-decoration: none;
    text-align: center;
    min-height: 48px;
}

/* --- Forms --- */
textarea {
    width: 100%;
    padding: 14px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-family: var(--font-chinese);
    resize: vertical;
    min-height: 130px;
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

textarea::placeholder {
    color: var(--text-hint);
    font-size: 14px;
}

.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    color: var(--color-primary);
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}

.hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Edit form */
.edit-form {
    display: none;
    width: 100%;
}

.edit-form.active {
    display: block;
}

.edit-input {
    width: 100%;
    padding: 14px;
    font-size: 22px;
    font-family: var(--font-chinese);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-md);
    text-align: center;
    margin-bottom: 10px;
}

.edit-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.edit-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.save-btn, .cancel-btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    width: auto;
}

.save-btn {
    background: linear-gradient(135deg, var(--color-success) 0%, var(--color-success-dark) 100%);
    color: white;
}

.cancel-btn {
    background: #e0e0e0;
    color: var(--text-primary);
}

/* --- Mode Selector (index page) --- */
.mode-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mode-selector-label {
    text-align: center;
    color: var(--color-primary);
    font-size: 16px;
    font-weight: 600;
}

.mode-buttons {
    display: flex;
    gap: 10px;
}

.mode-btn {
    flex: 1;
    padding: 18px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-md);
    background: white;
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: center;
    min-height: 56px;
}

.mode-btn.selected {
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
    border-color: var(--color-accent);
    color: white;
}

.form-content {
    display: none;
    margin-top: 20px;
    animation: fadeInUp 0.3s ease;
}

.form-content.visible {
    display: block;
}

.chinese-mode-content,
.english-mode-content {
    display: none;
}

.chinese-mode-content.active,
.english-mode-content.active {
    display: block;
}

/* --- Camera/Image Section --- */
.camera-section {
    margin-bottom: 16px;
}

#imageInput, #photoInput, #markingPhotoInput, #markingPhotoCam, #markingPhotoFile, #imageInputCamera, #imageInputFile {
    display: none;
}

#preview, #photoPreview, #markingPreview {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: var(--radius-md);
    margin-top: 10px;
    display: none;
    border: 2px solid #e0e0e0;
}

.or-divider {
    text-align: center;
    color: #999;
    margin: 16px 0;
    position: relative;
    font-size: 14px;
}

.or-divider::before,
.or-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 35%;
    height: 1px;
    background: #e0e0e0;
}

.or-divider::before { left: 0; }
.or-divider::after { right: 0; }

/* --- Progress Bars --- */
.progress-container {
    display: none;
    margin-top: 10px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
    width: 0%;
    transition: width var(--transition-normal);
}

.progress-text {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 5px;
}

.marking-progress {
    display: none;
    margin-top: 15px;
}

.marking-progress.visible {
    display: block;
}

.marking-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.marking-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
    width: 0%;
    transition: width var(--transition-normal);
}

.marking-text {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* --- Test Page --- */
.progress-info {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 16px;
    font-size: 16px;
}

.test-number {
    font-size: 14px;
    color: var(--color-primary);
    margin-bottom: 10px;
    font-weight: 600;
}

.test-instruction {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-align: center;
}

.english-definition {
    font-size: 22px;
    color: var(--text-primary);
    font-weight: 500;
    text-align: center;
    padding: 16px;
    background: var(--surface-bg);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.speak-area {
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.speak-buttons-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 12px 0;
}

.speak-punctuation {
    font-size: 22px;
    color: var(--color-primary);
    font-family: var(--font-chinese);
}

.speak-hint {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    min-height: 20px;
}

.speak-progress {
    text-align: center;
    color: var(--color-primary);
    font-size: 13px;
    font-weight: 500;
    min-height: 20px;
}

/* Answer box */
.answer-box {
    background: var(--surface-bg);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: background var(--transition-fast);
    border: 2px solid transparent;
}

.answer-box.revealed {
    background: #e8f5e9;
    border-color: var(--color-success);
}

.answer-hidden {
    color: #999;
    font-size: 14px;
}

.answer-content {
    display: none;
}

.answer-box.revealed .answer-hidden {
    display: none;
}

.answer-box.revealed .answer-content {
    display: block;
}

.chinese-answer {
    font-size: 36px;
    font-family: var(--font-chinese);
    color: var(--color-primary);
    margin-bottom: 6px;
}

.pinyin-answer {
    font-size: 18px;
    color: var(--color-accent);
    font-weight: 500;
}

.english-answer {
    font-size: 28px;
    color: var(--color-primary);
    font-weight: 700;
    margin-bottom: 4px;
}

.phonetic-answer {
    font-size: 16px;
    color: var(--color-accent);
    font-style: italic;
    margin-bottom: 4px;
}

.definition-answer {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Spelling input (English test) */
.spelling-input-area {
    margin: 12px 0;
}

.spelling-input {
    width: 100%;
    padding: 14px;
    font-size: 20px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-md);
    text-align: center;
    letter-spacing: 1px;
    transition: border-color var(--transition-fast), background var(--transition-fast);
    min-height: 52px;
}

.spelling-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(15, 52, 96, 0.1);
}

.spelling-input.correct {
    border-color: var(--color-success);
    background: #e8f5e9;
}

.spelling-input.incorrect {
    border-color: var(--color-accent);
    background: #fce4ec;
}

.check-spelling-btn {
    margin-top: 10px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
}

/* Upload section */
.upload-section {
    display: none;
    margin-top: 16px;
}

.upload-section.visible {
    display: block;
}

/* --- Results Section --- */
.results-section {
    display: none;
}

.results-section.visible {
    display: block;
}

.result-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #eee;
    gap: 12px;
}

.result-item:last-child {
    border-bottom: none;
}

.result-number {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-primary);
    width: 28px;
    flex-shrink: 0;
}

.result-content {
    flex: 1;
    min-width: 0;
}

.result-chinese {
    font-size: 24px;
    font-family: var(--font-chinese);
    color: var(--color-primary);
}

.result-pinyin {
    font-size: 14px;
    color: var(--color-accent);
}

.result-english {
    font-size: 13px;
    color: var(--text-secondary);
}

.result-english-word {
    font-size: 22px;
    color: var(--color-primary);
    font-weight: 600;
}

.result-phonetic {
    font-size: 13px;
    color: var(--color-accent);
    font-style: italic;
}

.result-definition {
    font-size: 13px;
    color: var(--text-secondary);
}

.result-written {
    font-size: 16px;
    margin-top: 4px;
    color: #333;
}

.result-written-label {
    font-size: 12px;
    color: #999;
}

.wrong-char {
    color: #d32f2f;
    font-weight: 700;
    border: 2px solid #d32f2f;
    border-radius: 50%;
    padding: 0 3px;
    margin: 0 1px;
    display: inline-block;
    line-height: 1.4;
}

.mark-btn {
    width: 48px;
    height: 48px;
    min-height: 48px;
    border-radius: 50%;
    border: 3px solid #ddd;
    background: white;
    cursor: pointer;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    padding: 0;
}

.mark-btn.correct {
    background: var(--color-success);
    border-color: var(--color-success);
    color: white;
}

.mark-btn.wrong {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: white;
}

/* Score box */
.score-box {
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
}

.score-title {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.score-value {
    font-size: 42px;
    font-weight: 700;
    color: var(--color-success);
}

/* --- Logs Page --- */
.stats {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 16px;
    font-size: 14px;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.log-type {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.log-type.photo,
.log-type.english_photo {
    background: #e8f4fd;
    color: var(--color-primary);
}

.log-type.text,
.log-type.english_text {
    background: #fce4ec;
    color: var(--color-accent);
}

.log-date {
    color: var(--text-muted);
    font-size: 13px;
}

.log-content {
    font-family: var(--font-chinese);
    font-size: 14px;
    color: var(--text-primary);
    background: #f5f7fa;
    padding: 12px;
    border-radius: var(--radius-sm);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 160px;
    overflow-y: auto;
}

.log-words {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    background: #ffffff;
    color: var(--color-primary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 14px;
    min-height: 40px;
    min-width: 40px;
}

.pagination .current {
    background: var(--color-accent);
    color: white;
}

.pagination .disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* --- Error & Status --- */
.error-box {
    background: rgba(255, 235, 238, 0.95);
    border: 1px solid #ef9a9a;
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 16px;
    color: #c62828;
}

.error-box h3 {
    margin-bottom: 8px;
}

.no-results, .no-logs {
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: 32px 20px;
    text-align: center;
    color: var(--text-secondary);
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    background: white;
    padding: 28px;
    border-radius: var(--radius-lg);
    text-align: center;
    font-size: 16px;
}

.loading-spinner::after {
    content: '';
    display: block;
    width: 36px;
    height: 36px;
    margin: 14px auto 0;
    border: 4px solid #e0e0e0;
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Speech warning */
.speech-warning {
    display: none;
    background: #fff3cd;
    border: 1px solid var(--color-warning);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 16px;
    color: var(--color-warning-dark);
    font-size: 13px;
    line-height: 1.5;
}

.speech-warning.visible {
    display: block;
}

.speech-warning-title {
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.speech-warning-tips {
    margin-top: 8px;
    padding-left: 18px;
}

.speech-warning-tips li {
    margin-bottom: 4px;
}

.speech-warning-dismiss {
    background: var(--color-warning-dark);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    margin-top: 8px;
    min-height: 32px;
    width: auto;
}

/* Feedback input */
.feedback-input {
    width: 100%;
    padding: 14px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-family: var(--font-system);
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.feedback-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.feedback-input::placeholder {
    color: var(--text-hint);
    font-size: 14px;
}

/* Credit link */
.credit-link {
    text-align: center;
    margin-top: 24px;
    padding: 12px;
}

.credit-link a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 12px;
    transition: color var(--transition-fast);
}

/* --- Privacy / Legal Page --- */
.legal-content {
    padding: 24px;
    line-height: 1.8;
    color: var(--text-primary);
    font-size: 15px;
}

.legal-content h2 {
    color: var(--color-primary);
    font-size: 20px;
    margin-top: 28px;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid rgba(15, 52, 96, 0.1);
}

.legal-content h2:first-of-type {
    margin-top: 16px;
}

.legal-content p {
    margin-bottom: 12px;
}

.legal-content ul {
    padding-left: 20px;
    margin: 10px 0 16px;
}

.legal-content ul li {
    margin-bottom: 8px;
}

.legal-content .legal-updated {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 20px;
}

.legal-content .legal-highlight {
    background: var(--surface-bg);
    border-left: 3px solid var(--color-accent);
    padding: 12px 16px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 16px 0;
    font-size: 14px;
}

.legal-content .legal-contact {
    background: var(--surface-bg);
    padding: 16px;
    border-radius: var(--radius-md);
    margin-top: 20px;
}

.legal-content .legal-contact p {
    margin-bottom: 4px;
}

.legal-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0 16px;
    font-size: 14px;
}

.legal-content table th,
.legal-content table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #e0e0e0;
}

.legal-content table th {
    background: var(--surface-bg);
    font-weight: 600;
    color: var(--color-primary);
}

/* --- Auth Pages (Login/Register) --- */
.auth-input {
    width: 100%;
    padding: 14px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-family: var(--font-system);
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.auth-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.auth-input::placeholder {
    color: var(--text-hint);
    font-size: 14px;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eee;
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-switch a {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 600;
}

.auth-guest-note {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    margin-top: 16px;
    padding: 0 20px;
    line-height: 1.5;
}

.auth-prompt {
    background: rgba(233, 69, 96, 0.1);
    border: 1px solid rgba(233, 69, 96, 0.2);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin-bottom: 16px;
}

.auth-prompt a {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 600;
}

/* Header auth elements */
.header-nav-user {
    color: var(--color-accent);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    background: rgba(233, 69, 96, 0.15);
    border-radius: 20px;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-nav-logout {
    opacity: 0.7;
    font-size: 13px;
}

.header-nav-logout:hover {
    opacity: 1;
}

/* ========================================
   Desktop Overrides (>= 768px)
   ======================================== */
@media (min-width: 768px) {
    /* Hide bottom nav on desktop */
    .bottom-nav {
        display: none;
    }

    /* Header becomes sticky, not fixed */
    .app-header {
        position: sticky;
        padding: 0 24px;
    }

    .header-inner {
        max-width: var(--container-max-desktop);
        margin: 0 auto;
    }

    /* Show desktop nav links in header */
    .header-nav {
        display: flex;
        gap: 8px;
        margin-left: auto;
    }

    .header-nav-link {
        color: var(--text-light);
        text-decoration: none;
        font-weight: 500;
        font-size: 14px;
        padding: 8px 14px;
        border-radius: var(--radius-sm);
        transition: background var(--transition-fast), color var(--transition-fast);
    }

    .header-nav-link:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .header-nav-link.active {
        color: var(--color-accent);
    }

    /* Main content: centered with padding */
    .app-main {
        padding-top: 24px;
        padding-bottom: 40px;
    }

    .app-main .container {
        max-width: var(--container-max-desktop);
        margin: 0 auto;
        padding: 0 20px;
    }

    .app-main .container--narrow {
        max-width: var(--container-narrow-desktop);
    }

    /* Page title */
    .page-title {
        font-size: 28px;
        margin-bottom: 24px;
    }

    /* Cards get border radius */
    .card, .word-card, .test-card, .result-card, .log-card {
        border-radius: var(--radius-lg);
        padding: 24px;
        margin-bottom: 16px;
    }

    /* Chinese text larger on desktop */
    .chinese {
        font-size: 48px;
    }

    .pinyin {
        font-size: 22px;
    }

    .english {
        font-size: 18px;
    }

    .english-word {
        font-size: 40px;
    }

    .phonetic {
        font-size: 18px;
    }

    .definition {
        font-size: 16px;
    }

    /* Button hover effects */
    button:hover, .btn:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-accent);
    }

    button:active, .btn:active {
        transform: translateY(0);
    }

    .btn-secondary:hover, .camera-btn:hover, .nav-btn:hover {
        box-shadow: var(--shadow-primary);
    }

    .speak-btn:hover {
        transform: scale(1.1);
        box-shadow: 0 5px 20px rgba(15, 52, 96, 0.4);
    }

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

    .edit-btn:hover {
        transform: scale(1.1);
        box-shadow: 0 5px 20px rgba(108, 117, 125, 0.4);
    }

    .mode-btn:hover:not(.selected) {
        border-color: var(--color-accent);
        color: var(--color-accent);
        transform: translateY(-2px);
        box-shadow: 0 5px 20px rgba(233, 69, 96, 0.2);
    }

    .mode-btn.selected:hover {
        transform: none;
        box-shadow: none;
    }

    /* Speak button on test page */
    .speak-btn {
        width: 60px;
        height: 60px;
        min-height: 60px;
        font-size: 28px;
    }

    /* Score */
    .score-value {
        font-size: 48px;
    }

    .score-box {
        padding: 30px;
    }

    /* Results */
    .result-chinese {
        font-size: 28px;
    }

    .result-english-word {
        font-size: 24px;
    }

    /* Nav buttons horizontal on desktop */
    .nav-buttons {
        flex-direction: row;
    }

    .nav-btn {
        padding: 18px;
        font-size: 18px;
    }

    /* Word card grid for desktop */
    .word-cards-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .word-cards-grid .word-card {
        margin-bottom: 0;
    }

    /* Chinese answer larger */
    .chinese-answer {
        font-size: 42px;
    }

    .english-answer {
        font-size: 32px;
    }

    /* Pagination */
    .pagination a:hover {
        background: var(--color-accent);
        color: white;
    }

    /* Textarea */
    textarea {
        font-size: 18px;
        min-height: 150px;
    }

    /* Edit input */
    .edit-input {
        font-size: 24px;
    }

    /* Test instruction */
    .test-instruction {
        font-size: 18px;
    }

    .english-definition {
        font-size: 24px;
        padding: 20px;
    }

    /* Credit link */
    .credit-link a {
        font-size: 14px;
    }

    .credit-link a:hover {
        color: var(--color-accent);
    }

    /* Log card */
    .log-content {
        font-size: 16px;
        padding: 15px;
        max-height: 200px;
    }

    /* Practice mode desktop */
    .practice-cards-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .practice-word-chinese {
        font-size: 40px;
    }

    .practice-pinyin {
        font-size: 18px;
    }

    .practice-english {
        font-size: 16px;
    }

    .practice-word-english {
        font-size: 34px;
    }

    .practice-phonetic {
        font-size: 17px;
    }

    .practice-definition {
        font-size: 15px;
    }

    .practice-card {
        padding: 20px;
    }

    .practice-timer {
        height: 40px;
    }

    .practice-timer-text {
        font-size: 16px;
    }
}

/* --- Practice Mode --- */
.practice-timer {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 30px;
    height: 36px;
    position: relative;
    overflow: hidden;
    margin-bottom: 16px;
}

.practice-timer-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(135deg, var(--color-success) 0%, var(--color-success-dark) 100%);
    border-radius: 30px;
    transition: width 1s linear;
}

.practice-timer-text {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.practice-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.practice-card {
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
    user-select: none;
    -webkit-user-select: none;
}

.practice-card-content {
    flex: 1;
    min-width: 0;
    transition: filter 0.4s ease, opacity 0.4s ease;
}

.practice-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 46, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    z-index: 2;
    border-radius: var(--radius-md);
}

.practice-card-overlay span {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 500;
}

.practice-card-speak {
    flex-shrink: 0;
    z-index: 3;
    position: relative;
}

.practice-card.covered .practice-card-content {
    filter: blur(8px);
    opacity: 0.3;
}

.practice-card.covered .practice-card-overlay {
    opacity: 1;
    pointer-events: auto;
    cursor: pointer;
}

.practice-card.covered.peeking .practice-card-content {
    filter: none;
    opacity: 1;
}

.practice-card.covered.peeking .practice-card-overlay {
    opacity: 0;
    pointer-events: none;
}

/* Chinese mode content */
.practice-word-chinese {
    font-size: 32px;
    font-family: var(--font-chinese);
    color: var(--color-primary);
    line-height: 1.2;
    margin-bottom: 4px;
}

.practice-pinyin {
    font-size: 16px;
    color: var(--color-accent);
    font-weight: 500;
    margin-bottom: 4px;
}

.practice-english {
    font-size: 14px;
    color: var(--text-secondary);
}

/* English mode content */
.practice-word-english {
    font-size: 28px;
    color: var(--color-primary);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 4px;
}

.practice-phonetic {
    font-size: 15px;
    color: var(--color-accent);
    font-weight: 500;
    font-style: italic;
    margin-bottom: 4px;
}

.practice-definition {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Practice button style */
.test-btn-practice {
    background: linear-gradient(135deg, var(--color-success) 0%, var(--color-success-dark) 100%);
}

/* --- Disable hover transforms on touch devices --- */
@media (hover: none) {
    button:hover, .btn:hover, .mode-btn:hover, .word-card:hover,
    .speak-btn:hover, .edit-btn:hover, .nav-btn:hover, .test-btn:hover,
    .camera-btn:hover, .upload-btn:hover, .home-btn:hover,
    .save-btn:hover, .cancel-btn:hover, .pagination a:hover {
        transform: none !important;
        box-shadow: inherit !important;
    }
}

/* --- Search Bar --- */
.search-bar {
    margin-bottom: 16px;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    background: #ffffff;
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font-system);
    outline: none;
    transition: border-color var(--transition-fast);
    box-sizing: border-box;
}

.search-input:focus {
    border-color: var(--color-accent);
}

.search-input::placeholder {
    color: var(--text-hint);
}

/* --- Log Title --- */
.log-title-row {
    margin-bottom: 8px;
}

.log-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background var(--transition-fast);
    display: inline-block;
}

.log-title:hover {
    background: #f0f4f8;
}

.log-title--empty {
    color: var(--text-hint);
    font-weight: 400;
    font-style: italic;
}

.log-title-input {
    width: 100%;
    padding: 4px 8px;
    border: 2px solid var(--color-accent);
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-system);
    color: var(--text-primary);
    outline: none;
    background: white;
    box-sizing: border-box;
}

/* --- Multi-Reading Characters --- */
.multi-reading-chinese {
    margin-bottom: 4px;
}

.multi-reading-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    font-weight: 600;
}

.readings-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reading-item {
    background: #f5f7fa;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    border-left: 3px solid var(--color-accent);
}

.reading-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.reading-pinyin {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-primary);
}

.speak-btn-sm {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 14px;
    padding: 0;
    border: none;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.reading-english {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* --- Voice Test --- */
.voice-test-area {
    margin-top: 16px;
    text-align: center;
}

.voice-test-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.voice-test-divider::before,
.voice-test-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e0e0e0;
}

.voice-test-divider span {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.mic-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 28px;
    background: #ffffff;
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
}

.mic-btn:active {
    transform: scale(0.96);
}

.mic-btn .mic-icon {
    font-size: 32px;
    line-height: 1;
}

.mic-btn .mic-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary);
}

.mic-btn.listening {
    border-color: var(--color-accent);
    background: #fff5f7;
    animation: mic-pulse 1.2s ease-in-out infinite;
}

.mic-btn.listening .mic-label {
    color: var(--color-accent);
}

@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(233, 69, 96, 0.3); }
    50% { box-shadow: 0 0 0 12px rgba(233, 69, 96, 0); }
}

.voice-result {
    margin-top: 12px;
    padding: 0;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    min-height: 0;
}

.voice-result:empty {
    display: none;
}

.voice-result--correct {
    display: block;
    background: #e8f5e9;
    color: #2e7d32;
    padding: 10px 14px;
    border: 1px solid #a5d6a7;
}

.voice-result--incorrect {
    display: block;
    background: #fce4ec;
    color: #c62828;
    padding: 10px 14px;
    border: 1px solid #ef9a9a;
}

.voice-result--error {
    display: block;
    background: #fff3e0;
    color: #e65100;
    padding: 10px 14px;
    border: 1px solid #ffcc80;
}

/* --- Mini Mic Button (Practice Mode) --- */
.practice-card-speak {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.mic-btn-mini {
    width: 40px;
    height: 40px;
    border: 2px solid var(--color-primary);
    border-radius: 50%;
    background: #ffffff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.mic-btn-mini:active {
    transform: scale(0.9);
}

.mic-btn-mini.listening {
    border-color: var(--color-accent);
    background: #fff5f7;
    animation: mic-pulse 1.2s ease-in-out infinite;
}

.voice-result-mini {
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    max-width: 80px;
    line-height: 1.2;
    word-break: break-word;
}

.voice-result-mini:empty {
    display: none;
}

.voice-result-mini--correct {
    color: #2e7d32;
}

.voice-result-mini--incorrect {
    color: #c62828;
}

.voice-result-mini--error {
    color: #e65100;
}

/* --- Log Action Buttons --- */
.log-actions {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-shrink: 0;
}

.log-action-btn {
    padding: 5px 10px;
    border: none;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    color: white;
    white-space: nowrap;
}

.log-action-random {
    background: var(--color-accent);
}

.log-action-order {
    background: var(--color-primary);
}

.log-action-practice {
    background: var(--color-success);
}
