/* ======================================================================
   Studia —— 答题卡
   白纸上印着蓝色的框，铅笔把学完的格子涂黑，老师用红笔批分，
   荧光笔划出等你处理的地方。标题和正文用无衬线，数字用等宽，
   只有红笔分数是手写感的衬线。夜读只换颜色，不改布局。
   ====================================================================== */
:root {
  --paper:   #ffffff;
  --paper-2: #f6f6f4;
  --card:    #ffffff;
  --well:    #f2f2ef;
  --ink:     33 36 41;
  --text:    rgb(var(--ink));
  --text-2:  rgb(var(--ink) / .74);
  --text-3:  rgb(var(--ink) / .52);
  --text-4:  rgb(var(--ink) / .36);
  --line:    rgb(var(--ink) / .09);
  --line-2:  rgb(var(--ink) / .17);
  --hover:   rgb(var(--ink) / .045);
  --press:   rgb(var(--ink) / .085);

  /* 印刷蓝：答题卡上印好的框和字；也是"正在进行"。 */
  --indigo:       #2d5fa6;
  --indigo-soft:  rgb(45 95 166 / .10);
  --print:        rgb(45 95 166 / .42);
  --print-2:      rgb(45 95 166 / .18);
  /* 红笔：分数、失败、危险操作。 */
  --seal:         #d03b2e;
  --seal-soft:    rgb(208 59 46 / .10);
  /* 完成。 */
  --celadon:      #2f7d5b;
  --celadon-soft: rgb(47 125 91 / .12);
  /* 荧光笔：等你操作。 */
  --gamboge:      #9a6f00;
  --gamboge-soft: rgb(247 214 64 / .38);
  --marker:       #f6d43c;

  --mooc: #1f8a8a; --cx: #2f6fd0; --zhs: #4a8a3a; --zyk: #8a5a2c;

  --sans:  -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono:  "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, "PingFang SC", monospace;
  --pen:   "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --shadow-pop: 0 0 0 1px rgb(var(--ink) / .08), 0 12px 32px rgb(20 24 30 / .14);
  /* Four registration squares in the corners, like the ones a scanner aligns an answer sheet by. */
  --corners: linear-gradient(rgb(var(--ink)), rgb(var(--ink))) 5px 5px / 6px 6px no-repeat, linear-gradient(rgb(var(--ink)), rgb(var(--ink))) calc(100% - 5px) 5px / 6px 6px no-repeat,
             linear-gradient(rgb(var(--ink)), rgb(var(--ink))) 5px calc(100% - 5px) / 6px 6px no-repeat, linear-gradient(rgb(var(--ink)), rgb(var(--ink))) calc(100% - 5px) calc(100% - 5px) / 6px 6px no-repeat;
  color-scheme: light;
}
:root[data-theme="night"] {
  --paper:   #15171a;
  --paper-2: #101214;
  --card:    #1b1e22;
  --well:    #212429;
  --ink:     226 229 233;
  --indigo:       #86a9ea;
  --indigo-soft:  rgb(134 169 234 / .14);
  --print:        rgb(134 169 234 / .40);
  --print-2:      rgb(134 169 234 / .16);
  --seal:         #ff7b6c;
  --seal-soft:    rgb(255 123 108 / .14);
  --celadon:      #6cc59a;
  --celadon-soft: rgb(108 197 154 / .15);
  --gamboge:      #ecc94f;
  --gamboge-soft: rgb(236 201 79 / .18);
  --marker:       #d9b52f;
  --shadow-pop: 0 0 0 1px rgb(255 255 255 / .07), 0 14px 40px rgb(0 0 0 / .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font: 13.5px/1.55 var(--sans); color: var(--text); background: var(--paper); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: default; text-align: inherit;
         -webkit-tap-highlight-color: transparent; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
:is(.btn, .nav_item, .menu_row, .me, .icon_btn, .paper, .run, .prow, .chip):active { background-color: var(--press); }
:is(.mtab, .tab, .course_card):active { opacity: .6; }
input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; border-radius: 4px; }
svg { display: block; flex: none; }
code { font: 12px var(--mono); padding: 1px 5px; border-radius: 3px; background: var(--well); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.grow { flex: 1; }

.app { display: grid; grid-template-columns: 232px 1fr; height: 100%; height: 100dvh; }

/* ---------------------------------------------------------------- sidebar */
.side { display: flex; flex-direction: column; min-height: 0; background: var(--paper-2); border-right: 1px solid var(--line); }
.side_top { position: relative; padding: 18px 12px 8px; }
.brand { display: flex; align-items: center; gap: 9px; padding: 0 6px; height: 28px; }
.mark { display: block; flex: none; width: 22px; height: 22px; }
.brand b { font: 700 16px/1 var(--sans); letter-spacing: -.01em; }
.icon_btn { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; color: var(--text-3); transition: background .15s, color .15s; }
@media (hover: hover) { .icon_btn:hover { background: var(--hover); color: var(--text); } }

/* Platform switch: the chosen one is inked in. */
.plat_seg { display: flex; margin-top: 14px; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--line-2); }
.plat_seg button { position: relative; flex: 1; height: 30px; border-radius: 6px; text-align: center; font-size: 12.5px; font-weight: 500; color: var(--text-3); transition: background .2s, color .2s; }
@media (hover: hover) { .plat_seg button:not([aria-selected="true"]):hover { color: var(--text); background: var(--hover); } }
.plat_seg button[aria-selected="true"] { background: rgb(var(--ink)); color: var(--paper); font-weight: 600; }
.plat_seg i { position: absolute; top: 5px; right: 6px; width: 5px; height: 5px; border-radius: 1px; }
.plat_seg i.busy { background: var(--indigo); animation: breathe 1.6s ease-in-out infinite; }
.plat_seg [aria-selected="true"] i.busy { background: var(--paper); }
.who { flex: 1; min-width: 0; line-height: 1.25; }
.who b { display: block; font-size: 13px; }
.who small { color: var(--text-3); font-size: 11.5px; }

.menu { position: absolute; left: 12px; right: 12px; z-index: 30; padding: 4px; border-radius: 8px; background: var(--card); box-shadow: var(--shadow-pop); animation: pop .22s var(--ease) both; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
.menu_row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border-radius: 5px; }
@media (hover: hover) { .menu_row:hover { background: var(--hover); } }
.menu_row svg { color: var(--text-3); }
.menu_row.danger, .menu_row.danger svg { color: var(--seal); }

.nav { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 12px; }
.nav_item { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; height: 32px; padding: 0 10px; border-radius: 6px; color: var(--text-2); transition: background .12s, color .12s; }
@media (hover: hover) { .nav_item:hover { background: var(--hover); color: var(--text); } }
/* The current row carries a timing mark, like the black bars down an answer sheet's edge. */
.nav_item[aria-current="true"] { background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.nav_item[aria-current="true"]::before { content: ""; position: absolute; left: -12px; top: 9px; width: 4px; height: 14px; background: rgb(var(--ink)); }
.nav_item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav_item .count { font: 11.5px var(--mono); color: var(--text-4); }
.nav_item .kbd { opacity: 0; transition: opacity .15s; }
@media (hover: hover) { .nav_item:hover .kbd { opacity: 1; } }
.nav_item.quiet { color: var(--text-4); }
.nav_label { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 6px; padding: 0 10px; font-size: 11.5px; font-weight: 600; color: var(--text-4); }
.live { display: inline-flex; align-items: center; gap: 5px; height: 19px; padding: 0 6px; border-radius: 3px; background: var(--indigo-soft); color: var(--indigo); font-size: 11px; font-weight: 600; white-space: nowrap; }
.live::before { content: ""; width: 6px; height: 6px; border-radius: 1px; background: currentColor; animation: breathe 1.6s ease-in-out infinite; }
.live:empty { padding: 0 5px; }
.live.waiting { background: var(--gamboge-soft); color: var(--gamboge); }
.live.waiting::before { animation: none; }
@keyframes breathe { 50% { opacity: .25; } }
.ring { width: 16px; height: 16px; flex: none; }

.side_foot { position: relative; display: flex; align-items: center; padding: 10px 12px 14px; border-top: 1px solid var(--line); }
.side_foot .me { height: auto; padding: 6px 8px; gap: 10px; }
.me { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; height: 32px; padding: 0 8px; border-radius: 6px; color: var(--text-2); }
@media (hover: hover) { .me:hover { background: var(--hover); } }
.me .who b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .chev { color: var(--text-4); }
.me[aria-expanded="true"] { background: var(--hover); }
.me[aria-current="true"] { background: var(--card); box-shadow: 0 0 0 1px var(--line); }
.me_menu { bottom: calc(100% - 6px); }
.avatar { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 4px; background: rgb(var(--ink)); color: var(--paper); font-size: 11px; font-weight: 700; }
.avatar.big { width: 28px; height: 28px; font-size: 13px; border-radius: 5px; }

.kbd { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--line-2);
       font: 500 10.5px/1 var(--mono); color: var(--text-3); }

/* ---------------------------------------------------------------- main */
.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: clip; }
.scroll { flex: 1; overflow-y: auto; }
.page { max-width: 940px; margin: 0 auto; padding: 40px 48px 140px; }
.page.enter > * { animation: enter .18s var(--ease) both; }
@keyframes enter { from { opacity: .4; transform: translateY(3px); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.crumb { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-3); }
.crumb > span:not(.dot) { color: var(--text-4); }
.crumb .dot { width: 7px; height: 7px; border-radius: 1.5px; }
.dot.mooc { background: var(--mooc); } .dot.cx { background: var(--cx); } .dot.zhs { background: var(--zhs); } .dot.zyk { background: var(--zyk); }
.title { margin: 6px 0 0; font: 700 26px/1.3 var(--sans); letter-spacing: -.015em; overflow-wrap: anywhere; }
.sub { margin: 4px 0 0; color: var(--text-3); font-size: 13px; }
.empty { margin-top: 24px; padding: 28px; border-radius: 6px; text-align: center; color: var(--text-3); border: 1px dashed var(--line-2); }
.notice { margin-top: 18px; padding: 12px 14px; border-radius: 6px; background: var(--gamboge-soft); color: var(--text-2); line-height: 1.7; }

/* Course hero: title, study buttons and progress on one card tinted with the course's ink. */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 28px; padding: 22px 26px 24px; border-radius: 8px;
  background: var(--corners), linear-gradient(120deg, color-mix(in srgb, var(--c) 11%, var(--card)), var(--card) 65%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 28%, transparent), 0 1px 2px rgb(var(--ink) / .04); }
