/* =====================================================
   style.css — キャラグリデータベース
   Puro Planner (Sky default) デザイン言語準拠
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

/* ── CSS変数 ── */
:root {
  --bg:   #e8f4fd;
  --sf:   #ffffff;
  --sf2:  #d4ebf8;
  --sf3:  #bdddf2;
  --bd:   #99cce8;
  --a1:   #1a7abf;
  --a2:   #7c3aed;
  --a3:   #059669;
  --a4:   #d97706;
  --tx:   #0c2a40;
  --sub:  #4a7fa0;
  --bd-r: 12px;

  /* 部屋カラー */
  --r101: #00b8c8;
  --r102: #e07820;
  --r201: #2878d0;
  --r202: #404040;
  --r301: #d44080;
}

/* ── リセット ── */
*, *::before, *::after {
  box-sizing: border-box; margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html { font-size: 16px; }
body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--tx);
  min-height: 100vh;
}
a { color: var(--a1); text-decoration: none; }
a:hover { opacity: .8; }

/* ══════════════════════════════════════════
   ヘッダー
   ══════════════════════════════════════════ */
header {
  background: var(--sf);
  border-bottom: 1px solid var(--bd);
  padding: 0 14px;
  min-height: 56px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 80;
  box-shadow: 0 2px 6px rgba(26,122,191,.1);
}

/* index用タイトル */
.hdr-title {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--a1);
  line-height: 1.2;
}
.hdr-title small {
  display: block;
  font-size: .65rem;
  font-weight: 800;
  color: var(--sub);
  letter-spacing: .1em;
}

/* chara/detail用キャラ名（目立つ大きさ） */
.hdr-chara-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.hdr-chara {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 1.35rem;
  color: var(--tx);
  line-height: 1.2;
  cursor: pointer;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: border-color .15s, color .15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.hdr-chara:hover {
  color: var(--a1);
  border-bottom-color: var(--a1);
}

/* ヘッダードロップダウン */
.hdr-chara-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 200px;
  max-width: 280px;
  max-height: 300px;
  overflow-y: auto;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: var(--bd-r);
  box-shadow: 0 8px 24px rgba(26,122,191,.15);
  z-index: 300;
}
.hdr-chara-dropdown.open { display: block; }
.hdr-chara-dropdown-item {
  padding: 10px 14px;
  font-size: .88rem;
  font-weight: 700;
  color: var(--tx);
  cursor: pointer;
  border-bottom: 1px solid var(--bd);
  transition: background .12s;
}
.hdr-chara-dropdown-item:last-child { border-bottom: none; }
.hdr-chara-dropdown-item:hover { background: var(--sf2); }
.hdr-chara-dropdown-item.active { color: var(--a1); font-weight: 900; }

/* ══════════════════════════════════════════
   コンテナ・カード
   ══════════════════════════════════════════ */
.container {
  max-width: 540px;
  margin: 0 auto;
  padding: 14px 12px 8px;
}
.card {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: var(--bd-r);
  padding: 12px 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(26,122,191,.08);
}

/* ── セレクト共通 ── */
select {
  font-family: 'Nunito', sans-serif;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 8px;
  color: var(--tx);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

/* ══════════════════════════════════════════
   年ナビ
   ══════════════════════════════════════════ */
.year-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}
.year-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--bd);
  background: var(--sf2);
  color: var(--tx);
  font-size: .85rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  flex-shrink: 0;
  transition: background .15s;
  user-select: none;
}
.year-nav-btn:hover { background: var(--sf3); }
.year-nav-btn.disabled { opacity: .3; pointer-events: none; }
.year-label {
  font-family: 'Nunito', sans-serif;
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--a1);
  min-width: 90px;
  text-align: center;
  line-height: 1;
}

/* detail専用：年ナビを小さく */
.page-detail .year-nav-btn {
  width: 22px;
  height: 22px;
  font-size: .65rem;
  border-color: transparent;
  background: transparent;
  color: var(--sub);
}
.page-detail .year-nav-btn:hover { background: var(--sf2); color: var(--tx); }
.page-detail .year-label { font-size: 1.3rem; min-width: 72px; }

/* ══════════════════════════════════════════
   モード切替タブ
   ══════════════════════════════════════════ */
.mode-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.mode-tab {
  flex: 1;
  padding: 7px 0;
  border-radius: 8px;
  border: 1px solid var(--bd);
  background: var(--sf2);
  color: var(--sub);
  font-family: 'Nunito', sans-serif;
  font-size: .85rem;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  transition: all .18s;
}
.mode-tab.active {
  background: linear-gradient(135deg, var(--a1), var(--a2));
  border-color: transparent;
  color: #fff;
}
.mode-tab:not(.active):hover { background: var(--sf3); }

/* ══════════════════════════════════════════
   データ行
   ══════════════════════════════════════════ */
