/* sam v2: keep the forest, improve the learning and account experience. */
.text-link{display:block;min-height:48px;margin:8px auto;padding:12px;color:#345d43;text-decoration:underline;text-underline-offset:4px;font-size:14px}
.auth-screen{background:linear-gradient(#f3f6e9dd,#fcfcf5),url('assets/ground.png') center/cover}.auth-brand{display:flex;align-items:center;justify-content:center;gap:18px;padding:22px 0 6px}.auth-brand .sam-wordmark{font-size:48px}.auth-screen .field{margin:20px 0}.recovery-code{display:block;overflow-wrap:anywhere;background:#e3ead7;padding:24px;border-radius:16px;margin:28px 0;font-size:18px}
.character-choices{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:24px}.character-choice{padding:16px 8px;min-height:155px}.character-choice strong{font-size:14px}.character-choice[aria-pressed="true"]{padding:15px 7px}.character-choice .select-dot{margin-top:9px}.secret-status{display:block;font-size:12px;line-height:1.5;margin-top:6px;color:#466344}.secret-locked{border-style:dashed;background:#e9ece0}.secret-locked .portrait{filter:grayscale(1);opacity:.45}.secret-locked .select-dot:after{content:'—';font-size:12px}.character-preview{min-height:220px}
.secret-face{display:block;position:absolute;inset:0;background-image:url('assets/secret-faces.png');background-repeat:no-repeat;background-size:335% 112%;background-position:0% 50%;opacity:0}
.secret-part.rig-head{background-image:none!important;aspect-ratio:1.13!important}.face-focus{background-position:0% 50%;opacity:1;animation:focus-face 4.8s infinite}.face-realize{background-position:50% 50%;animation:realize-face 4.8s infinite}.face-joy{background-position:100% 50%;animation:joy-face 4.8s infinite}
@keyframes focus-face{0%,49%{opacity:1}50%,99%{opacity:0}100%{opacity:1}}@keyframes realize-face{0%,49%,70%,100%{opacity:0}50%,69%{opacity:1}}@keyframes joy-face{0%,69%,100%{opacity:0}70%,99%{opacity:1}}
.character-D .rig-writing{animation:furious-writing .24s linear infinite;transform-origin:14px 29px}.character-D .rig-head{animation:furious-focus .65s ease-in-out infinite}.character-D .rig-body{animation:furious-shoulders .35s ease-in-out infinite}.character-D .rig-pencil{width:31px;top:-12px}.character-D .rig-book{width:108px;left:6px}.character-D:after{content:'';position:absolute;left:13px;top:88px;width:82px;height:16px;border-top:2px dashed #87634266;transform:rotate(-8deg);animation:pencil-streak .3s linear infinite;z-index:5;pointer-events:none}
@keyframes furious-writing{0%,100%{transform:translate(-5px,0) rotate(-14deg)}25%{transform:translate(12px,3px) rotate(12deg)}50%{transform:translate(2px,-2px) rotate(-8deg)}75%{transform:translate(18px,1px) rotate(16deg)}}
@keyframes furious-focus{0%,100%{transform:translate(0,0) rotate(-5deg)}45%{transform:translate(2px,4px) rotate(6deg)}75%{transform:translate(-1px,1px) rotate(-2deg)}}
@keyframes furious-shoulders{50%{transform:translateY(2px) rotate(3deg)}}@keyframes pencil-streak{50%{opacity:.2;transform:translateX(4px) rotate(-4deg)}}
.app .secret-jump{background-size:455% 226%;background-position:100% 100%;background-repeat:no-repeat}
.app .stump-node .lock-dot,.app .stump-node .done-check{position:absolute;inset:55px 7px auto auto;width:30px;height:30px;display:grid;place-items:center;z-index:12;border:2px solid #fcfbee;border-radius:50%;transform:scale(var(--badge-scale,1));transform-origin:center;box-shadow:0 2px 3px #263b2940;pointer-events:none;opacity:var(--badge-opacity,1)}
.app .stump-node .lock-dot{background:#e5e9d8;color:#51614b}.app .stump-node .done-check{background:#367445;color:#fff}.app .stump-node .lock-dot svg,.app .stump-node .done-check svg{width:19px;height:19px;stroke-width:2.4}
.app #content-view{background-color:#e9efd9;background-image:linear-gradient(#eff4e5d9,#eef2dfb5),url('assets/ground.png');background-size:100% 100%,auto 100%;background-position:center}
.app[data-level="2"] #content-view{background-color:#f2edd9;background-image:linear-gradient(#f6f1e4dd,#f4efd9c2),url('assets/ground.png')}.app[data-level="3"] #content-view{background-color:#e3eadf;background-image:linear-gradient(#eaf1e5dd,#e4eddebc),url('assets/ground.png')}
.lesson-toolbar{background:#f6f8efed;backdrop-filter:blur(12px)}.lesson-footer{background:#f6f8efe8!important;border-top:1px solid #c4d2b7;backdrop-filter:blur(10px)}.lesson-body{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='270' height='230' viewBox='0 0 270 230'%3E%3Cpath d='M16 52l-2-5m6 5v-7m5 7 2-5M244 185l-2-6m7 6v-8m4 8 2-4' fill='none' stroke='%239cae80' stroke-width='2' stroke-linecap='round'/%3E%3Cg fill='%23fffef5'%3E%3Ccircle cx='232' cy='44' r='3'/%3E%3Ccircle cx='238' cy='44' r='3'/%3E%3Ccircle cx='235' cy='40' r='3'/%3E%3Ccircle cx='235' cy='48' r='3'/%3E%3C/g%3E%3Ccircle cx='235' cy='44' r='2' fill='%23e5c97e'/%3E%3C/svg%3E");background-repeat:repeat;background-size:270px 230px}
.passage-paper,.grammar-note,.answer-option,.word-bank,.order-tray{box-shadow:0 3px 12px #354c1d08}.passage-paper,.answer-option{background:#fffef8f5}.question-index{display:inline-block;background:#f8faefcf;border-radius:20px;padding:5px 11px}.word-display{background:#f7faefcc;border-radius:24px;padding:25px 16px}
.app #content-view.chat-view{background:#e5eddf}.chat-context{padding:11px 20px;border-bottom:1px solid #becdb3;background:#f4f7eded;display:flex;justify-content:space-between;gap:12px;font-size:12px;color:#476043}.chat-messages{flex:1;min-height:0;overflow:auto;padding:24px 16px 30px;display:flex;flex-direction:column;gap:24px}.chat-row{display:flex;gap:9px;align-items:flex-start}.chat-row .portrait{width:34px;height:38px}.chat-row .portrait>.rig-head{width:33px!important}.chat-row>div{min-width:0;max-width:calc(100% - 44px)}.chat-name{display:block;font-size:12px;color:#40533d;margin:0 0 7px 2px}.chat-bubble{background:#fffef8;border-radius:4px 18px 18px 18px;padding:15px 17px;font-size:15px;line-height:1.85;white-space:pre-wrap;overflow-wrap:anywhere;box-shadow:0 2px 7px #314c1f08}.chat-row.user{justify-content:flex-end}.chat-row.user .chat-bubble{background:#315e43;color:#fff;border-radius:18px 4px 18px 18px;max-width:85%}.typing span{display:inline-block;animation:typing 1s ease-in-out infinite;font-size:26px;line-height:1;margin-left:8px}@keyframes typing{50%{opacity:.3;transform:translateY(-3px)}}
.chat-composer{display:grid;grid-template-columns:1fr 48px;gap:8px;padding:12px 16px max(16px,env(safe-area-inset-bottom));background:#f8faf3;border-top:1px solid #cfdbc5;flex-shrink:0}.chat-composer textarea{resize:none;width:100%;min-height:58px;max-height:130px;border:1px solid #aebfa4;border-radius:16px;padding:12px;font:15px/1.5 inherit;background:white;color:#23412c}.chat-send{width:48px;height:48px;border-radius:50%;background:#315e43;color:#fff;align-self:center;display:grid;place-items:center}.chat-send:disabled{opacity:.45}.chat-composer small,.chat-composer p,.chat-composer>.sam-button{grid-column:1/-1}.chat-composer p,.chat-composer small{font-size:12px;color:#4a6045;line-height:1.65}.chat-error{font-size:13px;color:#8d352b;padding:10px 20px;background:#fff4e9}
.forest-intro{padding:42px 24px 24px;overflow:hidden;min-height:100%;background-color:#e0ecc9}.forest-intro .sam-wordmark{text-align:center;font-size:66px}.intro-magic{position:relative;flex:1;min-height:350px;max-height:570px;display:grid;place-items:center}.forest-intro .intro-stage{position:absolute;inset:0;width:100%;height:100%;min-height:0}.forest-intro .intro-stage>.rig{animation:intro-bounce 3.8s cubic-bezier(.4,0,.2,1) infinite;transform-origin:50% 100%}.forest-intro .rig-writing{animation:furious-writing .42s ease-in-out infinite}.forest-intro .rig-head{animation:furious-focus 1.2s ease-in-out infinite}.forest-intro .intro-stump{width:240px}.intro-orbit{position:absolute;width:310px;height:310px;top:50%;left:50%;transform:translate(-50%,-55%);border:1px solid #91b96755;border-radius:50%;box-shadow:0 0 0 32px #adc88813,0 0 0 64px #adc8880a;background:radial-gradient(#fffad5a0,transparent 65%)}.intro-companion{position:absolute;bottom:28%;z-index:4}.companion-left{left:-9px;transform:scale(.65) rotate(-8deg);animation:companion-left 4s ease-in-out infinite}.companion-right{right:-9px;transform:scale(.65) rotate(8deg);animation:companion-right 4s .3s ease-in-out infinite}.magic-mote{position:absolute;left:calc(8% + mod(var(--i) * 29,85) * 1%);top:50%;width:7px;height:11px;background:#9dc665;border-radius:90% 0 90% 0;box-shadow:0 0 10px #ffffca;animation:magic-rise 3.5s ease-in-out infinite;animation-delay:calc(var(--i) * -.27s);transform:rotate(calc(var(--i) * 24deg));opacity:0}.magic-mote:nth-child(3n){background:#fffbd0;width:5px;height:5px;border-radius:50%}
@keyframes intro-bounce{0%,100%{transform:scale(1.3) translateY(0) rotate(-2deg)}20%{transform:scale(1.32,1.25) translateY(3px)}42%{transform:scale(1.3) translateY(-25px) rotate(3deg)}65%{transform:scale(1.3) translateY(0) rotate(-2deg)}}
@keyframes companion-left{0%,100%{transform:scale(.65) translateY(0) rotate(-8deg)}50%{transform:scale(.65) translateY(-35px) rotate(5deg)}}@keyframes companion-right{0%,100%{transform:scale(.65) translateY(-20px) rotate(8deg)}50%{transform:scale(.65) translateY(10px) rotate(-5deg)}}@keyframes magic-rise{0%{opacity:0;translate:0 120px}25%,65%{opacity:.8}100%{opacity:0;translate:20px -180px}}
.reward-screen{background:radial-gradient(ellipse at 45% 30%,#264e3e,#0c2b21 75%);color:#fff4d4}.reward-screen::backdrop{background:#0c2b21}.reward-content{max-width:430px;padding:16px 18px max(22px,env(safe-area-inset-bottom));gap:8px;min-height:100%;justify-content:space-between}.reward-top{display:flex;align-items:center;justify-content:space-between;width:100%}.reward-top .label{font-size:13px;color:#cbdab8}.reward-top .icon-button{color:#fff4d4}.reward-content h1{font-size:24px;line-height:1.45;margin-top:4px;letter-spacing:-.04em}.reward-content canvas{display:block;width:100%;height:auto;max-height:62dvh;object-fit:contain;flex:1;min-height:240px}.reward-content #reward-caption{font-size:14px;line-height:1.65;min-height:46px;color:#eee9cf}.reward-track{display:flex;gap:6px;justify-content:center;margin:4px 0 12px}.reward-track i{display:block;width:26px;height:4px;border-radius:4px;background:#ffffff22}.reward-track .filled{background:#e3cf8e;box-shadow:0 0 10px #ffe2a044}.reward-content>.sam-button{background:#e4eccf;color:#254b36;margin-top:0}
@media(max-height:600px){.intro-magic{min-height:230px}.forest-intro{padding-top:20px}.forest-intro .sam-wordmark{font-size:42px}.forest-intro .intro-stage>.rig{scale:.8}.forest-intro .intro-stump{width:190px}.intro-companion{scale:.8}.reward-content canvas{min-height:190px;max-height:60dvh}.reward-content h1{font-size:20px}.reward-content{gap:2px}.reward-content #reward-caption{min-height:24px}.reward-content{min-height:650px}}
@media(prefers-reduced-motion:reduce){.secret-face,.character-D .rig-writing,.character-D .rig-head,.character-D .rig-body,.character-D:after,.forest-intro .rig-writing,.forest-intro .rig-head,.forest-intro .intro-stage>.rig,.intro-companion,.magic-mote,.typing span{animation:none!important}.face-focus,.face-realize{opacity:0}.face-joy{opacity:1}.magic-mote{opacity:.5}.forest-intro .intro-stage>.rig{transform:scale(1.3)}}
