/* ==========================================================================
   ScienceHutch: Graph Lab (graph-lab.html only).
   Colors, buttons and type come from main.css. Graphs sit on light
   "graph paper" cards so they read clearly, print well and download
   looking the same as on screen.
   ========================================================================== */

.gl-wrap { width: min(100% - 2rem, 72rem); margin-inline: auto; }
.gl-page [hidden] { display: none !important; }   /* "hidden" always wins over a layout style */
.gl-page h2, .gl-page h1 { font-family: var(--font-display); font-weight: 400; line-height: 1.1; }

/* ======= INTRO ======= */
.gl-hero {
  border-bottom: 1px solid var(--border);
  background: radial-gradient(ellipse at 85% 30%, #3a1c12, var(--bg) 65%);
}
.gl-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3rem);
  padding-block: clamp(2.5rem, 7vw, 5rem);
}
.gl-hero h1 { margin: 0; font-size: clamp(2.6rem, 8vw, 5.2rem); }
.gl-hero h1 span { color: var(--orange); }
.gl-lead { max-width: 38em; margin: 18px 0 10px; color: var(--ink); font-size: clamp(1.05rem, 2.2vw, 1.25rem); }
.gl-promise { margin: 0 0 26px; color: var(--muted); }
.gl-hero-art { width: 100%; max-width: 360px; justify-self: center; transform: rotate(2deg); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45); border-radius: 14px; }
.gl-steps { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.gl-steps a {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 8px 18px 8px 8px;
  border: 1px solid #9A6A58; border-radius: 999px;
  color: var(--ink); font-weight: 700; text-decoration: none;
}
.gl-steps a:hover { border-color: var(--orange); }
.gl-steps span {
  display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: 50%; background: var(--orange); color: var(--on-accent);
}

/* ======= SECTIONS ======= */
.gl-section { padding-block: clamp(2.5rem, 6vw, 4.5rem); scroll-margin-top: 8px; }
.gl-section-alt { background: #110D0C; border-block: 1px solid var(--border); }
.gl-step-label { margin: 0 0 6px; color: var(--orange); font-size: 0.85rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.gl-section h2 { margin: 0 0 12px; font-size: clamp(1.8rem, 4.5vw, 2.8rem); }
.gl-section h3 { margin: 40px 0 14px; font-size: 1.3rem; }
.gl-intro { max-width: 46em; margin: 0 0 28px; color: var(--muted); font-size: 1.1rem; }

/* ======= GRAPH CARDS (shared) ======= */
.gl-figure { margin: 0; }
.gl-canvas {
  overflow: hidden;
  border-radius: 14px;
  background: #FFFDF9;
  box-shadow: 0 0 0 1px var(--border), 0 12px 30px rgba(0, 0, 0, 0.35);
}
.gl-canvas svg { display: block; width: 100%; height: auto; }
.gl-figure figcaption { margin-top: 12px; color: var(--muted); font-size: 0.98rem; }
.gl-summary-label { color: var(--ink); font-weight: 700; }

/* ======= 1. LEARN: parts of a graph ======= */
.gl-anatomy-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(1.25rem, 3vw, 2.5rem); align-items: center; }
.gl-anatomy .part { transition: opacity 0.2s; }
.gl-anatomy[data-show] .part { opacity: 0.18; }
.gl-anatomy[data-show="title"] .part-title,
.gl-anatomy[data-show="yaxis"] .part-yaxis,
.gl-anatomy[data-show="xaxis"] .part-xaxis,
.gl-anatomy[data-show="scale"] .part-scale,
.gl-anatomy[data-show="data"] .part-data,
.gl-anatomy[data-show="source"] .part-source { opacity: 1; }
.gl-parts-label { margin: 0 0 10px; font-weight: 700; }
.gl-part-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.gl-part-btn, .gl-small-btn {
  min-height: 44px; padding: 8px 16px;
  border: 1px solid #9A6A58; border-radius: 999px;
  background: transparent; color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer;
}
.gl-part-btn:hover, .gl-small-btn:hover { border-color: var(--orange); }
.gl-part-btn[aria-pressed="true"] { border-color: var(--orange); background: var(--orange); color: var(--on-accent); }
.gl-part-text {
  min-height: 5.5em; margin: 16px 0 0; padding: 16px;
  border-left: 4px solid var(--orange); border-radius: 10px;
  background: var(--surface); font-size: 1.05rem;
}

.gl-read-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.gl-read-steps li {
  position: relative; padding: 46px 16px 16px;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  counter-increment: step;
}
.gl-read-steps li::before {
  content: counter(step);
  position: absolute; top: 12px; left: 16px;
  display: grid; place-items: center; width: 28px; height: 28px;
  border-radius: 50%; background: var(--red); color: #fff; font-weight: 700;
}
.gl-read-steps strong { display: block; color: var(--orange); }

.gl-kinds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.gl-kind { padding: 18px; border: 1px solid var(--border); border-top: 3px solid var(--orange); border-radius: 14px; background: var(--surface); }
.gl-kind svg { width: 72px; height: 54px; }
.gl-kind h4 { margin: 8px 0 6px; font-size: 1.1rem; }
.gl-kind p { margin: 0; color: var(--muted); }
.gl-kind p strong { color: var(--ink); }

/* ======= 2. PRACTICE ======= */
.gl-ds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 24px; }
.gl-ds-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 64px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 700; text-align: left; cursor: pointer;
}
.gl-ds-btn small { color: var(--muted); font-weight: 500; }
.gl-ds-btn:hover { border-color: #9A6A58; }
.gl-ds-btn[aria-pressed="true"] { border-color: var(--orange); box-shadow: inset 0 0 0 1px var(--orange); background: var(--surface-2); }
.gl-ds-emoji { font-size: 1.4rem; line-height: 1; margin-bottom: 4px; }

.gl-practice-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); gap: clamp(1.25rem, 3vw, 2.5rem); align-items: start; }
.gl-panel { padding: clamp(16px, 2.5vw, 24px); border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.gl-ds-head { margin: 0 0 6px; }
.gl-tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; }
.gl-tag-real { background: #12372A; color: #8CE99A; }
.gl-tag-sample { background: #3A2622; color: #FFC9A3; }
.gl-ds-title { margin: 0 0 14px !important; font-size: 1.2rem !important; }
.gl-note { margin: 10px 0 0; color: var(--muted); font-size: 0.92rem; }

.gl-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.gl-table caption { padding-bottom: 8px; text-align: left; font-weight: 700; }
.gl-table th, .gl-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.gl-table thead th { color: var(--muted); font-size: 0.85rem; letter-spacing: 0.04em; text-transform: uppercase; }
.gl-table td { text-align: right; }

.gl-choose { margin: 22px 0 0; padding: 0; border: 0; }
.gl-choose legend { margin-bottom: 10px; font-weight: 700; }
.gl-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.gl-seg label { position: relative; }
.gl-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.gl-seg span {
  display: grid; place-items: center; min-height: 46px; padding: 6px;
  border: 1px solid #9A6A58; border-radius: 10px;
  font-weight: 700; cursor: pointer;
}
.gl-seg label:hover span { border-color: var(--orange); }
.gl-seg input:checked + span { border-color: var(--orange); background: var(--orange); color: var(--on-accent); }
.gl-seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 3px; }

.gl-feedback { margin: 16px 0 0; padding: 14px 16px; border-radius: 10px; border-left: 4px solid var(--muted); background: var(--surface-2); }
.gl-fit-best { border-left-color: #51CF66; }
.gl-fit-best strong { color: #8CE99A; }
.gl-fit-ok { border-left-color: var(--orange); }
.gl-fit-ok strong { color: var(--orange); }
.gl-fit-poor, .gl-fit-no { border-left-color: var(--red); }
.gl-fit-poor strong, .gl-fit-no strong { color: #FF8787; }

.gl-empty {
  display: grid; place-items: center; min-height: 260px; margin: 0; padding: 24px;
  border: 2px dashed var(--border); border-radius: 16px;
  color: var(--muted); text-align: center;
}
.gl-check { margin: 12px 0 0; }
.gl-check label { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.gl-check input { width: 20px; height: 20px; accent-color: var(--orange); }

.gl-questions h3 { margin-top: 28px; }
.gl-q { margin: 0 0 16px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.gl-q legend { padding: 0 6px; font-weight: 700; }
.gl-q label { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 4px 0; padding: 6px 10px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; }
.gl-q label:hover { border-color: #9A6A58; }
.gl-q input { width: 20px; height: 20px; flex: none; accent-color: var(--orange); }
.gl-q-feedback { margin: 10px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border-left: 4px solid var(--muted); }
.gl-q-feedback.is-right { border-left-color: #51CF66; }
.gl-q-feedback.is-right strong { color: #8CE99A; }
.gl-q-feedback.is-wrong { border-left-color: var(--red); }
.gl-q-feedback.is-wrong strong { color: #FF8787; }

/* ======= 3. MAKE YOUR OWN ======= */
.gl-make-grid { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.4fr); gap: clamp(1.25rem, 3vw, 2.5rem); align-items: start; }
.gl-make-preview { position: sticky; top: 16px; }
.gl-controls .gl-choose { margin-top: 0; }
.gl-fields { margin: 22px 0 0; padding: 18px 0 0; border: 0; border-top: 1px solid var(--border); }
.gl-fields legend, .gl-controls .gl-choose legend { padding: 0; font-weight: 700; font-size: 1.05rem; }
.gl-fields label:not(.gl-check label) { display: block; margin: 12px 0 6px; color: var(--muted); font-size: 0.95rem; }
.gl-fields input[type="text"], .gl-fields select, .gl-paste textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid #6E4E44; border-radius: 10px;
  background: var(--bg); color: var(--ink); font: inherit;
}
.gl-fields input[type="text"]:focus-visible, .gl-fields select:focus-visible, .gl-paste textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--orange); }
.gl-tip { margin: 10px 0 0; color: var(--muted); font-size: 0.92rem; }

.gl-edit-scroll { max-height: 420px; margin-top: 12px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.gl-edit { width: 100%; border-collapse: collapse; }
.gl-edit th, .gl-edit td { padding: 4px; border-bottom: 1px solid var(--border); vertical-align: bottom; }
.gl-edit thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; }
.gl-edit thead th .gl-col-hint { display: block; padding: 2px 4px; color: var(--muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.gl-edit input { width: 100%; min-width: 4.5rem; min-height: 40px; padding: 6px 8px; border: 1px solid #4A332D; border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; }
.gl-edit input.gl-head { font-weight: 700; }
.gl-edit input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--orange); }
.gl-edit thead th { white-space: nowrap; }
.gl-edit thead th:has(.gl-x) input { width: calc(100% - 40px); }
.gl-rownum { width: 2rem; color: var(--muted); font-size: 0.85rem; text-align: center; vertical-align: middle !important; }
.gl-x {
  width: 36px; height: 36px; padding: 0;
  border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--muted);
  font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.gl-x:hover { border-color: var(--red); color: var(--ink); }
.gl-edit-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.gl-paste { margin-top: 14px; }
.gl-paste summary { min-height: 44px; display: flex; align-items: center; color: var(--orange); font-weight: 700; cursor: pointer; }
.gl-paste textarea { margin: 6px 0 10px; resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.9rem; }
.gl-fields select { appearance: auto; }

.gl-messages { margin-top: 12px; padding: 12px 16px; border-left: 4px solid var(--orange); border-radius: 10px; background: var(--surface); }
.gl-messages ul { margin: 0; padding-left: 18px; }
.gl-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.gl-numbers { margin-top: 16px; }
.gl-numbers summary { min-height: 44px; display: flex; align-items: center; color: var(--orange); font-weight: 700; cursor: pointer; }
.gl-numbers .gl-table { margin-top: 8px; }
.gl-link-btn { padding: 0; border: 0; background: none; color: var(--orange); font: inherit; text-decoration: underline; cursor: pointer; }

.gl-more { padding-top: 0; }
.gl-more h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); }

/* ======= SMALLER SCREENS ======= */
@media (max-width: 1023px) {
  .gl-read-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gl-read-steps li:last-child { grid-column: 1 / -1; }
  .gl-kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gl-ds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 899px) {
  .gl-hero-inner, .gl-anatomy-grid, .gl-practice-grid, .gl-make-grid { grid-template-columns: 1fr; }
  .gl-hero-art { max-width: 280px; }
  .gl-make-preview { position: static; order: -1; }   /* phones: see the graph first */
  .gl-empty { min-height: 160px; }
}
@media (max-width: 479px) {
  .gl-kinds, .gl-read-steps { grid-template-columns: 1fr; }
  .gl-steps { flex-direction: column; }
  .gl-steps a { width: 100%; }
  .gl-actions .btn { width: 100%; }
}

/* ======= REDUCED MOTION ======= */
@media (prefers-reduced-motion: reduce) {
  .gl-anatomy .part { transition: none; }
}

/* ======= PRINTING (the Print button prints just your graph) ======= */
@media print {
  body.gl-printing * { visibility: hidden; }
  body.gl-printing .gl-print-target, body.gl-printing .gl-print-target * { visibility: visible; }
  body.gl-printing .gl-print-target { position: absolute; inset: 0 0 auto 0; }
  body.gl-printing .gl-print-target figcaption { color: #000; }
  .gl-canvas { box-shadow: none; border: 1px solid #ccc; }
}

/* ==========================================================================
   CELEBRATION LAYER (added 2026-11): the same playful look as Spectrum Quest
   and Making Waves. Animated intro graph, sticky progress bar, badges,
   pop-ups, trophy room and the Graph Master certificate (js/graph-lab-quest.js).
   Everything that moves stops for people who ask for reduced motion (bottom).
   ========================================================================== */

/* ======= INTRO: twinkling sky, shimmering title, a graph that draws itself ======= */
.gl-hero { position: relative; overflow: hidden; }
.gl-hero-inner { position: relative; }
.gl-sky, .gl-sky::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.2px 1.2px at 14% 22%, #fff, transparent),
    radial-gradient(1px 1px at 32% 60%, #ffe9c7, transparent),
    radial-gradient(1.3px 1.3px at 52% 14%, #fff, transparent),
    radial-gradient(1px 1px at 72% 40%, #ffd9c2, transparent),
    radial-gradient(1.2px 1.2px at 90% 76%, #fff, transparent);
  background-size: 360px 360px;
  opacity: 0.55;
}
.gl-sky::after { content: ""; background-size: 260px 260px; background-position: 80px 30px; animation: gl-twinkle 5s ease-in-out infinite alternate; }
@keyframes gl-twinkle { from { opacity: 0.1; } to { opacity: 0.8; } }
.gl-hero h1 span {
  background: linear-gradient(90deg, #FFB86B, #FF8A2B 35%, #E2412F 60%, #FFB86B);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gl-shimmer 7s ease-in-out infinite alternate;
}
@keyframes gl-shimmer { from { background-position: 0% 0; } to { background-position: 100% 0; } }
.gl-hero-art { animation: gl-float 6s ease-in-out infinite alternate; }
@keyframes gl-float { from { transform: rotate(2deg) translateY(-4px); } to { transform: rotate(1deg) translateY(4px); } }
.gl-hbar { transform-box: fill-box; transform-origin: 50% 100%; animation: gl-grow 0.7s cubic-bezier(.2, 1.3, .4, 1) var(--d, 0s) both; }
@keyframes gl-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.gl-hline { stroke-dasharray: 1; stroke-dashoffset: 1; animation: gl-draw 1s ease-out 1s forwards; }
@keyframes gl-draw { to { stroke-dashoffset: 0; } }
.gl-hpt { transform-box: fill-box; transform-origin: center; animation: gl-pt 0.45s cubic-bezier(.2, 1.6, .4, 1) var(--d, 0s) both; }
@keyframes gl-pt { from { transform: scale(0); } to { transform: scale(1); } }
.gl-quest-tip { max-width: 38em; margin: 18px 0 0; padding: 10px 14px; border-left: 4px solid var(--orange); border-radius: 0 12px 12px 0; background: rgba(255, 138, 43, 0.08); }

/* ======= STICKY PROGRESS BAR ======= */
.gl-questbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(10, 9, 8, 0.84);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.gl-questbar-inner { display: flex; align-items: center; gap: 8px 12px; min-height: 52px; padding-block: 6px; }
.gl-rings { display: flex; gap: 6px; margin-right: auto; }
.gl-ring {
  --fill: 0%;
  display: inline-flex;
  padding: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #FF8A2B var(--fill), rgba(255, 255, 255, 0.1) var(--fill));
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-decoration: none;
  transition: background 0.4s;
}
.gl-ring > span { padding: 4px 10px; border-radius: 999px; background: #120E0D; }
.gl-ring.is-done { background: linear-gradient(90deg, #FFB86B, #FF8A2B, #E2412F); box-shadow: 0 0 12px rgba(255, 138, 43, 0.5); color: var(--ink); }
.gl-ring.is-done > span::before { content: "✓ "; color: var(--orange); }
.gl-streak { color: #FFB86B; font-weight: 800; white-space: nowrap; }
.gl-bar-pill {
  display: inline-flex; align-items: center;
  min-height: 40px; padding: 6px 12px;
  border: 1px solid #9A6A58; border-radius: 999px;
  background: transparent;
  color: var(--ink); font: inherit; font-weight: 700; text-decoration: none;
  white-space: nowrap;
}
a.gl-bar-pill:hover, .gl-sound:hover { border-color: var(--orange); }
.gl-sound { gap: 6px; cursor: pointer; font-weight: 600; }
.gl-sound[aria-pressed="true"] { border-color: var(--orange); background: rgba(255, 138, 43, 0.12); }
#learn, #practice, #make, #trophies { scroll-margin-top: 60px; }
@media (max-width: 599px) {
  .gl-sound-label { display: none; }
  .gl-questbar-inner { gap: 6px; }
  .gl-bar-pill { padding: 6px 9px; }
  .gl-streak { order: 5; flex-basis: 100%; text-align: right; font-size: 0.85rem; }
  .gl-streak:empty { display: none; }
}
@media (max-width: 379px) {
  .gl-rings { gap: 3px; }
  .gl-ring { font-size: 0.72rem; }
  .gl-ring > span { padding: 4px 6px; }
  .gl-bar-pill { padding: 5px 8px; font-size: 0.85rem; min-height: 38px; }
}

/* ======= LITTLE REACTIONS ======= */
.gl-pop { animation: gl-pop 0.45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes gl-pop { 0% { transform: scale(0.92); } 60% { transform: scale(1.05); } 100% { transform: scale(1); } }
.gl-shake { animation: gl-shake 0.35s; }
@keyframes gl-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.gl-feedback:not([hidden]), .gl-q-feedback:not([hidden]) { animation: gl-in 0.35s ease-out; }
@keyframes gl-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.gl-fit-best { box-shadow: 0 0 24px rgba(124, 255, 158, 0.12); }
.gl-ds-btn { transition: transform 0.15s, border-color 0.2s; }
.gl-ds-btn:hover { transform: translateY(-2px); }
.gl-kind { transition: transform 0.2s, border-color 0.2s; }
.gl-kind:hover { transform: translateY(-3px); }
.gl-reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.gl-reveal.in { opacity: 1; transform: none; }

/* ======= TROPHY ROOM ======= */
.gl-badges { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.gl-badge a {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  height: 100%;
  padding: 16px 8px;
  border: 1px dashed #6B5A54;
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}
.gl-badge a:hover { border-color: var(--orange); transform: translateY(-2px); }
.gl-badge-icon { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: rgba(255, 255, 255, 0.05); font-size: 1.7rem; font-weight: 800; }
.gl-badge-name { color: var(--ink); font-weight: 800; font-size: 0.95rem; }
.gl-badge-desc { font-size: 0.8rem; }
.gl-badge.is-earned a { border: 1px solid rgba(255, 212, 90, 0.55); background: radial-gradient(ellipse at 50% 0%, rgba(255, 212, 90, 0.14), transparent 70%); }
.gl-badge.is-earned .gl-badge-icon { background: radial-gradient(circle, #FFE9A8, #FF9F43); box-shadow: 0 0 22px rgba(255, 180, 70, 0.55); }
.gl-cert-wrap { margin-top: 24px; }
.gl-cert-locked { padding: 18px 20px; border-radius: 16px; background: rgba(255, 255, 255, 0.04); text-align: center; }
.gl-cert-locked p { margin: 0; }
.gl-cert {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3rem);
  border-radius: 22px;
  background: #FFFBF3;
  color: #2A1A12;
  text-align: center;
  box-shadow: 0 0 0 6px #120A06, 0 0 0 10px #D9480F, 0 30px 60px rgba(0, 0, 0, 0.5);
}
.gl-cert p { margin: 0 0 10px; }
.gl-cert-eyebrow { color: #8A3A10; font-size: 0.8rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; }
.gl-cert-title { font-family: var(--font-display); font-size: clamp(2rem, 6vw, 3.2rem); line-height: 1.05; background: linear-gradient(90deg, #D9480F, #A61E4D, #1F2A44); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gl-cert-name { display: inline-block; padding: 0 18px 4px; border-bottom: 2px solid #D9C7B5; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.6rem, 5vw, 2.4rem); font-style: italic; }
.gl-cert-text, .gl-cert-date { color: #5A4436; }
.gl-cert-date { font-size: 0.9rem; }
.gl-cert-art { display: block; width: 200px; height: auto; margin: 16px auto 10px; }
.gl-cert-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 20px; }
.gl-cert-actions label { font-weight: 700; }
.gl-cert-actions input { min-height: 48px; padding: 8px 14px; border: 1px solid #9A6A58; border-radius: 12px; background: var(--surface-2); color: var(--ink); font: inherit; }
.gl-quest-reset { margin: 24px 0 0; color: var(--muted); font-size: 0.92rem; text-align: center; }
.gl-quest-reset .gl-link-btn { min-height: 40px; padding: 4px 2px; font-weight: 700; }
@media (max-width: 899px) { .gl-badges { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 559px) { .gl-badges { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ======= POP-UP + CONFETTI LAYER ======= */
.gl-toast {
  position: fixed;
  left: 50%; top: 14px;
  z-index: 60;
  display: flex; align-items: center; gap: 12px;
  max-width: min(92vw, 460px);
  padding: 12px 18px 12px 12px;
  border: 1px solid rgba(255, 212, 90, 0.6);
  border-radius: 18px;
  background: rgba(24, 18, 16, 0.96);
  box-shadow: 0 0 30px rgba(255, 180, 70, 0.35), 0 18px 40px rgba(0, 0, 0, 0.5);
  color: var(--ink);
  transform: translate(-50%, -140%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.5s cubic-bezier(.2, 1.4, .4, 1), opacity 0.3s;
}
.gl-toast.show { transform: translate(-50%, 0); opacity: 1; }
.gl-toast:empty { display: none; }
.gl-toast-icon { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle, #FFE9A8, #FF9F43); font-size: 1.5rem; }
.gl-toast-body { display: flex; flex-direction: column; }
.gl-toast-body span { color: var(--muted); font-size: 0.9rem; }
.gl-fx { position: fixed; inset: 0; z-index: 55; width: 100vw; height: 100vh; pointer-events: none; }

/* ======= REDUCED MOTION: everything holds still ======= */
@media (prefers-reduced-motion: reduce) {
  .gl-page *, .gl-page *::before, .gl-page *::after, .gl-toast { animation: none !important; transition: none !important; }
  .gl-hline { stroke-dashoffset: 0; }
}

/* ======= PRINT: only the certificate when "Print certificate" is pressed ======= */
@media print {
  body.gl-print-cert * { visibility: hidden; }
  body.gl-print-cert .gl-cert, body.gl-print-cert .gl-cert * { visibility: visible; }
  body.gl-print-cert .gl-cert { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; border: 6px double #D9480F; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
