/* Reading window / Books: master tokens only (foundation + master.css). No new colours, sizes or radii. */
.mx-master .rb-wrap{max-width:calc(var(--measure) * 2 + 128px)}
.mx-master .rb-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:var(--space-gap);padding-bottom:var(--s2);border-bottom:var(--line) solid var(--navy)}
.mx-master .rb-head nav{display:flex;gap:var(--s3)}
.mx-master .rb-head [aria-current="page"]{font-weight:700}
/* right = selection, centre = results / chosen book */
.mx-master .rb-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(192px,256px);gap:var(--s5);align-items:start;padding-top:var(--s3)}
.mx-master .rb-side{position:sticky;top:var(--s2);max-height:calc(100vh - var(--s4));overflow:auto}
.mx-master .rb-main{min-width:0}
.mx-master .rb-vh{position:absolute;width:var(--line);height:var(--line);overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.mx-master .rb-side li a{display:flex;justify-content:space-between;gap:var(--s1);min-height:40px;align-items:center}
.mx-master .rb-side li a[aria-current="true"]{font-weight:700;background:var(--surface)}
.mx-master .rb-side li a span:last-child{font:var(--t6);color:var(--ink)}
.mx-master .rb-stage{margin:var(--s4) 0 0;padding-bottom:var(--s1);border-bottom:var(--line) solid var(--navy);font:var(--t3)}
.mx-master .rb-stage span{font-weight:400;color:var(--ink)}
.mx-master .rb-main h1{font:var(--t1);margin-bottom:var(--s1)}
/* Wrap headings and book links without changing SVG graph labels. */
.mx-master .rb-main h1,.mx-master .rb-main h3,.mx-master .rb-main h3 a,.mx-master .rb-conn-list a{white-space:normal;overflow-wrap:anywhere;overflow:visible;text-overflow:clip;-webkit-line-clamp:unset;max-height:none}
.mx-master .rb-lead{font:var(--t4);margin-bottom:var(--s2)}
/* the chosen book: large, in the centre pane */
.mx-master .rb-book{display:grid;grid-template-columns:minmax(0,256px) minmax(0,1fr);gap:var(--s4);align-items:start;margin-top:var(--s3)}
.mx-master .rb-book img{width:100%;aspect-ratio:3 / 4;object-fit:contain;border:var(--line) solid var(--navy)}
.mx-master .rb-cover-none{aspect-ratio:3 / 4;display:grid;place-items:center;border:var(--line) solid var(--navy);font:var(--t6)}
.mx-master .rb-body h2{font:var(--t3);margin:var(--s3) 0 var(--s1);padding-bottom:var(--s1);border-bottom:var(--line) solid var(--navy)}
.mx-master .rb-body p{font:var(--t4)}
.mx-master .rb-quote{margin:var(--s2) 0;padding-left:var(--s2);border-left:var(--line-strong) solid var(--navy);font:var(--t4)}
.mx-master .rb-back{margin-bottom:var(--s2)}
.mx-master .rb-empty{padding:var(--s4) 0;font:var(--t4)}
@media (max-width:860px){
 .mx-master .rb-layout{grid-template-columns:minmax(0,1fr)}
 .mx-master .rb-side{position:static;max-height:none;order:1}
 .mx-master .rb-book{grid-template-columns:minmax(0,1fr)}
 .mx-master .rb-book img,.mx-master .rb-cover-none{max-width:192px}
}

.mx-master .rb-pick > summary{display:none;min-height:40px;align-items:center;cursor:pointer;font:var(--t5);font-weight:700;color:var(--navy);border-bottom:var(--line) solid var(--navy)}
@media (max-width:860px){
 .mx-master .rb-pick > summary{display:flex}
 .mx-master .rb-side form{margin-bottom:var(--s2)}
}
/* one rhythm between selection sections: 24px (--s3) above each */
.mx-master .rb-side .mx-widget + .mx-widget,.mx-master .rb-side .rb-pick .mx-widget + .mx-widget{margin-top:var(--s3)}
.mx-master .rb-pick{margin-top:var(--s3)}
.mx-master .rb-pick > .mx-widget:first-of-type{margin-top:var(--s3)}
.mx-master .rb-pick[open] > summary{margin-bottom:0}

/* ---- map + shelf (v2): tokens only. Series are told apart by position + name, nodes are navy, hover/hit use mustard/rust ---- */
.mx-master .rb-chips{display:flex;flex-wrap:wrap;gap:var(--s1);margin:var(--s2) 0}
.fx .mx-master .rb-chip{min-height:40px;text-decoration:none}
.mx-master .rb-chip[aria-current="true"]{background:var(--navy);color:var(--paper);font-weight:700}
.mx-master .rb-map{border-block:var(--line) solid var(--navy);margin-bottom:var(--s2)}
.mx-master .rb-map text{fill:var(--ink);font:var(--t6)}

.mx-master .rb-links line{stroke:var(--ink);stroke-opacity:.25}
.mx-master .rb-links line.rb-on{stroke:var(--navy);stroke-opacity:1}
.mx-master .rb-node{cursor:pointer}
.mx-master .rb-dot{fill:var(--navy)}
.mx-master .rb-hitarea{fill:var(--paper);fill-opacity:0}
.mx-master .rb-dim{opacity:.3}
.mx-master .rb-node.rb-hit .rb-dot{fill:var(--rust)}
.mx-master .rb-view{display:inline-flex;margin:var(--s1) 0 var(--s2)}
.mx-master .rb-seg{display:inline-flex;align-items:center;justify-content:center;min-width:96px;min-height:40px;padding-inline:var(--s2);font:var(--t5);text-decoration:none;color:var(--navy)}
.mx-master .rb-seg + .rb-seg{border-left:var(--line) solid var(--navy)}
.mx-master .rb-seg[aria-current="true"]{background:var(--navy);color:var(--paper);font-weight:700}
/* shelf: cover with a navy "spine" offset (foundation shadow token) */
.mx-master .rb-shelf{margin-top:var(--s2)}
.mx-master .rb-shelf img{box-shadow:var(--shadow);width:100%}
.mx-master .rb-cover{display:block;width:100%;cursor:pointer}
.mx-master .rb-cover img{display:block}
.mx-master .rb-map svg,.mx-master .rb-map svg :is(g,line){fill:none}
.mx-master .rb-badges{font:var(--t6);color:var(--ink)}
.mx-master .rb-shelf > li:hover h3{background:var(--surface)}
/* connections */
.mx-master .rb-conn{margin-top:var(--s5)}
.mx-master .rb-conn > h2{font:var(--t3);padding-bottom:var(--s1);border-bottom:var(--line) solid var(--navy)}
.mx-master .rb-map-book{margin-top:var(--s2)}
.mx-master .rb-map-book line{stroke:var(--navy);stroke-width:1.5}
.mx-master .rb-center{fill:var(--navy)}
.mx-master .rb-rel{cursor:pointer}
.mx-master .rb-rel circle{fill:var(--paper);stroke:var(--navy);stroke-width:2}
.mx-master .rb-rel:hover circle{fill:var(--mustard)}
.mx-master .rb-conn-list h3{font:var(--t5);font-weight:700;margin:var(--s2) 0 0}
.mx-master .rb-conn-list ul{list-style:none;margin:0}
.mx-master .rb-conn-list li{font:var(--t5);padding-block:calc(var(--s1) / 2)}
.mx-master .rb-conn-list li a{display:inline-flex;align-items:center;min-height:40px}
.mx-master a.rb-seg,.mx-master a.rb-chip{text-decoration:none}
.mx-master .rb-map text{paint-order:stroke;stroke:var(--paper);stroke-width:var(--s1);stroke-linejoin:round}
.mx-master .rb-map-book{border-top:0;margin-top:var(--s1)}

.mx-master .rb-rel.rb-off{cursor:default}
.mx-master .rb-rel.rb-off circle{stroke-dasharray:2 3}

.mx-master a.rb-pop{color:var(--paper);text-decoration:none}

.mx-master .rb-map-book .rb-hitarea{fill:var(--paper);fill-opacity:0}
.mx-master .rb-map-book text{display:none}
.mx-master .rb-rel .rb-hitarea{stroke:none;fill-opacity:0}

/* ---- interactive graph (graph.js): tokens only ---- */
.mx-master .rb-graph{position:relative;height:min(72vh,640px);min-height:320px;border-block:var(--line) solid var(--navy);overflow:hidden;margin-bottom:var(--s2)}
.mx-master .rb-map-book.rb-graph{height:384px}
.mx-master .rb-svg{display:block;width:100%;height:100%;touch-action:none;cursor:grab;fill:none}
.mx-master .rb-svg :is(g,line){fill:none}
.mx-master .rb-edge{stroke:var(--ink);stroke-opacity:.3;stroke-width:1.5;stroke-linecap:round}
.mx-master .rb-edge.rb-dash1{stroke-dasharray:7 5}
.mx-master .rb-edge.rb-dash2{stroke-dasharray:2 5}
.mx-master .rb-edge.rb-faded{stroke-opacity:.08}
.mx-master .rb-edge.rb-lit{stroke:var(--navy);stroke-opacity:1;stroke-width:2.4}
.mx-master .rb-node{cursor:pointer}
.mx-master .rb-hitarea{fill:var(--paper);fill-opacity:0}
.mx-master .rb-dot{fill:var(--navy);stroke:var(--paper);stroke-width:1}
.mx-master .rb-map-book .rb-dot{fill:var(--paper);stroke:var(--navy);stroke-width:2}
.mx-master .rb-map-book .rb-center .rb-dot{fill:var(--navy)}
.mx-master .rb-node.rb-faded{opacity:.18}
.mx-master .rb-node.rb-out{opacity:.25}
.mx-master .rb-node.rb-hit .rb-dot{fill:var(--rust)}
.mx-master .rb-labels{position:absolute;inset:0;pointer-events:none;overflow:hidden}
.mx-master .rb-label{position:absolute;transform:translate(-50%,0);font:var(--t6);color:var(--ink);background:var(--paper);padding-inline:calc(var(--s1) / 2);white-space:nowrap}
.mx-master .rb-label-main{font-weight:700;color:var(--navy)}
.mx-master .rb-label-series{transform:translate(-50%,-100%);font:var(--t6);font-weight:700;color:var(--navy)}
.mx-master .rb-ctrl{position:absolute;right:var(--s1);bottom:var(--s1);display:flex;gap:calc(var(--s1) / 2)}
.mx-master .rb-ctrl-btn{min-width:var(--touch);justify-content:center;box-shadow:none;background:var(--paper)}
.mx-master .rb-pop{position:absolute;z-index:3;display:inline-flex;align-items:center;min-height:40px;padding-inline:var(--s2);background:var(--navy);color:var(--paper);font:var(--t5);font-weight:700;text-decoration:none;white-space:nowrap}
.mx-master a.rb-pop{color:var(--paper);text-decoration:none}
.mx-master .rb-pop[hidden]{display:none}

/* series colours: master dataviz palette (director 2026-10-11 approved for readmap) */
.mx-master .rb-graph .rb-node.rb-s0 .rb-dot{fill:#6358a3}
.mx-master .rb-graph .rb-node.rb-s1 .rb-dot{fill:#26796f}
.mx-master .rb-graph .rb-node.rb-s2 .rb-dot{fill:#b36b26}
.mx-master .rb-graph .rb-node.rb-s3 .rb-dot{fill:#71823c}
.mx-master .rb-graph .rb-node.rb-s4 .rb-dot{fill:#9b5471}
.mx-master .rb-graph .rb-node.rb-s5 .rb-dot{fill:#487aa3}
.mx-master .rb-graph .rb-node.rb-s6 .rb-dot{fill:#102848}
.mx-master .rb-node.rb-on .rb-dot{stroke:var(--ink);stroke-width:3}
.mx-master .rb-node.rb-near .rb-dot{stroke:var(--ink);stroke-width:2;fill-opacity:1}
.mx-master .rb-graph .rb-node.rb-hit .rb-dot{fill:var(--rust);stroke:var(--ink);stroke-width:2}

.mx-master .rb-ctrl-btn{min-height:40px}

/* shell page: the map sits in the wide centre column, selection on the right */
.mx-master .rb-page{display:flex;flex-direction:column;gap:var(--s3)}
.mx-master .rb-layout{padding-top:0;gap:var(--s4)}
.mx-master .rb-side{max-height:none;position:static}
.mx-master .rb-graph{height:min(70vh,704px)}
.fx .fx-head a{display:inline-flex;align-items:center;min-height:40px}
.fx .rb-vh{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
/* gem glass: selected map filter shows the gem tint, not a navy fill */
.fx-gem .mx-master .rb-main .fx-band .rb-chip[aria-current="true"]{background-color:#fff;background-image:none;color:var(--gem-deep)}
.fx .fx-band[hidden]{display:none}
/* series filter sits on a section band (C) inside the map column */
.rb-main .fx-band.fx-band-c{margin:0 0 var(--s2);padding:var(--s4) var(--s3);border-radius:20px}
.rb-main .fx-band .rb-chips{margin:0}

/* P0 (astra review): graph controls sit in their own 40px tool row BELOW the canvas, never over nodes */
.mx-master .rb-graph,.mx-master .rb-map-book.rb-graph{height:auto;min-height:0;overflow:visible}
.mx-master .rb-canvas{position:relative;height:min(70vh,704px);min-height:320px;overflow:hidden}
.mx-master .rb-map-book .rb-canvas{height:384px}
.mx-master .rb-ctrl{position:static;display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--s1);padding-top:var(--s1)}
.fx .mx-master .rb-ctrl-btn{min-height:40px;min-width:var(--touch)}
/* P0: mobile selection = a visible "계열·학과 선택" row that opens the series/department lists */
@media (max-width:860px){
 .mx-master .rb-pick > summary{border:var(--line) solid var(--navy);border-radius:6px;padding-inline:var(--s2);justify-content:space-between}
 .mx-master .rb-pick > summary::after{content:'+';font-weight:700}
 .mx-master .rb-pick[open] > summary::after{content:'−'}
}
/* Compact hero on mobile so the series chips are visible. */
@media (max-width:860px){#rb-hero .fx-hero-spec{display:none}#rb-hero{padding-top:var(--s3);padding-bottom:var(--s4)}#rb-hero .fx-hero{padding:var(--s2)}#rb-hero h1{font-size:24px}}

/* V10.2 phone first screen: the map itself is the first thing — short hero, no hints, full-bleed canvas, wrapping series chips */
@media (max-width:860px){
 .mx-master .fx-hero-spec,.fx-steps small,.mx-master .mx-note,.mx-master .rb-lead{display:none}
 .rb-main .fx-band.fx-band-c{padding:var(--s2) var(--s2);margin-bottom:var(--s1)}
 .rb-main .fx-band .rb-chips{flex-wrap:wrap;padding-bottom:var(--s1)}
 .rb-main .fx-band .rb-chip{flex:none}
 .mx-master .rb-graph{margin-inline:calc(-1 * var(--s2))}
 .mx-master .rb-canvas{height:clamp(340px,60svh,560px)}
}
@media (max-width:860px){
 .fx .fx-steps li.is-current small,.fx .fx-steps li small{display:none}
 #rb-hero .fx-hero-line{display:none}
 #rb-hero.fx-band{padding-block:var(--s2)}
 #rb-hero .fx-hero{padding:var(--s2)}
 .mx-master .rb-page{gap:var(--s1)}
}

/* V10.3: step line + one example book card above the map (the link between the map and the book search) */
.mx-master .rb-flow{font:var(--t4);font-weight:700;margin:0 0 var(--s1)}
.mx-master .rb-example{margin:0 0 var(--s1)}
.mx-master .rb-example-card{display:flex;gap:var(--space-gap);align-items:center;padding:var(--s1) var(--s2);border:var(--line) solid var(--surface);border-radius:var(--r);background:var(--paper);text-decoration:none;color:var(--ink);min-height:var(--touch)}
.mx-master .rb-example-card img{flex:none;width:56px;height:74px;object-fit:contain}
.mx-master .rb-example-card span{display:flex;flex-direction:column;gap:2px;min-width:0}
.mx-master .rb-example-card b{font:var(--t5);font-weight:700;overflow-wrap:anywhere}
.mx-master .rb-example-card small{font:var(--t6)}
@media (max-width:860px){ .fx .fx-steps#rb-steps{display:none} .mx-master .rb-flow{display:block} }

/* The search label is visible; the input keeps its own row at narrow widths. */
.fx #rb-search { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s1); }
.fx #rb-search label { position: static; width: auto; height: auto; overflow: visible; white-space: normal; font: var(--t5); }
.fx #rb-q { min-width: 0; width: 100%; min-height: var(--touch); }
.fx #rb-search button { justify-self: start; }

/* Screen-space SVG labels are CSP-safe and stay within the canvas. */
.mx-master .rb-svg text.rb-label{display:block;position:static;transform:none;fill:var(--ink);font:var(--t6);paint-order:stroke;stroke:var(--paper);stroke-width:4px;stroke-linejoin:round;pointer-events:none}
.mx-master .rb-svg .rb-label-main{fill:var(--navy);font-weight:700}
.mx-master .rb-svg text.rb-label-hidden{display:none}
.mx-master a.rb-pop{position:static;display:inline-flex;align-items:center;min-height:40px;max-width:100%;overflow-wrap:anywhere;margin-block:var(--s1)}
.mx-master a.rb-pop[hidden]{display:none}
.rb-mobile-toggle{display:none}
.mx-master .rb-book-row{min-width:0}
.mx-master .rb-book-row .rb-description{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}
.mx-master .rb-book-row .rb-description.is-expanded{display:block;-webkit-line-clamp:unset;overflow:visible}
.fx .mx-master button.rb-description-toggle{display:flex;align-items:center;justify-content:flex-start;box-sizing:border-box;width:100%;min-height:40px;height:auto;margin-block:var(--s1);padding:var(--s1) var(--s2);font:var(--t5);color:var(--navy);background:var(--paper);border:var(--line) solid var(--surface);border-radius:var(--r);cursor:pointer}
.fx .mx-master button.rb-description-toggle:focus-visible{outline:2px solid var(--navy);outline-offset:2px}
.mx-master .rb-list-cover{display:block;width:56px;min-height:74px;float:left;margin:0 var(--s2) var(--s1) 0}
.mx-master .rb-list-cover img{display:block;width:56px;height:74px;object-fit:contain}
@media(max-width:700px){
 .fx.fx-gem .mx-master button.rb-mobile-toggle{display:flex;align-items:center;justify-content:center;box-sizing:border-box;height:40px;min-height:40px;width:auto;max-width:100%;margin:0;background:transparent;border:1px solid var(--navy);color:var(--navy);box-shadow:none}
 .mx-master .rb-department-heading{font:var(--t5);font-weight:700;margin-block:8px}
 .mx-master .rb-department-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;list-style:none;padding:2px;margin:0;max-height:192px;overflow:auto;position:relative}
 .mx-master .rb-department-list li{min-width:0}
 .mx-master .rb-department-list a{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;box-sizing:border-box;min-height:56px;padding:4px;border:1px solid var(--surface);border-radius:var(--r);font-size:13px;line-height:1.3;text-align:center;text-decoration:none}
 .mx-master .rb-department-list a span:first-child{min-width:0;max-width:100%;overflow-wrap:anywhere;white-space:normal}
 .mx-master .rb-department-list a span:last-child{flex:none;font-size:12px;line-height:1.3}
 .mx-master .rb-main .rb-chips{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px;margin:4px 0 8px;overflow:visible;padding:0}
 .fx.fx-gem .mx-master .rb-chips .rb-chip{display:flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:44px;min-height:40px;padding:4px;font-size:14px;line-height:1.3;text-align:center}
 .fx.fx-gem .mx-master .rb-chips .rb-chip[aria-current="true"],.mx-master .rb-department-list a[aria-current="true"]{background:var(--navy);color:var(--paper);font-weight:700}
 .mx-master .rb-selection-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
 .mx-master .rb-selection-head h2{margin:0;font:var(--t5);font-weight:700}
 .mx-master .rb-layout{padding-top:0;gap:8px}
 .fx.fx-gem #rb-hero.fx-band{padding:0;background:none;border:0;border-radius:0;box-shadow:none}
 .fx.fx-gem #rb-hero::before{display:none}
 .fx.fx-gem #rb-hero .fx-hero{padding:0;border:0;border-radius:0;background:none;box-shadow:none;backdrop-filter:none}
 .fx #rb-hero :is(.fx-hero-line,.fx-hero-spec){display:none}
 .rb-main .fx-band.fx-band-c{padding:0;margin-bottom:var(--s1);background:none;border:0;border-radius:0;box-shadow:none}
 .mx-master .rb-graph{margin-inline:0;max-width:100%}
 .mx-master .rb-flow,.mx-master .rb-example,.mx-master .rb-side .rb-pick{display:none}
 .mx-master .mx-row.rb-book-row{display:grid;grid-template-columns:56px minmax(0,1fr);gap:12px;align-items:start;padding-block:12px;overflow-wrap:anywhere;background:none;border-bottom:var(--line) solid var(--surface)}
 .mx-master .rb-book-copy{grid-column:2;min-width:0}
 .mx-master .rb-book-copy > *{margin:0}
 .mx-master .mx-row.rb-book-row h3{font:var(--t5);font-weight:700}
 .mx-master .rb-book-row p.mx-meta{display:block;white-space:normal;border:0;padding:0;font:var(--t6);margin-bottom:4px}
 .mx-master .rb-book-copy > p:not(.mx-meta){font:var(--t5)}
 .mx-master .rb-book-row a,.mx-master .rb-dept-back,.mx-master .rb-back,.mx-master .rb-head nav a{display:inline-flex;align-items:center;min-height:40px}
 .mx-master .rb-book-row a.rb-list-cover{display:block;float:none;width:56px;height:80px;min-height:80px;margin:0;grid-column:1}
 .mx-master .rb-book-row .rb-list-cover img{width:56px;height:80px;object-fit:contain}
 .mx-master .rb-book-copy > a.mx-link{background:none}
 .mx-master .rb-book-row h3,.mx-master .rb-book-row p{min-width:0}
 .mx-master .rb-main h1{font:var(--t3)}
 /* The shared title treatment uses !important; tighten its rhythm only on phones. */
 .fx #rb-hero{margin-bottom:var(--s1)!important}
 .fx #rb-hero .fx-hero-text{gap:var(--s1)!important}
 .fx #rb-hero .fx-hero h1{white-space:nowrap!important;text-wrap:nowrap!important}
 .mx-master .rb-main,.mx-master .rb-side,.mx-master .rb-layout{min-width:0;max-width:100%}
}

/* The shared injector retains its legacy tag; the page title uses Korean only. */
#rb-hero .fx-hero-tag{display:none}
.fx .mx-master .rb-department-list a,.fx .mx-master .rb-department-list a:hover,.fx .mx-master .rb-department-list a:focus,.fx .mx-master .rb-department-list a:focus-visible,.fx .mx-master .rb-department-list a:active,.fx .mx-master .rb-department-list a:visited,.fx .mx-master .rb-department-list a[aria-current="true"],.fx .mx-master .rb-department-list a span{text-decoration:none}

.fx .mx-master button.rb-description-toggle[hidden]{display:none!important}
/* C filters stay compact while their transparent hit area remains 40px. */
.fx .mx-master .rb-chip, .fx.fx-gem .mx-master .rb-chips .rb-chip, .mx-master .rb-seg { position: relative; box-sizing: border-box; height: 40px; min-height: 40px; padding-block: 0; border: 1px solid var(--navy); border-radius: 6px; font-weight: 500; }
.mx-master .rb-chip::after, .mx-master .rb-seg::after { content: ''; position: absolute; inset: -3px; }
.mx-master .rb-side li a, .mx-master .rb-pick > summary, .mx-master .rb-conn-list li a, .mx-master .rb-ctrl-btn, .fx .mx-master .rb-ctrl-btn { min-height: 40px; }

/* v3: news components and reader typography, scoped to books. */
.mx-master #rb-steps, .mx-master .rb-flow, .mx-master .rb-lead { display: none; }
.mx-master .rb-layout { grid-template-columns: minmax(0,1fr) 260px; }
.mx-master .rb-main { grid-column: 1; grid-row: 1; }
.mx-master .rb-side { grid-column: 2; grid-row: 1; }
.mx-master .rb-layout > .rb-pick { grid-column: 1; grid-row: 2; margin-top: 0; }
.mx-master .rb-pick > summary { display: flex; font-weight: 600; }
.mx-master .rb-side h2, .mx-master .rb-side label { font-weight: 600; }
.mx-master .rb-side input { height: 40px; min-height: 40px; }
.fx.fx-gem #rb-hero.fx-band { padding: 0; margin: 0 0 var(--s2); background: none; border: 0; box-shadow: none; mask-image: none; -webkit-mask-image: none; }
.fx.fx-gem #rb-hero::before { display: none; }
.fx.fx-gem #rb-hero .fx-hero { padding: 0; background: none; border: 0; box-shadow: none; }
.fx.fx-gem #rb-hero .fx-hero-line { font: var(--t5); }
.fx.fx-gem #rb-hero .fx-hero-spec { display: none; }
.fx.fx-gem .mx-master .rb-main > .fx-band-c { padding: 0; margin: 0 0 var(--s2); background: none; mask-image: none; -webkit-mask-image: none; }
.mx-master .rb-canvas { height: min(56vh,520px); min-height: 0; }
.fx.fx-gem .mx-master .rb-chips > .fx-chip {
  display: inline-flex; align-items: center; justify-content: center;
  box-sizing: border-box; height: 36px; min-height: 36px;
  border: 1px solid var(--surface); border-radius: 6px;
  font-size: 14px; font-weight: 500; background: var(--paper);
}
.fx.fx-gem .mx-master .rb-chips > .fx-chip[aria-current="true"] { background: var(--navy); color: var(--paper); }
.mx-master .rb-example { display: block; }
.mx-master .rb-example[hidden] { display: none; }
.mx-master .rb-example-card { border: 1px solid var(--surface); border-radius: 12px; padding: var(--s2); }
.mx-master .rb-example-card b { font-weight: 600; }
.mx-master #rb-view.rb-detail { width: 100%; max-width: 680px; margin: 0 auto; }
.mx-master .rb-detail .mx-post { display: block; }
.mx-master .rb-detail .mx-post h1 { font-size: 28px; line-height: 40px; font-weight: 700; }
.mx-master .rb-detail .mx-post h2 { font-size: 22px; line-height: 32px; font-weight: 600; margin: 24px 0 12px; }
.mx-master .rb-detail .mx-post p { font-size: 17px; line-height: 30px; margin-bottom: 12px; }
.mx-master .rb-detail .rb-book-meta { display: flex; flex-wrap: wrap; gap: var(--s1); margin-block: var(--s2); }
.mx-master .rb-detail .rb-book-meta span { font-size: 12px; line-height: 20px; font-weight: 600; border: 1px solid var(--surface); border-radius: 12px; padding: 0 var(--s1); }
.mx-master .rb-detail .rb-book { display: flow-root; margin-top: var(--s3); }
.mx-master .rb-detail .rb-book > :is(img,.rb-cover-none) { float: left; width: 144px; height: auto; margin: 0 var(--s2) var(--s2) 0; }
.mx-master .rb-detail .rb-quote { font-weight: 600; border-left: 4px solid var(--navy); display: flow-root; margin-top: 0; }
.mx-master .rb-detail .rb-conn { margin-top: var(--s3); }
.mx-master .rb-detail .rb-map-book .rb-canvas { height: min(46vh,400px); }
@media (max-width:860px) {
  .mx-master .rb-layout { grid-template-columns: minmax(0,1fr); }
  .mx-master .rb-side { grid-column: 1; grid-row: 3; }
}
@media (max-width:700px) {
  .mx-master .rb-detail .mx-post h1 { font-size: 24px; line-height: 34px; }
  .mx-master .rb-detail .rb-book > :is(img,.rb-cover-none) { width: 112px; }
}

/* Readmap v2: card, search and controls follow the quality UI contract. */
.mx-master #rb-search{position:relative;display:flex;gap:8px;margin:16px 0;z-index:5}
.mx-master #rb-q{flex:1;min-width:0;height:40px;border:1px solid #f1f1f1;border-radius:8px;font-size:14px}
.mx-master #rb-search-results{position:absolute;top:100%;left:0;right:0;max-height:360px;overflow:auto;margin:4px 0 0;padding:4px 12px;list-style:none;border:1px solid #f1f1f1;border-radius:12px;background:var(--paper);z-index:6}
.fx .mx-master #rb-search-results button{display:flex;flex-direction:column;align-items:flex-start;text-align:left;width:100%;min-height:52px;height:auto;padding:8px 0;background:transparent;border:0;border-radius:0;font-family:inherit;font-size:14px;line-height:22px;font-weight:400;color:var(--ink);white-space:normal}
.mx-master #rb-search-results small{font-size:12px;line-height:20px;color:#6b7280}
.mx-master #rb-search-results button:hover,.mx-master #rb-search-results button:focus-visible{background:#f4f4f4}
.mx-master .rb-status{min-height:20px;font-size:13px;line-height:20px;margin:4px 0}
.mx-master .rb-legend{display:flex;flex-wrap:wrap;gap:8px 16px;padding:8px 0;font-size:13px;line-height:20px;color:#555}
.mx-master .rb-legend>span{display:inline-flex;align-items:center;gap:6px}
.mx-master .rb-line{width:30px;border-top:2px solid #c9a45f}
.mx-master .rb-line.bridge{border-top:2px dashed #7fa8d9}
.mx-master .rb-line.character{border-top:2px dotted #7ec699}
.mx-master .rb-stage-chips,.mx-master .rb-filter-chips,.mx-master .rb-mid-chips,.mx-master .rb-controls{display:flex;flex-wrap:wrap;gap:8px;margin:8px 0}
.fx .mx-master :is(.rb-map-tools,.rb-controls) .fx-chip{display:inline-flex;align-items:center;justify-content:center;height:36px;min-height:36px;min-width:36px;width:auto;padding:0 10px;border:1px solid #f1f1f1;border-radius:6px;background:var(--paper);color:var(--navy);font-size:14px;font-weight:500;box-shadow:none;white-space:normal}
.fx .mx-master .rb-map-tools [aria-pressed="true"],.fx .mx-master .rb-controls [aria-pressed="true"]{background:var(--navy);color:var(--paper)}
.mx-master .rb-controls{justify-content:flex-end}
.mx-master .rb-map-tools button:disabled,.mx-master .rb-controls button:disabled{opacity:.45;cursor:default}
.mx-master .rb-filter-count{font-size:12px;line-height:20px;color:#6b7280;margin:4px 0}
.mx-master .rb-map-heading{display:flex;flex-wrap:wrap;gap:16px;font-size:14px;line-height:24px}
.mx-master .rb-graph{height:min(56vh,520px);min-height:320px}
.mx-master .rb-detail .rb-graph{height:min(46vh,400px)}
.mx-master .rb-card{position:absolute;z-index:3;top:12px;right:12px;box-sizing:border-box;width:300px;max-width:calc(100% - 24px);max-height:calc(100% - 24px);overflow:auto;padding:12px;border:1px solid #f1f1f1;border-radius:12px;background:var(--paper);box-shadow:none;text-align:left}
.mx-master .rb-card.rb-card-left{right:auto;left:12px}
.mx-master .rb-card h3{margin:0;padding-right:28px;font-size:15px;line-height:22px;font-weight:600}
.mx-master .rb-card .rb-card-author{margin:0 0 6px;font-size:13px;line-height:20px;color:#6b7280}
.mx-master .rb-card :is(.rb-card-reason,.rb-card-intro){margin:6px 0;font-size:14px;line-height:22px}
.mx-master .rb-relation,.mx-master .rb-estimated{display:inline-block;padding:0 7px;border-radius:12px;font-size:12px;line-height:20px;font-weight:600;background:#f4f4f4;color:var(--ink)}
.mx-master .rb-estimated{background:var(--paper);border:1px solid #f1f1f1}
.mx-master .rb-card a{display:flex;align-items:center;min-height:40px;font-size:13px;text-decoration:underline}
.fx .mx-master button.rb-card-close{position:absolute;top:0;right:0;width:36px;min-width:36px;height:36px;min-height:36px;padding:0;border:0;background:transparent;color:var(--ink);font-size:20px}
.mx-master .rb-flow-labels{position:absolute;top:8px;left:8px;display:flex;flex-direction:column;max-width:65%;max-height:80%;overflow:auto;padding:8px;background:var(--paper);border:1px solid #f1f1f1;border-radius:8px;font-size:12px;line-height:20px;pointer-events:none}
.mx-master .rb-map-list{margin:12px 0}
.mx-master .rb-map-list a{display:inline-flex;align-items:center;min-height:40px}
.mx-master .rb-filter-faded{opacity:.45}
.mx-master :is(.rb-card,.rb-flow-labels,.rb-map-list,.rb-mid-chips,#rb-search-results)[hidden]{display:none}
.mx-master :is(button,a,input):focus-visible{outline:2px solid var(--navy);outline-offset:2px}
@media(max-width:700px){
 .mx-master .rb-card,.mx-master .rb-card.rb-card-left{top:auto;bottom:0;left:0;right:0;width:100%;max-width:100%;max-height:36%;border-color:rgba(107,114,128,.25);border-radius:12px 12px 0 0;padding-bottom:max(12px,env(safe-area-inset-bottom))}
 .fx .mx-master :is(.rb-map-tools,.rb-controls,#rb-search) .fx-chip,.fx .mx-master button.rb-card-close{min-width:44px;min-height:44px;height:auto}
 .mx-master .rb-card a,.mx-master .rb-map-list a{min-height:44px}
 .mx-master #rb-q{height:44px}
 .fx .mx-master .rb-mid-chips.filter-sheet-ready > .fx-chip{display:none}
 .mx-master .rb-controls{justify-content:flex-start;gap:4px}
}
@media(pointer:coarse){
 .fx .mx-master :is(.rb-map-tools,.rb-controls,#rb-search) .fx-chip{min-height:44px;min-width:44px;height:auto}
 .mx-master .rb-card a{min-height:44px}
}

/* R4 map-first budget (CSS px, excludes the article/detail route):
   Desktop L0 <= 16 + 68 + 48 + 80 + 28 = 240; L1 <= 16 + 48 + 84 + 28 = 176.
   L1 expanded panel is capped at 112px, keeping that budget <=288.
   Phone includes the 57px site bar/border: L0 <= 57 + 12 + 68 + 52 + 48 + 28 = 265;
   L1 <= 57 + 12 + 52 + 96 + 28 = 245. L2 uses only a 36/44px title.
   These are structural budgets, not browser geometry measurements. */
.fx #work{gap:8px;padding-top:16px}
.fx.fx-gem #rb-hero.fx-band{margin:0!important}
.fx.fx-gem #rb-hero .fx-hero-text{gap:4px!important}
.fx.fx-gem #rb-hero .fx-hero h1{font-size:24px!important;line-height:32px!important;margin:0}
.fx.fx-gem #rb-hero .rb-data-hint{font-size:14px;line-height:24px;margin:0}
.fx #rb-hero[hidden],.mx-master [data-map-level] [hidden]{display:none!important}
.fx .mx-master #rb-search{display:flex;align-items:center;gap:8px;margin:0 0 8px;width:100%}
.fx .mx-master #rb-search label.rb-vh,.mx-master .rb-vh{position:absolute;width:1px;height:1px;min-height:0;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.fx .mx-master #rb-q{flex:1 1 0px;width:0;min-width:0;min-height:40px;height:40px;padding:0 12px;font-size:14px}
.fx .mx-master #rb-search > button{flex:none;width:auto;height:40px;min-height:40px;padding:0 12px;white-space:nowrap}
.mx-master .rb-search-count{flex:none;font-size:12px;line-height:20px;white-space:nowrap;color:#555}
.mx-master .rb-series-row{display:flex;align-items:center;gap:8px;margin:0 0 4px;min-width:0}
.mx-master .rb-series-row .rb-chips{display:flex;flex:1;flex-wrap:wrap;gap:4px;margin:0;max-height:76px;overflow:auto;padding:0}
.mx-master .rb-map-tools{position:relative;margin:0;padding:0}
.mx-master .rb-scene-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:4px 8px}
.mx-master .rb-map-heading{display:block;min-width:0;margin:0;font-size:13px;line-height:36px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mx-master .rb-scene-views:empty{display:none}
.mx-master .rb-scene-views .rb-view{display:flex;width:auto;margin:0}
.fx .mx-master .rb-scene-views .rb-seg{display:flex;align-items:center;justify-content:center;width:auto;min-width:36px;padding:0 8px;font-size:13px;line-height:20px}
.mx-master .rb-stage-chips{grid-column:1 / -1;display:flex;flex-wrap:nowrap;gap:4px;margin:0 0 4px;overflow-x:auto;min-width:0;max-width:100%;overscroll-behavior-x:contain}
.fx .mx-master .rb-stage-chips .fx-chip{flex:none;white-space:nowrap;font-size:13px;padding:0 8px}
.mx-master .rb-filter-panel{display:flex;flex-wrap:wrap;gap:4px;max-height:112px;overflow:auto;margin:0;padding:0}
.mx-master .rb-filter-panel.is-collapsed{display:none}
.mx-master .rb-filter-panel > .filter-sheet-row{display:none}
.fx .mx-master .rb-filter-toggle{gap:4px;white-space:nowrap;font-size:13px}
.mx-master .rb-active-filters{font-size:12px;line-height:20px}
.mx-master .rb-legend{display:flex;flex-wrap:nowrap;gap:12px;box-sizing:border-box;height:28px;padding:4px 0;margin:0;overflow-x:auto;white-space:nowrap;font-size:13px;line-height:20px;scrollbar-width:none}
.mx-master .rb-legend > span{flex:none}
.mx-master .rb-graph{position:relative;margin-top:0;overflow:hidden}
.mx-master .rb-graph .rb-controls{position:absolute;z-index:2;right:8px;bottom:8px;display:flex;flex-wrap:nowrap;gap:4px;margin:0;padding:0;max-width:calc(100% - 16px);justify-content:flex-end}
.fx .mx-master .rb-controls .fx-chip{flex:none;box-sizing:border-box;width:auto;height:36px;min-height:36px;min-width:36px;padding:0 8px;font-size:13px;white-space:nowrap}
@media(max-width:700px){
 .fx #work{padding-top:12px}
 .fx .mx-master #rb-q,.fx .mx-master #rb-search > button{height:44px;min-height:44px}
 .mx-master .rb-search-count{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
 .mx-master .rb-series-row .rb-chips{max-height:44px;margin:0}
 .fx .mx-master .rb-series-row .rb-chips.filter-sheet-ready > .fx-chip{display:none}
 .fx .mx-master .rb-series-row .filter-sheet-trigger{height:44px;min-height:44px;padding:0 10px}
 .fx .mx-master .rb-series-row button.rb-mobile-toggle{height:44px;min-height:44px;flex:none;margin:0;padding:0 10px}
 .mx-master .rb-scene-row{gap:4px}
 .mx-master .rb-map-heading{line-height:44px}
 .fx .mx-master .rb-scene-views .rb-seg{height:44px;min-height:44px;min-width:44px;padding:0 4px}
 .mx-master .rb-filter-panel.filter-sheet-ready{display:none}
 .mx-master .rb-graph,.mx-master .rb-detail .rb-graph{height:56vh;min-height:52vh}
 .fx .mx-master .rb-controls .fx-chip{height:44px;min-height:44px;min-width:44px;padding:0 6px}
 /* Keep the touch card above the controls, so Back stays reachable in L2. */
 .mx-master .rb-card,.mx-master .rb-card.rb-card-left{bottom:60px}
}
@media(pointer:coarse){
 .fx .mx-master .rb-controls .fx-chip{height:44px;min-height:44px;min-width:44px}
 .fx .mx-master .rb-scene-views .rb-seg{height:44px;min-height:44px;min-width:44px}
}

/* This -1 tab stop is a programmatic reading destination, not a control. */
.mx-master #rb-view[tabindex="-1"]:focus{outline:none}

/* R7: two complete legend lines; L1 phone top budget stays under 360px
   (57 site bar + 12 inset + 52 search + 96 toolbar + 44 legend = 261). */
@media(max-width:700px){
 .mx-master .rb-legend{flex-wrap:wrap;height:auto;min-height:44px;gap:0 12px;overflow:visible;white-space:normal;font-size:12px;line-height:18px}
 .mx-master .rb-legend > span{flex:0 1 auto;max-width:100%;overflow-wrap:anywhere}
 .mx-master .rb-legend > span:last-child{flex-basis:100%}
 .mx-master [data-map-level="0"] .rb-legend > span{flex-basis:100%}
 .mx-master [data-map-level="0"] .rb-graph{height: max(320px, 92vw);min-height:0;max-height:56vh}
}

/* R8: relation identity and parent context. */
.mx-master .rb-line.author{border-top:2px dotted #b08fd9}
.mx-master .rb-line.topic{border-top:2px dashed #e0916b}
.rb-card-via,.rb-card-stage{display:block;margin:6px 0;color:var(--muted,#596579)}

@media (max-width:640px){.fx .mx-master .rb-stage-chips{flex-wrap:wrap;overflow-x:visible}}
