  /* Overlay centers the modal vertically and horizontally */
  .custom-quiz-modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    padding: 24px;
    z-index: 1000;
  }

  /* Step progress bar */
  .hgq-progress { display:flex; align-items:center; gap:14px; padding: 6px 4px 14px; }
  .hgq-step { position:relative; display:flex; align-items:center; gap:14px; flex:1 1 auto; }
  .hgq-dot { width:26px; height:26px; border-radius:50%; display:flex; align-items:center; justify-content:center; border:2px solid #d1d5db; color:#6b7280; background:#fff; font-weight:700; font-family: Inter, system-ui; }
  .hgq-bar { height:6px; background:#e5e7eb; border-radius:4px; flex:1 1 auto; }
  .hgq-dot.done, .hgq-dot.active { border-color:#1C7C5C; color:#1C7C5C; }
  .hgq-bar.done { background:#74C2A0; }

  /* Prev/Next button styles */
  .custom-grey-button { background:#E5E7EB; color:#374151; border:none; padding:10px 16px; border-radius:8px; font-weight:600; }
  .custom-grey-button:disabled { opacity:.6; cursor:not-allowed; }

  /* Modal container */
  .custom-quiz-modal {
    width: min(800px, 95vw);
    max-height: 100vh; /* Prevent unnecessary overflow */
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* Header: full-bleed image with overlay close button */
  .custom-quiz-modal-header {
    position: relative;
    padding: 0;
    border-bottom: none;
    background: #000; /* fallback behind image */
  }

  .custom-quiz-modal-header-image {
    display: block;
    width: 100%;
    height: 140px; /* control header height */
    object-fit: cover; /* image spans entire header area */
  }

  .custom-quiz-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    border: none;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #000; /* default black */
    transition: color 0.2s ease;
    text-shadow: 0 1px 2px rgba(255,255,255,0.6); /* ensure contrast on dark areas */
    z-index: 2; /* ensure above image */
  }
  .custom-quiz-modal-close:hover {
    color: #fff; /* on hover should be white */
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  }

  /* Body grows with content but is capped to avoid overflow */
  .custom-quiz-modal-body {
    padding: 16px;
    overflow: auto;
    flex: 1 1 auto;
    max-height: 100vh; /* Safety cap in addition to modal's max-height */
  }

  .custom-quiz-container p {
    margin: 15px 0;
    font-size: 16px;
    line-height: 1.5;
    font-family: 'CircularStd-Medium';
    color: grey;
  }

  /* Options grid: for regular quiz questions */
  .custom-quiz-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
    margin-top: 8px;
  }

  /* Ensure each option has proper alignment */
  .custom-quiz-option {
    display: flex;
    align-items: flex-start; /* Align items to the top */
    gap: 8px;
  }

  
  /* For the custom survey, override the grid and flex layout */
  .student-details .custom-quiz-options,
  .working-professional-details .custom-quiz-options, .custom-quiz-subfields .custom-quiz-option {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 15px;
  }
  
  .student-details .custom-quiz-option,
  .working-professional-details .custom-quiz-option,
  .custom-quiz-subfields .custom-quiz-option {
    display: block;
    position: relative;
    margin: 0;
  }

  /* Keep radio buttons fixed in size and vertically aligned */
  .custom-hgq-radio {
    flex-shrink: 0; /* Prevent shrinking */
    width: 18px;
    height: 18px;
    margin-top: 2px; /* Align with first line of label */
    cursor: pointer;
  }
  /* Make sure label wraps cleanly without affecting radio size */
  .custom-hgq-radio-label {
    cursor: pointer;
    color: #737373;
    font-family: 'CircularStd-Book', sans-serif;
    line-height: 1.4;
    word-break: break-word;
  }
  
  .correct-answer {
    color: #4CA981 !important; /* Green color for correct answer */
    font-weight: 500;
  }
  
  .incorrect-answer {
    color: #ff5252 !important; /* Red color for incorrect answer */
    font-weight: 500;
  }

  /* Footer: Prev on left, Next on right */
  .custom-quiz-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
  }

  .custom-quiz-modal-footer-left,
  .custom-quiz-modal-footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .custom-quiz-modal-footer-left { flex: 1; }
  .custom-quiz-modal-footer-right { flex: 1; justify-content: flex-end; }
  /* Keep buttons inline; avoid stretching to full width */
  .custom-grey-button,
  .custom-green-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    width: auto;
    white-space: nowrap;
  }
  #custom-quiz-modal-prev-btn { display: none; }
  /* readonly state styles */
  .custom-quiz-container.readonly .custom-hgq-radio,
  .custom-quiz-container.readonly .custom-survey-radio,
  .custom-quiz-container.readonly .custom-survey-checkbox { pointer-events: none; }
  .custom-quiz-container.readonly label { opacity: 0.85; }

  .custom-quiz-modal-footer-left .result-text {
    color: #4CA981;
    font-weight: 500;
  }

  .custom-green-button {
    background: #4CA981;
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
  }

  .custom-green-button:disabled {
    background: #b8b8b8;
    cursor: not-allowed;
    opacity: 0.6;
    pointer-events: none;
  }

  /* Utility: hide template blocks by default; JS will clone and show */
  .custom-modal-question-template { display: none; }

  /* Candidate details block inside modal body */
  .custom-candidate-details-container {
    padding: 0; /* placeholder to avoid empty ruleset; detailed styles are applied conditionally */
  }

  /* Candidate details interstitial styles */
  .candidate-details {
    display: none; /* Hidden by default, shown only for interstitial step */
  }
  .candidate-details-container {
    padding: 8px 4px 20px 4px;
  }
  .candidate-details h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    font-family: 'CircularStd-Book';
  }
  .role-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
  }
  .role-pill-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }
  .role-pill {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    background: #ffffff;
    color: #333333;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
    font-family: 'CircularStd-Book';
  }
  .role-pill:hover { border-color: #bfbfbf; }
  .role-pill-input:checked + .role-pill,
  .role-pill.selected {
    background: #C0E8E5;
    color: #11998E;
    border-color: #C0E8E5;
  }
  .role-pill label {
    color: #737373
  }
  .skill-input-label {
    display: block;
    margin: 10px 0 6px 0;
    font-size: 14px;
    color: #555;
    font-family: 'CircularStd-Book';
  }
  .skill-input {
    width: 95%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    font-size: 14px;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
  }
  .skill-input:focus {
    border-color: #00aa8c;
    box-shadow: 0 0 0 3px rgba(0, 170, 140, 0.15);
  }
  
  /* Section heading style for survey categories */
  .survey-section-heading {
    font-size: 16px;
    font-weight: 500;
    color: #737373;
    margin: 10px 0 8px 0;
    font-family: 'CircularStd-Bold';
  }
  
  /* Custom Survey Styling for Student and Working Professional details */
  .student-details .custom-survey-checkbox,
  .student-details .custom-survey-radio,
  .working-professional-details .custom-survey-checkbox,
  .working-professional-details .custom-survey-radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    height: 0;
    width: 0;
    margin: 0;
  }
  
  .student-details .custom-quiz-option label,
  .working-professional-details .custom-quiz-option label {
    display: inline-block;
    padding: 5px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    background: #ffffff;
    color: #737373;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
    font-family: 'CircularStd-Book';
    box-sizing: border-box;
    text-align: center;
    white-space: nowrap;
    min-width: 80px;
  }
  
  .student-details .custom-quiz-option label:hover,
  .working-professional-details .custom-quiz-option label:hover {
    border-color: #bfbfbf;
  }
  
  .student-details .custom-survey-checkbox:checked + label,
  .student-details .custom-survey-radio:checked + label,
  .working-professional-details .custom-survey-checkbox:checked + label,
  .working-professional-details .custom-survey-radio:checked + label {
    background: #C0E8E5;
    color: #11998E;
    border-color: #C0E8E5;
  }
  
  /* Ensure consistent display for subfields */
  .custom-quiz-subfields {
    margin-top: 10px;
    /* margin-left: 15px; */
    width: 100%;
  }
  
  /* Specific style for text inputs in the survey */
  .custom-survey-text {
    width: 100%;
    padding: 8px 14px;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'CircularStd-Book';
    outline: none;
  }
  
  .custom-survey-text:focus {
    border-color: #4CA981;
    box-shadow: 0 0 0 3px rgba(76, 169, 129, 0.15);
  }

  .button-right {
    float: right;
    margin: 10px;
  }

  /* HabitGym v2 visual styles to match Figma */
  .habitgym-section { background:#F2FEFD; padding: 24px 0 28px; }
  .habitgym-section .habitgym-title { color:#0D967B !important; font-family: CircularStd-Bold, sans-serif; font-size:32px; line-height:38px; margin:0 0 6px; font-weight:700; }
  .habitgym-section .habitgym-subtitle { color:#5F6570 !important; font-size:17px; line-height:26px; margin:0 0 24px; font-family: Manrope, sans-serif; font-weight:400; }
  /* Grid and media sizing */
  .hg3-grid { display:grid; grid-template-columns: repeat(3, 1fr); gap:24px; }
  .hg3-media { width:100%; height:100px !important; min-height:100px !important; overflow:hidden; border-top-left-radius:8px; border-top-right-radius:8px; }
  .hg3-body { padding:22px 24px 20px; display:flex; flex-direction:column; }

  .hg3-card { border-radius:8px; background:#fff; border:2px solid #DADADA; box-shadow: 0px 16px 16px -8px rgba(12,12,13,0.10), 0px 4px 4px -4px rgba(12,12,13,0.05); overflow:hidden; display:flex; flex-direction:column; }
  .hg3-head { display:flex; align-items:center; gap:12px; margin-bottom:10px; }
  .hg3-head .hg3-txt h3 { color:#1C1C1C; font-family: CircularStd-Bold, sans-serif; font-size:20px; font-weight:600; line-height:24px; margin:0; }
  .hg3-head .hg3-txt span { color:#1E1E1E; font-family: Manrope, sans-serif; font-weight:500; font-size:15px; line-height:20px; }

  .hg3-body { gap:4px; flex:1; }
  .hg3-question p { color:#1E1E1E; font-family: Manrope, sans-serif; font-weight:500; font-size:15px; line-height:20px; margin: 0 0 8px; }
  .hg3-feedback { margin:10px 0 0; font-family: CircularStd-Medium, sans-serif; font-size:14px; }
  .hg3-options label { color:#1E1E1E; font-family: Manrope, sans-serif; font-weight:500; font-size:15px; line-height:20px; }
  /* Custom teal radios for quiz options (card view) */
  .hg3-ol input.hg3-radio{
    -webkit-appearance:none; appearance:none;
    width:18px; height:18px; border:2px solid #4CA981; border-radius:50%;
    background:#ffffff; display:inline-block; position:relative; margin-top:2px; cursor:pointer;
  }
  .hg3-ol input.hg3-radio:checked::after{
    content:""; position:absolute; top:50%; left:50%; width:8px; height:8px; background:#4CA981; border-radius:50%; transform:translate(-50%, -50%);
  }
  .hg3-ol input.hg3-radio:focus{ outline:none; box-shadow:0 0 0 3px rgba(76,169,129,0.15); }
  .hg3-ol li{ margin:8px 0; }
  .hg3-ol li label{ display:flex; align-items:center; gap:10px; color:#374151; font-family: Manrope, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; font-weight:600; font-size:16px; line-height:24px; }
  .hg3-ol { margin: 8px 0 12px; padding-left: 22px; }
  .hg3-ol li { margin: 6px 0; color:#111827; }
  .hg3-ol li label { color:#1E1E1E; font-family: Manrope, sans-serif; font-weight:500; font-size:15px; line-height:20px; }

  /* Buttons and badges */
  .hg3-btn { background:#4CA981 !important; color:#fff !important; border:none; border-radius:10px; font-weight:600; height:48px; padding:14px 32px; font-size:16px; display:inline-flex; align-items:center; justify-content:center; font-family: CircularStd-Medium, sans-serif; width:100%; margin-top:auto; text-decoration:none; box-sizing:border-box; }
  .habitgym-section .hg3-btn:hover{ opacity:.9; text-decoration:none; background:#4CA981 !important; color:#fff !important; }
  .habitgym-section a.hg3-btn, .habitgym-section a.hg3-btn:hover, .habitgym-section button.hg3-btn { text-decoration:none !important; color:#fff !important; background:#4CA981 !important; }
  .habitgym-section .hg3-icon { background:#4CA981 !important; border-radius:12px; width:40px !important; height:40px !important; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
  .habitgym-section .hg3-icon svg, .habitgym-section .hg3-icon img { width:22px; height:22px; color:#fff; }
  .hg3-icon-img { width:28px !important; height:28px !important; filter: brightness(0) invert(1); display:block; }
  .habitgym-section .hg3-body p { color:#6b7280; font-family:'CircularStd-Book', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; font-size:14px; }
  /* News typography */
  .hg3-news-title { color:#111827; font-family: CircularStd-Bold, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; font-size:16px; line-height:1.35; display:-webkit-box; -webkit-line-clamp:2; line-clamp:2; -webkit-box-orient: vertical; overflow:hidden; }
  .hg3-news-summary { color:#6b7280; font-family: CircularStd-Book, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; font-size:14px; line-height:1.5; display:-webkit-box; -webkit-line-clamp:3; line-clamp:3; -webkit-box-orient: vertical; overflow:hidden; }
  /* Quiz radios to match green accent and spacing */
  .hg3-ol { margin: 8px 0 12px;  }
  .hg3-ol li { margin: 6px 0; }
  .hg3-ol input[type="radio"]{ accent-color:#4CA981; }
  /* Responsive */
  @media (max-width: 992px){ .hg3-grid { grid-template-columns: repeat(2, 1fr); } }
  @media (max-width: 768px){ .hg3-grid { grid-template-columns: 1fr; } .habitgym-section .habitgym-title{ font-size:36px; line-height:48px; } .habitgym-section .habitgym-subtitle{ font-size:20px; line-height:30px; } }
