:root {
  color-scheme: light;
  --ink: #1b2027;
  --muted: #5c6672;
  --line: #dde2e8;
  --paper: #f6f4ee;
  --paper-2: #efece3;
  --surface: #ffffff;
  --accent: #0f7a6f;
  --accent-dark: #095e56;
  --accent-soft: #e3f1ee;
  --warn: #b94835;
  /* 3体のAIを見分けるための識別色 */
  --ai-a: #2f74c0;
  --ai-a-soft: #e9f1fb;
  --ai-b: #a96f0c;
  --ai-b-soft: #f8efd9;
  --ai-c: #7c4bc0;
  --ai-c-soft: #f0eafb;
  --blue: #2768a5;
  --gold: #8b6508;
  --green-soft: #e6f4f1;
  --blue-soft: #e8f1fb;
  --gold-soft: #fff3cc;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 40, .04), 0 6px 18px rgba(20, 30, 40, .06);
  --shadow-lg: 0 6px 16px rgba(20, 30, 40, .08), 0 20px 44px rgba(20, 30, 40, .10);
  font-family: "Zen Kaku Gothic New", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html { overflow-x: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden; /* .home-bg の左右ブリード(-40vw)が横スクロールを生むのを防ぐ */
  background: var(--paper);
  color: var(--ink);
}

button,
textarea,
a {
  font: inherit;
}

button,
.share-link,
.auth-cta {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 14px;
  min-height: 42px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

button:hover,
.share-link:hover,
.auth-cta:hover {
  border-color: var(--accent);
}

.auth-cta {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 800;
}

.auth-cta:hover {
  background: var(--accent-dark);
}

button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

button.primary:hover {
  background: var(--accent-dark);
}

.compact-button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.app {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.view {
  min-height: calc(100vh - 68px);
}

.hidden {
  display: none !important;
}

/* ===== TOP（1カラム刷新） ===== */
.home {
  position: relative;
  min-height: auto; /* .view の 100vh 強制を解除し、フッターをコンテンツ直後に */
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.home > * { position: relative; z-index: 1; }

/* 背景: teal の放射メッシュ＋微細グレイン（控えめに） */
.home-bg {
  position: absolute;
  inset: -40px -40vw -10% -40vw;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(15, 122, 111, .14), transparent 70%),
    radial-gradient(40% 40% at 88% 8%, rgba(124, 75, 192, .08), transparent 70%),
    radial-gradient(40% 40% at 10% 14%, rgba(47, 116, 192, .08), transparent 70%);
}
.home-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .5;
  background-image: radial-gradient(rgba(27, 32, 39, .05) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(70% 60% at 50% 8%, #000, transparent 75%);
          mask-image: radial-gradient(70% 60% at 50% 8%, #000, transparent 75%);
}

/* ヒーロー */
.hero { text-align: center; padding: 30px 4px 8px; animation: riseIn .6s cubic-bezier(.2,.7,.2,1) both; }
.hero .eyebrow {
  font-family: "Courier Prime", ui-monospace, monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin: 0 0 14px;
}
.hero-title {
  font-family: "M PLUS Rounded 1c", system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(48px, 11vw, 92px);
  line-height: .98;
  letter-spacing: -.01em;
  margin: 0;
  color: var(--ink);
}
.hero-title span { color: var(--accent); }
.hero .lead {
  font-family: "M PLUS Rounded 1c", system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(18px, 3.4vw, 24px);
  margin: 18px 0 6px;
  color: var(--ink);
}
.hero-desc { max-width: 46ch; margin: 0 auto; color: var(--muted); line-height: 1.95; }
.hero-desc em { font-style: normal; font-weight: 800; color: var(--warn); }

.home-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 24px; }
.home .home-actions .primary {
  font-family: "M PLUS Rounded 1c", system-ui, sans-serif;
  font-weight: 800;
  padding: 14px 26px;
  font-size: 16px;
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--accent-dark), var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
}
.home .home-actions .primary:hover { transform: translateY(2px); box-shadow: 0 2px 0 var(--accent-dark), var(--shadow); }
.home .home-actions button:not(.primary) {
  padding: 13px 22px;
  border-radius: 999px;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--line);
}
.home .home-actions button:not(.primary):hover { border-color: var(--accent); color: var(--accent-dark); }

/* 遊び方 */
.how {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 26px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
  animation: riseIn .6s cubic-bezier(.2,.7,.2,1) both .08s;
}
.ai-trio { display: flex; padding-left: 14px; }
.orb {
  position: relative;
  width: 60px; height: 60px;
  margin-left: -14px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: "M PLUS Rounded 1c", sans-serif;
  font-weight: 900; font-size: 22px; color: #fff;
  box-shadow: 0 6px 14px rgba(20,30,40,.18), inset 0 -3px 6px rgba(0,0,0,.12);
  border: 3px solid var(--surface);
}
.orb b { position: absolute; top: 9px; font-size: 8px; font-weight: 700; opacity: .85; letter-spacing: .1em; }
.orb-a { background: linear-gradient(160deg, #4a90d9, var(--ai-a)); }
.orb-b { background: linear-gradient(160deg, #c98a1e, var(--ai-b)); }
.orb-c { background: linear-gradient(160deg, #9a6ad6, var(--ai-c)); }
.orb-suspect { z-index: 2; transform: translateY(-4px) scale(1.08); animation: bob 2.6s ease-in-out infinite; }
.orb .tag {
  position: absolute; right: -6px; top: -6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--warn); color: #fff;
  font-size: 13px; font-weight: 900;
  display: grid; place-items: center;
  border: 2px solid var(--surface);
  box-shadow: 0 2px 6px rgba(185,72,53,.5);
}
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.steps li { display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--ink); font-size: 14.5px; }
.steps .num {
  flex: none;
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent-dark);
  font-family: "M PLUS Rounded 1c", sans-serif; font-weight: 900;
  display: grid; place-items: center; font-size: 14px;
}

/* カード（アカウント / 初回診断） */
.home .card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
  animation: riseIn .6s cubic-bezier(.2,.7,.2,1) both .14s;
}
.home .card.diag { animation-delay: .2s; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.kicker {
  font-family: "Courier Prime", ui-monospace, monospace;
  font-size: 11px; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.card-head strong { font-family: "M PLUS Rounded 1c", sans-serif; font-weight: 800; font-size: 18px; text-align: right; word-break: break-word; min-width: 0; }

/* ステータス（1カラム内のグリッド） */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  animation: riseIn .6s cubic-bezier(.2,.7,.2,1) both .26s;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  display: grid; gap: 6px;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent-soft); }
.stat strong { font-family: "M PLUS Rounded 1c", sans-serif; font-weight: 900; font-size: 30px; line-height: 1.05; color: var(--ink); }
/* 称号はテキスト値なので数値より小さく（折返し対策） */
#homeTitle { font-size: 18px; line-height: 1.3; }

@keyframes riseIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes bob { 0%,100% { transform: translateY(-4px) scale(1.08); } 50% { transform: translateY(-9px) scale(1.08); } }
@media (prefers-reduced-motion: reduce) {
  .hero, .how, .home .card, .stat-grid { animation: none; }
  .orb-suspect { animation: none; }
}
@media (max-width: 560px) {
  .how { grid-template-columns: 1fr; gap: 16px; justify-items: center; text-align: left; }
  .ai-trio { justify-content: center; }
  .hero { padding-top: 18px; }
}

.home-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 28px;
  align-items: center;
}

.home-copy h1 {
  margin: 0;
  font-size: clamp(42px, 8vw, 96px);
  line-height: 1;
  letter-spacing: 0;
}

.lead {
  font-size: 24px;
  font-weight: 700;
}

.home-copy p {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.8;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0;
}

.profile-panel,
.chat-shell,
.vote-choices,
.reason-box,
.result-grid section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.profile-panel {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.profile-panel div {
  display: grid;
  gap: 4px;
}

.label {
  color: var(--muted);
  font-size: 13px;
}

.profile-panel strong {
  font-size: 28px;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.auth-panel {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.auth-form {
  display: grid;
  gap: 8px;
}

.auth-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 40px;
}

/* サイトフッター（azaslab-website のレイアウトを踏襲） */
.site-footer {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.site-footer-inner {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
  display: grid;
  gap: 28px;
  grid-template-columns: 1fr auto;
  align-items: end;
}
.sf-tagline {
  margin: 0;
  font-family: "Noto Serif JP", serif;
  font-weight: 600;
  font-size: 24px;
  line-height: 1.4;
  color: var(--ink);
}
.sf-tagline span { color: var(--accent); }
.sf-desc {
  margin: 12px 0 0;
  max-width: 30em;
  font-size: 13px;
  line-height: 1.85;
  color: var(--muted);
}
.sf-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
.sf-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-family: "Courier Prime", ui-monospace, monospace;
  font-size: 12px;
  color: var(--muted);
}
.sf-links a {
  color: var(--muted);
  text-decoration: none;
}
.sf-links a:hover { color: var(--accent); }
.sf-copy {
  margin: 0;
  font-family: "Courier Prime", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--muted);
}
@media (max-width: 720px) {
  .site-footer-inner { grid-template-columns: 1fr; }
  .sf-right { align-items: flex-start; }
}

/* TOP のログイン導線：白カードなし・中央寄せ */
.account-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.account-cta #authStatus:empty { display: none; }
.account-cta #authStatus {
  font-family: "M PLUS Rounded 1c", sans-serif;
  font-weight: 800;
  font-size: 16px;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.account-cta .auth-cta,
.account-cta #logoutButton {
  min-height: 50px;
  padding: 12px 32px;
  font-size: 16px;
  border-radius: 12px;
}

#authMessage {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.diagnosis-panel {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.diagnosis-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.progress {
  width: 100%;
  height: 8px;
  background: #eef1f4;
  border-radius: 999px;
  overflow: hidden;
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
}

#profileHistory,
#profileSkills,
#profileTypes,
#profileScoreTrend,
#profileTrainingRecommendations,
#profileDailyMissions,
#skillList {
  line-height: 1.8;
  padding-left: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.topbar h2,
.vote-header h2 {
  margin: 0 0 6px;
  font-size: 32px;
  letter-spacing: 0;
}

.topbar p {
  margin-top: 0;
  color: var(--muted);
}

.meters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.meters span,
.tag-list span {
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--accent-dark);
  padding: 8px 10px;
  font-weight: 700;
}

.ai-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.ai-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  min-height: 210px;
}

