/* Devquo — devquo.com styles (matches the devquo.games look) */

:root {
  --blue: #1f6feb;
  --blue-deep: #0f4bb3;
  --blue-hover: #3a82f2;
  --accent: #7cc8ff;
  --ink: #ffffff;
  --ink-soft: rgba(255, 255, 255, 0.78);
  --ink-muted: rgba(255, 255, 255, 0.56);
  --line: rgba(255, 255, 255, 0.16);
  --field: rgba(var(--shade-rgb), 0.45);
  --danger: #ff7a7a;
  --success: #5fe0a1;
  --blue-rgb: 31, 111, 235;
  --accent-rgb: 124, 200, 255;
  --accent-soft: #d6ecff;
  --shade-rgb: 3, 10, 45;
  --bg-top: #0e2266;
  --bg-mid: #0b1b57;
  --bg-bottom: #071236;
  --glow-1: rgba(52, 196, 255, 0.16);
  --glow-2: rgba(36, 104, 255, 0.22);
  --radius: 14px;
  --radius-lg: 20px;
  --maxw: 1120px;
  --font: "Baloo 2", Inter, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--bg-bottom);
  background-image: var(--bg-image);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 3px solid var(--blue-hover); outline-offset: 2px; }

/* ---------- Header ---------- */

.site-header {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: inline-flex; align-items: center; flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand-wordmark { display: block; height: 30px; width: auto; }

.nav { display: flex; align-items: center; gap: 10px; }
.nav-form { margin: 0; }

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border: 0;
  border-radius: 12px;
  font: 700 15.5px/1.2 var(--font);
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 4px 0 rgba(var(--shade-rgb), 0.55);
  cursor: pointer;
  transition: transform 0.08s ease, background-color 0.15s ease, box-shadow 0.08s ease;
  white-space: nowrap;
}
.nav-btn:hover { background: rgba(255, 255, 255, 0.14); text-decoration: none; }
.nav-btn:active { transform: translateY(3px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 1px 0 rgba(var(--shade-rgb), 0.55); }

.nav-btn-primary {
  background: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 4px 0 var(--blue-deep);
}
.nav-btn-primary:hover { background: var(--blue-hover); }
.nav-btn-primary:active { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 1px 0 var(--blue-deep); }

.nav-btn.is-active { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55), 0 4px 0 rgba(var(--shade-rgb), 0.55); }
.nav-btn-primary.is-active { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55), 0 4px 0 var(--blue-deep); }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 700;
  font-size: 15px;
}
.user-avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--blue);
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
}
.user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Layout ---------- */

.site-main {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 24px 64px;
}
.page-auth .site-main { display: flex; align-items: flex-start; justify-content: center; padding-top: 6vh; }

.site-footer {
  text-align: center;
  padding: 24px;
  font-size: 14px;
  color: var(--ink-muted);
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--ink-soft); }

/* ---------- Auth card ---------- */

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 34px 32px 28px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 30px 60px -28px rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.auth-title {
  margin: 0;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.auth-sub { margin: 6px 0 22px; color: var(--ink-soft); }

.auth-switch {
  margin: 22px 0 0;
  text-align: center;
  font-size: 15.5px;
  color: var(--ink-soft);
}
.auth-switch a { font-weight: 700; }

/* ---------- Forms ---------- */

.form { display: grid; gap: 16px; }

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
}

.field input {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  font: 500 16px/1.3 var(--font);
  color: #fff;
  background: var(--field);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow 0.15s ease;
}
.field input:hover { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28); }
.field input:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--blue-hover), 0 0 0 4px rgba(var(--blue-rgb), 0.28);
}
.field input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--danger); }

/* Keep browser-autofilled fields dark instead of the default light yellow/blue */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-text-fill-color: #fff;
  caret-color: #fff;
  box-shadow: inset 0 0 0 1000px var(--bg-mid), inset 0 0 0 1px var(--line);
  transition: background-color 9999s ease-out 0s;
}
.field input:-webkit-autofill:focus {
  box-shadow: inset 0 0 0 1000px var(--bg-mid), inset 0 0 0 2px var(--blue-hover), 0 0 0 4px rgba(var(--blue-rgb), 0.28);
}

.field-hint, .field-error { margin: 6px 0 0; font-size: 14px; line-height: 1.35; }
.field-hint { color: var(--ink-muted); }
.field-error { color: var(--danger); font-weight: 600; }

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15.5px;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--blue); cursor: pointer; }

/* Spam trap: hidden from people, visible to bots */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  border: 0;
  border-radius: var(--radius);
  font: 800 17px/1.2 var(--font);
  color: #fff;
  cursor: pointer;
  transition: transform 0.08s ease, background-color 0.15s ease, box-shadow 0.08s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--blue);
  box-shadow: 0 5px 0 var(--blue-deep), 0 16px 26px -12px rgba(0, 0, 0, 0.55);
}
.btn-primary:hover { background: var(--blue-hover); }
.btn-primary:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--blue-deep), 0 6px 12px -8px rgba(0, 0, 0, 0.55); }
.btn-block { width: 100%; margin-top: 6px; }

/* ---------- Alerts ---------- */

