/* Roopt AIサポート チャットウィジェット v1
 * roopt-web 規約: カラーは CSS 変数(--green 系)・フォントは var(--font-ja)。明朝体は使用不可 */
.rc-root {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  font-family: var(--font-ja);
}
.rc-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: none;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.rc-toggle:hover { filter: brightness(1.05); }
.rc-panel {
  position: absolute;
  right: 0;
  bottom: 56px;
  width: min(320px, calc(100vw - 32px));
  height: min(400px, calc(100vh - 180px));
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.rc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--green);
  color: #fff;
}
.rc-title { font-weight: 700; font-size: 15px; }
.rc-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 4px;
}
.rc-close {
  margin-left: auto;
  border: none;
  background: none;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.rc-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f7f8f7;
}
.rc-note {
  font-size: 11px;
  color: #666;
  background: #fff;
  border: 1px solid #e5e7e5;
  border-radius: 8px;
  padding: 8px 10px;
  line-height: 1.5;
}
.rc-msg {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.rc-user {
  align-self: flex-end;
  background: var(--green);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.rc-assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e5e7e5;
  color: #222;
  border-bottom-left-radius: 4px;
}
.rc-assistant a { color: var(--green); text-decoration: underline; }
.rc-typing { color: #999; letter-spacing: 3px; }
.rc-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e5e7e5;
  background: #fff;
}
.rc-input {
  flex: 1;
  resize: none;
  border: 1px solid #d5d8d5;
  border-radius: 8px;
  padding: 9px 10px;
  /* 🚨 16px 未満にしないこと。iOS Safari は font-size が 16px 未満の入力欄に
     フォーカスすると**ページ全体を勝手に拡大**し、そのまま戻らない。
     13px だったせいで、チャットを開くとページの横幅が狂って見え、
     サブナビの「滞在情報」が画面外に押し出されていた(2026-08-03 上田報告)。
     viewport に maximum-scale を足す手もあるが、ピンチ拡大ができなくなるので採らない。 */
  font-size: 16px;
  font-family: inherit;
  line-height: 1.4;
}
.rc-input:focus { outline: 2px solid var(--green); border-color: transparent; }
/* rows=1 のため、プレースホルダーが折り返すと2行目が見切れる。1行に収めて溢れは省略記号に */
.rc-input::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-send {
  border: none;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 0 14px;
  white-space: nowrap;
  flex: none;
  cursor: pointer;
}
.rc-send:disabled { opacity: 0.5; cursor: default; }
/* hidden 属性(閉じる)を display: flex より優先させる。これが無いと×で閉じられない */
.rc-panel[hidden] { display: none !important; }
@media (max-width: 640px) {
  .rc-root { right: 10px; bottom: 10px; }
  .rc-panel { bottom: 52px; height: min(360px, calc(100vh - 180px)); }
}
@media print {
  .rc-root { display: none !important; }
}
