/* eLesson — teacher area */
:root {
  --bg: #121a26; --panel: #1a2433; --panel-2: #213045; --line: #2c3c54;
  --text: #ece6d8; --muted: #8d98ab; --cream: #e9d6a9; --sel: #7aa8ff; --ok: #5fd08a; --warn: #f2b84b; --err: #ff6b6b;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--sel); }
:focus-visible { outline: 2px solid var(--sel); outline-offset: 3px; }
[hidden] { display: none !important; }

header.top { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px clamp(16px, 4vw, 36px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand svg { width: 30px; height: 30px; fill: var(--cream); }
.brand b { display: block; font-size: 19px; line-height: 1; letter-spacing: .01em; }
.brand span { display: block; font-size: 12px; color: var(--muted); }
.head-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; height: 36px; }
.lang button { border: none; background: transparent; padding: 0 12px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.lang button + button { border-left: 1px solid var(--line); }
.lang button.on { background: var(--panel-2); color: var(--cream); }
.btn {
  height: 38px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; white-space: nowrap; text-decoration: none; color: var(--text);
}
.btn:hover:not(:disabled) { border-color: #3d5272; background: #29405e; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--cream); border-color: var(--cream); color: #1b1608; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: #f4e4bd; }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: rgba(255,107,107,.45); color: var(--err); }
.btn.danger:hover:not(:disabled) { background: rgba(255,107,107,.12); }
.btn.small { height: 32px; padding: 0 11px; font-size: 13px; }
.btn svg, .icon { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }

/* ---------- login (playful, space theme) ---------- */
.sky { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.sky i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff; opacity: .35; animation: twinkle 3.2s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .05; transform: scale(.6); } }
.deco { position: fixed; z-index: -1; pointer-events: none; animation: floaty 7s ease-in-out infinite; }
.deco.d1 { left: 7%; top: 22%; width: 70px; }
.deco.d2 { right: 8%; top: 16%; width: 54px; animation-delay: -2s; animation-duration: 8s; }
.deco.d3 { left: 12%; bottom: 14%; width: 38px; animation-delay: -4s; }
.deco.d4 { right: 13%; bottom: 20%; width: 64px; animation-delay: -1s; animation-duration: 9s; }
@keyframes floaty { 50% { transform: translateY(-14px) rotate(6deg); } }

main.center { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px clamp(16px, 4vw, 36px) 50px; }
.login { width: min(460px, 100%); text-align: center; }
.hero-star { width: 64px; height: 64px; margin: 0 auto 10px; animation: spinslow 14s linear infinite; }
@keyframes spinslow { to { transform: rotate(360deg); } }
.login h1 { font-size: clamp(26px, 5vw, 34px); font-weight: 700; margin: 0 0 8px; line-height: 1.2; }
.login .sub { color: var(--muted); margin: 0 0 24px; }
.card {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 26px; padding: 26px 24px 24px;
  box-shadow: 0 30px 80px rgba(0,0,0,.35); text-align: left; overflow: hidden;
}
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: linear-gradient(90deg, #ff6b6b, #f2c94c, #5fd08a, #7aa8ff, #c59cf2); }
.card.bounce { animation: bounce .55s cubic-bezier(.2,.9,.3,1.6); }
@keyframes bounce { 40% { transform: scale(1.03); } }
.field-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.email-group { display: flex; align-items: stretch; height: 54px; border: 2px solid var(--line); border-radius: 16px; background: var(--bg); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.email-group:focus-within { border-color: var(--sel); box-shadow: 0 0 0 4px rgba(122,168,255,.15); }
.email-group.bad { border-color: var(--err); box-shadow: 0 0 0 4px rgba(255,107,107,.12); }
.email-group input { flex: 1; min-width: 0; border: none; background: transparent; padding: 0 4px 0 16px; font-size: 18px; outline: none; }
.email-group .domain { display: flex; align-items: center; padding: 0 14px 0 2px; color: var(--muted); font-size: 16px; white-space: nowrap; pointer-events: none; }
.msg { min-height: 22px; font-size: 13.5px; margin: 8px 2px 14px; }
.msg.err { color: var(--err); }
.msg.ok { color: var(--ok); font-weight: 600; }

.slider {
  position: relative; height: 66px; border-radius: 999px; border: 2px solid var(--line); overflow: hidden;
  user-select: none; -webkit-user-select: none; touch-action: none;
  background: radial-gradient(circle at 20% 40%, rgba(255,255,255,.25) 0 1px, transparent 1.5px) 0 0 / 34px 26px,
              radial-gradient(circle at 70% 75%, rgba(255,255,255,.18) 0 1px, transparent 1.5px) 0 0 / 46px 30px, #0d1420;
}
.slider .fill { position: absolute; inset: 0 auto 0 0; width: 66px; border-radius: 999px; opacity: .42;
  background: linear-gradient(90deg, #ff6b6b, #f2c94c, #5fd08a, #7aa8ff, #c59cf2); }
.slider .label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 0 64px; font-size: 15px; font-weight: 600; color: var(--muted); pointer-events: none; text-align: center; line-height: 1.2; }
.slider.ready .label {
  color: transparent; background: linear-gradient(90deg, var(--muted) 0 40%, #fff 50%, var(--muted) 60% 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; animation: shine 2.4s linear infinite;
}
@keyframes shine { from { background-position: 125% 0; } to { background-position: -125% 0; } }
.planet { position: absolute; right: 8px; top: 50%; width: 46px; height: 46px; margin-top: -23px; opacity: .35; filter: grayscale(.7); transition: opacity .3s, filter .3s, transform .3s; }
.slider.ready .planet { opacity: 1; filter: none; animation: wobble 4s ease-in-out infinite; }
@keyframes wobble { 50% { transform: rotate(-10deg) scale(1.05); } }
.knob { position: absolute; top: 4px; left: 4px; width: 54px; height: 54px; border-radius: 50%; border: none; padding: 0; background: #26364d; display: grid; place-items: center; cursor: not-allowed; z-index: 2; }
.knob .rocket { width: 44px; height: 44px; filter: grayscale(1); opacity: .55; transition: filter .3s, opacity .3s; overflow: visible; }
.knob .flame { opacity: 0; transform-origin: 14px 24px; }
.slider.ready .knob { background: #fff7e0; cursor: grab; box-shadow: 0 4px 16px rgba(0,0,0,.4), 0 0 0 4px rgba(242,201,76,.25); }
.slider.ready .knob .rocket { filter: none; opacity: 1; animation: hover 1.6s ease-in-out infinite; }
@keyframes hover { 50% { transform: translateY(-3px) rotate(-4deg); } }
.slider.dragging .knob, .slider.busy .knob { cursor: grabbing; }
.slider.busy .knob, .slider.done .knob, .slider.shake .knob { background: #fff7e0; }
.slider.busy .knob .rocket, .slider.done .knob .rocket, .slider.shake .knob .rocket { filter: none; opacity: 1; }
.slider.busy .planet, .slider.done .planet, .slider.shake .planet { opacity: 1; filter: none; }
.slider.dragging .knob .flame, .slider.busy .knob .flame { opacity: 1; animation: flicker .12s steps(2) infinite; }
@keyframes flicker { 50% { transform: scaleX(1.35); } }
.slider.busy .knob .rocket { animation: rumble .1s linear infinite; }
@keyframes rumble { 50% { transform: translate(1px, -1px); } }
.slider.back .knob, .slider.back .fill { transition: left .45s cubic-bezier(.2,.9,.3,1.3), width .45s cubic-bezier(.2,.9,.3,1.3); }
.slider.done { border-color: var(--ok); }
.slider.done .knob .rocket { animation: launch .7s cubic-bezier(.5,0,.8,.4) forwards; }
.slider.done .knob .flame { opacity: 1; }
@keyframes launch { to { transform: translate(90px, -70px) rotate(-35deg) scale(.6); opacity: 0; } }
.slider.done .planet { animation: glow .7s ease-out; }
@keyframes glow { 50% { transform: scale(1.3); filter: drop-shadow(0 0 12px #f2c94c); } }
.slider.shake { animation: shake .45s; border-color: var(--err); }
.slider.shake .knob .rocket { animation: dizzy .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
@keyframes dizzy { 25% { transform: rotate(-25deg); } 75% { transform: rotate(25deg); } }
.confetti { position: fixed; width: 9px; height: 13px; border-radius: 2px; pointer-events: none; z-index: 100; }
.back-link { display: inline-block; margin-top: 22px; color: var(--muted); font-size: 14px; text-decoration: none; }
.back-link:hover { color: var(--text); }
@media (max-width: 640px) { .deco { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .sky i, .deco, .hero-star, .slider.ready .planet, .slider.ready .knob .rocket, .slider.ready .label, .card.bounce { animation: none; }
  .slider.ready .label { color: var(--text); background: none; }
}

/* ---------- dashboard ---------- */
.who { text-align: right; line-height: 1.25; }
.who b { display: block; font-size: 14px; }
.who span { font-size: 12px; color: var(--muted); }
main.dash { flex: 1; width: min(1100px, 100%); margin: 0 auto; padding: 26px clamp(16px, 4vw, 36px) 50px; display: flex; flex-direction: column; gap: 26px; }
.dash h1 { margin: 0; font-size: clamp(22px, 3vw, 28px); font-weight: 600; }
.dash h2 { margin: 0 0 4px; font-size: 18px; font-weight: 600; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.upload-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 20px; margin-top: 14px; }
.name-field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.name-field input { width: 100%; height: 46px; padding: 0 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-size: 16px; }
.name-field input:focus { outline: none; border-color: var(--sel); }
.path-preview { margin-top: 10px; font-size: 13px; color: var(--muted); word-break: break-all; }
.path-preview code { color: var(--cream); font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.drop {
  border: 2px dashed var(--line); border-radius: 14px; min-height: 150px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; padding: 18px; text-align: center; transition: border-color .15s, background .15s;
}
.drop.over { border-color: var(--cream); background: rgba(233,214,169,.06); }
.drop.has { border-style: solid; border-color: rgba(95,208,138,.5); }
.drop p { margin: 0; color: var(--muted); font-size: 14px; }
.drop .picked { color: var(--text); font-weight: 600; }
.drop-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.upload-actions { display: flex; align-items: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.progress { flex: 1; min-width: 200px; }
.bar { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.bar div { height: 100%; width: 0; background: var(--cream); transition: width .2s; }
.progress small { display: block; margin-top: 5px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hint { margin: 12px 0 0; font-size: 13px; color: var(--muted); line-height: 1.55; }

.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.lessons { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.lesson { display: grid; grid-template-columns: 1fr auto; gap: 14px 20px; padding: 18px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); }
.lesson h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.lesson .url { display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; min-width: 0; }
.lesson .url a { color: var(--cream); font-family: ui-monospace, Consolas, monospace; font-size: 13px; word-break: break-all; text-decoration: none; }
.lesson .url a:hover { text-decoration: underline; }
.copy { flex: none; width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.copy:hover { color: var(--text); border-color: #3d5272; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.expiry { font-weight: 600; color: var(--ok); }
.expiry.soon { color: var(--warn); }
.expiry.urgent { color: var(--err); }
.lesson-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; justify-content: flex-end; max-width: 330px; }
.empty-list { padding: 30px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 14px; }

/* modal */
.modal-back { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(8,12,18,.7); backdrop-filter: blur(3px); padding: 16px; }
.modal { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.modal h2 { margin: 0; font-size: 18px; }
.modal p { margin: 0; color: var(--muted); font-size: 14px; }
.qr-box { background: #fff; border-radius: 12px; padding: 14px; display: grid; place-items: center; }
.qr-box canvas { width: 100%; max-width: 300px; height: auto; image-rendering: pixelated; }
.qr-url { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; color: var(--cream); word-break: break-all; text-align: center; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; pointer-events: none; }
.toast { max-width: 380px; padding: 10px 14px; border-radius: 9px; background: #26364d; border-left: 3px solid var(--cream); box-shadow: 0 10px 30px rgba(0,0,0,.35); font-size: 14px; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: none; }
.toast.warn { border-left-color: var(--warn); } .toast.err { border-left-color: var(--err); }
footer.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 20px 20px; }

@media (max-width: 820px) {
  .upload-grid { grid-template-columns: 1fr; }
  .lesson { grid-template-columns: 1fr; }
  .lesson-acts { justify-content: flex-start; max-width: none; }
  .who { display: none; }
}
@media (prefers-reduced-motion: reduce) { .slider.ready .label { animation: none; color: var(--text); background: none; } .slider.shake { animation: none; } }
