/* AI予約代行 — お客様向けチャット画面 */

:root {
  --bg: #14100f;
  --panel: #1e1917;
  --line: #302825;
  --txt: #f0eae6;
  --dim: #a2938c;
  --accent: #c9a227;
  --accent-dim: #6b5615;
  --bubble-ai: #241e1c;
  --bubble-me: #3a2f16;
  --vvh: 100vh;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  overscroll-behavior: none;
}

/* iOSでキーボードが出たときに画面下が隠れないよう、実際の表示高さを使う */
.app {
  display: flex;
  flex-direction: column;
  height: var(--vvh);
  max-width: 640px;
  margin: 0 auto;
  background: var(--bg);
}

/* ── ヘッダー ───────────────────────────── */
.hd {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.hd-main { min-width: 0; flex: 1; }
.hd-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hd-sub { font-size: 11.5px; color: var(--dim); white-space: nowrap; }
.hd-sub .off { color: var(--accent); }
.hd-btn {
  flex: 0 0 auto;
  padding: 7px 14px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent-dim);
  border-radius: 999px;
  cursor: pointer;
}
.hd-btn:active { background: rgba(201, 162, 39, .12); }

/* ── 会話 ───────────────────────────────── */
.log {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.row { display: flex; }
.row.me { justify-content: flex-end; }

.msg {
  max-width: 82%;
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 15px;
  white-space: pre-wrap;
  word-break: break-word;
}
.row.ai  .msg { background: var(--bubble-ai); border-top-left-radius: 5px; }
.row.me  .msg { background: var(--bubble-me); border-top-right-radius: 5px; }

.note {
  align-self: center;
  max-width: 90%;
  text-align: center;
  font-size: 12px;
  color: var(--dim);
  padding: 6px 0;
}
.note.ok {
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 10px;
  padding: 10px 14px;
  background: rgba(201, 162, 39, .06);
  line-height: 1.6;
}

/* 入力中の点 */
.dots { display: flex; gap: 5px; padding: 15px 17px; }
.dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--dim);
  animation: bl 1.3s infinite ease-in-out;
}
.dots i:nth-child(2) { animation-delay: .18s; }
.dots i:nth-child(3) { animation-delay: .36s; }
@keyframes bl { 0%,60%,100% { opacity:.25 } 30% { opacity:1 } }

/* ── 入力欄 ─────────────────────────────── */
.bar {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 12px calc(env(safe-area-inset-bottom) + 10px);
  background: var(--panel);
  border-top: 1px solid var(--line);
}
.bar-input {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 16px; /* iOSの自動ズーム防止のため16px未満にしない */
  line-height: 1.5;
  color: var(--txt);
  background: #120f0e;
  border: 1px solid var(--line);
  border-radius: 21px;
  resize: none;
  outline: none;
}
.bar-input:focus { border-color: var(--accent-dim); }
.bar-input::placeholder { color: #6d605a; }

.bar-send {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  color: #1a1412;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}
.bar-send:disabled { opacity: .35; cursor: default; }

/* ── 在籍キャストのパネル ───────────────── */
.sheet-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 20;
}
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 21;
  max-width: 640px;
  margin: 0 auto;
  height: calc(var(--vvh) * .8);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-radius: 18px 18px 0 0;
  border-top: 1px solid var(--line);
}
.sheet-hd {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px;
  font-size: 14px; font-weight: 700;
  border-bottom: 1px solid var(--line);
}
.sheet-x {
  font-size: 16px; color: var(--dim);
  background: none; border: none; cursor: pointer; padding: 4px 8px;
}
.sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px calc(env(safe-area-inset-bottom) + 20px);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}
.cast { display: flex; flex-direction: column; gap: 7px; }
.cast-img {
  width: 100%; aspect-ratio: 3/4;
  object-fit: cover;
  background: #241e1c;
  border-radius: 10px;
  display: grid; place-items: center;
  color: #5b4f4a; font-size: 11px;
}
.cast-nm { font-size: 13.5px; font-weight: 700; }
.cast-tg { font-size: 11.5px; color: var(--dim); line-height: 1.5; }
