/* Expert residency: loaded only on its Learn page, after style.css. */
.er-phase { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 30px; }
.er-phase .label { margin: 0 4px 0 0; }
.chip.er-mode { font-size: 12px; }
.chip.er-mode.populate { border-color: var(--red); color: var(--red); }
.chip.er-mode.reuse { border-color: var(--soft); color: var(--soft); border-style: dashed; }
.chip.er-route { font-size: 12px; }
.chip.er-route.hit { border-color: var(--red); color: var(--red); }
.chip.er-route.miss { border-color: var(--purple); color: var(--purple); }
.chip.er-route.host { border-style: dashed; color: var(--soft); }

.er-dir { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 2fr) minmax(0, 2fr); gap: 14px; align-items: stretch; }
.er-group { display: grid; grid-template-rows: auto 1fr; gap: 8px; padding: 10px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); transition: border-color .3s, box-shadow .3s; }
.er-group.kv, .er-group.ws { border-style: dashed; }
.er-group.claim { border-color: var(--purple); box-shadow: 0 0 0 3px var(--glow); }
.er-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; min-height: 30px; }
.er-head .label { margin: 0; line-height: 1.35; }
.er-legend { display: inline-flex; align-items: center; gap: 5px; font: 10.5px var(--mono); color: var(--quiet); }
.er-sw { display: inline-block; width: 14px; height: 6px; border-radius: 2px; background: var(--soft); }
.er-sw.scales { width: 8px; height: 4px; margin-left: 6px; }
.er-slots { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; align-items: end; }

.er-slot { position: relative; display: grid; gap: 4px; padding: 8px 7px 7px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg); transition: border-color .3s, box-shadow .3s, background .3s; }
.er-no { font: 10px var(--mono); color: var(--quiet); }
.er-top { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; min-height: 19px; }
.er-key { font: 600 14px var(--mono); color: var(--fg); }
.er-gen { font: 10px var(--mono); color: var(--quiet); }
.er-bar { position: relative; display: block; height: 8px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.er-bar.scales { width: 55%; height: 5px; }
.er-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--soft); transition: width .6s cubic-bezier(.3, .7, .2, 1), background .3s; }
.er-state { font: 10px var(--mono); color: var(--quiet); text-transform: uppercase; letter-spacing: .04em; }

.er-slot.empty .er-key { color: var(--border-strong); }
.er-slot.loading { border-color: var(--purple); border-style: dashed; }
.er-slot.loading .er-bar i { background: var(--purple); }
.er-slot.loading .er-state { color: var(--purple); }
.er-slot.ready .er-state { color: var(--soft); }
.er-slot.fail { border-color: var(--border-strong); }
.er-slot.fail .er-bar i { background: var(--quiet); }
.er-slot.fail .er-state { color: var(--quiet); text-decoration: line-through; }
.er-slot.owned { border-style: dashed; border-color: var(--border); background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--bg) 6px 12px); }
.er-slot.owned .er-key { color: var(--soft); font-size: 12px; }
.er-slot.owned .er-bar { opacity: .4; }
.er-slot.hit, .er-slot.read { border-color: var(--red); box-shadow: 0 0 0 3px var(--glow-red); }
.er-slot.pub { border-color: var(--red); box-shadow: 0 0 0 3px var(--glow-red); }
.er-slot.block { border-color: var(--purple); box-shadow: 0 0 0 3px var(--glow); }
.er-slot.pin::before { content: 'pinned'; position: absolute; top: -8px; left: 50%; transform: translateX(-50%); padding: 0 5px; border-radius: 4px; background: var(--bg); font: 10px/1.4 var(--mono); color: var(--red); white-space: nowrap; }

.er-strip { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 5px; }
.er-cell { padding: 4px 0; border: 1px solid var(--border); border-radius: 6px; text-align: center; font: 11px var(--mono); color: var(--quiet); transition: color .3s, border-color .3s, background .3s; }
.er-cell.hit { color: var(--red); border-color: var(--red); background: var(--glow-red); }
.er-cell.up { color: var(--purple); border-color: var(--purple); background: var(--glow); }
.er-cell.host { color: var(--fg); border-color: var(--soft); border-style: dashed; }

.er-ghost { position: absolute; z-index: 2; transform: translate(-50%, -50%); border-color: var(--purple); color: var(--purple); background: var(--surface); pointer-events: none; transition: transform .75s cubic-bezier(.3, .7, .2, 1); }

@media (max-width: 600px) {
  .er-phase { min-height: 64px; align-content: flex-start; }
  .er-dir { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .er-group.bank { grid-column: 1 / -1; }
  .er-group { padding: 8px; }
  .er-slots { gap: 4px; }
  .er-slot { padding: 7px 4px 5px; }
  .er-key { font-size: 12px; }
  .er-gen, .er-no, .er-state { font-size: 9px; }
  .er-state { letter-spacing: 0; }
  .er-legend { display: none; }
  .er-strip { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
  .er-cell { font-size: 10.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .er-bar i, .er-ghost, .er-slot, .er-group, .er-cell { transition: none; }
}
