/* ====== 基本リセット ====== */
html, body {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  max-width: 100vw;
  overflow-x: hidden;
}
*, *::before, *::after {
  box-sizing: inherit;
}

/* ====== ヘッダー ====== */
header {
  position: relative;
  display: flex;
  align-items: center;
  padding: 10px 20px 10px 80px;
  background-color: #151652;
  color: #fff;
  z-index: 2000;
  height: 60px;
}
header h1 {
  margin: 0;
  font-family: 'Merriweather', serif;
  word-break: break-word;
  white-space: normal;
}

/* ====== ヘッダーナビ ====== */
.header-nav {
  margin-left: auto;
  display: flex;
  gap: 10px;
}
.header-nav button {
  background-color: #fff;
  color: #151652;
  border: none;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Merriweather', serif;
}
.header-nav button:hover {
  background-color: #e0e7ff;
}

/* ====== ハンバーガーボタン ====== */
#menu-toggle {
  position: fixed;
  top: 10px;
  left: 20px;
  background-color: #151652;
  color: #fff;
  border: none;
  padding: 8px 10px;
  font-size: 20px;
  border-radius: 4px;
  cursor: pointer;
  z-index: 3000;
}

/* ====== メインレイアウト ====== */
.container {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  margin-top: 60px;
  width: 100%;
  box-sizing: border-box;
}

/* ====== サイドバー ====== */
.sidebar {
  position: fixed;
  top: 0;
  left: -220px;
  width: 200px;
  height: 100vh;
  padding: 80px 20px 20px;
  background-color: #151652;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: left 0.3s ease;
  z-index: 1050;
}
.sidebar.open {
  left: 0;
}
.sidebar button {
  background-color: #fff;
  color: #151652;
  border: none;
  padding: 10px;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  font-family: 'Merriweather', serif;
}
.sidebar button:hover {
  background-color: #e0e7ff;
}

/* ====== メインコンテンツ ====== */
.content {
  flex: 1;
  min-height: 600px;
  padding: 20px;
  background-color: #f5f8ff;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(20,30,80,0.06);
  border: 1px solid #e5e7eb;
  box-sizing: border-box;
  word-break: break-word;
  white-space: normal;
  overflow-wrap: break-word;
}
.content p, .content strong, .content li {
  word-break: break-word;
  white-space: normal;
  overflow-wrap: break-word;
}

/* 見た目をヘッダーと同じにしてテキストリンク風に */
h2 a {
  color: inherit;            /* 親要素の色を継承 */
  text-decoration: none;     /* 下線を消す */
}

/* ホバー時だけ下線を表示 */
h2 a:hover {
  text-decoration: underline;
}
/* ====== フッター ====== */
footer {
  background-color: #fff;
  padding: 20px 0;
  text-align: center;
  margin-top: 40px;
}
.footer-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.footer-nav button {
  background-color: #151652;
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Merriweather', serif;
}
.footer-nav button:hover {
  background-color: #0f1045;
}

/* ====== 発表リスト ====== */
.presentation-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 100vw;
  word-break: break-word;
  white-space: normal;
  overflow-wrap: break-word;
}
.presentation-list li {
  counter-increment: presentation -1;
  margin-bottom: 1.5rem;
  position: relative;
  padding-left: 2rem;
  word-break: break-word;
  white-space: normal;
  overflow-wrap: break-word;
}
.presentation-list li::before {
  content: counter(presentation) ". ";
  position: absolute;
  left: 0;
  font-weight: bold;
}
.year-group + .year-group {
  margin-top: 2rem;
}
.year-group h3 {
  margin-bottom: 1rem;
  border-bottom: 1px solid #ccc;
  padding-bottom: 0.3rem;
}
.research-interests {
  margin-bottom: 3rem;
}

/* ====== スケジュール テーブル（PC用） ====== */
.schedule-table,
.schedule-table-pc {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  table-layout: fixed;
  word-break: break-word;
  white-space: normal;
  overflow-wrap: break-word;
}
.schedule-table th,
.schedule-table td {
  border: 1px solid #ccc;
  padding: 8px;
  text-align: left;
  min-width: 0;
  word-break: break-word;
  white-space: normal;
  overflow-wrap: break-word;
}
.schedule-table th {
  background-color: #f0f4ff;
  font-weight: bold;
}
.schedule-table tr:nth-child(even) {
  background-color: #fafafa;
}

/* ====== スケジュールリスト（スマホ用） ====== */
.schedule-list-sp {
  display: none;
  padding: 0;
  margin: 0;
}
.schedule-list-sp li {
  border: 1px solid #ccc;
  border-radius: 10px;
  background: #f7f9ff;
  margin-bottom: 12px;
  padding: 10px 14px;
  font-size: 13px;
  box-shadow: 0 1px 4px rgba(40,50,100,0.05);
  list-style: none;
}
.schedule-list-sp div {
  margin-bottom: 2px;
  word-break: break-word;
}
.schedule-list-sp strong {
  display: inline-block;
  min-width: 5.4em;
  font-weight: bold;
  color: #3842aa;
}

