:root {
  --bg: #f6f3ec;
  --paper: rgba(255, 255, 255, 0.98);
  --ink: #1b2a39;
  --muted: #637181;
  --line: #ddd8cf;
  --soft: #f7f4ee;
  --accent: #9c7b3e;
  --accent-soft: #f3ebd8;
  --brand: #22384c;
  --button: #22384c;
  --button-hover: #182a3a;
  --shadow: 0 20px 40px rgba(25, 35, 46, 0.08);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(156, 123, 62, 0.10), transparent 24%),
    linear-gradient(180deg, #f8f5ef 0%, #f1ede6 100%);
  color: var(--ink);
  line-height: 1.7;
}

.app-shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 20px 16px 36px;
}

.hero-card,
.suggestion-card,
.chat-card,
.cta-card,
.disclaimer-card {
  background: var(--paper);
  border: 1px solid rgba(221, 216, 207, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 24px 24px 22px;
  margin-bottom: 14px;
  min-height: 660px;
}

.hero-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(221, 216, 207, 0.9);
  min-height: 92px;
}

.hero-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.hero-page-title {
  margin: 0;
  font-size: clamp(1.5rem, 3.2vw, 2.5rem);
  line-height: 1.08;
  font-weight: 900;
  letter-spacing: 0.03em;
  color: #142536;
  background: linear-gradient(135deg, #142536 0%, #2c4961 48%, #9c7b3e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.28);
  white-space: nowrap;
  position: relative;
}

.hero-page-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -8px;
  width: 76%;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(156, 123, 62, 0.24), rgba(34, 56, 76, 0.08));
  z-index: -1;
}

.hero-title-character {
  width: 64px;
  height: auto;
  display: block;
  object-fit: contain;
  align-self: center;
}

.hero-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
  width: 240px;
  min-width: 240px;
  margin-top: 0;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.hero-brand-head {
  display: flex;
  align-items: center;
  gap: 0;
}

.hero-logo {
  width: 160px;
  min-width: 160px;
  max-width: 160px;
}

.hero-logo img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.hero-subbrand {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-align: right;
  white-space: nowrap;
}

.hero-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  gap: 34px;
  align-items: center;
}

.character-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.character-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 7 / 8;
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.96), transparent 28%),
    linear-gradient(160deg, #f5f1e7 0%, #ffffff 100%);
  border: 1px solid var(--line);
}

.guide-illustration {
  width: 100%;
  height: 100%;
  display: block;
}

.guide-photo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  display: block;
  transform-origin: 50% 80%;
}

.speech-dots {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 5px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(211, 223, 230, 0.9);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.speech-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9c7b3e;
}

.character-nameplate {
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  background: #faf7f1;
  border: 1px solid var(--line);
  text-align: center;
}

.character-nameplate strong {
  display: block;
  font-size: 18px;
}

.character-nameplate span {
  font-size: 14px;
  color: var(--muted);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.character-stage.is-speaking .guide-body {
  animation: none;
}

.character-stage.is-speaking .guide-photo {
  animation: photoSpeak 1.2s ease-in-out 1;
}

.character-stage.is-speaking .speech-dots {
  opacity: 1;
  transform: translateY(0);
}

.character-stage.is-speaking .speech-dots span:nth-child(1) {
  animation: dotPulse 0.8s ease-in-out infinite;
}

.character-stage.is-speaking .speech-dots span:nth-child(2) {
  animation: dotPulse 0.8s ease-in-out 0.12s infinite;
}

.character-stage.is-speaking .speech-dots span:nth-child(3) {
  animation: dotPulse 0.8s ease-in-out 0.24s infinite;
}

.eyebrow {
  margin: 2px 0 8px;
  font-size: 12px;
  color: var(--brand);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.hero-message {
  margin: 0;
  font-size: clamp(1.6rem, 2.5vw, 2.3rem);
  line-height: 1.25;
}

.lead {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.9;
}

.profile-box {
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(250, 247, 241, 0.98), rgba(255, 255, 255, 0.96));
  border: 1px solid var(--line);
}

.profile-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--brand);
}

.profile-box p {
  margin: 0 0 10px;
  color: #4e6474;
  font-size: 14px;
  line-height: 1.85;
}

.profile-box p:last-child {
  margin-bottom: 0;
}

.status-row {
  margin-top: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.suggestion-card,
.cta-card {
  padding: 18px;
  margin-bottom: 14px;
}

.disclaimer-card {
  padding: 12px 16px 14px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.76);
}

.disclaimer-title {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #5f6b77;
}

.disclaimer-text {
  margin: 0 0 6px;
  font-size: 12px;
  line-height: 1.7;
  color: #6b7784;
}

.disclaimer-text:last-child {
  margin-bottom: 0;
}

.suggestion-title,
.cta-card h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.chip:hover {
  transform: translateY(-1px);
  border-color: #d5c49a;
  background: #fbf8f1;
}

.chat-card {
  padding: 14px;
  margin-bottom: 14px;
}

