* { 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: #f0f4ff;
  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: #dc2626;
  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.65rem;
  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;
}

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

/* ━━━ ツールラッパー ━━━ */
.tool-wrap {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #dbeafe;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

/* ━━━ レベルタブ ━━━ */
.level-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.level-tab {
  padding: 0.5rem 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: bold;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.level-tab.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.level-tab:hover:not(.active) {
  border-color: #2563eb;
  color: #2563eb;
}

/* ━━━ モードタブ ━━━ */
.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.mode-tab {
  padding: 0.6rem 0.25rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: bold;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.mode-tab.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.mode-tab:hover:not(.active) {
  border-color: #2563eb;
  color: #2563eb;
}

.weak-badge {
  display: inline-block;
  background: #dc2626;
  color: #fff;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: bold;
  padding: 0.05rem 0.4rem;
  min-width: 1.4rem;
  text-align: center;
}

.mode-tab.active .weak-badge {
  background: rgba(255,255,255,0.3);
}

/* ━━━ 進捗バー ━━━ */
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.progress-bar-bg {
  flex: 1;
  height: 6px;
  background: #e0e7ff;
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: #2563eb;
  border-radius: 3px;
  transition: width 0.3s;
  width: 0%;
}

.progress-text {
  font-size: 0.78rem;
  color: #888;
  flex-shrink: 0;
  min-width: 3.5rem;
  text-align: right;
}

/* ━━━ フラッシュカード ━━━ */
.flash-card {
  width: 100%;
  height: 200px;
  perspective: 1000px;
  cursor: pointer;
  margin-bottom: 0.75rem;
  -webkit-tap-highlight-color: transparent;
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-inner.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  gap: 0.4rem;
}

.card-front {
  background: linear-gradient(135deg, #fff 0%, #eff6ff 100%);
  border: 2px solid #bfdbfe;
  box-shadow: 0 2px 12px rgba(37,99,235,0.08);
}

.card-front:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 16px rgba(37,99,235,0.15);
}

.card-back {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 2px solid #93c5fd;
  box-shadow: 0 2px 12px rgba(37,99,235,0.1);
  transform: rotateY(180deg);
}

.speak-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 34px;
  height: 34px;
  border: 1px solid #e0e7ff;
  border-radius: 50%;
  background: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
  padding: 0;
  flex-shrink: 0;
}

.speak-btn:hover {
  background: #eff6ff;
  border-color: #2563eb;
}

.weak-label {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: #dc2626;
  color: #fff;
  font-size: 0.68rem;
  font-weight: bold;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.card-word {
  font-size: 2rem;
  font-weight: bold;
  color: #1e3a8a;
  letter-spacing: 0.02em;
  text-align: center;
}

.card-pos {
  font-size: 0.78rem;
  color: #93c5fd;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card-hint {
  font-size: 0.75rem;
  color: #bfdbfe;
  margin-top: 0.5rem;
}

.card-word-sm {
  font-size: 0.95rem;
  color: #60a5fa;
  font-weight: bold;
  letter-spacing: 0.02em;
}

.card-meaning {
  font-size: 1.4rem;
  font-weight: bold;
  color: #1e3a8a;
  text-align: center;
  line-height: 1.5;
}

/* ━━━ アクションボタン ━━━ */
.action-btns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.action-btn {
  padding: 0.75rem;
  border-radius: 12px;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.action-btn:active { transform: scale(0.97); }

.action-btn.unknown {
  background: #fee2e2;
  color: #dc2626;
}

.action-btn.unknown:hover { background: #fecaca; }

.action-btn.known {
  background: #dcfce7;
  color: #16a34a;
}

.action-btn.known:hover { background: #bbf7d0; }

/* ━━━ 4択クイズ ━━━ */
.quiz-question {
  position: relative;
  background: linear-gradient(135deg, #fff 0%, #eff6ff 100%);
  border: 2px solid #bfdbfe;
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
  margin-bottom: 0.75rem;
}

.quiz-word {
  font-size: 1.9rem;
  font-weight: bold;
  color: #1e3a8a;
  margin-bottom: 0.2rem;
  letter-spacing: 0.02em;
}

.quiz-pos {
  font-size: 0.78rem;
  color: #93c5fd;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.quiz-prompt {
  font-size: 0.82rem;
  color: #94a3b8;
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.choice-btn {
  padding: 0.75rem 0.5rem;
  border: 2px solid #e0e7ff;
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: bold;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.4;
  text-align: center;
}

.choice-btn:hover:not(:disabled) {
  border-color: #2563eb;
  background: #eff6ff;
  color: #2563eb;
}

.choice-btn.correct {
  background: #dcfce7;
  border-color: #16a34a;
  color: #15803d;
}

.choice-btn.wrong {
  background: #fee2e2;
  border-color: #dc2626;
  color: #dc2626;
}

.choice-btn:disabled { cursor: default; }

.quiz-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 2.5rem;
}

.quiz-score {
  font-size: 0.88rem;
  font-weight: bold;
  color: #64748b;
}

.next-btn {
  padding: 0.5rem 1.1rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.15s;
}

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

/* ━━━ 復習空状態 ━━━ */
.empty-icon {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 0.75rem;
}

.empty-title {
  font-size: 1rem;
  font-weight: bold;
  text-align: center;
  color: #374151;
  margin-bottom: 0.4rem;
}

.empty-desc {
  font-size: 0.85rem;
  color: #94a3b8;
  text-align: center;
  line-height: 1.8;
  padding-bottom: 0.5rem;
}

/* ━━━ 完了画面 ━━━ */
.complete-icon {
  font-size: 3.5rem;
  text-align: center;
  margin-bottom: 0.75rem;
}

.complete-msg {
  font-size: 1.1rem;
  font-weight: bold;
  text-align: center;
  color: #1e3a8a;
  margin-bottom: 0.3rem;
}

.complete-sub {
  font-size: 0.85rem;
  color: #64748b;
  text-align: center;
  margin-bottom: 1rem;
}

/* ━━━ プライマリボタン ━━━ */
.primary-btn {
  display: block;
  width: 100%;
  padding: 0.9rem;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.15s;
  letter-spacing: 0.03em;
}

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

/* ━━━ 苦手単語カード ━━━ */
.weak-card-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.weak-card strong {
  display: block;
  font-size: 0.9rem;
  color: #333;
  margin-bottom: 0.15rem;
}

.weak-card p {
  font-size: 0.78rem;
  color: #999;
}

.reset-btn {
  padding: 0.4rem 0.9rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
  font-family: inherit;
  font-size: 0.8rem;
  color: #666;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}

.reset-btn:hover {
  border-color: #dc2626;
  color: #dc2626;
}

.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: #2563eb; }
.how-item p { font-size: 0.875rem; color: #666; line-height: 1.7; }

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: #2563eb; }
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; }
  .tool-wrap { padding: 1rem; }
  .card-word { font-size: 1.7rem; }
  .quiz-word { font-size: 1.5rem; }
  .card-meaning { font-size: 1.2rem; }
  .choice-btn { font-size: 0.82rem; padding: 0.6rem 0.4rem; }

  .tips-grid { grid-template-columns: 1fr; }
}

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

/* ━━━ ヒーローバッジ ━━━ */
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
.badge {
  display: inline-block;
  padding: 5px 13px;
  background: #dbeafe;
  color: #1d4ed8;
  border: 1.5px solid #bfdbfe;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ━━━ 活用シーン ━━━ */
.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: #eff6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: 12px;
}
.scene-icon { font-size: 1.7rem; flex-shrink: 0; }
.scene-body strong { display: block; font-size: .88rem; font-weight: 700; color: #1e3a8a; 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 #dbeafe;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.related-tool-item:hover { border-color: #2563eb; box-shadow: 0 2px 8px rgba(37,99,235,.1); }
.related-tool-icon { font-size: 1.6rem; flex-shrink: 0; }
.related-tool-item strong { display: block; font-size: .88rem; font-weight: 700; color: #2563eb; margin-bottom: .2rem; }
.related-tool-item p { font-size: .76rem; color: #6b7280; line-height: 1.5; margin: 0; }

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

@media (max-width: 600px) {
  .scene-grid { grid-template-columns: 1fr; }
}
