.infj-guide {
  --guide-night: #12110f;
  --guide-night-2: #1d1a16;
  --guide-gold: #d5ad62;
  --guide-gold-bright: #f0d397;
  --guide-cream: #f7f1e6;
  --guide-ink: #211e19;
  --guide-muted: #746b5e;
  position: fixed;
  z-index: 90;
  inset-inline-end: max(18px, env(safe-area-inset-right));
  inset-block-end: max(18px, env(safe-area-inset-bottom));
  inline-size: 78px;
  block-size: 78px;
  font-family: "SS", ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--guide-ink);
}

.infj-guide[hidden], .infj-guide [hidden] { display: none !important; }

.infj-guide-launcher {
  position: absolute;
  inset: 0;
  inline-size: 78px;
  block-size: 78px;
  border: 1px solid color-mix(in srgb, var(--guide-gold) 72%, transparent);
  border-radius: 50%;
  padding: 0;
  color: var(--guide-gold-bright);
  background: radial-gradient(circle at 43% 37%, #302a20 0 14%, #171512 52%, #090807 100%);
  box-shadow: 0 14px 34px rgb(11 9 6 / 0.34), inset 0 0 23px rgb(213 173 98 / 0.12);
  cursor: pointer;
  isolation: isolate;
  overflow: hidden;
  animation: infj-guide-breathe 7s ease-in-out infinite;
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.infj-guide-launcher::before,
.infj-guide-launcher::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: inherit;
}

.infj-guide-launcher::before {
  inset: 5px;
  z-index: -1;
  background: conic-gradient(from 20deg, transparent 0 15%, rgb(240 211 151 / 0.9) 19%, transparent 24% 56%, rgb(213 173 98 / 0.55) 62%, transparent 68%);
  -webkit-mask: radial-gradient(circle, transparent 61%, #000 63% 68%, transparent 70%);
  mask: radial-gradient(circle, transparent 61%, #000 63% 68%, transparent 70%);
  animation: infj-guide-orbit 13s linear infinite;
}

.infj-guide-launcher::after {
  inset: 9px;
  z-index: 2;
  border: 1px solid rgb(240 211 151 / 0.17);
  background: linear-gradient(110deg, transparent 36%, rgb(240 211 151 / 0.18) 49%, transparent 62%);
  background-size: 240% 100%;
  animation: infj-guide-scan 6.5s ease-in-out infinite;
}

.infj-guide-launcher:hover,
.infj-guide-launcher:focus-visible {
  transform: translateY(-3px) scale(1.045);
  border-color: var(--guide-gold-bright);
  box-shadow: 0 18px 42px rgb(11 9 6 / 0.42), 0 0 0 4px rgb(213 173 98 / 0.16), inset 0 0 26px rgb(213 173 98 / 0.18);
  outline: none;
}

.infj-guide-launcher__core {
  position: absolute;
  inset: 12px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.infj-guide-emblem { display: block; inline-size: 43px; block-size: auto; filter: drop-shadow(0 0 8px rgb(213 173 98 / 0.26)); }
.infj-guide-launcher__ai {
  position: absolute;
  inset-inline-end: -2px;
  inset-block-end: 0;
  min-inline-size: 22px;
  block-size: 18px;
  border: 1px solid rgb(240 211 151 / 0.58);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #0f0e0c;
  color: var(--guide-gold-bright);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.infj-guide.is-assembling .infj-guide-emblem { animation: infj-guide-assemble 640ms cubic-bezier(.2,.8,.2,1); }

.infj-guide-dismiss {
  position: absolute;
  inset-inline-end: -5px;
  inset-block-start: -7px;
  z-index: 4;
  inline-size: 26px;
  block-size: 26px;
  border: 1px solid rgb(240 211 151 / 0.42);
  border-radius: 50%;
  padding: 0;
  display: grid;
  place-items: center;
  background: #181612;
  color: #f4e3c0;
  font: 400 17px/1 ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
}

.infj-guide-dismiss:hover,
.infj-guide-dismiss:focus-visible,
.infj-guide-close:hover,
.infj-guide-close:focus-visible,
.infj-guide-send:focus-visible,
.infj-guide-actions a:focus-visible,
.infj-guide-links a:focus-visible,
.infj-guide-input:focus-visible {
  outline: 2px solid var(--guide-gold-bright);
  outline-offset: 2px;
}

.infj-guide-panel {
  position: absolute;
  inset-inline-end: 0;
  inset-block-end: 96px;
  inline-size: min(390px, calc(100vw - 24px));
  max-block-size: min(650px, calc(100dvh - 132px));
  border: 1px solid rgb(213 173 98 / 0.48);
  border-radius: 20px;
  overflow: hidden;
  background: var(--guide-cream);
  box-shadow: 0 24px 75px rgb(8 7 5 / 0.34), 0 0 0 1px rgb(255 255 255 / 0.35) inset;
  display: flex;
  flex-direction: column;
  transform-origin: right bottom;
  animation: infj-guide-panel-in 280ms cubic-bezier(.2,.8,.2,1) both;
}

.infj-guide-panel__head {
  flex: none;
  min-block-size: 66px;
  padding: 12px 12px 12px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f8efe0;
  background-color: var(--guide-night);
  background-image: radial-gradient(circle at 15% 0%, #3c3223 0, var(--guide-night-2) 38%, var(--guide-night) 100%);
  border-block-end: 1px solid rgb(213 173 98 / 0.26);
}

.infj-guide-panel__mark {
  inline-size: 39px;
  block-size: 39px;
  border: 1px solid rgb(213 173 98 / 0.35);
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 13px rgb(213 173 98 / 0.12);
}
.infj-guide-panel__mark img { display: block; }
.infj-guide-panel__head > span:nth-child(2) { display: grid; gap: 2px; }
.infj-guide-panel__head strong { font: 500 19px/1.1 "CG", Georgia, serif; letter-spacing: 0.01em; }
.infj-guide-panel__head small { color: #bcb09d; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.infj-guide-close {
  margin-inline-start: auto;
  inline-size: 36px;
  block-size: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #ead9b6;
  font: 300 25px/1 ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
}

.infj-guide-scroll { min-block-size: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px; }
.infj-guide-intro > p { margin: 0 0 12px; font: 500 21px/1.25 "CG", Georgia, serif; color: var(--guide-ink); }
.infj-guide-actions { display: grid; gap: 8px; }
.infj-guide-actions a {
  min-block-size: 43px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid #d9c7a6;
  border-radius: 12px;
  color: #332c23;
  background: rgb(255 253 248 / 0.82);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.3;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}
.infj-guide-actions a::after { content: "→"; color: #9b7334; font-size: 18px; }
.infj-guide-actions a:hover { border-color: #b99050; background: #fffdf9; transform: translateX(2px); }

.infj-guide-messages { display: grid; gap: 10px; margin-block-start: 14px; }
.infj-guide-message { max-inline-size: 91%; padding: 10px 12px; border-radius: 13px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.infj-guide-message--user { margin-inline-start: auto; color: #f9f1e3; background: #29251f; border-end-end-radius: 4px; }
.infj-guide-message--assistant { color: #322d25; background: #eee4d4; border-end-start-radius: 4px; }
.infj-guide-message--busy { color: var(--guide-muted); background: transparent; padding-inline-start: 4px; }
.infj-guide-links { display: flex; flex-wrap: wrap; gap: 7px; margin-block-start: 8px; }
.infj-guide-links a { min-block-size: 32px; display: inline-flex; align-items: center; padding: 5px 9px; border: 1px solid #c9a96e; border-radius: 999px; color: #65491f; background: #fffaf0; text-decoration: none; font-size: 12px; }

.infj-guide-form { flex: none; padding: 12px 14px 13px; border-block-start: 1px solid #dfd2bd; background: #fffdf9; }
.infj-guide-form > label { display: block; margin-block-end: 6px; color: #554d42; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.infj-guide-compose { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 8px; align-items: end; }
.infj-guide-input { min-inline-size: 0; max-block-size: 92px; resize: vertical; padding: 9px 10px; border: 1px solid #cdbfaa; border-radius: 11px; color: #27231e; background: #fff; font: 400 14px/1.4 "SS", ui-sans-serif, system-ui, sans-serif; }
.infj-guide-send { inline-size: 40px; block-size: 40px; border: 0; border-radius: 50%; background: var(--guide-night); color: var(--guide-gold-bright); font-size: 21px; cursor: pointer; }
.infj-guide-send:disabled { opacity: 0.38; cursor: default; }
.infj-guide-notice { margin: 8px 1px 0; color: #777064; font-size: 10.5px; line-height: 1.38; }
.infj-guide-notice a { color: #5d451f; }

@keyframes infj-guide-orbit { to { transform: rotate(360deg); } }
@keyframes infj-guide-scan { 0%, 58%, 100% { background-position: 180% 0; opacity: .3; } 72% { background-position: -80% 0; opacity: 1; } }
@keyframes infj-guide-breathe { 0%, 100% { box-shadow: 0 14px 34px rgb(11 9 6 / .34), inset 0 0 23px rgb(213 173 98 / .12); } 50% { box-shadow: 0 16px 39px rgb(11 9 6 / .4), 0 0 17px rgb(213 173 98 / .13), inset 0 0 28px rgb(213 173 98 / .17); } }
@keyframes infj-guide-assemble { 0% { opacity: .1; transform: scale(.55) rotate(-22deg); filter: blur(4px); } 55% { opacity: 1; transform: scale(1.12) rotate(3deg); } 100% { opacity: 1; transform: scale(1) rotate(0); filter: blur(0); } }
@keyframes infj-guide-panel-in { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 430px) {
  .infj-guide { inset-inline-end: max(12px, env(safe-area-inset-right)); inset-block-end: max(12px, env(safe-area-inset-bottom)); }
  .infj-guide-panel { inset-inline-end: 0; inset-block-end: 91px; max-block-size: calc(100dvh - 116px); }
}

@media (prefers-reduced-motion: reduce) {
  .infj-guide *, .infj-guide *::before, .infj-guide *::after {
    animation: none !important;
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
  }
}
