html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden; /* 防止滚动条 */
    color: #333;
}

.game-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    align-items: center;
    justify-content: center;
    padding: 10px;
    box-sizing: border-box;
}

.game-canvas-section {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 500px;
}

.game-controls-section {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-left: 20px;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    text-align: center;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .game-canvas-section {
        max-width: 450px;
    }

    .game-controls-section {
        max-width: 350px;
        padding: 18px;
    }

    h1 {
        font-size: 2.2em;
    }
}

@media (max-width: 1024px) {
	.game-container {
		flex-direction: column;
		height: auto;
		min-height: 100vh;
		padding: 6px;
	}
	.game-canvas-section {
		order: 1;
		width: 100%;
		max-width: 100%;
		flex: none;
		padding: 6px 0;
	}
	.game-controls-section {
		order: 2;
		width: 100%;
		max-width: 100%;
		flex: none;
		margin-left: 0;
		padding: 12px;
		max-height: none;
		overflow: visible;
	}
}

@media (max-width: 768px) {
	.game-container {
		padding: 4px;
		flex-direction: column;
		gap: 4px;
	}

	.game-canvas-section {
		width: 100%;
		padding: 2px 0;
		flex: 0 0 auto;
	}

	#gameCanvas {
		width: 95vw;
		max-width: 95vw;
		height: auto;
		border: 2px solid #34495e;
		max-width: calc(100vw - 10px);
	}

	.game-controls-section {
		width: 100%;
		padding: 8px;
		max-height: calc(100vh - 340px);
		overflow-y: auto;
		flex: 0 0 auto;
		font-size: 13px;
	}

	.game-controls {
		flex-wrap: wrap;
		gap: 6px;
		margin-bottom: 8px;
	}

	#startButton, #pauseButton, #resetButton {
		padding: 8px 12px;
		font-size: 12px;
		flex: 1;
		min-width: auto;
	}

	.difficulty-selector {
		margin-bottom: 8px;
		gap: 4px;
	}

	.difficulty-selector label {
		font-size: 12px;
	}

	.difficulty-selector select {
		padding: 5px 8px;
		font-size: 11px;
	}

	#difficultyDisplay {
		font-size: 12px;
	}

	.score {
		margin-bottom: 8px;
		font-size: 12px;
		gap: 6px;
	}

	.score span {
		padding: 4px 8px;
		font-size: 10px;
		min-width: 60px;
	}

	h1 {
		font-size: 1.5em;
		margin-bottom: 8px;
		line-height: 1.2;
	}

	.controls {
		padding: 8px;
		margin-top: 8px;
	}

	.controls p {
		font-size: 10px;
		margin: 2px 0;
		line-height: 1.3;
	}

	.controls strong {
		font-size: 11px;
	}

	.touch-hint {
		font-size: 10px;
		margin-top: 6px;
	}

	#gameStatus {
		padding: 12px;
		margin: 8px 0;
	}

	#gameStatus p {
		font-size: 14px;
		margin: 0 0 8px 0;
	}

	#restartButton {
		padding: 8px 16px;
		font-size: 12px;
	}

	.direction-controls {
		grid-template-columns: repeat(3, 40px);
		gap: 4px;
		margin: 8px 0;
	}

	.direction-btn {
		width: 40px;
		height: 40px;
		font-size: 14px;
		border-radius: 6px;
	}
}

