/* ===== WePang Match-3 Demo — Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-font-smoothing: antialiased;
    /* Mobile safe area support */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#gameCanvas {
    display: block;
    margin: 0 auto;
    touch-action: none;
}

/* Loading Screen */
#loadingScreen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 1000;
}

.loading-content {
    text-align: center;
}

.game-title {
    color: #fff;
    font-size: 36px;
    font-weight: bold;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.3);
    margin-bottom: 30px;
    letter-spacing: 4px;
}

.loading-bar-wrap {
    width: 240px;
    height: 12px;
    background: rgba(255,255,255,0.2);
    border-radius: 6px;
    overflow: hidden;
    margin: 0 auto 12px;
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #FFE66D, #FF6B6B);
    border-radius: 6px;
    transition: width 0.1s ease;
}

.loading-percent {
    color: rgba(255,255,255,0.8);
    font-size: 14px;
}

/* ===== Portrait Lock: Landscape Warning Overlay ===== */
#landscapeWarning {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.landscape-content {
    text-align: center;
    color: #fff;
}

.rotate-icon {
    font-size: 64px;
    animation: rotateHint 2s ease-in-out infinite;
    margin-bottom: 20px;
}

.landscape-content p {
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 2px;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.3);
}

@keyframes rotateHint {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(90deg); }
    50% { transform: rotate(90deg); }
    75% { transform: rotate(0deg); }
}

/* When mobile device is in landscape orientation, show the warning overlay.
   Desktop (body.is-desktop) skips this entirely so the game is always playable. */
@media screen and (orientation: landscape) {
    body:not(.is-desktop) #landscapeWarning {
        display: flex !important;
    }
    body:not(.is-desktop) #gameCanvas,
    body:not(.is-desktop) #hud,
    body:not(.is-desktop) #loadingScreen,
    body:not(.is-desktop) #resultOverlay {
        visibility: hidden;
    }
}

@media screen and (orientation: portrait) {
    #landscapeWarning {
        display: none !important;
    }
}

/* Desktop: always hide landscape warning */
body.is-desktop #landscapeWarning {
    display: none !important;
}
