:root {
    --bg-red: #CE2029; 
    --gold-main: #FDD07C; 
    --gold-dark: #C59D5F;
    --text-color: #FFF8E7;
    --shadow: 0 4px 8px rgba(0,0,0,0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    touch-action: manipulation;
}

body {
    font-family: 'Noto Sans TC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-red);
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* 使用用戶提供的背景圖 */
    background-image: url('bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: transparent;
    overflow: hidden;
    /* 金邊框 */
    border: 2px solid rgba(253, 208, 124, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 2;
}

/* Score HUD */
#score-hud {
    position: absolute;
    top: 20px;
    right: 20px;
    text-align: right;
    pointer-events: none;
    z-index: 10;
}

#scoreDisplay {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gold-main);
    text-shadow: 2px 2px 0 rgba(0,0,0,0.3);
    font-family: 'Noto Sans SC', 'PingFang SC', sans-serif;
}

/* Modals */
#modal-overlay, #game-over-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    transition: opacity 0.3s ease;
}

.modal-card {
    background: #FFF8E7;
    border: 3px solid var(--bg-red);
    border-radius: 20px;
    padding: 40px 20px;
    width: 90%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    color: #8B0000;
}

.modal-header {
    border-bottom: 2px solid var(--bg-red);
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.modal-header h1 {
    font-size: 2.2rem; /* 稍微調小以容納兩行 */
    color: var(--bg-red);
    margin: 0 0 10px;
    font-weight: 900;
    white-space: normal; /* 允許換行 */
    line-height: 1.3; /* 增加行距 */
    overflow: visible;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--gold-dark);
    letter-spacing: 1px;
    font-weight: bold;
    display: block;
    margin-bottom: 20px;
    white-space: nowrap;
}

/* Buttons */
.primary-btn {
    background: linear-gradient(135deg, #E60012, #B30000);
    color: #FFF;
    border: none;
    padding: 15px 0;
    width: 100%;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(179, 0, 0, 0.4);
    transition: transform 0.1s;
}

.primary-btn:active {
    transform: scale(0.98);
}

.hidden { display: none !important; opacity: 0; pointer-events: none; }
.visible { display: flex !important; opacity: 1; pointer-events: auto; }

.version {
    position: absolute;
    bottom: 20px;
    width: 100%;
    text-align: center;
    font-size: 0.6rem;
    color: rgba(255,255,255,0.6);
    pointer-events: none;
    letter-spacing: 1px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #scoreDisplay { font-size: 3rem; }
    .modal-header h1 { font-size: 2rem; }
    .modal-card { padding: 25px 20px; }
    .primary-btn { padding: 12px 0; font-size: 1rem; }
}
