/* ECLA Languages · platform styles
   Palette: ECLA blue, dark blue, textured grey, white, mustard (highlight only). */
:root {
  --blue: #2F5C8A; --blue-d: #1E3F63; --bg: #EDEBE7; --white: #FFFFFF; --mustard: #E8A33D;
  --ink: #1b2430; --muted: #5d6673; --line: #d9d5ce; --soft: #f6f4f1; --soft-blue: #e7eef5;
  --ok: #2f7d4f; --ok-bg: #e5f2ea; --bad: #b3372f; --bad-bg: #fbe9e7; --wait: #8a5a10; --wait-bg: #fbf0dc;
  --r: 12px; --font: "Lexend", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.55 var(--font); }
h1, h2, h3, h4 { color: var(--blue-d); line-height: 1.2; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: 1.8rem; font-weight: 700; } h2 { font-size: 1.25rem; font-weight: 600; } h3 { font-size: 1.08rem; font-weight: 600; }
p { margin: 0 0 .7em; }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--mustard); outline-offset: 2px; border-radius: 6px; }
.small { font-size: .85rem; } .muted { color: var(--muted); } .grow { flex: 1; min-width: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 0; border-radius: 10px; padding: .6rem 1.1rem;
  background: var(--blue); color: #fff; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--blue-d); }
.btn.ghost { background: var(--soft-blue); color: var(--blue-d); } .btn.ghost:hover { background: #d8e4ef; }
.btn.danger { background: var(--bad); } .btn.big { padding: .8rem 1.5rem; font-size: 1.05rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--blue); text-decoration: underline; cursor: pointer; font-size: .92rem; }
.link.danger { color: var(--bad); }
.inp { width: 100%; border: 1.5px solid #b9c3cf; background: #fff; border-radius: 9px; padding: .55rem .7rem; min-height: 44px; }
.inp:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(47, 92, 138, .18); }
.inp:disabled { background: var(--soft); color: var(--ink); opacity: 1; }
textarea.inp { resize: vertical; line-height: 1.6; }
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 500; font-size: .95rem; }
label.inline { flex-direction: row; align-items: center; gap: .5rem; } label.inline .inp { width: auto; }
label.chk { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; cursor: pointer; }
label.chk input { width: 20px; height: 20px; accent-color: var(--blue); }
.pw { display: flex; gap: .5rem; align-items: center; }
.err { background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: .55rem .8rem; font-size: .95rem; }
.row { display: flex; gap: .75rem; align-items: center; } .row.wrap { flex-wrap: wrap; } .row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; } .row.center { justify-content: center; margin: 1.5rem 0; }

