/* Import font */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght=500;700&display=swap');

/* ===== CSS VARIABLES ===== */
:root {
    --black: #1A1A1A;
    --white: #FFFFFF;
    --bg: #E6DFD3;
    --bg-body: rgba(244, 239, 234, 0.35);
    --red: #FF5A5A;
    --green: #2e7d32;
    --shadow-sm: 2px 2px 0px var(--black);
    --shadow-md: 3px 3px 0px var(--black);
    --shadow-lg: 4px 4px 0px var(--black);
    --shadow-xl: 8px 8px 0px var(--black);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition-btn: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                      box-shadow 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Space Grotesk', sans-serif;
}

body {
    background: linear-gradient(var(--bg-body), var(--bg-body)),
                url('images/background.png') no-repeat center center fixed;
    background-size: cover;
    color: var(--black);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    min-height: 100dvh; /* Đơn vị chiều cao động chuẩn cho mobile */
}

.language-dropdown {
    top: calc(20px + env(safe-area-inset-top));
    right: 20px;
}

.btn-back {
    top: calc(20px + env(safe-area-inset-top));
    left: 20px;
}


/* ===== LANGUAGE DROPDOWN & INFO BUTTON ===== */
.language-dropdown {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-info-style {
    background: var(--black);
    color: var(--bg);
    border: 2px solid var(--black);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-btn);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 39px;
}

.btn-info-style:hover {
    background: var(--bg);
    color: var(--black);
    transform: translate(-1px, -1px);
    box-shadow: var(--shadow-md);
}

.btn-info-style:active {
    transform: translate(2px, 2px);
    box-shadow: 0px 0px 0px var(--black);
}

.lang-current-wrapper {
    position: relative;
    display: inline-block;
}

.lang-current-btn {
    background: var(--white);
    border: 2px solid var(--black);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    transition: var(--transition-btn);
    height: 39px;
}

.lang-current-btn::after {
    content: '▼';
    font-size: 0.65rem;
    transition: transform 0.2s ease;
}

.lang-current-wrapper:hover .lang-current-btn::after { transform: rotate(180deg); }

.lang-list {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: var(--white);
    border: 2px solid var(--black);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    min-width: 130px;
    overflow: hidden;
    animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lang-item {
    width: 100%;
    background: none;
    border: none;
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    color: var(--black);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.lang-item:hover { background-color: var(--black); color: var(--white); }
.lang-current-wrapper:hover .lang-list { display: block; }

/* ===== CONTAINER & CARD ===== */
.container {
    width: 100%;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 10px 20px;
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1, h2 {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -1px;
    margin-bottom: 15px;
    text-align: center;
    width: 100%;
}

.subtitle {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 20px;
    text-align: center;
}

/* ===== INPUT ===== */
input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 3px solid var(--black);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 20px;
    background: #FCFCFA;
    outline: none;
    box-shadow: var(--shadow-lg);
    transition: all 0.2s ease;
    text-align: center;
}

input[type="text"]:focus {
    background: var(--white);
    box-shadow: 5px 5px 0px var(--black);
    transform: translate(-2px, -2px);
}

/* ===== BUTTONS ===== */
.btn-primary, .btn-submit, .btn-nav, .btn-delete, .btn-back {
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: var(--transition-btn), background-color 0.2s ease;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.btn-primary {
    background-color: var(--bg);
    color: var(--black);
    padding: 12px 24px;
    font-size: 0.95rem;
    border: 3px solid var(--black);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    width: 100%;
}

.btn-submit {
    background-color: var(--black);
    color: var(--white);
    padding: 15px 24px;
    font-size: 1.1rem;
    border: 3px solid var(--black);
    border-radius: var(--radius-md);
    box-shadow: 4px 4px 0px var(--bg);
    width: 100%;
    margin-top: 20px;
}

.btn-delete {
    background: var(--white);
    color: var(--red);
    border: 2px solid var(--black);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-top: 10px;
    width: 100%;
    box-shadow: var(--shadow-sm);
}

.btn-back {
    position: fixed;
    top: 20px; left: 20px; z-index: 999;
    background: var(--white); color: var(--black);
    border: 2px solid var(--black); border-radius: var(--radius-sm);
    padding: 10px 16px; font-size: 0.9rem; width: auto;
    box-shadow: var(--shadow-md);
}

.btn-nav {
    background: var(--white); 
    border: 2px solid var(--black);
    width: 44px !important; 
    height: 44px !important; 
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm); 
    flex-shrink: 0 !important; 
    font-size: 1rem;
    z-index: 10;
}

.btn-primary:hover  { transform: translate(-2px, -2px); box-shadow: 6px 6px 0px var(--black); }
.btn-submit:hover   { transform: translate(-2px, -2px); box-shadow: 6px 6px 0px var(--bg); }
.btn-nav:hover, .btn-back:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0px var(--black); }
.btn-delete:hover   { background-color: #FFF5F5; transform: translate(-1px, -1px); box-shadow: var(--shadow-md); }

.btn-primary:active, .btn-nav:active, .btn-back:active { transform: translate(4px, 4px); box-shadow: 0px 0px 0px var(--black); }
.btn-submit:active  { transform: translate(4px, 4px); box-shadow: 0px 0px 0px var(--bg); }
.btn-delete:active  { transform: translate(2px, 2px); box-shadow: 0px 0px 0px var(--black); }

/* Nút dừng ghi âm đặc biệt */
.btn-danger {
    background-color: var(--red) !important;
    color: var(--white) !important;
}

/* ===== GOD SELECTOR ===== */
/* ===== ĐOẠN CSS SỬA LỖI LỆCH GIAO DIỆN ===== */

.god-selector {
    display: flex; 
    align-items: center; 
    justify-content: center;
    width: 100%; 
    max-width: 420px; 
    margin: 20px auto; 
    position: relative; /* Gốc tọa độ cố định để định vị 2 nút bấm */
}

/* Khung chứa nội dung được căn giữa tuyệt đối độc lập */
.god-display {
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    width: 100%;
    /* Sử dụng margin tự động thay vì padding để không bóp méo hay đẩy lệch khung hình */
    margin: 0 auto; 
    box-sizing: border-box;
}

/* Cố định nút TRÁI sát rìa biên trái */
#btn-prev, .god-selector .btn-nav:first-child {
    position: absolute;
    left: 0;
    top: calc(50% - 22px); /* Căn giữa dọc theo tâm chiều cao nút */
    z-index: 10;
    margin: 0;
}

/* Cố định nút PHẢI sát rìa biên phải */
#btn-next, .god-selector .btn-nav:last-child {
    position: absolute;
    right: 0;
    top: calc(50% - 22px); /* Căn giữa dọc theo tâm chiều cao nút */
    z-index: 10;
    margin: 0;
}

