/* Help widget (support-widget.js). Parent palette; the kid prompt uses Fredoka.
   Launcher sits under the sheet-music fullscreen overlay (z 99999); the panel and guides sit above it. */
.gphelp {
  --gphelp-bg: #FFFFFF;
  --gphelp-bg-2: #F0EEE9;
  --gphelp-ink: #1B1C22;
  --gphelp-ink-2: #4A4D57;
  --gphelp-line: #E7E3DB;
  --gphelp-accent: #2E76C7;
  --gphelp-me: #EAF2FD;
  --gphelp-thumb: rgba(27, 28, 34, .18);
  --gphelp-thumb-hover: rgba(27, 28, 34, .32);
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--gphelp-ink);
}
html.gp-dark .gphelp {
  --gphelp-bg: oklch(.21 .015 260);
  --gphelp-bg-2: oklch(.25 .015 260);
  --gphelp-ink: oklch(.96 .005 260);
  --gphelp-ink-2: oklch(.80 .01 260);
  --gphelp-line: rgba(255, 255, 255, .10);
  --gphelp-accent: #6DB4FF;
  --gphelp-me: rgba(76, 158, 243, .18);
  --gphelp-thumb: rgba(255, 255, 255, .16);
  --gphelp-thumb-hover: rgba(255, 255, 255, .30);
  color-scheme: dark;
}

.gphelp button.gphelp-launch {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 9995;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px 8px 8px;
  border: 0;
  border-radius: var(--gp-r-pill, 999px);
  background: linear-gradient(135deg, #2E76C7, #2563EB);
  color: #fff;
  font: 700 15px/1 Inter, system-ui, sans-serif;
  box-shadow: 0 2px 16px rgba(76, 158, 243, .4);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.gphelp button.gphelp-launch:hover {
  background: linear-gradient(135deg, #2E76C7, #1D4ED8);
  transform: translateY(-1px);
  box-shadow: 0 4px 24px rgba(76, 158, 243, .55);
}
.gphelp--raised button.gphelp-launch { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 62px); }
.gphelp.is-open button.gphelp-launch,
.gphelp button.gphelp-launch[hidden] { display: none; }
.gphelp-launch__q {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .2);
  font-size: 16px;
}

.gphelp-panel {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 100100;
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100vw - 32px));
  max-height: min(640px, calc(100dvh - 32px));
  background: var(--gphelp-bg);
  border: 1px solid var(--gphelp-line);
  border-radius: 22px;
  box-shadow: 0 14px 40px rgba(20, 30, 50, .18), 0 4px 12px rgba(20, 30, 50, .08);
  overflow: hidden;
  animation: gphelp-in .2s cubic-bezier(.22, .9, .27, 1);
}
.gphelp-panel[hidden] { display: none; }
@keyframes gphelp-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.gphelp-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 16px 12px 20px;
  border-bottom: 1px solid var(--gphelp-line);
}
.gphelp-head__text { flex: 1; min-width: 0; }
.gphelp .gphelp-head__title { margin: 0; font: 600 20px/1.2 Fraunces, Georgia, serif; color: var(--gphelp-ink); }
.gphelp .gphelp-head__sub { margin: 2px 0 0; font-size: 13px; color: var(--gphelp-ink-2); }
.gphelp button.gphelp-x {
  width: 44px;
  height: 44px;
  margin: -8px -8px 0 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  color: var(--gphelp-ink-2);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.gphelp button.gphelp-x:hover { background: var(--gphelp-bg-2); }

.gphelp-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 16px 20px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* Chrome 121+/Firefox use scrollbar-color and ignore ::-webkit-scrollbar; Safari only reads the pseudo-elements. */
.gphelp-body, .gphelp .gphelp-ta { scrollbar-width: thin; scrollbar-color: var(--gphelp-thumb) transparent; }
.gphelp-body::-webkit-scrollbar, .gphelp .gphelp-ta::-webkit-scrollbar { width: 8px; }
.gphelp-body::-webkit-scrollbar-track, .gphelp .gphelp-ta::-webkit-scrollbar-track { background: transparent; }
.gphelp-body::-webkit-scrollbar-thumb, .gphelp .gphelp-ta::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--gphelp-thumb) padding-box;
}
.gphelp-body::-webkit-scrollbar-thumb:hover { background: var(--gphelp-thumb-hover) padding-box; }
.gphelp p { margin: 0; }
.gphelp .gphelp-lead { font-size: 17px; font-weight: 700; color: var(--gphelp-ink); }
.gphelp .gphelp-note { font-size: 13px; line-height: 1.5; color: var(--gphelp-ink-2); }
.gphelp .gphelp-kid {
  padding: 16px;
  border-radius: 16px;
  background: #FFF9F0;
  color: #1A1A2E;
  font: 600 22px/1.3 Fredoka, Inter, sans-serif;
  text-align: center;
}

