* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    /* លុបពណ៌ខៀវស្រាលពេលចុចលើទូរស័ព្ទ (Task 1) */
    -webkit-tap-highlight-color: transparent; 
    outline: none;
}

body {
    background-color: #525252;
    background-image: radial-gradient(#3a3a3a 2px, transparent 2px);
    background-size: 30px 30px;
    background-position: 0 0, 15px 15px;
    color: black;
    font-family: 'Roboto', sans-serif;
    text-transform: uppercase;
}

h1, h2, h3, h4, .nav-logo, .nav-links a, .badge, .btn-next, .btn-success, .btn-danger, .btn-secondary {
    font-family: Impact, Charcoal, sans-serif;
    font-weight: bold;
}

/* 🌐 Navigation Bar */
.navbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 30px 50px; position: sticky; top: 0; z-index: 100;
}

.nav-logo {
    background-color: #e0caaf; color: #3b76a0;
    padding: 15px 30px; border-radius: 40px; text-align: center;
    font-size: 28px; line-height: 1.1; cursor: pointer;
    border: 3px solid black; box-shadow: 4px 4px 0px black;
}

.nav-links { display: flex; list-style: none; gap: 60px; }
.nav-links a { color: black; text-decoration: none; font-size: 28px; text-shadow: 2px 2px 0px white; transition: 0.2s; }
.nav-links a:hover { color: white; text-shadow: 2px 2px 0px black; }

.container { max-width: 1000px; margin: 40px auto; padding: 0 20px; }

