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

:root {
    --primary-color: #2563eb;
    --success-color: #10b981;
    --failure-color: #ef4444;
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-color);
}

.app-shell {
    width: 100%;
    margin: 0 auto;
}

.screen {
    display: none;
    width: 100%;
    max-width: 100%;
    animation: fadeIn 0.5s ease;
}

/* 結果画面の外枠 */
.result-frame {
    width: 100%;
    margin: 0 auto;
}

/* タッチ端末（スマホ/タブレット）は幅いっぱい */
@media (hover: none), (pointer: coarse) {
    .app-shell {
        max-width: 100%;
    }
}

/* PC系入力デバイスでは全体幅を絞る */
@media (hover: hover) and (pointer: fine) {
    .app-shell {
        max-width: 480px;
    }
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    background: white;
    border-radius: 20px;
    padding: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-align: center;
    color: var(--primary-color);
}

h2 {
    font-size: 1.4rem;
    margin-bottom: 10px;
    text-align: center;
    color: var(--text-color);
}

h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--text-color);
}

.description {
    text-align: center;
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 30px;
    color: #64748b;
}

.info-box {
    background: var(--bg-color);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    border: 2px solid var(--border-color);
}

.info-box ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.info-box li {
    margin: 10px 0;
    line-height: 1.6;
}

.note {
    color: #64748b;
    font-size: 0.9rem;
    margin-top: 10px;
}

/* 年代選択 */
.age-selection {
    margin: 30px 0;
}

.age-selection h3 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--text-color);
}

.age-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.age-btn {
    padding: 20px 15px;
    font-size: 1rem;
    font-weight: 600;
    border: 3px solid var(--border-color);
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-color);
}

.age-btn:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
    transform: translateY(-2px);
}

.age-btn.selected {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}


.question-title {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--text-color);
}

/* プログレスバー */
.progress-bar {
    background: var(--bg-color);
    border-radius: 10px;
    height: 40px;
    position: relative;
    margin-bottom: 30px;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, var(--primary-color), #3b82f6);
    height: 100%;
    width: 0%;
    transition: width 0.5s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    color: var(--text-color);
    z-index: 1;
}

/* 画像コンテナ */
.image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 12px 0;
}

.image-container img {
    width: 100%;          
    max-width: 420px;     /* PC時の上限 */
    height: auto;         /* アスペクト比維持 */
    aspect-ratio: 1 / 1;  /* 正方形強制 */
    object-fit: cover;
    image-rendering: auto;
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.tutorial-step .image-container img {
    width: 100%;      /* 親ボックスの幅に依存 */
    max-width: 100%;
}

/* 人物情報 */
.person-info {
    text-align: center;
    margin: 10px 0;
}

.person-name {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.works {
    background: var(--bg-color);
    border-radius: 10px;
    padding: 10px;
    font-size: 1rem;
    line-height: 1.4;
    text-align: left;
    color: #475569;
}

/* ボタン */
.button-group {
    display: flex;
    gap: 15px;
    flex-wrap: nowrap;
        margin: 15px 0;
}

.button-group .btn {
    flex: 1;
    padding: 15px 10px;
    min-width: 0;
}

.btn {
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    min-width: 200px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-yes {
    background: var(--success-color);
    color: white;
}

.btn-yes:hover {
    background: #059669;
}

.btn-no {
    background: var(--failure-color);
    color: white;
}

.btn-no:hover {
    background: #dc2626;
}

/* 結果画面 */
.result-summary {
    display: flex;
    flex-wrap: nowrap;          /* 段落ち禁止 */
    gap: 12px;
    margin: 15px 0;
}

.result-card {
    background: white;
    width: 30%;
    border-radius: 12px;
    box-sizing: border-box;
    padding: 20px;
    text-align: center;
    border: 2px solid #333;   /* 黒枠 */
}
.result-card.success,
.result-card.failure,
.result-card.rate {
    border-color: #333;
    background: white;
}
.result-label {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 10px;
}

.result-value {
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--text-color);
}

/* カテゴリ別詳細 */
.category-details {
    margin: 40px 0;
    padding: 25px;
    background: var(--bg-color);
    border-radius: 12px;
    border: 2px solid var(--border-color);
}

.category-details h3 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.category-card {
    background: white;
    border-radius: 10px;
    padding: 20px 15px;
    text-align: center;
    border: 2px solid var(--border-color);
    transition: transform 0.2s ease;
}

.category-card:hover {
    transform: translateY(-2px);
}

.category-card.highlight {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}

.category-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 10px;
}

.category-desc {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: normal;
}

.category-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.result-note {
    background: #fef3c7;
    border: 2px solid #fbbf24;
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
    color: #92400e;
    text-align: center;
}

.result-message {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin: 20px 0;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

#attention {
    margin: 24px 0 28px;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}



.flag-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.flag-section h4 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.flag-message {
    margin: 10px 0;
    padding-left: 15px;
    color: #475569;
}

/* レスポンシブ */
@media (max-width: 640px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.2rem;
    }
    
    .btn {
        min-width: 150px;
        padding: 12px 30px;
        font-size: 1rem;
    }
    
    .result-value {
        font-size: 2rem;
    }
    
    .category-value {
        font-size: 1.5rem;
    }
}
/* グラフコンテナ */
.chart-container {
    position: relative;
    background-color: #ffffff;   /* ← 追加：青・紫を上書き */
    border-radius: 8px;           /* ← 任意：見た目を整える */
    padding: 8px;                 /* ← 任意 */
    width: 100%;
    height: 400px;
    margin-top: 10px;  /* canvasのmargin-topをこちらへ移動 */

}

