/* ================= CẤU HÌNH CƠ BẢN & NÚT ĐIỀU KHIỂN ================= */
:root {
    --navy: #1a237e;       /* màu chủ đạo CTB */
    --navy-dark: #0d1442;
    --navy-light: #7986cb;
    --paper: #eef3fa;      /* nền cửa sổ: trắng ngà pha xanh pastel */
    --hl: #ffffff;         /* mép sáng của khối nổi */
    --lt: #dbe5f5;
    --sh: #8e9cc4;         /* mép tối mềm */
    --edge: #3a4a8c;       /* viền ngoài khối nổi */
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
body {
    overflow: hidden; background-color: #000; font-family: 'Tahoma', 'Segoe UI', sans-serif;
    touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
input, select { -webkit-user-select: text; user-select: text; }

/* ================= GAME CANVAS & TOÀN MÀN HÌNH ================= */
#gameCanvas {
    position: fixed; inset: 0; display: block;
    width: 100vw; height: 100vh; height: 100dvh;
    background: #eee8d9; touch-action: none;
}
#game-fullscreen {
    position: fixed; z-index: 25;
    top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right));
    width: 44px; height: 44px; display: grid; place-items: center;
    border: 0; border-radius: 50%; background: #23463fd9; color: #fff7df;
    cursor: pointer; font: 24px/1 sans-serif;
}
#game-fullscreen[hidden],
body[data-football="VIEW_STELE"] #game-fullscreen,
body[data-football="KEEPIE"] #game-fullscreen { display: none; }

/* ================= CẦN ĐIỀU KHIỂN ẢO & NÚT TƯƠNG TÁC ================= */
#joystick {
    position: fixed; left: max(22px, env(safe-area-inset-left)); bottom: max(26px, env(safe-area-inset-bottom));
    width: 130px; height: 130px; border-radius: 50%; z-index: 20; display: none;
    background: rgba(26,35,126,0.22); border: 3px solid rgba(26,35,126,0.55);
    touch-action: none; -webkit-user-select: none; user-select: none;
}
#joystick-knob {
    position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
    background: #1a237e; border: 3px solid #fff; box-shadow: 0 3px 10px rgba(0,0,0,0.35); pointer-events: none;
}
#touch-hint {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20; display: none;
    background: rgba(26,35,126,0.85); color: #fff; font-size: 13px; padding: 8px 14px; border-radius: 16px;
    pointer-events: none; transition: opacity 0.8s; white-space: nowrap;
}

#board-btn, #door-btn, #npc-btn, #sit-btn {
    position: fixed; right: 16px; z-index: 20; display: none;
    padding: 10px 14px; font: bold 14px 'Tahoma', sans-serif; color: #fff;
    border: 2px solid var(--navy-dark); box-shadow: 2px 2px 0 rgba(13,20,66,0.4); border-radius: 4px;
}
#npc-btn   { bottom: 120px; background: #d84315; }
#board-btn { bottom: 170px; background: var(--navy); }
#sit-btn   { bottom: 220px; background: #3949ab; }
#door-btn  { bottom: 270px; background: #2e7d32; }

/* ================= NÚT CẢNH BIA ĐÁ & LAN CAN ================= */
#stele-check-in, #stele-return {
    position: fixed; z-index: 24; cursor: pointer; touch-action: manipulation;
    font: 600 14px/1.3 Tahoma, sans-serif; color: #fff9df; background: #24423d;
    border: 1px solid #e8d6a4; border-radius: 9px; padding: 9px 14px;
}
#stele-check-in { transform: translate(-50%, -100%); white-space: nowrap; animation: stele-pulse 1.6s ease-in-out infinite alternate; }
#stele-return { bottom: max(15px, env(safe-area-inset-bottom)); left: max(15px, env(safe-area-inset-left)); min-height: 44px; }
#stele-check-in[hidden], #stele-return[hidden] { display: none; }
@keyframes stele-pulse { from { opacity: .66; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #stele-check-in { animation: none; } }
@media (pointer: coarse) { #stele-check-in { min-height: 44px; } }

#rail-leave {
    position: fixed; bottom: max(16px, env(safe-area-inset-bottom)); right: max(16px, env(safe-area-inset-right));
    z-index: 24; min-height: 46px; padding: 9px 18px;
    background: #23463fea; color: #fff7df; border: 1px solid #c5d3bb;
    border-radius: 24px; font: 600 15px Tahoma, sans-serif; cursor: pointer;
}

/* Ẩn các nút khám phá khi đang ở cảnh đặc biệt */
body[data-football="VIEW_STELE"] :is(#joystick,#touch-hint,#sit-btn,#board-btn,#npc-btn,#door-btn) { display: none !important; }
body[data-football="KEEPIE"] :is(#joystick,#touch-hint,#sit-btn,#board-btn,#npc-btn,#door-btn,#kp-prompt,#stele-check-in) { display: none !important; }
body[data-football="GARDEN_OVERLOOK"] :is(#joystick,#touch-hint,#npc-btn,#door-btn,#school-way,#school-action,#sit-btn,#board-btn,#kp-prompt,#stele-check-in) { display: none !important; }
body[data-football="BASKETBALL"] :is(#joystick,#touch-hint,#npc-btn,#door-btn,#school-way,#school-action,#sit-btn,#board-btn,#kp-prompt,#stele-check-in) { display: none !important; }
body[data-football="BADMINTON"] :is(#touch-hint,#npc-btn,#door-btn,#school-way,#school-action,#sit-btn,#board-btn,#kp-prompt,#stele-check-in) { display: none !important; }
