/* ════════════════════════════════════════════════════════
   エゴグラム診断 — フロントエンドCSS
   デザイン: 深みのある紺×金＋各自我状態カラー
   ════════════════════════════════════════════════════════ */

:root {
  --ego-bg:        #0d1b2a;
  --ego-surface:   #132338;
  --ego-surface2:  #1a2f4a;
  --ego-gold:      #c8a84b;
  --ego-gold-lt:   #e8c870;
  --ego-text:      #e8eef4;
  --ego-text-muted:#8ca0b8;
  --ego-radius:    12px;
  --ego-shadow:    0 8px 32px rgba(0,0,0,.45);
  --ego-cp:        #e05c5c;
  --ego-np:        #5caa6e;
  --ego-a:         #4a90d9;
  --ego-fc:        #e0a030;
  --ego-ac:        #8b6abf;
}

/* ── ラップ ─────────────────────────────────────────────── */
.ego-wrap {
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  max-width: 680px;
  margin: 0 auto;
  color: var(--ego-text);
}

.ego-screen { display: none; }
.ego-screen.active { display: block; }

/* ── ボタン ─────────────────────────────────────────────── */
.ego-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 28px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s ease;
  letter-spacing: .03em;
}
.ego-btn-primary {
  background: linear-gradient(135deg, var(--ego-gold), var(--ego-gold-lt));
  color: #0d1b2a;
  box-shadow: 0 4px 16px rgba(200,168,75,.35);
}
.ego-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(200,168,75,.5); }
.ego-btn-secondary {
  background: var(--ego-surface2);
  color: var(--ego-gold);
  border: 1.5px solid var(--ego-gold);
}
.ego-btn-secondary:hover { background: var(--ego-gold); color: #0d1b2a; }
.ego-btn-ghost {
  background: transparent;
  color: var(--ego-text-muted);
  border: 1.5px solid var(--ego-surface2);
}
.ego-btn-ghost:hover { color: var(--ego-text); border-color: var(--ego-text-muted); }

/* ══ STEP 1: イントロ ════════════════════════════════════ */
.ego-intro-inner {
  background: var(--ego-surface);
  border-radius: 20px;
  padding: 48px 40px;
  text-align: center;
  box-shadow: var(--ego-shadow);
  border: 1px solid rgba(200,168,75,.18);
}
.ego-intro-badge {
  display: inline-block;
  background: rgba(200,168,75,.12);
  color: var(--ego-gold);
  border: 1px solid rgba(200,168,75,.3);
  border-radius: 100px;
  padding: 5px 18px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.ego-intro-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 14px;
  color: var(--ego-text);
}
.ego-intro-title span {
  background: linear-gradient(90deg, var(--ego-gold), var(--ego-gold-lt));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ego-intro-sub {
  color: var(--ego-text-muted);
  line-height: 1.8;
  margin: 0 0 28px;
  font-size: .92rem;
}
.ego-cats-preview {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.ego-cat-badge {
  padding: 5px 14px;
  border-radius: 100px;
  font-size: .8rem;
  font-weight: 700;
  background: rgba(255,255,255,.06);
  border: 1.5px solid var(--cat-color);
  color: var(--cat-color);
}
.ego-guest-box {
  margin: 0 0 24px;
}
.ego-guest-box label {
  display: block;
  font-size: .8rem;
  color: var(--ego-text-muted);
  margin-bottom: 8px;
}
.ego-guest-box input {
  background: var(--ego-bg);
  border: 1.5px solid var(--ego-surface2);
  border-radius: 8px;
  color: var(--ego-text);
  padding: 10px 16px;
  font-size: .95rem;
  width: 260px;
  max-width: 100%;
  outline: none;
  transition: border-color .2s;
}
.ego-guest-box input:focus { border-color: var(--ego-gold); }
.ego-logged-user {
  font-size: .85rem;
  color: var(--ego-text-muted);
  margin-bottom: 20px;
}
.ego-logged-user strong { color: var(--ego-gold); }

/* ══ STEP 2: 設問 ════════════════════════════════════════ */
.ego-quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.ego-progress-wrap {
  flex: 1;
}
.ego-progress-bar {
  height: 5px;
  background: var(--ego-surface2);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 6px;
}
.ego-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ego-gold), var(--ego-gold-lt));
  border-radius: 100px;
  transition: width .3s ease;
  width: 2%;
}
.ego-progress-label {
  font-size: .78rem;
  color: var(--ego-text-muted);
}
.ego-cat-indicator {
  font-size: .78rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 100px;
  margin-left: 16px;
  border: 1.5px solid currentColor;
}

