* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; word-break: keep-all; overflow-wrap: break-word; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
a { color: var(--primary); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- shell: logo + five menu groups (pill) + search + subject + connection (remodel) ------------------------------------------ */
.shell { min-height: 100vh; }
.topbar { max-width: var(--page); margin: 0 auto; padding: 18px 32px 0; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; position: relative; z-index: 30; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 24px; font-weight: 800; letter-spacing: -0.04em; color: var(--heading); margin-right: 6px; }
.logo i { color: var(--primary); font-style: normal; }
.navbar { display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 5px; }
.nav-wrap { position: relative; }
.nav-item { display: inline-flex; align-items: center; gap: 7px; height: 44px; padding: 0 15px; border: 0; border-radius: 999px; background: transparent; color: var(--text-2); font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.nav-item svg { width: 19px; height: 19px; flex: none; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--navy); color: #fff; font-weight: 800; }
.nav-item .caret { width: 15px; height: 15px; opacity: .7; margin-left: -2px; transition: transform .15s; }
.nav-group[aria-expanded="true"] .caret { transform: rotate(180deg); }
.menu-pop { position: absolute; top: calc(100% + 12px); left: 0; min-width: 310px; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 8px; box-shadow: var(--shadow-lg); display: grid; gap: 2px; z-index: 40; animation: rise .18s ease both; }
.menu-link { display: flex; gap: 14px; align-items: center; padding: 10px 12px; border-radius: 16px; text-decoration: none; color: var(--text); }
.menu-link:hover { background: var(--surface-2); }
.menu-link .mi { width: 42px; height: 42px; border-radius: 13px; background: var(--primary-soft); color: var(--navy); display: grid; place-items: center; flex: none; }
.menu-link .mi svg { width: 22px; height: 22px; }
.menu-link .mt { display: grid; line-height: 1.3; }
.menu-link .mt b { font-size: 15px; }
.menu-link .mt small { font-size: 12.5px; color: var(--text-3); }
.menu-link[aria-current="page"] { background: var(--primary-soft); }
.finder { margin-left: auto; flex: 1 1 140px; max-width: 230px; min-width: 110px; height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 16px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.finder:focus-within { border-color: var(--primary); }
.finder input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 14px; color: var(--text); }
.finder svg { width: 19px; height: 19px; color: var(--text-3); flex: none; }
.subject-tabs { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px; }
.subject-tabs button { height: 36px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: var(--text-2); font-size: 14px; font-weight: 600; cursor: pointer; }
.subject-tabs button[aria-selected="true"] { background: var(--primary-soft); color: var(--navy); font-weight: 800; }
.conn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 4px; color: var(--text-2); font-size: 13px; font-weight: 600; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.on { background: #12b76a; box-shadow: 0 0 0 4px color-mix(in srgb, #12b76a 22%, transparent); }
.dot.off { background: var(--bad); }
@media (max-width: 1320px) { #conn-text { display: none; } }
.main { max-width: var(--page); margin: 0 auto; padding: 30px 32px 80px; min-width: 0; }
.page { margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 26px; }
.page > * { animation: rise .45s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 55ms); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.page-head { display: grid; gap: 6px; }
.page-head h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.035em; color: var(--heading); }
.page-head p { color: var(--text-2); }
@media (max-width: 1100px) { .finder { display: none; } .topbar { gap: 12px; } .subject-tabs { margin-left: auto; } }
@media (max-width: 860px) {
  .topbar { padding: 14px 18px 0; gap: 12px; justify-content: space-between; }
  .subject-tabs button { padding: 0 12px; }
  .conn { display: none; }
  .main { padding: 22px 18px 100px; }
  /* phone / small tablet: the five groups become a bottom bar; a group opens a sheet above it */
  .navbar { position: fixed; inset: auto 0 0 0; z-index: 35; border-radius: 0; border-width: 1px 0 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; gap: 0; }
  .nav-wrap, .navbar > .nav-item { flex: 1; display: grid; }
  .navbar > .nav-item { justify-items: center; align-content: center; }
  .nav-item { flex-direction: column; justify-content: center; gap: 2px; height: 54px; padding: 0 6px; font-size: 11px; font-weight: 700; }
  .nav-item .caret { display: none; }
  .nav-item svg { width: 23px; height: 23px; }
  .menu-pop { position: fixed; left: 12px; right: 12px; top: auto; bottom: calc(76px + env(safe-area-inset-bottom)); min-width: 0; }
}

/* ---- primitives --------------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; }
.card.flush { padding: 0; overflow: hidden; }
.card.lift { transition: transform .18s, box-shadow .18s; }
.card.lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.section-title { font-size: 13px; font-weight: 700; color: var(--text-3); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.muted { color: var(--text-2); }
.small { font-size: 14px; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1 1 0; min-width: 0; }
.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 24px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); font-weight: 600; cursor: pointer; color: var(--text);
  transition: background .15s, border-color .15s, transform .12s, box-shadow .15s; }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--navy); border-color: transparent; color: #fff; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.12); }
.btn.white { background: #fff; color: #15306f; border-color: transparent; font-weight: 800; }
.btn.white:hover:not(:disabled) { background: #f0f5ff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.sm { min-height: 40px; padding: 0 16px; font-size: 14px; border-radius: 999px; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.tag { display: inline-flex; align-items: center; height: 26px; padding: 0 11px; border-radius: 13px; font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.tag.primary { background: var(--primary-soft); color: var(--primary); }
.tag.violet { background: var(--violet-soft); color: var(--violet); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); }
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.notice.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.notice.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.notice.info { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.notice.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.notice b { font-weight: 700; }
.empty { text-align: center; padding: 40px 20px; color: var(--text-2); display: grid; gap: 8px; justify-items: center; }
.empty .art { width: 64px; height: 64px; border-radius: 20px; background: var(--grad-soft); display: grid; place-items: center; color: var(--primary); margin-bottom: 4px; }
.empty .art svg { width: 30px; height: 30px; }
.empty h3 { color: var(--text); font-size: 17px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 10px; height: 20px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--grad); border-radius: 3px; transition: width .4s cubic-bezier(.2, .7, .2, 1); }

/* icon chips + ring ---------------------------------------------------------------------- */
.chip { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary); }
.chip svg { width: 22px; height: 22px; }
.chip.violet { background: var(--violet-soft); color: var(--violet); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.teal { background: var(--teal-soft); color: var(--teal); }
.chip.slate { background: var(--slate-soft); color: var(--text-2); }
.chip.red { background: var(--bad-soft); color: var(--bad); }
.ring { position: relative; display: grid; place-items: center; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .track { stroke: rgba(255, 255, 255, .22); }
.ring.onlight .track { stroke: var(--surface-2); }
.ring .bar { stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(.2, .7, .2, 1); }
.ring .center { position: absolute; display: grid; place-items: center; text-align: center; line-height: 1.1; }
.ring .center b { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ring .center span { font-size: 12px; opacity: .85; margin-top: 3px; }

/* ---- hero (flat navy card) ------------------------------------------------------------------------------------------------------ */
.hero { position: relative; overflow: hidden; border-radius: 28px; padding: 34px 36px; color: #fff; background: var(--navy);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; }
.hero .deco { position: absolute; right: -20px; bottom: -34px; width: 340px; opacity: .10; pointer-events: none; }
.hero > * { position: relative; }
.hero .eyebrow { font-size: 14px; opacity: .88; font-weight: 600; }
.hero h1 { text-wrap: balance; font-size: 30px; line-height: 1.25; font-weight: 900; letter-spacing: -0.035em; margin: 6px 0 14px; max-width: 560px; }
.hero p { opacity: .9; max-width: 540px; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; align-items: center; }
.hero .meta svg { width: 18px; height: 18px; }
.hero .meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; opacity: .92; }
@media (max-width: 720px) { .hero { grid-template-columns: 1fr; padding: 26px 22px; } .hero .ring { justify-self: start; } .hero h1 { font-size: 24px; } }

/* ---- stats + lists --------------------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.stat { display: flex; align-items: center; gap: 16px; padding: 18px 20px; }
.stat .num { font-size: 28px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .lbl { color: var(--text-2); font-size: 14px; }
.list { display: grid; }
.list > .item { display: flex; align-items: center; gap: 16px; padding: 18px 22px; border-top: 1px solid var(--border); transition: background .15s; }
.list > .item:first-child { border-top: 0; }
.list > .item:hover { background: color-mix(in srgb, var(--primary-soft) 40%, transparent); }
.list > .item.next { background: var(--grad-soft); }
.item .title { font-weight: 650; }
.item .sub { color: var(--text-2); font-size: 14px; }
.item .mins { color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 550; background: var(--surface-2); padding: 4px 11px; border-radius: 999px; font-size: 14px; }
@media (max-width: 640px) { .list > .item { flex-wrap: wrap; } .item .grow { flex-basis: calc(100% - 70px); } }
.mastery-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) 46px; gap: 12px; align-items: center; padding: 9px 22px; }
.mastery-row .name { font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mastery-row .pct { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; }
.mastery-row .progress { height: 8px; }
.mastery-row .progress > i.low { background: var(--bad); }
.mastery-row .progress > i.mid { background: var(--amber); }
.mastery-row .progress > i.high { background: var(--ok); }

/* ---- math ------------------------------------------------------------------------------------ */
.math { font-size: 1.25em; }
.math.lg { font-size: 2em; }
math-field { display: block; width: 100%; min-height: 62px; padding: 8px 16px; font-size: 1.6rem; border: 1.5px solid var(--border-strong); border-radius: 14px; background: var(--surface); color: var(--text);
  --hue: 230; --caret-color: var(--primary); --selection-background-color: var(--primary-soft); --selection-color: var(--text); --text-font-family: var(--font); transition: border-color .15s, box-shadow .15s; }
math-field:focus-within { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); }
math-field::part(virtual-keyboard-toggle), math-field::part(menu-toggle) { color: var(--text-3); }
.input-row { display: flex; gap: 12px; align-items: stretch; }
.input-row .grow { display: grid; min-width: 0; }
@media (max-width: 520px) { .input-row { flex-direction: column; } .input-row .btn { width: 100%; } }
.hint { color: var(--text-3); font-size: 14px; }
.err-text { color: var(--bad); font-size: 14px; font-weight: 500; }

/* ---- level test ------------------------------------------------------------------------------- */
.question { display: grid; gap: 24px; }
.question .prompt { color: var(--text-2); font-weight: 500; }
.problem-box { padding: 34px 28px; border-radius: 18px; text-align: center; overflow-x: auto; border: 1px solid var(--border);
  background-color: var(--surface-2); background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 28px 28px; background-position: -1px -1px; box-shadow: inset 0 2px 8px rgba(24, 39, 90, .04); }
.problem-box .math { background: var(--surface); padding: 6px 18px; border-radius: 12px; box-shadow: var(--shadow-sm); }
.steps { display: flex; gap: 5px; }
.steps i { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-2); }
.steps i.done { background: var(--grad); }
.steps i.cur { background: var(--primary); opacity: .55; }
.concept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.concept-cell { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); }
.intro { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 28px; align-items: center; }
.intro .art { width: 100%; max-width: 220px; justify-self: center; }
@media (max-width: 720px) { .intro { grid-template-columns: 1fr; } .intro .art { display: none; } }
.checks { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.checks li { display: flex; gap: 12px; align-items: flex-start; color: var(--text-2); }
.checks svg { width: 20px; height: 20px; color: var(--primary); flex: none; margin-top: 3px; }

/* ---- solve --------------------------------------------------------------------------------------- */
.solve { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 22px; align-items: start; }
.solve > * { min-width: 0; }
@media (max-width: 1100px) { .solve { grid-template-columns: minmax(0, 1fr); } }
.paper { min-height: 300px; padding: 6px 0; background: var(--surface); }
.line { display: grid; grid-template-columns: 38px minmax(0, 1fr) 30px; align-items: center; gap: 12px; padding: 10px 22px; cursor: pointer; border-left: 4px solid transparent; border-bottom: 1px solid color-mix(in srgb, var(--primary) 10%, transparent); min-height: 58px; transition: background .12s; }
.line .math { min-width: 0; overflow-x: auto; overflow-y: hidden; }
.line:hover { background: color-mix(in srgb, var(--primary-soft) 55%, transparent); }
.line.sel { background: var(--primary-soft); border-left-color: var(--primary); }
.line .no { color: var(--text-3); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.line .mark { width: 24px; height: 24px; }
.line .mark.ok { color: var(--ok); } .line .mark.bad { color: var(--bad); } .line .mark.warn { color: var(--amber); } .line .mark.none { color: var(--text-3); }
.line .why { grid-column: 2 / 4; margin-top: -4px; font-size: 14px; color: var(--bad); font-weight: 600; }
.line .why.warn { color: var(--warn); }
.panel { position: sticky; top: 24px; display: grid; gap: 14px; }
.verdict { display: flex; align-items: center; gap: 12px; padding: 14px 18px; margin: -22px -22px 4px; border-radius: var(--radius) var(--radius) 0 0; font-weight: 700; }
.verdict svg { width: 24px; height: 24px; flex: none; }
.verdict.ok { background: var(--ok-soft); color: var(--ok); } .verdict.bad { background: var(--bad-soft); color: var(--bad); }
.verdict.warn { background: var(--warn-soft); color: var(--warn); } .verdict.none { background: var(--surface-2); color: var(--text-2); }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--text-3); } .kv dd { margin: 0; }
.status-line { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13px; }

/* ---- analysis -------------------------------------------------------------------------------------- */
.habit { display: grid; grid-template-columns: 44px minmax(0, 1fr) 64px; gap: 6px 14px; align-items: center; padding: 16px 22px; border-top: 1px solid var(--border); }
.habit:first-child { border-top: 0; }
.habit .bar { grid-column: 2 / 4; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.habit .bar > i { display: block; height: 100%; background: var(--amber); border-radius: 4px; }
.habit .pct { text-align: right; font-weight: 750; font-size: 18px; font-variant-numeric: tabular-nums; }
.map { overflow-x: auto; padding: 4px 4px 14px; }
.map-inner { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(118px, 1fr); gap: 16px; min-width: 660px; }
.map-inner svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.map .col { display: grid; gap: 10px; align-content: start; position: relative; }
.map .col h4 { margin: 0 0 4px; font-size: 12px; color: var(--text-3); font-weight: 700; letter-spacing: .06em; }
.node { position: relative; padding: 9px 11px; font-size: 12.5px; overflow-wrap: anywhere; border: 1px solid var(--border-strong); border-radius: 11px; background: var(--surface); line-height: 1.35; box-shadow: var(--shadow-sm); }
.node.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.node.s1 { background: var(--warn-soft); border-color: var(--amber); }
.node.s2 { background: var(--bad-soft); border-color: var(--bad); }
.node.root { box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 35%, transparent); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--text-2); font-size: 13px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; border: 1px solid var(--border-strong); }

/* ---- plan ----------------------------------------------------------------------------------------- */
.day { display: grid; grid-template-columns: 124px 1fr; gap: 18px; padding: 18px 22px; border-top: 1px solid var(--border); }
.day:first-child { border-top: 0; }
.day.today { background: var(--grad-soft); }
.day .when { font-weight: 700; } .day .when small { display: block; color: var(--text-3); font-weight: 500; }
.day.today .when small { color: var(--primary); font-weight: 650; }
@media (max-width: 640px) { .day { grid-template-columns: 1fr; gap: 8px; } }
.q { display: flex; gap: 10px; align-items: center; padding: 4px 0; }
.q .mins { margin-left: auto; color: var(--text-2); font-variant-numeric: tabular-nums; font-size: 14px; }

/* ---- feedback / forms -------------------------------------------------------------------------------- */
.feedback { display: grid; gap: 8px; padding: 18px 20px; border-radius: 16px; }
.feedback svg { width: 24px; height: 24px; flex: none; }
.feedback.ok { background: var(--ok-soft); color: var(--ok); }
.feedback.bad { background: var(--bad-soft); color: var(--bad); }
.feedback .math { color: var(--text); }
.gate { max-width: 440px; margin: 12vh auto 0; display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 650; font-size: 15px; }
.field input, .field select, textarea, .gate input { min-height: 48px; padding: 0 14px; border: 1.5px solid var(--border-strong); border-radius: 12px; background: var(--surface); width: 100%; transition: border-color .15s, box-shadow .15s; }
.field input:focus, .field select:focus, textarea:focus, .gate input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent); }
textarea { padding: 12px 14px; min-height: 90px; resize: vertical; }
.setting { display: grid; gap: 14px; }
.setting-head { display: flex; align-items: center; gap: 14px; }
.setting-head h2 { font-size: 18px; }

