/* ============================================================
   狗宝的生日小世界 - global.css
   基础变量 / 排版 / 按钮 / HUD / 模态框架 / 移动端安全区
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=ZCOOL+KuaiLe&display=swap');

:root {
    --cream: #fff7ec;
    --wall-top: #ffe9d7;
    --wall-bottom: #ffd9c4;
    --floor: #e9c39b;
    --text-main: #6b4f3f;
    --text-soft: #a08371;
    --pink: #ff9aa2;
    --pink-deep: #f76c8a;
    --peach: #ffc9a8;
    --mint: #a8dcd0;
    --butter: #ffe08a;
    --card-bg: rgba(255, 255, 255, 0.92);
    --shadow-soft: 0 6px 18px rgba(150, 90, 60, 0.14);
    --shadow-lift: 0 10px 26px rgba(150, 90, 60, 0.2);
    --radius-lg: 22px;
    --radius-md: 16px;
    --sa-top: env(safe-area-inset-top, 0px);
    --sa-bottom: env(safe-area-inset-bottom, 0px);
    --sa-left: env(safe-area-inset-left, 0px);
    --sa-right: env(safe-area-inset-right, 0px);
    color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0; padding: 0; width: 100%; height: 100%;
    overflow: hidden;
    font-family: 'ZCOOL KuaiLe', 'Comic Sans MS', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    color: var(--text-main);
    background: linear-gradient(180deg, var(--cream), #ffe8d9);
    touch-action: manipulation;
    -webkit-user-select: none; user-select: none;
    overscroll-behavior: none;
}

body { padding: var(--sa-top) var(--sa-right) var(--sa-bottom) var(--sa-left); }

button { font-family: inherit; color: inherit; }

/* ---------- 通用按钮 ---------- */
.gb-btn {
    background: var(--card-bg);
    border: 2px solid var(--pink);
    padding: 10px 22px;
    border-radius: 30px;
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 154, 162, 0.35);
    transition: transform 0.15s ease, background 0.2s ease;
}
.gb-btn:active { transform: translateY(2px) scale(0.96); }
.gb-btn.primary { background: var(--pink); color: #fff; border-color: var(--pink-deep); }
.gb-btn.ghost { border-color: #e5d3c4; box-shadow: none; color: var(--text-soft); }
.gb-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- 场景切换 ---------- */
.gb-scene {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.45s ease;
    padding: 16px;
}
.gb-scene.active { opacity: 1; pointer-events: auto; }

/* ---------- 顶部工具条 ---------- */
#top-bar {
    position: fixed; top: calc(10px + var(--sa-top)); right: calc(12px + var(--sa-right));
    z-index: 400; display: flex; gap: 8px;
}
.tool-btn {
    width: 42px; height: 42px; border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    background: rgba(255, 252, 245, 0.88);
    box-shadow: var(--shadow-soft);
    font-size: 1.15rem; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.15s ease;
}
.tool-btn:active { transform: scale(0.88); }
.tool-btn.on { background: var(--butter); }

/* ---------- 浮动提示 ---------- */
#float-msg {
    position: fixed; top: 38%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 14px 30px; border-radius: 26px;
    box-shadow: 0 10px 30px rgba(255, 154, 162, 0.5);
    font-size: 1.15rem; color: var(--pink-deep);
    z-index: 1200; pointer-events: none; opacity: 0;
    text-align: center; max-width: 86vw; line-height: 1.5;
}
#float-msg.show { animation: gb-floatmsg 2.6s forwards; }

/* 成就 toast */
.ach-toast {
    position: fixed; left: 50%; bottom: calc(24px + var(--sa-bottom));
    transform: translateX(-50%);
    background: linear-gradient(135deg, #fff6e3, #ffe9ef);
    border: 2px solid var(--butter);
    border-radius: 18px; padding: 10px 22px;
    box-shadow: var(--shadow-lift);
    z-index: 1300; display: flex; align-items: center; gap: 10px;
    font-size: 1rem; white-space: nowrap;
    animation: gb-toastin 3.2s forwards;
}
.ach-toast .ach-ico { font-size: 1.6rem; }

/* ---------- 模态框架（GameManager） ---------- */
.gb-modal {
    position: fixed; inset: 0; z-index: 600;
    background: rgba(90, 60, 45, 0.35);
    backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.25s ease;
    padding: 14px;
}
.gb-modal.show { opacity: 1; }
.gb-modal-card {
    background: linear-gradient(180deg, #fffdf7, #fff3e8);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lift);
    width: min(560px, 96vw);
    max-height: min(88dvh, 100%);
    display: flex; flex-direction: column;
    overflow: hidden;
    transform: translateY(14px) scale(0.98);
    transition: transform 0.25s ease;
}
.gb-modal.show .gb-modal-card { transform: none; }
.gb-modal--full .gb-modal-card { width: 96vw; height: 88dvh; }
.gb-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 18px 6px;
}
.gb-modal-head h3 { margin: 0; font-size: 1.2rem; color: var(--pink-deep); font-weight: normal; }
.gb-modal-close {
    border: none; background: #f6e2d6; color: #8a6a55;
    width: 32px; height: 32px; border-radius: 50%;
    font-size: 1rem; cursor: pointer; line-height: 1;
}
.gb-modal-close:active { transform: scale(0.9); }
.gb-modal-body {
    padding: 8px 16px 18px;
    overflow-y: auto;
    touch-action: pan-y;
    position: relative;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.gb-modal-body canvas { display: block; width: 100%; height: auto; border-radius: var(--radius-md); touch-action: none; background: transparent; }

.gb-note { font-size: 0.95rem; color: var(--text-soft); text-align: center; line-height: 1.6; max-width: 420px; }
.gb-note b { color: var(--pink-deep); font-weight: normal; }

/* 游戏内小计分条 */
.gb-scorebar {
    display: flex; justify-content: space-between; width: 100%;
    font-size: 1rem; color: var(--text-main);
    background: rgba(255,255,255,0.7); border-radius: 12px; padding: 6px 14px;
}

/* ---------- 通用文本样式 ---------- */
.gb-title {
    font-size: 1.9rem; text-align: center; color: var(--pink-deep);
    text-shadow: 2px 2px 0 rgba(255,255,255,0.9); margin: 0 0 8px;
}
.gb-card {
    background: var(--card-bg); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft); padding: 16px 20px;
    line-height: 1.7; text-align: center;
}

/* 隐藏元素 */
.gb-hide { display: none !important; }

/* 横向滚动兜底：任何情况下都不允许 body 横向滚动 */
html { scrollbar-width: none; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(200, 150, 120, 0.35); border-radius: 3px; }

@media (max-width: 480px) {
    .gb-modal-head h3 { font-size: 1.05rem; }
    .gb-title { font-size: 1.5rem; }
}