.hero_main { min-width: 0; }
.hero .title { margin-top: 8px; }
.hero_side { display: flex; align-items: stretch; gap: 24px; }
.fp { max-width: 460px; margin-top: 14px; }
.shares { display: grid; gap: 2px; }
.share { display: block; min-width: 0; height: 24px; padding: 0 2px; border-radius: 2px; text-align: center; text-overflow: clip;
         box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 45%, transparent); overflow: hidden; white-space: nowrap;
         font-size: 12px; line-height: 24px; color: var(--text-3); }
.share { background: linear-gradient(90deg, color-mix(in srgb, var(--c) 16%, transparent) var(--fill, 0%), transparent var(--fill, 0%)); }
.share.auto { background: linear-gradient(90deg, color-mix(in srgb, var(--c) 30%, transparent) var(--fill, 100%), color-mix(in srgb, var(--c) 8%, transparent) var(--fill, 100%));
              box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 60%, transparent); color: var(--c); }
.ruler { position: relative; height: 18px; margin-top: 4px; border-top: 1px solid color-mix(in srgb, var(--c) 40%, transparent); }
.ruler i { position: absolute; top: 0; width: 1px; height: 3px; background: color-mix(in srgb, var(--c) 40%, transparent); }
.ruler i.ten { height: 5px; }
.ruler i.edge { height: 7px; background: color-mix(in srgb, var(--c) 75%, transparent); }
.ruler i span { position: absolute; top: 7px; left: 0; transform: translateX(-50%); font: 10px/1 var(--mono); color: var(--text-4); }
.ruler i:first-child span { transform: none; }
.ruler i:last-child { margin-left: -1px; }
.ruler i:last-child span { transform: translateX(-100%); }
.score_note b { font: 700 14px var(--mono); color: var(--text); }
.qa_head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 16px; }
.qa_score { font-size: 13px; color: var(--text-3); white-space: nowrap; }
.qa_score b { font: 600 24px var(--mono); color: var(--text); }
.qa_score .of, .qa_num .of { margin: 0 3px 0 1px; font: 600 13px var(--mono); color: var(--text-4); }
.qa_head small { font-size: 11.5px; line-height: 1.6; color: var(--text-4); text-align: right; }
.qa_lanes { display: grid; grid-template-columns: 1fr 1fr; }
.qa_lane { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; }
.qa_lane + .qa_lane { border-left: 1px solid var(--line); }
.qa_lane header { display: flex; align-items: baseline; justify-content: space-between; }
.qa_num { font: 600 16px var(--mono); }
.qa_lane small { font-size: 12px; color: var(--text-3); }
/* Ten to a row in both lanes: answers take two rows because they need twice as many. */
.qa_cells { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.qa_cells .cell { width: auto; height: 12px; }
.cell.pending { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--indigo) 60%, transparent);
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--indigo) 38%, transparent) 0 2px, transparent 2px 5px); }
.qa_act { display: flex; align-items: center; gap: 10px; margin-top: auto; }
.qa_act > .btn { margin-left: auto; min-width: 92px; justify-content: center; }
.qa_rescan { border-left: 3px solid var(--marker); }  /* waiting on the person, like every 等你操作 */
.qa_draft { display: flex; gap: 8px; align-items: flex-start; }
.qa_draft textarea { flex: 1; min-height: 44px; padding: 8px 10px; border-radius: 4px; border: 0; resize: vertical; background: var(--paper);
                     box-shadow: inset 0 0 0 1px var(--line-2); font: 13px/1.5 var(--sans); color: var(--text); }