/* ---- lectures ----------------------------------------------------------------------------------------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.lec { display: grid; grid-template-columns: 176px minmax(0, 1fr); gap: 18px; padding: 18px 22px; border-top: 1px solid var(--border); }
.lec:first-child { border-top: 0; }
@media (max-width: 640px) { .lec { grid-template-columns: 1fr; } }
.thumb { width: 176px; aspect-ratio: 16 / 9; border-radius: 12px; background: var(--surface-2); object-fit: cover; display: block; box-shadow: var(--shadow-sm); }
@media (max-width: 640px) { .thumb { width: 100%; } }
.lec .title { font-weight: 650; line-height: 1.4; }
.lec .meta { color: var(--text-3); font-size: 13px; }
.conf { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.conf .progress { width: 72px; }
select.btn { padding-right: 10px; }
.player-wrap { aspect-ratio: 16 / 9; width: 100%; background: #000; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-lg); }
.player-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
.seg { display: flex; justify-content: space-between; gap: 12px; width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; text-align: left; min-height: 46px; transition: background .15s, border-color .15s; }
.seg:hover { background: var(--primary-soft); border-color: transparent; }
.seg .t { color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lecture-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; align-items: start; }
@media (max-width: 1100px) { .lecture-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---- admin: tabs, usage, logs, switches ------------------------------------------------------------------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs a { padding: 11px 18px; text-decoration: none; color: var(--text-2); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; min-height: 46px; display: flex; align-items: center; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--primary); border-bottom-color: var(--primary); }
.usage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 14px; }
.metric b { display: block; font-size: 22px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.metric span { color: var(--text-2); font-size: 13px; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 96px; }
.bars .b { flex: 1; max-width: 64px; display: grid; grid-template-rows: 1fr auto; gap: 6px; height: 100%; text-align: center; font-size: 11px; color: var(--text-3); }
.bars .b i { align-self: end; display: block; min-height: 3px; border-radius: 6px 6px 2px 2px; background: var(--grad); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--text-3); font-weight: 600; font-size: 12px; letter-spacing: .04em; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 9px 6px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.tbl td.num, .tbl th.num { text-align: right; }
.switch { position: relative; width: 46px; height: 26px; border-radius: 13px; border: 0; background: var(--border-strong); cursor: pointer; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.logbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.logbar select, .logbar input { min-height: 42px; padding: 0 12px; border: 1.5px solid var(--border-strong); border-radius: 10px; background: var(--surface); }
.logbar input { flex: 1 1 180px; }
.log { display: grid; grid-template-columns: 112px 54px 82px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 18px; border-top: 1px solid var(--border); font-size: 14px; cursor: default; }
.log:first-child { border-top: 0; }
.log.has-detail { cursor: pointer; }
.log:hover { background: color-mix(in srgb, var(--primary-soft) 35%, transparent); }
.log .t { color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 12.5px; padding-top: 2px; }
.log .detail { grid-column: 4; margin-top: 4px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 720px) { .log { grid-template-columns: 1fr auto; } .log .t { grid-column: 1; } .log .detail, .log .msg { grid-column: 1 / 3; } }
.source { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.source:first-child { border-top: 0; }

/* form controls inside cards (settings, auto-collect) */
.setting input:not([type=checkbox]):not([type=radio]), .setting select:not(.btn):not(.sm), .logbar select {
  min-height: 44px; padding: 0 12px; border: 1.5px solid var(--border-strong); border-radius: 12px; background: var(--surface); width: 100%; transition: border-color .15s, box-shadow .15s; }
