/* 主题变量 */
:root[data-theme="dark"] {
    --bg-gradient-1: #1a1a1a;
    --bg-gradient-2: #4a4a4a;
    --container-bg: rgba(255, 255, 255, 0.1);
    --text-color: #fff;
    --canvas-bg: rgba(0, 0, 0, 0.2);
    --btn-bg: rgba(255, 255, 255, 0.1);
    --btn-hover: rgba(255, 255, 255, 0.2);
}

:root[data-theme="light"] {
    --bg-gradient-1: #e0e0e0;
    --bg-gradient-2: #ffffff;
    --container-bg: rgba(0, 0, 0, 0.05);
    --text-color: #333;
    --canvas-bg: rgba(0, 0, 0, 0.1);
    --btn-bg: rgba(0, 0, 0, 0.1);
    --btn-hover: rgba(0, 0, 0, 0.15);
}

body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-gradient-1), var(--bg-gradient-2));
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    touch-action: none;
}

.game-container {
    width: 100%;
    max-width: 414px;
    padding: 15px;
    background: var(--container-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.back-btn {
    display: flex;
    align-items: center;
    color: var(--text-color);
    text-decoration: none;
    font-size: 16px;
    padding: 8px 12px;
    background: var(--btn-bg);
    border-radius: 8px;
    transition: background 0.3s;
}

.back-btn:active {
    background: var(--btn-hover);
}

.back-btn svg {
    margin-right: 4px;
}

.score-board {
    color: var(--text-color);
    font-size: 24px;
    font-weight: bold;
}

#gameCanvas {
    width: 100%;
    border-radius: 15px;
    background: var(--canvas-bg);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
}

.controls {
    margin-top: 5px;
}

#controlBtn {
    width: 60%;
    margin: 5px auto;
    background: linear-gradient(45deg, #4CAF50, #45a049);
    border: none;
    padding: 10px;
    color: white;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: block;
}

#controlBtn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(255, 255, 255, 0.2), transparent);
    opacity: 0.5;
}

#controlBtn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* 不同状态下的按钮样式 */
#controlBtn[data-state="initial"] {
    background: linear-gradient(45deg, #4CAF50, #45a049);
}

#controlBtn[data-state="playing"] {
    background: linear-gradient(45deg, #FF9800, #F57C00);
}

#controlBtn[data-state="paused"] {
    background: linear-gradient(45deg, #2196F3, #1976D2);
}

#controlBtn[data-state="ended"] {
    background: linear-gradient(45deg, #f44336, #d32f2f);
}

.speed-buttons {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 0 15px;
}

.speed-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: var(--btn-bg);
    color: var(--text-color);
    font-size: 15px;
    font-weight: bold;
    transition: all 0.3s;
}

.speed-btn:active {
    transform: scale(0.95);
}

.speed-btn.active {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.game-status {
    text-align: center;
    color: var(--text-color);
    font-size: 16px;
    margin: 5px 0;
    min-height: 20px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.game-status.show {
    opacity: 1;
}

.game-status.error {
    color: #ff5252;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: var(--btn-bg);
    color: var(--text-color);
    cursor: pointer;
    transition: background 0.3s;
    min-width: 40px;
    min-height: 40px;
}

.theme-btn:active {
    background: var(--btn-hover);
}

.theme-icon {
    width: 24px;
    height: 24px;
}

/* 主题图标显示控制 */
:root[data-theme="dark"] .theme-icon.light,
:root[data-theme="light"] .theme-icon.dark {
    display: block;
}

:root[data-theme="dark"] .theme-icon.dark,
:root[data-theme="light"] .theme-icon.light {
    display: none;
}

.direction-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 15px 0;
    position: relative;
    height: 200px;
}

.horizontal-controls {
    display: flex;
    gap: 100px;
    margin-top: 15px;
}

.left-btn,
.right-btn,
.down-btn {
    width: 70px;
    height: 70px;
}

.dir-btn {
    border: none;
    border-radius: 50%;
    background: var(--btn-bg);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.up-btn {
    width: 70px;
    height: 70px;
    margin-bottom: 15px;
}

.down-btn {
    position: absolute;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
}

.dir-btn:active {
    transform: scale(0.95);
    background: var(--btn-hover);
}

.dir-btn svg {
    width: 36px;
    height: 36px;
}

/* 修改教程提示样式 */
.tutorial-overlay {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    border-radius: 12px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    max-width: 90%;
    width: auto;
    padding: 12px 20px;
    backdrop-filter: blur(8px);
}

.tutorial-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.tutorial-content {
    color: white;
    text-align: center;
    font-size: 14px;
    line-height: 1.4;
}

.tutorial-content p {
    margin: 4px 0;
}

.tutorial-content button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    margin-top: 8px;
    transition: background 0.2s;
}

.tutorial-content button:active {
    background: rgba(255, 255, 255, 0.3);
} 