.ego-question-card {
  background: var(--ego-surface);
  border-radius: var(--ego-radius);
  padding: 32px 28px;
  box-shadow: var(--ego-shadow);
  border: 1px solid var(--ego-surface2);
  margin-bottom: 20px;
  animation: ego-fadein .22s ease;
}
@keyframes ego-fadein { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

.ego-q-num {
  font-size: .78rem;
  font-weight: 700;
  color: var(--ego-gold);
  letter-spacing: .1em;
  margin: 0 0 10px;
}
.ego-q-text {
  font-size: 1.05rem;
  line-height: 1.7;
  font-weight: 500;
  margin: 0 0 24px;
}

.ego-choices {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.ego-choice {
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--ego-bg);
  border: 1.5px solid var(--ego-surface2);
  border-radius: 9px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all .15s ease;
  text-align: left;
  color: var(--ego-text);
  font-size: .9rem;
  width: 100%;
}
.ego-choice:hover {
  border-color: var(--ego-gold);
  background: rgba(200,168,75,.08);
}
.ego-choice.selected {
  border-color: var(--ego-gold);
  background: rgba(200,168,75,.15);
}
.ego-choice-dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--ego-surface2);
  flex-shrink: 0;
  transition: all .15s;
}
.ego-choice.selected .ego-choice-dot {
  background: var(--ego-gold);
  border-color: var(--ego-gold);
  box-shadow: 0 0 0 3px rgba(200,168,75,.25);
}

.ego-quiz-nav {
  display: flex;
  align-items: center;
}

/* ══ STEP 3: 結果 ════════════════════════════════════════ */
.ego-result-inner {
  background: var(--ego-surface);
  border-radius: 20px;
  padding: 40px 32px;
  box-shadow: var(--ego-shadow);
  border: 1px solid rgba(200,168,75,.18);
}
.ego-result-header {
  text-align: center;
  margin-bottom: 30px;
}
.ego-result-header h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 6px;
  color: var(--ego-gold);
}
.ego-result-date {
  font-size: .8rem;
  color: var(--ego-text-muted);
  margin: 0;
}

/* チャートラッパー */
.ego-chart-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}
.ego-chart-wrap canvas {
  max-width: 300px;
  max-height: 300px;
}

/* バー */
.ego-bars {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-bottom: 30px;
}
.ego-bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 34px;
  align-items: center;
  gap: 10px;
}
.ego-bar-label {
  font-size: .8rem;
  font-weight: 700;
  text-align: right;
}
.ego-bar-track {
  height: 14px;
  background: var(--ego-bg);
  border-radius: 100px;
  overflow: hidden;
}
.ego-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.ego-bar-val {
  font-size: .82rem;
  font-weight: 700;
  text-align: right;
  color: var(--ego-text-muted);
}

/* 説明カード */
.ego-desc-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}
.ego-desc-card {
  border-left: 4px solid var(--card-color);
  background: var(--ego-bg);
  border-radius: 0 8px 8px 0;
  padding: 13px 16px;
}
.ego-desc-card-title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--card-color);
  margin-bottom: 5px;
}
.ego-desc-card-text {
  font-size: .82rem;
  color: var(--ego-text-muted);
  line-height: 1.6;
  margin: 0;
}

/* 総評 */
.ego-summary-box {
  background: rgba(200,168,75,.09);
  border: 1px solid rgba(200,168,75,.3);
  border-radius: 10px;
  padding: 18px 20px;
  font-size: .88rem;
  line-height: 1.75;
  color: var(--ego-text);
  margin-bottom: 28px;
}
.ego-summary-box strong { color: var(--ego-gold); }

.ego-result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ══ STEP 4: 履歴 ════════════════════════════════════════ */
.ego-history-inner {
  background: var(--ego-surface);
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: var(--ego-shadow);
}
.ego-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.ego-history-header h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
}
.ego-history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ego-history-item {
  background: var(--ego-bg);
  border-radius: 10px;
  padding: 16px 18px;
  border: 1px solid var(--ego-surface2);
}
.ego-history-item-date {
  font-size: .78rem;
  color: var(--ego-text-muted);
  margin-bottom: 10px;
}
.ego-history-mini-bars {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  height: 40px;
}
.ego-mini-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
}
.ego-mini-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  transition: height .4s ease;
}
.ego-mini-bar-label {
  font-size: .65rem;
  font-weight: 700;
  color: var(--ego-text-muted);
}

.ego-no-history {
  text-align: center;
  color: var(--ego-text-muted);
  padding: 32px;
  font-size: .9rem;
}
.ego-loading { text-align: center; color: var(--ego-text-muted); padding: 24px; }

/* レスポンシブ */
@media (max-width: 540px) {
  .ego-intro-inner,
  .ego-result-inner,
  .ego-history-inner { padding: 28px 18px; }
  .ego-question-card { padding: 22px 16px; }
  .ego-intro-title { font-size: 1.55rem; }
  .ego-bar-row { grid-template-columns: 70px 1fr 28px; }
}