.gphelp button.gphelp-pill {
  align-self: flex-start;
  min-height: 44px;
  padding: 11px 22px;
  border: 0;
  border-radius: var(--gp-r-pill, 999px);
  background: linear-gradient(135deg, #2E76C7, #2563EB);
  box-shadow: 0 2px 16px rgba(76, 158, 243, .4);
  color: #fff;
  font: 700 15px/1.2 Inter, system-ui, sans-serif;
  cursor: pointer;
}
.gphelp button.gphelp-pill:hover { background: linear-gradient(135deg, #2E76C7, #1D4ED8); }
.gphelp button.gphelp-pill:disabled { opacity: .6; cursor: default; }
.gphelp button.gphelp-pill--sm { min-height: 36px; padding: 8px 16px; font-size: 14px; }

.gphelp button.gphelp-link,
.gphelp a.gphelp-link {
  align-self: flex-start;
  padding: 4px 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--gphelp-accent);
  font: 600 14px/1.4 Inter, system-ui, sans-serif;
  text-decoration: underline;
  cursor: pointer;
}

.gphelp .gphelp-input {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gphelp-line);
  border-radius: 10px;
  background: var(--gphelp-bg);
  color: var(--gphelp-ink);
  font: 16px/1.4 Inter, system-ui, sans-serif;
  box-shadow: none;
}
.gphelp .gphelp-input:focus { outline: none; border-color: #4C9EF3; box-shadow: 0 0 0 3px rgba(76, 158, 243, .3); }
.gphelp .gphelp-ta { resize: none; }
.gphelp .gphelp-label { font-size: 13px; font-weight: 600; color: var(--gphelp-ink-2); }
.gphelp .gphelp-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.gphelp .gphelp-status { font-size: 13px; color: var(--gphelp-ink-2); min-height: 1em; }

.gphelp-math, .gphelp-form { display: flex; flex-direction: column; gap: 10px; }
.gphelp .gphelp-math__q { font-size: 22px; font-weight: 800; }
.gphelp-math .gphelp-input { max-width: 140px; font-size: 22px; }

.gphelp-msgs { display: flex; flex-direction: column; gap: 8px; }
.gphelp-msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.gphelp-msg--bot { align-self: flex-start; background: var(--gphelp-bg-2); border-bottom-left-radius: 6px; }
.gphelp-msg--me { align-self: flex-end; background: var(--gphelp-me); border-bottom-right-radius: 6px; }
.gphelp-msg.is-typing { color: var(--gphelp-ink-2); }
.gphelp button.gphelp-mini {
  margin: 8px 8px 0 0;
  padding: 6px 12px;
  border: 1px solid var(--gphelp-accent);
  border-radius: var(--gp-r-pill, 999px);
  background: transparent;
  box-shadow: none;
  color: var(--gphelp-accent);
  font: 600 13px/1.2 Inter, system-ui, sans-serif;
  cursor: pointer;
}

.gphelp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.gphelp button.gphelp-chip {
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--gphelp-line);
  border-radius: var(--gp-r-pill, 999px);
  background: var(--gphelp-bg);
  box-shadow: none;
  color: var(--gphelp-ink);
  font: 500 14px/1.2 Inter, system-ui, sans-serif;
  cursor: pointer;
}
.gphelp button.gphelp-chip:hover { border-color: #4C9EF3; background: var(--gphelp-me); }

.gphelp-compose { display: flex; gap: 8px; align-items: flex-end; }
.gphelp-compose .gphelp-ta { flex: 1; min-width: 0; }
.gphelp button.gphelp-send {
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  border-radius: 12px;
  background: #2563EB;
  box-shadow: none;
  color: #fff;
  font: 700 15px/1 Inter, system-ui, sans-serif;
  cursor: pointer;
}
.gphelp button.gphelp-send:hover { background: #1D4ED8; }

.gphelp-live-slot { display: flex; flex-direction: column; gap: 6px; }
.gphelp-live-slot:empty { display: none; }
.gphelp-live-slot--mini { display: inline; }
.gphelp .gphelp-live-status { font-size: 14px; font-weight: 600; color: var(--gphelp-ink); }
.gphelp .gphelp-live-sys { align-self: center; font-size: 13px; color: var(--gphelp-ink-2); text-align: center; }
.gphelp-msg__who { display: block; font-size: 12px; font-weight: 700; color: var(--gphelp-accent); }
.gphelp button.gphelp-launch.has-news::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #E5484D;
}

.gphelp-nudge {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 56px);
  z-index: 9995;
  display: flex;
  align-items: flex-start;
  max-width: min(270px, calc(100vw - 32px));
  border: 1px solid var(--gphelp-line);
  border-radius: 16px 16px 4px 16px;
  background: var(--gphelp-bg);
  box-shadow: 0 10px 30px rgba(20, 30, 50, .18);
  animation: gphelp-nudge-in .25s ease-out;
}
.gphelp--raised .gphelp-nudge { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 118px); }
.gphelp.is-open .gphelp-nudge { display: none; }
.gphelp button.gphelp-nudge__ask {
  flex: 1;
  padding: 12px 4px 12px 14px;
  border: 0;
  background: none;
  color: var(--gphelp-ink);
  font: 600 15px/1.4 Inter, system-ui, sans-serif;
  text-align: left;
  cursor: pointer;
}
.gphelp button.gphelp-nudge__x {
  width: 36px;
  height: 36px;
  margin: 2px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--gphelp-ink-2);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.gphelp button.gphelp-nudge__x:hover { background: var(--gphelp-bg-2); }
