/* V9.3 | Wikipedia-like term explanations without overwhelming the lecture.
   Inline terms are short affordances; explanatory content is an on-demand dialog. */
#book-reader .history-term-inline{
  display:inline!important;white-space:normal!important;
  vertical-align:baseline!important;position:relative;
  padding:0 .06em!important;margin:0!important;
  background:transparent!important;color:inherit!important;
  border:0!important;border-bottom:1px dotted currentColor!important;
  border-radius:0!important;box-shadow:none!important;
  font:inherit!important;line-height:inherit!important;
  text-align:inherit!important;letter-spacing:inherit!important;
  cursor:help!important;
  text-decoration:none!important;
  -webkit-appearance:none;appearance:none;
}
#book-reader .history-term-inline::after{
  content:"?";display:inline-grid;place-items:center;vertical-align:.25em;
  width:1.05em;height:1.05em;margin-left:.13em;
  border:1px solid currentColor;border-radius:50%;
  font:700 .55em/1 var(--os-ui-font,"Noto Sans TC",sans-serif);
  opacity:.72;
}
#book-reader .history-term-inline:hover{
  background:color-mix(in srgb,var(--os-ink,#23736b) 13%,transparent)!important;
  border-bottom-style:solid!important;
}
#book-reader .history-term-inline:focus-visible,
#book-reader .history-term-index-button:focus-visible{
  outline:3px solid #e7a43a!important;outline-offset:2px;
}
#book-reader .book-leaf-top .history-term-index-button{
  order:7;flex:0 0 auto;
  margin-left:auto!important;min-height:24px!important;
  max-width:115px;white-space:nowrap!important;
  padding:.19rem .42rem!important;cursor:pointer!important;
  background:var(--os-button,#e8e0cf)!important;
  color:var(--os-button-ink,#29443e)!important;
  border:1px solid var(--os-line,#aa9a80)!important;
  border-radius:var(--os-radius,3px)!important;
  font:700 .67rem/1.25 var(--os-ui-font,"Noto Sans TC",sans-serif)!important;
  letter-spacing:0!important;
}
#book-reader .book-leaf-top .history-term-index-button:hover{
  filter:brightness(1.07);
}
#book-reader .history-term-dialog{
  position:fixed;inset:0;margin:auto;
  width:min(710px,94vw);height:auto;max-width:94vw;max-height:min(740px,90dvh);
  padding:0;overflow:hidden;
  border:2px solid var(--os-line,#aab8af);
  background:var(--os-client,#f8f6ef);color:var(--os-ink,#213d39);
  border-radius:var(--os-radius,8px);
  box-shadow:0 23px 80px #0009;
  font-family:var(--os-ui-font,"Noto Sans TC",sans-serif);
}
#book-reader .history-term-dialog::backdrop{
  background:#0a1824c9;backdrop-filter:blur(5px);
}
#book-reader .history-term-dialog[open]{
  display:flex;flex-direction:column;
}
#book-reader .history-term-shell{
  display:flex;flex-direction:column;min-height:0;
  width:100%;height:min(650px,86dvh);
}
#book-reader .history-term-header{
  flex:none;display:flex;justify-content:space-between;align-items:center;
  gap:.6rem;min-width:0;
  padding:clamp(.7rem,1.4vw,1rem) clamp(.8rem,2vw,1.4rem);
  color:var(--os-title-ink,#f6f1e7);
  background:var(--os-titlebar,#213d36);
  border-bottom:1px solid var(--os-line,#99afa6);
}
#book-reader .history-term-heading{min-width:0;}
#book-reader .history-term-heading h2{
  font:750 clamp(1.08rem,2vw,1.5rem)/1.3 var(--os-ui-font,"Noto Sans TC",sans-serif);
  color:inherit;margin:.18rem 0 0;overflow-wrap:anywhere;
}
#book-reader .history-term-eyebrow{
  font:.67rem/1.4 ui-monospace,Consolas,monospace;
  color:inherit;opacity:.74;letter-spacing:.03em;
}
#book-reader .history-term-controls{
  flex:none;display:flex;align-items:center;gap:.35rem;
}
#book-reader .history-term-controls button{
  flex:none;white-space:nowrap;cursor:pointer;
  padding:.43rem .6rem;min-height:35px;
  border:1px solid var(--os-line,#91a49e);
  border-radius:var(--os-radius,4px);
  color:var(--os-button-ink,#2e4e47);
  background:var(--os-button,#f1f3ef);
  font:750 .75rem/1.25 var(--os-ui-font,"Noto Sans TC",sans-serif);
}
#book-reader .history-term-controls button[hidden],
#book-reader .history-term-filter[hidden]{display:none!important;}
#book-reader .history-term-body{
  flex:1;min-height:0;
  overflow:auto;overscroll-behavior:contain;
  background:var(--os-client,#f8faf7);
  padding:clamp(.8rem,2vw,1.5rem);
}
#book-reader .history-term-filter{
  display:flex;align-items:center;min-height:43px;
  margin-bottom:.85rem;
}
#book-reader .history-term-search{
  width:100%;height:40px;min-width:0;
  padding:.48rem .75rem;
  background:var(--os-window,#fff);
  color:var(--os-ink,#173c34);
  border:1px solid var(--os-line,#9ab3aa);
  border-radius:var(--os-radius,4px);
  font:400 .9rem/1.3 var(--os-ui-font,"Noto Sans TC",sans-serif);
}
#book-reader .history-term-intro{
  font:.83rem/1.65 var(--os-ui-font,"Noto Sans TC",sans-serif);
  color:var(--os-ink,#315c50);margin:.3rem 0 1rem;
}
#book-reader .history-term-list{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
  gap:.55rem;
}
#book-reader .history-term-list-item{
  display:flex;flex-direction:column;align-items:flex-start;
  min-width:0;cursor:pointer;text-align:left;
  padding:.85rem;background:var(--os-window,#fff);
  color:var(--os-ink,#204a40);
  border:1px solid var(--os-line,#c3d3c9);
  border-radius:var(--os-radius,6px);
  font:400 .8rem/1.55 var(--os-ui-font,"Noto Sans TC",sans-serif);
}
#book-reader .history-term-list-item:hover{filter:brightness(.96)}
#book-reader .history-term-list-item strong{
  font-size:.98rem;line-height:1.4;margin-bottom:.35rem;
}
#book-reader .history-term-list-item span{
  display:-webkit-box;-webkit-box-orient:vertical;
  -webkit-line-clamp:3;overflow:hidden;opacity:.83;
}
#book-reader .history-term-entry{
  max-width:630px;margin:0 auto;
  font-family:var(--os-ui-font,"Noto Sans TC",sans-serif);
}
#book-reader .history-term-label{
  font-size:.73rem;font-weight:800;letter-spacing:.02em;
  margin:.8rem 0 .28rem;
  color:var(--os-ink,#43695e);opacity:.72;
}
#book-reader .history-term-explain{
  font-size:clamp(1.08rem,2vw,1.34rem);line-height:1.75;
  font-weight:750;margin:.35rem 0 .75rem;
  color:var(--os-ink,#223c36);
}
#book-reader .history-term-example,
#book-reader .history-term-detail{
  font-size:1rem;line-height:1.7;margin:.15rem 0 .8rem;
  color:var(--os-ink,#344a40);
}
#book-reader .history-term-example{
  border-left:4px solid var(--os-line,#7ea894);
  padding:.65rem .8rem;
  background:var(--os-window,#f0f7f2);
}
#book-reader .history-term-source{
  display:inline-block;margin-top:1.1rem;line-height:1.5;
  color:var(--os-ink,#1f5b86)!important;
  border-bottom:1px solid currentColor;
  font-size:.84rem;font-weight:700;
}
#book-reader .history-term-empty{font-size:.9rem;line-height:1.6}
#book-reader .history-term-dialog :is(button,a,input):focus-visible{
  outline:3px solid #e5a444;outline-offset:2px;
}
@media(max-width:980px){
 #book-reader .book-leaf-top .history-term-index-button{
   flex:0 0 30px!important;width:30px;min-width:30px;max-width:30px;
   height:27px;min-height:27px!important;
   font-size:0!important;line-height:0!important;
   padding:0!important;
   display:grid!important;place-items:center;
 }
 #book-reader .book-leaf-top .history-term-index-button::after{
   content:"?";font:800 .83rem/1 var(--os-ui-font,"Noto Sans TC",sans-serif);
 }
}
@media(max-width:650px){
 #book-reader .history-term-dialog{
   width:100vw;height:100dvh;max-width:100vw;max-height:100dvh;
   border:0;border-radius:0;
 }
 #book-reader .history-term-shell{height:100dvh;}
 #book-reader .history-term-header{padding:.7rem .65rem;}
 #book-reader .history-term-heading h2{font-size:1.08rem;}
 #book-reader .history-term-eyebrow{font-size:.57rem;}
 #book-reader .history-term-controls button{font-size:.68rem;min-height:32px;padding:.35rem .4rem;}
 #book-reader .history-term-body{padding:.8rem;}
 #book-reader .history-term-list{grid-template-columns:1fr;gap:.42rem;}
 #book-reader .history-term-list-item{padding:.7rem;}
 #book-reader .history-term-explain{font-size:1.08rem;}
 #book-reader .history-term-example,#book-reader .history-term-detail{font-size:.91rem;}
}
@media(max-height:500px){
 #book-reader .history-term-header{padding:.35rem .5rem;}
 #book-reader .history-term-shell{height:94dvh;}
 #book-reader .history-term-dialog{max-height:95dvh;}
 #book-reader .history-term-body{padding:.55rem;}
 #book-reader .history-term-list-item{padding:.45rem;}
}
@media(prefers-reduced-motion:reduce){
 #book-reader .history-term-dialog *{scroll-behavior:auto!important;animation:none!important;}
}

/* Classic Finder's original fixed-size title needs to flex at 320px;
   retain the historic titlebar but do not push the Guide or Glossary offscreen. */
@media(max-width:360px){
 #book-reader[data-os-family=mac] .book-leaf-top .book-os-window-title{
  flex:1 1 0%!important;min-width:0!important;max-width:none!important;
  overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;
 }
}


/* The original explainer window also offers the page glossary. */
#book-reader .book-evidence-demo-header .book-evidence-demo-help{
  flex:none;white-space:nowrap;min-height:32px;cursor:pointer;
  border:1px solid var(--os-line,#adc1b6);
  border-radius:var(--os-radius,3px);
  padding:.32rem .65rem;
  background:var(--os-button,#eff5ee);
  color:var(--os-button-ink,#183e35);
  font:700 .74rem/1.3 var(--os-ui-font,"Noto Sans TC",sans-serif);
  margin-left:auto;
}
#book-reader .book-evidence-demo-header .book-evidence-demo-help:focus-visible{
  outline:3px solid #e5a444;outline-offset:2px;
}
@media(max-width:650px){
 #book-reader .book-evidence-demo-header .book-evidence-demo-help{
  font-size:.65rem;min-height:31px;padding:.3rem .35rem;
 }
}
