/* STYGIAN DEPTHS — style.css */
/* 悠：這個CSS很短，別廢話了，直接看 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    background: #000000;
    overflow: hidden;
    font-family: 'Segoe UI', 'Microsoft JhengHei', sans-serif;
    touch-action: none;
}

#game-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #000;
    position: relative;
}

#game-canvas {
    display: block;
    /* 自動縮放：保持16:10比例 */
    max-width: 100%;
    max-height: 100%;
    /* 文字與圖形要清晰：使用 auto（高品質）而非 pixelated */
    image-rendering: auto;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: high-quality;
    /* 防止手機縮放/拖動 */
    touch-action: none;
    cursor: crosshair;
}

/* 手機虛擬搖桿容器 */
#mobile-controls {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 220px;
    pointer-events: none;
    z-index: 100;
}

#joystick-zone {
    position: absolute;
    left: 20px;
    bottom: 20px;
    width: 160px;
    height: 160px;
    pointer-events: all;
}

#joystick-base {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: 2px solid rgba(255,255,255,0.2);
}

#joystick-knob {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    border: 2px solid rgba(255,255,255,0.5);
    pointer-events: none;
    transition: none;
}

#action-buttons {
    position: absolute;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: all;
}

#action-buttons-row1,
#action-buttons-row2 {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.mobile-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    pointer-events: all;
    -webkit-tap-highlight-color: transparent;
    active-opacity: 0.5;
    line-height: 1.2;
    text-shadow: 0 1px 2px #000;
}

.mobile-btn:active {
    background: rgba(255,255,255,0.2);
    transform: scale(0.92);
}

#btn-attack { background: rgba(180, 40, 40, 0.7); border-color: #ff6666; }
#btn-dash   { background: rgba(40, 120, 200, 0.7); border-color: #66aaff; }
#btn-skill1 { background: rgba(120, 60, 180, 0.7); border-color: #cc88ff; width: 54px; height: 54px; font-size: 10px; }
#btn-skill2 { background: rgba(60, 160, 120, 0.7); border-color: #44ddaa; width: 54px; height: 54px; font-size: 10px; }
#btn-skill3 { background: rgba(200, 140, 20, 0.7); border-color: #ffcc44; width: 54px; height: 54px; font-size: 10px; }
#btn-inventory { background: rgba(80,80,80,0.7); border-color: #aaa; width: 48px; height: 48px; font-size: 9px; }

/* 遊戲載入畫面 */
#loading-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: #fff;
}

#loading-screen h1 {
    font-size: 36px;
    letter-spacing: 4px;
    color: #c084fc;
    text-shadow: 0 0 20px #c084fc;
    margin-bottom: 8px;
}

#loading-screen p {
    color: #888;
    font-size: 14px;
    margin-bottom: 32px;
}

#loading-bar-container {
    width: 300px;
    height: 4px;
    background: #222;
    border-radius: 2px;
    overflow: hidden;
}

#loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #7c3aed, #c084fc);
    border-radius: 2px;
    transition: width 0.1s linear;
}

/* 隱藏滾動條 */
::-webkit-scrollbar { display: none; }

/* 手機判斷：螢幕寬度小於768px顯示虛擬控制器 */
@media (max-width: 768px), (pointer: coarse) {
    #mobile-controls {
        display: block;
    }
    #game-canvas {
        cursor: default;
    }
    body {
        /* 防止手機地址欄干擾 */
        height: 100dvh;
    }
}

/* 橫屏提示（豎屏時顯示） */
#rotate-hint {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #000;
    z-index: 99999;
    color: #fff;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    text-align: center;
    gap: 16px;
}

#rotate-hint svg {
    width: 60px;
    height: 60px;
    fill: #c084fc;
}

@media (orientation: portrait) and (max-width: 768px) {
    #rotate-hint {
        display: flex;
    }
}
