/* ============================================================
   style-modern.css  —  夢主キャラ紹介サイト モダンスタイル
   ライトモード / エレガント・ファンタジー
   ============================================================ */

/* ─── Google Fonts ─── */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Noto+Serif+JP:wght@300;400;500;700&display=swap');

/* ─── CSS カスタムプロパティ（デザイントークン） ─── */
:root {
  /* ベースカラー */
  --bg-base: #f5f0ee;
  --bg-sidebar: #ffffff;
  --bg-content: #ffffff;
  --bg-card: #fefefe;
  --bg-card-header: #2a1a2e;

  /* テキスト */
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-light: #8888aa;
  --text-white: #ffffff;

  /* ボーダー・シャドウ */
  --border-light: #e8e0f0;
  --shadow-sm: 0 2px 8px rgba(42, 26, 46, 0.08);
  --shadow-md: 0 4px 20px rgba(42, 26, 46, 0.12);
  --shadow-lg: 0 8px 40px rgba(42, 26, 46, 0.16);

  /* サイドバー */
  --sidebar-width: 220px;

  /* アニメーション */
  --transition-fast: 0.18s ease;
  --transition-med: 0.32s cubic-bezier(0.4, 0, 0.2, 1);

  /* フォント */
  --font-ja: 'Noto Serif JP', 'Hiragino Mincho ProN', serif;
  --font-en: 'Cinzel', serif;

  /* アクセント（デフォルト。JSで上書きされる） */
  --accent: #006D4D;
  --accent-light: rgba(0, 109, 77, 0.12);
  --accent-border: rgba(0, 109, 77, 0.4);
}

/* ─── リセット ─── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font-ja);
  background: var(--bg-base);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================================
   レイアウト
   ============================================================ */

/* サイドバー */
#sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;

  /* スムーズなスクロールバー */
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}

#sidebar::-webkit-scrollbar {
  width: 4px;
}

#sidebar::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 2px;
}

/* モバイル用 サイドバー開閉ボタン（デスクトップでは非表示） */
#sidebar-toggle {
  display: none;
  position: fixed;
  top: 30%;
  left: var(--sidebar-width);
  transform: translateY(-50%);
  z-index: 320;
  width: 22px;
  height: 64px;
  border-radius: 0 10px 10px 0;
  border: 1px solid var(--border-light);
  border-left: none;
  background: var(--bg-sidebar);
  box-shadow: var(--shadow-md);
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  transition: left var(--transition-med);
}

/* メインコンテンツ */
#content-area {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
}

/* ============================================================
   サイドバー 内部
   ============================================================ */

/* サイトロゴ・タイトル */
#site-header {
  padding: 24px 16px 20px;
  border-bottom: 1px solid var(--border-light);
  text-align: center;
}

#site-header .logo-img {
  width: 100%;
  max-width: 140px;
  height: auto;
  margin-bottom: 8px;
}

#site-header .site-title {
  font-family: var(--font-en);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.12em;
  display: block;
}

#site-header .site-subtitle {
  font-size: 0.65rem;
  color: var(--text-light);
  letter-spacing: 0.06em;
  margin-top: 2px;
}

/* トップへ戻るボタン */
#btn-top {
  display: block;
  margin: 12px 16px 8px;
  padding: 8px 12px;
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  text-align: center;
  font-family: var(--font-ja);
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
}

#btn-top:hover {
  background: var(--accent-light);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* キャラ一覧ナビ */
#char-nav {
  padding: 8px 12px 24px;
  flex: 1;
}

#char-nav .section-label {
  font-size: 0.6rem;
  font-family: var(--font-en);
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--text-light);
  text-transform: uppercase;
  padding: 8px 4px 6px;
  display: block;
}

/* アイコングリッド（2列） */
.icon-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* 各キャラアイコンボタン */
.char-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid transparent;
  background: transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.char-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent-border);
  transform: translateY(-1px);
}

.char-btn.active {
  background: var(--accent-light);
  border-color: var(--accent);
}

.char-btn img.char-icon {
  width: 60px;
  height: 60px;
  object-fit: cover;
  display: block;
}

.char-btn .char-name-label {
  font-size: 0.55rem;
  color: var(--text-secondary);
  margin-top: 3px;
  text-align: center;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: break-word;
  max-width: 88px;
}

.char-btn.active .char-name-label {
  color: var(--accent);
  font-weight: 500;
}

/* 属性フィルター */
#type-filter {
  padding: 10px 12px 4px;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  margin: 4px 0;
}

#type-filter .filter-label {
  font-size: 0.6rem;
  font-family: var(--font-en);
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-light);
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}

.type-filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.type-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
  background: var(--bg-base);
  font-size: 0.6rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.type-chip img {
  width: 12px;
  height: 12px;
}

.type-chip:hover,
.type-chip.active {
  background: var(--accent-light);
  border-color: var(--accent-border);
  color: var(--accent);
}

.type-chip.all-chip {
  font-weight: 600;
}

/* ============================================================
   コンテンツエリア
   ============================================================ */

/* トップ画面（キャラ未選択） */
#page-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px;
  text-align: center;
  animation: fadeIn 0.5s ease;
}

#page-top .top-title {
  font-family: var(--font-en);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.15em;
  margin-bottom: 12px;
}

