/* Two earlier, interactive foundations rooms: punctuation and visible APA layout. */
.foundation-shell{max-width:1050px;padding-bottom:22px}
.foundation-nav{display:flex;justify-content:flex-end;margin:7px 0 10px}
.foundation-shell button{touch-action:manipulation}
.foundation-victory{max-width:660px;margin:30px auto;text-align:center;padding:38px 25px;background:radial-gradient(ellipse at top,#51634d,#1d2b35 70%);border:3px solid #b39a68;border-radius:18px;color:#f7e8c9;box-shadow:0 18px 38px #070b15a8}
.foundation-sigil{font-size:4rem;text-shadow:0 0 25px #ffdc79;animation:foundationShine 1.8s ease-in-out infinite alternate}
.foundation-victory h2{font:700 clamp(1.4rem,3vw,2rem) Georgia,serif}
.foundation-overline,.forge-eyebrow{letter-spacing:.15em;font-size:.75rem;font-weight:850;color:#e4bd82}
@keyframes foundationShine{to{filter:brightness(1.4);transform:scale(1.07)}}
/* Forge facade: moving smoke, flickering flames, and a working smith hammer. */
.forge-scene{height:205px;margin:8px 0 18px;position:relative;isolation:isolate;overflow:hidden;border:4px ridge #887258;border-radius:16px;background:repeating-linear-gradient(0deg,transparent 0 44px,#72645d29 46px 48px),repeating-linear-gradient(90deg,transparent 0 66px,#675f6727 68px 71px),radial-gradient(ellipse at 21% 100%,#d860244b,transparent 40%),linear-gradient(150deg,#2e2a31,#161c2b 65%);box-shadow:inset 0 12px 30px #070c15ba}
.forge-scene:after{content:"";position:absolute;bottom:0;left:0;right:0;height:29px;background:linear-gradient(#64564a,#302d30);border-top:5px solid #998068}
.forge-fire{position:absolute;left:10%;bottom:25px;width:155px;height:135px;filter:drop-shadow(0 0 26px #d88129ad)}
.forge-fire:before{content:"";position:absolute;bottom:0;left:5%;width:86%;height:17px;border-radius:50%;background:#ed9e45;filter:blur(5px)}
.forge-fire i{position:absolute;bottom:10px;width:49px;height:93px;border-radius:5% 75% 20% 65%;background:linear-gradient(#ffeb81,#faad38 50%,#c54d23);transform-origin:50% 100%;animation:forgeFlicker 1.2s ease-in-out infinite alternate}
.forge-fire i:nth-child(1){left:28px;transform:rotate(-17deg);height:102px}
.forge-fire i:nth-child(2){left:65px;animation-delay:-.5s;height:120px}
.forge-fire i:nth-child(3){left:93px;animation-delay:-.9s;transform:rotate(18deg);height:80px}
@keyframes forgeFlicker{to{transform:scaleX(.74) rotate(13deg);height:66px;filter:brightness(1.2)}}
.forge-smith{position:absolute;bottom:27px;left:36%;height:125px;width:134px}
.forge-hammer{position:absolute;left:30px;top:0;font-size:4.3rem;transform-origin:80% 85%;animation:forgeHammer 1.6s ease-in-out infinite}
.forge-anvil{position:absolute;bottom:0;left:4px;width:122px;height:41px;display:grid;place-items:center;color:#c5b0a0;font-size:2.3rem;line-height:1;background:linear-gradient(#66717b,#333e49);border-radius:50% 14% 15% 16%;box-shadow:0 8px 0 #1a1d24}
@keyframes forgeHammer{0%,33%,100%{transform:rotate(-22deg)}47%,57%{transform:rotate(19deg)}}
.forge-sign{position:absolute;z-index:3;right:5%;top:28px;font:700 clamp(1.3rem,3vw,2.15rem) Georgia,serif;letter-spacing:.05em;text-align:center;color:#f5daab;max-width:42%;text-shadow:0 3px 8px #080d16,0 0 18px #e2a85355}
.forge-lights{position:absolute;bottom:40px;right:7%;display:flex;gap:8px}
.forge-light,.gremlin-lamp{width:18px;height:18px;border:2px solid #ad946c;transform:rotate(45deg);background:#243039;box-shadow:inset 0 0 7px #15191d}
.forge-light.lit,.gremlin-lamp.lit{background:#ffd375;box-shadow:0 0 11px #ffc777,inset 0 0 6px #fff9c6}
.forge-light.active,.gremlin-lamp.active{background:#4b7795;box-shadow:0 0 10px #a9d2fb}
.forge-training,.forge-work{border:2px solid #7d6b56;border-radius:16px;background:linear-gradient(#28303c,#1f2532);padding:22px 24px;box-shadow:0 10px 35px #0b0c1680}
.forge-training h2,.forge-work h2{margin:0 0 6px;color:#f5dfb9;font:700 clamp(1.22rem,2.4vw,1.65rem) Georgia,serif}
.forge-training>p{color:#e2e4da;max-width:700px;margin:8px 0 20px}
.rune-library{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-bottom:24px}
.rune-reference{display:grid;grid-template-columns:55px 1fr;gap:12px;align-items:center;border:1px solid #7c776e;border-radius:11px;background:#35404b;padding:11px;color:#f7e6cd}
.rune-reference-symbol{display:grid;place-items:center;width:55px;height:63px;border:3px solid #a38d69;border-radius:10px;background:radial-gradient(#f3deb7,#a88d6c);color:#322d2f;font:700 2.8rem Georgia,serif;box-shadow:inset 0 -5px 0 #4c45383f}
.rune-reference div{display:flex;flex-direction:column;gap:2px}.rune-reference strong{font-size:.99rem}.rune-reference span:not(.rune-reference-symbol){font-size:.88rem;color:#e1e4da}
.rune-reference small{font-family:Georgia,serif;color:#d8c8aa}
.forge-work-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:15px;flex-wrap:wrap}
.forge-progress{font-size:.78rem;color:#d7caaa}.forge-direction{font-size:.97rem;color:#e9dfc9;margin:16px 0}
.forge-scroll{position:relative;min-height:145px;display:grid;place-items:center;padding:30px 35px;margin:14px 0 22px;background:radial-gradient(ellipse at 40% 40%,#f4e9cf,#d7bd92 90%);border:6px solid #ad8152;border-left-width:15px;border-right-width:15px;border-radius:21px 13px 13px 21px;box-shadow:0 7px 0 #4a3423,0 16px 23px #05070f75,inset 0 0 28px #97703d66;overflow:hidden;transition:filter .3s,box-shadow .3s}
.forge-scroll:before,.forge-scroll:after{content:"";position:absolute;top:0;bottom:0;width:17px;background:linear-gradient(90deg,#795433,#cdad76,#76502f);border-radius:18px}
.forge-scroll:before{left:0}.forge-scroll:after{right:0}
.forge-scroll.forge-sealed{box-shadow:0 6px 0 #4a3423,0 0 25px #d2d98894,inset 0 0 25px #e5ba7480}
.forge-scroll-ink{color:#2c2b2c;display:block;text-align:center;font:500 clamp(1.12rem,2.3vw,1.47rem)/2 Georgia,serif;max-width:820px;white-space:normal}
.rune-print{white-space:pre-wrap}
.rune-hole{display:inline-flex;align-items:center;justify-content:center;min-width:34px;height:38px;padding:0 4px;margin:0 1px;border:2px dashed #806342;border-radius:7px;background:#eeddb9;color:#96653d;vertical-align:middle;font:700 1.45rem Georgia,serif;cursor:pointer;transition:transform .15s,background .15s}
.rune-hole:hover:not(:disabled),.rune-hole:focus-visible{background:#fdf8e7;transform:translateY(-2px)}
.rune-hole.filled{background:#b9e2cb;border:2px solid #598575;color:#27514a;cursor:default;animation:runeStamp .24s ease-out}
@keyframes runeStamp{0%{transform:scale(1.5);filter:brightness(1.6)}100%{transform:scale(1);filter:none}}
.forge-rack{display:grid;grid-template-columns:repeat(10,minmax(0,1fr));gap:8px;padding:15px;background:linear-gradient(#564937,#2c2f32);border:5px ridge #88725d;border-radius:12px}
.rune-stamp{padding:3px;min-height:67px;border:3px solid #a38b6a;border-bottom:8px solid #6c5842;border-radius:9px;background:radial-gradient(#e9d39e,#9f886b);box-shadow:0 4px 3px #100d11a8;color:#2a2930;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:2px;transition:transform .13s,filter .13s}
.rune-stamp:hover{filter:brightness(1.14);transform:translateY(-3px)}.rune-stamp.chosen{border-color:#ffdb75;box-shadow:0 0 18px #fbd782,0 4px 3px #100d11a8;transform:translateY(-4px)}
.rune-symbol{font:700 clamp(1.36rem,2vw,1.85rem) Georgia,serif}.rune-name{font-size:.72rem;line-height:1.15}
.forge-bottom{display:flex;justify-content:space-between;align-items:center;gap:14px;flex-wrap:wrap;margin-top:18px}
.forge-hint{border-left:4px solid #f7c677;padding:9px 12px;background:#39444a;color:#f9dfad}.forge-notice{min-height:25px;margin:12px 0 0;color:#d1e8d9}.forge-notice.forge-warning{color:#f9c2a1}
/* Gremlin clinic: functioning controls and a readable document with subtle faults. */
.gremlin-machine{position:relative;display:flex;align-items:center;gap:22px;padding:25px 31px;margin-bottom:15px;min-height:142px;overflow:hidden;background:repeating-linear-gradient(90deg,#ffffff08 0 4px,transparent 5px 37px),radial-gradient(ellipse at 17% 30%,#8a6f4942,transparent 46%),linear-gradient(145deg,#414049,#202a33);border:4px ridge #887765;border-radius:15px}
.gremlin-machine h2{font:700 clamp(1.3rem,2.7vw,1.78rem) Georgia,serif;margin:4px 0;color:#f6e6c7;max-width:520px}
.gremlin-gears{position:relative;flex:0 0 115px;height:92px}.gremlin-gears i{font-style:normal;position:absolute;color:#b2aaa4;font-size:75px;line-height:1;animation:foundGear 9s linear infinite;text-shadow:0 5px 8px #060a11}
.gremlin-gears i:nth-child(2){font-size:61px;top:40px;left:55px;animation-direction:reverse;animation-duration:6s;color:#c5aa81}
@keyframes foundGear{to{transform:rotate(360deg)}}
.gremlin-silhouette{position:absolute;right:12%;bottom:-12px;width:72px;height:84px;border-radius:45% 45% 37% 35%;background:#657c61;border:4px solid #253f36;box-shadow:inset -11px -10px 0 #2e4d3d,0 0 13px #62ad71aa;transform:rotate(7deg);animation:gremlinBob 1.4s ease-in-out infinite alternate}
.gremlin-silhouette:before,.gremlin-silhouette:after{content:"";position:absolute;top:-23px;width:29px;height:47px;background:#657c61;clip-path:polygon(0 0,100% 100%,0 100%)}.gremlin-silhouette:before{left:3px;transform:rotate(-28deg)}.gremlin-silhouette:after{right:0;transform:scaleX(-1) rotate(-24deg)}
.gremlin-eyes{position:absolute;top:26px;left:15px;font:bold 2rem/1 Georgia,serif;letter-spacing:5px;color:#ffcf5f;text-shadow:0 0 10px #ffc760}
.gremlin-escaping{animation:gremlinRun 1s ease-in forwards}
@keyframes gremlinBob{to{transform:translateY(-6px) rotate(-5deg)}}@keyframes gremlinRun{to{transform:translate(165px,-75px) rotate(80deg);opacity:0}}
.gremlin-lamps{position:absolute;bottom:13px;left:30px;display:flex;gap:12px}.gremlin-lamp{width:13px;height:13px}
.gremlin-demo{background:#242c36;border:2px solid #786e62;border-radius:15px;padding:20px 24px}.gremlin-demo>p{margin:0 0 20px}
.gremlin-demo-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:20px;align-items:start;margin-bottom:22px}
.gremlin-demo-preview{padding:40px 35px;background:#fffef8;color:#272b33;border:10px solid #91919c;box-shadow:0 9px 22px #090c1580;min-height:360px;font:1rem Times New Roman,serif}
.gremlin-demo-preview p:first-child{margin:0 0 27px;font-size:1.16rem}.gremlin-demo-preview p{transition:all .25s ease-out}
.gremlin-demo-levers{display:flex;flex-direction:column;gap:8px}.demo-lever{display:flex;align-items:center;text-align:left;gap:11px;width:100%;min-height:49px;border:2px solid #748186;border-radius:10px;background:#313d48;color:#eff0e7;padding:9px 12px;font-size:.85rem;transition:transform .16s,background .16s}.demo-lever:hover{transform:translateX(5px);background:#42525d}.demo-lever.lever-tried{border-color:#8bc2a2}.lever-symbol{display:grid;place-items:center;flex:0 0 39px;height:35px;background:#d6d2ba;border:2px solid #b1a887;color:#2a3036;border-radius:7px;font:700 1.12rem Georgia,serif}.lever-light{margin-left:auto;font-size:1.3rem;color:#d6e9c9}
.gremlin-repair-scene{display:grid;grid-template-columns:minmax(0,1fr) minmax(285px,.83fr);gap:18px;align-items:start;margin:15px 0 30px}.gremlin-page-holder{background:repeating-linear-gradient(0deg,#141e2a 0 24px,#25313c 25px 29px);border:10px ridge #69636b;border-radius:12px;padding:18px;position:relative}.gremlin-page-holder:before{content:"";position:absolute;inset:7px;pointer-events:none;border:2px dashed #8e9b9970}
.gremlin-document{background:#fffefb;color:#22242c;border:1px solid #d1cec1;box-shadow:0 12px 27px #05070ca6;min-height:610px;padding:38px clamp(21px,4vw,42px) 37px;font:clamp(.86rem,1.5vw,1rem) Times New Roman,serif;position:relative}
.gremlin-pageno{position:absolute;top:13px;right:29px;color:#25262b;font:13px Times New Roman,serif}
.gremlin-page-zone,.gremlin-refs-hit{font:inherit;color:inherit;width:100%;border:2px solid transparent;background:transparent;padding:0;display:block;text-align:inherit;cursor:pointer;white-space:normal;overflow-wrap:anywhere}
.gremlin-page-zone{transition:box-shadow .15s;background-color .15s}.gremlin-page-zone:hover,.gremlin-refs-hit:hover{background:#def0ee66}
.gremlin-page-zone.selected,.gremlin-refs.selected{outline:2px dashed #37928e;outline-offset:2px;background:#d9f2ef70}
.gremlin-title{font-size:1.08em;margin:18px 0 22px}.gremlin-paragraph{margin:0;text-align:inherit;font-size:1em}
.gremlin-paragraph-gap{width:100%;min-height:14px;display:block;padding:0;border:1px solid transparent;background:transparent;cursor:pointer;position:relative;transition:height .22s;overflow:hidden}
.gremlin-paragraph-gap.too-large{min-height:70px}.gremlin-paragraph-gap:hover{background:#e4c38e1a}.gremlin-paragraph-gap.selected{outline:2px dashed #37928e;outline-offset:0;background:#f6e2bd44}
.gremlin-gap-instruction{display:none;position:absolute;font:12px sans-serif;top:8px;left:4px;color:#73634e}.gremlin-paragraph-gap.selected .gremlin-gap-instruction{display:inline}
.gremlin-ref-title{margin:27px 0 20px}.gremlin-refs{border:2px solid transparent;margin-top:0}.gremlin-refs-hit{display:flex;flex-direction:column;gap:11px;line-height:inherit}.gremlin-refs-hit span{display:block;text-align:left}.gremlin-workbench{background:linear-gradient(#343d48,#222c39);border:3px ridge #a18b68;border-radius:15px;padding:20px 18px;min-height:490px;box-shadow:0 16px 22px #0b111ebd}
.gremlin-workbench h3{font:700 1.4rem Georgia,serif;color:#f2d3a5;margin:0 0 8px}.gremlin-workbench>p{color:#e4e2da;margin:7px 0 13px;font-size:.93rem}.gremlin-select-help{margin:22px 0;color:#d7e0e0;line-height:1.6}
.gremlin-tool-section{border-top:1px solid #6c777a;padding:11px 0 8px}.gremlin-tool-section strong{display:block;color:#f7dab1;font-size:.83rem;margin-bottom:8px}
.gremlin-toolset{display:flex;gap:5px;flex-wrap:wrap}.gremlin-toolset button{min-width:40px;padding:7px 10px;color:#f3f1eb;background:#3e4e5a;border:2px solid #71838a;border-radius:7px;font-size:.86rem}.gremlin-toolset button:hover{background:#576877}.gremlin-toolset button.tool-active{color:#2a3036;background:#ffdc96;border-color:#faebbd}
.gremlin-check{display:flex;gap:8px;flex-wrap:wrap;margin:17px 0 8px}.gremlin-check button{font-size:.84rem;padding:10px 12px}.gremlin-clue{border-left:3px solid #f3ce85;padding:9px 11px;background:#47464a;color:#ffe3b6}.gremlin-status{color:#d9eadc;min-height:35px;margin:10px 0 0;font-size:.84rem}.gremlin-award{display:flex;gap:12px;align-items:center;min-height:120px;margin:20px 0 30px;border:2px solid #b7a273;border-radius:12px;padding:15px;color:#f3f6dc;background:#3b5b4b}.gremlin-award:first-letter{font-size:2rem}
.gremlin-restored .gremlin-document{animation:gremlinClean .8s ease-in-out both}
@keyframes gremlinClean{30%{filter:brightness(1.18);transform:rotate(.6deg)}100%{filter:none;transform:none}}
@media(max-width:850px){.forge-rack{grid-template-columns:repeat(5,minmax(0,1fr))}.gremlin-repair-scene{grid-template-columns:1fr}.gremlin-workbench{min-height:0}.gremlin-document{max-width:530px;margin:0 auto}.gremlin-demo-grid{grid-template-columns:1fr}.gremlin-demo-preview{min-height:280px}}
@media(max-width:580px){.rune-library{grid-template-columns:1fr}.forge-training,.forge-work{padding:16px 13px}.forge-scene{height:170px}.forge-fire{left:0;transform:scale(.75);transform-origin:bottom left}.forge-smith{left:27%;transform:scale(.8);transform-origin:bottom left}.forge-sign{font-size:1.2rem;right:3%;max-width:48%;top:24px}.forge-lights{right:4%;bottom:34px}.forge-light{width:12px;height:12px}.forge-scroll{padding:22px 18px;min-height:125px}.forge-scroll-ink{line-height:2.1}.forge-rack{gap:6px;padding:9px}.rune-stamp{min-height:60px;border-width:2px;border-bottom-width:5px}.gremlin-machine{padding:17px 19px 32px;gap:10px}.gremlin-gears{flex-basis:80px}.gremlin-gears i{font-size:57px}.gremlin-gears i:nth-child(2){font-size:44px;left:42px;top:32px}.gremlin-silhouette{right:0;transform:scale(.7);transform-origin:bottom right}.gremlin-demo{padding:13px}.gremlin-document{padding:30px 19px;min-height:565px}.gremlin-page-holder{padding:8px}.gremlin-workbench{padding:14px 12px}}
@media(prefers-reduced-motion:reduce){.forge-fire i,.forge-hammer,.gremlin-gears i,.gremlin-silhouette,.foundation-sigil,.gremlin-restored .gremlin-document{animation:none!important}.demo-lever,.rune-stamp,.gremlin-page-zone{transition:none!important}}