/* ================================
   Reset & Base
================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #6c3fff;
  --primary-dark: #5230d4;
  --accent: #00d4aa;
  --bg: #0a0a14;
  --bg-card: #12121f;
  --bg-card2: #1a1a2e;
  --text: #e8e8f0;
  --text-muted: #888899;
  --border: #2a2a3e;
  --success: #00d4aa;
  --warning: #f5a623;
  --danger: #e74c3c;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

body {
  font-family: 'Hiragino Sans', 'Noto Sans JP', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ================================
   Navbar
================================ */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 64px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.navbar-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.nav-link { color: var(--text-muted); font-size: 0.9rem; }
.nav-link:hover { color: var(--text); text-decoration: none; }

/* ================================
   Hamburger button
================================ */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 110;
}
.hamburger span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}
.hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.is-open span:nth-child(2) { opacity: 0; }
.hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ================================
   Language Switcher
================================ */
.lang-switcher {
  display: flex;
  gap: 4px;
  background: var(--bg-card2);
  border-radius: 20px;
  padding: 4px;
}
.lang-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.lang-btn.active, .lang-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* ================================
   Buttons
================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-google { background: #fff; color: #3c4043; border: 1px solid #dadce0; display: flex; align-items: center; justify-content: center; }
.btn-google:hover { background: #f8f9fa; border-color: #c6c6c6; text-decoration: none; color: #3c4043; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ================================
   Main & Pages
================================ */
.main-content { flex: 1; padding: 2rem 1rem; }
.page-container { max-width: 800px; margin: 0 auto; padding: 2rem 0; }

/* ================================
   Hero
================================ */
.hero {
  text-align: center;
  padding: 6rem 2rem;
  max-width: 860px;
  margin: 0 auto;
}
.hero-sub {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}
.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--text) 40%, var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-desc {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.hero-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ================================
   Features
================================ */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  max-width: 1000px;
  margin: 0 auto 4rem;
  padding: 0 2rem;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}
.feature-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.feature-card h3 { margin-bottom: 0.75rem; }
.feature-card p { color: var(--text-muted); }

/* ================================
   Flow section
================================ */
.flow-section {
  max-width: 600px;
  margin: 0 auto 4rem;
  padding: 0 2rem;
  text-align: center;
}
.flow-section h2 { margin-bottom: 1.5rem; font-size: 1.5rem; }
.flow-list {
  text-align: left;
  padding-left: 1.5rem;
  color: var(--text-muted);
}
.flow-list li { margin-bottom: 0.75rem; }

/* ================================
   Forms
================================ */
.predict-form { display: flex; flex-direction: column; gap: 1.5rem; }
.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-group label { font-weight: 600; font-size: 0.95rem; }
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 12px 16px;
  font-size: 0.95rem;
  width: 100%;
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
}
.form-group small { color: var(--text-muted); font-size: 0.8rem; }
.option-input { margin-bottom: 8px; }
.required { color: var(--warning); font-size: 0.8rem; }
.checkbox-group label { display: flex; align-items: flex-start; gap: 0.6rem; font-weight: normal; cursor: pointer; }
.checkbox-group label input[type="checkbox"] { flex-shrink: 0; margin-top: 3px; width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.checkbox-group label span { font-size: 0.88rem; line-height: 1.6; color: var(--text-muted); }
.error-msg { color: var(--danger); background: rgba(231,76,60,0.1); padding: 12px; border-radius: 8px; }
.hidden { display: none !important; }

/* ================================
   Auth
================================ */
.auth-container {
  max-width: 440px;
  margin: 4rem auto;
  padding: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.auth-container h1 { margin-bottom: 2rem; font-size: 1.5rem; }
.auth-form { display: flex; flex-direction: column; gap: 1.25rem; }
.auth-switch { text-align: center; margin-top: 1.5rem; color: var(--text-muted); }
.auth-divider { display: flex; align-items: center; gap: 0.75rem; margin: 1rem 0; color: var(--text-muted); font-size: 0.875rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.success-msg { color: #27ae60; background: rgba(39,174,96,0.1); padding: 12px; border-radius: 8px; margin-bottom: 1rem; }
.forgot-password-link { text-align: center; margin-top: 0.75rem; font-size: 0.875rem; }
.auth-desc { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.9rem; }

/* ================================
   Result
================================ */
.result-hero {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card2) 100%);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.probability-display {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.prob-label { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.prob-value {
  font-size: 3rem;
  font-weight: 800;
  color: var(--accent);
}
.prob-value--large { font-size: 4rem; }
.recommendation { display: flex; flex-direction: column; }
.rec-label { font-size: 0.85rem; color: var(--text-muted); }
.rec-value { font-size: 1.5rem; font-weight: 700; }
.result-section { margin-bottom: 2.5rem; }
.result-section h2 { margin-bottom: 1rem; font-size: 1.25rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
.factor-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.factor-list li {
  padding: 10px 16px;
  background: var(--bg-card);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}
.factor-list--warning li { border-left-color: var(--warning); }
.methods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.method-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}
.method-card h3 { margin-bottom: 0.75rem; font-size: 1rem; color: var(--accent); }
.tree-container { background: var(--bg-card2); border-radius: var(--radius); padding: 1.5rem; min-height: 200px; overflow-x: auto; }
.result-subtitle { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 1rem; }

/* Narrative（Markdownレンダリング結果）*/
.narrative-body { line-height: 2; font-size: 0.95rem; color: rgba(232,232,240,0.88); }
.narrative-body h2 { font-size: 1rem; font-weight: 700; color: var(--text); margin: 1.75rem 0 0.5rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--border); }
.narrative-body h3 { font-size: 0.95rem; font-weight: 700; color: var(--accent); margin: 1.25rem 0 0.4rem; }
.narrative-body p { margin-bottom: 0.75rem; }
.narrative-body ul, .narrative-body ol { padding-left: 1.4rem; margin-bottom: 0.75rem; display: flex; flex-direction: column; gap: 0.35rem; }
.narrative-body li { line-height: 1.85; }
.narrative-body strong { color: var(--text); font-weight: 600; }
.result-area { margin-top: 2rem; }
.result-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; }
.result-actions { display: flex; gap: 1rem; justify-content: center; margin-top: 2rem; }
.disclaimer { color: var(--text-muted); font-size: 0.8rem; margin-top: 2rem; text-align: center; }
.demo-upgrade-prompt {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}
.demo-upgrade-prompt p { margin-bottom: 1rem; color: var(--text-muted); }

/* ================================
   Pricing
================================ */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 1060px;
  margin: 2rem auto;
}
@media (max-width: 768px) {
  .pricing-grid { grid-template-columns: 1fr; }
}
.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  position: relative;
}
.pricing-card--featured { border-color: var(--primary); }
.badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  padding: 4px 16px;
  border-radius: 20px;
}
.price { font-size: 2.5rem; font-weight: 800; margin: 1rem 0; }
.price-unit { font-size: 1rem; font-weight: 400; color: var(--text-muted); }
.price-limit { color: var(--text-muted); margin-bottom: 1rem; }
.feature-list { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; margin: 1.5rem 0; }
.feature-list li::before { content: '✓ '; color: var(--accent); }
.success-banner, .notice-banner {
  padding: 1rem 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}
