/* =========================================================
   Flashcards page (site/ccna/flashcards/). Uses the tokens and parts in site.css.
   Header with your deck, the deck picker, the card list, your own cards, sources,
   and a round (#round), which replaces the bands while you study.
   ========================================================= */
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
code.c { font-family: var(--f-mono); font-size: .88em; background: var(--bg-2); color: var(--blue-ink); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }
.btn-s { min-height: 44px; padding: 9px 16px; font-size: 15px; box-shadow: 3px 3px 0 var(--ink); }
.btn-s:active { box-shadow: 1px 1px 0 var(--ink); }
button:disabled { cursor: default; }
.btn[hidden], .tool[hidden] { display: none; }

/* while a round is open, the page is the round: no section strip, rail or progress line */
body[data-view="run"] .now, body[data-view="run"] .rail, body[data-view="run"] .progress { display: none; }
body[data-view="run"] main > .band { display: none; }

/* every card's box, as five LEDs: blue while learning, green once solid (box 4+) */
.leds { display: inline-flex; gap: 3px; flex: none; }
.leds i { width: 7px; height: 7px; border-radius: 2px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--hair); }
.leds i.b { background: var(--blue); box-shadow: none; }
.leds i.g { background: var(--led); box-shadow: none; }

/* ---------- header: title + your deck ---------- */
.fl-head { display: grid; gap: 40px; }
@media (min-width: 1000px) { .fl-head { grid-template-columns: minmax(0, 6fr) minmax(360px, 5fr); gap: 64px; align-items: center; } }
.fl-title { font-size: clamp(40px, min(calc(10 * var(--vw)), calc(8 * var(--svh))), 72px); line-height: 1.02; letter-spacing: -.035em; max-width: 11em; text-wrap: balance; }
.fl-title em { display: block; color: var(--blue); }
.fl-sub { margin-top: 18px; font-size: 18px; color: var(--ink-2); max-width: 34em; }
.fl-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
@media (max-width: 420px) { .fl-actions .btn { flex: 1 1 100%; } }
@media (min-width: 1000px) { .fl-wrap { padding-top: clamp(40px, calc(7 * var(--svh)), 88px); padding-bottom: clamp(48px, calc(8 * var(--svh)), 96px); } }
@media (min-width: 1360px) { main > .band > .wrap { padding-right: max(var(--gutter), calc(200px - (calc(100 * var(--vw)) - var(--max)) / 2)); } }

