* { margin: 0; padding: 0; box-sizing: border-box; }
button { touch-action: manipulation; }

body {
  font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.7;
  overflow-x: hidden;
}

header {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.logo {
  font-size: 1.2rem;
  font-weight: bold;
  color: #db2777;
  text-decoration: none;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

/* ━━━ ヒーロー ━━━ */
.hero {
  text-align: center;
  padding: 2rem 0 1.25rem;
}

.hero-icon { font-size: 2.5rem; margin-bottom: 0.4rem; }

h1 {
  font-size: 1.75rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.05rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.description {
  color: #666;
  font-size: 0.9rem;
  line-height: 1.8;
}

/* ━━━ ヒーローバッジ ━━━ */
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.badge {
  display: inline-block;
  padding: 5px 13px;
  background: #fce7f3;
  color: #9d174d;
  border: 1.5px solid #f9a8d4;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ━━━ カード共通 ━━━ */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  border: 1px solid #e0e0e0;
}

/* ━━━ ゲームラッパー ━━━ */
.game-wrap {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e0e0e0;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

/* ━━━ 設定 ━━━ */
.setting-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.setting-row.col {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.setting-label {
  font-size: 0.85rem;
  font-weight: bold;
  color: #666;
  min-width: 3rem;
}

.tab-group {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.tab-group.wrap { width: 100%; }

.stab {
  padding: 0.35rem 0.85rem;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #fafafa;
  font-size: 0.82rem;
  font-family: inherit;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
}

.stab:hover { border-color: #db2777; color: #db2777; }
.stab.active { background: #db2777; border-color: #db2777; color: #fff; font-weight: bold; }

.tech-hint {
  font-size: 0.8rem;
  color: #9d174d;
  background: #fdf2f8;
  border: 1px solid #fbcfe8;
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  margin-bottom: 1rem;
}

.best-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1.25rem;
  padding: 0.65rem 1rem;
  background: #fdf2f8;
  border-radius: 8px;
  border: 1px solid #fbcfe8;
}

.best-label { font-size: 0.85rem; color: #9d174d; }
.best-value { font-size: 1.4rem; font-weight: 900; color: #db2777; line-height: 1; }
.best-unit  { font-size: 0.82rem; color: #9d174d; }

.primary-btn {
  display: block;
  width: 100%;
  padding: 0.9rem;
  background: linear-gradient(135deg, #db2777, #be185d);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.15s;
  letter-spacing: 0.05em;
}

.primary-btn:hover { opacity: 0.9; }

.sub-btn {
  display: block;
  width: 100%;
  margin-top: 0.6rem;
  padding: 0.6rem;
  background: #fff;
  color: #888;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.sub-btn:hover { border-color: #db2777; color: #db2777; }

/* ━━━ プレイ中 ━━━ */

/* タイマー */
.timer-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.75rem;
}

.timer-bar-wrap {
  flex: 1;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: #db2777;
  border-radius: 4px;
  transition: width 1s linear, background 0.5s;
}

.timer-num {
  font-size: 1.4rem;
  font-weight: 900;
  color: #db2777;
  min-width: 2.2ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* スコア */
.score-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.score-num {
  font-size: 2.2rem;
  font-weight: 900;
  color: #db2777;
}

.score-num.streak { color: #f97316; }

.score-lbl {
  font-size: 0.72rem;
  color: #999;
  margin-top: 0.1rem;
}

.score-sep {
  font-size: 1.5rem;
  color: #d1d5db;
  align-self: center;
}

/* 問題表示 */
.problem-wrap {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  min-height: 4.5rem;
}

.problem-text {
  font-size: 2.1rem;
  font-weight: 900;
  color: #1f2937;
  font-variant-numeric: tabular-nums;
}

.problem-eq {
  font-size: 1.8rem;
  font-weight: bold;
  color: #9ca3af;
}

.answer-display {
  font-size: 2.1rem;
  font-weight: 900;
  color: #db2777;
  min-width: 4ch;
  border-bottom: 3px solid #db2777;
  padding-bottom: 1px;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.answer-display.empty {
  color: #d1d5db;
  border-color: #d1d5db;
}

/* フィードバック */
.feedback {
  text-align: center;
  font-size: 0.95rem;
  font-weight: bold;
  min-height: 1.6rem;
  margin-bottom: 0.6rem;
}

.feedback.ok { color: #10b981; }
.feedback.ng { color: #ef4444; }

/* 途中式 */
.steps {
  background: #fdf2f8;
  border: 1px solid #fbcfe8;
  border-radius: 10px;
  padding: 0.75rem 0.95rem;
  margin-bottom: 0.9rem;
}

.step {
  font-size: 0.85rem;
  color: #4b5563;
  line-height: 1.7;
  padding-left: 1.1rem;
  position: relative;
}

.step::before {
  content: '↓';
  position: absolute;
  left: 0;
  color: #f9a8d4;
  font-weight: bold;
}

.step:first-child::before { content: '①'; font-size: 0.75rem; }

.step b { color: #be185d; }

/* 数字パッド */
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-width: 280px;
  margin: 0 auto;
}

.num-btn {
  aspect-ratio: 1.4;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  font-size: 1.4rem;
  font-weight: bold;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.num-btn:hover { background: #fdf2f8; border-color: #db2777; }
.num-btn:active { transform: scale(0.94); background: #fce7f3; }

.del-btn {
  background: #f9fafb;
  color: #555;
  font-size: 1rem;
}

.ok-btn {
  background: linear-gradient(135deg, #db2777, #be185d);
  border-color: #db2777;
  color: #fff;
}

.ok-btn:hover { opacity: 0.9; background: linear-gradient(135deg, #db2777, #be185d); }

/* ━━━ 結果パネル ━━━ */
.result-emoji  { font-size: 3.5rem; margin-bottom: 0.5rem; text-align: center; }
.result-title  { font-size: 1.5rem; font-weight: 900; margin-bottom: 0.4rem; text-align: center; }
.result-detail { font-size: 1.05rem; color: #666; margin-bottom: 0.5rem; text-align: center; }
.result-best   {
  font-size: 0.9rem;
  font-weight: bold;
  text-align: center;
  min-height: 1.5rem;
  margin-bottom: 1.25rem;
  color: #9d174d;
}

.result-best.new-best { color: #db2777; }

.hidden { display: none; }

/* ━━━ Amazon ━━━ */
.amazon-card h2 { margin-bottom: 0.25rem; }
.amazon-note { font-size: 0.82rem; color: #999; margin-bottom: 1rem; }
.amazon-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.amazon-item {
  display: block;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 0.9rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}
.amazon-item:hover {
  border-color: #FF9900;
  box-shadow: 0 2px 8px rgba(255,153,0,0.15);
  transform: translateY(-1px);
}
.amazon-item-icon { font-size: 1.7rem; margin-bottom: 0.35rem; }
.amazon-item-name { font-size: 0.88rem; font-weight: bold; margin-bottom: 0.2rem; }
.amazon-item-desc { font-size: 0.76rem; color: #888; line-height: 1.5; margin-bottom: 0.45rem; }
.amazon-item-link { font-size: 0.78rem; color: #FF9900; font-weight: bold; }

/* ━━━ 解説・ガイド ━━━ */
.guide-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1.6rem 0 .4rem;
  padding-bottom: .3rem;
  border-bottom: 2px solid #fce7f3;
}
.guide-card p { font-size: .9rem; line-height: 1.85; margin-bottom: .6rem; }
.guide-card p strong { color: #be185d; font-weight: 700; }
.guide-card b { color: #db2777; }
.guide-lead-note {
  font-size: .82rem !important;
  color: #888;
  background: #fafafa;
  border-left: 3px solid #f9a8d4;
  padding: .5rem .8rem;
}

.proof {
  background: #fdf2f8;
  border: 1px solid #fbcfe8;
  border-radius: 10px;
  padding: .8rem 1rem;
  margin: .7rem 0;
}
.proof-head {
  font-size: .82rem;
  font-weight: 700;
  color: #9d174d;
  margin-bottom: .3rem;
}
.proof p {
  font-size: .84rem !important;
  line-height: 1.9 !important;
  color: #4b5563;
  margin-bottom: 0 !important;
}

.tech-list { margin: 0 0 .7rem 1.3rem; }
.tech-list li { font-size: .88rem; line-height: 1.9; color: #444; }
.tech-list li b { color: #db2777; }

.example-box {
  border: 1px dashed #f9a8d4;
  border-radius: 10px;
  padding: .8rem 1rem;
  margin: .7rem 0 1rem;
}
.example-q {
  font-size: 1.15rem;
  font-weight: 900;
  color: #1f2937;
  margin-bottom: .35rem;
  font-variant-numeric: tabular-nums;
}
.example-q b { color: #db2777; }
.example-out .step { font-size: .82rem; }
.example-btn {
  margin-top: .6rem;
  padding: .35rem .85rem;
  border: 1px solid #f9a8d4;
  border-radius: 6px;
  background: #fff;
  font-family: inherit;
  font-size: .8rem;
  color: #db2777;
  cursor: pointer;
  transition: all .15s;
}
.example-btn:hover { background: #fdf2f8; }

/* ━━━ 使い方 ━━━ */
.tips-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.tip-item { display: flex; gap: .65rem; }
.tip-icon { font-size: 1.4rem; flex-shrink: 0; }
.tip-text strong { display: block; font-weight: 700; margin-bottom: .15rem; font-size: .88rem; }
.tip-text p { font-size: .8rem; color: #78716c; line-height: 1.55; }
.link { color: #db2777; text-decoration: none; font-weight: bold; }
.link:hover { text-decoration: underline; }

/* ━━━ 活用シーン ━━━ */
.scene-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
}
.scene-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem 1rem;
  background: #fdf2f8;
  border: 1.5px solid #fbcfe8;
  border-radius: 12px;
}
.scene-icon { font-size: 1.7rem; flex-shrink: 0; }
.scene-body strong { display: block; font-size: .88rem; font-weight: 700; color: #831843; margin-bottom: .2rem; }
.scene-body p { font-size: .78rem; color: #4b5563; line-height: 1.55; margin: 0; }

/* ━━━ FAQ ━━━ */
.faq-list { display: flex; flex-direction: column; }
.faq-item { padding: .9rem 0; border-bottom: 1px solid #f0f0f0; }
.faq-item:last-child { border-bottom: none; padding-bottom: 0; }
.faq-q { font-size: .9rem; font-weight: 700; color: #db2777; margin-bottom: .35rem; }
.faq-a { font-size: .85rem; color: #555; line-height: 1.75; }

/* ━━━ 関連ツール ━━━ */
.related-tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
}
.related-tool-item {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .85rem 1rem;
  border: 1.5px solid #e8edf5;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.related-tool-item:hover { border-color: #db2777; box-shadow: 0 2px 8px rgba(219,39,119,.1); }
.related-tool-icon { font-size: 1.6rem; flex-shrink: 0; }
.related-tool-item strong { display: block; font-size: .88rem; font-weight: 700; color: #db2777; margin-bottom: .2rem; }
.related-tool-item p { font-size: .76rem; color: #888; line-height: 1.5; margin: 0; }

/* ━━━ フッター ━━━ */
footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: .82rem;
  color: #a8a29e;
  border-top: 1px solid #e7e5e4;
  margin-top: auto;
}
footer a { color: #db2777; text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer p + p { margin-top: .3rem; }

.amazon-notice {
  font-size: 0.72rem;
  color: #bbb;
  margin-top: 0.2rem;
}

/* ━━━ レスポンシブ ━━━ */
@media (max-width: 480px) {
  h1 { font-size: 1.4rem; }
  .game-wrap { padding: 1.1rem; }
  .card { padding: 1.1rem 1.1rem; }
  .problem-text, .answer-display { font-size: 1.7rem; }
  .score-num { font-size: 1.8rem; }
  .numpad { max-width: 260px; gap: 5px; }
  .num-btn { font-size: 1.2rem; }
  .tips-grid { grid-template-columns: 1fr; }
  .scene-grid { grid-template-columns: 1fr; }
}
