:root {
  color-scheme: light;
  --chatbot-width: min(520px, calc(100vw - 32px));
  --chatbot-height: min(920px, calc(100vh - 16px));
  --chatbot-bg: #ffffff;
  --chatbot-border: #dbe4f0;
  --chatbot-shadow: 0 22px 60px rgba(15, 23, 42, 0.18);
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-deep: #0f4fc8;
  --text: #0f172a;
  --text-secondary: #64748b;
  --surface-muted: #f1f5f9;
  font-family: "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%); }
button, textarea { font: inherit; }
.chatbot-launcher { position: fixed; bottom: 24px; right: 24px; width: 60px; height: 60px; border: 0; border-radius: 50%; background: var(--primary); display: flex; justify-content: center; align-items: center; box-shadow: 0 10px 30px rgba(37, 99, 235, 0.4); cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease; z-index: 999; }
.chatbot-launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 40px rgba(37, 99, 235, 0.45); }
.chatbot-launcher.is-hidden { opacity: 0; pointer-events: none; }
.chatbot-launcher svg { width: 28px; height: 28px; fill: #fff; }
.chatbot-container { position: fixed; top: 8px; right: 16px; width: var(--chatbot-width); height: var(--chatbot-height); background: var(--chatbot-bg); border-radius: 22px; border: 1px solid var(--chatbot-border); box-shadow: var(--chatbot-shadow); display: flex; flex-direction: column; overflow: hidden; transform: translateX(calc(100% + 32px)); transition: transform 0.35s ease; z-index: 998; }
.chatbot-container.is-open { transform: translateX(0); }
.chatbot-header { flex: 0 0 auto; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%); color: #fff; }
.chatbot-header__title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chatbot-header__avatar { position: relative; width: 46px; height: 46px; border-radius: 50%; background: #fff; color: var(--primary-dark); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.08rem; flex: 0 0 auto; }
.chatbot-header__avatar::after { content: ""; position: absolute; right: 1px; bottom: 4px; width: 12px; height: 12px; border-radius: 50%; background: #22c55e; border: 2px solid var(--primary); }
.chatbot-header__name { font-size: 1.05rem; font-weight: 700; line-height: 1.25; white-space: nowrap; }
.chatbot-status { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 0.78rem; color: rgba(255, 255, 255, 0.88); }
.chatbot-status span { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }
.chatbot-header__actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.chatbot-header-button { border: 0; min-width: 50px; min-height: 46px; padding: 5px 7px; border-radius: 12px; background: transparent; color: #fff; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; cursor: pointer; transition: background 0.2s ease, transform 0.2s ease; }
.chatbot-header-button:hover { background: rgba(255, 255, 255, 0.14); }
.chatbot-header-button:active { transform: translateY(1px); }
.chatbot-header-button svg { width: 23px; height: 23px; fill: currentColor; }
.chatbot-header-button span { font-size: 0.68rem; font-weight: 600; }
.chatbot-messages { flex: 1 1 auto; padding: 18px 16px 14px; overflow-y: auto; background: linear-gradient(180deg, rgba(248, 250, 252, 0.9) 0%, #ffffff 100%); }
.chatbot-message { margin-bottom: 16px; display: flex; gap: 10px; }
.chatbot-message.bot { align-items: flex-start; }
.chatbot-message.user { justify-content: flex-end; align-items: flex-end; }
.chatbot-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 0.82rem; flex: 0 0 auto; }
.chatbot-message-content { display: flex; flex-direction: column; gap: 6px; min-width: 0; max-width: 100%; }
.chatbot-meta { display: flex; gap: 9px; align-items: center; color: var(--text-secondary); font-size: 0.76rem; }
.chatbot-meta strong { color: #334155; font-weight: 700; }
.chatbot-message.user .chatbot-meta { justify-content: flex-end; padding-right: 4px; }
.chatbot-bubble { max-width: 100%; width: fit-content; padding: 13px 15px; border-radius: 16px; line-height: 1.6; font-size: 0.9rem; background: #fff; color: var(--text); border: 1px solid rgba(148, 163, 184, 0.35); box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08); white-space: pre-wrap; }
.chatbot-message.bot .chatbot-bubble { border-top-left-radius: 6px; }
.chatbot-message.user .chatbot-bubble { max-width: 90%; min-width: 120px; background: var(--primary); color: #fff; border: none; border-top-right-radius: 6px; box-shadow: 0 10px 22px rgba(37, 99, 235, 0.26); word-break: keep-all; overflow-wrap: normal; white-space: pre-wrap; }
.chatbot-quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 12px; }
.chatbot-quick-action { min-height: 40px; border: 1px solid rgba(37, 99, 235, 0.28); border-radius: 12px; background: #fff; color: #0f4fc8; font-weight: 700; font-size: 0.86rem; cursor: pointer; transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease; }
.chatbot-quick-action:hover { border-color: var(--primary); background: #eff6ff; transform: translateY(-1px); }
.chatbot-typing { display: inline-flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 0.84rem; }
.chatbot-typing-dots { display: inline-flex; gap: 5px; }
.chatbot-typing-dots span { width: 6px; height: 6px; background: #94a3b8; border-radius: 50%; animation: typing 1.2s infinite ease-in-out; }
.chatbot-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.chatbot-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
.chatbot-rating { margin: 6px 0 18px; padding: 14px 16px; background: var(--surface-muted); border-radius: 16px; display: flex; flex-direction: column; gap: 12px; }
.chatbot-rating-title { margin: 0 0 4px; font-size: 0.88rem; font-weight: 700; color: var(--text); line-height: 1.35; }
.chatbot-rating-description { margin: 0; font-size: 0.72rem; color: var(--text-secondary); line-height: 1.5; }
.chatbot-rating-options { display: grid; grid-template-columns: repeat(5, minmax(42px, 1fr)); gap: 6px; align-items: start; }
.chatbot-rating-button { width: 100%; min-width: 0; border: 0; background: transparent; color: var(--text); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 0; }
.chatbot-rating-score { width: 40px; height: 40px; border: 1px solid rgba(148, 163, 184, 0.5); border-radius: 50%; background: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 0.98rem; font-weight: 700; transition: border 0.2s ease, box-shadow 0.2s ease, color 0.2s ease; }
.chatbot-rating-face { font-size: 0.72rem; line-height: 1; color: var(--text-secondary); }
.chatbot-rating-label { width: 100%; max-width: 62px; font-size: 0.58rem; color: #334155; line-height: 1.25; text-align: center; white-space: normal; word-break: keep-all; overflow-wrap: anywhere; }
.chatbot-rating-button:hover:not(:disabled) .chatbot-rating-score { border-color: var(--primary); color: var(--primary); box-shadow: 0 5px 14px rgba(37, 99, 235, 0.18); }
.chatbot-rating-button.is-selected .chatbot-rating-score { border-color: var(--primary); background: #eff6ff; color: var(--primary-dark); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
.chatbot-rating-button.is-selected .chatbot-rating-face, .chatbot-rating-button.is-selected .chatbot-rating-label { color: var(--primary-dark); font-weight: 700; }
.chatbot-rating-button:disabled { cursor: default; }
.chatbot-rating-thanks { margin: 0; padding-top: 2px; font-size: 0.76rem; color: var(--primary-dark); font-weight: 700; }
.chatbot-footer { flex: 0 0 auto; padding: 12px 16px 10px; background: rgba(248, 250, 252, 0.96); border-top: 1px solid var(--chatbot-border); }
.chatbot-form { display: block; }
.chatbot-privacy-notice { margin: 0 0 8px; padding: 9px 12px; border-radius: 12px; background: #f1f5f9; color: #64748b; text-align: center; font-size: 0.68rem; line-height: 1.5; }
.chatbot-privacy-notice strong { display: block; color: #475569; font-weight: 700; }
.chatbot-privacy-notice span { display: block; }

.chatbot-input-wrap { position: relative; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.chatbot-input { width: 100%; border-radius: 16px; border: 1px solid rgba(37, 99, 235, 0.35); padding: 14px 64px 14px 16px; font-size: 0.88rem; line-height: 1.5; min-height: 58px; max-height: 140px; resize: none; overflow-y: auto; transition: border 0.2s ease, box-shadow 0.2s ease; }
.chatbot-input:focus { outline: none; border-color: rgba(37, 99, 235, 0.72); box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15); }
.chatbot-input-hint { margin: 6px 56px 0 4px; font-size: 0.68rem; color: var(--text-secondary); text-align: right; line-height: 1.4; }
.chatbot-submit { position: absolute; right: 9px; top: auto; bottom: 9px; width: 40px; height: 40px; border: none; background: var(--primary); color: #fff; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.2s ease, transform 0.2s ease; }
.chatbot-submit:hover { background: var(--primary-dark); transform: translateY(-1px); }
.chatbot-submit:active { transform: translateY(0); }
.chatbot-submit svg { width: 20px; height: 20px; fill: currentColor; }
.chatbot-disclaimer { margin: 8px 0 0; text-align: center; font-size: 0.68rem; color: var(--text-secondary); line-height: 1.5; }
.chatbot-disclaimer a, .chatbot-disclaimer a:visited { color: var(--primary) !important; text-decoration: underline; font-weight: 600; }
.chatbot-disclaimer a:hover { color: var(--primary-dark) !important; }
@keyframes typing { 0%, 80%, 100% { transform: translateY(0); opacity: 0.4; } 40% { transform: translateY(-4px); opacity: 1; } }
@media (max-width: 600px) {
  :root { --chatbot-width: 100vw; --chatbot-height: 88vh; }
  .chatbot-container { top: auto; bottom: 0; right: 0; border-radius: 18px 18px 0 0; }
  .chatbot-launcher { bottom: 18px; right: 18px; }
  .chatbot-header { padding: 14px 16px; }
  .chatbot-header__avatar { width: 42px; height: 42px; }
  .chatbot-header__name { font-size: 1rem; }
  .chatbot-header-button { min-width: 46px; }
  .chatbot-message.user .chatbot-bubble { max-width: 92%; min-width: 100px; }
  .chatbot-quick-actions { grid-template-columns: 1fr; }
  .chatbot-rating { padding: 12px; }
  .chatbot-rating-options { gap: 4px; }
  .chatbot-rating-score { width: 36px; height: 36px; font-size: 0.9rem; }
  .chatbot-rating-label { display: none; }
  .chatbot-input-hint { display: none; }
}
