:root {
    --xnth-primary-color: #5d4037; /* Brown 700 */
    --xnth-primary-hover: #4e342e; /* Brown 800 */
    --xnth-background-color: #f5f5f5; /* Grey 100 */
    --xnth-container-bg: #ffffff;
    --xnth-text-color: #333;
    --xnth-light-text: #757575; /* Grey 600 */
    --xnth-border-color: #e0e0e0; /* Grey 300 */
    --xnth-font-family: 'Nunito', 'Helvetica', sans-serif;
    --xnth-accent-color: #8d6e63; /* Brown 300 */
}

.xnth-container {
    font-family: var(--xnth-font-family);
    max-width: 800px;
    margin: 30px auto;
    background: var(--xnth-container-bg);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 25px;
    overflow: hidden;
    color: var(--xnth-text-color);
    border: 1px solid var(--xnth-border-color);
}

/* --- Progress Bar Updated --- */
#xnth-progress-container {
    margin-bottom: 25px;
}
.xnth-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.xnth-progress-info {
    flex-grow: 1;
    text-align: center;
}
.xnth-step-name {
    font-weight: 800;
    color: var(--xnth-primary-color);
    font-size: 1.1em;
    margin-bottom: 2px;
}
.xnth-progress-steps {
    font-size: 0.9em;
    color: var(--xnth-light-text);
}
/* --- Feature Selection Box (Giao diện giống Hình 2) --- */

/* Khung viền bao quanh toàn bộ */
.xnth-feature-box {
    border: 1px solid #dcdcdc;
    border-radius: 4px;
    background-color: #fff;
    overflow: hidden; /* Để bo góc hoạt động tốt với header */
}

/* Phần Header cố định bên trên */
.xnth-feature-box-header {
    background-color: #f5f5f5; /* Màu xám nhẹ giống hình */
    padding: 10px 15px;
    border-bottom: 1px solid #dcdcdc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.xnth-box-title {
    font-weight: 700;
    color: #333;
    font-size: 14px;
}

/* Khu vực nút bấm bên phải */
.xnth-box-actions {
    font-size: 13px;
}

.xnth-box-actions span {
    cursor: pointer;
    color: #0073aa; /* Màu xanh WordPress */
    font-weight: 600;
    margin-left: 15px;
    user-select: none;
}

.xnth-box-actions span:hover {
    color: #005177;
    text-decoration: underline;
}

/* Phần danh sách có thanh cuộn */
.xnth-feature-box-list {
    padding: 15px;
    max-height: 180px; /* Chiều cao cố định, quá thì hiện thanh cuộn */
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 Cột */
    gap: 10px;
    background-color: #fff;
}

/* Style cho từng item checkbox */
.xnth-feature-checkbox-item {
    display: flex;
    align-items: center;
}

.xnth-feature-checkbox-item input {
    margin: 0 8px 0 0;
    cursor: pointer;
}

.xnth-feature-checkbox-item label {
    font-weight: 400 !important;
    font-size: 14px !important;
    cursor: pointer;
    color: #3c434a;
    width: 100%;
    margin: 0 !important;
}

.xnth-feature-checkbox-item:hover {
    background-color: #f0f8ff; /* Hiệu ứng hover nhẹ */
}

/* Tùy chỉnh thanh cuộn cho đẹp (Webkit browsers) */
.xnth-feature-box-list::-webkit-scrollbar {
    width: 6px;
}
.xnth-feature-box-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}
.xnth-feature-box-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}
.xnth-feature-box-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Mobile: Chuyển về 1 cột */
@media (max-width: 600px) {
    .xnth-feature-box-list {
        grid-template-columns: 1fr;
    }
    .xnth-feature-box-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    .xnth-box-actions span {
        margin-left: 0;
        margin-right: 15px;
        display: inline-block;
    }
}

.xnth-back-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--xnth-light-text);
}
.xnth-back-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.xnth-progress-steps, .xnth-progress-percent {
    font-weight: 700;
    color: var(--xnth-primary-color);
}
.xnth-progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--xnth-border-color);
    border-radius: 4px;
    overflow: hidden;
}
#xnth-progress-bar-inner {
    height: 100%;
    background-color: var(--xnth-primary-color);
    border-radius: 4px;
    transition: width 0.4s ease-in-out;
}

/* --- General Components --- */
.xnth-step { display: none; }
.xnth-step.active { display: block; animation: xnthFadeIn 0.5s; }
@keyframes xnthFadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.xnth-title {
    text-align: center;
    color: var(--xnth-primary-color);
    font-size: 1.8em;
    font-weight: 800;
    margin-bottom: 15px;
}
.xnth-intro { text-align: center; color: var(--xnth-light-text); margin-bottom: 25px; }

.xnth-btn {
    display: block;
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    transition: all 0.3s ease;
    margin-top: 20px;
}
.xnth-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.xnth-btn-primary { background-color: var(--xnth-primary-color); color: white; }
.xnth-btn-primary:hover { background-color: var(--xnth-primary-hover); }

