:root {
  --bg: #0b0d1a;
  --bg2: #12152a;
  --card: rgba(24, 27, 48, .94);
  --card-b: rgba(255, 255, 255, .10);
  --text: #eef0ff;
  --muted: #9aa0c3;
  --acc: #ffd166;       /* лунный жёлтый */
  --acc2: #8b7bff;      /* фиолетовый */
  --acc3: #3ee6c1;      /* мятный */
  --bad: #ff6b8b;
  --ok: #3ee6c1;
  --radius: 18px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f4ff; --bg2: #ffffff; --card: rgba(255, 255, 255, .85); --card-b: rgba(40, 30, 120, .10);
    --text: #1b1838; --muted: #5d5a80; --acc: #e0a100; --acc2: #6a55ff; --acc3: #0aa984; --bad: #e0315a; --ok: #0aa984;
    --shadow: 0 8px 30px rgba(60, 40, 160, .10);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
}
/* звёзды */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1px 1px at 10% 20%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 70% 15%, #fff9 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 40% 70%, #fff7 50%, transparent 51%),
    radial-gradient(1px 1px at 85% 60%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 25% 85%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 60% 40%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 92% 88%, #fff7 50%, transparent 51%),
    radial-gradient(900px 500px at 85% -10%, rgba(139, 123, 255, .22), transparent 60%),
    radial-gradient(700px 400px at -10% 110%, rgba(62, 230, 193, .12), transparent 60%);
  background-size: 300px 300px, 400px 400px, 350px 350px, 500px 500px, 450px 450px, 380px 380px, 420px 420px, auto, auto;
}
@media (prefers-color-scheme: light) { body::before { opacity: .5; filter: invert(1) hue-rotate(180deg); } }

a { color: var(--acc2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, .brand { font-family: 'Unbounded', 'Manrope', sans-serif; letter-spacing: -.01em; line-height: 1.2; }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin: .2em 0 .4em; }
h2 { font-size: 1.3rem; margin: 1.6em 0 .6em; }
h3 { font-size: 1.05rem; margin: 0 0 .4em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
header.top {
  position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  border-bottom: 1px solid var(--card-b);
}
header.top .wrap { display: flex; align-items: center; gap: 16px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.brand svg { width: 34px; height: 34px; }
nav.links { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
nav.links a, nav.links button {
  color: var(--muted); padding: 7px 12px; border-radius: 10px; font: inherit; font-size: .93rem;
  background: none; border: 0; cursor: pointer;
}
nav.links a:hover, nav.links button:hover { color: var(--text); background: var(--card); text-decoration: none; }
main { padding: 28px 0 70px; }

.card {
  background: var(--card); border: 1px solid var(--card-b); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 11px 20px; border-radius: 12px; border: 0; cursor: pointer; font: inherit; font-weight: 700;
  color: #14102e; background: linear-gradient(135deg, var(--acc), #ffb347);
  box-shadow: 0 6px 20px rgba(255, 209, 102, .25); transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; box-shadow: 0 10px 26px rgba(255, 209, 102, .35); }
.btn.alt { background: linear-gradient(135deg, var(--acc2), #b06bff); color: #fff; box-shadow: 0 6px 20px rgba(139, 123, 255, .3); }
.btn.ghost { background: var(--card); color: var(--text); border: 1px solid var(--card-b); box-shadow: none; }
.btn.sm { padding: 7px 12px; font-size: .88rem; border-radius: 10px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }

form.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: .93rem; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; padding: 11px 13px; border-radius: 11px; font: inherit; color: var(--text);
  background: var(--bg2); border: 1px solid var(--card-b); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--acc2); box-shadow: 0 0 0 3px rgba(139, 123, 255, .2); }
textarea { min-height: 90px; resize: vertical; }

.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-weight: 600; }
.flash.ok { background: rgba(62, 230, 193, .12); border: 1px solid rgba(62, 230, 193, .35); }
.flash.err { background: rgba(255, 107, 139, .12); border: 1px solid rgba(255, 107, 139, .4); }

.auth { max-width: 440px; margin: 30px auto; }

/* лендинг */
.hero { display: grid; grid-template-columns: 1.2fr .8fr; gap: 30px; align-items: center; padding: 30px 0 10px; }
.hero h1 { font-size: clamp(2rem, 5.5vw, 3.4rem); }
.hero .grad { background: linear-gradient(90deg, var(--acc), var(--acc2), var(--acc3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 560px; }
.moon { width: 100%; max-width: 340px; justify-self: center; animation: float 6s ease-in-out infinite; filter: drop-shadow(0 20px 60px rgba(255, 209, 102, .25)); }
@keyframes float { 50% { transform: translateY(-12px) rotate(-2deg); } }
.features { margin-top: 40px; }
.feature .ico { font-size: 1.8rem; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; } .moon { max-width: 220px; order: -1; } }

/* курс */
.course-head { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.ring {
  --p: 0; width: 112px; height: 112px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--acc) calc(var(--p) * 1%), rgba(255, 255, 255, .08) 0);
  display: grid; place-items: center; position: relative;
}
.ring::after { content: ''; position: absolute; inset: 10px; border-radius: 50%; background: var(--bg); }
.ring span { position: relative; z-index: 1; font-family: 'Unbounded', sans-serif; font-weight: 700; font-size: 1.15rem; text-align: center; line-height: 1.1; }
.ring span small { display: block; font-size: .62rem; color: var(--muted); font-family: 'Manrope'; font-weight: 600; }
.stat { display: grid; gap: 2px; }
.stat b { font-family: 'Unbounded', sans-serif; font-size: 1.4rem; }

.hw { position: relative; display: flex; flex-direction: column; gap: 10px; color: var(--text); transition: transform .15s, border-color .15s; }
.hw:hover { transform: translateY(-3px); border-color: rgba(139, 123, 255, .5); text-decoration: none; }
.hw .num { font-family: 'Unbounded', sans-serif; font-size: .8rem; color: var(--acc2); font-weight: 700; letter-spacing: .06em; }
.bar { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--acc3), var(--acc)); }
.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 700; background: var(--card); border: 1px solid var(--card-b); }
.pill.ok { color: var(--ok); border-color: rgba(62, 230, 193, .4); }
.pill.warn { color: var(--acc); border-color: rgba(255, 209, 102, .4); }
.pill.bad { color: var(--bad); border-color: rgba(255, 107, 139, .4); }
.pill.draft { color: var(--muted); }