.ai-card h3 {
  margin: 0 0 10px;
}

.ai-card p {
  margin: 0;
  line-height: 1.7;
}

.chat-shell {
  padding: 14px;
}

.message-log {
  display: grid;
  gap: 10px;
  max-height: 310px;
  overflow: auto;
  padding: 4px;
  margin-bottom: 12px;
}

.message {
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.6;
}

.message.user {
  background: var(--blue-soft);
}

.message.ai {
  background: #f3f5f7;
}

.message.coach {
  background: var(--gold-soft);
}

.message strong {
  display: block;
  margin-bottom: 4px;
}

.mention-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.question-form textarea,
.reason-box textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-height: 92px;
}

.form-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 10px;
}

.form-actions p {
  margin: 0 auto 0 0;
  color: var(--warn);
  font-weight: 700;
}

.vote-hint {
  margin: 0 0 4px;
  padding: 10px 12px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: var(--radius-sm);
  font-weight: 700;
}

#goVoteButton.emphasis {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  animation: votePulse 1.4s ease-in-out infinite;
}

@keyframes votePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(15, 122, 111, .35); }
  50% { box-shadow: 0 0 0 6px rgba(15, 122, 111, 0); }
}

.vote-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  margin: 16px 0;
}

.vote-choice {
  min-height: 64px;
  font-size: 18px;
  font-weight: 800;
}