.data-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--bd);
  animation: fadeIn .3s ease both;
}
.data-row:last-child { border-bottom: none; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
.row-label {
  flex: 1 1 0;
  min-width: 0;
  font-size: .9rem;
  font-weight: 800;
  color: var(--tx);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-label a { color: var(--a1); font-weight: 800; }
.row-count {
  flex: 0 0 42px;
  text-align: right;
  font-size: .8rem;
  font-weight: 700;
  color: var(--sub);
  white-space: nowrap;
}
.bar-wrap {
  flex: 0 0 80px;
  height: 8px;
  background: var(--sf2);
  border-radius: 4px;
  overflow: hidden;
}
.bar {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--a1), var(--a2));
  transition: width .5s cubic-bezier(.4,0,.2,1);
}

/* ══════════════════════════════════════════
   ナビゲーション・キャラ選択
   ══════════════════════════════════════════ */
.chara-select-wrap {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}
.chara-select {
  width: 100%;
  max-width: 280px;
  padding: 9px 14px;
  font-size: .88rem;
  font-weight: 700;
  color: var(--a1);
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 20px;
  text-align: center;
  text-align-last: center;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 12px 0;
  max-width: 540px;
  margin: 0 auto;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 16px;
  border-radius: 20px;
  background: var(--sf2);
  border: 1px solid var(--bd);
  color: var(--sub);
  font-size: .82rem;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.back-btn:hover { background: var(--sf3); color: var(--tx); }
.nav-sep {
  width: 1px;
  height: 16px;
  background: var(--bd);
  flex-shrink: 0;
}

/* ── ヘッダーアイコンボタン ── */
.hdr-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--bd);
  background: var(--sf2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  text-decoration: none;
  flex-shrink: 0;
  transition: background .15s;
  margin-left: auto;
}
.hdr-icon-btn:hover { background: var(--sf3); }

/* ── フッター（p-plannerスタイル準拠） ── */
footer {
  text-align: center;
  padding: 24px;
  color: var(--sub);
  font-size: 11px;
  border-top: 1px solid var(--bd);
  margin-top: 12px;
  line-height: 1.8;
}
footer p + p { margin-top: 8px; }

/* ── 注釈テキスト ── */
.hint-text {
  font-size: .75rem;
  color: var(--sub);
  text-align: center;
  padding: 8px 4px;
  line-height: 1.6;
}

/* ── ローディング ── */
.loading {
  text-align: center;
  padding: 28px 0;
  color: var(--sub);
  font-size: .88rem;
  font-weight: 700;
}
.loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--bd);
  border-top-color: var(--a1);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════
   detail.html 専用
   ══════════════════════════════════════════ */

/* ── 月ナビ ── */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}
.month-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--bd);
  background: var(--sf2);
  color: var(--tx);
  font-size: .85rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  flex-shrink: 0;
  transition: background .15s;
}
.month-nav-btn:hover { background: var(--sf3); }
.month-nav-btn.disabled { opacity: .3; pointer-events: none; }
.month-select {
  font-family: 'Nunito', sans-serif !important;
  font-size: 1.5rem;
  font-weight: 900;
  background: transparent;
  border: none;
  color: var(--a1);
  text-align: center;
  text-align-last: center;
  cursor: pointer;
  padding: 0;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  width: 5rem;
}