.qa_draft textarea:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--indigo), 0 0 0 3px var(--indigo-soft); }
.qa_post { cursor: pointer; }
.qa_post .stamp { width: 20px; height: 20px; font-size: 11px; }
.qa_text { padding: 10px 16px 14px 48px; font-size: 13px; line-height: 1.6; color: var(--text-2); white-space: pre-wrap; border-top: 1px dashed var(--line); }
.score_note .of { margin-right: 4px; font: 600 12px var(--mono); color: var(--text-4); }
.hero_stat { display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end; gap: 8px; }
.hero_stat + .hero_stat { padding-left: 24px; box-shadow: inset 1px 0 0 color-mix(in srgb, var(--c) 22%, transparent); }
.pen_num { font: 400 48px/44px var(--pen); color: var(--seal); }
@media (hover: hover) { button.hero_stat:hover .hero_note { color: var(--seal); } }
.hero_label { font-size: 11.5px; font-weight: 600; color: var(--c); }
.hero_note { font: 12px var(--mono); color: var(--text-3); white-space: nowrap; }
.digits { display: flex; align-items: flex-end; gap: 4px; }
.digits i { display: grid; place-items: center; width: 34px; height: 44px; border-radius: 3px; background: var(--card); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c, var(--indigo)) 45%, transparent);
  font: 600 27px/1 var(--mono); font-style: normal; }
.digits small { margin-left: 4px; font: 13px var(--mono); color: var(--text-3); }

/* Course: 学习 / 答题 switch, then a card per study action (click the card to start). */
.tabs.seg { gap: 4px; padding: 3px; width: max-content; border-radius: 10px; background: var(--well); box-shadow: inset 0 0 0 1px var(--line); }
.seg .tab { height: 30px; padding: 0 16px; border-radius: 7px; font-size: 13.5px; font-weight: 500; transition: background .3s, color .3s, box-shadow .3s; }
.seg .tab::after { display: none; }
.seg .tab[aria-selected="true"] { background: var(--card); color: var(--text); box-shadow: 0 0 0 1px var(--line), 0 1px 3px rgb(var(--ink) / .08); }
.acts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 14px; }
.act { display: flex; flex-direction: column; gap: 6px; padding: 16px 16px 14px; border-radius: 12px; background: var(--card); box-shadow: 0 0 0 1px var(--line); text-align: left; transition: box-shadow .2s, transform .2s var(--ease); }
@media (hover: hover) { .act:not([disabled]):hover { box-shadow: 0 0 0 1px var(--line-2), 0 6px 18px rgb(20 24 30 / .07); transform: translateY(-1px); } }
.act:active { background-color: var(--press); }
.act_head { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.glyph { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: color-mix(in srgb, var(--c, var(--indigo)) 12%, transparent); color: var(--c, var(--indigo)); }
.act p { margin: 0; color: var(--text-2); font-size: 12.5px; line-height: 1.6; }
.act .foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.act[disabled] { opacity: .55; }

/* Course list: a card per course, its cover the course's own answer sheet. */
.course_cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 14px; margin-top: 22px; }
.course_card { display: flex; flex-direction: column; min-width: 0; border-radius: 10px; background: var(--card); text-align: left; overflow: hidden;
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgb(var(--ink) / .04); transition: box-shadow .2s, transform .2s var(--ease); }
@media (hover: hover) { .course_card:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 35%, transparent), 0 12px 28px rgb(20 24 30 / .09); } }
.course_card:active { transform: none; }
.cover { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 4px; height: 92px; padding: 16px 16px 0; overflow: hidden;
  background: var(--corners), color-mix(in srgb, var(--c) 9%, var(--card)); border-bottom: 1px solid color-mix(in srgb, var(--c) 18%, transparent); }
.cover .cell { width: 16px; height: 9px; }
.cc_body { display: flex; flex-direction: column; min-width: 0; padding: 12px 16px 14px; }
.cc_body b { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc_body small { font-size: 12px; color: var(--text-3); }
.cc_bar { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 12px; color: var(--text-2); }
.bar { flex: 1; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--c) 16%, transparent); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--c); }
.cc_line { display: flex; align-items: center; min-height: 20px; margin-top: 8px; font-size: 12px; color: var(--text-3); }
.todo { color: var(--seal); font-weight: 600; }
.cc_line .sep { margin: 0 6px; color: var(--text-4); }

.tabs { display: flex; gap: 22px; margin-top: 26px; box-shadow: inset 0 -1px 0 var(--line-2); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.title + .sub + .tabs { margin-top: 22px; }
.tab { position: relative; display: flex; align-items: center; gap: 6px; height: 38px; color: var(--text-3); font-size: 14px; font-weight: 500; white-space: nowrap; transition: color .15s; }
@media (hover: hover) { .tab:hover { color: var(--text); } }
.tab[aria-selected="true"] { color: var(--text); font-weight: 600; }
.tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgb(var(--ink)); transform: scaleX(0); transition: transform .25s var(--ease); }
.tab[aria-selected="true"]::after { transform: none; }
.tab .n { font: 11.5px var(--mono); color: var(--text-4); }
.section { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 34px 0 12px; }
.section h3 { margin: 0; font-size: 15px; font-weight: 700; }
.section .aside { margin-left: auto; font-size: 12px; color: var(--text-3); }
.link { color: var(--indigo); font-weight: 500; }
@media (hover: hover) { .link:hover { text-decoration: underline; text-underline-offset: 3px; } }

