/* LingoCat — Teacher Liza, the guide: welcome tour, hints, game intros and her avatar. */

.guide-img { display: block; height: auto; user-select: none; -webkit-user-drag: none; }
.guide-avatar {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 18%;
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px #fff, 0 3px 8px -3px rgb(var(--shade) / 0.5);
}
.chip .guide-avatar { width: 22px; height: 22px; margin: -3px 0 -3px -6px; box-shadow: 0 0 0 1.5px #fff; }
.teacher-note .guide-avatar { width: 36px; height: 36px; }
.post-foot .guide-avatar { width: 22px; height: 22px; }
.post-foot { display: flex; align-items: center; gap: 6px; }

.tour-name { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--accent-ink); }

/* ------------------------------------------------------------------ tour */

.tour { position: fixed; inset: 0; z-index: 90; }
.tour-shade { position: absolute; inset: 0; background: rgba(30, 12, 50, 0.58); opacity: 0; transition: opacity 0.25s ease; }
.tour.no-target .tour-shade { opacity: 1; }
.tour-spot {
  position: absolute;
  pointer-events: none;
  box-shadow: 0 0 0 200vmax rgba(30, 12, 50, 0.58), 0 0 0 3px rgba(255, 255, 255, 0.95), 0 0 28px 8px rgba(255, 92, 150, 0.5);
  transition: left 0.38s cubic-bezier(0.3, 1.25, 0.4, 1), top 0.38s cubic-bezier(0.3, 1.25, 0.4, 1), width 0.38s ease, height 0.38s ease, border-radius 0.38s ease;
}
.tour-spot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: inherit;
  animation: tour-ring 1.6s ease-out infinite;
}
.tour.no-target .tour-spot { opacity: 0; }
@keyframes tour-ring {
  from { opacity: 0.9; transform: scale(1); }
  to { opacity: 0; transform: scale(1.08); }
}

.tour-card {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  animation: tour-in 0.38s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
.tour-card.at-top { top: calc(10px + env(safe-area-inset-top)); bottom: auto; }
.tour.no-target .tour-card { top: 0; bottom: 0; height: max-content; margin: auto; }
.tour-guide {
  position: relative;
  z-index: 1;
  width: 138px;
  flex: none;
  margin: 0 -22px -8px -6px;
  filter: drop-shadow(0 12px 14px rgba(40, 10, 60, 0.35));
  transform-origin: 50% 100%;
  animation: guide-bob 2.8s ease-in-out infinite alternate;
}
.tour-guide.is-new { animation: guide-pop 0.45s cubic-bezier(0.2, 1.7, 0.4, 1), guide-bob 2.8s 0.45s ease-in-out infinite alternate; }
.tour-bubble,
.guide-hint-body,
.guide-dialog-body {
  position: relative;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 20px 44px -18px rgba(40, 10, 60, 0.6), inset 0 1px 0 #fff;
}
.tour-bubble { flex: 1; min-width: 0; padding: 14px 16px 12px 30px; border-radius: 28px; }
.tour-bubble::before,
.guide-hint-body::before {
  content: "";
  position: absolute;
  left: -7px;
  bottom: 30px;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: inherit;
  transform: rotate(45deg);
}
.tour-text { margin: 4px 0 10px; font-size: 1.04rem; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.tour-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tour-dots { display: flex; flex: none; gap: 3px; }
.tour-dots i { width: 6px; height: 6px; border-radius: 99px; background: rgb(var(--shade) / 0.2); transition: width 0.25s ease, background 0.25s ease; }
.tour-dots i.is-on { width: 14px; background: var(--accent); }
.tour-buttons { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px; }
.tour-next { min-height: 44px; padding: 8px 20px; }
.tour.is-leaving { animation: fade-out 0.22s ease-in forwards; }

@keyframes tour-in {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
}
@keyframes guide-pop {
  0% { transform: scale(0.82) translateY(10px); }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
@keyframes guide-bob {
  from { transform: translateY(0); }
  to { transform: translateY(-4px); }
}
@keyframes fade-out {
  to { opacity: 0; }
}

/* ------------------------------------------------------------------ hints */

.guide-hint {
  position: fixed;
  z-index: 70;
  left: 10px;
  right: 10px;
  bottom: calc(98px + env(safe-area-inset-bottom));
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
  animation: tour-in 0.38s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
.guide-hint.at-top { top: calc(68px + env(safe-area-inset-top)); bottom: auto; }
.guide-hint > * { pointer-events: auto; }
.guide-hint-img { position: relative; z-index: 1; width: 96px; flex: none; margin: 0 -18px -6px -4px; filter: drop-shadow(0 10px 12px rgba(40, 10, 60, 0.32)); animation: guide-pop 0.45s cubic-bezier(0.2, 1.7, 0.4, 1); }
.guide-hint-body { flex: 1; min-width: 0; padding: 10px 12px 8px 26px; border-radius: 24px; }
.guide-hint-text { margin: 2px 0 6px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.guide-hint-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.guide-hint.is-leaving { animation: fade-out 0.22s ease-in forwards; }

/* ------------------------------------------------------------------ game intro */

dialog.guide-dialog {
  width: min(400px, calc(100% - 28px));
  max-width: none;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
}
dialog.guide-dialog[open] { display: grid; justify-items: center; animation: tour-in 0.38s cubic-bezier(0.2, 1.3, 0.4, 1) both; }
dialog.guide-dialog::backdrop { background: rgba(30, 12, 50, 0.58); }
.guide-dialog-img { position: relative; z-index: 1; width: 168px; margin-bottom: -34px; filter: drop-shadow(0 12px 14px rgba(40, 10, 60, 0.35)); }
.guide-dialog-body { display: grid; gap: 8px; width: 100%; padding: 38px 20px 16px; border-radius: 30px; text-align: center; }
.guide-dialog-body h2 { font-size: 1.3rem; }
.guide-dialog-body p { margin-bottom: 6px; font-weight: 700; line-height: 1.4; }

/* ------------------------------------------------------------------ settings row */

.tour-setting { display: flex; align-items: center; gap: 10px; }
.tour-setting .guide-avatar { width: 40px; height: 40px; }

/* ------------------------------------------------------------------ night */

[data-theme="night"] .tour-bubble,
[data-theme="night"] .guide-hint-body,
[data-theme="night"] .guide-dialog-body { background: #2d2048; color: #fff; box-shadow: 0 20px 44px -18px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
[data-theme="night"] .guide-avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5); }

@media (prefers-reduced-motion: reduce) {
  .tour-guide,
  .tour-guide.is-new,
  .tour-spot::after,
  .guide-hint-img { animation: none; }
}