.past-schedule-link {
  margin-top: 1rem;
}
.past-schedule-link a {
  color: #151652;
  text-decoration: underline;
  font-weight: bold;
}
.past-schedule-link a:hover {
  color: #0a1040;
}

/* ====== まず両方とも非表示にする（上書き可能） ====== */
.math-title-pc,
.math-title-sp {
  display: none;
}
/* PC表示用 */
@media (min-width: 636px) {
  .math-title-pc { display: inline; }
}
/* スマホ表示用 */
@media (max-width: 635px) {
  .math-title-sp { display: inline; }
}
/* PC用：テーブル表示、リスト非表示 */
.schedule-table-pc { display: table; }
.schedule-list-sp  { display: none;  }

/* ====== スマホ用レイアウト・スケジュール切替・その他 ====== */
@media (max-width: 835px) {
  header {
    padding: 6px 8px 6px 56px;
    height: 44px;
    min-width: 0;
    box-sizing: border-box;
  }
  header h1 {
    font-size: 1.05rem;
    white-space: normal;
    word-break: break-word;
  }
  .header-nav {
    display: none !important;
  }
  #menu-toggle {
    top: 8px;
    left: 8px;
    padding: 12px 14px;
    font-size: 22px;
    z-index: 3100;
  }
  .container {
    flex-direction: column !important;
    margin-top: 44px;
    max-width: 100vw !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
    box-sizing: border-box;
  }
  .sidebar {
    width: 100vw;
    min-width: 0;
    max-width: 100vw;
    left: -100vw;
    padding: 56px 8px 8px;
    box-sizing: border-box;
    transition: left 0.3s;
  }
  .sidebar.open { left: 0; }
  .content {
    padding: 7px;
    font-size: 14px;
    min-width: 0;
    box-sizing: border-box;
    word-break: break-word;
    white-space: normal;
    overflow-wrap: break-word;
  }
  /* ------ テーブルを隠し、リストのみ表示 ------ */
  .schedule-table,
  .schedule-table-pc {
    display: none !important;
  }
  .schedule-list-sp  {
    display: block !important;
  }
  /* ------ その他 ------ */
  .schedule-table,
  .presentation-list {
    max-width: 100vw !important;
    min-width: 0 !important;
    word-break: break-word;
    white-space: normal;
    table-layout: fixed;
  }
  .schedule-table th,
  .schedule-table td {
    word-break: break-word;
    white-space: normal;
    min-width: 0 !important;
    max-width: 80vw;
    overflow-wrap: break-word;
  }
  .content p,
  .content strong,
  .presentation-list li {
    word-break: break-word;
    white-space: normal;
    overflow-wrap: break-word;
  }
  .footer-nav {
    flex-wrap: wrap;
    gap: 4px;
  }
  .footer-nav button {
    font-size: 13px;
    padding: 5px 7px;
  }
}

/* ── モバイルファースト：デフォルトでテーブル非表示、リスト表示 ── */
.schedule-table,
.schedule-table-pc {
  display: none !important;
}
.schedule-list-sp {
  display: block !important;
}

/* ── PC向け（836px以上）：テーブル表示、リスト非表示 ── */
@media screen and (min-width: 836px) {
  .schedule-table,
  .schedule-table-pc {
    display: table !important;
    border-collapse: collapse !important;
  }
  .schedule-table th,
  .schedule-table td {
    border: 1px solid #ccc !important;
    padding: 8px !important;
    background: none !important;
  }
  .schedule-table th {
    background-color: #f0f4ff !important;
    font-weight: bold !important;
  }
  .schedule-table tr:nth-child(even) {
    background-color: #fafafa !important;
  }
  .schedule-list-sp {
    display: none !important;
  }
}

@media screen and (min-width: 836px) {
  .schedule-table,
  .schedule-table-pc {
    display: table !important;
    width: 100% !important;
    border-collapse: collapse !important;
    background: none !important;
  }
  .schedule-table th,
  .schedule-table-pc th,
  .schedule-table td,
  .schedule-table-pc td {
    border: 1px solid #ccc !important;
    padding: 8px !important;
    text-align: left !important;
    word-break: break-word !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
    background: none !important;
  }
  .schedule-table th,
  .schedule-table-pc th {
    background-color: #f0f4ff !important;
    font-weight: bold !important;
  }
  .schedule-table tr:nth-child(even),
  .schedule-table-pc tr:nth-child(even) {
    background-color: #fafafa !important;
  }
}

/* ----------------------------------------------------------------------
   タブレット（例：iPad）縦向きでもスマホレイアウトを有効にする
   ---------------------------------------------------------------------- */
@media screen and (orientation: portrait) {
  /* PC用テーブルを隠し */
  .schedule-table,
  .schedule-table-pc {
    display: none !important;
  }
  /* スマホ用リストを表示 */
  .schedule-list-sp {
    display: block !important;
  }
}

/* ----------------------------------------------------------------------
   既存のPC向け幅判定（836px以上）はそのまま
   iPad横向き（landscape）では width>=836px なのでPCレイアウト
   ---------------------------------------------------------------------- */
@media screen and (min-width: 835px) {
  .schedule-table,
  .schedule-table-pc {
    display: table !important;
  }
  .schedule-list-sp {
    display: none !important;
  }
}