/* Clevix Ed class page (learn.html): board + class pickers, chapter rows of activity tiles, filters, level check. */
.eyebrow { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.muted { color: var(--ink-2); } .small { font-size: 13px; }

/* subject colours (curriculum subject ids) */
.sub-maths { --sc: var(--c5); } .sub-science { --sc: var(--c3); } .sub-evs { --sc: var(--c6); } .sub-english { --sc: var(--c4); }
.sub-sst, .sub-history { --sc: var(--c2); } .sub-geography { --sc: var(--c6); } .sub-civics { --sc: var(--c1); } .sub-economics { --sc: var(--c3); }
.sub-physics { --sc: var(--c1); } .sub-chemistry { --sc: var(--c2); } .sub-biology { --sc: var(--c3); } .sub-computer, .sub-math { --sc: var(--c5); } .sub-earth { --sc: var(--c6); }
.learn-main { --sc: var(--accent); }

/* ---------- head ---------- */
.learn-head { position: relative; isolation: isolate; overflow: hidden; padding: 30px 0 18px; border-bottom: 1px solid var(--line);
  background: radial-gradient(1200px 300px at 85% -10%, color-mix(in srgb, var(--c5) 16%, transparent), transparent 60%),
              radial-gradient(900px 260px at 0% 0%, color-mix(in srgb, var(--c6) 14%, transparent), transparent 60%), var(--bg); }
.lh-top { display: flex; gap: 24px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.learn-head h1 { margin: 4px 0 4px; font-size: clamp(34px, 5vw, 52px); letter-spacing: -.035em; animation: lh-in .5s var(--ease) both; }
.lh-sub { margin: 0; color: var(--ink-2); max-width: 560px; }
@keyframes lh-in { from { opacity: 0; transform: translateY(8px); } }

.me-card { display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 12px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.me-ring { position: relative; width: 64px; height: 64px; flex: none; }
.me-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; }
.ring { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }
.ring .trk { stroke: var(--surface-2); }
.ring .val { stroke: var(--c5); stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease); }
.me-txt { display: grid; gap: 1px; font-size: 13px; color: var(--ink-2); min-width: 0; }
.me-txt b { color: var(--ink); font-size: 15px; }
.me-mini { white-space: nowrap; }

.board-seg { display: inline-flex; gap: 4px; padding: 4px; margin-top: 20px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.board-seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--ink-2); cursor: pointer; white-space: nowrap; transition: background .2s, color .2s, box-shadow .2s; }
.board-seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 4px 12px rgba(20,24,60,.08); }

.class-rail { display: flex; gap: 8px; margin-top: 14px; overflow-x: auto; padding: 4px 2px 8px; scroll-snap-type: x proximity; scrollbar-width: none; }
.class-rail::-webkit-scrollbar, .board-seg::-webkit-scrollbar { display: none; }
.class-rail button { flex: none; scroll-snap-align: center; width: 66px; height: 66px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  display: grid; place-content: center; line-height: 1.05; transition: transform .2s var(--ease), background .2s, border-color .2s, box-shadow .2s; }
.class-rail button small { font-size: 11px; color: var(--ink-2); font-weight: 500; }
.class-rail button b { font-size: 24px; }
.class-rail button:hover { transform: translateY(-2px); border-color: var(--accent); }
.class-rail button.on { background: linear-gradient(135deg, var(--c1), var(--c5)); border-color: transparent; color: #fff; box-shadow: 0 10px 24px color-mix(in srgb, var(--c5) 35%, transparent); transform: translateY(-2px); }
.class-rail button.on small { color: rgba(255,255,255,.85); }

/* ---------- layout ---------- */
.learn { grid-template-columns: 250px minmax(0, 1fr); padding-top: 22px; }
.learn-main { min-width: 0; }
.subj-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.subj-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; min-width: 0; }
.subj-chips::-webkit-scrollbar { display: none; }
.schip { --sc: var(--accent); flex: none; padding: 7px 14px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--sc) 35%, var(--line)); background: var(--surface);
  color: color-mix(in srgb, var(--sc) 85%, var(--ink)); font-weight: 600; font-size: 13.5px; cursor: pointer; transition: background .15s, color .15s, transform .15s; }
