/* 肥皂糖果遊戲專用樣式 */

/* 語言選擇頁面樣式 */
.theme-card {
    min-height: 200px;
}

.loading-card,
.error-card {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    background: var(--color-white);
    border: 2px dashed var(--color-purple);
    border-radius: 16px;
}

.error-card {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

/* 設定頁面樣式 */
.settings-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 2rem;
    background: var(--color-white);
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.setting-group {
    margin-bottom: 2rem;
}

.setting-label {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-black);
    margin-bottom: 0.5rem;
}

.setting-select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    border: 2px solid var(--color-purple);
    border-radius: 8px;
    background: var(--color-white);
    color: var(--color-black);
    cursor: pointer;
    transition: all 0.3s ease;
}

.setting-select:hover {
    border-color: var(--color-blue);
    background: rgba(187, 145, 255, 0.1);
}

.setting-select:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px rgba(73, 123, 255, 0.2);
}

/* Settings 頁面的開始遊戲按鈕 */
.settings-container .start-button {
    width: 100%;
    margin-top: 1rem;
}

/* 遊戲進行頁面樣式 */
.game-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--color-white);
}

.game-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--color-purple), var(--color-blue));
    color: var(--color-white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.header-left {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.header-center {
    text-align: center;
    padding: 0 1rem;
}

.header-center h2 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--color-white);
}

.back-button {
    color: var(--color-white);
    text-decoration: none;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: background-color 0.3s ease;
    display: inline-block;
    white-space: nowrap;
}

.back-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.back-button:active {
    background-color: rgba(255, 255, 255, 0.3);
}

.game-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
}

/* 倒數計時顯示 */
.timer-display {
    font-size: 6rem;
    font-weight: 700;
    color: var(--color-black);
    margin-bottom: 3rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.1em;
}

/* 語音顯示 */
.voice-display {
    width: 100%;
    max-width: 600px;
    margin-bottom: 3rem;
    text-align: center;
}

.voice-text {
    font-size: 3rem;
    font-weight: 700;
    color: var(--color-white);
    background: linear-gradient(135deg, var(--color-purple), var(--color-blue));
    padding: 2rem 3rem;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.voice-text:not(:empty) {
    animation: voicePop 0.3s ease-out;
}

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

/* 遊戲控制按鈕 */
.game-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.control-button {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.pause-button {
    background: var(--color-orange);
    color: var(--color-black);
}

.pause-button:hover:not(:disabled) {
    background: var(--color-blue);
    color: var(--color-white);
    transform: scale(1.05);
}

.resume-button {
    background: var(--color-blue);
    color: var(--color-white);
}

.resume-button:hover:not(:disabled) {
    background: var(--color-purple);
    transform: scale(1.05);
}

.end-button {
    background: #ff6b6b;
    color: var(--color-white);
}

.end-button:hover:not(:disabled) {
    background: #ff5252;
    transform: scale(1.05);
}

.control-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.start-button {
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--color-orange);
    color: var(--color-black);
}

.start-button:hover:not(:disabled) {
    background: var(--color-blue);
    color: var(--color-white);
    transform: scale(1.05);
}

.start-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.back-to-settings-button {
    background: var(--color-purple);
    color: var(--color-white);
}

.back-to-settings-button:hover:not(:disabled) {
    background: var(--color-blue);
    transform: scale(1.05);
}

/* 載入覆蓋層 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* 倒數覆蓋層 */
.countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1500;
}

#countdown {
    font-size: 6rem;
    font-weight: bold;
    color: var(--color-blue);
    text-align: center;
    animation: pulse 0.5s ease-in-out;
}

/* 倒數動畫 */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.loading-content {
    text-align: center;
    padding: 2rem;
}

.loading-content p {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--color-black);
}

.loading-progress {
    width: 300px;
    height: 8px;
    background: var(--color-white);
    border: 2px solid var(--color-purple);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto 1rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-purple), var(--color-blue));
    width: 0%;
    transition: width 0.3s ease;
}

/* 遊戲結束覆蓋層 */
.game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.overlay-content {
    background: var(--color-white);
    padding: 3rem;
    border-radius: 16px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.overlay-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--color-black);
}

.overlay-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: var(--color-black);
    opacity: 0.8;
}

.overlay-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .game-header {
        padding: 0.75rem 1rem;
        min-height: 60px;
    }

    .header-center h2 {
        font-size: 1.2rem;
    }

    .back-button {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }

    .game-main {
        padding: 1rem;
        justify-content: flex-start;
        padding-top: 2rem;
    }

    .timer-display {
        font-size: 4rem;
        margin-bottom: 2rem;
    }

    #countdown {
        font-size: 4rem;
    }

    .voice-display {
        margin-bottom: 2rem;
    }

    .voice-text {
        font-size: 2rem;
        padding: 1.5rem 2rem;
        min-height: 100px;
    }

    .game-controls {
        width: 100%;
        max-width: 100%;
        gap: 0.75rem;
    }

    .control-button {
        flex: 1;
        min-width: 100px;
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    .start-button {
        padding: 0.75rem 2rem;
        font-size: 1rem;
        width: 100%;
        max-width: 100%;
    }

    .settings-container {
        padding: 1.5rem;
    }

    .setting-group {
        margin-bottom: 1.5rem;
    }

    .loading-progress {
        width: 200px;
    }

    .overlay-content {
        padding: 2rem 1.5rem;
    }

    .overlay-content h2 {
        font-size: 1.5rem;
    }

    .overlay-content p {
        font-size: 1rem;
    }

    .overlay-buttons {
        flex-direction: column;
    }

    .overlay-buttons .control-button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .game-header {
        padding: 0.5rem 0.75rem;
        min-height: 56px;
    }

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

    .back-button {
        font-size: 0.85rem;
        padding: 0.35rem 0.7rem;
    }

    .timer-display {
        font-size: 3rem;
        margin-bottom: 1.5rem;
    }

    #countdown {
        font-size: 3rem;
    }

    .voice-text {
        font-size: 1.5rem;
        padding: 1rem 1.5rem;
        min-height: 80px;
    }

    .control-button {
        padding: 0.7rem 1.2rem;
        font-size: 0.95rem;
    }

    .start-button {
        padding: 0.7rem 1.5rem;
        font-size: 0.95rem;
    }

    .settings-container {
        padding: 1rem;
    }

    .setting-label {
        font-size: 1rem;
    }

    .setting-select {
        font-size: 0.9rem;
        padding: 0.6rem 0.8rem;
    }
}