.messages {
  min-height: 320px;
  max-height: 58vh;
  overflow: auto;
  padding: 4px;
}

.message {
  display: flex;
  margin-bottom: 12px;
}

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

.bubble {
  max-width: min(86%, 680px);
  padding: 14px 16px;
  border-radius: 18px;
  font-size: 14px;
  white-space: pre-wrap;
}

.intro-bubble {
  white-space: normal;
  line-height: 1.75;
}

.message.bot .bubble {
  background: #faf7f1;
  border: 1px solid #e3ddd2;
}

.message.user .bubble {
  background: linear-gradient(135deg, #22384c 0%, #182a3a 100%);
  color: #fff;
}

.message.is-loading .bubble {
  color: var(--muted);
  background: #f8f4ed;
}

.source-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1ead9;
  color: #715a2d;
  font-size: 11px;
  font-weight: 700;
}

.composer {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

#questionInput {
  width: 100%;
  resize: vertical;
  min-height: 110px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  font: inherit;
  color: var(--ink);
  background: #fffdfa;
}

#questionInput:focus {
  outline: 2px solid rgba(156, 123, 62, 0.18);
  border-color: #cdb887;
}

.composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.helper-text {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.send-button,
.cta-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--button);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.send-button {
  padding: 12px 20px;
  font-size: 14px;
}

.cta-button {
  margin-top: 6px;
  padding: 13px 20px;
}

.send-button:hover,
.cta-button:hover {
  background: var(--button-hover);
  transform: translateY(-1px);
}

.send-button:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.cta-card p {
  margin: 0 0 10px;
  color: var(--muted);
}

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

@keyframes bodyBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes handWave {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-14deg); }
}

@keyframes photoSpeak {
  0%, 100% { transform: translateY(0) scale(1); }
  25% { transform: translateY(-3px) scale(1.01); }
  50% { transform: translateY(0) scale(1); }
  75% { transform: translateY(-2px) scale(1.005); }
}

@keyframes mouthTalk {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.5); }
}

@keyframes dotPulse {
  0%, 80%, 100% {
    opacity: 0.4;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 12px 10px 22px;
  }

  .hero-card {
    min-height: auto;
    padding: 16px 14px 14px;
  }

  .hero-topline {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    min-height: 0;
  }

  .hero-page-title {
    font-size: clamp(1.5rem, 6.4vw, 2rem);
  }

  .hero-title-wrap {
    gap: 8px;
  }

  .hero-main {
    grid-template-columns: minmax(0, 1fr) 128px;
    gap: 14px;
    align-items: start;
  }

  .character-panel {
    max-width: 128px;
    align-self: start;
  }

  .hero-brand {
    gap: 4px;
    align-items: flex-start;
    width: 118px;
    min-width: 118px;
    margin-top: 0;
  }

  .hero-brand-head {
    gap: 12px;
  }

  .hero-logo {
    width: 112px;
    min-width: 112px;
    max-width: 112px;
  }

  .hero-logo img {
    width: 100%;
    height: auto;
    object-fit: contain;
  }

  .hero-subbrand {
    text-align: left;
    font-size: 10px;
    white-space: normal;
  }

  .hero-subbrand {
    font-size: 10px;
    letter-spacing: 0.03em;
  }

  .eyebrow {
    margin-bottom: 6px;
    font-size: 10px;
  }

  .hero-message {
    font-size: 2rem;
    line-height: 1.22;
    letter-spacing: -0.02em;
  }

  .lead {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.75;
  }

  .profile-box {
    margin-top: 12px;
    padding: 12px 12px;
    border-radius: 16px;
  }

  .profile-title {
    font-size: 14px;
  }

  .profile-box p {
    font-size: 12px;
    line-height: 1.75;
  }

  .character-stage {
    max-width: 168px;
    border-radius: 20px;
  }

  .character-nameplate {
    padding: 10px 10px;
    border-radius: 14px;
  }

  .character-nameplate strong {
    font-size: 14px;
  }

  .character-nameplate span {
    font-size: 11px;
    line-height: 1.4;
  }

  .messages {
    max-height: none;
    min-height: 260px;
  }

  .bubble {
    max-width: 92%;
  }

  .intro-bubble {
    max-width: 100%;
    padding: 16px 18px;
    font-size: 13px;
    line-height: 1.7;
    letter-spacing: 0;
  }

  .composer-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .chip-list {
    gap: 8px;
  }

  .chip {
    font-size: 12px;
    padding: 9px 12px;
  }

  .send-button,
  .cta-button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .hero-main {
    grid-template-columns: minmax(0, 1fr) 108px;
    gap: 10px;
  }

  .hero-brand-head {
    gap: 10px;
  }

  .hero-logo {
    width: 102px;
    min-width: 102px;
    max-width: 102px;
  }

  .hero-logo img {
    width: 100%;
    height: auto;
    object-fit: contain;
  }

  .hero-message {
    font-size: 1.75rem;
  }

  .lead {
    font-size: 12.5px;
  }

  .character-panel {
    max-width: 108px;
  }
}
