body {
    margin: 0;
    overflow: hidden;
    background-color: #333;
    font-family: 'Noto Serif TC', serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    height: 100dvh;
    /* Use dynamic viewport height for mobile browsers */
    touch-action: none;
    /* Prevent browser handling of gestures */
}

#game-container {
    width: 100%;
    height: 100%;
    position: relative;
    background-image: url('../2D/new_bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

/* Desktop View Simulation */
@media (min-width: 768px) {
    #game-container {
        max-width: 430px;
        /* iPhone 14/15 Pro Max width */
        max-height: 932px;
        height: 95vh;
        border-radius: 40px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
        border: 8px solid #1a1a1a;
    }
}

#controls {
    display: none;
    /* 調試用，如需微調模型位置可改為 block */
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.8);
    padding: 10px;
    z-index: 100;
    max-height: 80vh;
    overflow-y: auto;
}

#startButton,
#statusDisplay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 30px 40px;
    border-radius: 4px;
    width: 85%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    border: 1px solid #d4a0a0;
    outline: 4px solid white;
    outline-offset: -10px;
}

#statusDisplay {
    display: none;
}

button {
    margin-top: 15px;
    padding: 12px 0;
    width: 100%;
    background-color: #b22222;
    color: white;
    border: none;
    border-radius: 50px;
    /* Pill shape */
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 5px 0 #800000;
    /* 3D Shadow */
    transition: all 0.1s;
}

button:hover {
    background-color: #cc2222;
    transform: translateY(-2px);
    box-shadow: 0 7px 0 #800000;
}

button:active {
    transform: translateY(5px);
    box-shadow: 0 0 0 #800000;
}

.title {
    color: #8b0000;
    margin: 0 0 20px 0;
    font-size: 36px;
    font-weight: bold;
    letter-spacing: 5px;
}

.input-group {
    width: 100%;
    margin-bottom: 20px;
    position: relative;
}

.input-group textarea {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    outline: none;
    text-align: center;
    color: #555;
    resize: vertical;
    min-height: 40px;
    font-family: inherit;
}

.input-group textarea::placeholder {
    color: #aaa;
}

.instruction {
    margin: 0 0 20px 0;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    letter-spacing: 1px;
}

.secondary-button {
    background-color: #666;
    margin-top: 10px;
    font-size: 16px;
    box-shadow: 0 5px 0 #444;
    /* Dark gray shadow */
}

.secondary-button:hover {
    background-color: #444;
    box-shadow: 0 7px 0 #333;
}

.secondary-button:active {
    box-shadow: 0 0 0 #444;
}

button.small-btn {
    width: auto;
    margin-top: 15px;
    padding: 5px 10px;
    background-color: transparent;
    color: #999;
    font-size: 11px;
    font-weight: normal;
    border: 1px solid #ddd;
    border-radius: 15px;
    box-shadow: 0 3px 0 #ccc;
    /* Gray shadow for small button */
}

button.small-btn:hover {
    background-color: #f0f0f0;
    color: #666;
    box-shadow: 0 4px 0 #ccc;
}

h1 {
    color: #8b4513;
    margin-top: 0;
    font-size: 24px;
}

p {
    line-height: 1.6;
    margin: 10px 0;
}

.footer-info {
    position: absolute;
    bottom: 30px;
    /* Increased from 15px */
    bottom: calc(30px + env(safe-area-inset-bottom));
    /* Add safe area for iPhone X+ */
    width: 100%;
    text-align: center;
    color: #5d4037;
    font-size: 14px;
    z-index: 10;
    pointer-events: none;
    padding: 0 20px;
    box-sizing: border-box;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    letter-spacing: 1px;
}