:root{font-family:"Microsoft YaHei","PingFang SC",Arial,sans-serif;color:#18345d;background:#eaf5ff}*{box-sizing:border-box}body{margin:0;min-height:100vh;background:linear-gradient(145deg,#f7fcff,#dceeff 55%,#f5f8ff)}button,a{font:inherit}.textbook-shell{width:min(1240px,100%);margin:auto;padding:18px 18px 34px}.textbook-topbar{display:flex;align-items:center;gap:18px;min-height:68px}.textbook-topbar>div{flex:1}.textbook-back,.quick-links a{color:#1d5a99;text-decoration:none;font-weight:900}.eyebrow{margin:0 0 4px;color:#5a8ac1;font-size:12px;font-weight:900;letter-spacing:1px}.textbook-topbar h1,.preview-head h2,.panel-heading h2{margin:0;color:#17345f;font-weight:1000}.textbook-topbar h1{font-size:28px}.saved-state{padding:7px 11px;border:1px solid #b8d4ee;border-radius:99px;background:#fff;color:#6b88aa;font-size:12px;font-weight:900}.textbook-layout{display:grid;grid-template-columns:330px minmax(0,1fr);gap:14px;margin-top:14px}.book-panel,.preview-panel{border:1px solid #c6ddf1;border-radius:16px;background:rgba(255,255,255,.75);box-shadow:0 10px 30px rgba(58,106,151,.12);padding:16px}.panel-heading,.preview-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.panel-heading h2{font-size:18px}.panel-heading>span{color:#7894b2;font-size:12px;font-weight:900}.book-list{display:grid;gap:10px;margin-top:14px;max-height:calc(100vh - 150px);overflow:auto}.book-card{display:grid;grid-template-columns:68px minmax(0,1fr);gap:11px;padding:9px;border:1px solid #d3e3f2;border-radius:11px;background:#f9fcff;text-align:left;cursor:pointer}.book-card:hover,.book-card.active{border-color:#6aabe6;background:#edf7ff}.book-cover{width:68px;height:82px;object-fit:cover;border-radius:7px;background:linear-gradient(135deg,#bfe4ff,#fff1bf);border:1px solid #b7d2e9}.book-card strong{display:block;margin:4px 0;color:#244d7a;font-size:14px}.book-card small{color:#7690ad;font-size:12px;line-height:1.45}.preview-head h2{font-size:22px}.preview-head>div{min-width:0}.preview-head p:last-child{margin:5px 0 0;color:#6d87a3;font-size:13px}.primary-button{flex:none;padding:10px 16px;border:0;border-radius:10px;background:#e5b342;color:#fff;box-shadow:0 3px 0 #a67319;font-weight:1000;cursor:pointer}.primary-button:disabled{cursor:not-allowed;opacity:.45}.grade-tabs,.unit-tabs{display:flex;gap:8px;overflow:auto;padding:16px 0 8px}.grade-tab,.unit-tab{flex:none;padding:8px 12px;border:1px solid #c9deef;border-radius:9px;background:#fff;color:#487198;font-weight:900;cursor:pointer}.grade-tab.active,.unit-tab.active{border-color:#4f9bdd;background:#e8f5ff;color:#1e609b}.unit-tabs{padding-top:4px;border-bottom:1px solid #e0ebf5}.word-preview{min-height:340px;padding-top:14px}.word-group h3{margin:0 0 10px;color:#356895;font-size:16px}.word-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:8px}.word-item{padding:10px 12px;border:1px solid #dbe8f3;border-radius:9px;background:#fbfdff}.word-item strong{display:block;color:#173d68;font-size:15px}.word-item span{display:block;margin-top:3px;color:#7690aa;font-size:13px}.empty-state{padding:60px 20px;text-align:center;color:#8098b2}.quick-links{display:flex;gap:10px;flex-wrap:wrap;border-top:1px solid #e0ebf5;padding-top:14px}.quick-links a{padding:8px 11px;border-radius:8px;background:#edf7ff;font-size:13px}@media(max-width:800px){.textbook-shell{padding:12px}.textbook-layout{grid-template-columns:1fr}.book-list{display:flex;max-height:none;overflow:auto;padding-bottom:3px}.book-card{min-width:220px}.preview-panel{min-height:600px}.textbook-topbar{gap:10px}.textbook-topbar h1{font-size:24px}.textbook-back{font-size:13px}.word-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:420px){.preview-head{display:block}.primary-button{margin-top:12px;width:100%}.word-grid{grid-template-columns:1fr}.book-card{min-width:205px}}
/* Responsive width guardrails */
html,body{max-width:100%;overflow-x:hidden}.textbook-shell,.textbook-layout,.book-panel,.preview-panel,.preview-head,.panel-heading{min-width:0}.textbook-topbar{flex-wrap:wrap}.textbook-topbar>div{min-width:0}.preview-head>div{overflow-wrap:anywhere}.book-list{min-width:0}.book-card{min-width:0}.book-card strong,.book-card small{overflow-wrap:anywhere}
@media (max-width:800px){.textbook-shell{width:100%;padding-left:12px;padding-right:12px}.book-panel,.preview-panel{width:100%;padding:13px}.book-list{display:flex;width:100%;max-width:100%;overflow-x:auto;overflow-y:hidden}.book-card{flex:0 0 min(240px,78vw);width:min(240px,78vw)}.preview-panel{overflow:hidden}.grade-tabs,.unit-tabs{max-width:100%}}
@media (max-width:480px){.textbook-topbar{align-items:flex-start}.textbook-back{order:2}.saved-state{margin-left:auto}.textbook-topbar>div{order:1;width:calc(100% - 110px)}.saved-state{order:3}.book-card{flex-basis:210px;width:210px}.preview-head h2{font-size:19px}.word-preview{min-height:260px}}
.preview-cover{width:72px;height:92px;flex:none;object-fit:cover;border:1px solid #b7d2e9;border-radius:8px;background:#e8f4ff}.grade-tab{display:flex;align-items:center;gap:7px;padding:6px 9px}.grade-tab img{width:30px;height:39px;object-fit:cover;border-radius:4px;background:#e8f4ff}.grade-tab span{white-space:nowrap}
/* Textbook hall backgrounds: wide screens use landscape, narrow screens use portrait. */
body.textbook-page{background-image:url("assets/images/backgrounds/textbook-selector/textbook-selector-bg-landscape.png");background-position:center top;background-size:cover;background-attachment:fixed}
.book-panel,.preview-panel{background:rgba(255,255,255,.75)}
.book-card{background:rgba(249,252,255,.75)}
.book-card:hover,.book-card.active{background:rgba(237,247,255,.75)}
.grade-tab,.unit-tab{background:rgba(255,255,255,.75)}
.grade-tab.active,.unit-tab.active{background:rgba(232,245,255,.6)}
@media (max-width:800px){body.textbook-page{background-image:url("assets/images/backgrounds/textbook-selector/textbook-selector-bg-portrait.png")}}
/* Match Adventure visual language: blue controls, cream panels, gold active states. */
body.textbook-page{font-family:"Noto Sans SC","Microsoft YaHei","PingFang SC",Arial,sans-serif;color:#17345f}
.textbook-shell{width:min(1220px,100%);padding:10px 10px calc(34px + env(safe-area-inset-bottom))}
.textbook-topbar{min-height:78px;margin:0 0 14px;padding:12px 18px;gap:12px;border:3px solid #8fc1f4;border-radius:22px;background:rgba(255,255,255,.75);box-shadow:0 5px 0 rgba(82,134,210,.15)}
.textbook-topbar h1,.preview-head h2,.panel-heading h2{font-family:"Source Han Serif SC","Noto Serif SC","SimSun",serif;font-weight:950;color:#17345f}
.textbook-back{display:inline-flex;align-items:center;justify-content:center;min-height:36px;padding:0 14px;border:2px solid #8fc1f4;border-radius:999px;color:#17345f;background:linear-gradient(180deg,#fff,#eaf7ff);font-size:13px;font-weight:900;box-shadow:0 3px 0 rgba(82,134,210,.18)}
.eyebrow{color:#4f82c4;font-weight:950;letter-spacing:.6px}
.saved-state{border:2px solid #8fc1f4;border-radius:999px;background:rgba(255,255,255,.75);color:#315d8c}
.textbook-layout{gap:10px;margin-top:6px}
.book-panel,.preview-panel{border:3px solid rgba(218,166,78,.9);border-radius:22px;background:rgba(255,250,235,.75);box-shadow:0 18px 50px rgba(4,15,39,.32),inset 0 0 0 2px rgba(75,155,255,.2);padding:16px}
.book-card{border:2px solid rgba(91,150,219,.72);border-radius:13px;background:linear-gradient(180deg,rgba(255,255,255,.75),rgba(228,239,251,.75));box-shadow:0 3px 0 rgba(82,134,210,.18);font-family:"Source Han Serif SC","Noto Serif SC","SimSun",serif}
.book-card:hover,.book-card.active{border-color:#d99b2f;background:linear-gradient(180deg,rgba(255,240,163,.6),rgba(255,212,90,.6))}
.book-card strong{color:#17345f;font-weight:950}.book-card small{color:rgba(16,50,106,.68);font-weight:850}
.preview-head p:last-child{color:rgba(16,50,106,.68);font-weight:850}
.primary-button{min-height:38px;border:2px solid #b87518;border-radius:999px;background:linear-gradient(180deg,#fff0a3,#ffd45a);color:#4b3107;box-shadow:0 3px 0 #9a691d;font-weight:950}
.grade-tab,.unit-tab{border:2px solid rgba(91,150,219,.72);border-radius:16px;background:linear-gradient(180deg,rgba(255,255,255,.75),rgba(228,241,255,.75));box-shadow:0 3px 0 rgba(82,134,210,.18);color:#17345f;font-family:"Source Han Serif SC","Noto Serif SC","SimSun",serif;font-weight:950}
.grade-tab.active,.unit-tab.active{border-color:#d99b2f;background:linear-gradient(180deg,#fff0a3,#ffd45a);color:#4b3107}
.word-item{border:2px solid rgba(91,150,219,.46);border-radius:13px;background:rgba(255,255,255,.75);box-shadow:0 3px 0 rgba(82,134,210,.12)}
.word-item strong{color:#17345f;font-family:"Source Han Serif SC","Noto Serif SC","SimSun",serif;font-weight:950}.word-item span{color:rgba(16,50,106,.68);font-weight:800}
.quick-links{border-top:2px solid rgba(91,150,219,.35)}.quick-links a{border:2px solid #8fc1f4;border-radius:999px;background:rgba(255,255,255,.75);color:#17345f;box-shadow:0 3px 0 rgba(82,134,210,.16)}
.book-panel .panel-heading .eyebrow{margin:0;font-size:20px;line-height:1.2;color:#4f82c4}
.preview-head .eyebrow{font-size:20px;line-height:1.2;color:#4f82c4}
.grade-tab{gap:10px;padding:8px 12px;min-height:82px}
.grade-tab img{width:44px;height:58px;border-radius:5px}
.current-textbook-panel{display:flex;align-items:center;gap:14px;margin:8px 0 10px;padding:11px 14px;border:3px solid rgba(91,150,219,.72);border-radius:18px;background:rgba(255,255,255,.75);box-shadow:0 5px 0 rgba(82,134,210,.15)}.current-textbook-cover{width:54px;height:68px;flex:none;object-fit:cover;border:2px solid #d99b2f;border-radius:7px;background:#e8f4ff}.current-textbook-info{min-width:0;display:grid;gap:3px}.current-textbook-info .eyebrow{margin:0;color:#4f82c4;font-size:14px}.current-textbook-info strong{color:#17345f;font-family:"Source Han Serif SC","Noto Serif SC","SimSun",serif;font-size:18px;overflow-wrap:anywhere}.current-textbook-info span{color:rgba(16,50,106,.68);font-size:13px;font-weight:850}@media(max-width:480px){.current-textbook-panel{margin-top:6px;padding:10px}.current-textbook-cover{width:46px;height:59px}.current-textbook-info strong{font-size:16px}}
.stage-tabs{display:flex;gap:9px;margin:8px 0 6px}.stage-tab{min-width:92px;padding:9px 20px;border:2px solid rgba(91,150,219,.72);border-radius:999px;background:rgba(255,255,255,.75);color:#17345f;box-shadow:0 3px 0 rgba(82,134,210,.15);font-weight:950;cursor:pointer}.stage-tab.active{border-color:#d99b2f;background:linear-gradient(180deg,#fff0a3,#ffd45a);color:#4b3107}@media(max-width:480px){.stage-tabs{margin-top:6px}.stage-tab{flex:1;padding:8px 14px}}
.textbook-topbar{min-height:62px;margin:0 0 10px;padding:12px 16px;border:2px solid #8fc1f4;border-radius:22px;background:rgba(255,255,255,.75);box-shadow:0 18px 34px rgba(38,88,145,.2)}.textbook-topbar h1{margin:0;color:#4f82c4;font-family:"Microsoft YaHei","PingFang SC","Noto Sans SC",Arial,sans-serif;font-size:24px;font-weight:900;line-height:1.2}.textbook-back{min-height:40px;padding:0 14px;border:1.5px solid rgba(91,137,190,.5);border-radius:999px;color:#1e4778;background:linear-gradient(180deg,#fff,#def2ff);font-size:14px;font-weight:900;box-shadow:none}.textbook-topbar>div{flex:1;min-width:0}
.preview-section-tag{margin:0 0 6px;color:#4f82c4;font-size:20px;font-weight:900;line-height:1.2}.preview-head{align-items:center}.preview-head .preview-cover{margin-top:0}/* Keep the hall return action pinned to the top-right of the title bar. */
.textbook-topbar{position:relative;justify-content:flex-start;padding-right:250px}
.textbook-back{position:absolute;right:16px;top:50%;transform:translateY(-50%);order:initial}.textbook-guide-button{position:absolute;right:112px;top:50%;transform:translateY(-50%);min-height:40px;padding:0 14px;border:1.5px solid rgba(91,137,190,.5);border-radius:999px;color:#1e4778;background:linear-gradient(180deg,#fff,#def2ff);font-size:14px;font-weight:900;cursor:pointer}
@media(max-width:480px){
  .textbook-topbar{padding-right:205px}
  .textbook-back{right:10px}.textbook-guide-button{right:100px}
}
/* Selector tutorial spotlight, matched to the word-flash guide. */
.textbook-guide.hidden{display:none}.textbook-guide{position:fixed;inset:0;z-index:5000;pointer-events:none;font-family:"Noto Sans SC","Microsoft YaHei",sans-serif}.textbook-guide-dim,.textbook-guide-spotlight,.textbook-guide-arrow,.textbook-guide-card{position:fixed}.textbook-guide-dim{z-index:5000;background:rgba(6,21,45,.62);pointer-events:auto}.textbook-guide-spotlight{z-index:5001;border:3px solid #ffe47a;border-radius:16px;box-shadow:0 0 0 3px rgba(65,139,225,.9),0 0 24px rgba(255,223,96,.72),inset 0 0 18px rgba(255,247,193,.26);pointer-events:none;animation:textbookGuidePulse .95s ease-in-out infinite alternate}.textbook-guide-arrow{z-index:5003;width:32px;height:32px;filter:drop-shadow(0 3px 0 rgba(24,71,125,.32));pointer-events:none}.textbook-guide-arrow:before{content:"";position:absolute;left:50%;top:50%;width:0;height:0;transform:translate(-50%,-50%);border-left:16px solid transparent;border-right:16px solid transparent}.textbook-guide-arrow.up:before{border-bottom:28px solid #ffc24b}.textbook-guide-arrow.down:before{border-top:28px solid #ffc24b}.textbook-guide-card{z-index:5004;box-sizing:border-box;width:min(330px,calc(100vw - 28px));padding:15px;color:#17345f;background:linear-gradient(180deg,rgba(255,255,255,.98),rgba(229,247,255,.98));border:2px solid #8fc1f4;border-radius:16px;box-shadow:0 14px 28px rgba(20,70,130,.28),inset 0 1px 0 rgba(255,255,255,.88);pointer-events:auto}.textbook-guide-step{margin:0 0 5px;color:#2f76d2;font-size:12px;font-weight:900}.textbook-guide-title{margin:0 0 8px;color:#17345f;font-size:20px;line-height:1.15}.textbook-guide-text{margin:0;color:#315278;font-size:14px;font-weight:800;line-height:1.5}.textbook-guide-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:14px}.textbook-guide-skip,.textbook-guide-next{min-height:34px;padding:7px 13px;font:inherit;font-size:13px;font-weight:900;border:2px solid #8fc1f4;border-radius:999px;box-shadow:0 6px 12px rgba(47,118,210,.16);cursor:pointer}.textbook-guide-skip{color:#315278;background:#fff}.textbook-guide-next{color:#4a2f00;background:linear-gradient(180deg,#ffe08b,#ffc24b);border-color:#f0a930}@keyframes textbookGuidePulse{from{transform:scale(1)}to{transform:scale(1.012)}}@media(max-width:760px){.textbook-guide-card{padding:13px;border-radius:14px}.textbook-guide-title{font-size:18px}.textbook-guide-text{font-size:13px}.textbook-guide-skip,.textbook-guide-next{min-height:32px;padding:6px 11px;font-size:12px}}.preview-section-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:6px}.preview-section-head .preview-section-tag{margin:0}.preview-section-head .quick-links{display:flex;gap:8px;flex-wrap:wrap;border:0;padding:0;margin:0}.preview-section-head .quick-links a{padding:7px 10px;font-size:12px}@media(max-width:600px){.preview-section-head{align-items:flex-start}.preview-section-head .quick-links{justify-content:flex-end}.preview-section-head .quick-links a{padding:6px 8px;font-size:11px}}