/* ===========================================================
   tour.css — Proto's guided tour (ui/tour.js)
   =========================================================== */

/* ---------- Proto ---------- */
.proto { flex: none; color: var(--a); filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .45)); }
.proto svg { overflow: visible; }
.proto-body { animation: protoBob 2.6s ease-in-out infinite; transform-origin: 50% 90%; }
.proto-eyes { animation: protoBlink 4.2s infinite; transform-origin: 50% 52%; }
.proto-arm { animation: protoWave 1.6s ease-in-out 2; transform-origin: 70px 78px; }
.proto-ping { animation: protoPing 1.8s ease-out infinite; transform-origin: 50px 5px; }
.proto.talking .proto-mouth { animation: protoTalk .18s ease-in-out infinite alternate; transform-origin: 50px 63.5px; }
.proto.sad .proto-eyes { transform: scaleY(.45) translateY(6px); animation: none; }
.proto.sad .proto-body { animation: protoSigh 1.8s ease-in-out; }
@keyframes protoBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes protoBlink { 0%, 93%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes protoWave { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-18deg); } }
@keyframes protoTalk { from { transform: scaleY(1); } to { transform: scaleY(2.6); } }
@keyframes protoPing { 0% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(3); } }
@keyframes protoSigh { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(4px) rotate(-3deg); } }

/* ---------- the tour layer ---------- */
.tour-root { position: fixed; inset: 0; z-index: 9400; opacity: 0; transition: opacity .25s ease; }
.tour-root.on { opacity: 1; }
.tour-block { position: absolute; inset: 0; }          /* swallows taps on the page underneath */
.tour-spot {
  position: fixed;
  border-radius: var(--r-lg, 16px);
  box-shadow: 0 0 0 9999px rgba(2, 5, 8, .68), 0 0 0 2px var(--a), 0 0 28px 4px var(--a-glow);
  pointer-events: none;
  transition: left .35s cubic-bezier(.2, .8, .2, 1), top .35s cubic-bezier(.2, .8, .2, 1),
              width .35s cubic-bezier(.2, .8, .2, 1), height .35s cubic-bezier(.2, .8, .2, 1);
}
.tour-spot.none { left: 50% !important; top: 50% !important; width: 0 !important; height: 0 !important; box-shadow: 0 0 0 9999px rgba(2, 5, 8, .72); }

.tour-card {
  position: fixed;
  width: 400px; max-width: calc(100vw - 24px);
  display: flex; gap: 10px; align-items: flex-end;
  transition: left .35s cubic-bezier(.2, .8, .2, 1), top .35s cubic-bezier(.2, .8, .2, 1);
}
.tour-card.center { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); }
.tour-card.docked {
  left: 12px !important; right: 12px; top: auto !important; width: auto; transform: none;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}
.tour-bubble {
  position: relative;
  flex: 1; min-width: 0;
  padding: 14px 16px 12px;
  background: var(--panel);
  border: 1px solid var(--a-line);
  border-radius: var(--r-lg, 16px);
  box-shadow: var(--shadow), 0 0 30px -12px var(--a-glow);
}
/* the speech-bubble tail pointing at Proto */
.tour-bubble::before {
  content: ""; position: absolute; left: -7px; bottom: 22px;
  width: 12px; height: 12px; transform: rotate(45deg);
  background: var(--panel); border-left: 1px solid var(--a-line); border-bottom: 1px solid var(--a-line);
}
.tour-head { display: flex; align-items: center; gap: 8px; }
.tour-title { flex: 1; color: var(--fg-hi); font-size: var(--fs-md, 15px); }
.tour-count { color: var(--fg-3); font-size: var(--fs-micro); font-variant-numeric: tabular-nums; }
.tour-x { background: none; border: 0; color: var(--fg-3); font-size: 15px; cursor: pointer; padding: 2px 4px; }
.tour-x:hover { color: var(--fg-hi); }
.tour-text { margin: 8px 0 10px; color: var(--fg-2); font-size: var(--fs-sm); line-height: 1.5; min-height: 3em; }
.tour-btns { display: flex; gap: 6px; align-items: center; }
.tour-act { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.tour-ask { flex-direction: row; flex-wrap: wrap; }
.tour-ask .input { flex: 1; min-width: 160px; }
.tour-answer { width: 100%; margin: 4px 0 0; color: var(--a); font-size: var(--fs-sm); }
.tour-answer:empty { display: none; }
.tour-results { display: flex; flex-direction: column; gap: 4px; }
.tour-result { justify-content: flex-start; text-align: left; white-space: normal; }

/* ---------- the first-open offer ---------- */
.tour-offer {
  position: fixed; left: 12px; right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 9350;
  max-width: 560px; margin: 0 auto;
  padding: 10px 18px 16px;
  background: var(--panel);
  border: 1px solid var(--a-line);
  border-radius: var(--r-xl, 22px);
  box-shadow: var(--shadow), 0 0 40px -12px var(--a-glow);
  transform: translateY(140%);
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), opacity .3s ease;
  touch-action: none;
  user-select: none; -webkit-user-select: none;
}
.tour-offer.on { transform: none; }
.tour-offer.drag { transition: none; }
.tour-offer.gone { transform: translateY(140%) !important; opacity: 0 !important; }
.tour-grip { width: 42px; height: 5px; border-radius: 999px; background: var(--line-2); margin: 0 auto 10px; }
.tour-offer-row { display: flex; gap: 14px; align-items: center; }
.tour-offer-text { display: flex; flex-direction: column; gap: 4px; }
.tour-offer-text b { color: var(--fg-hi); font-size: var(--fs-lg); }
.tour-offer-text span { color: var(--fg-2); font-size: var(--fs-sm); }
.tour-offer-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tour-offer-btns .btn { flex: 1 1 auto; justify-content: center; padding: 11px 12px; }

