/* =====================
   BASE STYLES
===================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    "Noto Sans JP",
    "Apple Color Emoji",
    "Segoe UI Emoji",
    "Noto Color Emoji",
    sans-serif;
  background: #f7f7f7; /* カードが際立つよう薄いグレーを維持 */
  color: #333;
  line-height: 1.6;
  padding-top: 72px; /* header 分 */
}

/* =====================
   HEADER & HERO
===================== */
.site-header {
  height: 72px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  background: #ffffff;
  position: fixed;
  top: 0;
  left: 0; /* 左端を明示的に指定 */
  z-index: 100;
  width: 100%;
  box-sizing: border-box; /* パディングによるはみ出しを防止 */
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.logo-area {
  display: flex;
  align-items: center; /* ロゴとテキストを中央揃え */
}

.logo-area img {
  height: 40px;
  display: block; /* 画像の下にできる謎の隙間を消す */
}

.home-link {
  margin-left: 15px;
  color: #0073aa;
  text-decoration: none;
  font-size: 14px; /* サイズを指定しておくと安心 */
}

.home-link:hover {
  text-decoration: underline;
}

.hero {
  background: #0b6edc;
  color: #fff;
  text-align: center;
  padding: 50px 20px 55px; /* 下の余白を多めにとって重ねる準備 */
}

.hero h1 {
  font-size: 2.2rem;
  margin-bottom: 10px;
  font-weight: 800;
}

.hero-en {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.hero-sub {
  font-size: 1rem;
  opacity: 0.95;
  max-width: 600px;
  margin: 0 auto 20px;
}


/* =========================
   RESET / BASE
========================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Noto Sans JP", sans-serif;
  background: #f7f7f7;
  color: #333;
  line-height: 1.6;
}

/* =========================
   FILTER AREA
========================= */
.filter-area {
  position: -webkit-sticky; /* Safari対応 */
  position: sticky;
  top: 72px;                 /* ← ヘッダー分ずらす（重要） */
  z-index: 95;               /* header(100) より下 */
  background: #fef5e7;
  margin: 0 auto 18px;       /* ← マイナスマージンをやめる */
  padding: 10px 12px;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.1);
  max-width: 100%;
  width: 100%;
}

.filter-note {
  font-size: 12px;
  font-weight: 400;
  color: #8d7d66;
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: 0.08em;
}

.filter-note strong {
  font-weight: 700;
}

/* =========================
   FILTER NAV 共通
========================= */
#resetBtn {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  color: #475569;
  border: 1.5px solid #e2e8f0;
  display: block;
  margin: 0 auto 10px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#resetBtn:hover {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

/* active state now uses a vibrant blue gradient instead of green */
#resetBtn.active {
  background: linear-gradient(135deg, #a7f3d0 0%, #6ee7b7 100%);
  color: #065f46;
  border-color: #34d399;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

#resetBtn.active:hover {
  background: linear-gradient(135deg, #6ee7b7 0%, #34d399 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}

.category-wrapper.is-collapsed .filter-nav-category {
  display: none;
}

.category-toggle {
  display: none; /* PCでは非表示 */
  margin: 0 auto 8px;
  font-size: 13px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  padding: 6px 14px;
}



.filter-nav-category,
.filter-nav-alphabet {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}

/* category buttons now use modern blue-gray styling */
.filter-nav-category button {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  color: #3b82f6;
  border: 1.5px solid #bfdbfe;
  border-radius: 10px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* alphabet buttons also use modern blue styling */
.filter-nav-alphabet button {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  color: #0ea5e9;
  border: 1.5px solid #bae6fd;
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* grammar filter now uses purple accent color */
.filter-nav-category button.grammar-filter {
  color: #6624a4;
  border-color: #e9d5ff;
}

/* hover（未選択のみ） */
.filter-nav-category button:not(.active):hover:not(.disabled),
.filter-nav-alphabet button:not(.active):hover:not(.disabled) {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.15);
  border-color: #93c5fd;
}

/* disabled state is more subtle and professional */
.filter-nav-alphabet button.disabled {
  color: #cbd5e1;
  border-color: #e2e8f0;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.6;
  box-shadow: none;
}

.uncountable-desc {
  display: none;
  margin-top: 12px;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
  color: #334155;
}

.uncountable-desc .example {
  margin-top: 6px;
  color: #475569;
  font-size: 13px;
}

.uncountable-desc.is-open {
  display: block;
}



/* =========================
   ACTIVE（通常）
========================= */
/* active state now uses modern blue gradient instead of yellow */
.filter-nav-category button.active:not(.grammar-filter) {
  background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
  color: #991b1b;
  border-color: #f87171;
  cursor: default;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
  transform: translateY(-1px);
}

.filter-nav-alphabet button.active {
  background: linear-gradient(135deg, #bfdbfe 0%, #93c5fd 100%);
  color: #1e3a8a;
  border-color: #60a5fa;
  cursor: default;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
  transform: translateY(-1px);
}

/* 文法・性質フィルター共通 */
/* grammar filter has softer default styling */
.grammar-filter {
  background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
  color: #7c3aed;
  border: 1.5px solid #e9d5ff;
  margin-left: 14px;
}

/* ON のとき */
/* active grammar filter uses purple gradient */
.filter-nav-category button.grammar-filter.active {
  background: linear-gradient(135deg, #e9d5ff 0%, #d8b4fe 80%);
  color: #3b0764;
  border-color: #c084fc;
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.25);
  transform: translateY(-1px);
  font-weight: 700;
}

/* hover */
.grammar-filter:not(.active):hover {
  background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(168, 85, 247, 0.15);
  border-color: #d8b4fe;
}

/* ON + hover */
.grammar-filter.active:hover {
  background: linear-gradient(135deg, #d8b4fe 0%, #c084fc 100%);
  box-shadow: 0 6px 16px rgba(168, 85, 247, 0.3);
}


/* =========================
   CARD GRID
========================= */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  max-width: 90%;
  margin: 0 auto 60px;
  padding: 0 16px;
}

/* =========================
   CARD
========================= */
.card {
  background: #ffffff;
  border-radius: 18px;
  padding: 12px 12px 14px;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.lang-info {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 0.65rem;
  color: #aaa;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.card img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  margin-bottom: 8px;
}

.expression {
  font-size: 1.2rem;
  font-weight: 800;
  color: #0b6edc;
  margin-bottom: 4px;
}

.meaning {
  font-size: 1rem;
  margin-bottom: 6px;
}

.note {
  font-size: 0.85rem;
  background: #f8f9fa;
  padding: 8px;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  color: #334155; 
  text-align: left;
  line-height: 1.55;
  margin-top: 10px;
}

.fi {
  margin-right: 5px;
  border-radius: 2px; /* 少し角を丸くする */
  vertical-align: middle;
}

.note-extra {
  margin-top: 6px;
  padding: 4px 6px;
  background: #f5f7fa;
  border-left: 3px solid #bbb;
  font-size: 0.75em;
  color: #555;
}

.trial-button {
  background: #ff6b35;
  color: #fff;
  padding: 12px 24px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: bold;
  transition: opacity 0.2s;
}

.trial-button:hover {
  opacity: 0.9;
}

#chatTopBtn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 55px;
  height: 55px;
  background-color: #58d68d;
  color: #fff;
  border-radius: 50%;
  box-shadow: 0 4px 8px rgba(0,0,0,0.25);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 1000;
}

#chatTopBtn:hover {
  background-color: #45b97c;
  transform: scale(1.05);
}

/* スクロールするまで非表示にする場合 */
#chatTopBtn.hide {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#chatTopBtn.show {
  opacity: 1;
}



/* Footer */
.footer {
  background: #333;
  color: white;
  padding: 40px 0 20px;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 0 40px;
}

.footer-logo img {
  height: 40px;
  filter: brightness(0) invert(1);
  margin-left: 20px;
}

.footer-nav {
  display: flex;
  gap: 30px;
}

.footer-nav a {
  color: white;
  text-decoration: none;
  transition: color 0.3s;
}

.footer-nav a:hover {
  color: #ff6b35;
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid #555;
  color: #ccc;
}



/* =========================
   MOBILE（スマホ最適化）
========================= */
@media (max-width: 600px) {
  .header-inner {
    padding: 6px 12px;  /* 上下を削る */
  }

  .site-header {
    height: 44px;
    padding: 0 14px;
  }

  body {
    padding-top: 44px !important; /* ヘッダー分だけ確保 */
    padding-left: 0;
    padding-right: 0;
  }

  .logo-area img {
    height: 28px; /* PC:40px → スマホで小さく */
  }
  .home-link {
    font-size: 12px;   /* 14px → 12px */
    margin-left: 6px;  /* 余白を削る */
    white-space: nowrap;
  }


  .trial-button {
    white-space: nowrap;
    font-size: 12px;
    padding: 6px 10px;        /* 上下・左右を縮める */
    border-radius: 16px;      /* 少しだけ丸く */
  }


  /* HEROエリアの余白を上下均等に、かつ少しタイトに */
  .hero {
    padding: 20px 16px 22px; /* 上・左右・下を明示 */
  }

  .hero h1 {
    font-size: 1.6rem; /* スマホ用に文字サイズを少し調整 */
  }

  .hero-en {
    font-size: 1rem;
  }

  .hero-sub {
    font-size: 0.9rem;
    margin-bottom: 10px; /* 下の間隔も少し詰める */
  }
  

  .filter-area {
    top: 44px;   /* ヘッダー高さに合わせる */
    margin: 0 auto 20px;
    padding: 12px;
  }

  .filter-note {
    font-size: 11px;
  }
  .category-toggle {
    display: block;
  }
  .filter-nav-category button,
    .filter-nav-all button {
    padding: 8px 12px;
    font-size: 14px;
  }
  .filter-nav-category {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* ← 3列固定 */
    gap: 6px;
  }

  .filter-nav-alphabet button {
      flex: none;         /* flex固定を解除 */
      width: auto;
      padding: 8px 0;     /* 左右パディングを0にして中央寄せに集中 */
      font-size: 13px;    /* 文字を少し小さく */
      text-align: center;
      min-width: 0;       /* グリッド内で圧縮を許可 */
    }

  .filter-nav-alphabet {
      display: grid;
      /* 1行に13文字ずつ並べて2行にする設定（画面幅に応じて調整） */
      grid-template-columns: repeat(9, 1fr); 
      gap: 6px;           /* ボタン間の隙間を狭く */
      justify-content: center;
      overflow-x: visible; /* 横スクロールを解除 */
      flex-wrap: wrap;     /* 念のため */
      padding: 0 4px;
    }
  
  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    padding: 0 8px;
  }

  .card {
    padding: 10px 10px 12px;
  }

  .card img {
    height: 150px;
  }

  .expression {
    font-size: 1.05rem;
  }

  .meaning {
    font-size: 0.9rem;
  }

  .note {
    font-size: 0.8rem;
    background: #e9eef5;
  }
  #chatTopBtn {
    bottom: 10px; /* 例：20px → 12px に下げる */
  }
}

/* 超小型スマホ */
@media (max-width: 380px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
  .filter-nav-alphabet {
      grid-template-columns: repeat(9, 1fr); /* 3行構成に自動でシフト */
  }

}
