/*
  Boss Battle - hand-written CSS, no build step.
  Everything sized to be read from the back of the room on a projector:
  20px minimum font, buttons at least 44px tall.
*/

:root {
    --bg: #0f1020;
    --bg-soft: #191a33;
    --line: #2b2d4d;
    --text: #f4f4ff;
    --muted: #9a9cc4;
    --accent: #38bdf8;
    --good: #22c55e;
    --bad: #ef4444;
    --boss-color: #8b5cf6;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 20px;
    line-height: 1.4;
}

.battle {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

/*
  The only way out of the projected screen.
  Deliberately quiet: it must not compete with the game, but she cannot be trapped
  on this page either - the alternative was "End battle", which ends the lesson.
*/
.battle-exit {
    display: inline-block;
    margin-bottom: 10px;
    padding: 4px 10px 4px 0;
    color: var(--muted);
    text-decoration: none;
    font-size: 16px;
}

.battle-exit:hover { color: var(--text); }
.battle-exit .small { font-size: 14px; }

/* ---------- Navigation ---------- */

.nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 20px;
    padding: 10px 22px;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--line);
    font-size: 17px;
}

.nav__brand {
    font-weight: 800;
    font-size: 19px;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -.01em;
}

.nav__links, .nav__context { display: flex; align-items: center; gap: 4px; }

.nav__context {
    padding-left: 20px;
    border-left: 1px solid var(--line);
}

.nav__here {
    color: var(--muted);
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-right: 6px;
}

.nav a:not(.nav__brand) {
    padding: 6px 12px;
    border-radius: 8px;
    color: var(--muted);
    text-decoration: none;
}

.nav a:not(.nav__brand):hover { background: #262845; color: var(--text); }

.nav a.is-active {
    background: #262845;
    color: var(--text);
    font-weight: 600;
}

.nav__logout { margin-left: auto; }

.nav__logout button {
    padding: 6px 12px;
    background: transparent;
    border: 0;
    color: var(--muted);
    font-family: inherit;
    font-size: 17px;
    cursor: pointer;
}

.nav__logout button:hover { color: var(--text); text-decoration: underline; }

.label {
    display: block;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
}

.muted { color: var(--muted); }
.small { font-size: 16px; }

/* ---------- Boss ---------- */

.boss-stage {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 20px 24px 8px;
    position: relative;
    overflow: hidden;
}

.boss-stage__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.boss-stage h1 {
    margin: 2px 0 0;
    font-size: 34px;
}

.xp-counter { text-align: right; }
.xp-counter strong { font-size: 30px; font-variant-numeric: tabular-nums; }

.hpbar {
    position: relative;
    height: 34px;
    margin: 16px 0 4px;
    background: #0b0c1a;
    border: 1px solid var(--line);
    border-radius: 999px;
    overflow: hidden;
}

.hpbar__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--boss-color), #f472b6);
    transition: width .45s cubic-bezier(.2, .8, .2, 1);
}

.hpbar__text {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 17px;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
}

.boss {
    display: grid;
    place-items: center;
    padding: 4px 0;
}

.boss-figure {
    position: relative;
    width: 260px;
    height: 260px;
    animation: idle 3s ease-in-out infinite;
    transition: filter .6s ease, transform .6s ease;
}

.boss-art {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 12px 18px rgba(0, 0, 0, .55));
}

@keyframes idle {
    0%, 100% { transform: translateY(0) }
    50% { transform: translateY(-8px) }
}

/* ---------- Progressive damage ---------- */