.xnth-input-group { margin-bottom: 20px; }
.xnth-input-group label { display: block; margin-bottom: 8px; font-weight: 700; }
.xnth-input-group input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--xnth-border-color);
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 16px;
}

.xnth-loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--xnth-primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: xnth-spin 1s linear infinite;
    margin: 50px auto;
    grid-column: 1 / -1; /* Dòng code mới để căn giữa loader trong grid */
}
@keyframes xnth-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- Step Start --- */
.xnth-input-group label {
    text-align: center;
    font-size: 1.2em;
    color: var(--xnth-text-color);
}
.xnth-input-group small {
    display: block;
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 10px 15px;
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--xnth-light-text);
}

.xnth-gender-selection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
}
.xnth-gender-option {
    border: 2px solid var(--xnth-border-color);
    border-radius: 16px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    overflow: hidden; /* Quan trọng để bo góc cho phần text bên dưới */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0;
    position: relative; /* Để định vị dấu tick */
}
.xnth-gender-option img {
    height: 250px;
    padding: 5px 25px 5px 20px;
    object-fit: contain;
    align-self: center;
}
.xnth-gender-option span {
    display: block;
    width: 100%;
    padding: 12px;
    font-weight: 700;
    background-color: var(--xnth-border-color);
    color: var(--xnth-light-text);
    transition: all 0.3s ease;
}

/* --- Styling for Selected State --- */
.xnth-gender-option.selected {
    border: 3px solid var(--xnth-primary-color);
    background-color: #fff;
}
.xnth-gender-option.selected span {
    background-color: var(--xnth-primary-color);
    color: white;
}
.xnth-gender-option.selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background-color: var(--xnth-primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    animation: xnthFadeIn 0.3s;
}
/* --- Step Quiz --- */
.xnth-feature-title { font-size: 1.6em; text-align: center; margin-bottom: 5px; color: var(--xnth-primary-color); }
.xnth-feature-subtitle { font-size: 1em; text-align: center; color: var(--xnth-light-text); margin-bottom: 30px; }
.xnth-options-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}
.xnth-option-item {
    border: 2px solid var(--xnth-border-color);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 10px;
}
.xnth-option-image-wrapper { position: relative; }
.xnth-option-checkmark {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background-color: var(--xnth-primary-color);
    color: white;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}
.xnth-option-item.selected {
    border-color: var(--xnth-primary-color);
    background-color: #efebe9; /* Brown 50 */
}
.xnth-option-item.selected .xnth-option-checkmark { display: flex; }
.xnth-option-item img { width: 300px; height:350px; border-radius: 8px; }
.xnth-option-item p { margin-top: 10px; font-weight: 600; }
.xnth-quiz-nav {
    margin-top: 30px;
    display: flex;
    gap: 15px; /* Tạo khoảng cách giữa 2 nút */
}

.xnth-btn-secondary {
    background-color: #f0f0f0;
    color: var(--xnth-primary-color);
    border: 2px solid var(--xnth-border-color);
}

.xnth-btn-secondary:hover {
    background-color: var(--xnth-border-color);
    border-color: #ccc;
}


/* --- Step Result --- */
.xnth-result-container { padding: 10px; }
.xnth-result-title { text-align: center; color: var(--xnth-primary-color);font-weight: 700;}
.xnth-result-summary {
    background-color: #f5f5f5;
    padding: 20px;
    border-radius: 12px;
    text-align: justify;
    line-height: 1.7;
    border-left: 5px solid var(--xnth-accent-color);
}
.xnth-disclaimer {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px dashed var(--xnth-border-color);
    font-size: 12px;
    color: var(--xnth-light-text);
    text-align: justify;
}

/* --- Styling for Detailed Result Page --- */
.xnth-result-section {
    margin-bottom: 25px;
    border-bottom: 1px solid var(--xnth-border-color);
    padding-bottom: 20px;
}
.xnth-result-section:last-of-type {
    border-bottom: none;
}
.xnth-result-section h3 {
    font-size: 1.3em;
    color: var(--xnth-primary-color);
    margin-bottom: 15px;
    font-weight: 600;
}
.xnth-result-item {
    margin-bottom: 15px;
}
.xnth-result-item h4 {
    font-size: 1.1em;
    font-weight: 700;
    margin-bottom: 5px;
    padding-left: 10px;
    border-left: 3px solid var(--xnth-accent-color);
}
.xnth-result-item p {
    padding-left: 13px;
    text-align: justify;
    line-height: 1.7;
}

/* --- Mobile Optimization --- */
@media (max-width: 600px) {
    .xnth-container {
        padding: 15px;
    }

    .xnth-options-container {
        /* Chuyển layout thành 1 cột */
        grid-template-columns: 1fr;
    }
    
    /* Cho các lựa chọn giới tính to hơn trên mobile */
    .xnth-gender-selection {
        grid-template-columns: 1fr;
    }

    .xnth-title, .xnth-feature-title {
        font-size: 1.5em;
    }
}