.success-banner { background: rgba(0,212,170,0.1); border: 1px solid var(--accent); color: var(--accent); }
.notice-banner { background: rgba(108,63,255,0.1); border: 1px solid var(--primary); color: var(--text-muted); }

/* ================================
   Mypage
================================ */
.mypage-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 2rem;
}
.mypage-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.mypage-row:last-child { border-bottom: none; }
.plan-badge {
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
}
.plan-badge--free     { background: var(--border); color: var(--text-muted); }
.plan-badge--standard { background: var(--primary); color: #fff; }
.plan-badge--premium  { background: var(--accent);  color: #000; }
.plan-badge--pro      { background: var(--primary); color: #fff; }
.history-section { margin-bottom: 2rem; }
.history-section h2 { margin-bottom: 1rem; }
.history-list { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.history-item a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  transition: border-color 0.2s;
  overflow: hidden;
}
.history-item a:hover { border-color: var(--primary); text-decoration: none; }
.history-date { color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; flex-shrink: 0; }
.history-option { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-prob { color: var(--accent); font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.empty-msg { color: var(--text-muted); }
.upgrade-prompt, .billing-actions { margin-bottom: 2rem; }

/* Period toggle */
.period-toggle {
  display: flex;
  justify-content: center;
  gap: 0;
  margin: 1.5rem auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: fit-content;
  overflow: hidden;
}
.toggle-btn {
  background: none;
  border: none;
  padding: 0.6rem 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.95rem;
  transition: background 0.2s, color 0.2s;
}
.toggle-btn.active {
  background: var(--primary);
  color: #fff;
}
.badge-save {
  display: inline-block;
  background: var(--accent);
  color: #000;
  font-size: 0.7rem;
  padding: 1px 8px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
}

/* Current plan label */
.current-plan-label {
  display: block;
  text-align: center;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: default;
}
.btn-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.upgrade-prompt p { margin-bottom: 1rem; color: var(--text-muted); }
.danger-zone { padding-top: 2rem; border-top: 1px solid var(--border); }
.delete-blocked-msg { font-size: 0.875rem; color: var(--text-muted); }

/* ================================
   Step panels & Loading
================================ */
.step-panel.hidden { display: none; }
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5rem 2rem;
  gap: 2rem;
}
.spinner {
  width: 56px;
  height: 56px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.subtitle { color: var(--text-muted); margin-bottom: 1.5rem; }

/* ================================
   Footer
================================ */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ================================
   Footer links
================================ */
.footer-links {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 0.75rem 0;
}
.footer-links a {
  color: var(--text-muted);
  font-size: 0.8rem;
}
.footer-links a:hover { color: var(--text); }

/* ================================
   Legal pages
================================ */
.legal-page {
  max-width: 860px;
}
.legal-page h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.legal-lead {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.75;
  margin-bottom: 2.5rem;
}
.legal-meta {
  color: var(--text-muted);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  margin-bottom: 0.2rem;
}
.legal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem 3.5rem;
  line-height: 2;
  font-size: 0.95rem;
  color: var(--text);
}
.legal-content h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 3rem 0 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.legal-content h2:first-child { margin-top: 0; }
.legal-content h3 {
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--accent);
  margin: 2rem 0 0.6rem;
  letter-spacing: 0.01em;
}
.legal-content p {
  margin-bottom: 1rem;
  color: rgba(232,232,240,0.88);
  line-height: 2;
}
.legal-content ul, .legal-content ol {
  padding-left: 1.6rem;
  margin: 0.5rem 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.legal-content li {
  color: rgba(232,232,240,0.85);
  line-height: 1.85;
  padding-left: 0.25rem;
}
.legal-content ol { list-style: decimal; }
.legal-content strong { color: var(--text); font-weight: 600; }
.legal-content a { color: var(--primary); }
.legal-content a:hover { text-decoration: underline; }

.legal-contact {
  margin-top: 3rem;
  padding: 1.75rem 2rem;
  background: var(--bg-card2);
  border-radius: 10px;
  border: 1px solid var(--border);
  line-height: 2;
}
.legal-contact h2 {
  font-size: 1rem;
  margin: 0 0 0.75rem;
  border-bottom: none;
  padding-bottom: 0;
}
.legal-contact p { margin-bottom: 0.4rem; }

.legal-back { margin-top: 2.5rem; }

/* Tokusho table */
.table-wrapper { overflow-x: auto; margin: 1.5rem 0; }
.legal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.legal-table th, .legal-table td {
  border: 1px solid var(--border);
  padding: 14px 18px;
  text-align: left;
  vertical-align: top;
  line-height: 1.85;
}
.legal-table th {
  background: var(--bg-card2);
  font-weight: 600;
  white-space: nowrap;
  width: 200px;
  color: var(--text);
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}
.legal-table td { color: rgba(232,232,240,0.88); }
.legal-table tr:nth-child(even) td { background: rgba(255,255,255,0.015); }

/* ================================
   FAQ Accordion
================================ */
.faq-section {
  margin-bottom: 2.5rem;
}
.faq-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 3rem 0 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.faq-section-title:first-child { margin-top: 0; }

.accordion {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.accordion-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.accordion-item.is-open {
  border-color: var(--primary);
}
.accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  background: var(--bg-card2);
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.6;
  transition: background 0.2s;
}
.accordion-trigger:hover { background: rgba(108,63,255,0.08); }
.accordion-item.is-open .accordion-trigger { background: rgba(108,63,255,0.1); }
.accordion-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: transform 0.25s, border-color 0.2s, color 0.2s;
}
.accordion-item.is-open .accordion-icon {
  transform: rotate(45deg);
  border-color: var(--primary);
  color: var(--primary);
}
.accordion-body {
  display: none;
  padding: 1.1rem 1.5rem 1.4rem;
  background: var(--bg-card);
  color: rgba(232,232,240,0.85);
  font-size: 0.92rem;
  line-height: 2;
  border-top: 1px solid var(--border);
}
.accordion-item.is-open .accordion-body { display: block; }

.faq-sep {
  margin-top: 3rem;
  padding: 1.75rem 2rem;
  text-align: center;
  background: var(--bg-card2);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.faq-sep p {
  margin-bottom: 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ================================
   Responsive
================================ */
@media (max-width: 640px) {
  .navbar { padding: 0 1rem; }
  .hamburger { display: flex; }
  .navbar-menu {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0.5rem 0 1rem;
    z-index: 99;
  }
  .navbar-menu.is-open { display: flex; }
  .navbar-menu .nav-link {
    width: 100%;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
  }
  .navbar-menu .btn {
    margin: 0.5rem 1.5rem 0;
    width: calc(100% - 3rem);
    text-align: center;
  }
  .navbar-menu .lang-switcher {
    margin: 0.75rem 1.5rem 0;
  }
  .hero { padding: 3rem 1rem; }
  .hero-cta { flex-direction: column; align-items: center; }
  .result-hero { flex-direction: column; align-items: flex-start; }

  /* Auth */
  .auth-container {
    margin: 1.5rem 1rem;
    padding: 1.75rem 1.25rem;
    border-radius: 10px;
  }
  .auth-container h1 { font-size: 1.25rem; margin-bottom: 1.5rem; }

  /* Page container */
  .page-container { padding: 1.5rem 0; }

  /* Legal pages */
  .legal-content {
    padding: 1.5rem 1.25rem;
  }
  .legal-content h2 { margin: 2rem 0 0.75rem; font-size: 1.05rem; }
  .legal-contact { padding: 1.25rem 1rem; }

  /* Tokusho table */
  .legal-table th { width: 120px; font-size: 0.8rem; padding: 10px 12px; }
  .legal-table td { font-size: 0.85rem; padding: 10px 12px; }

  /* Accordion */
  .accordion-trigger { font-size: 0.88rem; padding: 0.85rem 1rem; }
  .accordion-body { padding: 0.9rem 1rem 1.1rem; font-size: 0.88rem; }
  .faq-section-title { font-size: 1rem; }
  .faq-sep { padding: 1.25rem 1rem; }

  /* Chat UI */
  .choice-grid { grid-template-columns: 1fr 1fr; }
  .chat-bubble { padding: 0.75rem 1rem; }
}

/* ================================
   Chat / Conversation UI
================================ */
.chat-phase { max-width: 680px; margin: 0 auto; }
.chat-phase.hidden { display: none; }

/* Step indicator */
.chat-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 2rem;
}
.chat-step {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: bold;
  color: var(--text-muted);
  transition: all 0.3s;
}
.chat-step.active {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(108,63,255,0.12);
}
.chat-step.done {
  border-color: var(--accent);
  background: var(--accent);
  color: #000;
}
.chat-step-line {
  flex: 1;
  max-width: 80px;
  height: 2px;
  background: var(--border);
}

/* Chat bubbles */
.chat-history {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.chat-bubble {
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius);
  max-width: 88%;
}
.chat-bubble--user {
  background: rgba(108,63,255,0.15);
  border: 1px solid rgba(108,63,255,0.3);
  align-self: flex-end;
}
.chat-bubble--ai {
  background: var(--bg-card);
  border: 1px solid var(--border);
  align-self: flex-start;
}
.chat-label {
  display: block;
  font-size: 0.72rem;
  font-weight: bold;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.chat-bubble p { margin: 0; font-size: 0.95rem; }

/* Current question area */
.chat-current {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.chat-choice-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 1rem 0 0.6rem;
}

/* Choice buttons grid */
.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.choice-btn {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.65rem 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: center;
  line-height: 1.4;
}
.choice-btn:hover { border-color: var(--primary); background: rgba(108,63,255,0.08); }
.choice-btn.selected {
  border-color: var(--primary);
  background: rgba(108,63,255,0.2);
  color: #c9b8ff;
  font-weight: bold;
}

/* Usage limit banner */
.limit-banner {
  text-align: center;
  padding: 2.5rem 1.5rem;
  background: var(--bg-card);
  border: 1.5px solid var(--danger);
  border-radius: var(--radius);
}
.limit-banner__title {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--danger);
  margin-bottom: 0.6rem;
}
.limit-banner__desc {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* Chat reason input */
.chat-reason { margin-top: 1rem; }
.chat-reason-label {
  display: block;
  font-size: 0.88rem;
  color: var(--accent);
  font-weight: bold;
  margin-bottom: 0.4rem;
}

/* Inline form group (horizon selector) */
.form-group--inline {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.form-group--inline label { white-space: nowrap; margin-bottom: 0; }
.form-group--inline select { width: auto; }

/* ================================
   Narrative Streaming (SSE)
================================ */
.narrative-streaming-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.8rem 0;
}
.narrative-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: narrative-pulse 1.2s ease-in-out infinite;
}
.narrative-dot:nth-child(2) { animation-delay: 0.2s; }
.narrative-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes narrative-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}
.narrative-streaming-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: 0.4rem;
}
#narrative-body {
  transition: all 0.2s;
}
.narrative-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--primary);
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: cursor-blink 0.8s step-end infinite;
}
@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ================================
   Chat Typing Indicator
