/* 計算チャレンジ(MMP-01)の追加スタイル。節見出しごとに担当が違う: start=S0 / game=S0・S1 / a11y=S3 / ads=S4 */

/* start */
/* ゲームスタートは、どの画面幅でも見えて押せる(旧: CSS で全幅 display:none) */
#start-screen #start-game-btn {
  display: block;
  min-height: 48px;
}
#start-screen .level-btn,
#start-screen .time-preset-btn {
  min-height: 44px;
}

/* game */
/* 新記録バッジの .hidden は、css/style.css の .inline-block に負けて隠れなかった */
#new-record-badge.hidden,
#new-record-badge-go.hidden,
#end-practice-btn.hidden {
  display: none;
}

/* 練習モード(時間なし): ラベルとチェック。チェックの当たりは 44px 以上 */
.mm-practice-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 1rem;
  line-height: 1.5;
  color: #1f2937;
  cursor: pointer;
  text-align: left;
}
.mm-practice-check {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  margin: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.mm-practice-check::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 10px;
  width: 24px;
  height: 24px;
  box-sizing: border-box;
  border: 2px solid #1d4ed8;
  border-radius: 6px;
  background: #fff;
  color: #fff;
  font-size: 18px;
  line-height: 20px;
  text-align: center;
}
.mm-practice-check:checked::before {
  content: "\2713";
  background: #1d4ed8;
}
.mm-practice-check:focus-visible::before {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}

/* 「おわる」(練習中のみ) */
.mm-end-practice {
  min-width: 120px;
  min-height: 44px;
  padding: 8px 24px;
  border: 2px solid #475569;
  border-radius: 8px;
  background: #fff;
  color: #1e293b;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

/* 不正解を責めない: 赤を使わない中立の配色(色だけに頼らず、文言と記号 → も添える) */
.mm-feedback-neutral {
  color: #334155;
}
#problem-display .answer-btn.incorrect {
  background-color: #475569 !important;
  color: #fff !important;
  animation: none !important;
}
#problem-display.feedback-wrong {
  animation: none;
}

/* a11y */
/* 範囲3(S3): 読みやすさ・押しやすさ・邪魔しない。ロジックには触らない。広告ブロック(ads)の見た目は S4 の節 */

