/* US Air Guitar — Official Rulebook reader
   Palette and type carried over from the printed rulebook. */
:root{
  --navy:#002D62;
  --red:#EE3123;
  --ink:#161719;
  --gray:#6B7280;
  --rule:#D4D7DD;
  --paper:#FFFFFF;
  --desk:#E8EAEE;
  --wash:#F4F5F7;
  --body:'Tinos',Times,'Times New Roman',serif;
  --form:'Barlow Condensed','Barlow',Arial,sans-serif;
  --sheet-w:44rem;
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
html{-webkit-text-size-adjust:100%}
body{
  background:var(--desk);
  color:var(--ink);
  font-family:var(--body);
  font-size:17px;
  line-height:1.5;
  display:flex;
  flex-direction:column;
  min-height:100vh;
  min-height:100dvh;
}

/* ------------------------------------------------------------ topbar */
.topbar{
  position:sticky;top:0;z-index:20;
  background:var(--navy);color:#fff;
  box-shadow:0 1px 0 rgba(0,0,0,.2);
}
.tb-in{
  max-width:var(--sheet-w);margin:0 auto;
  padding:.5rem 1.1rem .55rem;
  display:flex;align-items:center;gap:1rem;justify-content:space-between;
}
.brand{display:flex;flex-direction:column;line-height:1.05;min-width:0}
.brand-a{
  font-family:var(--form);font-weight:700;font-size:.95rem;
  letter-spacing:.09em;color:#fff;
}
.brand-b{
  font-family:var(--form);font-weight:400;font-size:.82rem;
  letter-spacing:.05em;color:#9DB4D0;
}
.counter{display:flex;align-items:center;gap:.5rem;flex:none}
.c-num{
  font-family:var(--form);font-weight:700;font-size:1.7rem;
  color:#fff;line-height:1;font-variant-numeric:tabular-nums;
}
.c-lab{
  font-family:var(--form);font-size:.62rem;line-height:1.12;
  letter-spacing:.08em;text-transform:uppercase;color:#9DB4D0;
}
.progress{height:3px;background:#00214A}
.bar{height:100%;width:0;background:var(--red);transition:width .28s ease}

/* ------------------------------------------------------------ sheet */
#scroll{flex:1;overflow-y:auto;padding:1.4rem 1rem 2.4rem}
.sheet{
  max-width:var(--sheet-w);margin:0 auto;
  background:var(--paper);
  border:1px solid var(--rule);
  border-top:3px solid var(--navy);
  padding:2.1rem 2.3rem 1.5rem;
  box-shadow:0 1px 3px rgba(16,24,40,.07),0 8px 26px rgba(16,24,40,.06);
}
.loading{
  max-width:var(--sheet-w);margin:0 auto 1rem;text-align:center;
  color:var(--gray);font-family:var(--form);letter-spacing:.06em;
}
.err{color:var(--red)}

/* part + chapter heads */
.partbar{
  border-top:2px solid var(--navy);border-bottom:2px solid var(--navy);
  padding:.55rem 0;margin:0 0 1.5rem;text-align:center;
}
.part-label{
  font-family:var(--form);font-size:.7rem;font-weight:600;
  letter-spacing:.19em;color:var(--red);text-transform:uppercase;
}
.part-title{
  font-family:var(--form);font-size:1.28rem;font-weight:600;
  letter-spacing:.02em;color:var(--navy);
}
.chaphead{margin:0 0 1.5rem;border-bottom:2.5px solid var(--red);padding-bottom:.5rem}
.chap-label{
  font-family:var(--form);font-size:.76rem;font-weight:600;
  letter-spacing:.17em;color:var(--red);text-transform:uppercase;
}
.chap-title{
  font-family:var(--form);font-weight:600;font-size:1.92rem;
  line-height:1.1;color:var(--navy);margin:.14rem 0 0;letter-spacing:.005em;
}

/* body copy */
.body p{margin:0 0 .82rem;text-align:justify;hyphens:auto}
.sec{font-family:var(--form);color:var(--navy);margin:1.35rem 0 .42rem;line-height:1.22}
h2.sec{font-size:1.18rem;font-weight:600}
h3.sec{font-size:1.02rem;font-weight:600}
h4.sec{font-size:.94rem;font-weight:600;color:#243B57}
.secno{color:var(--red);font-weight:600;margin-right:.14em;white-space:nowrap}
.dterm{font-family:var(--form);font-weight:600;font-size:1.03em;letter-spacing:.01em}
.math{font-family:var(--body);white-space:nowrap}
.uc{text-transform:uppercase}
code{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:.86em}

/* definition lists */
.defs{margin:.5rem 0 1rem}
.defs dt{
  font-family:var(--form);font-weight:600;font-size:1.05rem;
  color:var(--navy);margin-top:.75rem;
}
.defs dd{margin:.1rem 0 0;text-align:justify}

.lst{margin:.2rem 0 .9rem;padding-left:1.5rem}
.lst li{margin-bottom:.24rem}

/* tables */
.tw{overflow-x:auto;margin:.7rem 0 1rem;-webkit-overflow-scrolling:touch}
.tw table{border-collapse:collapse;width:100%;font-family:var(--form);font-size:.93rem}
.tw th{
  text-align:left;font-weight:600;color:var(--navy);
  border-top:1.5px solid var(--navy);border-bottom:1px solid var(--navy);
  padding:.34rem .55rem .3rem;white-space:nowrap;
}
.tw td{border-bottom:1px solid var(--rule);padding:.3rem .55rem;vertical-align:top}
.tw tr:last-child td{border-bottom:1.5px solid var(--navy)}
.tcont{font-family:var(--form);font-size:.76rem;color:var(--gray);
  letter-spacing:.09em;text-transform:uppercase;margin:0 0 .2rem}

/* footnote refs + block */
sup.fn{line-height:0}
.fnref{
  font-family:var(--form);font-size:.72em;font-weight:600;
  color:var(--red);background:none;border:0;padding:0 .05em;
  cursor:pointer;vertical-align:super;
}
.fnref:hover{text-decoration:underline}
sup.tn{color:var(--gray);font-size:.72em}
.fnotes{margin-top:1.5rem;padding-top:.6rem;border-top:1px solid var(--rule)}
.fnote{
  display:flex;gap:.45rem;font-size:.83rem;line-height:1.38;
  color:#33363B;margin-bottom:.3rem;
}
.fnum{
  font-family:var(--form);font-weight:600;color:var(--red);
  flex:none;min-width:1.5rem;text-align:right;
}
.fnote.flash{background:#FFF3C4;transition:background .1s}
.fnote:not(.flash){transition:background 1.1s ease}
.xref{font-style:italic}

/* ---------------------------------------------- acknowledgment form */
.ack{
  margin-top:1.8rem;border:1.5px solid var(--navy);
  background:var(--wash);
}
.ack.done{background:#F1F7F1;border-color:#2F6B3D}
.ack-head{
  display:flex;flex-wrap:wrap;gap:.4rem;align-items:center;
  font-family:var(--form);font-size:.66rem;font-weight:600;
  letter-spacing:.07em;color:var(--navy);
  padding:.36rem .7rem .3rem;border-bottom:1px solid var(--rule);
  text-transform:uppercase;
}
.ack.done .ack-head{color:#2F6B3D;border-color:#C9DFCB}
.ack-head .sep{color:var(--rule)}
.ack-main{display:flex;gap:.7rem;align-items:flex-start;padding:.65rem .7rem;cursor:pointer}
.ack-main input{
  appearance:none;-webkit-appearance:none;
  flex:none;width:1.45rem;height:1.45rem;margin:.05rem 0 0;
  border:1.5px solid var(--navy);background:#fff;cursor:pointer;
  display:grid;place-content:center;border-radius:2px;
}
.ack-main input:checked{background:#2F6B3D;border-color:#2F6B3D}
.ack-main input:checked::after{
  content:"";width:.72rem;height:.4rem;
  border-left:2.5px solid #fff;border-bottom:2.5px solid #fff;
  transform:rotate(-45deg) translate(1px,-2px);
}
.ack-main input:focus-visible{outline:3px solid var(--red);outline-offset:2px}
.ack-text{font-family:var(--form);font-size:.83rem;line-height:1.33;color:#2B2E33}
.ack-text strong{color:var(--navy);letter-spacing:.04em}
.ack-foot{
  display:flex;flex-wrap:wrap;gap:.35rem 1.1rem;
  padding:.32rem .7rem .5rem;
  font-family:var(--form);font-size:.7rem;color:var(--gray);
  border-top:1px dotted var(--rule);
}
.ack-foot .fill{color:var(--navy);font-weight:600}
.ack-foot .pgno{margin-left:auto}

.complete{margin-top:1.6rem;text-align:center;padding-bottom:.6rem}
.c-rule{height:3px;background:var(--navy);margin-bottom:.1rem}
.c-label{font-family:var(--form);font-size:.68rem;letter-spacing:.16em;
  color:var(--gray);margin-top:.55rem}
.complete h2{font-family:var(--form);color:var(--navy);font-size:1.5rem;
  margin:.1rem 0 .4rem;font-weight:600}
.complete p{font-size:.95rem;color:#33363B;max-width:32rem;margin:0 auto;text-align:center}

/* ------------------------------------------------------------ navbar */
.navbar{
  position:sticky;bottom:0;z-index:20;
  background:#fff;border-top:1px solid var(--rule);
  box-shadow:0 -2px 14px rgba(16,24,40,.07);
}
.nb-in{
  max-width:var(--sheet-w);margin:0 auto;
  padding:.6rem 1.1rem .35rem;
  display:flex;align-items:center;gap:.7rem;
}
.nb-mid{flex:1;min-width:0;text-align:center}
.nb-where{display:flex;flex-direction:column;line-height:1.15}
.nb-page{font-family:var(--form);font-size:.88rem;color:var(--navy)}
.nb-page b{font-weight:700;font-variant-numeric:tabular-nums}
.nb-ch{
  font-family:var(--form);font-size:.7rem;color:var(--gray);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.gate{
  margin:.2rem 0 0;font-family:var(--form);font-size:.74rem;
  color:var(--red);letter-spacing:.03em;
}
.btn{
  font-family:var(--form);font-size:.92rem;font-weight:600;letter-spacing:.03em;
  border:1.5px solid var(--navy);background:#fff;color:var(--navy);
  padding:.46rem .85rem;cursor:pointer;border-radius:2px;flex:none;
  transition:background .15s,color .15s,opacity .15s;
}
.btn.primary{background:var(--navy);color:#fff}
.btn.primary:hover:not(:disabled){background:#003C82}
.btn.ghost:hover:not(:disabled){background:var(--wash)}
.btn:disabled{opacity:.34;cursor:not-allowed}
.btn:focus-visible{outline:3px solid var(--red);outline-offset:2px}

.nb-tools{
  max-width:var(--sheet-w);margin:0 auto;
  padding:0 1.1rem .5rem;
  display:flex;flex-wrap:wrap;gap:.35rem .9rem;align-items:center;
  font-family:var(--form);font-size:.76rem;color:var(--gray);
}
.tool{display:flex;align-items:center;gap:.3rem}
.tool input,.tool select{
  font-family:var(--form);font-size:.78rem;color:var(--navy);
  border:1px solid var(--rule);background:#fff;padding:.16rem .3rem;
  border-radius:2px;
}
.tool input{width:3.4rem;text-transform:uppercase;letter-spacing:.08em}
.linkbtn{
  font-family:var(--form);font-size:.76rem;color:var(--navy);
  background:none;border:0;border-bottom:1px solid var(--rule);
  padding:0 0 1px;cursor:pointer;
}
.linkbtn:hover{border-color:var(--navy)}
.linkbtn.danger{color:var(--red);margin-left:auto}

/* ------------------------------------------------------------ modal */
.modal{
  position:fixed;inset:0;z-index:40;background:rgba(0,20,45,.55);
  display:flex;align-items:center;justify-content:center;padding:1rem;
}
.modal[hidden]{display:none}
.modal-in{
  background:#fff;border-top:3px solid var(--navy);
  max-width:34rem;width:100%;max-height:86vh;
  display:flex;flex-direction:column;padding:1rem 1.2rem 1.1rem;
}
.modal-head{display:flex;justify-content:space-between;align-items:flex-start;gap:1rem}
.m-label{font-family:var(--form);font-size:.68rem;letter-spacing:.16em;color:var(--red)}
.modal-head h2{font-family:var(--form);color:var(--navy);font-size:1.25rem;
  margin:.05rem 0 0;font-weight:600}
.m-note{font-size:.84rem;color:var(--gray);margin:.5rem 0 .6rem}
.m-scroll{overflow-y:auto;border-top:1px solid var(--rule);flex:1}
.ledger{width:100%;border-collapse:collapse;font-family:var(--form);font-size:.8rem}
.ledger th{
  position:sticky;top:0;background:#fff;text-align:left;color:var(--navy);
  border-bottom:1px solid var(--navy);padding:.25rem .4rem;
}
.ledger td{padding:.16rem .4rem;border-bottom:1px solid #EFF1F4;color:var(--gray)}
.ledger tr.y td{color:var(--navy)}
.m-recon{
  display:flex;flex-wrap:wrap;gap:.3rem 1rem;padding-top:.55rem;
  border-top:1.5px solid var(--navy);margin-top:.5rem;
  font-family:var(--form);font-size:.8rem;color:var(--gray);
}
.m-recon b{color:var(--navy)}

/* ------------------------------------------------------------ mobile */
@media (max-width:640px){
  body{font-size:16px}
  .sheet{padding:1.4rem 1.15rem 1.1rem}
  .chap-title{font-size:1.5rem}
  .body p{text-align:left}
  .defs dd{text-align:left}
  .c-num{font-size:1.4rem}
  .nb-in{padding:.5rem .8rem .3rem;gap:.45rem}
  .btn{padding:.44rem .6rem;font-size:.86rem}
  .nb-tools{padding:0 .8rem .45rem;font-size:.72rem}
  .nb-ch{display:none}
  .ack-foot{font-size:.66rem;gap:.25rem .7rem}
  .ack-foot .pgno{margin-left:0}
}

@media (prefers-reduced-motion:reduce){
  *{animation:none!important;transition:none!important;scroll-behavior:auto!important}
}

/* ============================================================ PAGE VIEW */
.stage{
  max-width:100%;
  display:flex;justify-content:center;
  padding:0 0 .5rem;
}
.pagesheet{
  position:relative;
  background:#fff;
  border:1px solid var(--rule);
  box-shadow:0 1px 3px rgba(16,24,40,.10),0 10px 30px rgba(16,24,40,.10);
  max-width:100%;
}
#pagecanvas{display:block;width:100%;height:auto}

/* the interactive box, sitting exactly over the printed one */
.tickoverlay{
  position:absolute;
  cursor:pointer;
  border-radius:2px;
  box-shadow:0 0 0 2px rgba(238,49,35,.55);
  background:rgba(238,49,35,.07);
  transition:background .12s,box-shadow .12s;
}
.tickoverlay:hover{background:rgba(238,49,35,.16)}
.tickoverlay:focus-visible{outline:3px solid var(--red);outline-offset:3px}
.tickoverlay.checked{
  background:transparent;
  box-shadow:0 0 0 2px rgba(47,107,61,.5);
}
/* the tick mark itself, drawn to fit the printed square */
.tickoverlay.checked::after{
  content:"";position:absolute;
  left:18%;top:24%;width:64%;height:34%;
  border-left:2.5px solid #1F5B2C;
  border-bottom:2.5px solid #1F5B2C;
  transform:rotate(-45deg);
}

.ackbar{
  max-width:var(--sheet-w);margin:.55rem auto 0;
  display:flex;align-items:center;gap:.5rem;
  font-family:var(--form);font-size:.82rem;color:var(--red);
  background:#FFF4F3;border:1px solid #F6C9C4;
  padding:.4rem .7rem;border-radius:2px;
}
.ackbar.done{color:#2F6B3D;background:#F1F7F1;border-color:#C9DFCB}
.ackbar-dot{
  width:.5rem;height:.5rem;border-radius:50%;
  background:currentColor;flex:none;
}

/* view toggle + zoom */
.viewtoggle{display:inline-flex}
.seg{
  font-family:var(--form);font-size:.76rem;color:var(--navy);
  background:#fff;border:1px solid var(--rule);
  padding:.16rem .5rem;cursor:pointer;
}
.seg:first-child{border-radius:2px 0 0 2px}
.seg:last-child{border-left:0;border-radius:0 2px 2px 0}
.seg.on{background:var(--navy);color:#fff;border-color:var(--navy)}
.zbtn{
  font-family:var(--form);font-size:.9rem;line-height:1;color:var(--navy);
  background:#fff;border:1px solid var(--rule);border-radius:2px;
  width:1.5rem;height:1.4rem;cursor:pointer;
}
.zbtn:hover{background:var(--wash)}
#zoomtools[hidden]{display:none}

@media (max-width:640px){
  .stage{padding:0}
  .ackbar{font-size:.76rem;margin-top:.45rem}
}

/* the status bar doubles as a larger tap target for the tick box */
button.ackbar{width:100%;max-width:var(--sheet-w);cursor:pointer;text-align:left;
  font-family:var(--form);}
button.ackbar:hover{filter:brightness(.985)}
button.ackbar:focus-visible{outline:3px solid var(--red);outline-offset:2px}
