/* Extra features (js/extras*.js). Same tokens as style.css. */

/* Accessibility (set on <html> from the Accessibility page) */
html.a-dyslexia, html.a-dyslexia body, html.a-dyslexia button, html.a-dyslexia input, html.a-dyslexia select, html.a-dyslexia textarea {
  font-family: "Lexend", var(--sans) !important; letter-spacing: .02em; }
html.a-dyslexia h1, html.a-dyslexia h2, html.a-dyslexia h3, html.a-dyslexia .stat, html.a-dyslexia .hello { font-family: "Lexend", var(--head) !important; }
html.a-spacing body { line-height: 1.9; word-spacing: .16em; }
html.a-spacing p, html.a-spacing li { margin-bottom: .6em; }
html.a-large { font-size: 18px; }
html.a-large body { font-size: 17.5px; }
html.a-large .small { font-size: 15px; }
html.a-tint:not([data-theme="dark"]) { --bg: #FBF6E9; --sheet: #FFFCF3; --shade: #F2ECDC; }
@media (prefers-color-scheme: dark) { html.a-tint:not([data-theme="light"]) { --bg: #2B2B2B; --sheet: #323232; --shade: #3A3A3A; } }

/* hidden must win over display rules */
.points li[hidden], .model[hidden], .eyebrow[hidden], [hidden] { display: none !important; }

.x-cols { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.x-form { display: grid; gap: 0 var(--s3); grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); align-items: end; }
.x-sticky { position: sticky; top: 64px; z-index: 4; }
.x-done { border-color: var(--green); }
.x-cta .stat { line-height: 1.1; }
.x-clip { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--ink2); }
.x-ol { margin: 0; padding-left: 20px; } .x-ol li { margin-bottom: 6px; }
.x-ul { margin: 0; padding-left: 18px; } .x-ul li { margin-bottom: 6px; }

/* Level / XP */
.x-level { display: flex; gap: var(--s3); align-items: center; }
.x-lvl { width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font: 700 18px var(--head); flex: none; }
.x-badges { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.x-badge { border: 1px dashed var(--line); border-radius: var(--r); padding: var(--s3); display: flex; flex-direction: column; gap: 2px; opacity: .55; }
.x-badge.got { border-style: solid; border-color: var(--green); opacity: 1; }
.x-badge-i { font-size: 22px; color: var(--amber); }

/* Goals and countdown */
.x-goal { display: flex; gap: var(--s2); align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.x-goal:last-child { border-bottom: 0; }
.x-goal.ok .x-check { background: var(--green); color: #fff; border-color: var(--green); }
.x-check { width: 18px; height: 18px; border: 1px solid var(--line); border-radius: 4px; display: grid; place-items: center; font-size: 12px; flex: none; }
.x-count { display: flex; flex-direction: column; gap: var(--s2); }
.x-count-i { display: flex; gap: var(--s3); align-items: center; }
.x-days { font: 700 24px var(--head); min-width: 48px; text-align: center; padding: 4px 6px; border-radius: var(--r2); background: var(--shade); }

/* Analytics */
.x-heat-t th { font-size: 11px; font-weight: 600; text-align: center; padding: 4px; max-width: 110px; white-space: normal; line-height: 1.2; vertical-align: bottom; }
.x-heat-t td { padding: 0; }
td.x-heat { text-align: center; font: 600 13px var(--sans); padding: 10px 4px; border: 2px solid var(--sheet); border-radius: 6px; min-width: 52px; }
td.x-heat.none { color: var(--mute); background: var(--shade); }
.x-heat-row { margin-bottom: var(--s3); }

/* Question card add-ons */
.x-tip { margin: var(--s3) 0 0; background: color-mix(in srgb, var(--amber) 10%, transparent); border-left: 3px solid var(--amber); border-radius: 6px; padding: 6px 12px; font-size: 14px; }
.x-tip summary { cursor: pointer; font-weight: 600; color: var(--amber); }
.x-tip > div { padding: 6px 0 2px; }
.x-try textarea { font: 15px/1.6 var(--sans); }
.x-tick { margin: 3px 4px 0 0; width: 18px; height: 18px; flex: none; accent-color: var(--green); }
.x-hit { display: block; font-size: 11px; color: var(--green); margin-left: auto; padding-left: 8px; white-space: nowrap; }
.points li .x-hit { flex-basis: 100%; margin-left: 52px; white-space: normal; }
.points li { flex-wrap: wrap; }
.x-thread { margin-top: var(--s3); border-top: 1px solid var(--line); padding-top: var(--s3); }
.x-comments { display: flex; flex-direction: column; gap: 6px; }
.x-c { background: var(--shade); border-radius: var(--r2); padding: 6px 10px; max-width: 90%; }
.x-c.tutor { align-self: flex-start; border-left: 3px solid var(--ink); }
.x-c.tutee { align-self: flex-end; }
.x-tbox { padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.x-tbox .x-thread, .x-tbox [data-x="thread"] { border: 0; padding: 0; margin: 0; }

/* Drills and flashcards */
.x-opt { justify-content: flex-start !important; text-align: left; height: auto !important; min-height: var(--h); padding: 8px 14px !important; white-space: normal; }
.x-opt.x-right { border-color: var(--green); background: color-mix(in srgb, var(--green) 14%, var(--sheet)); opacity: 1; }
.x-opt.x-wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 12%, var(--sheet)); opacity: 1; }
.x-card { max-width: 520px; margin: 0 auto; min-height: 220px; border: 1px solid var(--line); border-radius: var(--r); background: var(--sheet); padding: var(--s5);
  display: flex; flex-direction: column; gap: var(--s3); justify-content: center; text-align: center; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.x-card-front { font: 600 22px var(--head); }
.x-card.flip .x-card-front { font-size: 16px; color: var(--ink2); }
.x-eq { font-size: 18px; margin: 6px 0; overflow-x: auto; }
.x-f { padding: 10px 0; border-bottom: 1px solid var(--line); }
.x-f:last-child { border-bottom: 0; }
.x-cw summary { cursor: pointer; display: flex; gap: var(--s2); align-items: baseline; flex-wrap: wrap; list-style: none; }
.x-cw summary::-webkit-details-marker { display: none; }
.x-cw-m { flex-basis: 100%; }
.x-cw[open] .x-cw-m { display: none; }
.x-eg { background: var(--shade); border-radius: var(--r2); padding: var(--s3); display: flex; flex-direction: column; gap: 6px; }
.x-eg-row { display: flex; gap: var(--s2); align-items: baseline; font-size: 14px; }
.x-eg-row .tag { flex: none; }
.x-pq { padding: 8px 0; border-bottom: 1px solid var(--line); }
.x-pq:last-child { border-bottom: 0; }
.x-pq summary { cursor: pointer; color: var(--ink2); }

/* Glossary */
.x-gl dl { margin: 0; }
.x-term { display: grid; grid-template-columns: minmax(130px, 220px) 1fr; gap: var(--s3); padding: 6px 0; border-bottom: 1px solid var(--line); }
.x-term:last-child { border-bottom: 0; }
.x-term dt { font-weight: 600; } .x-term dd { margin: 0; }
.x-term dd.x-hide { color: transparent; background: var(--shade); border-radius: 4px; cursor: pointer; user-select: none; }
.x-term dd.x-hide::after { content: "tap to show"; color: var(--mute); font-size: 12px; }
@media (max-width: 640px) { .x-term { grid-template-columns: 1fr; gap: 0; } }

/* RAG checklist */
.x-rag-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; margin-bottom: 4px; }
.x-rag-topic summary { cursor: pointer; }
.x-stmt { display: flex; gap: var(--s3); align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.x-rag { display: flex; gap: 4px; flex: none; }
.x-rag button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); background: var(--sheet); cursor: pointer; padding: 0; }
.x-rag .x-rag-r[aria-pressed="true"] { background: var(--red); border-color: var(--red); }
.x-rag .x-rag-a[aria-pressed="true"] { background: var(--amber); border-color: var(--amber); }
.x-rag .x-rag-g[aria-pressed="true"] { background: var(--green); border-color: var(--green); }
.x-rag .x-rag-r { border-color: color-mix(in srgb, var(--red) 50%, var(--line)); }
.x-rag .x-rag-a { border-color: color-mix(in srgb, var(--amber) 50%, var(--line)); }
.x-rag .x-rag-g { border-color: color-mix(in srgb, var(--green) 50%, var(--line)); }

/* Library */
.x-res { display: flex; gap: var(--s2); align-items: baseline; padding: 6px 0; flex-wrap: wrap; }

/* Wellbeing */
.x-moods { display: flex; gap: var(--s2); flex-wrap: wrap; }
.x-mood { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r2); background: var(--sheet); cursor: pointer; min-width: 74px; font-size: 13px; }
.x-mood span { font-size: 26px; }
.x-mood[aria-pressed="true"] { border-color: var(--ink); background: var(--shade); }

/* Photos */
.x-photo-row { display: flex; gap: var(--s4); align-items: flex-start; }
.x-photo-row img { width: 140px; max-height: 180px; object-fit: cover; border-radius: var(--r2); border: 1px solid var(--line); background: #fff; }
@media (max-width: 640px) { .x-photo-row { flex-direction: column; } .x-photo-row img { width: 100%; max-height: 320px; } }

/* Lessons, calendar, sessions */
.x-lesson { padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.x-lesson:last-child { border-bottom: 0; }
.x-slot { padding: 6px 0; border-bottom: 1px solid var(--line); }
.x-cal-day { display: grid; grid-template-columns: 70px 1fr; gap: var(--s3); padding: 8px 0; border-bottom: 1px solid var(--line); }
.x-cal-day:last-child { border-bottom: 0; }
.x-cal-d { font-size: 13px; color: var(--ink2); }
.x-cal-slots { display: flex; flex-direction: column; gap: 6px; }
.x-slot-i { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.x-slot-i > span:first-child { min-width: 120px; font-variant-numeric: tabular-nums; }

/* Timetable */
.x-tt-days { display: grid; gap: var(--s2); grid-template-columns: repeat(7, minmax(70px, 1fr)); }
.x-tt-days select { padding: 0 6px; }
@media (max-width: 640px) { .x-tt-days { grid-template-columns: repeat(4, 1fr); } }
.x-tt details { border-top: 1px solid var(--line); padding: 8px 0; }
.x-tt summary { cursor: pointer; }
.x-tt-t td { padding: 6px; vertical-align: top; }
.x-tt-t tr.x-today td { background: var(--shade); }
.x-blk { display: inline-block; font-size: 13px; border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; margin: 2px 4px 2px 0; background: var(--sheet); }

/* Mock builder and printing */
.x-mock { display: grid; gap: var(--s4); grid-template-columns: 1fr 1fr; align-items: start; }
@media (max-width: 800px) { .x-mock { grid-template-columns: 1fr; } }
.x-mq { display: flex; gap: var(--s2); align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.x-mq:last-child { border-bottom: 0; }
.x-mq > b { width: 22px; flex: none; }
.x-print-head { border-bottom: 2px solid var(--ink); padding-bottom: var(--s3); margin-bottom: var(--s4); }
.x-pq-print { padding: var(--s3) 0; border-bottom: 1px solid var(--line); break-inside: avoid; }
.x-lines { background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(2em - 1px), var(--line) calc(2em - 1px), var(--line) 2em); margin: 8px 0; }
.x-bounds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 var(--s2); }
@media print {
  .x-noprint, .demo-bar, .top, .exam-banner, .toast { display: none !important; }
  main { max-width: none; padding: 0; }
  body { background: #fff; color: #000; }
  .sheet { border: 0; padding: 0; }
  .q-img { filter: none !important; }
  .x-print .answer { background: none; padding: 0; }
}
