/* Clevix Ed Code Academy: home, course path, lesson player, editor, runners and the robot world */
:root { --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace; --tc: var(--c1); --spring: cubic-bezier(.2, 1.4, .4, 1); }
.code-page h1, .code-page h2, .code-page h3 { letter-spacing: -.02em; }
.h-sm { font-size: 20px; margin: 0 0 14px; }

/* ---------- home hero ---------- */
.ca-hero { padding-bottom: 40px; }
.ca-hero .hero-sub { font-size: 18px; color: var(--ink-2); max-width: 560px; margin: 0 0 24px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.code-art { position: relative; padding: 26px 10px; }
.win { background: #12152b; color: #e6e9ff; border-radius: 20px; box-shadow: 0 30px 80px rgba(20, 24, 60, .28); overflow: hidden; border: 1px solid rgba(255, 255, 255, .08); transform: rotate(-1.5deg); }
.win-bar { display: flex; align-items: center; gap: 7px; padding: 12px 14px; background: rgba(255, 255, 255, .05); font: 500 13px var(--mono); color: #a9b0d8; }
.win-bar i { width: 11px; height: 11px; border-radius: 50%; background: #ff6b80; } .win-bar i:nth-child(2) { background: #ffc24d; } .win-bar i:nth-child(3) { background: #3fcf96; }
.win-bar span { margin-left: 8px; }
.win-code { margin: 0; padding: 20px 22px 26px; min-height: 190px; font: 15px/1.6 var(--mono); white-space: pre-wrap; word-break: break-word; }
.caret { display: inline-block; width: 9px; height: 18px; background: #7d95ff; vertical-align: -3px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.ca-float { position: absolute; z-index: 2; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow); white-space: nowrap; animation: bob 5s ease-in-out infinite; }
.ca-float.f1 { left: -6px; top: 4px; } .ca-float.f2 { right: 4px; top: -4px; animation-delay: -1.2s; } .ca-float.f3 { right: -8px; top: 46%; animation-delay: -2.4s; }
.ca-float.f4 { left: 8%; bottom: 0; animation-delay: -3.3s; } .ca-float.f5 { right: 18%; bottom: -6px; animation-delay: -4.1s; }

/* ---------- stats strip ---------- */
.ca-stats-wrap { margin-top: -10px; }
.ca-stats { display: grid; grid-template-columns: 1.4fr repeat(4, minmax(0, 1fr)); gap: 12px; }
.ca-stat { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); min-width: 0; }
.ca-stat b { display: block; font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ca-stat small { color: var(--ink-2); font-size: 12.5px; }
.ca-stat .si { font-size: 26px; }
.ca-stat.lvl b { font-size: 18px; }

/* ---------- progress ring ---------- */
.ring { position: relative; display: inline-grid; place-items: center; width: var(--sz, 52px); height: var(--sz, 52px); flex: none; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4.5; }
.ring .trk { stroke: var(--surface-2); }
.ring .bar { stroke: var(--tc, var(--accent)); stroke-linecap: round; stroke-dasharray: 119.4; stroke-dashoffset: calc(119.4 * (1 - var(--p))); transition: stroke-dashoffset 1.2s var(--ease, ease); }
.ring b { font-size: calc(var(--sz, 52px) * .24); font-variant-numeric: tabular-nums; }

/* ---------- continue ---------- */
.cont { margin-top: 34px; }
.cont-row { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x mandatory; }
.cont-card { flex: 0 0 auto; width: 260px; scroll-snap-align: start; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; transition: transform .2s var(--ease, ease), border-color .2s; }
.cont-card:hover { transform: translateY(-3px); border-color: var(--tc); }
.cont-art { font-size: 26px; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: color-mix(in srgb, var(--tc) 16%, transparent); flex: none; }
.cont-t { display: grid; min-width: 0; flex: 1; }
.cont-t b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14.5px; }
.cont-t small { color: var(--ink-2); font-size: 12px; }

/* ---------- filters ---------- */
.filters-row { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-bottom: 22px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px; max-width: 100%; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 38px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 500; font-size: 14px; cursor: pointer; transition: background .15s, color .15s, border-color .15s, transform .15s; }
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* ---------- track cards ---------- */
.tgroup { margin-bottom: 34px; }
.tg-head h3 { margin: 0; font-size: 20px; }
.tg-head p { margin: 4px 0 14px; color: var(--ink-2); font-size: 14.5px; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tcard { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; overflow: hidden; isolation: isolate;
  box-shadow: var(--shadow); transition: transform .25s var(--ease, ease), box-shadow .25s, border-color .25s; animation: tcIn .5s var(--ease, ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
.tcard::before { content: ""; position: absolute; z-index: -1; right: -40px; top: -40px; width: 150px; height: 150px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--tc) 22%, transparent), transparent 70%); transition: transform .4s var(--ease, ease); }
.tcard:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--tc) 60%, var(--line)); box-shadow: 0 18px 40px rgba(20, 24, 60, .12); }
.tcard:hover::before { transform: scale(1.3); }
@keyframes tcIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.tc-top { display: flex; justify-content: space-between; align-items: flex-start; }
.tc-art { font-size: 34px; width: 60px; height: 60px; display: grid; place-items: center; border-radius: 18px; background: color-mix(in srgb, var(--tc) 15%, var(--surface)); transition: transform .3s var(--spring); }
.tcard:hover .tc-art { transform: rotate(-8deg) scale(1.08); }
.tcard h4 { margin: 4px 0 0; font-size: 19px; }
.tcard p { margin: 0; color: var(--ink-2); font-size: 14px; flex: 1; }
.tc-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.badge.you { background: color-mix(in srgb, var(--tc) 18%, transparent); color: var(--tc); font-weight: 600; }
.tc-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.lvchip { position: relative; overflow: hidden; font-size: 11.5px; font-weight: 600; text-align: center; padding: 5px 2px; border-radius: 9px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.lvchip i { position: absolute; inset: 0 auto 0 0; width: calc(var(--w) * 100%); background: color-mix(in srgb, var(--tc) 25%, transparent); z-index: 0; }
.lvchip.hl { outline: 2px solid var(--tc); color: var(--ink); }
.lvchip.done { color: var(--tc); }
.lvchip { z-index: 0; } .lvchip > * { position: relative; }
.tc-go { font-weight: 600; font-size: 14px; color: var(--tc); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty-note { color: var(--ink-2); padding: 30px 0; text-align: center; }

/* ---------- placement ---------- */
.level-box { display: grid; grid-template-columns: .8fr 1.2fr; gap: 30px; padding: 30px; border-radius: 28px; background: linear-gradient(135deg, color-mix(in srgb, var(--c5) 12%, var(--surface)), color-mix(in srgb, var(--c1) 10%, var(--surface))); border: 1px solid var(--line); }
.level-intro h2 { margin: 0; font-size: clamp(24px, 3vw, 34px); }
.level-body { min-width: 0; }
.lv-q { font-weight: 600; margin: 0 0 12px; }
.lv-tracks { display: flex; flex-wrap: wrap; gap: 10px; }
.lv-track { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; transition: transform .2s var(--spring), border-color .2s; }
.lv-track:hover { transform: translateY(-3px) scale(1.03); border-color: var(--tc); }
.lv-track span { font-size: 22px; }
.lv-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13.5px; color: var(--ink-2); margin-bottom: 12px; flex-wrap: wrap; }
.lv-bar { flex: 1; min-width: 120px; height: 8px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.lv-bar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .4s var(--ease, ease); }
.lv-card { background: var(--surface); border-radius: 20px; padding: 18px; border: 1px solid var(--line); animation: slideIn .35s var(--ease, ease) both; }
.lv-card .tq { font-size: 18px; }
.lv-next { margin-top: 12px; }
.lv-result { text-align: center; background: var(--surface); border-radius: 20px; padding: 26px 18px; border: 1px solid var(--line); animation: pop .5s var(--spring) both; }
.lv-badge { font-size: 64px; line-height: 1; }
.lv-result h3 { font-size: 24px; margin: 10px 0 6px; }
.lv-result p { color: var(--ink-2); margin: 0 0 18px; }
.lv-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.why { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 14.5px; }

/* ---------- how ---------- */
.ca-how h2 { font-size: clamp(24px, 3vw, 34px); margin: 0 0 20px; }
.ca-how-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.ca-how-c { padding: 20px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); }
.ca-how-c span { font-size: 30px; display: block; }
.ca-how-c b { display: block; margin: 8px 0 4px; font-size: 17px; }
.ca-how-c p { margin: 0; color: var(--ink-2); font-size: 14px; }
.code-foot { padding: 26px 0; }
.code-foot .foot-bottom { margin: 0; padding: 0; border: 0; }

/* ---------- course path ---------- */
.t-hero { padding: 26px 0 30px; background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 13%, var(--bg)), var(--bg)); }
.back-link { display: inline-block; color: var(--ink-2); text-decoration: none; font-size: 14px; margin-bottom: 14px; }
.back-link:hover { color: var(--ink); }
.t-head { display: flex; gap: 20px; align-items: center; }
.t-art { font-size: 52px; width: 92px; height: 92px; flex: none; display: grid; place-items: center; border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); animation: pop .6s var(--spring) both; }
.t-txt { flex: 1; min-width: 0; }
.t-txt h1 { margin: 0; font-size: clamp(28px, 4vw, 44px); }
.t-txt p { margin: 4px 0 10px; color: var(--ink-2); max-width: 640px; }
.t-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.t-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.t-actions .btn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.path { max-width: 760px; padding-top: 10px; padding-bottom: 20px; }
.lvl-sec { margin: 22px 0 10px; scroll-margin-top: 80px; }
.lvl-head { position: sticky; top: calc(var(--nav-h, 64px) + 6px); z-index: 5; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 12px 18px; border-radius: 18px; color: #fff;
  background: linear-gradient(120deg, var(--tc), color-mix(in srgb, var(--tc) 55%, var(--c5))); box-shadow: 0 10px 30px color-mix(in srgb, var(--tc) 30%, transparent); }
