:root {
  --a-bg: #FFE1DE;
  --a-fg: #B71C1C;
  --a-strong-1: #FF8A80;
  --a-strong-2: #E53935;
  --b-bg: #DCEBFF;
  --b-fg: #0D47A1;
  --b-strong-1: #64B5F6;
  --b-strong-2: #1E6FE0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', sans-serif;
  background: radial-gradient(circle at 10% 0%, #FFF6D8 0%, #FFF0F0 45%, #EAF3FF 100%);
  min-height: 100vh;
  color: #333;
}

.block-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 1.6rem 1rem 3rem 1rem;
}

.boot-loading {
  text-align: center;
  padding-top: 4rem;
  color: #888;
}

h1, h2, h3 { margin: 0; }
h1 { font-size: clamp(1.6rem, 5.5vw, 2.3rem); font-weight: 800; text-align: center; }
h2, h3 { font-weight: 800; }

@keyframes bounce { 0%,100%{transform: translateY(0);} 50%{transform: translateY(-8px);} }
.bounce { display:inline-block; animation: bounce 1.6s ease-in-out infinite; }

button {
  font-family: inherit;
}

.btn {
  width: 100%;
  min-height: 3.3rem;
  padding: 0.6rem 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 16px;
  border: none;
  margin-bottom: 0.55rem;
  transition: all 0.15s ease;
  box-shadow: 0 3px 0 rgba(0,0,0,0.08);
  cursor: pointer;
  background: #f0f0f0;
  color: #333;
  display: block;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 5px 0 rgba(0,0,0,0.1); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(0,0,0,0.08); }

