/* 脳力偏差値チェッカー Web版 — 共通スタイル
   カラーはiOSアプリ(BrainScore) Theme.swiftのセマンティックカラーに準拠。
   絵文字は使用しない（全社ルール）。アイコンは assets/js/icons.js の線画SVG。 */

:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --card-border: #e4e7f0;
  --text: #1a1d28;
  --text-2: #6a7080;
  --accent: #5b21b6;
  --accent-blue: #2563eb;
  --good: #059669;
  --bad: #dc2626;
  --warn: #b45309;
  --on-fixed: #ffffff;
  --pop: #eab308; /* CTAの一押しに使う電光イエロー(彩度を落として上品に) */
  --grad: linear-gradient(135deg, #5b21b6 0%, #2563eb 100%);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 28px rgba(35, 30, 80, 0.10);
  --shadow-sm: 0 2px 10px rgba(35, 30, 80, 0.08);
  --maxw: 720px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101218;
    --card: #1c1f2a;
    --card-border: #2a2e3d;
    --text: #edeff6;
    --text-2: #9aa1b2;
    --accent: #a78bfa;
    --accent-blue: #60a5fa;
    --good: #34d399;
    --bad: #f87171;
    --warn: #fbbf24;
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.7;
  overscroll-behavior-y: none;
}
img { max-width: 100%; display: block; }
a { color: var(--accent-blue); }
button { font-family: inherit; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.wrap-wide { max-width: 920px; margin: 0 auto; padding: 0 20px; }

/* ── ヘッダー ─────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(244, 246, 251, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--card-border);
}
@media (prefers-color-scheme: dark) {
  .site-header { background: rgba(16, 18, 24, 0.86); }
}
.site-header .bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; max-width: var(--maxw); margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-weight: 800; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.brand span { font-size: 15px; }
.header-cta {
  font-size: 13px; font-weight: 700; color: #fff; background: var(--grad);
  padding: 8px 14px; border-radius: 999px; text-decoration: none; white-space: nowrap;
}

/* ── ヒーロー ─────────────────────────────── */
.hero {
  background: var(--grad);
  color: #fff;
  padding: 44px 20px 40px;
  text-align: center;
}
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
  background: rgba(255,255,255,0.16); padding: 6px 12px; border-radius: 999px;
  margin-bottom: 16px;
}
.hero h1 {
  font-size: clamp(26px, 6.4vw, 38px);
  font-weight: 900;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}
.hero p.lead {
  font-size: 15px;
  color: rgba(255,255,255,0.88);
  max-width: 480px;
  margin: 0 auto 26px;
}
.hero-stats { display: flex; justify-content: center; gap: 22px; margin: 22px 0 30px; flex-wrap: wrap; }
.hero-stats .stat { text-align: center; }
.hero-stats .stat b { display: block; font-size: 22px; font-weight: 900; }
.hero-stats .stat span { font-size: 11px; color: rgba(255,255,255,0.78); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 800; font-size: 16px; border: none; cursor: pointer;
  border-radius: 999px; padding: 16px 28px; text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--pop); color: #1a1400; box-shadow: 0 10px 26px rgba(234, 179, 8, 0.35); }
.btn-primary:hover { opacity: .92; }
.btn-white { background: #fff; color: var(--accent); }
.btn-outline { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,0.7); }
.btn-block { width: 100%; }
.btn-lg { padding: 18px 28px; font-size: 17px; }
.btn-dark { background: #111; color: #fff; }
.btn-card { background: var(--card); color: var(--text); border: 1px solid var(--card-border); font-weight: 700; }

.hero-note { margin-top: 16px; font-size: 12px; color: rgba(255,255,255,0.72); }

/* ── セクション共通 ───────────────────────── */
section { padding: 44px 0; }
.section-title { font-size: 22px; font-weight: 900; margin: 0 0 6px; text-align: center; }
.section-sub { font-size: 14px; color: var(--text-2); text-align: center; margin: 0 0 28px; }

.card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* ── 種目グリッド ─────────────────────────── */
.disc-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
@media (min-width: 560px) { .disc-grid { grid-template-columns: repeat(3, 1fr); } }
.disc-card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius-sm);
  padding: 16px 14px; text-align: left; cursor: pointer; color: var(--text);
  display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-sm);
}
.disc-card .ic-wrap {
  width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: rgba(37, 99, 235, 0.10); color: var(--accent-blue);
}
.disc-card .cat-tag { font-size: 10px; color: var(--text-2); font-weight: 700; }
.disc-card .name { font-size: 14px; font-weight: 800; }
.disc-card .rule { font-size: 11.5px; color: var(--text-2); }

