/* ==========================================================
   ストループ効果テスト - style.css
   すべてのクラスに .stroop- プレフィックスを付与（WP干渉防止）
   ========================================================== */

.stroop-body {
  margin: 0;
  background: #e9ecef;
}

.stroop-app {
  /* ---- CSS変数 ---- */
  --stroop-red: #E03131;
  --stroop-blue: #1971C2;
  --stroop-green: #2F9E44;
  --stroop-yellow: #F59F00;
  --stroop-bg: #f4f6fb;
  --stroop-card: #ffffff;
  --stroop-text: #212529;
  --stroop-muted: #868e96;
  --stroop-primary: #3b5bdb;
  --stroop-primary-dark: #2f49b3;
  --stroop-border: #dee2e6;
  --stroop-radius: 16px;

  position: relative;
  box-sizing: border-box;
  max-width: 560px;
  min-height: 640px;
  margin: 0 auto;
  padding: 16px;
  overflow: hidden;
  background: var(--stroop-bg);
  color: var(--stroop-text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", "Meiryo", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  text-align: left;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

.stroop-app *,
.stroop-app *::before,
.stroop-app *::after {
  box-sizing: border-box;
}

.stroop-app h1,
.stroop-app h2,
.stroop-app p,
.stroop-app dl,
.stroop-app dd,
.stroop-app ul {
  margin: 0;
  padding: 0;
}

.stroop-app ul { list-style: none; }

/* ---------- 画面切り替え ---------- */
.stroop-screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 608px;
}
.stroop-screen[hidden] { display: none !important; }
.stroop-screen--center { align-items: center; justify-content: center; }

/* ---------- 共通パーツ ---------- */
.stroop-card {
  background: var(--stroop-card);
  border-radius: var(--stroop-radius);
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.stroop-btn {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.08s ease, background-color 0.15s ease;
}
.stroop-btn:active { transform: scale(0.97); }
.stroop-btn:focus-visible,
.stroop-answer:focus-visible { outline: 3px solid #ffd43b; outline-offset: 2px; }

.stroop-btn--primary { background: var(--stroop-primary); color: #fff; box-shadow: 0 4px 0 var(--stroop-primary-dark); }
.stroop-btn--primary:hover { background: #4263eb; }
.stroop-btn--cta { min-height: 64px; font-size: 1.25rem; }
.stroop-btn--x { background: #111; color: #fff; display: flex; align-items: center; justify-content: center; }
.stroop-btn--x:hover { background: #333; }
.stroop-btn--ghost { background: transparent; color: var(--stroop-muted); border: 1px solid var(--stroop-border); min-height: 44px; }
.stroop-btn--small { min-height: 40px; font-size: 0.85rem; padding: 8px 16px; align-self: center; width: auto; }
/* ---------- 脳トレメニューへ戻るボタン ---------- */
.stroop-nav {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: 4px;
}
.stroop-app a.stroop-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--stroop-card);
  color: var(--stroop-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  text-decoration: none;
  touch-action: manipulation;
  transition: transform 0.08s ease, background-color 0.15s ease;
}
.stroop-app a.stroop-back:hover { background: #edf2ff; color: var(--stroop-primary-dark); }
.stroop-app a.stroop-back:active { transform: scale(0.94); }
.stroop-app a.stroop-back:focus-visible { outline: 3px solid #ffd43b; outline-offset: 2px; }
.stroop-back svg { display: block; width: 22px; height: 22px; }


/* ---------- ① スタート画面 ---------- */
.stroop-title {
  text-align: center;
  font-size: clamp(1.4rem, 5.5vw, 1.8rem);
  font-weight: 800;
  line-height: 1.35;
  padding-top: 8px;
}
.stroop-title__sub { display: block; font-size: 0.7em; color: var(--stroop-primary); }

.stroop-rule__lead { text-align: center; font-size: 1.05rem; margin-bottom: 12px; }
.stroop-rule__lead strong { color: var(--stroop-primary); }

.stroop-demo {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 12px; background: var(--stroop-bg); border-radius: 12px;
}
.stroop-demo__word { font-size: 2.2rem; font-weight: 800; }
.stroop-demo__word--red { color: var(--stroop-red); }
.stroop-demo__arrow { color: var(--stroop-muted); }
.stroop-demo__answer {
  padding: 6px 14px; border-radius: 10px; background: var(--stroop-red); color: #fff; font-weight: 800;
}
.stroop-demo__answer small { font-weight: 400; opacity: 0.7; }
.stroop-demo__note { margin: 8px 0 12px; font-size: 0.85rem; text-align: center; }
.stroop-text-red { color: var(--stroop-red); }

.stroop-rule__list { font-size: 0.85rem; display: grid; gap: 4px; }
.stroop-rule__list li { padding-left: 1.1em; position: relative; }
.stroop-rule__list li::before { content: "●"; position: absolute; left: 0; color: var(--stroop-primary); font-size: 0.6em; top: 0.5em; }
.stroop-rule__list kbd {
  display: inline-block; min-width: 1.6em; margin: 0 2px 0 4px; padding: 0 4px;
  border: 1px solid var(--stroop-border); border-bottom-width: 2px; border-radius: 4px;
  background: #fff; font: 700 0.8rem/1.5 monospace; text-align: center;
}

.stroop-records { display: flex; justify-content: space-around; text-align: center; gap: 8px; }
.stroop-records__item dt { font-size: 0.75rem; color: var(--stroop-muted); }
.stroop-records__item dd { font-size: 1.3rem; font-weight: 800; }
.stroop-records__rank { color: var(--stroop-primary); }

/* スタート画面：ランク判定基準（折りたたみ。数字記憶・文字なぞりと同じ見た目） */
.stroop-details { padding: 8px 16px; font-size: 0.85rem; color: var(--stroop-muted); }
.stroop-details summary { cursor: pointer; padding: 8px 0; font-weight: 700; }
.stroop-details__points { display: grid; gap: 2px; margin: 4px 0 8px; color: var(--stroop-text); }
.stroop-details__points li { position: relative; padding-left: 1.1em; }
.stroop-details__points li::before { content: "●"; position: absolute; left: 0; top: 0.5em; font-size: 0.6em; color: var(--stroop-primary); }
.stroop-table { width: 100%; margin: 4px 0 8px; border-collapse: collapse; }
.stroop-table th, .stroop-table td { padding: 6px 4px; text-align: left; border-bottom: 1px solid var(--stroop-border); }
.stroop-table td:first-child { font-weight: 800; color: var(--stroop-primary); }

/* ---------- ② カウントダウン ---------- */
.stroop-countdown__num {
  font-size: clamp(5rem, 28vw, 9rem);
  font-weight: 900;
  color: var(--stroop-primary);
  line-height: 1;
  opacity: 0;
}
.stroop-countdown__num.is-go { color: var(--stroop-red); font-size: clamp(3.5rem, 18vw, 6rem); }
.stroop-countdown__num.is-anim { animation: stroop-pop 0.9s cubic-bezier(0.2, 0.8, 0.3, 1) forwards; }

@keyframes stroop-pop {
  0%   { transform: scale(0.3); opacity: 0; }
  35%  { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1.3); opacity: 1; }
}

/* ---------- ③ プレイ画面 ---------- */
.stroop-hud { display: grid; gap: 8px; }

.stroop-timebar {
  height: 14px; background: var(--stroop-border); border-radius: 999px; overflow: hidden;
}
.stroop-timebar__fill {
  width: 100%; height: 100%;
  background: var(--stroop-primary);
  transform-origin: left center;
  transform: scaleX(1);
  will-change: transform;
}
.stroop-timebar__fill.is-warning { background: var(--stroop-red); }

.stroop-hud__row { display: flex; justify-content: space-between; align-items: flex-end; }
.stroop-hud__cell { display: flex; flex-direction: column; min-width: 30%; }
.stroop-hud__cell--center { align-items: center; }
.stroop-hud__cell--right { align-items: flex-end; }
.stroop-hud__label { font-size: 0.7rem; letter-spacing: 0.08em; color: var(--stroop-muted); font-weight: 700; }
.stroop-hud__value { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
#stroop-combo.is-hot { color: var(--stroop-red); }

.stroop-stage {
  position: relative;
  flex: 1;
  min-height: 200px;
  display: flex; align-items: center; justify-content: center;
  background: #fff;
  border-radius: var(--stroop-radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.stroop-word {
  font-size: clamp(48px, 13vw, 64px);   /* 48px〜64px */
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 0.05em;
  text-align: center;
}
.stroop-word.is-neutral { color: var(--stroop-muted); font-size: clamp(32px, 9vw, 44px); }

.stroop-feedback {
  position: absolute; top: 12px; right: 16px;
  font-size: 1.1rem; font-weight: 800; opacity: 0; pointer-events: none;
}
.stroop-feedback.is-good { color: var(--stroop-green); }
.stroop-feedback.is-bad { color: var(--stroop-red); }
.stroop-feedback.is-anim { animation: stroop-float 0.6s ease-out forwards; }

@keyframes stroop-float {
  0%   { opacity: 1; transform: translateY(6px); }
  100% { opacity: 0; transform: translateY(-10px); }
}

.stroop-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.stroop-answer {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 76px;           /* 60px以上 */
  padding: 8px;
  border: 0; border-radius: 14px;
  color: #fff;
  font: inherit; font-size: 1.35rem; font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}
.stroop-answer:active,
.stroop-answer.is-pressed { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); }
.stroop-answer__key { font-size: 0.8rem; font-weight: 500; opacity: 0.55; font-family: monospace; }
.stroop-answer--red { background: var(--stroop-red); }
.stroop-answer--blue { background: var(--stroop-blue); }
.stroop-answer--green { background: var(--stroop-green); }
.stroop-answer--yellow { background: var(--stroop-yellow); color: #3b2a00; }

/* タッチ端末ではキー表示を隠す */
@media (hover: none) and (pointer: coarse) {
  .stroop-answer__key { display: none; }
}

/* 誤答フラッシュ */
.stroop-flash {
  position: absolute; inset: 0; z-index: 10;
  background: rgba(224, 49, 49, 0.55);
  opacity: 0; pointer-events: none;
}
.stroop-flash.is-active { animation: stroop-flash 0.3s ease-out; }
@keyframes stroop-flash {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------- ④ リザルト画面 ---------- */
.stroop-result__title { text-align: center; font-size: 1.4rem; font-weight: 800; }

.stroop-result__main { position: relative; text-align: center; padding-top: 24px; }

.stroop-new-record {
  display: inline-block; margin-bottom: 8px; padding: 2px 14px;
  background: linear-gradient(90deg, #ff6b6b, #fcc419); color: #fff;
  font-weight: 900; letter-spacing: 0.08em; border-radius: 999px;
  animation: stroop-blink 0.9s ease-in-out infinite alternate;
}
.stroop-new-record[hidden] { display: none; }
@keyframes stroop-blink { from { transform: scale(1); } to { transform: scale(1.08); } }

.stroop-result__rank {
  width: 96px; height: 96px; margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff;
  font-size: 3.4rem; font-weight: 900; line-height: 1;
  background: var(--stroop-muted);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.stroop-result__rank[data-rank="S"] { background: linear-gradient(135deg, #fcc419, #f76707); }
.stroop-result__rank[data-rank="A"] { background: var(--stroop-red); }
.stroop-result__rank[data-rank="B"] { background: var(--stroop-blue); }
.stroop-result__rank[data-rank="C"] { background: var(--stroop-green); }
.stroop-result__rank[data-rank="D"] { background: var(--stroop-muted); }

.stroop-result__age { font-weight: 700; color: var(--stroop-muted); }
.stroop-result__score { font-size: 2.6rem; font-weight: 900; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stroop-result__score small { font-size: 1rem; margin-left: 2px; }

.stroop-stats { display: flex; justify-content: space-around; text-align: center; gap: 8px; }
.stroop-stats__item dt { font-size: 0.75rem; color: var(--stroop-muted); }
.stroop-stats__item dd { font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.stroop-actions { display: grid; gap: 12px; }

/* 広告枠：ボタン類から35px以上の余白（誤クリック防止）。最下部に配置 */
.stroop-ad {
  margin-top: 48px;
  text-align: center;
}
.stroop-ad__label { display: block; font-size: 0.7rem; color: var(--stroop-muted); margin-bottom: 4px; }
.stroop-ad__slot {
  display: flex; align-items: center; justify-content: center;
  min-height: 100px;
  border: 2px dashed var(--stroop-border);
  border-radius: 8px;
  color: var(--stroop-muted);
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.6);
}

/* ---------- レスポンシブ ---------- */
@media (max-width: 380px) {
  .stroop-app { padding: 12px; }
  .stroop-hud__value { font-size: 1.25rem; }
  .stroop-answer { font-size: 1.2rem; }
}
@media (min-width: 600px) {
  .stroop-app { margin-top: 16px; margin-bottom: 16px; border-radius: 20px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12); }
}
@media (max-height: 640px) and (orientation: landscape) {
  .stroop-stage { min-height: 120px; }
  .stroop-answer { min-height: 64px; }
}

/* 動きを減らす設定への配慮 */
@media (prefers-reduced-motion: reduce) {
  .stroop-app *, .stroop-app *::before, .stroop-app *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .stroop-countdown__num { opacity: 1; }
}