/* Guide (package K): «?» buttons, help panel with Lea or Nico, first-login tutorial, manual page. */

/* ---------- characters: breathing, blinking, waving, ponytail, talking ---------- */
.mascot { display: block; width: 100%; height: auto; overflow: visible; }
.mascot .m-all { transform-box: view-box; transform-origin: 110px 300px; animation: m-breathe 3.4s ease-in-out infinite; }
.mascot .m-eyes { transform-box: view-box; transform-origin: 110px 115px; animation: m-blink 5.2s infinite; }
.mascot-nico .m-eyes { animation-delay: 1.3s; }
.mascot .m-wave { transform-box: view-box; transform-origin: 142px 174px; animation: m-wave 1.2s ease-in-out 2 .3s, m-idle-arm 4s ease-in-out 3s infinite; }
.mascot-nico .m-wave { transform-origin: 150px 188px; }
.mascot .m-tail { transform-box: view-box; transform-origin: 67px 56px; animation: m-sway 2.8s ease-in-out infinite; }
.mascot .m-mouth { transform-box: view-box; transform-origin: 110px 138px; }
.mascot.talking .m-mouth { animation: m-talk .26s ease-in-out 7; }
@keyframes m-breathe { 0%, 100% { transform: translateY(0) scaleY(1); } 50% { transform: translateY(-3px) scaleY(1.008); } }
@keyframes m-blink { 0%, 90%, 100% { transform: scaleY(1); } 93% { transform: scaleY(.08); } 96% { transform: scaleY(1); } }
@keyframes m-wave { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-16deg); } 70% { transform: rotate(10deg); } }
@keyframes m-idle-arm { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-4deg); } }
@keyframes m-sway { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(5deg); } }
@keyframes m-talk { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.35); } }
@media (prefers-reduced-motion: reduce) {
  .mascot *, .mascot.talking .m-mouth { animation: none !important; }
  .help-pop, .help-bubble, .tutorial-card { animation: none !important; }
}

/* ---------- «?» button ---------- */
.help-btn { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; margin-left: 6px; flex: none;
  border-radius: 50%; border: 2px solid var(--brand); color: var(--brand); background: var(--surface); font-weight: 800; font-size: .9rem;
  line-height: 1; text-decoration: none; vertical-align: middle; cursor: pointer; }
.help-btn:hover, .help-btn:focus-visible { background: var(--brand); color: var(--brand-ink); }
.help-btn:focus-visible { outline: 3px solid var(--brand-soft); outline-offset: 2px; }
h1 .help-btn { width: 28px; height: 28px; font-size: 1rem; position: relative; top: -2px; }
summary .help-btn { position: relative; top: -1px; }

/* ---------- help panel: character next to a speech bubble ---------- */
.help-pop { position: fixed; z-index: 60; right: 20px; bottom: 20px; width: min(560px, calc(100vw - 40px)); max-height: calc(100vh - 40px);
  display: grid; grid-template-columns: 150px 1fr; align-items: end; gap: 4px; animation: help-in .22s ease-out; }
.help-pop[hidden] { display: none; }
.help-pop.from-left { left: 20px; right: auto; }
.help-mascot { width: 150px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .15)); }
.help-bubble { position: relative; background: var(--surface); color: var(--ink); border: 2px solid var(--brand); border-radius: 18px;
  padding: 14px 16px 12px; box-shadow: 0 12px 32px rgba(16, 24, 20, .22); max-height: calc(100vh - 60px); overflow: auto; margin-bottom: 40px;
  animation: bubble-in .28s ease-out .05s both; }
.help-bubble::before { content: ""; position: absolute; left: -12px; bottom: 34px; width: 20px; height: 20px; background: var(--surface);
  border-left: 2px solid var(--brand); border-bottom: 2px solid var(--brand); transform: rotate(45deg); }