.lvl-head h2 { margin: 0; font-size: 21px; }
.lvl-n { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; opacity: .85; font-weight: 600; }
.lvl-c { margin-left: auto; font-size: 13px; opacity: .9; }
.nodes { list-style: none; margin: 0; padding: 18px 0 8px; display: grid; gap: 6px; }
.node-li { display: grid; grid-template-columns: 1fr; justify-items: center; transform: translateX(var(--x)); animation: nodeIn .45s var(--spring) both; animation-delay: calc(var(--i) * 70ms); }
@keyframes nodeIn { from { opacity: 0; transform: translateX(var(--x)) scale(.6); } }
.node { position: relative; display: grid; place-items: center; width: 74px; height: 70px; border-radius: 50%; text-decoration: none; color: #fff; font-size: 26px; font-weight: 700;
  background: color-mix(in srgb, var(--ink-2) 40%, var(--surface-2)); box-shadow: 0 6px 0 color-mix(in srgb, var(--ink-2) 55%, var(--surface-2)); transition: transform .12s, box-shadow .12s; }
.node:active { transform: translateY(5px); box-shadow: 0 1px 0 color-mix(in srgb, var(--ink-2) 55%, var(--surface-2)); }
.node-li.done .node, .node-li.cur .node { background: var(--tc); box-shadow: 0 6px 0 color-mix(in srgb, var(--tc) 60%, #000); }
.node-li.cur .node::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 3px solid var(--tc); animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { from { opacity: .9; transform: scale(.92); } to { opacity: 0; transform: scale(1.25); } }
.node-tip { position: absolute; top: -34px; background: var(--surface); color: var(--tc); border: 2px solid var(--line); border-radius: 12px; padding: 2px 10px; font-size: 13px; font-weight: 700; white-space: nowrap; animation: bob 2.4s ease-in-out infinite; }
.node-t { text-align: center; margin-top: 10px; max-width: 220px; }
.node-t b { display: block; font-size: 14.5px; }
.node-t small { color: var(--ink-2); font-size: 12px; }
.stars { display: inline-flex; gap: 1px; font-style: normal; }
.stars i { font-style: normal; color: var(--line); font-size: 14px; }
.stars i.on { color: #f5b400; }
.labs, .others { margin: 30px auto; }
.lab-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.lab-card { display: grid; gap: 4px; padding: 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; transition: transform .2s; }
.lab-card:hover { transform: translateY(-3px); }
.lab-thumb { display: block; border-radius: 12px; overflow: hidden; background: var(--stage); }
.lab-card small { color: var(--ink-2); font-size: 13px; }

/* ---------- lesson player ---------- */
.lesson-page { background: var(--bg); }
.l-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.l-close { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--ink-2); text-decoration: none; font-size: 20px; flex: none; }
.l-close:hover { background: var(--surface-2); color: var(--ink); }
.l-bar { flex: 1; height: 14px; border-radius: 8px; background: var(--surface-2); overflow: hidden; min-width: 60px; }
.l-bar i { display: block; height: 100%; width: 0; border-radius: 8px; background: linear-gradient(90deg, var(--tc), color-mix(in srgb, var(--tc) 50%, var(--c3))); transition: width .5s var(--spring); position: relative; }
.l-bar i::after { content: ""; position: absolute; left: 8px; right: 8px; top: 3px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .35); }
.combo { font-weight: 700; font-size: 13px; color: var(--c2); white-space: nowrap; animation: pop .4s var(--spring) both; }
.hearts { display: inline-flex; gap: 1px; font-size: 19px; flex: none; }
.hearts .on { color: var(--c4); } .hearts .off { color: var(--line); }
.hearts.hit { animation: shake .45s; }
.l-act { margin-left: 0; gap: 6px; }
.lesson-main { padding: 22px 0 60px; }
.l-wrap { max-width: 780px; position: relative; }
.card-l { background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 24px; box-shadow: var(--shadow); min-width: 0; }
.slide-in { animation: slideIn .4s var(--ease, ease) both; }
.slide-out { position: absolute; left: 24px; right: 24px; top: 0; animation: slideOut .26s ease both; pointer-events: none; }
@keyframes slideIn { from { opacity: 0; transform: translateX(40px); } }
@keyframes slideOut { to { opacity: 0; transform: translateX(-40px); } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.shake { animation: shake .45s; }
.eyebrow-s { font-size: 13px; font-weight: 600; color: var(--tc); margin-bottom: 6px; }
.card-l h1 { font-size: clamp(24px, 4vw, 32px); margin: 0 0 12px; outline: none; }
.learn-body { font-size: 16.5px; }
.learn-body p { margin: 0 0 12px; }
.learn-body code, .tq code, .why code { font-family: var(--mono); font-size: .92em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.learn-body pre { font-family: var(--mono); background: var(--surface-2); padding: 12px; border-radius: 12px; overflow-x: auto; }
.learn-body ul { padding-left: 20px; margin: 0 0 12px; }
.example { margin-top: 16px; border-radius: 18px; border: 1px solid var(--line); overflow: hidden; }
.ex-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; background: var(--surface-2); font-size: 13px; font-weight: 600; color: var(--ink-2); }
.example .cbox { border-radius: 0; margin: 0; }
.cbox { margin: 12px 0; padding: 14px 16px; background: #12152b; color: #e6e9ff; border-radius: 14px; font: 14.5px/1.6 var(--mono); overflow-x: auto; white-space: pre; tab-size: 4; }
.cbox .gap { display: inline-block; min-width: 4ch; padding: 0 6px; border-radius: 6px; background: rgba(125, 149, 255, .25); border-bottom: 2px dashed #7d95ff; color: #c8d2ff; }
.cbox .gap.filled { background: rgba(63, 207, 150, .25); border-bottom-color: #3fcf96; color: #b5f5da; animation: pop .35s var(--spring); }
.console { margin: 0; padding: 12px 14px; background: #0b0d1c; color: #d6f5e4; font: 14px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; max-height: 300px; overflow: auto; border-top: 1px solid rgba(255, 255, 255, .06); }
.card-l > .console { border-radius: 14px; margin-top: 10px; }
.console.err { color: #ffd0d7; }
.console .err-l { color: #ff8b9b; margin-top: 4px; }
.console small { color: #8c93bd; }
.tbl-wrap { overflow-x: auto; }
.sql-t { border-collapse: collapse; font-size: 13px; }
.sql-t th, .sql-t td { border: 1px solid rgba(255, 255, 255, .15); padding: 4px 10px; text-align: left; }
.sql-t th { color: #9fb2ff; }
.preview { display: block; width: 100%; height: 240px; border: 1px solid var(--line); border-radius: 14px; background: #fff; margin-top: 10px; }
.card-foot { display: flex; justify-content: flex-end; margin-top: 20px; }
.tq { font-size: 21px; margin: 0 0 14px; line-height: 1.35; }
.hint { color: var(--ink-2); font-size: 14.5px; margin: -4px 0 12px; }
.opts { display: grid; gap: 10px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 10px 14px; text-align: left; border-radius: 16px; border: 2px solid var(--line); background: var(--surface);
  box-shadow: 0 3px 0 var(--line); cursor: pointer; font-size: 16px; transition: transform .1s, border-color .15s, background .15s; animation: slideIn .35s var(--ease, ease) both; animation-delay: calc(var(--i) * 50ms); }
.opts.mono .ot { font-family: var(--mono); font-size: 15px; white-space: pre-wrap; }
.opt:hover:not(:disabled) { border-color: var(--tc); transform: translateY(-1px); }
.opt:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.opt .key { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 8px; border: 2px solid var(--line); font-size: 13px; font-weight: 700; color: var(--ink-2); }
.opt .ot { min-width: 0; overflow-wrap: anywhere; }
.opt:disabled { cursor: default; opacity: .65; }
.opt.right { opacity: 1; border-color: var(--good); background: color-mix(in srgb, var(--good) 13%, var(--surface)); box-shadow: 0 3px 0 var(--good); animation: pop .35s var(--spring); }
.opt.right .key { border-color: var(--good); background: var(--good); color: #fff; }
.opt.wrong { opacity: 1; border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--surface)); box-shadow: 0 3px 0 var(--bad); animation: shake .4s; }
.opt.wrong .key { border-color: var(--bad); background: var(--bad); color: #fff; }

/* parsons */
.pz-ans { list-style: none; counter-reset: ln; margin: 0 0 12px; padding: 10px; min-height: 64px; border-radius: 16px; border: 2px dashed var(--line); display: grid; gap: 6px; transition: border-color .2s, background .2s; }
.pz-ans > li { counter-increment: ln; display: flex; align-items: center; gap: 8px; animation: pop .25s var(--spring); }
.pz-ans > li::before { content: counter(ln); width: 22px; text-align: right; font: 12px var(--mono); color: var(--ink-2); flex: none; }
.pz-ans > li.pz-empty { color: var(--ink-2); font-size: 14px; justify-content: center; padding: 8px; }
.pz-ans > li.pz-empty::before { content: none; }
.pz-ans.ok { border-color: var(--good); border-style: solid; background: color-mix(in srgb, var(--good) 8%, transparent); }
.pz-ans.nope { animation: shake .4s; border-color: var(--bad); }
.pz-ans li.ok-line .pz-line { border-color: var(--good); }
.pz-pool { display: grid; gap: 6px; }
.pz-line { display: block; width: 100%; text-align: left; min-height: 44px; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); box-shadow: 0 2px 0 var(--line); cursor: pointer; transition: transform .1s, border-color .15s; }
.pz-line:hover { border-color: var(--tc); }
.pz-line:active { transform: translateY(2px); }
.pz-line code { font: 14.5px var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.pz-ans .pz-line { background: color-mix(in srgb, var(--tc) 8%, var(--surface)); }

/* code task */
.want { margin: 0 0 12px; }
.want small { color: var(--ink-2); font-weight: 600; font-size: 12.5px; }
.want pre { margin: 4px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font: 14px/1.5 var(--mono); white-space: pre-wrap; overflow-x: auto; }
.checks { margin: 0 0 12px; padding-left: 20px; color: var(--ink-2); font-size: 14.5px; }
.ed { display: flex; border-radius: 14px; overflow: hidden; background: #12152b; border: 2px solid transparent; transition: border-color .2s; }
.ed:focus-within { border-color: var(--tc); }
.ed-gut { flex: none; width: 42px; padding: 12px 8px 12px 0; text-align: right; color: #5d6494; font: 14.5px/1.6 var(--mono); white-space: pre; overflow: hidden; user-select: none; background: #0e1124; }
.ed-ta { flex: 1; min-width: 0; padding: 12px; border: 0; outline: none; resize: vertical; background: transparent; color: #e6e9ff; font: 14.5px/1.6 var(--mono); tab-size: 4; white-space: pre; overflow-x: auto; min-height: 150px; caret-color: #7d95ff; }
.run-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.run-msg { margin: 10px 0 0; font-weight: 600; min-height: 1.3em; }
.run-msg.good { color: var(--good); } .run-msg.bad { color: var(--bad); }
.sol { margin-top: 12px; }
.sol summary { cursor: pointer; color: var(--accent); font-weight: 600; }

/* feedback bar */
.feedback { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 20px -24px -24px; padding: 18px 24px calc(18px + env(safe-area-inset-bottom)); border-radius: 0 0 26px 26px; animation: up .35s var(--spring) both; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.feedback.good { background: color-mix(in srgb, var(--good) 16%, var(--surface)); }
.feedback.bad { background: color-mix(in srgb, var(--bad) 13%, var(--surface)); }
.fb-t { flex: 1; min-width: 200px; }
.fb-t b { font-size: 20px; }
.feedback.good .fb-t b { color: var(--good); } .feedback.bad .fb-t b { color: var(--bad); }
.fb-t p { margin: 4px 0 0; font-size: 14.5px; }
.fb-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* finish */
.finish { text-align: center; padding: 34px 24px; }
.trophy { font-size: 84px; line-height: 1; animation: pop .7s var(--spring) both; }
.big-stars { display: flex; justify-content: center; gap: 8px; margin: 6px 0 18px; }
.big-stars i { font-style: normal; font-size: 46px; color: var(--line); animation: starIn .5s var(--spring) both; animation-delay: var(--d); }
.big-stars i.on { color: #f5b400; text-shadow: 0 4px 14px rgba(245, 180, 0, .4); }
@keyframes starIn { from { opacity: 0; transform: scale(.2) rotate(-90deg); } }
.fin-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 460px; margin: 0 auto 22px; }
.fin-stats div { padding: 12px 6px; border-radius: 16px; background: var(--surface-2); }
.fin-stats b { display: block; font-size: 24px; }
.fin-stats small { color: var(--ink-2); font-size: 12px; }
.fin-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.fin-btns .btn { max-width: 100%; white-space: normal; }

/* confetti */
.burst { position: fixed; z-index: 400; width: 0; height: 0; pointer-events: none; }
.burst i { position: absolute; width: 9px; height: 9px; border-radius: 2px; animation: fly .9s cubic-bezier(.2, .8, .3, 1) forwards; }
@keyframes fly { to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0; } }

/* ---------- robot world ---------- */
.robot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.robot-stage { min-width: 0; }
.robot-board { position: relative; display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 3px; padding: 6px; border-radius: 18px; background: color-mix(in srgb, var(--c3) 18%, var(--surface-2)); aspect-ratio: var(--cols) / var(--rows); max-width: 420px; }
.robot-board .cell { position: relative; border-radius: 8px; background: color-mix(in srgb, var(--c3) 8%, var(--surface)); display: grid; place-items: center; font-size: clamp(14px, 4vw, 24px); }
.robot-board .cell.wall { background: color-mix(in srgb, var(--ink-2) 55%, var(--surface-2)); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18); }
.robot-board .cell.goal { background: color-mix(in srgb, var(--c2) 25%, var(--surface)); }
.robot-board .cell .s { transition: transform .3s var(--spring), opacity .3s; animation: twinkle 2s ease-in-out infinite; }
.robot-board .cell.got .s { transform: scale(1.8) translateY(-12px); opacity: 0; animation: none; }
@keyframes twinkle { 50% { transform: scale(1.15); } }
.bot { position: absolute; width: calc((100% - 12px) / var(--cols)); height: calc((100% - 12px) / var(--rows)); margin: 6px; display: grid; place-items: center; z-index: 2; transition: left .3s var(--ease, ease), top .3s var(--ease, ease); }
.bot .b { font-size: clamp(18px, 5vw, 30px); filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .25)); }
.bot .arrow { position: absolute; inset: 0; transform: rotate(var(--rot, 90deg)); transition: transform .25s var(--ease, ease); }
.bot .arrow::after { content: ""; position: absolute; left: 50%; top: -2px; transform: translateX(-50%); border: 7px solid transparent; border-bottom: 10px solid var(--c4); border-top: 0; }
.bot.bump { animation: shake .35s; }
.robot-status { margin: 10px 0 0; font-weight: 600; min-height: 1.4em; }
.robot.won .robot-status { color: var(--good); }
.robot.lost .robot-status { color: var(--bad); }
.robot.won .robot-board { box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 45%, transparent); }
.robot-side { min-width: 0; display: grid; gap: 10px; }
.robot-mode { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); justify-self: start; }
.robot-mode .seg { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.robot-mode .seg.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.robot-palette { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.blk { min-height: 44px; padding: 6px 12px; border-radius: 12px; border: 0; color: #fff; font-weight: 600; font-size: 14px; cursor: pointer; box-shadow: 0 3px 0 rgba(0, 0, 0, .22); transition: transform .1s; }
.blk:active { transform: translateY(2px); box-shadow: none; }
.blk-move { background: var(--c1); } .blk-left, .blk-right { background: var(--c5); } .blk-repeat { background: var(--c2); } .blk-while { background: var(--c3); } .blk-if { background: var(--c6); }
.rep-n { display: inline-flex; align-items: center; gap: 4px; padding: 2px; border-radius: 10px; background: color-mix(in srgb, var(--c2) 18%, transparent); }
.rep-n b { min-width: 18px; text-align: center; }
.mini { width: 32px; height: 32px; border-radius: 8px; border: 0; background: var(--surface); cursor: pointer; font-size: 16px; }
.robot-cond { min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); padding: 0 8px; }
.robot-ctl { display: flex; flex-wrap: wrap; gap: 6px; }
.robot-prog { list-style: none; margin: 0; padding: 10px; min-height: 90px; max-height: 300px; overflow: auto; border-radius: 14px; background: var(--surface-2); display: grid; gap: 5px; align-content: start; }
.robot-prog ol { list-style: none; margin: 5px 0 0 14px; padding: 6px 0 6px 10px; border-left: 3px solid color-mix(in srgb, var(--ink-2) 30%, transparent); display: grid; gap: 5px; min-height: 26px; }
.robot-prog ol.active { border-left-color: var(--c2); background: color-mix(in srgb, var(--c2) 8%, transparent); border-radius: 0 10px 10px 0; }
.pb { padding: 6px 10px; border-radius: 10px; background: var(--surface); font-size: 14px; font-weight: 600; animation: pop .25s var(--spring); }
.pb-move { border-left: 4px solid var(--c1); } .pb-left, .pb-right { border-left: 4px solid var(--c5); } .pb-repeat { border-left: 4px solid var(--c2); }
.pb-while { border-left: 4px solid var(--c3); } .pb-if, .pb-else { border-left: 4px solid var(--c6); }
.pb-empty { color: var(--ink-2); font-size: 13.5px; padding: 6px; }
.robot-text { width: 100%; min-height: 170px; border-radius: 14px; border: 2px solid var(--line); background: #12152b; color: #e6e9ff; font: 14.5px/1.6 var(--mono); padding: 12px; resize: vertical; }
.robot-run { display: flex; gap: 8px; }
.robot-run .btn { min-height: 46px; flex: 1; font-size: 16px; }

/* ---------- responsive ---------- */
@media (max-width: 1060px) {
  .ca-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ca-stat.lvl { grid-column: 1 / -1; }
  .level-box { grid-template-columns: 1fr; }
  .ca-how-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .code-art { max-width: 560px; width: 100%; margin: 0 auto; }
}
@media (max-width: 760px) {
  .robot { grid-template-columns: minmax(0, 1fr); }
  .robot-board { margin: 0 auto; }
  .card-l { padding: 18px 16px; border-radius: 22px; }
  .feedback { margin: 18px -16px -18px; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 0 0 22px 22px; }
  .feedback .btn { flex: 1; }
  .slide-out { left: 16px; right: 16px; }
  .l-top { gap: 8px; padding-left: 10px; padding-right: 10px; }
  .l-top .icon-btn { display: none; }
  .tq { font-size: 19px; }
  .t-head { flex-wrap: wrap; }
  .t-art { width: 72px; height: 72px; font-size: 40px; border-radius: 22px; }
  .t-ring { order: 3; }
  .level-box { padding: 20px 16px; border-radius: 22px; }
  .win-code { font-size: 13.5px; min-height: 160px; }
  .ca-float.f3 { display: none; }
  .ca-how-grid { grid-template-columns: minmax(0, 1fr); }
  .node-li { transform: translateX(calc(var(--x) * .6)); }
}
@media (prefers-reduced-motion: reduce) {
  .tcard, .node-li, .opt, .slide-in, .slide-out, .lv-card, .pz-ans > li, .pb, .feedback, .trophy, .big-stars i, .t-art, .lv-result, .combo { animation: none !important; }
  .node-li.cur .node::after, .node-tip, .caret, .ca-float, .robot-board .cell .s { animation: none; }
  .bot, .bot .arrow, .ring .bar, .l-bar i { transition: none; }
}
.console .sql-h { color: #9fb2ff; font-weight: 600; border-bottom: 1px solid rgba(255,255,255,.15); margin-bottom: 4px; }
.console .sql-n { display: block; margin-top: 6px; }
.nodes { padding-top: 44px; }
.node-t .stars { display: flex; justify-content: center; margin-top: 2px; }
.t-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
@media (max-width: 760px) {
  .t-head { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "art ring" "txt txt"; gap: 14px; }
  .t-art { grid-area: art; } .t-ring { grid-area: ring; justify-self: end; } .t-txt { grid-area: txt; }
}
.trophy { margin-bottom: 14px; }