/* ── 診断ステージ（フルスクリーン風ゲームエリア） ───────── */
.stage-overlay {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: flex; flex-direction: column;
}
.stage-topbar {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 16px;
  border-bottom: 1px solid var(--card-border);
}
.stage-topbar .progress-track {
  flex: 1; height: 6px; border-radius: 3px; background: var(--card-border); margin: 0 14px; overflow: hidden;
}
.stage-topbar .progress-fill { height: 100%; background: var(--grad); border-radius: 3px; transition: width .3s ease; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--card-border);
  background: var(--card); color: var(--text-2); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.stage-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.game-fill {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  color: #fff; padding: 24px;
}
.game-fill .big { font-size: clamp(34px, 10vw, 52px); font-weight: 900; }
.game-fill .sub { font-size: 15px; font-weight: 600; margin-top: 10px; opacity: .92; }

.intro-screen {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px;
}
.intro-screen .ic-wrap-lg {
  width: 84px; height: 84px; border-radius: 22px; background: rgba(37,99,235,0.10); color: var(--accent-blue);
  display: flex; align-items: center; justify-content: center; margin-bottom: 18px;
}
.intro-screen h2 { font-size: 24px; font-weight: 900; margin: 0 0 12px; }
.intro-screen p { font-size: 15px; color: var(--text-2); max-width: 340px; margin: 0 0 28px; }

.playzone { flex: 1; display: flex; flex-direction: column; padding: 16px; min-height: 0; }
.playzone-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 12px; font-size: 14px; font-weight: 700; color: var(--text-2); }
.playzone-head .warn { color: var(--bad); }
.playzone-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; }
.playzone-foot { padding-top: 14px; }

.stop-btn {
  width: 100%; padding: 17px; border-radius: 14px; border: none; font-size: 17px; font-weight: 800;
  color: #fff; background: var(--bad); cursor: pointer;
}
.next-btn {
  width: 100%; padding: 17px; border-radius: 14px; border: none; font-size: 17px; font-weight: 800;
  color: #fff; background: var(--accent-blue); cursor: pointer;
}

/* 数字入力の自前キーパッド */
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; max-width: 320px; margin: 0 auto; }
.numpad button {
  padding: 16px 0; border-radius: 10px; border: 1px solid var(--card-border); background: var(--card);
  color: var(--text); font-size: 19px; font-weight: 700; cursor: pointer;
}
.numpad button:active { background: var(--card-border); }
.numpad .empty { visibility: hidden; }

.entry-boxes { display: flex; gap: 8px; justify-content: center; margin-bottom: 18px; }
.entry-boxes .box {
  width: 40px; height: 52px; border-radius: 8px; border: 1.5px solid var(--card-border); background: var(--card);
  display: flex; align-items: center; justify-content: center; font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--text);
}
.entry-boxes .box.cur { border-color: var(--accent-blue); }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; max-width: 400px; }
.choice-grid.two { grid-template-columns: 1fr 1fr; }
.choice-btn {
  padding: 18px 8px; border-radius: 14px; border: 1px solid var(--card-border); background: var(--card);
  font-size: 18px; font-weight: 800; color: var(--text); cursor: pointer;
}
.choice-btn:active { transform: scale(0.97); }

.trial-feedback { font-size: 20px; font-weight: 800; }
.trial-feedback.good { color: var(--good); }
.trial-feedback.bad { color: var(--bad); }

.chimp-grid { display: grid; gap: 6px; width: 100%; max-width: 360px; }
.chimp-row { display: grid; gap: 6px; }
.chimp-tile {
  aspect-ratio: 1; border-radius: 8px; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px;
}
.hue-grid { display: grid; gap: 6px; width: 100%; max-width: 340px; margin: 0 auto; }
.hue-row { display: grid; gap: 6px; }
.hue-tile { aspect-ratio: 1; border-radius: 8px; border: none; cursor: pointer; }

.moving-track { position: relative; width: 100%; height: 130px; border-radius: 14px; border: 1px solid var(--card-border); background: var(--card); overflow: hidden; margin-bottom: 20px; }
.moving-num { position: absolute; top: 50%; font-size: 36px; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--text); transform: translate(-50%, -50%); white-space: nowrap; }

.timing-track { position: relative; width: 100%; height: 60px; border-radius: 10px; border: 1px solid var(--card-border); background: var(--card); margin-bottom: 26px; }
.timing-zone { position: absolute; top: 0; bottom: 0; left: 43%; width: 14%; background: rgba(5, 150, 105, 0.28); }
.timing-center { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: var(--good); }
.timing-marker { position: absolute; top: -6px; width: 6px; height: 72px; border-radius: 3px; background: var(--accent); }

/* ── 結果画面 ─────────────────────────────── */
.result-hero {
  background: var(--grad); color: #fff; text-align: center; padding: 40px 20px 34px; border-radius: 0 0 26px 26px;
}
.result-hero .label { font-size: 13px; font-weight: 700; color: rgba(255,255,255,0.85); }
.result-hero .score { font-size: 68px; font-weight: 900; margin: 6px 0; }
.result-hero .title-pill {
  display: inline-block; background: rgba(255,255,255,0.18); padding: 8px 18px; border-radius: 999px;
  font-weight: 800; font-size: 16px; margin-top: 6px;
}
.radar-wrap { display: flex; justify-content: center; padding: 26px 0 6px; }
.radar-wrap svg text { fill: var(--text); }