/* the Settings → Account replay card */
.tour-card-settings .acct-row .proto { margin: -6px 0; }

@media (prefers-reduced-motion: reduce) {
  .proto-body, .proto-eyes, .proto-arm, .proto-ping, .proto.talking .proto-mouth { animation: none; }
  .tour-spot, .tour-card { transition: none; }
}

/* the decrypting tail while Proto types */
.tour-scramble { color: var(--a); opacity: .75; font-family: var(--mono, monospace); text-shadow: 0 0 8px var(--a-glow); }

.tour-hint { margin: -4px 0 8px; color: var(--fg-3); font-size: var(--fs-micro); }
.tour-hint:empty { display: none; }
.tour-btns .btn:disabled { opacity: .4; cursor: not-allowed; }

/* ===========================================================
   Proto the mascot on errors (ui/proto.js, ui/proto-card.js)
   =========================================================== */
.proto-wrench { display: none; }
.proto.fixing .proto-arm { display: none; }
.proto.fixing .proto-wrench { display: inline; }
.proto.fixing .proto-wrench-tool { animation: protoWrench 1.1s ease-in-out infinite; transform-origin: 84px 70px; }
.proto.fixing .proto-eyes { animation: protoFocus 3s ease-in-out infinite; transform-origin: 50% 52%; }
@keyframes protoWrench { 0%, 100% { transform: rotate(-18deg); } 50% { transform: rotate(22deg); } }
@keyframes protoFocus { 0%, 80%, 100% { transform: scaleY(1); } 88% { transform: scaleY(.55); } }

/* a whole page or box that couldn't show */
.proto-card { display: flex; gap: 18px; align-items: center; padding: 22px; }
.proto-card.small { gap: 12px; padding: 14px; }
.proto-card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.proto-card-text b { color: var(--fg-hi); font-size: var(--fs-lg); }
.proto-card.small .proto-card-text b { font-size: var(--fs-md, 15px); }
.proto-card-text p { margin: 0; color: var(--fg-2); font-size: var(--fs-sm); }
.proto-card-fine { color: var(--fg-3) !important; font-size: var(--fs-micro) !important; }
.proto-card-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.proto-card-detail summary { cursor: pointer; color: var(--fg-3); font-size: var(--fs-micro); letter-spacing: .1em; text-transform: uppercase; }
.proto-card-detail pre { margin: 6px 0 0; max-height: 160px; overflow: auto; white-space: pre-wrap; word-break: break-word; color: var(--fg-3); font-size: 11px; }
@media (max-width: 520px) { .proto-card:not(.small) { flex-direction: column; text-align: center; } }

/* error toasts: Proto beside the plain-words version */
.toast.toast-proto { display: flex; gap: 10px; align-items: flex-start; }
.toast-proto .proto { flex: none; margin-top: -2px; }
.toast-proto-text { flex: 1; min-width: 0; }
.toast-code { margin-top: 3px; color: var(--fg-3); font-size: 10px; opacity: .8; word-break: break-word; }

/* #/a-page-that-doesn't-exist */
.lost { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 20px; }
.lost h1 { margin: 6px 0 0; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-hi); font-size: var(--fs-xl); }
.lost-line { margin: 0; color: var(--fg-2); font-size: var(--fs-md, 15px); }
.lost-fine { margin: 0; color: var(--fg-3); font-size: var(--fs-micro); }
.lost-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.lost .proto-eyes { animation: protoLook 4s ease-in-out infinite; }
@keyframes protoLook { 0%, 40%, 100% { transform: translateX(0); } 50%, 70% { transform: translateX(-4px); } 80%, 95% { transform: translateX(4px); } }
