/*
 * WebGameBox - 公共样式库
 * 移动端竖屏游戏适配 - 居中显示
 */

/* ===== 基础重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== 视口适配 ===== */
html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 
             env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ===== 游戏容器 ===== */
.game-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 400px;
    height: 100%;
    max-height: 700px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 0;
}

/* ===== 游戏区域 ===== */
.game-content {
    flex: 1;
    position: relative;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

/* ===== 顶部状态栏 ===== */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.4);
    min-height: 48px;
}

.game-header .score {
    color: #fff;
    font-size: 15px;
    font-weight: 600;
}

.game-header .score span {
    color: #ffd700;
    font-size: 18px;
}

.game-header .back-btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
}

.game-header .header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.game-header .install-btn {
    background: #ffd700;
    color: #1a1a2e;
    border: none;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

/* ===== 信息面板 ===== */
.game-info {
    display: flex;
    justify-content: space-around;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
}

.game-info .info-item {
    text-align: center;
    color: #fff;
}

.game-info .info-item .label {
    font-size: 10px;
    opacity: 0.7;
}

.game-info .info-item .value {
    font-size: 16px;
    font-weight: bold;
}

/* ===== 画布容器 ===== */
.canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.canvas-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ===== 底部控制区 ===== */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.5);
}

.game-controls .ctrl-btn {
    width: 55px;
    height: 55px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
}

.game-controls .ctrl-btn:active {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== 底部广告位 ===== */
.game-ad {
    background: linear-gradient(45deg, #2d2d44, #3d3d5c);
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px dashed rgba(255, 255, 255, 0.2);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
}

/* ===== 弹窗屏幕 ===== */
.modal-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.modal-screen.hidden {
    display: none;
}

.modal-screen h1,
.modal-screen h2 {
    font-size: 26px;
    margin-bottom: 15px;
    color: #fff;
}

.modal-screen p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 25px;
    font-size: 13px;
}

.modal-screen button {
    background: linear-gradient(135deg, #e94560, #ff6b6b);
    color: #fff;
    border: none;
    padding: 14px 45px;
    border-radius: 30px;
    font-size: 15px;
    cursor: pointer;
    margin: 5px;
}

.modal-screen button:active {
    transform: scale(0.95);
}

.modal-screen .score-display {
    font-size: 42px;
    color: #ffd700;
    margin: 15px 0;
}

/* ===== 浮动文字动画 ===== */
.float-text {
    position: absolute;
    font-size: 16px;
    font-weight: bold;
    color: #ffd700;
    animation: floatUp 1s forwards;
    pointer-events: none;
    z-index: 15;
}

@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-40px); }
}
