/* ============================================================
   カスタムCSS — 最高の知育サブスクベスト3
   ============================================================ */

:root {
  --primary: #3DAA6E;
  --primary-dark: #2D8A54;
  --accent: #F96C30;
  --yellow: #ffda54;
  --section-bg: #F0FAF4;
  --section-bg-2: #DCF5E7;
  --card-shadow: 0 2px 10px rgba(0,0,0,0.08);
  --card-hover-shadow: 0 8px 28px rgba(61,170,110,0.18);
  --radius: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: #f5f7fa;
  font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
  color: #1f2937;
}

/* ============================================================
   ヘッダー
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  box-shadow: 0 1px 8px rgba(0,0,0,0.10);
  transition: box-shadow 0.2s;
}

.site-header.scrolled {
  box-shadow: 0 2px 16px rgba(0,0,0,0.15);
}

/* ============================================================
   ヒーローセクション
   ============================================================ */
.hero-section {
  background: linear-gradient(135deg, #2D8A54 0%, #3DAA6E 60%, #4DC880 100%);
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 200%;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}

.hero-section::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 40%;
  height: 150%;
  background: rgba(255,255,255,0.03);
  border-radius: 50%;
}

/* ============================================================
   ランクリボン（左上リボン型バッジ）
   ============================================================ */
.rank-ribbon {
  position: absolute;
  top: 0;
  left: 0;
  width: 86px;
  height: 86px;
  overflow: hidden;
  z-index: 2;
  pointer-events: none;
}

.rank-ribbon::before {
  content: attr(data-label);
  position: absolute;
  top: 22px;
  left: -24px;
  width: 96px;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.04em;
  transform: rotate(-45deg);
  transform-origin: center center;
  padding: 4px 0;
}

.rank-ribbon.ribbon-1::before { background: #f5a623; }
.rank-ribbon.ribbon-2::before { background: #8c9399; }
.rank-ribbon.ribbon-3::before { background: #b87333; }

/* ============================================================
   Top3カード
   ============================================================ */
.top3-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 2px solid #e5e7eb;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.25s, transform 0.2s;
}

.top3-card:hover {
  box-shadow: var(--card-hover-shadow);
  transform: translateY(-2px);
}

.top3-card.top3-rank-1 { border-color: #f5a623; }
.top3-card.top3-rank-2 { border-color: #b0b5ba; }
.top3-card.top3-rank-3 { border-color: #b87333; }

.top3-card-body {
  padding: 1.5rem 1.5rem 1.5rem 1.5rem;
}

.top3-assertion {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--section-bg);
  border-left: 4px solid var(--primary);
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  border-radius: 0 6px 6px 0;
}

.top3-spec-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.top3-spec-item {
  background: #f8fafc;
  border-radius: 8px;
  padding: 0.5rem;
  text-align: center;
}

.top3-spec-label {
  font-size: 0.68rem;
  color: #6b7280;
  margin-bottom: 0.2rem;
}

.top3-spec-value {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1f2937;
}

.top3-spec-value.highlight {
  color: var(--primary);
}

.top3-reason {
  font-size: 0.85rem;
  color: #4b5563;
  line-height: 1.65;
  margin-bottom: 1.25rem;
}

.top3-btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ============================================================
   申し込みボタン
   ============================================================ */
.apply-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.65rem 1.5rem;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  box-shadow: 0 2px 8px rgba(249,108,48,0.4);
  white-space: nowrap;
}

.apply-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(249,108,48,0.5);
  background: #e55e20;
}

.apply-btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
  box-shadow: none;
}

.apply-btn-outline:hover {
  background: var(--section-bg);
  box-shadow: none;
  transform: translateY(-1px);
}

.apply-btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 2px 8px rgba(61,170,110,0.4);
}

