/* Biến nội bộ */
.microscope-neo-wrapper {
    --bg-white: #ffffff;
    --border-ink: 3px solid #111111;
    --shadow-solid: 5px 5px 0px #111111;
    --shadow-push: 2px 2px 0px #111111;
    
    /* Bảng màu Kính hiển vi */
    --clr-teal: #06d6a0;     /* Xanh mòng két */
    --clr-blue: #118ab2;     /* Xanh dương */
    --clr-yellow: #ffd166;   /* Vàng nổi bật */
    --clr-pink: #ef476f;     /* Đỏ hồng */
    --clr-bg: #f8f9fa;

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

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

/* Header */
.microscope-neo-header { background: var(--clr-teal); border: var(--border-ink); box-shadow: var(--shadow-solid); padding: 20px; border-radius: 12px; text-align: center; margin-bottom: 25px; }
.microscope-neo-header h2 { margin: 0 0 10px 0; font-size: 1.8rem; font-weight: 900; text-transform: uppercase; color: #111;}
.microscope-neo-header p { margin: 0; font-weight: 800; font-size: 0.95rem; color: #111; }

/* Tabs Chế độ */
.microscope-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: 900; border: var(--border-ink); border-radius: 12px; background: var(--bg-white); box-shadow: 4px 4px 0px #111; transition: all 0.15s; color: #111;}
.radio-mode input:checked + .neo-content { background: #111; color: #fff; box-shadow: var(--shadow-push); transform: translate(2px, 2px); }

/* Form Styles */
.microscope-neo-form { display: flex; flex-direction: column; gap: 20px; }
.microscope-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.microscope-group { display: flex; flex-direction: column; gap: 10px; }
.microscope-group label { font-weight: 900; font-size: 1.05rem; color: #111; }

/* Các ô Input */
.microscope-neo-wrapper input[type="number"] { width: 100%; padding: 14px; font-size: 1.2rem; font-weight: 900; border: var(--border-ink); border-radius: 12px; background: var(--bg-white); box-shadow: 4px 4px 0px #111; outline: none; transition: all 0.2s; color: #111;}
.microscope-neo-wrapper input[type="number"]:focus { box-shadow: var(--shadow-solid); background: #e0fbfc; }

/* Gộp Input & Select (Đơn vị) - Đã fix lỗi bị nhỏ/khuất chữ */
.input-with-select { 
    display: flex; 
    align-items: stretch; /* Ép 2 ô cao bằng nhau */
    border: var(--border-ink); 
    border-radius: 12px; 
    box-shadow: 4px 4px 0px #111; 
    background: #fff; 
    overflow: hidden; 
    width: 100%;
}

.input-with-select input { 
    border: none !important; 
    border-radius: 0 !important; 
    box-shadow: none !important; 
    flex: 1 1 65%; /* Ép input luôn chiếm 65% chiều rộng */
    min-width: 0;  /* Ngăn lỗi tràn viền trên mobile */
    padding: 16px 15px !important; /* Tăng khoảng không gian bên trong */
    font-size: 1.3rem !important;  /* Chữ to rõ ràng */
    color: #111;
}

.input-with-select select { 
    border: none; 
    border-left: 3px solid #111; 
    padding: 0 15px; 
    font-weight: 900; 
    font-size: 1.1rem; 
    background: #e9ecef; 
    outline: none; 
    cursor: pointer; 
    color: #111; 
    flex: 0 0 auto; /* Đảm bảo ô select không bóp méo ô input */
    text-align: center;
}

.input-with-select input:focus, 
.input-with-select select:focus { 
    background: #e0fbfc; 
}

/* Thẻ Quick Tags */
.input-with-quick { display: flex; flex-direction: column; gap: 10px; }
.quick-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.q-tag { padding: 4px 12px; border: 2px solid #111; border-radius: 20px; font-size: 0.85rem; font-weight: 800; cursor: pointer; background: #fff; box-shadow: 2px 2px 0px #111; color: #111; transition: transform 0.1s;}
.q-tag:hover { background: var(--clr-yellow); }
.q-tag:active { box-shadow: 0px 0px 0px #111; transform: translate(2px,2px); }

/* Helper Text (Chữ đen đậm) */
.microscope-helper-black { font-size: 0.95rem; font-weight: 800; color: #111; background: var(--clr-yellow); padding: 12px 15px; border-radius: 8px; border: 2px dashed #111; line-height: 1.5; }

.microscope-error-alert { background: var(--clr-pink); color: #fff; border: var(--border-ink); padding: 12px; border-radius: 8px; font-weight: 800; text-align: center; }

/* Button */
.microscope-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-teal); cursor: pointer; text-transform: uppercase; transition: all 0.1s; margin-top: 5px;}
.microscope-neo-btn:active { box-shadow: 2px 2px 0px var(--clr-teal); transform: translate(3px, 3px); }

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

.microscope-card { background: #fff; border: var(--border-ink); box-shadow: var(--shadow-solid); border-radius: 12px; padding: 30px 20px; text-align: center; display: flex; flex-direction: column; align-items: center;}
.microscope-card h3 { margin: 0 0 15px 0; font-size: 1.3rem; color: #111; font-weight: 900; text-transform: uppercase; border-bottom: 3px solid #111; padding-bottom: 10px;}

.val-text { font-size: 4rem; font-weight: 900; color: #111; line-height: 1; margin-bottom: 10px;}
.val-text small { font-size: 1.8rem; font-weight: 900; }
.val-desc { margin: 0; font-size: 1.05rem; font-weight: 800; color: #111; }

/* Box Quy đổi Đơn vị (Chỉ hiện khi tính kích thước) */
.conversion-box { width: 100%; margin-top: 20px; background: #e9ecef; border: 2px dashed #111; border-radius: 8px; padding: 15px; text-align: left;}
.conversion-box h4 { margin: 0 0 10px 0; font-size: 1rem; color: #111; font-weight: 900;}
.conversion-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px;}
.conversion-list li { display: flex; justify-content: space-between; border-bottom: 2px solid #ccc; padding-bottom: 5px;}
.conversion-list li:last-child { border-bottom: none; padding-bottom: 0;}
.c-label { font-weight: 800; color: #111; }
.c-val { font-weight: 900; font-size: 1.1rem; color: #111; }

/* Ghi chú Y sinh */
.microscope-note-black { background: #fff; border: 3px solid #111; border-radius: 8px; padding: 15px; font-size: 0.95rem; font-weight: 800; color: #111; line-height: 1.6; text-align: left;}
.microscope-note-black strong { color: var(--clr-blue); font-weight: 900; text-transform: uppercase;}

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

@media (max-width: 600px) {
    .microscope-form-grid { grid-template-columns: 1fr; }
}