:root {
  color-scheme: light;
  --green: #3c8161;
  --beige: #f7f4ef;
  --card: #ffffff;
  --text: #2c2c2c;
  --soft-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(244, 240, 232, 0.88)),
    url("images/3.jpg") center/cover fixed;
  color: var(--text);
  min-height: 100vh;
}

.hero {
  padding: 18px 16px 12px;
  text-align: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 2;
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: baseline;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.05em;
}

.brand-mark {
  font-size: 20px;
}

.brand-sub {
  font-size: 13px;
  color: #6c7a74;
}

.chat-area {
  display: flex;
  justify-content: center;
  padding: 18px 12px 32px;
}

.chat-shell {
  width: 100%;
  max-width: 960px;
  background: rgba(247, 244, 239, 0.95);
  border-radius: 18px;
  box-shadow: var(--soft-shadow);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  min-height: 72vh;
}

.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  padding-bottom: 140px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background:
    radial-gradient(circle at 18% 0%, rgba(60, 129, 97, 0.035), transparent 32%),
    rgba(247, 244, 239, 0.95);
}

.message-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.message-row.user {
  justify-content: flex-end;
}

.avatar {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #ffffff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  background: #ffffff;
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 30%;
}

.message {
  max-width: min(78%, 680px);
  padding: 14px 16px;
  border-radius: 14px;
  line-height: 1.6;
  background: #ffffff;
  color: var(--text);
  position: relative;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.04);
  white-space: pre-line;
}

.message.with-image {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 16px;
}

.message-text {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.message-subtext {
  margin: 2px 0 0;
  font-size: 14px;
  color: #5c5b58;
}

.message-highlight {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 800;
  color: #6b5a2e;
  background: linear-gradient(90deg, #f5eddc, #f0e2c6);
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.message-media {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.05);
  background: #f9f6f0;
}

.message-media img {
  display: block;
  width: 100%;
  height: auto;
}

.message.bot::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 18px;
  width: 14px;
  height: 14px;
  background: #ffffff;
  border-left: 1px solid rgba(0, 0, 0, 0.04);
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  transform: rotate(45deg);
  box-shadow: -3px 3px 12px rgba(0, 0, 0, 0.04);
}

.message.user {
  background: linear-gradient(135deg, #4a8f70, #3b745b);
  color: #ffffff;
}

.message.user::before {
  content: "";
  position: absolute;
  right: -8px;
  top: 18px;
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, #4a8f70, #3b745b);
  transform: rotate(45deg);
  box-shadow: 3px 3px 12px rgba(0, 0, 0, 0.08);
}

.message.typing {
  min-width: 54px;
  padding: 12px 14px;
  display: inline-flex;
  justify-content: center;
}

.typing-dots {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  min-width: 46px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #47433b;
  animation: typing-bounce 1.2s ease-in-out infinite;
  display: inline-block;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.16s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes typing-bounce {
  0% { transform: translateY(0); }
  12% { transform: translateY(-4px); }  /* 上 */
  28% { transform: translateY(3px); }   /* 下 */
  48% { transform: translateY(-6px); }  /* 上 */
  68% { transform: translateY(4px); }   /* 下 */
  88% { transform: translateY(-3px); }  /* 上 */
  100% { transform: translateY(0); }
}

.input-container {
  padding: 14px 18px 18px;
  background: rgba(247, 244, 239, 0.95);
  border-top: 1px solid rgba(0, 0, 0, 0.02);
}

.input-container.floating {
  position: sticky;
  bottom: 12px;
  align-self: flex-end;
  width: min(86%, 560px);
  margin-right: 14px;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(2px);
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.textarea-row {
  align-items: stretch;
}

.text-input {
  flex: 1;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid #d9d3c6;
  border-radius: 10px;
  background: rgba(247, 244, 239, 0.95);
}

.textarea-input {
  resize: vertical;
  min-height: 88px;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, #4a8f70, #3c8161);
  color: #ffffff;
  box-shadow: 0 10px 18px rgba(60, 129, 97, 0.28);
  transition: transform 0.08s ease, box-shadow 0.12s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(60, 129, 97, 0.32);
}

.btn.secondary {
  background: #ffffff;
  color: var(--green);
  border: 1px solid #d9d3c6;
  box-shadow: none;
}

.btn.skip {
  margin-top: 10px;
  width: 100%;
  background: #ffffff;
  color: #6f756f;
  border: 1px dashed #d9d3c6;
  box-shadow: none;
}

.select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.select-grid.stacked {
  grid-template-columns: 1fr;
}

.select-grid.stacked .btn {
  width: 100%;
  justify-content: center;
}

.note-text {
  font-size: 13px;
  color: #6f756f;
  margin-bottom: 8px;
  white-space: pre-line;
}

@media (max-width: 640px) {
  .chat-shell {
    min-height: 70vh;
  }

  .chat-container {
    padding: 18px 14px;
    gap: 14px;
  }

  .message {
    max-width: 90%;
    font-size: 15px;
  }

  .avatar {
    width: 60px;
    height: 60px;
  }

  .select-grid {
    grid-template-columns: 1fr;
  }

  .select-grid .btn {
    width: 100%;
    justify-content: center;
  }
}
