﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft JhengHei', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    background-attachment: fixed !important;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* 主畫面 */
.main-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    max-width: 1200px;
    gap: 20px;
    padding: 20px;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.main-title {
    font-size: 40px;
    color: white;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    font-weight: bold;
    letter-spacing: 6px;
    margin-bottom: 10px;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-10px); }
}

.menu-buttons {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.menu-button {
    background: white;
    border: none;
    border-radius: 20px;
    padding: 0;
    width: 6cm;
    height: 4cm;
    min-width: 6cm;
    min-height: 4cm;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.menu-button:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.menu-button:active {
    transform: translateY(-4px) scale(1.02);
}

.button-icon {
    font-size: 60px;
    line-height: 1;
}

.button-text {
    font-size: 28px;
    font-weight: bold;
    color: #667eea;
    line-height: 1;
}

.button-desc {
    font-size: 20px;
    color: #888;
    font-weight: 500;
}

/* 注音選擇器 */
.zhuyin-selector {
    width: 90%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.selector-title {
    font-size: 20px;
    color: white;
    font-weight: bold;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.zhuyin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 8px;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.zhuyin-key {
    aspect-ratio: 1;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.zhuyin-key:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.zhuyin-key.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    transform: scale(1.05);
}

.zhuyin-key.all-btn {
    grid-column: span 2;
    background: #ffd700;
    border-color: #ffc700;
    color: #333;
}

.zhuyin-key.all-btn.selected {
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
    color: white;
}

.zhuyin-key.start-btn {
    grid-column: span 2;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-weight: bold;
    font-size: 20px;
}

.zhuyin-key.start-btn:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8b 100%);
    transform: translateY(-3px);
}

.start-practice-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 18px 60px;
    font-size: 26px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    margin-top: 20px;
    z-index: 10;
    position: relative;
}

.start-practice-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.6);
}

.start-practice-btn:active {
    transform: translateY(-1px);
}


/* 返回主畫面按鈕 */
.back-to-menu {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 15px;
    padding: 12px 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: bold;
    color: #667eea;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.back-to-menu:hover {
    background: white;
    transform: translateX(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.back-to-menu svg {
    color: #667eea;
}


.container {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    position: relative;
}

/* 撌血蝧駁??? */
.nav-button {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.nav-button:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.nav-button:active {
    transform: scale(0.95);
}

.nav-button svg {
    color: #667eea;
}

.nav-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: scale(1);
}

.card-wrapper {
    perspective: 1000px;
    width: 450px;
    height: 650px;
}

.card {
    position: relative;
    width: 100%;
    height: 100%;
    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;
    background: white;
    border-radius: 25px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 30px;
    padding-bottom: 100px;
    overflow-y: auto;
}

.card-front {
    z-index: 2;
}

.card-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.zhuyin-large {
    font-size: 120px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 15px;
    margin-top: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.sound-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: none;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.sound-button svg {
    width: 45px;
    height: 45px;
}

.sound-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.6);
}

.sound-button:active {
    transform: scale(0.95);
}

.sound-button svg {
    color: white;
}

.word-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 5px;
    flex: 1;
}

/* 詞句區塊 */
.word-item, .sentence-item { display: flex; flex-direction: row; align-items: center; justify-content: space-between; padding: 15px 20px; background: rgba(102, 126, 234, 0.05); border-radius: 12px; border-left: 4px solid #667eea; min-height: 70px; gap: 15px; }

.word-content {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex: 1;
}

.word-char { 
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
}

.char-text {
    font-size: 42px;
    font-weight: bold;
    display: block;
}

/* 注音直書 */
.zhuyin-vertical { 
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #667eea;
    font-weight: normal;
    line-height: 1;
    min-height: 26px;
}

.zhuyin-char { 
    writing-mode: vertical-rl;
    letter-spacing: 0px;
}

.zhuyin-tone { 
    font-size: 10px;
    display: inline-block;
    margin-left: 2px;
    writing-mode: horizontal-tb;
}

.sentence-content { 
    font-size: 24px;
    font-weight: 500;
    color: #000;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
    flex: 1;
}

.sentence-content .word-char {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
}

.sentence-content .char-text {
    font-size: 24px;
    font-weight: 500;
}

/* 播放按鈕 */
.play-button { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; border: none; border-radius: 50%; width: 45px; height: 45px; min-width: 45px; display: flex; justify-content: center; align-items: center; cursor: pointer; color: white; transition: all 0.3s ease; flex-shrink: 0; }

.play-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.5);
}

    transform: scale(0.95);
}

.play-button svg {
    color: white;
    margin-left: 2px;
    width: 20px;
    height: 20px;
}

/* 蝧餉?閫貊???- 摨蝧餉??? */
.flip-button-bottom { position: absolute; bottom: 0; left: 0; right: 0; height: 60px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.3s ease; z-index: 100; margin-top: 80px; }

.flip-button-bottom:hover {
    background: rgba(102, 126, 234, 0.2);
}

.flip-button-bottom::before {
    content: '點我翻轉卡牌';
    font-size: 16px;
    color: #667eea;
    font-weight: bold;
}

/* ??蕃頧???*/
.card-back .flip-button-bottom { position: absolute; bottom: 0; left: 0; right: 0; height: 60px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.3s ease; z-index: 100; margin-top: 80px; }

.card-back .flip-button-bottom:hover {
    background: rgba(255, 255, 255, 0.3);
}

.card-back .flip-button-bottom::before {
    content: '點我回到正面';
    color: white;
}

/* ??質儘蝺渡?璅?? */
.back-title {
    font-size: 32px;
    font-weight: bold;
    color: white;
    margin-bottom: 30px;
    text-align: center;
}

.listening-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 30px;
    flex: 1;
    padding: 20px 0;
    padding-bottom: 80px; /* 為底部翻轉按鈕留空間 */
}

/* 音頻按鈕區域 */
.audio-buttons-area {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.sound-button-small {
    background: white;
    border: none;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.sound-button-small:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.sound-button-small svg {
    width: 40px;
    height: 40px;
    fill: #667eea;
}

/* 圖片區域 */
.images-area {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
}

.listening-image {
    width: 45%;
    height: 200px;
    background: white;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-size: 48px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.listening-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: -1;
}

.listening-image:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.listening-image img {
    width: 70%;
    height: 70%;
    object-fit: contain;
    background: white;
}

.image-text {
    font-size: 72px;
    color: #667eea;
}

/* 舊的樣式(保留以防其他地方使用) */
.listening-group {
    width: 100%;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 20px;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.listening-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.sound-button-small:active {
    transform: scale(0.95);
}

.sound-button-small svg {
    color: #667eea;
}

/* ?踵?撘身閮?*/
@media (max-width: 480px) {
    .card-wrapper {
        width: 90%;
        height: 500px;
    }
    
    .zhuyin-large {
        font-size: 100px;
    }
    
    .word {
        font-size: 24px;
    }
    
    .sentence {
        font-size: 18px;
    }
}


.listening-img {
    width: 60%;
    height: 60%;
    object-fit: contain;
    background: white;
}

/* 翅膀圖片特別放大 */
.listening-img[alt="翅膀"] {
    width: 80%;
    height: 80%;
}

/* 草地、菜園、早上圖片放大 */
.listening-img[alt="草地"],
.listening-img[alt="菜園"],
.listening-img[alt="早上"] {
    width: 85%;
    height: 85%;
}



