/* ==========================================
       1. CSS変数 (ライトテーマ / ダークテーマ)
       ここでロゴの色や背景色を一括管理します
    ========================================== */
:root {
  /* Base Colors */
  --bg-color: #ffffff;
  --text-color: #0f172a;
  --border-color: rgba(15, 23, 42, 0.15);
  --header-bg: rgb(255, 255, 255);
  --footer-bg: rgb(255, 255, 255);

  /* Logo Colors */
  --logo-stroke: #0f172a;
  --logo-fill: #0f172a;

  /* Component Colors */
  --nav-link-color: rgba(15, 23, 42, 0.5);
  --btn-bg: #0f172a;
  --btn-text: #ffffff;
  --grid-line: rgba(15, 23, 42, 0.06);
}

html.dark {
  /* Base Colors */
  --bg-color: #090d16;
  --text-color: #f8fafc;
  --border-color: rgba(248, 250, 252, 0.1);
  --header-bg: rgb(9, 13, 22);
  --footer-bg: rgb(9, 13, 22);

  /* Logo Colors */
  --logo-stroke: #f8fafc;
  --logo-fill: #f8fafc;

  /* Component Colors */
  --nav-link-color: rgba(248, 250, 252, 0.5);
  --btn-bg: #f8fafc;
  --btn-text: #090d16;
  --grid-line: rgba(248, 250, 252, 0.03);
}

/* ==========================================
       2. リセット & ベーススタイル
    ========================================== */
    *, *::before, *::after {
      box-sizing: border-box;
    }
    
    /* -- 選択範囲のハイライト -- */
    ::selection {
      background-color: #2b6cb0; /* 落ち着いたクラシックなブルー */
      color: #ffffff;
    }
    ::-moz-selection {
      background-color: #2b6cb0; /* 落ち着いたクラシックなブルー */
      color: #ffffff;
    }

    /* -- カスタムスクロールバー (太めのカクカクブロック) -- */
    /* Firefox向け */
    @-moz-document url-prefix() {
      html {
        scrollbar-width: auto;
        scrollbar-color: var(--text-color) var(--bg-color);
      }
    }
    ::-webkit-scrollbar {
      width: 14px;
      height: 14px;
      background-color: var(--bg-color);
      border-left: 1px solid var(--border-color);
    }
    ::-webkit-scrollbar-track {
      background-color: transparent; /* 網目を削除してシンプルに */
    }
    ::-webkit-scrollbar-thumb {
      background-color: var(--text-color);
      border-radius: 0; /* 完全な四角 */
      border: none; /* 枠線を消してソリッドなブロックにする */
    }
    ::-webkit-scrollbar-thumb:hover {
      background-color: var(--nav-link-color); /* 水色をやめて落ち着いた色に */
    }
body {
  margin: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: "Noto Sans JP", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;

  /* 方眼紙グリッド背景 */
  background-size: 32px 32px;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
}
a {
  text-decoration: none;
  color: inherit;
}
button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  margin: 0;
  padding: 0;
}

/* Utility Classes */
.font-silkscreen {
  font-family: "Silkscreen", cursive;
}

/* ==========================================
       3. ヘッダー (Header)
    ========================================== */
