:root {
    --bg-gradient-start: #6dd5ed;
    --bg-gradient-end: #2193b0;
    --container-bg: #000;
    --font-color: #fff;
    --title-shadow: #2980b9;
    --control-bg: rgba(0, 0, 0, 0.2);
    --control-border: #00d9ff;
    --control-shadow: rgba(0, 217, 255, 0.5);
    --control-symbol: #fff;
}

* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Disable tap highlight on mobile */
}

body {
    background: linear-gradient(45deg, var(--bg-gradient-start), var(--bg-gradient-end));
    font-family: 'Helvetica Neue', Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 1rem;
    overflow: hidden; /* Prevent scrollbars */
}

/* --- 新增：標題容器 --- */
.header-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

h1 {
    color: var(--font-color);
    margin: 0; /* 移除 h1 的預設 margin */
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px var(--title-shadow);
}

/* --- 新增：說明按鈕 --- */
.help-button {
    background-color: rgba(255, 255, 255, 0.2);
    border: 2px solid var(--font-color);
    color: var(--font-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}
.help-button:hover {
    background-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}


.game-container {
    width: 100%;
    max-width: 800px;
    aspect-ratio: 480 / 320;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    border-radius: 8px;
    overflow: hidden;
}

canvas {
    background: var(--container-bg);
    display: block;
    width: 100%;
    height: 100%;
}

.controls-container {
    display: none; /* Hidden by default */
    width: 100%;
    max-width: 800px; /* Match game container */
    margin-top: 1rem;
    justify-content: space-between;
    align-items: center;
}

.control-btn {
    width: 140px;
    height: 140px;
    background: var(--control-bg);
    border: 3px solid var(--control-border);
    border-radius: 50%;
    box-shadow: 0 0 20px var(--control-shadow);
    color: var(--control-symbol);
    font-size: 3rem;
    line-height: 140px;
    text-align: center;
    user-select: none;
    transition: all 0.2s ease;
}

.control-btn.launch {
    width: 120px;
    height: 120px;
    line-height: 120px;
    border-radius: 30px;
    transform: rotate(45deg);
}

.control-btn.launch span {
    display: inline-block;
    transform: rotate(-45deg);
}

.control-btn:active {
    background: var(--control-shadow);
    transform: scale(0.95);
}

/* --- 新增：彈出視窗樣式 --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.modal-overlay:not(.hidden) {
    opacity: 1;
}
.modal-content {
    background: #fff;
    padding: 2rem;
    border-radius: 10px;
    max-width: 90%;
    width: 500px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}
.modal-overlay:not(.hidden) .modal-content {
    transform: scale(1);
}
.modal-content h2 { color: #333; text-align: center; margin-bottom: 1.5rem; }
.modal-content h3 { color: #555; margin-top: 1.5rem; border-bottom: 1px solid #eee; padding-bottom: 0.5rem;}
.modal-content h4 { color: #777; margin-top: 1rem; }
.modal-content p, .modal-content ul { color: #444; line-height: 1.6; }
.modal-content ul { list-style-position: inside; padding-left: 0; }
.modal-content li { margin-bottom: 0.5rem; }
.modal-content code { background-color: #eee; padding: 2px 6px; border-radius: 4px; font-family: monospace; }

.close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 2rem;
    font-weight: bold;
    color: #aaa;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
}
.close-button:hover { color: #333; }
.hidden { display: none; }


/* --- Footer 樣式 --- */
footer {
    margin-top: 1.5rem;
    padding: 0.5rem;
    text-align: center;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

footer a {
    color: inherit;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s ease;
}

footer a:hover {
    text-decoration: underline;
    color: #fff;
}


/* Media query for touch devices */
@media (hover: none) and (pointer: coarse) {
    .controls-container {
        display: flex;
    }
}
