/* Theme 1: magical academy — midnight ink, aged parchment and warm gold. */
html[data-theme="magic"]{--gold:#e7c071;--line:#655335;--muted:#c7bca6;background:#141321;color:#f2e7ce;color-scheme:dark}
html[data-theme="magic"] body{background:radial-gradient(ellipse at 12% 0,#47314d55,transparent 55%),radial-gradient(ellipse at 95% 40%,#173d3a44,transparent 60%),#141321;color:#f2e7ce}
[data-theme="magic"] .academy-header{background:linear-gradient(110deg,#251d32,#162b31);border-bottom:2px solid #b19352;box-shadow:0 5px 26px #0007}
[data-theme="magic"] .brand{color:#f4d18a;text-shadow:0 0 20px #eec17233}
[data-theme="magic"] .seal{color:#ffe2a0}
[data-theme="magic"] .horizontal-nav+.horizontal-nav{border-color:#a1834a44}
[data-theme="magic"] .horizontal-nav button{color:#d4c8b1}
[data-theme="magic"] .horizontal-nav button:hover{background:#554327;color:#fff0c5;border-color:#ae8e50;box-shadow:0 0 17px #e5bd6233}
[data-theme="magic"] .horizontal-nav button.active,[data-theme="magic"] .horizontal-nav button[aria-pressed="true"]{background:linear-gradient(125deg,#665031,#3f432e);border-color:#c3a166;color:#fff0c5;box-shadow:inset 0 -2px #e8c77d}
[data-theme="magic"] h1,[data-theme="magic"] h2,[data-theme="magic"] .featured strong{font-family:Georgia,"Times New Roman",serif;color:#f4d99e}
[data-theme="magic"] p,[data-theme="magic"] .breadcrumbs{color:#c7bca6}
[data-theme="magic"] .eyebrow,[data-theme="magic"] .study-eyebrow{color:#e3bf78}
[data-theme="magic"] .featured a{background:radial-gradient(ellipse at top right,#54423f,transparent 75%),linear-gradient(125deg,#242c36,#182d2c);border:1px solid #aa8c51;box-shadow:inset 0 0 0 5px #d8b66c0b,0 14px 35px #0003}
[data-theme="magic"] .featured a:nth-child(2){background:radial-gradient(ellipse at top right,#493458,transparent 75%),#232434}
[data-theme="magic"] .featured a:after{content:'✦';position:absolute;right:28px;bottom:22px;font-size:30px;color:#dabb7677;pointer-events:none}
[data-theme="magic"] .featured a:hover{box-shadow:0 0 26px #c8a25b22;border-color:#ffe2a1}
[data-theme="magic"] .subjects button,[data-theme="magic"] .topic,[data-theme="magic"] .hint{background:#262737;border-color:#716046;color:#e7d6b7}
[data-theme="magic"] iframe[id$="Frame"]{border-color:#8b754b;background:#141321;box-shadow:0 15px 40px #0003}
[data-theme="magic"] .study-settings,[data-theme="magic"] .panel{background:linear-gradient(125deg,#2b2e38,#1d2c30);border-color:#726044}
[data-theme="magic"] select{background:#202633;border-color:#796b52;color:#f3e9d1}
[data-theme="magic"] .study-header h1{text-shadow:0 2px 12px #d1a65022}
[data-theme="magic"] #studyQuestion{color:#f4dfb8}
[data-theme="magic"] .study-options button{background:#303845;border-color:#91784b;color:#f7ead0;box-shadow:inset 0 0 0 3px #c9ac6c0a}
[data-theme="magic"] .study-options button:hover:not(:disabled){background:#454637;box-shadow:0 0 18px #e3bd5933}
[data-theme="magic"] .study-face{background:radial-gradient(ellipse at top,#f0dfad,#c9ad76);border:2px solid #e6c785;color:#35293b;text-shadow:0 1px #fff5;box-shadow:inset 0 0 0 7px #6a4b3022,0 14px 30px #0005}
[data-theme="magic"] .study-back{background:radial-gradient(ellipse at top,#e8d59d,#a3b69b);color:#243d36}
[data-theme="magic"] .study-footer button{border-color:#998052;background:#343441;color:#f7e7c1}
[data-theme="magic"] #studyKnown,[data-theme="magic"] #studyNext,[data-theme="magic"] #studyRepeat,[data-theme="magic"] #start{background:linear-gradient(120deg,#f0d18c,#c69c51);color:#2b2435;border-color:#e8c980}
[data-theme="magic"] .learning-hub{background:#252739;border-color:#756143}
[data-theme="magic"] .learning-action{background:#303442;border-color:#756143}
[data-theme="magic"] .learning-action[aria-pressed=true]{background:#55472b;border-color:#d4b873}
[data-theme="magic"] .study-options button.correct{background:#275642;border-color:#8dd8a8;color:#f1fff4}
[data-theme="magic"] .study-options button.wrong{background:#653642;border-color:#e3a6b3;color:#fff0f3}
[data-theme="magic"] .theme-arrival{animation:spellReveal .65s ease both}
[data-theme="magic"] .study-content.refresh{animation:spellReveal .38s ease both}
[data-theme="magic"] .brand .seal{animation:goldShimmer 4s ease-in-out 2}
@keyframes spellReveal{from{opacity:.3;filter:brightness(1.35);transform:translateY(7px)}to{opacity:1;filter:brightness(1);transform:translateY(0)}}
@keyframes goldShimmer{0%,100%{text-shadow:0 0 4px #eec17222}50%{text-shadow:0 0 16px #ffd98c,0 0 30px #b97ecf}}
@media(prefers-reduced-motion:reduce){[data-theme="magic"] *,[data-theme="magic"] *:before,[data-theme="magic"] *:after{animation:none!important;transition:none!important}}

/* Animate inner content, preserving Leaflet's map-position transforms. */
[data-theme="magic"] #map .geo-popup .leaflet-popup-content-wrapper{background:linear-gradient(135deg,#fff7df,#f1e1b6);border:1px solid #ae8334;box-shadow:0 7px 24px #20112c55,0 0 18px #edbd6155;animation:atlasSpellAppear .46s cubic-bezier(.16,.8,.25,1) both}
[data-theme="magic"] #map .geo-popup .leaflet-popup-tip{background:#f1e1b6}
[data-theme="magic"] #map .geo-popup .leaflet-popup-content-wrapper:before{background:linear-gradient(110deg,transparent 25%,#fff9cebb 48%,transparent 70%);animation:atlasSpellSweep .75s ease-out both}
[data-theme="magic"] #map .leaflet-tooltip{background:#fff3d1;border-color:#bb934a;color:#49351c;animation:atlasSpellHint .3s ease-out both;box-shadow:0 0 13px #e6b65366}
[data-theme="magic"] #map .capital-marker:hover span{box-shadow:0 0 0 3px #f6e7aa88,0 0 17px #ffd36a;transition:box-shadow .2s}
@keyframes atlasSpellAppear{from{opacity:0;transform:translateY(9px) scale(.93);filter:brightness(1.3)}to{opacity:1;transform:translateY(0) scale(1);filter:brightness(1)}}
@keyframes atlasSpellSweep{0%{opacity:0;transform:translateX(-100%)}25%{opacity:.8}100%{opacity:0;transform:translateX(100%)}}
@keyframes atlasSpellHint{from{opacity:0;filter:brightness(1.6) blur(2px)}to{opacity:1;filter:brightness(1) blur(0)}}
@media(prefers-reduced-motion:reduce){[data-theme="magic"] #map .geo-popup *,[data-theme="magic"] #map .geo-popup *:before,[data-theme="magic"] #map .leaflet-tooltip{animation:none!important;transition:none!important}}
