:root {
  --color-bg: #ffffff;
  --color-page-bg: #eef2f8;
  --color-text: #2b2f36;
  --color-muted: #5a6270;
  --color-accent: #2b5faa;
  --color-accent-dark: #1f4680;
  --color-accent-soft: #eaf1fb;
  --color-border: #e3e8ef;
  --color-footer-bg: #f4f7fb;
  --shadow-card: 0 8px 30px rgba(31, 70, 128, 0.10);
  --shadow-bubble: 0 1px 2px rgba(43, 47, 54, 0.06);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  padding: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic",
    "Meiryo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--color-page-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
}

.app-shell {
  width: 100%;
  max-width: 640px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  box-shadow: var(--shadow-card);
}

.site-header {
  position: relative;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
  color: #ffffff;
  padding: 28px 28px 24px;
  flex-shrink: 0;
}

.site-header__info-link {
  display: none;
  position: absolute;
  top: 10px;
  right: 12px;
  width: 26px;
  height: 26px;
  line-height: 26px;
  text-align: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  text-decoration: none;
  font-size: 0.9rem;
}

.site-header__eyebrow {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}

.site-header h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.site-header__lead {
  margin: 8px 0 0;
  font-size: 0.85rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.9);
}

.chat {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--color-bg);
}

.bubble {
  max-width: 82%;
  padding: 13px 17px;
  border-radius: 16px;
  line-height: 1.85;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.95rem;
  box-shadow: var(--shadow-bubble);
}

.bubble.user {
  align-self: flex-end;
  background: var(--color-accent);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.bubble.assistant {
  align-self: flex-start;
  background: var(--color-accent-soft);
  border: 1px solid #dbe7f7;
  color: var(--color-text);
  border-bottom-left-radius: 4px;
}

.bubble.system-note {
  align-self: center;
  max-width: 92%;
  background: #fff3cd;
  border: 1px solid #ffe08a;
  font-size: 0.85rem;
  color: #664d03;
  text-align: center;
  box-shadow: none;
}

.retry-btn {
  margin-top: 10px;
  padding: 7px 16px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.retry-btn:hover:not(:disabled) {
  background: #c02434;
}

.retry-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.error-banner {
  background: #f8d7da;
  color: #842029;
  padding: 10px 20px;
  font-size: 0.85rem;
  flex-shrink: 0;
  border-top: 1px solid #f1aeb5;
}

.voice-hint {
  padding: 8px 20px 0;
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--color-muted);
  background: var(--color-bg);
  flex-shrink: 0;
}

.voice-hint__line {
  margin: 0;
}

.voice-hint-icon {
  display: none;
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-footer-bg);
  font-size: 1.1rem;
  cursor: pointer;
  align-self: flex-end;
}

.voice-hint-popover {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: 240px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #2b2f36;
  color: #ffffff;
  font-size: 0.72rem;
  line-height: 1.6;
  text-align: left;
  font-weight: 400;
  box-shadow: var(--shadow-card);
  z-index: 5;
}

.chat-form {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.chat-form textarea {
  flex: 1;
  resize: none;
  padding: 11px 15px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-footer-bg);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.chat-form textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  background: var(--color-bg);
  box-shadow: 0 0 0 3px rgba(43, 95, 170, 0.12);
}

.chat-form button {
  padding: 0 24px;
  background: var(--color-accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.chat-form button:hover:not(:disabled) {
  background: var(--color-accent-dark);
}

.chat-form button:disabled {
  opacity: 0.6;
  cursor: default;
}

.site-footer {
  background-color: var(--color-footer-bg);
  border-top: 1px solid var(--color-border);
  padding: 12px 16px;
  flex-shrink: 0;
  text-align: center;
}

.site-footer a {
  color: var(--color-muted);
  font-size: 0.78rem;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--color-accent-dark);
  text-decoration: underline;
}

@media (max-width: 480px) {
  .bubble { max-width: 92%; }

  /* ヘッダーをコンパクト化：説明文・eyebrowを消し、タイトル1行分の高さにする */
  .site-header { padding: 12px 44px 12px 16px; }
  .site-header__eyebrow { display: none; }
  .site-header h1 { font-size: 1.05rem; }
  .site-header__lead { display: none; }
  .site-header__info-link { display: block; }

  .chat { padding: 14px 14px; }
  .chat-form { padding: 10px 12px; }

  /* 音声入力案内：常時表示のテキストは消し、アイコン+ポップオーバーに切り替える */
  .voice-hint { display: none; }
  .voice-hint-icon { display: flex; align-items: center; justify-content: center; }

  /* プライバシーポリシーの常時フッターは消し、ヘッダー右上のアイコンからのみアクセスする */
  .site-footer { display: none; }
}
