/* ---------- learn + searchable rules reference ---------- */
main:has(.learn-shell) { max-width: 1240px; padding-top: 22px; }
.learn-shell { --learn-accent: #8fd5c8; }
.learn-topbar { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; }
.learn-back { color: var(--dim); }
.learn-updated { color: var(--faint); font-size: 11px; }
.learn-hero {
  position: relative; overflow: hidden; padding: clamp(28px, 6vw, 68px);
  border: 1px solid rgba(143,213,200,.3); border-radius: 22px;
  background:
    radial-gradient(circle at 88% 12%, rgba(143,213,200,.18), transparent 27%),
    radial-gradient(circle at 76% 90%, rgba(122,162,247,.15), transparent 34%),
    linear-gradient(135deg, #1f2b35 0%, #1b2130 58%, #171a24 100%);
  box-shadow: 0 24px 70px rgba(0,0,0,.25);
}
.learn-kicker { color: var(--learn-accent); font-size: 10.5px; font-weight: 800;
  letter-spacing: .14em; text-transform: uppercase; }
.learn-hero h2 { margin: 8px 0 10px; max-width: 740px; color: #f3f8f7;
  font: 500 clamp(38px, 7vw, 68px)/1 Georgia, "Times New Roman", serif;
  letter-spacing: -.04em; }
.learn-hero p { max-width: 680px; margin: 0; color: #c5ced2;
  font-size: clamp(14px, 1.6vw, 17px); line-height: 1.6; }
.learn-tabs { position: sticky; top: calc(8px + env(safe-area-inset-top));
  z-index: 7; display: flex; gap: 5px; width: fit-content; margin: 14px auto 20px;
  padding: 5px; border: 1px solid var(--border2); border-radius: 14px;
  background: rgba(26,30,41,.94); backdrop-filter: blur(12px);
  box-shadow: 0 8px 26px rgba(0,0,0,.28); }
.learn-tab { min-height: 38px; border-color: transparent; background: transparent;
  color: var(--dim); }
.learn-tab.active { color: #16201f; border-color: transparent;
  background: var(--learn-accent); }
.learn-panel[hidden] { display: none; }
.learn-intro { max-width: 720px; margin: 0 auto 20px; text-align: center; }
.learn-intro h3 { margin: 0 0 5px; font-size: 22px; }
.learn-intro p { margin: 0; color: var(--dim); }
.guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px; counter-reset: guide; }
.guide-card { position: relative; min-height: 250px; padding: 24px;
  border-color: rgba(143,213,200,.18); }
.guide-step { display: inline-grid; place-items: center; width: 34px; height: 34px;
  margin-bottom: 24px; border: 1px solid rgba(143,213,200,.35);
  border-radius: 50%; background: rgba(143,213,200,.09);
  color: var(--learn-accent); font-size: 12px; font-weight: 800; }
.guide-card h3 { margin: 0 0 4px; font-size: 21px; }
.guide-summary { margin: 0 0 12px; color: var(--learn-accent); font-weight: 650; }
.guide-body { margin: 0; color: #c8cbd4; line-height: 1.6; }
.guide-tip { margin: 18px 0 0; padding: 10px 12px; border-left: 2px solid var(--warn);
  background: rgba(224,175,104,.06); color: var(--dim); font-size: 12px; }
.related-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 14px; }
.rule-jump { min-height: 0; padding: 3px 8px; border-radius: 999px;
  border-color: var(--border2); background: var(--panel2); color: var(--dim);
  font-size: 10.5px; }
.rule-jump:hover { color: var(--text); border-color: var(--learn-accent); }
.rules-toolbar { position: sticky; top: calc(62px + env(safe-area-inset-top));
  z-index: 6; margin-bottom: 12px; padding: 14px; border: 1px solid var(--border);
  border-radius: 14px; background: rgba(26,30,41,.96);
  box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.rules-search-wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: center; gap: 10px; }
.rules-search { min-height: 46px; padding-left: 42px;
  background: var(--panel3); border-color: var(--border2); }
.rules-search-icon { position: absolute; margin-left: 15px; color: var(--faint);
  pointer-events: none; }
.rules-count { color: var(--faint); font-size: 11px; white-space: nowrap; }
.rules-filters { display: flex; gap: 6px; overflow-x: auto; padding-top: 10px;
  scrollbar-width: thin; }
.rules-filter { min-height: 30px; padding: 4px 10px; border-radius: 999px;
  white-space: nowrap; color: var(--dim); background: var(--panel2); }
.rules-filter.active { color: #15201e; background: var(--learn-accent);
  border-color: var(--learn-accent); }
.rule-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px; align-items: start; }
.rule-entry { margin: 0; padding: 0; overflow: hidden; scroll-margin-top: 152px; }
.rule-entry > summary { list-style: none; cursor: pointer; padding: 17px 18px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px;
  align-items: start; }
