/* English Olympics — light theme based on the logo (royal blue + gold) */
:root {
  color-scheme: light;
  --bg: #f4f7fd;
  --card: #ffffff;
  --ink: #0f1d3d;
  --muted: #5d6b89;
  --line: #e1e7f3;
  --navy: #0b2a6f;
  --blue: #1a56db;
  --blue-d: #1442ad;
  --blue-soft: #e8efff;
  --gold: #f2b01e;
  --gold-d: #c98a00;
  --gold-soft: #fff5db;
  --silver: #b9c3cf;
  --bronze: #c77b3a;
  --green: #0f8a4a;
  --green-soft: #e1f5ea;
  --red: #d63c42;
  --red-soft: #fde8e9;
  --hot: #d9730d;
  --hot-soft: #fff0e0;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 29, 61, .05), 0 6px 18px rgba(15, 29, 61, .06);
  --display: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--body);
  font-size: 15px;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body.bare {
  background:
    linear-gradient(180deg, rgba(26, 86, 219, .10), rgba(26, 86, 219, 0) 420px),
    radial-gradient(700px 400px at 100% 100%, rgba(242, 176, 30, .14), transparent 70%),
    var(--bg);
  min-height: 100vh;
}
h1, h2, h3 { font-family: var(--display); font-weight: 800; letter-spacing: -.01em; color: var(--navy); }
h1 { font-size: 1.85rem; margin: 0 0 .25rem; line-height: 1.1; text-transform: uppercase; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; text-transform: uppercase; letter-spacing: .04em; }
h3 { font-size: 1.1rem; margin: 1rem 0 .4rem; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; letter-spacing: .06em; }
.grow { flex: 1; min-width: 0; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  padding: .55rem 1.5rem;
  background: var(--card);
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 2px 10px rgba(15, 29, 61, .05);
}
.brand { display: flex; align-items: center; gap: .65rem; color: var(--navy);
  font-family: var(--display); font-weight: 900; font-size: 1.15rem;
  text-transform: uppercase; letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.nav { display: flex; gap: .15rem; flex: 1; overflow-x: auto; }
.nav a { padding: .5rem .85rem; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: .92rem; white-space: nowrap; }
.nav a:hover { background: var(--blue-soft); text-decoration: none; color: var(--blue); }
.nav a.on { background: var(--blue); color: #fff; }
.me { display: flex; align-items: center; gap: .55rem; }
.me-name { font-weight: 600; font-size: .92rem; }
@media (max-width: 760px) {
  .topbar { padding: .5rem 1rem; gap: .6rem; }
  .brand { font-size: 1.2rem; }
  .nav { order: 3; flex-basis: 100%; }
  .me-name { display: none; }
  .me { margin-left: auto; }
}

/* ---------- Layout ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 1.75rem 1rem 4rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 .muted { color: var(--muted); font-weight: 600; }
.section-title { margin: 2.1rem 0 .8rem; display: flex; align-items: center; gap: .6rem; }
.section-title::before { content: ''; width: 4px; height: 1.1em; background: var(--gold); border-radius: 2px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.35rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.two-col { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.back { display: inline-block; margin-bottom: 1rem; font-weight: 600; font-size: .92rem; }
.empty { background: var(--card); border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 2rem; text-align: center; color: var(--muted); }
.list { list-style: none; padding: 0; margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.list li { padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }

/* ---------- Buttons & pills ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: .62rem 1.15rem; border-radius: 8px; font: 600 .92rem var(--body);
  cursor: pointer; transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { text-decoration: none; background: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-d); border-color: var(--blue-d); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: .38rem .75rem; font-size: .84rem; border-radius: 7px; }
.btn-block { width: 100%; padding: .75rem; }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .6rem; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); font-size: .76rem; font-weight: 600; color: var(--muted); white-space: nowrap; letter-spacing: .01em; }
.pill.big { font-size: .9rem; padding: .4rem .85rem; }
.pill-gold { background: var(--gold-soft); border-color: #f6dc9a; color: #8a5d00; }
.pill-green { background: var(--green-soft); border-color: transparent; color: var(--green); }
.pill-hot { background: var(--hot-soft); border-color: transparent; color: var(--hot); }
.pill-grey { opacity: .8; }

/* ---------- Flash ---------- */
.flash { padding: .8rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 500; background: var(--green-soft); color: var(--green); border-left: 4px solid var(--green); }
.flash-err { background: var(--red-soft); color: var(--red); border-left-color: var(--red); }

/* ---------- Forms ---------- */
.form { display: grid; gap: 1rem; }
.form label { display: grid; gap: .35rem; font-weight: 600; font-size: .88rem; color: var(--ink); }
.form label small { font-weight: 400; color: var(--muted); }
input, textarea, select {
  font: 400 .95rem var(--body); color: var(--ink); background: #fff;
  border: 1px solid #cfd8ea; border-radius: 8px; padding: .62rem .8rem; width: 100%;
}
input:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26, 86, 219, .15); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; align-items: end; }
.actions { display: flex; gap: .5rem; }
.upload input[type=file] { background: var(--bg); border-style: dashed; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.auth-card { width: 100%; max-width: 430px; background: var(--card); border-radius: 16px; padding: 2rem 2rem 1.75rem; box-shadow: 0 10px 40px rgba(11, 42, 111, .12); text-align: center; border-top: 4px solid var(--gold); }
.auth-card.wide { max-width: 560px; }
.auth-card .form { text-align: left; margin-top: 1.25rem; }
.auth-logo { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; margin: -.25rem auto .75rem; display: block; box-shadow: 0 8px 24px rgba(11, 42, 111, .25); }
.auth-alt { margin: 1.25rem 0 0; font-size: .92rem; }

/* ---------- Avatars ---------- */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: var(--bg); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-emoji { background: hsl(var(--h) 70% 92%); }
.avatar-sm { width: 32px; height: 32px; font-size: 18px; }
.avatar-md { width: 48px; height: 48px; font-size: 27px; }
.avatar-lg { width: 72px; height: 72px; font-size: 40px; }
.avatar-xl { width: 104px; height: 104px; font-size: 58px; }
.avatar-pick { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.avatar-pick legend { font-weight: 600; margin-bottom: .5rem; font-size: .88rem; }
.avatar-pick label { cursor: pointer; display: block; }
.avatar-pick input { position: absolute; opacity: 0; pointer-events: none; }
.avatar-pick .avatar { border: 3px solid transparent; transition: transform .1s; }
.avatar-pick label:hover .avatar { transform: scale(1.06); }
.avatar-pick input:checked + .avatar { border-color: var(--blue); transform: scale(1.08); }
.avatar-pick input:focus-visible + .avatar { outline: 3px solid var(--gold); }
.who { display: inline-flex; align-items: center; gap: .55rem; }
.profile-top { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }

/* ---------- Student hero ---------- */
.hero-card {
  position: relative; overflow: hidden;
  display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  background: linear-gradient(120deg, #1546c9 0%, #2a6cf0 60%, #4b8bff 100%);
  color: #fff; border-radius: 16px; padding: 1.6rem 1.75rem; box-shadow: 0 10px 30px rgba(21, 70, 201, .25);
  border-bottom: 4px solid var(--gold);
}
.hero-card::after { content: ''; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 255, 255, .07); pointer-events: none; }
.hero-card h1 { color: #fff; }
.hero-left { display: flex; align-items: center; gap: 1rem; }
.hero-card .avatar { border: 3px solid var(--gold); }
.eyebrow { margin: 0; opacity: .85; font-weight: 500; font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; }
.stats { display: flex; gap: .75rem; flex-wrap: wrap; position: relative; z-index: 1; }
.stat { background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .2); border-radius: 10px; padding: .7rem 1.15rem; min-width: 115px; display: grid; }
.stat-num { font-family: var(--display); font-size: 1.9rem; font-weight: 800; line-height: 1.05; }
.stat-label { font-size: .78rem; opacity: .85; text-transform: uppercase; letter-spacing: .05em; }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat-box { background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--blue); border-radius: var(--radius); padding: 1rem 1.2rem; display: grid; box-shadow: var(--shadow); }
.stat-box .stat-num { color: var(--navy); }
.stat-box .stat-label { color: var(--muted); }
.stat-box.hot { border-top-color: var(--gold); }
.stat-box.hot .stat-num { color: var(--gold-d); }

/* ---------- Tasks ---------- */
.task-card {
  display: flex; flex-direction: column; gap: .3rem;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.15rem 1.25rem; color: var(--ink); box-shadow: var(--shadow);
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.task-card:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--blue); box-shadow: 0 10px 24px rgba(26, 86, 219, .12); }
.task-card h3 { margin: .5rem 0 0; font-size: 1.08rem; }
.task-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0; font-size: .92rem; }
.task-cta { margin-top: auto; padding-top: .6rem; color: var(--blue); font-weight: 600; font-size: .9rem; }
.countdown { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-weight: 600; font-size: .82rem; color: var(--blue); background: var(--blue-soft); padding: .2rem .55rem; border-radius: 6px; white-space: nowrap; }
.countdown.urgent { color: var(--hot); background: var(--hot-soft); }
.countdown.over { color: var(--muted); background: var(--bg); }
.task-detail h1 { margin-top: .75rem; }
.prose { white-space: normal; overflow-wrap: anywhere; }
.callout { margin-top: 1.1rem; background: var(--gold-soft); border-left: 4px solid var(--gold); border-radius: 8px; padding: .9rem 1.1rem; }
.callout h3 { margin-top: 0; }
.status-line { font-weight: 600; margin: 0 0 1rem; }
.result { display: flex; gap: 1rem; align-items: center; }
.result-pts { font-family: var(--display); font-size: 2.8rem; font-weight: 700; color: var(--green); }
.result p { margin: .3rem 0 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .8rem 1rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); background: #f8faff; font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table .rank { font-family: var(--display); font-size: 1.25rem; font-weight: 700; color: var(--navy); }
.me-row { background: var(--blue-soft); }
.row-actions { display: flex; gap: .4rem; justify-content: flex-end; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.inline-rename { display: flex; align-items: center; gap: .5rem; margin: 0; }
.inline-rename input { max-width: 200px; padding: .38rem .6rem; }

/* ---------- Podium ---------- */
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 1rem; margin: 1rem 0 2rem; }
.podium-spot { display: flex; flex-direction: column; align-items: center; gap: .3rem; width: 170px; text-align: center; }
.podium-name { font-weight: 600; overflow-wrap: anywhere; }
.podium-pts { color: var(--muted); font-weight: 600; font-size: .9rem; }
.podium-block { width: 100%; border-radius: 10px 10px 0 0; display: grid; place-items: center; font-size: 2rem; margin-top: .4rem; }
.place-1 .podium-block { height: 130px; background: linear-gradient(#ffd35c, var(--gold)); }
.place-2 .podium-block { height: 95px; background: linear-gradient(#e6ebf1, var(--silver)); }
.place-3 .podium-block { height: 70px; background: linear-gradient(#e5a671, var(--bronze)); }
.place-1 .avatar { border: 4px solid var(--gold); }
.place-2 .avatar { border: 4px solid var(--silver); }
.place-3 .avatar { border: 4px solid var(--bronze); }
@media (max-width: 520px) {
  .podium { gap: .5rem; }
  .podium-spot { width: 31%; }
  .podium-spot .avatar-xl { width: 76px; height: 76px; font-size: 44px; }
  .podium-spot .avatar-lg { width: 60px; height: 60px; font-size: 34px; }
}

/* ---------- Teacher review ---------- */
.review-head, .score-who { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.review p { margin: .5rem 0; }
.note { margin: .5rem 0; padding: .6rem .9rem; border-left: 3px solid var(--blue); background: var(--bg); border-radius: 0 8px 8px 0; overflow-wrap: anywhere; font-size: .92rem; }
.grade-form { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.grade-form input { flex: 1; min-width: 140px; padding: .45rem .65rem; }
.grade-form .pts-input { flex: 0 0 90px; min-width: 0; }
.score-row.is-pending { border-left: 4px solid var(--gold); }
.mini-board { list-style: none; padding: 0; margin: 0 0 .75rem; }
.mini-board li { display: flex; align-items: center; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.mini-board .rank { width: 1.6rem; text-align: center; font-family: var(--display); font-weight: 700; color: var(--navy); }
details summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: .75rem; }

/* ---------- Student dashboard (arena) ---------- */
.arena {
  background: linear-gradient(160deg, #0d1b3e 0%, #12285a 100%);
  color: #fff; border-radius: 18px; padding: 1.6rem 1.75rem 1.75rem;
  box-shadow: 0 14px 40px rgba(11, 27, 62, .22);
}
.arena-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding-bottom: 1.25rem; margin-bottom: 1.25rem; border-bottom: 1px solid rgba(255, 255, 255, .14); }
.arena-eyebrow { margin: 0; color: #8fb0ff; font-weight: 700; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .03em; }
.arena-title { color: #fff; font-size: 2.4rem; font-weight: 900; margin: .1rem 0 .35rem; letter-spacing: -.01em; }
.arena-sub { margin: 0; color: #b8c4de; font-size: .85rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.arena-trophy { width: 54px; height: 54px; border-radius: 14px; background: rgba(143, 176, 255, .16); color: var(--gold); display: grid; place-items: center; flex-shrink: 0; }
.arena-grid { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 1rem; }
.tile { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); border-radius: 14px; padding: 1.1rem 1.25rem; display: flex; flex-direction: column; gap: .2rem; color: #fff; }
.tile-label { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: #c7d2ea; }
.tile-label.strong { color: #fff; font-weight: 800; font-size: .95rem; }
.tile-num { font-size: 2.3rem; font-weight: 900; line-height: 1.1; letter-spacing: -.02em; }
.tile-num small { font-size: 1.4rem; font-weight: 800; }
.tile-num.gold { color: var(--gold); }
.tile-sub { color: #c7d2ea; font-size: .92rem; }
.tile-next { background: linear-gradient(140deg, #24457f, #2c55a0); border-color: rgba(143, 176, 255, .25); transition: transform .12s, box-shadow .12s; }
a.tile-next:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, .25); }
.tile-next.is-empty { background: rgba(255, 255, 255, .06); }
.tile-next-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.badge-open { background: rgba(34, 197, 94, .16); color: #4ade80; font-size: .74rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: .22rem .6rem; border-radius: 999px; }
.tile-next-title { color: #fff; font-size: 1.3rem; font-weight: 800; text-transform: none; letter-spacing: -.01em; margin: .55rem 0 .2rem; }
.tile-next-desc { margin: 0; color: #dbe3f5; font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-next-foot { margin-top: auto; padding-top: .9rem; display: flex; justify-content: space-between; align-items: center; gap: .5rem 1rem; flex-wrap: wrap; }
.xp { color: var(--gold); font-weight: 900; font-size: 1.3rem; }
.deadline { font-weight: 700; display: inline-flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.arena .countdown { background: rgba(255, 255, 255, .12); color: #fff; }
.arena .countdown.urgent { background: rgba(242, 176, 30, .2); color: var(--gold); }
.xp-pill { background: var(--gold-soft); color: #8a5d00; border: 1px solid #f6dc9a; font-size: .78rem; font-weight: 800; padding: .18rem .6rem; border-radius: 6px; }

.dash-cols { display: grid; grid-template-columns: 1fr 340px; gap: 1.75rem; align-items: start; }
.dash-main > .section-title:first-child, .dash-side > .section-title:first-child { margin-top: 2rem; }
.top3 { list-style: none; padding: 0; margin: 0 0 .75rem; display: grid; gap: .6rem; }
.top3 li { display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem; border-radius: 12px; font-weight: 700; background: var(--card); border: 1px solid var(--line); }
.top3-1 { background: #f5a50b !important; border-color: #f5a50b !important; color: #1b1300; }
.top3-2 { background: #d3d8e0 !important; border-color: #d3d8e0 !important; color: #141b2b; }
.top3-3 { background: #b47a4b !important; border-color: #b47a4b !important; color: #fff; }
.top3 li.is-me { box-shadow: 0 0 0 3px var(--blue); }
.top3-medal { font-size: 1.15rem; width: 1.5rem; text-align: center; }
.top3-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top3-xp { font-weight: 800; white-space: nowrap; }
.side-link { font-weight: 600; font-size: .9rem; }

@media (max-width: 900px) {
  .arena-grid { grid-template-columns: 1fr 1fr; }
  .tile-next { grid-column: 1 / -1; }
  .dash-cols { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 520px) {
  .arena { padding: 1.25rem 1.1rem 1.25rem; border-radius: 16px; }
  .arena-title { font-size: 1.9rem; }
  .arena-grid { gap: .75rem; }
  .tile { padding: .95rem 1rem; }
  .tile-num { font-size: 1.9rem; }
  .tile-num small { font-size: 1.15rem; }
  .container { padding-top: 1rem; }
}

/* ---------- Mini ranking (Top 3) ---------- */
.mini-rank { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: .5rem; }
.mr-row { display: flex; align-items: center; gap: .65rem; padding: .7rem .75rem; border-radius: 10px; border-left: 4px solid transparent; }
.mr-row + .mr-row { margin-top: .25rem; }
.mr-row.place-1 { border-left-color: var(--gold); background: linear-gradient(90deg, #fff6dc, #fff 70%); }
.mr-row.place-2 { border-left-color: #a9b4c2; background: linear-gradient(90deg, #eef1f5, #fff 70%); }
.mr-row.place-3 { border-left-color: var(--bronze); background: linear-gradient(90deg, #f8ebe0, #fff 70%); }
.mr-row.is-open { border-left-color: var(--line); opacity: .7; }
.mr-row.is-me { box-shadow: inset 0 0 0 2px var(--blue); background: var(--blue-soft); }
.mr-self { margin-top: .6rem !important; position: relative; border-left-color: var(--blue); }
.mr-self::before { content: ''; position: absolute; left: .75rem; right: .75rem; top: -.4rem; border-top: 1px dashed var(--line); }
.mr-medal { width: 1.4rem; text-align: center; font-size: 1.15rem; }
.mr-place { width: 2.2rem; font-weight: 800; font-size: .85rem; color: var(--muted); text-transform: uppercase; }
.mr-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr-you { display: inline-block; margin-left: .3rem; background: var(--blue); color: #fff; font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: .1rem .45rem; border-radius: 999px; vertical-align: middle; }
.mr-pts { font-weight: 800; color: var(--navy); white-space: nowrap; }
.mr-pts small { font-weight: 600; color: var(--muted); font-size: .75rem; }
.mr-link { display: block; padding: .65rem .75rem .35rem; font-weight: 600; font-size: .88rem; }

/* ---------- Latest activity ---------- */
.activity { display: flex; align-items: center; gap: .9rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .85rem 1.1rem; box-shadow: var(--shadow); color: var(--ink); }
a.activity:hover { text-decoration: none; border-color: var(--blue); }
.activity-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; flex-shrink: 0; }
.activity-icon.ok { background: var(--green-soft); color: var(--green); }
.activity-icon.wait { background: var(--hot-soft); color: var(--hot); }
.activity-icon.start { background: var(--blue-soft); color: var(--blue); }
.activity-body { flex: 1; min-width: 0; display: grid; }
.activity-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-side { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; justify-content: flex-end; }
.activity-pts { font-weight: 800; color: var(--green); }
@media (max-width: 520px) {
  .activity { flex-wrap: wrap; }
  .activity-side { width: 100%; justify-content: flex-start; padding-left: calc(38px + .9rem); }
}

/* ---------- Bonus points (teacher) ---------- */
.bonus-panel { margin-bottom: 1.5rem; }
.bonus-panel .section-title { margin-top: 0; }
.bonus-form { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; margin-top: .8rem; }
.bonus-form label { display: grid; gap: .35rem; font-weight: 600; font-size: .88rem; }
.bonus-form label small { font-weight: 400; color: var(--muted); }
.bonus-form select { min-width: 200px; }
.bonus-form input[type=number] { width: 100px; }
.bonus-form .grow { flex: 1 1 220px; }
.bonus-quick { display: flex; gap: .3rem; }
.table .pos { color: var(--green); }
.table .neg { color: var(--hot); }
@media (max-width: 640px) {
  .bonus-form > * { flex: 1 1 100%; }
  .bonus-form select, .bonus-form input[type=number] { width: 100%; }
}
