/* Glossary Game: styles for the bubbles, the flip cards and the meaning sheet.
   Scoped under .gl so it sits inside the CosmoVentures shell (home.css, cosmoventures.css, tool.css).
   Colours come from the site tokens (--card, --ink, --dim, --faint, --glow, --glow-soft, --line); each topic adds its own hue (--h). */
.gl{max-width:860px;display:flex;flex-direction:column;gap:18px}
.gl :focus-visible{outline:2px solid var(--glow);outline-offset:3px;border-radius:4px}
.gl-pane{display:flex;flex-direction:column;gap:18px;min-width:0}
.gl [hidden]{display:none!important}
.gl button,.gl select,.gl input{font:inherit}

/* segmented choices */
.gl-seg{display:flex;flex-wrap:wrap;gap:8px}
.gl-seg button{flex:1 1 auto;min-height:44px;padding:9px 16px;font-family:var(--mono);font-size:13.5px;letter-spacing:.02em;color:var(--dim);
  background:var(--card);border:1px solid var(--line);border-radius:6px;cursor:pointer}
.gl-seg button:hover{border-color:var(--glow);color:var(--ink)}
.gl-seg button[aria-pressed="true"]{color:var(--glow);border-color:var(--glow);background:var(--glow-soft)}
#glModes button{font-size:15px;min-height:48px}

/* random words */
.gl-today{background:var(--card);border:1px solid var(--line);border-radius:6px;box-shadow:0 1px 2px rgba(19,21,43,.04),0 8px 24px rgba(19,21,43,.05);padding:20px;display:flex;flex-direction:column;gap:14px}
.gl-head{display:flex;justify-content:space-between;align-items:center;gap:12px}
.gl-head h2{font-size:22px;line-height:1.2}
.gl-small{min-height:40px;padding:6px 14px;font-family:var(--mono);font-size:13px;letter-spacing:.02em;color:var(--glow);background:transparent;border:1px solid var(--line);border-radius:6px;cursor:pointer}
.gl-small:hover{border-color:var(--glow)}

