/* Hibiki 響 widget. Uses the site's tokens where a page defines them, with the
   same values as fallbacks so it looks right on every page. */
.hbk-launch, .hbk-panel, .hbk-dialog {
  --h-bg: var(--bg2, #141416);
  --h-bg3: var(--bg3, #1a1a1d);
  --h-border: var(--border2, rgba(255,255,255,0.14));
  --h-text: var(--text, #e8e6e0);
  --h-muted: var(--muted, #7a7870);
  --h-accent: var(--accent, #e8736a);
  --h-teal: var(--teal, #5ab8a8);
  --h-sans: var(--sans, 'DM Sans', sans-serif);
  --h-mono: var(--mono, 'Space Mono', monospace);
  font-family: var(--h-sans);
  color: var(--h-text);
}

.hbk-launch {
  position: fixed; right: 20px; bottom: 20px; z-index: 900;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px 10px 12px;
  background: var(--h-bg); border: 1px solid var(--h-border); border-radius: 999px;
  font-size: 14px; letter-spacing: 0.02em; cursor: pointer;
  box-shadow: 0 6px 24px rgba(0,0,0,0.45);
  transition: border-color .2s, transform .2s;
}
.hbk-launch:hover { border-color: var(--h-accent); transform: translateY(-1px); }
.hbk-jp { font-family: 'Noto Serif JP', serif; font-weight: 400; }
.hbk-kanji {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--h-accent); color: #0d0d0e; font-family: 'Noto Serif JP', serif; font-size: 16px;
}

.hbk-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 901;
  width: 360px; max-height: min(560px, calc(100vh - 40px));
  display: flex; flex-direction: column;
  background: var(--h-bg); border: 1px solid var(--h-border); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.55); overflow: hidden;
}
.hbk-panel[hidden], .hbk-launch[hidden] { display: none; }
.hbk-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--h-border);
}
.hbk-head strong { display: block; font-size: 15px; }
.hbk-head .hbk-tag { display: block; font-family: var(--h-mono); font-size: 10.5px; color: var(--h-muted); letter-spacing: .04em; }
.hbk-x { background: none; border: 0; color: var(--h-muted); font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px; }
.hbk-x:hover { color: var(--h-text); }

.hbk-log { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-height: 160px; }
.hbk-bubble { max-width: 85%; padding: 9px 12px; border-radius: 12px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.hbk-bubble.bot { background: var(--h-bg3); align-self: flex-start; border-bottom-left-radius: 4px; }
.hbk-bubble.me { background: rgba(232,115,106,0.16); border: 1px solid rgba(232,115,106,0.3); align-self: flex-end; border-bottom-right-radius: 4px; }
.hbk-bubble.typing { color: var(--h-muted); }
.hbk-bubble a { color: var(--h-teal); }

.hbk-input { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--h-border); }
.hbk-input textarea {
  flex: 1; resize: none; background: var(--h-bg3); color: var(--h-text);
  border: 1px solid var(--h-border); border-radius: 8px; padding: 8px 10px;
  font: inherit; font-size: 14px;
}
.hbk-notice { margin: 0; padding: 0 16px 6px; font-size: 11px; color: var(--h-muted); }
.hbk-foot { padding: 0 16px 12px; }
.hbk-link { background: none; border: 0; padding: 0; color: var(--h-teal); font: inherit; font-size: 12.5px; cursor: pointer; text-decoration: underline; }

.hbk-btn {
  padding: 8px 16px; border-radius: 8px; border: 1px solid var(--h-border);
  background: transparent; color: var(--h-text); font: inherit; font-size: 14px; cursor: pointer;
}
.hbk-btn.primary { background: var(--h-accent); border-color: var(--h-accent); color: #0d0d0e; font-weight: 500; }
.hbk-btn:disabled { opacity: .5; cursor: default; }
.hbk-launch:focus-visible, .hbk-btn:focus-visible, .hbk-x:focus-visible, .hbk-link:focus-visible,
.hbk-panel textarea:focus-visible, .hbk-form :is(input, select, textarea):focus-visible {
  outline: 2px solid var(--h-teal); outline-offset: 2px;
}

/* contact dialog */
.hbk-dialog {
  /* Plain <section>/<header> rules and the page's margin reset would leak in;
     restore the dialog's centering explicitly. */
  position: fixed; inset: 0; margin: auto; height: fit-content; color: var(--h-text);
  width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  padding: 0; background: var(--h-bg); border: 1px solid var(--h-border); border-radius: 14px;
}
.hbk-dialog::backdrop { background: rgba(0,0,0,0.65); }
.hbk-form { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.hbk-form h2 { margin: 0; font-family: 'Noto Serif JP', serif; font-weight: 400; font-size: 24px; }
.hbk-sub { margin: -6px 0 4px; color: var(--h-muted); font-size: 13.5px; }
.hbk-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--h-muted); }
.hbk-field :is(input, select, textarea) {
  background: var(--h-bg3); color: var(--h-text); border: 1px solid var(--h-border);
  border-radius: 8px; padding: 9px 11px; font: inherit; font-size: 14.5px;
}
.hbk-field textarea { resize: vertical; }
.hbk-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.hbk-msg { margin: 0; min-height: 1.2em; font-size: 13.5px; }
.hbk-msg.ok { color: var(--h-teal); }
.hbk-msg.err { color: var(--h-accent); }
.hbk-row { display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 480px) {
  .hbk-launch { right: 16px; bottom: 16px; }
  .hbk-panel { left: 16px; right: 16px; bottom: 16px; width: auto; max-height: calc(100vh - 32px); }
  .hbk-form { padding: 18px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .hbk-launch { transition: none; }
  .hbk-launch:hover { transform: none; }
}

/* "Talk to Hibiki" button inside a page card (ai.html) */
.hbk-cta { margin-top: 1.5rem; cursor: pointer; font-family: inherit; }
