/* games/fruitmahjong/css/style.css */

/* ROOT VÀ CẤU HÌNH MOBILE */
:root {
    --primary: #4CAF50;
    --primary-dark: #388E3C;
    --second: #FFC107;
    --danger: #F44336;
    --bg-dark: #1e1e1e;
    --text-light: #ffffff;
    --hud-bg: rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Fredoka', sans-serif;
    /* Cấm highlight bôi đen chữ khi dính phím cảm ứng */
    user-select: none;
    -webkit-user-select: none;
}

body, html {
    width: 100vw;
    height: 100vh;
    overflow: hidden; /* Cấm zoom out, scroll dọc iOS Safari */
    background: radial-gradient(circle at center, #8BC34A 0%, #33691E 100%); /* Nền xanh lá tươi mát thư giãn */
}

/* LỚP THREE.JS NẰM DƯỚI CÙNG */
#threejs-canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* GUI VUE3 NẰM TRÊN */
#vue-app {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* RẤT QUAN TRỌNG: Xuyên thấu click xuống canvas 3D */
}

/* CÁC THÀNH PHẦN NÀO MUỐN NHẬN CLICK THÌ BẬT POINTER EVENTS LẠI */
.game-overlay, .hud-header, .hud-sidebar {
    pointer-events: auto; 
}

/* MÀN HÌNH KHỞI ĐỘNG LEVEL (MODAL) */
.game-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85); /* Tối mờ tháp dưới */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-card {
    background: #2a2a2a;
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    color: white;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border: 2px solid #444;
}

.modal-card .logo-icon {
    font-size: 50px;
    color: var(--primary);
    margin-bottom: 15px;
    text-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
}

.modal-card h1 { font-size: 28px; margin-bottom: 10px;}
.modal-card .desc { font-size: 14px; color: #aaa; margin-bottom: 20px; line-height: 1.5; }
.text-success { color: var(--primary) !important; }
.text-danger { color: var(--danger) !important; }

/* BẢNG ĐIỂM SỐ TRONG MODAL */
.stats-board {
    display: flex;
    justify-content: space-around;
    background: #111;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 25px;
}
.stat-item {
    display: flex;
    flex-direction: column;
}
.stat-item .label { font-size: 12px; color: #888; text-transform: uppercase; }
.stat-item .value { font-size: 24px; font-weight: bold; color: var(--second); }

/* Level Selector Giao diện chọn màn mới */
.level-selector {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fdfaf3;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: bold;
    color: #444;
}
.level-selector .btn-arrow {
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--primary);
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
}
.level-selector .btn-arrow:active { transform: scale(0.9); }
.level-selector .btn-arrow:disabled { color: #ccc; cursor: not-allowed; }

/* NÚT BẤM */
.btn-play, .btn-quit {
    display: block;
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    text-decoration: none;
    color: white;
}
.btn-play { background: var(--primary); margin-bottom: 10px; }
.btn-play:hover { background: var(--primary-dark); transform: translateY(-2px); }
.btn-quit { background: #444; }
.btn-quit:hover { background: #555; }

/* HUD TRONG GAME CỰC KỲ TỐI GIẢN */
.hud-container {
    height: 100%;
    width: 100%;
}

.hud-header {
    position: absolute;
    top: env(safe-area-inset-top, 15px);
    left: 20px; right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.hud-timer, .hud-level, .hud-score {
    background: var(--hud-bg);
    color: white;
    padding: 8px 15px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: bold;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.1);
}

.hud-timer.warning {
    color: var(--danger);
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from { transform: scale(1); box-shadow: 0 0 10px rgba(244, 67, 54, 0.5); }
    to { transform: scale(1.1); box-shadow: 0 0 20px rgba(244, 67, 54, 0.8); }
}

.hud-sidebar {
    position: absolute;
    bottom: env(safe-area-inset-bottom, 30px);
}
.hud-sidebar.right { right: 20px; display: flex; flex-direction: column; gap: 15px; }

.tool-btn {
    width: 60px; height: 60px;
    border-radius: 50%;
    border: none;
    background: var(--second);
    color: #333;
    font-size: 24px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    position: relative;
    cursor: pointer;
    transition: transform 0.1s;
}
.tool-btn:active { transform: scale(0.9); }
.tool-btn:disabled { background: #555; color: #888; cursor: not-allowed;}
.tool-btn .badge {
    position: absolute;
    top: -5px; right: -5px;
    background: var(--danger);
    color: white;
    font-size: 12px;
    width: 24px; height: 24px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #333;
}

/* HIỆU ỨNG CHUYỂN CẢNH VUE */
.fade-enter-active, .fade-leave-active { transition: opacity 0.5s ease; }
.fade-enter-from, .fade-leave-to { opacity: 0; }

/* HƯỚNG DẪN VUỐT CHẠM CẢM ỨNG NỔI LÊN BỀ MẶT 3D */
.tutorial-overlay {
    position: absolute; top:0; left:0; width:100%; height:100%;
    display: flex; align-items: center; justify-content: center;
    background: transparent;
    z-index: 5;
    pointer-events: none; /* RẤT QUAN TRỌNG: Cho phép bấm xuyên qua tháp 3D bên dưới */
}
.hand-gesture {
    color: rgba(255,255,255,0.7);
    text-align: center;
    font-size: 50px;
    text-shadow: 0 2px 10px black;
}
.hand-gesture p { font-size: 20px; margin-top: 10px;}
.animated-swipe {
    animation: swipeAnim 2s infinite ease-in-out;
}
@keyframes swipeAnim {
    0% { transform: translateX(-50px) rotate(-15deg); opacity: 0;}
    20% { opacity: 1;}
    80% { opacity: 1;}
    100% { transform: translateX(50px) rotate(15deg); opacity: 0;}
}
