/* Writing Studio — original study-guide mascot (welcome + Practice tour).
   Transform / opacity animation only. No CSS filter. backdrop-filter is
   static, with a solid background fallback. Never used in Strict Exam. */

.tour-mascot,
.mascot-tour-fig,
.pr-guide-replay { pointer-events: none; }
.pr-guide-replay { pointer-events: auto; }

#tour-mascot-img,
.mascot-tour-fig {
  display: block;
  width: auto;
  height: 168px;
  max-width: 42vw;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- Welcome sheet: mascot + glass speech ---------- */
#tour.mascot-on .sheet-inner { overflow: visible; }
#tour.mascot-on .tour-art { display: none; }
#tour.mascot-on #tour-mascot { display: block; }
#tour.mascot-on .tour-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
#tour.mascot-on .tour-mascot {
  position: relative;
  margin: -28px 0 2px;
  z-index: 1;
}
.tour-mascot-glass {
  display: grid;
  place-items: end center;
  min-width: 120px;
  padding: 8px 10px 0;
  border-radius: 24px 24px 18px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2, 0 8px 24px rgba(28, 27, 34, .1));
}
.tour-speech {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px 10px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
}
#tour.mascot-on .tour-speech { margin-top: 4px; }
#tour.mascot-on .tour-speech::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -7px;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  background: inherit;
  border: 1px solid var(--line);
  border-right: 0;
  border-bottom: 0;
  transform: rotate(45deg);
}
#tour.mascot-on .tour-body h2 { position: relative; z-index: 1; margin: 0 0 6px; }
#tour.mascot-on .tour-text { position: relative; z-index: 1; margin: 0; }

@supports ((-webkit-backdrop-filter: blur(10px)) or (backdrop-filter: blur(10px))) {
  .tour-mascot-glass,
  #tour.mascot-on .tour-speech {
    background: var(--glass-bg, color-mix(in srgb, var(--surface) 78%, transparent));
    border-color: color-mix(in srgb, var(--line) 62%, var(--glass-edge, rgba(255,255,255,.5)));
    -webkit-backdrop-filter: saturate(var(--glass-sat, 1.3)) blur(12px);
    backdrop-filter: saturate(var(--glass-sat, 1.3)) blur(12px);
    box-shadow: var(--glass-shadow, 0 8px 28px rgba(28, 27, 34, .1)), var(--glass-inset, inset 0 1px 0 rgba(255,255,255,.55));
  }
}

@media (min-width: 601px) {
  #tour.mascot-on .tour-body {
    flex-direction: row;
    align-items: flex-end;
    gap: 8px;
  }
  #tour.mascot-on .tour-mascot { margin: 0 0 -6px; flex: none; }
  #tour-mascot-img { height: 200px; max-width: 180px; }
  #tour.mascot-on .tour-speech { flex: 1; min-width: 0; margin-top: 0; }
  #tour.mascot-on .tour-speech::before {
    left: -7px;
    top: 42%;
    margin-left: 0;
    transform: rotate(-45deg);
  }
}

@media (max-width: 600px) {
  #tour-mascot-img { height: 124px; max-width: 46vw; }
}

/* Pop-in: transform + opacity only */
@keyframes mascot-pop {
  from { opacity: 0; transform: translateY(14px) scale(.92); }
  to { opacity: 1; transform: none; }
}
html[data-motion=on] #tour.mascot-on .tour-mascot.is-pop,
html[data-motion=on] #tour.mascot-on .tour-speech.is-pop {
  animation: mascot-pop 380ms cubic-bezier(.16, 1, .3, 1) both;
}
html[data-motion=on] #tour.mascot-on .tour-speech.is-pop { animation-delay: 40ms; }

@media (prefers-reduced-motion: reduce) {
  html[data-motion=on] #tour.mascot-on .tour-mascot.is-pop,
  html[data-motion=on] #tour.mascot-on .tour-speech.is-pop { animation: none; }
}
html[data-motion=off] #tour.mascot-on .tour-mascot.is-pop,
html[data-motion=off] #tour.mascot-on .tour-speech.is-pop { animation: none; }

/* ---------- Practice helper tour ---------- */
#mascot-tour {
  position: fixed;
  inset: 0;
  z-index: 520;
  pointer-events: none;
}
#mascot-tour[hidden] { display: none !important; }
.mascot-tour-spot {
  position: fixed;
  z-index: 521;
  box-sizing: border-box;
  border: 2px solid var(--brand, #2f5d9f);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(12, 13, 18, .55);
  pointer-events: none;
  background: transparent;
}
[data-theme=dark] .mascot-tour-spot {
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .62);
  border-color: color-mix(in srgb, var(--brand, #8eb4ff) 80%, #fff);
}
.mascot-tour-card {
  position: fixed;
  z-index: 522;
  pointer-events: auto;
  width: min(420px, calc(100vw - 20px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  overscroll-behavior: contain;
}
.mascot-tour-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}
.mascot-tour-fig {
  height: 132px;
  max-width: 34vw;
  flex: none;
  margin-bottom: -4px;
}
.mascot-tour-speech {
  flex: 1;
  min-width: 0;
  position: relative;
  padding: 12px 14px 12px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: var(--shadow-2, 0 10px 28px rgba(28, 27, 34, .16));
}
@supports ((-webkit-backdrop-filter: blur(10px)) or (backdrop-filter: blur(10px))) {
  .mascot-tour-speech {
    background: var(--glass-bg, color-mix(in srgb, var(--surface) 82%, transparent));
    border-color: color-mix(in srgb, var(--line) 62%, var(--glass-edge, rgba(255,255,255,.5)));
    -webkit-backdrop-filter: saturate(var(--glass-sat, 1.3)) blur(12px);
    backdrop-filter: saturate(var(--glass-sat, 1.3)) blur(12px);
    box-shadow: var(--glass-shadow, 0 10px 28px rgba(28, 27, 34, .16)), var(--glass-inset, inset 0 1px 0 rgba(255,255,255,.55));
  }
}
.mascot-tour-step {
  margin: 0 0 4px;
  font: 600 11px/1.3 var(--font-ui, sans-serif);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--brass, var(--muted));
}
.mascot-tour-speech h2 {
  margin: 0 0 6px;
  font-size: 18px;
  letter-spacing: -.01em;
  color: var(--head-ink, var(--ink));
}
.mascot-tour-speech p#mascot-tour-text {
  margin: 0 0 10px;
  font-size: 14.5px;
  line-height: 1.5;
}
.mascot-tour-never {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin: 0 0 8px;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
}
.mascot-tour-never input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
.mascot-tour-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.mascot-tour-btns .btn { min-height: 40px; }

html[data-motion=on] #mascot-tour.is-pop .mascot-tour-row {
  animation: mascot-pop 380ms cubic-bezier(.16, 1, .3, 1) both;
}
@media (prefers-reduced-motion: reduce) {
  html[data-motion=on] #mascot-tour.is-pop .mascot-tour-row { animation: none; }
}
html[data-motion=off] #mascot-tour.is-pop .mascot-tour-row { animation: none; }

@media (max-width: 600px) {
  .mascot-tour-row { flex-direction: column; align-items: center; }
  .mascot-tour-fig { height: 96px; max-width: 38vw; margin-bottom: -4px; }
  .mascot-tour-card { width: calc(100vw - 16px); }
}

.pr-guide-replay {
  flex: none;
  font: 700 16px/1 var(--font-ui, sans-serif);
  color: var(--ink);
}