.alert {
  margin: 0 0 18px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.4;
}
.alert-error { color: #ffdede; background: rgba(255, 77, 77, 0.14); box-shadow: inset 0 0 0 1px rgba(255, 122, 122, 0.45); }
.alert-success { color: #dcffee; background: rgba(46, 204, 128, 0.14); box-shadow: inset 0 0 0 1px rgba(95, 224, 161, 0.45); }

/* ---------- Home (members area) ---------- */

.home { max-width: 720px; padding-top: 4vh; }
.home .alert { max-width: 560px; }

.eyebrow {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.home-title {
  margin: 0;
  font-size: clamp(38px, 6vw, 60px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}
.accent { color: var(--accent); font-style: italic; }
.home-sub { margin: 10px 0 28px; font-size: 19px; color: var(--ink-soft); }

.panel {
  padding: 22px 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.13);
}
.panel-title { margin: 0 0 12px; font-size: 20px; font-weight: 800; }

.details { margin: 0; display: grid; gap: 0; }
.details > div {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.details > div:first-child { border-top: 0; }
.details dt { color: var(--ink-muted); font-weight: 600; }
.details dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

.home-actions { margin-top: 26px; display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Admin ---------- */

.role-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(255, 196, 61, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 196, 61, 0.5);
  color: #ffd66b;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.6;
}
.role-muted { color: var(--ink-muted); font-weight: 600; }

.admin { padding-top: 2vh; }
.admin-title { margin: 0 0 20px; font-size: clamp(34px, 5vw, 48px); font-weight: 800; line-height: 1.05; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  display: flex;
  flex-direction: column;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.stat-value { font-size: 30px; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: 14px; color: var(--ink-muted); font-weight: 600; }

.table-panel { padding: 6px 0; }
.table-scroll { overflow-x: auto; }
.users-table { width: 100%; border-collapse: collapse; font-size: 15.5px; }
.users-table th {
  padding: 12px 20px;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  white-space: nowrap;
}
.users-table td { padding: 12px 20px; border-top: 1px solid rgba(255, 255, 255, 0.08); vertical-align: middle; }
.users-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.cell-strong { font-weight: 700; }
.cell-time { white-space: nowrap; color: var(--ink-soft); }
.empty { margin: 0; padding: 18px 24px; color: var(--ink-muted); }

/* ---------- Shared bits ---------- */

.btn-soft {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24), 0 5px 0 rgba(var(--shade-rgb), 0.6);
}
.btn-soft:hover { background: rgba(255, 255, 255, 0.14); }
.btn-soft:active { transform: translateY(4px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24), 0 1px 0 rgba(var(--shade-rgb), 0.6); }
.btn-sm { padding: 10px 16px; font-size: 15.5px; border-radius: 12px; }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.inline-form { margin: 0; display: inline-flex; }
.link-btn { padding: 0; border: 0; background: none; font: 700 15.5px/1.4 var(--font); color: var(--accent); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.muted { color: var(--ink-muted); }
.small { font-size: 14px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.page-head { margin-bottom: 26px; }
.page-title { margin: 0; font-size: clamp(34px, 5vw, 50px); font-weight: 800; line-height: 1.05; letter-spacing: -0.015em; }
.page-sub { margin: 10px 0 0; max-width: 660px; font-size: 18px; color: var(--ink-soft); }
.section-title { margin: 40px 0 14px; font-size: 24px; font-weight: 800; }
.sub-title { margin: 26px 0 8px; font-size: 19px; font-weight: 800; }
.crumbs { margin: 0 0 18px; font-size: 15px; color: var(--ink-muted); }
.crumbs a { color: var(--ink-soft); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.chip {
  padding: 3px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-soft);
}
.chip-accent { background: rgba(var(--blue-rgb), 0.25); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.45); color: var(--accent-soft); }

.status {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.6;
  white-space: nowrap;
}
.status-completed { background: rgba(46, 204, 128, 0.16); box-shadow: inset 0 0 0 1px rgba(95, 224, 161, 0.5); color: #a6f2cb; }
.status-in_progress { background: rgba(var(--blue-rgb), 0.22); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.5); color: var(--accent-soft); }
.status-abandoned { background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); color: var(--ink-muted); }
.status-wrong { background: rgba(255, 77, 77, 0.14); box-shadow: inset 0 0 0 1px rgba(255, 122, 122, 0.5); color: #ffc4c4; }

.score-good { color: var(--success); font-weight: 800; }
.score-mid { color: #ffd66b; font-weight: 800; }
.score-low { color: var(--danger); font-weight: 800; }
.cell-action { text-align: right; white-space: nowrap; font-weight: 700; }

/* ---------- Quizzes list ---------- */

.quiz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }
.quiz-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 24px 50px -30px rgba(0, 0, 0, 0.7);
}
.quiz-card-title { margin: 0; font-size: 25px; font-weight: 800; line-height: 1.15; }
.quiz-card-title a { color: #fff; }
.quiz-card-desc { margin: 0; font-size: 16px; color: var(--ink-soft); }
.quiz-card-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 14px;
  color: var(--ink-muted);
  font-weight: 600;
}
.quiz-card-stats strong { display: block; font-size: 22px; font-weight: 800; line-height: 1.15; color: #fff; }
.quiz-card .btn-row { margin-top: auto; padding-top: 4px; }

/* Category filter */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}
.filter-chip:hover { color: #fff; background: rgba(255, 255, 255, 0.12); text-decoration: none; }
.filter-chip.is-active { color: #fff; background: var(--blue); box-shadow: 0 3px 0 var(--blue-deep); }
.filter-count { padding: 0 7px; border-radius: 999px; font-size: 12.5px; background: rgba(0, 0, 0, 0.22); }
.chip-link:hover { background: rgba(var(--blue-rgb), 0.45); color: #fff; text-decoration: none; }

/* Tag filters: one row per tag category (Topic, Book, …) */
.filters { display: grid; gap: 10px; margin: 0 0 16px; }
.filters .filter-bar { flex-wrap: nowrap; align-items: flex-start; gap: 12px; margin: 0; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.filter-label {
  flex: none;
  min-width: 58px;
  padding-top: 9px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.filter-chip.is-empty:not(.is-active) { opacity: 0.5; }

/* Count + Show / Sort controls above the quiz grid */
.list-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
  margin: 0 0 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.list-count { margin: 0; font-size: 15.5px; font-weight: 700; color: var(--ink-muted); }
.list-count strong { color: #fff; }
.list-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.list-control { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; color: var(--ink-muted); }
.list-control select {
  min-height: 42px;
  padding: 8px 34px 8px 12px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  box-shadow: inset 0 0 0 1px var(--line);
  appearance: none;
  cursor: pointer;
}
.list-control select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.list-control option { color: #0b1a4a; background: #fff; }

/* Tags outside Topic ("Book: Hooked") under a quiz title */
.quiz-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: -4px 0 0; padding: 0; list-style: none; font-size: 15px; font-weight: 700; color: var(--ink-soft); }
.quiz-meta-cat { margin-right: 2px; font-size: 12px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-muted); }
.quiz-meta a { color: #ffe08a; }
.quiz-meta-lg { margin: 6px 0 14px; font-size: 17px; }
.quiz-meta-sm { margin: 4px 0 0; font-size: 13.5px; }

/* Builder: tag help under the Tags box */
div.field-hint p { margin: 0; }
.tag-help { margin: 6px 0 0; padding-left: 18px; }
.tag-help li { margin: 2px 0; }
@media (max-width: 560px) {
  /* Each filter row scrolls sideways on phones instead of stacking up */
  .filters .filter-bar { flex-direction: column; gap: 6px; }
  .filter-label { padding-top: 0; }
  .filter-chips { flex-wrap: nowrap; width: 100%; margin: 0 -2px; padding: 2px 2px 6px; overflow-x: auto; scrollbar-width: thin; }
  .filter-chip { flex: none; }
  .list-controls, .list-control { width: 100%; }
  .list-control > span { min-width: 56px; }
  .list-control select { flex: 1; }
}

/* ---------- Quiz detail ---------- */

.quiz-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 26px; align-items: start; }
.quiz-layout .chips { margin-bottom: 12px; }
.topic-list { margin: 0 0 16px; padding-left: 20px; color: var(--ink-soft); }
.topic-list li { margin: 5px 0; }
.start-panel { display: grid; gap: 14px; }
.start-panel .btn { width: 100%; }
.start-panel form { margin: 0; }
.start-panel p { margin: 0; }
.stats-plain { padding-top: 0; border-top: 0; justify-content: space-between; }
.restart-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }

/* ---------- Playing ---------- */

.play { max-width: 780px; margin: 0 auto; padding-top: 1vh; }
.play-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.play-top .eyebrow { margin-bottom: 2px; }
.play-count { margin: 0; font-size: 20px; font-weight: 800; }
.tally { margin: 0; font-size: 16px; font-weight: 800; color: var(--ink-muted); white-space: nowrap; }
.tally .ok { color: var(--success); }
.tally .no { color: var(--danger); }

.quiz-progress {
  display: block;
  width: 100%;
  height: 10px;
  margin: 0 0 20px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
  -webkit-appearance: none;
  appearance: none;
}
.quiz-progress::-webkit-progress-bar { background: rgba(255, 255, 255, 0.1); border-radius: 999px; }
.quiz-progress::-webkit-progress-value { background: linear-gradient(90deg, var(--blue), var(--accent)); border-radius: 999px; }
.quiz-progress::-moz-progress-bar { background: linear-gradient(90deg, var(--blue), var(--accent)); border-radius: 999px; }

.question-card {
  padding: 28px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 30px 60px -32px rgba(0, 0, 0, 0.7);
}
.options-fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.question-text { display: block; margin: 0 0 20px; padding: 0; font-size: clamp(20px, 2.5vw, 25px); font-weight: 800; line-height: 1.3; }

.options { display: grid; gap: 12px; margin: 0 0 22px; padding: 0; list-style: none; }
.option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(var(--shade-rgb), 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  font-size: 17px;
  line-height: 1.4;
  transition: background-color 0.12s ease, box-shadow 0.12s ease;
}
label.option { cursor: pointer; }
label.option:hover { background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32); }
.option input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.option-key {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
}
.option-text { flex: 1 1 0; min-width: 0; padding-top: 2px; }
.option:has(input:checked) { background: rgba(var(--blue-rgb), 0.24); box-shadow: inset 0 0 0 2px var(--blue-hover); }
.option:has(input:checked) .option-key { background: var(--blue); }
.option:has(input:focus-visible) { outline: 3px solid var(--blue-hover); outline-offset: 2px; }

.option.is-correct { background: rgba(46, 204, 128, 0.14); box-shadow: inset 0 0 0 2px rgba(95, 224, 161, 0.75); }
.option.is-correct .option-key { background: #1f9e63; }
.option.is-wrong { background: rgba(255, 77, 77, 0.13); box-shadow: inset 0 0 0 2px rgba(255, 122, 122, 0.75); }
.option.is-wrong .option-key { background: #cf3f3f; }
.option.is-dim { opacity: 0.6; }
.option-tag {
  flex-shrink: 0;
  margin-left: auto;
  padding-top: 5px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.is-correct .option-tag { color: #a6f2cb; }
.is-wrong .option-tag { color: #ffc4c4; }

.verdict { margin: 0 0 10px; font-size: 22px; font-weight: 800; }
.verdict-correct { color: var(--success); }
.verdict-wrong { color: var(--danger); }

.explain {
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.explain-label {
  display: block;
  margin-bottom: 4px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.sources { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.sources-label {
  margin-right: 2px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.source-btn {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 8px;
  padding: 7px 12px;
  border-radius: 10px;
  background: rgba(var(--blue-rgb), 0.18);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.4), 0 3px 0 rgba(var(--shade-rgb), 0.55);
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
  transition: background-color 0.15s ease, transform 0.08s ease, box-shadow 0.08s ease;
}
.source-btn:hover { background: rgba(var(--blue-rgb), 0.32); text-decoration: none; }
.source-btn:active { transform: translateY(2px); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.4), 0 1px 0 rgba(var(--shade-rgb), 0.55); }
.source-site { font-size: 12.5px; font-weight: 800; color: var(--accent); }
.source-arrow { color: var(--accent); }
.play-actions { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-top: 22px; }
.play-actions > .btn-primary { justify-self: center; min-width: 190px; }
.step-btn { gap: 6px; }
.step-back { justify-self: start; }
.step-forward { justify-self: end; }
.btn.is-disabled { opacity: 0.35; cursor: default; pointer-events: none; }
.play-top-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.play-top-right .muted { white-space: nowrap; }
.play-top-right .muted:hover { color: var(--ink-soft); }
.play-done { margin-left: 8px; font-size: 15px; font-weight: 700; color: var(--ink-muted); }

/* Question navigator: jump to any question */
.qnav { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.qnav-item {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 800;
  line-height: 1;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  transition: background-color 0.12s ease, box-shadow 0.12s ease;
}
.qnav-item:hover { background: rgba(255, 255, 255, 0.13); text-decoration: none; color: #fff; }
.qnav-item.is-right { background: rgba(46, 204, 128, 0.2); box-shadow: inset 0 0 0 1px rgba(95, 224, 161, 0.55); color: #a6f2cb; }
.qnav-item.is-wrong { background: rgba(255, 77, 77, 0.18); box-shadow: inset 0 0 0 1px rgba(255, 122, 122, 0.55); color: #ffc4c4; }
.qnav-item.is-current { box-shadow: inset 0 0 0 2px #fff; color: #fff; }

/* ---------- Attempt review ---------- */

.score-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 26px;
  padding: 26px 28px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15), 0 30px 60px -32px rgba(0, 0, 0, 0.7);
}
.score-big { font-size: 64px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.score-title { margin: 0 0 10px; font-size: 24px; font-weight: 800; line-height: 1.2; }
.score-actions { display: grid; gap: 10px; }
.score-actions form { margin: 0; }
.score-actions .btn { width: 100%; }
.jump { margin: 18px 0 0; font-weight: 700; color: var(--ink-muted); }
.jump a { margin-right: 6px; }

.review-list { display: grid; gap: 16px; margin: 0; padding: 0; list-style: none; }
.review-item {
  padding: 22px 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.13);
  scroll-margin-top: 20px;
}
.review-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.review-q { margin: 0 0 14px; font-size: 19px; font-weight: 800; line-height: 1.3; }
.review-item .options { gap: 8px; margin-bottom: 14px; }
.review-item .option { padding: 10px 14px; font-size: 15.5px; }
.review-item .option-key { width: 26px; height: 26px; font-size: 13.5px; }

@media (max-width: 860px) {
  .quiz-layout { grid-template-columns: 1fr; }
  .score-card { grid-template-columns: 1fr; gap: 16px; }
  .score-actions { grid-template-columns: 1fr 1fr; }
}

/* ---------- List quizzes ---------- */

.list-card .question-text { margin-bottom: 16px; }
.guess-form { display: flex; gap: 10px; margin: 0 0 14px; }
.guess-form input {
  flex: 1 1 0;
  min-width: 0;
  padding: 14px 16px;
  border: 0;
  border-radius: 14px;
  font: 600 18px/1.3 var(--font);
  color: #fff;
  background: var(--field);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  transition: box-shadow 0.15s ease;
}
.guess-form input::placeholder { color: var(--ink-muted); font-weight: 500; }
.guess-form input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--blue-hover), 0 0 0 4px rgba(var(--blue-rgb), 0.28); }
.guess-form .btn { flex-shrink: 0; min-width: 110px; }

.list-feedback {
  margin: 0 0 14px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.4;
}
.list-feedback .gem-earned, .list-feedback .gem-note { margin-left: 8px; vertical-align: 1px; }
.fb-found { background: rgba(46, 204, 128, 0.14); box-shadow: inset 0 0 0 1px rgba(95, 224, 161, 0.6); color: #a6f2cb; }
.fb-found strong { color: #fff; }
.fb-miss { background: rgba(255, 77, 77, 0.12); box-shadow: inset 0 0 0 1px rgba(255, 122, 122, 0.55); color: #ffc4c4; }
.fb-vague { background: rgba(255, 196, 77, 0.12); box-shadow: inset 0 0 0 1px rgba(255, 205, 110, 0.55); color: #ffe3a8; }
.fb-again { background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-soft); }
.fb-hint { background: rgba(var(--blue-rgb), 0.16); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.5); color: #e2f3ff; font-weight: 600; }
.fb-label, .slot-tag {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.fb-label { margin-right: 6px; }

.list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.list-tools-note { flex: 1 1 220px; }
.btn:disabled { opacity: 0.35; cursor: default; pointer-events: none; }
.list-confirm {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(255, 77, 77, 0.07);
  box-shadow: inset 0 0 0 2px rgba(255, 122, 122, 0.5);
}
.list-confirm p { margin: 0; color: var(--ink-soft); }

.list-slots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}
.slot {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 9px 14px 9px 10px;
  border-radius: 13px;
  background: rgba(var(--shade-rgb), 0.3);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  font-size: 16px;
  line-height: 1.3;
}
.slot-num {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-muted);
}
.slot-blank { font-size: 18px; font-weight: 800; color: rgba(255, 255, 255, 0.28); }
.slot-name { flex: 1 1 0; min-width: 0; font-weight: 800; }
.slot-hint { flex: 1 1 0; min-width: 0; font-size: 14.5px; font-weight: 600; color: #cfe9ff; }
.slot-tag { flex-shrink: 0; }
.slot.is-found { background: rgba(46, 204, 128, 0.13); box-shadow: inset 0 0 0 1px rgba(95, 224, 161, 0.55); }
.slot.is-found .slot-num { background: #1f9e63; color: #fff; }
.slot.is-hinted { background: rgba(var(--blue-rgb), 0.13); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.45); }
.slot.is-hinted .slot-num { background: rgba(var(--blue-rgb), 0.55); color: #fff; }
.slot.is-new { box-shadow: inset 0 0 0 2px #fff; }

.typed { margin: -6px 0 14px; color: var(--ink-soft); }
.typed strong { color: #fff; }
.not-listed { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.miss-chip {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
}
.list-missed a + a::before { content: "· "; color: var(--ink-muted); }

/* ---------- Gems ---------- */

.gem-icon { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -3px; }
.gem-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 9px;
  border-radius: 999px;
  background: rgba(95, 196, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(95, 196, 255, 0.4);
  font-weight: 800;
  font-size: 15px;
  color: #d6efff;
  white-space: nowrap;
}
.gem-earned {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 10px;
  padding: 2px 10px 2px 7px;
  border-radius: 999px;
  background: rgba(95, 196, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(95, 196, 255, 0.5);
  font-size: 15px;
  font-weight: 800;
  color: #d6efff;
  vertical-align: 3px;
}
.gem-earned-sm { margin-left: 0; padding: 0 8px 0 5px; font-size: 12.5px; letter-spacing: 0; }
.gem-earned-sm .gem-icon { width: 14px; height: 14px; }
.gem-note { margin-left: 10px; font-size: 14px; font-weight: 600; color: var(--ink-muted); vertical-align: 2px; }
.chip-gem { display: inline-flex; align-items: center; gap: 5px; color: #d6efff; box-shadow: inset 0 0 0 1px rgba(95, 196, 255, 0.45); background: rgba(95, 196, 255, 0.12); }
.chip-gem .gem-icon { width: 14px; height: 14px; }
.gem-dd, .gem-cell { display: flex; align-items: center; gap: 6px; }
.gem-cell { font-weight: 700; }
.gem-line { display: flex; align-items: flex-start; gap: 8px; font-size: 14.5px; color: var(--ink-soft); }
.gem-line .gem-icon { margin-top: 2px; }
.gem-line strong { color: #d6efff; }

/* ---------- Admin: tabs + quiz builder ---------- */

.admin-tabs { display: flex; gap: 6px; margin: 0 0 22px; padding: 4px; width: fit-content; border-radius: 14px; background: rgba(var(--shade-rgb), 0.35); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.admin-tab { padding: 8px 18px; border-radius: 10px; font-weight: 800; color: var(--ink-soft); }
.admin-tab:hover { color: #fff; text-decoration: none; background: rgba(255, 255, 255, 0.06); }
.admin-tab.is-active { color: #fff; background: var(--blue); box-shadow: 0 3px 0 var(--blue-deep); }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.admin-toolbar p { margin: 0; }
.plain-link { color: #fff; }
.chip-sm { margin-left: 8px; padding: 1px 8px; font-size: 12px; vertical-align: 2px; }
.draft-note { margin: 10px 0 0; padding: 8px 12px; border-radius: 10px; background: rgba(255, 196, 61, 0.12); box-shadow: inset 0 0 0 1px rgba(255, 196, 61, 0.4); color: #ffe3a1; font-weight: 600; font-size: 15px; }
.draft-note a { color: #ffd66b; font-weight: 800; }
.select-hint { margin: -10px 0 16px; font-size: 14px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }

.builder .admin-title { margin-bottom: 0; }
.builder-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.builder-form { display: grid; gap: 18px; margin-bottom: 26px; }
.builder-form .panel-title { margin: 0; }
.builder-form fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.builder-form legend { margin-bottom: 8px; padding: 0; font-size: 15px; font-weight: 700; color: rgba(255, 255, 255, 0.92); }
.builder-form textarea,
.builder-form input[type="number"],
.builder-form input[type="url"] {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  font: 500 16px/1.4 var(--font);
  color: #fff;
  background: var(--field);
  box-shadow: inset 0 0 0 1px var(--line);
  resize: vertical;
}
.builder-form textarea:focus,
.builder-form input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--blue-hover), 0 0 0 4px rgba(var(--blue-rgb), 0.28); }
.builder-form textarea[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--danger); }
.builder-form input[type="text"] { display: block; width: 100%; padding: 12px 14px; border: 0; border-radius: 12px; font: 500 16px/1.3 var(--font); color: #fff; background: var(--field); box-shadow: inset 0 0 0 1px var(--line); }
.builder-form ::placeholder { color: rgba(255, 255, 255, 0.35); }
.field-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.label-note { font-weight: 500; color: var(--ink-muted); }
.status-picker { display: grid; gap: 8px; }
.builder-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 6px; }
.builder > .admin-title { margin-bottom: 18px; }
/* Checkbox/radio labels inside builder fields stay on one line (overrides the stacked .field label style) */
.builder-form .check { display: flex; margin-bottom: 0; font-size: 15.5px; font-weight: 600; color: var(--ink-soft); }
.builder-form .correct-toggle { display: inline-flex; margin-bottom: 0; }

/* Answer type picker: radio "tabs" */
.type-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.type-option {
  position: relative;
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(var(--shade-rgb), 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  cursor: pointer;
}
.type-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.type-option:hover { background: rgba(255, 255, 255, 0.06); }
.type-option:has(input:checked) { background: rgba(var(--blue-rgb), 0.24); box-shadow: inset 0 0 0 2px var(--blue-hover); }
.type-option:has(input:focus-visible) { outline: 3px solid var(--blue-hover); outline-offset: 2px; }
.type-name { font-weight: 800; }
.type-hint { font-size: 13.5px; color: var(--ink-muted); }

/* Show only the answer fields that match the chosen type (browsers without :has show both; the server uses the right one) */
.question-form:has(#type-truefalse:checked) .answers-section { display: none; }
.question-form:not(:has(#type-truefalse:checked)) .tf-section { display: none; }
.question-form:has(#type-multiple:checked) .hint-single,
.question-form:not(:has(#type-multiple:checked)) .hint-multiple { display: none; }

.answer-rows, .source-rows { display: grid; gap: 8px; }
.answer-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.answer-letter { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: rgba(255, 255, 255, 0.1); font-weight: 800; font-size: 14px; }
.correct-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}
.correct-toggle input { width: 17px; height: 17px; margin: 0; accent-color: #1f9e63; }
.correct-toggle:has(input:checked) { background: rgba(46, 204, 128, 0.16); box-shadow: inset 0 0 0 1px rgba(95, 224, 161, 0.6); color: #a6f2cb; }
.tf-options { display: flex; gap: 22px; }
.source-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px; }

/* Question list in the quiz editor */
.builder-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.builder-section-head .section-title { margin: 0; }
.question-list { display: grid; gap: 10px; margin: 14px 0 0; padding: 0; list-style: none; }
.question-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.13);
}
.question-row.is-confirming { box-shadow: inset 0 0 0 2px rgba(255, 122, 122, 0.7); }
.question-num { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 255, 255, 0.1); font-weight: 800; }
.question-title { display: block; color: #fff; font-weight: 700; line-height: 1.35; }
.question-meta { margin: 6px 0 0; font-size: 14px; color: var(--ink-muted); }
.question-meta .chip-sm { margin-left: 0; margin-right: 4px; }
.question-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  font: 800 14px/1 var(--font);
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.15); text-decoration: none; }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn-danger { color: #ffc4c4; }
.icon-btn-danger:hover { background: rgba(255, 77, 77, 0.2); }
.inline-confirm { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; font-size: 14.5px; font-weight: 600; color: #ffd0d0; }
.btn-danger { background: #cf3f3f; box-shadow: 0 5px 0 #8e2424; }
.btn-danger:hover { background: #e04b4b; }
.confirm-panel { display: grid; gap: 12px; margin-bottom: 22px; box-shadow: inset 0 0 0 2px rgba(255, 122, 122, 0.6); }
.confirm-panel p { margin: 0; color: var(--ink-soft); }
.danger-zone { margin-top: 30px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.link-danger { color: #ff9c9c; font-weight: 700; font-size: 15px; }

/* ---------- Small screens ---------- */

@media (max-width: 560px) {
  .site-header { padding: 16px; flex-wrap: wrap; row-gap: 12px; }
  .nav { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
  .quiz-grid { grid-template-columns: 1fr; }
  .question-card, .review-item { padding: 20px 18px; }
  .list-slots { grid-template-columns: 1fr; }
  .guess-form .btn { min-width: 0; padding-left: 16px; padding-right: 16px; }
  .guess-form input { font-size: 17px; }
  .option { padding: 12px 13px; gap: 11px; font-size: 16px; }
  .options-static .option { flex-wrap: wrap; row-gap: 2px; }
  .options-static .option-tag { width: 100%; margin-left: 41px; padding-top: 0; }
  .play-top { align-items: flex-start; }
  .play-actions { grid-template-columns: auto 1fr auto; gap: 8px; }
  .type-options, .field-row, .source-row { grid-template-columns: 1fr; }
  .question-row { grid-template-columns: 30px minmax(0, 1fr); }
  .question-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .answer-row { grid-template-columns: 26px minmax(0, 1fr) auto; gap: 8px; }
  .correct-toggle span { display: none; }
  .admin-tabs { width: 100%; }
  .admin-tab { flex: 1; text-align: center; }
  .play-actions > .btn-primary { justify-self: stretch; min-width: 0; padding-left: 12px; padding-right: 12px; }
  .step-btn { min-width: 46px; }
  .step-word { display: none; }
  .score-big { font-size: 52px; }
  .score-actions { grid-template-columns: 1fr; }
  .brand-wordmark { height: 24px; }
  .nav { gap: 8px; }
  .nav-btn { padding: 8px 12px; font-size: 14.5px; }
  .user-chip { padding-right: 5px; }
  .user-name, .user-chip .role-badge { display: none; }
  .gem-chip { padding: 6px 10px 6px 7px; font-size: 14px; }
  .gem-note { display: block; margin: 4px 0 0; }
  .stats { gap: 8px; }
  .stat { padding: 12px; }
  .stat-value { font-size: 24px; }
  .stat-label { font-size: 12.5px; line-height: 1.25; }
  .users-table th, .users-table td { padding: 10px 14px; }
  .site-main { padding: 12px 16px 48px; }
  .auth-card { padding: 26px 20px 22px; }
  .auth-title { font-size: 29px; }
  .details > div { grid-template-columns: 1fr; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ==========================================================================
   Questionnaire (questionnaire.php, questionnaire-game.php)
   ========================================================================== */
.qn-optional { margin-left: 6px; font-size: 13px; font-weight: 600; color: var(--ink-muted); }
.qn-new { margin-bottom: 8px; }
.qn-new-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: 14px 16px; align-items: end; }
.qn-new-form .field { margin: 0; }
.qn-new-btn { white-space: nowrap; }
.qn-count { display: inline-block; margin-left: 6px; padding: 1px 10px; border-radius: 999px; font-size: 15px; vertical-align: 3px; color: var(--ink-soft); background: rgba(255, 255, 255, 0.08); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14); }
.qn-empty p { margin: 0; color: var(--ink-soft); }

/* Saved games */
.qn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.qn-card { display: flex; flex-direction: column; gap: 10px; padding: 22px 22px 18px; border-radius: var(--radius-lg); color: var(--ink); text-decoration: none; background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 24px 50px -30px rgba(0, 0, 0, 0.7); transition: transform 0.12s ease, box-shadow 0.15s ease, background-color 0.15s ease; }
.qn-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.55), 0 28px 56px -30px rgba(0, 0, 0, 0.8); }
.qn-card:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--blue-hover), 0 0 0 4px rgba(var(--blue-rgb), 0.35); }
.qn-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.qn-card-title { margin: 0; font-size: 23px; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.qn-card-repo { margin: -4px 0 0; font-size: 14px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qn-card-stats { display: flex; justify-content: space-between; gap: 10px; font-size: 14.5px; color: var(--ink-soft); }
.qn-card-stats strong { color: var(--ink); }
.qn-card-time { margin: 0; font-size: 13.5px; color: var(--ink-muted); }

.qn-decision { flex: none; display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 13px; font-weight: 800; line-height: 1.4; white-space: nowrap; }
.qn-decision-build { color: #05331d; background: var(--success); }
.qn-decision-prototype { color: #04224f; background: var(--accent); }
.qn-decision-rework { color: #3d2600; background: #ffc857; }
.qn-decision-scrap { color: #4a0b0b; background: var(--danger); }

/* Progress bar (width set by class: the CSP doesn't allow inline styles) */
.qn-bar { position: relative; height: 8px; border-radius: 999px; overflow: hidden; background: rgba(var(--shade-rgb), 0.55); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); }
.qn-bar > span { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--accent)); transition: width 0.3s ease; }
.qn-p-0 { width: 0; } .qn-p-1 { width: 5%; } .qn-p-2 { width: 10%; } .qn-p-3 { width: 15%; } .qn-p-4 { width: 20%; }
.qn-p-5 { width: 25%; } .qn-p-6 { width: 30%; } .qn-p-7 { width: 35%; } .qn-p-8 { width: 40%; } .qn-p-9 { width: 45%; }
.qn-p-10 { width: 50%; } .qn-p-11 { width: 55%; } .qn-p-12 { width: 60%; } .qn-p-13 { width: 65%; } .qn-p-14 { width: 70%; }
.qn-p-15 { width: 75%; } .qn-p-16 { width: 80%; } .qn-p-17 { width: 85%; } .qn-p-18 { width: 90%; } .qn-p-19 { width: 95%; }
.qn-p-20 { width: 100%; }
.qn-bar > span.qn-p-20 { background: linear-gradient(90deg, #2fbf7f, var(--success)); }

/* Game page header */
.qn-crumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; font-size: 15px; font-weight: 700; color: var(--ink-muted); }
.qn-crumbs a { color: var(--accent); }
.qn-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px 28px; flex-wrap: wrap; margin-bottom: 18px; }
.qn-head .page-title { overflow-wrap: anywhere; }
.qn-head-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 0; font-size: 15px; color: var(--ink-muted); }
.qn-repo { color: var(--accent); font-weight: 700; overflow-wrap: anywhere; }
.qn-head-stats { display: flex; gap: 12px; }
.qn-stat { display: flex; flex-direction: column; align-items: flex-start; min-width: 110px; padding: 10px 16px; border-radius: var(--radius); background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.13); }
.qn-stat-value { font-size: 24px; font-weight: 800; line-height: 1.2; }
.qn-stat-decision { font-size: 16px; min-height: 29px; display: flex; align-items: center; }
.qn-stat-label { font-size: 12.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }

/* Toolbar above the frame */
.qn-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 14px; padding: 12px 16px; border-radius: var(--radius); background: rgba(255, 255, 255, 0.05); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.qn-progress { display: flex; align-items: center; gap: 14px; flex: 1 1 260px; min-width: 0; }
.qn-progress .qn-bar { flex: 1; max-width: 340px; }
.qn-progress-text { font-size: 15px; color: var(--ink-soft); white-space: nowrap; }
.qn-progress-text strong { color: var(--ink); }
.qn-toolbar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.qn-status { font-size: 14px; font-weight: 700; color: var(--ink-muted); }
.qn-status.is-ok { color: var(--success); }
.qn-status.is-pending { color: var(--ink-soft); }
.qn-status.is-error { color: var(--danger); }
.qn-toolbar .btn-sm { padding: 8px 14px; font-size: 15px; }
.qn-next, .qn-clear, .qn-add-row, .qn-row-del { display: none; }
.qn-js .qn-next { display: inline-flex; }
.qn-js .qn-clear, .qn-js .qn-add-row { display: inline-block; }
.qn-js .qn-row-del { display: inline-flex; }

/* Categories + scrollable frame */
.qn-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }
.qn-cats { display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: var(--radius-lg); background: rgba(255, 255, 255, 0.05); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.qn-cat { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 11px; font-size: 16px; font-weight: 700; line-height: 1.25; color: var(--ink-soft); text-decoration: none; transition: background-color 0.12s ease, color 0.12s ease; }
.qn-cat:hover { text-decoration: none; color: var(--ink); background: rgba(255, 255, 255, 0.07); }
.qn-cat.is-active { color: #fff; background: var(--blue); box-shadow: 0 3px 0 var(--blue-deep); }
.qn-cat-count { flex: none; padding: 1px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 800; color: var(--ink-soft); background: rgba(var(--shade-rgb), 0.45); }
.qn-cat.is-active .qn-cat-count { color: #fff; background: rgba(var(--shade-rgb), 0.35); }
.qn-cat.is-done .qn-cat-count { color: #05331d; background: var(--success); }
.qn-cat.is-done .qn-cat-count::before { content: "✓ "; }

.qn-frame { height: clamp(460px, calc(100vh - 150px), 920px); overflow-y: auto; overscroll-behavior: contain; padding: 6px 22px 22px; border-radius: var(--radius-lg); background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.13); scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.28) transparent; }
.qn-frame:focus-visible { outline: 2px solid var(--blue-hover); outline-offset: 2px; }
.qn-section { padding-top: 16px; }
.qn-section + .qn-section { margin-top: 18px; border-top: 1px solid var(--line); }
.qn-section-head { margin-bottom: 14px; }
.qn-section-title { margin: 0; font-size: 26px; font-weight: 800; line-height: 1.15; }
.qn-section-blurb { margin: 4px 0 0; font-size: 15.5px; color: var(--ink-soft); }
.qn-frame-end { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink-muted); }
.qn-frame-end p { margin: 0; }

/* Questions */
.qn-q { min-width: 0; margin: 0 0 12px; padding: 16px 18px; border: 0; border-radius: var(--radius); background: rgba(var(--shade-rgb), 0.28); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.qn-q-label { display: flex; align-items: flex-start; gap: 10px; float: none; width: 100%; margin: 0 0 10px; padding: 0; font-size: 17px; font-weight: 700; line-height: 1.35; color: var(--ink); }
.qn-q-num { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; margin-top: -1px; padding: 0 6px; border-radius: 999px; font-size: 13px; font-weight: 800; color: var(--ink-soft); background: rgba(255, 255, 255, 0.09); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16); transition: background-color 0.15s ease, color 0.15s ease; }
.qn-q.is-answered .qn-q-num { color: #05331d; background: var(--success); box-shadow: none; }
.qn-q > legend.qn-q-label { float: left; }
.qn-q-hint, .qn-pills, .qn-rows { clear: both; }
.qn-q-hint { margin: -4px 0 10px 36px; font-size: 14.5px; line-height: 1.4; color: var(--ink-muted); }
.qn-input { display: block; width: 100%; padding: 11px 13px; border: 0; border-radius: 11px; font: 500 16px/1.4 var(--font); color: #fff; background: var(--field); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow 0.15s ease; }
.qn-input::placeholder { color: rgba(255, 255, 255, 0.34); }
.qn-input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--blue-hover), 0 0 0 4px rgba(var(--blue-rgb), 0.28); }
.qn-textarea { min-height: 84px; resize: vertical; overflow: hidden; }

/* Choice and 1–5 scale */
.qn-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.qn-pill { position: relative; display: inline-flex; cursor: pointer; }
.qn-pill input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.qn-pill span { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; padding: 8px 16px; border-radius: 999px; font-size: 15.5px; font-weight: 700; color: var(--ink-soft); background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); transition: background-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease; }
.qn-pill:hover span { color: var(--ink); background: rgba(255, 255, 255, 0.12); }
.qn-pill input:checked + span { color: #fff; background: var(--blue); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25), 0 3px 0 var(--blue-deep); }
.qn-pill input:focus-visible + span { box-shadow: inset 0 0 0 2px var(--blue-hover), 0 0 0 4px rgba(var(--blue-rgb), 0.35); }
.qn-q-scale .qn-pill span { min-width: 46px; padding: 8px 0; }
.qn-scale-end { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); }
.qn-clear { margin-left: 4px; padding: 4px 6px; border: 0; background: none; font: 700 14px var(--font); color: var(--ink-muted); text-decoration: underline; cursor: pointer; }
.qn-clear:hover { color: var(--ink); }

/* Tables (rows of inputs) */
.qn-rows { display: grid; gap: 8px; }
.qn-row { display: grid; gap: 8px; align-items: center; }
.qn-cols-2 .qn-row { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) 36px; }
.qn-cols-3 .qn-row { grid-template-columns: repeat(3, minmax(0, 1fr)) 36px; }
.qn-cols-4 .qn-row { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.8fr) minmax(0, 1.3fr) minmax(0, 1.3fr) 36px; }
.qn-row-head span { padding: 0 4px; font-size: 13px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-muted); }
.qn-cell { padding: 9px 11px; font-size: 15.5px; }
.qn-row-del { align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px; font: 700 20px/1 var(--font); color: var(--ink-muted); background: rgba(255, 255, 255, 0.05); cursor: pointer; }
.qn-row-del:hover { color: var(--danger); background: rgba(255, 122, 122, 0.12); }
.qn-add-row { margin-top: 10px; padding: 8px 14px; border: 1px dashed rgba(255, 255, 255, 0.3); border-radius: 10px; font: 700 15px var(--font); color: var(--accent); background: none; cursor: pointer; }
.qn-add-row:hover { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.08); }

/* Settings */
.qn-settings { margin-top: 22px; }
.qn-settings > summary, .qn-danger > summary { cursor: pointer; font-weight: 800; }
.qn-settings > summary { font-size: 18px; }
.qn-settings-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: 14px 16px; align-items: end; margin-top: 16px; }
.qn-settings-form .field { margin: 0; }
.qn-danger { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.qn-danger > summary { font-size: 15px; color: var(--danger); }
.qn-danger p { margin: 10px 0 12px; color: var(--ink-soft); }
.qn-delete-btn { color: #fff; background: #c93a3a; box-shadow: 0 4px 0 #8c2323; }
.qn-delete-btn:hover { background: #dc4848; }

@media (max-width: 860px) {
  .qn-new-form, .qn-settings-form { grid-template-columns: 1fr; }
  .qn-shell { grid-template-columns: 1fr; gap: 10px; }
  .qn-cats { flex-direction: row; overflow-x: auto; padding: 8px; gap: 6px; scrollbar-width: none; }
  .qn-cats::-webkit-scrollbar { display: none; }
  .qn-cat { flex: none; padding: 7px 12px; font-size: 15px; }
  .qn-frame { height: clamp(420px, calc(100vh - 120px), 900px); padding: 4px 14px 16px; }
  .qn-q { padding: 14px; }
  .qn-q-hint { margin-left: 0; }
  .qn-row-head { display: none; }
  .qn-cols-2 .qn-row, .qn-cols-3 .qn-row, .qn-cols-4 .qn-row { grid-template-columns: minmax(0, 1fr) 36px; padding: 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); }
  .qn-row .qn-cell { grid-column: 1; }
  .qn-row .qn-row-del { grid-column: 2; grid-row: 1; }
}

@media (max-width: 560px) {
  .qn-head { align-items: flex-start; }
  .qn-head-stats { width: 100%; }
  .qn-stat { flex: 1; min-width: 0; }
  .qn-progress { flex-basis: 100%; }
  .qn-toolbar-actions { width: 100%; justify-content: space-between; }
  .qn-status { flex-basis: 100%; order: -1; }
  .qn-status:empty { display: none; }
  .qn-pill span { padding: 7px 13px; font-size: 15px; }
  .qn-q-scale .qn-pill span { min-width: 40px; }
  .qn-scale-end { display: none; }
}

/* ==========================================================================
   Sharing (share panel on quizzes and questionnaires) + questionnaire roles
   ========================================================================== */
.share-panel { margin: 0 0 16px; padding: 0; }
.share-summary { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 14px 20px; cursor: pointer; list-style: none; }
.share-summary::-webkit-details-marker { display: none; }
.share-summary::before { content: "▸"; font-size: 14px; color: var(--ink-muted); transition: transform 0.15s ease; }
.share-panel[open] > .share-summary::before { transform: rotate(90deg); }
.share-summary-title { font-size: 18px; font-weight: 800; }
.share-summary-sub { font-size: 15px; color: var(--ink-soft); }
.share-faces { display: inline-flex; margin-left: auto; }
.share-faces .share-face + .share-face { margin-left: -8px; }
.share-face { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; font-size: 14px; font-weight: 800; color: #fff; background: var(--blue); box-shadow: 0 0 0 2px #0b1d58; }
.share-body { padding: 0 20px 18px; }
.share-help { margin: 0 0 14px; font-size: 15px; color: var(--ink-muted); }
.share-form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px 14px; align-items: end; }
.share-form .field { margin: 0; }
.share-form select { display: block; min-height: 46px; padding: 10px 12px; border: 0; border-radius: 12px; font: 600 16px/1.3 var(--font); color: #fff; background: var(--field); box-shadow: inset 0 0 0 1px var(--line); color-scheme: dark; cursor: pointer; }
.share-form select:focus { outline: none; box-shadow: inset 0 0 0 2px var(--blue-hover), 0 0 0 4px rgba(var(--blue-rgb), 0.28); }
.share-form select option { color: #000; }
.share-btn { min-height: 46px; }
.share-empty { margin: 14px 0 0; color: var(--ink-muted); }
.share-list { display: grid; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
.share-person { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 12px; border-radius: 12px; background: rgba(var(--shade-rgb), 0.3); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.share-person .share-face { box-shadow: none; }
.share-name { font-weight: 800; }
.share-role-chip { padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; color: var(--ink-soft); background: rgba(255, 255, 255, 0.08); }
.share-role-edit { color: #05331d; background: var(--success); }
.share-role-play { color: #04224f; background: var(--accent); }
.share-inline { display: inline; margin: 0; }
.share-inline:first-of-type { margin-left: auto; }
.share-link { padding: 4px 6px; border: 0; background: none; font: 700 14px var(--font); color: var(--accent); cursor: pointer; }
.share-link:hover { text-decoration: underline; }
.share-remove { color: var(--danger); }

/* Questionnaire: shared games */
.qn-card-time { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.qn-card-owner { font-weight: 700; color: var(--ink-soft); }
.qn-access { padding: 1px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; }
.qn-access-edit { color: #05331d; background: var(--success); }
.qn-access-view { color: var(--ink-soft); background: rgba(255, 255, 255, 0.1); }
.qn-lock { min-width: 0; margin: 0; padding: 0; border: 0; }
.qn-lock:disabled .qn-input { opacity: 1; color: var(--ink); cursor: default; -webkit-text-fill-color: var(--ink); }
.qn-lock:disabled .qn-input::placeholder { color: transparent; }
.qn-lock:disabled .qn-pill { cursor: default; }
.qn-lock:disabled .qn-pill input:not(:checked) + span { opacity: 0.55; }
.is-readonly .qn-next { display: none; }

@media (max-width: 640px) {
  .share-form { grid-template-columns: 1fr; }
  .share-form select { width: 100%; }
  .share-summary, .share-body { padding-left: 16px; padding-right: 16px; }
  .share-inline:first-of-type { margin-left: 0; }
}

.home-empty { margin: 18px 0 0; max-width: 560px; color: var(--ink-soft); }

/* ==========================================================================
   Questionnaire — pre-release / post-release
   ========================================================================== */
.qn-kinds { display: inline-flex; gap: 4px; max-width: 100%; margin: 0 0 14px; padding: 5px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.qn-kind { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 9px 16px; border-radius: 10px; font-size: 16px; font-weight: 800; line-height: 1.2; color: var(--ink-soft); text-decoration: none; white-space: nowrap; transition: background-color 0.12s ease, color 0.12s ease; }
.qn-kind:hover { text-decoration: none; color: var(--ink); background: rgba(255, 255, 255, 0.07); }
.qn-kind.is-active { color: #fff; background: var(--blue); box-shadow: 0 3px 0 var(--blue-deep); }
.qn-kind:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--blue-hover), 0 0 0 4px rgba(var(--blue-rgb), 0.35); }
.qn-kind-count { padding: 1px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 800; color: var(--ink-soft); background: rgba(var(--shade-rgb), 0.45); }
.qn-kind.is-active .qn-kind-count { color: #fff; background: rgba(var(--shade-rgb), 0.35); }

.qn-phase { display: flex; flex-direction: column; gap: 6px; }
.qn-phase-name { font-weight: 800; color: var(--ink); }
.qn-phase.is-unstarted { opacity: 0.55; }

.qn-decision-scale { color: #05331d; background: var(--success); }
.qn-decision-iterate { color: #04224f; background: var(--accent); }
.qn-decision-maintain { color: #3d2600; background: #ffc857; }
.qn-decision-sunset { color: #4a0b0b; background: var(--danger); }

.qn-section-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; align-items: start; }
.qn-section-grid > .qn-section-head { grid-column: 1 / -1; }
.qn-frame-end-actions { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 860px) {
  .qn-section-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .qn-kinds { display: flex; }
  .qn-kind { flex: 1; gap: 8px; padding: 9px 8px; font-size: 15px; }
}

/* ==========================================================================
   Questionnaire — pick-all-that-apply questions
   ========================================================================== */
.qn-multi-group { clear: both; margin: 0 0 12px; }
.qn-multi-label { margin: 0 0 8px; font-size: 13px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-muted); }
.qn-q-multi .qn-pill span { min-width: 0; }
.qn-multi-foot { margin-top: -2px; }
.qn-multi-foot .qn-clear { margin-left: 0; padding-left: 0; }

/* ==========================================================================
   Questionnaire — the eight filters
   ========================================================================== */
.qn-filter-note { margin-top: 10px; }
.qn-pill-yes input:checked + span { color: #05331d; background: var(--success); box-shadow: 0 3px 0 #2fa56f; }
.qn-pill-unsure input:checked + span { color: #3d2600; background: #ffc857; box-shadow: 0 3px 0 #c9952a; }
.qn-pill-no input:checked + span { color: #4a0b0b; background: var(--danger); box-shadow: 0 3px 0 #c95353; }

/* ==========================================================================
   Gem reward animation (assets/gems.js)
   ========================================================================== */
.gem-earned.is-popping { animation: gem-pop 0.6s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes gem-pop {
  0% { transform: scale(0.3); opacity: 0; }
  55% { transform: scale(1.3); opacity: 1; box-shadow: inset 0 0 0 1px rgba(95, 196, 255, 0.9), 0 0 22px rgba(95, 196, 255, 0.75); }
  100% { transform: scale(1); }
}
.gem-spark { position: fixed; z-index: 1001; width: 6px; height: 6px; border-radius: 50%; background: #c9ecff; box-shadow: 0 0 6px #5fc4ff; pointer-events: none; }
.gem-fly { position: fixed; z-index: 1002; display: block; pointer-events: none; filter: drop-shadow(0 0 8px rgba(95, 196, 255, 0.9)); }
.gem-fly svg { display: block; width: 100%; height: 100%; }
.gem-chip.is-bumped { animation: gem-bump 0.5s ease both; }
@keyframes gem-bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.18); box-shadow: inset 0 0 0 1px rgba(95, 196, 255, 0.9), 0 0 18px rgba(95, 196, 255, 0.7); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .gem-earned.is-popping, .gem-chip.is-bumped { animation: none; }
}

/* ==========================================================================
Projects — finalize steps checklist
========================================================================== */
.qn-q.qn-q-check { margin-bottom: 8px; padding: 0; }
.qn-check { display: flex; align-items: center; gap: 14px; padding: 13px 18px; font-size: 17px; font-weight: 700; line-height: 1.35; color: var(--ink); cursor: pointer; }
.qn-check-box { flex: none; display: grid; place-content: center; width: 24px; height: 24px; margin: 0; border-radius: 7px; background: var(--field); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35); -webkit-appearance: none; appearance: none; cursor: pointer; transition: background-color 0.12s ease, box-shadow 0.12s ease; }
.qn-check-box::after { content: ""; width: 12px; height: 7px; border: solid #05331d; border-width: 0 0 3px 3px; transform: translateY(-2px) rotate(-45deg); opacity: 0; }
.qn-check:hover .qn-check-box { box-shadow: inset 0 0 0 2px var(--accent); }
.qn-check-box:checked { background: var(--success); box-shadow: none; }
.qn-check-box:checked::after { opacity: 1; }
.qn-check-box:focus-visible { outline: 3px solid var(--blue-hover); outline-offset: 2px; }
.qn-check-text { min-width: 0; overflow-wrap: anywhere; }
.qn-q-check.is-answered .qn-check-text { color: var(--ink-muted); text-decoration: line-through; text-decoration-thickness: 2px; }
.qn-q-check .qn-q-hint { margin: -6px 18px 12px 56px; }
.qn-lock:disabled .qn-check, .qn-lock:disabled .qn-check-box { cursor: default; }

@media (max-width: 560px) {
.qn-check { padding: 12px 14px; font-size: 16px; }
.qn-kind { flex-direction: column; gap: 3px; padding: 8px 6px; white-space: normal; text-align: center; }
}

/* Projects — four section tabs: let them scroll sideways on narrow phones */
@media (max-width: 560px) {
.qn-kinds { overflow-x: auto; scrollbar-width: none; }
.qn-kinds::-webkit-scrollbar { display: none; }
.qn-kind { flex: 1 0 auto; font-size: 14px; }
}

/* Topic / Book dropdowns above the quiz list (one tag filter at a time) */
.filter-selects { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: 0 0 14px; }

/* =====================================================================================
   Themes (bought in the Shop). The equipped theme is a class on <html>: theme-<key>.
   Every theme only sets colour variables; the rest of this stylesheet reads them.
   The same classes go on .swatch previews in the shop, so .swatch rebuilds --bg-image too.
   ===================================================================================== */
:root, .swatch {
  --bg-image:
    radial-gradient(900px 560px at 88% 0%, var(--glow-1), transparent 70%),
    radial-gradient(760px 560px at 0% 100%, var(--glow-2), transparent 72%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 55%, var(--bg-bottom) 100%);
}

/* The free default (only used on shop swatches; on <html> the :root values already apply) */
.theme-default {
  --blue: #1f6feb; --blue-deep: #0f4bb3; --blue-hover: #3a82f2; --blue-rgb: 31, 111, 235;
  --accent: #7cc8ff; --accent-rgb: 124, 200, 255; --accent-soft: #d6ecff; --shade-rgb: 3, 10, 45;
  --bg-top: #0e2266; --bg-mid: #0b1b57; --bg-bottom: #071236;
  --glow-1: rgba(52, 196, 255, 0.16); --glow-2: rgba(36, 104, 255, 0.22);
}

/* Flat colours: one solid background, no gradient */
.theme-charcoal {
  --blue: #56657a; --blue-deep: #39434f; --blue-hover: #6a7b92; --blue-rgb: 86, 101, 122;
  --accent: #c9d3e0; --accent-rgb: 201, 211, 224; --accent-soft: #eef2f7; --shade-rgb: 6, 7, 10;
  --bg-top: #1d2027; --bg-mid: #1d2027; --bg-bottom: #1d2027; --bg-image: none;
}
.theme-crimson {
  --blue: #d63a4f; --blue-deep: #96202f; --blue-hover: #e6566a; --blue-rgb: 214, 58, 79;
  --accent: #ff9fac; --accent-rgb: 255, 159, 172; --accent-soft: #ffe1e6; --shade-rgb: 26, 3, 8;
  --bg-top: #3b0d18; --bg-mid: #3b0d18; --bg-bottom: #3b0d18; --bg-image: none;
}
.theme-emerald {
  --blue: #1f9e63; --blue-deep: #136b42; --blue-hover: #2bb877; --blue-rgb: 31, 158, 99;
  --accent: #7ee8b5; --accent-rgb: 126, 232, 181; --accent-soft: #d9fbea; --shade-rgb: 2, 20, 12;
  --bg-top: #0a3021; --bg-mid: #0a3021; --bg-bottom: #0a3021; --bg-image: none;
}
.theme-grape {
  --blue: #7b4ce0; --blue-deep: #5230a3; --blue-hover: #9166f0; --blue-rgb: 123, 76, 224;
  --accent: #c6abff; --accent-rgb: 198, 171, 255; --accent-soft: #eee6ff; --shade-rgb: 12, 5, 26;
  --bg-top: #271446; --bg-mid: #271446; --bg-bottom: #271446; --bg-image: none;
}
.theme-tangerine {
  --blue: #e5731a; --blue-deep: #a14d0b; --blue-hover: #f58a33; --blue-rgb: 229, 115, 26;
  --accent: #ffc48c; --accent-rgb: 255, 196, 140; --accent-soft: #ffebd8; --shade-rgb: 24, 10, 2;
  --bg-top: #3b1d07; --bg-mid: #3b1d07; --bg-bottom: #3b1d07; --bg-image: none;
}
.theme-bubblegum {
  --blue: #dd4aac; --blue-deep: #9c2d79; --blue-hover: #ec66c0; --blue-rgb: 221, 74, 172;
  --accent: #ffa9e2; --accent-rgb: 255, 169, 226; --accent-soft: #ffe4f6; --shade-rgb: 26, 4, 20;
  --bg-top: #3f1037; --bg-mid: #3f1037; --bg-bottom: #3f1037; --bg-image: none;
}

/* Gradients */
.theme-ocean {
  --blue: #139fb4; --blue-deep: #0a6c7b; --blue-hover: #22b9cf; --blue-rgb: 19, 159, 180;
  --accent: #7ef0e6; --accent-rgb: 126, 240, 230; --accent-soft: #d6fbf7; --shade-rgb: 2, 16, 26;
  --bg-top: #0d4c60; --bg-mid: #0a3550; --bg-bottom: #061d33;
  --glow-1: rgba(56, 230, 214, 0.2); --glow-2: rgba(30, 140, 255, 0.22);
}
.theme-aurora {
  --blue: #25b386; --blue-deep: #177a5b; --blue-hover: #34cc9c; --blue-rgb: 37, 179, 134;
  --accent: #b9a2ff; --accent-rgb: 185, 162, 255; --accent-soft: #e8e0ff; --shade-rgb: 6, 8, 26;
  --bg-top: #0b3b3a; --bg-mid: #142a4f; --bg-bottom: #1a0f3d;
  --glow-1: rgba(80, 255, 170, 0.22); --glow-2: rgba(170, 90, 255, 0.28);
}
.theme-sunset {
  --blue: #ee5f38; --blue-deep: #aa3c1d; --blue-hover: #ff7752; --blue-rgb: 238, 95, 56;
  --accent: #ffc47e; --accent-rgb: 255, 196, 126; --accent-soft: #ffead2; --shade-rgb: 22, 6, 16;
  --bg-top: #5c1f3e; --bg-mid: #3e1641; --bg-bottom: #1e0d2e;
  --glow-1: rgba(255, 170, 60, 0.28); --glow-2: rgba(255, 70, 140, 0.26);
}
.theme-galaxy {
  --blue: #8458f7; --blue-deep: #5733c0; --blue-hover: #9a74ff; --blue-rgb: 132, 88, 247;
  --accent: #a3d9ff; --accent-rgb: 163, 217, 255; --accent-soft: #e3f3ff; --shade-rgb: 4, 3, 14;
  --bg-top: #1b1342; --bg-mid: #0f0b2a; --bg-bottom: #05040f;
  --glow-1: rgba(150, 90, 255, 0.3); --glow-2: rgba(60, 190, 255, 0.18);
  --bg-image:
    radial-gradient(1.5px 1.5px at 12% 18%, rgba(255, 255, 255, 0.9), transparent 100%),
    radial-gradient(1px 1px at 27% 62%, rgba(255, 255, 255, 0.8), transparent 100%),
    radial-gradient(1.5px 1.5px at 41% 33%, rgba(255, 255, 255, 0.75), transparent 100%),
    radial-gradient(1px 1px at 58% 12%, rgba(255, 255, 255, 0.85), transparent 100%),
    radial-gradient(2px 2px at 66% 71%, rgba(255, 255, 255, 0.7), transparent 100%),
    radial-gradient(1px 1px at 79% 41%, rgba(255, 255, 255, 0.9), transparent 100%),
    radial-gradient(1.5px 1.5px at 90% 84%, rgba(255, 255, 255, 0.75), transparent 100%),
    radial-gradient(1px 1px at 7% 88%, rgba(255, 255, 255, 0.8), transparent 100%),
    radial-gradient(1px 1px at 35% 92%, rgba(255, 255, 255, 0.7), transparent 100%),
    radial-gradient(1.5px 1.5px at 95% 8%, rgba(255, 255, 255, 0.8), transparent 100%),
    radial-gradient(700px 480px at 75% 20%, var(--glow-1), transparent 70%),
    radial-gradient(640px 520px at 10% 90%, var(--glow-2), transparent 72%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 55%, var(--bg-bottom) 100%);
}

/* Rainbow (legendary): a full-spectrum gradient that keeps cycling, darkened so text stays readable */
.theme-rainbow {
  --blue: #8a4dff; --blue-deep: #5626b5; --blue-hover: #9e69ff; --blue-rgb: 138, 77, 255;
  --accent: #ffe066; --accent-rgb: 255, 224, 102; --accent-soft: #fff6cc; --shade-rgb: 10, 4, 24;
  --bg-top: #150a26; --bg-mid: #150a26; --bg-bottom: #150a26; --bg-image: none;
  --rainbow: linear-gradient(115deg, #e5243b, #f08a1c, #e8c51b, #2fb85a, #1c9be0, #6b4ce6, #c43fb4, #e5243b);
}
html.theme-rainbow body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(rgba(10, 4, 24, 0.52), rgba(10, 4, 24, 0.52)), var(--rainbow);
  animation: rainbow-hue 20s linear infinite;
}
html.theme-rainbow .btn-primary,
html.theme-rainbow .nav-btn-primary,
html.theme-rainbow .user-avatar,
html.theme-rainbow .qn-bar > span,
.swatch.theme-rainbow .swatch-btn {
  background-image: linear-gradient(90deg, #ff4d6d, #ffb84d, #ffe14d, #4dd98a, #4db8ff, #a56bff);
}
html.theme-rainbow .page-title {
  background: linear-gradient(90deg, #ff8fa3, #ffd08a, #fff08a, #8ff0b6, #8fd3ff, #c6a8ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
@keyframes rainbow-hue { to { filter: hue-rotate(360deg); } }

/* ---------- Shop ---------- */
.shop-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 24px; }
.shop-balance { display: inline-flex; align-items: center; gap: 10px; padding: 12px 20px 12px 16px; border-radius: 999px; background: rgba(95, 196, 255, 0.12); box-shadow: inset 0 0 0 1px rgba(95, 196, 255, 0.4); color: #d6efff; font-weight: 800; }
.shop-balance strong { font-size: 30px; line-height: 1; color: #fff; }
.shop-balance span { font-size: 16px; color: #d6efff; }
.gem-icon.shop-balance-icon { width: 30px; height: 30px; vertical-align: 0; }
.shop-jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 6px; }
.shop-intro { margin: -6px 0 18px; max-width: 700px; color: var(--ink-soft); }
.shop-subhead { margin: 26px 0 12px; font-size: 18px; font-weight: 800; color: var(--ink-soft); }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.shop-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--radius-lg); background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 24px 50px -30px rgba(0, 0, 0, 0.7); }
.shop-card.is-equipped { box-shadow: inset 0 0 0 2px var(--success), 0 24px 50px -30px rgba(0, 0, 0, 0.7); }
.shop-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.shop-card-title { margin: 0; font-size: 20px; font-weight: 800; line-height: 1.2; }
.shop-card-desc { margin: 0; font-size: 14.5px; line-height: 1.4; color: var(--ink-soft); }
.shop-card-actions { margin-top: auto; padding-top: 4px; }
.shop-tier { flex: none; font-size: 12px; }
.tier-flat { color: var(--ink-soft); }
.tier-gradient { color: #d6efff; background: rgba(95, 196, 255, 0.14); box-shadow: inset 0 0 0 1px rgba(95, 196, 255, 0.4); }
.tier-legendary { color: #fff3c4; background: rgba(255, 196, 61, 0.16); box-shadow: inset 0 0 0 1px rgba(255, 196, 61, 0.55); }
.shop-buy { gap: 6px; }
.shop-buy .gem-icon { width: 16px; height: 16px; vertical-align: 0; }
.shop-short { margin-left: 4px; font-size: 13px; font-weight: 700; color: var(--ink-muted); }
.shop-equipped { display: inline-flex; align-items: center; padding: 8px 14px; border-radius: 12px; font-size: 15px; font-weight: 800; color: #dcffee; background: rgba(46, 204, 128, 0.16); box-shadow: inset 0 0 0 1px rgba(95, 224, 161, 0.55); }
.shop-owned-note, .shop-locked { font-size: 14px; font-weight: 700; color: var(--ink-muted); }
.shop-current-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: -4px 0 4px; }
.shop-current-title p { margin: 0; display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink-soft); }
.shop-none { color: var(--ink-muted); }
.shop-title-show { display: flex; align-items: center; min-height: 40px; }
.shop-title-card .title-tag { font-size: 17px; }
.shop-title-card.is-locked .shop-title-show { opacity: 0.55; filter: saturate(0.4); }
.shop-rarity { margin: -4px 0 0; font-size: 12.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.rarity-text-common { color: var(--ink-muted); }
.rarity-text-rare { color: #8fd3ff; }
.rarity-text-epic { color: #c9a8ff; }
.rarity-text-legendary { color: #ffd66b; }
.shop-progress { display: flex; align-items: center; gap: 10px; }
.shop-progress .qn-bar { flex: 1; }
.shop-progress-num { flex: none; font-size: 13.5px; font-weight: 800; color: var(--ink-soft); }
.shop-preview-bar { position: sticky; top: 10px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; margin: 0 0 20px; padding: 12px 16px; border-radius: 16px; background: rgba(var(--shade-rgb), 0.85); box-shadow: inset 0 0 0 2px var(--accent), 0 18px 40px -20px rgba(0, 0, 0, 0.8); }
.shop-preview-bar p { margin: 0; font-weight: 700; }

/* Theme swatches: a tiny picture of the site in that theme */
.swatch { position: relative; height: 92px; overflow: hidden; border-radius: 14px; background-color: var(--bg-bottom); background-image: var(--bg-image); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16); }
.swatch-line { position: absolute; left: 14px; top: 18px; width: 58%; height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.85); }
.swatch-line-short { top: 36px; width: 36%; background: rgba(255, 255, 255, 0.4); }
.swatch-btn { position: absolute; left: 14px; bottom: 16px; width: 64px; height: 20px; border-radius: 8px; background-color: var(--blue); box-shadow: 0 3px 0 var(--blue-deep); }
.swatch-dot { position: absolute; right: 16px; bottom: 16px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); }
.swatch.theme-rainbow { background-image: linear-gradient(rgba(10, 4, 24, 0.35), rgba(10, 4, 24, 0.35)), var(--rainbow); animation: rainbow-hue 8s linear infinite; }

/* Titles (equipped one shows under your name in the header) */
.title-tag { display: inline-block; padding: 2px 12px; border-radius: 999px; font-weight: 800; font-size: 14px; line-height: 1.5; white-space: nowrap; }
.title-tag.rarity-common { color: #f2f5fb; background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28); }
.title-tag.rarity-rare { color: #d8f0ff; background: rgba(79, 180, 255, 0.18); box-shadow: inset 0 0 0 1px rgba(120, 200, 255, 0.6); }
.title-tag.rarity-epic { color: #f0e6ff; background: rgba(160, 100, 255, 0.22); box-shadow: inset 0 0 0 1px rgba(196, 160, 255, 0.65); }
.title-tag.rarity-legendary { color: #2a1600; background: linear-gradient(90deg, #ffd66b, #ffb347, #ffe8a3); box-shadow: inset 0 0 0 1px rgba(255, 240, 200, 0.8), 0 0 18px -4px rgba(255, 196, 61, 0.7); }
.user-text { display: inline-flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.user-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; font-weight: 800; letter-spacing: 0.03em; }
.user-title.rarity-common { color: var(--ink-muted); }
.user-title.rarity-rare { color: #8fd3ff; }
.user-title.rarity-epic { color: #c9a8ff; }
.user-title.rarity-legendary { color: #ffd66b; }
a.gem-chip { color: #d6efff; text-decoration: none; }
a.gem-chip:hover { background: rgba(95, 196, 255, 0.2); text-decoration: none; }

@media (max-width: 560px) {
  .user-text { display: none; }
  .shop-grid { grid-template-columns: 1fr; }
  .shop-balance strong { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  html.theme-rainbow body::before, .swatch.theme-rainbow { animation: none; }
}

/* ---------- Lenses ---------- */
.lens-board { margin: 0 0 22px; }
.lens-board-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.lens-board-count { margin: 0; font-size: 17px; font-weight: 700; color: var(--ink-soft); }
.lens-board-count strong { font-size: 34px; line-height: 1; color: #fff; margin-right: 4px; }
.lens-board-pct { margin: 0; font-size: 22px; font-weight: 800; color: var(--accent); }
.lens-board-bar { height: 10px; margin: 0 0 16px; }
.lens-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.lens-tile { display: grid; place-items: center; height: 30px; border-radius: 8px; font-size: 12.5px; font-weight: 800; color: var(--ink-muted); background: rgba(var(--shade-rgb), 0.45); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); transition: transform 0.08s ease, background-color 0.15s ease; }
.lens-tile:hover { color: #fff; background: rgba(var(--blue-rgb), 0.45); text-decoration: none; transform: translateY(-1px); }
.lens-tile.is-done { color: #05331d; background: var(--success); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35); }
.lens-tile.is-done:hover { background: #8af0c0; }
.lens-tile.is-next { color: #fff; box-shadow: inset 0 0 0 2px var(--accent); }
.lens-next { margin: 14px 0 0; font-weight: 700; color: var(--ink-soft); }
.lens-tools .list-controls { flex: 1; justify-content: flex-end; }
.lens-search input { width: 220px; padding: 9px 12px; border: 0; border-radius: 12px; font: 700 15px/1.2 var(--font); color: #fff; background: var(--field); box-shadow: inset 0 0 0 1px var(--line); }
.lens-search input::placeholder { color: var(--ink-muted); }
.lens-search input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--blue-hover), 0 0 0 4px rgba(var(--blue-rgb), 0.28); }
.lens-list { display: grid; gap: 10px; }
.lens { border-radius: var(--radius-lg); background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.13); scroll-margin-top: 16px; }
.lens[open] { box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.45), 0 24px 50px -30px rgba(0, 0, 0, 0.7); }
.lens.is-done { box-shadow: inset 0 0 0 1px rgba(95, 224, 161, 0.4); }
.lens-summary { display: flex; align-items: center; gap: 14px; padding: 14px 18px; cursor: pointer; list-style: none; border-radius: inherit; }
.lens-summary::-webkit-details-marker { display: none; }
.lens-summary:hover { background: rgba(255, 255, 255, 0.04); }
.lens-summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.lens-num { flex: none; min-width: 48px; padding: 3px 0; border-radius: 10px; text-align: center; font-size: 14px; font-weight: 800; color: var(--accent-soft); background: rgba(var(--blue-rgb), 0.25); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.4); }
.lens.is-done .lens-num { color: #05331d; background: var(--success); box-shadow: none; }
.lens-name { flex: 1; min-width: 0; font-size: 18px; font-weight: 800; line-height: 1.25; }
.lens-status { flex: none; font-size: 13.5px; font-weight: 800; color: var(--ink-muted); }
.lens.is-done .lens-status { color: var(--success); }
.lens-chevron { flex: none; width: 10px; height: 10px; margin-right: 4px; border-right: 2.5px solid var(--ink-muted); border-bottom: 2.5px solid var(--ink-muted); transform: rotate(45deg) translateY(-3px); transition: transform 0.15s ease; }
.lens[open] .lens-chevron { transform: rotate(-135deg) translateY(-2px); }
.lens-body { padding: 2px 18px 18px 80px; }
.lens-text { margin: 0 0 12px; max-width: 760px; color: var(--ink-soft); line-height: 1.55; }
.lens-questions { margin: 0 0 16px; padding-left: 20px; max-width: 760px; color: var(--ink-soft); }
.lens-questions li { margin: 0 0 6px; }
.lens-questions li::marker { color: var(--accent); }
.lens-form { display: grid; gap: 8px; max-width: 760px; padding: 14px 16px; border-radius: 14px; background: rgba(var(--shade-rgb), 0.35); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); }
.lens-form-label { font-weight: 800; }
.lens-form-hint { margin: -6px 0 2px; font-size: 14px; color: var(--ink-muted); }
.lens-answer { width: 100%; min-height: 96px; padding: 10px 12px; border: 0; border-radius: 12px; font: 600 16px/1.45 var(--font); color: #fff; background: var(--field); box-shadow: inset 0 0 0 1px var(--line); resize: vertical; box-sizing: border-box; }
.lens-answer:focus { outline: none; box-shadow: inset 0 0 0 2px var(--blue-hover), 0 0 0 4px rgba(var(--blue-rgb), 0.28); }
.lens-saved { font-size: 14px; font-weight: 700; color: var(--success); }
.lens-reset { margin: 8px 0 0; }
.link-btn { padding: 0; border: 0; background: none; font: 700 14px/1.3 var(--font); color: var(--ink-muted); text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: #fff; }
.lens-body .alert { max-width: 760px; }

@media (max-width: 560px) {
  .lens-summary { gap: 10px; padding: 12px 14px; }
  .lens-num { min-width: 40px; }
  .lens-name { font-size: 16px; }
  .lens-status { display: none; }
  .lens-body { padding: 2px 14px 14px; }
  .lens-search input { width: 100%; flex: 1; }
}

/* Quizzes: Topic, Book, Show and Sort by share one row, with the count on its own line under them */
.list-tools.quiz-list-tools { flex-direction: column; align-items: flex-start; gap: 12px; padding-top: 0; border-top: 0; }

/* "Clear all" link beside Apply when a quiz filter is on */
.list-clear { font-size: 14px; font-weight: 800; }

/* Header: your name links to the admin panel (admins) or the home page (everyone else) */
a.user-chip { color: inherit; text-decoration: none; }
a.user-chip:hover { background: rgba(255, 255, 255, 0.14); text-decoration: none; }
a.user-chip.is-active { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55); }

/* Header: gem count sits inside the Shop button as a small badge, like the Admin badge in the name tag */
.gem-chip.gem-badge { gap: 4px; margin-left: 8px; padding: 1px 8px 1px 6px; font-size: 12.5px; line-height: 1.6; }
.gem-chip.gem-badge .gem-icon { width: 13px; height: 13px; vertical-align: 0; }

/* Lens grid: only the first row shows until "View more" is clicked (a hidden checkbox, no script) */
.lens-tiles-toggle:not(:checked) ~ .lens-tiles { max-height: 34px; padding-top: 2px; margin-top: -2px; overflow: hidden; }
.lens-board-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-top: 14px; }
.lens-board-foot .lens-next { margin: 0; }
.lens-more { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; font-size: 14px; font-weight: 800; color: var(--accent); cursor: pointer; user-select: none; }
.lens-more:hover { text-decoration: underline; }
.lens-more::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.lens-tiles-toggle:checked ~ .lens-board-foot .lens-more::after { transform: translateY(2px) rotate(-135deg); }
.lens-tiles-toggle:checked ~ .lens-board-foot .lens-more-closed,
.lens-tiles-toggle:not(:checked) ~ .lens-board-foot .lens-more-open { display: none; }
.lens-tiles-toggle:focus-visible ~ .lens-board-foot .lens-more { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* Projects: the "New project" form is the first card in the grid, styled like a project card */
.qn-card.qn-card-new:hover { transform: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 24px 50px -30px rgba(0, 0, 0, 0.7); }
.qn-card-new .alert { margin: 0; }
.qn-card-new .qn-new-form { grid-template-columns: 1fr; gap: 12px; margin-top: 2px; }
.qn-card-new .qn-new-btn { width: 100%; margin-top: 4px; }

/* ---------- Theme box (Shop) ---------- */
.box-card { display: flex; align-items: center; gap: 28px; margin: 0 0 20px; padding: 22px 26px; border-radius: var(--radius-lg); background: linear-gradient(135deg, rgba(var(--blue-rgb), 0.24), rgba(255, 255, 255, 0.04)); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.35), 0 24px 50px -30px rgba(0, 0, 0, 0.7); }
.box-info { flex: 1; min-width: 0; }
.box-title { margin: 0 0 4px; font-size: 24px; font-weight: 800; }
.box-desc { margin: 0 0 12px; color: var(--ink-soft); }
.box-odds { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }
.box-odd { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--ink-soft); background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px var(--line); }
.box-odd strong { color: #fff; }
.box-odd.tier-gradient { box-shadow: inset 0 0 0 1px rgba(190, 140, 255, 0.6); }
.box-odd.tier-legendary { box-shadow: inset 0 0 0 1px rgba(255, 196, 61, 0.65); }
.box-odd.tier-legendary strong { color: #ffd66b; }
.box-actions { align-items: center; }
.box-owned { font-size: 14px; font-weight: 700; color: var(--ink-muted); }
.box-chance { font-size: 13.5px; font-weight: 800; color: var(--ink-muted); }

/* The box, drawn in CSS: a lid with a bow, and a body with a ribbon and a gem */
.box-art { position: relative; flex-shrink: 0; width: 96px; height: 92px; }
.box-body { position: absolute; left: 6px; right: 6px; bottom: 0; height: 62px; display: grid; place-items: center; border-radius: 10px 10px 14px 14px; background: linear-gradient(180deg, #2f7dff, #1747b8); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.22), inset 0 0 0 2px rgba(255, 255, 255, 0.18), 0 12px 26px -8px rgba(47, 125, 255, 0.75); }
.box-body::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 14px; transform: translateX(-50%); background: linear-gradient(180deg, #ffd66b, #f2a516); }
.box-lid { position: absolute; z-index: 1; left: 0; right: 0; top: 14px; height: 24px; border-radius: 9px; background: linear-gradient(180deg, #4d93ff, #2a66e0); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.2), inset 0 0 0 2px rgba(255, 255, 255, 0.22); }
.box-lid::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 14px; transform: translateX(-50%); background: linear-gradient(180deg, #ffe08a, #f5b52a); }
.box-lid::after { content: ""; position: absolute; left: 50%; top: -14px; width: 30px; height: 16px; transform: translateX(-50%); border: 5px solid #ffd66b; border-bottom: 0; border-radius: 16px 16px 0 0; box-sizing: border-box; }
.box-gem { position: relative; width: 26px; height: 26px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45)); }
.box-card .box-art { animation: box-idle 3s ease-in-out infinite; }

/* Opening: the box shakes, the lid pops off in a flash, then the prize card springs in */
dialog.box-reveal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 20px; border: 0; color: var(--ink); background: rgba(3, 8, 28, 0.84); backdrop-filter: blur(6px); --prize-glow: rgba(124, 200, 255, 0.55); }
dialog.box-reveal:not([open]) { display: none; }
dialog.box-reveal > * { grid-area: 1 / 1; }
.box-reveal.tier-gradient { --prize-glow: rgba(190, 120, 255, 0.8); }
.box-reveal.tier-legendary { --prize-glow: rgba(255, 196, 61, 0.95); }
.box-stage { animation: box-stage-out 0.2s ease 1.6s forwards; }
.box-art-big { width: 150px; height: 144px; transform-origin: 50% 100%; animation: box-shake 1.3s ease-in 0.25s both; }
.box-art-big .box-body { left: 10px; right: 10px; height: 96px; border-radius: 14px 14px 20px 20px; }
.box-art-big .box-body::before, .box-art-big .box-lid::before { width: 22px; }
.box-art-big .box-lid { top: 22px; height: 38px; border-radius: 12px; animation: box-lid-pop 0.45s ease-out 1.5s forwards; }
.box-art-big .box-lid::after { top: -22px; width: 46px; height: 24px; border-width: 7px; }
.box-art-big .box-gem { width: 40px; height: 40px; }
.box-burst { width: 60px; height: 60px; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, #fff 0%, var(--prize-glow) 40%, transparent 70%); opacity: 0; animation: box-burst 0.8s ease-out 1.55s forwards; }
.box-prize { display: flex; flex-direction: column; align-items: center; gap: 10px; width: min(440px, 100%); padding: 26px 24px 22px; border-radius: var(--radius-lg); text-align: center; background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05)), #0b1f5c; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 30px 80px -20px rgba(0, 0, 0, 0.8), 0 0 70px -6px var(--prize-glow); opacity: 0; transform: scale(0.6); animation: box-prize-in 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) 1.75s forwards; }
.box-prize .swatch { align-self: stretch; }
.box-prize-kicker { margin: 0; font-size: 13px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.box-reveal.tier-legendary .box-prize-kicker { color: #ffd66b; }
.box-prize-name { margin: 2px 0 0; font-size: 30px; font-weight: 800; line-height: 1.1; }
.box-prize-note { margin: 0; color: var(--ink-soft); }
.box-prize-actions { justify-content: center; margin-top: 6px; }
.box-prize-actions form { margin: 0; }

@keyframes box-idle { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-4px) rotate(-2deg); } }
@keyframes box-shake {
  0% { transform: rotate(0); }
  15% { transform: rotate(-3deg); }
  30% { transform: rotate(3deg); }
  45% { transform: translateY(-2px) rotate(-5deg); }
  60% { transform: translateY(-4px) rotate(5deg); }
  75% { transform: translateY(-6px) rotate(-8deg) scale(1.04); }
  90% { transform: translateY(-8px) rotate(8deg) scale(1.08); }
  100% { transform: translateY(-10px) rotate(0) scale(1.12); }
}
@keyframes box-lid-pop { to { transform: translateY(-130px) rotate(-35deg); opacity: 0; } }
@keyframes box-burst { 0% { opacity: 1; transform: scale(0.4); } 100% { opacity: 0; transform: scale(10); } }
@keyframes box-stage-out { to { opacity: 0; visibility: hidden; } }
@keyframes box-prize-in { to { opacity: 1; transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .box-stage, .box-burst { display: none; }
  .box-prize { opacity: 1; transform: none; animation: none; }
  .box-card .box-art { animation: none; }
}
@media (max-width: 560px) {
  .box-card { flex-direction: column; align-items: flex-start; gap: 16px; padding: 20px; }
}

/* Opening a theme box: a Counter-Strike style reel scrolls past the gold marker and stops on the prize,
   then the prize card appears under it. "Skip" (a hidden checkbox) jumps straight to the end. */
dialog.box-reveal { overflow-y: auto; }
.box-reveal-inner { display: flex; flex-direction: column; align-items: center; gap: 18px; width: min(920px, 100%); }
.reel { position: relative; width: 100%; height: 150px; flex-shrink: 0; overflow: hidden; border-radius: 16px; background: rgba(0, 0, 0, 0.35); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14); -webkit-mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent); mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent); }
.reel::before { content: ""; position: absolute; z-index: 2; top: 0; bottom: 0; left: 50%; width: 3px; transform: translateX(-50%); background: #ffd66b; box-shadow: 0 0 14px rgba(255, 214, 107, 0.9); }
.reel::after { content: ""; position: absolute; z-index: 2; top: 0; left: 50%; transform: translateX(-50%); border: 10px solid transparent; border-top-color: #ffd66b; }
.reel-strip { position: absolute; top: 12px; left: 50%; display: flex; gap: 8px; will-change: transform; animation: reel-spin 5.6s cubic-bezier(0.08, 0.6, 0.12, 1) 0.3s both; }
.reel-tile { --tile-tier: #5fc4ff; flex: 0 0 128px; height: 126px; box-sizing: border-box; display: flex; flex-direction: column; gap: 8px; padding: 8px 8px 12px; border-radius: 10px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), inset 0 -4px 0 var(--tile-tier); }
.reel-tile.tier-gradient { --tile-tier: #b779ff; }
.reel-tile.tier-legendary { --tile-tier: #ffc43d; }
.reel-tile .swatch { display: block; flex: 1; height: auto; min-height: 0; border-radius: 7px; }
.reel-name { font-size: 13.5px; font-weight: 800; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reel-tile.is-win { animation: reel-win 0.5s ease 5.9s both; }
.box-reveal .box-prize { animation: box-prize-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) 6.1s forwards; }
.reel-skip { align-self: flex-end; margin-top: -10px; font-size: 13.5px; font-weight: 800; color: var(--ink-muted); cursor: pointer; animation: reel-skip-out 0.2s ease 5.9s forwards; }
.reel-skip:hover { color: #fff; text-decoration: underline; }
.reel-skip-input:focus-visible ~ .reel-skip { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.reel-skip-input:checked ~ .reel .reel-strip { animation: none; transform: translateX(var(--reel-stop)); }
.reel-skip-input:checked ~ .reel .is-win { animation-delay: 0s; }
.reel-skip-input:checked ~ .reel-skip { display: none; }
.reel-skip-input:checked ~ .box-prize { animation-delay: 0s; }
@keyframes reel-spin { from { transform: translateX(var(--reel-start)); } to { transform: translateX(var(--reel-stop)); } }
@keyframes reel-win { to { background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.08)); box-shadow: inset 0 0 0 2px var(--tile-tier), inset 0 -4px 0 var(--tile-tier), 0 0 28px var(--tile-tier); } }
@keyframes reel-skip-out { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  .reel-strip { animation: none; transform: translateX(var(--reel-stop)); }
  .reel-tile.is-win, .box-reveal .box-prize { animation-delay: 0s; animation-duration: 0.01s; }
  .reel-skip { display: none; }
}

/* Reel start and stop positions (128px tiles, 8px gap): it starts 6 tiles in and stops inside tile 40 */
.reel-strip { --reel-start: -816px; --reel-stop: -5504px; }
.reel-stop-1 { --reel-stop: -5460px; }
.reel-stop-2 { --reel-stop: -5472px; }
.reel-stop-3 { --reel-stop: -5484px; }
.reel-stop-4 { --reel-stop: -5496px; }
.reel-stop-5 { --reel-stop: -5508px; }
.reel-stop-6 { --reel-stop: -5520px; }
.reel-stop-7 { --reel-stop: -5532px; }
.reel-stop-8 { --reel-stop: -5544px; }

/* Quiz questions can show a picture (a chart or a table) above the answers */
.quiz-figure { margin: 6px 0 18px; }
.quiz-figure a { display: block; overflow: hidden; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 1px var(--line), 0 14px 30px -18px rgba(0, 0, 0, 0.7); }
.quiz-figure img { display: block; width: 100%; height: auto; }
.quiz-figure figcaption { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--ink-muted); }
.review-item .quiz-figure { max-width: 560px; }

/* ---------------------------------------------------------------------------
   Research (admins only)
   --------------------------------------------------------------------------- */
.rs-plus { display: inline-grid; place-items: center; flex: none; width: 56px; height: 56px; border-radius: 50%; font-size: 36px; font-weight: 800; line-height: 1; color: #fff; background: var(--blue); box-shadow: 0 4px 0 var(--blue-deep); transition: transform 0.15s ease; }

.rs-new { border: 2px dashed rgba(var(--accent-rgb), 0.42); border-radius: var(--radius-lg); background: rgba(var(--accent-rgb), 0.05); }
.rs-new:not([open]):hover { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.1); }
.rs-new[open] { border-style: solid; border-color: rgba(255, 255, 255, 0.16); background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04)); }
.rs-new-toggle { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 190px; padding: 22px; border-radius: var(--radius-lg); font-size: 19px; font-weight: 800; color: var(--accent-soft); cursor: pointer; list-style: none; }
.rs-new-toggle::-webkit-details-marker { display: none; }
.rs-new-toggle:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--blue-hover), 0 0 0 4px rgba(var(--blue-rgb), 0.35); }
.rs-new[open] .rs-new-toggle { flex-direction: row; justify-content: flex-start; min-height: 0; padding: 18px 22px 4px; }
.rs-new[open] .rs-plus { width: 36px; height: 36px; font-size: 26px; transform: rotate(45deg); }
.rs-new-form { display: grid; gap: 12px; padding: 10px 22px 22px; }
.rs-new-form .field { margin: 0; }
.rs-new-form .alert { margin: 0; }
.rs-new-btn { width: 100%; margin-top: 4px; }

.rs-card .qn-card-time { margin-top: auto; }
.rs-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 0; padding: 0; list-style: none; }
.rs-tags li { max-width: 100%; padding: 2px 10px; border-radius: 999px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 700; color: var(--accent-soft); background: rgba(var(--accent-rgb), 0.1); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.28); }
.rs-tags .rs-tag-more { color: var(--ink-muted); background: none; box-shadow: inset 0 0 0 1px var(--line); }

.rs-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; margin: 6px 0 14px; }
.rs-toolbar-title { margin: 0; font-size: 24px; font-weight: 800; scroll-margin-top: 20px; }
.rs-toolbar-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.rs-empty p { margin: 0; color: var(--ink-soft); }
.rs-notes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.rs-note { min-width: 0; padding: 14px 18px 18px; scroll-margin-top: 24px; }
.rs-note-head { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.rs-note-title { flex: 1; width: 0; min-width: 0; margin-left: -10px; padding: 6px 10px; border: 0; border-radius: 10px; font: 800 21px/1.25 var(--font); color: #fff; background: transparent; box-shadow: inset 0 0 0 1px transparent; transition: box-shadow 0.15s ease, background-color 0.15s ease; }
.rs-note-title::placeholder { color: rgba(255, 255, 255, 0.34); }
.rs-note-title:hover { box-shadow: inset 0 0 0 1px var(--line); }
.rs-note-title:focus { outline: none; background: var(--field); box-shadow: inset 0 0 0 2px var(--blue-hover), 0 0 0 4px rgba(var(--blue-rgb), 0.28); }
.rs-note-del { flex: none; padding: 7px 12px; border: 0; border-radius: 10px; font: 700 14px/1.2 var(--font); color: var(--ink-muted); background: transparent; cursor: pointer; transition: color 0.15s ease, background-color 0.15s ease; }
.rs-note-del:hover, .rs-note-del:focus-visible { outline: none; color: var(--danger); background: rgba(255, 122, 122, 0.12); }
.rs-note-del.is-armed { color: #fff; background: #c93a3a; }
.rs-note-body { min-height: 120px; }

.rs-add { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; margin-top: 16px; padding: 14px; border: 2px dashed rgba(var(--accent-rgb), 0.42); border-radius: var(--radius-lg); font: 800 18px/1.2 var(--font); color: var(--accent-soft); background: rgba(var(--accent-rgb), 0.05); cursor: pointer; transition: background-color 0.15s ease, border-color 0.15s ease; }
.rs-add:hover { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.1); }
.rs-add:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--blue-hover), 0 0 0 4px rgba(var(--blue-rgb), 0.35); }
.rs-add .rs-plus { width: 38px; height: 38px; font-size: 27px; }

.rs-card-cover { display: block; width: calc(100% + 44px); height: 150px; margin: -22px -22px 4px; object-fit: cover; border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: rgba(var(--shade-rgb), 0.5); }

.rs-images-head { margin-top: 34px; }
.rs-images-head .qn-count { vertical-align: 4px; }
.rs-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.rs-image { min-width: 0; display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 10px; scroll-margin-top: 24px; }
.rs-image-link { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 12px; background: rgba(var(--shade-rgb), 0.5); }
.rs-image-link img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s ease; }
.rs-image-link:hover img { transform: scale(1.03); }
.rs-image-link:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--blue-hover); }
.rs-image-row { display: flex; align-items: center; gap: 6px; }
.rs-caption { flex: 1; width: 0; min-width: 0; padding: 8px 10px; font-size: 14.5px; }

.rs-upload { margin-top: 16px; }
.rs-drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px 18px; border: 2px dashed rgba(var(--accent-rgb), 0.42); border-radius: var(--radius-lg); text-align: center; color: var(--accent-soft); background: rgba(var(--accent-rgb), 0.05); cursor: pointer; transition: background-color 0.15s ease, border-color 0.15s ease; }
.rs-drop:hover, .rs-drop.is-over { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.12); }
.rs-drop:focus-within { border-color: var(--blue-hover); box-shadow: 0 0 0 4px rgba(var(--blue-rgb), 0.28); }
.rs-drop.is-busy { cursor: progress; opacity: 0.75; }
.rs-drop .rs-plus { width: 38px; height: 38px; font-size: 27px; }
.rs-drop-title { font-size: 18px; font-weight: 800; }
.rs-drop-hint { max-width: 520px; font-size: 14.5px; line-height: 1.4; color: var(--ink-muted); }
.rs-drop-status { font-size: 14.5px; font-weight: 700; color: var(--ink-soft); }
.rs-drop-status:empty { display: none; }
.rs-drop-status.is-error { color: var(--danger); }
.rs-upload-btn { margin-top: 10px; }
.rs-upload.has-js .rs-upload-btn { display: none; }

@media (max-width: 560px) {
  .rs-new-toggle { min-height: 150px; }
  .rs-note { padding: 12px 14px 14px; }
  .rs-note-title { font-size: 19px; }
  .rs-toolbar-actions { width: 100%; justify-content: space-between; }
  .rs-toolbar-actions .qn-status { flex-basis: auto; order: 0; }
  .rs-gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .rs-image { padding: 8px; }
  .rs-image-row { flex-wrap: wrap; gap: 4px; }
  .rs-caption { flex: 1 1 100%; }
  .rs-image-row .rs-note-del { margin-left: auto; padding: 5px 10px; }
}

/* Research notes: formatted text (Markdown) and the style toolbar */
.rs-note.has-md:not(.is-editing) .rs-note-body { display: none; }
.rs-note.is-editing .rs-md { display: none; }
.rs-md-bar { display: none; }
.rs-note.is-editing .rs-md-bar { position: sticky; top: 8px; z-index: 2; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin: 0 0 8px; padding: 6px; border-radius: 12px; background: #13256b; box-shadow: inset 0 0 0 1px var(--line), 0 8px 18px -10px rgba(0, 0, 0, 0.6); }
.rs-md-btn { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border: 0; border-radius: 8px; font: 700 16px/1 var(--font); color: var(--ink-soft); background: transparent; cursor: pointer; transition: background-color 0.12s ease, color 0.12s ease; }
.rs-md-btn:hover, .rs-md-btn:focus-visible { outline: none; color: #fff; background: rgba(255, 255, 255, 0.12); }
.rs-md-btn b { font-weight: 900; }
.rs-md-btn i { font-family: Georgia, serif; font-size: 17px; }
.rs-md-btn s { text-decoration-thickness: 2px; }
.rs-md-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rs-md-btn svg circle { fill: currentColor; stroke: none; }
.rs-md-btn svg text { fill: currentColor; stroke: none; font: 800 5.5px/1 var(--font); }
.rs-md-btn svg .rs-ic-soft { opacity: 0.45; }
.rs-ic-mark { padding: 1px 5px; border-radius: 4px; color: #2a1c00; background: #ffd66b; }
.rs-ic-h small { font-size: 11px; opacity: 0.7; }
.rs-md-sep { width: 1px; height: 22px; margin: 0 4px; background: var(--line); }
.rs-md-hint { margin-left: auto; padding: 0 6px; font-size: 13px; font-weight: 700; color: var(--ink-muted); }
.rs-md-done { padding: 7px 12px; border: 0; border-radius: 8px; font: 800 14px/1.2 var(--font); color: #fff; background: var(--blue); cursor: pointer; }
.rs-md-done:hover, .rs-md-done:focus-visible { outline: none; background: var(--blue-hover); }

.rs-md { min-height: 48px; padding: 10px 13px; border-radius: 11px; font-size: 16px; line-height: 1.55; color: var(--ink); overflow-wrap: anywhere; background: rgba(var(--shade-rgb), 0.22); box-shadow: inset 0 0 0 1px transparent; cursor: text; transition: box-shadow 0.15s ease, background-color 0.15s ease; }
.rs-md:hover { box-shadow: inset 0 0 0 1px var(--line); }
.rs-md:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--blue-hover), 0 0 0 4px rgba(var(--blue-rgb), 0.28); }
.rs-md > :first-child { margin-top: 0; }
.rs-md > :last-child { margin-bottom: 0; }
.rs-md p { margin: 0 0 10px; }
.rs-md .rs-md-empty { color: var(--ink-muted); font-style: italic; }
.rs-md h3, .rs-md h4, .rs-md h5 { margin: 16px 0 6px; font-weight: 800; line-height: 1.25; }
.rs-md .rs-md-h1 { font-size: 21px; }
.rs-md .rs-md-h2 { font-size: 18.5px; }
.rs-md .rs-md-h3 { font-size: 16px; color: var(--accent-soft); letter-spacing: 0.02em; }
.rs-md ul, .rs-md ol { margin: 0 0 10px; padding-left: 26px; }
.rs-md li { margin: 2px 0; }
.rs-md li > ul, .rs-md li > ol { margin: 2px 0 4px; }
.rs-md ol > li::marker { font-weight: 700; color: var(--accent); }
.rs-md ul > li::marker { color: var(--accent); }
.rs-md .rs-md-task { list-style: none; margin-left: -22px; }
.rs-md .rs-md-task label { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.rs-md .rs-md-task input { flex: none; width: 17px; height: 17px; margin: 4px 0 0; accent-color: var(--blue); cursor: pointer; }
.rs-md .rs-md-task.is-done span { color: var(--ink-muted); text-decoration: line-through; }
.rs-md strong { font-weight: 800; color: #fff; }
.rs-md del { color: var(--ink-muted); text-decoration-thickness: 2px; }
.rs-md mark { padding: 0 3px; border-radius: 4px; color: #2a1c00; background: #ffd66b; }
.rs-md a { font-weight: 700; text-decoration: underline; text-decoration-color: rgba(var(--accent-rgb), 0.45); text-underline-offset: 2px; }
.rs-md code { padding: 1px 6px; border-radius: 6px; font: 500 14.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #d6ecff; background: rgba(var(--shade-rgb), 0.6); box-shadow: inset 0 0 0 1px var(--line); }
.rs-md pre { margin: 0 0 10px; padding: 12px 14px; overflow-x: auto; border-radius: 10px; background: rgba(var(--shade-rgb), 0.6); box-shadow: inset 0 0 0 1px var(--line); }
.rs-md pre code { padding: 0; background: none; box-shadow: none; white-space: pre; }
.rs-md blockquote { margin: 0 0 10px; padding: 4px 0 4px 14px; border-left: 3px solid var(--accent); color: var(--ink-soft); }
.rs-md blockquote p { margin-bottom: 6px; }
.rs-md hr { height: 0; margin: 14px 0; border: 0; border-top: 1px solid var(--line); }

@media (max-width: 560px) {
  .rs-note.is-editing .rs-md-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .rs-note.is-editing .rs-md-bar::-webkit-scrollbar { display: none; }
  .rs-md-hint { display: none; }
  .rs-md-done { margin-left: auto; }
  .rs-md { padding: 9px 11px; }
}

/* Research: drag to reorder (cards on the list page, notes on an entry page) */
.rs-list-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; margin: 40px 0 14px; }
.rs-list-head .section-title { margin: 0; }
.rs-card-wrap { position: relative; display: flex; min-width: 0; }
.rs-card-wrap > .rs-card { flex: 1; min-width: 0; }
.rs-drag { display: none; place-items: center; flex: none; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 9px; color: var(--ink-soft); background: rgba(var(--shade-rgb), 0.7); box-shadow: inset 0 0 0 1px var(--line); cursor: grab; touch-action: none; opacity: 0; transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease; }
.has-sort .rs-drag { display: inline-grid; }
.rs-drag svg { width: 16px; height: 16px; fill: currentColor; }
.rs-drag:hover { color: #fff; background: var(--blue); }
.rs-drag:focus-visible { outline: none; opacity: 1; color: #fff; background: var(--blue); box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.45); }
.rs-card-wrap > .rs-drag { position: absolute; top: 10px; right: 10px; z-index: 1; }
.rs-card-wrap:hover > .rs-drag, .rs-note:hover .rs-drag { opacity: 1; }
.rs-note { position: relative; }
.rs-note-head .rs-drag { position: absolute; top: 15px; left: -16px; z-index: 1; }
.rs-slot { min-height: 60px; border: 2px dashed rgba(var(--accent-rgb), 0.5); border-radius: var(--radius-lg); background: rgba(var(--accent-rgb), 0.06); }
.is-dragging { position: fixed; z-index: 60; margin: 0; pointer-events: none; }
.rs-card-wrap.is-dragging > .rs-card, .rs-note.is-dragging { background: linear-gradient(180deg, #1d3688, #152b72); box-shadow: inset 0 0 0 2px var(--accent), 0 30px 60px -18px rgba(0, 0, 0, 0.85); }
.rs-card-wrap.is-dragging > .rs-card { transform: rotate(1.2deg); }
.is-dragging .rs-drag { opacity: 1; color: #fff; background: var(--blue); }
body.rs-sorting, body.rs-sorting * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
@media (hover: none) { .rs-drag { opacity: 0.85; } }

/* Search bars (Research, Projects, Quizzes) */
.search-nojs { display: none !important; }
.is-search-hidden { display: none !important; }
.search-empty[hidden] { display: none; }
.search-empty { margin: 0 0 18px; }
.search-empty p { margin: 0; color: var(--ink-soft); }
.search-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.search-field { position: relative; display: block; flex: 1 1 260px; min-width: 0; }
.search-field svg { position: absolute; top: 50%; left: 13px; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--ink-muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search-input { display: block; width: 100%; min-height: 42px; padding: 9px 38px 9px 40px; border: 0; border-radius: 12px; font: 600 15.5px/1.3 var(--font); color: #fff; background: var(--field); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow 0.15s ease; }
.search-input::placeholder { color: rgba(255, 255, 255, 0.42); font-weight: 500; }
.search-input:hover { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28); }
.search-input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--blue-hover), 0 0 0 4px rgba(var(--blue-rgb), 0.28); }
.search-input::-webkit-search-cancel-button { cursor: pointer; filter: grayscale(1) brightness(1.9); opacity: 0.8; }
.search-key { position: absolute; top: 50%; right: 10px; min-width: 22px; padding: 1px 6px; border-radius: 6px; transform: translateY(-50%); font: 800 12.5px/1.5 var(--font); text-align: center; color: var(--ink-muted); box-shadow: inset 0 0 0 1px var(--line); pointer-events: none; }
.search-input:focus ~ .search-key, .search-input:not(:placeholder-shown) ~ .search-key { display: none; }
.search-count { font-size: 14px; font-weight: 700; color: var(--ink-muted); white-space: nowrap; }
.search-count:empty { display: none; }
.rs-search { flex: 0 1 420px; margin-left: auto; }
.is-searching .rs-drag { display: none !important; }
.is-searching [data-rs="order-status"] { display: none; }
.qn-search { max-width: 520px; margin: -8px 0 6px; }
.list-control.quiz-search { flex: 1 1 260px; }
.list-control.quiz-search .search-field { flex: 1 1 auto; min-width: 200px; }
@media (max-width: 560px) {
  .rs-search { flex-basis: 100%; margin-left: 0; }
  .qn-search { max-width: none; }
}

/* Research list: one thin row per game */
.rs-adder { margin: 0 0 8px; border: 2px dashed rgba(var(--accent-rgb), 0.42); border-radius: 14px; background: rgba(var(--accent-rgb), 0.05); transition: background-color 0.15s ease, border-color 0.15s ease; }
.rs-adder:not([open]):hover { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.1); }
.rs-adder[open] { border-style: solid; border-color: rgba(255, 255, 255, 0.16); background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035)); }
.rs-adder-toggle { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 14px; border-radius: 12px; font-size: 16px; font-weight: 800; color: var(--accent-soft); cursor: pointer; list-style: none; }
.rs-adder-toggle::-webkit-details-marker { display: none; }
.rs-adder-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.45); }
.rs-adder .rs-plus { width: 30px; height: 30px; font-size: 22px; box-shadow: 0 3px 0 var(--blue-deep); }
.rs-adder[open] .rs-plus { transform: rotate(45deg); }
.rs-adder .rs-new-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; align-items: end; gap: 10px 12px; padding: 0 14px 14px; }
.rs-adder .rs-new-form .alert { grid-column: 1 / -1; margin: 0; }
.rs-adder .rs-new-form .field { margin: 0; }
.rs-adder .rs-new-form .field input { padding: 10px 12px; }
.rs-adder .rs-new-btn { width: auto; min-height: 43px; margin: 0; padding: 10px 24px; }

.rs-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.rs-row { position: relative; display: flex; min-width: 0; }
.rs-row.is-dragging { position: fixed; }
.rs-row-link { display: flex; flex: 1; align-items: center; gap: 14px; min-width: 0; min-height: 50px; padding: 7px 16px 7px 42px; border-radius: 12px; color: var(--ink); text-decoration: none; background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); transition: box-shadow 0.15s ease, background-color 0.15s ease; }
.rs-row-link:hover { text-decoration: none; background-color: rgba(255, 255, 255, 0.03); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.55); }
.rs-row-link:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--blue-hover), 0 0 0 4px rgba(var(--blue-rgb), 0.3); }
.rs-row-thumb { display: grid; flex: none; place-items: center; width: 34px; height: 34px; overflow: hidden; border-radius: 9px; font-size: 15px; font-weight: 800; color: var(--accent-soft); background: rgba(var(--accent-rgb), 0.14); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.3); }
.rs-row-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.rs-row-name { display: flex; flex: 1 1 auto; align-items: baseline; gap: 12px; min-width: 0; overflow: hidden; }
.rs-row-title { flex: 0 0 auto; min-width: 0; max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16.5px; font-weight: 800; }
.rs-row-url { flex: 0 10 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 600; color: var(--accent); }
.rs-row-tags { display: flex; flex: none; gap: 5px; }
.rs-tag { flex: none; max-width: 150px; padding: 1px 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: var(--accent-soft); background: rgba(var(--accent-rgb), 0.1); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.25); }
.rs-tag.rs-tag-more { color: var(--ink-muted); background: none; box-shadow: inset 0 0 0 1px var(--line); }
.rs-row-count { flex: none; width: 124px; text-align: right; white-space: nowrap; font-size: 13.5px; font-weight: 700; color: var(--ink-soft); }
.rs-row-time { flex: none; width: 190px; overflow: hidden; text-align: right; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--ink-muted); }
.rs-row > .rs-drag { position: absolute; top: 50%; left: 7px; z-index: 1; width: 28px; height: 28px; margin-top: -14px; }
.rs-row:hover > .rs-drag { opacity: 1; }
.rs-row.is-dragging > .rs-row-link { background: linear-gradient(180deg, #1d3688, #152b72); box-shadow: inset 0 0 0 2px var(--accent), 0 24px 44px -16px rgba(0, 0, 0, 0.85); }
.rs-list .rs-slot { min-height: 0; border-radius: 12px; list-style: none; }

@media (max-width: 1000px) { .rs-row-tags { display: none; } }
@media (max-width: 760px) { .rs-row-time { display: none; } }
@media (max-width: 560px) {
  .rs-list-head .qn-status { flex-basis: auto; order: 0; }
  .rs-row-link { gap: 10px; padding: 7px 12px 7px 42px; }
  .rs-row-name { flex-direction: column; align-items: flex-start; gap: 0; }
  .rs-row-title { max-width: 100%; font-size: 15.5px; }
  .rs-row-url { max-width: 100%; font-size: 12.5px; }
  .rs-row-count { width: auto; font-size: 12.5px; }
  .rs-adder .rs-new-form { grid-template-columns: 1fr; }
  .rs-adder .rs-new-btn { width: 100%; }
}

/* Projects and Quizzes as thin rows (shares the Research row look) */
.qn-list .rs-row-link, .qz-list .rs-row-link { padding-left: 12px; }
.qn-row .qn-decision { padding: 2px 10px; font-size: 12.5px; }
.qn-row-phases { display: flex; flex: none; gap: 4px; }
.qn-row-phase { position: relative; width: 24px; height: 8px; overflow: hidden; border-radius: 999px; background: rgba(var(--shade-rgb), 0.55); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.qn-row-phase > span { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--accent)); }
.qn-row-phase > span.qn-p-20 { background: linear-gradient(90deg, #2fbf7f, var(--success)); }
.qn-row-phase.is-unstarted { opacity: 0.5; }
.qn-row-phase.is-current { opacity: 1; box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 2px rgba(var(--accent-rgb), 0.3); }
html.theme-rainbow .qn-row-phase > span { background-image: linear-gradient(90deg, #ff4d6d, #ffb84d, #ffe14d, #4dd98a, #4db8ff, #a56bff); }
.qn-row .qn-row-current { width: 150px; }
.qn-row .rs-row-time { width: 200px; }
.qn-row .qn-row-current strong { color: var(--ink); }

.quizzes .quiz-list-tools { margin-bottom: 16px; }
.qz-row-title { color: #fff; text-decoration: none; }
.qz-row-title:hover { color: #fff; text-decoration: none; }
.qz-row-title::after { content: ""; position: absolute; inset: 0; z-index: 0; border-radius: 12px; }
.qz-row-title:focus-visible { outline: none; }
.qz-row-title:focus-visible::after { box-shadow: inset 0 0 0 2px var(--blue-hover), 0 0 0 4px rgba(var(--blue-rgb), 0.3); }
.qz-row .rs-row-title { max-width: 100%; }
.qz-row-tags a, .qz-row-action { position: relative; z-index: 1; }
.qz-row-tags a.rs-tag:hover { color: #fff; text-decoration: none; background: rgba(var(--accent-rgb), 0.24); }
.qz-row-tags .qz-tag-meta { max-width: 180px; color: #ffe08a; background: rgba(255, 224, 138, 0.08); box-shadow: inset 0 0 0 1px rgba(255, 224, 138, 0.32); }
.qz-row-tags a.qz-tag-meta:hover { color: #fff3c4; background: rgba(255, 224, 138, 0.18); }
.qz-row-size { flex: none; width: 160px; text-align: right; white-space: nowrap; font-size: 13.5px; font-weight: 600; color: var(--ink-muted); }
.qz-row-score { flex: none; width: 170px; overflow: hidden; text-align: right; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 700; color: var(--ink-soft); }
.qz-row-score strong { color: var(--ink); }
.qz-row-going, .qz-row-going strong { color: var(--accent-soft); }
.qz-row-new { font-weight: 600; color: var(--ink-muted); }
.qz-row-action { flex: none; width: 126px; }
.qz-row-action form { display: flex; }
.qz-row-action .btn { width: 100%; padding: 7px 12px; font-size: 14px; border-radius: 10px; white-space: nowrap; }
.qz-row-action .btn-primary { box-shadow: 0 3px 0 var(--blue-deep); }
.qz-row-action .btn-primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--blue-deep); }
.qz-row-action .btn-soft { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24), 0 3px 0 rgba(var(--shade-rgb), 0.6); }
.qz-row-action .btn-soft:active { transform: translateY(2px); }

@media (min-width: 861px) {
  .quiz-list-tools .list-controls { flex-wrap: nowrap; width: 100%; }
  .quiz-list-tools .list-control { flex: 0 1 auto; min-width: 0; white-space: nowrap; }
  .quiz-list-tools .list-control select { flex: 0 1 auto; min-width: 0; max-width: 250px; }
  .quiz-list-tools .btn, .quiz-list-tools .list-clear { flex: none; white-space: nowrap; }
}
@media (max-width: 1000px) { .qz-row-size { width: auto; } }
@media (max-width: 860px) { .qn-row-phases { display: none; } .qz-row-size { display: none; } }
@media (max-width: 560px) {
  .qn-list .rs-row-link, .qz-list .rs-row-link { padding: 8px 12px; }
  .qn-row .rs-row-link { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 5px 10px; }
  .qn-row .rs-row-thumb { grid-column: 1; grid-row: 1 / span 2; }
  .qn-row .rs-row-name { grid-column: 2; grid-row: 1; }
  .qn-row .rs-row-url { display: none; }
  .qn-row .qn-decision { grid-column: 3; grid-row: 1; justify-self: end; }
  .qn-row .qn-row-phases { display: flex; grid-column: 2; grid-row: 2; }
  .qn-row .qn-row-phase { flex: 1 1 0; width: auto; height: 6px; }
  .qn-row .qn-row-current { grid-column: 3; grid-row: 2; width: auto; font-size: 12px; }
  .qz-row-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; }
  .qz-row .rs-row-name { grid-column: 1; grid-row: 1; }
  .qz-row .rs-row-title { max-width: 100%; }
  .qz-row-score { grid-column: 1; grid-row: 2; width: auto; text-align: left; font-size: 12.5px; }
  .qz-row-action { grid-column: 2; grid-row: 1 / span 2; align-self: center; width: auto; }
  .qz-row-action .btn { padding: 7px 12px; font-size: 13.5px; }
  .quiz-list-tools { width: 100%; }
  .quiz-list-tools .list-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; gap: 8px 10px; }
  .quiz-list-tools .list-control { flex-direction: column; align-items: stretch; gap: 3px; width: auto; min-width: 0; }
  .quiz-list-tools .list-control > span { min-width: 0; font-size: 12.5px; }
  .quiz-list-tools .list-control select { width: 100%; min-width: 0; }
  .quiz-list-tools .btn { min-height: 42px; }
  .quiz-list-tools .list-clear { align-self: center; justify-self: start; }
}
/* Quiz rows: the title takes its full width first; chips use what is left, and any that don't fit drop out whole */
.qz-row .rs-row-name { flex: 0 1 auto; }
.qz-row-tags { flex: 1 1 0; flex-wrap: wrap; justify-content: flex-end; min-width: 0; height: 21px; row-gap: 12px; overflow: hidden; container-type: inline-size; }
.qz-row-tags .rs-tag { flex: 0 1 auto; min-width: 0; }
@container (max-width: 64px) { .qz-row-tags > * { visibility: hidden; } }
@media (min-width: 861px) { .quiz-list-tools label.list-control:nth-last-of-type(-n+2), .quiz-list-tools label.list-control:nth-last-of-type(-n+2) select { flex-shrink: 0; } }
/* Quiz filters stretch to the full width of the quiz list (Apply lines up with the rows' right edge) */
@media (min-width: 561px) {
  .quiz-list-tools .list-controls { width: 100%; }
  .quiz-list-tools .list-control { flex: 1 1 auto; }
  .quiz-list-tools .list-control select { flex: 1 1 auto; max-width: none; }
}

/* Projects: your own rows make room for the drag handle once dragging is switched on */
.qn-list.has-sort .rs-row-link { padding-left: 42px; }

/* ==========================================================================
   Daily rewards (/daily) and the shared reward effects (assets/fx.js)
   ========================================================================== */
.daily-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.daily-icon .fill { fill: currentColor; stroke: none; }

/* Header: on narrower screens the buttons wrap onto a second row instead of running off the page */
.nav { flex-wrap: wrap; justify-content: flex-end; row-gap: 10px; min-width: 0; }

/* Home page block */
.daily { max-width: 1060px; margin: 30px 0 34px; scroll-margin-top: 16px; }
.daily-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 0 0 16px; }
.daily-title { margin: 0; font-size: 26px; font-weight: 800; line-height: 1.15; }
.daily-sub { margin: 4px 0 0; font-size: 16px; color: var(--ink-soft); }
.daily-sound { display: inline-flex; align-items: center; gap: 8px; flex: none; margin-top: 4px; padding: 8px 14px 8px 11px; border: 0; border-radius: 999px; font: 700 14px/1.2 var(--font); color: var(--ink-soft); background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
.daily-sound:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }
.daily-sound[hidden] { display: none; }
.daily-sound .snd-off, .daily-sound.is-off .snd-on { display: none; }
.daily-sound.is-off .snd-off { display: inline; }
.daily-grid { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 22px; align-items: stretch; }

/* The gift */
.daily-gift { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 24px 24px 26px; border-radius: var(--radius-lg); text-align: center; overflow: hidden; background: radial-gradient(120% 80% at 50% 0%, rgba(var(--blue-rgb), 0.42), rgba(var(--blue-rgb), 0.08) 62%, rgba(255, 255, 255, 0.03)); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.62), 0 30px 70px -28px rgba(var(--blue-rgb), 0.95); }
.gift-art { position: relative; display: grid; place-items: center; width: 176px; height: 176px; }
.gift-art > * { grid-area: 1 / 1; }
.gift-rays { width: 176px; height: 176px; border-radius: 50%; background: repeating-conic-gradient(rgba(var(--accent-rgb), 0.34) 0deg 9deg, transparent 9deg 30deg); -webkit-mask-image: radial-gradient(circle, #000 18%, transparent 70%); mask-image: radial-gradient(circle, #000 18%, transparent 70%); animation: gift-spin 16s linear infinite; }
.gift-glow { width: 116px; height: 116px; border-radius: 50%; background: radial-gradient(circle, rgba(var(--accent-rgb), 0.8), rgba(var(--blue-rgb), 0.18) 55%, transparent 70%); animation: gift-breathe 2.6s ease-in-out infinite; }
.gift-gem { width: 94px; height: 94px; filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 14px rgba(95, 196, 255, 0.75)); animation: gift-bob 2.6s ease-in-out infinite; }
.gift-twinkle { width: 13px; height: 13px; background: #fff; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); opacity: 0; animation: gift-twinkle 2.4s ease-in-out infinite; }
.gift-twinkle-1 { translate: -62px -40px; animation-delay: 0.2s; }
.gift-twinkle-2 { width: 9px; height: 9px; translate: 60px -18px; animation-delay: 1s; }
.gift-twinkle-3 { width: 11px; height: 11px; translate: 38px 54px; animation-delay: 1.7s; }
.gift-title { margin: 0; font-size: 26px; font-weight: 800; line-height: 1.15; }
.gift-amount { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 19px; font-weight: 800; color: var(--accent-soft); }
.gift-amount .gem-icon { width: 22px; height: 22px; vertical-align: 0; }
.gift-ready, .gift-done { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.gift-ready form { width: 100%; margin: 0; }
.gift-note { margin: 0; font-size: 14px; color: var(--ink-muted); }
.daily-gift.is-ready .gift-done, .daily-gift.is-claimed .gift-ready, .daily-gift.is-opening .gift-done { display: none; }
.btn-claimed { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin: 0; padding: 16px 24px; font-size: 19px; color: var(--success); background: rgba(46, 204, 128, 0.12); box-shadow: inset 0 0 0 1px rgba(95, 224, 161, 0.45); cursor: default; pointer-events: none; }
.btn-claimed .daily-icon { stroke-width: 3; }

/* Collected: the card keeps its look and the claim button turns into a "Claimed" label */
.daily-gift.is-just-claimed .gift-gem { animation: gift-settle 0.9s cubic-bezier(0.2, 1.4, 0.4, 1) both, gift-bob 2.6s ease-in-out 0.9s infinite; }
.daily-gift.is-just-claimed .gift-done { animation: daily-fade-up 0.45s ease 0.5s both; }
/* Opening: the gem shakes harder and harder and the glow flares, then it bursts (fx.js) */
.daily-gift.is-opening .gift-gem { animation: gift-shake 0.52s ease-in both; }
.daily-gift.is-opening .gift-glow { animation: gift-flare 0.52s ease-in both; }
.daily-gift.is-opening .gift-rays { animation-duration: 1.2s; }

/* Claim buttons: a shine sweeps across them */
.btn-claim { position: relative; overflow: hidden; }
.btn-claim::after { content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 38%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.5), transparent); transform: skewX(-18deg); animation: claim-shine 2.6s ease-in-out infinite; pointer-events: none; }
.btn-claim:disabled { cursor: progress; }
.daily-gift .btn-claim { width: 100%; padding: 16px 24px; font-size: 19px; animation: claim-glow 2s ease-in-out infinite; }
.btn-claim-task { min-width: 92px; color: #05331d; background: var(--success); box-shadow: 0 4px 0 #2fa56f, 0 10px 22px -10px rgba(95, 224, 161, 0.9); }
.btn-claim-task:hover { background: #7df0b8; }
.btn-claim-task:active { transform: translateY(3px); box-shadow: 0 1px 0 #2fa56f; }

/* Tasks */
.daily-tasks { padding: 22px 24px; border-radius: var(--radius-lg); background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.13), 0 30px 70px -28px rgba(var(--blue-rgb), 0.95); }
.tasks-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 14px; }
.tasks-title { margin: 0; font-size: 22px; font-weight: 800; }
.daily-timer { display: inline-flex; align-items: center; gap: 7px; margin: 0; font-size: 14.5px; font-weight: 700; color: var(--ink-muted); }
.daily-timer .daily-icon { width: 17px; height: 17px; }
.daily-countdown { color: var(--ink); font-variant-numeric: tabular-nums; }
.daily.is-new-day .daily-countdown { color: var(--success); }
.task-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.task { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: rgba(var(--shade-rgb), 0.35); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); transition: background-color 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease; }
.task-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; color: var(--accent-soft); background: rgba(var(--blue-rgb), 0.28); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.35); transition: background-color 0.3s ease, color 0.3s ease; }
.task-icon .daily-icon { width: 24px; height: 24px; }
.task-body { min-width: 0; }
.task-title { margin: 0; font-size: 17.5px; font-weight: 800; line-height: 1.2; }
.task-text { margin: 2px 0 8px; font-size: 14.5px; line-height: 1.35; color: var(--ink-soft); }
.task-progress { display: flex; align-items: center; gap: 10px; }
.task-bar { flex: 1; max-width: 260px; }
.task-count { flex: none; font-size: 13.5px; font-weight: 800; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.task-reward { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px 4px 8px; border-radius: 999px; font-size: 15px; font-weight: 800; color: #d6efff; background: rgba(95, 196, 255, 0.12); box-shadow: inset 0 0 0 1px rgba(95, 196, 255, 0.4); }
.task-reward .gem-icon { width: 16px; height: 16px; vertical-align: 0; }
.task-action { display: flex; justify-content: flex-end; min-width: 96px; }
.task-action form { margin: 0; }
.task-claimed { display: inline-flex; align-items: center; gap: 6px; font-size: 14.5px; font-weight: 800; color: var(--success); }
.task-claimed[hidden] { display: none; }
.task-claimed .daily-icon { width: 18px; height: 18px; stroke-width: 3; }
.task.is-claimable { background: rgba(46, 204, 128, 0.1); box-shadow: inset 0 0 0 1px rgba(95, 224, 161, 0.6), 0 0 26px -8px rgba(95, 224, 161, 0.55); }
.task.is-claimable .task-icon { color: #05331d; background: var(--success); box-shadow: none; }
.task.is-claimable .task-bar > span, .task.is-claimed .task-bar > span { background: linear-gradient(90deg, #2fbf7f, var(--success)); }
.task.is-claimed { opacity: 0.7; }
.task.is-claimed .task-icon { color: var(--success); background: rgba(46, 204, 128, 0.14); box-shadow: inset 0 0 0 1px rgba(95, 224, 161, 0.45); }
.task.is-claimed .task-title { text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: rgba(95, 224, 161, 0.75); }
.task.is-claimed .task-reward { opacity: 0.6; }
.task.is-claiming { box-shadow: inset 0 0 0 2px var(--success), 0 0 40px -6px rgba(95, 224, 161, 0.9); }
.task.is-just-claimed { animation: task-done 0.9s ease both; }
.task.is-just-claimed .task-claimed { animation: daily-stamp 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.task-none { margin: 0; color: var(--ink-soft); }
.daily-total { display: flex; align-items: center; gap: 8px; margin: 16px 0 0; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 15px; font-weight: 700; color: var(--ink-soft); }
.daily-total strong { color: #fff; font-variant-numeric: tabular-nums; }
.daily-error { margin: 8px 0 0; font-size: 14px; font-weight: 700; color: #ffc4c4; }

@keyframes gift-spin { to { rotate: 360deg; } }
@keyframes gift-breathe { 0%, 100% { scale: 0.92; opacity: 0.75; } 50% { scale: 1.08; opacity: 1; } }
@keyframes gift-bob { 0%, 100% { translate: 0 0; rotate: -4deg; } 50% { translate: 0 -9px; rotate: 4deg; } }
@keyframes gift-twinkle { 0%, 100% { opacity: 0; scale: 0.3; } 45% { opacity: 1; scale: 1; } 60% { opacity: 0.9; scale: 0.8; } }
@keyframes gift-shake {
  0% { rotate: 0deg; scale: 1; }
  20% { rotate: -6deg; scale: 1.04; }
  40% { rotate: 7deg; scale: 1.08; }
  60% { rotate: -9deg; scale: 1.14; }
  80% { rotate: 10deg; scale: 1.2; }
  100% { rotate: 0deg; scale: 1.32; filter: brightness(1.8) drop-shadow(0 0 26px #fff); }
}
@keyframes gift-flare { to { scale: 1.6; opacity: 1; } }
@keyframes gift-settle { 0% { scale: 0.2; opacity: 0; } 60% { scale: 1.12; opacity: 1; } 100% { scale: 1; } }
@keyframes daily-stamp { 0% { scale: 2.2; opacity: 0; } 100% { scale: 1; opacity: 1; } }
@keyframes daily-fade-up { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }
@keyframes claim-shine { 0%, 55% { left: -60%; } 100% { left: 130%; } }
@keyframes claim-glow {
  0%, 100% { box-shadow: 0 5px 0 var(--blue-deep), 0 16px 26px -12px rgba(0, 0, 0, 0.55), 0 0 0 0 rgba(var(--accent-rgb), 0); }
  50% { box-shadow: 0 5px 0 var(--blue-deep), 0 16px 26px -12px rgba(0, 0, 0, 0.55), 0 0 26px 2px rgba(var(--accent-rgb), 0.55); }
}
@keyframes task-done { 0% { scale: 1; } 30% { scale: 1.025; } 100% { scale: 1; } }

@media (max-width: 860px) {
  .daily-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .daily-head { flex-direction: column; gap: 6px; }
  .daily-gift, .daily-tasks { padding: 20px 16px; }
  .task { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px 12px; padding: 12px; }
  .task-icon { width: 40px; height: 40px; border-radius: 11px; }
  .task-reward { grid-column: 3; grid-row: 1; align-self: start; }
  .task-action { grid-column: 2 / -1; justify-content: flex-start; min-width: 0; }
}

/* ---------- Reward effects (assets/fx.js) ---------- */
.fx-canvas { position: fixed; inset: 0; z-index: 1003; pointer-events: none; }
.fx-gem { position: fixed; z-index: 1004; display: block; pointer-events: none; will-change: transform; filter: drop-shadow(0 0 10px rgba(95, 196, 255, 0.95)); }
.fx-gem svg { display: block; width: 100%; height: 100%; }
.fx-float { position: fixed; z-index: 1005; pointer-events: none; font-size: 30px; font-weight: 800; line-height: 1; white-space: nowrap; color: #fff; text-shadow: 0 0 14px rgba(95, 196, 255, 0.95), 0 3px 0 rgba(var(--shade-rgb), 0.8); }
.fx-float-big { font-size: 48px; color: #fff6cf; text-shadow: 0 0 20px rgba(255, 214, 107, 0.95), 0 4px 0 rgba(var(--shade-rgb), 0.8); }
.fx-mini { position: fixed; top: 14px; right: 14px; z-index: 1002; display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px 7px 10px; border-radius: 999px; font-size: 17px; font-weight: 800; color: #d6efff; background: rgba(var(--shade-rgb), 0.92); box-shadow: inset 0 0 0 1px rgba(95, 196, 255, 0.55), 0 10px 30px -8px rgba(0, 0, 0, 0.7); translate: 0 -90px; transition: translate 0.3s cubic-bezier(0.2, 1.3, 0.4, 1); pointer-events: none; }
.fx-mini.is-shown { translate: 0 0; }
.fx-mini svg { width: 20px; height: 20px; }
.fx-mini.is-bumped { animation: gem-bump 0.5s ease both; }
.verdict.fx-pop { transform-origin: 0 50%; animation: fx-pop 0.6s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
.list-feedback.fx-pop { animation: fx-pop 0.6s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
.fx-shake { animation: fx-shake 0.4s ease both; }
@keyframes fx-pop {
  0% { transform: scale(0.86); }
  45% { transform: scale(1.07); text-shadow: 0 0 18px rgba(95, 224, 161, 0.85); }
  100% { transform: scale(1); }
}
@keyframes fx-shake { 0%, 100% { translate: 0 0; } 20% { translate: -6px 0; } 40% { translate: 5px 0; } 60% { translate: -3px 0; } 80% { translate: 2px 0; } }

@media (prefers-reduced-motion: reduce) {
  .gift-rays, .gift-glow, .gift-gem, .gift-twinkle, .btn-claim::after, .daily-gift .btn-claim,
  .daily-gift.is-just-claimed .gift-gem, .daily-gift.is-just-claimed .gift-done,
  .task.is-just-claimed, .task.is-just-claimed .task-claimed, .fx-pop, .fx-shake { animation: none; }
  .fx-mini { transition: none; }
}

/* ==========================================================================
   Quiz races (race.php, assets/race.js) and the home page's racing profile
   ========================================================================== */
.race-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.race-icon .fill { fill: currentColor; stroke: none; }
.race-unit { font-size: 12.5px; font-weight: 700; color: var(--ink-muted); }
.race-error { margin: 0; font-size: 15px; font-weight: 700; color: var(--danger); }

/* Quiz list + quiz page: the Race button */
.qz-row-action.has-race { display: flex; gap: 8px; width: 214px; }
.qz-row-action.has-race > * { min-width: 0; }
.qz-row-action.has-race > form, .qz-row-action.has-race > .btn:not(.btn-race) { flex: 1 1 auto; }
.qz-row-action.has-race form .btn { width: 100%; }
.qz-row-action .btn-race { flex: none; width: 80px; }
@media (max-width: 560px) {
  .qz-row-action.has-race { flex-direction: column; gap: 6px; width: auto; }
  .qz-row-action .btn-race { width: 100%; }
}

/* Lobby */
.race-head { margin-bottom: 18px; }
.race-setup { display: grid; gap: 16px; }
.race-setup-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.race-toggle { display: inline-flex; align-items: center; gap: 12px; padding: 10px 16px 10px 12px; border: 0; border-radius: 999px; font: 700 16px/1.2 var(--font); color: var(--ink-soft); background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
.race-toggle:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.race-toggle strong { margin-left: 4px; color: var(--ink-muted); }
.race-toggle.is-on strong { color: var(--success); }
.race-toggle-track { position: relative; width: 44px; height: 26px; border-radius: 999px; background: rgba(var(--shade-rgb), 0.6); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); transition: background-color 0.18s ease; }
.race-toggle-knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #cfd8ff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45); transition: transform 0.18s ease, background-color 0.18s ease; }
.race-toggle.is-on .race-toggle-track { background: rgba(95, 224, 161, 0.35); }
.race-toggle.is-on .race-toggle-knob { transform: translateX(18px); background: var(--success); }
.race-ghost-pick { display: inline-flex; align-items: center; gap: 10px; min-width: 0; font-weight: 700; color: var(--ink-soft); }
.race-ghost-label { display: inline-flex; align-items: center; gap: 6px; }
.race-ghost-pick select { min-width: 0; max-width: 100%; padding: 11px 40px 11px 14px; border: 0; border-radius: 12px; font: 700 15.5px/1.2 var(--font); color: #fff; background: rgba(var(--shade-rgb), 0.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 18px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16); -webkit-appearance: none; appearance: none; cursor: pointer; }
.race-ghost-pick select:disabled { color: var(--ink-muted); cursor: default; }
.race-ghost-pick option, .race-ghost-pick optgroup { color: #0b1d57; background: #fff; }
.race-start { gap: 10px; width: 100%; padding: 17px 24px; font-size: 21px; }
.race-start .race-icon { width: 24px; height: 24px; }
.race-start:disabled { opacity: 0.7; cursor: progress; }
.race-rules { margin: 0; }
.race-rules .gem-icon { width: 16px; height: 16px; vertical-align: -3px; }
.race-tiles { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin: 18px 0 0; }
.race-tiles .stat-value { font-variant-numeric: tabular-nums; }

/* Races table */
.race-table td { white-space: nowrap; }
.race-table .race-cell-quiz { white-space: normal; min-width: 180px; }
.race-table .race-cell-quiz a { color: #fff; font-weight: 700; }
.race-table .race-cell-time, .race-table .race-cell-speed { font-variant-numeric: tabular-nums; }
.race-th-options { text-align: center !important; }
.race-cell-options { text-align: center; }
.race-icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; margin: 0 2px; padding: 0; border: 0; border-radius: 11px; color: var(--accent-soft); background: rgba(var(--blue-rgb), 0.28); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.35); cursor: pointer; vertical-align: middle; transition: background-color 0.12s ease, transform 0.08s ease; }
.race-icon-btn:hover { color: #fff; background: rgba(var(--blue-rgb), 0.55); text-decoration: none; }
.race-icon-btn:active { transform: translateY(1px); }
.race-icon-btn .race-icon { width: 18px; height: 18px; }
.race-icon-ghost { color: #e6dcff; background: rgba(168, 132, 255, 0.2); box-shadow: inset 0 0 0 1px rgba(196, 170, 255, 0.4); }
.race-icon-ghost:hover { background: rgba(168, 132, 255, 0.4); }

/* The race: stats, track, pills */
.race-stage { scroll-margin-top: 16px; }
.race-hud { padding: 18px 20px 16px; border-radius: var(--radius-lg); background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.13), 0 30px 60px -32px rgba(0, 0, 0, 0.8); }
.race-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.race-stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: 14px; background: rgba(var(--shade-rgb), 0.35); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.race-stat-label { font-size: 12.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
.race-stat-value { font-size: 26px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; color: #fff; }
.race-stat-unit { font-size: 12.5px; font-weight: 700; color: var(--ink-muted); }
.race-stat-time .race-stat-value { color: var(--accent); }
.race-stat-ghost.is-ahead .race-stat-value { color: var(--success); }
.race-stat-ghost.is-behind .race-stat-value { color: var(--danger); }

.race-track { margin: 16px 0 14px; padding-top: 18px; }
.race-lane { position: relative; height: 34px; border-radius: 999px; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 18px, transparent 18px 34px) center / 100% 2px no-repeat, rgba(var(--shade-rgb), 0.55); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); }
.race-runner { --p: 0; position: absolute; top: 3px; left: calc(var(--p) * (100% - 34px)); width: 28px; height: 28px; margin-left: 3px; border-radius: 50%; transition: left 0.3s cubic-bezier(0.25, 1, 0.5, 1); }
.race-runner-you { z-index: 2; background: radial-gradient(circle at 35% 30%, #9ad7ff, var(--blue) 70%); box-shadow: 0 0 0 3px rgba(var(--shade-rgb), 0.8), 0 0 18px rgba(95, 196, 255, 0.85); }
.race-runner-ghost { z-index: 1; background: rgba(214, 196, 255, 0.35); box-shadow: inset 0 0 0 2px rgba(225, 210, 255, 0.75), 0 0 14px rgba(196, 170, 255, 0.5); transition: none; }
.race-runner-tag { position: absolute; bottom: calc(100% + 5px); left: 50%; translate: -50% 0; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 800; white-space: nowrap; color: #05264d; background: var(--accent); }
.race-runner-ghost .race-runner-tag { color: #2b1c57; background: #d9ccff; }
.race-runner-ghost .race-runner-tag { bottom: auto; top: calc(100% + 5px); }
.race-track:has(.race-runner-ghost) { padding-bottom: 20px; }
.race-flag { position: absolute; top: 4px; right: 6px; bottom: 4px; width: 14px; border-radius: 4px; background: repeating-conic-gradient(#fff 0 25%, #1b2a5a 0 50%) 0 0 / 7px 7px; opacity: 0.8; }

.race-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.race-pill { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; color: #fff; background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14); transition: background-color 0.2s ease, box-shadow 0.2s ease; }
.race-pill.is-current { background: rgba(var(--blue-rgb), 0.45); box-shadow: inset 0 0 0 2px var(--accent), 0 0 14px rgba(var(--accent-rgb), 0.45); }
.race-pill.is-wrong { background: rgba(255, 122, 122, 0.85); box-shadow: inset 0 0 0 2px #ffb0b0, 0 0 16px rgba(255, 122, 122, 0.6); animation: race-pill-miss 0.35s ease; }
.race-pill.is-done { color: #05331d; background: rgba(95, 224, 161, 0.72); box-shadow: inset 0 0 0 1px rgba(95, 224, 161, 0.9); }
.race-pill.is-perfect { background: var(--success); box-shadow: inset 0 0 0 1px #b6f5d4, 0 0 12px rgba(95, 224, 161, 0.45); }

/* The question card */
.race-card { position: relative; margin-top: 16px; padding: 22px 24px 24px; border-radius: var(--radius-lg); background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 30px 60px -32px rgba(0, 0, 0, 0.7); overflow: hidden; }
.race-card.is-entering .race-qtext, .race-card.is-entering .race-options { animation: race-enter 0.22s ease both; }
.race-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 30px; margin-bottom: 8px; }
.race-qnum { margin: 0; font-size: 14px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.race-wrong { margin: 0; padding: 4px 14px; border-radius: 999px; font-size: 15px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: #3a0b0b; background: var(--danger); box-shadow: 0 0 18px rgba(255, 122, 122, 0.6); opacity: 0; visibility: hidden; }
.race-wrong.is-shown { visibility: visible; animation: race-wrong 0.9s ease both; }
.race-qtext { margin-bottom: 16px; }
.race-figure:empty { display: none; }
.race-figure { margin: 0 0 16px; }
.race-img { display: block; max-width: 100%; max-height: 260px; border-radius: 14px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14); }
.race-hint { margin: -6px 0 14px; font-size: 15px; font-weight: 700; color: var(--accent-soft); }
.race-options { display: grid; gap: 12px; }
.race-options.is-truefalse { grid-template-columns: 1fr 1fr; }
.race-option { position: relative; display: flex; align-items: flex-start; gap: 14px; width: 100%; padding: 14px 16px; border: 0; border-radius: 14px; font: 600 17px/1.4 var(--font); text-align: left; color: #fff; background: rgba(var(--shade-rgb), 0.35); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14); cursor: pointer; transition: background-color 0.12s ease, box-shadow 0.12s ease, transform 0.08s ease; }
button.race-option:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32); }
button.race-option:active:not(:disabled) { transform: translateY(1px); }
.race-option:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.race-option .race-key { flex: none; }
.race-option-text { padding-top: 2px; }
.race-option.is-checking { box-shadow: inset 0 0 0 2px rgba(var(--accent-rgb), 0.7); }
.race-option.is-wrong { color: #ffe3e3; background: rgba(255, 122, 122, 0.2); box-shadow: inset 0 0 0 2px var(--danger); animation: race-shake 0.32s ease; cursor: default; }
.race-option.is-wrong .race-key { color: #3a0b0b; background: var(--danger); }
.race-option.is-right { background: rgba(95, 224, 161, 0.2); box-shadow: inset 0 0 0 2px var(--success), 0 0 22px -4px rgba(95, 224, 161, 0.7); cursor: default; }
.race-option.is-right .race-key { color: #05331d; background: var(--success); }
.race-card.is-waiting .race-options, .race-card.is-waiting .race-qtext, .race-card.is-waiting .race-figure { filter: blur(6px); opacity: 0.5; pointer-events: none; }
.race-card.is-done { box-shadow: inset 0 0 0 2px rgba(95, 224, 161, 0.75), 0 30px 60px -32px rgba(0, 0, 0, 0.7); }
.race-card.is-replay .race-option { cursor: default; }

/* 3, 2, 1, GO! */
.race-countdown { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(var(--shade-rgb), 0.55); transition: opacity 0.35s ease; }
.race-countdown.is-gone { opacity: 0; }
.race-count-num { font-size: clamp(84px, 16vw, 140px); font-weight: 800; line-height: 1; color: #fff; text-shadow: 0 0 40px rgba(var(--accent-rgb), 0.8), 0 6px 0 rgba(var(--shade-rgb), 0.8); }
.race-count-num.is-go { color: var(--success); text-shadow: 0 0 40px rgba(95, 224, 161, 0.85), 0 6px 0 rgba(var(--shade-rgb), 0.8); }
.race-count-num.is-pop { animation: race-pop 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) both; }

.race-stage-bar { display: flex; justify-content: flex-end; margin-top: 12px; }
.race-toast { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; font-weight: 700; color: #ffe3e3; background: rgba(255, 122, 122, 0.16); box-shadow: inset 0 0 0 1px rgba(255, 122, 122, 0.5); }
.race-lost { display: grid; gap: 12px; justify-items: start; }
.race-lost p { margin: 0; }

/* Results */
.race-results { display: grid; gap: 18px; outline: none; }
.race-results-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.race-results-head .eyebrow { margin: 0; }
.race-results-time { margin: 0; font-size: clamp(48px, 9vw, 72px); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent); }
.race-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.race-badge { padding: 6px 12px; border-radius: 999px; font-size: 15px; font-weight: 800; }
.race-badge-best { color: #3d2a00; background: #ffd66b; box-shadow: 0 0 18px rgba(255, 214, 107, 0.45); }
.race-badge-win { color: #05331d; background: var(--success); }
.race-badge-lose { color: #2b1c57; background: #d9ccff; }
.race-tiles-result { margin: 0; }
.race-splits-box summary { cursor: pointer; font-weight: 800; color: var(--ink-soft); }
.race-splits { display: grid; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; }
.race-split { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px; background: rgba(var(--shade-rgb), 0.3); font-size: 15px; }
.race-split-n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; font-weight: 800; color: #05331d; background: rgba(95, 224, 161, 0.72); }
.race-split.is-perfect .race-split-n { background: var(--success); }
.race-split-q { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); }
.race-split-tries { font-weight: 700; color: var(--ink-muted); }
.race-split-time { font-weight: 800; font-variant-numeric: tabular-nums; }
.race-results-actions { gap: 10px; }

/* Home page: racing profile */
.race-profile { max-width: 1060px; margin: 8px 0 34px; }
.race-profile-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 0 16px; }
.race-big { display: flex; align-items: baseline; gap: 8px; flex: none; }
.race-big strong { font-size: clamp(44px, 7vw, 60px); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent); text-shadow: 0 0 30px rgba(var(--accent-rgb), 0.35); }
.race-big span { font-size: 20px; font-weight: 800; color: var(--ink-soft); }
.race-profile .race-tiles { margin: 0; }
.race-since { margin: 12px 0 0; }
.race-since .gem-icon { width: 15px; height: 15px; vertical-align: -2px; }
.race-h3 { margin: 26px 0 12px; font-size: 20px; font-weight: 800; }
.race-empty { display: grid; gap: 12px; justify-items: start; }
.race-empty .empty { padding: 0; }

/* Replay window */
.race-replay { width: min(940px, calc(100% - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 0; border-radius: 24px; color: #fff; background: linear-gradient(180deg, #0f2a7a, #071a52); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 40px 90px -20px rgba(0, 0, 0, 0.85); }
.race-replay::backdrop { background: rgba(3, 10, 45, 0.72); backdrop-filter: blur(3px); }
.race-replay-inner { display: grid; gap: 14px; padding: 20px 22px 22px; }
.race-replay-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.race-replay-head .eyebrow { margin: 0 0 4px; }
.race-replay-title { margin: 0; font-size: 24px; font-weight: 800; line-height: 1.2; }
.race-replay-close { flex: none; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 12px; font: 800 26px/1 var(--font); color: #fff; background: rgba(255, 255, 255, 0.08); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); cursor: pointer; }
.race-replay-close:hover { background: rgba(255, 255, 255, 0.16); }
.race-replay-screen .race-hud { padding: 14px 16px 12px; }
.race-replay-screen .race-stat-value { font-size: 22px; }
.race-replay-screen .race-card { margin-top: 12px; padding: 18px 20px 20px; }
.race-replay-screen .race-option { padding: 11px 14px; font-size: 16px; }
.race-replay-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.race-rp-btn { min-width: 76px; }
.race-replay-seek { flex: 1 1 160px; min-width: 120px; accent-color: var(--blue); }
.race-replay-clock { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.race-rp-ghost { gap: 8px; }
.race-rp-ghost[hidden] { display: none; }
.race-rp-loading { margin: 24px 0; }
.race-quiz-btn { gap: 8px; }

@keyframes race-pop { 0% { scale: 1.8; opacity: 0; } 100% { scale: 1; opacity: 1; } }
@keyframes race-enter { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }
@keyframes race-shake { 0%, 100% { translate: 0 0; } 20% { translate: -7px 0; } 40% { translate: 6px 0; } 60% { translate: -4px 0; } 80% { translate: 2px 0; } }
@keyframes race-wrong { 0% { opacity: 0; scale: 0.7; } 15% { opacity: 1; scale: 1.08; } 25% { scale: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes race-pill-miss { 0%, 100% { scale: 1; } 40% { scale: 1.18; } }

@media (max-width: 700px) {
  .race-profile-head { flex-direction: column; align-items: flex-start; }
  .race-options.is-truefalse { grid-template-columns: 1fr; }
  .race-card { padding: 18px 16px 20px; }
  .race-hud { padding: 12px 12px 12px; }
  .race-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .race-stat { padding: 7px 9px; border-radius: 11px; }
  .race-stat-label { font-size: 10.5px; letter-spacing: 0.04em; }
  .race-stat-value { font-size: 19px; }
  .race-stat-unit { display: none; }
  .race-pill { width: 28px; height: 28px; border-radius: 9px; font-size: 13px; }
  .race-track { margin: 10px 0; }
  .race-ghost-pick { flex-wrap: wrap; width: 100%; }
  .race-ghost-pick select { flex: 1 1 200px; }
  .race-split { grid-template-columns: 28px minmax(0, 1fr) auto; }
  .race-split-tries { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .race-runner, .race-toggle-knob, .race-toggle-track { transition: none; }
  .race-card.is-entering .race-qtext, .race-card.is-entering .race-options, .race-option.is-wrong, .race-pill.is-wrong, .race-count-num.is-pop { animation: none; }
  .race-wrong.is-shown { animation: none; opacity: 1; }
}

/* ==========================================================================
   Quizzes page modes (Daily challenge, Play random, Pick quiz, Race) and the daily challenge
   ========================================================================== */
.qz-modes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 0 0 12px; }
.qz-mode-form { display: flex; margin: 0; }
.qz-mode { position: relative; display: grid; align-content: start; gap: 4px; width: 100%; min-height: 150px; padding: 18px 18px 16px; border: 0; border-radius: var(--radius-lg); font: inherit; text-align: left; color: #fff; text-decoration: none; background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.035)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 6px 0 rgba(var(--shade-rgb), 0.55), 0 24px 40px -26px rgba(0, 0, 0, 0.8); cursor: pointer; transition: transform 0.1s ease, box-shadow 0.15s ease, background-color 0.15s ease; }
.qz-mode:hover { color: #fff; text-decoration: none; transform: translateY(-2px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28), 0 8px 0 rgba(var(--shade-rgb), 0.55), 0 28px 44px -26px rgba(0, 0, 0, 0.85); }
.qz-mode:active { transform: translateY(3px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28), 0 2px 0 rgba(var(--shade-rgb), 0.55); }
.qz-mode:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent), 0 6px 0 rgba(var(--shade-rgb), 0.55); }
.qz-mode:disabled { opacity: 0.55; cursor: default; transform: none; }
.qz-mode-icon { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 8px; border-radius: 14px; color: #fff; background: var(--blue); box-shadow: 0 4px 0 var(--blue-deep), 0 10px 20px -8px rgba(31, 111, 235, 0.8); }
.qz-mode-icon .race-icon { width: 24px; height: 24px; }
.qz-mode-title { font-size: 21px; font-weight: 800; line-height: 1.15; }
.qz-mode-sub { font-size: 14.5px; font-weight: 600; line-height: 1.35; color: var(--ink-soft); }
.qz-mode-sub .gem-icon { width: 15px; height: 15px; vertical-align: -2px; }
.qz-mode-daily { background: radial-gradient(120% 90% at 0% 0%, rgba(255, 170, 60, 0.22), transparent 60%), linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.035)); }
.qz-mode-daily .qz-mode-icon { background: #f08a24; box-shadow: 0 4px 0 #b35c0a, 0 10px 20px -8px rgba(240, 138, 36, 0.8); }
.qz-mode-daily.is-done .qz-mode-icon { background: var(--success); color: #05331d; box-shadow: 0 4px 0 #2fa56f, 0 10px 20px -8px rgba(95, 224, 161, 0.7); }
.qz-mode-random .qz-mode-icon { background: #8a5cf6; box-shadow: 0 4px 0 #5b33b8, 0 10px 20px -8px rgba(138, 92, 246, 0.8); }
.qz-mode-race .qz-mode-icon { background: #a884ff; color: #2b1c57; box-shadow: 0 4px 0 #6c4cc9, 0 10px 20px -8px rgba(168, 132, 255, 0.8); }
.qz-mode.is-open { box-shadow: inset 0 0 0 2px var(--accent), 0 6px 0 rgba(var(--shade-rgb), 0.55), 0 0 30px -6px rgba(var(--accent-rgb), 0.55); }
.qz-mode.is-open::after { content: ""; position: absolute; left: 50%; bottom: -13px; width: 0; height: 0; translate: -50% 0; border: 9px solid transparent; border-top-color: var(--accent); }
.qz-mode-streak { display: inline-flex; align-items: center; gap: 4px; justify-self: start; margin-top: 6px; padding: 3px 10px 3px 7px; border-radius: 999px; font-size: 13px; font-weight: 800; color: #3d2400; background: #ffb347; }
.qz-mode-streak .race-icon { width: 15px; height: 15px; fill: currentColor; stroke: none; }
.qz-rule { margin: 0 0 22px; }
.qz-pick { scroll-margin-top: 16px; }
.qz-race-panel { scroll-margin-top: 16px; margin-bottom: 18px; }
.qz-race-panel .sub-title { margin-top: 0; }
.qz-race-panel .empty { padding: 0; }
.qz-race-intro { margin: -4px 0 14px; color: var(--ink-soft); }
.qz-race-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.qz-race-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 10px 12px 10px 16px; border-radius: 14px; background: rgba(var(--shade-rgb), 0.35); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); }
.qz-race-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.qz-race-meta { font-size: 14px; font-weight: 700; white-space: nowrap; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.qz-race-meta strong { color: #fff; }
.qz-race-row .btn { gap: 6px; min-width: 150px; }
.qz-race-row .btn .race-icon { width: 17px; height: 17px; }

/* The daily challenge */
.ch-icon { vertical-align: -4px; }
.ch-stat-streak .stat-value { display: inline-flex; align-items: center; gap: 6px; color: #ffb347; }
.ch-stat-streak .race-icon, .ch-badge-streak .race-icon { fill: currentColor; stroke: none; }
.ch-intro[hidden], .ch-stage[hidden] { display: none; }
.ch-stat-streak .race-icon { width: 26px; height: 26px; }
.ch-intro .stat-value .gem-icon { width: 22px; height: 22px; margin-right: 4px; vertical-align: -2px; }
.ch-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 10px; }
.ch-count { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.ch-tally { margin: 0; font-weight: 800; }
.ch-tally .ok { color: var(--success); }
.ch-tally .no { color: var(--danger); }
.ch-timer { margin: 0; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent); }
.ch-progress { width: 100%; }
.ch-card { margin-top: 14px; }
.ch-from { margin: 0 0 10px; }
.race-option.is-selected { background: rgba(var(--blue-rgb), 0.38); box-shadow: inset 0 0 0 2px var(--accent), 0 0 18px -6px rgba(var(--accent-rgb), 0.8); }
.race-option.is-selected .race-key { color: #05264d; background: var(--accent); }
.race-option.is-dim { opacity: 0.5; cursor: default; }
.ch-feedback { margin-top: 16px; }
.ch-feedback .verdict { margin: 0 0 10px; }
.ch-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.ch-action { min-width: 180px; }
.ch-note { margin: 12px 0 0; text-align: center; }
.ch-badge-streak { display: inline-flex; align-items: center; gap: 6px; color: #3d2400; background: #ffb347; box-shadow: 0 0 18px rgba(255, 179, 71, 0.45); }
.ch-badge-streak .race-icon { width: 17px; height: 17px; }
.race-badge .gem-icon { width: 16px; height: 16px; margin-right: 4px; vertical-align: -3px; }
.ch-review-row.is-miss .race-split-n { color: #3a0b0b; background: var(--danger); }
.ch-review-row .race-split-n .race-icon { width: 16px; height: 16px; stroke-width: 3; }
.ch-next { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 700; color: var(--ink-soft); }
.ch-next strong { color: #fff; font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .qz-modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qz-mode.is-open::after { display: none; }
}
@media (max-width: 560px) {
  .qz-modes { gap: 10px; }
  .qz-mode { min-height: 0; padding: 14px; }
  .qz-mode-icon { width: 40px; height: 40px; margin-bottom: 4px; }
  .qz-mode-title { font-size: 18px; }
  .qz-mode-sub { font-size: 13px; }
  .qz-race-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .qz-race-row .btn { width: 100%; }
  .ch-action { width: 100%; }
}

/* Home page: the Daily quiz challenge block */
.ch-home { max-width: 1060px; margin: 8px 0 34px; scroll-margin-top: 16px; }
.ch-home .ch-done .btn-row { display: none; }

/* ==========================================================================
   Daily tasks side panel (every page) and the home page's daily gift popup
   (app/daily_panel.php, assets/daily.js)
   ========================================================================== */
.dq-side:not(.is-placed) { visibility: hidden; }

/* The tab on the right edge */
.dq-side-tab {
  position: fixed; right: 0; top: 38vh; z-index: 990;
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  width: 40px; padding: 13px 0 14px; border: 0; border-radius: 14px 0 0 14px; cursor: pointer;
  font: 800 13px/1 var(--font); letter-spacing: 0.06em; color: #fff;
  background: linear-gradient(180deg, rgba(var(--blue-rgb), 0.62), rgba(var(--blue-rgb), 0.36));
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.12), -8px 12px 26px -10px rgba(0, 0, 0, 0.75);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: width 0.18s ease, background-color 0.18s ease;
}
.dq-side-tab:hover { width: 46px; }
.dq-side-tab[hidden] { display: none; }
.dq-side-tab .daily-icon { width: 20px; height: 20px; }
.dq-side-tab-text { writing-mode: vertical-rl; transform: rotate(180deg); }
.dq-side-badge {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  font-size: 12.5px; letter-spacing: 0; color: #05331d; background: var(--success);
  box-shadow: 0 0 0 3px rgba(46, 204, 128, 0.22), 0 0 14px rgba(46, 204, 128, 0.6);
}
.dq-side-badge[hidden] { display: none; }
.dq-side.has-ready .dq-side-tab { animation: dq-tab-glow 2.6s ease-in-out infinite; }

/* The panel */
.dq-side-panel {
  position: fixed; right: 14px; top: 84px; z-index: 990;
  width: min(330px, calc(100vw - 28px)); max-height: calc(100vh - 100px); overflow-y: auto; overscroll-behavior: contain;
  padding: 16px 16px 14px; border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(34, 52, 128, 0.97), rgba(17, 28, 82, 0.97));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.13), 0 26px 60px -18px rgba(0, 0, 0, 0.8), 0 0 46px -14px rgba(var(--blue-rgb), 0.65);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  scrollbar-width: thin;
}
.dq-side-panel[hidden] { display: none; }
.dq-side.is-docked .dq-side-panel { right: 18px; top: 96px; width: 320px; }
.dq-side-panel.is-entering { animation: dq-panel-in 0.32s cubic-bezier(0.2, 1.2, 0.4, 1) both; }

.dq-side-head { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 12px; }
.dq-side-heading { flex: 1; min-width: 0; }
.dq-side-title { margin: 0 0 3px; font-size: 19px; font-weight: 800; line-height: 1.2; }
.dq-side-head .daily-timer { font-size: 13px; gap: 6px; }
.dq-side-head .daily-timer .daily-icon { width: 15px; height: 15px; }
.dq-side-btn {
  display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 10px; cursor: pointer;
  color: var(--ink-soft); background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.dq-side-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.13); }
.dq-side-btn[hidden] { display: none; }
.dq-side-btn .daily-icon { width: 18px; height: 18px; }
.dq-side-sound .snd-off, .dq-side-sound.is-off .snd-on { display: none; }
.dq-side-sound.is-off .snd-off { display: inline; }
.dq-side-sound.is-off { color: var(--ink-muted); }

.dq-newday { margin: 0 0 10px; padding: 8px 12px; border-radius: 12px; font-size: 13.5px; background: rgba(var(--accent-rgb), 0.14); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.35); }
.dq-newday[hidden] { display: none; }

/* Today's gift, as the first row */
.dq-gift {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 6px 10px;
  margin-bottom: 8px; padding: 10px 12px; border-radius: 14px;
  background: radial-gradient(130% 150% at 0% 50%, rgba(var(--accent-rgb), 0.26), rgba(var(--blue-rgb), 0.08) 72%);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.5);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}
.dq-gift-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(var(--blue-rgb), 0.22); }
.dq-gift-icon .gem-icon { width: 24px; height: 24px; filter: drop-shadow(0 0 7px rgba(95, 196, 255, 0.85)); animation: gift-bob 2.6s ease-in-out infinite; }
.dq-gift-body { min-width: 0; }
.dq-gift .task-text { margin-bottom: 0; }
.dq-gift.is-claiming { box-shadow: inset 0 0 0 2px var(--success), 0 0 40px -6px rgba(95, 224, 161, 0.55); }
.dq-gift.is-claimed { background: rgba(var(--shade-rgb), 0.3); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.dq-gift.is-claimed .dq-gift-icon { background: rgba(46, 204, 128, 0.12); }
.dq-gift.is-claimed .gem-icon { animation: none; filter: none; opacity: 0.75; }
.dq-gift.is-claimed .task-reward { opacity: 0.6; }
.dq-gift.is-just-claimed { animation: task-done 0.9s ease both; }
.dq-gift.is-just-claimed .task-claimed { animation: daily-stamp 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) both; }

/* Compact task rows */
.dq-side .task-list { gap: 8px; }
.dq-side .task, .dq-side .dq-gift { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 6px 10px; padding: 10px 12px; border-radius: 14px; }
.dq-side .task-icon { grid-row: 1 / span 2; width: 34px; height: 34px; border-radius: 10px; align-self: start; }
.dq-side .task-body, .dq-side .dq-gift-body { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
.dq-side .task-icon .daily-icon { width: 18px; height: 18px; }
.dq-side .dq-gift-icon { grid-row: 1 / span 2; align-self: start; }
.dq-side .task-title { font-size: 15px; }
.dq-side .task-text { margin: 1px 0 6px; font-size: 13px; line-height: 1.3; }
.dq-side .task-bar { max-width: none; }
.dq-side .task-count { font-size: 12px; }
.dq-side .task-reward { grid-column: 3; grid-row: 1; align-self: start; justify-self: end; padding: 3px 8px 3px 6px; font-size: 13px; }
.dq-side .task-reward .gem-icon { width: 15px; height: 15px; }
.dq-side .task-action { grid-column: 3; grid-row: 2; align-self: end; justify-content: flex-end; min-width: 0; }
.dq-side .task-text { margin-bottom: 4px; }
.dq-side .dq-gift .task-text { margin-bottom: 0; }
.dq-side .task-claimed { font-size: 13px; }
.dq-side .task-claimed .daily-icon { width: 15px; height: 15px; }
.dq-side .btn-claim-task { min-width: 0; padding: 6px 14px; }
.dq-side .task-action .btn-sm { padding: 6px 14px; font-size: 14.5px; }
.dq-side .task-none { font-size: 14px; }
.dq-side .daily-total { margin: 12px 0 0; padding-top: 12px; font-size: 13.5px; }
.dq-side .daily-error { margin: 6px 0 0; font-size: 13px; }

/* The daily gift popup */
html.gift-pop-open { overflow: hidden; }
.gift-pop {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; overflow-y: auto;
  background: rgba(3, 8, 32, 0.7); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0; transition: opacity 0.22s ease;
}
.gift-pop[hidden] { display: none; }
.gift-pop.is-shown { opacity: 1; }
.gift-pop-card { position: relative; width: min(380px, 100%); transform: translateY(16px) scale(0.92); transition: transform 0.42s cubic-bezier(0.2, 1.45, 0.4, 1); }
.gift-pop.is-shown .gift-pop-card { transform: none; }
.gift-pop .daily-gift {
  padding: 30px 26px 28px;
  background-color: #14215f;
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.65), 0 30px 80px -20px rgba(0, 0, 0, 0.85), 0 0 90px -20px rgba(var(--blue-rgb), 0.9);
}
.gift-pop .gift-title { font-size: 28px; }
.gift-pop-close { position: absolute; top: 12px; right: 12px; z-index: 2; }
.gift-pop-later { display: block; margin: 12px auto 0; padding: 6px 12px; border: 0; background: none; cursor: pointer; font: 700 15px var(--font); color: var(--ink-soft); }
.gift-pop-later:hover { color: #fff; text-decoration: underline; }
.gift-pop-later[hidden] { display: none; }

@keyframes dq-panel-in { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes dq-tab-glow {
  0%, 100% { box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.12), -8px 12px 26px -10px rgba(0, 0, 0, 0.75); }
  50% { box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.2), inset 0 0 0 1px rgba(95, 224, 161, 0.55), -6px 0 26px -4px rgba(46, 204, 128, 0.55); }
}

@media (max-width: 700px) {
  .dq-side-tab { top: auto; bottom: 22vh; width: 34px; padding: 10px 0 11px; gap: 7px; font-size: 12px; }
  .dq-side-tab:hover { width: 34px; }
  .dq-side-tab .daily-icon { width: 18px; height: 18px; }
  .dq-side-panel { top: auto; bottom: 12px; right: 10px; width: calc(100vw - 20px); max-height: min(78vh, calc(100vh - 24px)); }
  .gift-pop .daily-gift { padding: 26px 20px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .dq-side.has-ready .dq-side-tab, .dq-side-panel.is-entering, .dq-gift-icon .gem-icon, .dq-gift.is-just-claimed,
  .dq-gift.is-just-claimed .task-claimed { animation: none; }
  .gift-pop, .gift-pop-card, .dq-side-tab { transition: none; }
}

/* ==========================================================================
   Home page: racing scene + simple cards (index.php, app/home.php)
   ========================================================================== */
body.page-home { isolation: isolate; }
body.page-home::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: url("/assets/home-scene.svg?v=1") center bottom / cover no-repeat;
}

.hm { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; max-width: 1060px; margin: 4px 0 38px; }
.hm-card {
  position: relative; grid-column: 1 / -1; isolation: isolate;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0 18px;
  min-height: 190px; padding: 26px 30px; border-radius: 22px; overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.05));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15), 0 24px 50px -26px rgba(0, 0, 0, 0.8);
  -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px);
}
.hm-card::after {   /* a coloured glow behind each card's picture */
  content: ""; position: absolute; z-index: -1; right: -60px; top: 50%; width: 340px; height: 340px; translate: 0 -50%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(var(--blue-rgb), 0.45), transparent);
  pointer-events: none;
}
.hm-hero::after { background: radial-gradient(closest-side, rgba(47, 184, 100, 0.34), transparent); }
.hm-daily::after { background: radial-gradient(closest-side, rgba(255, 191, 60, 0.3), transparent); }
.hm-random::after { background: radial-gradient(closest-side, rgba(139, 92, 246, 0.42), transparent); }
.hm-lenses::after { background: radial-gradient(closest-side, rgba(20, 184, 166, 0.38), transparent); }
.hm-research::after { background: radial-gradient(closest-side, rgba(255, 138, 61, 0.36), transparent); }
.hm-half { grid-column: auto; min-height: 0; padding: 24px 24px 24px 28px; }
.hm-wide { grid-column: 1 / -1; }

.hm-main { min-width: 0; }
.hm-title { margin: 0; font-size: 30px; font-weight: 800; line-height: 1.15; }
.hm-half .hm-title { font-size: 25px; }
.hm-sub { margin: 5px 0 18px; font-size: 17px; line-height: 1.4; color: var(--ink-soft); }
.hm-sub strong { color: #fff; }
.hm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; }
.hm-btn { gap: 10px; padding: 15px 28px; font-size: 19px; border-radius: 15px; }
.hm-half .hm-btn { padding: 13px 22px; font-size: 17.5px; }
.hm-btn .race-icon { width: 22px; height: 22px; }
.hm-btn-go { background: #2fb864; box-shadow: 0 5px 0 #1d8247, 0 16px 26px -12px rgba(0, 0, 0, 0.55); }
.hm-btn-go:hover { background: #37c56f; text-decoration: none; }
.hm-btn-gold { color: #3a2500; background: #ffbf3c; box-shadow: 0 5px 0 #c48a17, 0 16px 26px -12px rgba(0, 0, 0, 0.55); }
.hm-btn-gold:hover { background: #ffc955; }
.hm-btn-gold:disabled { opacity: 0.7; }
.hm-btn-purple { background: #8b5cf6; box-shadow: 0 5px 0 #5f35c4, 0 16px 26px -12px rgba(0, 0, 0, 0.55); }
.hm-btn-purple:hover { background: #9a70f8; }
.hm-btn-soft { background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.26), 0 5px 0 rgba(var(--shade-rgb), 0.6); }
.hm-btn-soft:hover { background: rgba(255, 255, 255, 0.16); text-decoration: none; }
.hm-btn-teal { background: #0fa596; box-shadow: 0 5px 0 #0a746a, 0 16px 26px -12px rgba(0, 0, 0, 0.55); }
.hm-btn-teal:hover { background: #14b8a6; text-decoration: none; }
.hm-btn-orange { background: #f2742b; box-shadow: 0 5px 0 #b8501a, 0 16px 26px -12px rgba(0, 0, 0, 0.55); }
.hm-btn-orange:hover { background: #ff8a3d; text-decoration: none; }
.hm-actions form { margin: 0; }
.hm-daily-note { flex: none; }
.hm-daily-note .race-icon { color: var(--success); }
.hm-daily-note form { display: inline-flex; margin: 0; }
.hm-linkbtn {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 0; border-radius: 999px; cursor: pointer;
  font: 800 13.5px/1.2 var(--font); color: #ffd27a; background: rgba(255, 191, 60, 0.14); box-shadow: inset 0 0 0 1px rgba(255, 191, 60, 0.45);
}
.hm-linkbtn:hover { color: #fff; background: rgba(255, 191, 60, 0.26); }
.hm-meta .hm-linkbtn .race-icon { width: 16px; height: 16px; color: inherit; }
.hm-continue { display: none; margin-top: 16px; }
.hm-daily:has(> .hm-stage .ch-done) .hm-continue { display: flex; }
.hm-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 16px 0 0; font-size: 14.5px; font-weight: 700; color: var(--ink-muted); }
.hm-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.hm-meta strong { color: #fff; }
.hm-meta .race-icon, .hm-meta .gem-icon { width: 17px; height: 17px; }
.hm-streak .race-icon { color: #ffb02e; }
.hm-card .race-error { margin: 12px 0 0; }

.hm-art { display: grid; place-items: center; margin: -10px -8px -10px 0; pointer-events: none; }
.hm-pic { display: block; height: auto; filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.35)); }
.hm-car { width: 360px; margin-right: -16px; }
.hm-watch { width: 250px; }
.hm-dice, .hm-cards, .hm-lens, .hm-pad { width: 150px; }

/* A little motion: the car's wheels turn and it rocks on its springs, the flag waves, the stopwatch ticks. */
.hm-wheel { transform-box: view-box; animation: hm-spin 0.55s linear infinite; }
.hm-wheel-r { transform-origin: 123px 112px; }
.hm-wheel-f { transform-origin: 291px 112px; }
.hm-car-ride { animation: hm-bob 1.4s ease-in-out infinite; }
.hm-car-lines { animation: hm-streak 0.8s ease-in-out infinite; }
.hm-flag { transform-box: fill-box; transform-origin: left center; animation: hm-wave 1.8s ease-in-out infinite; }
.hm-hand { transform-box: view-box; transform-origin: 176px 102px; animation: hm-tick 6s steps(12) infinite; }
.hm-card:hover .hm-dice { animation: hm-roll 0.6s ease; }

/* The Daily challenge, while it's being played on the card */
.hm-daily:has(> .hm-stage:not([hidden])) { display: block; }
.hm-daily:has(> .hm-stage:not([hidden])) > .hm-art { display: none; }
.hm-daily:has(> .hm-stage:not([hidden]))::after { display: none; }
.hm-stage { min-width: 0; }
.hm-daily .ch-done .btn-row { display: none; }

@keyframes hm-spin { to { rotate: 360deg; } }
@keyframes hm-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -2px; } }
@keyframes hm-streak { 0%, 100% { translate: 0 0; opacity: 1; } 50% { translate: -8px 0; opacity: 0.55; } }
@keyframes hm-wave { 0%, 100% { scale: 1 1; } 50% { scale: 0.94 1.04; } }
@keyframes hm-tick { to { rotate: 360deg; } }
@keyframes hm-roll { 0% { rotate: 0deg; } 60% { rotate: 18deg; } 100% { rotate: 0deg; } }

@media (max-width: 900px) {
  .hm-car { width: 280px; }
  .hm-watch { width: 200px; }
}
@media (max-width: 700px) {
  .hm { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .hm-card, .hm-half { grid-template-columns: minmax(0, 1fr) auto; min-height: 0; padding: 20px 18px 22px 20px; }
  .hm-title { font-size: 24px; }
  .hm-half .hm-title { font-size: 22px; }
  .hm-sub { font-size: 15.5px; margin-bottom: 14px; }
  .hm-btn, .hm-half .hm-btn { padding: 12px 20px; font-size: 17px; }
  .hm-art { position: absolute; z-index: -1; right: -14px; top: 12px; margin: 0; opacity: 0.3; }
  .hm-car { width: 190px; }
  .hm-watch { width: 140px; }
  .hm-dice, .hm-cards, .hm-lens, .hm-pad { width: 104px; }
  .hm-meta { font-size: 13.5px; gap: 4px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .hm-wheel, .hm-car-ride, .hm-car-lines, .hm-flag, .hm-hand, .hm-card:hover .hm-dice { animation: none; }
}

/* Home page: the full-width Projects frame */
.hm-projects::after { background: radial-gradient(closest-side, rgba(226, 72, 127, 0.38), transparent); }
.hm-btn-rose { background: #e2487f; box-shadow: 0 5px 0 #a52e5b, 0 16px 26px -12px rgba(0, 0, 0, 0.55); }
.hm-btn-rose:hover { background: #ef5c91; text-decoration: none; }
.hm-plan { width: 150px; }
.hm-wide .hm-plan { width: 220px; }
@media (max-width: 700px) {
  .hm-plan, .hm-wide .hm-plan { width: 120px; }
}

/* Home page: the Racing profile side panel, on the left (app/home.php, assets/race-side.js) */
.rp-side:not(.is-placed) { visibility: hidden; }
.rp-side-tab {
  right: auto; left: 0; border-radius: 0 14px 14px 0;
  background: linear-gradient(180deg, rgba(47, 184, 100, 0.62), rgba(47, 184, 100, 0.34));
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.12), 8px 12px 26px -10px rgba(0, 0, 0, 0.75);
}
.rp-side-tab .dq-side-tab-text { transform: none; }
.rp-side-tab .race-icon { width: 20px; height: 20px; }
.rp-side-panel { right: auto; left: 14px; }
.rp-side.is-docked .rp-side-panel { left: 18px; top: 96px; width: 320px; }
.rp-side-panel.is-entering { animation-name: rp-panel-in; }
.rp-sub { margin: 0; font-size: 13px; font-weight: 700; color: var(--ink-muted); }
.rp-empty { margin: 0 0 12px; font-size: 14.5px; color: var(--ink-soft); }
.rp-big { display: flex; align-items: baseline; gap: 8px; margin: 0 0 12px; }
.rp-big strong { font-size: 46px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent); text-shadow: 0 0 26px rgba(var(--accent-rgb), 0.35); }
.rp-big span { font-size: 17px; font-weight: 800; color: var(--ink-soft); }
.rp-big em { margin-left: auto; font-size: 12.5px; font-style: normal; font-weight: 700; color: var(--ink-muted); }
.rp-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 10px; }
.rp-stat, .rp-row { border-radius: 12px; background: rgba(var(--shade-rgb), 0.35); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.rp-stat { padding: 8px 10px; }
.rp-stat strong { display: block; font-size: 18px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.rp-stat span { font-size: 12px; font-weight: 700; color: var(--ink-muted); }
.rp-since { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0; font-size: 12.5px; font-weight: 700; color: var(--ink-muted); }
.rp-since .gem-icon { width: 14px; height: 14px; }
.rp-h3 { margin: 16px 0 8px; font-size: 12.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.rp-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.rp-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; }
.rp-main { min-width: 0; }
.rp-quiz { margin: 0; overflow: hidden; font-size: 14px; font-weight: 800; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.rp-meta { margin: 2px 0 0; font-size: 12px; font-weight: 700; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.rp-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.rp-speed { font-size: 11.5px; font-weight: 700; color: var(--ink-muted); white-space: nowrap; }
.rp-speed strong { font-size: 15px; color: #fff; font-variant-numeric: tabular-nums; }
.rp-btns { display: flex; gap: 4px; }
.rp-btns .race-icon-btn { width: 30px; height: 30px; margin: 0; border-radius: 9px; }
.rp-btns .race-icon { width: 15px; height: 15px; }
.rp-more { display: inline-block; margin-top: 12px; font-size: 14px; font-weight: 800; }
@keyframes rp-panel-in { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
@media (max-width: 700px) {
  .rp-side-tab { width: 34px; }
  .rp-side-panel { left: 10px; right: auto; }
}

/* ==========================================================================
   Quiz player (play.php, assets/play.js) and quiz results (app/play.php: play.php and attempt.php)
   ========================================================================== */
.pl .play-top-right { display: flex; align-items: center; gap: 14px; }
.pl-timer { margin: 0; min-width: 64px; text-align: right; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent); }
.pl-card { margin-top: 14px; }
.pl-card .question-text { margin: 0 0 16px; }
.pl-feedback { min-height: 30px; margin-top: 14px; }
.pl-feedback .verdict { margin: 0; }
.pl-note { margin: 12px 0 0; text-align: center; }
.race-option.is-checking { cursor: progress; }

/* Results */
.pl-result { margin-top: 16px; padding: 24px 26px 26px; border-radius: var(--radius-lg); background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 30px 60px -32px rgba(0, 0, 0, 0.7); }
.pl-result:focus { outline: none; }
.pl-result-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.pl-result-title { margin: 2px 0 0; font-size: 28px; font-weight: 800; line-height: 1.15; }
.pl-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.pl-stat { display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: center; column-gap: 10px; padding: 12px 14px; border-radius: 14px; background: rgba(var(--shade-rgb), 0.35); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); }
.pl-stat > svg { grid-row: 1 / span 2; width: 36px; height: 36px; padding: 8px; border-radius: 50%; color: var(--accent); background: rgba(var(--blue-rgb), 0.25); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.35); }
.pl-stat-label { font-size: 13px; font-weight: 700; color: var(--ink-muted); }
.pl-stat strong { font-size: 22px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.pl-stat strong small { font-size: 13px; color: var(--ink-soft); }
.pl-actions { margin-top: 18px; }
.pl-actions form { margin: 0; }
.pl-actions .btn { gap: 8px; }
.pl-actions .race-icon { width: 20px; height: 20px; }
.pl-h3 { margin: 26px 0 10px; font-size: 14px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }

/* Time per question */
.pl-chart { display: flex; align-items: flex-end; gap: 6px; height: 200px; padding: 12px 12px 0; overflow-x: auto; border-radius: 14px; background: rgba(var(--shade-rgb), 0.3); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.pl-col { display: flex; flex: 1 1 0; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 30px; height: 100%; }
.pl-col-val { margin-bottom: 4px; font-size: 11px; font-weight: 700; white-space: nowrap; color: var(--ink-muted); }
.pl-bar { display: block; width: 100%; max-width: 46px; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, var(--accent), rgba(var(--blue-rgb), 0.9)); }
.pl-bar.is-miss { background: linear-gradient(180deg, #ff9a9a, rgba(255, 122, 122, 0.6)); }
.pl-col-n { padding: 6px 0 8px; font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.pl-h-1 { height: calc((100% - 46px) * 0.05); }
.pl-h-2 { height: calc((100% - 46px) * 0.1); }
.pl-h-3 { height: calc((100% - 46px) * 0.15); }
.pl-h-4 { height: calc((100% - 46px) * 0.2); }
.pl-h-5 { height: calc((100% - 46px) * 0.25); }
.pl-h-6 { height: calc((100% - 46px) * 0.3); }
.pl-h-7 { height: calc((100% - 46px) * 0.35); }
.pl-h-8 { height: calc((100% - 46px) * 0.4); }
.pl-h-9 { height: calc((100% - 46px) * 0.45); }
.pl-h-10 { height: calc((100% - 46px) * 0.5); }
.pl-h-11 { height: calc((100% - 46px) * 0.55); }
.pl-h-12 { height: calc((100% - 46px) * 0.6); }
.pl-h-13 { height: calc((100% - 46px) * 0.65); }
.pl-h-14 { height: calc((100% - 46px) * 0.7); }
.pl-h-15 { height: calc((100% - 46px) * 0.75); }
.pl-h-16 { height: calc((100% - 46px) * 0.8); }
.pl-h-17 { height: calc((100% - 46px) * 0.85); }
.pl-h-18 { height: calc((100% - 46px) * 0.9); }
.pl-h-19 { height: calc((100% - 46px) * 0.95); }
.pl-h-20 { height: calc((100% - 46px) * 1); }

/* Mistakes */
.pl-perfect { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 700; color: var(--success); }
.pl-mistakes { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pl-mistake { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(var(--shade-rgb), 0.35); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.pl-mistake-n { display: inline-grid; place-items: center; min-width: 38px; height: 28px; padding: 0 8px; border-radius: 999px; font-size: 13px; font-weight: 800; color: #ffe3e3; background: rgba(255, 122, 122, 0.2); }
.pl-mistake-q { margin: 0 0 8px; font-weight: 700; }
.pl-mistake-a { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.pl-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px 4px 7px; border-radius: 999px; font-size: 13.5px; font-weight: 700; }
.pl-chip .race-icon { width: 15px; height: 15px; }
.pl-chip.is-wrong { color: #ffe3e3; background: rgba(255, 122, 122, 0.18); box-shadow: inset 0 0 0 1px rgba(255, 122, 122, 0.5); }
.pl-chip.is-right { color: #d9ffe9; background: rgba(95, 224, 161, 0.16); box-shadow: inset 0 0 0 1px rgba(95, 224, 161, 0.5); }
.pl-recent tr.is-current td { background: rgba(var(--blue-rgb), 0.22); }
.ch-done .stat-value small { font-size: 14px; color: var(--ink-soft); }
.ch-done .stat-value .gem-icon { width: 22px; height: 22px; margin-right: 4px; vertical-align: -2px; }
@media (max-width: 700px) {
  .pl-result { padding: 18px 16px 20px; }
  .pl-result-head { flex-direction: column; align-items: flex-start; }
  .pl-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pl .play-top-right { gap: 10px; }
}
