﻿* { 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;
}

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

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

main {
  max-width: 520px;
  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: #fef3c7;
  color: #92400e;
  border: 1.5px solid #fcd34d;
  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-label {
  font-size: 0.85rem;
  font-weight: bold;
  color: #666;
  min-width: 3rem;
}

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

.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: #f59e0b; color: #f59e0b; }
.stab.active { background: #f59e0b; border-color: #f59e0b; color: #fff; font-weight: bold; }

.op-btn {
  width: 46px;
  height: 46px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
  font-size: 1.15rem;
  font-weight: bold;
  font-family: inherit;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.op-btn:hover { border-color: #f59e0b; color: #f59e0b; }
.op-btn.active { background: #f59e0b; border-color: #f59e0b; color: #fff; }

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

.best-label { font-size: 0.85rem; color: #92400e; }
.best-value { font-size: 1.4rem; font-weight: 900; color: #f59e0b; line-height: 1; }
.best-unit  { font-size: 0.82rem; color: #92400e; }

.primary-btn {
  display: block;
  width: 100%;
  padding: 0.9rem;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  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; }

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

/* タイマー */
.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: #f59e0b;
  border-radius: 4px;
  transition: width 1s linear, background 0.5s;
}

.timer-bar.low { background: #ef4444; }

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

.timer-num.low { color: #ef4444; }

/* スコア */
.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: #f59e0b;
}

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

.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;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  min-height: 4.5rem;
}

.problem-text {
  font-size: 2.4rem;
  font-weight: 900;
  color: #1f2937;
}

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

.answer-display {
  font-size: 2.4rem;
  font-weight: 900;
  color: #f59e0b;
  min-width: 3ch;
  border-bottom: 3px solid #f59e0b;
  padding-bottom: 1px;
  text-align: left;
}

.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.correct { color: #10b981; }
.feedback.wrong   { color: #ef4444; }

/* 数字パッド */
.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: #fffbeb; border-color: #f59e0b; }
.num-btn:active { transform: scale(0.94); background: #fef3c7; }

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

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

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

/* シェイク */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-7px); }
  40%      { transform: translateX(7px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

.shake { animation: shake 0.4s ease; }

/* ━━━ 結果パネル ━━━ */
.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: #f59e0b;
}

.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; }

/* ━━━ 遊び方 ━━━ */
.how-item { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid #f0f0f0; }
.how-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.how-item h3 { font-size: 0.9rem; font-weight: bold; margin-bottom: 0.3rem; color: #f59e0b; }
.how-item p { font-size: 0.875rem; color: #666; line-height: 1.7; }
.link { color: #f59e0b; text-decoration: none; font-weight: bold; }
.link:hover { text-decoration: underline; }

footer {
  text-align: center;
  padding: 2rem;
  color: #999;
  font-size: 0.875rem;
}
footer a { color: #999; text-decoration: none; margin: 0 0.5rem; }
footer a:hover { color: #f59e0b; }
footer p { margin-bottom: 0.3rem; }

/* ━━━ レスポンシブ ━━━ */

/* ─── Tips grid (rank-tracker 統一パターン) ──────── */
.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; }
@media (max-width: 480px) {
  h1 { font-size: 1.4rem; }
  .game-wrap { padding: 1.1rem; }
  .problem-text, .answer-display { font-size: 2rem; }
  .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; }
}

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

/* ━━━ 活用シーン ━━━ */
.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: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: 12px;
}
.scene-icon { font-size: 1.7rem; flex-shrink: 0; }
.scene-body strong { display: block; font-size: .88rem; font-weight: 700; color: #78350f; margin-bottom: .2rem; }
.scene-body p { font-size: .78rem; color: #4b5563; line-height: 1.55; margin: 0; }

/* ━━━ 関連ツール ━━━ */
.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: #f59e0b; box-shadow: 0 2px 8px rgba(245,158,11,.1); }
.related-tool-icon { font-size: 1.6rem; flex-shrink: 0; }
.related-tool-item strong { display: block; font-size: .88rem; font-weight: 700; color: #f59e0b; margin-bottom: .2rem; }
.related-tool-item p { font-size: .76rem; color: #888; line-height: 1.5; 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: #f59e0b; margin-bottom: .35rem; }
.faq-a { font-size: .85rem; color: #555; line-height: 1.75; }
