/* T1: Bảng Cửu Chương Tốc Độ - Style */


h1, h2, h3 { font-family: 'Baloo 2', cursive; color: #FF9800; }

.game-wrapper {
    max-width: 800px; margin: 0 auto; padding: 20px;
    height: 100vh; display: flex; flex-direction: column;
}

.back-btn {
    display: inline-flex; align-items: center; gap: 8px; font-weight: 700;
    color: #FF9800; background: #fff; padding: 8px 16px; border-radius: 99px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); align-self: flex-start; margin-bottom: 5px;
    transition: transform 0.2s; z-index: 100; position: relative;
}

.back-btn:active { transform: scale(0.95); }

.game-header { text-align: center; margin-bottom: 10px; z-index: 100; position: relative;}
.game-header h1 { font-size: 2.5rem; margin-bottom: 5px; text-shadow: 2px 2px 0 #FFF;}
.game-header p { font-size: 1.1rem; color: #7B8B9A; margin-bottom: 10px; }

.stats-container {
    display: flex; justify-content: center; gap: 20px;
}

.score-board, .lives-board {
    display: inline-block; padding: 6px 20px;
    border-radius: 99px; font-weight: 800; font-size: 1.2rem;
    box-shadow: 0 4px 0px rgba(0,0,0,0.1);
}

.score-board { background: #FFD18C; color: #A0522D; box-shadow: 0 4px 0px #E5B26A; }
.lives-board { background: #FFCDD2; color: #C62828; box-shadow: 0 4px 0px #EF9A9A; }

.pop-text.pop { animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

@keyframes popIn {
    0% { transform: scale(1); }
    50% { transform: scale(1.5); }
    100% { transform: scale(1); }
}

/* Khu vực Bảng gỗ câu hỏi */
.question-board {
    background: #8D6E63; /* Màu gỗ */
    border: 6px solid #5D4037;
    border-radius: 16px;
    padding: 20px 40px;
    margin: 0 auto 20px;
    text-align: center;
    color: white;
    font-family: 'Baloo 2', cursive;
    font-size: 2.5rem;
    font-weight: 800;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2), inset 0 0 10px rgba(0,0,0,0.5);
    position: relative;
    z-index: 100;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 120px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.btn-start {
    background: #FF9800; color: white; border: 3px solid #F57C00;
    padding: 10px 30px; font-size: 1.5rem; border-radius: 99px;
    cursor: pointer; font-family: 'Baloo 2', cursive; font-weight: 700;
    box-shadow: 0 6px 0px #E65100; transition: transform 0.1s, box-shadow 0.1s;
    margin-top: 10px;
}

.btn-start:active { transform: translateY(6px); box-shadow: 0 0px 0px #E65100; }
.btn-start.hide { display: none; }

/* Arena (Vùng rớt trái cây) */
.game-area {
    flex: 1; display: flex; flex-direction: column; position: relative;
}

.ninja-arena {
    flex: 1; position: relative; border-radius: 20px; overflow: hidden;
    background: linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(255,255,255,0.1));
    border: 2px dashed #FFD18C; cursor: crosshair;
}

/* Fruit Target */
.target-fruit {
    position: absolute; display: flex; align-items: center; justify-content: center;
    font-size: 4rem; width: 80px; height: 80px;
    user-select: none; pointer-events: auto; /* Cho phép click/touch */
    filter: drop-shadow(0 10px 10px rgba(0,0,0,0.2));
    transition: transform 0.1s;
}

/* Bảng tên chứa kết quả đính kèm trái cây */
.target-label {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: white; border: 3px solid #FF9800; color: #E65100;
    border-radius: 50%; width: 45px; height: 45px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 1.2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    pointer-events: none; /* Để chém xuyên qua dính vào trái cây */
}

/* Hiệu ứng chém đứt */
.target-fruit.slashed {
    pointer-events: none;
    animation: slashEffect 0.4s forwards;
}

@keyframes slashEffect {
    0% { transform: scale(1); filter: brightness(1) drop-shadow(0 10px 10px rgba(0,0,0,0.2)); }
    50% { transform: scale(1.3) rotate(15deg); filter: brightness(2) drop-shadow(0 0px 30px #FF9800); }
    100% { transform: scale(0) rotate(-15deg); opacity: 0; filter: brightness(1); }
}

/* Hiệu ứng chém xịt (Rớt khỏi map) */
.target-fruit.missed {
    animation: fadeOutDown 0.3s forwards;
}

@keyframes fadeOutDown {
    to { opacity: 0; transform: translateY(50px); }
}


/* Modal */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.3s; z-index: 1000;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal-content {
    background: white; padding: 40px; border-radius: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2); transform: scale(0.8); transition: transform 0.3s;
    max-width: 90%; width: 400px;
}
.modal-overlay.show .modal-content { transform: scale(1); }
.modal-icon { font-size: 5rem; margin-bottom: 10px; animation: bounce 2s infinite; }

.btn-primary {
    background: #FF9800; color: white; border: none; padding: 12px 30px;
    font-size: 1.2rem; font-family: 'Baloo 2', cursive; border-radius: 99px;
    cursor: pointer; box-shadow: 0 6px 0px #F57C00; margin: 5px;
}
.btn-secondary {
    display: inline-block; background: #E2E8F0; color: #4A5568; margin: 5px;
    border: none; padding: 12px 30px; font-size: 1.2rem; font-family: 'Baloo 2', cursive;
    border-radius: 99px; cursor: pointer; box-shadow: 0 6px 0px #CBD5E0;
}
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-15px);}
    60% {transform: translateY(-7px);}
}

/* Responsive */
@media (max-width: 600px) {
    .question-board { font-size: 2rem; padding: 15px 20px; }
    .target-fruit { font-size: 3.5rem; width: 60px; height: 60px; }
    .target-label { width: 35px; height: 35px; font-size: 1rem; }
    .game-header h1 { font-size: 2rem; }
}