#god-image {
    width: 100%; 
    max-width: 320px; 
    height: 320px;
    object-fit: contain; 
    margin-bottom: 15px;
    animation: floatGod 4s ease-in-out infinite;
}

#god-name {
    font-size: 1.25rem; 
    font-weight: 700; 
    text-align: center; 
    width: 100%; 
    
    /* Hiện FULL tên trên 1 dòng, bỏ hoàn toàn dấu 3 chấm */
    white-space: nowrap;                    
    overflow: visible;       
    text-overflow: clip;     
    display: block;
}
/* ===== AUDIO SECTION ===== */
.audio-section { width: 100%; margin-top: 20px; }
#audio-preview-container {
    margin-top: 15px; background: var(--white); padding: 15px;
    border-radius: var(--radius-md); border: 3px solid var(--black);
    box-shadow: var(--shadow-lg); display: flex; flex-direction: column; align-items: center;
}
.audio-status { font-size: 0.85rem; margin-bottom: 8px; font-weight: 700; }
audio { width: 100%; }

/* ===== POPUP OVERLAY (Lỗi, Thành công) ===== */
.overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(26, 26, 26, 0.7);
    display: flex; justify-content: center; align-items: center; z-index: 999;
    backdrop-filter: blur(4px); opacity: 0; visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}
.overlay.show { opacity: 1; visibility: visible; }

.popup-content {
    background: var(--white); border: 4px solid var(--black);
    padding: 40px 20px; border-radius: var(--radius-lg); text-align: center;
    max-width: 400px; width: 90%; box-shadow: var(--shadow-xl);
    transform: scale(0.85) translateY(20px);
    transition: transform 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}
.overlay.show .popup-content { transform: scale(1) translateY(0); }
.popup-success h2 { color: var(--green); margin-bottom: 15px; }
.popup-error h2   { color: var(--red); margin-bottom: 15px; }
.popup-content p  { margin-bottom: 25px; line-height: 1.4; font-weight: 500; }

/* ===== GIAO DIỆN POPUP THÔNG TIN TO RỘNG RÃI ===== */
.popup-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5); display: none;
    justify-content: center; align-items: center; z-index: 9999;
}
.popup-overlay.show { display: flex; }

