/* スペースTAKAYA チャット単体ページ */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #22262e;
  --text-light: #6b7280;
  --accent: #2f5d8a;
  --accent-deep: #22476b;
  --accent-light: #dfe7f0;
  --bot-bg: #eef1f5;
  --error-bg: #fdf0ee;
  --error-text: #8a3a2c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181d;
    --surface: #1e2229;
    --text: #e6e8ec;
    --text-light: #9aa1ad;
    --accent: #7aa7d4;
    --accent-deep: #3d6c9a;
    --accent-light: #2d3440;
    --bot-bg: #272c35;
    --error-bg: #3a2522;
    --error-text: #f0b5a8;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 15px;
  line-height: 1.7;
}

.chat-page {
  height: 100dvh;
  display: flex;
  justify-content: center;
  padding: 16px;
}

.chat-panel {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--accent-light);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--accent-deep);
  color: #fff;
}
.chat-title { margin: 0; font-size: 1rem; font-weight: 700; letter-spacing: 0.04em; }

.chat-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-msg {
  max-width: 85%;
  padding: 9px 13px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg-bot { align-self: flex-start; background: var(--bot-bg); border-bottom-left-radius: 3px; }
.chat-msg-user { align-self: flex-end; background: var(--accent-deep); color: #fff; border-bottom-right-radius: 3px; }
.chat-msg-error { background: var(--error-bg); color: var(--error-text); }
.chat-link { color: var(--accent); word-break: break-all; }

.chat-typing { display: flex; gap: 4px; align-items: center; padding: 13px 14px; }
.chat-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-light);
  animation: chatDot 1.2s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatDot { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

.chat-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.chat-quick[hidden] { display: none; }
.chat-chip {
  font: inherit;
  font-size: 0.85rem;
  padding: 5px 13px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}
.chat-chip:hover { background: var(--bot-bg); }

.chat-form { display: flex; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--accent-light); }
.chat-form input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 16px; /* iOS のズーム防止 */
  padding: 8px 12px;
  border: 1px solid var(--accent-light);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
.chat-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.chat-form button {
  width: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent-deep);
  color: #fff;
  cursor: pointer;
}
.chat-form button:disabled { opacity: 0.5; cursor: default; }

.chat-note { margin: 0; padding: 0 16px 10px; font-size: 0.72rem; color: var(--text-light); text-align: center; }

.chat-off { margin: auto; text-align: center; color: var(--text-light); }

.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;
}

@media (max-width: 600px) {
  .chat-page { padding: 0; }
  .chat-panel { border-radius: 0; border: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-typing span { animation: none; }
}
