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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #f59e0b;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --bot-bg: #f0f4ff;
  --user-bg: #2563eb;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* Header */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; }
.logo-icon { font-size: 20px; }
.logo-ai {
  background: var(--primary);
  color: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 14px;
}
.badge {
  font-size: 11px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 20px;
}

/* Main */
.main {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Hero */
.hero { text-align: center; padding: 32px 0 8px; }
.hero h1 { font-size: 28px; font-weight: 800; margin-bottom: 12px; }
.hero-sub { color: var(--text-muted); font-size: 15px; margin-bottom: 24px; line-height: 1.8; }

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.suggestion {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text);
}
.suggestion:hover { border-color: var(--primary); color: var(--primary); background: #eff6ff; }

/* Chat */
.chat-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.chat-box {
  padding: 20px;
  min-height: 300px;
  max-height: 500px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message { display: flex; gap: 10px; align-items: flex-start; }
.message.user { flex-direction: row-reverse; }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.message.user .avatar { background: var(--text-muted); }

.bubble {
  max-width: 80%;
  background: var(--bot-bg);
  padding: 12px 16px;
  border-radius: 0 12px 12px 12px;
  font-size: 14px;
  line-height: 1.7;
}
.message.user .bubble {
  background: var(--user-bg);
  color: #fff;
  border-radius: 12px 0 12px 12px;
}
.bubble p + p { margin-top: 8px; }
.bubble .note { font-size: 11px; color: var(--text-muted); margin-top: 8px; }
.message.user .bubble .note { color: rgba(255,255,255,0.7); }

/* Typing indicator */
.typing .bubble { display: flex; align-items: center; gap: 4px; padding: 14px 16px; }
.dot {
  width: 7px; height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* Input area */
.input-area {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  padding-bottom: env(safe-area-inset-bottom, 12px);
  background: var(--surface);
  position: sticky;
  bottom: 0;
  z-index: 5;
}
.limit-bar {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.limit-bar span { font-weight: 700; color: var(--primary); }
.input-row { display: flex; gap: 8px; align-items: flex-end; }
textarea {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.15s;
}
textarea:focus { border-color: var(--primary); }
.send-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.send-btn:hover { background: var(--primary-dark); }
.send-btn:disabled { background: var(--border); cursor: not-allowed; }

/* Affiliate */
.affiliate-section h3 { font-size: 15px; margin-bottom: 12px; color: var(--text-muted); }
.affiliate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.affiliate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.15s;
}
.affiliate-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.affiliate-card .card-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.affiliate-card .card-name { font-weight: 700; font-size: 14px; }
.affiliate-card .card-desc { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Upgrade */
.upgrade-card {
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
}
.upgrade-card h3 { font-size: 18px; margin-bottom: 8px; }
.upgrade-card > p { font-size: 14px; opacity: 0.85; margin-bottom: 16px; }
.upgrade-card ul { text-align: left; display: inline-block; margin-bottom: 20px; }
.upgrade-card li { font-size: 14px; padding: 3px 0; }
.upgrade-price { font-size: 32px; font-weight: 800; margin-bottom: 4px; }
.upgrade-price span { font-size: 16px; opacity: 0.7; }
.upgrade-btn {
  background: var(--accent);
  color: #1e293b;
  border: none;
  border-radius: 8px;
  padding: 12px 32px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  margin-bottom: 12px;
}
.upgrade-note { font-size: 12px; opacity: 0.7; margin-bottom: 12px; }
.email-row { display: flex; gap: 8px; max-width: 360px; margin: 0 auto; }
.email-row input {
  flex: 1;
  border: none;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  outline: none;
}
.email-btn {
  background: #fff;
  color: var(--primary);
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

/* Section title */
.section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

/* FAQ */
.faq-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 20px; }
.faq-list { display: flex; flex-direction: column; gap: 0; }
.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 0;
}
.faq-item:last-child { border-bottom: none; }
.faq-item summary {
  padding: 14px 0;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 18px; color: var(--primary); font-weight: 400; }
.faq-item[open] summary::after { content: "−"; }
.faq-item p {
  padding: 0 0 14px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
}
.faq-item strong { color: var(--text); }

/* Articles section */
.articles-section { }
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.article-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.article-link:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(37,99,235,0.08); }
.article-tag {
  font-size: 11px;
  background: #eff6ff;
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  width: fit-content;
}
.articles-more {
  display: inline-block;
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.articles-more:hover { text-decoration: underline; }
.articles-more-btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 12px 28px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  transition: background 0.15s;
}
.articles-more-btn:hover { background: var(--primary-dark); }

/* Cross-promo: sharoushi-agent */
.cross-promo {
  background: #f0fdf4;
  border-top: 1px solid #a7f3d0;
  border-bottom: 1px solid #a7f3d0;
  padding: 40px 20px;
  text-align: center;
  margin-top: 16px;
}
.cross-promo-inner { max-width: 560px; margin: 0 auto; }
.cross-promo-label { font-size: 12px; color: #065f46; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.cross-promo-title { font-size: 22px; font-weight: 800; color: #064e3b; margin-bottom: 8px; }
.cross-promo-sub { font-size: 14px; color: #047857; margin-bottom: 20px; line-height: 1.6; }
.cross-promo-btn {
  display: inline-block;
  background: #059669;
  color: #fff;
  padding: 12px 28px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  transition: background .2s;
}
.cross-promo-btn:hover { background: #047857; }

/* Footer */
.footer {
  text-align: center;
  padding: 24px 20px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.footer p + p { margin-top: 4px; }

@media (max-width: 480px) {
  .hero h1 { font-size: 22px; }
  .bubble { max-width: 90%; }
  .affiliate-grid { grid-template-columns: 1fr 1fr; }
}
