/* Skewbiks.com — Algorithms reference + admin editor. */

.algwrap { max-width: 1320px; margin: 0 auto; padding: 22px 22px 80px; }
.alghead h1 { font: 700 30px var(--disp); margin: 6px 0 4px; }
.alghead .sub { color: var(--mut); max-width: 70ch; margin: 0 0 14px; }

/* top-level section tabs: one per subset */
.sectabs { display: inline-flex; gap: 4px; margin: 0 0 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 4px; }
.sectab { background: none; border: 0; color: var(--mut); font: 700 14px var(--body); padding: .5em 1.4em; border-radius: 8px; cursor: pointer; }
.sectab:hover { color: var(--txt); }
.sectab.on { color: var(--actink); background: var(--act); }

/* second-level nav: group pills + per-group dropdown (authored `nav`) */
/* page-local pills (renamed from .subnav so the navbar rule in site.css cannot leak in) */
.algsubnav { display: flex; align-items: center; gap: 14px; margin: -4px 0 14px; flex-wrap: wrap; }
.subtabs { display: inline-flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.subtab { background: none; border: 0; color: var(--mut); font: 600 13px var(--body); padding: .4em 1.1em; border-radius: 7px; cursor: pointer; }
.subtab:hover { color: var(--txt); }
.subtab.on { color: var(--actink); background: var(--act); }
.navfilter { display: inline-flex; align-items: center; gap: 8px; color: var(--mut); font: 600 12px var(--body); }
.navfilter select { background: var(--panel); color: var(--txt); border: 1px solid var(--line); border-radius: 8px;
  font: 500 13px var(--body); padding: .4em .6em; max-width: 240px; }
.navfilter select:focus { outline: none; border-color: var(--mut); }

/* toolbar */
.algtoolbar { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; flex-wrap: wrap; }
.algsearch { flex: 1; min-width: 220px; background: var(--panel); border: 1px solid var(--line2);
  color: var(--txt); border-radius: 10px; padding: .6em .9em; font: 500 15px var(--body); }
.algsearch:focus { outline: none; border-color: var(--mut); }
.algstatus { font: 500 12px var(--mono); color: var(--dim); }
.algstatus.admin { color: var(--green); }
.algstatus.err { color: var(--red); }
.export { white-space: nowrap; }

/* two-column layout: case nav + main */
.algcols { display: grid; grid-template-columns: 190px 1fr; gap: 24px; align-items: start; }
.algsidewrap { position: sticky; top: 12px; }
.algside { display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 40px); overflow: auto; padding-right: 6px; }
.navcase { display: flex; justify-content: space-between; gap: 8px; text-decoration: none; color: var(--mut);
  font: 500 13px var(--body); padding: .35em .55em; border-radius: 7px; }
.navcase:hover { color: var(--txt); background: var(--panel); }
.navcase .navct { font: 500 11px var(--mono); color: var(--dim); }

/* subset panel */
.subset { border: 1px solid var(--line); border-radius: 12px; margin: 0 0 12px; background: var(--panel); overflow: hidden; }

/* source-sheet attribution (the subset's authored `credit` block) */
.algcredit { margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--line);
  font: 500 12.5px var(--body); color: var(--mut); }
.algcredit a { color: var(--txt); text-decoration: underline; text-underline-offset: 2px; }
.algcredit a:hover { color: var(--acc, var(--txt)); }

/* case cards */
.casegrid { display: flex; flex-direction: column; gap: 0; }
.casecard { border-bottom: 1px solid var(--line); padding: 14px 16px; }
.casecard:last-child { border-bottom: 0; }
.casehd { margin: 0 0 10px; }
.casename { font: 600 15px var(--body); color: var(--txt); }
.casebody { display: flex; flex-direction: column; gap: 14px; }

