*{box-sizing:border-box}body{margin:0;background:#f4f6eb;color:#254735;font-family:system-ui,sans-serif}header{max-width:1100px;margin:auto;padding:24px;display:flex;align-items:center;justify-content:space-between;gap:15px}header b{font-size:24px}nav{display:flex;align-items:center;gap:10px}button,select{font:inherit;border:0;border-radius:15px;padding:13px 20px;background:#e4ebd8;color:#294b36;font-weight:700;cursor:pointer}button:hover{filter:brightness(.95)}button:focus-visible,select:focus-visible{outline:4px solid #d8a23e;outline-offset:3px}button:disabled{opacity:.6;cursor:default}.primary{background:#2b6a4c;color:white;box-shadow:0 4px 0 #18432d}main{max-width:1050px;margin:30px auto;padding:0 24px}.hero{display:grid;grid-template-columns:1fr 1fr;gap:36px;align-items:center}h1{font-size:clamp(35px,5vw,60px);line-height:1.08;letter-spacing:-2px;margin:18px 0}p{line-height:1.7;color:#627969;font-size:18px}.eyebrow{text-transform:uppercase;letter-spacing:2px;font-size:12px;font-weight:800;color:#6b876a}.scene{height:350px;background:#dcebd9;border-radius:45%;display:grid;place-items:center;position:relative;overflow:hidden}.scene:before{content:'';position:absolute;background:#adc58f;bottom:30px;width:85%;height:90px;border-radius:50%;box-shadow:0 20px 0 #93ab79}.creature{font-size:145px;z-index:1;animation:float 3s ease-in-out infinite}.cards,.pets{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin:35px 0}.card,.panel{background:white;border:1px solid #e0e6d6;border-radius:25px;padding:25px}.card p{font-size:15px}.icon{font-size:40px}.game{max-width:730px;margin:auto}.panel{text-align:center}.top{display:flex;justify-content:space-between;align-items:center;gap:10px}.bar{height:9px;background:#dfe8d4;border-radius:20px;margin:20px 0;overflow:hidden}.bar div{height:100%;background:#81ae62}.equation{font-size:52px;font-weight:800;margin:20px}.answers{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:20px 0}.answers button{font-size:28px;min-height:72px;border:2px solid #e2e9d8;background:#f6f8ef}.answers .correct{background:#d4ecc6;border-color:#78aa60}.answers .wrong{background:#fff0d3;border-color:#d7b460}.feedback{min-height:55px;font-weight:700;line-height:1.5}.hint{background:#f0f4e8;border-radius:15px;padding:15px;margin:15px 0}.groups{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin:15px}
.bouquet {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 2px;
  width: max-content;
  max-width: min(100%, 188px);
  padding: 6px;
  border: 1px solid #abc59a;
  border-radius: 14px;
  background: white;
}
.flower {
  flex: none;
  font: 32px/1.1 "Segoe UI Emoji", "Apple Color Emoji", sans-serif;
}
.pet{text-align:center}.pet .icon{font-size:75px}.locked{filter:grayscale(1);opacity:.4}.muted{font-size:14px}footer{text-align:center;font-size:13px;color:#829279;margin:35px}select{max-width:100%;background:#eff3e7}.actions{display:flex;gap:12px;justify-content:center;flex-wrap:wrap}table{width:100%;border-collapse:collapse}td,th{text-align:left;padding:10px;border-bottom:1px solid #e3e8db}@keyframes float{50%{transform:translateY(-10px)}}@media(prefers-reduced-motion:reduce){*{animation:none!important}}@media(max-width:650px){header{flex-wrap:wrap;padding:18px}header b{font-size:21px}nav button{font-size:12px;padding:10px}.hero{grid-template-columns:1fr}.scene{height:240px}.creature{font-size:110px}.cards{grid-template-columns:1fr;margin:25px 0;gap:10px}.pets{grid-template-columns:1fr 1fr}.panel{padding:18px}.equation{font-size:42px}main{margin-top:15px;padding:0 18px}h1{letter-spacing:-1px}}

.portal-back{color:#2b6a4c;font-size:14px;font-weight:700;text-decoration:none}.portal-back:focus-visible{outline:3px solid #d8a23e;outline-offset:3px}nav{flex-wrap:wrap}[hidden]{display:none!important}

.island-lessons { margin:32px 0; }
.island-factors { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; }
.island-lessons form { margin:24px 0; padding:16px; border-radius:16px; background:#f4f6eb; }
.island-lessons fieldset { display:flex; flex-wrap:wrap; justify-content:center; gap:8px; min-width:0; padding:12px; margin:0 0 16px; border:1px solid #b9c9ae; border-radius:12px; }
.island-lessons label { padding:8px; background:white; border-radius:10px; cursor:pointer; }
.island-lessons input { accent-color:#2b6a4c; }

@media (max-width: 719px) { .island-factors { grid-template-columns:repeat(2,minmax(0,1fr)); } .island-factors button { padding-inline:8px; } }

.pet-portrait { display:inline-block; width:64px; aspect-ratio:1; vertical-align:middle;
  background-image:url("assets/stworki.webp"); background-size:300% 200%; background-repeat:no-repeat; }
.scene .pet-portrait { display:block; width:clamp(160px,24vw,236px); }

.pet .pet-portrait, .game.panel .pet-portrait { width:min(112px,100%); }

.host-chat { margin:8px auto 0; max-width:42ch; border-radius:20px; border:1px solid #cfdfbd; background:white; padding:14px; text-align:center; }
.host-chat p { margin:0 0 10px; min-height:3.2em; font-size:16px; line-height:1.5; color:#31563d; }
.host-chat button { margin:3px; padding:8px 12px; }
.scene .creature { transform-origin:50% 90%; animation:island-sway 3.6s ease-in-out infinite; }
.scene .host-motion-1, .scene .host-motion-4 { animation-name:island-hop; }
.scene .host-motion-3, .scene .host-motion-5 { animation-name:island-hover; }
.scene .host-motion-2 { animation-duration:2.8s; }
@keyframes island-sway { 0%,100% {transform:rotate(-3deg)} 50% {transform:rotate(3deg)} }
@keyframes island-hop { 0%,45%,75%,100% {transform:translateY(0)} 60% {transform:translateY(-13px) rotate(2deg)} }
@keyframes island-hover { 0%,100% {transform:translateY(2px) rotate(-2deg)} 50% {transform:translateY(-9px) rotate(2deg)} }
@media(prefers-reduced-motion:reduce) { .scene .creature { animation:none; } }

#pet-welcome { box-sizing:border-box; width:min(92vw,35rem); max-height:90dvh; overflow:auto;
  padding:clamp(16px,4vw,34px); text-align:center; border:2px solid #d7c784; border-radius:26px;
  color:#244d38; background:radial-gradient(ellipse at 50% 33%,#fff0af,#fffefa 68%); }
#pet-welcome::backdrop { background:rgb(19 43 34 / 65%); }
#pet-welcome h2 { font-size:clamp(1.8rem,5vw,2.6rem); margin:.25em 0; }
#pet-welcome p { margin:.5em 0 1em; }
#welcome-portrait .pet-portrait { width:min(58vw,32vh,245px); }
#pet-welcome[open] #welcome-portrait .pet-portrait { animation:pet-arrives 1.1s ease-out both; }
@keyframes pet-arrives {
  0% { transform:translateY(35px) scale(.55) rotate(-10deg); opacity:0; }
  50% { transform:translateY(-10px) scale(1.06) rotate(5deg); opacity:1; }
  75% { transform:translateY(2px) scale(.98) rotate(-2deg); }
  100% { transform:none; }
}
@media(prefers-reduced-motion:reduce){ #pet-welcome[open] #welcome-portrait .pet-portrait { animation:none; } }

.host-name { display:block; margin-bottom:.4em; font-size:1.125rem; line-height:1.4; overflow-wrap:anywhere; }
.pet-replay { display:grid; justify-items:center; align-content:center; gap:.65rem; width:100%; }
.pet-replay > strong { font-size:1.2rem; }
.pet-replay > span:last-child { color:#275b42; font-size:.95rem; }
.pet-replay:hover { border-color:#639675; }

.pet-portrait { position:relative; }
.pet-portrait::after {
  content:""; position:absolute; inset:0; pointer-events:none;
  background-image:url("assets/powieki.svg"); background-size:300% 200%;
  background-position:inherit; background-repeat:no-repeat;
  opacity:0; animation:pet-blink var(--blink-period,5s) steps(1,end) infinite;
}
@keyframes pet-blink { 0%,64%,68%,100% { opacity:0; } 65% { opacity:1; } }
.locked .pet-portrait::after { display:none; }
@media (prefers-reduced-motion:reduce) { .pet-portrait::after { animation:none; } }
