/* 重置和基本樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Helvetica Neue', Arial, 'Microsoft JhengHei', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

.container {
    width: 90%;
    max-width: 800px;
    margin: 20px auto;
}

/* 遊戲標題 */
.game-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #e91e63 0%, #f50057 100%);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(233, 30, 99, 0.5);
    position: relative;
    overflow: hidden;
}

.game-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 10s linear infinite;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.game-header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.5);
    position: relative;
    z-index: 1;
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.player-number {
    margin-top: 15px;
    padding: 10px 25px;
    background: rgba(0,0,0,0.3);
    border-radius: 30px;
    display: inline-block;
    font-size: 1.1em;
    border: 2px solid rgba(255,255,255,0.3);
    position: relative;
    z-index: 1;
}

/* 遊戲內容 */
.game-content {
    min-height: 400px;
    position: relative;
}

.start-screen,
.game-level,
.success-screen {
    animation: fadeIn 0.5s ease-in;
}

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

.hidden {
    display: none !important;
}

/* 歡迎畫面 */
.welcome-box {
    background: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
    padding: 50px 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border: 3px solid #e91e63;
}

.welcome-box h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: #e91e63;
}

.welcome-box p {
    font-size: 1.2em;
    margin: 15px 0;
    line-height: 1.6;
}

.warning {
    color: #ffa502;
    font-weight: bold;
    margin: 25px 0 !important;
    font-size: 1.1em !important;
}

/* 關卡樣式 */
.level-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
    border-radius: 15px;
    border-left: 5px solid #e91e63;
}

.level-header h2 {
    font-size: 2em;
    color: #e91e63;
    margin-bottom: 10px;
}

.level-header p {
    font-size: 1.1em;
    opacity: 0.8;
}

