/* ====== Base Layout ====== */
body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #fafafa;
  color: #222;
}

a {
  text-decoration: none;
  color: inherit;
}

.container {
  max-width: 900px;
  margin: auto;
  padding: 20px;
}

/* ====== Header ====== */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  color: white;
  padding: 10px 20px;
}

.site-header .brand {
  display: flex;
  align-items: center;
}

.site-header .brand-logo {
  height: 48px !important;
  width: auto;
  margin-right: 12px;
}

.site-header nav a {
  color: black;
  margin-left: 20px;
  font-weight: 500;
}

/* ====== Flash Messages ====== */
.flash {
  padding: 10px 15px;
  margin: 10px 0;
  border-radius: 4px;
  font-size: 0.95rem;
}

.flash.success { background: #e0f7e9; color: #075e28; }
.flash.error   { background: #fdecea; color: #a12622; }
.flash.info    { background: #eaf4fd; color: #1a4d8f; }

/* ====== Quiz Page ====== */
.q {
  padding: 10px 0;
  margin-top: 0;   /* kill extra space above questions */
}

.q hr {
  border: 0;
  border-top: 1px solid #e6e6e6; /* subtle divider */
  margin: 12px 0 0;              /* only small gap above */
}

.q > p {
  margin: 0 0 0.6rem;
  font-size: 1rem;
}

.q > p strong {
  font-weight: 600;
}

/* Options styling */
.options-inline {
  margin-bottom: 0.4rem;  /* less gap below options */
}

.options-inline label {
  display: inline-flex;
  align-items: center;
  margin-right: 1.2rem;
  margin-bottom: 0;       /* kill bottom margin */
  font-size: 0.95rem;
}

.options-inline input[type="radio"] {
  margin: 0 0.25rem 0 0;
}

/* Info block (non-question pages) */
.info-block img {
  max-width: 100%;
  height: auto;
  margin: .4rem 0;
  display: block;
}

.info-block p {
  margin: .4rem 0;
  font-style: italic;
}

.muted {
  color: #777;
  font-size: 0.9rem;
}

/* ====== Buttons ====== */
button, .btn {
  background: #111;
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 0.95rem;
  cursor: pointer;
}

button:hover, .btn:hover {
  background: #333;
}

.btn.secondary {
  background: #555;
}

.btn.secondary:hover {
  background: #333;
}

/* ====== Tables (Leaderboards, Admin Pages) ====== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0;
}

table th, table td {
  border: 1px solid #ddd;
  padding: 8px 10px;
  text-align: left;
}

table th {
  background: #f4f4f4;
  font-weight: 600;
}

/* ====== Responsive ====== */
@media (max-width: 600px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .site-header nav {
    margin-top: 10px;
  }
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 0rem;
}

.module-card {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 18px;
  background: #fff;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.module-card h3 {
  margin-top: 0.1rem;   /* reduce top space */
  margin-bottom: 1rem; /* optional, keeps it compact */
}

.q-required-failed {
  border: 2px solid red;
  background: #ffe6e6;
  padding: 0.5rem;
}

/* small avatar */
.avatar-sm { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }

/* row highlight */
.table.compact tr.behind { background: #fff6f6; }            /* soft red */
.table.compact tr.behind td { border-top: 1px solid #f3d1d1; }

/* tiny “Behind” pill */
.badge-late {
  margin-left: .4rem;
  font-size: .75rem;
  background: #ffe3e3;
  color: #a40000;
  padding: .1rem .4rem;
  border-radius: .5rem;
  vertical-align: middle;
}

.top-rank {
  background: #fff7d1;      /* soft gold */
  font-weight: 600;
  border-radius: 4px;
}

.q textarea { min-height: 120px; width: 100%; }

.options {
  display: grid;
  grid-template-columns: 1fr;           /* 1 column on phones */
  gap: .5rem .75rem;
  margin: .5rem 0 0.25rem;
}

@media (min-width: 640px) {
  .options { grid-template-columns: repeat(2, minmax(0, 1fr)); } /* 2 columns on wider screens */
}

.option {
  display: inline-flex;                 /* keep input + text together */
  align-items: flex-start;              /* align to top for multi-line text */
  gap: .5rem;
  padding: .5rem .6rem;
  border: 1px solid #e5e7eb;
  border-radius: .5rem;
  line-height: 1.3;
  cursor: pointer;                      /* bigger tap target */
}

.option input {
  margin-top: .15rem;                   /* optical align with first line of text */
  flex: 0 0 auto;
}

.option span {
  flex: 1 1 auto;                       /* text wraps inside the card */
  word-break: break-word;
}

/* focus/hover for accessibility */
.option:hover { background: #fafafa; }
.option:has(input:focus-visible) { outline: 2px solid #000; outline-offset: 2px; }