.level-step { border-left: 4px solid var(--bs-secondary-bg); padding-left: 1rem; }
.level-step.completed { border-color: var(--ok); }
.level-step.current { border-color: var(--accent); }
.level-step.locked { opacity: .55; }
.skill-card.locked { opacity: .6; }
.skill-card { transition: transform .1s; }
.skill-card:hover { transform: translateY(-2px); }
.stat { font-size: 2.2rem; font-weight: 700; color: var(--accent); line-height: 1; font-family: var(--font-display); }
video { width: 100%; max-height: 70vh; background: #000; border-radius: .5rem; }

/* ---- path graph ---- */
.path-graph-wrap { overflow-x: auto; }
.path-graph { width: 100%; max-width: 1100px; height: auto; display: block; margin: 0 auto; }
.pg-edge { fill: none; stroke-width: 2.5; }
.pg-edge-done { stroke: var(--bs-success); }
.pg-edge-active { stroke: var(--accent); }
.pg-edge-locked { stroke: var(--bs-secondary-color); stroke-dasharray: 6 6; opacity: .5; }
.pg-arrow-done { fill: var(--bs-success); }
.pg-arrow-active { fill: var(--accent); }
.pg-arrow-locked { fill: var(--bs-secondary-color); opacity: .5; }
.pg-disc { stroke-width: 3; fill: var(--bs-body-bg); }
.pg-inner { fill: none; stroke-width: 1; stroke-dasharray: 3 4; opacity: .6; }
.pg-icon { font-family: "bootstrap-icons"; text-anchor: middle; dominant-baseline: central; }
.pg-label { fill: var(--bs-body-color); font-size: 15px; font-weight: 600; text-anchor: middle; }
.pg-label-lg { font-size: 19px; }
.pg-sub { fill: var(--bs-secondary-color); font-size: 13px; text-anchor: middle; }
.pg-completed .pg-disc, .pg-completed .pg-inner { stroke: var(--bs-success); }
.pg-completed .pg-icon { fill: var(--bs-success); }
.pg-available .pg-disc, .pg-available .pg-inner { stroke: var(--accent); }
.pg-available .pg-icon { fill: var(--accent); }
.pg-available .pg-halo { fill: none; stroke: var(--accent); stroke-width: 2; animation: pg-pulse 2s ease-in-out infinite; }
.pg-pending .pg-disc, .pg-pending .pg-inner { stroke: var(--bs-warning); }
.pg-pending .pg-icon { fill: var(--bs-warning); }
.pg-locked { opacity: .45; }
.pg-locked .pg-disc, .pg-locked .pg-inner { stroke: var(--bs-secondary-color); }
.pg-locked .pg-icon { fill: var(--bs-secondary-color); }
.pg-level .pg-disc { stroke-width: 4; }
.pg-finish.pg-completed .pg-icon { fill: #ffc107; }
.pg-link { text-decoration: none; }
.pg-link .pg-node { cursor: pointer; transition: transform .15s; transform-box: fill-box; transform-origin: center; }
.pg-link:hover .pg-disc { fill: var(--bs-secondary-bg); }
.pg-key { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 3px solid; vertical-align: -1px; }
.pg-key.pg-completed { border-color: var(--bs-success); }
.pg-key.pg-available { border-color: var(--accent); }
.pg-key.pg-pending { border-color: var(--bs-warning); }
.pg-key.pg-locked { border-color: var(--bs-secondary-color); opacity: 1; }
@keyframes pg-pulse { 0%, 100% { opacity: .25; } 50% { opacity: .9; } }
@media (prefers-reduced-motion: reduce) { .pg-available .pg-halo { animation: none; opacity: .6; } }

/* ---- 7-day activity chart (status colors: good / warning / critical) ---- */
:root { --st-good: var(--ok); --st-warning: var(--warn); --st-critical: var(--bad); }
.ac-wrap { position: relative; }
.ac-chart { width: 100%; height: auto; display: block; overflow: visible; }
.ac-axis { stroke: var(--bs-border-color); stroke-width: 1; }
.ac-hit { fill: transparent; }
.ac-col:hover .ac-hit, .ac-col:focus .ac-hit { fill: var(--bs-secondary-bg); opacity: .5; }
.ac-col:focus { outline: none; }
.ac-approved { fill: var(--st-good); }
.ac-pending { fill: var(--st-warning); }
.ac-rejected { fill: var(--st-critical); }
.ac-cap { fill: var(--bs-body-color); font-size: 13px; font-weight: 600; text-anchor: middle; font-variant-numeric: tabular-nums; }
.ac-day { fill: var(--bs-secondary-color); font-size: 12px; text-anchor: middle; }
.ac-today { fill: var(--bs-body-color); font-weight: 600; }
.ac-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: 0; }
.ac-swatch.ac-approved { background: var(--st-good); }
.ac-swatch.ac-pending { background: var(--st-warning); }
.ac-swatch.ac-rejected { background: var(--st-critical); }
.ac-icon-approved { color: var(--st-good); }
.ac-icon-pending { color: var(--st-warning); }
.ac-icon-rejected { color: var(--st-critical); }
.ac-tip { position: absolute; pointer-events: none; z-index: 5; min-width: 160px; padding: .5rem .65rem;
  font-size: .8rem; background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color); border-radius: .4rem;
  box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.ac-table td, .ac-table th { font-variant-numeric: tabular-nums; }

/* ---- dashboard ---- */
.note-item { display: flex; gap: .65rem; padding: .6rem .75rem; text-decoration: none; color: inherit; border-bottom: 1px solid var(--bs-border-color); }
.note-item:last-child { border-bottom: 0; }
.note-item:hover { background: var(--bs-tertiary-bg); }
.note-item.unread { background: rgba(255, 106, 0, .07); }
.note-item.unread .note-msg { font-weight: 600; }
.note-icon { font-size: 1.1rem; line-height: 1.3; }
.note-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; margin-top: .45rem; }
.ac-legend > span { white-space: nowrap; display: inline-block; }
@media (max-width: 576px) {
  /* SVG text is in viewBox units; bump it so it stays ~11px when the chart shrinks */
  .ac-cap { font-size: 20px; }
  .ac-day { font-size: 17px; }
  }