/* logo */
.logo { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; }
.logo-mark { width: 42px; height: 42px; border-radius: 50%; background: #fff; color: var(--blue); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .72rem; letter-spacing: -.03em; white-space: nowrap; box-shadow: inset 0 0 0 2.5px var(--blue); flex: none; }
.logo-mark b { color: var(--mustard); }
.logo-txt { display: flex; flex-direction: column; line-height: 1.1; }
.logo-name { font-weight: 700; color: var(--blue-d); } .logo-name span { font-weight: 400; }
.logo-tag { font-size: .7rem; color: var(--muted); font-style: italic; }

/* top bar */
.demo-bar { background: var(--mustard); color: var(--blue-d); text-align: center; font-size: .85rem; padding: .3rem 16px; font-weight: 500; }
.demo-bar .link { color: var(--blue-d); font-size: .85rem; }
.top { background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 1.5rem; padding: .6rem clamp(16px, 3vw, 2rem); flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.brand { text-decoration: none; }
.nav { display: flex; gap: .2rem; flex-wrap: wrap; flex: 1; }
.nav a { text-decoration: none; color: var(--ink); padding: .45rem .8rem; border-radius: 8px; font-weight: 500; font-size: .95rem; }
.nav a:hover { background: var(--soft); }
.nav a[aria-current="page"] { background: var(--soft-blue); color: var(--blue-d); }
.who { display: flex; gap: .9rem; align-items: center; font-size: .9rem; color: var(--muted); }
.main { max-width: 1100px; margin: 0 auto; padding: 1.6rem clamp(16px, 3vw, 2rem) 4rem; }

/* cards & lists */
.card { background: #fff; border-radius: var(--r); padding: 1.2rem 1.3rem; margin-bottom: 1rem; box-shadow: 0 1px 2px rgba(30, 63, 99, .06); }
.card.narrow { max-width: 460px; display: flex; flex-direction: column; gap: .9rem; }
details.card summary { cursor: pointer; color: var(--blue); }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; } .grid2 > * { min-width: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem 1.2rem; margin-top: 1rem; } .form-grid .full { grid-column: 1 / -1; }
.tbl { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.list th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: .5rem .6rem; border-bottom: 2px solid var(--line); }
table.list td { padding: .6rem; border-bottom: 1px solid #eee9e2; vertical-align: middle; }
td.acts { white-space: nowrap; } td.acts > * { margin-right: .8rem; }
.search { max-width: 260px; }
.pill { display: inline-block; font-size: .78rem; font-weight: 600; border-radius: 999px; padding: .2rem .65rem; white-space: nowrap; }
.pill.done { background: var(--ok-bg); color: var(--ok); } .pill.wait { background: var(--wait-bg); color: var(--wait); }
.pill.go { background: var(--soft-blue); color: var(--blue-d); } .pill.new { background: var(--blue); color: #fff; } .pill.lock { background: #ebe8e3; color: var(--muted); }
.empty { background: #fff; border-radius: var(--r); padding: 2.5rem 1.5rem; text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin: .5rem 0; }
.chip { display: inline-flex; align-items: center; gap: .3rem; border: 1.5px solid #b9c3cf; background: #fff; border-radius: 8px; padding: .35rem .75rem; font-size: .98rem; cursor: pointer; min-height: 40px; }
.chip:hover:not(:disabled) { border-color: var(--blue); }
.chip.on { background: var(--soft-blue); border-color: var(--blue); color: var(--blue-d); }
.chip .x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; padding: 0 .1rem; }
.qtag { color: var(--wait); }

/* home */
.hello { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.4rem; }
.hello p { margin: 0; color: var(--muted); }
.stats { display: flex; gap: .6rem; flex-wrap: wrap; }
.stats > div { background: #fff; border-radius: var(--r); padding: .6rem 1rem; text-align: center; min-width: 96px; }
.stats b { display: block; font-size: 1.6rem; color: var(--blue-d); font-variant-numeric: tabular-nums; }
.stats span { font-size: .78rem; color: var(--muted); }
.stats.wide { margin-bottom: 1rem; }
.book { background: #fff; border-radius: var(--r); padding: 1.3rem; margin-bottom: 1.2rem; }
.book-h { border-bottom: 2px solid var(--blue); padding-bottom: .6rem; margin-bottom: .6rem; }
.ltag { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--blue); font-weight: 600; }
.unit h3 { margin: 1rem 0 .3rem; font-size: .95rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.lrow { display: flex; align-items: center; gap: .9rem; padding: .75rem .3rem; border-top: 1px solid #eee9e2; flex-wrap: wrap; }
.lrow.locked { color: var(--muted); } .lrow.locked b { color: var(--muted); }
.lnum { width: 34px; height: 34px; border-radius: 50%; background: var(--soft-blue); color: var(--blue-d); display: grid; place-items: center; font-weight: 700; flex: none; }
.lrow.locked .lnum { background: #ebe8e3; color: var(--muted); }
.lockic { font-size: 1.2rem; }

/* login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-side { background: var(--blue); color: #fff; padding: 2.5rem clamp(16px, 4vw, 3.5rem); display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; }
.login-side .logo-name, .login-side .logo-tag { color: #fff; }
.login-side h1 { color: #fff; font-size: clamp(2rem, 4vw, 3rem); max-width: 14ch; }
.login-side p { color: #dbe6f0; max-width: 40ch; font-size: 1.05rem; }
.login-side h1::after { content: ""; display: block; width: 64px; height: 6px; background: var(--mustard); border-radius: 3px; margin-top: 1rem; }
.login-main { display: grid; place-items: center; padding: 2rem 16px; }
.login-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 1rem; padding: 2rem; }
.demo-acc { background: var(--soft); border-radius: 8px; padding: .6rem .8rem; font-size: .9rem; }

/* lesson page = book page */
.lesson-wrap { max-width: 860px; margin: 0 auto; }
.lbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; padding: .4rem 0; }
.page { background: #fff; border-radius: 6px; padding: clamp(1.2rem, 4vw, 2.6rem); box-shadow: 0 2px 10px rgba(30, 63, 99, .08); border-top: 6px solid var(--blue); }
.lhead { border-bottom: 1px solid var(--line); padding-bottom: 1rem; margin-bottom: 1rem; }
.lhead h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); margin: .2rem 0; }
.lsub { color: var(--muted); font-size: 1.05rem; }
.goals { background: var(--soft-blue); border-radius: 10px; padding: .9rem 1.1rem; margin-bottom: 1.5rem; }
.goals-h { font-weight: 600; color: var(--blue-d); } .goals ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.lsec { margin-top: 2.2rem; }
.sec { display: flex; align-items: center; gap: .7rem; font-size: 1.35rem; border-bottom: 2px solid var(--blue); padding-bottom: .4rem; flex-wrap: wrap; }
.sn { background: var(--blue); color: #fff; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-size: 1.05rem; }
.ss { font-size: .9rem; font-weight: 400; color: var(--muted); }
.instr { font-weight: 500; margin: .9rem 0 .6rem; }
.subh { margin: 1.4rem 0 .6rem; font-size: 1.05rem; }
.tip, .hint { background: var(--soft); border-left: 4px solid var(--mustard); padding: .6rem .9rem; border-radius: 0 8px 8px 0; margin: .8rem 0; font-size: .95rem; }
.bank { display: flex; flex-wrap: wrap; justify-content: center; gap: .2rem 0; border: 1.5px dashed var(--blue); border-radius: 10px; padding: .6rem 1rem; text-align: center; color: var(--blue-d); font-weight: 500; margin: .5rem 0 1rem; }
.bank .dot { margin: 0 .55rem; color: var(--mustard); font-weight: 700; }
.num { min-width: 28px; height: 28px; border-radius: 50%; background: var(--soft-blue); color: var(--blue-d); display: inline-grid; place-items: center; font-weight: 600; font-size: .85rem; flex: none; padding: 0 .3rem; }
.qp { display: flex; gap: .6rem; align-items: flex-start; margin-bottom: .45rem; }
.ex-tag { background: var(--mustard); color: var(--blue-d); font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: .15rem .5rem; border-radius: 5px; }
.ex-ans { background: var(--soft); border-radius: 8px; padding: .5rem .8rem; font-weight: 500; color: var(--blue-d); }
.qrow.ex { margin-bottom: .9rem; }

.q { border-radius: 10px; }
.pgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.pcard { background: var(--soft); padding: .7rem; text-align: center; display: flex; flex-direction: column; gap: .5rem; }
.pimg { font-size: 2.6rem; line-height: 1.2; }
.cilist, .clist, .match, .glist, .oplist, .olist { display: flex; flex-direction: column; gap: .7rem; }
.cirow { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; padding: .35rem .4rem; }
.ciimg { font-size: 1.6rem; } .ciafter { font-weight: 500; }
.seg, .opts { display: inline-flex; gap: .35rem; flex-wrap: wrap; }
.seg button, .opts button { border: 1.5px solid #b9c3cf; background: #fff; border-radius: 8px; padding: .4rem .9rem; min-height: 40px; cursor: pointer; }
.seg button[aria-checked="true"], .opts button[aria-checked="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
.seg button:disabled, .opts button:disabled { cursor: default; }
.crow { padding: .3rem .4rem; } .crow .opts { margin-left: 2.3rem; }
.mrow { display: grid; grid-template-columns: auto 9rem 1fr; gap: .7rem; align-items: center; padding: .3rem .4rem; }
.mrow .fb { grid-column: 1 / -1; }
.mw { font-weight: 600; color: var(--blue-d); }
.gaprow .inp { max-width: 340px; margin-left: 2.3rem; } .ghint { color: var(--muted); letter-spacing: .08em; font-size: .9rem; }
.oprow .qp { margin-bottom: .4rem; } .wc { text-align: right; font-size: .8rem; color: var(--muted); }
.orow { background: var(--soft); padding: .8rem 1rem; }
.ohead { display: flex; gap: .6rem; align-items: center; } .kind { font-weight: 600; color: var(--blue-d); }
.ostruct { font-size: .9rem; color: var(--muted); margin: .35rem 0; } .ostruct b { color: var(--blue); }
.built { min-height: 52px; border: 2px dashed #b9c3cf; border-radius: 10px; background: #fff; padding: .4rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.built .ph { color: var(--muted); font-size: .9rem; padding-left: .4rem; }
.clear { border: 0; background: none; color: var(--bad); text-decoration: underline; cursor: pointer; font-size: .85rem; }
.rules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; margin: .8rem 0; }
.rules > div { background: var(--soft-blue); border-radius: 10px; padding: .8rem; font-size: .95rem; }
.rh { font-weight: 700; color: var(--blue); font-size: 1.1rem; } .rx { margin-top: .4rem; font-style: italic; color: var(--blue-d); }
.gram { border: 1.5px solid var(--blue); border-radius: 10px; margin: 1rem 0; overflow: hidden; }
.gt { background: var(--blue); color: #fff; font-weight: 700; padding: .5rem .9rem; } .gt span { font-weight: 400; opacity: .9; }
.gram table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.gram th { text-align: left; padding: .55rem .8rem; width: 8rem; color: var(--blue-d); background: var(--soft); }
.gram td { padding: .55rem .8rem; border-top: 1px solid var(--line); } .gram td.struct { font-weight: 600; color: var(--blue); }
.gf { font-size: .88rem; padding: .5rem .9rem; background: var(--soft); border-top: 1px solid var(--line); }
table.atable { border-collapse: collapse; min-width: 320px; } .atable th, .atable td { border: 1px solid var(--line); padding: .45rem .7rem; text-align: left; }
.atable th { background: var(--blue); color: #fff; } .atable td:first-child { font-weight: 600; }
.vhead { font-weight: 700; color: var(--blue-d); letter-spacing: .08em; text-transform: uppercase; font-size: .9rem; margin: 1rem 0 .5rem; }
.vgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.vcard { display: flex; gap: .8rem; align-items: flex-start; background: var(--soft); border-radius: 10px; padding: .7rem; }
.vimg { font-size: 2rem; line-height: 1; width: 2.6rem; text-align: center; flex: none; }
.vw { font-weight: 700; color: var(--blue-d); } .vm { font-size: .92rem; } .vex { font-size: .88rem; color: var(--muted); font-style: italic; }
.talk, .useful { border: 1.5px solid var(--blue); border-radius: 10px; padding: .8rem 1rem; margin: 1rem 0; }
.talk-h { font-weight: 700; color: var(--blue); margin-bottom: .3rem; } .talk ol { margin: 0; padding-left: 1.3rem; } .talk li { margin: .2rem 0; }
.ugrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; font-size: .9rem; } .ugrid b { display: block; color: var(--blue-d); }
.check { padding-left: 1.2rem; } .check li { margin: .25rem 0; }
.story { background: var(--soft); border-radius: 10px; padding: 1.1rem 1.3rem; line-height: 1.75; }
.story h4 { font-size: 1.2rem; } .story-img { font-size: 2rem; float: right; }
.story mark { background: #fbe6c2; color: inherit; padding: 0 .15em; border-radius: 3px; }

/* correction */
.st-right { box-shadow: inset 4px 0 0 var(--ok); } .st-wrong { box-shadow: inset 4px 0 0 var(--bad); }
.st-pending, .st-blank { box-shadow: inset 4px 0 0 var(--mustard); }
.q[class*="st-"] { padding-left: .8rem; }
.fb { font-size: .92rem; border-radius: 8px; padding: .45rem .7rem; margin-top: .4rem; text-align: left; }
.fb.ok { background: var(--ok-bg); color: var(--ok); } .fb.ok span { color: var(--ink); }
.fb.no { background: var(--bad-bg); color: var(--ink); } .fb.no > b { color: var(--bad); }
.fb.wait { background: var(--wait-bg); color: var(--ink); }
.fb.note { background: var(--soft-blue); color: var(--ink); } .fb.note > b { color: var(--blue-d); }
.fb .why { margin-top: .2rem; }
.tmark { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; background: #fff8ea; border: 1px dashed var(--mustard); border-radius: 8px; padding: .45rem .6rem; margin-top: .4rem; }
.tmark label { flex-direction: row; align-items: center; font-size: .88rem; white-space: nowrap; }
.tmark input[type=number] { width: 4.5rem; min-height: 36px; padding: .3rem .4rem; border: 1.5px solid #b9c3cf; border-radius: 6px; }
.tmark input[type=text] { flex: 1 1 12rem; min-width: 0; width: 100%; min-height: 36px; border: 1.5px solid #b9c3cf; border-radius: 6px; padding: .3rem .5rem; }
.summary { display: flex; gap: 1.2rem; align-items: center; background: #fff; border-radius: var(--r); padding: 1rem 1.3rem; margin-bottom: 1rem; border-left: 6px solid var(--mustard); }
.summary.done { border-left-color: var(--ok); } .summary.teacher { border-left-color: var(--blue); }
.summary p { margin: .2rem 0 0; }
.big-score { font-size: 2.6rem; font-weight: 700; color: var(--blue-d); font-variant-numeric: tabular-nums; line-height: 1; white-space: nowrap; }
.big-score small { font-size: 1rem; color: var(--muted); }
.tcom { font-style: italic; color: var(--blue-d); }
.sendbox { display: flex; gap: 1rem; align-items: center; justify-content: space-between; background: #fff; border-radius: var(--r); padding: 1.1rem 1.3rem; margin-top: 1rem; flex-wrap: wrap; }
.sendbox.col { flex-direction: column; align-items: stretch; }
.sendbox p { margin: 0; }
.rev { border-top: 1px solid #eee9e2; padding: .7rem 0; } .rev .you { color: var(--bad); } .rev .right { color: var(--ok); } .rev .why { font-size: .9rem; }
.note.doubt { border-left: 5px solid var(--mustard); } .nbody { white-space: pre-wrap; margin: .5rem 0; }
fieldset.bookpick { border: 1px solid var(--line); border-radius: 10px; margin: 1rem 0; padding: .6rem 1rem; }
fieldset.bookpick legend { font-weight: 600; color: var(--blue-d); padding: 0 .3rem; }
.unitpick { padding: .4rem 0; border-top: 1px solid #eee9e2; } .chk.ind { padding-left: 1.8rem; }

/* modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(20, 35, 55, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 14px; padding: 1.5rem; max-width: 440px; width: 100%; box-shadow: 0 10px 40px rgba(0, 0, 0, .2); }
#toast { position: fixed; bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); background: var(--blue-d); color: #fff;
  padding: .7rem 1.2rem; border-radius: 10px; z-index: 60; font-weight: 500; max-width: calc(100% - 32px); }
#toast.bad { background: var(--bad); } #toast.ok { background: var(--ok); }

@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; } .login-side { padding-block: 1.6rem; } .login-side h1 { margin-top: .5rem; }
  .grid2, .form-grid { grid-template-columns: 1fr; }
  .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vgrid, .rules, .ugrid { grid-template-columns: 1fr; }
  .mrow { grid-template-columns: auto 1fr; } .mrow select { grid-column: 1 / -1; }
  .who span { display: none; }
    .top { position: static; gap: .6rem; } .nav { order: 3; width: 100%; }
  .crow .opts, .gaprow .inp { margin-left: 0; }
  .lrow .btn { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .top, .demo-bar, .lbar, .sendbox { display: none; } body { background: #fff; } .page { box-shadow: none; } }
