/*------------------------------------
  過去問モーダル（PC）／問題タイプ説明／体験バナー
  ※ style.css の末尾に追記
------------------------------------*/
.bumon-container {
  --navy-color: #019380;
  --accent-color: #FFB400;
}

/* 問題タイプ説明 */
.type-guide { max-width: 720px; margin: 30px auto; }
.type-guide-title {
  margin: 0 0 16px;
  font-size: 2.4rem;
  font-weight: bold;
  color: var(--main-color, #009380);
}
.type-guide-cards { display: flex; gap: 16px; }
.type-card {
  flex: 1;
  min-height: 130px;
  padding: 20px 16px;
  background: #fff;
  border: 3px solid;
  border-radius: 14px;
  text-align: center;
  box-sizing: border-box;
}
.type-card-basic  { border-color: var(--main-color, #009380); }
.type-card-kyotsu { border-color: var(--navy-color); }
.type-card-name { margin-bottom: 6px; font-size: 2.2rem; font-weight: bold; color: #222; }
.type-card-text { margin: 0; font-size: 1.8rem; line-height: 1.6; color: #444; }
.type-guide-note { margin: 14px 0 0; font-size: 1.6rem; color: #888; }

/* 体験バナー（横長：左にテキスト／右にボタン） */
.trial-banner {
  max-width: 960px;
  margin: 30px auto;
  padding: 32px 40px;
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 40px;
  align-items: center;
  background: var(--navy-color);
  border-radius: 18px;
  box-sizing: border-box;
}
.trial-label { grid-column: 1; margin: 0 0 10px; font-size: 1.8rem; font-weight: bold; color: var(--accent-color); }
.trial-title { grid-column: 1; margin: 0 0 14px; font-size: 3.4rem; font-weight: bold; line-height: 1.4; color: #fff; }
.trial-meta  { grid-column: 1; margin: 0; font-size: 1.7rem; color: #ffffff; }
.trial-button {
  grid-column: 2;
  grid-row: 1 / span 3;
  min-width: 400px;
  padding: 28px 40px;
  background: var(--accent-color);
  border-radius: 10px;
  font-size: 2.2rem;
  color:black;
  font-weight: bold;
  text-align: center;
  text-decoration: none;
  transition: opacity .2s;
}
.trial-button:hover { opacity: .85; }
.trial-arrow { margin-left: 8px; font-size: .9em; }

/* 幅768px以下はボタンを下に */
@media (max-width: 768px) {
  .trial-banner { display: block; padding: 26px 22px; }
  .trial-title { font-size: 2.8rem; }
  .trial-meta { margin-bottom: 20px; }
  .trial-button { display: block; min-width: 0; }
}

/* モーダル本体：PCは左右2カラムで1画面に収める */
.qm[hidden], .qm-zoom[hidden] { display: none; }
.qm {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qm-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); }
.qm-dialog {
  position: relative;
  width: 96vw;
  max-width: 1020px;
  max-height: 96vh;
  overflow-y: auto;
  padding: 24px 30px;
  background: #fff;
  border: 3px solid #009380;
  border-radius: 24px;
  box-sizing: border-box;
  text-align: center;
}
.qm-close {
  position: absolute;
  top: 6px;
  right: 14px;
  z-index: 3;
  padding: 0;
  background: none;
  border: none;
  font-size: 3.6rem;
  line-height: 1;
  color: #666;
  cursor: pointer;
}
.qm-close:hover { color: #000; }

.qm-body { display: flex; flex-direction: row-reverse; align-items: center; gap: 32px; }
/* 右：写真（画面の高さに合わせて幅を制限し、4:3の写真が必ず収まる） */
.qm-main { flex: 0 0 auto; width: min(60%, calc((100vh - 290px) * 1.3333)); }
/* 左：選択など */
.qm-side { flex: 1; min-width: 0; }

.qm-label { margin: 14px 0 8px; font-size: 1.8rem; font-weight: bold; color: #000; }
.qm-side > .qm-label:first-child { margin-top: 0; }
.qm-row { display: flex; justify-content: center; gap: 10px; }
.qm-btn {
  flex: 1;
  padding: 9px 4px;
  background: #fff;
  border: 3px solid;
  border-radius: 8px;
  font-size: 1.8rem;
  font-weight: bold;
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: opacity .2s;
}
.qm-btn:hover { opacity: .8; }
.qm-btn[hidden] { display: none; }

.qm-dept .qm-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.3;
  font-size: 1.6rem;
  color: #009380;
  border-color: #009380;
}
.qm-dept .qm-btn[data-dept="all"] { font-size: 1.4rem; }
.qm-dept .qm-btn.is-active { background: #009380; color: #fff; }
.qm-subject .qm-btn { max-width: 45%; }
.qm-subject [data-subject="english"] { color: #f5a800; border-color: #fdb515; }
.qm-subject [data-subject="english"].is-active { background: #fdb515; color: #fff; }
.qm-subject [data-subject="math"] { color: #0089cf; border-color: #0089cf; }
.qm-subject [data-subject="math"].is-active { background: #0089cf; color: #fff; }
.qm-type .qm-btn { color: #00288f; border-color: #00288f; }
.qm-type .qm-btn.is-active { background: #00288f; color: #fff; }

.qm-zoom-hint {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  color: #00806F;           /* サイトのメインの緑に合わせる */
}

/* 問題の上にマウスを置くと拡大できると分かるようにする */
.qm-pdf canvas { cursor: zoom-in; }

/* スライダー（矢印で切替） */
.qm-slider-wrap { position: relative; }
.qm-slider {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  border-radius: 4px;
}
.qm-slider::-webkit-scrollbar { display: none; }
.qm-slide {
  position: relative;
  flex: 0 0 100%;
  aspect-ratio: 4 / 3;
  background: #e2e2e2;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}
.qm-slide-ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  font-weight: bold;
  line-height: 1.6;
  color: #000;
}
.qm-slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  cursor: zoom-in;
}
.qm-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  padding: 0 0 4px;
  background: rgba(0, 40, 143, 0.85);
  border: none;
  border-radius: 50%;
  font-size: 3rem;
  line-height: 1;
  color: #fff;
  cursor: pointer;
  transition: opacity .2s;
}
.qm-nav:hover { opacity: .8; }
.qm-nav:disabled { opacity: .25; cursor: default; }
.qm-prev { left: 8px; }
.qm-next { right: 8px; }
.qm-slider-note { margin: 8px 0 0; font-size: 1.4rem; color: #000; }

/* ポイント・解説（長い場合は枠内でスクロール） */
.qm-point-btn {
  display: block;
  width: 100%;
  margin: 18px 0 0;
  padding: 11px;
  background: #00288f;
  border: none;
  border-radius: 6px;
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.3);
  font-size: 1.9rem;
  font-weight: bold;
  color: #fff;
  cursor: pointer;
  transition: opacity .2s;
}
.qm-point-btn:hover { opacity: .85; }
.qm-point {
  margin: 8px 0 0;
  padding: 12px 14px;
  max-height: 18vh;
  overflow-y: auto;
  background: #e8efff;
  border-radius: 6px;
  font-size: 1.5rem;
  line-height: 1.7;
  text-align: left;
}

/* お申し込み（左右レイアウトの下に横長） */
.qm-apply-area {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 2px dashed #cfe5e1;
}
.qm-apply-title { margin: 0 0 10px; font-size: 2.2rem; font-weight: bold; color: #d1232a; }
.qm-apply { display: flex; justify-content: center; gap: 14px; }
.qm-apply-btn {
  flex: 1;
  padding: 13px 4px;
  background: #f9393f;
  border-radius: 4px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
  font-size: 2rem;
  font-weight: bold;
  line-height: 1.4;
  color: #fff;
  text-decoration: none;
  transition: transform .15s, box-shadow .15s;
}
.qm-apply-btn br { display: none; }
.qm-apply-btn:hover { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); }
.qm-venue { margin: 10px 0 0; font-size: 1.5rem; }
.qm-venue a { color: #000; text-decoration: underline; }

/* 画像拡大 */
.qm-zoom {
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.9);
  cursor: zoom-out;
}
.qm-zoom img { max-width: 96%; max-height: 96%; object-fit: contain; }

/* 幅768px以下は縦並び（スクロール可） */
@media (max-width: 768px) {
  .qm-dialog { max-width: 580px; padding: 22px 18px 24px; }
  .qm-body { flex-direction: column; align-items: stretch; gap: 16px; }
  .qm-main { width: 100%; }
  .qm-side > .qm-label:first-child { margin-top: 8px; }
  .qm-point { max-height: none; }
  .qm-apply-btn { font-size: 1.6rem; }
  .qm-apply-btn br { display: inline; }
}

/* 問題PDF：スライド内を縦スクロール */
.qm-pdf {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: transparent;
}
.qm-pdf canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  border-bottom: 1px solid #ccc;
}
@media (max-width: 768px) {
  .qm-slide { aspect-ratio: auto; height: 58vh; }
}

/* 問題PDFのタップ拡大 */
.qm-pdf canvas { cursor: zoom-in; }
.qm-zoom-scroll {
  width: 100%;
  height: 100%;
  overflow: auto;
  padding: 12px 0;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}
.qm-zoom-scroll canvas { display: block; margin: 0 auto 12px; max-width: none; background: #fff; }
.qm-zoom-close {
  position: fixed;
  top: 10px;
  right: 14px;
  z-index: 1;
  width: 44px;
  height: 44px;
  padding: 0 0 3px;
  background: rgba(255, 255, 255, 0.92);
  border: none;
  border-radius: 50%;
  font-size: 3rem;
  line-height: 1;
  cursor: pointer;
}

/* PC：モーダルの大きさを固定（どの問題でも同じ） */
.qm-dialog {
  display: flex;
  flex-direction: column;
  height: min(92vh, 780px);
  max-height: none;
  overflow: hidden;
}
.qm-body { flex: 1; min-height: 0; align-items: stretch; }
.qm-main { display: flex; flex-direction: column; width: 60%; min-height: 0; }
.qm-slider-wrap { flex: 1; min-height: 0; }
.qm-slider { height: 100%; align-items: stretch; overflow-y: hidden; }
.qm-slide { aspect-ratio: auto; height: 100%; background: #fff; }
.qm-slide:not(.is-loaded) { background: #e2e2e2; }
.qm-pdf { position: absolute; inset: 0; max-height: none; }
.qm-slider-note { flex: none; }
.qm-side { display: flex; flex-direction: column; min-height: 0; }
.qm-point-btn { flex: none; }
.qm-point { flex: 1; min-height: 0; max-height: none; margin-top: 8px; overflow-y: auto; }
.qm-apply-area { flex: none; }

@media (max-width: 768px) {
  .qm-dialog { display: block; height: auto; max-height: 96vh; overflow-y: auto; }
  .qm-main { width: 100%; }
  .qm-slider { height: auto; }
  .qm-slide { height: 58vh; }
  .qm-side { display: block; }
}