/* one labelled row per presentation: diagram + heading + alg list */
.sidegrp { display: flex; gap: 18px; align-items: center; }
.algnet { width: 168px; flex: 0 0 168px; }
.algnet .skewbsvg { width: 100%; height: auto; display: block; }
.algnet.empty { height: 94px; background: var(--panel2); border-radius: 8px; }
.sidebody { flex: 1; min-width: 0; }
.sidehd { font: 600 12px var(--mono); color: var(--mut); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 6px; }
/* first-move table: the 8 possible first moves, each with its alg(s).
   The first-move keys are a fixed-width highlighted chip column so they line
   up; rotations inside the alg text are tinted blue (regrips at a glance). */
.fmtable { display: flex; flex-direction: column; gap: 3px; }
.fmrow { display: flex; align-items: first baseline; gap: 14px; }
.fmrow.empty { opacity: .45; }
.fmkey { flex: 0 0 2.4em; text-align: center; font: 700 13px var(--mono);
  border-radius: 6px; padding: 2px 0; line-height: 1.4; }
.fmrow:not(.empty) .fmkey { color: var(--actink); background: var(--act); }
.fmrow.empty .fmkey { color: var(--dim); border: 1px dashed var(--line2); padding: 1px 0; }
.fmnone { color: var(--dim); font: 500 13px var(--mono); }
.fmalgs { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.alg .tok { margin-right: .5em; display: inline-block; }
.alg .tok:last-child { margin-right: 0; }
.alg .tok.rot { color: var(--bluelt); }
.ratetag { font: 500 10px var(--mono); border: 1px solid var(--line2); border-radius: 5px; padding: 0 4px; color: var(--mut); }
.ratetag.best { color: var(--green); border-color: var(--green); opacity: .85; }
.ratetag.poor { color: var(--dim); }
.algrow { display: flex; align-items: center; gap: 8px; padding: 3px 0; break-inside: avoid; }
.algrow .alg { font: 500 16px var(--mono); color: var(--txt); }
.algrow.warn .alg { color: var(--mut); }
.addedtag { font: 500 10px var(--mono); color: var(--green); border: 1px solid var(--green); border-radius: 5px; padding: 0 4px; opacity: .8; }
.warntag { color: var(--yellow); cursor: help; }
.algrow .ord { display: inline-flex; flex-direction: column; line-height: .8; }
.algrow .ord .mv { background: none; border: 0; color: var(--dim); font-size: 11px; line-height: 1;
  cursor: pointer; padding: 0 2px; border-radius: 4px; }
.algrow .ord .mv:hover:not(:disabled) { color: var(--txt); background: var(--panel2); }
.algrow .ord .mv:disabled { opacity: .25; cursor: default; }
.algrow .rm { margin-left: auto; background: none; border: 0; color: var(--dim); font-size: 18px; line-height: 1;
  cursor: pointer; padding: 0 4px; border-radius: 5px; }
.algrow .rm:hover { color: var(--red); background: var(--panel2); }
.algrow .rm:disabled { opacity: .4; cursor: default; }

.noalgs { color: var(--dim); font: 500 13px var(--body); }

/* admin add row */
.adder { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.addin { flex: 1; min-width: 200px; background: var(--panel2); border: 1px solid var(--line2); color: var(--txt);
  border-radius: 8px; padding: .45em .7em; font: 500 13px var(--mono); }
.addin:focus { outline: none; border-color: var(--mut); }
.primary.sm, .ghost.sm { font: 600 12px var(--body); padding: .45em .9em; border-radius: 8px; cursor: pointer; }
.addfb { font: 500 12px var(--body); flex-basis: 100%; }
.addfb.ok { color: var(--green); }
.addfb.err { color: var(--red); }

.nomatch { color: var(--dim); padding: 14px 16px; font: 500 13px var(--body); }
.nomatch.big { text-align: center; padding: 40px; }
.algerr { color: var(--red); padding: 30px; text-align: center; }

@media (max-width: 760px) {
  .algcols { grid-template-columns: 1fr; }
  .algsidewrap { position: static; }
  .algside { flex-direction: row; flex-wrap: wrap; max-height: none; }
  .sidegrp { flex-direction: column; align-items: flex-start; }
  .algnet { width: 150px; flex-basis: 150px; }
}
