* {margin: 0;padding: 0;box-sizing: border-box;}
body {font-family: 'Microsoft YaHei', Arial, sans-serif;background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);min-height: 100vh;display: flex;flex-direction: column;align-items: center;padding: 15px;padding-top: 85px;}
.top-bar {width: 100%;max-width: 420px;display: flex;justify-content: space-between;align-items: center;margin-bottom: 20px;margin-top: 0;flex-wrap: wrap;gap: 10px;}
.progress-info {position: absolute;top: 50px;left: 20px;color: #999;font-size: 13px;font-weight: bold;}
.controls {display: flex;gap: 12px;align-items: center;flex-wrap: wrap;}
.switch-container {display: flex;align-items: center;gap: 6px;background: rgba(255,255,255,0.2);padding: 6px 12px;border-radius: 20px;backdrop-filter: blur(10px);}
.switch-container label {color: white;font-size: 13px;white-space: nowrap;}
.switch {position: relative;width: 44px;height: 24px;}
.switch input {opacity: 0;width: 0;height: 0;}
.slider {position: absolute;cursor: pointer;top: 0;left: 0;right: 0;bottom: 0;background-color: #ccc;transition: 0.4s;border-radius: 34px;}
.slider:before {position: absolute;content: "";height: 18px;width: 18px;left: 3px;bottom: 3px;background-color: white;transition: 0.4s;border-radius: 50%;}
input:checked + .slider {background-color: #4CAF50;}
input:checked + .slider:before {transform: translateX(20px);}
.vocabulary-btn {background: #6a1b9a;color: white;border: none;padding: 8px 16px;border-radius: 20px;cursor: pointer;font-size: 14px;font-weight: bold;display: flex;align-items: center;gap: 6px;box-shadow: 0 4px 15px rgba(0,0,0,0.3);transition: all 0.3s;}
.vocabulary-btn:hover {background: #8e24aa;transform: translateY(-2px);box-shadow: 0 6px 20px rgba(0,0,0,0.4);}
.card-row {display: flex;align-items: flex-start;justify-content: center;gap: 12px;margin-bottom: 25px;}
.card-col {display: flex;flex-direction: column;align-items: stretch;width: 340px;}
.card-container {perspective: 1000px;width: 100%;height: 480px;position: relative;margin-bottom: 20px;}
.side-btns {display: flex;flex-direction: column;gap: 10px;padding-top: 0;}
.side-btn {background: #ff9800;color: white;border: none;padding: 12px 14px;border-radius: 14px;cursor: pointer;font-weight: bold;box-shadow: 0 4px 12px rgba(0,0,0,0.25);transition: all 0.3s;text-align: center;display: flex;flex-direction: column;align-items: center;justify-content: center;gap: 2px;}
.side-btn .btn-zh {font-size: 13px;white-space: nowrap;}
.side-btn .btn-en {font-size: 10px;white-space: nowrap;opacity: 0.9;}
.side-btn:hover {background: #fb8c00;transform: translateY(-2px);box-shadow: 0 6px 16px rgba(0,0,0,0.35);}
.card {width: 100%;height: 100%;position: relative;transform-style: preserve-3d;transition: transform 0.6s;cursor: pointer;}
.card.flipped {transform: rotateY(180deg);}
.card-face {position: absolute;width: 100%;height: 100%;backface-visibility: hidden;border-radius: 20px;display: flex;flex-direction: column;justify-content: center;align-items: center;padding: 40px;box-shadow: 0 10px 30px rgba(0,0,0,0.3);}
.card-front {background: #FFF9E6;}
.card-back {background: #E3F2FD;transform: rotateY(180deg);}
.unit-label {position: absolute;top: 15px;left: 20px;color: #999;font-size: 14px;font-weight: bold;max-width: 70%;line-height: 1.3;}
.favorite-btn {position: absolute;top: 15px;right: 15px;background: none;border: none;font-size: 32px;cursor: pointer;transition: transform 0.3s;z-index: 10;}
.favorite-btn:hover {transform: scale(1.2);}
.favorite-btn.active {color: #ff1744;}
.favorite-btn:not(.active) {color: #ccc;}
.word-display {font-size: 56px;font-weight: bold;color: #2196F3;margin-bottom: 15px;max-width: 100%;text-align: center;line-height: 1.1;white-space: nowrap;overflow: visible;}
.word-display.long-word {font-size: 42px;}
.word-display.very-long-word {font-size: 32px;}
.word-pos {font-size: 20px;color: #999;font-style: italic;margin-bottom: 30px;}
.speaker-btn {background: none;border: none;font-size: 48px;cursor: pointer;transition: transform 0.2s;}
.speaker-btn:hover {transform: scale(1.1);}
.word-info {font-size: 28px;color: #333;text-align: center;line-height: 1.6;word-wrap: break-word;word-break: break-word;max-width: 100%;}
.navigation {display: flex;gap: 15px;width: 100%;margin-bottom: 15px;}
.nav-btn {flex: 1;background: #2196F3;color: white;border: none;padding: 16px;font-size: 16px;font-weight: bold;cursor: pointer;transition: all 0.3s;border-radius: 12px;box-shadow: 0 4px 10px rgba(0,0,0,0.2);}
.nav-btn:hover:not(:disabled) {background: #1976D2;transform: translateY(-2px);box-shadow: 0 6px 15px rgba(0,0,0,0.3);}
.nav-btn:disabled {background: #B0BEC5;cursor: not-allowed;opacity: 0.6;}
.unit-actions {display: flex;flex-direction: row;gap: 15px;width: 100%;margin-bottom: 20px;}
.unit-action-btn {flex: 1;background: #FFD700;color: #000;border: 3px solid #000;padding: 16px 10px;font-size: 16px;font-weight: 900;border-radius: 12px;cursor: pointer;box-shadow: 0 4px 15px rgba(0,0,0,0.3);transition: all 0.3s;}
.unit-action-btn:hover {background: #FFC700;transform: translateY(-3px);box-shadow: 0 8px 25px rgba(0,0,0,0.4);}
.hidden {display: none !important;}
.unit-navigation {display: grid;grid-template-columns: repeat(5, 1fr);gap: 10px;justify-content: center;width: 100%;max-width: 480px;padding: 16px;background: rgba(255,255,255,0.1);border-radius: 15px;backdrop-filter: blur(10px);margin-top: 15px;}
.unit-btn {background: rgba(255,255,255,0.3);color: white;border: 2px solid transparent;padding: 12px 8px;border-radius: 10px;cursor: pointer;font-size: 14px;font-weight: bold;transition: all 0.3s;backdrop-filter: blur(5px);}
.unit-btn:hover {background: rgba(255,255,255,0.5);transform: translateY(-2px);}
.unit-btn.active {background: #FFD700;color: #000;border-color: #FFA500;box-shadow: 0 4px 15px rgba(255,215,0,0.5);}
.modal {display: none;position: fixed;z-index: 1000;left: 0;top: 0;width: 100%;height: 100%;background-color: rgba(0,0,0,0.6);backdrop-filter: blur(5px);}
.modal-content {background-color: #fff;margin: 5% auto;padding: 30px;border-radius: 20px;width: 90%;max-width: 600px;max-height: 80vh;overflow-y: auto;box-shadow: 0 10px 40px rgba(0,0,0,0.3);}
.modal-header {display: flex;justify-content: space-between;align-items: center;margin-bottom: 25px;padding-bottom: 15px;border-bottom: 2px solid #eee;}
.modal-header h2 {color: #6a1b9a;font-size: 24px;}
.close {color: #aaa;font-size: 32px;font-weight: bold;cursor: pointer;transition: color 0.3s;}
.close:hover {color: #000;}
.vocabulary-list {margin-bottom: 20px;}
.unit-group {margin-bottom: 25px;background: #f9f9f9;padding: 15px;border-radius: 10px;}
.unit-title {font-size: 18px;font-weight: bold;color: #6a1b9a;margin-bottom: 12px;padding-bottom: 8px;border-bottom: 2px solid #6a1b9a;}
.vocab-item {display: flex;justify-content: space-between;align-items: center;padding: 10px;margin: 8px 0;background: white;border-radius: 8px;border-left: 4px solid #6a1b9a;}
.vocab-text {flex: 1;font-size: 15px;color: #333;}
.delete-btn {background: none;border: none;color: #ff5722;font-size: 14px;font-weight: bold;cursor: pointer;padding: 5px 12px;border-radius: 5px;transition: all 0.3s;}
.delete-btn:hover {background: #ffe0db;color: #d84315;}
.save-btn {background: #4CAF50;color: white;border: none;padding: 12px 30px;border-radius: 25px;cursor: pointer;font-size: 16px;font-weight: bold;box-shadow: 0 4px 15px rgba(0,0,0,0.2);transition: all 0.3s;flex: 1;}
.save-btn:hover {background: #45a049;transform: translateY(-2px);box-shadow: 0 6px 20px rgba(0,0,0,0.3);}
.modal-buttons {display: flex;gap: 15px;width: 100%;}
.back-btn {background: #FF5722;color: white;border: none;padding: 12px 30px;border-radius: 25px;cursor: pointer;font-size: 16px;font-weight: bold;box-shadow: 0 4px 15px rgba(0,0,0,0.2);transition: all 0.3s;flex: 1;}
.back-btn:hover {background: #E64A19;transform: translateY(-2px);box-shadow: 0 6px 20px rgba(0,0,0,0.3);}
.empty-message {text-align: center;color: #999;font-size: 16px;padding: 40px;}
#practiceMode {display: none;flex-direction: column;align-items: center;width: 100%;max-width: 500px;margin-top: 60px;}
.page-exit-btn {position: fixed;top: 20px;right: 20px;background: #ff5722;color: white;border: none;padding: 10px 20px;border-radius: 10px;cursor: pointer;font-size: 15px;font-weight: bold;box-shadow: 0 4px 15px rgba(0,0,0,0.3);z-index: 100;}
.practice-card {background: #FFF9E6;border-radius: 20px;box-shadow: 0 10px 30px rgba(0,0,0,0.3);width: 100%;min-height: 350px;padding: 40px;position: relative;display: flex;flex-direction: column;justify-content: center;align-items: center;margin-bottom: 20px;}
.unit-indicator {position: absolute;top: 20px;left: 20px;color: #999;font-size: 16px;font-weight: bold;}
.practice-progress {position: absolute;top: 45px;left: 20px;color: #999;font-size: 14px;font-weight: bold;}
.practice-word {font-size: 32px;color: #333;text-align: center;margin-bottom: 30px;}
.input-area {width: 100%;max-width: 400px;margin-bottom: 20px;}
.input-group {display: flex;gap: 10px;}
.practice-input {flex: 1;padding: 12px 16px;font-size: 18px;border: 2px solid #ddd;border-radius: 10px;outline: none;}
.practice-input:focus {border-color: #2196F3;}
.input-btn {padding: 12px 20px;font-size: 16px;font-weight: bold;border: none;border-radius: 10px;cursor: pointer;white-space: nowrap;}
.submit-btn {background: #2196F3;color: white;}
.reset-btn {background: #4CAF50;color: white;}
.report-modal {display: none;position: fixed;z-index: 2000;left: 0;top: 0;width: 100%;height: 100%;background-color: rgba(0,0,0,0.8);}
.report-content {background-color: #fff;margin: 3% auto;padding: 30px;border-radius: 20px;width: 90%;max-width: 700px;max-height: 90vh;overflow-y: auto;}
.report-header {text-align: center;margin-bottom: 25px;padding-bottom: 15px;border-bottom: 3px solid #FFD700;}
.report-header h2 {color: #6a1b9a;font-size: 28px;}
.report-stats {background: #f0f0f0;padding: 20px;border-radius: 10px;margin-bottom: 20px;text-align: center;}
.accuracy-rate {font-size: 32px;font-weight: bold;color: #4CAF50;margin: 15px 0;}
.report-unit {font-size: 20px; font-weight: bold; color: #333; margin-bottom: 8px;}
.report-meta {font-size: 15px; color: #555; margin: 4px 0;}
.report-date {font-size: 13px; color: #aaa; margin-top: 12px;}
.report-columns {display: flex;gap: 20px;margin-top: 20px;}
.error-column {flex: 1;background: #fff;padding: 15px;border-radius: 10px;}
.correct-column {flex: 1;background: #e8f5e9;padding: 15px;border-radius: 10px;}
.column-title {font-size: 18px;font-weight: bold;margin-bottom: 15px;padding-bottom: 10px;border-bottom: 2px solid;}
.error-column .column-title {color: #f44336;border-bottom-color: #f44336;}
.correct-column .column-title {color: #4CAF50;border-bottom-color: #4CAF50;}
.error-item {background: #fff;border-left: 4px solid #ff5722;padding: 10px;margin: 8px 0;border-radius: 5px;}
.correct-word {background: white;padding: 8px 12px;margin: 8px 0;border-radius: 5px;border-left: 4px solid #4CAF50;font-size: 14px;color: #333;}
.red-letter {color: red;font-weight: bold;}
.close-report-btn {background: #2196F3;color: white;border: none;padding: 12px 30px;border-radius: 25px;cursor: pointer;font-size: 16px;font-weight: bold;margin: 20px auto;display: block;}
#matchMode {display: none;flex-direction: column;align-items: center;width: 100%;color: white;margin-top: 60px;}
#matchMode .header {text-align: center;margin-bottom: 15px;width: 100%;}
#matchMode .stats-bar {background: rgba(255, 255, 255, 0.2);backdrop-filter: blur(10px);padding: 8px 20px;border-radius: 50px;margin-bottom: 20px;font-weight: bold;font-size: 15px;display: inline-block;}
#matchMode .match-grid {display: grid;grid-template-columns: repeat(4, minmax(0, 1fr));gap: 8px;width: 100%;max-width: 500px;margin: 0 auto 20px auto;}
#matchMode .match-card {background: #FFF9E6;color: #333;aspect-ratio: 1.3 / 1;border-radius: 10px;display: flex;justify-content: center;align-items: center;cursor: pointer;font-size: 13px;font-weight: bold;text-align: center;padding: 4px;box-shadow: 0 4px 8px rgba(0,0,0,0.15);transition: 0.15s;border: 3px solid transparent;user-select: none;word-break: break-word;line-height: 1.2;}
#matchMode .match-card.selected {border-color: #FFD700;background-color: #E3F2FD;transform: scale(0.98);}
#matchMode .match-card.matched {opacity: 0;pointer-events: none;visibility: hidden;}
#matchMode .match-card.error {background-color: #ff7675;color: white;animation: shake 0.4s;}
@keyframes shake {0%, 100% {transform: translateX(0);}25% {transform: translateX(-5px);}75% {transform: translateX(5px);}}
#matchMode .unit-navigation {display: grid;grid-template-columns: repeat(5, 1fr);gap: 8px;width: 100%;max-width: 480px;padding: 12px;background: rgba(255,255,255,0.15);border-radius: 16px;margin-top: 15px;}
#matchMode .unit-btn {background: rgba(255,255,255,0.25);color: white;border: 2px solid transparent;padding: 10px 0;border-radius: 8px;cursor: pointer;font-size: 12px;font-weight: bold;}
#matchMode .unit-btn.active {background: #FFD700;color: #000;border-color: #FFA500;box-shadow: 0 4px 15px rgba(255,215,0,0.5);}
#win-overlay {display: none;position: fixed;inset: 0;background: rgba(0,0,0,0.85);backdrop-filter: blur(5px);flex-direction: column;justify-content: center;align-items: center;z-index: 100;}
#matchMode .btn {padding: 12px 35px;background: #6c5ce7;color: white;border: none;border-radius: 25px;cursor: pointer;font-weight: bold;margin: 10px;font-size: 16px;box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);}
@media (max-width: 600px) {
    .word-display {font-size: 42px;}
    .word-info {font-size: 22px;}
    .card-row {gap: 10px;}
    .card-col {width: 280px;}
    .card-container {height: 420px;}
    .side-btn {padding: 10px 10px;}
    .side-btn .btn-zh {font-size: 11px;}
    .side-btn .btn-en {font-size: 9px;}
    .unit-navigation {max-width: 100%;padding: 15px;gap: 10px;}
    .unit-btn {padding: 12px 8px;font-size: 13px;}
    .practice-word {font-size: 24px;}
    .practice-input {font-size: 16px;}
    .input-btn {padding: 10px 15px;font-size: 14px;}
    .practice-card {min-height: 300px;padding: 30px 20px;}
    #matchMode .match-card {font-size: 11px;}
    #matchMode .match-grid {gap: 6px;}
    .report-columns {flex-direction: column;}
}
.book-title {position: fixed;top: 20px;left: 50%;transform: translateX(-50%);color: #FFD700;font-size: 26px;font-weight: 900;text-shadow: 2px 2px 8px rgba(0,0,0,0.6), 0 0 20px rgba(255,215,0,0.3);z-index: 999;padding: 0;letter-spacing: 2px;}
/* ========== 追加到 style.css 末尾 ========== */

/* ---- 寻宝迷宫容器 ---- */
#searchMode {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 860px;
    margin-top: 60px;
    color: white;
}

/* 标题栏 */
.search-header {
    text-align: center;
    margin-bottom: 16px;
    width: 100%;
}
.search-header h2 {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 1px;
    margin-bottom: 6px;
}
.search-stats {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    padding: 6px 20px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: bold;
}

/* 主体区域：左矩阵 + 右列表 */
.search-body {
    display: flex;
    gap: 20px;
    width: 100%;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
}

/* 字母矩阵外框 */
.search-grid-wrap {
    background: rgba(255,255,255,0.12);
    border-radius: 16px;
    padding: 12px;
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    user-select: none;
    touch-action: none; /* 阻止触摸滚动，保证划线流畅 */
}

/* 10×10 网格 */
.search-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
}

/* 单个格子 */
.search-cell {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 900;
    border-radius: 8px;
    background: rgba(255,255,255,0.15);
    color: white;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    letter-spacing: 0;
}

/* 划选中（拖动轨迹） */
.search-cell.selected {
    background: rgba(255, 235, 59, 0.55);
    color: #333;
    transform: scale(1.08);
    box-shadow: 0 0 8px rgba(255,235,59,0.6);
}

/* 已找到（永久锁定绿色） */
.search-cell.found {
    background: rgba(76, 175, 80, 0.75);
    color: white;
    box-shadow: 0 0 10px rgba(76,175,80,0.5);
}

/* 右侧单词列表 */
.search-word-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 160px;
    max-width: 200px;
    background: rgba(255,255,255,0.12);
    border-radius: 16px;
    padding: 16px 14px;
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    align-self: stretch;
}
.search-word-list h3 {
    font-size: 14px;
    font-weight: bold;
    color: #FFD700;
    margin-bottom: 4px;
    text-align: center;
    letter-spacing: 1px;
}
.search-word-item {
    background: rgba(255,255,255,0.18);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 15px;
    font-weight: bold;
    color: white;
    text-align: center;
    transition: all 0.3s;
}
.search-word-item.done {
    text-decoration: line-through;
    background: rgba(76,175,80,0.35);
    color: rgba(255,255,255,0.5);
}

/* 通关遮罩 */
#searchWinOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.82);
    backdrop-filter: blur(6px);
    z-index: 200;
    justify-content: center;
    align-items: center;
}
#searchWinOverlay.show {
    display: flex;
}
.search-win-box {
    background: linear-gradient(135deg,#1a1a2e,#16213e);
    border: 2px solid #FFD700;
    border-radius: 24px;
    padding: 40px 50px;
    text-align: center;
    color: white;
    box-shadow: 0 0 60px rgba(255,215,0,0.3);
}
.search-win-box h2 {
    font-size: 30px;
    margin: 12px 0 8px;
    color: #FFD700;
}
.search-win-box p {
    font-size: 16px;
    margin-bottom: 24px;
    color: #eee;
}
.search-win-btn {
    background: #FFD700;
    color: #333;
    border: none;
    padding: 12px 36px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(255,215,0,0.4);
    transition: transform 0.2s;
}
.search-win-btn:hover { transform: scale(1.05); }

/* 响应式适配 */
@media (max-width: 600px) {
    .search-cell { width: 30px; height: 30px; font-size: 13px; border-radius: 6px; }
    .search-grid { gap: 3px; }
    .search-word-list { min-width: 130px; max-width: 160px; padding: 12px 10px; }
    .search-word-item { font-size: 13px; padding: 6px 8px; }
}

/* ---- 寻宝迷宫追加样式（覆盖/补充） ---- */
/* 进度条（与消消乐同风格） */
.search-stats-bar {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    padding: 7px 22px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 15px;
    color: white;
    margin-top: 6px;
}

/* 单元导航（复用 matchMode 风格） */
#searchMode .unit-navigation {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 480px;
    padding: 12px;
    background: rgba(255,255,255,0.15);
    border-radius: 16px;
    margin-top: 18px;
}
#searchMode .unit-btn {
    background: rgba(255,255,255,0.25);
    color: white;
    border: 2px solid transparent;
    padding: 10px 0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
}
#searchMode .unit-btn.active {
    background: #FFD700;
    color: #000;
    border-color: #FFA500;
    box-shadow: 0 4px 15px rgba(255,215,0,0.5);
}

@media (max-width: 600px) {
    .search-stats-bar { font-size: 13px; padding: 6px 16px; }
    #searchMode .unit-navigation { max-width: 100%; padding: 10px; gap: 6px; }
    #searchMode .unit-btn { font-size: 11px; padding: 8px 0; }
}