.rule-entry > summary::-webkit-details-marker { display: none; }
.rule-entry > summary::after { content: "+"; display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%; color: var(--learn-accent);
  background: rgba(143,213,200,.08); }
.rule-entry[open] > summary::after { content: "−"; }
.rule-entry h3 { margin: 0 0 4px; font-size: 16px; }
.rule-entry .rsum { color: var(--dim); font-size: 12.5px; line-height: 1.45; }
.rule-detail { padding: 0 18px 18px; border-top: 1px solid var(--border); }
.rule-detail p { color: #c8cbd4; line-height: 1.6; }
.rule-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.rule-category, .rule-number { display: inline-block; padding: 3px 8px;
  border-radius: 999px; font-size: 10px; }
.rule-category { color: var(--learn-accent); background: rgba(143,213,200,.08); }
.rule-number { color: var(--accent); background: rgba(122,162,247,.08); }
.rules-empty { grid-column: 1 / -1; padding: 44px 20px; text-align: center;
  color: var(--dim); }
/* the Learn screen's game switcher: the same control as the New game
   card's, so the two read as one setting rather than two lookalikes */
.learn-gameswitch { max-width: 520px; margin: 0 auto 16px; }
/* Rules quick reference: a term/meaning list, two columns where there is
   room and one where there is not. */
.nr-glossary { margin: 0; padding: 6px 4px; }
.nr-glossary .gloss-row { display: grid;
  grid-template-columns: minmax(120px, 190px) minmax(0, 1fr); gap: 6px 16px;
  padding: 9px 12px; border-bottom: 1px solid var(--border); }
.nr-glossary .gloss-row:last-child { border-bottom: 0; }
.nr-glossary dt { margin: 0; color: var(--text); font-weight: 700;
  font-size: 13.5px; }
.nr-glossary dd { margin: 0; color: #c8cbd4; font-size: 13.5px;
  line-height: 1.55; }
@media (max-width: 640px) {
  .nr-glossary .gloss-row { grid-template-columns: 1fr; gap: 2px; }
}
.learn-sources { margin-top: 18px; padding: 18px; color: var(--dim);
  font-size: 12px; }
.learn-sources strong { color: var(--text); }
.learn-sources a { color: var(--learn-accent); }
@media (max-width: 760px) {
  main:has(.learn-shell) { padding: 10px 10px 180px; }
  .learn-topbar { margin-top: 4px; }
  .learn-hero { padding: 30px 22px; border-radius: 16px; }
  .guide-grid, .rule-list { grid-template-columns: 1fr; }
  .guide-card { min-height: 0; padding: 20px; }
  .guide-step { margin-bottom: 16px; }
  .learn-tabs { width: 100%; }
  .learn-tab { flex: 1; }
  .rules-toolbar { top: calc(6px + env(safe-area-inset-top)); }
  .rules-search-wrap { grid-template-columns: 1fr; }
  .rules-count { padding-left: 2px; }
}