.vote-choice.selected {
  border-color: var(--accent);
  background: var(--green-soft);
}

.reason-box {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.result-summary {
  background: var(--surface);
  border-left: 6px solid var(--accent);
  padding: 18px;
  margin-bottom: 16px;
}

.result-summary h2 {
  margin: 0 0 8px;
  font-size: 34px;
}

.result-summary p {
  margin: 6px 0;
}

/* ===== 結果ページ（ダッシュボード風に再設計） ===== */
.view.result { max-width: 760px; margin: 0 auto; }

.result-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  background: var(--surface); border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 18px; padding: 22px 24px; box-shadow: var(--shadow);
}
.result-hero.is-fail { border-top-color: #c0473a; }
.verdict-badge { display: inline-block; font-weight: 900; font-size: 22px; color: var(--accent-dark); }
.is-fail .verdict-badge { color: #c0473a; }
.verdict-sub { margin: 10px 0 0; color: var(--ink); font-size: 14px; line-height: 1.6; }
.verdict-sub strong { color: var(--accent-dark); }
.is-fail .verdict-sub strong { color: #c0473a; }
.verdict-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.verdict-chips .chip { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--paper-2); color: var(--muted); white-space: nowrap; }
.verdict-chips .chip strong { color: var(--ink); }
.verdict-chips .chip-up { background: var(--accent-soft); color: var(--accent-dark); }
.verdict-chips .chip-down { background: #f6e1dd; color: #c0473a; }

.result-score { position: relative; width: 120px; height: 120px; flex: none; }
.gauge { width: 120px; height: 120px; transform: rotate(-90deg); }
.gauge-track { fill: none; stroke: var(--line); stroke-width: 12; }
.gauge-value { fill: none; stroke: var(--accent); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset .9s cubic-bezier(.2,.7,.2,1); }
.is-fail .gauge-value { stroke: #c0473a; }
.gauge-num { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.gauge-num strong { font-size: 32px; line-height: 1; }
.gauge-num span { font-size: 12px; color: var(--muted); }

.result-block { margin-top: 18px; }
.result-kicker {
  font-family: "Courier Prime", ui-monospace, monospace;
  font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 8px;
}

.reveal, .feedback, .chip-rows {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 18px 20px;
}
.reveal-facts { display: flex; flex-wrap: wrap; gap: 10px; }
.reveal-fact { flex: 1 1 160px; background: var(--paper-2); border-radius: 12px; padding: 10px 12px; }
.reveal-fact span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.reveal-fact strong { font-size: 16px; }
.reveal-doc-link { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--accent-dark); text-decoration: none; }
.reveal-doc-link:hover { color: var(--accent); text-decoration: underline; }
.reveal-claim, .reveal-focus { margin: 14px 0 0; line-height: 1.7; }
.reveal-exp { margin: 12px 0 0; color: var(--ink); line-height: 1.85; }
.reveal-tag { display: inline-block; font-size: 11px; font-weight: 700; background: var(--accent-soft); color: var(--accent-dark); padding: 2px 8px; border-radius: 6px; margin-right: 8px; }

.feedback p { margin: 0 0 10px; line-height: 1.8; }
.feedback p:last-child { margin-bottom: 0; }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bars .bar { display: grid; grid-template-columns: minmax(7em, 10em) 1fr auto; align-items: center; gap: 12px; font-size: 13px; }
.bar-label { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 8px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.bar-neg .bar-fill { background: #d98a7e; }
.bars-accent .bar-fill { background: #5fa3c4; }
.bar-val { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent-dark); min-width: 2.6em; text-align: right; }
.bar-neg .bar-val { color: #c0473a; }
.bar-empty { list-style: none; color: var(--muted); font-size: 13px; }

.chip-rows { display: grid; gap: 14px; }
.chip-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.chip-row-label { font-size: 12px; color: var(--muted); min-width: 4.5em; }
.muted-chip { color: var(--muted); }

@media (max-width: 560px) {
  .result-hero { flex-direction: column-reverse; align-items: stretch; text-align: center; }
  .result-score { margin: 0 auto; }
  .verdict-chips { justify-content: center; }
  .bars .bar { grid-template-columns: 1fr auto; }
  .bars .bar-track { grid-column: 1 / -1; order: 3; }
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.history-item span {
  min-width: 0;
}

.training-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.training-row span {
  min-width: 0;
}

.score-trend,
.training-list,
.mission-list {
  display: grid;
  gap: 8px;
  list-style: none;
  padding-left: 0;
}

.score-trend li {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(80px, 1fr) 48px;
  gap: 8px;
  align-items: center;
}

.score-trend-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef1f4;
}

.score-trend-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.training-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.training-item span {
  min-width: 0;
}

.mission-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.mission-item span,
.mission-item small {
  color: var(--muted);
  font-size: 12px;
}

.mission-item.completed span {
  color: var(--accent-dark);
  font-weight: 800;
}

.period-reports {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.period-report {
  border-left: 4px solid var(--accent);
  padding-left: 12px;
}

.period-report h4 {
  margin: 0 0 8px;
}

.period-report small {
  color: var(--muted);
  margin-left: 6px;
}

.share-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--gold);
  background: linear-gradient(135deg, #fff, var(--gold-soft));
  padding: 16px;
}

.share-card-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.share-card-score {
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.result-grid section {
  padding: 16px;
}

.result-grid h3 {
  margin: 0 0 10px;
}

dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 12px;
}

dt {
  color: var(--muted);
  font-weight: 700;
}

dd {
  margin: 0;
}

#scoreList {
  padding-left: 20px;
  line-height: 1.7;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin: 14px 0;
}

.filter-bar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.filter-bar input,
.filter-bar select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 10px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-height: 94px;
  display: grid;
  align-content: space-between;
  gap: 10px;
}

.kpi-card strong {
  font-size: 28px;
  line-height: 1.1;
}

.wide-section {
  grid-column: 1 / -1;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
}

.class-join-form {
  display: flex;
  gap: 8px;
}

.class-join-form input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  text-transform: uppercase;
}

.custom-question-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.custom-question-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.custom-question-form input,
.custom-question-form select,
.custom-question-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
}

.full-width {
  grid-column: 1 / -1;
}

.class-name-input,
td select {
  width: min(180px, 100%);
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
}

@media (max-width: 820px) {
  .app {
    width: min(100% - 20px, 1160px);
    padding-top: 16px;
  }

  .home-view,
  .ai-grid,
  .vote-choices,
  .filter-bar {
    grid-template-columns: 1fr;
  }

  .result-grid,
  .custom-question-form {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: block;
  }

  .meters {
    justify-content: flex-start;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .period-reports {
    grid-template-columns: 1fr;
  }
}

.organization-admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.compact-admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.compact-admin-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.compact-admin-form input,
.compact-admin-form select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
}

@media (max-width: 760px) {
  .organization-admin-grid,
  .compact-admin-form {
    grid-template-columns: 1fr;
  }
}

.class-admin-form {
  grid-template-columns: minmax(180px, 2fr) minmax(180px, 1fr) minmax(120px, 1fr) auto minmax(80px, 1fr);
  margin-bottom: 14px;
}

@media (max-width: 760px) {
  .class-admin-form {
    grid-template-columns: 1fr;
  }
}

.invitation-admin-form {
  grid-template-columns: minmax(220px, 2fr) minmax(160px, 1fr) 100px auto minmax(80px, 1fr);
  margin-bottom: 14px;
}

@media (max-width: 760px) {
  .invitation-admin-form {
    grid-template-columns: 1fr;
  }
}

.bulk-invitation-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.bulk-invitation-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.bulk-invitation-form textarea,
.bulk-invitation-form input {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
}

.bulk-invitation-form .form-actions {
  grid-column: 1 / -1;
}

@media (max-width: 760px) {
  .bulk-invitation-form {
    grid-template-columns: 1fr;
  }
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.case-context {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

/* ============================================================
   UI refresh (v2) — 識別色・質感・読みやすさ
   ============================================================ */

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(1100px 560px at 88% -12%, var(--accent-soft), transparent 62%),
    var(--paper);
}

button,
.share-link {
  border-radius: var(--radius-sm);
  font-weight: 700;
  transition: transform .08s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease, color .15s ease;
}
button:hover,
.share-link:hover { box-shadow: var(--shadow); }
button:active { transform: translateY(1px); }
button.primary { box-shadow: 0 2px 10px rgba(15, 122, 111, .28); }

.profile-panel,
.chat-shell,
.vote-choices,
.reason-box,
.result-grid section,
.ai-card,
.kpi-card {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ヒーロー */
.home-copy h1 {
  font-weight: 900;
  letter-spacing: -0.01em;
}
.eyebrow {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: .03em;
}

/* ===== AIカード：話者ごとの識別色 ===== */
.ai-card {
  position: relative;
  overflow: hidden;
  padding-top: 18px;
  transition: transform .12s ease, box-shadow .15s ease;
}
.ai-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--muted);
}
.ai-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.ai-card h3 { display: flex; align-items: center; gap: 9px; font-size: 15px; }
.ai-avatar {
  display: inline-grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 9px;
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  line-height: 1;
  background: var(--muted);
}
.ai-card.speaker-a::before { background: var(--ai-a); }
.ai-card.speaker-b::before { background: var(--ai-b); }
.ai-card.speaker-c::before { background: var(--ai-c); }
.ai-card.speaker-a .ai-avatar { background: var(--ai-a); }
.ai-card.speaker-b .ai-avatar { background: var(--ai-b); }
.ai-card.speaker-c .ai-avatar { background: var(--ai-c); }

/* ===== チャット発言：話者ごとに左ボーダー＋淡い背景＋名前色 ===== */
.message.ai.speaker-a { background: var(--ai-a-soft); border-left: 3px solid var(--ai-a); }
.message.ai.speaker-b { background: var(--ai-b-soft); border-left: 3px solid var(--ai-b); }
.message.ai.speaker-c { background: var(--ai-c-soft); border-left: 3px solid var(--ai-c); }
.message.coach { border-left: 3px solid var(--gold); }
.message.user { border-left: 3px solid var(--blue); }
.message.ai.speaker-a strong { color: var(--ai-a); }
.message.ai.speaker-b strong { color: var(--ai-b); }
.message.ai.speaker-c strong { color: var(--ai-c); }
.message.coach strong { color: var(--gold); }
.message.user strong { color: var(--blue); }

/* ===== @メンションボタン：話者色 ===== */
.mention-row button[data-mention="@AI-A"] { color: var(--ai-a); border-color: color-mix(in srgb, var(--ai-a) 35%, var(--line)); }
.mention-row button[data-mention="@AI-B"] { color: var(--ai-b); border-color: color-mix(in srgb, var(--ai-b) 35%, var(--line)); }
.mention-row button[data-mention="@AI-C"] { color: var(--ai-c); border-color: color-mix(in srgb, var(--ai-c) 35%, var(--line)); }
.mention-row button[data-mention="@coach"] { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 35%, var(--line)); }
.mention-row button:hover { color: #fff; }
.mention-row button[data-mention="@AI-A"]:hover { background: var(--ai-a); border-color: var(--ai-a); }
.mention-row button[data-mention="@AI-B"]:hover { background: var(--ai-b); border-color: var(--ai-b); }
.mention-row button[data-mention="@AI-C"]:hover { background: var(--ai-c); border-color: var(--ai-c); }
.mention-row button[data-mention="@coach"]:hover { background: var(--gold); border-color: var(--gold); }

/* ===== 投票：話者色 ===== */
.vote-choice[data-vote="AI-A"].selected { background: var(--ai-a-soft); border-color: var(--ai-a); }
.vote-choice[data-vote="AI-B"].selected { background: var(--ai-b-soft); border-color: var(--ai-b); }
.vote-choice[data-vote="AI-C"].selected { background: var(--ai-c-soft); border-color: var(--ai-c); }

/* ===== メーター（残り回数）を見やすく ===== */
.meters span {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 13px;
}

/* 入力フォーカスリング */
textarea:focus,
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ゲーム画面：読みやすい幅に中央寄せ（縦の間延び対策） */
#caseContext,
.ai-grid,
.chat-shell { max-width: 940px; margin-inline: auto; }

/* 結果サマリー */
.result-summary {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: linear-gradient(135deg, var(--surface), var(--accent-soft));
}

/* ============================================================
   v3 ——「事件調書」テーマ / ハルシネーション・ハント
   クリーム紙 × 朱の検印(ゴム印) × タイプライター。AIは"供述者"。
   ============================================================ */
:root {
  --paper: #f0e9da;
  --paper-2: #e7ddc9;
  --ink: #211d15;
  --muted: #6c6353;
  --line: #d6cab2;
  --surface: #fbf7ec;
  --accent: #b22f24;        /* 朱（検印・赤ペン） */
  --accent-dark: #8c241b;
  --accent-soft: #f1dcd5;
  --warn: #b22f24;
  --blue: #2f5d86;
  --gold: #9a6b1e;
  --ai-a: #2f5d86;  --ai-a-soft: #e3ebf2;   /* 供述者A：藍 */
  --ai-b: #9a6b1e;  --ai-b-soft: #f1e6cd;   /* 供述者B：黄土 */
  --ai-c: #6a4a78;  --ai-c-soft: #ebe2f0;   /* 供述者C：葡萄 */
  --radius: 3px;
  --radius-sm: 2px;
  --shadow: 2px 3px 0 rgba(33, 29, 21, .08);
  --shadow-lg: 3px 5px 0 rgba(33, 29, 21, .12);
  --font-display: "M PLUS Rounded 1c", system-ui, sans-serif;
  --font-ui: "M PLUS Rounded 1c", system-ui, sans-serif;
  --font-mono: "Courier Prime", ui-monospace, SFMono-Regular, monospace;
  font-family: var(--font-ui);
}

/* 紙の質感：罫線＋朱のかすみ＋粒状グレイン */
body {
  background:
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(120, 100, 70, .045) 31px 32px),
    radial-gradient(1100px 560px at 88% -12%, rgba(178, 47, 36, .05), transparent 62%),
    var(--paper);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: .35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* 見出しはヴィンテージ明朝 */
.home-copy h1,
.topbar h2,
.vote-header h2,
.result-summary h2,
.result-grid h3 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: .015em;
}
.home-copy h1 {
  font-size: clamp(40px, 7.5vw, 88px);
  color: var(--ink);
  -webkit-text-fill-color: currentColor;
}
.lead { font-weight: 700; }

/* eyebrow ＝ 事件スタンプ風タグ（角ばった朱の枠・タイプライター） */
.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  background: transparent;
  border: 1.5px solid var(--accent);
  border-radius: 2px;
  padding: 3px 9px;
}

.label,
.meters span,
.kpi-card .label,
.ai-card h3,
.message strong {
  font-family: var(--font-mono);
  letter-spacing: .02em;
}

/* 角は鋭く＝紙ファイル。ボックスは押印シャドウ */
.profile-panel,
.chat-shell,
.vote-choices,
.reason-box,
.result-grid section,
.ai-card,
.kpi-card,
.case-context,
button,
.share-link,
.auth-form input,
.question-form textarea,
.reason-box textarea {
  border-radius: var(--radius);
}

/* プライマリ＝朱のゴム印（ハード offset シャドウ＝押した質感） */
button.primary {
  background: var(--accent);
  border-color: var(--accent-dark);
  color: #fff;
  box-shadow: 2px 2px 0 var(--accent-dark);
}
button.primary:hover { background: var(--accent-dark); box-shadow: 1px 1px 0 var(--accent-dark); transform: translateY(1px); }

/* ===== 供述者カード（調書） ===== */
.ai-card {
  background: var(--surface);
  box-shadow: var(--shadow);
  padding-top: 20px;
}
.ai-card::before { height: 6px; }
.ai-card::after {
  content: "供述";
  position: absolute;
  top: 12px; right: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .2em;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 2px;
}
.ai-card h3 { font-size: 14px; }
.ai-avatar {
  width: 30px; height: 30px;
  border-radius: 2px;
  font-family: var(--font-mono);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35);
}

