/* Shared Huideng palette: 明亮 / 夜读 / 牛皮纸. */
html[data-hd-theme="light"] {
  --fw-canvas:#f7f3ea;--fw-card:#fffdf8;--fw-soft:#eee9df;--fw-text:#25231f;--fw-muted:#625f58;
  --fw-accent:#8a641f;--fw-accent-soft:#f0e5cd;--fw-line:#d2c5ae;--fw-action:#081220;--fw-on-action:#f7f3ea;
  --fw-success:#3e6b53;--fw-success-soft:#e7f0e9;--fw-danger:#93433f;--fw-danger-soft:#f6e9e6;--fw-info:#326878;--fw-info-soft:#e6eff1;
  --fw-shadow:rgba(84,61,23,.12);--fw-overlay:rgba(37,35,31,.52);
}
html[data-hd-theme="dark"] {
  --fw-canvas:#081220;--fw-card:#101827;--fw-soft:#1c2838;--fw-text:#f7f3ea;--fw-muted:#c2bfb9;
  --fw-accent:#e6c98a;--fw-accent-soft:#302c25;--fw-line:#655638;--fw-action:#c9a35a;--fw-on-action:#081220;
  --fw-success:#a6ceaf;--fw-success-soft:#20382f;--fw-danger:#e2a19c;--fw-danger-soft:#402b2c;--fw-info:#a4d3df;--fw-info-soft:#203640;
  --fw-shadow:rgba(0,0,0,.28);--fw-overlay:rgba(2,8,16,.72);
}
html[data-hd-theme="paper"] {
  --fw-canvas:#e7d3aa;--fw-card:#f4e6c6;--fw-soft:#ebdbb7;--fw-text:#352d21;--fw-muted:#68583e;
  --fw-accent:#7a561d;--fw-accent-soft:#e2c998;--fw-line:#b7a178;--fw-action:#78541d;--fw-on-action:#fff8e8;
  --fw-success:#385f4e;--fw-success-soft:#dfe5c9;--fw-danger:#8e3e36;--fw-danger-soft:#ebd1bc;--fw-info:#365e67;--fw-info-soft:#dce0cb;
  --fw-shadow:rgba(94,68,27,.14);--fw-overlay:rgba(53,45,33,.54);
}
html[data-hd-theme],html[data-hd-theme] body {
  --page-bg:var(--fw-canvas);--paper-bg:var(--fw-card);--panel-bg:var(--fw-card);--card-bg:var(--fw-card);
  --text-primary:var(--fw-text);--text-secondary:var(--fw-muted);--text:var(--fw-text);--ink:var(--fw-text);--muted:var(--fw-muted);
  --paper:var(--fw-canvas);--paper-soft:var(--fw-card);--paper-deep:var(--fw-soft);--surface:var(--fw-card);--surface-strong:var(--fw-soft);
  --brand:var(--fw-accent);--accent:var(--fw-accent);--accent-soft:var(--fw-accent-soft);--brown:var(--fw-accent);--brown-deep:var(--fw-action);--gold:var(--fw-accent);--gold-soft:var(--fw-accent-soft);
  --border:var(--fw-line);--line:var(--fw-line);--line-soft:var(--fw-line);--button-bg:var(--fw-action);--button-text:var(--fw-on-action);
  --green:var(--fw-success);--green-soft:var(--fw-success-soft);--red:var(--fw-danger);--ok:var(--fw-success);--status-ok:var(--fw-success);--status-warn:var(--fw-danger);
  --path-green:var(--fw-success);--path-green-dark:var(--fw-success);--path-green-soft:var(--fw-success-soft);--path-gold:var(--fw-accent);--path-blue:var(--fw-info);
  background-color:var(--fw-canvas);color:var(--fw-text);scrollbar-color:var(--fw-line) var(--fw-canvas);accent-color:var(--fw-accent);
}
html[data-hd-theme] body{background-image:none}
html[data-hd-theme] body::before{background:none}
html[data-hd-theme] ::selection{color:var(--fw-text);background:var(--fw-accent-soft)}
html[data-hd-theme] :focus-visible{outline:2px solid var(--fw-accent);outline-offset:3px}
html[data-hd-theme] input::placeholder,html[data-hd-theme] textarea::placeholder{color:var(--fw-muted);opacity:1}
html[data-hd-theme] button:disabled{color:var(--fw-muted)}
.theme-toggle,.theme-box{display:none!important}
.fw-theme{position:relative;flex:0 0 auto;margin-left:auto;line-height:1.4;z-index:40;color:var(--fw-accent);font-family:"Noto Serif SC","Songti SC",serif}
.fw-theme button{box-sizing:border-box;font:inherit;cursor:pointer;touch-action:manipulation;box-shadow:none}
.fw-theme .fw-theme-trigger{display:grid;place-items:center;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;border:1px solid var(--fw-line);border-radius:50%;background:var(--fw-card);color:var(--fw-accent);font-size:22px;font-weight:700}
.fw-theme .fw-theme-menu{position:absolute;right:0;top:calc(100% + 8px);display:grid;grid-template-columns:repeat(3,1fr);gap:4px;width:224px;padding:7px;border:1px solid var(--fw-line);border-radius:14px;background:var(--fw-card);box-shadow:0 12px 30px var(--fw-shadow);z-index:41}
.fw-theme .fw-theme-menu[hidden]{display:none!important}
.fw-theme .fw-theme-menu button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-width:0;min-height:76px;padding:6px 3px;border:1px solid transparent;border-radius:10px;background:transparent;color:var(--fw-muted);white-space:nowrap}
.fw-theme .fw-theme-menu button[aria-checked="true"]{border-color:var(--fw-accent);background:var(--fw-accent-soft);color:var(--fw-accent)}
.fw-theme-menu span{font-size:28px}.fw-theme-menu small{font:600 14px/1.5 "Microsoft YaHei",sans-serif}
.fw-theme-trigger:hover,.fw-theme-menu button:hover{background:var(--fw-accent-soft)}
.material-header h2{flex:1}.material-header>.fw-theme{margin-left:auto}
.material-header,.learning-dialog-head,.coach-dialog>header{overflow:visible}
.learning-dialog-head>div:first-of-type{min-width:0;flex:1}
.learning-dialog-head .dialog-close{flex:0 0 44px}
.learning-dialog-head .learning-dialog-actions{margin-left:auto}
.coach-dialog-head{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--fw-line)}
.coach-dialog-head h2{flex:1;min-width:0;font-size:20px;margin:0}
.coach-dialog-head>[data-coach="map"]{flex:0 0 44px;width:44px;height:44px;padding:8px;color:var(--fw-text);background:var(--fw-card);border:1px solid var(--fw-line)}
[data-learning-fullscreen].fw-course-fullscreen{position:fixed;inset:0;margin:0;width:100%;max-width:none;height:100%;max-height:none;box-sizing:border-box;background:var(--fw-card);border:0;z-index:100001}
.learning-dialog.fw-course-fullscreen{grid-template-rows:auto minmax(0,1fr) auto}
.coach-fullscreen-surface.fw-course-fullscreen{display:flex;flex-direction:column}
.coach-fullscreen-surface.fw-course-fullscreen>.coach-course-view{flex:1;min-height:0;overflow:auto}
[data-learning-fullscreen]:fullscreen,[data-learning-fullscreen]:-webkit-full-screen{width:100%;height:100%;background:var(--fw-card)}
.material-reader,.material-header,.material-reader button,.material-reader input,.material-video-tools select{background:var(--fw-canvas);color:var(--fw-text);border-color:var(--fw-line)}
.material-header,.material-reader button,.material-reader input{background:var(--fw-card)}
.material-reader button:active{background:var(--fw-accent-soft)}
.learning-dialog-head{position:relative;z-index:50}
.learning-dialog-actions{display:flex;align-items:center;gap:8px}
.learn-header,.memory-header,.study-header,.reader-top,.site-head,.topbar .session{gap:10px}
.about-top{position:relative}.about-top>.fw-theme{position:absolute;top:16px;right:16px}.about-top .about-brand{padding-right:52px}
.learn-header .fw-theme,.memory-header .fw-theme,.study-header .fw-theme{margin-left:0}
.map-node.current .map-node-orb{background:var(--fw-action);color:var(--fw-on-action);border-color:var(--fw-accent)}
.dictionary-return:hover{color:var(--fw-on-action)}
.admin-shell .side>.fw-theme{display:none}
@media(max-width:560px){
  .memory-header{flex-wrap:wrap}.memory-header .memory-brand{flex:1;min-width:0}.memory-header>nav{order:3;width:100%}.memory-header>.fw-theme{order:2}
  .study-header .brand{min-width:0;flex:1}.study-header .brand strong{font-size:16px}.study-header .brand small{display:none}.study-header .close-link{padding:8px}
  .site-head{display:grid;grid-template-columns:minmax(0,1fr) auto}.site-head .brand-link{grid-area:1/1}.site-head>.fw-theme{grid-area:1/2}.site-head>nav{grid-area:2/1/3/3;width:100%}
  .material-header{gap:8px}.material-header h2{font-size:17px}.material-header button[data-material-close]{padding:6px;min-width:48px}
  .learning-dialog-head{gap:8px}.learning-dialog-actions{gap:4px}.learning-dialog-head h2{font-size:18px}
  .admin-shell .topbar .session{display:flex;width:100%;align-items:center;justify-content:flex-end}.admin-shell .topbar .session .fw-theme{margin-left:auto}
  .admin-shell .side{position:relative}.admin-shell .side>.fw-theme{display:block;position:absolute;top:16px;right:16px}.admin-shell .side .brand{padding-right:52px}.admin-shell .topbar .session>.fw-theme{display:none}
}

