/* ==========================================
   STUDIO U PORTAL - Modern Minimalist Theme
   ========================================== */

/* デザインシステムと変数定義 */
:root {
  --font-family: 'Outfit', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  /* カラーパレット (白ベース＆コントラスト強化) */
  --bg-primary: #f1f5f9;        /* Slate 100 (少し深めてカードの白を際立たせる) */
  --bg-card: #ffffff;           /* 純白のカード */
  --text-primary: #0f172a;      /* Slate 900 (引き締まったダークネイビー) */
  --text-secondary: #334155;    /* Slate 700 (読みやすい深いグレー) */
  --text-muted: #64748b;        /* Slate 500 (見やすいグレー) */
  
  /* 💙 カラー1：知的なネイビーブルー */
  --accent-primary: #1e3a8a;    /* Indigo 900 (深みのあるノーブルネイビー) */
  --accent-hover: #1d4ed8;      /* Blue 700 */
  --accent-light: #f0f9ff;      /* Sky 50 */
  --accent-border: #bae6fd;     /* Sky 200 */
  
  /* 🧡 カラー2（アクセント）：洗練されたテラコッタオレンジ */
  --game-primary: #ea580c;      /* Orange 600 (温かみとアクティブさのある上品オレンジ) */
  --game-hover: #c2410c;        /* Orange 700 */
  --game-light: #fff7ed;        /* Orange 50 */
  --game-border: #ffedd5;       /* Orange 100 */
  
  /* ボーダーと影 */
  --border-color: #cbd5e1;      /* Slate 300 (境界をくっきりさせて真っ白感を防ぐ) */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 12px 20px -3px rgba(15, 23, 42, 0.04), 0 4px 6px -4px rgba(15, 23, 42, 0.02);
  
  /* 角丸とトランジション */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  
  --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 基本リセット */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  /* 💡 極薄のグリッドドットパターンを背景に敷く (方眼紙のような知的さ) */
  background-image: radial-gradient(var(--border-color) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================
   ヘッダー
   ========================================== */
.header {
  background-color: #fff7ed; /* Orange 50: 薄いオレンジベース */
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 10px,
    rgba(234, 88, 12, 0.07) 10px,
    rgba(234, 88, 12, 0.07) 12px
  );
  border-bottom: 2px solid #ffedd5; /* Orange 100 */
  padding: 44px 0;
  text-align: center;
}

.logo {
  font-family: var(--font-family);
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent-primary); /* 全部ネイビーで統一 */
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  line-height: 1;
}

.logo-label {
  font-family: 'Noto Sans JP', var(--font-family);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--accent-primary);
  opacity: 0.75;
}

.tagline {
  font-family: 'Noto Sans JP', var(--font-family);
  font-size: 0.9rem;
  color: var(--accent-primary);
  opacity: 0.6;
  font-weight: 500;
  letter-spacing: 0.08em;
  margin-top: 16px;
}

/* ==========================================
   メインコンテンツ ＆ ナビゲーション
   ========================================== */
.main-content {
  flex: 1;
  padding: 48px 0 96px 0;
}

/* 学期切り替えタブ */
.term-nav {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 48px;
  background-color: #ffffff;
  padding: 6px;
  border-radius: 14px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.nav-btn {
  font-family: var(--font-family);
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  padding: 10px 24px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.nav-btn:hover {
  color: var(--accent-primary);
  background-color: var(--accent-light);
}

.nav-btn.active {
  background-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.25);
}

/* ==========================================
   グリッド ＆ トピックカード
   ========================================== */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 32px;
}

.topic-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.topic-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: #cbd5e1; /* Slate 300 */
}

/* バッジエリア */
.card-header {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.term-badge, .subject-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 9999px;
  letter-spacing: 0.02em;
}

.term-badge {
  background-color: #f1f5f9;
  color: var(--text-secondary);
}

.subject-badge {
  background-color: var(--accent-light);
  color: var(--accent-primary);
}

/* タイトルと説明 */
.topic-title {
  font-size: 1.6rem; /* 1.4rem から 1.6rem にサイズアップ！ */
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.topic-description {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
  flex-grow: 1;
  line-height: 1.6;
}

/* ==========================================
   ゲームセクション (カード内の主役アクション)
   ========================================== */
.game-section {
  background-color: var(--game-light);
  border: 1px solid var(--game-border);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.game-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0; /* 折り返し防止対策 */
}

.game-tag {
  font-size: 0.725rem;
  font-weight: 800;
  color: var(--game-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.game-name {
  font-size: 0.975rem;
  font-weight: 700;
  color: var(--accent-primary); /* 💙 緑から知的なネイビーに変更！ */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--game-primary);
  color: white;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 8px;
  transition: var(--transition-fast);
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.15);
}

.game-btn:hover {
  background-color: var(--game-hover);
  box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2);
}

.arrow-icon {
  width: 15px;
  height: 15px;
  transition: var(--transition-fast);
}

.game-btn:hover .arrow-icon {
  transform: translateX(3px);
}

/* ==========================================
   フッター (授業プリント＆学習リンク)
   ========================================== */