.help-name { margin: 0 28px 4px 0; font-size: .85rem; color: var(--muted); }
.help-name strong { color: var(--brand); }
.help-title { font-size: 1.05rem; margin: 0 0 .4rem; }
.help-title:focus { outline: none; }
.help-intro { margin: 0 0 .5rem; }
.help-steps { margin: 0 0 .6rem; padding-left: 1.1rem; font-size: .92rem; }
.help-steps li { margin: .25rem 0; }
.help-more { font-weight: 600; font-size: .9rem; }
.help-close { position: absolute; top: 6px; right: 8px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent;
  color: var(--muted); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.help-close:hover, .help-close:focus-visible { background: var(--bg); color: var(--ink); }
@keyframes help-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes bubble-in { from { opacity: 0; transform: scale(.92); transform-origin: left bottom; } to { opacity: 1; transform: none; } }
@media (max-width: 640px) {
  .help-pop, .help-pop.from-left { left: 8px; right: 8px; bottom: 8px; width: auto; grid-template-columns: 1fr; max-height: 86vh; }
  .help-mascot { width: 92px; margin: 0 0 -10px 12px; position: relative; z-index: 1; }
  .help-bubble { margin-bottom: 0; max-height: calc(86vh - 110px); }
  .help-bubble::before { left: 40px; bottom: auto; top: -12px; transform: rotate(135deg); }
}

/* ---------- tutorial ---------- */
html.tutorial-open { overflow: hidden; }
.tutorial { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(12, 20, 16, .55); }
.tutorial[hidden] { display: none; }
.tutorial-card { width: min(720px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); color: var(--ink);
  border-radius: 20px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); display: grid; grid-template-columns: 260px 1fr; gap: 8px;
  padding: 20px 24px 18px 12px; animation: help-in .3s ease-out; }
.tutorial-figure { display: flex; align-items: flex-end; justify-content: center; min-height: 240px; background: radial-gradient(circle at 50% 80%, var(--brand-soft), transparent 70%); border-radius: 16px; }
.tutorial-figure .help-mascot { width: 200px; filter: none; }
.tutorial-figure.both .help-mascot { width: 126px; }
.tutorial-body { display: flex; flex-direction: column; min-width: 0; }
.tutorial-kicker { margin: 4px 0 2px; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand); }
.tutorial-step h2 { font-size: 1.35rem; margin: 0 0 .5rem; }
.tutorial-step h2:focus { outline: none; }
.tutorial-step p { font-size: 1.02rem; }
.tutorial-dots { list-style: none; display: flex; gap: 6px; padding: 0; margin: auto 0 10px; }
.tutorial-dots li { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.tutorial-dots li.on { background: var(--brand); width: 22px; border-radius: 6px; }
.tutorial-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tutorial-spacer { flex: 1; }
@media (max-width: 640px) {
  .tutorial { align-items: flex-end; padding: 0; }
  .tutorial-card { grid-template-columns: 1fr; border-radius: 20px 20px 0 0; padding: 14px 16px 16px; max-height: 92vh; }
  .tutorial-figure { min-height: 0; height: 150px; }
  .tutorial-figure .help-mascot { width: 112px; }
  .tutorial-figure.both .help-mascot { width: 92px; }
  .tutorial-step h2 { font-size: 1.2rem; }
}

/* ---------- manual ---------- */
.guide-hero { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: center; overflow: hidden; }
.guide-hero-figures { display: flex; align-items: flex-end; justify-content: center; gap: 0; background: radial-gradient(circle at 50% 85%, var(--brand-soft), transparent 70%); border-radius: 14px; }
.guide-hero-figures .mascot { width: 150px; }
.guide-hero-names { margin: 0 0 .3rem; color: var(--muted); }
.guide-hero-names strong { color: var(--brand); }
.guide-hero .lead { font-size: 1.08rem; }
.guide-search { width: 100%; max-width: 520px; margin-top: 6px; }
.guide-toc { margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 24px; }
.guide-toc h2 { font-size: .95rem; margin: .4rem 0 .5rem; color: var(--muted); }
.guide-toc .chip { display: inline-block; text-decoration: none; color: var(--ink); }
.guide-toc .chip:hover { border-color: var(--brand); color: var(--brand); }
.guide-toc li[hidden] { display: none; }
.guide-group { margin: 28px 0 10px; font-size: 1.2rem; }
.guide-group[hidden] { display: none; }
.guide-topics { max-width: 1000px; }
.guide-topics .guide-topic { margin-bottom: 12px; scroll-margin-top: 16px; }
.guide-topic[hidden] { display: none; }
.guide-topic h3 { font-size: 1.1rem; margin: 0 0 .4rem; }
.guide-topic:target { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.guide-intro { font-weight: 500; }
.guide-steps { margin: .4rem 0; padding-left: 1.3rem; }
.guide-steps li { margin: .3rem 0; }
@media (max-width: 720px) {
  .guide-hero { grid-template-columns: 1fr; }
  .guide-hero-figures .mascot { width: 120px; }
}
