/* lab-game.css: Study Lab game template: stages, shared game parts and the Understand stage.
   Shared file: used by many pages. Pages load it in a fixed position between their own styles, so keep the rules in this order.
   After editing, run tools/refresh-asset-versions.sh so browsers fetch the new version. */
@keyframes heroShift{ to{ background-position:100% 0; } }

  /* ================= Study Lab: game template ================= */
  .gm-page{ --ac:var(--c-lab); --ac-rgb:var(--c-lab-rgb); }
  .gm-back{ display:flex; width:max-content; align-items:center; gap:8px; margin-bottom:22px; color:var(--text-muted); text-decoration:none; font-size:0.92rem; font-weight:500; }
  .gm-back:hover{ color:var(--ac); }
  .gm-head h1{ font-size:clamp(2.4rem,6vw,4.4rem); line-height:1.02; letter-spacing:-0.025em; }
  .gm-sub{ margin-top:12px; font-family:'Space Grotesk',sans-serif; font-size:clamp(1.15rem,2.4vw,1.5rem); color:var(--ac); font-weight:500; }
  .gm-mission{ margin-top:26px; display:flex; gap:18px; align-items:flex-start; max-width:900px; padding:22px 24px; border-radius:20px;
    border:1px solid rgba(var(--ac-rgb),.45); background:radial-gradient(120% 140% at 0% 0%, rgba(var(--ac-rgb),.16), transparent 60%), var(--bg-alt); }
  .gm-mission-ic{ flex-shrink:0; width:46px; height:46px; border-radius:14px; display:grid; place-items:center; color:var(--bg); background:var(--ac); }
  .gm-mission-ic svg{ width:26px; height:26px; }
  .gm-mission h2{ font-size:1.1rem; }
  .gm-mission p{ margin-top:6px; line-height:1.7; color:var(--text); }

  .gm-steps{ list-style:none; margin:30px 0 26px; padding:0; display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:26px; counter-reset:gms; }
  .gm-steps li{ position:relative; }
  /* small arrow between stages: shows the suggested order (every stage is open) */
  .gs-arrow{ position:absolute; z-index:1; left:-13px; top:50%; width:22px; height:22px; margin:-11px 0 0 -11px; border-radius:50%; display:grid; place-items:center;
    background:var(--bg); border:1px solid var(--border); color:var(--text-muted); pointer-events:none; transition:color .3s, border-color .3s; }
  .gs-arrow svg{ width:13px; height:13px; fill:none; stroke:currentColor; stroke-width:2.6; stroke-linecap:round; stroke-linejoin:round; }
  .gm-steps li:has(> button.is-done) + li > .gs-arrow{ color:var(--ac); border-color:rgba(var(--ac-rgb),.6); }
  .gm-steps button{ width:100%; display:grid; grid-template-columns:auto 1fr; grid-template-rows:auto auto; column-gap:12px; align-items:center; text-align:left;
    padding:12px 14px; border-radius:16px; border:1px solid var(--border); background:var(--bg-alt); color:var(--text-muted); cursor:pointer; font:inherit;
    transition:border-color .2s, background-color .2s, color .2s, opacity .2s; }
  .gm-steps .gs-ic{ grid-row:1 / span 2; position:relative; width:38px; height:38px; border-radius:12px; display:grid; place-items:center; background:var(--reel-bg); border:1px solid var(--border); color:var(--text-muted); }
  .gm-steps .gs-ic svg{ width:21px; height:21px; }
  .gm-steps .gs-ok{ position:absolute; right:-6px; bottom:-6px; width:19px; height:19px; border-radius:50%; display:none; place-items:center; background:var(--ok); color:var(--bg); border:2px solid var(--bg-alt); }
  .gm-steps .gs-ok svg{ width:11px; height:11px; stroke-width:3.2; }
  .gm-steps .gs-t{ font-family:'Space Grotesk',sans-serif; font-weight:600; font-size:1rem; color:var(--text); }
  .gm-steps .gs-s{ font-size:0.8rem; }
  .gm-steps button:disabled{ cursor:not-allowed; opacity:.5; }
  .gm-steps button:not(:disabled):hover{ border-color:rgba(var(--ac-rgb),.6); }
  .gm-steps button.is-done .gs-ok{ display:grid; }
  .gm-steps button.is-done .gs-ic{ color:var(--ac); }
  .gm-steps button[aria-current="step"]{ border-color:var(--ac); background:rgba(var(--ac-rgb),.12); color:var(--text); box-shadow:0 14px 30px -20px rgba(var(--ac-rgb),.9); }
  .gm-steps button[aria-current="step"] .gs-ic{ background:var(--ac); border-color:var(--ac); color:var(--bg); }
  .gm-steps button:focus-visible{ outline:2px solid var(--ac); outline-offset:2px; }
  /* tablets and phones: icon above the name, so the four stages and their arrows fit side by side */
  @media (max-width:900px){
    .gm-steps{ gap:10px; } .gs-arrow{ left:-5px; top:29px; width:18px; height:18px; margin:-9px 0 0 -9px; } .gs-arrow svg{ width:11px; height:11px; stroke-width:2.8; }
    .gm-steps button{ grid-template-columns:1fr; grid-template-rows:auto auto; justify-items:center; text-align:center; padding:10px 4px; row-gap:6px; }
    .gm-steps .gs-ic{ grid-row:auto; } .gm-steps .gs-s{ margin-top:-4px; }
  }
  @media (max-width:760px){ .gm-steps .gs-s{ display:none; } .gm-steps .gs-t{ font-size:0.8rem; } }
  @media (max-width:400px){
    .gm-steps{ gap:8px; } .gs-arrow{ left:-4px; width:16px; height:16px; margin:-8px 0 0 -8px; } .gs-arrow svg{ width:10px; height:10px; }
    .gm-steps button{ padding:10px 1px; } .gm-steps .gs-t{ font-size:0.7rem; letter-spacing:-0.01em; }
  }

  .gm-stage{ padding:26px; border-radius:24px; border:1px solid var(--border); background:color-mix(in srgb, var(--bg-alt) 92%, transparent); animation:gmIn .45s cubic-bezier(.2,.8,.2,1) both; }
  @keyframes gmIn{ from{ opacity:0; transform:translateY(10px); } to{ opacity:1; transform:none; } }
  .gm-stage-head{ display:flex; gap:14px; align-items:flex-start; margin-bottom:20px; }
  .gm-stage-ic{ flex-shrink:0; width:42px; height:42px; border-radius:13px; display:grid; place-items:center; color:var(--ac); background:rgba(var(--ac-rgb),.14); border:1px solid rgba(var(--ac-rgb),.35); }
  .gm-stage-ic svg{ width:23px; height:23px; }
  .gm-stage-head h2{ font-size:clamp(1.4rem,2.6vw,1.8rem); line-height:1.15; }
  .gm-task{ margin-top:4px; color:var(--text-muted); line-height:1.6; max-width:80ch; }
  .gm-foot{ margin-top:22px; padding-top:18px; border-top:1px solid var(--border); display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:14px; }
  .gm-status{ color:var(--text-muted); font-size:0.95rem; line-height:1.5; }
  .gm-status b{ color:var(--text); }
  .gm-next[disabled]{ opacity:.45; cursor:not-allowed; filter:grayscale(.4); }
  .gm-page .btn.primary{ background:var(--ac); color:var(--bg); }
  .gm-page .btn:not(.primary):hover{ border-color:var(--ac); color:var(--ac); }
  .gm-end{ margin-top:26px; display:flex; flex-wrap:wrap; gap:12px; }
  @media (max-width:560px){ .gm-stage{ padding:18px 14px; border-radius:20px; } .gm-foot .btn, .gm-end .btn{ flex:1 1 100%; } }

  .gm-split{ display:grid; grid-template-columns:minmax(0,1.7fr) minmax(280px,1fr); gap:18px; align-items:start; }
  @media (max-width:1100px){ .gm-split{ grid-template-columns:minmax(0,1fr); } }
  /* shared bits used inside games */
  .gm-card{ padding:18px 20px; border-radius:18px; border:1px solid var(--border); background:var(--bg); }
  .gm-card h3{ font-size:1.12rem; }
  .gm-card p{ margin-top:6px; line-height:1.65; color:var(--text); }
  .gm-pill{ display:inline-flex; align-items:center; gap:6px; padding:4px 11px; border-radius:100px; font-size:0.8rem; font-weight:600; background:rgba(var(--ac-rgb),.14); color:var(--ac); }
  .gm-hearts{ display:inline-flex; gap:4px; }
  .gm-hearts svg{ width:20px; height:20px; fill:var(--bad); transition:opacity .3s, transform .3s; }
  .gm-hearts svg.lost{ opacity:.18; transform:scale(.8); fill:var(--text-muted); }
  .gm-stars{ display:inline-flex; gap:4px; }
  .gm-stars svg{ width:26px; height:26px; fill:var(--border); }
  .gm-stars svg.on{ fill:#FFC857; filter:drop-shadow(0 0 6px rgba(255,200,87,.5)); }
  .gm-opts{ display:grid; gap:10px; margin-top:14px; }
  .gm-opt{ text-align:left; padding:13px 16px; border-radius:14px; border:1px solid var(--border); background:var(--bg-alt); color:var(--text); font:inherit; font-size:0.98rem; line-height:1.45; cursor:pointer; transition:border-color .2s, background-color .2s, transform .2s; }
  .gm-opt:hover:not(:disabled){ border-color:var(--ac); }
  .gm-opt:focus-visible{ outline:2px solid var(--ac); outline-offset:2px; }
  .gm-opt.right{ border-color:var(--ok); background:rgba(var(--ok-rgb),.14); }
  .gm-opt.wrong{ border-color:var(--bad); background:rgba(var(--bad-rgb),.12); animation:gmShake .4s; }
  .gm-opt:disabled{ cursor:default; }
  @keyframes gmShake{ 20%,60%{ transform:translateX(-5px); } 40%,80%{ transform:translateX(5px); } }
  .gm-feedback{ margin-top:12px; padding:12px 14px; border-radius:12px; line-height:1.6; font-size:0.95rem; }
  .gm-feedback:empty{ display:none; }
  .gm-feedback.ok{ background:rgba(var(--ok-rgb),.12); border:1px solid rgba(var(--ok-rgb),.4); }
  .gm-feedback.bad{ background:rgba(var(--bad-rgb),.1); border:1px solid rgba(var(--bad-rgb),.4); }
  .gm-info{ min-height:150px; }
  .gm-info .gm-info-empty{ color:var(--text-muted); line-height:1.6; }
  .gm-info .gm-info-k{ font-size:0.82rem; color:var(--ac); font-weight:600; }
  .gm-info h3{ margin-top:2px; font-size:1.3rem; }
  .gm-info p{ margin-top:8px; line-height:1.7; }
  .gm-info .gm-analogy{ margin-top:12px; padding:10px 12px; border-radius:12px; background:rgba(var(--ac-rgb),.1); font-size:0.94rem; line-height:1.6; }
  .gm-seen{ display:flex; flex-wrap:wrap; gap:6px; margin-top:14px; }
  .gm-seen span{ padding:4px 10px; border-radius:100px; font-size:0.78rem; border:1px dashed var(--border); color:var(--text-muted); }
  .gm-seen span.on{ border-style:solid; border-color:rgba(var(--ok-rgb),.5); color:var(--ok); background:rgba(var(--ok-rgb),.08); }
  .gm-hot{ position:absolute; width:30px; height:30px; margin:-15px 0 0 -15px; border-radius:50%; border:2px solid var(--ac); background:rgba(var(--ac-rgb),.3); color:var(--bg);
    cursor:pointer; display:grid; place-items:center; padding:0; font:inherit; font-weight:700; font-size:0.8rem; z-index:3; transition:transform .2s, background-color .2s; }
  .gm-hot::after{ content:''; pointer-events:none; position:absolute; inset:-7px; border-radius:50%; border:2px solid var(--ac); opacity:0; animation:gmPing 1.8s ease-out infinite; }
  .gm-hot:hover, .gm-hot:focus-visible{ transform:scale(1.15); outline:none; }
  .gm-hot.on{ background:var(--ok); border-color:var(--ok); }
  .gm-hot.on::after{ display:none; }
  .gm-hot.sel{ background:var(--ac); box-shadow:0 0 0 4px rgba(var(--ac-rgb),.3); }
  .gm-hot svg{ width:15px; height:15px; stroke-width:3; }
  @keyframes gmPing{ 0%{ opacity:.8; transform:scale(.7); } 100%{ opacity:0; transform:scale(1.5); } }

  /* the Understand stage */
  .gm-done{ margin-bottom:20px; display:flex; flex-wrap:wrap; align-items:center; gap:14px 20px; padding:18px 22px; border-radius:18px;
    background:linear-gradient(110deg, rgba(var(--ok-rgb),.18), rgba(var(--ac-rgb),.12)); border:1px solid rgba(var(--ok-rgb),.45); }
  .gm-done h3{ font-size:1.25rem; }
  .gm-done p{ color:var(--text-muted); margin-top:2px; }
  .gm-done.gm-left{ background:linear-gradient(110deg, rgba(var(--ac-rgb),.14), rgba(var(--ac-rgb),.05)); border-color:rgba(var(--ac-rgb),.45); }
  .gm-done .gm-left-go{ display:flex; flex-wrap:wrap; gap:10px; }
  .gm-done .gm-left-go .btn{ padding:9px 16px; font-size:0.9rem; }
  .gm-theory{ display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:16px; }
  .gm-theory .wide{ grid-column:1 / -1; }
  @media (max-width:820px){ .gm-theory{ grid-template-columns:minmax(0,1fr); } }
  .gm-theory .gm-card ul{ margin:10px 0 0; padding-left:20px; line-height:1.7; }
  .gm-theory .gm-card li + li{ margin-top:6px; }
  .gm-words{ display:grid; grid-template-columns:repeat(auto-fill, minmax(220px,1fr)); gap:10px; margin-top:12px; }
  .gm-words div{ padding:12px 14px; border-radius:14px; background:var(--bg-alt); border:1px solid var(--border); }
  .gm-words dt{ font-family:'Space Grotesk',sans-serif; font-weight:600; color:var(--ac); }
  .gm-words dd{ margin:4px 0 0; font-size:0.93rem; line-height:1.55; color:var(--text); }
  .gm-tip{ border-color:rgba(var(--c-slots-rgb),.5); background:radial-gradient(120% 140% at 100% 0%, rgba(var(--c-slots-rgb),.14), transparent 60%), var(--bg); }
  .gm-tip h3{ color:var(--c-slots); }
  .gm-confetti{ position:fixed; width:9px; height:9px; border-radius:2px; pointer-events:none; z-index:200; animation:gmPop 1.1s ease-out forwards; }
  @keyframes gmPop{ from{ transform:translate(0,0) rotate(0); opacity:1; } to{ transform:translate(var(--dx), var(--dy)) rotate(300deg); opacity:0; } }
  @media (prefers-reduced-motion:reduce){ .gm-stage{ animation:none; } .gm-hot::after{ animation:none; } }
