html, body {
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
}

body {
    font-family: 'Noto Serif JP', serif;
    margin: 0;
    padding: 0;
    background-color: #f4f2f8;
    text-align: center;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow-x: hidden;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
}

body::-webkit-scrollbar, html::-webkit-scrollbar {
    display: none;
}

.site-banner {
  background: linear-gradient(135deg, #dcd6f7, #e7e9f9, #f0f1f6);
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  color: #111;
  font-size: 1rem;
  height: 6%;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;      
  justify-content: center; 
  align-items: center;
  text-align: center; 
}
.info-banner {
  position: sticky;
  top: 0;
  z-index: 999;
  background: #f4f2f8;
  padding: 0.5em 1em;
  text-align: center;
  font-size: 0.95rem;
  width: 50%;
  margin: 0 auto; 
  text-align: center;
}
header {
    background-color: transparent;
    color: black;
    height: 23%;
    display: flex;
    flex-direction: column;  
    justify-content: center;
    align-items: center;   
    width:90%;
    margin: 0 auto;
    box-sizing: border-box;
    margin-top: 6%; 
}

.paw-nav {
    position: fixed;
    right: 60px; 
    bottom: 60px;  
    z-index: 1000;
    list-style: none; 
    margin: 0;
    padding: 0;
}

.paw-nav li {
    display: inline-block;
}

.paw-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: #444;
    text-decoration: none;
    transition: transform 0.25s ease, color 0.25s ease;
}

.paw-nav a:hover {
    transform: scale(1.3) rotate(-10deg);
    color: #7d6bc5;
}


h1 {
  width: 100%;              
  text-align: center;     
  font-size: 2.0rem;
  font-weight: 600;      
  margin: 0 0 10px 0;     
  box-sizing: border-box;
}

h4 {
  width: 100%;              
  text-align: right;     
  font-size: 0.8rem;
  font-weight: 400;      
  margin: 0 0 0px 0;     
  box-sizing: border-box;
}

main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 70%;
  max-width: none;
  margin: 0 auto;
  box-sizing: border-box;
}

/* 全体コンテナ */
.controls {
    display: flex;
    flex-wrap: wrap;          /* 画面幅が狭いと自動で折り返す */
    justify-content: center;  /* 横方向中央揃え */
    align-items: center;      /* 縦方向中央揃え */
    gap: 1rem;                /* 各セクションの間隔 */
    padding-top: 40px;
    font-family: 'Noto Serif JP', serif; /* 全体フォント */
}

/* filter-section と sort-section を横並びに */
.filter-section,
.sort-section {
    display: flex;
    align-items: center; /* 縦方向中央揃え */
    gap: 0.5rem;         /* ラベルと select の間隔 */
}

/* ラベル */
.filter-section label,
.sort-section label {
    font-weight: 700;
    margin-right: 7px;
}

.sort-section select {
    margin-right: 1rem; /* Resetボタンとの間隔 */
}

/* select 共通スタイル */
select {
    padding: 0.5rem;
    font-size: 1rem;
    font-family: 'Noto Serif JP', serif;
    box-sizing: border-box;
}

/* 個別幅設定 */
#filter-gender {
    width: 100px;      /* 狭め */
}

#filter-system {
    width: 250px;      /* 少し広め */
}

#sort-type {
    width: 140px;      /* 適度な幅 */
}

/* ボタン共通 */
button {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    background-color: #ffffff;      /* 白で軽やかに */
    color: #666666;                 /* ダークグレーで控えめ */
    border: 1.5px solid #cccccc;    /* 薄いグレーのボーダー */
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.3s ease, color 0.3s ease, background-color 0.3s ease;
    font-family: 'Noto Serif JP', serif;
}

button:hover {
    border-color: #999999;          /* ちょっと濃いグレー */
    color: #333333;                 /* 文字も濃く */
    background-color: #e9e8f0;      /* ほんのり紫がかった薄いグレー */
}

/* Resetボタン個別 */
#reset-filters {
    background-color: #4A4A4A;
    color: white;
    flex-shrink: 0;   /* 縮まない */
}

#reset-filters:hover {
    background-color: #333333;
}

.container {
  width: 100%;  
}

#characters-list-container {
  width: 100%;      
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 20px 40px;
  box-sizing: border-box;
  align-items: center;
  padding-bottom: 20px;
}

#index {
  width: 100%;
}

.index-row {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0;
}

.index-title {
  font-size: 1.2rem;
  font-weight: 700;
  width: 100%;
  border-bottom: 1.3px solid black;
  padding-top: 18px;
  padding-bottom: 2px;
  margin-bottom: 10px;
  text-align: left;
}

.character-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  justify-content: flex-start;
}

.character {
  flex: 0 0 calc((100% - 4 * 10px) / 5);
  box-sizing: border-box;
  padding: 0.5px;
  cursor: default;
  font-size: 1rem;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  transition: all 0.3s ease;
}

.character:hover {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  background-color: #f4f2f8;
}

