/* ── Visite guidée de bienvenue racontée par L.U.M.A. (src/features/welcome-tour/WelcomeTour.js) ──
   L.U.M.A. se tient hors de la boîte de dialogue, à gauche ou à droite, et déborde du cadre. */
.wt {
    --wt-pet: 150px;
    --wt-line: color-mix(in srgb, var(--border-color) 85%, transparent);
    --wt-tint: color-mix(in srgb, var(--primary) 10%, transparent);
    --wt-tint-strong: color-mix(in srgb, var(--primary) 18%, transparent);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: calc(var(--wt-pet) - 20px);
}
/* Les deux paddings sont toujours définis : changer de côté se fait en glissant, sans à-coup */
.wt { padding-left: 0; padding-right: 0; transition: padding 0.4s cubic-bezier(0.2, 0.7, 0.2, 1); }
.wt.is-pet-left { padding-left: calc(var(--wt-pet) - 14px); }
.wt.is-pet-right { padding-right: calc(var(--wt-pet) - 14px); }

/* Personnage */
.wt-pet {
    position: absolute;
    bottom: -22px;
    width: var(--wt-pet);
    height: var(--wt-pet);
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    z-index: 2;
    filter: drop-shadow(0 14px 14px rgba(0, 0, 0, 0.35));
    left: 0;
    transition: left 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
    animation: wt-pet-in 0.5s cubic-bezier(0.2, 1.3, 0.4, 1) both; /* une seule fois, à l'apparition de la visite */
}
.wt-pet svg { display: block; width: 100%; height: 100%; overflow: visible; }
.is-pet-right .wt-pet { left: calc(100% - var(--wt-pet)); }
.wt-pet-body { display: block; width: 100%; height: 100%; transform-origin: 50% 100%; }
.wt-pet-body.is-talking { animation: wt-talk 0.42s ease-in-out infinite alternate; }
.wt-pet-body.is-jumping { animation: wt-jump 0.7s cubic-bezier(0.3, 0.7, 0.4, 1); }

/* Boîte de dialogue, avec une queue qui pointe vers L.U.M.A. */
.wt-box {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 18px;
    border: 1px solid var(--wt-line);
    border-radius: 18px;
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.45);
    animation: gt-rise 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.wt-box::before {
    content: '';
    position: absolute;
    bottom: 34px;
    width: 16px;
    height: 16px;
    border: 1px solid var(--wt-line);
    background: var(--bg-card);
    rotate: 45deg;
}
.is-pet-left .wt-box::before { left: -9px; border-right: 0; border-top: 0; }
.is-pet-right .wt-box::before { right: -9px; border-left: 0; border-bottom: 0; }

.wt-top { display: flex; align-items: center; gap: 10px; }
.wt-bar { flex: 1; height: 5px; border-radius: 999px; background: var(--wt-line); overflow: hidden; }
.wt-bar i { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width 0.4s ease; }
.wt-progress { font-size: 0.74rem; font-weight: 600; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wt-text { position: relative; margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--wt-tint); font-size: 0.93rem; line-height: 1.55; cursor: default; white-space: pre-line; max-height: 42vh; overflow-y: auto; }
.wt-ghost { display: block; visibility: hidden; }
.wt-live { position: absolute; top: 12px; left: 14px; right: 14px; }
.wt-caret { display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -0.15em; background: var(--primary); animation: wt-blink 0.8s steps(1) infinite; }
.wt-hint { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px dashed var(--primary); border-radius: 12px; background: var(--wt-tint); font-size: 0.85rem; font-weight: 600; transition: opacity 0.2s; }
.wt-hint i { color: var(--primary); font-size: 1.1rem; }
.wt-hint.is-hidden { opacity: 0; }
.wt-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 12px; padding-top: 10px; border-top: 1px solid var(--wt-line); }
.wt-link { padding: 0; border: 0; background: none; color: var(--text-muted); font: inherit; font-size: 0.8rem; cursor: pointer; }
.wt-link:hover { color: var(--text-main); text-decoration: underline; }
.wt-actions { margin-left: auto; display: inline-flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.wt-btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 8px 16px; border: 1px solid var(--wt-line); border-radius: 999px; background: var(--bg-card); color: var(--text-main); font: inherit; font-size: 0.84rem; font-weight: 600; cursor: pointer; transition: border-color 0.15s, background 0.15s, transform 0.15s; }
.wt-btn:hover { border-color: var(--primary); transform: translateY(-1px); }
.wt-btn-primary { border-color: var(--primary); background: var(--primary); color: var(--text-on-primary, #fff); box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 35%, transparent); }
.wt-btn-primary:hover { filter: brightness(1.08); }
.wt-kbd { padding: 1px 6px; border: 1px solid color-mix(in srgb, currentColor 45%, transparent); border-radius: 5px; font: inherit; font-size: 0.68rem; font-weight: 600; opacity: 0.85; }
@media (hover: none) { .wt-kbd { display: none; } }

@keyframes wt-pet-in { from { opacity: 0; translate: 0 14px; scale: 0.8; } to { opacity: 1; translate: 0 0; scale: 1; } }
@keyframes wt-talk { from { translate: 0 0; rotate: -1.5deg; } to { translate: 0 -5px; rotate: 1.5deg; } }
@keyframes wt-jump { 0%, 100% { translate: 0 0; scale: 1; } 25% { translate: 0 6px; scale: 1.06 0.92; } 55% { translate: 0 -26px; scale: 0.96 1.06; } 80% { translate: 0 0; scale: 1.04 0.96; } }
@keyframes wt-blink { 50% { opacity: 0; } }

/* Petit écran : L.U.M.A. passe au-dessus de la boîte, centrée */
@media (max-width: 640px) {
    .wt { --wt-pet: 112px; min-height: 0; }
    .wt.is-pet-left, .wt.is-pet-right { padding: var(--wt-pet) 0 0; }
    .wt-pet, .is-pet-left .wt-pet, .is-pet-right .wt-pet { top: 0; bottom: auto; left: 50%; margin-left: calc(var(--wt-pet) / -2); }
    .wt-box::before { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .wt-pet, .wt-pet-body, .wt-box, .wt-caret { animation: none; }
}