/*
  Gashes drawn in CSS. There is no ready-made "wounded" Pokemon artwork, so a
  damage mark is a bright streak rotated over the figure, growing in opacity
  as the stage rises.
*/
.boss-wounds {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.boss-wounds span {
    position: absolute;
    left: 18%;
    width: 64%;
    height: 5px;
    border-radius: 4px;
    background: linear-gradient(90deg, transparent, #fecaca 18%, #ef4444 50%, #fecaca 82%, transparent);
    opacity: 0;
    transition: opacity .5s ease;
    box-shadow: 0 0 10px rgba(239, 68, 68, .8);
}

.boss-wounds span:nth-child(1) { top: 34%; transform: rotate(-24deg); }
.boss-wounds span:nth-child(2) { top: 52%; transform: rotate(19deg); }
.boss-wounds span:nth-child(3) { top: 68%; transform: rotate(-11deg); }

/*
  The damage transform lives on #boss (the outer element) and the idle animation
  on .boss-figure (the inner one). If both fought over the same element the
  animation would always win - keyframes beat plain declarations - and the
  wounded boss would never tilt.
*/
.boss { transition: transform .6s ease, filter .6s ease; }

/* stage 1 - scratched */
.boss--dmg-1 { filter: saturate(.92); }
.boss--dmg-1 .boss-wounds span:nth-child(1) { opacity: .75; }

/* stage 2 - wounded */
.boss--dmg-2 { filter: saturate(.75) brightness(.9); transform: rotate(-4deg); }
.boss--dmg-2 .boss-wounds span:nth-child(1),
.boss--dmg-2 .boss-wounds span:nth-child(2) { opacity: .85; }

/* stage 3 - barely standing: trembles on its own and pulses red */
.boss--dmg-3 {
    filter: saturate(.6) brightness(.8) drop-shadow(0 0 26px rgba(239, 68, 68, .75));
    transform: rotate(-8deg);
}
.boss--dmg-3 .boss-figure {
    animation: idle 3s ease-in-out infinite, tremble .45s linear infinite;
}
.boss--dmg-3 .boss-wounds span { opacity: .95; }

@keyframes tremble {
    0%, 100% { margin-left: 0 }
    25% { margin-left: -3px }
    75% { margin-left: 3px }
}

.boss-state {
    text-align: center;
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 17px;
}

.boss--dmg-3 .boss-state, .boss.is-defeated + .boss-state { color: #fca5a5; }

@keyframes hurt {
    0% { transform: translateX(0) }
    20% { transform: translateX(-12px) }
    40% { transform: translateX(10px) }
    60% { transform: translateX(-7px) }
    80% { transform: translateX(4px) }
    100% { transform: translateX(0) }
}

.boss.is-hurt .boss-figure {
    animation: hurt .4s ease;
    filter: brightness(2.4) saturate(.3) contrast(1.2);
}

/* Penalty: the boss heals. Green, rising - the visual opposite of damage. */
.boss.is-healing .boss-figure {
    filter: drop-shadow(0 0 26px var(--good)) brightness(1.15);
}

.boss.is-defeated {
    transform: rotate(96deg) translateY(30px);
    filter: grayscale(1) brightness(.5);
    opacity: .6;
    transition: all 1s cubic-bezier(.4, 0, .2, 1);
}

.boss.is-defeated .boss-figure { animation: none; }

.boss.is-defeated .boss-wounds span { opacity: .5; }

.floating {
    position: absolute;
    left: 50%;
    bottom: 30%;
    transform: translateX(-50%);
    font-size: 30px;
    font-weight: 800;
    color: var(--accent);
    text-shadow: 0 2px 8px rgba(0, 0, 0, .9);
    animation: float-up 1.5s ease-out forwards;
    pointer-events: none;
}

.floating.is-penalty { color: var(--bad); }

@keyframes float-up {
    0% { opacity: 0; transform: translate(-50%, 12px) scale(.85) }
    18% { opacity: 1; transform: translate(-50%, 0) scale(1.08) }
    100% { opacity: 0; transform: translate(-50%, -80px) scale(1) }
}

.overkill {
    text-align: center;
    color: var(--good);
    font-weight: 700;
    margin: 0 0 12px;
}

/* ---------- Pairs ---------- */

.pairs { margin-top: 20px; }
.pairs h2 { font-size: 17px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0; }

.pairs__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

/* Offline queue status: has to be discreet when all is well and impossible to
   ignore when a score is stuck. */
.queue-status {
    font-size: 15px;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid transparent;
}

.queue-status.is-ok { color: var(--muted); }

.queue-status.is-pending {
    color: #fcd34d;
    border-color: #f59e0b;
    background: rgba(245, 158, 11, .14);
    font-weight: 600;
}

/* A refused score cannot be silent: she would think the button is broken. */
.queue-status.is-problem {
    color: #fca5a5;
    border-color: var(--bad);
    background: rgba(239, 68, 68, .16);
    font-weight: 700;
}

.pair-row {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg-soft);
    margin-bottom: 8px;
}

.pair-row {
    /* The reorder settles a second after the last score, so it has to be visible
       enough for her to follow which pair moved. */
    transition: border-color .3s ease, background .3s ease;
}

.pair-row__main {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    padding: 10px 12px;
}

/* Podium badge: medal for the top three, plain position for everyone else. */
.pair-rank {
    min-width: 28px;
    flex: none;
    text-align: center;
    font-size: 17px;
    font-weight: 700;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.pair-rank.is-podium { font-size: 26px; line-height: 1; }

.pair-row.is-leader {
    border-color: #eab308;
    background: linear-gradient(90deg, rgba(250, 204, 21, .12), var(--bg-soft) 60%);
}

.pair-row.is-leader .pair-row__name { color: #fde68a; }

/*
  A trio has to fit on one line: three avatars, three names, the XP and seven
  buttons inside 1100px. So the row never wraps - it shrinks the NAME text first
  (min-width:0 + ellipsis) and only in the extreme case clips a long name, while
  the avatars keep their full size. Smaller type here buys the room for that.
*/
.pair-row__name {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
    overflow: hidden;
    font-weight: 600;
    font-size: 18px;
}

/*
  Avatar and name are one unit - they must never be split across the row, and the
  name sits level with the middle of the creature rather than at its feet.
*/
.pair-member {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

/*
  The avatar is a clickable <img>, deliberately not a <button>: a button brings the
  browser's own chrome with it, and the day the stylesheet is stale or missing every
  creature shows up boxed in grey. An image degrades to just an image.
*/
/*
  vertical-align matters more than it looks: an <img> is inline by default, so
  without it the sprite sits on the text baseline and the name hangs off its
  bottom edge. That is exactly how it looked on her screen while the stylesheet
  was stale, and this keeps it centred even if the flex rules never arrive.
*/
.avatar-card { cursor: pointer; border-radius: 8px; vertical-align: middle; }
.avatar-card:hover { background: rgba(56, 189, 248, .18); }
.avatar-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.pair-member img { width: 48px; height: 48px; flex: none; image-rendering: pixelated; vertical-align: middle; }
.pair-member__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pair-plus { color: var(--muted); font-weight: 400; flex: none; }

/*
  Narrow projector (1024x768 is still out there in schools). A trio with three long
  names runs out of room, so give some back: slightly smaller avatars and buttons
  beat truncating the names she needs to read.
*/
@media (max-width: 1150px) {
    .pair-member img { width: 42px; height: 42px; }
    .student-row__name img { width: 38px; height: 38px; }
    .pair-row__name { font-size: 17px; gap: 5px; }
    .pair-member { gap: 5px; }
    .btn--quick { min-width: 44px; font-size: 17px; padding: 10px 4px; }
    .btn--more { min-width: 38px; padding: 10px 4px; }
    .pair-row__xp { min-width: 66px; font-size: 17px; }
}
.pair-row__xp {
    min-width: 78px;
    flex: none;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    font-weight: 700;
    font-size: 18px;
}
.pair-row__actions { display: flex; gap: 4px; flex: none; }

/* Solo rows: collapsed by default so the screen does not become a wall of buttons. */
.pair-row__students { display: none; padding: 0 12px 10px 12px; }
.pair-row.is-expanded .pair-row__students { display: block; }
.pair-row.is-expanded { border-color: var(--accent); }

.student-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 7px 10px 7px 22px;
    border-top: 1px dashed var(--line);
}

.student-row__name {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    color: var(--muted);
}

.student-row__name img { width: 42px; height: 42px; image-rendering: pixelated; vertical-align: middle; }

.student-row__xp {
    min-width: 96px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-weight: 600;
}

.btn--quick-solo {
    min-width: 54px;
    min-height: 42px;
    font-size: 18px;
    background: #1b1d38;
}

.tag {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: var(--line);
    color: var(--muted);
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 8px;
    vertical-align: middle;
}

/* ---------- Buttons ---------- */

.btn {
    min-height: 46px;
    padding: 10px 18px;
    font-size: 19px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text);
    background: #262845;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover { background: #32355a; }
.btn:active { transform: translateY(1px); }

.btn--quick { min-width: 50px; padding: 10px 6px; font-size: 18px; flex: none; }
.btn--more { min-width: 42px; padding: 10px 6px; font-size: 20px; letter-spacing: 1px; flex: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #06263a; }
.btn--danger { background: transparent; border-color: var(--bad); color: #fca5a5; }
.btn--ghost { background: transparent; }
.btn--huge { min-height: 64px; font-size: 24px; padding: 0 32px; }

.battle-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 22px;
}

.battle-footer__tools { display: flex; flex-wrap: wrap; gap: 8px; }

.tag--warn { background: rgba(245, 158, 11, .2); color: #fcd34d; }

/* ---------- Modal ---------- */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(6, 7, 18, .78);
    display: grid;
    place-items: center;
    padding: 20px;
    z-index: 20;
}

.modal__box {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 24px;
    width: min(520px, 100%);
    max-height: 90vh;
    overflow-y: auto;
}

.modal__box h3 { margin: 0 0 16px; font-size: 26px; }
.modal__box label { display: block; margin: 14px 0 6px; font-size: 16px; color: var(--muted); }

.input {
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    font-size: 20px;
    font-family: inherit;
    color: var(--text);
    background: #0b0c1a;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.modal__actions { display: flex; gap: 12px; margin-top: 22px; }
.modal__actions .btn { flex: 1; }
.modal__secondary { display: flex; justify-content: space-between; margin-top: 14px; }

.error { color: #fca5a5; font-size: 16px; }

/* ---------- Rankings and lists ---------- */

.ranking, .podium { list-style: none; padding: 0; margin: 0; counter-reset: pos; }

.ranking li, .podium li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    counter-increment: pos;
}

.ranking li::before, .podium li::before {
    content: counter(pos) "º";
    color: var(--muted);
    min-width: 44px;
}

.ranking li b, .podium li b { color: var(--accent); font-variant-numeric: tabular-nums; }
.ranking li span, .podium li span { flex: 1; }

.pair-preview { list-style: none; padding: 0; margin: 24px 0; }
.pair-preview li {
    padding: 12px 16px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 22px;
}

/* ---------- Stage screens ---------- */

.stage { text-align: center; padding: 40px 0; }
.stage h1 { font-size: 40px; margin: 0 0 4px; }
.stage--result.is-win h1 { color: var(--good); }
.stage--result.is-loss h1 { color: var(--bad); }
.stage--result .podium { max-width: 520px; margin: 24px auto; text-align: left; }
.stage .btn { margin-top: 18px; }

/* ---------- Simple panel (classes) ---------- */

.panel { max-width: 900px; margin: 0 auto; padding: 24px; }
.panel h1 { font-size: 32px; }
.panel__card {
    display: block;
    padding: 18px 20px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 10px;
    color: var(--text);
    text-decoration: none;
}
.panel__card:hover { border-color: var(--accent); }

.form-login { max-width: 380px; margin: 12vh auto; padding: 24px; }
.form-login .btn { width: 100%; margin-top: 18px; }

/* ---------- Student roster ---------- */

.inline-form { display: flex; gap: 10px; align-items: center; margin: 16px 0 8px; }
.inline-form .input { flex: 1; }

textarea.input { resize: vertical; line-height: 1.5; }

.warn {
    padding: 12px 16px;
    border: 1px solid #f59e0b;
    border-radius: 10px;
    background: rgba(245, 158, 11, .12);
    color: #fcd34d;
    font-size: 17px;
}

.roster { margin: 20px 0 8px; }

.roster__row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 8px;
}

.roster__name { flex: 1; display: flex; flex-direction: column; }
.roster__name.inline-form { flex-direction: row; margin: 0; }
.roster__actions { display: flex; gap: 6px; }

.avatar-btn {
    width: 62px;
    height: 62px;
    flex: none;
    display: grid;
    place-items: center;
    padding: 0;
    background: #0b0c1a;
    border: 1px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
}

.avatar-btn:hover { border-color: var(--accent); }
.avatar-btn img { width: 56px; height: 56px; image-rendering: pixelated; }
.avatar-empty { font-size: 26px; color: var(--muted); }

.modal__box--wide { width: min(760px, 100%); }

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.avatar-option {
    display: grid;
    place-items: center;
    gap: 2px;
    padding: 8px 4px;
    background: #0b0c1a;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}

.avatar-option:hover:not(.is-taken) { border-color: var(--accent); }
.avatar-option img { width: 56px; height: 56px; image-rendering: pixelated; }
.avatar-option.is-taken { opacity: .3; cursor: not-allowed; }

/* ---------- Trophy of the day and result ---------- */

.trophy {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 16px;
    padding: 16px 20px;
    background: linear-gradient(90deg, rgba(250, 204, 21, .16), rgba(250, 204, 21, .04));
    border: 1px solid #eab308;
    border-radius: 14px;
}

.trophy__icon { font-size: 44px; line-height: 1; }
.trophy strong { display: block; font-size: 26px; }
.trophy > div:nth-child(2) { flex: 1; }
.trophy .muted { font-size: 17px; }

/* Scoring closes once the boss goes down. */
.pairs.is-locked { opacity: .5; pointer-events: none; }
.pairs.is-locked .btn { cursor: not-allowed; }

.boss-down {
    width: 210px;
    height: 210px;
    object-fit: contain;
    transform: rotate(96deg);
    filter: grayscale(1) brightness(.55);
    opacity: .6;
}

.boss-down.is-escaped { transform: none; filter: none; opacity: 1; }

.podium--medals li:nth-child(1)::before { content: "🥇"; }
.podium--medals li:nth-child(2)::before { content: "🥈"; }
.podium--medals li:nth-child(3)::before { content: "🥉"; }

.leader {
    max-width: 520px;
    margin: 26px auto 0;
    padding: 14px 18px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    text-align: left;
}

.leader__row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.leader__row img { width: 44px; height: 44px; image-rendering: pixelated; }
.leader__row strong { flex: 1; font-size: 21px; }
.leader__row b { color: var(--accent); font-variant-numeric: tabular-nums; }

/* ---------- Class campaign ---------- */

.campaign {
    margin: 18px 0 26px;
    padding: 16px 18px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.campaign__numbers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.campaign__numbers div { text-align: center; }
.campaign__numbers b { display: block; font-size: 30px; color: var(--accent); font-variant-numeric: tabular-nums; }
.campaign__numbers span { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.trophies { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 16px; }

.trophy-boss {
    display: grid;
    place-items: center;
    width: 84px;
    padding: 6px 4px;
    background: #0b0c1a;
    border: 1px solid #eab308;
    border-radius: 10px;
}

.trophy-boss img { width: 52px; height: 52px; image-rendering: pixelated; }
.trophy-boss small { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.2; }
.trophy-boss.is-escaped { border-color: var(--line); opacity: .55; }
.trophy-boss.is-escaped img { filter: grayscale(1); }

/* Lesson result in the history: has to be readable at a glance. */
.lesson-row .is-down {
    transform: rotate(90deg);
    filter: grayscale(1) brightness(.6);
    opacity: .7;
}

.outcome {
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    text-decoration: none;
}

.outcome.is-win { background: rgba(34, 197, 94, .16); border: 1px solid var(--good); color: #86efac; }
.outcome.is-loss { background: rgba(239, 68, 68, .14); border: 1px solid var(--bad); color: #fca5a5; }
.outcome.is-open { background: rgba(56, 189, 248, .14); border: 1px solid var(--accent); color: var(--accent); }

/* ---------- Battle recap ---------- */

.scoreboard {
    font-size: 16px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.scoreboard b { margin-left: 6px; }
.is-over { color: #86efac; }
.is-short { color: #fca5a5; }

.lesson-row__actions { display: flex; align-items: center; gap: 8px; }

.recap-score {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
    padding: 18px 22px;
    margin: 16px 0 26px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.recap-score.is-win { border-color: var(--good); }
.recap-score.is-loss { border-color: var(--bad); }

.recap-boss { width: 150px; height: 150px; object-fit: contain; }
.recap-boss.is-down { transform: rotate(96deg); filter: grayscale(1) brightness(.55); opacity: .6; }

.recap-score__text { flex: 1; min-width: 260px; }
.recap-score__text h2 { margin: 0 0 2px; font-size: 26px; }
.recap-score__text strong { display: block; font-size: 22px; margin-bottom: 4px; }
.recap-score__text p { margin: 0; }

.recap-sources { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 12px; }
.recap-sources span { font-size: 16px; color: var(--muted); }
.recap-sources b { color: var(--accent); font-size: 20px; }

.rank-position { min-width: 34px; color: var(--muted); font-weight: 700; }
.recap-xp { color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }

.table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 17px; }
.table th {
    text-align: left;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
}
.table td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table .ta-right { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Class challenge ---------- */

.challenges {
    margin-top: 22px;
    padding: 14px 16px;
    background: rgba(56, 189, 248, .06);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.challenge-form { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.challenge-form .input:first-child { flex: 1; min-width: 240px; }

.challenge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 8px;
}

.challenge__icon { font-size: 26px; }
.challenge__title { flex: 1; font-size: 20px; font-weight: 600; }
.challenge__xp {
    color: var(--accent);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.challenge.is-done { border-color: var(--good); background: rgba(34, 197, 94, .1); }
.challenge.is-done .challenge__title { text-decoration: line-through; color: var(--muted); }

.danger-zone {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid var(--bad);
    border-radius: 12px;
    background: rgba(239, 68, 68, .06);
}

.danger-zone .inline-form { margin: 0; }

/* ---------- Round progress ---------- */

.round-progress { display: flex; align-items: center; gap: 8px; margin: 6px 0 14px; }

.round-progress__pip {
    width: 46px;
    height: 10px;
    border-radius: 999px;
    background: #0b0c1a;
    border: 1px solid var(--line);
}

.round-progress__pip.is-done { background: var(--accent); border-color: var(--accent); }
.round-progress .btn { margin-left: 8px; }

.round-done {
    padding: 12px 16px;
    margin: 12px 0;
    border: 1px solid #eab308;
    border-radius: 12px;
    background: rgba(250, 204, 21, .12);
    color: #fde68a;
    font-weight: 600;
}

.ranking--round li.is-podium { background: rgba(250, 204, 21, .07); }
.ranking--round li.is-podium b { font-size: 22px; }

.btn--ghost.is-danger { color: #fca5a5; }
.btn--ghost.is-danger:hover { background: rgba(239, 68, 68, .16); }

/* ---------- Creature card ---------- */

.avatar-modal__box {
    display: grid;
    place-items: center;
    gap: 6px;
    width: min(420px, 100%);
    text-align: center;
}

/* Big enough to read from the back of the room - that is the whole point of it. */
.avatar-modal__sprite {
    width: 220px;
    height: 220px;
    image-rendering: pixelated;
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .55));
}

.avatar-modal__pokemon { font-size: 40px; line-height: 1.1; }
.avatar-modal__student { font-size: 26px; color: var(--accent); margin-bottom: 10px; }

.edit-class { margin: 10px 0 18px; }
.edit-class summary { cursor: pointer; color: var(--muted); font-size: 17px; }
.edit-class summary:hover { color: var(--text); }

/* ---------- Pair building ---------- */

.builder-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.builder-actions--save { margin-top: 26px; align-items: center; }

.pool { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }

.pool__item {
    display: flex;
    align-items: stretch;
    border: 2px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: #0b0c1a;
}

.pool__item.is-selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, .35);
}

.pool__pick {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px 8px 8px;
    min-height: 56px;
    background: transparent;
    border: 0;
    color: var(--text);
    font-family: inherit;
    font-size: 19px;
    font-weight: 600;
    cursor: pointer;
}

.pool__pick img { width: 40px; height: 40px; image-rendering: pixelated; }
.pool__pick:hover { background: #1b1d38; }

/* The "1" button: leaves a student solo, no partner needed. */
.pool__solo {
    width: 42px;
    border: 0;
    border-left: 1px solid var(--line);
    background: #16182e;
    color: var(--muted);
    font-family: inherit;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
}

.pool__solo:hover { background: #262845; color: var(--text); }

.groups { display: grid; gap: 8px; }

.group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px 8px 8px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.group__members { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.group__actions { display: flex; align-items: center; gap: 8px; flex: none; }

/* A group waiting to receive the selected student. */
.group.is-droppable { border-color: var(--muted); }
.group.is-droppable:hover { border-color: var(--accent); }

.btn--join { padding: 8px 14px; font-size: 17px; white-space: nowrap; }

/* Pull one student out without dismantling the whole trio. */
.member-remove {
    margin-left: 4px;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--muted);
    font-family: inherit;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

.member-remove:hover { border-color: var(--bad); color: #fca5a5; }

/* Bigger groups get a warmer accent, so the shape of the formation reads at a glance. */
.group--size-1 { border-left: 3px solid var(--line); }
.group--size-2 { border-left: 3px solid var(--accent); }
.group--size-3 { border-left: 3px solid #a855f7; }
.group--size-4 { border-left: 3px solid #eab308; }

.group__member {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 19px;
    font-weight: 600;
}

.group__member img { width: 46px; height: 46px; image-rendering: pixelated; }

/* ---------- Boss picker ---------- */

.boss-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
    margin-bottom: 18px;
}

.boss-option input { position: absolute; opacity: 0; pointer-events: none; }

.boss-option__inner {
    display: grid;
    place-items: center;
    gap: 2px;
    padding: 10px 6px;
    height: 100%;
    background: #0b0c1a;
    border: 2px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
}

.boss-option__inner img { width: 64px; height: 64px; image-rendering: pixelated; }
.boss-option__inner b { font-size: 16px; }
.boss-option__inner small { font-size: 13px; color: var(--muted); }
.boss-option__inner:hover { border-color: var(--muted); }

.boss-option input:checked + .boss-option__inner {
    border-color: var(--boss-color);
    background: color-mix(in srgb, var(--boss-color) 14%, #0b0c1a);
    box-shadow: 0 0 0 1px var(--boss-color);
}

.boss-option input:focus-visible + .boss-option__inner { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Avatars inside the battle and the rankings */
.pair-avatars { display: inline-flex; gap: 2px; vertical-align: middle; margin-right: 8px; }
.pair-avatars img { width: 54px; height: 54px; image-rendering: pixelated; }
.ranking img.mini { width: 42px; height: 42px; image-rendering: pixelated; vertical-align: middle; margin-right: 8px; }