/* Shared page tools: theme on the left, fullscreen on the far right. */
.fw-theme.fw-tools{display:flex;align-items:center;gap:4px;min-width:92px}
.fw-theme .fw-fullscreen-trigger{display:grid;place-items:center;flex:0 0 44px;width:44px;height:44px;min-width:44px;min-height:44px;padding:10px;border:0;border-radius:50%;background:transparent;color:var(--fw-accent)}
.fw-fullscreen-trigger svg{display:block;width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.fw-theme .fw-fullscreen-trigger:hover,.fw-theme .fw-fullscreen-trigger[aria-pressed=true]{background:var(--fw-accent-soft)}
.fw-fullscreen-notice{position:fixed;z-index:100000;left:50%;bottom:max(24px,env(safe-area-inset-bottom));transform:translateX(-50%);width:max-content;max-width:calc(100vw - 32px);box-sizing:border-box;padding:12px 16px;border:1px solid var(--fw-line);border-radius:12px;background:var(--fw-card);color:var(--fw-text);font:15px/1.6 sans-serif;text-align:center;pointer-events:none}
.fw-fullscreen-notice[hidden]{display:none!important}
html[data-hd-theme] .learn-header>.fw-theme.fw-tools{flex:0 0 auto}
html[data-hd-theme] .letters-header.site-head{grid-template-columns:44px minmax(0,1fr) 92px;gap:8px}
.about-top>.fw-theme.fw-tools{right:16px}.about-top .about-brand{padding-right:104px}
html.fw-focus-mode .mobile-tabbar,html.fw-focus-mode .learn-sidebar,html.fw-focus-mode .header-stats,html.fw-focus-mode .memory-header>nav,html.fw-focus-mode .site-head>nav,html.fw-focus-mode .sidebar>.nav-list{display:none!important}
html.fw-focus-mode .learn-shell{grid-template-columns:minmax(0,1fr)}
html.fw-focus-mode .learn-header>.fw-tools{margin-left:auto}
@media(min-width:941px){html.fw-focus-mode .app-shell{grid-template-columns:minmax(0,1fr)}html.fw-focus-mode .app-shell>.sidebar{display:none}}
@media(max-width:900px){.memory-header{position:relative}}
@media(max-width:860px){.reader-top .reader-back{grid-row:2;grid-column:1/-1;justify-self:start}.reader-top>.fw-tools{grid-row:1;grid-column:2;margin-left:auto}}
@media(max-width:820px){
  .admin-shell .side{position:relative}.admin-shell .side>.fw-theme.fw-tools{display:flex;position:absolute;top:16px;right:16px}.admin-shell .side .brand{padding-right:104px}.admin-shell .topbar .session>.fw-theme.fw-tools{display:none}
}
@media(max-width:560px){
  .admin-shell .side>.fw-theme.fw-tools{display:flex}.admin-shell .side .brand{padding-right:104px}
  .reader-top{gap:8px;flex-wrap:wrap}.reader-top .reader-brand{flex:1;min-width:0}.reader-top .reader-back{grid-row:2;grid-column:1/-1;justify-self:start}.reader-top>.fw-tools{grid-row:1;grid-column:2;margin-left:auto}
  .study-header .close-link{max-width:72px;line-height:1.4;text-align:center}
}
@media(max-width:420px){
  html[data-hd-theme] .learn-header .brand{min-width:44px;min-height:44px;justify-content:center}
  html[data-hd-theme] .learn-header .brand-mark{display:none}
  html[data-hd-theme] .learn-header{gap:4px}
  html[data-hd-theme] .learn-header .header-stats a{flex:0 0 44px;width:44px;max-width:44px;flex-direction:column;padding:2px;gap:1px}
  html[data-hd-theme] .learn-header .header-stats strong{max-width:100%;overflow:hidden;text-overflow:ellipsis;font-size:11px;line-height:1.4}
  .site-head .brand-link small{display:none}
}
@media(max-width:359px){html[data-hd-theme] .learn-header .brand-copy{display:none}html[data-hd-theme] .learn-header .brand-mark{display:block;width:28px;flex-basis:28px}}
@media(max-width:360px){
  html[data-hd-theme] .sidebar .brand-home{grid-template-columns:minmax(0,1fr);gap:0}
  html[data-hd-theme] .sidebar .brand-mark{display:none}
  html[data-hd-theme] .sidebar h1{font-size:16px}
}
