/* ================================================
   共通ナビゲーション
   ================================================ */

/* ---- ヘッダー全体 ---- */
header {
  background-color: var(--primary-color);
  color: white;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 500;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* ---- サイト名 ---- */
.site-brand {
  flex-shrink: 0;
}

.site-brand a {
  color: white;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.3;
  display: block;
}

.site-brand .brand-sub {
  font-size: 0.7rem;
  opacity: 0.8;
  font-weight: 400;
  display: block;
}

/* ---- デスクトップ ナビ ---- */
.main-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  color: rgba(255,255,255,0.88);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.is-active {
  background: rgba(255,255,255,0.18);
  color: white;
}

/* ドロップダウン（学習） */
.nav-dropdown-wrap {
  position: relative;
}

.nav-dropdown-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.88);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: background 0.15s;
  white-space: nowrap;
}

.nav-dropdown-btn:hover {
  background: rgba(255,255,255,0.18);
  color: white;
}

.nav-arrow {
  font-size: 0.7rem;
  transition: transform 0.2s;
}

.nav-dropdown-wrap:hover .nav-arrow,
.nav-dropdown-wrap.is-open .nav-arrow {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: white;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
  min-width: 160px;
  overflow: hidden;
  z-index: 600;
}

.nav-dropdown-wrap:hover .nav-dropdown-menu,
.nav-dropdown-wrap.is-open .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-item {
  display: block;
  padding: 0.65rem 1rem;
  color: var(--text-primary, #1f2937);
  text-decoration: none;
  font-size: 0.875rem;
  transition: background 0.12s;
}

.nav-dropdown-item:hover {
  background: var(--bg-secondary, #f9fafb);
  color: var(--primary-color, #3b82f6);
}

/* ---- ヘッダー右端アクション ---- */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-left: auto;
}

/* 通知歯車ボタン（notification.js が追加） */
.notif-gear-btn {
  background: transparent;
  border: 2px solid rgba(255,255,255,0.5);
  color: white;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.notif-gear-btn:hover {
  background: rgba(255,255,255,0.15);
  border-color: white;
}

/* ハンバーガーボタン（スマホのみ表示） */
.hamburger-btn {
  display: none;
  background: transparent;
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 38px;
}

.hamburger-btn.is-open .hamburger-line:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.hamburger-btn.is-open .hamburger-line:nth-child(2) { opacity: 0; }
.hamburger-btn.is-open .hamburger-line:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

.hamburger-line {
  display: block;
  width: 20px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}

/* ================================================
   モバイルドロワー
   ================================================ */

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 700;
}

.mobile-overlay.is-open { display: block; }

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  background: white;
  z-index: 800;
  transform: translateX(100%);
  transition: transform 0.28s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.mobile-drawer.is-open {
  transform: translateX(0);
}

.mobile-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  height: 56px;
  background: var(--primary-color, #3b82f6);
  color: white;
  flex-shrink: 0;
}

.mobile-drawer-head span {
  font-weight: 700;
  font-size: 0.95rem;
}

.mobile-drawer-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem 0.4rem;
}

.mobile-nav {
  padding: 0.75rem 0;
  flex: 1;
}

.mobile-nav-link {
  display: block;
  padding: 0.8rem 1.25rem;
  color: var(--text-primary, #1f2937);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  transition: background 0.12s;
}

.mobile-nav-link:hover,
.mobile-nav-link.is-active {
  background: #eff6ff;
  color: var(--primary-color, #3b82f6);
}

.mobile-nav-section {
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.mobile-nav-section-title {
  padding: 0.8rem 1.25rem 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mobile-nav-sublink {
  display: block;
  padding: 0.65rem 1.25rem 0.65rem 2rem;
  color: var(--text-primary, #1f2937);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.12s;
}

.mobile-nav-sublink:hover {
  background: #eff6ff;
  color: var(--primary-color, #3b82f6);
}

/* ================================================
   ホームページ 導線カード（過去問・バトル・ランキング）
   ================================================ */

.action-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.25rem 0.75rem;
  background: var(--bg-primary, #fff);
  border: 2px solid var(--border-color, #e5e7eb);
  border-radius: var(--border-radius, 8px);
  text-decoration: none;
  color: var(--text-primary, #1f2937);
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.15s;
}

.action-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.action-card .action-icon {
  font-size: 2rem;
  line-height: 1;
}

.action-card.card-past  { border-color: #f59e0b; }
.action-card.card-past:hover { border-color: #d97706; }
.action-card.card-battle { border-color: #ef4444; }
.action-card.card-battle:hover { border-color: #dc2626; }
.action-card.card-rank  { border-color: #10b981; }
.action-card.card-rank:hover { border-color: #059669; }

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

@media (max-width: 768px) {
  .main-nav      { display: none; }
  .hamburger-btn { display: flex; }

  .site-brand .brand-sub { display: none; }
  .site-brand a { font-size: 0.9rem; }

  .action-cards {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
  }

  .action-card {
    padding: 1rem 0.5rem;
    font-size: 0.78rem;
  }

  .action-card .action-icon { font-size: 1.6rem; }
}

@media (max-width: 400px) {
  .action-cards { grid-template-columns: 1fr; }
}