#page-top .top-subtitle {
  font-size: 0.85rem;
  color: var(--text-light);
  letter-spacing: 0.08em;
  margin-bottom: 32px;
}

#page-top .top-type-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 500px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.legend-item img {
  width: 18px;
  height: 18px;
}

#page-top .top-hint {
  margin-top: 24px;
  font-size: 0.75rem;
  color: var(--text-light);
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

/* ============================================================
   プロフィールページ
   ============================================================ */

#profile-page {
  padding: 32px 40px 60px;
  animation: fadeIn 0.35s ease;
  max-width: 960px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* キャラ名ヘッダー */
.profile-header {
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--accent-border);
}

.profile-header .chara-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 6px;
  border-radius: 20px;
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  font-size: 0.7rem;
  color: var(--accent);
  margin-bottom: 10px;
}

.profile-header .chara-type-badge img {
  width: 16px;
  height: 16px;
}

.profile-header .chara-name-ja {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
  display: block;
}

.profile-header .chara-name-en {
  font-family: var(--font-en);
  font-size: clamp(0.8rem, 1.8vw, 1.1rem);
  font-weight: 400;
  color: var(--text-light);
  letter-spacing: 0.1em;
  margin-top: 4px;
  display: block;
}

/* 本文レイアウト（イラスト + テーブル） */
.profile-body {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* イラストエリア */
.profile-illust {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 420px;
  width: 100%;
}

.profile-illust img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  transition: opacity var(--transition-med);
}

.profile-illust img.clickable-illust {
  cursor: pointer;
}

.profile-illust img.clickable-illust:hover {
  opacity: 0.92;
}

/* バージョン切り替えボタンエリア */
.illust-switcher {
  display: flex;
  gap: 8px;
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

.switcher-btn {
  font-family: var(--font-ja);
  font-size: 0.72rem;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
}

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

.switcher-btn.active {
  background: var(--accent);
  color: var(--text-white);
  border-color: var(--accent);
}

/* プロフィールテーブル側 */
.profile-data {
  flex: 1;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* プロフィールテーブル */
.profile-table-wrapper {
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.profile-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.profile-table .table-header {
  background: var(--bg-card-header);
  color: var(--text-white);
  font-family: var(--font-en);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  padding: 10px 14px;
  text-align: left;
}

.profile-table .lbl {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
  font-size: 0.75rem;
  text-align: center;
  vertical-align: middle;
  padding: 8px 10px;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  width: 72px;
}

.profile-table .val {
  background: var(--bg-card);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
  line-height: 1.5;
}

.profile-table tr:last-child .lbl,
.profile-table tr:last-child .val {
  border-bottom: none;
}

/* 説明文カード */
.profile-desc {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  padding: 14px 16px;
  font-size: 0.85rem;
  line-height: 1.9;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

/* セリフカード */
.profile-sample {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.profile-sample .sample-header {
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.72rem;
  font-family: var(--font-en);
  font-weight: 600;
  letter-spacing: 0.12em;
  padding: 8px 14px;
  border-bottom: 1px solid var(--accent-border);
}

.profile-sample .sample-body {
  padding: 12px 16px;
}

.profile-sample .sample-line {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  padding: 5px 0;
}

.profile-sample .sample-line+.sample-line {
  border-top: 1px dashed var(--border-light);
  margin-top: 4px;
}

/* ============================================================
   検索バー
   ============================================================ */
#search-wrap {
  padding: 10px 12px 6px;
}

#search-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-family: var(--font-ja);
  font-size: 0.75rem;
  color: var(--text-primary);
  background: var(--bg-base);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

#search-input:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 2px var(--accent-light);
}

#search-input::placeholder {
  color: var(--text-light);
}

/* ============================================================
   ユーティリティ
   ============================================================ */

.hidden {
  display: none !important;
}

/* キャラ数バッジ */
.char-count-badge {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.6rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 4px;
}

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

@media (max-width: 700px) {
  :root {
    --sidebar-width: 180px;
  }

  .char-btn img.char-icon {
    width: 52px;
    height: 52px;
  }

  #profile-page {
    padding: 20px 16px 40px;
  }

  .profile-illust img {
    max-width: 200px;
  }

  /* サイドバーは普段どおり表示、ボタンを押した時だけ左に引っ込める */
  #sidebar {
    transition: transform var(--transition-med);
  }

  body.sidebar-collapsed #sidebar {
    transform: translateX(-100%);
  }

  #content-area {
    transition: margin-left var(--transition-med);
  }

  body.sidebar-collapsed #content-area {
    margin-left: 0;
  }

  #sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  body.sidebar-collapsed #sidebar-toggle {
    left: 0;
  }
}

@media (max-width: 500px) {
  :root {
    --sidebar-width: 150px;
  }

  .char-btn img.char-icon {
    width: 48px;
    height: 48px;
  }
}

/* ============================================================
   イラスト拡大表示（ライトボックス）
   ============================================================ */

.illust-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 12, 20, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
  cursor: zoom-out;
  animation: fadeIn 0.2s ease;
}

.illust-lightbox.hidden {
  display: none;
}

.illust-lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  cursor: default;
}

.lightbox-close {
  position: fixed;
  top: 16px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-white);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 500px) {
  .illust-lightbox {
    padding: 12px;
  }

  .lightbox-close {
    top: 10px;
    right: 12px;
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
  }
}