/* ---------------------------------------------------------------- course grid: answer-sheet bubbles */
.grid { margin-top: 18px; padding: 14px 16px 12px; border-radius: 4px; background: var(--card); box-shadow: 0 0 0 1px var(--line); }
.grid.loading { color: var(--text-3); text-align: center; padding: 26px; }
.chapter { display: grid; grid-template-columns: 128px 1fr auto; align-items: center; gap: 14px; padding: 6px 0; }
.chapter + .chapter { border-top: 1px solid var(--line); }
.chapter .name { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chapter .tally { font: 11.5px var(--mono); color: var(--text-4); }
.cells { display: flex; flex-wrap: wrap; gap: 5px 4px; }
/* Inside a course the pencil takes the course's ink (--c); elsewhere it is graphite. */
.cell { display: block; position: relative; width: 20px; height: 12px; border-radius: 2px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c, var(--indigo)) 42%, transparent); transition: background-color .4s var(--ease), box-shadow .4s; }
.cell.done { background: var(--c, rgb(var(--ink) / .86)) repeating-linear-gradient(112deg, rgb(255 255 255 / .1) 0 1px, transparent 1px 3px); box-shadow: none; }
.cell.running { box-shadow: inset 0 0 0 1px var(--indigo); overflow: hidden; }
.cell.running::after { content: ""; position: absolute; inset: 0; background: var(--indigo); transform-origin: left; animation: fill 1.4s var(--ease) infinite; }
@keyframes fill { from { transform: scaleX(0); } 60%, 100% { transform: scaleX(1); } }
.cell.waiting { background: var(--marker); box-shadow: none; }
.cell.failed { box-shadow: inset 0 0 0 1.5px var(--seal); }
.cell.failed::after { content: ""; position: absolute; inset: 2px 5px; background: linear-gradient(to top left, transparent 44%, var(--seal) 44% 60%, transparent 60%); }
.cell.skipped { box-shadow: none; border: 1px dashed var(--line-2); }
.cell.stamp { animation: stamp .5s var(--ease); }
@keyframes stamp { 0% { transform: scale(1); } 35% { transform: scale(1.18); } 100% { transform: scale(1); } }
.chapter.current .name { color: var(--text); font-weight: 600; }
.chapter.current .tally { color: var(--indigo); }
@media (hover: hover) { .cells .cell:hover { outline: 2px solid rgb(var(--ink)); outline-offset: 1px; } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .cell { width: 14px; height: 9px; }

.tip { position: fixed; z-index: 50; padding: 7px 10px; border-radius: 5px; background: rgb(var(--ink)); color: var(--paper); font-size: 12px; line-height: 1.45; pointer-events: none;
       opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; max-width: 260px; }
.tip.show { opacity: 1; transform: none; }
.tip .mono { opacity: .7; }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 32px; padding: 0 13px; border-radius: 6px; background: var(--card);
       box-shadow: inset 0 0 0 1px var(--line-2), 0 1px 0 rgb(var(--ink) / .05); font-weight: 500; color: var(--text); white-space: nowrap;
       transition: background .15s, color .15s, box-shadow .15s, transform .1s; }
