html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: sans-serif;
  font-size: 18px;

  background: url(/image/chatback.webp) center center / cover no-repeat;
  background-attachment: fixed;
  background-color: #e4edff;
}

/* --------------------
   画面切り替え
-------------------- */
.hidden {
  display: none;
}

#phoneScreen.hidden,
#chatScreen.hidden {
  display: none !important;
}

/* --------------------
   電話番号入力画面
-------------------- */
#phoneScreen {
  font-size: 18px;
  box-sizing: border-box;
  padding: 3px 16px 40px;
  overflow: hidden;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}


.startCard {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.startCard h2 {
  text-align: center;
  margin-top: 3px;
  margin-bottom: 10px;
  font-size: 24px;
  color: #5868fd;
}

.notice1 {
  color: #3258f2;
}

.notice2 {
  color: #fd89ae;
  font-weight: 600;
}

#phoneWrap {
  margin-bottom: 10px;
  margin-left: 10px;
}

#phone {
  font-size: 18px;
  padding: 12px;
  height: 25px;
  border: 2px solid #999;
}

input[type="tel"] {
  font-size: 16px;
}

.startActions {
  display: flex;
  gap: 16px; /* ← ボタンの間 */
  margin-top: 16px;
  margin-left: 8px;
}

#startChatBtn,
.backTopBtn {
  flex: 1;              /* ← 同じ幅にする */
  max-width: 152px;     /* ← 横幅制限（お好みで調整） */
  text-align: center;   /* ← 文字中央 */
  padding: 12px 0;      /* ← 高さ揃える */
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
}

/* 入室ボタン */
#startChatBtn {
  border: none;
  background: #4da3ff;
  color: #fff;
}

/* 戻るボタン */
.backTopBtn {
  background: #888;
  color: #fff;
}

/* --------------------
   チャット画面
-------------------- */
#chatScreen {
  font-size: 18px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chatExitWrap {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 8px;
}

#exitChatBtn {
  height: 40px;
  border: none;
  border-radius: 8px;
  background: #888;
  color: #fff;
  font-size: 16px;
  font-weight: bold;
}

#chatMessages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 12px 90px;
  box-sizing: border-box;

  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);

  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 16px;

  box-shadow:
    0 4px 12px rgba(0,0,0,0.06),
    inset 0 1px 0 rgba(255,255,255,0.35);
}

.msg {
  margin-bottom: 10px;
  display: flex;
  padding: 0 6px;
}

.msg.user {
  justify-content: flex-end;
}

.msg.admin,
.msg.bot {
  justify-content: flex-start;
}

.msg-inner {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 16px;
  font-size: 17px;
  line-height: 1.5;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.msg.user .msg-inner {
  background: hsl(210, 100%, 88%);
  border-radius: 8px;
}

.msg.admin .msg-inner,
.msg.bot .msg-inner {
  background: #ffd6e7;
  border-radius: 8px;
}

#chatForm {
  padding: 6px 8px;
  background: transparent;
  border-top: 1px solid #ddd;
}

.chatInput {
  display: flex;
  gap: 8px;
  align-items: center;
  background: transparent;
}

#message {
  flex: 1;
  min-height: 45px;
  max-height: 120px;
  padding: 10px 12px;
  border-radius: 20px;
  box-sizing: border-box;
  font-size: 18px;
  line-height: 1.3;
  background: #fff;
  border: 1px solid #8e5ffc;
  resize: none;
  outline: none;
}

.chatInput button {
  height: 45px;
  padding: 0 16px;
  font-size: 18px;
  font-weight: bold;
  border-radius: 20px;
  background: #6ecbff;
  color: #fff;
  border: 1px solid #8e5ffc;
}

#newMessageNotice {
  position: fixed;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%);
  background: #ff55c1;
  color: #fff;
  padding: 18px 24px;
  border-radius: 20px;
  font-size: 20px;
  display: none;
  z-index: 999;
  width: 80%;
}
.read-marker {
  margin: 6px 0 14px;
  font-size: 12px;
  color: #666;
  text-align: right;
}

#toastError {
  position: fixed;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);

  width: 80%;
  max-width: 320px;

  background: rgba(0,0,0,0.75);
  color: #fff;
  white-space: nowrap;
  font-size: 16px;
  padding: 14px 22px;
  border-radius: 26px;

  text-align: center;

  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999;
}

#toastError.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.chatTopBanner {
  position: sticky;
  top: 0;
  z-index: 1000;
}
.chatTopBanner {
  max-width: 500px;   /* ←ここで横幅制限 */
  margin: 0 auto;     /* ←中央寄せ */
}

.chatTopBanner img {
  width: 100%;
  height: auto;
}

/* --------------------
   ボタン共通
-------------------- */
button:hover {
  background: #4f72ff;
}

/* --------------------
   hidden強化
-------------------- */
#chatScreen.hidden {
  display: none !important;
}

#chatScreen.hidden #chatMessages,
#chatScreen.hidden #chatForm {
  display: none !important;
}

/* --------------------
   レスポンシブ
-------------------- */
@media (max-width: 768px) {
  .msg-inner {
    max-width: 90%;
  }
}