@import url("https://fonts.googleapis.com/css2?family=Shippori+Mincho:wght@700;800&display=swap");
/* Delia, the tutor's mascot (js/delia.js). Ink follows the page text colour; the seal stays red. */
.d { --k: var(--text, #141210); --red: var(--signal, #d51f3f); overflow: visible; }
.d .ink { stroke: var(--k); fill: none; stroke-linecap: round; stroke-linejoin: round; }
.d .dot { fill: var(--k); }
.d .red { fill: var(--red); }
.d .body { stroke-dasharray: 1; stroke-dashoffset: 0; }
.d .opt { opacity: 0; }
.d .eyes, .d .seal, .d .drop, .d .enso, .d .write, .d .q, .d .sweat, .d .spl, .d .pup { transform-box: fill-box; transform-origin: center; }
.d .fig { transform-box: view-box; transform-origin: 100px 140px; }
.d .petal { transform-box: view-box; transform-origin: 100px 92px; }

.d.drawn .body { animation: d-draw 1.1s ease-out both; }
@keyframes d-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.d .eyes { animation: d-blink 4.5s infinite; }
@keyframes d-blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }

.d.s-idle .fig { animation: d-breathe 3.6s ease-in-out infinite; }
@keyframes d-breathe { 50% { transform: scale(1.015, 1.03); } }

.d.s-listen .pup { animation: d-read 2.4s ease-in-out infinite; }
@keyframes d-read { 0%, 100% { transform: translateX(-2.5px); } 50% { transform: translateX(2.5px); } }
.d.s-listen .dots { opacity: 1; }
.d.s-listen .dots circle { animation: d-pulse 1.2s infinite; }
.d.s-listen .dots circle:nth-child(2) { animation-delay: .2s; }
.d.s-listen .dots circle:nth-child(3) { animation-delay: .4s; }
@keyframes d-pulse { 0%, 100% { opacity: .15; } 50% { opacity: 1; } }

.d.s-think .enso { opacity: 1; stroke-dasharray: 1; animation: d-enso 2.6s ease-in-out infinite; }
@keyframes d-enso { 0% { stroke-dashoffset: 1; opacity: .9; } 70% { stroke-dashoffset: 0; opacity: .9; } 100% { stroke-dashoffset: 0; opacity: 0; } }
.d.s-think .pup { transform: translate(2px, -3px); }
.d.s-think .drop { opacity: 1; animation: d-drip 2.2s ease-in infinite; }
@keyframes d-drip { 0% { transform: translateY(-8px); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(26px); opacity: 0; } }

.d.s-found .seal { opacity: 1; animation: d-stamp .7s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes d-stamp { 0% { transform: translateY(-50px) scale(1.8) rotate(-14deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; opacity: 1; } }
.d.s-found .eyes { transform: scale(1.35); animation: none; }
.d.s-found .spl { opacity: 1; animation: d-splat .5s .45s both; }
@keyframes d-splat { from { transform: scale(0); } to { transform: scale(1); } }
.d.s-found .ring { opacity: 1; stroke-dasharray: 1; animation: d-draw .8s .5s ease-out both; }

.d.s-explain .write { opacity: 1; }
.d.s-explain .write rect { animation: d-reveal 2.8s steps(28) infinite; }
@keyframes d-reveal { 0% { width: 0; } 70%, 100% { width: 56px; } }
.d.s-explain .under { opacity: 1; stroke-dasharray: 1; animation: d-under 2.8s ease-out infinite; }
@keyframes d-under { 0%, 55% { stroke-dashoffset: 1; } 80%, 100% { stroke-dashoffset: 0; } }
.d.s-explain .pup { transform: translateX(3px); }

.d.s-done .fig { animation: d-hop 1.2s ease-in-out infinite; }
@keyframes d-hop { 0%, 100% { transform: none; } 30% { transform: translateY(-10px) scale(.98, 1.03); } 50% { transform: translateY(0) scale(1.04, .96); } }
.d.s-done .petal { opacity: 1; animation: d-bloom 1.6s ease-out infinite; }
@keyframes d-bloom { 0% { transform: rotate(var(--a)) translateY(0) scale(.2); opacity: 0; } 25% { opacity: 1; } 100% { transform: rotate(var(--a)) translateY(-74px) scale(1); opacity: 0; } }
.d.s-done .eyes, .d.s-done .mouth { opacity: 0; animation: none; }
.d.s-done .happy, .d.s-done .grin { opacity: 1; }
.d.s-done .enso { opacity: .9; }

.d.s-unsure .fig { animation: d-tilt 2.4s ease-in-out infinite; }
@keyframes d-tilt { 50% { transform: rotate(-4deg); } }
.d.s-unsure .sweat { opacity: 1; animation: d-sweat 2.4s ease-in infinite; }
@keyframes d-sweat { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(18px); opacity: 0; } }
.d.s-unsure .q { opacity: 1; animation: d-qbob 2.4s ease-in-out infinite; }
@keyframes d-qbob { 50% { transform: translateY(-4px) rotate(6deg); } }
.d.s-unsure .mouth { opacity: 0; }
.d.s-unsure .wavy { opacity: 1; }

/* older chat avatars hold still so only the newest one moves */
.d.still, .d.still * { animation: none !important; }

/* chat: avatar beside the assistant bubble */
.msg.with-delia { position: relative; margin-left: 84px; overflow: visible; }
.delia-av { position: absolute; left: -88px; bottom: -6px; width: 80px; height: 64px; pointer-events: none; }
.delia-av svg { width: 100%; height: 100%; display: block; }
.welcome .delia-hero { width: 150px; height: 120px; margin: 0 auto 6px; }
.welcome .delia-hero svg { width: 100%; height: 100%; display: block; }
.delia-stage { width: 120px; height: 96px; flex: none; }
.delia-stage svg { width: 100%; height: 100%; display: block; }

@media (max-width: 600px) {
  .msg.with-delia { margin-left: 44px; }
  .delia-av { left: -46px; width: 40px; height: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  .d, .d * { animation: none !important; }
}
