/* ============================================================================
   studio_textbooks.css — TEXTBOOKS on the web studio layer (owner order 2026-10-29; ENGINEERING §5bh).
   Drawn only for /me.textbooks accounts (studio_textbooks.js); every rule sits under #tb1 or a tb1- class, so no
   other screen can match one. 1 = Today tile (b1's portal shell, in Listening's place) · 2 = Learn section (the
   Guided Video Lessons feature-card tokens + a bookshelf rail) · 3 = the reader, ported from Codex's viewer.css
   (webapp-viewer-r01), colours mapped onto the app tokens; the PDF page itself stays white paper in both themes.
   ============================================================================ */

/* ---------------------------------------------------------------- 1. Today -- */
/* Owner 10-29: the premium night tile, like Guided (video still) and Constellation (live map). A real page of the
   book lies on a leather-dark desk, its word-tap underlines drawn from the overlays; one word at a time lights up and
   the chip shows its Thai + English (studio_textbooks.js startToday). The tile is night-toned in both themes, as the
   Guided and Constellation tiles are. */
body.hts-studio.hts-studio.hts-studio .tb1-tile{color:#fff;border-color:transparent;clip-path:inset(0 round 19px);
  background:radial-gradient(130% 110% at 78% 8%,#4a3420 0%,#2a1c10 52%,#170f08 100%)}
body.hts-studio.hts-studio.hts-studio .w6-console .gl-tiles .tb1-tile{color:#fff}
body.hts-studio.hts-studio.hts-studio .tb1-tile .b1-over{color:#f3cf86;text-shadow:0 1px 8px rgba(20,12,4,.7)}
body.hts-studio.hts-studio.hts-studio .tb1-tile .b1-card__go{color:#fff;text-shadow:0 1px 8px rgba(20,12,4,.7)}
body.hts-studio.hts-studio.hts-studio .tb1-tile .b1-title{color:#fff}
body.hts-studio.hts-studio.hts-studio .tb1-tile .b1-card__foot small{color:#f1dfbd;opacity:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
/* the desk: the page is 240% of the tile's width; its focus point (--fx/--fy, the densest run of glossed words,
   hugging the left margin) sits at 66% / 43% of the tile, so the page's edge and stack show down the left, and the page turns -6deg about that point */
body.hts-studio .tb1-tile .tb1-desk{position:absolute;inset:0;z-index:0;overflow:hidden;border-radius:inherit;pointer-events:none}
body.hts-studio .tb1-tile .tb1-pg{position:absolute;left:66%;top:43%;width:240%;display:block;
  transform-origin:calc(var(--fx) * 100%) calc(var(--fy) * 100%);
  transform:translate(calc(var(--fx) * -100%),calc(var(--fy) * -100%)) rotate(-6deg);
  transition:transform .6s cubic-bezier(.2,.7,.3,1)}
body.hts-studio .tb1-tile:hover .tb1-pg{transform:translate(calc(var(--fx) * -100%),calc(var(--fy) * -100%)) rotate(-5deg) scale(1.025)}
body.hts-studio .tb1-tile .tb1-pg::before,body.hts-studio .tb1-tile .tb1-pg::after{content:"";position:absolute;inset:0;z-index:-1;border-radius:3px;background:#efe6d3}
body.hts-studio .tb1-tile .tb1-pg::before{transform:translate(-1.1%,.9%) rotate(-1.6deg);background:#e4d7bd;box-shadow:0 0 0 1px rgba(60,40,15,.18)}
body.hts-studio .tb1-tile .tb1-pg::after{transform:translate(-.5%,.45%) rotate(-.7deg);box-shadow:0 0 0 1px rgba(60,40,15,.12)}
body.hts-studio .tb1-tile .tb1-pg__img{display:block;width:100%;height:auto;border-radius:3px;background:#fff;
  box-shadow:0 2px 0 rgba(255,255,255,.4) inset,0 40px 70px -18px rgba(0,0,0,.75),0 10px 22px rgba(0,0,0,.35)}
body.hts-studio .tb1-tile .tb1-pg__hits{position:absolute;inset:0}
body.hts-studio .tb1-tile .tb1-pg__hits i{position:absolute;display:block;border-radius:2px;
  background:linear-gradient(90deg,rgba(201,138,30,.85) 40%,transparent 0) bottom left/4px 1.5px repeat-x;
  transition:background-color .35s ease,box-shadow .35s ease}
body.hts-studio .tb1-tile .tb1-pg__hits i.is-on{background-color:rgba(255,196,77,.42);
  box-shadow:0 0 0 2px rgba(255,196,77,.42),0 0 18px 4px rgba(255,190,60,.38)}
/* a slow band of lamplight across the desk */
body.hts-studio .tb1-tile .tb1-sheen{position:absolute;inset:-20%;display:block;pointer-events:none;mix-blend-mode:soft-light;
  background:linear-gradient(105deg,transparent 38%,rgba(255,236,190,.55) 50%,transparent 62%);background-size:260% 100%;
  animation:tb1Sheen 9s ease-in-out infinite}
@keyframes tb1Sheen{0%,18%{background-position:130% 0}62%,100%{background-position:-30% 0}}
body.hts-studio .tb1-tile .tb1-scrim{position:absolute;inset:0;z-index:1;pointer-events:none;border-radius:inherit;
  background:linear-gradient(180deg,rgba(23,15,8,.82) 0%,rgba(23,15,8,.35) 15%,rgba(23,15,8,0) 27%,rgba(23,15,8,0) 52%,rgba(23,15,8,.8) 78%,rgba(23,15,8,.95) 100%)}
/* the tap-to-hear chip: Thai + the dictionary English, a speaking wave, a tip pointing at the word */
body.hts-studio .tb1-tile .tb1-chip{position:absolute;left:0;top:0;z-index:2;display:flex;align-items:center;gap:8px;max-width:calc(100% - 16px);
  padding:6px 11px 6px 9px;border-radius:12px;color:#fff;pointer-events:none;
  background:rgba(28,18,8,.84);border:1px solid rgba(243,207,134,.45);box-shadow:0 10px 24px rgba(0,0,0,.45);
  -webkit-backdrop-filter:blur(8px) saturate(1.3);backdrop-filter:blur(8px) saturate(1.3);
  opacity:0;transition:opacity .22s ease,transform .45s cubic-bezier(.2,.7,.3,1)}
body.hts-studio .tb1-tile .tb1-chip.is-in{opacity:1}
body.hts-studio .tb1-tile .tb1-chip::after{content:"";position:absolute;left:var(--tip,50%);bottom:-6px;width:10px;height:10px;margin-left:-5px;
  background:inherit;border:inherit;border-width:0 1px 1px 0;transform:rotate(45deg);border-radius:0 0 2px 0}
body.hts-studio .tb1-tile .tb1-chip.is-below::after{bottom:auto;top:-6px;border-width:1px 0 0 1px;border-radius:2px 0 0 0}
body.hts-studio .tb1-tile .tb1-chip__wave{display:flex;align-items:center;gap:2px;height:16px;flex:none}
body.hts-studio .tb1-tile .tb1-chip__wave i{display:block;width:2.5px;height:100%;border-radius:2px;background:#f3cf86;transform-origin:50% 50%;
  animation:tb1Wave 1s ease-in-out infinite}
body.hts-studio .tb1-tile .tb1-chip__wave i:nth-child(2){animation-delay:-.25s}
body.hts-studio .tb1-tile .tb1-chip__wave i:nth-child(3){animation-delay:-.5s}
body.hts-studio .tb1-tile .tb1-chip__wave i:nth-child(4){animation-delay:-.75s}
@keyframes tb1Wave{0%,100%{transform:scaleY(.3)}50%{transform:scaleY(1)}}
body.hts-studio .tb1-tile .tb1-chip__txt{display:flex;flex-direction:column;min-width:0;line-height:1.15}
body.hts-studio .tb1-tile .tb1-chip__txt b{font-family:var(--app-font-thai,Thai,"Sarabun",sans-serif);font-size:16px;font-weight:600;white-space:nowrap}
body.hts-studio .tb1-tile .tb1-chip__txt small{font-size:10.5px;font-weight:600;color:#f3cf86;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@media (min-width:700px){
  body.hts-studio.hts-studio.hts-studio .b1-grid.gl-tiles .tb1-tile{clip-path:inset(0 round 24px)}
  body.hts-studio .tb1-tile .tb1-chip{padding:8px 14px 8px 11px;gap:10px}
  body.hts-studio .tb1-tile .tb1-chip__txt b{font-size:20px}
  body.hts-studio .tb1-tile .tb1-chip__txt small{font-size:12px}
}
body.hts-studio.hts-studio.hts-studio .gl-tiles--w6 .tb1-tile{clip-path:inset(0 round 24px)}
@media (prefers-reduced-motion:reduce){
  body.hts-studio .tb1-tile .tb1-sheen,body.hts-studio .tb1-tile .tb1-chip__wave i{animation:none}
  body.hts-studio .tb1-tile .tb1-pg,body.hts-studio .tb1-tile .tb1-chip,body.hts-studio .tb1-tile .tb1-pg__hits i{transition:none}
}

/* ---------------------------------------------------------------- 2. Learn -- */
body.hts-studio .tb1-learn{display:block;margin:0 0 22px}
body.hts-studio.hts-studio.hts-studio .tb1-feat{position:relative;display:flex;align-items:stretch;gap:16px;min-height:178px;margin:0 0 12px;padding:20px 22px;
  border-radius:21px;overflow:hidden;text-decoration:none;color:#fff!important;isolation:isolate;
  background:radial-gradient(ellipse at 100% 0,#7a5a2a55,transparent 70%),#102e50;border:1px solid #ffffff1a;
  box-shadow:0 14px 30px -14px #102e5099,0 2px 6px #102e5022;transition:transform .25s cubic-bezier(.2,.7,.3,1),box-shadow .25s cubic-bezier(.2,.7,.3,1)}
:root[data-theme="dark"] body.hts-studio.hts-studio.hts-studio .tb1-feat{background:radial-gradient(ellipse at 100% 0,#7a5a2a55,transparent 70%),#1b3a5b;border-color:#29425c;box-shadow:0 14px 30px -14px #0009}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) body.hts-studio.hts-studio.hts-studio .tb1-feat{background:radial-gradient(ellipse at 100% 0,#7a5a2a55,transparent 70%),#1b3a5b;border-color:#29425c}}
body.hts-studio.hts-studio.hts-studio .tb1-feat:hover{transform:translateY(-3px);box-shadow:0 20px 36px -14px #102e50aa,0 3px 8px #102e5026}
body.hts-studio.hts-studio.hts-studio .tb1-feat:active{transform:translateY(-1px) scale(.995)}
body.hts-studio.hts-studio.hts-studio .tb1-feat:focus-visible{outline:3px solid #80b5ff;outline-offset:3px}
body.hts-studio .tb1-feat__text{position:relative;z-index:2;flex:1 1 56%;min-width:0;display:flex;flex-direction:column;align-items:flex-start}
body.hts-studio.hts-studio.hts-studio .tb1-feat__eyebrow{font:600 10px/16px Inter,sans-serif;letter-spacing:.15em;color:#f2d492!important}
body.hts-studio.hts-studio.hts-studio .tb1-feat__title{margin-top:4px;font:600 24px/29px Inter,sans-serif;letter-spacing:-.7px;color:#fff!important;text-wrap:balance}
body.hts-studio.hts-studio.hts-studio .tb1-feat__stats{margin-top:6px;font:400 12.5px/18px Inter,sans-serif;color:#c6dcf7!important}
body.hts-studio .tb1-feat__prog{display:block;width:min(220px,100%);height:3px;margin-top:12px;border-radius:2px;background:#ffffff22;overflow:hidden}
body.hts-studio .tb1-feat__prog i{display:block;height:100%;background:#f2d492;border-radius:2px}
body.hts-studio.hts-studio.hts-studio .tb1-feat__progt{margin-top:5px;font:400 11px/16px Inter,sans-serif;color:#9cbde3!important}
body.hts-studio.hts-studio.hts-studio .tb1-feat__btn{margin-top:14px;display:inline-flex;align-items:center;gap:9px;height:38px;padding:0 15px;border-radius:19px;
  background:#edf4ff;color:#113a6b!important;font:600 12.5px/1 Inter,sans-serif;box-shadow:0 3px 10px #06172933;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body.hts-studio .tb1-feat__btn svg{flex:none;width:16px;height:16px;fill:none;stroke:#113a6b;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
:root[data-theme="dark"] body.hts-studio.hts-studio.hts-studio .tb1-feat__btn{background:#80b5ff;color:#06203f!important}
:root[data-theme="dark"] body.hts-studio .tb1-feat__btn svg{stroke:#06203f}
body.hts-studio .tb1-feat__fan{position:relative;z-index:1;flex:0 0 40%;min-width:130px;align-self:stretch}
body.hts-studio .tb1-feat__p{position:absolute;top:50%;left:50%;width:140px;aspect-ratio:900/650;object-fit:contain;padding:5px;border-radius:9px;background:#fbf6ea;
  border:1px solid #ffffff55;box-shadow:0 12px 22px -8px #020c18cc,0 2px 5px #020c1855;
  transform:translate(calc(-50% + var(--o) * 34px),calc(-50% + var(--o) * var(--o) * 5px)) rotate(calc(var(--o) * 7deg)) scale(calc(1 - (var(--o) * var(--o)) * .07));
  z-index:calc(10 - var(--o) * var(--o));transition:transform .35s cubic-bezier(.2,.7,.3,1);animation:tb1Drift 9s ease-in-out infinite alternate}
body.hts-studio .tb1-feat__p:is([style*="--o:-2"],[style*="--o:2"]){display:none}
body.hts-studio .tb1-feat:hover .tb1-feat__p{transform:translate(calc(-50% + var(--o) * 44px),calc(-50% + var(--o) * var(--o) * 5px - 4px)) rotate(calc(var(--o) * 9deg)) scale(calc(1 - (var(--o) * var(--o)) * .07))}
@keyframes tb1Drift{from{translate:0 0}to{translate:0 -5px}}
body.hts-studio .tb1-feat__p[style*="--o:0"]{animation-duration:7s}
@media (min-width:700px){
  body.hts-studio.hts-studio.hts-studio .tb1-feat{min-height:210px;padding:26px 30px}
  body.hts-studio.hts-studio.hts-studio .tb1-feat__title{font-size:30px;line-height:36px}
  body.hts-studio.hts-studio.hts-studio .tb1-feat__stats{font-size:14px}
  body.hts-studio .tb1-feat__fan{flex-basis:52%}
  body.hts-studio .tb1-feat__p{width:190px;transform:translate(calc(-50% + var(--o) * 58px),calc(-50% + var(--o) * var(--o) * 6px)) rotate(calc(var(--o) * 6deg)) scale(calc(1 - (var(--o) * var(--o)) * .06))}
  body.hts-studio .tb1-feat:hover .tb1-feat__p{transform:translate(calc(-50% + var(--o) * 70px),calc(-50% + var(--o) * var(--o) * 6px - 4px)) rotate(calc(var(--o) * 7deg)) scale(calc(1 - (var(--o) * var(--o)) * .06))}
  body.hts-studio .tb1-feat__p:is([style*="--o:-2"],[style*="--o:2"]){display:block}
}
@media (min-width:1200px){ body.hts-studio .tb1-feat__p{width:210px} }
/* the bookshelf: all twelve, cover + title + chapter/page counts from catalog.json */
body.hts-studio .tb1-shelf{display:flex;align-items:stretch;gap:12px;overflow-x:auto;padding:2px 2px 8px;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch;scrollbar-width:thin}
body.hts-studio .tb1-shelf[hidden]{display:none}
body.hts-studio.hts-studio.hts-studio .tb1-book{flex:0 0 clamp(150px,40vw,188px);scroll-snap-align:start;display:flex;flex-direction:column;overflow:hidden;border-radius:16px;
  background:var(--app-surface-raised);border:1px solid var(--app-line);box-shadow:var(--app-shadow-card);color:var(--app-ink);text-decoration:none;
  transition:transform .2s ease,box-shadow .2s ease}
body.hts-studio.hts-studio.hts-studio .tb1-book:hover{transform:translateY(-2px);box-shadow:var(--app-shadow-float)}
body.hts-studio.hts-studio.hts-studio .tb1-book:focus-visible{outline:3px solid #80b5ff;outline-offset:2px}
body.hts-studio .tb1-book__art{display:block;aspect-ratio:900/650;background:radial-gradient(120% 90% at 80% 12%,rgba(255,255,255,.7),transparent 62%),linear-gradient(150deg,#f8f1e3,#ebdec4)}
:root[data-theme="dark"] body.hts-studio .tb1-book__art{background:linear-gradient(150deg,#2c3548,#1f2738)}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) body.hts-studio .tb1-book__art{background:linear-gradient(150deg,#2c3548,#1f2738)}}
body.hts-studio .tb1-book__art img{display:block;width:100%;height:100%;object-fit:contain}
body.hts-studio .tb1-book__t{display:flex;flex-direction:column;gap:3px;padding:10px 12px 12px;min-width:0}
body.hts-studio.hts-studio.hts-studio .tb1-book__t small{font:600 10px/14px Inter,sans-serif;letter-spacing:.12em;color:var(--app-brand-ink)}
body.hts-studio.hts-studio.hts-studio .tb1-book__t b{font:600 14px/18px Inter,sans-serif;letter-spacing:-.2px;color:var(--app-ink);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
body.hts-studio.hts-studio.hts-studio .tb1-book__t span{margin-top:auto;padding-top:3px;font:400 11.5px/16px Inter,sans-serif;color:var(--app-ink-muted)}
@media (prefers-reduced-motion:reduce){
  body.hts-studio .tb1-feat__p{animation:none}
  body.hts-studio.hts-studio.hts-studio .tb1-feat,body.hts-studio .tb1-feat__p,body.hts-studio.hts-studio.hts-studio .tb1-book{transition:none}
}

/* --------------------------------------------------------------- 3. Reader -- */
html.tb1-on body.hts-studio .tb1-host{min-height:0}
@media (max-width:899px){html.tb1-full,html.tb1-full body{overflow:hidden}}
#tb1{--tb-ink:var(--app-ink,#17344f);--tb-muted:var(--app-ink-muted,#667b8e);--tb-panel:var(--app-surface-raised,#fff);--tb-side:var(--app-surface,#f9fbfd);
  --tb-stage:var(--app-canvas,#e5ebf1);--tb-blue:var(--app-brand,#216bce);--tb-on-blue:var(--app-on-accent,#fff);
  --tb-line:color-mix(in srgb,var(--app-line,#95accb) 50%,var(--tb-panel));--tb-hover:color-mix(in srgb,var(--tb-blue) 9%,var(--tb-panel));
  --tb-sel:color-mix(in srgb,var(--tb-blue) 14%,var(--tb-panel));--tb-sel-ink:var(--app-brand-ink,#165694);--tb-err:var(--app-negative-ink,#a53449);
  position:fixed;z-index:6;display:flex;flex-direction:column;overflow:hidden;background:var(--tb-stage);color:var(--tb-ink);
  font:400 14px/1.4 var(--app-font-latin,"Segoe UI",Arial,sans-serif);-webkit-text-size-adjust:100%}
#tb1[hidden],#tb1 [hidden]{display:none!important}
#tb1 *,#tb1 *::before,#tb1 *::after{box-sizing:border-box}
#tb1 h1,#tb1 h2,#tb1 p{margin:0;font-family:inherit;letter-spacing:normal;color:inherit;line-height:inherit}
#tb1 button,#tb1 input,#tb1 select{font:inherit;color:inherit;letter-spacing:normal;margin:0}
#tb1 button{cursor:pointer;-webkit-tap-highlight-color:transparent}
#tb1 button:disabled{opacity:.35;cursor:default}
#tb1 button:focus-visible,#tb1 a:focus-visible,#tb1 input:focus-visible,#tb1 select:focus-visible{outline:3px solid #82b7ff;outline-offset:3px}
#tb1 select,#tb1 input{height:36px;border:1px solid var(--tb-line);border-radius:7px;background:var(--tb-panel);color:var(--tb-ink);padding:0 8px}
#tb1 .tb1-toggle,#tb1 .tb1-icon{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;border:1px solid var(--tb-line);border-radius:10px;background:var(--tb-panel);color:var(--tb-ink);padding:0}
#tb1 .tb1-toggle{width:40px;height:40px}
#tb1 .tb1-icon{width:40px;height:40px;font-size:23px;line-height:1}
#tb1 .tb1-toggle:hover,#tb1 .tb1-icon:hover,#tb1 .tb1-control:hover{background:var(--tb-hover)}
#tb1 .tb1-ws{flex:1;min-height:0;display:grid;grid-template-columns:280px minmax(0,1fr)}
#tb1 .tb1-side{min-height:0;display:flex;flex-direction:column;background:var(--tb-side);border-right:1px solid var(--tb-line)}
#tb1 .tb1-menu-head{display:flex;align-items:center;justify-content:space-between;padding:25px 22px 15px;gap:12px}
#tb1 .tb1-menu-head h1{font-size:23px;font-weight:650;letter-spacing:-.6px;margin:3px 0 0;line-height:1.2}
#tb1 .tb1-eyebrow{font-size:10px;font-weight:650;letter-spacing:1.3px;color:var(--tb-muted)}
#tb1 .tb1-menu-head .tb1-icon{display:none}
#tb1 .tb1-side-top{padding:0 20px 19px;border-bottom:1px solid var(--tb-line)}
#tb1 .tb1-book-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:5px}
#tb1 .tb1-chip{border:1px solid var(--tb-line);border-radius:7px;background:var(--tb-panel);color:var(--tb-ink);height:34px;font-size:12px;padding:0}
#tb1 .tb1-chip[aria-pressed=true]{background:var(--tb-blue);color:var(--tb-on-blue);border-color:var(--tb-blue)}
#tb1 .tb1-side-top h2{font-size:16px;line-height:1.35;margin:17px 0 4px;font-weight:650}
#tb1 .tb1-side-top p{font-size:12px;color:var(--tb-muted);margin:0}
#tb1 .tb1-contents-head{padding:17px 20px 8px}
#tb1 .tb1-search{margin-top:9px;width:100%;height:38px;padding:0 10px;font-size:12px}
#tb1 .tb1-contents{overflow:auto;overscroll-behavior:contain;flex:1;min-height:90px;padding:0 10px 12px;scrollbar-width:thin}
#tb1 .tb1-toc{display:grid;grid-template-columns:minmax(0,1fr) 28px;gap:8px;width:100%;text-align:left;background:transparent;border:1px solid transparent;border-radius:7px;padding:10px;font-size:12px;color:var(--tb-muted);line-height:1.4;margin:2px 0}
#tb1 .tb1-toc:hover{background:var(--tb-hover)}
#tb1 .tb1-toc.is-current{background:var(--tb-sel);color:var(--tb-sel-ink);border-color:color-mix(in srgb,var(--tb-blue) 30%,var(--tb-panel))}
#tb1 .tb1-toc.is-chapter{font-weight:600}
#tb1 .tb1-toc.is-part{margin-top:13px;padding-top:14px;border-top:1px solid var(--tb-line);border-radius:0;font-size:10px;letter-spacing:.6px}
#tb1 .tb1-toc-page{text-align:right;color:var(--tb-muted);font-variant-numeric:tabular-nums}
#tb1 .tb1-menu-foot{padding:12px 20px 17px;border-top:1px solid var(--tb-line);background:var(--tb-side);font-size:11px;line-height:1.65;color:var(--tb-muted)}
#tb1 .tb1-menu-foot p{margin:0 0 6px}
#tb1 .tb1-mobile-hint,#tb1 .tb1-exit{display:none}
#tb1 .tb1-mainc{min-width:0;min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr) 35px}
#tb1 .tb1-toolbar{display:flex;align-items:center;gap:18px;padding:14px 22px;border-bottom:1px solid var(--tb-line);background:var(--tb-panel);flex-wrap:wrap}
#tb1 .tb1-book-field{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--tb-muted)}
#tb1 .tb1-book-field select{width:195px;font-size:12px}
#tb1 .tb1-page-controls,#tb1 .tb1-page-form,#tb1 .tb1-zoom-controls{display:flex;align-items:center;gap:7px}
#tb1 .tb1-page-form label,#tb1 .tb1-page-total{font-size:12px;color:var(--tb-muted)}
#tb1 .tb1-page-form input{width:60px;font-size:13px;font-weight:600}
#tb1 .tb1-control{display:inline-flex;align-items:center;justify-content:center;min-height:36px;padding:0 11px;border:1px solid var(--tb-line);border-radius:7px;background:var(--tb-panel);color:var(--tb-ink);font-size:12px;text-decoration:none;white-space:nowrap}
#tb1 .tb1-nav{width:34px;font-size:23px;padding:0}
#tb1 .tb1-zoom-controls{margin-left:auto}
#tb1 .tb1-zoom{width:96px;font-size:12px}
#tb1 .tb1-original{font-size:11px}
#tb1 .tb1-stage{min-width:0;min-height:0;position:relative;overflow:auto;overscroll-behavior:contain;background:var(--tb-stage);scrollbar-width:thin;touch-action:pan-x pan-y pinch-zoom}
#tb1 .tb1-track{min-width:100%;min-height:100%;width:max-content;display:flex;justify-content:center;align-items:flex-start;padding:24px}
#tb1 .tb1-paper{position:relative;background:#fff;box-shadow:0 4px 22px #16364b17;flex:none;line-height:0;visibility:hidden}
#tb1 .tb1-paper canvas{display:block}
#tb1 .tb1-links{position:absolute;inset:0}
#tb1 .tb1-hot{position:absolute;padding:0;margin:0;min-width:0;min-height:0;border:0;background:transparent;cursor:pointer;border-radius:2px}
#tb1 .tb1-hot:hover,#tb1 .tb1-hot.is-playing{background:#3d8ef026;box-shadow:0 0 0 1px #3d8ef080}
#tb1 .tb1-word::after{content:"";position:absolute;left:.4px;right:.4px;top:var(--u);border-top:1px dotted #467aab;pointer-events:none}
#tb1 .tb1-word:hover::after,#tb1 .tb1-word.is-playing::after{border-top:2px solid #216bce}
#tb1 .tb1-loading{position:absolute;inset:0;display:grid;place-content:center;justify-items:center;gap:10px;text-align:center;padding:20px;background:var(--tb-stage);color:var(--tb-muted);font-size:13px}
#tb1 .tb1-loading br{display:none}
#tb1 .tb1-bottom{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0 20px;background:var(--tb-panel);border-top:1px solid var(--tb-line);font-size:11px;color:var(--tb-muted);white-space:nowrap;overflow:hidden}
#tb1 .tb1-bottom #tb1-ref{color:var(--tb-ink)}
#tb1 .tb1-bottom #tb1-detail{font-size:10px;overflow:hidden;text-overflow:ellipsis}
#tb1 .tb1-audio{position:absolute;bottom:48px;right:18px;z-index:40;display:flex;align-items:center;gap:8px;max-width:440px;padding:11px 12px;background:var(--tb-panel);border:1px solid var(--tb-line);border-radius:13px;box-shadow:var(--app-shadow-float,0 7px 30px #183e6320)}
#tb1 .tb1-audio>div{min-width:0;flex:1}
#tb1 .tb1-audio strong{font-family:var(--app-font-thai,"Leelawadee UI","Segoe UI",sans-serif);font-size:20px;line-height:1.45;font-weight:600;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#tb1 .tb1-audio small{display:block;color:var(--tb-muted);font-size:11px}
#tb1 .tb1-fav[aria-pressed=true]{color:#b43c59;background:#fbeaf0;border-color:#f2d5df}
#tb1 .tb1-fav[aria-pressed=true] svg{fill:currentColor}
#tb1 .tb1-toast{position:absolute;bottom:25px;left:50%;transform:translateX(-50%);padding:12px 18px;max-width:calc(100% - 30px);background:#173b5d;color:#fff;border-radius:10px;z-index:60;font-size:13px}
#tb1 .tb1-empty{padding:16px;color:var(--tb-muted);font-size:12px}
/* full-text search results (owner 10-29): matching chapters first, then pages of this book, then the other books */
#tb1 .tb1-rhead{margin:12px 10px 4px;font-size:10px;font-weight:650;letter-spacing:1.1px;text-transform:uppercase;color:var(--tb-muted)}
#tb1 .tb1-rhead--other{margin-top:20px;padding-top:14px;border-top:1px solid var(--tb-line);color:var(--tb-ink)}
#tb1 .tb1-rgroup{margin:0 0 6px}
#tb1 .tb1-rgroup:not(.is-own) .tb1-rhead{text-transform:none;letter-spacing:0;font-size:11.5px;font-weight:650;color:var(--tb-ink)}
#tb1 .tb1-rstatus{padding:14px 10px;margin:0;color:var(--tb-muted);font-size:12px}
#tb1 .tb1-result{display:grid;gap:3px;width:100%;margin:2px 0;padding:9px 10px;text-align:left;background:transparent;border:1px solid transparent;border-radius:7px;color:var(--tb-ink);cursor:pointer}
#tb1 .tb1-result:hover,#tb1 .tb1-result:focus-visible{background:var(--tb-hover);border-color:color-mix(in srgb,var(--tb-blue) 22%,var(--tb-panel))}
#tb1 .tb1-result-pg{font-size:10.5px;font-weight:650;color:var(--tb-sel-ink);font-variant-numeric:tabular-nums}
#tb1 .tb1-result-snip{font-size:12px;line-height:1.5;color:var(--tb-muted);overflow-wrap:anywhere}
#tb1 .tb1-result mark{background:color-mix(in srgb,#f2b53a 34%,transparent);color:var(--tb-ink);border-radius:2px;padding:0 1px;font-weight:600}
#tb1 .tb1-rmore{display:block;margin:2px 10px 8px;padding:6px 0;background:none;border:0;color:var(--tb-blue);font-size:11.5px;font-weight:600;cursor:pointer}
#tb1 .tb1-rmore:hover{text-decoration:underline}
#tb1 .tb1-rmore[hidden]{display:none}
/* the searched word on the page it opened: a warm glow until the next page */
#tb1 .tb1-word.is-found{background:#f2b53a40;box-shadow:0 0 0 2px #f2b53a8c;animation:tb1Found 1.4s ease-in-out 3}
@keyframes tb1Found{50%{box-shadow:0 0 0 4px #f2b53a40,0 0 14px 4px #f2b53a66}}
@media (prefers-reduced-motion:reduce){#tb1 .tb1-word.is-found{animation:none}}
#tb1.tb1-hide-side .tb1-ws{grid-template-columns:0 minmax(0,1fr)}
#tb1.tb1-hide-side .tb1-side{visibility:hidden;overflow:hidden}
#tb1 .tb1-backdrop{display:none}
#tb1 .tb1-mnav{display:none}
@media (max-width:1100px){
  #tb1 .tb1-toolbar{gap:10px;padding:12px 16px}
  #tb1 .tb1-book-field,#tb1 .tb1-original,#tb1 .tb1-bottom #tb1-detail{display:none}
  #tb1 .tb1-ws{grid-template-columns:248px minmax(0,1fr)}
}
/* phones / narrow tablets: the page takes the whole viewport; hamburger upper corner, floating page pill */
@media (max-width:899px){
  #tb1{z-index:50;display:block;background:var(--tb-panel)}
  #tb1 #tb1-desktop-controls,#tb1 .tb1-bottom{display:none}
  #tb1 .tb1-ws,#tb1 .tb1-mainc{display:block;height:100%;width:100%}
  #tb1 .tb1-stage{height:100%;width:100%;background:var(--tb-panel)}
  #tb1 .tb1-track{padding:0 0 calc(88px + env(safe-area-inset-bottom))}
  #tb1 .tb1-paper{box-shadow:none}
  #tb1 .tb1-toggle{position:absolute;z-index:35;top:max(4px,env(safe-area-inset-top));right:max(12px,env(safe-area-inset-right));width:44px;height:44px;
    background:color-mix(in srgb,var(--tb-panel) 93%,transparent);box-shadow:0 3px 16px #1b38591a;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}
  #tb1.tb1-menu-open .tb1-toggle{visibility:hidden}
  #tb1 .tb1-side,#tb1.tb1-hide-side .tb1-side{position:absolute;z-index:50;top:0;bottom:0;left:0;width:min(365px,calc(100vw - 28px));visibility:hidden;transform:translateX(-105%);
    transition:transform .2s ease,visibility .2s;background:var(--tb-panel);overflow:hidden;border:0;box-shadow:5px 0 32px #132c4626;padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom)}
  #tb1.tb1-menu-open .tb1-side{visibility:visible;transform:none}
  #tb1 .tb1-menu-head{padding:18px 19px 12px}
  #tb1 .tb1-menu-head h1{font-size:22px}
  #tb1 .tb1-menu-head .tb1-icon{display:flex}
  #tb1 .tb1-side-top{padding:0 18px 13px}
  #tb1 .tb1-side-top h2{margin:12px 0 4px}
  #tb1 .tb1-chip{height:36px}
  #tb1 .tb1-book-grid{gap:6px}
  #tb1 .tb1-backdrop{position:absolute;inset:0;border:0;padding:0;background:#102b4766;z-index:45;display:block;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}
  #tb1 .tb1-backdrop[hidden]{display:none!important}
  #tb1 .tb1-toolbar{padding:13px 18px;display:flex;gap:11px;border-bottom:1px solid var(--tb-line);background:transparent}
  #tb1 .tb1-toolbar .tb1-book-field{display:none}
  #tb1 .tb1-page-controls{width:100%;justify-content:space-between}
  #tb1 .tb1-page-form{flex:1;justify-content:center}
  #tb1 .tb1-page-form input{width:62px;height:40px}
  #tb1 .tb1-control,#tb1 .tb1-zoom{min-height:40px}
  #tb1 .tb1-nav{width:40px}
  #tb1 .tb1-zoom-controls{width:100%;margin:0;justify-content:space-between}
  #tb1 .tb1-zoom{flex:1;max-width:140px}
  #tb1 .tb1-contents-head{padding:14px 18px 7px}
  #tb1 .tb1-search{height:42px;font-size:16px}   /* 16px: iOS Safari zooms the page on focus below 16 */
  #tb1 .tb1-result-snip{font-size:13px}
  #tb1 .tb1-result-pg{font-size:11px}
  #tb1 .tb1-result{padding:10px}
  #tb1 .tb1-contents{padding:0 9px 10px}
  #tb1 .tb1-toc{padding:11px 10px;font-size:13px}
  #tb1 .tb1-toc.is-part{font-size:10px}
  #tb1 .tb1-menu-foot{padding:10px 18px 14px;font-size:11px;background:var(--tb-panel)}
  #tb1 .tb1-mobile-hint{display:block}
  #tb1 .tb1-menu-foot p:first-child{display:none}
  #tb1 .tb1-exit{display:inline-flex;align-items:center;min-height:40px;margin-top:4px;padding:0 14px;border:1px solid var(--tb-line);border-radius:8px;background:var(--tb-side);color:var(--tb-ink);font-size:13px;font-weight:600}
  #tb1 .tb1-audio{bottom:calc(86px + env(safe-area-inset-bottom));right:12px;left:12px;max-width:400px;margin-left:auto;gap:7px;padding:10px;z-index:40}
  #tb1 .tb1-audio .tb1-icon{width:40px;height:40px}
  #tb1 .tb1-audio strong{font-size:21px}
  #tb1 .tb1-audio .tb1-control{padding:0 9px;min-height:40px}
  #tb1 .tb1-loading{background:var(--tb-panel)}
  #tb1 .tb1-toast{bottom:162px}
  #tb1.tb1-menu-open .tb1-audio,#tb1.tb1-menu-open .tb1-mnav{visibility:hidden}
  #tb1 .tb1-mnav{display:block;position:absolute;z-index:38;left:50%;bottom:max(12px,env(safe-area-inset-bottom));transform:translateX(-50%);width:236px;max-width:calc(100vw - 24px)}
  #tb1 .tb1-pill{display:flex;align-items:center;justify-content:space-between;gap:6px;padding:5px;background:color-mix(in srgb,var(--tb-panel) 96%,transparent);border:1px solid var(--tb-line);border-radius:18px;box-shadow:0 5px 24px #173b5d1c;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px)}
  #tb1 .tb1-pill>button{height:46px;min-width:46px;display:flex;align-items:center;justify-content:center;border:0;border-radius:12px;color:var(--tb-blue);background:transparent;padding:0 10px;touch-action:manipulation}
  #tb1 .tb1-pill>button:hover{background:var(--tb-hover)}
  #tb1 .tb1-pill>button:disabled{opacity:.3}
  #tb1 .tb1-pill .tb1-pill-num{flex:1;flex-direction:column;gap:1px;line-height:1.2;color:var(--tb-ink)}
  #tb1 .tb1-pill-cap{font-size:8px;letter-spacing:1.2px;color:var(--tb-muted)}
  #tb1 .tb1-pill-num>span:last-child{display:flex;align-items:center;gap:4px;font-size:13px;font-variant-numeric:tabular-nums}
  #tb1 .tb1-pill-num strong{font-size:15px;font-weight:650}
  #tb1 .tb1-pill-total{color:var(--tb-muted)}
  #tb1 .tb1-pill-num svg{margin-left:4px}
  #tb1 .tb1-pill .tb1-pill-num[aria-expanded=true]{background:var(--tb-sel);color:var(--tb-sel-ink)}
  #tb1 .tb1-jump{position:absolute;bottom:calc(100% + 10px);left:50%;transform:translateX(-50%);width:min(300px,calc(100vw - 24px));background:var(--tb-panel);padding:15px;border:1px solid var(--tb-line);border-radius:17px;box-shadow:0 10px 45px #173b5d26}
  #tb1 .tb1-jump-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:11px}
  #tb1 .tb1-jump-head strong{font-size:15px;font-weight:650}
  #tb1 .tb1-jump-head .tb1-icon{width:32px;height:32px;font-size:21px}
  #tb1 .tb1-jump label{display:block;font-size:12px;color:var(--tb-muted);margin-bottom:7px}
  #tb1 .tb1-jump-field{display:flex;gap:8px}
  #tb1 .tb1-jump-field input{min-width:0;flex:1;height:44px;font-size:16px;padding:0 11px}
  #tb1 .tb1-jump-field input[aria-invalid=true]{border-color:var(--tb-err)}
  #tb1 .tb1-jump-go{height:44px;padding:0 20px;border:0;border-radius:8px;background:var(--tb-blue);color:var(--tb-on-blue);font-size:14px;font-weight:600}
  #tb1 .tb1-jump-quick{display:flex;gap:8px;margin-top:12px}
  #tb1 .tb1-jump-quick button{flex:1;min-height:40px;border:1px solid var(--tb-line);border-radius:8px;background:var(--tb-side);color:var(--tb-ink);font-size:12px}
  #tb1 .tb1-jump-quick button:hover{background:var(--tb-hover)}
  #tb1 #tb1-jump-error{font-size:12px;line-height:1.4;color:var(--tb-err);margin:8px 0 0}
}
@media (max-height:650px) and (max-width:899px){
  #tb1 .tb1-side{overflow-y:auto}
  #tb1 .tb1-contents{flex:none;min-height:180px;overflow:visible}
  #tb1 .tb1-menu-foot p{display:none}
  #tb1 .tb1-menu-head{padding-top:10px}
}
@media (max-width:360px){#tb1 .tb1-toggle{top:max(2px,env(safe-area-inset-top));right:6px;width:40px;height:40px}}
@media (prefers-reduced-motion:reduce){#tb1 .tb1-side{transition:none}}
/* anti-scrape (owner 2026-10-30, ENGINEERING §5bq): the reader never prints, and a page is never selected, dragged or long-pressed */
@media print{html.tb1-on body{visibility:hidden!important}#tb1{display:none!important}}
#tb1 .tb1-paper,#tb1 .tb1-paper *{-webkit-user-select:none;user-select:none;-webkit-user-drag:none;-webkit-touch-callout:none}