@keyframes gphelp-nudge-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .gphelp-nudge { animation: none; } }

.gphelp-see { padding: 10px 14px; border: 1px solid var(--gphelp-line); border-radius: 12px; font-size: 13px; color: var(--gphelp-ink-2); }
.gphelp-see summary { cursor: pointer; font-weight: 600; color: var(--gphelp-ink); }
.gphelp-see ul { margin: 8px 0; padding-left: 18px; }
.gphelp-see li { overflow-wrap: anywhere; }

.gphelp-guide { position: fixed; inset: 0; z-index: 100090; pointer-events: none; }
.gphelp-guide__tip { pointer-events: auto; }
.gphelp-guide__ring {
  position: fixed;
  border-radius: 14px;
  box-shadow: 0 0 0 4px #4C9EF3, 0 0 0 9999px rgba(10, 12, 20, .55);
  pointer-events: none;
  transition: top .15s ease, left .15s ease, width .15s ease, height .15s ease;
}
.gphelp-guide__tip {
  position: fixed;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(300px, calc(100vw - 16px));
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--gphelp-bg);
  color: var(--gphelp-ink);
  box-shadow: 0 14px 40px rgba(20, 30, 50, .25);
  font-size: 15px;
  line-height: 1.45;
}

@media (max-width: 600px) {
  .gphelp-panel {
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    max-height: 88dvh;
    border-radius: 22px 22px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .gphelp button.gphelp-launch { padding-right: 12px; }
}
