/* ── Colours ────────────────────────────────────────────────────────────────── */

:root {
  --black:           #1a1a1a;
  --checked-purple-grey:     #766a77;
  --text-white:     #efe5f0;
  --color-bg-fallback:    #fbebc4;
  --dusty-purple:         #4a3f52;
  --tsinghua-original-purple:  #7b2d8b;
  --tsinghua-purple-hover:   #5d2269;
  --color-border:         #e0e0e0;
  --color-error:          #c0392b;
  --white:          #fff;
}

/* ── Reset & base ──────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Times New Roman', Times, serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--black);

  /* Tiled background */
  background-image: url('../images/Tsinghua_Tan_Purity_Background.png');
  background-repeat: repeat;
  background-size: 225px; /* adjust to scale the background repeated tile */
  background-color: var(--color-bg-fallback); /* fallback while image loads */
}

/* ── Layout ────────────────────────────────────────────────────────────────── */

/* Single centred column that stays readable on both desktop and mobile */
header,
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
}

/* ── Header ────────────────────────────────────────────────────────────────── */

header img {
  width: 100%;
  height: 225px;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* ── Tooltip ───────────────────────────────────────────────────────────────── */

.tooltip {
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: help;
  position: relative;
  color: var(--dusty-purple);
}

.tooltip-box {
  display: none;
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--dusty-purple);
  color: var(--white);
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  white-space: nowrap;
  z-index: 10;
}

.tooltip:hover .tooltip-box {
  display: block;
}

.description {
  text-align: center;
  font-style: italic;
}

.warning {
  text-align: center;
  font-weight: bold;
  margin-top: 1rem;
}

.instructions {
  text-align: center;
  margin-top: 1rem;
}

/* ── Question list ─────────────────────────────────────────────────────────── */

#question-list {
  list-style: none;         /* numbers come from the id in the data, not CSS */
  padding: 0;
  margin-bottom: 1.5rem;
}

/* 44px min-height satisfies Apple's tap-target guideline on mobile */
#question-list label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  padding: 0.25rem 0;
  cursor: pointer;
}

#question-list input[type="checkbox"] {
  /* Prevent the checkbox from shrinking on small screens */
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--tsinghua-original-purple);
  cursor: pointer;
}

#question-list input[type="checkbox"]:checked + span {
  color: var(--checked-purple-grey);
}

.error {
  color: var(--color-error);
}

/* ── Submit button ─────────────────────────────────────────────────────────── */

#submit-btn {
  display: block;
  width: auto;
  padding: 0.85rem 2rem;
  margin: 0 auto;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-white);
  background: var(--tsinghua-original-purple);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 1.5rem;
}

#submit-btn:hover {
  background: var(--tsinghua-purple-hover);
}

/* ── Inline links ───────────────────────────────────────────────────────────── */

.confession-link {
  color: var(--dusty-purple);
}

/* ── Footer ────────────────────────────────────────────────────────────────── */

footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--checked-purple-grey);
}

footer a {
  color: var(--checked-purple-grey);
}

/* ── Score page ─────────────────────────────────────────────────────────────── */

#score-panel {
  text-align: center;
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
}

#score-value {
  color: var(--color-error);
}

#score-message {
  font-size: 1.15rem;
  padding: 0.85rem 2rem;
  color: var(--checked-purple-grey);
}

#retake-btn {
  display: block;
  width: fit-content;
  padding: 0.85rem 2rem;
  margin: 0 auto 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-white);
  background: var(--tsinghua-original-purple);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

#retake-btn:hover {
  background: var(--tsinghua-purple-hover);
}