.card-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* PDFダウンロード */
.pdf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: #f8fafc;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 12px;
  border-radius: 8px;
  transition: var(--transition-fast);
}

.pdf-btn:hover {
  background-color: var(--accent-light);
  color: var(--accent-primary);
  border-color: var(--accent-border);
}

.pdf-icon {
  width: 18px;
  height: 18px;
}

/* 動画リソースエリア */
.resources-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.resource-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.video-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.video-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition-fast);
  width: fit-content;
  max-width: 100%;
}

.video-link:hover {
  color: var(--accent-primary);
}

.video-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted); /* 通常時は馴染みやすいグレーに */
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.video-link:hover .video-icon {
  color: var(--accent-primary); /* ホバー時はテキストと一緒にネイビーに変化！ */
}

.video-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================
   その他・エンプティーステート
   ========================================== */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 24px;
  background-color: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
}

.empty-icon {
  width: 56px;
  height: 56px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.empty-state p {
  font-weight: 500;
  font-size: 1rem;
}

/* ページフッター */
.footer {
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 32px 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: auto;
}

/* ==========================================
   レスポンシブデザイン (スマホ最適化)
   ========================================== */
@media (max-width: 768px) {
  .header {
    padding: 32px 0;
  }
  
  .logo {
    font-size: 2.0rem;
  }

  .logo-label {
    font-size: 0.7rem;
    letter-spacing: 0.15em;
  }
  
  .term-nav {
    width: calc(100% - 16px);
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    justify-content: flex-start;
    padding: 4px;
    -webkit-overflow-scrolling: touch;
  }
  
  .nav-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
    flex-shrink: 0;
  }
  
  .topics-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .topic-card {
    padding: 20px;
  }

  /* 💡 スマホサイズ（iPhone SEの375px等）のUI/UX最適化 */
  .game-section {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px;
  }

  .game-btn {
    justify-content: center;
    padding: 12px;
  }

  .card-footer {
    gap: 16px;
  }
}

/* ==========================================
   装飾用アクセント (のっぺり感解消 & プレミアム化)
   ========================================== */
/* 1. 背景に溶け込むネイビーとオレンジの淡い光の球体 (Blur Orbs) */
.decor-blur {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  opacity: 0.35;
  filter: blur(120px);
}

.decor-blur-1 {
  top: -200px;
  left: -200px;
  background: radial-gradient(circle, rgba(30, 58, 138, 0.08) 0%, rgba(255, 255, 255, 0) 70%);
}

.decor-blur-2 {
  bottom: -100px;
  right: -200px;
  background: radial-gradient(circle, rgba(234, 88, 12, 0.06) 0%, rgba(255, 255, 255, 0) 70%);
}

/* 2. メンフィス風・化学幾何学アクセント (少し主張して数も増やした版) */
.bg-shape {
  position: fixed;
  pointer-events: none;
  z-index: -1;
  opacity: 0.10; /* 4% → 10% に上げて少し主張した */
}

/* 六角形１: 左上・ネイビー（大） */
.shape-hex-1 {
  top: 12%;
  left: 4%;
  width: 90px;
  height: 104px;
  background-color: var(--accent-primary);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

/* 六角形２: 右下・オレンジ（大） */
.shape-hex-2 {
  bottom: 15%;
  right: 4%;
  width: 110px;
  height: 127px;
  background-color: var(--game-primary);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

/* 六角形３: 右上・ネイビー（小） */
.shape-hex-3 {
  top: 8%;
  right: 5%;
  width: 55px;
  height: 63px;
  background-color: var(--accent-primary);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

/* プラス記号１: 右中外・オレンジ */
.shape-cross-1 {
  top: 45%;
  right: 6%;
  width: 40px;
  height: 40px;
  background-color: var(--game-primary);
  clip-path: polygon(35% 0%, 65% 0%, 65% 35%, 100% 35%, 100% 65%, 65% 65%, 65% 100%, 35% 100%, 35% 65%, 0% 65%, 0% 35%, 35% 35%);
}

/* プラス記号２: 左下・ネイビー */
.shape-cross-2 {
  bottom: 30%;
  left: 5%;
  width: 30px;
  height: 30px;
  background-color: var(--accent-primary);
  clip-path: polygon(35% 0%, 65% 0%, 65% 35%, 100% 35%, 100% 65%, 65% 65%, 65% 100%, 35% 100%, 35% 65%, 0% 65%, 0% 35%, 35% 35%);
}

/* サークル１: 左中・ネイビー */
.shape-circle-1 {
  top: 50%;
  left: 4%;
  width: 56px;
  height: 56px;
  border: 7px solid var(--accent-primary);
  border-radius: 50%;
}

/* サークル２: 右上・オレンジ（小） */
.shape-circle-2 {
  top: 28%;
  right: 4%;
  width: 36px;
  height: 36px;
  border: 5px solid var(--game-primary);
  border-radius: 50%;
}

/* スマホ画面では背景グラフィックスを非表示 */
@media (max-width: 768px) {
  .bg-shape {
    display: none;
  }
}