/* ── カレンダー ── */
#calendar { margin-bottom: 8px; }
.cal-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 2px;
}
.day-name {
  text-align: center;
  font-size: .65rem;
  font-weight: 800;
  padding: 5px 0;
  background: var(--sf2);
  color: var(--sub);
  border: 1px solid var(--bd);
}
.day-name.sun { background: #fde8e8; color: #c00; }
.day-name.sat { background: #ddeeff; color: #006; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.date-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  aspect-ratio: 1 / 1;
  padding: 3px 2px;
  border-radius: 5px;
  background: var(--sf3);
  border: 1px solid transparent;
  cursor: default;
  transition: background .12s;
  user-select: none;
}
.date-cell.open-day {
  background: var(--sf);
  border-color: var(--bd);
  cursor: pointer;
}
.date-cell.open-day:hover { background: var(--sf2); }
.date-cell.sun { background: #fde8e8; }
.date-cell.sat { background: #ddeeff; }
.date-cell.open-day.sun { background: #fff0f0; border-color: #f0b0b0; }
.date-cell.open-day.sat { background: #eef6ff; border-color: #99ccee; }
.date-cell.highlight {
  outline: 2px solid var(--a1);
  outline-offset: -1px;
}
.empty { background: transparent; border: none; }

/* ── パーク休館日(グリーティング有無とは別軸の、施設自体の休館表示) ── */
.date-cell.park-closed {
  position: relative;
  opacity: .5;
}
.date-cell.park-closed::after {
  content: '休';
  position: absolute;
  top: 2px;
  right: 3px;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: .55rem;
  font-weight: 800;
  color: #c00;
  background: #fde8e8;
  border: 1px solid #f0b0b0;
  border-radius: 50%;
}

.date {
  font-size: .85rem;
  font-weight: 800;
  color: var(--tx);
  line-height: 1;
}
.date-cell.sun .date { color: #c00; }
.date-cell.sat .date { color: #006; }
.highlight-icon {
  font-size: .62rem;
  visibility: hidden;
  line-height: 1;
}
.date-cell.highlight .highlight-icon { visibility: visible; }

/* ── 部屋凡例 ── */
.room-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 8px 0 0;
  padding: 8px 10px;
  background: var(--sf2);
  border-radius: 8px;
  border: 1px solid var(--bd);
}
.legend-item { font-size: .72rem; font-weight: 800; }
.legend-item.r101 { color: var(--r101); }
.legend-item.r102 { color: var(--r102); }
.legend-item.r201 { color: var(--r201); }
.legend-item.r202 { color: var(--r202); }
.legend-item.r301 { color: var(--r301); }
.legend-item.pending { color: var(--sub); }

/* ══════════════════════════════════════════
   モーダル（ボトムシート）
   ══════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal-sheet {
  background: var(--sf);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--bd);
  width: 100%;
  max-width: 540px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: slideUp .28s cubic-bezier(.32,1,.6,1);
  box-shadow: 0 -4px 24px rgba(26,122,191,.12);
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* ヘッダー固定部 */
.modal-header {
  flex-shrink: 0;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--bd);
}
/* ＜＞×行 */
.modal-close-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}
.modal-close-x {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--bd);
  background: var(--sf2);
  color: var(--sub);
  font-size: .8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .12s;
}
.modal-close-x:hover { background: var(--sf3); color: var(--tx); }
.modal-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.modal-nav-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--bd);
  background: var(--sf2);
  color: var(--tx);
  font-size: .75rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .12s;
  user-select: none;
}
.modal-nav-btn:hover { background: var(--sf3); }
.modal-nav-btn.disabled { opacity: .3; pointer-events: none; }
.modal-title {
  font-family: 'Nunito', sans-serif;
  font-size: .95rem;
  font-weight: 900;
  color: var(--tx);
  text-align: center;
  line-height: 1.3;
  white-space: nowrap;
}

/* スクロール可能リスト */
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px 16px;
  -webkit-overflow-scrolling: touch;
}
.modal-body::-webkit-scrollbar { width: 3px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--bd); border-radius: 2px; }

.modal-list { display: flex; flex-direction: column; gap: 6px; }
.modal-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--sf2);
  border-radius: 10px;
  border: 1px solid var(--bd);
  transition: background .12s;
  cursor: pointer;
}
.modal-item:hover { background: var(--sf3); }
.modal-room-badge {
  font-size: .7rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  color: #fff;
}
.modal-chara-name {
  font-size: .92rem;
  font-weight: 800;
  color: var(--tx);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modal-chara-start {
  font-size: .75rem;
  font-weight: 700;
  color: var(--sub);
  margin-top: 1px;
}

/* ── 開園・閉園時刻(休館通知) ── */
.modal-hours {
  font-family: 'Nunito', sans-serif;
  text-align: center;
  font-size: .95rem;
  font-weight: 400;
  color: var(--tx);
  padding: 8px 4px;
  line-height: 1.3;
}
.modal-hours.is-closed { color: #c00; font-weight: 700; }
.modal-hours:empty { padding: 0; }

/* フッター固定部廃止 → 閉じるボタンはリスト末尾 */
.modal-close-btn {
  width: 100%;
  margin-top: 10px;
  padding: 9px;
  border-radius: 10px;
  border: 1px solid var(--bd);
  background: var(--sf2);
  color: var(--sub);
  font-family: 'Nunito', sans-serif;
  font-size: .88rem;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s;
  display: block;
  text-align: center;
}
.modal-close-btn:hover { background: var(--sf3); color: var(--tx); }

/* 部屋バッジカラー */
.badge-101 { background: var(--r101); }
.badge-102 { background: var(--r102); }
.badge-201 { background: var(--r201); }
.badge-202 { background: var(--r202); }
.badge-301 { background: var(--r301); }
.badge-pending { background: var(--bd); color: var(--sub); }

/* ── 未確定スケジュール ── */
.date-cell.pending { opacity: .45; }
.date-cell.pending .highlight-icon { color: var(--sub) !important; }
.date-cell.pending.highlight { outline-color: var(--sub) !important; }
.modal-item.pending { opacity: .6; }

/* ── レスポンシブ ── */
@media (max-width: 360px) {
  .day-name       { font-size: .55rem; }
  .date           { font-size: .72rem; }
  .highlight-icon { font-size: .55rem; }
  .row-label      { font-size: .82rem; }
}