.result-list { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.result-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--card-border);
}
.result-row .ic-wrap { width: 34px; height: 34px; border-radius: 9px; background: rgba(91,33,182,0.10); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.result-row .info { flex: 1; min-width: 0; }
.result-row .info .n { font-size: 13.5px; font-weight: 700; }
.result-row .info .r { font-size: 11.5px; color: var(--text-2); }
.result-row .dev { font-size: 18px; font-weight: 900; color: var(--accent-blue); }

.share-block { text-align: center; padding: 30px 20px 10px; }
.share-preview { margin: 0 auto 18px; border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); width: 240px; }
.share-preview canvas { width: 100%; display: block; }
.share-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.app-cta {
  margin: 34px 20px 0; padding: 26px 20px; border-radius: var(--radius); background: var(--card);
  border: 1px solid var(--card-border); text-align: center;
}
.app-cta img.appicon { width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 12px; box-shadow: var(--shadow-sm); }
.app-cta h3 { font-size: 17px; font-weight: 900; margin: 0 0 8px; }
.app-cta p { font-size: 13.5px; color: var(--text-2); margin: 0 0 18px; }
.app-cta ul { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-direction: column; gap: 8px; text-align: left; max-width: 320px; margin-inline: auto; }
.app-cta li { font-size: 13px; color: var(--text); display: flex; gap: 8px; align-items: flex-start; }
.app-cta li .ic { color: var(--good); flex-shrink: 0; margin-top: 2px; }

.appstore-badge {
  display: inline-flex; align-items: center; gap: 8px; background: #000; color: #fff; text-decoration: none;
  padding: 11px 20px 11px 16px; border-radius: 12px; font-weight: 700;
}
.appstore-badge .lines { text-align: left; line-height: 1.15; }
.appstore-badge .lines small { display: block; font-size: 10px; font-weight: 500; color: #d8d8d8; }
.appstore-badge .lines b { display: block; font-size: 16px; }

.replay-row { display: flex; gap: 10px; justify-content: center; padding: 24px 20px 8px; }

/* ── 種目一覧(単体プレイ)ページ内モード切替 ─── */
.mode-tabs { display: flex; gap: 8px; justify-content: center; margin: 0 0 20px; }
.mode-tab {
  padding: 9px 18px; border-radius: 999px; border: 1px solid var(--card-border); background: var(--card);
  font-size: 13px; font-weight: 700; color: var(--text-2); cursor: pointer;
}
.mode-tab.active { background: var(--grad); color: #fff; border-color: transparent; }

/* ── SEO記事ページ ─────────────────────────── */
.article-hero { padding: 34px 0 8px; }
.article-hero .cat { font-size: 12px; font-weight: 800; color: var(--accent-blue); }
.article-hero h1 { font-size: clamp(24px, 5.5vw, 32px); margin: 8px 0 14px; }
.article-hero .desc { color: var(--text-2); font-size: 14.5px; }
article.content { padding: 10px 0 50px; font-size: 15.5px; }
article.content h2 { font-size: 20px; margin: 34px 0 12px; }
article.content h3 { font-size: 16.5px; margin: 24px 0 8px; }
article.content p { margin: 0 0 14px; color: var(--text); }
article.content ul, article.content ol { margin: 0 0 16px; padding-left: 22px; color: var(--text); }
article.content li { margin-bottom: 6px; }
.faq-item { border-top: 1px solid var(--card-border); padding: 16px 0; }
.faq-item h3 { margin: 0 0 8px; }
.inline-cta {
  margin: 30px 0; padding: 20px; border-radius: var(--radius); background: var(--grad); color: #fff; text-align: center;
}
.inline-cta p { color: rgba(255,255,255,0.9); margin: 0 0 14px; font-size: 14px; }
.related-list { display: flex; flex-direction: column; gap: 10px; margin: 16px 0 0; }
.related-list a { display: block; padding: 14px 16px; border-radius: 12px; background: var(--card); border: 1px solid var(--card-border); text-decoration: none; color: var(--text); font-weight: 700; font-size: 14px; }

/* ── フッター ─────────────────────────────── */
footer.site-footer { padding: 40px 0 60px; text-align: center; color: var(--text-2); font-size: 12.5px; }
footer.site-footer nav { display: flex; gap: 16px; justify-content: center; margin-bottom: 14px; flex-wrap: wrap; }
footer.site-footer nav a { color: var(--text-2); text-decoration: none; }
footer.site-footer nav a:hover { color: var(--text); }

.badge-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 16px 0; }
.badge-pill { font-size: 11.5px; font-weight: 700; color: var(--text-2); background: var(--card); border: 1px solid var(--card-border); padding: 5px 12px; border-radius: 999px; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: #111; color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 13.5px; font-weight: 700;
  opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.legal { padding: 40px 0 60px; font-size: 14px; }
.legal h1 { font-size: 22px; }
.legal h2 { font-size: 16px; margin-top: 28px; }
.legal p, .legal li { color: var(--text-2); }

@media (max-width: 380px) {
  .disc-card .rule { display: none; }
}
