:root {
  --bg: #f6f4ee;
  --panel: #ffffff;
  --ink: #1d1d1b;
  --muted: #6b6a66;
  --line: #dedbd2;
  --accent: #1f5fbf;
  --accent-ink: #ffffff;
  --ok: #1e7f4f;
  --bad: #b3261e;
  --warn: #9a6700;
  --soft: #eef3fb;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.5; font-size: 16px; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: .5rem .9rem; border-radius: 8px; text-decoration: none; display: inline-block; line-height: 1.2;
}
button:hover { border-color: #b8b4a8; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--bad); border-color: var(--bad); }
button.warn { color: var(--warn); border-color: var(--warn); }
button.small { padding: .25rem .6rem; font-size: .9rem; }
button.link { border: none; background: none; color: var(--accent); padding: 0; text-decoration: underline; }
input, select, textarea { font: inherit; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid #9ec0f5; outline-offset: 1px; }
textarea { width: 100%; min-height: 6rem; }
label { display: block; font-size: .92rem; color: var(--muted); margin-bottom: .25rem; }
.field { margin-bottom: .9rem; }
.field input[type=text], .field input[type=password], .field input[type=number], .field input[type=url], .field select { width: 100%; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.tiny { font-size: .8rem; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.warnc { color: var(--warn); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; }
.loading { padding: 3rem; text-align: center; color: var(--muted); }
.wrap { max-width: 980px; margin: 0 auto; padding: 1.2rem 16px 4rem; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .brand { font-weight: 600; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.card.soft { background: var(--soft); border-color: #cfdcf3; }
.card h2 { margin-top: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--line); padding: .8rem 0; display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; }
.list li:first-child { border-top: none; }
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .78rem; background: #ebe8df; color: var(--muted); white-space: nowrap; }
.badge.new { background: #dfe9fb; color: #1f4fa0; }
.badge.progress { background: #fff1cc; color: #7a5200; }
.badge.done { background: #dcf1e5; color: #14603a; }
.badge.paused { background: #fde2df; color: #8a1f18; }
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs button { border: none; background: none; border-bottom: 3px solid transparent; border-radius: 0; padding: .5rem .8rem; color: var(--muted); }
.tabs button.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.notice { padding: .7rem .9rem; border-radius: 8px; background: #fff8e1; border: 1px solid #f1dc8f; margin-bottom: 1rem; }
.notice.error { background: #fdecea; border-color: #f3b4ae; }
.notice.success { background: #e7f6ed; border-color: #a9dcbd; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
pre { background: #f2f0ea; padding: .7rem; border-radius: 8px; overflow: auto; font-size: .85rem; }

/* Exam */
.exam { user-select: none; -webkit-user-select: none; }
.exam .exambar { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .55rem 16px; background: #1d1d1b; color: #fff; position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.exam .exambar .timer { font-variant-numeric: tabular-nums; font-size: 1.25rem; font-weight: 600; letter-spacing: .02em; }
.exam .exambar .timer.low { color: #ffb3ad; }
.exam .exambar button { background: #2f2f2c; color: #fff; border-color: #4a4a46; }
.exam .exambar button.primary { background: var(--accent); border-color: var(--accent); }
.exam .exambar button.stop { background: #6d3b00; border-color: #8a4b00; }
.exam .tasknav { display: flex; gap: .3rem; flex-wrap: wrap; }
.exam .tasknav button { padding: .3rem .6rem; }
.exam .tasknav button.active { background: #fff; color: #1d1d1b; }
.exam .body { max-width: 900px; margin: 0 auto; padding: 1.2rem 16px 6rem; }
.task { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; margin-bottom: 1.2rem; }
.task .head { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; flex-wrap: wrap; }
.task .instructions { font-weight: 600; margin-bottom: 1rem; }
.task .passage { font-family: var(--serif); font-size: 1.04rem; line-height: 1.6; background: #fbfaf6; border: 1px solid #ece9df; border-radius: 8px; padding: 1rem 1.1rem; margin: .8rem 0 1rem; }
.task .passage h3 { text-align: center; font-family: var(--font); letter-spacing: .04em; }
.task .passage p { margin: 0 0 .9em; text-align: justify; }
.task .passage .plabel { font-weight: 700; font-family: var(--font); margin-right: .4em; }
.task .passage .gapmark { display: inline-block; font-family: var(--font); font-weight: 700; background: #fff1cc; padding: 0 .35em; border-radius: 4px; margin: 0 .15em; }
.task .passage select.inline { font-size: .95rem; padding: .15rem .3rem; margin: 0 .2em; vertical-align: baseline; }
.task .passage input.inline { font-size: .95rem; padding: .15rem .4rem; margin: 0 .2em; min-width: 12rem; }
.task .gaplines { line-height: 2; }
.task .gaplines .line { margin: 0 0 .25em; }
.task .gaplines input.inline { font-size: .95rem; padding: .15rem .4rem; margin: 0 .2em; min-width: 14rem; }
.task .bank { display: flex; gap: .5rem .9rem; flex-wrap: wrap; border: 1px solid var(--line); padding: .5rem .8rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 600; }
.task .item { margin: 1rem 0; padding-top: .8rem; border-top: 1px dashed var(--line); }
.task .item:first-of-type { border-top: none; }
.task .item .stem { font-weight: 600; margin-bottom: .4rem; }
.task .item .group { font-weight: 700; color: var(--muted); margin: 1rem 0 .2rem; }
.task .options { display: grid; gap: .25rem; }
.task .options label { display: flex; gap: .55rem; align-items: flex-start; padding: .35rem .5rem; border-radius: 6px; cursor: pointer; color: var(--ink); font-size: 1rem; }
.task .options label:hover { background: #f2f0ea; }
.task .options label.chosen { background: #e6effc; }
.task .options label.correct { background: #dcf1e5; }
.task .options label.wrong { background: #fde2df; }
.task .options input[type=radio] { margin-top: .3rem; }
.task .optlist { margin: .5rem 0 1rem; padding: .6rem .9rem; border: 1px solid var(--line); border-radius: 8px; }
.task .optlist div { padding: .15rem 0; }
.task .optlist b { display: inline-block; min-width: 1.6em; }
.task .matchrow { display: flex; gap: .8rem; align-items: flex-start; padding: .4rem 0; }
.task .matchrow .id { font-weight: 700; min-width: 2.6em; }
.task .matchrow select { min-width: 5rem; }
.task .matchrow .txt { flex: 1; }
.task .review { margin-top: .4rem; font-size: .92rem; }
.task .review .given { padding: .2rem .5rem; border-radius: 6px; display: inline-block; }
.task .review .given.ok { background: #dcf1e5; }
.task .review .given.bad { background: #fde2df; }
.task .review .given.review { background: #fff1cc; }
.task .transcript { margin-top: 1rem; }
.task .transcript summary { cursor: pointer; font-weight: 600; }
.task .transcript .seg { margin: .6rem 0; padding: .6rem .8rem; background: #fbfaf6; border-radius: 8px; white-space: pre-wrap; font-family: var(--serif); }
.player { position: sticky; top: 3.4rem; z-index: 4; background: #fff8e1; border: 1px solid #f1dc8f; border-radius: 10px; padding: .7rem 1rem; margin-bottom: 1rem; display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; }
.player .phase { font-weight: 600; }
.player .count { font-variant-numeric: tabular-nums; font-size: 1.2rem; }
.player .bar { height: 6px; background: #f1dc8f; border-radius: 3px; overflow: hidden; width: 100%; }
.player .bar > div { height: 100%; background: #9a6700; transition: width .3s linear; }
.overlay { position: fixed; inset: 0; background: #14140f; color: #fff; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 2rem; text-align: center; }
.overlay .box { max-width: 520px; }
.overlay h1 { font-size: 2rem; }
.overlay button { font-size: 1.1rem; padding: .8rem 1.4rem; }
.overlay .muted { color: #c9c7be; }
.pill { display: inline-block; padding: .15rem .6rem; border-radius: 99px; background: #eee; font-size: .85rem; }
.scorebig { font-size: 2.4rem; font-weight: 700; }
.events { font-size: .88rem; }
.events li { padding: .15rem 0; }
.feedback h3 { margin-top: 1rem; }
.feedback ul { margin: .3rem 0 .8rem 1.2rem; padding: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; font-size: .92rem; }
.recorder .seg { border-top: 1px solid var(--line); padding: .8rem 0; }
.recorder .seg .tr { white-space: pre-wrap; font-family: var(--serif); background: #fbfaf6; padding: .5rem .7rem; border-radius: 8px; margin: .4rem 0; max-height: 9rem; overflow: auto; }
.recorder .rec { color: #b3261e; font-weight: 700; }
.jsonbox { width: 100%; min-height: 16rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
/* Two facing sheets: the text on the left, the questions on the right, the way
   the printed paper opens. One column below 1000px and on narrow windows. */
.task.split .sheets { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.4rem; align-items: start; }
.task.split .sheet.left { position: sticky; top: 4rem; max-height: calc(100vh - 6rem); overflow: auto; }
.task.split .sheet.left .passage { margin-top: 0; }
.task.split .sheet.right .item:first-of-type { border-top: none; padding-top: 0; }
@media (max-width: 1000px) {
  .task.split .sheets { grid-template-columns: 1fr; }
  .task.split .sheet.left { position: static; max-height: none; overflow: visible; }
}

/* Task 7: three gaps per row, the four options printed under each number. */
.task .clozegrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin-top: 1rem; }
.task .clozecell { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; }
.task .clozecell.ok { border-color: #a9dcbd; background: #f4fbf7; }
.task .clozecell.bad { border-color: #f3b4ae; background: #fff7f6; }
.task .clozecell .num { font-weight: 700; margin-bottom: .3rem; }
.task .clozecell label { display: flex; gap: .45rem; align-items: flex-start; padding: .2rem .3rem; border-radius: 6px; cursor: pointer; font-size: .95rem; }
.task .clozecell label:hover { background: #f2f0ea; }
.task .clozecell label.chosen { background: #e6effc; }
.task .clozecell label.correct { background: #dcf1e5; }
.task .clozecell label.wrong { background: #fde2df; }
.task .clozecell input[type=radio] { margin-top: .25rem; }
@media (max-width: 760px) { .task .clozegrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .task .clozegrid { grid-template-columns: 1fr; } }

.task .pickmsg { margin: .6rem 0; }
.task .topics { display: grid; gap: .5rem; margin-bottom: .9rem; }
.task .topics label.topic { display: flex; gap: .55rem; align-items: flex-start; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.task .topics label.topic.chosen { background: #e6effc; border-color: #9cb8e8; }

/* The essay's CKE score sheet. */
.writingreview { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: .8rem; }
.writingreview .scorebig.small { font-size: 1.6rem; }
.writingreview table.criteria { width: 100%; border-collapse: collapse; margin: .5rem 0 .8rem; }
.writingreview table.criteria td { border-top: 1px solid var(--line); padding: .35rem .5rem; vertical-align: top; }
.writingreview table.criteria td.num { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.writingreview ul.tight { margin: .3rem 0 .8rem 1.2rem; padding: 0; }
.writingreview h4 { margin: .8rem 0 .2rem; }

.progress .bar { height: 6px; background: #eee; border-radius: 3px; overflow: hidden; margin-bottom: .35rem; }
.progress .bar .fill { height: 100%; background: var(--accent, #2f6fd0); transition: width .3s ease; }

@media print { body { display: none !important; } }
@media (max-width: 640px) {
  .exam .exambar { padding: .5rem 12px; }
  .task { padding: 1rem; }
  .task .matchrow { flex-wrap: wrap; }
}

/* --- Grammar module ------------------------------------------------------ */
.md { line-height: 1.55; }
.md h2 { font-size: 1.2rem; margin: 1.4rem 0 .5rem; padding-bottom: .25rem; border-bottom: 1px solid var(--line); }
.md h2:first-child { margin-top: 0; }
.md h3 { font-size: 1.02rem; margin: 1.1rem 0 .35rem; }
.md h4 { font-size: .96rem; margin: .9rem 0 .3rem; }
.md p { margin: 0 0 .7em; }
.md ul, .md ol { margin: 0 0 .8em 1.3rem; padding: 0; }
.md li { margin: .2em 0; }
.md table { width: 100%; border-collapse: collapse; margin: .4rem 0 1rem; font-size: .93rem; }
.md th, .md td { border: 1px solid var(--line); padding: .35rem .5rem; text-align: left; vertical-align: top; }
.md th { background: #f2f0ea; }
.md blockquote { margin: .6rem 0 1rem; padding: .5rem .9rem; border-left: 4px solid var(--accent); background: var(--soft); border-radius: 0 8px 8px 0; }
.md blockquote p:last-child { margin-bottom: 0; }
.md hr { border: none; border-top: 1px solid var(--line); margin: 1.4rem 0; }
.md s { color: var(--bad); }
.md code { background: #f2f0ea; padding: 0 .25em; border-radius: 4px; font-size: .9em; }
.md i, .md em { font-style: italic; }
.badge.lvl { font-weight: 600; }
.badge.lvl-p { background: #dcf1e5; color: #14603a; }
.badge.lvl-r { background: #dfe9fb; color: #1f4fa0; }
.grammar .cat { margin-bottom: .6rem; }
.grammar .cat summary { cursor: pointer; font-weight: 600; padding: .5rem 0; }
.grammar .topics { list-style: none; margin: 0 0 .4rem 0; padding: 0; }
.grammar .topics li { display: flex; gap: .6rem; align-items: baseline; padding: .3rem 0 .3rem 1rem; border-top: 1px dashed var(--line); }
.grammar .topics li:first-child { border-top: none; }
.grammar .topics .num { color: var(--muted); font-size: .85rem; min-width: 1.4rem; }
.grammar .topics a { text-decoration: none; }
.grammar .topics a:hover { text-decoration: underline; }
.grammar .topics .group { padding-left: 1rem; color: var(--muted); font-size: .85rem; font-weight: 600; margin-top: .4rem; border-top: none; }
.grammar .search { width: 100%; }
.grammar .examples { margin: .5rem 0 1rem; }
.grammar .examples li { font-family: var(--serif); font-size: 1.02rem; margin: .15rem 0; }
.grammar .examples .r { color: #1f4fa0; }
.grammar .examples .tag { font-family: var(--font); font-size: .72rem; color: #1f4fa0; background: #dfe9fb; padding: 0 .4em; border-radius: 99px; margin-left: .35em; vertical-align: middle; }
.grammar .prevnext { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1rem; }
.grammar .askbox textarea { min-height: 4rem; }
.grammar .qa { border-top: 1px solid var(--line); padding: .8rem 0; }
.grammar .qa .q { font-weight: 600; margin-bottom: .3rem; }
.grammar .qa .ex { margin: .4rem 0 0 1rem; font-size: .93rem; }
.grammar .qa .ex li { margin: .15rem 0; }
.lesson .lessonhead { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.lesson .pointlinks { display: flex; gap: .4rem; flex-wrap: wrap; margin: .4rem 0 .2rem; }
.lesson .pointlinks a { font-size: .85rem; background: var(--soft); border: 1px solid #cfdcf3; border-radius: 99px; padding: .1rem .6rem; text-decoration: none; }
.lesson .checkbar { position: sticky; bottom: 0; z-index: 6; background: var(--panel); border-top: 1px solid var(--line); padding: .7rem 16px; margin: 0 -16px; display: flex; gap: .8rem; align-items: center; justify-content: space-between; flex-wrap: wrap; box-shadow: 0 -4px 12px rgba(0,0,0,.05); }
.lesson .checkbar .progress { flex: 1; min-width: 12rem; }
.lesson .task .explain { margin: .3rem 0 .2rem 1.2rem; font-size: .9rem; color: #444; }
.lesson .task .explain b { color: var(--muted); font-weight: 600; }
.lesson .verdict { font-size: .9rem; margin: .2rem 0 .2rem 1.2rem; }
.lesson .mistakes li { margin-bottom: .6rem; }
.lesson .mistakes .rule { font-weight: 600; }
.lesson .attempts { font-size: .88rem; color: var(--muted); }
.lesson .task .review .given.review { background: #fff1cc; }
/* Teacher: lesson generator and editor */
.pointpicker { max-height: 26rem; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: .4rem .8rem; }
.pointpicker details { margin: .2rem 0; }
.pointpicker summary { cursor: pointer; font-weight: 600; padding: .25rem 0; }
.pointpicker label { display: flex; gap: .5rem; align-items: baseline; color: var(--ink); font-size: .92rem; padding: .15rem 0 .15rem .4rem; margin: 0; cursor: pointer; }
.pointpicker label:hover { background: #f6f4ee; }
.pointpicker label input { margin-top: .2rem; }
.pointpicker .grp { color: var(--muted); font-size: .8rem; font-weight: 600; margin: .3rem 0 0 .4rem; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin: .5rem 0; }
.chips span { background: var(--soft); border: 1px solid #cfdcf3; border-radius: 99px; padding: .1rem .6rem; font-size: .85rem; }
.chips span button { border: none; background: none; padding: 0 0 0 .3rem; color: var(--muted); cursor: pointer; }
.exrows { display: grid; gap: .3rem; }
.exrow { display: grid; grid-template-columns: auto 1fr auto auto; gap: .6rem; align-items: center; padding: .3rem .4rem; border-radius: 6px; }
.exrow:hover { background: #f6f4ee; }
.exrow .lbl { font-size: .95rem; }
.exrow .mat { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.exrow input[type=number] { width: 4.2rem; }
.exrow.off .lbl, .exrow.off .mat { color: #aaa; }
.manualedit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
.manualedit textarea { min-height: 30rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
.manualedit .preview { max-height: 32rem; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; background: #fbfaf6; }
@media (max-width: 900px) { .manualedit { grid-template-columns: 1fr; } .exrow { grid-template-columns: auto 1fr; } }

/* --- Vocabulary module --------------------------------------------------- */
.modules { margin-bottom: 1rem; } .modules .card { margin-bottom: 0; }
.vocab .topicgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .7rem; margin-top: .6rem; }
.vocab .topicgrid a.topic { display: flex; gap: .7rem; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; text-decoration: none; color: var(--ink); background: #fbfaf6; }
.vocab .topicgrid a.topic:hover { border-color: #9cb8e8; background: var(--soft); }
.vocab .topicgrid .num { font-weight: 700; color: var(--accent); font-size: 1.3rem; min-width: 1.6rem; line-height: 1.1; }
.vocab .topicgrid .name { font-weight: 600; }
.vocab .topicgrid .subs { display: flex; flex-wrap: wrap; gap: .15rem .5rem; font-size: .78rem; color: var(--muted); margin-top: .25rem; }
.vocab .topicgrid .subs span::after { content: " ·"; color: #c8c5bb; }
.vocab .topicgrid .subs span:last-child::after { content: ""; }
.vocab .chips .r, .vocab .topicgrid .r { color: #1f4fa0; font-size: .72rem; }
.vocab .hits { margin-bottom: .8rem; }
table.words { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.words td { padding: .3rem .45rem; border-bottom: 1px solid #ece9df; vertical-align: top; }
table.words td.tick { width: 1.6rem; padding-right: 0; } table.words td.tick input { margin: .15rem 0 0; }
table.words td.en { white-space: nowrap; } table.words td.pl { min-width: 9rem; } table.words td.ex { color: #444; font-family: var(--serif); }
table.words .pos { font-size: .72rem; color: var(--muted); background: #f2f0ea; border-radius: 4px; padding: 0 .3em; vertical-align: middle; }
table.words tr.known td { color: #9a988f; } table.words tr.known td.en b { font-weight: 500; }
table.words button.say { border: none; background: none; padding: 0 .2rem; cursor: pointer; font-size: .9rem; opacity: .6; }
table.words button.say:hover { opacity: 1; }
label.inline { display: inline-flex; gap: .35rem; align-items: center; color: var(--ink); margin: 0; }
.wsec { margin: .4rem 0; } .wsec summary { cursor: pointer; font-weight: 600; padding: .4rem 0; }
.flash { margin-top: .6rem; }
.flash .fcard { border: 2px solid #cfdcf3; background: var(--soft); border-radius: 14px; min-height: 11rem; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 1.4rem 1rem; margin: .8rem 0; cursor: pointer; user-select: none; }
.flash .fcard.flipped { background: #fff8e1; border-color: #f1dc8f; }
.flash .fcard.done { cursor: default; background: #e7f6ed; border-color: #a9dcbd; }
.flash .fcard .big { font-size: 1.6rem; font-weight: 600; line-height: 1.3; }
.flash .fcard .big .pos { font-size: .8rem; color: var(--muted); font-weight: 400; vertical-align: middle; }
.flash .fcard .ex { margin-top: .6rem; font-family: var(--serif); color: #444; }
.flash button.ok { color: var(--ok); border-color: var(--ok); }
.topictext .passage-md { font-family: var(--serif); font-size: 1.04rem; line-height: 1.65; background: #fbfaf6; border: 1px solid #ece9df; border-radius: 8px; padding: 1rem 1.1rem; }
.topictext .passage-md b { background: #fff1cc; padding: 0 .15em; border-radius: 3px; font-weight: 600; }
.topictext .gloss { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .2rem .9rem; margin-top: .7rem; font-size: .92rem; }
.topictext .gloss div { display: flex; gap: .5rem; justify-content: space-between; border-bottom: 1px dotted var(--line); padding: .15rem 0; }
.topictext .gloss span { color: var(--muted); text-align: right; }
.lessonaudio { background: #fff8e1; border: 1px solid #f1dc8f; border-radius: 10px 10px 0 0; padding: .6rem 1rem .2rem; margin-bottom: -1px; }
.lessonaudio .seg { display: block; padding: .4rem 0; border-top: 1px dashed #f1dc8f; }
.lessonaudio .seg:first-of-type { border-top: none; }
.lessonaudio audio { height: 2.2rem; max-width: 100%; }
.lesson .pointlinks .sub { font-size: .85rem; color: var(--muted); padding: .1rem .2rem; }
.wordsec table.words td.ex { font-size: .92rem; }
@media (max-width: 640px) { table.words td.ex { display: none; } table.words td.en { white-space: normal; } .lessonaudio .row.between { flex-direction: column; align-items: flex-start; } }
/* Teacher: vocabulary generator and editor */
.subpick { display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.genpart { padding: .6rem 0; border-top: 1px dashed var(--line); }
.genpart:first-child { border-top: none; padding-top: 0; }
.listenopts .grid2 { margin-bottom: .4rem; }
table.wordedit { width: 100%; border-collapse: collapse; }
table.wordedit th { font-size: .8rem; }
table.wordedit td { padding: .15rem .25rem; border-bottom: 1px solid #ece9df; }
table.wordedit input[type=text], table.wordedit select { width: 100%; padding: .25rem .4rem; font-size: .92rem; }
table.wordedit td:nth-child(2) { width: 9rem; } table.wordedit td:last-child { width: 2.2rem; }

.lessonaudio .transcript { margin: .3rem 0 .2rem; }
.lessonaudio .transcript summary { cursor: pointer; font-size: .85rem; color: var(--muted); }
.lessonaudio .turns { font-family: var(--serif); background: #fffdf5; border: 1px solid #f1dc8f; border-radius: 8px; padding: .5rem .8rem; margin-top: .3rem; max-height: 22rem; overflow: auto; }
.lessonaudio .turns p { margin: 0 0 .4em; } .lessonaudio .turns b { font-family: var(--font); font-size: .9rem; }
.editorbar2 { margin: -.4rem 0 .8rem; gap: .4rem .6rem; }

/* Where to learn this: chips under a mistake and the focus of a lesson */
.learn { display: flex; flex-wrap: wrap; gap: .3rem .4rem; align-items: center; margin-top: .35rem; }
.focus { display: inline-flex; flex-wrap: wrap; gap: .3rem .4rem; align-items: center; }
.chip { display: inline-block; font-size: .82rem; padding: .1rem .55rem; border-radius: 99px; text-decoration: none; border: 1px solid var(--line); background: #f6f4ee; color: var(--ink); line-height: 1.5; }
a.chip:hover { border-color: #9cb8e8; text-decoration: none; }
.chip.g { background: var(--soft); border-color: #cfdcf3; }
.chip.v { background: #fff8e1; border-color: #f1dc8f; }
.chip.l { background: #e7f6ed; border-color: #a9dcbd; }
.revision { margin: .6rem 0 .9rem; }
button.tiny.link { font-size: .8rem; }
.lookup .dict { margin-top: .4rem; border-top: 1px dashed var(--line); padding-top: .35rem; font-size: .9rem; }
.lookup .dict .hit { margin: .2rem 0; }
.list.lessons li .focus { margin: .15rem 0; }
.topicrow { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .7rem; margin: .4rem 0; background: #fbfaf6; }
.card.requests .learn { margin: .2rem 0; }

/* --- Accounts ------------------------------------------------------------ */
.acctbar { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .45rem .8rem; margin-bottom: 1rem; }
.login .tabs { margin-bottom: .8rem; }
.list li .due { color: #7a5200; }
table.users td, table.users th { font-size: .92rem; }
table.users .tiny button { margin-left: .3rem; }
.assignbox { border: 1px dashed var(--line); border-radius: 8px; padding: .6rem .8rem; margin: .5rem 0; background: #fbfaf6; }
.assignbox .grid2 { gap: .5rem 1rem; }
.assignbox .field { margin-bottom: .4rem; }
.assignbox ul.list li { padding: .45rem 0; }
.temppw { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.1rem; background: #fff8e1; border: 1px solid #f1dc8f; border-radius: 6px; padding: .2rem .5rem; }

/* --- Reading comfort (student settings) ----------------------------------- */
body[data-size="large"] { font-size: 18px; }
body[data-size="larger"] { font-size: 20px; }
body[data-font="verdana"] { --font: Verdana, Geneva, sans-serif; --serif: Verdana, Geneva, sans-serif; }
body[data-font="dyslexic"] { --font: "OpenDyslexic", "Atkinson Hyperlegible", Verdana, Geneva, sans-serif; --serif: "OpenDyslexic", "Atkinson Hyperlegible", Verdana, Geneva, sans-serif; }
body[data-spacing="on"] { letter-spacing: .04em; word-spacing: .12em; line-height: 1.8; }
body[data-spacing="on"] .task .passage, body[data-spacing="on"] .md, body[data-spacing="on"] .topictext .passage-md { line-height: 1.9; }
body[data-contrast="on"] { --bg: #ffffff; --panel: #ffffff; --ink: #000000; --muted: #2b2b2b; --line: #555555; --accent: #0030a0; --soft: #eef3ff; }
body[data-contrast="on"] .badge { color: #000; background: #e4e4e4; }
body[data-contrast="on"] .task .passage { background: #fff; border-color: #555; }
.comfort .field label.inline { margin-top: 1.6rem; }

/* Teacher: item analysis */
table.items tr.hard td { background: #fff7f6; }

/* --- The error bank (My mistakes) ------------------------------------------ */
.mistakes .stats { display: flex; gap: 1.2rem; flex-wrap: wrap; margin: .4rem 0 1rem; }
.mistakes .stats b { font-size: 1.4rem; }
.mistakes .mcard { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: .9rem 1.1rem; margin-bottom: .9rem; }
.mistakes .mcard .src { font-size: .85rem; color: var(--muted); }
.mistakes .mcard .task { margin: .6rem 0; padding: .8rem 1rem; }
.mistakes .mcard .task .head { display: none; }
.mistakes .mcard .verdict { margin: .4rem 0; font-weight: 600; }
.mistakes .mcard .why { margin: .5rem 0; padding: .5rem .8rem; background: #fbfaf6; border-radius: 8px; }
.mistakes .box { display: inline-block; font-size: .72rem; padding: 0 .45rem; border-radius: 99px; background: #ebe8df; color: var(--muted); margin-left: .3rem; }
.mistakes .box.b5 { background: #dcf1e5; color: #14603a; }
.mistakes .tagchips .chip { cursor: pointer; }
.mistakes .tagchips .chip.on { outline: 2px solid var(--accent); }
.mistakes table.all td { font-size: .92rem; }
.hintbar { margin: -.6rem 0 1rem; padding: .5rem .9rem; border: 1px dashed #f1dc8f; background: #fffdf5; border-radius: 8px; font-size: .92rem; }
.hintbar .h { margin: .3rem 0 0; padding-left: .2rem; }
.hintbar .h b { color: #7a5200; }

/* --- My words (the deck) and the Today card -------------------------------- */
button.deckbtn { border: none; background: none; padding: 0 .15rem; cursor: pointer; color: #b8b4a8; font-size: 1rem; line-height: 1; }
button.deckbtn.on { color: #d9a400; }
button.deckbtn.small { border: 1px solid var(--line); border-radius: 8px; padding: .2rem .5rem; font-size: .85rem; color: var(--ink); }
button.deckbtn.small.on { border-color: #d9a400; }
.cards .stats { display: flex; gap: 1.2rem; flex-wrap: wrap; margin: .4rem 0 .2rem; }
.cards .stats b { font-size: 1.4rem; }
.cards .box { display: inline-block; font-size: .72rem; padding: 0 .45rem; border-radius: 99px; background: #ebe8df; color: var(--muted); }
.cards .box.b5 { background: #dcf1e5; color: #14603a; }
.cards .fcard .pos { font-size: .8rem; color: var(--muted); font-weight: 400; vertical-align: middle; }
.card.next { background: linear-gradient(135deg, #eef3fb, #fbfaf6); border-color: #cfdcf3; }
.card.next .countdown { font-weight: 600; color: #1f4fa0; }
.card.next .countdown.soon { color: #8a1f18; }
.card.next .nextgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin: .6rem 0; }
.card.next .tile { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; text-align: left; padding: .55rem .8rem; }
.card.next .tile b { font-size: 1.4rem; line-height: 1.1; }
.card.next .tile span { font-size: .85rem; color: var(--muted); }
.card.next .tile.hot { border-color: var(--accent); }
.card.next .skills { margin-top: .4rem; }
.card.next .skill { display: grid; grid-template-columns: 8rem 1fr 3.2rem; gap: .6rem; align-items: center; font-size: .9rem; margin: .2rem 0; }
.card.next .skill .bar { height: 8px; background: #e6e3da; border-radius: 4px; overflow: hidden; }
.card.next .skill .bar > div { height: 100%; border-radius: 4px; }
.card.next .skill .bar .good { background: var(--ok); } .card.next .skill .bar .mid { background: #e0a800; } .card.next .skill .bar .low { background: var(--bad); }
.card.next .skill .pct { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .card.next .skill { grid-template-columns: 6rem 1fr 3rem; } }

/* --- The essay: second draft, comparison, model answer ---------------------- */
.rewrite textarea { min-height: 16rem; font-family: var(--serif); font-size: 1.02rem; line-height: 1.55; }
.rewrite table.compare { width: auto; margin: .5rem 0; }
.rewrite table.compare td, .rewrite table.compare th { padding: .25rem .7rem; text-align: center; }
.rewrite table.compare td:first-child { text-align: left; }
.rewrite .up { color: var(--ok); font-weight: 700; } .rewrite .down { color: var(--bad); font-weight: 700; }
.rewrite .diff { font-family: var(--serif); line-height: 1.7; background: #fbfaf6; border: 1px solid #ece9df; border-radius: 8px; padding: .8rem 1rem; white-space: pre-wrap; }
.rewrite .diff del { background: #fde2df; text-decoration: line-through; color: #8a1f18; }
.rewrite .diff ins { background: #dcf1e5; text-decoration: none; color: #14603a; }
.rewrite .model { border-top: 1px solid var(--line); margin-top: .8rem; padding-top: .6rem; }
.rewrite .model .text { font-family: var(--serif); line-height: 1.65; white-space: pre-wrap; background: #fbfaf6; border: 1px solid #ece9df; border-radius: 8px; padding: .8rem 1rem; }

/* --- Speaking (matura ustna) ------------------------------------------------ */
.speaking .parthead { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; flex-wrap: wrap; }
.speaking .parthead h2 { margin: 0 0 .4rem; }
.speaking .timer { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); }
.speaking .timer.low { color: var(--bad); }
.speaking .sheet { white-space: pre-wrap; font-family: var(--serif); background: #fbfaf6; border: 1px solid #ece9df; border-radius: 8px; padding: .8rem 1rem; margin: .5rem 0 .8rem; }
.speaking .sheetbox summary { cursor: pointer; color: var(--muted); }
.speaking .points { list-style: none; margin: .3rem 0 .8rem; padding: 0; display: grid; gap: .15rem; font-size: .92rem; }
.speaking .points li { color: var(--muted); }
.speaking .points li.done { color: var(--ok); }
.speaking .line { display: flex; gap: .6rem; align-items: baseline; margin: .25rem 0; }
.speaking .line .who { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; min-width: 5.2rem; color: var(--muted); }
.speaking .line.examiner .who { color: #1f4fa0; }
.speaking .line .txt { flex: 1; }
.speaking .line.student .txt { font-family: var(--serif); }
.speaking .examiner { background: var(--soft); border: 1px solid #cfdcf3; border-radius: 10px; padding: .6rem .9rem; margin: .6rem 0; }
.speaking .examiner .line { margin: 0; }
.speaking .conv { margin: .4rem 0; max-height: 24rem; overflow: auto; }
.speaking .qa { margin: .3rem 0; padding: .2rem 0; border-top: 1px dashed var(--line); }
.speaking .answer { margin: .6rem 0; }
.speaking .answer button.mic { font-size: 1.1rem; padding: .7rem 1.2rem; }
.speaking .answer.listening .rec { font-weight: 600; color: var(--bad); margin-bottom: .4rem; }
.speaking .answer .dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; background: var(--bad); animation: pulse 1s infinite; vertical-align: middle; margin-right: .2rem; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.speaking .answer .interim { min-height: 2.4rem; font-family: var(--serif); background: #fbfaf6; border: 1px solid #ece9df; border-radius: 8px; padding: .5rem .8rem; margin-bottom: .5rem; }
.speaking .answer textarea { font-family: var(--serif); font-size: 1.02rem; margin-bottom: .4rem; }
.speaking .photo img { max-width: 100%; max-height: 60vh; border-radius: 8px; border: 1px solid var(--line); display: block; margin: .4rem 0 .8rem; }
.speaking .photo.described { background: #fbfaf6; border: 1px solid #ece9df; border-radius: 8px; padding: .7rem 1rem; margin: .4rem 0 .8rem; font-family: var(--serif); }
.speaking .photo.described .tiny { font-family: var(--font); margin-bottom: .3rem; }
.speaking .photo.described p { margin: 0; }
.speaking .options { margin: .3rem 0 .6rem 1.2rem; padding: 0; }
.speaking .options li { margin: .2rem 0; }
.speaking .report table.criteria { width: 100%; border-collapse: collapse; margin: .4rem 0 .8rem; }
.speaking .report table.criteria td { border-top: 1px solid var(--line); padding: .4rem .5rem; vertical-align: top; }
.speaking .report table.criteria td.num { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; width: 4.5rem; }
.speaking .report tr.muted td { color: var(--muted); }
.speaking .report .pt { display: inline-block; margin: .1rem .6rem .1rem 0; }
.speaking .report .pt.ok { color: var(--ok); } .speaking .report .pt.bad { color: var(--bad); }
.speaking .report .overall { font-size: 1.02rem; }
.speaking .report table.corrections td { padding: .3rem .5rem; border-top: 1px solid var(--line); vertical-align: top; }
.speaking .report td.wrong { color: var(--bad); text-decoration: line-through; }
.speaking .report td.right { color: var(--ok); font-weight: 600; }
.speaking .report .transcript summary { cursor: pointer; font-weight: 600; margin-top: .6rem; }
.speaking .report h4 { margin: .8rem 0 .2rem; color: var(--muted); }
.speaking audio.rec { display: block; height: 2.2rem; max-width: 100%; margin: .2rem 0 .3rem 5.8rem; }
.speaking .prep .sheet { margin-bottom: .6rem; }
/* Teacher: the set editor */
.oraledit .qlist { display: grid; gap: .35rem; }
.oraledit .qlist .row { flex-wrap: nowrap; }
.oraledit .qlist input[type=text] { flex: 1; }
.oraledit .photo img, .card .photo img { max-width: 320px; max-height: 240px; border-radius: 8px; border: 1px solid var(--line); display: block; margin: .3rem 0; }
@media (max-width: 640px) { .speaking .line { flex-direction: column; gap: .1rem; } .speaking audio.rec { margin-left: 0; } }

/* --- The diagnostic and the plan ------------------------------------------- */
.plan .skill { display: grid; grid-template-columns: 8rem 1fr 3.6rem; gap: .6rem; align-items: center; font-size: .9rem; margin: .2rem 0; }
.plan .skill .bar { height: 8px; background: #e6e3da; border-radius: 4px; overflow: hidden; }
.plan .skill .bar > div { height: 100%; border-radius: 4px; }
.plan .skill .bar .good { background: var(--ok); } .plan .skill .bar .mid { background: #e0a800; } .plan .skill .bar .low { background: var(--bad); }
.plan .skill .pct { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plan .skills { margin: .4rem 0 .8rem; }
.plan ol.steps { margin: .6rem 0 0; padding: 0 0 0 1.4rem; }
.plan ol.steps li { margin: .45rem 0; }
.plan ol.steps li.done > a, .plan ol.steps li.done > .ico { color: var(--muted); }
.plan ol.steps li.done > a { text-decoration: line-through; }
.plan ol.steps .why { display: block; font-size: .82rem; color: var(--muted); }
.plan ol.steps label { display: inline; margin: 0; cursor: pointer; }
.plansnip { border-top: 1px dashed #cfdcf3; margin-top: .6rem; padding-top: .5rem; }
.plansnip ol { margin: .3rem 0 0; padding-left: 1.4rem; }
.plansnip ol li { margin: .15rem 0; font-size: .92rem; }
.card.diag ul { margin: .4rem 0 .6rem 1.2rem; padding: 0; }
@media (max-width: 520px) { .plan .skill { grid-template-columns: 6rem 1fr 3.4rem; } }

/* --- Housekeeping: the roster import, the activity log ----------------------- */
textarea.roster { min-height: 6rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; }
.card.log table td { font-size: .88rem; }
.card.log code { font-size: .82rem; background: #f2f0ea; padding: 0 .3em; border-radius: 4px; }
.notice.imported table.users td { background: transparent; }

/* Teacher: the Assignments tab's published list, papers and lessons */
.pubfilter { margin: .2rem 0 .6rem; gap: .4rem; }
