/* Shared look for the Maker Mindz library pages: Premium eBooks (/stem/ebooks/), Learn Algebra (/stem/algebra/), Workshops (/stem/workshops/).
   The page itself is built by /stem/library.js. */
  :root { --green: #27ae60; --green2: #2ecc71; --green-text: #1e8449; --brand: #2c3e50; --muted: #5b6b78; --line: #e3e8e6; --bg: #f4f6f5; }
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; color: var(--brand); background: var(--bg); }
a { color: var(--green-text); }
.bar { background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 20; }
.bar .in { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.bar .home { color: #fff; text-decoration: none; font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.bar .home img { width: 34px; height: 34px; border-radius: 50%; background: #fff; }
.bar .home span b { color: var(--green2); }
.bar .sp { flex: 1; }
.who { display: none; align-items: center; gap: 8px; font-size: 13.5px; min-width: 0; }
.who .name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #dfe9e5; }
.btn { font: inherit; font-weight: 700; font-size: 14.5px; border-radius: 10px; padding: 10px 18px; border: 1.5px solid var(--line); background: #fff; color: var(--brand); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:hover { background: #f3f6f5; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: #229954; }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.45); }
.btn.ghost:hover { background: rgba(255,255,255,.12); }
.btn:disabled { opacity: .6; cursor: default; }
.hero { background: linear-gradient(135deg, #1f5f46 0%, var(--brand) 100%); color: #fff; }
.hero .in { max-width: 1180px; margin: 0 auto; padding: 34px 16px 30px; }
.kicker { font-size: 12.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--green2); }
.hero h1 { margin: 6px 0 8px; font-size: clamp(26px, 4vw, 38px); line-height: 1.15; }
.hero p { margin: 0 0 16px; max-width: 760px; color: #dfe9e5; font-size: 16px; line-height: 1.55; }
.hero .acts { display: flex; flex-wrap: wrap; gap: 10px; }
.status { margin-top: 14px; font-size: 14px; color: #dfe9e5; }
.status b { color: #fff; }
main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 40px; }
.shelf { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.book { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; text-align: left; font: inherit; color: inherit; cursor: pointer; padding: 0; transition: transform .15s, box-shadow .15s; }
.book:hover, .book:focus-visible { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(20,40,60,.14); outline: none; }
.cover { height: 150px; display: flex; align-items: center; justify-content: center; font-size: 58px; position: relative; }
.cover .lock { position: absolute; top: 10px; right: 10px; background: rgba(20,30,40,.7); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.book .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.book h2 { margin: 0; font-size: 18px; line-height: 1.3; }
.book .sub { font-size: 13.5px; color: var(--muted); font-style: italic; }
.book p { margin: 0; font-size: 14px; color: #3c4c58; line-height: 1.5; }
.book .go { margin-top: auto; padding-top: 6px; font-weight: 700; font-size: 14px; color: var(--green-text); }
.note { font-size: 13px; color: var(--muted); margin-top: 18px; line-height: 1.55; }
/* reader */
#reader { display: none; max-width: 1400px; margin: 0 auto; padding: 14px 16px 24px; }
#reader .tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
#reader h2 { margin: 0; font-size: 18px; flex: 1; min-width: 160px; }
.frame { position: relative; height: calc(100vh - 150px); min-height: 520px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.frame iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: #fff; color: var(--muted); font-weight: 600; }
.spin { width: 40px; height: 40px; border-radius: 50%; border: 4px solid #e3ece8; border-top-color: var(--green); animation: sp 1s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
/* pop-up windows */
.back { position: fixed; inset: 0; background: rgba(20,32,44,.6); z-index: 50; display: none; align-items: flex-start; justify-content: center; padding: 24px 16px; overflow-y: auto; }
.back.on { display: flex; }
.box { background: #fff; border-radius: 16px; width: 100%; max-width: 440px; padding: 22px; box-shadow: 0 20px 50px rgba(0,0,0,.3); position: relative; margin: auto 0; }
.box h3 { margin: 0 44px 10px 0; font-size: 20px; }
.box .x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: #f1f4f3; font-size: 22px; cursor: pointer; color: #44555f; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: #eef2f1; border-radius: 10px; padding: 4px; margin-bottom: 12px; }
.tabs button { font: inherit; font-weight: 700; font-size: 14px; border: 0; background: transparent; border-radius: 8px; padding: 8px; cursor: pointer; color: var(--muted); }
.tabs button.on { background: #fff; color: var(--green-text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
label.l { display: block; font-size: 13.5px; font-weight: 700; margin: 10px 0 4px; }
.in-f { width: 100%; font: inherit; font-size: 15px; padding: 10px 12px; border: 1.5px solid #cfd6db; border-radius: 9px; background: #fff; color: var(--brand); }
.in-f:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(39,174,96,.18); }
.code { text-align: center; font-size: 24px; letter-spacing: .3em; font-family: Consolas, monospace; }
.small { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 8px 0 0; }
.err { color: #c0392b; font-size: 14px; margin-top: 10px; display: none; }
.err.on { display: block; }
.err button { display: block; margin-top: 6px; font: inherit; font-weight: 700; color: var(--green-text); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.row { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; margin-top: 12px; }
.check input { margin-top: 3px; accent-color: var(--green); }
.linkish { font: inherit; color: var(--green-text); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; font-weight: 700; }
ul.perks { margin: 4px 0 12px; padding-left: 20px; font-size: 14px; color: #3c4c58; line-height: 1.6; }
.hidden { display: none !important; }
footer { text-align: center; font-size: 13px; color: var(--muted); padding: 18px 16px 30px; }
@media (max-width: 900px) { .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .shelf { grid-template-columns: 1fr; }
  .bar .home span { display: none; }
  .who .name { max-width: 130px; }
  .hero .acts .btn { flex: 1 1 auto; }
  /* Reader on a phone: one slim toolbar, and the book fills the rest of the screen */
  #reader { padding: 8px 8px 12px; }
  #reader .tools { flex-wrap: nowrap; gap: 6px; margin-bottom: 8px; }
  #reader h2 { font-size: 15px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #reader .tools .btn { padding: 6px 10px; flex: none; }
  .frame { height: calc(100vh - 118px); height: calc(100dvh - 118px); min-height: 360px; border-radius: 10px; }
}
.book.off { cursor: default; opacity: .75; }
.book.off:hover { transform: none; box-shadow: none; }
.cover .free { position: absolute; top: 10px; right: 10px; background: var(--green); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
