/* Biến CSS nội bộ */
.hw-neo-wrapper {
    --bg-white: #ffffff;
    --border-ink: 3px solid #111111;
    --shadow-solid: 5px 5px 0px #111111;
    --shadow-push: 2px 2px 0px #111111;
    
    /* Palette Sinh Thái & Tiến Hóa */
    --clr-earth: #f4a261;      /* Cam đất */
    --clr-leaf: #e9edc9;       /* Xanh rêu nhạt */
    --clr-leaf-dark: #ccd5ae;  /* Xanh rêu đậm */
    --clr-dom: #ffb5a7;        /* Hồng trội */
    --clr-het: #fefae0;        /* Vàng dị hợp */
    --clr-rec: #bde0fe;        /* Xanh lặn */
    --clr-success: #a7f3d0;    /* Xanh đạt cân bằng */
    --clr-danger: #ff99c8;     /* Đỏ/Hồng chưa cân bằng */

    max-width: 800px;
    margin: 0 auto;
    font-family: system-ui, -apple-system, sans-serif;
    color: #111111;
    background: #fafafa;
    padding: 20px;
    border: var(--border-ink);
    border-radius: 16px;
    box-shadow: 8px 8px 0px #111;
}

.hw-neo-wrapper * { box-sizing: border-box; }

/* Header */
.hw-neo-header { background: var(--clr-earth); border: var(--border-ink); box-shadow: var(--shadow-solid); padding: 20px; border-radius: 12px; text-align: center; margin-bottom: 25px; }
.hw-neo-header h2 { margin: 0 0 10px 0; font-size: 1.8rem; font-weight: 900; }
.hw-neo-header p { margin: 0; font-weight: 600; font-size: 0.95rem; }

/* Tabs Chế độ */
.hw-mode-toggle { display: flex; gap: 15px; margin-bottom: 20px; }
.radio-mode { flex: 1; cursor: pointer; }
.radio-mode input { display: none; }
.radio-mode .neo-content { display: block; text-align: center; padding: 14px; font-weight: 800; border: var(--border-ink); border-radius: 12px; background: var(--bg-white); box-shadow: 4px 4px 0px #111; transition: all 0.15s; }
.radio-mode input:checked + .neo-content { background: var(--clr-leaf-dark); box-shadow: var(--shadow-push); transform: translate(2px, 2px); }

/* Form Styles */
.hw-neo-form { display: flex; flex-direction: column; gap: 15px; }
.hw-group { display: flex; flex-direction: column; gap: 10px; }
.hw-group label { font-weight: 800; font-size: 1.05rem; }
.hw-helper { font-size: 0.85rem; font-weight: 600; color: #444; background: #e9ecef; padding: 10px; border-radius: 8px; border: 2px dashed #111;}

/* Gộp Select và Input */
.input-with-select { display: flex; flex-direction: column; border: var(--border-ink); border-radius: 12px; box-shadow: 4px 4px 0px #111; background: #fff; overflow: hidden; }
.input-with-select select { border: none; border-bottom: 2px solid #111; padding: 14px; font-weight: 800; background: #f8f9fa; outline: none; cursor: pointer; font-size: 1rem;}
.input-with-select input { border: none; padding: 15px; font-size: 1.3rem; font-weight: 900; outline: none; text-align: center; }
.input-with-select input:focus { background: var(--clr-leaf); }

/* Grid cho chế độ 2 */
.hw-inputs-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; }
.hw-sub-group { display: flex; flex-direction: column; gap: 5px; }
.hw-sub-group label { font-size: 0.9rem; text-align: center; }
.hw-sub-group input { width: 100%; padding: 12px; font-size: 1.2rem; font-weight: 800; text-align: center; border: var(--border-ink); border-radius: 8px; box-shadow: 3px 3px 0px #111; outline: none; transition: all 0.2s;}
.hw-sub-group input:focus { box-shadow: var(--shadow-solid); background: var(--clr-leaf); }

.hw-error-alert { background: #ff4d4d; color: #fff; border: var(--border-ink); padding: 12px; border-radius: 8px; font-weight: 700; text-align: center; }

/* Button */
.hw-neo-btn { padding: 18px; font-size: 1.2rem; font-weight: 900; background: #111; color: #fff; border: var(--border-ink); border-radius: 12px; box-shadow: 5px 5px 0px var(--clr-earth); cursor: pointer; text-transform: uppercase; margin-top: 10px; transition: all 0.1s; }
.hw-neo-btn:active { box-shadow: 2px 2px 0px var(--clr-earth); transform: translate(3px, 3px); }

/* Result Layout */
.hw-neo-result { margin-top: 30px; padding-top: 30px; border-top: 4px dashed #111; }
.hw-neo-result.active { display: block !important; animation: hwPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }

/* Trạng thái */
.hw-status-box { border: var(--border-ink); box-shadow: var(--shadow-solid); border-radius: 12px; padding: 15px 20px; text-align: center; margin-bottom: 25px; }
.hw-status-box h3 { margin: 0 0 5px 0; font-size: 1.3rem; }
.hw-status-box p { margin: 0; font-weight: 600; font-size: 0.95rem; }

/* Tần số Alen */
.hw-card-group { margin-bottom: 25px; }
.card-allele { background: #fff; border: var(--border-ink); box-shadow: var(--shadow-solid); border-radius: 12px; padding: 20px; text-align: center; }
.card-allele h4 { margin: 0 0 15px 0; font-size: 1.1rem; border-bottom: 2px solid #111; padding-bottom: 10px;}
.allele-grid { display: flex; gap: 20px; justify-content: center; }
.allele-item { display: flex; flex-direction: column; background: #f8f9fa; border: 2px dashed #111; border-radius: 8px; padding: 10px 20px; min-width: 150px;}
.a-label { font-size: 0.9rem; font-weight: 700; color: #555; margin-bottom: 5px; }
.a-val { font-size: 1.8rem; font-weight: 900; }

/* Cấu trúc Kiểu Gen */
.result-heading { text-align: center; font-size: 1.2rem; margin-bottom: 15px; }
.hw-genotype-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; }
.geno-card { border: 3px solid #111; border-radius: 12px; padding: 20px 10px; display: flex; flex-direction: column; align-items: center; box-shadow: 4px 4px 0px #111; position: relative; text-align: center;}
.geno-aa { background: var(--clr-dom); }
.geno-Aa { background: var(--clr-het); }
.geno-aa-rec { background: var(--clr-rec); }

.g-badge { position: absolute; top: -15px; background: #111; color: #fff; padding: 4px 15px; border-radius: 20px; font-weight: 900; font-size: 1.1rem; border: 2px solid #111; }
.g-name { margin-top: 10px; font-size: 0.85rem; font-weight: 700; color: #444; text-transform: uppercase; margin-bottom: 5px;}
.g-val { font-size: 1.5rem; font-weight: 900; }
.g-percent { font-size: 1rem; font-weight: 800; background: rgba(255,255,255,0.6); padding: 2px 10px; border-radius: 6px; margin-top: 5px; border: 1px solid #111;}

@keyframes hwPop { 0% { opacity: 0; transform: translateY(20px); } 100% { opacity: 1; transform: translateY(0); } }

@media (max-width: 650px) {
    .hw-inputs-grid { grid-template-columns: 1fr; }
    .hw-genotype-grid { grid-template-columns: 1fr; gap: 25px; }
    .allele-grid { flex-direction: column; }
}