.btn-primary {
  background: linear-gradient(135deg, #FF5B5B 0%, #FF3B3B 100%);
  color: white;
}

.btn-a { background: var(--a-bg); color: var(--a-fg) !important; }
.btn-a.btn-strong { background: linear-gradient(135deg, var(--a-strong-1), var(--a-strong-2)); color: #fff !important; }
.btn-b { background: var(--b-bg); color: var(--b-fg) !important; }
.btn-b.btn-strong { background: linear-gradient(135deg, var(--b-strong-1), var(--b-strong-2)); color: #fff !important; }

.btn-plain {
  background: transparent;
  box-shadow: none;
  color: #888;
  font-weight: 600;
  min-height: auto;
  padding: 0.4rem;
}
.btn-plain:hover { transform: none; box-shadow: none; text-decoration: underline; }

.hero {
  background: linear-gradient(135deg, #FFE8A3 0%, #FFD1DC 100%);
  border-radius: 26px;
  padding: 1.8rem 1.5rem;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  margin-bottom: 1.3rem;
  color: #5a2030;
}
.hero h1 { color: #5a2030; }
.hero p { color: #a15; font-weight: 600; }
.hero .chips { margin-top: 0.9rem; }
.chip {
  display: inline-block;
  background: rgba(255,255,255,0.75);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  margin: 0.2rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #a15;
}

.caption { color: #777; font-size: 0.85rem; text-align: center; margin-top: 0.8rem; }

.progress-wrap {
  background: #fff;
  border-radius: 999px;
  height: 14px;
  overflow: hidden;
  margin: 0.4rem 0 1rem 0;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.12);
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #FFCB05, #FF5B5B);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.progress-label { text-align: center; color: #999; font-weight: 700; margin-bottom: 0.6rem; }

.card {
  background: #fff;
  border-radius: 18px;
  padding: 1.15rem 1.3rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.chart-card-wide {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.quiz-instruction { text-align: center; color: #888; font-weight: 800; margin-bottom: 0.5rem; }

.side-a, .side-b { border-radius: 18px; padding: 1rem 1.1rem; margin-bottom: 0.7rem; }
.side-a { background: linear-gradient(135deg,#FFE3E3,#FFC9C9); }
.side-b { background: linear-gradient(135deg,#DCEBFF,#C7DFFF); }
.side-label { font-weight: 700; font-size: 1.02rem; line-height: 1.5; margin-bottom: 0.6rem; text-align: center; }
.ab-badge {
  display: inline-block;
  width: 1.6rem; height: 1.6rem; line-height: 1.6rem;
  border-radius: 50%; color: #fff; font-weight: 800; text-align: center; margin-right: 0.3rem;
}
.ab-badge-a { background: #E53935; }
.ab-badge-b { background: #1E6FE0; }
.battle-vs { text-align: center; font-weight: 800; color: #999; margin: 0.5rem 0; letter-spacing: 2px; }
.pick-hint { text-align: center; color: #999; font-weight: 700; margin: 0.9rem 0 0.5rem 0; }

.answer-cols { display: flex; gap: 0.8rem; }
.answer-col { flex: 1; }

.back-btn-wrap { margin-top: 0.4rem; }

.result-card {
  background: linear-gradient(160deg, #FFF7E0 0%, #FFE9EC 100%);
  border-radius: 26px;
  padding: 1.8rem 1.5rem;
  text-align: center;
  box-shadow: 0 6px 22px rgba(0,0,0,0.09);
  margin-bottom: 1.2rem;
  border: 3px solid #fff;
  color: #5a2030;
}
.result-card .eyebrow { font-size: 1rem; color: #a15; font-weight: 700; }
.result-card h2 { color: #5a2030; margin: 0.3rem 0; }
.result-card img { max-width: min(280px, 78vw); border-radius: 18px; box-shadow: 0 4px 14px rgba(0,0,0,0.15); }
.sync-badge {
  display: inline-block; margin-top: 0.8rem; background: #fff; color: #FF3B3B;
  font-weight: 800; padding: 0.4rem 1.1rem; border-radius: 999px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.personality-line { font-size: 1.05rem; font-weight: 700; color: #a13; text-align: center; }

.runner-up { text-align: center; padding: 0.7rem; background: #fafafa; border-radius: 14px; }
.runner-up img { width: 100%; max-width: 120px; border-radius: 12px; }
.runner-up .ru-name { font-weight: 700; color: #333; }
.runner-up .ru-sync { color: #777; font-size: 0.85rem; }
.runner-ups-grid { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.runner-ups-grid > div { flex: 1; min-width: 120px; }
.runner-up-header { font-weight: 700; }
.runner-up-sub { color: #777; font-size: 0.8rem; margin-bottom: 0.6rem; }

details.evidence-box { margin-top: 0.4rem; }
details.evidence-box summary {
  cursor: pointer; font-weight: 700; color: #333; padding: 0.3rem 0;
}
details.evidence-box .evidence-caption { color: #777; font-size: 0.85rem; margin-top: 0.4rem; }

.share-btn {
  display: block; width: 100%; text-align: center; text-decoration: none;
  background: #1DA1F2; color: #fff; font-weight: 700; padding: 0.8rem 1rem;
  border-radius: 16px; box-shadow: 0 3px 0 rgba(0,0,0,0.08); margin-bottom: 1rem;
}

canvas#radar-chart { max-width: 100%; }

textarea.feedback-input {
  width: 100%; min-height: 80px; border-radius: 12px; border: 1px solid #ddd;
  padding: 0.6rem 0.8rem; font-family: inherit; font-size: 0.95rem; resize: vertical;
}

.feedback-msg { margin-top: 0.5rem; font-weight: 700; }
.feedback-msg.ok { color: #2e7d32; }
.feedback-msg.warn { color: #b26a00; }

.error-box { background: #fff3f3; border: 1px solid #ffcdd2; color: #b71c1c; padding: 1rem; border-radius: 12px; }

@media (max-width: 480px) {
  .answer-cols { gap: 0.5rem; }
}

/* ---- モーダル ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; z-index: 1000;
}
.modal-box {
  background: #fff; border-radius: 20px; padding: 1.5rem;
  max-width: 480px; width: 100%; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.modal-box h3 { margin-bottom: 0.7rem; }
.modal-box p { line-height: 1.7; color: #444; margin: 0.5rem 0; }
.modal-close {
  display: block; margin: 1rem auto 0 auto; background: #f0f0f0;
  border: none; border-radius: 14px; padding: 0.6rem 1.4rem; font-weight: 700;
  cursor: pointer;
}
.note-link {
  display: block; text-align: center; color: #2E7D32; font-weight: 700;
  text-decoration: none; background: #E8F5E9; border-radius: 12px;
  padding: 0.7rem; margin-top: 0.7rem;
}
.note-link:hover { text-decoration: underline; }

.top-links {
  display: flex; justify-content: center; gap: 0.6rem; margin: 0.6rem 0 1rem 0;
  flex-wrap: wrap;
}
.link-chip {
  background: #fff; border: 1px solid #eee; border-radius: 999px;
  padding: 0.45rem 1rem; font-size: 0.85rem; font-weight: 700; color: #666;
  cursor: pointer; text-decoration: none;
}
.link-chip:hover { background: #f7f7f7; }

/* ---- 履歴 ---- */
.history-item {
  display: flex; align-items: center; gap: 0.8rem;
  background: #fff; border-radius: 16px; padding: 0.8rem 1rem; margin-bottom: 0.6rem;
  cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.history-item:hover { background: #fafafa; }
.history-item img { width: 56px; height: 56px; object-fit: contain; border-radius: 10px; background: #f5f5f5; }
.history-item .hi-main { flex: 1; min-width: 0; }
.history-item .hi-name { font-weight: 700; }
.history-item .hi-date { font-size: 0.78rem; color: #999; }
.history-item .hi-blurb { font-size: 0.82rem; color: #777; margin-top: 0.15rem; }
.history-empty { text-align: center; color: #999; padding: 2rem 1rem; }

/* ---- 保存ボタン ---- */
.save-btn {
  background: #fff; border: 1.5px solid #ddd; color: #444;
}
.save-note {
  text-align: center; font-size: 0.8rem; color: #999; margin: -0.3rem 0 0.8rem 0;
}

.chart-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 560px;
  min-height: 280px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
}
.chart-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.dev-credit {
  text-align: center;
  margin-top: 1.4rem;
  font-size: 0.78rem;
}
.dev-credit a {
  color: #aaa;
  text-decoration: none;
}
.dev-credit a:hover {
  color: #888;
  text-decoration: underline;
}

.legal-disclaimer {
  margin-top: 1.6rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
  color: #999;
  font-size: 0.72rem;
  line-height: 1.6;
}
.legal-disclaimer-title {
  font-weight: 700;
  color: #888;
  margin-bottom: 0.3rem;
}
.legal-disclaimer ul {
  margin: 0;
  padding-left: 1.1rem;
}
.legal-disclaimer li {
  margin-bottom: 0.3rem;
}
.legal-disclaimer a {
  color: #999;
  text-decoration: underline;
  word-break: break-all;
}
