/* Base Setup & Animated Background */
:root {
    /* Fix iOS viewport height issue */
    --vh: 100svh;
}

body {
    margin: 0;
    overflow: hidden;
    font-family: 'Nunito', sans-serif;
    color: #333;
    touch-action: none;
    /* Khóa hoàn toàn scroll và zoom */
    overscroll-behavior: none;
    -webkit-user-select: none;
    /* Chống bôi đen text */
    user-select: none;
    height: var(--vh);
    width: 100vw;
    display: flex;
    flex-direction: column;
}

/* Chống kéo thả ảnh */
img {
    -webkit-user-drag: none;
}

.bg-gradient-animated {
    background: linear-gradient(-45deg, #00a1e9, #ffffff, #ffcc00, #ff0000);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Glassmorphism Classes */
.glass {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

.glass-panel {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

/* Ergonomic Mobile Controls */
.control-btn {
    background: rgba(255, 255, 255, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08), inset 0 3px 5px rgba(255, 255, 255, 0.9);
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #00a1e9;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    position: relative;
    animation: float-btn 3s ease-in-out infinite;
}

/* Mở rộng vùng bấm để tránh ấn trượt */
.control-btn::after {
    content: '';
    position: absolute;
    inset: -15px;
    z-index: -1;
}

.control-btn:nth-child(2) {
    animation-delay: 0.2s;
}

.control-btn:nth-child(4) {
    animation-delay: 0.4s;
}

.control-btn:nth-child(6) {
    animation-delay: 0.6s;
}

.control-btn:nth-child(8) {
    animation-delay: 0.8s;
}

.control-btn:hover {
    transform: translateY(-5px) scale(1.05);
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 10px 20px rgba(0, 161, 233, 0.15);
    color: #007bb5;
}

.control-btn.active,
.control-btn:active {
    transform: scale(0.85) translateY(4px);
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 2px 10px rgba(0, 161, 233, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.1);
    color: #ff0000;
    animation: none;
    transition: all 0.05s ease-out;
}

@keyframes float-btn {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-5px) scale(1.02);
    }
}

@keyframes btn-pop-in {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    70% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

#controls-area .control-btn {
    animation: float-btn 3s ease-in-out infinite, btn-pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.control-btn svg {
    width: 32px;
    height: 32px;
    stroke: currentColor;
    stroke-width: 3.5;
    transition: transform 0.2s ease;
}

.control-btn:hover svg {
    transform: scale(1.1);
}

/* Premium Play Button */
.btn-play {
    background: linear-gradient(135deg, #00a1e9 0%, #007bb5 100%);
    box-shadow: 0 10px 20px rgba(0, 161, 233, 0.3);
    transition: all 0.2s ease;
}

.btn-play:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px rgba(0, 161, 233, 0.4);
}

.btn-play:active {
    transform: scale(0.95);
    box-shadow: 0 5px 10px rgba(0, 161, 233, 0.3);
}

/* Expand hit area for top buttons too */
#btn-help,
#btn-settings {
    position: relative;
}

#btn-help::after,
#btn-settings::after {
    content: '';
    position: absolute;
    inset: -10px;
}

/* Character Select Button Styling */
.char-btn.active {
    border-color: #00a1e9;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 4px rgba(0, 161, 233, 0.3);
    transform: scale(1.05);
}

/* Custom Scrollbar for Settings Menu */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(0, 161, 233, 0.4);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 161, 233, 0.6);
}

/* ================= STANDARDIZED TEXT2 BRAND HEADER ================= */
.header-brand-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.btn-back {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid rgba(0, 0, 0, 0.15);
    color: #0f172a;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    flex-shrink: 0;
    font-size: 18px;
    padding: 0;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.btn-back i,
.btn-back svg {
    color: inherit;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.8);
    color: #000000;
    transform: translateX(-2px);
    border-color: rgba(0, 0, 0, 0.35);
}

.btn-back:active {
    transform: scale(0.92);
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.45);
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
}

.brand-link:hover {
    opacity: 0.92;
}

.brand-logo-card {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
    padding: 3.5px;
    box-sizing: border-box;
    transition: transform 0.2s ease;
}

.brand-link:hover .brand-logo-card {
    transform: scale(1.04);
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
    display: block;
}

.brand-text {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    line-height: 1;
    white-space: nowrap;
}

.brand-name {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-weight: 800;
    font-size: 19px;
    color: #0f172a;
    letter-spacing: -0.025em;
    line-height: 1;
}

.brand-divider {
    font-size: 14px;
    font-weight: 300;
    color: rgba(15, 23, 42, 0.4);
    opacity: 0.7;
    user-select: none;
}

.brand-app {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    letter-spacing: -0.01em;
    line-height: 1;
}

@media (max-width: 640px) {
    .btn-back {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: 16px;
    }

    .brand-logo-card {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        padding: 3px;
    }

    .brand-name {
        font-size: 17px;
    }

    .brand-divider {
        font-size: 13px;
    }

    .brand-app {
        font-size: 13px;
    }
}