/* 謎題框 */
.puzzle-box {
    background: rgba(255,255,255,0.05);
    padding: 40px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(233, 30, 99, 0.3);
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.question {
    font-size: 1.4em;
    margin-bottom: 20px;
    text-align: center;
    color: #fff;
    font-weight: 500;
}

.hint {
    text-align: center;
    color: #ffa502;
    margin-bottom: 25px;
    font-size: 0.95em;
    font-style: italic;
}

/* 輸入框 */
.answer-input {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.2em;
    border: 2px solid #e91e63;
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    text-align: center;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.answer-input:focus {
    outline: none;
    background: rgba(255,255,255,0.15);
    border-color: #f50057;
    box-shadow: 0 0 20px rgba(233, 30, 99, 0.5);
}

.answer-input::placeholder {
    color: rgba(255,255,255,0.5);
}

/* 形狀網格 */
.shapes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 30px 0;
}

.shape-btn {
    background: linear-gradient(135deg, rgba(233, 30, 99, 0.2) 0%, rgba(245, 0, 87, 0.2) 100%);
    border: 2px solid #e91e63;
    border-radius: 15px;
    padding: 30px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.shape-btn:hover {
    transform: translateY(-5px);
    background: linear-gradient(135deg, rgba(233, 30, 99, 0.4) 0%, rgba(245, 0, 87, 0.4) 100%);
    box-shadow: 0 10px 30px rgba(233, 30, 99, 0.4);
}

.shape {
    font-size: 4em;
    color: #fff;
}

.shape-btn span {
    font-size: 1.1em;
    color: #fff;
}

/* 按鈕 */
.game-btn {
    background: linear-gradient(135deg, #e91e63 0%, #f50057 100%);
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 1.2em;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(233, 30, 99, 0.4);
    font-weight: bold;
    width: 100%;
    max-width: 300px;
    display: block;
    margin: 20px auto 0;
}

.game-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(233, 30, 99, 0.6);
}

.game-btn:active {
    transform: translateY(-1px);
}

.game-btn.secondary {
    background: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
    border: 2px solid #e91e63;
}

/* 錯誤訊息 */
.error-message {
    text-align: center;
    margin-top: 15px;
    font-size: 1.1em;
    min-height: 25px;
    font-weight: 500;
}

/* 成功畫面 */
.success-box {
    background: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
    padding: 60px 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border: 3px solid #2ed573;
}

.success-box h2 {
    font-size: 3em;
    margin-bottom: 20px;
    color: #2ed573;
    animation: pulse 1.5s ease-in-out infinite;
}

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

.reward-text {
    font-size: 1.3em;
    margin: 25px 0;
    color: #ffa502;
}

.reward-btn {
    background: linear-gradient(135deg, #2ed573 0%, #26de81 100%);
    box-shadow: 0 5px 15px rgba(46, 213, 115, 0.4);
    font-size: 1.4em;
    padding: 20px 50px;
}

.reward-btn:hover {
    box-shadow: 0 8px 25px rgba(46, 213, 115, 0.6);
}

/* 進度條 */
.progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    margin-top: 40px;
    overflow: hidden;
}

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

.progress-text {
    text-align: center;
    margin-top: 10px;
    font-size: 1em;
    color: rgba(255,255,255,0.7);
}

/* 震動動畫 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.shake {
    animation: shake 0.5s ease;
}

/* 彩帶效果 */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    z-index: 9999;
    animation: confetti-fall 5s linear;
}

@keyframes confetti-fall {
    to {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ==================== 獎勵頁面樣式 ==================== */

.reward-container {
    padding: 20px;
}

.reward-page {
    background: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
    border-radius: 25px;
    padding: 40px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.5);
    border: 3px solid #2ed573;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.reward-page.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.winner-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid rgba(233, 30, 99, 0.3);
}

.winner-header h1 {
    font-size: 3em;
    margin-bottom: 15px;
    color: #2ed573;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% {
        text-shadow: 2px 2px 4px rgba(0,0,0,0.5),
                     0 0 10px rgba(46, 213, 115, 0.5);
    }
    50% {
        text-shadow: 2px 2px 4px rgba(0,0,0,0.5),
                     0 0 20px rgba(46, 213, 115, 0.8),
                     0 0 30px rgba(46, 213, 115, 0.6);
    }
}

.winner-text {
    font-size: 1.5em;
    color: #fff;
    margin-bottom: 20px;
}

.prize-amount {
    font-size: 2.5em;
    color: #ffa502;
    font-weight: bold;
    margin: 20px 0 10px;
    font-family: 'Courier New', monospace;
}

.prize-note {
    font-size: 0.9em;
    color: rgba(255,255,255,0.6);
    font-style: italic;
}

/* 實際獎勵區 */
.actual-reward {
    background: rgba(255,255,255,0.05);
    padding: 35px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(46, 213, 115, 0.3);
}

.actual-reward h2 {
    text-align: center;
    font-size: 2.2em;
    color: #ffa502;
    margin-bottom: 30px;
}

.reward-description {
    text-align: center;
    margin-bottom: 35px;
}

.reward-title {
    font-size: 1.8em;
    color: #fff;
    margin-bottom: 20px;
    font-weight: bold;
}

.reward-items {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.reward-item {
    background: linear-gradient(135deg, rgba(233, 30, 99, 0.2) 0%, rgba(245, 0, 87, 0.2) 100%);
    padding: 15px 30px;
    border-radius: 15px;
    font-size: 1.2em;
    border: 2px solid #e91e63;
    box-shadow: 0 5px 15px rgba(233, 30, 99, 0.3);
}

/* QR Code 區域 */
.qr-code-section {
    text-align: center;
    margin: 40px 0;
}

.qr-code-wrapper {
    background: #fff;
    padding: 20px;
    border-radius: 20px;
    display: inline-block;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    margin-bottom: 20px;
    position: relative;
}

.qr-code-wrapper img {
    max-width: 300px;
    width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
}

.qr-placeholder {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    border-radius: 10px;
    display: none;
    justify-content: center;
    align-items: center;
    border: 3px dashed #999;
}

.placeholder-content {
    text-align: center;
    color: #666;
}

.placeholder-icon {
    font-size: 4em;
    margin-bottom: 15px;
}

.placeholder-content p {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 10px;
}

.placeholder-content small {
    font-size: 0.9em;
    display: block;
    margin-bottom: 8px;
}

.placeholder-content code {
    display: inline-block;
    background: rgba(0,0,0,0.1);
    padding: 8px 15px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    color: #333;
    margin-top: 5px;
}

.qr-instruction {
    font-size: 1.2em;
    color: #2ed573;
    margin: 15px 0;
    font-weight: 500;
}

.expiry-note {
    font-size: 1em;
    color: #ffa502;
    font-style: italic;
}

/* 聖誕訊息 */
.christmas-message {
    text-align: center;
    margin: 35px 0;
    padding: 25px;
    background: rgba(233, 30, 99, 0.1);
    border-radius: 15px;
    border: 2px solid rgba(233, 30, 99, 0.3);
}

.christmas-message h3 {
    font-size: 1.8em;
    color: #2ed573;
    margin-bottom: 15px;
}

.christmas-message p {
    font-size: 1.1em;
    margin: 10px 0;
    color: #fff;
}

.signature {
    font-style: italic;
    color: #ffa502;
    margin-top: 15px !important;
}

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

.action-buttons .game-btn {
    margin: 0;
    flex: 1;
    min-width: 200px;
}

/* 魷魚遊戲頁尾 */
.squid-game-footer {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid rgba(233, 30, 99, 0.3);
    text-align: center;
}

.shapes-decoration {
    font-size: 2em;
    margin-bottom: 15px;
    letter-spacing: 20px;
}

.deco-shape {
    color: #e91e63;
    display: inline-block;
    animation: float 3s ease-in-out infinite;
}

.deco-shape:nth-child(2) {
    animation-delay: 0.5s;
}

.deco-shape:nth-child(3) {
    animation-delay: 1s;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.game-over-text {
    font-size: 1.2em;
    color: rgba(255,255,255,0.6);
    letter-spacing: 5px;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .game-header h1 {
        font-size: 2em;
    }

    .shapes-grid {
        grid-template-columns: 1fr;
    }

    .welcome-box,
    .puzzle-box,
    .actual-reward {
        padding: 30px 20px;
    }

    .winner-header h1 {
        font-size: 2em;
    }

    .prize-amount {
        font-size: 1.8em;
    }

    .reward-items {
        flex-direction: column;
        gap: 15px;
    }

    .qr-code-wrapper img,
    .qr-placeholder {
        max-width: 250px;
        width: 250px;
        height: 250px;
    }

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

    .action-buttons .game-btn {
        width: 100%;
    }
}

/* 列印樣式 */
@media print {
    body {
        background: white;
        color: black;
    }

    .action-buttons {
        display: none;
    }

    .reward-page {
        border: 2px solid #000;
        box-shadow: none;
    }

    .confetti {
        display: none;
    }
}