.setting select:not(.btn) { width: auto; }
.setting input:focus, .setting select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent); }
.usage-grid input[type=number] { min-height: 40px; padding: 0 10px; border: 1.5px solid var(--border-strong); border-radius: 10px; background: var(--surface); }

/* ---- error review (복기) ---- */
.review-compare { display: grid; gap: 8px; }
.review-compare .side { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; overflow-x: auto; }
.review-compare .side .tag { flex: none; }
.review-compare .side.bad { background: var(--bad-soft); }
.review-compare .side.ok { background: var(--ok-soft); }
.review-piece { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.review .rule { margin: 0; font-weight: 600; line-height: 1.55; }
.review .example { display: flex; align-items: center; gap: 10px; color: var(--text-2); overflow-x: auto; font-size: 14px; }
details.review-all > summary { list-style: none; }
details.review-all > summary::-webkit-details-marker { display: none; }
details.review-all > summary::after { content: "펼치기"; margin-left: 10px; font-weight: 500; font-size: 13px; color: var(--text-3); }
details.review-all[open] > summary::after { content: "접기"; }

/* ---- hints and model solutions ---- */
.hint-steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
.hint-steps li { padding-left: 4px; }
.hint-steps .hint-row { margin-top: 4px; overflow-x: auto; }
.notice.hint { align-items: stretch; }
details.solution > summary { list-style: none; }
details.solution > summary::-webkit-details-marker { display: none; }
details.solution > summary::after { content: "펼치기"; margin-left: 10px; font-weight: 500; font-size: 13px; color: var(--text-3); }
details.solution[open] > summary::after { content: "접기"; }

/* ---- concept card / report ---- */
.note-formula { padding: 10px 14px; border-radius: 12px; background: var(--surface-2); overflow-x: auto; }
.pill { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 14px; font-weight: 600; text-decoration: none; }
.pill:hover { background: color-mix(in srgb, var(--primary-soft) 70%, var(--primary) 12%); }
.habit .btn { white-space: nowrap; flex: none; }
.stats.four { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.habit:has(.btn) { grid-template-columns: 44px minmax(0, 1fr) auto; }

/* ---- Gemini routes ---- */
.route-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); }
.route-detail { flex-basis: 100%; }
.field.spare .row { flex-wrap: nowrap; }
.field.spare .row input { flex: 1; min-width: 0; }
@media (max-width: 520px) { .field.spare .row { flex-wrap: wrap; } }