.ledger { background: var(--card); border: 2px solid var(--ink); border-radius: var(--r-m); box-shadow: 6px 6px 0 var(--ink); overflow: hidden; }
.ledger-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--navy); color: #fff; }
.ledger-t { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #fff; }
.ledger-n { font-size: 12px; color: #C3CEEE; }
.led-list { list-style: none; margin: 0; padding: 4px 8px; }
.led-list li + li { border-top: 1px solid var(--hair); }
.led {
  width: 100%; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; grid-template-areas: "n name due" ". bar bar" ". sub sub";
  column-gap: 10px; row-gap: 5px; padding: 10px 8px; background: none; border: 0; border-radius: 8px; text-align: left; min-height: 44px;
  transition: background-color .2s;
}
.led:hover:not(:disabled) { background: var(--bg); }
.led-n { grid-area: n; font-size: 12px; font-weight: 700; color: var(--blue-ink); padding-top: 2px; }
.led-name { grid-area: name; font-family: var(--f-display); font-weight: 700; font-size: 15px; letter-spacing: -.01em; line-height: 1.25; }
.led-due { grid-area: due; font-size: 12px; font-weight: 700; color: var(--ink-3); white-space: nowrap; padding-top: 2px; }
.led-due.on { color: var(--blue); }
.led-bar { grid-area: bar; display: flex; height: 8px; border-radius: 3px; background: var(--bg-2); overflow: hidden; }
.led-bar i { height: 100%; transition: width .6s var(--ease-out); }
.led-bar .s { background: var(--led); }
.led-bar .l { background: var(--blue); }
.led-sub { grid-area: sub; font-size: 11.5px; color: var(--ink-3); }
.led-key { display: flex; gap: 14px; padding: 0 16px 10px 58px; font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.led-key span { display: inline-flex; align-items: center; gap: 6px; }
.led-key i { width: 10px; height: 8px; border-radius: 2px; }
.k-new { background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--hair); }
.k-learn { background: var(--blue); }
.k-solid { background: var(--led); }
.led-foot { padding: 14px 16px 16px; border-top: 2px solid var(--ink); background: var(--bg); font-size: 15px; color: var(--ink-2); display: grid; gap: 8px; }
.led-foot strong { color: var(--ink); }
.lf-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.lf-k { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--blue-ink); }
.lf-k + strong { margin-right: 10px; }
.lf-go { background: none; border: 0; padding: 0; min-height: 44px; color: var(--blue-ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.lf-weak { line-height: 1.45; }
/* laptops: the header fits the first screen */
@media (min-width: 1000px) and (max-height: 900px) { .led { padding: 7px 8px; row-gap: 4px; } .led-sub { display: none; } .led-foot { padding: 10px 16px 12px; } }
@media (min-width: 1000px) and (max-height: 640px) { .led { padding: 5px 8px; } .led-name { font-size: 14px; } .led-key { display: none; } .led-foot { font-size: 14px; } }

/* ---------- study: deck picker ---------- */
.decks { display: grid; gap: 10px; margin-bottom: 28px; }
@media (min-width: 340px) { .decks { grid-template-columns: 1fr 1fr; } }
@media (max-width: 559px) { .deck-b { padding: 11px 11px 10px; } .deck-name { font-size: 15px; } .deck-c { font-size: 10.5px; } }
@media (min-width: 640px) { .decks { gap: 12px; } }
@media (min-width: 1000px) { .decks { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.deck-b {
  position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "led n" "name name" "c c"; align-items: center; column-gap: 8px; row-gap: 4px;
  padding: 14px 14px 13px; min-height: 44px; text-align: left; background: var(--card); color: var(--ink);
  border: 2px solid var(--ink); border-radius: var(--r-m); box-shadow: 4px 4px 0 var(--ink);
}
.deck-b:hover:not(:disabled) { background: var(--bg); }
.deck-b:active:not(:disabled) { box-shadow: 1px 1px 0 var(--ink); }
.deck-led { grid-area: led; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); background: var(--bg-2); transition: background-color .25s; }
.deck-n { grid-area: n; font-size: 12px; font-weight: 700; color: var(--blue-ink); text-transform: uppercase; letter-spacing: .06em; }
.deck-name { grid-area: name; font-family: var(--f-display); font-weight: 800; font-size: 17px; letter-spacing: -.02em; line-height: 1.15; }
.deck-c { grid-area: c; font-size: 11.5px; color: var(--ink-3); }
.deck-b[aria-pressed="true"] { background: var(--navy); color: #fff; box-shadow: 4px 4px 0 var(--blue); }
.deck-b[aria-pressed="true"] .deck-led { background: var(--led); border-color: #fff; }
.deck-b[aria-pressed="true"] .deck-n { color: #9FB3F5; }
.deck-b[aria-pressed="true"] .deck-c { color: #C3CEEE; }
.deck-b:disabled { opacity: .55; box-shadow: none; border-style: dashed; }
.deck-mine:not([aria-pressed="true"]) { background: var(--led-wash); }
.deck-all {
  min-height: 44px; padding: 10px 14px; border: 2px dashed var(--ink-3); border-radius: var(--r-m); background: transparent; color: var(--ink-2);
  font-family: var(--f-display); font-weight: 700; font-size: 15px;
}
.deck-all:hover { border-color: var(--ink); color: var(--ink); }

.setup { display: grid; gap: 18px; padding: 18px; background: var(--bg); border: 2px solid var(--ink); border-radius: var(--r-m); }
@media (min-width: 900px) { .setup { grid-template-columns: auto auto 1fr; align-items: end; gap: 28px; padding: 20px 24px; } }
.seg { display: grid; gap: 8px; }
.seg-l { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--blue-ink); }
.seg-row { display: flex; border: 2px solid var(--ink); border-radius: var(--r-s); overflow: hidden; background: var(--card); width: max-content; max-width: 100%; }
.seg-b { min-height: 44px; min-width: 52px; padding: 8px 14px; border: 0; border-left: 2px solid var(--ink); background: none; font-family: var(--f-display); font-weight: 700; font-size: 15px; white-space: nowrap; }
.seg-b:first-child { border-left: 0; }
.seg-b:hover { background: var(--bg-2); }
.seg-b[aria-checked="true"] { background: var(--blue); color: #fff; }
.seg-b:focus-visible { outline-offset: -5px; outline-color: var(--ink); }
.seg-b[aria-checked="true"]:focus-visible { outline-color: #fff; }
.go { display: grid; gap: 12px; }
@media (min-width: 900px) { .go { justify-items: end; text-align: right; } }
.go-line { font-size: 15.5px; color: var(--ink-2); }
.go-line strong { color: var(--ink); }
.go-btns { display: flex; flex-wrap: wrap; gap: 10px; }
@media (min-width: 900px) { .go-btns { justify-content: flex-end; } }
@media (max-width: 480px) { .go-btns .btn { flex: 1 1 100%; } }

.rules { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 0; border-top: 2px solid var(--ink); max-width: 52em; }
.rules li { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--hair); font-size: 15.5px; color: var(--ink-2); }
.rule-k { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--blue-ink); }
.rules li:first-child .rule-k { color: var(--miss); }
.rules li:last-child .rule-k { color: #0A8A4A; }

/* ---------- card list ---------- */
.finder { display: grid; gap: 12px; margin-bottom: 10px; }
@media (min-width: 1000px) { .finder { grid-template-columns: minmax(240px, 340px) 1fr auto; align-items: center; gap: 18px; } }
.find { position: relative; display: block; }
.find svg { position: absolute; left: 13px; top: 50%; width: 19px; height: 19px; transform: translateY(-50%); fill: none; stroke: var(--ink-2); stroke-width: 2.2; stroke-linecap: round; pointer-events: none; }
.find input {
  width: 100%; min-height: 48px; padding: 10px 14px 10px 40px; border: 2px solid var(--ink); border-radius: var(--r-s); background: var(--card);
  font-family: var(--f-body); font-size: 16px; box-shadow: 3px 3px 0 var(--ink);
}
.find input:focus-visible { outline-offset: 2px; }
.find input::-webkit-search-cancel-button { cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 44px; min-width: 48px; padding: 8px 12px; border: 2px solid var(--ink); border-radius: 999px; background: var(--card);
  font-family: var(--f-mono); font-size: 13px; font-weight: 700;
}
.chip:hover { background: var(--bg); }
@media (max-width: 420px) { .chips { gap: 6px; } .chip { min-width: 44px; padding: 8px 6px; } }
.chip[aria-checked="true"] { background: var(--ink); color: #fff; }
.cover { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-family: var(--f-display); font-weight: 700; font-size: 15px; cursor: pointer; user-select: none; }
.cover input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cover-sw { position: relative; width: 44px; height: 26px; border: 2px solid var(--ink); border-radius: 999px; background: var(--card); transition: background-color .2s; }
.cover-sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); transition: transform .2s var(--ease-spring), background-color .2s; }
.cover input:checked + .cover-sw { background: var(--blue); }
.cover input:checked + .cover-sw::after { transform: translateX(18px); background: #fff; }
.cover input:focus-visible + .cover-sw { outline: 3px solid var(--blue); outline-offset: 3px; }
.find-n { font-size: 12px; color: var(--ink-3); margin-bottom: 18px; min-height: 18px; }

.index { display: grid; }
.grp { border-top: 2px solid var(--ink); }
.grp:last-child { border-bottom: 2px solid var(--ink); }
.grp-head { display: flex; align-items: center; gap: 10px; }
.grp-tog {
  flex: 1; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "n t chev" ". c chev"; align-items: center; gap: 2px 12px;
  padding: 12px 4px; min-height: 56px; border: 0; background: none; text-align: left;
}
@media (min-width: 760px) { .grp-tog { grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "n t c chev"; } }
.grp-n { grid-area: n; font-size: 13px; font-weight: 700; background: var(--blue); color: #fff; padding: 4px 8px; border-radius: 6px; min-width: 44px; text-align: center; }
.grp-t { grid-area: t; font-family: var(--f-display); font-size: clamp(17px, calc(2.1 * var(--vw)), 20px); font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.grp-c { grid-area: c; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.grp-chev { grid-area: chev; width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s var(--ease-out); }
.grp.open .grp-chev { transform: rotate(180deg); }
.grp-tog:hover .grp-t { color: var(--blue-ink); }
.grp-go { flex: none; min-height: 44px; padding: 6px 14px; border: 2px solid var(--ink); border-radius: 8px; background: var(--card); font-family: var(--f-display); font-weight: 700; font-size: 14px; box-shadow: 2px 2px 0 var(--ink); }
.grp-go:hover { background: var(--led-wash); }
.grp .rows { padding-bottom: 14px; }
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "q leds" "a a"; gap: 8px 14px; align-items: start;
  padding: 12px 4px; border: 0; border-bottom: 1px solid #C3D1F5; background: none; text-align: left; font-size: 16px; line-height: 1.45; min-height: 44px;
}
@media (min-width: 900px) { .row { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr) auto; grid-template-areas: "q a leds"; gap: 24px; padding: 12px 8px; } }
.row:hover { background: rgba(255, 255, 255, .5); }
.row-q { grid-area: q; font-weight: 500; color: var(--ink); }
.row-a { grid-area: a; position: relative; color: var(--ink-2); min-width: 0; }
.row .leds { grid-area: leds; margin-top: 7px; }
/* covered: the answer sits under a striped plate until you click the row */
.index:not(.bare) .row:not(.open) .row-a-in { visibility: hidden; }
.index:not(.bare) .row:not(.open) .row-a::after {
  content: "Click to uncover"; position: absolute; inset: 0; display: flex; align-items: center; padding: 0 10px; min-height: 26px;
  border-radius: 6px; font-family: var(--f-mono); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--blue-ink);
  background: repeating-linear-gradient(-45deg, var(--blue-wash) 0 8px, #CFDBFF 8px 16px);
}
.index:not(.bare) .row.open .row-a { animation: uncover .35s var(--ease-out); }
@keyframes uncover { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.none { padding: 22px; border: 2px dashed var(--ink-3); border-radius: var(--r-m); color: var(--ink-2); max-width: 640px; }

/* ---------- your cards ---------- */
.maker { margin-top: 26px; background: var(--card); border: 2px solid var(--ink); border-radius: var(--r-m); box-shadow: 6px 6px 0 var(--ink); overflow: hidden; display: grid; gap: 14px; padding: 0 16px 18px; max-width: 34em; }
.maker.editing { box-shadow: 6px 6px 0 var(--blue); }
.maker-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 -16px; padding: 10px 16px; background: var(--navy); color: #fff; }
.maker.editing .maker-bar { background: var(--blue); }
.maker-t { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.maker-n { font-size: 11px; color: #C3CEEE; }
.fld { display: grid; gap: 6px; }
.fld-l { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--blue-ink); }
.fld textarea, .fld select {
  width: 100%; padding: 10px 12px; border: 2px solid var(--ink); border-radius: var(--r-s); background: var(--bg);
  font-family: var(--f-body); font-size: 16px; line-height: 1.45; color: var(--ink); resize: vertical;
}
.fld select { min-height: 48px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.fld textarea:focus, .fld select:focus { background-color: var(--card); }
.fld-hint { font-size: 13.5px; color: var(--ink-3); }
.maker-msg, .mine-msg { font-size: 15px; min-height: 0; }
.maker-msg:empty, .mine-msg:empty { display: none; }
.maker-msg[data-kind="ok"], .mine-msg[data-kind="ok"] { color: #0A7A42; }
.maker-msg[data-kind="bad"], .mine-msg[data-kind="bad"] { color: var(--miss); }
.maker-btns { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 420px) { .maker-btns .btn { flex: 1 1 100%; } }
.undo { background: none; border: 0; padding: 0 2px; min-height: 44px; font-weight: 700; color: var(--blue-ink); text-decoration: underline; text-underline-offset: 3px; }

.mine-side { min-width: 0; }
@media (min-width: 1000px) { .mine-side { padding-top: 66px; } }
.mine-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px; margin-bottom: 14px; }
.mine-n { font-family: var(--f-display); font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.mine-n .mono { color: var(--blue); }
.mine-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.tool { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border: 2px solid var(--ink); border-radius: var(--r-s); background: var(--card); font-family: var(--f-display); font-weight: 700; font-size: 14.5px; box-shadow: 3px 3px 0 var(--ink); cursor: pointer; }
.tool:hover:not(:disabled) { background: var(--bg-2); }
.tool:active:not(:disabled) { box-shadow: 1px 1px 0 var(--ink); }
.tool:disabled { opacity: .45; box-shadow: none; }
.tool:focus-within { outline: 3px solid var(--blue); outline-offset: 3px; }
.mine-msg { margin-bottom: 12px; }
.mine-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
@media (min-width: 640px) and (max-width: 999px) { .mine-list { grid-template-columns: 1fr 1fr; } }
.mc { display: grid; gap: 8px; padding: 14px 16px; background: var(--card); border: 2px solid var(--ink); border-radius: var(--r-m); box-shadow: 4px 4px 0 var(--ink); min-width: 0; }
.mc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mc-q { font-family: var(--f-display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; line-height: 1.3; overflow-wrap: anywhere; }
.mc-a { font-size: 15.5px; color: var(--ink-2); padding-top: 8px; border-top: 1px dashed var(--hair); overflow-wrap: anywhere; }
.mc-btns { display: flex; gap: 8px; margin-top: 2px; }
.mc-b { min-height: 40px; padding: 6px 12px; border: 1.5px solid var(--ink); border-radius: 8px; background: var(--card); font-family: var(--f-display); font-weight: 700; font-size: 14px; }
.mc-b:hover { background: var(--bg-2); }
.mc-del { color: var(--miss); border-color: var(--miss); }
.mc-del:hover { background: #FBEDEB; }
.mine-empty { padding: 20px; border: 2px dashed var(--ink-3); border-radius: var(--r-m); color: var(--ink-2); display: grid; gap: 6px; }
.me-t { font-family: var(--f-display); font-weight: 800; font-size: 19px; color: var(--ink); letter-spacing: -.02em; }

/* ---------- sources ---------- */
.srcs { list-style: none; margin: 0; padding: 0; display: grid; border-top: 2px solid var(--ink); }
@media (min-width: 900px) { .srcs { grid-template-columns: 1fr 1fr; column-gap: 40px; } }
.srcs li { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--hair); font-size: 14.5px; color: var(--ink-2); }
.srcs a { color: var(--ink); text-underline-offset: 3px; }
.src-n { flex: none; font-size: 11.5px; color: var(--ink-3); }

/* ---------- a round ---------- */
.run-view { min-height: calc(calc(100 * var(--svh)) - var(--tb, 64px)); background: var(--bg); border-top: 2px solid var(--ink); padding-bottom: 64px; }
.run-strip { position: sticky; top: var(--tb, 64px); z-index: 20; background: var(--navy); color: #fff; }
.run-strip-in { max-width: var(--max); margin: 0 auto; padding: 6px var(--gutter); min-height: 56px; display: flex; align-items: center; gap: 10px 14px; }
.run-exit { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px 0 8px; border-radius: var(--r-s); border: 1.5px solid #fff; background: transparent; color: #fff; font-family: var(--f-display); font-weight: 700; font-size: 14px; white-space: nowrap; }
.run-exit:hover { background: var(--navy-2); }
.run-exit svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.run-strip :focus-visible { outline-color: var(--led); }
.run-name { flex: 1; min-width: 0; font-family: var(--f-display); font-weight: 800; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-mode { padding: 4px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--led); color: var(--ink); white-space: nowrap; }
.run-mode:empty { display: none; }
.run-mode[data-m="type"] { background: #fff; }
.run-count { font-size: 13px; color: #C3CEEE; white-space: nowrap; }
@media (max-width: 420px) { .run-mode { display: none; } }
.run-pips { display: flex; gap: 2px; height: 5px; background: var(--navy); padding: 0 0 1px; }
.run-pips i { flex: 1; background: #22357D; transition: background-color .3s; }
.run-pips i.hit { background: var(--led); }
.run-pips i.mid { background: #8FA5F0; }
.run-pips i.bad { background: var(--miss); }
.run-pips i.cur { background: #fff; }

.stage { position: relative; max-width: 680px; margin: 0 auto; padding: 28px var(--gutter) 0; display: grid; gap: 18px; }
@media (min-width: 900px) { .stage { padding-top: clamp(28px, calc(6 * var(--svh)), 56px); } }
/* the deck the card sits on */
.hold { position: relative; }
.pile { position: absolute; inset: 0; pointer-events: none; }
.pile i { position: absolute; inset: 0; border: 2px solid var(--ink); border-radius: var(--r-l); background: var(--card); }
.pile i:first-child { transform: rotate(2.2deg) translate(7px, 6px); background: var(--blue-wash); }
.pile i:last-child { transform: rotate(-1.6deg) translate(-5px, 8px); }

.card3d { position: relative; display: grid; perspective: 1400px; cursor: pointer; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; border-radius: var(--r-l); --dx: 0px; transform: translateX(var(--dx)) rotate(calc(var(--dx) / 28)); }
.card3d:focus-visible { outline-offset: 6px; }
.card3d:not(.drag) { transition: transform .3s var(--ease-spring); }
.face {
  grid-area: 1 / 1; min-height: clamp(260px, calc(42 * var(--svh)), 360px); display: flex; flex-direction: column; gap: 14px; padding: 20px 20px 18px;
  border: 2px solid var(--ink); border-radius: var(--r-l); box-shadow: 6px 6px 0 var(--ink);
  backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .55s var(--ease-out);
}
@media (min-width: 760px) { .face { padding: 26px 30px 22px; } }
.front { background: var(--card); }
.back { background: var(--navy); color: #fff; transform: rotateY(180deg); box-shadow: 6px 6px 0 var(--blue); }
.card3d.flipped .front { transform: rotateY(-180deg); }
.card3d.flipped .back { transform: rotateY(0); }
.c-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.c-tag { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--blue-ink); line-height: 1.4; }
.back .c-tag { color: var(--led); }
.c-again { align-self: flex-start; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--miss); border: 1.5px solid var(--miss); border-radius: 6px; padding: 2px 7px; }
.c-q { flex: 1; display: flex; align-items: center; font-family: var(--f-display); font-weight: 800; font-size: clamp(24px, calc(6 * var(--vw)), 34px); line-height: 1.12; letter-spacing: -.025em; text-wrap: balance; overflow-wrap: anywhere; }
.c-q code.c { font-size: .8em; }
.c-hint { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.c-qmini { font-size: 13px; color: #9FB3F5; text-align: right; max-width: 60%; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.c-qmini code.c { background: transparent; color: inherit; padding: 0; }
.c-a { flex: 1; display: flex; flex-direction: column; justify-content: center; font-family: var(--f-mono); font-weight: 700; font-size: clamp(24px, calc(6.4 * var(--vw)), 36px); line-height: 1.2; letter-spacing: -.01em; overflow-wrap: anywhere; }
.c-a.long { font-family: var(--f-body); font-weight: 500; font-size: clamp(18px, calc(4.4 * var(--vw)), 22px); line-height: 1.45; letter-spacing: 0; }
.back code.c { background: rgba(255, 255, 255, .12); color: #fff; }
.c-a:not(.long) code.c { background: none; padding: 0; font-size: 1em; }
.c-verdict { font-size: 14.5px; padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, .08); color: #DCE4FF; overflow-wrap: anywhere; }
.c-verdict[data-ok="1"] { background: var(--led); color: var(--ink); }
.c-verdict[data-ok="1"] code.c { background: rgba(255, 255, 255, .5); color: var(--ink); }
.c-src { font-size: 11px; color: #9FB3F5; letter-spacing: .04em; }
/* swiping: a stamp shows which way the card will go */
.stamp { position: absolute; top: 22px; z-index: 2; padding: 6px 12px; border: 3px solid; border-radius: 8px; font-size: 18px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: #fff; opacity: 0; transition: opacity .15s; pointer-events: none; }
.stamp-knew { left: 22px; color: #0A8A4A; border-color: var(--led); transform: rotate(-8deg); }
.stamp-miss { right: 22px; color: var(--miss); border-color: var(--miss); transform: rotate(8deg); }
.card3d[data-lean="knew"] .stamp-knew, .card3d[data-lean="miss"] .stamp-miss { opacity: 1; }
.card3d[data-lean="knew"] .back { box-shadow: 6px 6px 0 var(--led); }
.card3d[data-lean="miss"] .back { box-shadow: 6px 6px 0 var(--miss); }

.typer { display: flex; gap: 10px; }
.typer input { flex: 1; min-width: 0; min-height: 48px; padding: 10px 14px; border: 2px solid var(--ink); border-radius: var(--r-s); background: var(--card); font-family: var(--f-mono); font-size: 16px; box-shadow: 3px 3px 0 var(--ink); }
.typer[hidden] { display: none; }
.grades { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grades[hidden] { display: none; }
.gr {
  position: relative; display: grid; justify-items: center; gap: 2px; min-height: 64px; padding: 10px 6px; border: 2px solid var(--ink); border-radius: var(--r-s);
  background: var(--card); box-shadow: 4px 4px 0 var(--ink); text-align: center;
}
.gr:active { box-shadow: 1px 1px 0 var(--ink); }
.gr-l { font-family: var(--f-display); font-weight: 800; font-size: 16px; letter-spacing: -.01em; }
.gr-w { font-size: 11px; color: var(--ink-3); }
.gr-k { position: absolute; top: 6px; right: 7px; font-size: 10px; color: var(--ink-3); border: 1px solid var(--hair); border-radius: 4px; padding: 0 4px; }
@media (hover: none), (max-width: 760px) { .gr-k { display: none; } }
.gr-miss { border-color: var(--miss); box-shadow: 4px 4px 0 var(--miss); }
.gr-miss .gr-l { color: var(--miss); }
.gr-miss:hover { background: #FBEDEB; }
.gr-unsure:hover { background: var(--bg-2); }
.gr-knew { background: var(--led); }
.gr-knew .gr-w { color: #0B4D2B; }
.gr-knew .gr-k { color: #0B4D2B; border-color: #0B4D2B; }
.gr-knew:hover { background: #2BD27E; }
.gr-knew.hint { outline: 3px solid var(--led); outline-offset: 3px; }
.swipe-hint { font-size: 11px; color: var(--ink-3); text-align: center; text-transform: uppercase; letter-spacing: .06em; }

/* results */
.res { display: grid; gap: 22px; }
.stage:has(.res) { max-width: var(--max); }
@media (min-width: 1000px) { .res { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 36px; align-items: start; } }
.res-card { background: var(--card); border: 2px solid var(--ink); border-radius: var(--r-m); box-shadow: 6px 6px 0 var(--ink); padding: 20px; display: grid; gap: 14px; }
@media (min-width: 760px) { .res-card { padding: 26px; } }
.res-k { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--blue-ink); }
.res-big { font-family: var(--f-display); font-weight: 800; font-size: clamp(28px, calc(5 * var(--vw)), 40px); line-height: 1.06; letter-spacing: -.03em; }
.res-big .mono { color: #0A8A4A; }
.res-bar { display: flex; height: 12px; border-radius: 4px; overflow: hidden; background: var(--bg-2); border: 1.5px solid var(--ink); }
.res-bar i { height: 100%; }
.res-bar .k, .res-n .k { background: var(--led); }
.res-bar .u, .res-n .u { background: #8FA5F0; }
.res-bar .m, .res-n .m { background: var(--miss); }
.res-n { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); }
.res-n li { display: inline-flex; align-items: center; gap: 6px; }
.res-n i { width: 10px; height: 10px; border-radius: 2px; }
.res-line { font-size: 15.5px; color: var(--ink-2); }
.res-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
@media (max-width: 480px) { .res-btns .btn { flex: 1 1 100%; } }
.res-review { display: grid; gap: 18px; min-width: 0; }
.rv-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink); padding-bottom: 8px; border-bottom: 2px solid var(--ink); margin-bottom: 4px; }
.rv-list { list-style: none; margin: 0; padding: 0; }
.rv-list li { display: grid; gap: 4px; padding: 11px 0; border-bottom: 1px solid var(--hair); }
.rv-q { font-weight: 700; }
.rv-a { color: var(--ink-2); font-size: 15.5px; }
.rv-none { color: var(--ink-3); }

/* =========================================================
   Motion. This page's own entrances (none borrowed from the landing page or Practice Tests):
     header        the copy flips up line by line like cards turned face up; deck bars fill in turn
     study         deck buttons riffle in from alternating sides; the setup panel seats itself
     card list     rows drop down like a rolodex turning
     your cards    the form unrolls from the top; your cards are pinned on, one by one
     sources       the list inks in from the left
     a round       each new card is dealt in from the right; graded cards fly off (right if known,
                   left if missed, down if unsure); flipping turns the card over
   sections.js adds .in on the way in and removes it off screen, so entrances replay.
   Nothing moves under prefers-reduced-motion.
   ========================================================= */
@media (prefers-reduced-motion: no-preference) {
  /* ----- header ----- */
  .fx-flipup .fl-head.in .fl-copy { perspective: 900px; }
  .fx-flipup .fl-head.in .fl-copy > * { transform-origin: 50% 100%; animation: faceup .8s var(--ease-out) backwards; }
  .fx-flipup .fl-head.in .fl-copy > :nth-child(2) { animation-delay: .08s; }
  .fx-flipup .fl-head.in .fl-copy > :nth-child(3) { animation-delay: .16s; }
  .fx-flipup .fl-head.in .fl-copy > :nth-child(4) { animation-delay: .24s; }
  @keyframes faceup { from { opacity: 0; transform: rotateX(-78deg); } }
  .fx-flipup .fl-head.in .ledger { animation: slidein .7s var(--ease-out) .12s backwards; }
  @keyframes slidein { from { opacity: 0; transform: translateX(28px) rotate(1.2deg); } }
  .fx-flipup .fl-head.in .led-bar i { animation: barfill .8s var(--ease-out) backwards; animation-delay: calc(.45s + var(--i, 0) * .07s); transform-origin: 0 50%; }
  .fx-flipup .fl-head.in .led-list li:nth-child(1) .led-bar i { --i: 0; }
  .fx-flipup .fl-head.in .led-list li:nth-child(2) .led-bar i { --i: 1; }
  .fx-flipup .fl-head.in .led-list li:nth-child(3) .led-bar i { --i: 2; }
  .fx-flipup .fl-head.in .led-list li:nth-child(4) .led-bar i { --i: 3; }
  .fx-flipup .fl-head.in .led-list li:nth-child(5) .led-bar i { --i: 4; }
  .fx-flipup .fl-head.in .led-list li:nth-child(6) .led-bar i { --i: 5; }
  .fx-flipup .fl-head.in .led-list li:nth-child(7) .led-bar i { --i: 6; }
  @keyframes barfill { from { transform: scaleX(0); } }

  /* ----- study ----- */
  .fx-riffle .decks.in .deck-b, .fx-riffle .decks.in .deck-all { animation: riffle-l .6s var(--ease-out) backwards; animation-delay: calc(var(--i, 7) * .05s); }
  .fx-riffle .decks.in .deck-b:nth-child(even) { animation-name: riffle-r; }
  @keyframes riffle-l { from { opacity: 0; transform: translateX(-40px) rotate(-4deg); } }
  @keyframes riffle-r { from { opacity: 0; transform: translateX(40px) rotate(4deg); } }
  .fx-riffle .setup.in { animation: seat .6s var(--ease-out) .25s backwards; }
  @keyframes seat { from { opacity: 0; transform: translate(-8px, -8px); } }
  .fx-riffle .rules.in li { animation: fadein .6s ease backwards; }
  .fx-riffle .rules.in li:nth-child(2) { animation-delay: .1s; }
  .fx-riffle .rules.in li:nth-child(3) { animation-delay: .2s; }

  /* ----- card list ----- */
  .index, .grp .rows { perspective: 900px; }
  .fx-rolodex .index.in:not(.settled) .grp { transform-origin: 50% 0; animation: rolo .55s var(--ease-out) backwards; animation-delay: calc(var(--k, 0) * .04s); }
  .grp .rows:not([hidden]) li { animation: rolo .4s var(--ease-out) backwards; animation-delay: calc(var(--k, 0) * .025s); }
  @keyframes rolo { from { opacity: 0; transform: rotateX(-70deg); } }
  .fx-rolodex .finder.in .chip { animation: fadein .5s ease backwards; }

  /* ----- your cards ----- */
  .fx-pin .copy.in .maker { animation: unroll .8s var(--ease-out) .15s backwards; }
  @keyframes unroll { from { clip-path: inset(0 0 100% 0 round 16px); } to { clip-path: inset(0 0 -12px 0 round 16px); } }
  .fx-pin .mine-side.in .mc { animation: pin .55s var(--ease-spring) backwards; animation-delay: calc(.1s + var(--i, 0) * .07s); }
  @keyframes pin { from { opacity: 0; transform: translateY(-22px) rotate(-3deg) scale(1.03); } }
  .mc.new { animation: pin .55s var(--ease-spring); }

  /* ----- sources ----- */
  .fx-ink .srcs.in { animation: ink .9s var(--ease-out) backwards; }
  @keyframes ink { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

  /* ----- a round ----- */
  .card3d.dealt { animation: dealin .45s var(--ease-out); }
  @keyframes dealin { from { opacity: 0; transform: translateX(70px) rotate(5deg); } }
  .card3d.out { transition: transform .3s var(--ease-out), opacity .3s ease; opacity: 0; pointer-events: none; }
  .card3d.out-knew { transform: translateX(120%) rotate(12deg); }
  .card3d.out-miss { transform: translateX(-120%) rotate(-12deg); }
  .card3d.out-unsure { transform: translateY(40px) scale(.94); }
  .grades:not([hidden]) .gr { animation: fadein .3s ease backwards; }
  .grades:not([hidden]) .gr:nth-child(2) { animation-delay: .05s; }
  .grades:not([hidden]) .gr:nth-child(3) { animation-delay: .1s; }
  .res-card { animation: dealin .5s var(--ease-out); }
}
@media (prefers-reduced-motion: reduce) {
  .face, .card3d, .led-bar i { transition: none !important; }
  .index:not(.bare) .row.open .row-a { animation: none; }
}