/* ===== 尋問記録（チャット） ===== */
.message { border-radius: var(--radius); }
.message strong { font-size: 12px; letter-spacing: .08em; }
.chat-shell { background: var(--surface); }

/* メンション＝指名チップ */
.mention-row button { font-family: var(--font-mono); font-weight: 700; }

/* メーター（残り回数）＝符号タグ */
.meters span {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 2px;
}

/* 投票＝容疑者の指名 */
.vote-choice { font-family: var(--font-display); border-radius: var(--radius); }
.vote-choice.selected { box-shadow: inset 0 0 0 3px var(--accent), var(--shadow); }

/* 結果＝朱の「判定」検印 */
.result-summary {
  position: relative;
  border-left: 6px solid var(--accent);
  background: linear-gradient(135deg, var(--surface), var(--accent-soft));
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}
.result-summary::after {
  content: "判 定";
  position: absolute;
  top: 16px; right: 18px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .15em;
  color: var(--accent);
  border: 3px double var(--accent);
  border-radius: 6px;
  padding: 6px 12px;
  transform: rotate(-9deg);
  opacity: .85;
}

/* フォーカスは朱の検印リング */
textarea:focus,
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ============================================================
   v4 —— 成長レポート ダッシュボード & 依存なしチャート
   ============================================================ */