/* задание / тест */
.files { display: flex; flex-wrap: wrap; gap: 10px; }
.files a { display: inline-flex; gap: 8px; align-items: center; padding: 9px 14px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--card-b); color: var(--text); font-weight: 600; font-size: .92rem; }
.files a:hover { border-color: var(--acc2); text-decoration: none; }
.section-title { font-family: 'Unbounded', sans-serif; font-size: .95rem; color: var(--acc); margin: 26px 0 10px; }
.q { margin-bottom: 14px; }
.q .qtext { white-space: pre-wrap; font-weight: 600; margin-bottom: 10px; }
.q .meta { font-size: .8rem; color: var(--muted); margin-bottom: 6px; display: flex; gap: 10px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-radius: 10px; cursor: pointer; font-weight: 500; border: 1px solid transparent; }
.opt:hover { background: rgba(139, 123, 255, .08); }
.opt input { margin-top: 4px; accent-color: var(--acc2); width: 17px; height: 17px; flex: none; }
.opt.correct { border-color: rgba(62, 230, 193, .5); background: rgba(62, 230, 193, .08); }
.opt.wrongpick { border-color: rgba(255, 107, 139, .5); background: rgba(255, 107, 139, .08); }
.q.is-ok { border-left: 4px solid var(--ok); }
.q.is-bad { border-left: 4px solid var(--bad); }
.result { text-align: center; padding: 30px 20px; }
.result .big { font-family: 'Unbounded', sans-serif; font-size: 3rem; font-weight: 800; }
.sticky-submit { position: sticky; bottom: 14px; display: flex; justify-content: center; margin-top: 20px; }
.sticky-submit .pill { background: var(--bg2); padding: 10px 16px; font-size: .88rem; box-shadow: var(--shadow); text-align: center; }

/* таблицы */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--card-b); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--card-b); white-space: nowrap; }
th { color: var(--muted); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr.me td { background: rgba(255, 209, 102, .09); }
.medal { font-size: 1.15rem; }
td.total { font-family: 'Unbounded', sans-serif; font-weight: 700; }

details.adm { border: 1px solid var(--card-b); border-radius: 14px; padding: 12px 16px; margin-bottom: 10px; background: var(--card); }
details.adm summary { cursor: pointer; font-weight: 700; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
details.adm form { margin-top: 14px; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .cols2 { grid-template-columns: 1fr; } }
.code { font-family: ui-monospace, monospace; font-size: 1.1rem; font-weight: 700; letter-spacing: .1em; color: var(--acc); }
.checks { display: flex; gap: 18px; flex-wrap: wrap; }
.checks label { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.scale { display: flex; gap: 6px; }
.scale label { display: block; }
.scale input { position: absolute; opacity: 0; pointer-events: none; }
.scale span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; border: 1px solid var(--card-b); background: var(--bg2); cursor: pointer; font-weight: 700; }
.scale input:checked + span { background: linear-gradient(135deg, var(--acc2), #b06bff); color: #fff; border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { display: block; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips span { display: inline-block; padding: 9px 14px; border-radius: 99px; border: 1px solid var(--card-b); background: var(--bg2); cursor: pointer; font-weight: 600; font-size: .9rem; }
.chips input:checked + span { background: linear-gradient(135deg, var(--acc), #ffb347); color: #14102e; border-color: transparent; }
.chips input:focus-visible + span, .scale input:focus-visible + span { outline: 2px solid var(--acc2); outline-offset: 2px; }
@media (max-width: 640px) {
  header.top .wrap { height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; gap: 6px; }
  .brand span { font-size: .95rem; }
  nav.links { margin-left: 0; width: 100%; gap: 2px; }
  nav.links a, nav.links button { padding: 6px 9px; font-size: .86rem; }
  nav.links .btn.sm { margin-left: auto; }
  .card { padding: 16px; }
  .result .big { font-size: 2.4rem; }
}
footer { color: var(--muted); font-size: .85rem; padding: 30px 0; text-align: center; }
th.n:first-child, td.n:first-child { width: 56px; }