.apply-btn-primary:hover {
  box-shadow: 0 4px 16px rgba(61,170,110,0.5);
  background: linear-gradient(135deg, #4DC880, #3DAA6E);
}

/* ============================================================
   フローチャート（迷ったらセクション）
   ============================================================ */
.flowchart {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 580px;
  margin: 0 auto;
}

.flow-item {
  display: flex;
  align-items: center;
  gap: 0;
}

.flow-condition {
  background: #fff;
  border: 2px solid var(--primary);
  border-radius: 9999px;
  padding: 0.6rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary-dark);
  min-width: 220px;
  text-align: center;
}

.flow-arrow {
  font-size: 1.3rem;
  color: var(--accent);
  margin: 0 0.75rem;
  flex-shrink: 0;
}

.flow-result {
  background: var(--accent);
  color: #fff;
  border-radius: 9999px;
  padding: 0.6rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
  display: inline-block;
}

.flow-result:hover {
  background: #e55e20;
  transform: translateY(-1px);
}

.flow-divider {
  width: 2px;
  height: 1.5rem;
  background: #d1d5db;
  margin-left: 109px;
}

/* ============================================================
   サービスビジュアル（アイコン型）
   ============================================================ */
.service-visual {
  width: 88px;
  height: 88px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.service-visual::before {
  content: '';
  position: absolute;
  top: -20%;
  right: -20%;
  width: 60%;
  height: 60%;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
}

/* ============================================================
   キャンペーンバッジ
   ============================================================ */
.campaign-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.campaign-badge.hot {
  background: #fee2e2;
  color: #dc2626;
}

.campaign-badge.new-badge {
  background: #d1fae5;
  color: #059669;
}

/* ============================================================
   スペック表（service/[id].html用）
   ============================================================ */
.spec-table {
  width: 100%;
  border-collapse: collapse;
}

.spec-table th, .spec-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.9rem;
}

.spec-table th {
  background: #f1f5f9;
  font-weight: 600;
  color: #475569;
  width: 35%;
}

.spec-table td {
  color: #1f2937;
  font-weight: 500;
}

/* ============================================================
   ポイント還元率バー
   ============================================================ */
.rate-bar {
  height: 6px;
  background: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
}

.rate-bar-fill {
  height: 100%;
  background: linear-gradient(to right, var(--primary), #4DC880);
  border-radius: 9999px;
  transition: width 0.6s ease;
}

/* ============================================================
   星評価
   ============================================================ */
.star-rating {
  display: inline-flex;
  gap: 1px;
  color: #f5a623;
  font-size: 0.9rem;
}

/* ============================================================
   フッター
   ============================================================ */
.site-footer {
  background: #1e293b;
  color: #94a3b8;
}

.site-footer a {
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.2s;
}

.site-footer a:hover { color: #fff; }

/* ============================================================
   スクロールバー
   ============================================================ */
.tab-scroll::-webkit-scrollbar { height: 4px; }
.tab-scroll::-webkit-scrollbar-track { background: #f1f5f9; }
.tab-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9999px; }

/* ============================================================
   アニメーション
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.4s ease; }
.slide-down { animation: slideDown 0.3s ease; }

/* ============================================================
   Utilities
   ============================================================ */
.text-primary { color: var(--primary); }
.bg-primary { background: var(--primary); }
.border-primary { border-color: var(--primary); }
.bg-section  { background: var(--section-bg); }
.bg-section-2 { background: var(--section-bg-2); }

.truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   レスポンシブ
   ============================================================ */
@media (max-width: 768px) {
  .service-visual { width: 72px; height: 72px; font-size: 2.2rem; }
  .spec-table th { width: 40%; }
  .flow-condition { min-width: 160px; font-size: 0.85rem; }
  .flow-result { font-size: 0.85rem; }
}

@media (max-width: 640px) {
  .apply-btn {
    padding: 0.55rem 1.1rem;
    font-size: 0.85rem;
  }
  .top3-btn-row {
    flex-direction: column;
  }
  .top3-btn-row .apply-btn {
    text-align: center;
    width: 100%;
  }
  .flow-item {
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
  }
  .flow-condition { min-width: unset; width: 100%; }
  .flow-arrow { transform: rotate(90deg); }
  .flow-divider { margin-left: auto; margin-right: auto; }
}
