@property --h { syntax: '<number>'; inherits: true; initial-value: 28; }
:root {
	--bg: #0e1014; --s1: #161920; --s2: #1e222b; --s3: #272c37; --line: #2c323e; --text: #e8eaf0; --mut: #8d95a6;
	--acc: #ff8a3d; --acc2: #ffb07a; --blue: #62a8ff; --red: #ff6170; --green: #3ddc97; --yellow: #ffd166; --r: 12px;
	color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--blue); }
h1 { font-size: 26px; margin: 0 0 14px; letter-spacing: -.02em; }
h2 { font-size: 18px; margin: 0 0 10px; }
h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--mut); margin: 18px 0 8px; font-weight: 600; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--mut); }
.mut { color: var(--mut); } .sm { font-size: 13px; } .xs { font-size: 12px; } .b { font-weight: 650; } .grow { flex: 1; min-width: 0; } .row { display: flex; align-items: center; gap: 10px; } .wrap { flex-wrap: wrap; } .col { display: flex; flex-direction: column; gap: 10px; } .center { text-align: center; } .right { margin-left: auto; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
svg.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* shell */
.shell { display: flex; height: 100dvh; }
.rail { width: 84px; background: var(--s1); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 4px; flex: none; }
.rail .logo { width: 40px; height: 40px; margin-bottom: 12px; }
.rail button { width: 70px; padding: 9px 0 7px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11.5px; color: var(--mut); position: relative; }
.rail button:hover { background: var(--s2); color: var(--text); }
.rail button.on { background: color-mix(in srgb, var(--acc) 16%, transparent); color: var(--acc2); }
.rail .sp { flex: 1; }
.dot { position: absolute; top: 5px; right: 16px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.main { flex: 1; min-width: 0; overflow: auto; padding: 22px clamp(14px, 3vw, 34px) 90px; }
.page { max-width: 1000px; margin: 0 auto; }
.head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.head h1 { margin: 0; flex: 1; }
@media (max-width: 700px) {
	.shell { flex-direction: column-reverse; }
	.rail { width: 100%; flex-direction: row; justify-content: space-around; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
	.rail .logo, .rail .sp { display: none; }
	.rail button { width: auto; flex: 1; }
	.main { padding-bottom: 30px; }
}

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px; border-radius: 10px; background: var(--s3); font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.btn:hover { filter: brightness(1.15); }
.btn.pri { background: var(--acc); color: #1b1206; }
.btn.blue { background: var(--blue); color: #06162b; }
.btn.ghost { background: none; border-color: var(--line); }
.btn.danger { background: color-mix(in srgb, var(--red) 18%, transparent); color: var(--red); }
.btn.big { padding: 13px 20px; font-size: 16px; border-radius: 13px; }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.ib { width: 36px; height: 36px; border-radius: 10px; display: inline-grid; place-items: center; color: var(--mut); flex: none; position: relative; }
.ib:hover { background: var(--s3); color: var(--text); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=datetime-local], input[type=number], input[type=search], input[type=url], input[type=tel], select, textarea {
	width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--acc); }
input.num { width: 64px; text-align: center; padding: 7px 4px; display: inline-block; }
select.inl { width: auto; display: inline-block; padding: 7px 8px; }
textarea { min-height: 90px; resize: vertical; }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--mut); margin-bottom: 5px; font-weight: 600; }
.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { flex: 1; padding: 8px 10px; border-radius: 8px; color: var(--mut); font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.seg button.on { background: var(--s3); color: var(--text); }
.seg button.on.red { background: color-mix(in srgb, var(--red) 25%, transparent); color: var(--red); }
.seg button.on.green { background: color-mix(in srgb, var(--green) 22%, transparent); color: var(--green); }
.tog { display: flex; align-items: center; gap: 12px; padding: 10px 0; cursor: pointer; }
.tog i { width: 42px; height: 24px; border-radius: 12px; background: var(--s3); position: relative; flex: none; transition: .15s; }
.tog i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--mut); transition: .15s; }
.tog.on i { background: var(--acc); } .tog.on i::after { left: 21px; background: #fff; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 99px; background: var(--s2); border: 1px solid var(--line); font-size: 13px; color: var(--mut); white-space: nowrap; }
button.chip:hover { color: var(--text); } .chip.on { background: color-mix(in srgb, var(--acc) 18%, transparent); border-color: var(--acc); color: var(--acc2); }
.card { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.list { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); min-height: 52px; }
.li:first-child { border-top: 0; } .li.click { cursor: pointer; } .li.click:hover { background: var(--s2); }
.empty { padding: 34px 18px; text-align: center; color: var(--mut); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tile { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; gap: 12px; align-items: center; cursor: pointer; text-align: left; }
.tile:hover { border-color: var(--acc); }
.stat { background: var(--s2); border-radius: 12px; padding: 12px; flex: 1; min-width: 120px; }
.stat b { display: block; font-size: 20px; }

/* avatars - any hue, glowing */
.av { --g: .6; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; position: relative; background: hsl(var(--h) 45% 20%); color: hsl(var(--h) 90% 82%);
	box-shadow: 0 0 0 2.5px hsl(var(--h) 95% 60%), 0 0 calc(var(--g) * 24px) calc(var(--g) * 5px) hsl(var(--h) 95% 55% / .8); }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.av.rainbow { animation: hue 8s linear infinite; }
.av.pulse { animation: pulse 2.4s ease-in-out infinite; }
.av.rainbow.pulse { animation: hue 8s linear infinite, pulse 2.4s ease-in-out infinite; }
@keyframes hue { from { --h: 0; } to { --h: 360; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 2.5px hsl(var(--h) 95% 60%), 0 0 calc(var(--g) * 44px) calc(var(--g) * 11px) hsl(var(--h) 95% 55% / .9); } }
input.hue { -webkit-appearance: none; appearance: none; height: 16px; border-radius: 8px; padding: 0; border: 0; background: linear-gradient(90deg, hsl(0 95% 60%), hsl(60 95% 60%), hsl(120 95% 60%), hsl(180 95% 60%), hsl(240 95% 60%), hsl(300 95% 60%), hsl(360 95% 60%)); }
input[type=range] { width: 100%; accent-color: var(--acc); }

/* sheets, menus, toasts */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50; display: flex; justify-content: flex-end; animation: fade .15s; }
.sheet { width: min(520px, 100%); height: 100%; background: var(--s1); border-left: 1px solid var(--line); display: flex; flex-direction: column; animation: slide .18s; }
.sheet.center { margin: auto; height: auto; max-height: 92dvh; border: 1px solid var(--line); border-radius: 16px; width: min(460px, calc(100% - 24px)); animation: pop .15s; }
.sheet.wide { width: min(860px, 100%); }
.sheet > header { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.sheet > header h2 { margin: 0; flex: 1; }
.sheet > .body { padding: 16px 18px; overflow: auto; flex: 1; }
.sheet > footer { padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } } @keyframes slide { from { transform: translateX(40px); opacity: 0; } } @keyframes pop { from { transform: scale(.96); opacity: 0; } }
.menu { position: fixed; z-index: 80; background: var(--s2); border: 1px solid var(--line); border-radius: 12px; padding: 5px; min-width: 190px; box-shadow: 0 12px 40px rgba(0,0,0,.5); max-height: 80vh; overflow: auto; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border-radius: 8px; text-align: left; }
.menu button:hover { background: var(--s3); } .menu button.danger { color: var(--red); } .menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu .lbl { padding: 6px 11px 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--mut); }
#toasts { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #2b313d; border: 1px solid var(--line); padding: 10px 16px; border-radius: 99px; box-shadow: 0 8px 30px rgba(0,0,0,.5); animation: pop .15s; max-width: 90vw; }
.toast.err { border-color: var(--red); color: #ffd3d7; }

/* one-time hints */
.hint { position: fixed; z-index: 100; max-width: 300px; background: #26314a; border: 1px solid var(--blue); color: #eaf2ff; border-radius: 12px; padding: 11px 13px; box-shadow: 0 10px 34px rgba(0,0,0,.6); animation: pop .2s; font-size: 14px; }
.hint::before { content: ''; position: absolute; left: var(--ax, 24px); width: 12px; height: 12px; background: #26314a; border: 1px solid var(--blue); border-right: 0; border-bottom: 0; transform: rotate(45deg); top: -7px; }
.hint.above::before { top: auto; bottom: -7px; transform: rotate(225deg); }
.hint .row { margin-top: 8px; justify-content: flex-end; gap: 14px; }
.hint button { color: var(--blue); font-weight: 650; font-size: 13px; } .hint button.q { color: #93a4c4; font-weight: 500; }
.hinted { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 8px; }
.tipcard { text-align: center; padding: 8px 4px; } .tipcard .big { font-size: 46px; margin-bottom: 6px; } .tipcard p { color: #c9cfdb; margin: 8px 0 0; }
.dots { display: flex; gap: 4px; justify-content: center; margin-top: 14px; flex-wrap: wrap; } .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--s3); } .dots i.on { background: var(--acc); }

/* auth */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 500px at 50% -10%, #2a1c12, transparent), var(--bg); }
.auth .card { width: min(410px, 100%); padding: 26px; }
.auth .logo { width: 62px; height: 62px; display: block; margin: 0 auto 10px; }

/* lesson editor */
.lesson { height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.lhead { background: var(--s1); border-bottom: 1px solid var(--line); padding: 9px 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lhead.past { background: #1d1a2c; }
.score { padding: 5px 12px; border-radius: 99px; background: var(--s3); font-weight: 700; }
.score.zero { background: color-mix(in srgb, var(--green) 22%, transparent); color: var(--green); } .score.pos { background: color-mix(in srgb, var(--red) 22%, transparent); color: var(--red); } .score.neg { background: color-mix(in srgb, var(--yellow) 22%, transparent); color: var(--yellow); }
.lbody { flex: 1; overflow: auto; padding: 14px clamp(10px, 3vw, 28px) 30px; }
.lbody > .inner { max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.lbar { background: var(--s1); border-top: 1px solid var(--line); display: flex; align-items: stretch; padding: 5px 8px calc(5px + env(safe-area-inset-bottom)); gap: 4px; }
.lbar button { flex: 1; padding: 7px 2px 5px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--mut); }
.lbar button:hover { background: var(--s2); color: var(--text); }
.lbar button.go { background: var(--acc); color: #1b1206; font-weight: 700; flex: 1.3; }
.piece { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.piece.inev { border-color: color-mix(in srgb, var(--yellow) 45%, var(--line)); }
.phead { display: flex; align-items: center; gap: 8px; padding: 9px 8px 9px 6px; background: var(--s2); }
.phead .t { font-weight: 680; font-size: 16px; } .phead .s { font-size: 12.5px; color: var(--mut); }
.grip { cursor: grab; color: #596072; width: 24px; height: 34px; display: grid; place-items: center; touch-action: none; flex: none; }
.grip:hover { color: var(--text); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.goal { display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 4px; border-top: 1px solid var(--line); }
.goal .gt { flex: 1; min-width: 0; cursor: pointer; padding: 3px 0; }
.goal.trouble .gt { color: var(--red); } .goal.bonus .gt { color: var(--green); }
.goal.done .gt { text-decoration: line-through; opacity: .5; }
.ev { width: 28px; height: 28px; border-radius: 50%; border: 2px dashed #6a7386; display: grid; place-items: center; flex: none; font-size: 12px; font-weight: 700; }
.ev.assigned { border: 2px solid var(--text); background: var(--text); color: var(--bg); } .ev.done { border: 2px solid var(--green); color: var(--green); }
.goal.trouble .ev.assigned { background: var(--red); border-color: var(--red); color: #fff; } .goal.bonus .ev.assigned { background: var(--green); border-color: var(--green); color: #04130c; }
.ty { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; background: var(--s3); color: var(--mut); flex: none; }
.ty.spot { background: #3a2a55; color: #c9a8ff; } .ty.spread { background: #1f3d57; color: #8fd0ff; } .ty.universal { background: #4a3a14; color: var(--yellow); } .ty.once { background: #173e34; color: #7ee6c4; }
.gstats { display: flex; gap: 9px; font-size: 12px; color: var(--mut); flex: none; }
.sub { margin: 0 8px 8px 38px; padding: 7px 10px; border-radius: 9px; background: var(--s2); font-size: 14px; display: flex; gap: 8px; align-items: center; }
.sub.self { border-left: 3px solid var(--yellow); } .sub.note { border-left: 3px solid var(--blue); }
.notecard { background: var(--s1); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: var(--r); padding: 8px 8px 8px 6px; display: flex; align-items: center; gap: 8px; }
.notecard.self { border-left-color: var(--yellow); } .notecard.media { border-left-color: #b48cff; } .notecard.donec { border-left-color: var(--green); }
.notecard .tx { white-space: pre-wrap; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.evbox { border: 1.5px solid color-mix(in srgb, var(--yellow) 55%, transparent); background: color-mix(in srgb, var(--yellow) 6%, transparent); border-radius: 14px; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.evbox > .eh { display: flex; align-items: center; gap: 8px; padding: 2px 2px 2px 0; }
.evtag { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; color: var(--yellow); }
.addg { padding: 8px 12px 9px 40px; color: var(--mut); font-size: 13.5px; text-align: left; width: 100%; border-top: 1px solid var(--line); display: flex; gap: 6px; align-items: center; }
.addg:hover { color: var(--acc2); }
.dropline { height: 3px; background: var(--acc); border-radius: 2px; margin: -6px 0; pointer-events: none; }
.dragging { opacity: .35; } .droptarget { outline: 2px dashed var(--acc); outline-offset: 2px; }
.sugg { border: 1px solid var(--line); border-radius: 10px; margin-top: 6px; overflow: hidden; } .sugg button { display: flex; width: 100%; text-align: left; padding: 8px 11px; gap: 8px; border-top: 1px solid var(--line); } .sugg button:first-child { border-top: 0; } .sugg button:hover { background: var(--s2); }
mark { background: color-mix(in srgb, var(--acc) 35%, transparent); color: inherit; border-radius: 3px; }

/* practice */
.prac { height: 100dvh; display: flex; flex-direction: column; background: radial-gradient(1000px 500px at 50% -15%, #1b2233, transparent), var(--bg); }
.ptop { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 18px; padding: 4px 14px; border-radius: 99px; background: var(--s2); }
.pbar { height: 5px; background: var(--s2); } .pbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--acc), var(--yellow)); border-radius: 0 3px 3px 0; transition: width .3s; }
.pmain { flex: 1; overflow: auto; padding: 18px clamp(14px, 4vw, 40px); }
.pmain > .inner { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.ptitle { font-size: 24px; font-weight: 750; letter-spacing: -.02em; text-align: center; margin-top: 6px; } .psub { text-align: center; color: var(--mut); margin-top: -8px; }
.pgoal { background: var(--s1); border: 1.5px solid var(--line); border-radius: 16px; padding: 16px 16px; font-size: 18px; display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; transition: .12s; }
button.pgoal:hover { border-color: var(--acc); }
.pgoal.trouble { border-color: color-mix(in srgb, var(--red) 60%, transparent); } .pgoal.bonus { border-color: color-mix(in srgb, var(--green) 55%, transparent); }
.pgoal.uni { font-size: 15px; padding: 10px 14px; border-style: dashed; border-color: color-mix(in srgb, var(--yellow) 50%, transparent); }
.pgoal.done { opacity: .55; } .pgoal.done .gx { text-decoration: line-through; }
.pgoal .ck { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #6a7386; flex: none; display: grid; place-items: center; }
.pgoal.done .ck { background: var(--green); border-color: var(--green); color: #04130c; }
.pfoot { padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); display: flex; gap: 10px; align-items: center; border-top: 1px solid var(--line); background: var(--s1); }
.drill { text-align: center; } .drill img { width: min(300px, 70vw); height: min(300px, 70vw); object-fit: contain; background: #fff; border-radius: 24px; padding: 10px; }
.drill .cnt { font-size: 38px; font-weight: 800; font-variant-numeric: tabular-nums; }
.thumbs { display: flex; gap: 18px; justify-content: center; margin-top: 12px; }
.thumbs button { width: 92px; height: 92px; border-radius: 50%; font-size: 40px; display: grid; place-items: center; border: 2px solid; }
.thumbs .up { border-color: var(--green); background: color-mix(in srgb, var(--green) 15%, transparent); } .thumbs .dn { border-color: var(--red); background: color-mix(in srgb, var(--red) 15%, transparent); }
.thumbs button:active { transform: scale(.93); }
.meter { height: 12px; border-radius: 6px; background: var(--s3); overflow: hidden; max-width: 320px; margin: 8px auto; } .meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--green)); transition: width .25s; }
.cal { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; } .cal i { aspect-ratio: 1; border-radius: 4px; background: var(--s2); } .cal i.l1 { background: #1f5c46; } .cal i.l2 { background: #2a9d74; } .cal i.l3 { background: var(--green); }
.bubble { max-width: 78%; padding: 8px 12px; border-radius: 14px; background: var(--s2); white-space: pre-wrap; overflow-wrap: anywhere; } .bubble.me { background: color-mix(in srgb, var(--acc) 30%, var(--s2)); align-self: flex-end; }
.viewer { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.92); display: flex; flex-direction: column; } .viewer .vb { flex: 1; display: grid; place-items: center; overflow: auto; padding: 10px; } .viewer img, .viewer video { max-width: 100%; max-height: 100%; } .viewer iframe { width: 100%; height: 100%; border: 0; background: #fff; }
@media print {
	body { background: #fff; color: #000; } .rail, .lbar, .ib, .grip, #toasts, .noprint, .scrim > .sheet > footer { display: none !important; }
	.scrim { position: static; background: none; } .sheet { width: 100%; border: 0; background: #fff; color: #000; } .sheet > .body { overflow: visible; }
	.piece, .phead, .notecard, .card, .sub { background: #fff !important; color: #000 !important; border-color: #999 !important; } .mut, .phead .s { color: #444 !important; }
	body.printing #app { display: none; }
}