@media (hover: hover) { .btn:hover { background: var(--well); } }
.btn:active { transform: translateY(1px); }
.btn.primary { background: rgb(var(--ink)); color: var(--paper); box-shadow: none; font-weight: 600; }
@media (hover: hover) { .btn.primary:hover { background: rgb(var(--ink) / .84); } }
.btn.primary .kbd { color: var(--paper); opacity: .6; box-shadow: inset 0 0 0 1px currentColor; }
.btn .kbd { margin-left: 2px; }
.btn.danger { color: var(--seal); }
.btn.armed, .btn.armed:hover { background: var(--seal); color: #fff; box-shadow: none; animation: nudge .3s var(--ease); }
@keyframes nudge { 30% { transform: translateX(-2px); } 70% { transform: translateX(2px); } }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn.small { height: 28px; padding: 0 11px; font-size: 12.5px; }

/* ---------------------------------------------------------------- papers */
.papers { border-radius: 4px; background: var(--card); box-shadow: 0 0 0 1px var(--line); overflow: hidden; }
.paper { display: grid; grid-template-columns: 18px 26px 1fr auto 64px; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 8px 16px; text-align: left; transition: background .12s; }
.paper + .paper { border-top: 1px solid var(--line); }
@media (hover: hover) { .paper:hover { background: var(--hover); } }
.paper.on { background: var(--indigo-soft); }
.paper.off { color: var(--text-3); }
/* The tick box fills in like a bubble on an answer sheet. */
.box { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 3px; box-shadow: inset 0 0 0 1.5px var(--print); color: var(--paper); transition: background .15s, box-shadow .15s; }
.paper.on .box { background: rgb(var(--ink)); box-shadow: none; }
.paper.off .box { box-shadow: inset 0 0 0 1px var(--line-2); background: repeating-linear-gradient(135deg, var(--line-2) 0 1px, transparent 1px 4px); }
.stamp { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 5px; box-shadow: inset 0 0 0 1.5px currentColor; font-size: 12px; font-weight: 700; transform: rotate(-4deg); color: var(--indigo); }
.stamp.k { color: var(--seal); } .stamp.c { color: var(--celadon); }
.paper .pname { min-width: 0; }
.paper .pname b { font-weight: 500; }
.paper .pname small { display: block; margin-top: 1px; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 3px; font-size: 11.5px; font-weight: 500; background: var(--well); color: var(--text-3); white-space: nowrap; vertical-align: 1px; }
.pill.blue { background: var(--indigo-soft); color: var(--indigo); }
.pill.wait { background: var(--gamboge-soft); color: var(--gamboge); }
.pill.red { background: var(--seal-soft); color: var(--seal); }
/* Red-pen scores: underlined, and full marks circled. */
.score { justify-self: end; position: relative; font: 400 24px/1 var(--pen); color: var(--seal); font-variant-numeric: lining-nums tabular-nums; }
.score::after { content: ""; position: absolute; left: -4px; right: -2px; bottom: -5px; height: 6px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 6' preserveAspectRatio='none'%3E%3Cpath d='M1 4.5C14 2.2 30 1.6 59 2.8' fill='none' stroke='%23d03b2e' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 100% 100%; opacity: .8; }
.score.full::after { left: -9px; right: -9px; top: -8px; bottom: -7px; height: auto;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 40' preserveAspectRatio='none'%3E%3Cpath d='M38 4C20 1 4 8 3 20s14 18 30 17 25-8 24-19S44 2 30 4' fill='none' stroke='%23d03b2e' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); }
.score.none { color: var(--text-4); font-size: 14px; } .score.none::after { display: none; }

.dock { position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; gap: 8px; margin-top: 18px; padding: 10px 10px 10px 16px; border-radius: 6px; background: var(--card); box-shadow: var(--shadow-pop); }
.dock .info { flex: 1; color: var(--text-2); }
.dock .info b { font: 600 13px var(--mono); color: var(--text); }

/* ---------------------------------------------------------------- now studying (player) */
.player { position: relative; z-index: 25; display: grid; grid-template-columns: minmax(220px, 1fr) minmax(200px, 1.3fr) auto; align-items: center; gap: 20px; min-height: 64px; padding: 0 16px env(safe-area-inset-bottom);
          border-top: 1px solid var(--line-2); background: var(--card); }
.player[hidden] { display: none; }
.player.enter { animation: slide .4s var(--ease) both; }
@keyframes slide { from { transform: translateY(100%); } }
.player.ended { grid-template-columns: 1fr auto; }
.np { display: flex; align-items: center; gap: 12px; min-width: 0; }
.np .art { position: relative; display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 5px; background: var(--c, var(--indigo)); color: #fff; overflow: hidden; }
.np .art::after { content: ""; position: absolute; inset: 0 0 0 -15px; background: repeating-linear-gradient(112deg, rgb(255 255 255 / .14) 0 2px, transparent 2px 7px); background-size: 15px 15px; animation: flow2 1.2s linear infinite; }
:root[data-theme="night"] .np .art { color: #101214; }
.np .art.waiting { background: var(--marker); color: #3a2c00; } .np .art.waiting::after, .np .art.still::after { display: none; }
.np .art.still { background: var(--well); color: var(--text-3); }
@keyframes flow2 { to { transform: translateX(15px); } }
.np .what { min-width: 0; line-height: 1.3; }
.np .what small { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; }
.np .what b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 600; }
.scrub { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; min-width: 0; }
.scrub .t { font: 12px var(--mono); color: var(--text-3); white-space: nowrap; }
.track { position: relative; height: 6px; border-radius: 1px; background: repeating-linear-gradient(90deg, var(--print-2) 0 calc(10% - 2px), transparent calc(10% - 2px) 10%); overflow: hidden; }
.track i { position: absolute; inset: 0 auto 0 0; background: var(--indigo); transition: width .9s linear; }
.track.unknown i { width: 30% !important; animation: sweep 1.4s var(--ease) infinite; }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(334%); } }
.np_meta { display: flex; align-items: center; gap: 8px; }
.mini { display: flex; gap: 2px; margin-right: 4px; }
.mini .cell { width: 7px; height: 14px; border-radius: 1px; }

/* Focus sheet */
.sheet { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; background: var(--paper); transform: translateY(102%); visibility: hidden; transition: transform .45s var(--ease), visibility 0s .45s; }
.sheet.open { transform: none; visibility: visible; transition: transform .45s var(--ease), visibility 0s; }
.sheet_bar { display: flex; align-items: center; gap: 8px; height: 54px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.sheet_tag { display: flex; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.sheet_tag .chip { flex: none; }
.sheet_body { flex: 1; overflow-y: auto; }
.focus { max-width: 980px; margin: 0 auto; padding: 36px 48px 60px; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 36px; }
.focus .clock { display: flex; align-items: baseline; gap: 10px; font: 600 60px/1 var(--mono); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.focus .clock small { font: 13px var(--sans); letter-spacing: 0; color: var(--text-4); }
.focus .now { margin-top: 14px; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.focus .of { margin-top: 2px; color: var(--text-3); overflow-wrap: anywhere; }
.focus .spot { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; margin-top: 18px; }
.focus .spot .track { height: 6px; }
.focus .spot .mono { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.focus .section { margin-top: 34px; }
.focus .grid { margin-top: 12px; }
/* Long courses scroll inside the card, fading at the edges, so the clock and log stay put. */
.focus .chapters { position: relative; max-height: 380px; overflow-y: auto; margin: -6px -6px 0; padding: 6px;
  mask-image: linear-gradient(transparent, #000 14px, #000 calc(100% - 14px), transparent); scrollbar-width: thin; }
.focus .log { position: sticky; top: 24px; }
.focus .log_body { max-height: min(560px, calc(100vh - 200px)); }
.log { align-self: start; border-radius: 4px; background: var(--card); box-shadow: 0 0 0 1px var(--line); overflow: hidden; }
.log_head { display: flex; align-items: center; gap: 4px; padding: 8px 10px 8px 12px; border-bottom: 1px solid var(--line); }
.log_head .grow { font-weight: 700; }
.chip { height: 24px; padding: 0 8px; border-radius: 4px; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.chip[aria-pressed="true"] { background: rgb(var(--ink)); color: var(--paper); }
.log_body { max-height: 440px; overflow-y: auto; padding: 6px 0; font: 11.5px/19px var(--mono); }
.line { display: grid; grid-template-columns: 38px 6px 1fr; align-items: baseline; gap: 10px; padding: 2px 12px; color: var(--text-2); }
.line time { color: var(--text-4); }
.line .lv { width: 6px; height: 6px; border-radius: 1px; background: var(--line-2); transform: translateY(-1px); }
.line.warn .lv { background: var(--gamboge); } .line.err .lv { background: var(--seal); } .line.ok .lv { background: var(--celadon); }
.line.fresh { animation: logIn .45s var(--ease); }
@keyframes logIn { from { opacity: 0; transform: translateY(-6px); background: var(--indigo-soft); } }
.line.err .msg { color: var(--seal); }
.line .msg { font-family: var(--sans); font-size: 12px; overflow-wrap: anywhere; }
.line.none { display: block; color: var(--text-4); }

/* ---------------------------------------------------------------- runs */
.runs { border-radius: 4px; background: var(--card); box-shadow: 0 0 0 1px var(--line); overflow: hidden; }
.run { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto 150px 84px; align-items: center; gap: 14px; width: 100%; min-height: 54px; padding: 8px 16px; text-align: left; }
.run[data-history] { grid-template-columns: 18px minmax(0, 1fr) auto 150px 84px 12px; }
.runs > * + * { border-top: 1px solid var(--line); }
@media (hover: hover) { .run[data-history]:hover { background: var(--hover); } }
.run .t1 { min-width: 0; font-weight: 600; }
.run .t1 small { display: block; font-weight: 400; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run .when { font: 12px var(--mono); color: var(--text-3); text-align: right; white-space: nowrap; }
.chev_r { width: 7px; height: 7px; border: solid var(--text-4); border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); transition: transform .2s var(--ease); }
.run.open .chev_r { transform: rotate(45deg); }
.state { display: inline-flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.state .mono { font-weight: 400; color: var(--text-3); }
.state.done { color: var(--celadon); } .state.error { color: var(--seal); } .state.waiting { color: var(--gamboge); } .state.stopped { color: var(--text-3); }
.state.running, .state.queued { color: var(--indigo); }
.run .fix { display: flex; gap: 6px; justify-self: end; }
.run .state.running { --c: var(--indigo); justify-content: flex-start; }
.run .state.running .bar { flex: 1; max-width: 70px; }
.run.past > svg { opacity: .35; }
.run > .state { justify-content: space-between; }
/* A person's jobs as a board: slots for what runs, the queue below (dragged by its grip), the paused folded away. */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.slot { display: grid; align-content: start; gap: 4px; min-width: 0; min-height: 92px; padding: 11px 10px 11px 14px; border-radius: 6px; background: var(--card);
        box-shadow: inset 3px 0 0 var(--c), 0 0 0 1px var(--line); transition: box-shadow .15s; }
.slot small { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot_head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.slot_head b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot_foot { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.slot.vacant { place-content: center; box-shadow: none; outline: 1px dashed var(--line-2); outline-offset: -1px; color: var(--text-4); font-size: 12.5px; }
.slot.drop { box-shadow: inset 3px 0 0 var(--c, var(--indigo)), 0 0 0 2px var(--indigo); }
.slot.vacant.drop { outline-color: var(--indigo); color: var(--indigo); }
.dots { display: grid; place-items: center; flex: none; width: 26px; height: 26px; margin: -4px -2px -4px 0; border-radius: 5px; color: var(--text-3); }
@media (hover: hover) { .dots:hover { background: var(--well); color: var(--text); } }
.board_head { display: flex; align-items: baseline; gap: 10px; margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.board_head small { font-weight: 400; font-size: 12px; color: var(--text-3); }
.board_head.fold { align-items: center; gap: 6px; }
.board_head.fold .chev_r { transition: transform .2s; } .board_head.fold[aria-expanded="true"] .chev_r { transform: rotate(45deg); }
.qrow { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 10px 6px 4px; background: var(--card); }
.qrow .t1 { flex: 1; min-width: 0; font-weight: 600; }
.qrow .t1 small { display: block; font-weight: 400; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qrow .place { width: 14px; font-size: 12px; color: var(--text-3); text-align: center; }
.grip { display: grid; place-items: center; flex: none; width: 26px; height: 34px; border-radius: 4px; color: var(--text-4); cursor: grab; touch-action: none; }
.grip.off { cursor: default; }
@media (hover: hover) { .grip[data-grip]:hover { background: var(--well); color: var(--text-2); } }
.qrow.dragging { opacity: .35; }
.qrow.drop_before { box-shadow: inset 0 2px 0 var(--indigo); } .qrow.drop_after { box-shadow: inset 0 -2px 0 var(--indigo); }
.qrow.ghost { position: fixed; z-index: 50; pointer-events: none; border-radius: 6px; box-shadow: var(--shadow-pop); opacity: .95; }
body.dragging, body.dragging * { cursor: grabbing !important; user-select: none; }
.job_menu { position: fixed; left: 0; right: auto; width: 160px; }
.run_lines { padding: 6px 0 10px; background: var(--well); font: 11.5px/19px var(--mono); }

/* ---------------------------------------------------------------- settings, admin, forms */
.models { border-radius: 4px; background: var(--card); box-shadow: 0 0 0 1px var(--line); overflow: hidden; }
.model { display: grid; grid-template-columns: auto minmax(0, 1fr) 64px auto; align-items: center; gap: 14px; padding: 12px 16px; }
.models > * + * { border-top: 1px solid var(--line); }
.model.plain { grid-template-columns: 1fr auto; }
.model.ai { grid-template-columns: minmax(0, 1fr) 64px auto; }
.in_use { display: inline-flex; align-items: center; height: 28px; padding: 0 8px; font-size: 12.5px; font-weight: 600; color: var(--celadon); }
.in_use::before { content: ""; width: 7px; height: 4px; margin: -3px 7px 0 0; border: solid currentColor; border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.m1 { min-width: 0; }
.m1 b { font-weight: 600; }
.m1 .pill { margin-left: 6px; }
.m1 small { display: block; font: 11.5px var(--mono); color: var(--text-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m1 small.sans { font-family: var(--sans); font-size: 12px; white-space: normal; }
.row_btns { display: flex; align-items: center; gap: 6px; }
.health { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.health::before { content: ""; width: 7px; height: 7px; border-radius: 1.5px; background: var(--text-4); }
.health.ok { color: var(--celadon); } .health.ok::before { background: var(--celadon); }
.health.error { color: var(--seal); } .health.error::before { background: var(--seal); }
.health.busy::before { animation: breathe 1s ease-in-out infinite; background: var(--indigo); }
.plat { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 5px; color: #fff; font-size: 12px; font-weight: 700; }
.plat.mooc { background: var(--mooc); } .plat.cx { background: var(--cx); } .plat.zhs { background: var(--zhs); } .plat.zyk { background: var(--zyk); }

.form_card { padding: 16px 18px 14px; border-radius: 6px; background: var(--card); box-shadow: var(--shadow-pop); margin: 4px 0 12px; }
.models .form_card { margin: 0; border-radius: 0; box-shadow: inset 4px 0 0 rgb(var(--ink)); }
.form_card h3 { margin: 0 0 10px; font-size: 14px; }
.field { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 10px; margin: 8px 0; }
.field label { color: var(--text-3); }
.field input, .inline_num, .log_range input, .log_range select, .auth_field input {
  border: 0; border-radius: 5px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line-2); transition: box-shadow .15s; }
.field input { height: 34px; padding: 0 10px; font-size: 13px; background: var(--paper); }
:is(.field input, .inline_num, .log_range input, .log_range select, .auth_field input):focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--indigo), 0 0 0 3px var(--indigo-soft); }
.field input[type="number"] { width: 90px; font-family: var(--mono); }
.form_btns { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* Platform login */
.login_card { display: flex; gap: 26px; align-items: center; margin-top: 24px; padding: 22px; border-radius: 4px; background: var(--card); box-shadow: inset 0 0 0 1px var(--print); }
.qr { position: relative; flex: none; width: 176px; height: 176px; padding: 8px; border-radius: 3px; background: #fff; box-shadow: 0 0 0 1px var(--line-2); }
.qr img { width: 100%; height: 100%; display: block; }
.qr .qr_empty { display: grid; place-items: center; height: 100%; color: #888; font-size: 12px; }
.login_status b { display: block; margin-bottom: 6px; font-size: 15px; }
.login_status p { margin: 0 0 14px; color: var(--text-2); line-height: 1.7; }
.login_card .auth_form { flex: 1; min-width: 240px; max-width: 360px; }
.login_card .auth_form .btn { width: 100%; justify-content: center; }

/* Admin */
.inline_num { width: 64px; height: 30px; margin: 0 6px; padding: 0 8px; background: var(--paper); font: 600 14px var(--mono); text-align: center; }
.model.log_export { align-items: end; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper .btn { width: 34px; padding: 0; justify-content: center; font: 600 16px var(--mono); }
.stepper output { min-width: 34px; text-align: center; font: 600 17px var(--mono); font-variant-numeric: tabular-nums; }
/* A form that opens inside a list row (admin: task limit, password reset). */
.row_form { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin: 2px 0 0; padding: 12px 14px; border-radius: 6px; background: var(--well); animation: rise .2s var(--ease) both; }
.row_form label { display: flex; align-items: center; font-weight: 500; }
.row_form small { color: var(--text-3); font-size: 12px; }
.row_input { width: 240px; max-width: 100%; height: 30px; padding: 0 10px; border: 0; border-radius: 5px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line-2); font-size: 13px; }
.row_input:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--indigo), 0 0 0 3px var(--indigo-soft); }
.row_form .inline_num { background: var(--card); }
.btn[aria-pressed="true"] { background: rgb(var(--ink)); color: var(--paper); box-shadow: none; }
.log_range { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.log_range label { display: grid; gap: 4px; font-size: 12px; color: var(--text-3); }
.log_range input, .log_range select { height: 34px; padding: 0 10px; background: var(--paper); font: 13px var(--sans); color: var(--text); }

/* Settings > account */
.account_who { display: flex; align-items: center; gap: 14px; min-width: 0; }
.model.password_form { grid-template-columns: minmax(0, 1fr); align-items: start; gap: 14px; }
.pw_fields { display: grid; gap: 2px; max-width: 340px; }
.pw_fields .auth_field input { height: 38px; font-size: 14px; }
.pw_fields .row_btns { margin-top: 6px; }

/* Studia sign-in (hosted): an answer sheet filling itself in on the left, the form on the right. */
body.signed-out .app, body.signed-out .player { display: none; }
.auth { position: fixed; inset: 0; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(400px, 1fr); background: var(--paper); overflow-y: auto; }
.auth_art { position: relative; display: flex; flex-direction: column; padding: 40px 56px; background: var(--paper-2); border-right: 1px solid var(--line); overflow: hidden; }
.auth .brand { padding: 0; height: auto; }
.auth .brand .mark { width: 28px; height: 28px; }
.auth .brand b { font-size: 20px; }
.auth_pitch { margin-top: auto; max-width: 460px; }
.auth_pitch h1 { margin: 0; font: 700 32px/1.35 var(--sans); letter-spacing: -.02em; }
.auth_pitch p { margin: 14px 0 0; color: var(--text-2); font-size: 15px; line-height: 1.75; }
.auth_grid { display: grid; gap: 8px; margin: 48px 0 auto; padding: 24px 26px; width: max-content; max-width: 100%; border-radius: 2px; background: var(--corners), var(--card); box-shadow: inset 0 0 0 1px var(--print), 0 18px 40px rgb(20 24 30 / .06); }
.auth_grid .cells { gap: 6px; flex-wrap: nowrap; }
.auth_grid .cell { width: 26px; height: 15px; }
.auth_foot { margin: 28px 0 0; font: 12px var(--mono); color: var(--text-4); }

.auth_side { display: grid; place-items: center; padding: 40px 24px; }
.auth_card { width: 360px; max-width: 100%; min-width: 0; }
.auth_card h2 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.auth_lead { margin: 6px 0 26px; color: var(--text-3); line-height: 1.7; overflow-wrap: anywhere; }
.auth_field { display: block; margin-bottom: 14px; }
.auth_field > span:first-child { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--indigo); }
.auth_field input { width: 100%; height: 42px; padding: 0 12px; font-size: 15px; }
.auth_field input::placeholder { color: var(--text-4); }
.pw { position: relative; display: block; }
.pw input { padding-right: 64px; }
.pw_eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 30px; padding: 0 10px; border-radius: 4px; font-size: 12px; color: var(--text-3); }
@media (hover: hover) { .pw_eye:hover { background: var(--hover); color: var(--text); } }
.auth_error { min-height: 20px; margin: 2px 0 10px; font-size: 13px; color: var(--seal); }
.auth_submit { width: 100%; height: 44px; font-size: 15px; }
.auth_note { margin: 18px 0 0; text-align: center; font-size: 13px; color: var(--text-3); }
.auth_note .link { margin-left: 4px; }

@media (max-width: 860px) {
  .auth { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .auth_art { padding: calc(24px + env(safe-area-inset-top)) 20px 22px; border-right: 0; border-bottom: 1px solid var(--line); }
  .auth_pitch { margin-top: 22px; }
  .auth_pitch h1 { font-size: 22px; }
  .auth_pitch p { margin-top: 6px; font-size: 13.5px; line-height: 1.65; }
  .auth_grid { margin: 26px 0 0; padding: 12px 14px; gap: 5px; }
  .auth_grid .cells { gap: 4px; }
  .auth_grid .cells .cell { width: 14px; height: 9px; }
  .auth_foot { display: none; }
  .auth_side { grid-template-columns: minmax(0, 1fr); place-items: start stretch; padding: 26px 20px calc(32px + env(safe-area-inset-bottom)); }
  .auth_card { width: 100%; }
}

/* ---------------------------------------------------------------- palette */
.palette_wrap { position: fixed; inset: 0; z-index: 40; display: none; align-items: flex-start; justify-content: center; padding: 16vh 16px 0; background: rgb(var(--ink) / .14); }
.palette_wrap.open { display: flex; }
.palette { width: 520px; max-width: 100%; border-radius: 8px; background: var(--card); box-shadow: var(--shadow-pop); overflow: hidden; animation: rise .2s var(--ease) both; }
.palette input { width: 100%; height: 50px; padding: 0 16px; border: 0; border-bottom: 1px solid var(--line); background: none; outline: none; font-size: 15px; }
.palette .rows { max-height: 50vh; overflow-y: auto; padding: 5px; }
.prow { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border-radius: 5px; }
.prow > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow[aria-selected="true"] { background: var(--indigo-soft); }
.prow .meta { margin-left: auto; font-size: 12px; color: var(--text-4); white-space: nowrap; }
.prow .stamp { width: 18px; height: 18px; font-size: 10px; border-radius: 4px; }
.prow .dot { width: 8px; height: 8px; margin: 0 4px; border-radius: 1.5px; }
.psep { height: 1px; margin: 4px 8px; background: var(--line); }

.toast { position: fixed; left: 50%; bottom: 92px; z-index: 60; transform: translate(-50%, 10px); max-width: calc(100% - 32px); padding: 9px 14px; border-radius: 6px; background: rgb(var(--ink)); color: var(--paper); font-size: 13px; opacity: 0; pointer-events: none; transition: .22s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; } }
/* Touch screens: finger-sized targets, no keyboard hints. */
@media (pointer: coarse) {
  .kbd { display: none; }
  .btn { height: 40px; padding: 0 14px; } .btn.small { height: 36px; }
  .icon_btn { width: 40px; height: 40px; }
  .nav_item { height: 44px; } .menu_row { padding: 11px 8px; }
  .tab { height: 44px; } .chip { height: 32px; padding: 0 12px; }
  .paper { min-height: 62px; } .run { min-height: 62px; }
  .field input { height: 42px; font-size: 16px; }
  .page.enter > * { animation-name: rise; }
  .scroll, .nav, .sheet_body, .log_body { overscroll-behavior: contain; }
}

/* ---------------------------------------------------------------- phone navigation: top bar and tabs */
.mbar, .mtabs { display: none; }
.mbar { align-items: center; gap: 9px; min-height: calc(52px + env(safe-area-inset-top)); padding: calc(8px + env(safe-area-inset-top)) 12px 8px 16px; background: var(--paper-2); border-bottom: 1px solid var(--line); }
.mbar b { font: 700 17px/1 var(--sans); letter-spacing: -.01em; }
.mbar .plat_seg { margin: 0; }
.mbar .plat_seg button { flex: none; height: 32px; padding: 0 12px; }
.mtabs { grid-template-columns: repeat(3, 1fr); padding: 0 8px env(safe-area-inset-bottom); background: var(--paper-2); border-top: 1px solid var(--line); }
.mtab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 56px; color: var(--text-3); font-size: 11.5px; transition: color .2s; }
.mtab svg, .mtab .avatar { width: 20px; height: 20px; }
.mtab .avatar { font-size: 10px; }
.mtab[aria-current="true"] { color: var(--text); font-weight: 600; }
/* The current tab gets a timing mark along its top edge. */
.mtab::before { content: ""; position: absolute; top: -1px; width: 22px; height: 3px; background: rgb(var(--ink)); transform: scaleX(0); transition: transform .3s var(--ease); }
.mtab[aria-current="true"]::before { transform: none; }
.mtab .badge { position: absolute; top: 7px; left: calc(50% + 7px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 3px; background: var(--indigo); color: #fff; font: 600 10px/16px var(--mono); }
:root[data-theme="night"] .mtab .badge { color: #101214; }
/* Phone top bar: a back button one level down. */
.mback { display: flex; align-items: center; gap: 2px; height: 36px; margin-left: -8px; padding: 0 10px 0 4px; border-radius: 6px; font-size: 15px; font-weight: 600; }
.mback:active { background: var(--press); }

/* 我的: who you are, then grouped rows. */
.me_card { display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: 10px; background: var(--corners), var(--card); box-shadow: inset 0 0 0 1px var(--print); }
.me_card .avatar.big { width: 48px; height: 48px; border-radius: 8px; font-size: 20px; }
.me_card .who b { font-size: 18px; }
.me_card .who small { font-size: 13px; }
.lrows { border-radius: 10px; background: var(--card); box-shadow: 0 0 0 1px var(--line); overflow: hidden; }
.lrow { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 14px; text-align: left; }
.lrow + .lrow { border-top: 1px solid var(--line); }
.lrow:active { background: var(--press); }
@media (hover: hover) { .lrow:hover { background: var(--hover); } }
.lrow > svg:first-child { color: var(--text-2); }
.lrow > svg:last-child { color: var(--text-4); }
.lrow_t { flex: 1; min-width: 0; }
.lrow_t b { display: block; font-size: 15px; font-weight: 500; }
.lrow_t small { display: block; font-size: 12.5px; color: var(--text-3); }
.lrow_go { font-size: 13px; font-weight: 600; color: var(--indigo); }
.lrow .plat { width: 26px; height: 26px; font-size: 11px; }
.switch { position: relative; flex: none; width: 42px; height: 26px; border-radius: 13px; background: var(--line-2); transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .25s var(--ease); }
button.switch { border: 0; padding: 0; cursor: pointer; }
.switch.on { background: var(--indigo); }
.switch.on::after { transform: translateX(16px); }
:root[data-theme="night"] .switch { background: var(--indigo); }
:root[data-theme="night"] .switch::after { transform: translateX(16px); }
.me_out { width: 100%; height: 46px; margin-top: 24px; }

/* Phones: the sidebar gives way to a top bar and tabs at the bottom. */
@media (max-width: 860px) {
  .qa_lanes { grid-template-columns: 1fr; }
  .qa_lane + .qa_lane { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .mbar { display: flex; } .mtabs { display: grid; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
  .side { display: none; }
  .page { padding: 22px 16px 60px; }
  .title { font-size: 23px; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 18px 16px; }
  .hero_side { justify-content: space-between; padding-top: 14px; border-top: 1px solid color-mix(in srgb, var(--c) 18%, transparent); }
  .hero_stat { align-items: flex-start; } .pen_num { font-size: 40px; line-height: 36px; }
  .digits i { width: 28px; height: 36px; font-size: 22px; }
  .acts { grid-template-columns: 1fr; }
  .course_cards { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 18px; }
  .tabs { margin-top: 20px; }
  .chapter { grid-template-columns: 1fr auto; gap: 8px; } .chapter .cells { grid-column: 1 / -1; grid-row: 2; }
  .cells .cell { width: 22px; height: 14px; }
  .section { flex-wrap: wrap; }
  .player { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 8px 10px 8px 12px; }
  .player .scrub, .player .mini, .player [data-go="#/jobs"] { display: none; }
  .np .art { width: 36px; height: 36px; }
  .np_meta { gap: 6px; }
  .focus { grid-template-columns: 1fr; gap: 24px; padding: 24px 16px 40px; }
  .focus .clock { font-size: 46px; }
  .log_body { max-height: 50vh; }
  .sheet_bar { padding: 0 10px; gap: 6px; }
  .sheet_tag { flex: 1; } .sheet_bar .grow { display: none; }
  .paper { grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; padding: 8px 12px; }
  .paper .stamp { display: none; }
  .paper > span:nth-child(4) { grid-column: 2; grid-row: 2; justify-self: start; }
  .paper .score { grid-column: 3; grid-row: 1 / span 2; margin-right: 6px; }
  .paper > span:nth-child(4):empty { display: none; }
  .dock { flex-wrap: wrap; padding: 10px; bottom: 10px; } .dock .info { flex-basis: 100%; padding: 0 4px; }
  .dock .btn { flex: 1; }
  .run, .run[data-history] { grid-template-columns: 18px minmax(0, 1fr) auto; gap: 4px 10px; padding: 10px 12px; }
  .run .state { grid-column: 2; justify-content: flex-start; } .run .when, .run .chev_r { display: none; }
  .run .state.running .bar { max-width: 120px; }
  .focus .log { position: static; }
  .focus .log_body { max-height: none; overflow: visible; }
  .focus .chapters { max-height: 300px; }
  .run .fix { grid-column: 3; grid-row: 1 / span 2; flex-direction: column; } .run .fix:empty { display: none; }
  .model { grid-template-columns: auto minmax(0, 1fr); } .model .health, .model .row_btns { grid-column: 2; }
  .model.ai { grid-template-columns: minmax(0, 1fr) auto; } .model.ai .health { grid-column: 2; grid-row: 1; } .model.ai .row_btns { grid-column: 1 / -1; }
  .model.plain { grid-template-columns: 1fr; } .model.plain .row_btns { grid-column: 1; }
  .model.plain.stepper_row, .model.plain.qa_switch { grid-template-columns: minmax(0, 1fr) auto; }
  .model.plain.qa_switch .row_btns { grid-column: 2; }
  .stepper .btn { width: 40px; height: 36px; }
  .row_btns { flex-wrap: wrap; }
  .field { grid-template-columns: 1fr; gap: 4px; }
  .form_btns { flex-wrap: wrap; }
  .row_form { grid-column: 1 / -1; } .row_form .grow { display: none; } .row_form .btn { flex: 1; } .row_input { flex: 1 1 100%; height: 40px; font-size: 16px; }
  .login_card { flex-direction: column; align-items: flex-start; padding: 18px; }
  .toast { bottom: calc(140px + env(safe-area-inset-bottom)); }
  .palette_wrap { padding-top: 10vh; }
}