/* 🏠 Store Pages System */
.store-page { display: none; }
.store-page.active { display: block; animation: fadeIn 0.4s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* 📦 Home Content */
.welcome-text { text-align: center; margin-bottom: 40px; color: white; text-shadow: 2px 2px 0px black; }
.welcome-text h1 { font-size: 40px; margin-bottom: 10px; letter-spacing: 1px; }
.welcome-text p { font-size: 18px; font-weight: bold; }

.home-boxes {
    display: grid; grid-template-columns: 2fr 1.3fr; grid-template-rows: auto auto;
    grid-template-areas: "rank support" "rank life"; gap: 40px;
}

.home-box {
    border: 4px solid black; border-radius: 30px; display: flex; flex-direction: column;
    justify-content: center; align-items: center; text-align: center; padding: 30px; cursor: pointer;
    box-shadow: 8px 8px 0px black; transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.home-box:hover { transform: translate(-3px, -3px); box-shadow: 12px 12px 0px black; }
.home-box:active { transform: translate(6px, 6px); box-shadow: 0px 0px 0px black; }
.home-box h3 { font-size: 58px; margin: 0 0 5px 0; line-height: 1; }
.card-subtitle { font-size: 26px; font-weight: bold; margin: 0; }

.box-rank { grid-area: rank; background-color: #ffd66b; min-height: 420px; }
.box-views { grid-area: support; background-color: #55c76c; }
.box-life { grid-area: life; background-color: #4dc3ff; }

/* 💎 Shop Multi-Step Design */
.shop-step { display: none; }
.shop-step.active { display: block; }
h2 { font-size: 32px; margin-bottom: 25px; color: white; text-align: center; text-shadow: 2px 2px 0px black; }

.grid-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 25px; }

.rank-card {
    background-color: white; border: 4px solid black; border-radius: 20px; padding: 25px;
    text-align: center; cursor: pointer; box-shadow: 6px 6px 0px black; transition: 0.1s;
}
.rank-card:hover { transform: translate(-3px, -3px); box-shadow: 10px 10px 0px black; }
.rank-card.selected { background-color: #ffd66b; transform: translate(4px, 4px) !important; box-shadow: 2px 2px 0px black !important; border-color: black; }

.badge { font-size: 24px; padding: 10px 20px; border-radius: 10px; display: inline-block; margin-bottom: 15px; border: 3px solid black; }
.rank-acacia { background-color: #e65100; color: #fff; }
.rank-azalea { background-color: #ec407a; color: #fff; }
.rank-jungle { background-color: #2e7d32; color: #fff; }

.price { font-size: 32px; font-weight: bold; margin-bottom: 10px; }

/* Buttons */
.btn-next, .btn-success, .btn-danger, .btn-secondary {
    padding: 15px 35px; font-size: 20px; border: 4px solid black; border-radius: 12px; cursor: pointer;
    box-shadow: 6px 6px 0px black; transition: 0.1s ease;
}
.btn-next:active, .btn-success:active, .btn-danger:active, .btn-secondary:active { transform: translate(6px, 6px); box-shadow: 0px 0px 0px black; }
.btn-next { background-color: #ffd66b; color: black; float: right; }
.btn-secondary { background-color: #c4c4c4; color: black; }
.btn-danger { background-color: #e53935; color: white; }
.btn-success { background-color: #55c76c; color: black; }

/* Forms & Checkout Cards */
.form-card, .checkout-card { background-color: white; border: 4px solid black; border-radius: 20px; padding: 30px; max-width: 600px; margin: 0 auto; box-shadow: 10px 10px 0px black; }
.form-group { margin-bottom: 20px; text-align: left; }
.form-group label { display: block; margin-bottom: 8px; font-size: 18px; font-weight: bold; color: black; }
.form-group input, .form-group select { width: 100%; padding: 15px; background-color: #f0f0f0; border: 3px solid black; border-radius: 10px; color: black; font-size: 16px; font-weight: bold; outline: none; transition: 0.1s; }
.form-group input:focus, .form-group select:focus { background-color: white; box-shadow: 6px 6px 0px #55c76c; transform: translate(-2px, -2px); }
.form-buttons { display: flex; justify-content: space-between; margin-top: 30px; }
.checkout-details p { padding: 15px 0; border-bottom: 3px dashed #c4c4c4; display: flex; justify-content: space-between; font-size: 18px; font-weight: bold; }
.text-highlight { color: #3b76a0; font-size: 20px; }


/* ========================================================
   KHQR Redesign ថ្មី (ដូចរូបភាព)
======================================================== */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.85); flex-direction: column; justify-content: center; align-items: center; }

.khqr-card-container { width: 90%; max-width: 360px; margin: auto; }

.khqr-real-card {
    background: #f8f9fa;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.khqr-header {
    background-color: #c91b2c; /* ពណ៌ក្រហម KHQR */
    padding: 15px;
    text-align: center;
    position: relative;
    border-bottom-right-radius: 20px;
}
.khqr-header h2 { font-family: Arial, sans-serif; color: white; margin: 0; letter-spacing: 2px; font-size: 26px; text-shadow: none; }
.corner-fold {
    position: absolute; right: 0; bottom: -20px; width: 0; height: 0;
    border-top: 20px solid #c91b2c; border-right: 20px solid transparent;
}

.khqr-body { padding: 25px 30px; text-align: left; }
.khqr-name { font-size: 16px; font-weight: bold; color: #444; letter-spacing: 1px; margin-bottom: 5px; font-family: Arial, sans-serif;}
.khqr-price { font-size: 38px; font-weight: bold; color: black; margin-bottom: 15px; font-family: Arial, sans-serif;}
.khqr-dashed { border: none; border-top: 2px dashed #ccc; margin-bottom: 20px; }

.qr-container { width: 100%; aspect-ratio: 1; background: white; padding: 10px; display: flex; justify-content: center; align-items: center; position: relative; border-radius: 8px;}
#qrcode-box { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; }
#qrcode-box img { max-width: 100%; max-height: 100%; }

.timeout-overlay { display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(255,255,255,0.95); border-radius: 10px; justify-content: center; align-items: center; flex-direction: column; padding: 10px; text-align: center;}
.timer-box { background-color: #ffd66b; border: 3px solid black; font-size: 16px; font-weight: bold; padding: 10px; border-radius: 10px; margin: 20px 0; text-align: center;}
.loading-status { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; font-weight: bold; }
.spinner { border: 4px solid #c4c4c4; border-top: 4px solid black; border-radius: 50%; width: 20px; height: 20px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }


/* Success Alert Modal */
.alert-modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.8); justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.alert-modal.active { opacity: 1; pointer-events: auto; }
.alert-content { background-color: white; border-radius: 20px; padding: 40px 30px; text-align: center; max-width: 400px; width: 85%; border: 4px solid black; box-shadow: 10px 10px 0px #55c76c; transform: scale(0.8); transition: 0.3s transform ease; }
.alert-modal.active .alert-content { transform: scale(1); }
.success-icon-box { display: flex; justify-content: center; margin-bottom: 20px; }
.checkmark-circle { width: 80px; height: 80px; border-radius: 50%; border: 5px solid #55c76c; display: block; position: relative; }
.checkmark { display: block; }
.checkmark.draw:after { animation-duration: 800ms; animation-timing-function: ease; animation-name: checkmark; transform: scaleX(-1) rotate(135deg); }
.checkmark:after { opacity: 1; height: 40px; width: 20px; transform-origin: left top; border-right: 5px solid #55c76c; border-top: 5px solid #55c76c; content: ''; left: 16px; top: 38px; position: absolute; }
@keyframes checkmark { 0% { height: 0; width: 0; opacity: 1; } 20% { height: 0; width: 20px; opacity: 1; } 40% { height: 40px; width: 20px; opacity: 1; } 100% { height: 40px; width: 20px; opacity: 1; } }

/* ========================================================
   Responsive សម្រាប់ឧបករណ៍គ្រប់ប្រភេទ
======================================================== */
@media (max-width: 1024px) {
    .container { max-width: 90%; }
    .nav-links { gap: 30px; }
    .home-box h3 { font-size: 48px; }
}

@media (max-width: 768px) {
    .navbar { flex-direction: column; padding: 15px; gap: 15px; }
    .nav-links { gap: 15px; flex-wrap: wrap; justify-content: center; }
    .nav-links a { font-size: 20px; }
    
    .home-boxes { grid-template-columns: 1fr; grid-template-areas: "rank" "support" "life"; gap: 20px; }
    .box-rank { min-height: 250px; }
    .welcome-text h1 { font-size: 28px; }
    
    .form-card, .checkout-card { padding: 20px; }
    .btn-next, .btn-success, .btn-danger, .btn-secondary { width: 100%; margin-top: 10px; text-align: center; }
    .form-buttons { flex-direction: column; }
                            }
                  
