/* Link maker (#/links) and Leaderboard (#/leaderboard), round C 2026-10-25. Uses the shadcn tokens (css/shadcn.css),
   light + dark. Phones: one column from 560 px down, nothing wider than the screen. Motion: the bars grow in and
   re-sort; prefers-reduced-motion turns every transition and animation off. */

/* ================================================================ link maker */
.lm-view { display: grid; gap: 16px; min-width: 0; }
.lm-top { display: grid; gap: 16px; min-width: 0; max-width: 960px; }
.lm-form { display: grid; gap: 22px; min-width: 0; }
.lm-step { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 10px; }
.lm-step[hidden] { display: none; }
.lm-step__title { display: flex; align-items: center; gap: 9px; padding: 0; margin-bottom: 2px; font: 600 14.5px var(--f-body); color: var(--ink); }
.lm-step__n { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--on-ink); font: 600 11.5px var(--f-mono); flex: none; }

.lm-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.lm-tile { position: relative; display: grid; justify-items: center; align-content: center; gap: 8px; min-height: 88px; padding: 12px 6px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--paper); cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.lm-tile__radio { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.lm-tile:hover { border-color: var(--dash); }
.lm-tile:has(:checked) { border-color: var(--red); background: var(--red-soft); box-shadow: inset 0 0 0 1px var(--red); }
.lm-tile:has(:focus-visible) { outline: 2px solid var(--ring); outline-offset: 2px; }
.lm-tile__logo { display: grid; place-items: center; height: 30px; }
.lm-tile__logo .logo { height: 28px; max-width: 76px; }
.lm-tile__logo .logo--skool { height: 17px; }
.lm-tile__name { font: 500 12.5px var(--f-body); color: var(--ink); }
.lm-otherlogo { display: inline-grid; place-items: center; color: var(--ink-2); }
.lm-tile__logo .lm-otherlogo .icon { width: 26px; height: 26px; }
.lm-otherlogo.logo--sm .icon { width: 16px; height: 16px; }

.lm-field { display: grid; gap: 6px; min-width: 0; }
.lm-field[hidden], .lm-block[hidden] { display: none; }
.lm-field__label { font: 500 12.5px var(--f-body); color: var(--ink-2); }
.lm-input { width: 100%; min-width: 0; }
.lm-input[aria-invalid="true"] { border-color: var(--red); }
.lm-hint { margin: 0; color: var(--muted); font-size: 12.5px; }
.lm-err { margin: 0; color: var(--red-ink); font-size: 12.5px; font-weight: 500; }
.lm-hint:empty, .lm-err:empty { display: none; }
.lm-sub { margin: 4px 0 0; font: 500 12px var(--f-body); color: var(--muted); }
.lm-block { display: grid; gap: 10px; min-width: 0; }
.lm-grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

.lm-videos { display: grid; gap: 6px; max-height: 330px; overflow: auto; padding: 2px; }
.lm-video { position: relative; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; min-width: 0; }
.lm-video input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.lm-video:hover { border-color: var(--dash); }
.lm-video:has(:checked) { border-color: var(--red); background: var(--red-soft); }
.lm-video:has(:focus-visible) { outline: 2px solid var(--ring); outline-offset: 2px; }
.lm-video .thumb--row { width: 80px; }
.lm-video__text { display: grid; gap: 1px; min-width: 0; }
.lm-video__text b { font: 600 13.5px var(--f-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lm-video__text small { color: var(--muted); font-size: 12px; }

.lm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lm-chip { position: relative; }
.lm-chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.lm-chip span { display: inline-flex; align-items: center; min-height: 34px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-strong); font: 500 13px var(--f-body); color: var(--ink-2); }
.lm-chip:has(:checked) span { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.lm-chip:has(:focus-visible) span { outline: 2px solid var(--ring); outline-offset: 2px; }

.lm-dests { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.lm-dests[hidden] { display: none; }
.lm-dest { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer; min-width: 0; }
.lm-dest input { margin: 3px 0 0; accent-color: var(--red); flex: none; }
.lm-dest:has(:checked) { border-color: var(--red); background: var(--red-soft); }
.lm-dest__text { display: grid; gap: 2px; min-width: 0; font-size: 13.5px; }
.lm-dest__text small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.lm-docdest { margin: 0; }
.lm-docdest[hidden] { display: none; }

.lm-preview { display: grid; gap: 6px; padding: 12px 14px; border-radius: 10px; background: var(--paper-2); border: 1px dashed var(--line-strong); min-width: 0; }
.lm-preview__link { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0; }
.lm-preview__link code { font-size: 14.5px; color: var(--ink); overflow-wrap: anywhere; min-width: 0; }
.lm-preview__label { font-size: 12px; color: var(--muted); }
.lm-preview__meta { margin: 0; font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.lm-tags summary, .lm-more summary { cursor: pointer; font-size: 12.5px; color: var(--muted); width: fit-content; }
.lm-tags dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; margin: 6px 0 0; }
.lm-tags dt { color: var(--muted); font-size: 12px; }
.lm-tags dd { margin: 0; font-size: 12px; overflow-wrap: anywhere; }
.lm-dup { display: grid; gap: 8px; padding: 12px 14px; border-radius: 10px; background: var(--tag-risky-bg); color: var(--tag-risky-fg); font-size: 13.5px; }
.lm-dup[hidden], .lm-formerr[hidden], .lm-result[hidden], .lm-form[hidden] { display: none; }
.lm-dup p { margin: 0; overflow-wrap: anywhere; }
.lm-dup .btn--text { color: inherit; text-decoration: underline; }
.lm-formerr { margin: 0; }
.lm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lm-save .icon, .lm-copy .icon, .lm-copyrow .icon { width: 16px; height: 16px; }

.lm-result { display: grid; gap: 12px; min-width: 0; }
.lm-result__head { display: flex; align-items: center; gap: 10px; }
.lm-result__what { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.lm-copyrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--paper-2); border: 1px solid var(--line-strong); min-width: 0; }
.lm-copyrow__link { flex: 1 1 200px; min-width: 0; font-size: 15.5px; color: var(--ink); overflow-wrap: anywhere; }
.lm-copyrow--sm { margin-top: 8px; padding: 8px 10px; }
.lm-copyrow--sm .lm-copyrow__link { font-size: 12.5px; }
.lm-copyrow__label { flex: none; font-size: 12px; color: var(--muted); }
.lm-gate:empty { display: none; }
.lm-gate .notice { margin: 0; }

/* the list */
.lm-listsec { display: grid; gap: 10px; min-width: 0; }
.lm-listsec__head { margin: 6px 0 0; }
.lm-toolbar { margin-bottom: 0; }
.lm-filter-q { flex: 1 1 240px; min-width: 0; }
.lm-search { min-height: 36px; }
.lm-kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.lm-kind { display: inline-flex; align-items: center; gap: 6px; }
.lm-kind .logo--sm { height: 14px; }
.lm-kind .logo--sm.logo--skool { height: 10px; }
.lm-kind__n { font: 500 11px var(--f-mono); opacity: 0.7; }
.lm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lm-item { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto auto; align-items: center; gap: 10px 18px; padding: 12px 14px; background: var(--paper); border-radius: var(--radius); box-shadow: var(--card-shadow); min-width: 0; }
.lm-item.is-off .lm-item__main, .lm-item.is-off .lm-item__logo, .lm-item.is-off .lm-item__nums { opacity: 0.55; }
.lm-item__logo { display: grid; place-items: center; }
.lm-item__logo .logo--skool { height: 10px; }
.lm-item__main { display: grid; gap: 3px; min-width: 0; }
.lm-item__title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0; font: 600 14px var(--f-body); overflow-wrap: anywhere; }
.lm-item__title a { color: inherit; text-decoration: none; }
.lm-item__title a:hover { text-decoration: underline; }
.lm-item__where { margin: 0; font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.lm-item__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0; font-size: 12px; }
.lm-by { display: inline-flex; align-items: center; gap: 6px; }
.lm-item__go { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lm-item__go code { font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.lm-item__nums { display: flex; gap: 16px; margin: 0; }
.lm-item__nums div { display: grid; justify-items: end; }
.lm-item__nums dt { font-size: 11px; color: var(--muted); }
.lm-item__nums dd { margin: 0; font: 600 15px var(--f-mono); }
.lm-item__own { display: flex; align-items: center; gap: 2px; }
.lm-switch { position: relative; flex: none; width: 38px; height: 22px; margin-right: 6px; padding: 0; border: 0; border-radius: 99px; background: var(--track); cursor: pointer; }
.lm-switch[aria-checked="true"] { background: var(--lime); }
.lm-switch__dot { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: transform .18s var(--ease); }
.lm-switch[aria-checked="true"] .lm-switch__dot { transform: translateX(16px); }
.lm-del { color: var(--red-ink); }
.lm-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 8px; min-width: 0; }
.lm-more-btn { justify-self: start; }

@media (max-width: 1100px) {
  .lm-item { grid-template-columns: 30px minmax(0, 1fr) auto; }
  .lm-item__go { grid-column: 2; }
  .lm-item__nums { grid-column: 3; grid-row: 1; }
  .lm-item__own { grid-column: 2 / -1; justify-content: flex-start; }
  .lm-edit { grid-column: 2 / -1; }
}
@media (max-width: 720px) { .lm-grid3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) {
  .lm-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lm-tile { min-height: 76px; }
  .lm-item { grid-template-columns: 26px minmax(0, 1fr); gap: 8px 10px; padding: 12px; }
  .lm-item__nums { grid-column: 2; grid-row: auto; }
  .lm-item__nums div { justify-items: start; }
  .lm-edit { grid-template-columns: minmax(0, 1fr); }
  .lm-dests { grid-template-columns: minmax(0, 1fr); }
}

/* ================================================================ leaderboard */
.lb-view { display: grid; gap: 16px; min-width: 0; }
.lb-toolbar { margin-bottom: 0; }
.lb-range { display: flex; flex-wrap: wrap; align-items: center; }
.lb-metrics { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; width: fit-content; max-width: 100%; border-radius: 12px; background: var(--paper-2); box-shadow: 0 0 0 1px var(--line); }
.lb-metric { min-height: 36px; padding: 6px 16px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: 600 13.5px var(--f-body); cursor: pointer; }
.lb-metric:hover { color: var(--ink); }
.lb-metric.is-on { background: var(--paper); color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong), 0 1px 3px rgba(0, 0, 0, 0.12); }
.lb-stage { display: grid; gap: 18px; min-width: 0; overflow: hidden; }
.lb-stage .card__head { margin: 0; }
.lb-sub { white-space: nowrap; }

/* podium: 2 · 1 · 3 */
.lb-podium { display: flex; justify-content: center; align-items: flex-end; gap: 14px; list-style: none; margin: 0; padding: 6px 0 0; }
.lb-podium[hidden] { display: none; }
.lb-pod { display: grid; justify-items: center; gap: 4px; flex: 0 1 160px; min-width: 0; text-align: center; animation: lb-rise .6s var(--ease) both; }
.lb-pod--1 { order: 2; animation-delay: .1s; }
.lb-pod--2 { order: 1; animation-delay: .25s; }
.lb-pod--3 { order: 3; animation-delay: .4s; }
.lb-pod__face { position: relative; margin-bottom: 4px; }
.lb-pod__av { width: 64px; height: 64px; font-size: 20px; border: 3px solid var(--line-strong); }
.lb-pod--1 .lb-pod__av { width: 86px; height: 86px; font-size: 26px; }
.lb-pod--gold .lb-pod__av { border-color: #ffd60a; box-shadow: 0 0 0 5px rgba(255, 214, 10, 0.18); }
.lb-pod--silver .lb-pod__av { border-color: #c4c7cf; box-shadow: 0 0 0 5px rgba(196, 199, 207, 0.16); }
.lb-pod--bronze .lb-pod__av { border-color: #d08a4b; box-shadow: 0 0 0 5px rgba(208, 138, 75, 0.16); }
.lb-pod__medal { position: absolute; right: -4px; bottom: -4px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--paper); font-size: 12.5px; font-weight: 700; background: #c4c7cf; color: #18181b; }
.lb-pod--gold .lb-pod__medal { background: #ffd60a; color: #1a1500; }
.lb-pod--bronze .lb-pod__medal { background: #d08a4b; color: #1d0f02; }
.lb-pod__name { font: 600 14px var(--f-body); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-pod__val { font: 700 18px var(--f-mono); letter-spacing: -0.02em; }
.lb-pod--1 .lb-pod__val { font-size: 23px; }
.lb-pod__step { width: 100%; height: 30px; margin-top: 6px; border-radius: 10px 10px 0 0; border: 1px solid var(--line); border-bottom: 0; background: linear-gradient(180deg, var(--paper-2), transparent); }
.lb-pod--1 .lb-pod__step { height: 62px; background: linear-gradient(180deg, rgba(255, 214, 10, 0.2), transparent); border-color: rgba(255, 214, 10, 0.35); }
.lb-pod--2 .lb-pod__step { height: 44px; }
@keyframes lb-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* the bars: the photo rides at the bar end */
.lb-chart { --av: 40px; position: relative; list-style: none; margin: 0; padding: 0; min-width: 0; }
.lb-chart[hidden] { display: none; }
.lb-row { position: absolute; top: 0; left: 0; right: 0; display: grid; grid-template-columns: 26px 128px minmax(0, 1fr) 88px; align-items: center; gap: 12px; height: 48px; transition: transform .6s var(--ease); }
.lb-row__rank { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 12.5px; color: var(--muted); }
.lb-row.is-lead .lb-row__rank { background: #ffd60a; color: #1a1500; font-weight: 700; }
.lb-row__name { font: 600 13.5px var(--f-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-row.is-me .lb-row__name::after { content: ' (you)'; color: var(--muted); font-weight: 500; }
.lb-row__track { position: relative; display: flex; align-items: center; height: 44px; min-width: 0; }
.lb-row__bar { --p: 0; position: relative; display: block; height: 26px; width: calc(var(--av) + (100% - var(--av)) * var(--p)); border-radius: 999px;
  background: linear-gradient(90deg, rgba(184, 162, 240, 0.35), var(--lilac)); transition: width .9s var(--ease); }
.lb-row.is-lead .lb-row__bar { background: linear-gradient(90deg, #e00000, #ff6a00 60%, #ffbf00); }
.lb-row__face { position: absolute; right: 0; top: 50%; width: var(--av); height: var(--av); transform: translateY(-50%); border: 3px solid var(--paper); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35); font-size: 13px; }
.lb-row__val { font: 700 15px var(--f-mono); text-align: right; letter-spacing: -0.02em; }
.lb-chart.is-racing .lb-row { transition: transform .35s var(--ease); }
.lb-chart.is-racing .lb-row__bar { transition: width .28s linear; }
.lb-empty { margin: 0; color: var(--muted); text-align: center; font-size: 13.5px; }
.lb-empty[hidden] { display: none; }
.lb-race { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.lb-play .icon { width: 14px; height: 14px; }
.lb-slider { flex: 1 1 160px; min-width: 0; accent-color: var(--red); }
.lb-day { min-width: 52px; font-size: 13px; color: var(--ink-2); }
.lb-tablesec { display: grid; gap: 10px; min-width: 0; }
.lb-tablesec .card__head { margin: 6px 0 0; }
.lb-table th[scope="row"] { text-align: left; font-weight: 400; }
.lb-table th.is-on, .lb-table td.is-on { color: var(--ink); background: var(--hover); }
.lb-table tr.is-me th, .lb-table tr.is-me td { background: var(--hover); }
.lb-rules { margin: 0; max-width: 900px; }

/* phones: the table becomes one card per person, six numbers in a 3 x 2 grid */
@media (max-width: 760px) {
  table.leads.lb-table tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; margin-bottom: 10px; padding: 12px 14px; border-radius: 14px; background: var(--paper); box-shadow: var(--card-shadow); }
  table.leads.lb-table tr.is-me { box-shadow: 0 0 0 1px var(--line-strong); }
  table.leads.lb-table th[scope="row"] { grid-column: 1 / -1; display: block; padding: 0 0 4px; border: 0; background: none; }
  table.leads.lb-table td { display: grid; gap: 1px; width: auto; padding: 0; border: 0; text-align: left; background: none; font-size: 15px; }
  table.leads.lb-table td[data-label]::before { content: attr(data-label); color: var(--muted); font: 500 11px var(--f-body); letter-spacing: 0; text-transform: none; }
  table.leads.lb-table td.is-on { color: var(--ink); font-weight: 700; }
  table.leads.lb-table td:nth-child(n) { grid-column: auto; grid-row: auto; }
}
@media (max-width: 560px) {
  .lb-chart { --av: 32px; }
  .lb-row { grid-template-columns: 24px minmax(0, 1fr) auto; grid-template-rows: 16px 32px; gap: 0 10px; height: 48px; }
  .lb-row__rank { grid-row: 1 / 3; }
  .lb-row__name { grid-column: 2; grid-row: 1; font-size: 12.5px; }
  .lb-row__val { grid-column: 3; grid-row: 1; font-size: 13px; }
  .lb-row__track { grid-column: 2 / 4; grid-row: 2; height: 32px; }
  .lb-row__bar { height: 18px; }
  .lb-pod { flex-basis: 104px; }
  .lb-pod__av { width: 52px; height: 52px; }
  .lb-pod--1 .lb-pod__av { width: 68px; height: 68px; }
  .lb-pod__val { font-size: 15px; }
  .lb-pod--1 .lb-pod__val { font-size: 18px; }
  .lb-metric { padding: 6px 11px; }
  .lb-sub { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .lb-row, .lb-row__bar, .lb-chart.is-racing .lb-row, .lb-chart.is-racing .lb-row__bar, .lm-tile, .lm-switch__dot { transition: none; }
  .lb-pod { animation: none; }
}