/* ---- English practice (plain text answers) ---- */
.en-problem { font-size: 26px; line-height: 1.5; font-weight: 550; letter-spacing: .1px; overflow-wrap: anywhere; }
.en-problem.lg { font-size: 28px; }
.en-blank { display: inline-block; min-width: 76px; height: 1.1em; vertical-align: -.12em; margin: 0 4px; border-bottom: 3px solid var(--primary); border-radius: 2px; }
.en-text { font-size: 17px; }
.en-input { width: 100%; min-height: 52px; padding: 0 16px; font: inherit; font-size: 20px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); }
.en-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.choice-list { display: flex; flex-wrap: wrap; gap: 10px; }
.choice, .word { min-height: 52px; padding: 0 20px; font: inherit; font-size: 20px; font-weight: 550; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); cursor: pointer; }
.choice[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.word:disabled { opacity: .35; cursor: default; }
.word.placed { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.order-answer, .order-bank { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.order-answer { min-height: 66px; padding: 8px; border: 1.5px dashed var(--border); border-radius: 12px; }
.input-row.en { align-items: flex-start; }
.review-rule { display: grid; gap: 6px; padding: 12px 14px; margin-top: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); line-height: 1.55; }
.word-big { font-size: 44px; font-weight: 700; letter-spacing: .2px; }
.word-card { padding: 34px 24px; }
.en-passage { font-size: 21px; line-height: 1.75; padding: 18px 20px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.en-question { font-size: 22px; font-weight: 650; line-height: 1.5; }
.prompt { white-space: pre-line; }

/* ---- today (2026 layout) ------------------------------------------------------------------------------------------------------- */
.eyebrow-blue { font-size: 15px; font-weight: 700; color: var(--primary); }
.greet { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.greet h1 { font-size: 44px; line-height: 1.1; font-weight: 900; letter-spacing: -0.04em; color: var(--heading); margin: 6px 0 10px; }
.greet p { font-size: 17px; color: var(--text-2); }
.greet p b { color: var(--text); }
.daybar { width: 340px; max-width: 100%; display: grid; gap: 8px; font-size: 14px; }
.row.between { justify-content: space-between; }
.bars2 { display: flex; height: 12px; gap: 3px; border-radius: 99px; overflow: hidden; background: var(--surface-2); }
.bars2 span { border-radius: 99px; } .bars2 .m { background: var(--math); } .bars2 .e { background: var(--eng); } .bars2 .s { background: var(--amber); }
.legend2 { display: flex; gap: 18px; font-size: 13px; color: var(--text-2); }
.legend2 i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; } .legend2 i.m { background: var(--math); } .legend2 i.e { background: var(--eng); } .legend2 i.s { background: var(--amber); }
.split2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 900px) { .split2 { grid-template-columns: minmax(0, 1fr); } }
.hero-card { background: var(--navy); color: #fff; border-radius: 28px; padding: 34px 36px; display: flex; flex-direction: column; gap: 16px; min-height: 300px; }
.hero-card h2 { font-size: 36px; line-height: 1.2; font-weight: 900; letter-spacing: -0.04em; text-wrap: balance; }
.hero-card p { color: #c9d8f8; font-size: 16px; line-height: 1.65; max-width: 520px; }
.hero-card .meta { color: #c9d8f8; font-size: 15px; }
.hero-card .btn { min-height: 56px; padding: 0 30px; font-size: 17px; } .hero-card .btn svg { width: 20px; height: 20px; }
.hero-card .empty { color: #c9d8f8; } .hero-card .empty h3 { color: #fff; }
.chip-s { display: inline-flex; align-items: center; height: 28px; padding: 0 13px; border-radius: 999px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.chip-s.math { background: var(--math-soft); color: var(--math); } .chip-s.eng { background: var(--eng-soft); color: var(--eng); } .chip-s.school { background: var(--amber-soft); color: var(--amber); }
.hero-card .chip-s.math { background: #2f54eb; color: #fff; } .hero-card .chip-s.eng { background: #12a478; color: #fff; }
.chip-s.glass { background: rgba(255, 255, 255, .16); color: #fff; }
.sky-card { background: var(--sky); border: 1px solid var(--sky-line); border-radius: 28px; padding: 30px 32px; display: flex; flex-direction: column; gap: 8px; }
.bignum { font-size: 88px; line-height: 1; font-weight: 900; letter-spacing: -0.05em; color: var(--heading); font-variant-numeric: tabular-nums; }
.bignum small { font-size: 38px; }
.rule-line { height: 2px; background: var(--heading); margin: 8px 0 6px; }
.mbar { display: grid; gap: 5px; font-size: 14px; } .mbar b.m { color: var(--math); } .mbar b.e { color: var(--eng); }
.mbar .track { height: 8px; border-radius: 99px; } .mbar .track i { display: block; height: 100%; border-radius: 99px; }
.mbar .track.m { background: var(--math-soft); } .mbar .track.m i { background: var(--math); } .mbar .track.e { background: var(--eng-soft); } .mbar .track.e i { background: var(--eng); }
.pill-col { display: grid; gap: 10px; margin-top: auto; padding-top: 14px; }
.pill-row { display: flex; gap: 12px; flex-wrap: wrap; }
.pill-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 0 20px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--sky-line); color: var(--navy); font-size: 15px; font-weight: 800; text-decoration: none; }
.pill-link:hover { background: var(--surface-2); }
.h2row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.h2row h2 { font-size: 24px; font-weight: 900; letter-spacing: -0.03em; }
.order { display: grid; gap: 10px; }
.order-row { display: flex; align-items: center; gap: 16px; min-height: 66px; padding: 10px 22px; border-radius: 20px; background: var(--surface); border: 1.5px solid var(--border); flex-wrap: wrap; }
.order-row.now { background: var(--surface-2); border-color: var(--navy); }
.order-row .no { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 800; flex: none; }
.order-row .no.math { background: var(--math-soft); color: var(--math); } .order-row .no.eng { background: var(--eng-soft); color: var(--eng); } .order-row .no.school { background: var(--amber-soft); color: var(--amber); }
.order-row.now .no { background: var(--navy); color: #fff; }
.order-row .t { font-size: 17px; font-weight: 700; } .order-row .sub { font-size: 13px; color: var(--text-3); }
.order-row .mins { width: 52px; text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; }
.engine-card { background: var(--surface-2); border-radius: 28px; padding: 30px 32px; display: flex; gap: 28px; flex-wrap: wrap; align-items: center; }
.engine-card > .stack { flex: 1 1 300px; } .engine-card h2 { font-size: 24px; font-weight: 900; letter-spacing: -0.03em; } .engine-card .bad { color: var(--bad); }
.mm-wrap { flex: 1.6 1 520px; min-width: 0; overflow-x: auto; padding: 6px 2px; }
.mm { position: relative; margin: 0 auto; }
.mm-edges { position: absolute; inset: 0; } .mm-edges path { fill: none; stroke: var(--border-strong); stroke-width: 2; } .mm-edges path.hot { stroke: var(--bad); stroke-width: 2.5; } .mm-edges path.lock { stroke-dasharray: 5 5; }
.mm-node { position: absolute; padding: 6px 12px; border-radius: 12px; border: 1.5px solid; display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.mm-node span { font-size: 10px; font-weight: 700; opacity: .85; } .mm-node b { font-size: 12.5px; font-weight: 800; line-height: 1.25; }
.mm-node.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 45%, transparent); color: var(--ok); }
.mm-node.root { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.mm-node.gap { background: var(--warn-soft); border-color: var(--amber); color: var(--warn); }
.mm-node.locked { background: var(--slate-soft); border-color: var(--border-strong); color: var(--text-3); }

/* ---- engine page ------------------------------------------------------------------------------------------------------------------ */
.mods { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.mod { background: var(--surface-2); border-radius: 20px; padding: 18px 20px; display: grid; gap: 4px; }
.mod code, .gov-log code { font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace; font-size: 12px; font-weight: 700; color: var(--text-3); }
.mod b { font-size: 16px; font-weight: 800; } .mod span { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.insights { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 20px; }
@media (max-width: 560px) { .insights { grid-template-columns: minmax(0, 1fr); } }
.insight { display: grid; gap: 10px; align-content: start; padding: 28px 30px; }
.insight h2 { font-size: 22px; font-weight: 900; letter-spacing: -0.03em; }
.gov-log { background: #0b1226; color: #d6e0f5; border-radius: 28px; padding: 28px 30px; display: grid; gap: 14px; }
.gov-log h2 { font-size: 22px; font-weight: 900; color: #fff; letter-spacing: -0.03em; } .gov-log p { color: #8fa3cc; font-size: 14px; }
.gov-log .glog { display: grid; gap: 10px; font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; }
.gov-log .glog > div { display: flex; gap: 14px; } .gov-log .glog b { flex: none; width: 110px; color: #84caff; } .gov-log details summary { cursor: pointer; color: #84caff; font-family: var(--font); font-size: 13px; }
.gov-log code { color: #8fa3cc; }

.btn svg { width: 18px; height: 18px; flex: none; }
@media (max-width: 640px) {
  .order-row .grow { flex: 1 1 calc(100% - 60px); }
  .order-row .chip-s { margin-left: 46px; }
  .order-row .mins { margin-left: auto; }
  .hero-card { padding: 26px 22px; min-height: 0; } .hero-card h2 { font-size: 28px; }
  .greet h1 { font-size: 34px; } .bignum { font-size: 68px; }
}
.mastery-row.fam { grid-template-columns: 92px minmax(0, 1fr) 46px; }

/* ---- solve (polish) ----------------------------------------------------------------------------------------------------------------------- */
.paper.card { background: transparent; border: 0; border-radius: 0; overflow: visible; display: grid; gap: 10px; padding: 0; min-height: 0; }
.paper.is-empty { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-height: 280px; align-content: center; }
.line { grid-template-columns: 34px minmax(0, 1fr) 28px; gap: 14px; padding: 12px 20px; min-height: 64px; border-radius: 18px; background: var(--surface); border: 1.5px solid var(--border); }
.line:hover { background: var(--surface-2); }
.line.sel { background: var(--surface-2); border-color: var(--navy); }
.line .no { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 13px; font-weight: 800; color: var(--text-2); }
.line.sel .no { background: var(--navy); color: #fff; }
.line.tone-bad { border-color: var(--bad); background: color-mix(in srgb, var(--bad-soft) 40%, var(--surface)); }
.line.tone-bad .no { background: var(--bad-soft); color: var(--bad); }
.line.tone-ok .no { background: var(--ok-soft); color: var(--ok); }
.line.tone-warn { border-color: var(--amber); }
.line .why { font-weight: 700; margin-top: 0; }
.panel .verdict { font-size: 17px; font-weight: 800; margin: -26px -26px 6px; padding: 18px 24px; border-radius: var(--radius) var(--radius) 0 0; }
.panel .verdict.bad, .panel .verdict.ok { color: var(--on-primary); }
.panel .verdict.bad { background: var(--bad); } .panel .verdict.ok { background: var(--ok); }
.panel .verdict .muted { color: inherit; opacity: .85; }
.review-compare .side { padding: 14px 18px; border-radius: 16px; }
.review-compare .side .math { font-size: 1.45em; }
.review .rule { font-size: 15px; }
.review .example { background: var(--surface-2); border-radius: 14px; padding: 10px 16px; }
.solve > .stack > .card.stack { padding: 18px; border-radius: 24px; background: var(--surface-2); border-color: transparent; }
.solve math-field { background: var(--surface); }

/* ---- practice (polish) ------------------------------------------------------------------------------------------------------------------- */
.problem-box { background: var(--surface-2); background-image: none; border: 0; box-shadow: none; padding: 36px 28px; border-radius: 22px; }
.problem-box .math { background: transparent; box-shadow: none; padding: 0; }
.q-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.q-head .steps { flex: 1 1 160px; max-width: 320px; }
.q-count { font-size: 14px; font-weight: 800; color: var(--text-2); font-variant-numeric: tabular-nums; }
.feedback { border-radius: 20px; padding: 20px 22px; }
.question { gap: 22px; }
.steps i { background: var(--border-strong); }
.steps i.done { background: var(--navy); } .steps i.cur { background: var(--primary); opacity: 1; }
.panel .btn.primary { text-align: center; line-height: 1.3; padding-top: 10px; padding-bottom: 10px; text-wrap: balance; }

/* ---- plan adjuster ---------------------------------------------------------------------------------------------------------------- */
.adjuster { background: var(--surface-2); border-radius: 28px; padding: 24px 28px; display: grid; gap: 14px; }
.adjuster .h2row { margin-bottom: 0; } .adjuster h2 { font-size: 20px; font-weight: 900; letter-spacing: -0.03em; }
.adjust-chat { display: flex; gap: 10px; flex-wrap: wrap; }
.adjust-input { flex: 1 1 280px; min-height: 44px; padding: 0 18px; border: 1.5px solid var(--border-strong); border-radius: 999px; background: var(--surface); }
.adjust-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent); }
.adjust-out { display: grid; gap: 4px; padding: 14px 18px; border-radius: 18px; line-height: 1.55; }
.adjust-out.ok { background: var(--ok-soft); color: var(--ok); } .adjust-out.part { background: var(--warn-soft); color: var(--warn); } .adjust-out.no { background: var(--bad-soft); color: var(--bad); }
.adjust-out span { color: var(--text); }

/* ---- coach chat -------------------------------------------------------------------------------------------------------------------- */
.chat { display: grid; gap: 14px; max-width: 860px; }
.chat-log { display: grid; gap: 14px; min-height: 360px; max-height: 62vh; overflow-y: auto; padding: 24px; background: var(--surface-2); border-radius: 28px; align-content: start; }
.msg { display: grid; gap: 8px; max-width: 86%; }
.msg.user { justify-self: end; } .msg.coach { justify-self: start; }
.bubble { padding: 14px 18px; border-radius: 22px; line-height: 1.6; white-space: pre-wrap; }
.msg.user .bubble { background: var(--navy); color: #fff; border-bottom-right-radius: 8px; }
.msg.coach .bubble { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 8px; }
.msg.wait .bubble { color: var(--text-3); }
.msg-extra { display: grid; gap: 8px; }
.chg { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; padding: 6px 12px; border-radius: 999px; width: fit-content; }
.chg svg { width: 16px; height: 16px; }
.chg.ok { background: var(--ok-soft); color: var(--ok); } .chg.part { background: var(--warn-soft); color: var(--warn); } .chg.no { background: var(--bad-soft); color: var(--bad); }
.chat-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-btn { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--sky-line); background: var(--surface); color: var(--navy); font-weight: 700; font-size: 14px; cursor: pointer; }
.chip-btn:hover { background: var(--sky); }
.chat-bar { display: flex; gap: 10px; }
.chat-input { flex: 1; min-height: 52px; padding: 0 20px; border: 1.5px solid var(--border-strong); border-radius: 999px; background: var(--surface); font-size: 16px; }
.chat-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent); }
.diag { margin: 8px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font: 12px/1.6 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); }

/* ---- lecture notes ------------------------------------------------------------------------------------------------------------- */
.note-input { width: 100%; min-height: 84px; padding: 12px 14px; border: 1.5px solid var(--border-strong); border-radius: 16px; background: var(--surface); resize: vertical; line-height: 1.55; }
.note-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent); }
.note-list { display: grid; gap: 8px; max-height: 340px; overflow-y: auto; }
.note { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.note-time { border: 0; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 12px; min-height: 28px; padding: 0 10px; cursor: pointer; font-variant-numeric: tabular-nums; }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.note-actions { grid-column: 2; display: flex; gap: 4px; }
.note-actions .btn { min-height: 32px; padding: 0 10px; font-size: 13px; }

/* Handwriting pad (MyScript iink): one line of working at a time */
.mode-group { gap: 6px; }
.mode-btn[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 650; }
.ink-stage { position: relative; border: 1px solid var(--border-strong, var(--border)); border-radius: 16px; background: #fff; overflow: hidden; }
.ink-surface { position: relative; width: 100%; height: 240px; touch-action: none; user-select: none; -webkit-user-select: none; }
.ink-surface > * { touch-action: none; }
@media (min-width: 900px) { .ink-surface { height: 280px; } }
.ink-hint { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; font-size: 1.05rem; }
.ink-hint[hidden] { display: none; }
.ink-bar { align-items: center; gap: 8px; flex-wrap: wrap; }
.ink-bar .ink-status { margin-left: auto; }
.ink-status[data-tone="ok"] { color: var(--ok, #15803d); }
.ink-status[data-tone="warn"] { color: var(--warn, #b45309); }
.ink-status[data-tone="bad"] { color: var(--bad, #b91c1c); }
.ink-finger { display: inline-flex; align-items: center; gap: 4px; }
.ink-log { margin: 8px 0 0; padding: 10px; max-height: 180px; overflow: auto; white-space: pre-wrap; word-break: break-all; font-size: .78rem; background: var(--surface-2); border-radius: 10px; }
.ink-surface .ms-ink-state, .ink-stage .ms-ink-state { display: none !important; }   /* the SDK's own connection badge: meaningless for request/response recognition */
.work-rows:empty { display: none; }
.work-surface { height: 320px; }
@media (min-width: 900px) { .work-surface { height: 420px; } }
.ink-tools { gap: 6px; align-items: center; flex-wrap: wrap; }
.ink-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.mode-btn.swatch { width: 34px; height: 34px; min-height: 34px; padding: 0; border-radius: 50%; background: var(--swatch); border: 3px solid var(--surface); box-shadow: 0 0 0 1.5px var(--border-strong, var(--border)); }
.mode-btn.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--primary); background: var(--swatch); }
.ink-tools .btn { min-height: 38px; }
/* School documents */
.school-card { display: grid; gap: 6px; text-decoration: none; color: inherit; }
.school-card:hover { background: var(--surface-2); }
.school-preview:empty { display: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.check-row input { width: 20px; height: 20px; flex: none; }
.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 14px; margin-top: 8px; }
.field textarea, .field select, .field input[type="text"], .field input[type="date"] { width: 100%; }

/* ---- home (remodel): one big start card, order list, side cards ------------------------------------------------------------------ */
.greet h1 { font-size: 34px; letter-spacing: -0.04em; font-weight: 800; }
.hero-card { flex-direction: row; align-items: center; gap: 36px; min-height: 0; padding: 34px 40px; box-shadow: 0 18px 40px -24px rgba(21, 48, 111, .6); }
.hero-main { flex: 1; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.hero-main h2 { font-size: 32px; }
.hero-ring { flex: none; }
.hero-actions { gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.hero-card .btn.white { box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .45); }
.btn.ghost-white { background: transparent; border: 1.5px solid rgba(255, 255, 255, .45); color: #fff; }
.btn.ghost-white:hover { background: rgba(255, 255, 255, .1); }
.hero-card .btn svg, .btn.ghost-white svg { width: 20px; height: 20px; }
.chip-s svg { width: 14px; height: 14px; margin-right: 6px; flex: none; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 900px) { .home-grid { grid-template-columns: minmax(0, 1fr); } .hero-card { flex-direction: column; align-items: flex-start; padding: 26px 22px; } .hero-ring { align-self: center; } }
.order-card { padding: 22px 26px; }
.order-card .order { gap: 0; }
.order-card .order-row { background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 10px 0; min-height: 62px; }
.order-card .order-row:last-child { border-bottom: 0; }
.order-card .order-row.now { background: var(--primary-soft); border-radius: 16px; border-bottom-color: transparent; padding: 10px 14px; margin: 0 -14px; }
.order-row .no svg { width: 16px; height: 16px; }
.order-row.is-done .t { text-decoration: line-through; color: var(--text-3); font-weight: 500; }
.order-row.is-done .no { background: var(--ok-soft); color: var(--ok); }
.order-row.is-done .btn { display: none; }
.side-stack { display: grid; gap: 16px; }
.side-stack .sky-card { padding: 22px 26px; gap: 8px; }
.side-stack .bignum { font-size: 60px; }
.dday-card { display: grid; gap: 10px; text-decoration: none; color: inherit; padding: 20px 24px; }
.dday-card:hover { background: var(--surface-2); }
.dday-title { font-size: 18px; font-weight: 800; }
.track-s { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.track-s i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.watch-card { padding: 20px 24px; display: grid; gap: 8px; }
.mi-s { width: 30px; height: 30px; border-radius: 10px; background: var(--primary-soft); color: var(--navy); display: grid; place-items: center; flex: none; }
.mi-s svg { width: 18px; height: 18px; }

/* ---- learning session (remodel): no site menu, a slim bar with the day's steps, the item below ------------------------------------ */
body.in-session .topbar { display: none; }
body.in-session .main { padding-top: 18px; }
.session-bar { display: flex; align-items: center; gap: 18px; min-height: 60px; }
.session-steps { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 6px; flex: 1; justify-content: center; flex-wrap: wrap; }
.session-steps .step { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-3); }
.session-steps .step + .step::before { content: ""; width: 22px; height: 2px; background: var(--border-strong); margin-right: 6px; border-radius: 2px; }
.session-steps .si { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.session-steps .si svg { width: 15px; height: 15px; }
.session-steps .step.done { color: var(--ok); font-weight: 700; }
.session-steps .step.done .si { background: var(--ok-soft); color: var(--ok); }
.session-steps .step.now { background: var(--navy); color: #fff; border-radius: 999px; padding: 5px 16px 5px 6px; font-weight: 800; font-size: 15px; }
.session-steps .step.now .si { background: rgba(255, 255, 255, .18); color: #fff; }
.session-steps .step.now::before { display: none; }
.session-steps .step.now + .step::before { display: block; }
.session-time { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.session-time svg { width: 18px; height: 18px; }
.session-stage { min-width: 0; margin-top: 8px; }
.session-page { display: grid; gap: 20px; }
.session-task-bar { justify-content: flex-end; }
.summary { padding: 34px 36px; display: grid; gap: 22px; }
.sum-head { display: flex; align-items: center; gap: 18px; }
.sum-badge { width: 60px; height: 60px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; flex: none; }
.sum-badge svg { width: 30px; height: 30px; }
.sum-head h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.sum-list { list-style: none; margin: 0; padding: 0; display: grid; }
.sum-list li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.sum-list li:last-child { border-bottom: 0; }
.sum-list .si { width: 34px; height: 34px; border-radius: 11px; background: var(--primary-soft); color: var(--navy); display: grid; place-items: center; flex: none; }
.sum-list .si svg { width: 19px; height: 19px; }
.sum-note { color: var(--ok); font-variant-numeric: tabular-nums; }

/* ---- the tablet solving screen: problem | pad | judged lines, answer bar underneath ----------------------------------------------- */
.q-wide { gap: 16px; }
.q-grid { display: grid; grid-template-columns: 290px minmax(0, 1fr) 270px; gap: 16px; align-items: start; }
.q-left { display: grid; gap: 14px; align-content: start; }
.q-left .problem-box { padding: 26px 10px; }
.q-left .prompt { font-size: 15px; }
.q-pad { min-width: 0; }
.q-pad .work { gap: 8px; }
.q-pad .work-surface { height: 380px; }
.q-judge { background: var(--surface-2); border-radius: 20px; padding: 16px; display: grid; gap: 10px; align-content: start; min-height: 200px; }
.q-judge-title { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; }
.q-judge-title svg { width: 18px; height: 18px; color: var(--ok); }
.q-judge .work-rows .line { grid-template-columns: 30px minmax(0, 1fr) 26px; gap: 10px; padding: 8px 10px; min-height: 52px; border-radius: 14px; }
.q-judge .work-rows .line .no { width: 26px; height: 26px; font-size: 12px; }
.q-judge .work-rows .line .why { font-size: 13px; }
.answer-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px 14px; align-items: center; padding: 14px 18px; background: var(--surface-2); border-radius: 22px; }
.answer-bar .ab-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; }
.answer-bar .ab-label svg { width: 18px; height: 18px; color: var(--primary); }
.answer-bar .btn.primary { min-height: 52px; padding: 0 34px; font-size: 17px; }
.answer-bar .ab-hint { grid-column: 2 / -1; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.hint svg { width: 14px; height: 14px; vertical-align: -2px; }
@media (max-width: 1060px) {
  .q-grid { grid-template-columns: minmax(0, 1fr); }
  .answer-bar { grid-template-columns: minmax(0, 1fr); }
  .answer-bar .ab-hint { grid-column: auto; }
}
.q-pad .ink-tools { gap: 5px; padding: 0 2px; }
.q-pad .ink-tools .btn.sm { padding: 0 12px; min-height: 36px; font-size: 13px; }
.q-pad .ink-tools .mode-btn.swatch { width: 28px; height: 28px; min-height: 28px; }
.q-pad .ink-tools .ink-sep { margin: 0 2px; }
.q-pad .ink-bar { gap: 6px; }
.q-left .math.lg, .q-left .problem-box .math { font-size: 22px; }
.ink-tools .btn svg, .ink-bar .btn svg { width: 16px; height: 16px; margin-right: 5px; vertical-align: -3px; }

/* ---- home, as in the confirmed mock-up: short heading, lean order list, "this week" card ---- */
.hero-main h2, .hero-card h2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.order-row { flex-wrap: nowrap; }
.order-row .grow { min-width: 0; }
.order-row .t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; color: inherit; text-decoration: none; }
.order-row a.t:hover { text-decoration: underline; text-underline-offset: 3px; }
.order-row.now .t { font-weight: 800; }
.order-row .chip-s { height: 26px; font-size: 12px; }
.order-row .icon-only, .order-row .icon-only-gap { width: 36px; min-height: 36px; padding: 0; flex: none; display: inline-grid; place-items: center; }
.order-row .icon-only svg { width: 17px; height: 17px; margin: 0; }
.greet-total { display: grid; gap: 2px; justify-items: end; text-align: right; }
.change-card { display: grid; gap: 8px; padding: 20px 24px; }
.change-title { display: flex; align-items: center; gap: 8px; } .change-title svg { width: 18px; height: 18px; }
.change-num { font-size: 30px; font-weight: 800; letter-spacing: -0.04em; }
.change-num.good { color: var(--ok); } .change-num.bad { color: var(--bad); }
@media (max-width: 640px) {
  .order-row { flex-wrap: wrap; }
  .order-row .grow { flex: 1 1 calc(100% - 100px); }
  .order-row .chip-s { margin-left: 46px; }
  .greet-total { justify-items: start; text-align: left; }
}

/* ---- session solving screen, as in the confirmed mock-up (Session): three white cards + an answer bar, one screen, no page scroll ---- */
.session-steps .step.now .sc { font-weight: 500; opacity: .75; margin-left: 2px; font-variant-numeric: tabular-nums; }
.hint-btn { text-align: left; background: var(--surface); border: 1.5px solid var(--border-strong, var(--border)); border-radius: 14px; padding: 12px 16px; font: inherit; font-size: 15px; font-weight: 700; color: var(--navy); cursor: pointer; min-height: 46px; }
.hint-btn:hover:not(:disabled) { background: var(--primary-soft); }
.hint-btn.open { color: var(--text-3); font-weight: 500; border-style: solid; background: var(--surface-2); }
.hint-btn.locked { background: var(--surface-2); border-style: dashed; color: var(--text-3); font-weight: 500; }
.hint-btn:disabled { cursor: default; }
.hint-title { font-weight: 700; color: var(--text-3); }
.q-chip { align-self: flex-start; }
.ink-tools.compact { flex-wrap: nowrap; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.ink-tools.compact .grow { flex: 1; }
.ink-tools.compact .lbl { display: none; }
@media (min-width: 1500px) { .ink-tools.compact .lbl { display: inline; } }
.ink-tools.compact .btn svg { margin-right: 0; }
.ink-tools.compact .btn .lbl { margin-left: 5px; }

@media (min-width: 900px) {
  body.in-session .session-page .q-wide { background: transparent; border: 0; box-shadow: none; padding: 0; gap: 14px; display: flex; flex-direction: column; }
  body.in-session .q-grid { grid-template-columns: 300px minmax(0, 1fr) 270px; align-items: stretch; gap: 16px; }
  body.in-session .q-left, body.in-session .q-pad, body.in-session .q-judge { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; }
  body.in-session .q-left { padding: 22px; gap: 14px; align-content: start; }
  body.in-session .q-pad { padding: 0; overflow: hidden; }
  body.in-session .q-pad .work { gap: 0; }
  body.in-session .q-pad .ink-stage { border: 0; border-radius: 0; }
  body.in-session .q-pad .work-surface { height: calc(100vh - 470px); min-height: 300px; }
  body.in-session .q-pad .ink-bar { padding: 8px 14px; border-top: 1px solid var(--border); }
  body.in-session .q-pad details.ink-diag { padding: 0 14px 10px; }
  body.in-session .q-judge { padding: 20px; align-content: start; gap: 12px; }
  body.in-session .answer-bar { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 14px 20px 14px 28px; }
}
/* the judged lines: a coloured card per line, status circle on the left, the line and its one-sentence verdict on the right */
.q-judge .work-rows { display: grid; gap: 10px; }
.q-judge .work-rows .line { grid-template-columns: 28px minmax(0, 1fr); grid-template-areas: "mark math" "mark why"; column-gap: 12px; row-gap: 3px; align-items: start; padding: 12px; border: 0; border-radius: 16px; background: var(--ok-soft); min-height: 0; }
.q-judge .work-rows .line > :nth-child(1) { display: none; }
.q-judge .work-rows .line > :nth-child(2) { grid-area: math; min-width: 0; }
.q-judge .work-rows .line > :nth-child(3) { grid-area: mark; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); }
.q-judge .work-rows .line > :nth-child(3) svg { width: 14px; height: 14px; color: #fff; stroke: #fff; }
.q-judge .work-rows .line > .why { grid-area: why; font-size: 13px; font-weight: 700; color: var(--ok); }
.q-judge .work-rows .line > div[style*="grid-column"] { grid-column: 2 !important; grid-area: auto; }
.q-judge .work-rows .line.tone-warn { background: var(--warn-soft, #fff6e8); } .q-judge .work-rows .line.tone-warn > :nth-child(3) { background: var(--amber); }
.q-judge .work-rows .line.tone-warn > .why { color: var(--amber); }
.q-judge .work-rows .line.tone-bad { background: var(--bad-soft); } .q-judge .work-rows .line.tone-bad > :nth-child(3) { background: var(--bad); }
.q-judge .work-rows .line.tone-bad > .why { color: var(--bad); }
.q-judge .work-rows .line.tone-none { background: var(--surface-2); } .q-judge .work-rows .line.tone-none > :nth-child(3) { background: var(--border-strong, var(--border)); }

.ink-tools.compact .mode-btn.swatch { width: 26px; height: 26px; min-height: 26px; flex: none; }
.ink-tools.compact [data-part="ink-width"] span { display: none; }
@media (min-width: 1500px) { .ink-tools.compact [data-part="ink-width"] span { display: inline; margin-left: 5px; } }
@media (max-width: 1150px) { .ink-tools.compact { flex-wrap: wrap; } }
body.in-session .main { padding-bottom: 14px; }
body.in-session .session-stage { margin-top: 0; }

/* ---- lecture management: pipeline funnel, tabs, review cards, concept cards ---- */
.lm-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.lm-keys { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lm-key { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
.lm-key i { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.lm-key.ok i { background: var(--ok); } .lm-key.bad { color: var(--bad); } .lm-key.bad i { background: var(--bad); }

.lm-funnel { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; align-items: stretch; gap: 8px; }
.lm-step { display: grid; gap: 2px; align-content: center; text-align: left; padding: 18px 22px; border-radius: 22px; background: var(--surface); border: 1px solid var(--border); font: inherit; color: inherit; }
button.lm-step { cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; }
button.lm-step:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.lm-step .n { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; color: var(--heading); }
.lm-step .l { font-size: 14px; font-weight: 700; } .lm-step .s { font-size: 12px; color: var(--text-3); }
.lm-step.hot { background: var(--navy); border-color: transparent; color: #fff; box-shadow: 0 14px 30px -20px rgba(21, 48, 111, .7); }
.lm-step.hot .n, .lm-step.hot .l { color: #fff; } .lm-step.hot .s { color: #c9d8f8; }
.lm-step.ok .n { color: var(--ok); }
.lm-arrow { display: grid; place-items: center; color: var(--text-3); } .lm-arrow svg { width: 18px; height: 18px; }

.lm-tabs { display: flex; gap: 4px; padding: 5px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); width: fit-content; max-width: 100%; overflow-x: auto; }
.lm-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 20px; border: 0; border-radius: 999px; background: transparent; font: inherit; font-size: 15px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.lm-tab[aria-selected="true"] { background: var(--navy); color: #fff; font-weight: 800; }
.lm-badge { min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--surface-2); color: var(--text-2); font-variant-numeric: tabular-nums; }
.lm-tab[aria-selected="true"] .lm-badge { background: rgba(255, 255, 255, .2); color: #fff; }
.lm-badge.hot { background: var(--bad); color: #fff; }
.lm-pane[hidden] { display: none; }
.lm-toolbar { gap: 10px; align-items: center; flex-wrap: wrap; }
.lm-toolbar input[type=search], .lm-toolbar input[type=number] { min-height: 42px; padding: 0 12px; border: 1.5px solid var(--border-strong); border-radius: 12px; background: var(--surface); font: inherit; }

.lm-list { overflow: hidden; border-radius: 24px; }
.lec { grid-template-columns: 220px minmax(0, 1fr); gap: 22px; padding: 22px 24px; }
.lec .thumb-wrap { position: relative; align-self: start; }
.lec .thumb { width: 220px; border-radius: 14px; }
.lec .dur { position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: 8px; background: rgba(8, 15, 35, .82); color: #fff; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lec .title { font-size: 17px; font-weight: 750; letter-spacing: -0.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lec .lec-sum { color: var(--text-2); line-height: 1.55; }
.lec .conf { gap: 10px; font-weight: 700; } .lec .conf .progress { width: 120px; height: 8px; }
.lec .conf.high { color: var(--ok); } .lec .conf.mid { color: var(--amber); } .lec .conf.low { color: var(--bad); }
.lec .conf.high .progress > i { background: var(--ok); } .lec .conf.mid .progress > i { background: var(--amber); } .lec .conf.low .progress > i { background: var(--bad); }
.lec-actions { gap: 10px; align-items: end; padding-top: 6px; }
.lm-concept-pick { display: grid; gap: 4px; }
.lm-leaving { opacity: .35; transform: scale(.995); transition: opacity .2s, transform .2s; pointer-events: none; }
@media (max-width: 760px) { .lec { grid-template-columns: 1fr; } .lec .thumb { width: 100%; } }

.lm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.lm-concept { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; overflow: hidden; }
.lm-concept-head { display: flex; align-items: center; gap: 14px; padding: 18px 20px; }
.lm-concept-head b { font-size: 16px; }
.lm-split { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--surface-2); margin-top: 8px; }
.lm-split .m { background: var(--ok); } .lm-split .a { background: var(--border-strong); }
.lm-concept .lec { grid-template-columns: 120px minmax(0, 1fr); padding: 14px 18px; gap: 14px; }
.lm-concept .lec .thumb { width: 120px; border-radius: 10px; }
.lm-concept .lec .title { font-size: 14px; } .lm-concept .lec .lec-sum { display: none; }
@media (max-width: 1000px) { .lm-grid { grid-template-columns: minmax(0, 1fr); } }
.lm-danger summary { color: var(--text-2); }
@media (max-width: 800px) {
  .lm-funnel { grid-template-columns: 1fr 1fr; } .lm-arrow { display: none; }
  .lm-step { padding: 14px 16px; } .lm-step .n { font-size: 24px; }
}
.lm-concept .lm-list { border: 0; border-top: 1px solid var(--border); border-radius: 0; box-shadow: none; background: transparent; }
.lm-concept .lm-list .lec:first-child { border-top: 0; }
.lm-addrow { display: grid; grid-template-columns: minmax(0, 1fr) 260px auto; gap: 10px; align-items: center; }
.lm-addrow select { width: 100%; }
@media (max-width: 760px) {
  .lm-addrow { grid-template-columns: minmax(0, 1fr); }
  .lec .thumb { max-height: 170px; object-fit: cover; }
  .lec-actions { flex-wrap: wrap; } .lec-actions .grow { display: none; }
  .lec-actions .lm-concept-pick { flex: 1 1 100%; } .lec-actions .btn { flex: 1; justify-content: center; }
  .lm-toolbar > select, .lm-toolbar > input[type=search] { flex: 1 1 100%; }
  .lm-concept .lec { grid-template-columns: 96px minmax(0, 1fr); } .lm-concept .lec .thumb { width: 96px; max-height: none; }
}

/* ---- real-time difficulty: level dots and the note after an answer ---- */
.lvl { display: inline-flex; gap: 4px; align-items: center; }
.lvl i { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong, var(--border)); }
.lvl i.on { background: var(--primary); }
.adapt-note { align-self: start; padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 700; background: var(--surface-2); color: var(--text-2); }
.adapt-note[data-change="up"] { background: var(--ok-soft); color: var(--ok); }
.adapt-note[data-change="down"] { background: var(--warn-soft); color: var(--amber); }

/* ---- pen bar made of Shoelace components (vendor/shoelace): bring them into the app's look ---- */
:root {
  --sl-font-sans: inherit;
  --sl-border-radius-medium: 12px; --sl-border-radius-large: 18px; --sl-border-radius-pill: 999px;
  --sl-input-height-medium: 40px; --sl-input-height-large: 48px;
  --sl-color-primary-600: var(--navy); --sl-color-primary-500: var(--navy);
  --sl-focus-ring-color: var(--primary); --sl-focus-ring-width: 3px;
}
sl-button:not(:defined), sl-button-group:not(:defined), sl-dropdown:not(:defined), sl-color-picker:not(:defined), sl-range:not(:defined) { visibility: hidden; }
.pen-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pen-bar sl-button::part(base) { font-weight: 700; letter-spacing: -0.01em; }
.pen-bar sl-button[variant="text"]::part(base) { color: var(--text-2); }
.pen-bar sl-button[variant="text"]::part(base):hover { background: var(--surface-2); color: var(--text); }
.pen-bar .lbl-always { margin-left: 2px; }
.pen-bar sl-button svg { width: 18px; height: 18px; }
.pen-dot { width: 28px; height: 28px; min-height: 28px; padding: 0; flex: none; border-radius: 50%; border: 3px solid var(--surface); background: var(--swatch); box-shadow: 0 0 0 1.5px var(--border-strong, var(--border)); cursor: pointer; transition: box-shadow .12s, transform .12s; }
.pen-dot:hover { transform: scale(1.06); }
.pen-dot[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--primary); }
.pen-dot.pen-more { background: conic-gradient(#ef4444, #f59e0b, #84cc16, #06b6d4, #6366f1, #d946ef, #ef4444); }
.pen-panel { display: grid; gap: 10px; padding: 16px; background: var(--sl-panel-background-color, var(--surface)); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 18px 40px -18px rgba(10, 20, 50, .35); }
.pen-panel-title { font-weight: 800; font-size: 14px; }
.pen-panel-width { width: 250px; }
.pen-preview-box { height: 34px; display: grid; align-items: center; padding: 0 6px; background: var(--surface-2); border-radius: 12px; }
.pen-preview { display: block; width: 100%; border-radius: 999px; background: var(--text); }
.pen-size-dot { display: inline-block; border-radius: 50%; background: var(--text); }
sl-range { --track-color-active: var(--primary); --thumb-size: 22px; }
sl-color-picker { --grid-width: 250px; }
.pen-bar.compact .lbl-always { display: none; }
@media (min-width: 1500px) { .pen-bar.compact .lbl-always { display: inline; } }

/* ---- today's order as phases of blocks ---- */
.order-why { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; padding: 10px 14px; border-radius: 14px; background: var(--primary-soft); color: var(--text-2); }
.order-why svg { width: 16px; height: 16px; flex: none; color: var(--primary); }
.order-groups { display: grid; gap: 14px; }
.phase-head { display: flex; align-items: center; gap: 10px; padding: 4px 2px 6px; }
.phase-head .ph-ic { width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--navy); }
.phase-head .ph-ic svg { width: 15px; height: 15px; }
.phase-head b { font-size: 14px; letter-spacing: -0.01em; }
.phase-group[data-phase="urgent"] .ph-ic { background: var(--bad-soft); color: var(--bad); }
.phase-group[data-phase="english"] .ph-ic { background: var(--eng-soft); color: var(--eng); }
.phase-group[data-phase="review"] .ph-ic { background: var(--surface-2); color: var(--text-2); }
.order-row .sub { margin-top: 2px; }

/* ---- session bar: phases in one row, the steps of the current block, what is next, the whole order in a pop-over ---- */
.session-bar { align-items: center; gap: 16px; padding-top: 4px; }
.session-mid { flex: 1; min-width: 0; display: grid; gap: 8px; justify-items: center; }
.session-phases { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; }
.session-phases .phase { display: inline-flex; align-items: center; gap: 7px; padding: 5px 13px 5px 6px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--text-3); background: transparent; }
.session-phases .phase + .phase::before { content: ""; width: 14px; height: 2px; margin-right: 4px; border-radius: 2px; background: var(--border-strong); }
.session-phases .si { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.session-phases .si svg { width: 13px; height: 13px; }
.session-phases .pc { font-weight: 600; font-variant-numeric: tabular-nums; opacity: .7; }
.session-phases .phase.done { color: var(--ok); } .session-phases .phase.done .si { background: var(--ok-soft); color: var(--ok); }
.session-phases .phase.now { background: var(--primary-soft); color: var(--navy); } .session-phases .phase.now .si { background: var(--navy); color: #fff; }
.session-line { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; min-width: 0; }
.session-line .session-steps { flex: 0 1 auto; }
.session-next { white-space: nowrap; }
.session-right { display: flex; align-items: center; gap: 12px; flex: none; }
.session-progress { --height: 6px; --indicator-color: var(--primary); --track-color: var(--surface-2); margin: 2px 0 4px; }
.order-panel { width: 340px; max-height: 70vh; overflow: auto; }
.op-group { display: grid; gap: 4px; }
.op-head { display: flex; align-items: center; gap: 8px; padding: 6px 0 2px; } .op-head svg { width: 15px; height: 15px; color: var(--primary); } .op-head .muted { margin-left: auto; }
.op-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 12px; font-size: 14px; }
.op-row.now { background: var(--primary-soft); font-weight: 700; } .op-row.done { color: var(--text-3); text-decoration: line-through; }
.op-mark { width: 18px; height: 18px; display: grid; place-items: center; color: var(--ok); flex: none; } .op-row.now .op-mark { color: var(--navy); } .op-mark svg { width: 15px; height: 15px; }
@media (max-width: 760px) { .session-bar { flex-wrap: wrap; } .session-mid { order: 3; flex: 1 1 100%; } .session-phases .pl { display: none; } .session-phases .phase.now .pl { display: inline; } }
.session-bar { position: relative; z-index: 30; }
.lec-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag.lec-subj { font-weight: 800; }
.tag.lec-subj.eng { background: var(--eng-soft); color: var(--eng); } .tag.lec-subj.math { background: var(--math-soft); color: var(--math); }

/* ---- plan screen by phases; "if there is time" folded ---- */
.plan-why { margin: 0 0 8px; }
.plan-phase { display: grid; gap: 2px; margin-bottom: 10px; }
.plan-phase-head { display: flex; align-items: center; gap: 8px; padding: 2px 0; list-style: none; cursor: default; }
.plan-phase-head .ph-ic { width: 22px; height: 22px; border-radius: 8px; display: grid; place-items: center; background: var(--primary-soft); color: var(--navy); } .plan-phase-head .ph-ic svg { width: 13px; height: 13px; }
.plan-phase[data-phase="english"] .ph-ic { background: var(--eng-soft); color: var(--eng); } .plan-phase[data-phase="urgent"] .ph-ic { background: var(--bad-soft); color: var(--bad); }
.plan-phase.extra { opacity: .85; } .plan-phase.extra summary { cursor: pointer; }
.plan-steps { margin-left: auto; margin-right: 10px; white-space: nowrap; }
details.phase-group.extra > summary { cursor: pointer; list-style: none; } details.phase-group.extra > summary::-webkit-details-marker { display: none; }
details.phase-group.extra { margin-top: 6px; }