/* canvas本体 */
#scatterChart {
  background-color: #ffffff;
  display: block;
  width: 100%;
  height: 100%;
}

/* スマホ対応 */
@media (max-width: 600px) {
    .chart-container {
        height: 280px;
    }
}
/* チュートリアル画面 */
#tutorialScreen .container {
    max-width: 1040px;
}

#tutorialScreen .tutorial-step {
    margin: 20px -10px;
    padding: 20px 14px;
}

#tutorialScreen .tutorial-step .image-container {
    margin: 12px -6px;
}

#tutorialScreen .tutorial-step .image-container img {
    width: 100%;
    max-width: 100%;
}

.tutorial-flow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 16px 0 8px;
    color: #64748b;
}

.tutorial-flow .flow-label {
    font-size: 0.8rem;
    letter-spacing: 0.04em;
}

.tutorial-flow .flow-arrow {
    font-size: 1.1rem;
    line-height: 1;
}

.tutorial-step {
    margin: 20px 0;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 12px;
    border: 2px solid var(--border-color);
}

.step-badge {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 10px;
}

.tutorial-choice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 12px 0;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.choice-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}
#skipTutorialCheck {
    width: 30px;
    height: 30px;
    cursor: pointer;
    vertical-align: middle;
    margin-right: 8px;
}
/* 正解画面専用ボタン */
#threeChoices,
#twoChoices {
    display: flex;
    gap: 8px;
    width: 100%;
}

#threeChoices .btn,
#twoChoices .btn {
    flex: 1;
    min-width: 0;
    padding: 15px 8px;
    font-size: 1rem;
}

#mistakenBtn {
    flex: 0.7;
    font-size: 0.85rem;
    padding: 15px 4px;
}

    .btn-answer-yes {
        background: var(--success-color);
        color: white;
        border: none;
    }
    .btn-answer-yes:hover {
        background: #059669;
    }

    .btn-answer-mid {
        background: #64748b;
        color: white;
        border: none;
    }
    .btn-answer-mid:hover {
        background: #475569;
    }

    .btn-answer-no {
        background: var(--failure-color);
        color: white;
        border: none;
    }
    .btn-answer-no:hover {
        background: #dc2626;
    }

.tweet-btn-wrapper {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin: 20px 0;
    line-height: 1.8;
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.tweet-btn-wrapper a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  background-color: #000;
  color: #fff;
  text-decoration: none;
  font-size: 0.8em;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  border-radius: 9999px; /* 完全なラウンド */
  border: 1px solid #000;
  transition: all 0.2s ease;
  margin-right: 8px;
}
.tweet-btn-wrapper p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.7;
}

/* ホバー */
.tweet-btn-wrapper a:hover {
  background-color: #111;
  border-color: #333;
}

/* クリック時 */
.tweet-btn-wrapper a:active {
  background-color: #222;
  transform: scale(0.97);
}

/* フォーカス（アクセシビリティ） */
.tweet-btn-wrapper a:focus {
  outline: 2px solid #1d9bf0; /* Xのアクセントカラー */
  outline-offset: 2px;
}

/* チュートリアル開始ボタンのみ、上下に厚みを追加 */
#tutorialStartBtn {
  padding: 18px 40px;
}

@media (max-width: 640px) {
  #tutorialStartBtn {
    padding: 15px 30px;
  }
}

.chart-help {
  text-align: right;
  margin: 8px 0 16px;
}

.chart-help-btn {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #64748b;
  border-radius: 9999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
}

.chart-help-btn:hover {
  background: #f8fafc;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  z-index: 999;
  padding: 16px;
}

.modal-overlay.is-open {
  display: flex;
}

.modal-content {
  position: relative;
  width: min(80vw, 920px);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.modal-content h3 {
  margin-bottom: 12px;
  text-align: center;
  color: #334155;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.graph-info-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}