================================ */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
}
.chat-typing.hidden { display: none; }
.chat-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: chat-typing-bounce 1.2s ease-in-out infinite;
}
.chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes chat-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ================================
   Similar scenario note (Phase 3)
================================ */
.similar-count-note {
  text-align: center;
  font-size: 0.82rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

/* ================================
   Quantum Method Card (Phase 5)
================================ */
.method-card--quantum {
  border-color: rgba(0, 212, 170, 0.4);
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(0, 212, 170, 0.05) 100%);
}
.method-card--quantum h3::after {
  content: ' ⟨ψ⟩';
  font-size: 0.75em;
  color: var(--accent);
  font-weight: normal;
}
.quantum-interference {
  font-size: 0.82rem;
  color: var(--accent);
  margin-top: 0.25rem;
}

/* ================================
   World Line Tree Tabs (Phase 4)
================================ */
.tree-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.tree-tab-btn {
  padding: 0.4rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}
.tree-tab-btn:hover { border-color: var(--primary); color: var(--text); }
.tree-tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ================================
   Monte Carlo Distribution Chart
================================ */
.mc-chart-wrap {
  background: var(--bg-card2);
  border-radius: var(--radius);
  padding: 1.2rem;
  margin-top: 1rem;
}
.mc-percentile-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
}
.mc-percentile-track {
  flex: 1;
  height: 10px;
  background: var(--border);
  border-radius: 9999px;
  position: relative;
}
.mc-percentile-range {
  position: absolute;
  top: 0;
  height: 100%;
  background: var(--primary);
  border-radius: 9999px;
  min-width: 4px;
}
.mc-percentile-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.mc-percentile-caption {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  text-align: center;
}

/* ツリースケルトンローディング */
.tree-loading-indicator {
  padding: 24px 0;
}
.tree-skeleton-row {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 16px;
}
.tree-skeleton-branch {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tree-skeleton-node {
  width: 200px;
  height: 80px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--card-bg) 25%, var(--border-color) 50%, var(--card-bg) 75%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.6s ease-in-out infinite;
}
.tree-skeleton-node--sm {
  width: 160px;
  height: 64px;
}
.tree-loading-text {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 16px;
}
@keyframes skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