footer {
  background: #f9f9f9; 
  color: #444;
  font-size: 0.8rem;
  font-family: 'Noto Serif JP', serif;
  font-weight: 300; 
  height: 5%;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  border-top: none;
  box-shadow: 0 -2px 6px rgba(0,0,0,0.08); /* 影で自然に区切る */
}

footer .footer-inner {
  opacity: 0.8;
}

a {
    color: inherit;  /* 親要素の色を継承 */
    text-decoration: none;  /* 下線を消す */
}

@media (max-width: 1024px) {
  .site-banner {
    position: fixed;    
    top: 0;
    left: 0;
    right: 0;
    height: auto;  
    white-space: normal;   
    padding: 0.8rem 1rem;  
    font-size: 0.8rem;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 1000;
    flex-wrap: wrap;    
  }

  header {
    flex-direction: column;
    align-items: center;
    margin-top: 60px;
  }

  .controls {
    flex-direction: row;       /* 横並びを維持 */
    flex-wrap: wrap;           /* 折り返し許可 */
    justify-content: center;   /* 中央揃え */
    gap: 1rem;                 /* セクション間の間隔を広めに */
    padding-top: 16px;
  }

  .filter-section,
  .sort-section {
    flex-direction: row;      /* 横並び維持 */
    align-items: center;
    gap: 0.8rem;
  }

  .filter-section select,
  .sort-section select {
    width: auto;
    min-width: 220px;
    margin-right: 0;
  }

  #reset-filters {
    margin-top: 0.5rem; /* スマホよりやや近く */
  }
  #characters-list-container {
    display: block !important;  /* flex / grid を解除して縦並びに */
  }
  #index {
    width: 95%;
    margin: 0 auto;
    display: block !important; /* ← flex / grid を完全に解除 */
  }

  .index-row {
    display: block !important; /* ← 横並びの影響を断つ */
    width: 100%;
    margin: 0 0 1.2rem 0;
  }

  .index-title {
    font-size: 1.5rem;
    font-weight: 700;
    width: 100%;
    border-bottom: 1.3px solid black;
    padding-top: 20px;
    padding-bottom: 3px;
    margin-bottom: 12px;
    text-align: center;
    cursor: pointer;
  }

.character-row {
  display: flex;
  flex-wrap: wrap;           
  justify-content: flex-start;  /* 👈 左詰めに変更！ */
  gap: 10px;
  max-height: 2500px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.character {
  flex: 0 1 calc(33.333% - 10px);
  box-sizing: border-box;
  text-align: center;
  font-size: 1rem;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}


  .character-row.open {
    max-height: 2500px;
  }


  .character a {
    display: block;
    width: 100%;
    line-height: 1.6; 
  }

  .paw-nav {
    right: 25px;
    bottom: 35px;
  }

  .paw-nav a {
    font-size: 2rem; 
  }
}

@media (max-width: 768px) {
.site-banner {
  font-size: 0.6rem;
  padding: 0.1rem 0.5rem;
  height: 50px;
  box-sizing: border-box; 
}

header {
  flex-direction: column;
  align-items: center;
  margin-top: 70px; 
}

  .controls {
    flex-direction: column;   /* 横並び → 縦並び */
    align-items: center;      /* 中央揃え */
    gap: 0.8rem;              /* セクション間の間隔 */
    padding-top: 20px;
  }

  /* filter-section と sort-section 内も縦並び */
  .filter-section,
  .sort-section {
    flex-direction: column;  /* 横並び → 縦並び */
    align-items: center;     /* 中央揃え */
    gap: 0.5rem;
  }

  /* select は幅を調整して中央揃え */
  .filter-section select,
  .sort-section select {
    width: auto;      /* 自動幅でボタンサイズに合わせる */
    min-width: 200px; /* 必要に応じて最小幅を指定 */
    margin-right: 0; 
  }


    #reset-filters {
        margin-top: 1rem;            /* select と Reset の距離を広げる */
    }

  #index {
    width: 100%;
  }

  .index-row {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 0 0 1rem 0;
  }

  .index-title {
    font-size: 1.4rem;
    font-weight: 700;
    width: 100%;
    border-bottom: 1.3px solid black;
    padding-top: 18px;
    padding-bottom: 2px;
    margin-bottom: 10px;
    text-align: center;
    cursor: pointer;
  }

.character-row {
  display: block;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}


  .character-row.open {
    max-height: 2000px;
  }

.character {
  text-align: center;
  font-size: 1rem;
  width: 100%; 
  white-space: normal;  
  overflow: visible;  
  text-overflow: clip;   
  padding: 8px;
  border-bottom: 1px solid rgba(0,0,0,0.1); /* 薄い仕切り線 */
  padding: 6px 0;
}

.character a {
  display: block;   
  width: 100%;
  line-height: 1.6; 
}


    .paw-nav {
        right: 20px; 
        bottom: 30px;
    }

    .paw-nav a {
        font-size: 1.8rem; 
    }
}