/* 1. 横あふれ: 隠さず、折り返す */
img, canvas, svg, video, iframe { max-width: 100%; }
canvas { height: auto; }
nav.mm-crumb {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  padding: 0 16px !important;
  font-size: 0.875rem !important;
}
nav.mm-crumb a {
  display: inline-flex;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
}
nav.mm-crumb span { min-width: 0; overflow-wrap: anywhere; color: #4b5563 !important; }
.mm-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  color: #e0e7ff;
  font-size: 0.875rem !important;
}
.mm-band a {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px !important;
  box-sizing: border-box;
}
.mm-band a:first-child { color: #0e7490 !important; }
.mm-band a:last-child { color: #e0e7ff !important; text-decoration: underline !important; }

/* 2. 押せる大きさ: リンク・ボタン・入力は 44x44px 以上(本文中の文章リンクを除く) */
header a, header button { min-height: 44px; }
header a { display: inline-flex; align-items: center; }
#mobile-menu a, #mobile-menu button {
  display: flex;
  align-items: center;
  min-height: 44px;
}
/* フッターは高さ固定(50px)で、中身が下へあふれて運営表記と重なっていた。中身に合わせて伸ばす */
footer { height: auto !important; min-height: var(--footer-height); padding: 24px 0 !important; }
footer li { margin: 0; }
footer > p { padding-left: 16px; padding-right: 16px; }
footer p, footer .text-gray-400, footer .text-gray-500 { color: #e5e7eb !important; }
footer a, footer a.text-gray-400 { color: #e5e7eb !important; text-decoration: underline; }
footer a.text-blue-400 { color: #bfdbfe !important; }
footer a.bg-blue-600 { color: #fff !important; text-decoration: none; }
footer a {
  display: inline-flex;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
  box-sizing: border-box;
}
.mm-orgfooter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  column-gap: 8px;
  color: #4b5563 !important;
}
.mm-orgfooter a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  color: #4b5563 !important;
  text-decoration: underline !important;
}
.share-btn, a.share-btn { min-height: 44px; box-sizing: border-box; }
.mm-touch {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  box-sizing: border-box;
}
input[type="range"] {
  box-sizing: content-box;
  height: 24px;
  padding: 10px 0;
  background-clip: content-box;
}

/* 3. 読める大きさ: rt(ふりがな)以外は 14px 以上 */
.text-xs { font-size: 0.875rem !important; line-height: 1.5 !important; }
ruby { font-size: inherit; }

/* 4. 同意バナー(共有の consent-mode.js は変えない): 高さ分の余白、文字 14px、「詳細」も押せる大きさ */
body:has(#consent-banner-v2) { padding-bottom: var(--consent-h, 96px); }
html:has(#consent-banner-v2) { scroll-padding-bottom: var(--consent-h, 96px); }
#consent-banner-v2 { font-size: 14px !important; }
#consent-banner-v2 a {
  display: inline-flex;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
  margin-left: 0 !important;
  color: #bfdbfe !important;
}

/* 5. 邪魔しない: 「上へ戻る」はバナーの上・ゲーム中は出さない。スキップリンクはフォーカスで見える */
#back-to-top {
  width: 44px !important;
  height: 44px !important;
  line-height: 44px !important;
  right: 12px !important;
  bottom: calc(var(--consent-h, 0px) + 16px) !important;
}
body:has(#game-play-area:not(.hidden)) #back-to-top { display: none !important; }
a[href="#main"].sr-only:focus,
a[href="#main"].sr-only:focus-visible {
  position: fixed;
  top: 8px;
  left: 8px;
  width: auto;
  height: auto;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 10px 16px;
  clip: auto;
  overflow: visible;
  white-space: normal;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  z-index: 1000000;
  background: #1e3a8a;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 8px;
  outline: 3px solid #facc15;
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
  .hover\:scale-105:hover, .active\:scale-95:active { --tw-scale-x: 1; --tw-scale-y: 1; }
  button:hover, button:active, a:hover, a:active,
  .answer-btn.selected, .answer-btn.correct, .answer-btn.incorrect { transform: none !important; }
}

/* 6. 文字と背景のコントラスト比 4.5:1 以上(既存の !important に勝つよう、id を重ねる) */
header { background: linear-gradient(135deg, #1d4ed8, #047857) !important; }
#quick-start-area { background: linear-gradient(135deg, #065f46, #064e3b) !important; }
#quick-start-area p { color: #fff !important; opacity: 1 !important; }
#quick-start-area #quick-start-btn,
#quick-start-area #quick-start-btn:hover {
  background: #fff !important;
  background-image: none !important;
  color: #14532d !important;
  border: 2px solid #fff !important;
}
#start-screen #start-game-btn,
#start-screen #start-game-btn.btn-ready {
  background: #15803d !important;
  background-image: none !important;
  color: #fff !important;
}
#start-screen #start-game-btn:disabled {
  background: #e5e7eb !important;
  color: #4b5563 !important;
}
#start-screen .level-btn,
#start-screen .time-preset-btn {
  background: #fff !important;
  background-image: none !important;
  color: #1f2937 !important;
  border: 2px solid #4b5563 !important;
}
#start-screen .level-btn.active,
#start-screen .time-preset-btn.active {
  background: #1e40af !important;
  color: #fff !important;
  border: 3px solid #1e3a8a !important;
}
#start-screen .level-btn *, #start-screen .time-preset-btn * { color: inherit !important; opacity: 1 !important; }
#start-screen .text-red-500 { color: #b91c1c; }
#trust-badges > span { color: #111827 !important; }
/* 薄い灰色の補足文は濃くする(暗いフッターの中は上の footer の規則が勝つ) */
.text-gray-400, .text-gray-500 { color: #4b5563; }
kbd { font-size: 0.875rem !important; }
.bg-green-600 { background-color: #047857 !important; }
.hover\:bg-green-700:hover { background-color: #065f46 !important; }
[id^="print-result-btn"], [id^="copy-result-btn"], [id^="export-csv-btn"], #share-result-btn {
  background-image: none !important;
  color: #fff !important;
}
[id^="print-result-btn"] { background-color: #6d28d9 !important; }
[id^="copy-result-btn"], #share-result-btn { background-color: #1d4ed8 !important; }
[id^="export-csv-btn"] { background-color: #0f766e !important; }


/* ads */
/* 広告は開始画面の下の 1 か所だけ。本文より目立たせない(色面・影・動きなし)。開始ボタンの下端から 24px 以上離す */
#ads-block {
  margin: 40px 0 0;
  padding: 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #f9fafb;
  color: #374151;
  text-align: left;
  box-sizing: border-box;
  max-width: 100%;
}
#ads-block .ads-heading {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 700;
  color: #1f2937;
}
#ads-block .ads-note {
  margin: 0 0 12px;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #374151;
}
#ads-block .ads-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#ads-block .ads-list:last-child {
  margin-bottom: 0;
}
#ads-block .ads-list a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  box-sizing: border-box;
  border: 1px solid #9ca3af;
  border-radius: 6px;
  background: #fff;
  color: #1e40af;
  font-size: 0.9375rem;
  line-height: 1.5;
  text-decoration: underline;
  overflow-wrap: anywhere;
}
#ads-block .ads-list img {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
/* 開始画面は index.html の `#start-screen{display:flex}` が .hidden に勝ち、プレイ中も残る。広告だけは確実に消す */
#start-screen.hidden #ads-block {
  display: none;
}
@media (prefers-reduced-motion: reduce) {
  #ads-block, #ads-block * { animation: none !important; transition: none !important; }
}
