/* 全域樣式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft JhengHei', 'PingFang TC', 'Noto Sans TC', '微軟正黑體', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-text-size-adjust: none;
    -webkit-user-select: none;
    user-select: none;
}

.app-container {
    max-width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

/* 頁首樣式 */
.header {
    width: 100%;
    max-width: 800px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 0 20px;
}

.header h1 {
    color: white;
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.settings-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 1.8rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* 檔案匯入區域 */
.import-section {
    width: 100%;
    max-width: 600px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
}

.import-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 500px;
}

.import-card h2 {
    color: #333;
    font-size: 2rem;
    margin-bottom: 15px;
}

.import-card p {
    color: #666;
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.import-btn {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    border: none;
    border-radius: 15px;
    padding: 20px 40px;
    font-size: 1.3rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    margin-bottom: 20px;
}

.import-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.file-info {
    font-size: 1rem;
    color: #666;
    margin-top: 15px;
}

/* Flash Card 容器 */
.card-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
}

/* 進度條 */
.progress-bar {
    width: 100%;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Flash Card 樣式 */
.flash-card {
    width: 100%;
    max-width: 600px;
    height: 450px;
    background: white;
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    margin-bottom: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.flash-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.card-content {
    text-align: center;
    width: 100%;
    padding: 40px 40px 80px 40px; /* 增加底部間距避免與進度重疊 */
}

.chinese-character {
    font-size: 180px;
    color: #333;
    font-weight: bold;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    line-height: 1;
    font-family: 'Microsoft JhengHei', 'PingFang TC', 'Noto Sans TC', '微軟正黑體', '標楷體', serif;
}

.card-info {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 移除重複的 .card-number 定義，統一在後面定義 */

/* 控制按鈕 */
.controls {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.control-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    border: none;
    border-radius: 15px;
    padding: 15px 25px;
    font-size: 1.1rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    min-width: 120px;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 動作按鈕 */
.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 1rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.action-btn:hover {
    background: white;
    color: #667eea;
    transform: translateY(-2px);
}

/* 設定面板 */
.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    z-index: 1000;
    min-width: 350px;
}

.settings-panel h3 {
    color: #333;
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-align: center;
}

.setting-item {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.setting-item label {
    color: #333;
    font-size: 1.1rem;
}

.setting-item input[type="range"] {
    width: 120px;
    margin: 0 10px;
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

.close-settings-btn {
    background: #667eea;
    border: none;
    border-radius: 10px;
    padding: 12px 24px;
    color: white;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    font-size: 1rem;
}

/* 成功訊息 */
.success-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.success-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    max-width: 400px;
    width: 90%;
}

.success-content h2 {
    color: #4CAF50;
    font-size: 2rem;
    margin-bottom: 15px;
}

.success-content p {
    color: #333;
    font-size: 1.2rem;
    margin-bottom: 25px;
}

/* 語音按鈕樣式 */
.speak-btn {
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.speak-btn:hover {
    background: #45a049;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

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

/* 移除重複的 .card-info 定義 */

.card-number {
    background: rgba(102, 126, 234, 0.2);
    color: #667eea;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: 500;
}

/* 設定面板中的語音控制 */
.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

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

.setting-item label {
    font-weight: 500;
    color: #333;
    margin-right: 15px;
}

.setting-item input[type="range"] {
    flex: 1;
    margin: 0 15px;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #4CAF50;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.setting-item input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #4CAF50;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #4CAF50;
}

.setting-item span {
    min-width: 60px;
    text-align: right;
    color: #666;
    font-size: 0.9rem;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .chinese-character {
        font-size: 150px !important;
    }
    
    .flash-card {
        height: 400px;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .control-btn {
        width: 80%;
        max-width: 250px;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .chinese-character {
        font-size: 120px !important;
    }
    
    .flash-card {
        height: 350px;
    }
    
    .import-card {
        padding: 30px 20px;
    }

    .speak-btn {
        width: 35px;
        height: 35px;
        font-size: 1rem;
        margin-left: 10px;
    }
    
    .card-info {
        bottom: 15px;
        left: 15px;
        right: 15px;
    }
    
    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 25px;
    }
    
    .setting-item label {
        margin-bottom: 10px;
        margin-right: 0;
    }
    
    .setting-item input[type="range"] {
        width: 100%;
        margin: 10px 0;
    }
}

/* 觸控優化 */
@media (hover: none) and (pointer: coarse) {
    .control-btn:hover,
    .import-btn:hover,
    .flash-card:hover,
    .settings-btn:hover,
    .action-btn:hover {
        transform: none;
    }
    
    .control-btn:active,
    .import-btn:active,
    .flash-card:active,
    .settings-btn:active,
    .action-btn:active {
        transform: scale(0.95);
    }
}

/* 動畫效果 */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes flipCard {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(90deg); }
    100% { transform: rotateY(0deg); }
}

.card-flip {
    animation: flipCard 0.6s ease-in-out;
}

.slide-in {
    animation: slideIn 0.5s ease-out;
} 

/* 語音播放時的視覺反饋 */
.chinese-character.speaking {
    animation: speaking-glow 1.5s ease-in-out infinite;
}

@keyframes speaking-glow {
    0%, 100% { 
        color: #333; 
        text-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
        transform: scale(1);
    }
    50% { 
        color: #667eea; 
        text-shadow: 0 0 25px rgba(102, 126, 234, 0.8), 0 0 35px rgba(102, 126, 234, 0.6);
        transform: scale(1.02);
    }
}

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