/* Focus rings on links: only after the visitor starts using the keyboard on this page
   (html.kbd is set by base.html), so a page load or Back navigation never leaves a stray ring. */
html:not(.kbd) a:focus { outline: none; box-shadow: none; }
html.kbd a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: .375rem; box-shadow: none; }

.ai-pre { white-space: pre-wrap; max-height: 260px; overflow: auto; font-size: .75rem; background: var(--bs-tertiary-bg); padding: .5rem; border-radius: .375rem; }

/* ---- calmer layout ---- */
.page-narrow { max-width: 860px; margin: 0 auto; }
.week-numbers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.week-numbers .n { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.week-numbers .l { color: var(--bs-secondary-color); font-size: .85rem; }
.level-fold > summary { list-style: none; cursor: pointer; }
.level-fold > summary::-webkit-details-marker { display: none; }
.level-fold .fold-icon { transition: transform .15s; }
.level-fold[open] .fold-icon { transform: rotate(180deg); }
.level-fold:not([open]) > summary { border-bottom: 0; }
.bulk-bar { position: sticky; top: .5rem; z-index: 20; display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap; padding: .6rem 1rem; margin-bottom: 1rem; border-radius: .5rem;
  background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color); box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.bulk-bar[hidden] { display: none; }

/* ---- prizes ---- */
.prize-card { overflow: hidden; }
.prize-card.is-affordable { border-color: color-mix(in srgb, var(--accent) 55%, var(--bs-border-color)); }
.prize-img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--bs-tertiary-bg); }
.prize-img-empty { display: flex; align-items: center; justify-content: center; font-size: 3rem; color: var(--bs-secondary-color); }
.prize-thumb { width: 64px; height: 48px; object-fit: cover; border-radius: .375rem; background: var(--bs-tertiary-bg); flex: none; }
.prize-thumb.prize-img-empty { font-size: 1.4rem; }
.prize-cost { white-space: nowrap; font-weight: 700; }
.prize-cost .bi { color: var(--st-warning); }
.prize-desc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.qr-img { width: 100%; max-width: 240px; background: #fff; padding: 8px; border-radius: .5rem; }

/* ======================================================================
   Phones (iPhone mini / SE / 16e = 375 px). Everything below applies only
   under 576 px wide, so desktop and tablet layouts are untouched.
   ====================================================================== */
@media (max-width: 575.98px) {
  main.container { padding-top: 1.25rem; }

  /* path graph: on phones keep labels readable and scroll sideways instead (elsewhere it scales to fit) */
  .path-graph { min-width: var(--pg-min); }

  /* login: the drone sits above the headline instead of on top of it */
  .auth-wrap { min-height: auto; }
  .auth-hero { padding: 1.5rem; min-height: auto; }
  .auth-hero svg.hero-drone { position: static; width: 112px; margin-bottom: 1rem; }
  .auth-hero h1 { font-size: 1.7rem; }
  .auth-form { padding: 1.5rem; }

  /* tabs scroll sideways instead of wrapping onto a second line */
  .nav-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tabs .nav-link { white-space: nowrap; }

  /* wide tables become one card per row, each value with its label */
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: .75rem;
    padding: .4rem .9rem; background: var(--surface); }
  .table-stack td { border: 0; padding: .3rem 0; text-align: right; overflow: hidden; }
  .table-stack td::before { content: attr(data-label); float: left; margin-right: 1rem; padding-top: .15rem;
    text-align: left; color: var(--ink-3);
    font-family: var(--font-display); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; }
  .table-stack td:not([data-label])::before { content: none; }
  .table-stack td:empty { display: none; }
  .table-stack td.stack-action { padding-top: .5rem; }
  .table-stack td.stack-full { display: block; text-align: left; }

  /* admin prize requests: note box on its own line, buttons below */
  .request-actions input[name="note"] { width: 100% !important; flex: 1 1 100%; }
  .request-actions .btn { flex: 1 1 auto; }

  /* a little more room inside cards */
  .card-body { padding: .95rem 1rem; }
  .list-group { --bs-list-group-item-padding-x: .9rem; }
}

