/* Independent icon-only light/dark control at the right edge. */
.brand-row{grid-template-columns:auto minmax(0,1fr) auto auto}
.mode-toggle{position:relative;display:inline-flex;align-items:center;justify-content:space-between;gap:6px;width:86px;min-width:86px;height:42px;padding:4px;border:1px solid #8b7b64;border-radius:24px;background:#0d1828;color:#c5cede;cursor:pointer;isolation:isolate}
.mode-toggle:before{content:'';position:absolute;left:4px;top:4px;width:34px;height:32px;border-radius:50%;background:#c8b8e3;transform:translateX(42px);transition:transform .25s ease,background .25s;z-index:-1}
.mode-toggle span{display:grid;place-items:center;width:34px;height:32px}.mode-toggle svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.mode-toggle .moon-symbol{color:#20243b}.mode-toggle:focus-visible{outline:3px solid #70bbdc;outline-offset:4px}.mode-toggle:hover{border-color:#f2d095}
[data-mode="light"] .mode-toggle:before{transform:translateX(0);background:#e8bc60}[data-mode="light"] .mode-toggle .sun-symbol{color:#352508}[data-mode="light"] .mode-toggle .moon-symbol{color:#4c5369}
/* Light palette is applied after both themed stylesheets. */
html[data-mode="light"]{--gold:#8c5a17;--line:#b5a789;--muted:#555469;color-scheme:light;background:#f4eedf;color:#292b3b}
html[data-mode="light"] body{background:radial-gradient(ellipse at 10% 0,#e4d6ed77,transparent 60%),#f4eedf;color:#292b3b}
[data-mode="light"] .academy-header{background:linear-gradient(110deg,#f4e7cf,#ece7ed);border-color:#a18448;box-shadow:0 4px 18px #53452918}
[data-mode="light"] .brand,[data-mode="light"] .seal{color:#765020;text-shadow:none}
[data-mode="light"] .brand small,[data-mode="light"] .breadcrumbs,[data-mode="light"] p,[data-mode="light"] .welcome>p{color:#555469}
[data-mode="light"] .horizontal-nav+.horizontal-nav{border-color:#c9baa0}
[data-mode="light"] .horizontal-nav button{color:#4e4356;background:#ebe2d4;border-color:#c9bca5}
[data-mode="light"] .horizontal-nav button:hover{background:#dfcca6;color:#30283c}
[data-mode="light"] .horizontal-nav button.active,[data-mode="light"] .horizontal-nav button[aria-pressed="true"]{background:#dbc18b;color:#382a13;border-color:#8d6c30;box-shadow:inset 0 -2px #8d6c30}
[data-mode="light"] h1,[data-mode="light"] h2,[data-mode="light"] .featured strong,[data-mode="light"] .study-header h1{color:#674620;text-shadow:none}
[data-mode="light"] .eyebrow,[data-mode="light"] .study-eyebrow{color:#805717}
[data-mode="light"] .featured a,[data-mode="light"] .featured a:nth-child(2){background:linear-gradient(125deg,#fbf4df,#e4ddc7);border-color:#ae9665;box-shadow:inset 0 0 0 5px #ae96650a,0 9px 25px #53452912;color:#35313e}
[data-mode="light"] .featured a:nth-child(2){background:linear-gradient(125deg,#f5eaf9,#e0d6e5)}
[data-mode="light"] .featured small,[data-mode="light"] .featured p,[data-mode="light"] .featured .go{color:#595066}
[data-mode="light"] .subjects button,[data-mode="light"] .topic,[data-mode="light"] .hint{background:#eee5d6;border-color:#b1a184;color:#383346}
[data-mode="light"] .subjects button strong,[data-mode="light"] .info strong{color:#775020}
[data-mode="light"] .subjects button small,[data-mode="light"] .topic small{color:#60596a}
[data-mode="light"] .pill{border-color:#a1937f;color:#60596a}
[data-mode="light"] iframe[id$="Frame"]{background:#f4eedf;border-color:#ad986d;box-shadow:0 10px 30px #665c3d14}
[data-mode="light"] .study-settings,[data-mode="light"] .panel{background:#eee6d6;border-color:#b9a47c}
[data-mode="light"] .study-settings label,[data-mode="light"] aside label,[data-mode="light"] .study-stats,[data-mode="light"] .study-stats span:first-child,[data-mode="light"] .study-meta,[data-mode="light"] .keyboard-hint{color:#575064}
[data-mode="light"] select{background:#fffaf0;border-color:#aa9e89;color:#302c3c}
[data-mode="light"] button{color:#3b3346;background:#e3d7bf;border-color:#a69069}
[data-mode="light"] .study-flip,[data-mode="light"] .study-flip:hover{background:transparent;border:0}
[data-mode="light"] .study-settings button,[data-mode="light"] .study-footer button,[data-mode="light"] button.secondary{background:#e3d7bf;border-color:#a69069;color:#3a3041}
[data-mode="light"] #studyKnown,[data-mode="light"] #studyNext,[data-mode="light"] #studyRepeat,[data-mode="light"] #start{background:linear-gradient(120deg,#e2c177,#ceb079);color:#30240e;border-color:#91703a}
[data-mode="light"] #studyQuestion,[data-mode="light"] #studyFeedback{color:#3d3549}
[data-mode="light"] .study-options button{background:#fcf6e9;border-color:#a3906c;color:#30283c}
[data-mode="light"] .study-options button:hover:not(:disabled){background:#e9dcc0}
[data-mode="light"] .study-face{box-shadow:inset 0 0 0 7px #6a4b3018,0 12px 24px #594a3422}
[data-mode="light"] .study-options button.correct{background:#d2ecda;border-color:#3c8258;color:#17472b}
[data-mode="light"] .study-options button.wrong{background:#f4d8db;border-color:#aa5363;color:#72283c}
[data-mode="light"] .learning-hub{background:#eae1d0;border-color:#b19c70}
[data-mode="light"] .learning-action{background:#e4d8c0;border-color:#a6906a;color:#493b26}
[data-mode="light"] .learning-action small{color:#635a4b}
[data-mode="light"] .learning-action[aria-pressed=true]{background:#d8c08e;color:#3f311a;border-color:#91723d}
[data-mode="light"] .draft-alert,[data-mode="light"] .warning{background:#f3e7c7;border-color:#ad955e;color:#635021}
[data-mode="light"] .map-bar,[data-mode="light"] .toolbar,[data-mode="light"] .footnote,[data-mode="light"] .credit,[data-mode="light"] #score{color:#5d5867}
[data-mode="light"] .study-meta{border-color:#b8aa90}
[data-mode="light"] .theme-toggle,[data-mode="light"] .mode-toggle{background:#ede5d8;border-color:#a8987d;color:#55516a}
[data-mode="light"] .theme-toggle .console-symbol{color:#55516a}
[data-mode="light"] .theme-toggle .magic-symbol{color:#392b16}
/* A bright starship console retains the LCARS shapes and coloured controls. */
html[data-theme="console"][data-mode="light"]{--gold:#99602b;--line:#a7afc3;--muted:#4f6074;background:#edf2f8}
html[data-theme="console"][data-mode="light"] body{background:linear-gradient(#4b709007 1px,transparent 1px),#edf2f8;background-size:100% 5px;color:#263247}
[data-theme="console"][data-mode="light"] .academy-header{background:#e1e8f2;border-bottom-color:#9c7ebc;box-shadow:0 5px 0 #edf2f8,0 7px 0 #9db1c5}
[data-theme="console"][data-mode="light"] .brand,[data-theme="console"][data-mode="light"] .seal{color:#624c87}
[data-theme="console"][data-mode="light"] .horizontal-nav button{background:#c6b4df;color:#17253d;border-color:transparent}
[data-theme="console"][data-mode="light"] .subject-nav button:nth-child(even){background:#e7b88e}
[data-theme="console"][data-mode="light"] .area-nav button{background:#b0d2e3}
[data-theme="console"][data-mode="light"] .horizontal-nav button.active,[data-theme="console"][data-mode="light"] .horizontal-nav button[aria-pressed=true]{background:#efbd82;color:#3d2814;box-shadow:inset 0 -3px #aa662c}
[data-theme="console"][data-mode="light"] h1,[data-theme="console"][data-mode="light"] h2,[data-theme="console"][data-mode="light"] .featured strong,[data-theme="console"][data-mode="light"] .study-header h1{color:#5b4679}
[data-theme="console"][data-mode="light"] .eyebrow,[data-theme="console"][data-mode="light"] .study-eyebrow{color:#8d5529}
[data-theme="console"][data-mode="light"] .featured a,[data-theme="console"][data-mode="light"] .featured a:nth-child(2){background:#f7f9fd;border-color:#a59bb7;border-left-color:#aa8dca}
[data-theme="console"][data-mode="light"] .featured a:nth-child(2){border-left-color:#d69b65}
[data-theme="console"][data-mode="light"] .featured a:after{color:#31657e}
[data-theme="console"][data-mode="light"] .subjects button,[data-theme="console"][data-mode="light"] .topic,[data-theme="console"][data-mode="light"] .hint{background:#e6edf7;border-color:#9bacc6;border-left-color:#8bafc9}
[data-theme="console"][data-mode="light"] iframe[id$="Frame"]{background:#edf2f8;border-color:#a292bd}
[data-theme="console"][data-mode="light"] .study-settings,[data-theme="console"][data-mode="light"] .panel{background:#e4ecf5;border-color:#a5b3c8;border-left-color:#a58ac6}
[data-theme="console"][data-mode="light"] select{background:#f8fbff;border-color:#96aac5;color:#25344c}
[data-theme="console"][data-mode="light"] .study-options button{background:#f7faff;border-color:#8ea9c2;border-left-color:#ac91cc;color:#25344c}
[data-theme="console"][data-mode="light"] .study-options button:hover:not(:disabled){background:#d8e9f4}
[data-theme="console"][data-mode="light"] .study-face{background:repeating-linear-gradient(0deg,#49779108 0px,#49779108 1px,transparent 1px,transparent 5px),#e4eff8;border-color:#779eba;border-left-color:#a98cc9;color:#2e4e68}
[data-theme="console"][data-mode="light"] .study-back{background:#dcefeb;color:#285851;border-color:#73a69e;border-left-color:#73a69e}
[data-theme="console"][data-mode="light"] .study-footer button,[data-theme="console"][data-mode="light"] .study-settings button{background:#c6b4df;border-color:#a18bbd;color:#2d2343}
[data-theme="console"][data-mode="light"] #studyKnown,[data-theme="console"][data-mode="light"] #studyNext,[data-theme="console"][data-mode="light"] #studyRepeat,[data-theme="console"][data-mode="light"] #start{background:#edbe89;color:#3e2b14;border-color:#b88b52}
[data-theme="console"][data-mode="light"] .study-options button.correct{background:#ceeae4;border-color:#4c8c7e;color:#215349}
[data-theme="console"][data-mode="light"] .study-options button.wrong{background:#f2dae1;border-color:#b46c84;color:#702d46}
[data-theme="console"][data-mode="light"] .theme-toggle .magic-symbol{color:#55516a}
[data-theme="console"][data-mode="light"] .theme-toggle .console-symbol{color:#251c36}
@media(max-width:700px){.brand-row{grid-template-columns:auto minmax(0,1fr) auto}.brand-row .breadcrumbs{display:none}}
@media(max-width:480px){.brand-row{gap:8px}.mode-toggle{width:78px;min-width:78px;height:40px}.mode-toggle:before{height:30px;width:30px;transform:translateX(38px)}.mode-toggle span{width:30px;height:30px}[data-mode="light"] .mode-toggle:before{transform:translateX(0)}.brand{font-size:13px;line-height:1.2;gap:5px}.brand .seal{display:none}}
@media(prefers-reduced-motion:reduce){.mode-toggle:before{transition:none}}
