html, body, input, button, textarea, select, option {
  font-family: "Times New Roman", Times, serif !important;
}

*, *::before, *::after {
  font-family: inherit;
}

/* =========================
   1. Base / Layout
   ========================= */
html,
body {
  margin: 0;
  padding: 0;
  background: #f6f8fb;
  color: #111;
  font-size: 16px;
  line-height: 1.6;
  height: 100%;
  overflow: hidden;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
}

/* =========================
   2. Cards
   Consent / Instruction / Comprehension
   ========================= */
#consent,
#instruction,
#comprehension {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(24, 32, 56, 0.12);
  padding: 28px;
  height: 88vh;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  scrollbar-gutter: auto;
}

/* =========================
   3. Headings / Text / HR
   ========================= */
h2 {
  margin: 0;
  font-size: 24px;
}

h4 {
  margin: 0 0 10px;
  font-size: 18px;
}

h5 {
  margin: 16px 0 4px;
  font-size: 16px;
}

hr {
  border: 0;
  border-top: 1px solid #e5e7eb;
  margin: 16px 0;
}

.block-text {
  margin: 0;
}

ol,
ul {
  margin: 6px 0;
  padding-left: 2em;
}

/* =========================
   4. Scroll Areas
   ========================= */
#consent .legal,
#instruction .legal,
#comprehension .legal {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  background: #fafafa;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0) transparent;
  -ms-overflow-style: auto;
}

#consent .legal {
  flex: 1.15 1 auto;
}

#consent .legal > h5:first-child {
  margin-top: 0;
}

#consent .legal p.block-text + p.block-text {
  margin-top: 1em;
}

#consent .legal::-webkit-scrollbar,
#instruction .legal::-webkit-scrollbar,
#comprehension .legal::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

#consent .legal::-webkit-scrollbar-track,
#instruction .legal::-webkit-scrollbar-track,
#comprehension .legal::-webkit-scrollbar-track {
  background: transparent;
}

#consent .legal::-webkit-scrollbar-thumb,
#instruction .legal::-webkit-scrollbar-thumb,
#comprehension .legal::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0);
  border-radius: 999px;
  transition: background-color 0.18s;
}

#consent .legal:hover::-webkit-scrollbar-thumb,
#instruction .legal:hover::-webkit-scrollbar-thumb,
#comprehension .legal:hover::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
}

#consent .legal:hover,
#instruction .legal:hover,
#comprehension .legal:hover {
  scrollbar-color: rgba(0, 0, 0, 0.18) transparent;
}

/* =========================
   5. Actions / Buttons / Notes
   ========================= */
.actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 18px;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  background: #002147;
  color: #fff;
}

.btn-primary:hover {
  background: #001a38;
}

.btn-danger {
  background: #b64235;
  color: #fff;
}

.btn-danger:hover {
  background: #a5392d;
}

.actions .btn {
  width: 220px;
  white-space: nowrap;
  text-align: center;
}

.note {
  color: #64748b;
  font-size: 13px;
  text-align: center;
  margin-top: 8px;
}

/* =========================
   6. Consent Page
   ========================= */
#consent .study-meta {
  text-align: center;
  margin-bottom: 14px;
}

#consent .study-meta .block-text + .block-text {
  margin-top: 10px;
}

#consent .consent-lower {
  flex: 0 0 auto;
  margin-top: 12px;
}

#consent .consent-lower h5 {
  margin: 8px 0 2px;
}

#consent .consent-lower h5:first-child {
  margin-top: 0;
}

#consent .consent-lower > p.block-text {
  margin: 0 0 8px;
}

.participant-id-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 16px;
}

#consent .consent-lower .participant-id-row {
  margin: 6px 0 8px;
}

.participant-id-inputs {
  display: grid;
  grid-template-rows: auto auto;
  gap: 6px;
}

#participantId {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.3;
  min-height: 40px;
  outline: none;
  background: #fff;
  box-sizing: border-box;
}

#participantId:focus {
  border-color: #002147;
  box-shadow: 0 0 0 3px rgba(0, 33, 71, 0.16);
}

#participantId.input-error {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.16);
  color: #dc2626;
}

#participantId.input-error::placeholder {
  color: #dc2626;
  opacity: 1;
}

.consent-summary {
  margin: 10px 0;
  padding: 10px 16px;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  background: #fafbfc;
}

#consent .consent-summary p.block-text {
  margin: 0 0 6px;
}

#consent .consent-summary p.block-text:last-child {
  margin-bottom: 0;
}

#consent .consent-summary label {
  display: grid;
  grid-template-columns: 24px 1fr;
  column-gap: 10px;
  align-items: center;
  cursor: pointer;
}

#consent .consent-summary input[type='checkbox'] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  justify-self: center;
  align-self: center;
  border: 1.5px solid #94a3b8;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  position: relative;
  box-sizing: border-box;
}

#consent .consent-summary input[type='checkbox']:hover {
  border-color: #002147;
}

#consent .consent-summary input[type='checkbox']:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 33, 71, 0.16);
}

#consent .consent-summary input[type='checkbox']:checked {
  background: #002147;
  border-color: #002147;
}

#consent .consent-summary input[type='checkbox']:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

#consent .actions {
  margin-top: 10px;
}

/* =========================
   7. Glossary Inline
   Instruction page
   ========================= */
.glossary-inline {
  margin-top: 12px;
  display: block;
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px 10px;
  align-items: stretch;
}

.glossary-tile {
  background: #fafbfc;
  border: 1px solid #e8edf3;
  border-radius: 10px;
  padding: 10px;
  box-shadow: none;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.glossary-tile .alien {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.2px;
  margin-bottom: 3px;
  color: #0f1724;
}

.glossary-tile .english {
  font-size: 14px;
  color: #3f5168;
  line-height: 1.2;
  word-break: break-word;
}

/* =========================
   8. Comprehension Page
   ========================= */
#comprehension .group {
  margin: 18px 0;
  padding: 0;
  display: block;
}

#comprehension .q-title {
  font-weight: 700;
  margin-bottom: 10px;
  font-size: 16px;
  color: #0f1724;
}

#comprehension .choices.vertical {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

#comprehension label.chip.v {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e6edf7;
  background: #fff;
  transition: transform 0.06s ease, box-shadow 0.08s ease,
    border-color 0.12s;
}

#comprehension label.chip.v input[type='radio'] {
  margin: 0;
  width: 18px;
  height: 18px;
  accent-color: #002147;
  appearance: auto;
}

#comprehension label.chip.v span {
  display: block;
  color: #0f1724;
  line-height: 1.2;
}

#comprehension label.chip.v:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(24, 32, 56, 0.06);
  border-color: #dbeafe;
}

#comprehension .msg {
  margin-top: 8px;
  text-align: left;
  color: #64748b;
  font-size: 14px;
}

#comprehension .msg.error {
  color: #dc2626;
  font-weight: 700;
}

/* =========================
   9. Accessibility Helpers
   ========================= */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* =========================
   10. Responsive Tweaks
   ========================= */
@media (max-width: 520px) {
  .glossary-grid {
    grid-template-columns: 1fr;
  }

  .actions .btn {
    width: 160px;
  }

  #comprehension label.chip.v {
    padding: 12px;
  }
}
