/* ===== 移动端覆盖样式 =====
   覆盖 style.css 的固定桌面尺寸，使布局在移动端横屏时自适应铺满
   仅作为 style.css 的补充，不重复定义已有样式
*/

/* ===== 基础重置（移动端补充） ===== */
* {
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* 防止 iOS Safari 弹性滚动 */
    overscroll-behavior: none;
    -webkit-user-select: none;
    user-select: none;
}

/* 让 input 等可输入元素保持可选 */
input, textarea {
    -webkit-user-select: auto;
    user-select: auto;
}

/* ===== 覆盖桌面固定尺寸 → 移动端全屏 ===== */
body {
    justify-content: center;
    align-items: center;
}

.game-container {
    width: 100vw;
    height: 100vh;
    height: -webkit-fill-available;
    border-radius: 0;
    box-shadow: none;
}

/* ===== 服务器面板：移动端自适应 ===== */
.server-panel {
    width: 28%;
    min-width: 180px;
    max-width: 282px;
}

/* ===== 右侧主区域自适应（覆盖 style.css 固定高度） ===== */
.top-row {
    height: auto;
    flex: 1 1 55%;
    min-height: 0;
}

.ad-box {
    width: auto;
    height: 100%;
    flex: 0 0 45%;
    max-width: 50%;
}

.ad-slide img {
    object-fit: contain;
}

.notice-panel {
    padding-top: 28px;
}

.notice-item {
    padding: 4px 8px;
    font-size: 12px;
    gap: 5px;
    margin-bottom: 0;
}

.notice-list {
    padding: 2px 6px;
}

.login-section {
    flex: 0 0 auto;
    padding: 8px 15px;
}

/* ===== 小屏幕优化（横屏高度不足 360px） ===== */
@media (max-height: 360px) {
    .server-panel {
        padding: 10px 12px;
    }
    .tree-node-content {
        padding: 5px 8px;
        font-size: 12px;
    }
    .server-info-bar {
        padding: 5px 8px;
        font-size: 12px;
    }
    .login-section {
        padding: 5px 12px;
    }
    .field-label {
        height: 22px;
        width: 42px;
    }
    .field-input-wrap {
        width: 170px;
        height: 22px;
    }
    .field-input-wrap input {
        font-size: 12px;
        padding: 0 6px;
    }
    .start-btn img {
        height: 45px;
    }
    .register-btn img {
        height: 22px;
    }
    .login-section .agreement-row {
        font-size: 11px;
    }
    .login-section .agreement-row a {
        font-size: 10px;
    }
}

/* ===== 高度充足的横屏（> 600px） ===== */
@media (min-height: 600px) {
    .server-panel {
        padding: 24px 20px;
    }
    .tree-node-content {
        padding: 10px 12px;
        font-size: 15px;
    }
    .login-section {
        padding: 15px 30px;
    }
    .field-label {
        height: 32px;
        width: 60px;
    }
    .field-input-wrap {
        width: 240px;
        height: 30px;
    }
    .start-btn img {
        height: 70px;
    }
}

/* ===== 竖屏旋转提示遮罩 ===== */
.rotate-tip {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.rotate-tip.show {
    display: flex;
}

.rotate-tip-content {
    text-align: center;
    color: #ffd700;
}

.rotate-icon {
    font-size: 96px;
    line-height: 1;
    margin-bottom: 32px;
    animation: rotate-phone 2s ease-in-out infinite;
    display: inline-block;
}

@keyframes rotate-phone {
    0%   { transform: rotate(0deg); }
    45%  { transform: rotate(90deg); }
    55%  { transform: rotate(90deg); }
    100% { transform: rotate(0deg); }
}

.rotate-text {
    font-size: 18px;
    line-height: 1.6;
    letter-spacing: 2px;
    color: rgba(255, 215, 0, 0.9);
    margin-bottom: 28px;
}

/* 强制横屏按钮 */
.lock-landscape-btn {
    display: inline-block;
    padding: 14px 36px;
    background: linear-gradient(135deg, #ffd700 0%, #f0c000 100%);
    border: none;
    border-radius: 30px;
    color: #8b0000;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 2px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(255, 215, 0, 0.5);
    transition: all 0.2s;
    margin-bottom: 32px;
    -webkit-tap-highlight-color: transparent;
}

.lock-landscape-btn:active {
    transform: scale(0.96);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

.lock-landscape-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 清除缓存重新加载按钮 */
.cache-bust-btn {
    display: block;
    margin: 0 auto 24px;
    padding: 8px 18px;
    background: transparent;
    color: rgba(255, 215, 0, 0.6);
    border: 1px solid rgba(255, 215, 0, 0.25);
    border-radius: 16px;
    font-size: 11px;
    letter-spacing: 1px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.cache-bust-btn:active {
    background: rgba(255, 215, 0, 0.1);
    color: rgba(255, 215, 0, 0.9);
}

/* 添加到主屏幕提示 */
.install-hint {
    margin-top: 8px;
    padding: 14px 18px;
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.25);
    border-radius: 8px;
    max-width: 320px;
}

.install-hint-title {
    color: #ffd700;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 6px;
    letter-spacing: 1px;
}

.install-hint-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    line-height: 1.5;
}

/* ===== 游戏 iframe 容器（保持 PWA 全屏加载游戏） ===== */
.game-frame-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    height: -webkit-fill-available;
    background: #000;
    z-index: 5000;
}

.game-frame-container.active {
    display: block;
}

.game-frame-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
    display: block;
}

/* 触屏设备：iOS Safari 给跨域 iframe 预留滚动条空间 */
@media (pointer: coarse) {
    .game-frame-container iframe {
        width: calc(100% + 70px);
    }
}
