/* ==========================================================================
   特別支援教育 数学・算数ポータル スタイルシート (style.css)
   ========================================================================== */

:root {
  /* カラーパレット */
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-surface-hover: #ffffff;
  --color-text-main: #1e293b;
  --color-text-muted: #64748b;
  --color-text-light: #94a3b8;

  /* ブランド・アクセントカラー */
  --color-primary: #3b82f6;
  --color-primary-dark: #1d4ed8;
  --color-primary-light: #eff6ff;
  --color-primary-border: #bfdbfe;

  --color-success: #10b981;
  --color-success-bg: #ecfdf5;
  --color-success-border: #a7f3d0;

  --color-orange: #f97316;
  --color-orange-bg: #fff7ed;
  --color-purple: #8b5cf6;
  --color-purple-bg: #f5f3ff;

  /* シャドウ・ボーダー */
  --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 6px 16px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 32px -4px rgba(15, 23, 42, 0.12);
  --shadow-hover: 0 20px 36px -6px rgba(59, 130, 246, 0.18);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;

  /* フォント */
  --font-main: "M PLUS Rounded 1c", "Zen Maru Gothic", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* 背景デコレーション */
.bg-shape {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -1;
  opacity: 0.5;
  pointer-events: none;
}
.bg-shape-1 {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, #dbeafe 0%, rgba(219, 234, 254, 0) 70%);
  top: -100px;
  right: -50px;
}
.bg-shape-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #fef3c7 0%, rgba(254, 243, 199, 0) 70%);
  top: 300px;
  left: -150px;
}
.bg-shape-3 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #ede9fe 0%, rgba(237, 233, 254, 0) 70%);
  bottom: 50px;
  right: -100px;
}

.portal-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ナビゲーションバー */
.top-nav {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 50;
}
.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--color-text-main);
  font-weight: 700;
  font-size: 1.05rem;
}
.brand-badge {
  background: #e0f2fe;
  color: #0284c7;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
}
.brand-name {
  color: #334155;
}
.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
}
.nav-btn-outline {
  border: 1.5px solid #cbd5e1;
  color: #475569;
  background: #ffffff;
}
.nav-btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
  transform: translateY(-1px);
}

/* ヘッダーエリア */
.portal-header {
  padding: 44px 24px 32px;
  text-align: center;
}
.header-container {
  max-width: 860px;
  margin: 0 auto;
}
.header-badge-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.pill-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.pill-math {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}
.pill-support {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.portal-title {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.title-sub {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f97316;
  letter-spacing: 0.05em;
}
.title-main {
  font-size: 2.3rem;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.02em;
}
.portal-description {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  line-height: 1.7;
  margin-bottom: 28px;
}
.br-pc {
  display: inline;
}

/* おすすめ学習順バナー */
.learning-flow-banner {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 100%;
}
.flow-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.flow-icon {
  font-size: 1.2rem;
}
.flow-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: #334155;
  letter-spacing: 0.03em;
}
.flow-steps {
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  flex-wrap: wrap;
  justify-content: center;
}
.flow-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 700;
  color: #334155;
}
.step-num {
  width: 20px;
  height: 20px;
  background: var(--color-primary);
  color: #ffffff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
}
.flow-arrow {
  color: #94a3b8;
  font-weight: 900;
  font-size: 0.85rem;
}

/* メインコンテンツエリア */
.portal-main {
  flex: 1;
  padding: 0 24px 60px;
}
.main-container {
  max-width: 1200px;
  margin: 0 auto;
}