/* --- Mole Selector Styling (NEW LAYOUT) --- */
.xnth-moles-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.xnth-moles-diagram {
    flex-basis: 100%; /* Mặc định cho mobile */
    text-align: center;
    border: 1px solid var(--xnth-border-color);
    border-radius: 12px;
    padding: 10px;
    align-self: flex-start;
}

#xnth-mole-face-diagram {
    max-width: 100%;
    height: auto;
}

.xnth-mole-number-list {
    flex-basis: 100%; /* Mặc định cho mobile */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    max-height: 612px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--xnth-border-color);
    border-radius: 12px;
}

/* Tùy chỉnh thanh cuộn cho đẹp hơn (tùy chọn) */
.xnth-mole-number-list::-webkit-scrollbar {
  width: 8px;
}
.xnth-mole-number-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}
.xnth-mole-number-list::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 10px;
}
.xnth-mole-number-list::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}


.xnth-mole-checkbox-item {
    display: block;
}

.xnth-mole-checkbox-item input {
    display: none;
}

.xnth-mole-checkbox-item label {
    display: block;
    padding: 12px 5px;
    text-align: center;
    border: 2px solid var(--xnth-border-color);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s ease;
}

.xnth-mole-checkbox-item label:hover {
    border-color: var(--xnth-accent-color);
}

.xnth-mole-checkbox-item input:checked + label {
    background-color: var(--xnth-primary-color);
    color: white;
    border-color: var(--xnth-primary-color);
}

/* ÁP DỤNG LAYOUT MỚI CHO DESKTOP */
@media (min-width: 768px) {
    .xnth-moles-layout {
        flex-direction: row;
        align-items: flex-start;
    }
    .xnth-moles-diagram {
        flex-basis: 70%; /* Ảnh chiếm 60% */
    }
    .xnth-mole-number-list {
        flex-basis: 30%; /* Danh sách chiếm 40% */
        /* Giới hạn số cột để các nút to hơn */
        grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
    }
}

/* Thêm vào cuối file style.css */
.xnth-btn .xnth-btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: xnth-spin 1s ease-in-out infinite;
    -webkit-animation: xnth-spin 1s ease-in-out infinite;
    margin-right: 8px;
    vertical-align: middle;
}

/* --- Styling for Fake Stats --- */
.xnth-stats-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.xnth-stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: #f0f2f5;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    color: #333;
    font-weight: 500;
}
.xnth-stat-item svg {
    color: #1877f2;
}
.xnth-stat-item .xnth-stars {
    color: #ffb900;
    font-size: 16px;
    line-height: 1;
}
.xnth-stat-item strong {
    font-weight: 700;
}

/* --- Styling for Loader with Text --- */
.xnth-loader-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 50px auto;
    color: var(--xnth-light-text);
    font-style: italic;
    font-weight: 600;
    grid-column: 1 / -1; /* Căn giữa trong grid layout */
}
.xnth-loader {
    margin: 0; /* Bỏ margin cũ của loader */
}

/* --- Skip Link Styling --- */
.xnth-skip-container {
    text-align: right; /* Căn phải */
    margin-top: 10px;
    margin-bottom: 5px;
    padding-right: 5px;
}

#xnth-skip-link {
    font-size: 14px;
    color: #888; /* Màu xám nhạt không gây chú ý */
    font-style: italic; /* In nghiêng */
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s;
}

#xnth-skip-link:hover {
    color: var(--xnth-primary-color); /* Đổi màu khi di chuột vào */
}

/* --- Styling for Guidance Section (NEW) --- */
.xnth-guidance-wrapper {
    text-align: right; /* Căn phải nút bấm */
    margin-top: -10px; /* Kéo lên gần tiêu đề hơn */
    margin-bottom: 15px;
}

.xnth-guidance-toggle {
    text-decoration: none;
    font-size: 14px;
    font-style: italic;
    font-weight: 600;
    cursor: pointer;
    display: inline-block;
    padding: 5px 10px;
    border-radius: 20px;
    background-color: #f0f8ff;
    transition: all 0.3s;
}

.xnth-guidance-toggle:hover {
    background-color: #e0f0ff;
    transform: translateY(-1px);
}

.xnth-guidance-content {
    background-color: #f9f9f9;
    border-left: 4px solid var(--xnth-accent-color, #8d6e63);
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    text-align: justify; /* Căn đều chữ cho đẹp */
}

.xnth-guidance-content h4 {
    margin-top: 0;
    color: var(--xnth-primary-color, #5d4037);
    font-weight: 700;
}

.xnth-guidance-content p {
    font-size: 15px;
    line-height: 1.6;
    color: #555;
}

.xnth-guidance-content p:last-child {
    margin-bottom: 0;
}

/* --- Disclaimer Block ở màn hình Start --- */
.xnth-start-disclaimer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee; /* Đường kẻ mờ phân cách */
    text-align: center;
}

.xnth-start-disclaimer p {
    font-size: 13px;
    color: #888; /* Màu xám nhạt */
    line-height: 1.5;
    margin: 0;
    font-style: italic;
    text-align: justify;
}

.xnth-start-disclaimer strong {
    color: #555; /* Màu đậm hơn cho tiêu đề */
    font-style: normal;
}