/* ---- leadership / engagement ---- */
.stat-tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1rem; }
.stat-tiles .n { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat-tiles .l { color: var(--ink-2); font-size: .8rem; }
@media (max-width: 991.98px) { .stat-tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 575.98px) { .stat-tiles { grid-template-columns: repeat(2, 1fr); } }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: .75rem; align-items: flex-start; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline li > .bi { font-size: 1.05rem; line-height: 1.5; width: 1.2rem; text-align: center; flex: none; }
.rank-name { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; color: var(--accent); line-height: 1.1; }
.rank-xp { font-family: var(--font-display); font-weight: 700; }
.streak-nudge { padding: .55rem .75rem; border-radius: 10px; background: rgba(251, 191, 36, .1);
  border: 1px solid rgba(251, 191, 36, .3); color: var(--warn); font-size: .9rem; }

/* Admin → Activity: the "details" panel of one event */
.activity-details { display: grid; grid-template-columns: max-content 1fr; gap: .15rem .75rem; margin-top: .4rem; }
.activity-details dt { color: var(--ink-2); font-weight: 600; }
.activity-details dd { margin: 0; overflow-wrap: anywhere; }
details > summary { cursor: pointer; }
.activity-table a { text-decoration: none; }
.activity-table a:hover { text-decoration: underline; }

/* "Log in as": always visible while an admin is acting as someone else */
.impersonation-bar { background: var(--warn); color: #1d1300; padding: .5rem 0; margin: 0 0 1rem;
  font-size: .9rem; position: sticky; top: 0; z-index: 1030; }
.impersonation-bar .btn-dark { background: #1d1300; border-color: #1d1300; color: var(--warn); }

/* Decision history of a submission (admin review page + student attempts) */
.decisions { list-style: none; margin: 0; padding: 0; position: relative; }
.decisions::before { content: ""; position: absolute; left: 13px; top: 14px; bottom: 14px; width: 2px; background: var(--line); }
.decision { display: flex; gap: .75rem; padding: .35rem 0; position: relative; }
.decision-dot { flex: 0 0 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .85rem;
  background: var(--surface); border: 2px solid var(--line); color: var(--ink-2); z-index: 1; }
.decision.ok .decision-dot { border-color: var(--ok); color: var(--ok); }
.decision.bad .decision-dot { border-color: var(--bad); color: var(--bad); }
.decision.warn .decision-dot, .decision.waiting .decision-dot { border-color: var(--warn); color: var(--warn); }
.decision-body { flex: 1; min-width: 0; padding-top: .2rem; }
.decision-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem .75rem; font-size: .9rem; }
.decision-head time { font-size: .8rem; white-space: nowrap; }
.decision-comment { margin: .35rem 0 .35rem; padding: .45rem .7rem; border-left: 3px solid var(--line);
  background: rgba(148, 163, 194, .06); border-radius: 0 8px 8px 0; font-size: .9rem; overflow-wrap: anywhere; }
.decision.ok .decision-comment { border-left-color: var(--ok); }
.decision.bad .decision-comment { border-left-color: var(--bad); }
.attempt.current { border-color: var(--accent); }

/* Show/hide eye inside password fields */
.pw-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
.pw-wrap > input { padding-right: 2.6rem; }
.pw-toggle { position: absolute; top: 50%; right: .35rem; transform: translateY(-50%); width: 2rem; height: 2rem;
  display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); }
.pw-toggle:hover { color: var(--ink); background: rgba(148, 163, 194, .1); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
