.ho-guide {
  --ho-guide-size: 144px;
  --ho-guide-inset-bottom: max(16px, env(safe-area-inset-bottom));
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: var(--ho-guide-inset-bottom);
  width: var(--ho-guide-size);
  z-index: 45;
  color: var(--ink, #193237);
  font-size: 14px;
  line-height: 1.7;
}
.ho-guide[hidden], .ho-guide [hidden] { display: none !important; }
.ho-guide *, .ho-guide *::before, .ho-guide *::after { box-sizing: border-box; }
.ho-guide-toggle {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--teal-dark, #006966);
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
.ho-guide > .ho-adopted-character {
  --ho-size: var(--ho-guide-size);
  position: static;
  width: 100%;
  font: inherit;
}
.ho-adopted-character .ho-concierge__button { position: relative; }
.ho-adopted-character.ho-hover-sway .ho-concierge__canvas {
  transform-origin: 50% 85%;
  animation: ho-hover-sway 780ms ease-in-out;
}
.ho-adopted-character.ho-hover-hop .ho-concierge__canvas {
  animation: ho-hover-hop 660ms ease-in-out;
}
.ho-adopted-character.ho-hover-blink .ho-concierge__canvas { visibility: hidden; }
.ho-adopted-character.ho-hover-blink .ho-concierge__button::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url('./ho-concierge/assets/ho-kun-atlas.png');
  background-size: 400% 500%;
  background-position: 0 0;
  background-repeat: no-repeat;
  animation: ho-hover-blink 750ms steps(1, end);
}
@keyframes ho-hover-sway {
  0%, 100% { transform: rotate(0deg); }
  28% { transform: rotate(-4deg); }
  62% { transform: rotate(3deg); }
  84% { transform: rotate(-1deg); }
}
@keyframes ho-hover-hop {
  0%, 100% { transform: translateY(0); }
  42% { transform: translateY(-8px); }
  72% { transform: translateY(-2px); }
}
@keyframes ho-hover-blink {
  0%, 40%, 90%, 100% { background-position: 0 0; }
  10%, 32%, 55%, 80% { background-position: 33.333333% 0; }
  18%, 64% { background-position: 66.666667% 0; }
}
.ho-guide-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: min(326px, calc(100vw - 36px));
  max-height: min(420px, calc(100vh - 240px));
  max-height: min(420px, calc(100dvh - 240px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 12px 12px;
  border: 1px solid #d6e1db;
  border-radius: 18px;
  background: #ffffff;
  color: #193237;
  box-shadow: 0 8px 26px #19323724;
  scrollbar-width: thin;
}

.ho-guide[data-state]:not([data-state="closed"])::before {
  content: '';
  position: absolute;
  right: calc(var(--ho-guide-size) / 2 - 7px);
  bottom: calc(100% + 2px);
  z-index: 2;
  width: 14px;
  height: 14px;
  border-right: 1px solid #d6e1db;
  border-bottom: 1px solid #d6e1db;
  background: #fff;
  transform: rotate(45deg);
  pointer-events: none;
}
.ho-guide-head {
  position: sticky;
  top: -8px;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  background: #ffffff;
  color: var(--teal-dark, #006966);
  font-weight: 500;
}
.ho-guide-name { margin-right: auto; white-space: nowrap; }
.ho-guide-close {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  margin-right: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #647b78;
  font: inherit;
  font-size: 22px;
  cursor: pointer;
}
.ho-guide-voice-toggle, .ho-guide-repeat {
  min-height: 44px;
  padding: 5px 8px;
  border: 1px solid #d6e1db;
  border-radius: 8px;
  background: #f2f6f2;
  color: #193237;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.ho-guide-voice-toggle {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  margin-left: auto;
  padding: 0;
  line-height: 1;
  touch-action: manipulation;
}
.ho-guide-voice-icon { display: block; width: 24px; height: 24px; }
.ho-guide-voice-toggle[aria-pressed="true"] .ho-guide-voice-slash,
.ho-guide-voice-toggle[aria-pressed="false"] .ho-guide-voice-waves { display: none; }
.ho-guide-voice-toggle[aria-pressed="true"] { background: #e6efeb; border-color: #9bbcb3; }
.ho-guide-repeat { flex: 0 0 44px; width: 44px; padding: 0; border: 0; background: transparent; color: #516a68; font-size: 24px; line-height: 1; }
.ho-guide-voice-status { margin: 0 0 8px; font-size: 12px; color: #516a68; }
.ho-guide-prompt { margin: 2px 0 8px; font-weight: 500; line-height: 1.6; }
.ho-guide-next { margin-top: 10px; }
.ho-guide[data-state="message"] .ho-guide-panel { width: min(286px, calc(100vw - 36px)); }
.ho-guide[data-state="message"] .ho-guide-prompt { margin-bottom: 0; }
/* The silent first invitation only needs its text and a dismiss button. */
.ho-guide[data-state="message"][data-message-kind="invitation"] .ho-guide-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  gap: 4px;
  width: max-content;
  max-width: min(286px, calc(100vw - 36px));
  padding-block: 8px;
}
.ho-guide[data-message-kind="invitation"] .ho-guide-head { grid-column: 2; grid-row: 1; position: static; }
.ho-guide[data-message-kind="invitation"] .ho-guide-name,
.ho-guide[data-message-kind="invitation"] .ho-guide-voice-toggle,
.ho-guide[data-message-kind="invitation"] .ho-guide-repeat { display: none; }
.ho-guide[data-message-kind="invitation"] .ho-guide-prompt { grid-column: 1; grid-row: 1; margin: 0; }
.ho-guide-menu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ho-guide-choice {
  min-height: 44px;
  padding: 9px 5px;
  border: 1px solid #d6e1db;
  border-radius: 10px;
  background: #f2f6f2;
  color: #193237;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.ho-guide-choice:last-child:nth-child(odd) { grid-column: 1 / -1; }
.ho-guide-choice:hover { background: #e6efeb; }
.ho-guide-description { margin: 0 0 16px; }
.ho-guide-current { margin: 0 0 10px; color: #516a68; font-size: 12px; }
.ho-guide-go {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--teal, #007e7c);
  color: #ffffff;
  text-decoration: none;
  font-weight: 500;
}
.ho-guide-go:hover { background: var(--teal-dark, #006966); }
.ho-guide-back {
  display: block;
  min-height: 44px;
  margin-top: 6px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--teal-dark, #006966);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.ho-guide :focus-visible { outline: 3px solid #e8a539; outline-offset: 3px; }
@media (min-width: 760px) {
  .ho-guide-panel { right: calc(100% + 12px); bottom: 0; max-height: min(420px, calc(100vh - 112px)); max-height: min(420px, calc(100dvh - 112px)); }
  .ho-guide[data-state]:not([data-state="closed"])::before { right: calc(100% + 2px); bottom: calc(var(--ho-guide-size) / 2 - 7px); transform: rotate(-45deg); }
}
@media (max-width: 600px) {
  .ho-guide { --ho-guide-size: 104px; --ho-guide-inset-bottom: max(12px, env(safe-area-inset-bottom)); right: max(12px, env(safe-area-inset-right)); }
  .ho-guide-panel { width: min(272px, calc(100vw - 24px)); max-height: min(320px, calc(100vh - var(--ho-guide-size) - var(--ho-guide-inset-bottom) - 96px)); max-height: min(320px, calc(100dvh - var(--ho-guide-size) - var(--ho-guide-inset-bottom) - 96px)); padding-inline: 12px; font-size: 13px; }
  .ho-guide[data-state="message"] .ho-guide-panel { width: min(264px, calc(100vw - 24px)); }
  .ho-guide[data-state="message"][data-message-kind="invitation"] .ho-guide-panel { width: max-content; max-width: min(272px, calc(100vw - 24px)); }
  .ho-guide-menu { gap: 6px; }
  .ho-guide-choice { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .ho-adopted-character .ho-concierge__canvas,
  .ho-adopted-character .ho-concierge__button::after { animation: none !important; }
}
@media print { .ho-guide { display: none !important; } }

.ho-guide .ho-guide-hint {
  position: absolute;
  top: -4%;
  right: 70%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 36px;
  height: 24px;
  border: 1px solid #d6e1db;
  border-radius: 12px;
  background: #fff;
  color: #000;
  box-shadow: 0 3px 10px #1932371a;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  user-select: none;
}
.ho-guide .ho-guide-hint::after {
  content: '';
  position: absolute;
  right: 2px;
  bottom: -3px;
  width: 6px;
  height: 6px;
  border-right: 1px solid #d6e1db;
  border-bottom: 1px solid #d6e1db;
  background: #fff;
  transform: rotate(45deg);
}
.ho-guide[data-state]:not([data-state="closed"]) .ho-guide-hint { display: none; }

.ho-guide[data-voice-state="playing"] .ho-guide-hint { display: none; }
.ho-guide-prompt, .ho-guide-description { white-space: pre-line; }

.ho-guide-footer-credit {
  margin-top: 10px;
  padding-inline-end: 164px;
  color: #516a68;
  font-size: 12px;
  line-height: 1.8;
}
.ho-guide-footer-credit p { margin: 0; }
.ho-guide-footer-credit a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.ho-guide-footer-credit a:focus-visible { outline: 3px solid #e8a539; outline-offset: 3px; }
@media (max-width: 600px) {
  .ho-guide-footer-credit { padding-inline-end: 116px; }
}

/* Illustrated Ho-kun keeps the existing page-guide size and controls. */
.ho-illustrated-character .ho-concierge__button {
  display: block;
  width: 100%;
  height: var(--ho-guide-size, 144px);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  touch-action: manipulation;
}
.ho-illustrated-character .ho-concierge__canvas,
.ho-illustrated-character .ho-concierge__fallback {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
