/**
 * 像素蚁国争霸
 * 样式表
 */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #1a1a1a;
    font-family: 'Courier New', monospace;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* 移动端优化 */
@media (max-width: 768px) {
    #game-canvas {
        image-rendering: auto;
    }
}

/* 加载界面 */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #1a1a1a;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: #ffffff;
    font-family: 'Courier New', monospace;
}

#loading-screen h1 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #ff6b35;
}

#loading-screen p {
    font-size: 14px;
    color: #888888;
}

#loading-screen.hidden {
    display: none;
}

/* 主菜单 */
#main-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#main-menu.hidden {
    display: none;
}

#main-menu h1 {
    font-size: 32px;
    color: #ff6b35;
    margin-bottom: 40px;
    text-shadow: 2px 2px 0px #000000;
}

#main-menu button {
    min-width: 200px;
    min-height: 44px;
    padding: 12px 24px;
    margin: 10px;
    background-color: #2a2a2a;
    color: #ffffff;
    border: 2px solid #ff6b35;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#main-menu button:hover {
    background-color: #ff6b35;
    color: #1a1a1a;
}

#main-menu button:active {
    transform: scale(0.95);
}

/* 暂停菜单 */
#pause-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(42, 42, 42, 0.95);
    padding: 30px;
    border: 3px solid #ff6b35;
    display: none;
    flex-direction: column;
    align-items: center;
    z-index: 500;
}

#pause-menu.visible {
    display: flex;
}

#pause-menu h2 {
    color: #ffffff;
    margin-bottom: 20px;
}

#pause-menu button {
    min-width: 150px;
    min-height: 44px;
    padding: 10px 20px;
    margin: 5px;
    background-color: #3a3a3a;
    color: #ffffff;
    border: 2px solid #666666;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    cursor: pointer;
}

#pause-menu button:hover {
    background-color: #ff6b35;
    border-color: #ff6b35;
    color: #1a1a1a;
}

/* 设置面板 */
#settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(42, 42, 42, 0.95);
    padding: 30px;
    border: 3px solid #ff6b35;
    display: none;
    flex-direction: column;
    align-items: center;
    z-index: 600;
    min-width: 300px;
}

#settings-panel.visible {
    display: flex;
}

#settings-panel h2 {
    color: #ffffff;
    margin-bottom: 20px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin: 10px 0;
    color: #ffffff;
}

.setting-row label {
    font-size: 14px;
}

.setting-row input[type="range"] {
    width: 150px;
    accent-color: #ff6b35;
}

/* 提示信息 */
#toast-container {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 400;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.toast {
    background-color: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    padding: 10px 20px;
    margin: 5px;
    border-radius: 4px;
    font-size: 12px;
    animation: fadeInOut 3s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(10px); }
    10% { opacity: 1; transform: translateY(0); }
    90% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}

/* 关卡完成界面 */
#level-complete {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(42, 42, 42, 0.95);
    padding: 40px;
    border: 3px solid #ffd700;
    display: none;
    flex-direction: column;
    align-items: center;
    z-index: 700;
    min-width: 350px;
}

#level-complete.visible {
    display: flex;
}

#level-complete h2 {
    color: #ffd700;
    font-size: 28px;
    margin-bottom: 20px;
}

#level-complete .stats {
    color: #ffffff;
    font-size: 14px;
    margin: 10px 0;
    text-align: left;
    width: 100%;
}

#level-complete .rating {
    font-size: 48px;
    color: #ffd700;
    margin: 20px 0;
}

#level-complete button {
    min-width: 150px;
    min-height: 44px;
    padding: 12px 24px;
    margin: 10px;
    background-color: #3a3a3a;
    color: #ffffff;
    border: 2px solid #ffd700;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    cursor: pointer;
}

#level-complete button:hover {
    background-color: #ffd700;
    color: #1a1a1a;
}

/* 游戏结束界面 */
#game-over {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(42, 42, 42, 0.95);
    padding: 40px;
    border: 3px solid #ff0000;
    display: none;
    flex-direction: column;
    align-items: center;
    z-index: 800;
    min-width: 300px;
}

#game-over.visible {
    display: flex;
}

#game-over h2 {
    color: #ff0000;
    font-size: 32px;
    margin-bottom: 20px;
}

#game-over p {
    color: #ffffff;
    font-size: 14px;
    margin: 10px 0;
}

#game-over button {
    min-width: 150px;
    min-height: 44px;
    padding: 12px 24px;
    margin: 10px;
    background-color: #3a3a3a;
    color: #ffffff;
    border: 2px solid #ff0000;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    cursor: pointer;
}

#game-over button:hover {
    background-color: #ff0000;
    color: #ffffff;
}

/* 触控提示 */
.touch-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    pointer-events: none;
    z-index: 100;
}

/* 移动端特定样式 */
@media (max-width: 768px) {
    #main-menu h1 {
        font-size: 24px;
    }

    #main-menu button {
        width: 80%;
        max-width: 250px;
    }

    #pause-menu,
    #settings-panel,
    #level-complete,
    #game-over {
        width: 90%;
        max-width: 350px;
    }
}

/* PC端特定样式 */
@media (min-width: 769px) {
    .touch-hint {
        display: none;
    }
}

/* 禁止文本选择 */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 隐藏滚动条 */
::-webkit-scrollbar {
    display: none;
}

* {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