.header {
  position: sticky;
  top: 0;
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  z-index: 50;
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease;
}
.header-inner {
  max-width: 1152px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* -- Logo -- */
.logo-link {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.logo-svg {
  width: 2.5rem;
  height: 2.5rem;
}
/* ★ココがロゴの色が変わる魔法のCSSクラスです★ */
.logo-stroke {
  stroke: var(--logo-stroke);
  transition: stroke 0.3s ease;
}
.logo-fill {
  fill: var(--logo-fill);
  transition: fill 0.3s ease;
}
.logo-text {
  font-size: 1.5rem;
  font-weight: bold;
  letter-spacing: 0.1em;
}

/* -- Navigation -- */
.nav {
  display: none;
}
@media (min-width: 768px) {
  .nav {
    display: flex;
    align-items: center;
    gap: 2rem;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
  }
}
.nav-link {
  color: var(--nav-link-color);
  transition: color 0.2s ease;
}
.nav-link:hover {
  color: var(--text-color);
}
.nav-link.active {
  color: var(--text-color);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
}

/* -- Utilities (Theme Toggle & Login) -- */
    .utils {
      display: flex;
      align-items: center;
      gap: 1.5rem;
    }
    .theme-btn {
      background-color: transparent;
      border: none;
      padding: 0;
      color: var(--text-color);
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: opacity 0.2s ease;
    }
    .theme-btn:hover {
      opacity: 0.6;
    }
    .theme-btn svg {
      width: 1.25rem;
      height: 1.25rem;
    }
    .icon-moon { display: none; }
    html.dark .icon-moon { display: block; }
    html.dark .icon-sun { display: none; }

.login-btn {
  border: 2px solid var(--text-color);
  background-color: var(--btn-bg);
  color: var(--btn-text);
  font-size: 0.75rem;
  padding: 0.5rem 1rem;
  font-weight: bold;
  transition:
    opacity 0.2s ease,
    background-color 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease;
}
.login-btn:hover {
  opacity: 0.85;
}

    /* ==========================================
       4. ヒーローセクション (Hero)
    ========================================== */
    .hero {
      width: 100%;
      border-bottom: 1px solid var(--border-color);
      background: linear-gradient(180deg, var(--header-bg) 0%, transparent 100%);
      padding: 4rem 1.5rem;
      position: relative;
      overflow: hidden;
    }
    .hero-inner {
      max-width: 1152px;
      margin: 0 auto;
      display: flex;
      flex-direction: column-reverse;
      align-items: center;
      gap: 3rem;
    }
    @media (min-width: 768px) {
      .hero-inner {
        flex-direction: row-reverse;
        justify-content: space-between;
        padding: 4rem 0;
      }
    }
    .hero-content {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 1.5rem;
    }
    .hero-title {
      font-size: 3.5rem;
      margin: 0;
      line-height: 1;
      letter-spacing: 0.05em;
    }
    @media (min-width: 768px) {
      .hero-title { font-size: 5.5rem; }
    }
    .hero-subtitle {
      font-size: 0.875rem;
      font-weight: bold;
      color: var(--nav-link-color);
      letter-spacing: 0.2em;
      margin: 0;
      font-family: 'Silkscreen', cursive;
    }
    .hero-desc {
      font-size: 1rem;
      line-height: 1.8;
      max-width: 480px;
      margin: 0;
      color: var(--text-color);
    }
    .hero-actions {
      display: flex;
      gap: 1rem;
      margin-top: 1.5rem;
    }
    .btn-primary {
      background-color: var(--btn-bg);
      color: var(--btn-text);
      padding: 1rem 2rem;
      font-weight: bold;
      font-size: 0.875rem;
      border: 2px solid var(--btn-bg);
      transition: opacity 0.3s ease;
      letter-spacing: 0.05em;
    }
    .btn-primary:hover {
      opacity: 0.85;
    }
    .btn-secondary {
      background-color: transparent;
      color: var(--text-color);
      padding: 1rem 2rem;
      font-weight: bold;
      font-size: 0.875rem;
      border: 2px solid var(--text-color);
      transition: background-color 0.3s ease, color 0.3s ease;
      letter-spacing: 0.05em;
    }
    .btn-secondary:hover {
      background-color: var(--text-color);
      color: var(--bg-color);
    }

    .hero-visual {
      flex: 1;
      display: flex;
      justify-content: center;
      align-items: center;
      position: relative;
    }
    .hero-logo-svg {
      width: 200px;
      height: 200px;
      transform: rotate(5deg);
      transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .hero-visual:hover .hero-logo-svg {
      transform: rotate(0deg) scale(1.05);
    }
    @media (min-width: 768px) {
      .hero-logo-svg {
        width: 320px;
        height: 320px;
        transform: rotate(10deg);
      }
    }

    /* ==========================================
       5. メインコンテンツ (Main)
    ========================================== */
    .main-content {
      flex: 1; /* フッターを下部に押しやるため */
      max-width: 1152px;
      width: 100%;
      margin: 0 auto;
      padding: 2.5rem 1.5rem;
      display: grid;
      grid-template-columns: 1fr;
      gap: 2rem;
      align-items: start;
    }
    @media (min-width: 768px) {
      .main-content {
        grid-template-columns: 300px 1fr;
      }
    }

    /* パネル (Ranking / News などの枠) */
    .panel {
      border: 1px solid var(--border-color);
      background-color: var(--header-bg); /* 少し透過させる */
      backdrop-filter: blur(8px);
      padding: 1.5rem;
      transition: background-color 0.3s ease, border-color 0.3s ease;
    }
    .panel-title {
      font-family: 'Silkscreen', cursive;
      font-size: 1.25rem;
      font-weight: bold;
      border-bottom: 2px solid var(--text-color);
      padding-bottom: 0.5rem;
      margin-bottom: 1.5rem;
      letter-spacing: 0.1em;
      margin-top: 0;
    }

    /* パネル内のリスト */
    .panel-list {
      list-style: none;
      padding: 0;
      margin: 0;
      display: flex;
      flex-direction: column;
      gap: 1rem;
    }
    .panel-list-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px dashed var(--border-color);
      padding-bottom: 0.75rem;
    }
    .panel-list-item:last-child {
      border-bottom: none;
      padding-bottom: 0;
    }
    .item-date {
      font-size: 0.75rem;
      color: var(--nav-link-color);
      font-family: 'Silkscreen', cursive;
    }
    .item-title {
      font-size: 0.875rem;
      font-weight: bold;
      color: var(--text-color);
      text-decoration: none;
      transition: opacity 0.2s ease;
    }
    .item-title:hover {
      opacity: 0.7;
    }
    .item-desc {
      font-size: 0.75rem;
      color: var(--nav-link-color);
      margin: 0.5rem 0 0 0;
      line-height: 1.5;
    }
    
    /* ランキング用装飾 */
    .rank-1 { color: #f59e0b; font-weight: bold; }
    .rank-2 { color: #94a3b8; font-weight: bold; }
    .rank-3 { color: #b45309; font-weight: bold; }
    .rank-user {
      font-weight: bold;
      font-size: 0.875rem;
      font-family: 'Silkscreen', cursive;
    }

    /* RECENT CONTESTS \u30bb\u30af\u30b7\u30e7\u30f3 */
    .contests-col {
      grid-column: 1 / -1; /* 2\u30ab\u30e9\u30e0\u3059\u3079\u3066\u306b\u30b9\u30d1\u30f3 */
    }

    /* \u30b3\u30f3\u30c6\u30b9\u30c8\u4e00\u89a7\u306e\u884c\u30ec\u30a4\u30a2\u30a6\u30c8 */
    .contest-item {
      display: flex;
      align-items: center;
      gap: 1rem;
    }
    .contest-info {
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 0.2rem;
    }
    .contest-meta {
      font-size: 0.7rem;
      color: var(--nav-link-color);
      letter-spacing: 0.05em;
    }

    /* ステータスバッジ */
    .contest-badge {
      font-size: 0.6rem;
      padding: 0.3rem 0;
      width: 72px;          /* 固定幅で縦ズレを防ぐ */
      flex-shrink: 0;
      text-align: center;
      white-space: nowrap;
      letter-spacing: 0.05em;
      color: #ffffff;
    }
    .badge-upcoming {
      background-color: #16a34a;
    }
    .badge-finished {
      background-color: #64748b;
    }

    /* ==========================================
       6. フッター (Footer)
    ========================================== */
.footer {
  background-color: var(--footer-bg);
  border-top: 1px solid var(--border-color);
  margin-top: auto;
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease;
  padding-top: 4rem; /* 大手企業サイト風のたっぷりとした高さ */
}
.footer-top {
  max-width: 1152px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
}
@media (min-width: 768px) {
  .footer-top {
    grid-template-columns: 2fr 1fr 1fr;
  }
}
.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.footer-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.footer-logo svg {
  width: 2rem;
  height: 2rem;
}
.footer-logo-text {
  font-size: 1.125rem;
  font-weight: bold;
  letter-spacing: 0.1em;
  font-family: "Silkscreen", cursive;
}
.footer-desc {
  font-size: 0.875rem;
  color: var(--nav-link-color);
  line-height: 1.6;
  max-width: 300px;
}
.footer-link-title {
  font-size: 0.875rem;
  font-weight: bold;
  margin-bottom: 1.5rem;
  letter-spacing: 0.05em;
  font-family: "Silkscreen", cursive;
  color: var(--text-color);
}
.footer-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.footer-links a {
  font-size: 0.875rem;
  color: var(--nav-link-color);
  transition: color 0.2s ease;
}
.footer-links a:hover {
  color: var(--text-color);
}
.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding: 2rem 1.5rem;
  text-align: center;
}
.footer-bottom p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--nav-link-color);
  font-family: "Silkscreen", cursive;
}

/* ==========================================
   7. ハンバーガーメニュー (モバイル)
========================================== */

/* ---- ハンバーガーボタン ---- */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  flex-shrink: 0;
  z-index: 200;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background-color: var(--text-color);
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: center;
}
/* 「×」に変化するアニメーション */
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* デスクトップでは非表示 */
@media (min-width: 768px) {
  .hamburger { display: none; }
}

/* ---- スクロールロック ---- */
body.menu-open { overflow: hidden; }

/* ---- モバイルナビオーバーレイ ---- */
.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 100;
  background-color: var(--bg-color);
  background-size: 32px 32px;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);

  /* 右からスライドイン */
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}
.mobile-nav.open {
  transform: translateX(0);
}

/* デスクトップでは常に非表示 */
@media (min-width: 768px) {
  .mobile-nav { display: none !important; }
}

.mobile-nav-inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 1.5rem;
  gap: 2rem;
}

/* ヘッダー行（ロゴ + 閉じるボタン） */
.mobile-nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.5rem;
}
.mobile-nav-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  transition: opacity 0.2s;
}
.mobile-nav-close:hover { opacity: 0.6; }

/* ナビリンク縦並び */
.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
}
.mobile-nav-link {
  display: block;
  font-size: 1.5rem;
  letter-spacing: 0.1em;
  padding: 1.25rem 0;
  border-bottom: 1px dashed var(--border-color);
  color: var(--nav-link-color);
  transition: color 0.2s, padding-left 0.2s;
}
.mobile-nav-link:hover {
  color: var(--text-color);
  padding-left: 0.5rem;
}
.mobile-nav-link:first-child { border-top: 1px dashed var(--border-color); }

/* フッター（ログインボタン） */
.mobile-nav-footer {
  padding-top: 1rem;
}
.mobile-nav-footer .btn-primary {
  display: block;
  width: 100%;
  text-align: center;
}