@media (max-width: 480px) {
	html, body {
		font-size: 14px;
	}

	.game-container {
		padding: 3px;
		min-height: 100vh;
		gap: 3px;
	}

	.game-canvas-section {
		width: 100%;
		padding: 2px 0;
		flex: 0 0 auto;
	}

	#gameCanvas {
		width: calc(100vw - 8px);
		max-width: calc(100vw - 8px);
		height: auto;
		border: 2px solid #34495e;
	}

	.game-controls-section {
		width: 100%;
		padding: 6px;
		max-height: calc(100vh - 320px);
		overflow-y: auto;
		flex: 0 0 auto;
		font-size: 12px;
	}

	h1 {
		font-size: 1.3em;
		margin-bottom: 6px;
		line-height: 1.1;
	}

	.difficulty-selector {
		margin-bottom: 6px;
		gap: 3px;
		flex-wrap: wrap;
	}

	.difficulty-selector label {
		font-size: 11px;
		white-space: nowrap;
	}

	.difficulty-selector select {
		padding: 4px 6px;
		font-size: 10px;
		min-width: 80px;
	}

	#difficultyDisplay {
		font-size: 11px;
	}

	.score {
		margin-bottom: 6px;
		font-size: 11px;
		gap: 4px;
		justify-content: center;
	}

	.score span {
		padding: 3px 6px;
		font-size: 9px;
		min-width: 55px;
	}

	.game-controls {
		gap: 4px;
		margin-bottom: 6px;
	}

	#startButton, #pauseButton, #resetButton {
		padding: 6px 10px;
		font-size: 11px;
		flex: 1;
		min-width: auto;
	}

	.direction-controls {
		grid-template-columns: repeat(3, 38px);
		gap: 3px;
		margin: 6px 0;
	}

	.direction-btn {
		width: 38px;
		height: 38px;
		font-size: 13px;
		border-radius: 5px;
	}

	.controls {
		padding: 6px;
		margin-top: 6px;
	}

	.controls p {
		font-size: 9px;
		margin: 1px 0;
		line-height: 1.2;
	}

	.controls strong {
		font-size: 10px;
	}

	.touch-hint {
		font-size: 9px;
		margin-top: 4px;
	}

	#gameStatus {
		padding: 10px;
		margin: 6px 0;
	}

	#gameStatus p {
		font-size: 13px;
		margin: 0 0 6px 0;
	}

	#restartButton {
		padding: 6px 12px;
		font-size: 11px;
	}
}

@media (max-width: 360px) {
	.game-container {
		padding: 2px;
		gap: 2px;
	}

	.game-canvas-section {
		padding: 2px 0;
	}

	#gameCanvas {
		width: calc(100vw - 6px);
		max-width: calc(100vw - 6px);
		border: 1px solid #34495e;
	}

	.game-controls-section {
		padding: 4px;
		max-height: calc(100vh - 300px);
		font-size: 11px;
	}

	h1 {
		font-size: 1.2em;
		margin-bottom: 4px;
	}

	.difficulty-selector {
		margin-bottom: 4px;
		gap: 2px;
	}

	.difficulty-selector label {
		font-size: 10px;
	}

	.difficulty-selector select {
		padding: 3px 4px;
		font-size: 9px;
	}

	.score {
		margin-bottom: 4px;
		font-size: 10px;
		gap: 3px;
	}

	.score span {
		padding: 2px 4px;
		font-size: 8px;
		min-width: 50px;
	}

	.game-controls {
		gap: 3px;
		margin-bottom: 4px;
	}

	#startButton, #pauseButton, #resetButton {
		padding: 5px 8px;
		font-size: 10px;
	}

	.direction-controls {
		grid-template-columns: repeat(3, 35px);
		gap: 2px;
		margin: 4px 0;
	}

	.direction-btn {
		width: 35px;
		height: 35px;
		font-size: 12px;
	}

	.controls {
		padding: 4px;
		margin-top: 4px;
	}

	.controls p {
		font-size: 8px;
		margin: 0px 0;
	}

	.touch-hint {
		font-size: 8px;
		margin-top: 2px;
	}
}

/* 触屏提示 */
.touch-hint {
    display: none;
    font-size: 12px;
    color: #7f8c8d;
    text-align: center;
    margin-top: 10px;
    font-style: italic;
}

@media (max-width: 768px) {
    .touch-hint {
        display: block;
    }
}