.schip:hover { transform: translateY(-1px); }
.schip.on { background: var(--sc); border-color: var(--sc); color: #fff; }
.schip.all.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.code-promo { display: grid; gap: 4px; margin-top: 16px; padding: 16px; border-radius: 18px; text-decoration: none; color: #fff;
  background: linear-gradient(135deg, #1b1f4b, #3a2a7a 60%, #0e7490); box-shadow: var(--shadow); transition: transform .2s var(--ease); }
.code-promo:hover { transform: translateY(-2px); }
.code-promo span { font-size: 13px; opacity: .85; }
.code-promo i { font-style: normal; font-size: 20px; letter-spacing: 4px; margin-top: 4px; }

/* ---------- subject / chapter rows ---------- */
.row-title { font-size: 18px; margin: 6px 0 10px; }
.recent { margin-bottom: 18px; }
#subjects { transition: opacity .2s; } #subjects.dim { opacity: .4; }
.subj { margin: 8px 0 26px; animation: lh-in .45s var(--ease) both; }
.ch-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.sbadge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 8px; background: var(--sc, var(--accent)); color: #fff; font-weight: 600; font-size: 14px; white-space: nowrap; }
.ch-name { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 4px 2px; font-size: 17px; font-weight: 600; color: color-mix(in srgb, var(--sc) 80%, var(--ink)); cursor: pointer; text-align: left; min-width: 0; }
.ch-name:hover span:first-child { text-decoration: underline; text-underline-offset: 3px; }
.ch-name .tick { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--good); color: #fff; font-size: 12px; flex: none; }
.ch-name .chev { font-size: 12px; opacity: .7; flex: none; }
.ch-meta { font-size: 13px; color: var(--ink-2); }
.lv-chip { margin-left: auto; border: 1px dashed color-mix(in srgb, var(--sc) 50%, var(--line)); background: transparent; color: var(--ink-2); border-radius: 999px; padding: 4px 12px; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.lv-chip.set { border-style: solid; background: color-mix(in srgb, var(--sc) 12%, transparent); color: color-mix(in srgb, var(--sc) 85%, var(--ink)); }

.row-wrap { position: relative; }
.row { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 12px; scroll-snap-type: x proximity; scrollbar-width: thin; overscroll-behavior-x: contain; }
.row.slide-l .tile { animation-name: tile-in-l; } .row.slide-r .tile { animation-name: tile-in-r; }
.row-arrow { position: absolute; top: calc(50% - 26px); width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
  font-size: 22px; line-height: 1; cursor: pointer; display: grid; place-items: center; opacity: 0; transition: opacity .2s; color: var(--ink); }
.row-arrow.l { left: -14px; } .row-arrow.r { right: -14px; }
.row-wrap:hover .row-arrow { opacity: 1; }

.tile { position: relative; flex: none; width: 172px; height: 172px; border-radius: 18px; overflow: hidden; scroll-snap-align: start; text-decoration: none; color: #fff;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(20,24,60,.06);
  animation: tile-in .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); transition: transform .2s var(--ease), box-shadow .2s; }
a.tile:hover { transform: translateY(-4px) scale(1.02); box-shadow: 0 16px 30px rgba(20,24,60,.18); }
a.tile:active { transform: scale(.97); }
@keyframes tile-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes tile-in-l { from { opacity: 0; transform: translateX(40px); } }
@keyframes tile-in-r { from { opacity: 0; transform: translateX(-40px); } }
.tile .art { position: absolute; inset: 0; display: grid; place-items: center; }
.tile .art.lab { background: var(--stage); padding: 10px 8px 46px; }
.tile .art.lab svg { width: 100%; height: 100%; }
.tile .art.game { background: radial-gradient(circle at 30% 20%, color-mix(in srgb, #fff 30%, var(--sc)), var(--sc) 55%, color-mix(in srgb, #000 30%, var(--sc))); }
.tile .art.code { background: linear-gradient(145deg, #12162e, #2a2160 60%, color-mix(in srgb, var(--c5) 70%, #000)); }
.tile .art code { position: absolute; right: 10px; top: 34px; font-size: 13px; color: #9fe7ff; opacity: .7; }
.tile .emo { font-size: 64px; margin-top: -30px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.25)); transition: transform .3s var(--ease); }
a.tile:hover .emo { transform: scale(1.12) rotate(-6deg); }
.tile .ttl { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 10px 10px; font-weight: 600; font-size: 14.5px; line-height: 1.2; text-align: center;
  background: linear-gradient(180deg, transparent, rgba(8,10,28,.62) 40%, rgba(8,10,28,.86)); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile .kind { position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: rgba(8,10,28,.55); color: #fff; backdrop-filter: blur(4px); max-width: calc(100% - 60px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.k-lab .kind { background: color-mix(in srgb, var(--sc) 85%, #000); }
.tile .lvl { position: absolute; right: 9px; top: 10px; }
.lvl { display: inline-flex; gap: 2px; align-items: flex-end; }
.lvl i { width: 4px; border-radius: 2px; background: rgba(255,255,255,.35); }
.lvl i:nth-child(1) { height: 6px; } .lvl i:nth-child(2) { height: 10px; } .lvl i:nth-child(3) { height: 14px; }
.lvl.l1 i:nth-child(1), .lvl.l2 i:nth-child(-n+2), .lvl.l3 i { background: #ffd34d; }
.tile.k-lab .lvl i { background: color-mix(in srgb, var(--ink) 18%, transparent); }
.tile.k-lab .lvl.l1 i:nth-child(1), .tile.k-lab .lvl.l2 i:nth-child(-n+2), .tile.k-lab .lvl.l3 i { background: var(--c2); }
.tile .stars { position: absolute; right: 8px; top: 30px; font-size: 13px; color: #ffd34d; letter-spacing: 1px; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.tile .foryou { position: absolute; left: 8px; top: 32px; padding: 1px 7px; border-radius: 6px; background: #ffd34d; color: #3a2a00; font-size: 10.5px; font-weight: 700; }
.tile.challenge { margin-right: 8px; box-shadow: 10px 0 0 -6px color-mix(in srgb, var(--sc) 30%, transparent); }
.tile.challenge .art { background: radial-gradient(circle at 50% 30%, #ffe27a, #f5a623 45%, color-mix(in srgb, var(--sc) 70%, #3a1d00)); }
.tile.challenge .ttl { background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--sc) 70%, #000) 45%); }
.tile.challenge .kind { background: rgba(60, 30, 0, .55); }
a.tile.challenge:hover .emo { transform: scale(1.15) rotate(8deg); }
.tile.none, .tile.nav-tile { display: flex; flex-direction: column; justify-content: center; color: var(--ink); animation-delay: 0ms; }
.tile.none { padding: 16px; gap: 6px; border-style: dashed; background: transparent; } .tile.none span { font-size: 13px; color: var(--ink-2); }
.tile.nav-tile { border: 1.5px solid color-mix(in srgb, var(--sc) 55%, var(--line)); background: var(--surface); padding: 6px 12px; }
.nav-tile button { flex: 1; border: 0; background: transparent; font-size: 14.5px; font-weight: 500; color: color-mix(in srgb, var(--sc) 85%, var(--ink)); cursor: pointer; border-bottom: 1px solid var(--line); border-radius: 0; }
.nav-tile button:last-child { border-bottom: 0; }
.nav-tile button:hover:not(:disabled) { background: color-mix(in srgb, var(--sc) 8%, transparent); }
.nav-tile button:disabled { color: var(--ink-2); opacity: .55; cursor: default; }

.loading { display: flex; gap: 8px; justify-content: center; padding: 30px; }
.loading[hidden] { display: none; }
.loading span { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: dot 1s infinite ease-in-out; }
.loading span:nth-child(2) { animation-delay: .15s; } .loading span:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 50% { transform: translateY(-8px); opacity: .5; } }

/* ---------- code band ---------- */
.code-band { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; align-items: center; margin: 34px 0 10px; padding: 30px; border-radius: 26px; color: #fff; overflow: hidden;
  background: radial-gradient(500px 240px at 90% 0%, rgba(63,208,234,.35), transparent 70%), linear-gradient(135deg, #141838, #2c1f63); }
.code-band h2 { font-size: clamp(26px, 3vw, 34px); margin: 6px 0 8px; }
.code-band p { color: rgba(255,255,255,.82); margin: 0 0 18px; }
.code-band .eyebrow { color: #9fe7ff; }
.code-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.code-chips span { padding: 8px 12px; border-radius: 12px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); font-size: 14px; font-weight: 500;
  animation: float-chip 5s ease-in-out infinite; animation-delay: calc(var(--k) * -.6s); }
@keyframes float-chip { 50% { transform: translateY(-5px); } }

/* all-chapters view */
.ch-view { flex: none; margin-left: auto; }
.ch-view button { width: auto; padding: 0 12px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.subj.all { padding: 18px 0 6px; border-top: 1px solid var(--line); margin-top: 6px; }
.subj-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.sbadge.big { font-size: 16px; padding: 6px 14px; border-radius: 10px; }
.subj.all .chap { margin-bottom: 14px; content-visibility: auto; contain-intrinsic-size: auto 230px; scroll-margin-top: calc(var(--nav-h) + 16px); border-radius: 18px; }
.subj.all .chap.flash { animation: chap-flash 1.4s ease; }
@keyframes chap-flash { 0%, 40% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--sc) 45%, transparent); background: color-mix(in srgb, var(--sc) 6%, transparent); } }
.subj.all .ch-head { margin-bottom: 8px; }
.ch-num { display: grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 9px; background: color-mix(in srgb, var(--sc) 14%, var(--surface)); color: color-mix(in srgb, var(--sc) 85%, var(--ink)); font-weight: 700; font-size: 13.5px; }
.ch-name.static { cursor: default; font-size: 16px; }
.ch-name.static:hover span:first-child { text-decoration: none; }

/* ---------- my progress ---------- */
.me-panel { margin: 30px 0 0; padding: 26px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); scroll-margin-top: calc(var(--nav-h) + 12px); }
.me-panel h2 { margin: 0 0 14px; } .me-panel h3 { margin: 22px 0 10px; font-size: 16px; }
.me-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.stat { display: grid; justify-items: center; text-align: center; padding: 14px 8px; border-radius: 16px; background: var(--surface-2); font-size: 12.5px; color: var(--ink-2); }
.stat .i { font-size: 22px; } .stat b { font-size: 20px; color: var(--ink); }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.bdg { display: grid; justify-items: center; gap: 4px; padding: 12px 6px; border-radius: 16px; border: 1px dashed var(--line); font-size: 12.5px; text-align: center; color: var(--ink-2); filter: grayscale(1); opacity: .6; }
.bdg .i { font-size: 26px; }
.bdg.got { filter: none; opacity: 1; border-style: solid; background: color-mix(in srgb, #ffd34d 14%, var(--surface)); color: var(--ink); animation: pop .5s var(--ease) both; }
@keyframes pop { from { transform: scale(.8); opacity: 0; } }

/* ---------- dialogs ---------- */
.sheet-dlg { width: min(560px, calc(100vw - 24px)); max-height: min(86vh, 760px); padding: 0; border: 0; border-radius: 24px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.sheet-dlg[open] { display: flex; flex-direction: column; animation: dlg-in .35s var(--ease) both; }
.sheet-dlg::backdrop { background: rgba(10,12,30,.5); backdrop-filter: blur(2px); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(24px) scale(.98); } }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 10px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 0; font-size: 18px; }
.ch-list { list-style: none; margin: 0; padding: 8px; overflow: auto; }
.ch-list button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.ch-list button:hover, .ch-list button.on { background: var(--surface-2); }
.ch-list .n { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 700; flex: none; }
.ch-list .nm { flex: 1; min-width: 0; font-weight: 500; display: grid; }
.ch-list .nm small { color: var(--ink-2); font-weight: 400; font-size: 12px; }
.ch-list .pc { position: relative; width: 36px; height: 36px; flex: none; }
.ch-list .pc .ring circle { stroke-width: 4; } .ch-list .pc .ring .val { stroke: var(--good); }
.ch-list .pc i { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; font-size: 9.5px; font-weight: 600; }
#level-body { padding: 16px 18px 20px; overflow: auto; }
.pick-subj { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pick-subj button { --sc: var(--accent); display: grid; gap: 2px; justify-items: start; padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; transition: transform .15s, border-color .15s; }
.pick-subj button:hover { transform: translateY(-2px); border-color: var(--sc); }
.pick-subj .i { font-size: 26px; } .pick-subj small { color: var(--ink-2); }
.lv-top { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.lv-top .lvl { margin-left: auto; } .lv-top .lvl i { background: var(--line); } .lv-top .lvl.l1 i:nth-child(1), .lv-top .lvl.l2 i:nth-child(-n+2), .lv-top .lvl.l3 i { background: var(--c2); }
.lv-bar { height: 6px; border-radius: 3px; background: var(--surface-2); margin: 12px 0 16px; overflow: hidden; }
.lv-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--c1), var(--c5)); border-radius: 3px; transition: width .4s var(--ease); }
.lv-q { font-size: 18px; font-weight: 600; margin: 0 0 14px; animation: lh-in .35s var(--ease) both; }
.lv-opts { display: grid; gap: 10px; }
.lv-opts button { min-height: 48px; padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); text-align: left; font-size: 15.5px; cursor: pointer; transition: border-color .15s, background .15s, transform .1s; }
.lv-opts button:hover:not(:disabled) { border-color: var(--accent); }
.lv-opts button.ok { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, var(--surface)); }
.lv-opts button.no { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--surface)); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.lv-result { text-align: center; padding: 10px 0; }
.lv-result .big { font-size: 64px; animation: pop .6s cubic-bezier(.2,1.6,.4,1) both; }
.lv-result h3 { margin: 6px 0; font-size: 22px; } .lv-result p { color: var(--ink-2); }
.lv-result .btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- responsive ---------- */
@media (max-width: 1060px) {
  .learn { grid-template-columns: 1fr; }
  .row-arrow { display: none; }
  .me-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .subj-bar { flex-wrap: wrap; } .ch-view { order: 3; margin-left: 0; }
  .learn-head { padding: 20px 0 12px; }
  .lh-top { align-items: stretch; }
  .me-card { width: 100%; }
  .me-card .btn { margin-left: auto; padding: 7px 12px; }
  .class-rail button { width: 58px; height: 58px; border-radius: 16px; } .class-rail button b { font-size: 21px; }
  .tile { width: 148px; height: 148px; border-radius: 16px; }
  .tile .emo { font-size: 52px; }
  .tile .ttl { font-size: 13px; }
  .ch-name { font-size: 16px; }
  .lv-chip { margin-left: 0; }
  .code-band { grid-template-columns: 1fr; padding: 24px 20px; }
  .me-panel { padding: 20px 16px; }
  .sheet-dlg { width: 100vw; max-width: 100vw; max-height: 88vh; margin: auto 0 0; border-radius: 22px 22px 0 0; }
}
@media (max-width: 420px) {
  .me-card { flex-wrap: wrap; } .me-card .btn { width: 100%; }
}