/* search and selects */
.gl-input{width:100%;min-height:46px;padding:10px 14px;font-size:16px;color:var(--ink);background:#fff;border:1px solid rgba(19,21,43,.2);border-radius:4px}
.gl-input:focus{outline:2px solid var(--glow);outline-offset:1px;border-color:var(--glow)}
.gl-setup{display:grid;grid-template-columns:1.4fr 1fr;gap:12px}
.gl-setup label{display:grid;gap:6px;min-width:0}
.gl-setup label span{font-family:var(--mono);font-size:13px;letter-spacing:.02em;color:var(--faint)}

/* bubbles */
.gl-group{display:flex;flex-direction:column;gap:10px}
.gl-group+.gl-group{margin-top:6px}
.gl-group h3{font-family:var(--mono);font-weight:400;font-size:13.5px;letter-spacing:.02em;color:var(--faint)}
.gl-bubbles{display:flex;flex-wrap:wrap;gap:8px}
.gl-bubbles.center{justify-content:center}
.gl-bubble{--h:230;max-width:100%;min-height:42px;padding:9px 15px;font-size:15px;font-weight:500;line-height:1.25;text-align:left;overflow-wrap:anywhere;cursor:pointer;
  color:hsl(var(--h) 45% 24%);background:hsl(var(--h) 70% 94%);border:1px solid hsl(var(--h) 40% 80%);border-radius:999px;transition:transform .12s,border-color .2s}
.gl-bubble:hover{border-color:hsl(var(--h) 45% 55%)}
.gl-bubble:active{transform:scale(.96)}
.gl-bubble.big{min-height:48px;padding:11px 18px;font-size:16.5px}
.gl-empty{margin:0;padding:20px 0;color:var(--dim)}

/* buttons */
.gl-btn{min-height:50px;padding:12px 14px;font-size:16px;font-weight:500;color:var(--ink);background:var(--card);border:1px solid rgba(19,21,43,.3);border-radius:4px;cursor:pointer}
.gl-btn:hover{border-color:var(--ink);background:rgba(19,21,43,.04)}
.gl-btn.primary{color:#fff;background:var(--ink);border-color:var(--ink)}
.gl-btn.primary:hover{background:var(--glow);border-color:var(--glow)}
.gl-answer{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.gl-answer:has(> :only-child){grid-template-columns:1fr}

/* flip card */
.gl-stats{display:flex;justify-content:space-between;gap:12px;font-family:var(--mono);font-size:13px;letter-spacing:.02em;color:var(--faint)}
.gl-flip{perspective:1400px;cursor:pointer;-webkit-user-select:none;user-select:none;width:100%}
.gl-flip-in{display:grid;grid-template-columns:minmax(0,1fr);transform-style:preserve-3d;transition:transform .55s cubic-bezier(.3,.7,.2,1)}
.gl-flip.flipped .gl-flip-in{transform:rotateY(180deg)}
.gl-face{grid-area:1/1;min-width:0;min-height:320px;padding:30px 24px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;text-align:center;
  backface-visibility:hidden;-webkit-backface-visibility:hidden;background:var(--card);border:1px solid var(--line);border-radius:6px;box-shadow:0 1px 2px rgba(19,21,43,.04),0 8px 24px rgba(19,21,43,.07)}
.gl-face.back{transform:rotateY(180deg);background:#f7f8fc;border-color:rgba(51,70,176,.3)}
.gl-label{font-family:var(--mono);font-size:13px;letter-spacing:.02em;color:var(--glow)}
.gl-big{font-family:var(--display);font-weight:900;font-size:clamp(28px,6.4vw,40px);line-height:1.15;overflow-wrap:break-word;hyphens:auto;-webkit-hyphens:auto;text-wrap:balance}
.gl-big.long{font-size:clamp(22px,5.2vw,31px)}
.gl-text{margin:0;max-width:46ch;font-size:18px;line-height:1.6;overflow-wrap:break-word;hyphens:auto;-webkit-hyphens:auto}
.gl-hint{font-size:14px;color:var(--faint)}
.gl-face a,.gl-sheet a{color:var(--glow);font-size:15px}
.gl-done{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;min-height:280px;padding:30px 22px;text-align:center;
  background:var(--card);border:1px solid var(--line);border-radius:6px;box-shadow:0 1px 2px rgba(19,21,43,.04),0 8px 24px rgba(19,21,43,.07)}
.gl-done p{margin:0}
.gl-done .gl-note{font-family:var(--mono);font-size:13px;letter-spacing:.02em;color:var(--faint);margin-top:4px}
.gl-done .gl-big{font-size:clamp(26px,5.6vw,34px)}
.gl-done .gl-answer{width:100%;max-width:440px;margin-top:6px}

/* meaning sheet: centred on a large screen, a bottom sheet on a phone */
.gl-sheet{width:calc(100% - 32px);max-width:560px;max-height:calc(100vh - 48px);padding:0;overflow:auto;color:var(--ink);background:var(--card);border:1px solid var(--line);border-radius:8px;box-shadow:0 24px 60px rgba(19,21,43,.3)}
.gl-sheet::backdrop{background:rgba(19,21,43,.45)}
.gl-sheet[open]{animation:gl-rise .22s ease}
@keyframes gl-rise{from{opacity:0;transform:translateY(18px)}}
.gl-sheet-in{display:flex;flex-direction:column;gap:18px;padding:26px 24px calc(22px + env(safe-area-inset-bottom))}
.gl-sheet-body{display:flex;flex-direction:column;gap:10px}
.gl-sheet-body h2{font-size:clamp(26px,5vw,32px);line-height:1.15}
.gl-sheet-body p{margin:0;font-size:17.5px;line-height:1.6}
.gl-sheet-body a{align-self:flex-start}
.gl-tag{--h:230;align-self:flex-start;padding:3px 11px;font-family:var(--mono);font-size:12.5px;letter-spacing:.02em;color:hsl(var(--h) 45% 24%);background:hsl(var(--h) 70% 94%);border:1px solid hsl(var(--h) 40% 80%);border-radius:999px}
.gl-sheet-actions{display:grid;grid-template-columns:1fr 1fr;gap:12px}

@media (max-width:640px){
  .gl{gap:16px}
  .gl-today{padding:16px}
  .gl-seg button{padding:9px 10px;font-size:13px}
  .gl-face{min-height:300px;padding:26px 18px}
  .gl-sheet{width:100%;max-width:none;max-height:86vh;margin:auto 0 0;border-width:1px 0 0;border-radius:16px 16px 0 0}
  .gl-sheet[open]{animation-name:gl-rise-up}
  @keyframes gl-rise-up{from{transform:translateY(40px);opacity:.4}}
}
@media (max-width:480px){.gl-setup{grid-template-columns:1fr}}
@media (prefers-reduced-motion:reduce){.gl-flip-in,.gl-bubble{transition:none}.gl-sheet[open]{animation:none}}
html[data-ds-calm] .gl-flip-in,html[data-ds-calm] .gl-bubble{transition:none}
html[data-ds-calm] .gl-sheet[open]{animation:none}