/* コントロールバー（タブ＆検索） */
.controls-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 32px;
  flex-wrap: wrap;
  background: #ffffff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow-sm);
}
.category-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tab-btn {
  background: transparent;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.tab-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
}
.tab-btn.active {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}
.tab-count {
  font-size: 0.75rem;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.08);
  font-weight: 800;
}
.tab-btn.active .tab-count {
  background: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

/* 検索ボックス */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 280px;
  flex: 1;
  max-width: 360px;
}
.search-icon {
  position: absolute;
  left: 12px;
  color: #94a3b8;
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 9px 36px 9px 38px;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  background: #f8fafc;
  transition: all 0.2s ease;
}
.search-input:focus {
  border-color: var(--color-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.search-clear-btn {
  position: absolute;
  right: 10px;
  background: #cbd5e1;
  border: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.85rem;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}
.search-clear-btn:hover {
  background: #94a3b8;
}

/* アプリグリッド */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

/* アプリカード */
.app-card {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative;
  overflow: hidden;
}
.app-card:hover {
  transform: translateY(-6px);
  border-color: var(--color-primary-border);
  box-shadow: var(--shadow-hover);
}

/* カード上部のヘッダー情報 */
.card-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}
.step-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.03em;
}
.step-badge-step1 {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}
.step-badge-step2 {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}
.step-badge-step3 {
  background: #f3e8ff;
  color: #7e22ce;
  border: 1px solid #e9d5ff;
}
.step-badge-step4 {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.stage-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

/* アイコンとタイトルエリア */
.card-visual-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}
.card-icon-wrapper {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.icon-bg-orange { background: #fff7ed; border: 1.5px solid #ffedd5; }
.icon-bg-blue   { background: #eff6ff; border: 1.5px solid #dbeafe; }
.icon-bg-purple { background: #faf5ff; border: 1.5px solid #f3e8ff; }
.icon-bg-green  { background: #f0fdf4; border: 1.5px solid #dcfce7; }

.card-title-group {
  flex: 1;
}
.card-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.35;
  margin-bottom: 4px;
}
.card-subtitle {
  font-size: 0.9rem;
  font-weight: 700;
  color: #f97316;
}

/* 説明文 */
.card-description {
  font-size: 0.92rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
  flex-grow: 1;
}

/* タグ一覧 */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}
.tag-item {
  font-size: 0.78rem;
  font-weight: 700;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

/* アクションボタン（リンク） */
.card-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 20px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  text-decoration: none;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  transition: all 0.2s ease;
}
.card-action-btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
  transform: translateY(-2px);
}
.card-action-btn:active {
  transform: translateY(0);
}
.btn-arrow {
  font-size: 1.1rem;
  transition: transform 0.2s ease;
}
.card-action-btn:hover .btn-arrow {
  transform: translateX(4px);
}

/* 検索ゼロ件ステート */
.no-results {
  text-align: center;
  padding: 60px 20px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 2px dashed #cbd5e1;
}
.no-results-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}
.no-results-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #334155;
  margin-bottom: 6px;
}
.no-results-sub {
  font-size: 0.95rem;
  color: #64748b;
  margin-bottom: 20px;
}
.btn-reset-filter {
  background: var(--color-primary);
  color: #ffffff;
  border: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 9px 20px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.2s;
}
.btn-reset-filter:hover {
  background: var(--color-primary-dark);
}

/* ガイドセクション（指導のヒント） */
.guide-section {
  margin-top: 50px;
}
.guide-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-sm);
}
.guide-header {
  text-align: center;
  max-width: 650px;
  margin: 0 auto 30px;
}
.guide-badge {
  display: inline-block;
  background: #fef3c7;
  color: #b45309;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 8px;
}
.guide-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 6px;
}
.guide-subtitle {
  font-size: 0.95rem;
  color: #64748b;
}
.guide-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}
.guide-step-box {
  background: #f8fafc;
  border-left: 4px solid var(--color-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 16px 18px;
}
.guide-step-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: 4px;
}
.guide-step-box h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 6px;
}
.guide-step-box p {
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.55;
}

/* 静的フォールバック用 */
.app-card-static {
  background: #ffffff;
  padding: 20px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}
.app-card-static a {
  color: var(--color-primary);
  text-decoration: underline;
  font-weight: 800;
}
.noscript-notice {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 12px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-weight: 700;
}

/* フッター */
.portal-footer {
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  padding: 32px 24px;
  margin-top: auto;
}
.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.footer-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: #1e293b;
}
.footer-site {
  font-size: 0.85rem;
  color: #64748b;
}
.footer-copy {
  font-size: 0.85rem;
  color: #94a3b8;
}

/* レスポンシブ調整 */
@media (max-width: 768px) {
  .portal-header {
    padding: 30px 16px 24px;
  }
  .title-main {
    font-size: 1.8rem;
  }
  .portal-description {
    font-size: 0.95rem;
  }
  .br-pc {
    display: none;
  }
  .controls-section {
    flex-direction: column;
    align-items: stretch;
  }
  .search-box {
    max-width: 100%;
  }
  .flow-steps {
    flex-direction: column;
    gap: 6px;
  }
  .flow-arrow {
    transform: rotate(90deg);
  }
}