h1 {
    color: #2c3e50;
    margin-bottom: 25px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.difficulty-selector {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.difficulty-selector label {
    font-weight: bold;
    color: #34495e;
}

.difficulty-selector select {
    padding: 8px 12px;
    border: 2px solid #bdc3c7;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.difficulty-selector select:hover {
    border-color: #3498db;
}

.difficulty-selector select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

#difficultyDisplay {
    font-weight: bold;
    color: #e74c3c;
    font-size: 16px;
}

#gameCanvas {
    border: 3px solid #34495e;
    border-radius: 10px;
    background: #000000;
    display: block;
    width: 100%;
    max-width: 500px;
    height: auto;
    aspect-ratio: 1;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.score {
    margin-bottom: 20px;
    font-size: 18px;
    color: #555;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
}

.score span {
    background: #f8f9fa;
    padding: 8px 15px;
    border-radius: 20px;
    border: 2px solid #dee2e6;
    font-weight: bold;
    min-width: 80px;
    display: inline-block;
}

.game-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

#startButton, #pauseButton, #resetButton {
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 25px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

#startButton:hover, #pauseButton:hover, #resetButton:hover {
    background: linear-gradient(45deg, #229954, #27ae60);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.4);
}

#startButton:active, #pauseButton:active, #resetButton:active {
    transform: translateY(0);
}

#pauseButton {
    background: linear-gradient(45deg, #f39c12, #e67e22);
}

#pauseButton:hover {
    background: linear-gradient(45deg, #e67e22, #d35400);
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.4);
}

#resetButton {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
}

#resetButton:hover {
    background: linear-gradient(45deg, #c0392b, #a93226);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

p {
    color: #666;
    font-size: 16px;
    margin: 10px 0;
    line-height: 1.5;
}

.controls {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    border: 1px solid #dee2e6;
}

.controls p {
    margin: 5px 0;
    font-size: 14px;
}

.controls strong {
    color: #495057;
}

/* 移除碰撞预警动画，保持静态 */
.game-status {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 15px;
    margin: 15px 0;
    text-align: center;
    border: 2px solid #f39c12;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3);
}

.game-status p {
    font-size: 18px;
    font-weight: bold;
    color: #e74c3c;
    margin: 0 0 15px 0;
}

#restartButton {
    background: linear-gradient(45deg, #f39c12, #e67e22);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(243, 156, 18, 0.3);
}

#restartButton:hover {
    background: linear-gradient(45deg, #e67e22, #d35400);
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.4);
}

/* 方向按钮控制区域 */
.direction-controls {
    display: none;
    grid-template-columns: repeat(3, 60px);
    gap: 8px;
    justify-content: center;
    margin: 20px 0;
    justify-items: center;
}

.direction-btn {
    width: 60px;
    height: 60px;
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
}

.direction-btn:active {
    background: linear-gradient(45deg, #2980b9, #1f618d);
    transform: scale(0.95);
}

.direction-btn:hover {
    background: linear-gradient(45deg, #2980b9, #1f618d);
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.4);
}

/* 上按钮位置 */
.direction-btn.up {
    grid-column: 2;
    grid-row: 1;
}

/* 左按钮位置 */
.direction-btn.left {
    grid-column: 1;
    grid-row: 2;
}

/* 下按钮位置 */
.direction-btn.down {
    grid-column: 2;
    grid-row: 3;
}

/* 右按钮位置 */
.direction-btn.right {
    grid-column: 3;
    grid-row: 2;
}

/* 中心按钮（加速） */
.direction-btn.center {
    grid-column: 2;
    grid-row: 2;
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    font-size: 18px;
}

.direction-btn.center:active {
    background: linear-gradient(45deg, #c0392b, #a93226);
}

/* 手机设备适配 */
@media (max-width: 768px) {
    .direction-controls {
        display: grid;
    }

    .game-controls {
        gap: 8px;
    }

    #startButton, #pauseButton, #resetButton {
        padding: 12px 20px;
        font-size: 16px;
        flex: 1;
        min-width: 100px;
    }

    .direction-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .direction-controls {
        grid-template-columns: repeat(3, 50px);
        gap: 6px;
        margin: 15px 0;
    }

    .direction-btn {
        width: 50px;
        height: 50px;
        font-size: 18px;
        border-radius: 8px;
    }

    .game-controls {
        flex-direction: column;
        gap: 6px;
    }

    #startButton, #pauseButton, #resetButton {
        padding: 10px 15px;
        font-size: 14px;
        width: 100%;
    }
}