/* Rounded 1c は見出しを太く */
.home-copy h1,
.topbar h2,
.vote-header h2,
.result-summary h2,
.result-grid h3,
.lead { font-weight: 800; }

/* KPI ヒーロー */
.kpi-hero {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi-stat {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  display: grid;
  gap: 5px;
  align-content: start;
  overflow: hidden;
}
.kpi-stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--line); }
.kpi-stat.kpi-accent::before { background: var(--accent); }
.kpi-stat:nth-child(2)::before { background: var(--ai-a); }
.kpi-stat:nth-child(3)::before { background: var(--ai-c); }
.kpi-stat:nth-child(4)::before { background: var(--ai-b); }
.kpi-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.kpi-stat strong { font-family: var(--font-display); font-size: 40px; font-weight: 800; line-height: 1; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.kpi-stat.is-down strong { color: var(--accent); }

/* ダッシュボード・グリッド（4列。チャートは見やすく配置） */
.dashboard-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.dashboard-grid > section { grid-column: span 2; }
.dashboard-grid > .card-wide,
.dashboard-grid > .wide-section { grid-column: 1 / -1; }
.dashboard-grid > section:has(#profileScoreTrend) { order: -3; }
.dashboard-grid > section:has(#profileSkills) { order: -2; }
.dashboard-grid > section:has(#profileTypes) { order: -2; }
.dashboard-grid > section:has(#profileDiagnosisGauge) { order: -1; }
.dashboard-grid > section:has(#profileRiskReduction) { order: -1; }
.card-chart { display: flex; flex-direction: column; }

@media (max-width: 920px) {
  .kpi-hero { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid > section,
  .dashboard-grid > .card-wide { grid-column: 1 / -1; }
}

/* チャート共通 */
.chart { margin-top: 8px; }
.chart-empty { color: var(--muted); font-size: 13px; padding: 22px 4px; text-align: center; }
.svg-chart { width: 100%; height: auto; display: block; }
.svg-chart .cg { stroke: var(--line); stroke-width: 1; fill: none; }
.svg-chart .ct { fill: var(--muted); font-size: 10px; font-family: var(--font-mono); }
.svg-chart .cline { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.svg-chart .carea { fill: var(--accent-soft); opacity: .7; stroke: none; }
.svg-chart .cdot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.svg-chart.radar .cradar { fill: color-mix(in srgb, var(--ai-a) 20%, transparent); stroke: var(--ai-a); stroke-width: 2; stroke-linejoin: round; }
.svg-chart.radar .cdot { stroke: var(--ai-a); }
.svg-chart.gauge { max-width: 190px; margin: 0 auto; }
.svg-chart .gtrack { fill: none; stroke: var(--paper-2); stroke-width: 12; }
.svg-chart .gval { fill: none; stroke: var(--accent); stroke-width: 12; stroke-linecap: round; }
.svg-chart .gnum { font-family: var(--font-display); font-weight: 800; font-size: 34px; fill: var(--ink); }
.svg-chart .gsub { font-family: var(--font-mono); font-size: 10px; fill: var(--muted); }

/* 横棒・分岐棒 */
.barset { display: grid; gap: 9px; margin-top: 4px; }
.bar-row { display: grid; grid-template-columns: 96px 1fr 58px; gap: 10px; align-items: center; }
.bar-label { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { position: relative; height: 12px; background: var(--paper-2); border-radius: 999px; }
.bar-fill { position: absolute; top: 0; bottom: 0; border-radius: 999px; }
.bar-track.center { overflow: visible; }
.bar-track.center .bar-axis { position: absolute; left: 50%; top: -4px; bottom: -4px; width: 1px; background: var(--muted); opacity: .5; }
.bar-val { font-family: var(--font-mono); font-size: 12px; font-weight: 700; text-align: right; }

/* チャート化したコンテナは旧リスト用の padding を解除 */
#profileScoreTrend.chart,
#profileSkills.chart,
#profileTypes.chart,
#profileRiskReduction.chart { padding-left: 0; line-height: 1.4; }

/* ============================================================
   v5 —— ニュートラル & ポップ + 進捗 + モーション
   （v3「事件調書」テイストを上書きして無効化）
   ============================================================ */
:root {
  --paper: #f2f5fb;
  --paper-2: #e9edf6;
  --ink: #1b2330;
  --muted: #69748a;
  --line: #e4e8f1;
  --surface: #ffffff;
  --accent: #10b3a3;
  --accent-dark: #0a8e82;
  --accent-soft: #d7f4f0;
  --warn: #ef5d62;
  --ai-a: #3b82f6;  --ai-a-soft: #e6efff;
  --ai-b: #f59e0b;  --ai-b-soft: #fdf0d8;
  --ai-c: #8b5cf6;  --ai-c-soft: #efe9fe;
  --blue: #3b82f6;
  --gold: #f59e0b;
  --good: #16a37b;
  --green-soft: #d7f4f0;
  --blue-soft: #e6efff;
  --gold-soft: #fdf0d8;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(28, 40, 64, .05), 0 10px 26px rgba(28, 40, 64, .08);
  --shadow-lg: 0 8px 18px rgba(28, 40, 64, .10), 0 26px 50px rgba(28, 40, 64, .14);
  --font-display: "M PLUS Rounded 1c", system-ui, sans-serif;
  --font-ui: "M PLUS Rounded 1c", system-ui, sans-serif;
  font-family: var(--font-ui);
}

/* 事件調書テイストの全廃 */
body::after { content: none !important; }
.ai-card::after { content: none !important; }
.result-summary::after { content: none !important; }
.case-context { background: var(--accent-soft); color: var(--accent-dark); border-left-color: var(--accent); }

body {
  background:
    radial-gradient(900px 520px at 8% -6%, color-mix(in srgb, var(--ai-a) 13%, transparent), transparent 60%),
    radial-gradient(820px 520px at 96% -2%, color-mix(in srgb, var(--ai-c) 12%, transparent), transparent 55%),
    var(--paper);
}

/* ラベル類はモノスペースをやめて丸ゴシックに（ニュートラル） */
.label, .kpi-label, .ai-card h3, .message strong, .meters span, .bar-label, .bar-val {
  font-family: var(--font-ui);
}

/* eyebrow＝ポップな色付きピル */
.eyebrow {
  display: inline-block;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .02em;
  text-transform: none;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border: 0;
  border-radius: 999px;
  padding: 5px 12px;
}

/* 角丸を大きく・影はやわらかく（ポップ） */
.profile-panel, .chat-shell, .vote-choices, .reason-box, .result-grid section,
.ai-card, .kpi-card, .kpi-stat, .case-context, .auth-form input,
.question-form textarea, .reason-box textarea { border-radius: var(--radius); }
button, .share-link { border-radius: var(--radius-sm); }
.profile-panel, .chat-shell, .vote-choices, .reason-box, .result-grid section,
.ai-card, .kpi-card, .kpi-stat { box-shadow: var(--shadow); }

/* プライマリ＝はっきり・押すと弾む */
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 0 var(--accent-dark);
  font-weight: 800;
}
button.primary:hover { background: var(--accent); box-shadow: 0 2px 0 var(--accent-dark); transform: translateY(2px); }
button.primary:active { transform: translateY(4px); box-shadow: 0 0 0 var(--accent-dark); }

.meters span { background: var(--surface); border: 1px solid var(--line); color: var(--ink); border-radius: 999px; box-shadow: var(--shadow); }

/* AIカードの上バーを太く・アバターは丸く */
.ai-card { border-radius: var(--radius); }
.ai-card::before { height: 6px; }
.ai-avatar { border-radius: 50%; box-shadow: none; }

/* ===== レベル進捗バー（主役の一つ） ===== */
.level-progress {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  margin-bottom: 16px;
}
.lp-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.lp-badge {
  font-weight: 900; font-size: 14px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--ai-c));
  padding: 5px 12px; border-radius: 999px;
}
.lp-title { font-weight: 800; font-size: 18px; }
.lp-next { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 700; }
.lp-bar { height: 16px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.lp-fill {
  display: block; height: 100%; width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--ai-a));
  transition: width 1.1s cubic-bezier(.2, .8, .2, 1);
}

/* ===== KPIカードをポップに（絵文字＋色） ===== */
.kpi-stat strong { color: var(--ink); }
.kpi-stat.kpi-accent strong { color: var(--accent-dark); }
.kpi-stat .kpi-label::before { margin-right: 6px; }
.kpi-stat:nth-child(1) .kpi-label::before { content: "🎯"; }
.kpi-stat:nth-child(2) .kpi-label::before { content: "⭐"; }
.kpi-stat:nth-child(3) .kpi-label::before { content: "📈"; }
.kpi-stat:nth-child(4) .kpi-label::before { content: "🔥"; }
.kpi-stat.is-down strong { color: var(--warn); }

/* ===== モーション ===== */
@keyframes growx { from { width: 0; } }
@keyframes risein { from { opacity: 0; transform: translateY(14px); } }
@keyframes gaugedraw { to { stroke-dashoffset: 0; } }
@keyframes linedraw { to { stroke-dashoffset: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.4); } }

.bar-fill { animation: growx .9s cubic-bezier(.2, .8, .2, 1) both; }
.svg-chart .gval { animation: gaugedraw 1.1s ease both; }
.svg-chart .cline { stroke-dasharray: 1; stroke-dashoffset: 1; animation: linedraw 1.2s ease .15s forwards; }
.svg-chart.radar .cradar { transform-origin: center; animation: pop .6s cubic-bezier(.2, .8, .2, 1) .15s both; }

.kpi-hero .kpi-stat, .level-progress, .dashboard-grid > section { animation: risein .55s cubic-bezier(.2, .8, .2, 1) both; }
.level-progress { animation-delay: .02s; }
.kpi-hero .kpi-stat:nth-child(1) { animation-delay: .06s; }
.kpi-hero .kpi-stat:nth-child(2) { animation-delay: .12s; }
.kpi-hero .kpi-stat:nth-child(3) { animation-delay: .18s; }
.kpi-hero .kpi-stat:nth-child(4) { animation-delay: .24s; }

/* ホバーで弾む */
.kpi-stat, .ai-card, .result-grid section { transition: transform .14s ease, box-shadow .18s ease; }
.kpi-stat:hover, .result-grid section:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

@media (prefers-reduced-motion: reduce) {
  .bar-fill, .svg-chart .gval, .svg-chart .cline, .svg-chart.radar .cradar,
  .kpi-hero .kpi-stat, .level-progress, .dashboard-grid > section { animation: none; }
  .lp-fill { transition: none; }
}

/* ============================================================
   v6 —— マイページ PC レイアウト再設計（12カラム）
   ============================================================ */
@media (min-width: 920px) {
  .dashboard-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
  }
  /* テキスト系セクションは既定 4/12（3列） */
  .dashboard-grid > section { grid-column: span 4; }
  .dashboard-grid > .wide-section { grid-column: 1 / -1; }

  /* 1段目: スコア推移(8) + 初回診断ゲージ(4) */
  .dashboard-grid > section:has(#profileScoreTrend) { grid-column: span 8; order: -5; }
  .dashboard-grid > section:has(#profileDiagnosisGauge) { grid-column: span 4; order: -5; }
  /* 2段目: スキル / タイプ別 / 思考クセ を3分割 */
  .dashboard-grid > section:has(#profileSkills) { grid-column: span 4; order: -4; }
  .dashboard-grid > section:has(#profileTypes) { grid-column: span 4; order: -4; }
  .dashboard-grid > section:has(#profileRiskReduction) { grid-column: span 4; order: -4; }
  /* 3段目以降: 成長レポート/弱点 などは広めに */
  .dashboard-grid > section:has(#profileGrowthReport) { grid-column: span 6; order: -3; }
  .dashboard-grid > section:has(#profileWeakness) { grid-column: span 6; order: -3; }

  /* チャート行の高さをそろえる */
  .dashboard-grid > section:has(#profileScoreTrend),
  .dashboard-grid > section:has(#profileDiagnosisGauge) { min-height: 300px; }
  .dashboard-grid > section:has(#profileSkills),
  .dashboard-grid > section:has(#profileTypes),
  .dashboard-grid > section:has(#profileRiskReduction) { min-height: 320px; }
}

/* チャートの高さ制御（間延び防止） */
.card-chart { justify-content: flex-start; }
.card-chart .chart { display: flex; align-items: center; justify-content: center; flex: 1; min-height: 0; }
.svg-chart { max-height: 250px; }
#profileScoreTrend .svg-chart { width: 100%; max-height: 230px; }
.svg-chart.radar { max-height: 250px; }
.svg-chart.gauge { max-height: 150px; }
.barset { width: 100%; align-self: center; }

/* タイプ別/思考クセはバーを縦中央に置かず上から */
.dashboard-grid > section:has(.barset) .chart { align-items: stretch; }