.popup-content.info-box {
    background: #fdfbf7; 
    border: 3px solid #1a1a1a; 
    border-radius: 20px;
    padding: 40px;            
    width: 95%; 
    max-width: 650px;         
    box-shadow: 6px 6px 0px #1a1a1a; 
    text-align: left;
    animation: popupPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popupPop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.popup-content h2 {
    text-align: center; margin-top: 0; font-size: 1.6rem;
    color: #1a1a1a; border-bottom: 2px solid #1a1a1a; padding-bottom: 10px;
}

.info-scroll-content {
    max-height: 480px;        
    overflow-y: auto;
    margin: 20px 0; 
    padding-right: 10px; 
    color: #333; 
    line-height: 1.6;
}

.info-divider { border: none; border-top: 1px dashed #1a1a1a; margin: 15px 0; }

/* ĐỊNH DẠNG HỆ THỐNG CÁC TAB BUTTON */
.donate-tabs {
    display: flex; gap: 10px; margin: 20px 0 15px 0; width: 100%;
}

.tab-btn {
    flex: 1; background: var(--white); color: var(--black);
    border: 2px solid var(--black); border-radius: var(--radius-sm);
    padding: 10px; font-weight: 700; cursor: pointer;
    box-shadow: var(--shadow-sm); transition: all 0.15s ease;
    text-transform: uppercase; font-size: 0.85rem;
}

.tab-btn:hover { background: #f0ede6; transform: translateY(-1px); box-shadow: var(--shadow-md); }

.tab-btn.active {
    background: var(--black); color: var(--white);
    box-shadow: 0px 0px 0px var(--black); transform: translate(2px, 2px);
}

.donate-content-wrapper { width: 100%; display: flex; justify-content: center; }
.tab-content-panel {
    width: 100%; display: flex; flex-direction: column; align-items: center;
    animation: fadeInTab 0.25s ease-out;
}

@keyframes fadeInTab { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.qr-container {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; margin: 10px 0; width: 100%;
}

/* ===== KHUNG ĐỒNG BỘ QR CODE TỰ CO GIÃN THÔNG MINH ===== */
#bank-qr-image {
    width: 100%;
    max-width: 400px;         
    height: auto;             
    object-fit: contain;
    border: 3px solid var(--black);
    border-radius: 12px;
    background: var(--white);
    padding: 10px;
    box-shadow: 4px 4px 0px var(--black);
    transition: transform 0.2s ease;
}

#paypal-qr-image {
    width: 100%;
    max-width: 220px;
    height: auto;
    object-fit: contain;
    border: 3px solid var(--black);
    border-radius: 12px;
    background: var(--white);
    padding: 10px;
    box-shadow: 4px 4px 0px var(--black);
    transition: transform 0.2s ease;
}

#bank-qr-image:hover, #paypal-qr-image:hover { transform: scale(1.02); }

.qr-caption {
    font-size: 0.8rem; font-weight: 700; color: #555;
    text-transform: uppercase; margin-top: 12px; letter-spacing: 0.5px; text-align: center;
}

/* NÚT BẤM DONATE PAYPAL KIỂU NEO-BRUTALISM */
.btn-paypal-style {
    display: inline-flex; align-items: center; justify-content: center;
    width: 100%; max-width: 250px; background: #0070ba; color: var(--white);
    border: 3px solid var(--black); border-radius: var(--radius-md);
    padding: 12px; font-size: 0.9rem; font-weight: 700;
    text-decoration: none; text-transform: uppercase; margin-top: 15px;
    box-shadow: var(--shadow-lg); transition: var(--transition-btn); text-align: center;
}

.btn-paypal-style:hover { background: #005ea6; transform: translate(-2px, -2px); box-shadow: 6px 6px 0px var(--black); }
.btn-paypal-style:active { transform: translate(4px, 4px); box-shadow: 0px 0px 0px var(--black); }

.btn-close-style {
    display: block; width: 100%; background: #1a1a1a; color: #e6dfd3;
    border: 2px solid #1a1a1a; border-radius: 12px; padding: 12px;
    font-weight: bold; cursor: pointer; box-shadow: 3px 3px 0px #ccc;
    margin-top: 15px; text-transform: uppercase;
}
.btn-close-style:hover { background: #e6dfd3; color: #1a1a1a; box-shadow: 3px 3px 0px #1a1a1a; }

.developer-credit { position: fixed; bottom: 20px; left: 20px; z-index: 1000; font-size: 0.75rem; font-weight: 500; color: var(--black); opacity: 0.5; }
.hidden { display: none !important; }

@keyframes popIn { 0% { opacity: 0; transform: scale(0.9) translateY(-10px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes floatGod { 0% { transform: translateY(0px); } 50% { transform: translateY(-6px); } 100% { transform: translateY(0px); } }

/* ===== RESPONSIVE ===== */
@media screen and (max-width: 768px) {
    body { padding: 15px; }
    .container { max-width: 100%; }
    .card { padding: 10px 5px; }
    h1 { font-size: 1.7rem; } 
    h2 { font-size: 1.3rem; }
    
    .god-selector { 
        gap: 10px; 
        max-width: 320px; 
    } 
    
    #god-image { max-width: 250px; height: 250px; }
    .btn-primary, .btn-submit { font-size: 0.95rem; padding: 14px; }
    .language-dropdown { top: 15px; right: 15px; }
    .btn-back { top: 15px; left: 15px; padding: 8px 12px; font-size: 0.8rem; }
    
    /* Responsive cho hộp popup và QR trên thiết bị di động */
    .popup-content.info-box { padding: 25px 20px; }
    .info-scroll-content { max-height: 380px; }
    #bank-qr-image { max-width: 280px; }
    #paypal-qr-image { max-width: 180px; }
}
.btn-open-upload-style {
    position: fixed; top: 20px; left: 20px; z-index: 1000;
    background: var(--black); color: var(--white);
    padding: 8px 12px; border: 2px solid var(--black);
    border-radius: var(--radius-sm); font-weight: 700; cursor: pointer;
    box-shadow: var(--shadow-sm); font-size: 0.8rem;
}
.btn-open-upload-style:hover { background: var(--bg); color: var(--black); }
