* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  color: #303030;
  background: #f5f4ef;
  overflow-x: hidden;
}

html,
body {
  height: 100%;
}

.page {
  width: min(1160px, 96vw);
  /* iframe(高さ可変)内で縦スクロールが出ないよう、flex縦積みで
     地図セクションを「残り高さ」ちょうどに収める（余白・定数依存なし）。
     margin相殺で高さが狂うため上下余白はpaddingで確保 */
  margin: 0 auto;
  padding: 16px 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(24px, 4vw, 40px);
  line-height: 1.25;
  letter-spacing: 0;
}

.lead {
  max-width: 980px;
  margin: 0 0 14px;
  color: #5f615f;
  line-height: 1.8;
  font-weight: 700;
}

.lead p {
  margin: 0;
}

/* リード文の続き: デスクトップは常時展開(summary非表示)、モバイルはscript.jsで初期折りたたみ */
.lead-more summary {
  display: none;
  cursor: pointer;
  color: #1f5e73;
  width: fit-content;
}

.map-section {
  background: #fff;
  border: 1px solid #dedbd2;
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .06);
  flex: 1;
  min-height: 0;
}

.map-scroll {
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.map-wrap {
  position: relative;
  /* 正方形地図。aspect-ratio＋max制約で「幅にも残り高さにも収まる最大サイズ」に
     自動フィット（縦横比維持・内部スクロールなし。オーナー指示 2026-07-08） */
  aspect-ratio: 1 / 1;
  width: auto;
  max-width: min(100%, 860px);
  max-height: 100%;
  margin: 0 auto;
}

.map-img {
  display: block;
  width: 100%;
  height: auto;
}

.map-point {
  position: absolute;
  z-index: 2;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  background: transparent;
  transform: translate(-50%, -50%);
  cursor: pointer;
  --label-x: 0px;
  --label-y: -22px;
  --line-length: 14px;
  --line-rotate: 0deg;
}

.map-point::before {
  content: "";
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: var(--line-length);
  background: #646464;
  transform-origin: center bottom;
  transform: translate(-50%, -100%) rotate(var(--line-rotate));
  opacity: .9;
}

.map-point::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  background: #111;
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}

.map-point span {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(calc(-50% + var(--label-x)), calc(-50% + var(--label-y)));
  display: inline-block;
  border: 1px solid #303030;
  border-radius: 999px;
  background: rgba(255, 255, 255, .98);
  color: #202020;
  padding: .25em .5em;
  font-size: clamp(9px, 1.12vw, 11px);
  font-weight: 850;
  line-height: 1;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .13);
  white-space: nowrap;
  min-width: 2.4em;
  text-align: center;
}

.map-point:hover span,
.map-point:focus span,
.map-point.active span {
  background: #1f5e73;
  border-color: #1f5e73;
  color: #fff;
  outline: none;
}

.map-point:focus-visible {
  outline: 2px solid #1f5e73;
  outline-offset: 8px;
}

.map-point:hover::after,
.map-point:focus::after,
.map-point.active::after {
  background: #1f5e73;
  transform: translate(-50%, -50%) scale(1.25);
}

.berlin {
  left: 71.3%;
  top: 31.6%;
  z-index: 6;
}

.dresden {
  left: 73.9%;
  top: 48.3%;
  z-index: 6;
}

.heidelberg {
  left: 38.0%;
  top: 66.9%;
  z-index: 6;
}

.rothenburg {
  left: 48.5%;
  top: 67.3%;
  z-index: 6;
}

.cologne {
  left: 25.4%;
  top: 49.5%;
  z-index: 6;
}

.lorelei {
  left: 30.9%;
  top: 58.6%;
  z-index: 6;
}

.neuschwanstein {
  left: 52.0%;
  top: 87.6%;
  z-index: 7;
}

.zugspitze {
  left: 54.7%;
  top: 89.9%;
  z-index: 8;
}

/* 接するタイプのラベル: カード縁を黒丸のフチに付ける(カード幅非依存のアンカー式) */
.map-point {
  --touch-gap: 8px;
}

.berlin span,
.neuschwanstein span {
  transform: translate(-50%, calc(-100% - var(--touch-gap)));
}

.heidelberg span,
.cologne span {
  transform: translate(calc(-100% - var(--touch-gap)), -50%);
}

.dresden span,
.lorelei span {
  transform: translate(var(--touch-gap), -50%);
}

.rothenburg span,
.zugspitze span {
  transform: translate(-50%, var(--touch-gap));
}

.info-card {
  position: fixed;
  right: min(28px, 4vw);
  bottom: min(28px, 4vw);
  z-index: 80;
  width: min(520px, 92vw);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .2);
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #555;
}

.card-location {
  margin: 0 0 6px;
  color: #1f5e73;
  font-weight: 850;
}

.info-card h2 {
  margin: 0 0 12px;
  padding-right: 22px;
  font-size: 24px;
  line-height: 1.3;
}

.card-note {
  margin: 0 0 14px;
  line-height: 1.7;
}

.card-section {
  margin-top: 18px;
}

.card-section h3 {
  margin: 0 0 10px;
  font-size: 16px;
  border-left: 4px solid #1f5e73;
  padding-left: 8px;
}

.resource-notes {
  margin: 0;
  width: 100%;
}

.resource-item {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

.resource-item:last-child {
  border-bottom: none;
}

.resource-name {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.45;
  font-weight: 900;
  color: #222;
}

.resource-desc {
  width: calc(100% - 24px);
  box-sizing: border-box;
  margin: 0 0 0 24px;
  padding-left: 12px;
  color: #555;
  line-height: 1.65;
  border-left: 3px solid #ddd;
  padding-top: 2px;
  padding-bottom: 2px;
}

.resource-figure {
  width: 100%;
  box-sizing: border-box;
  margin: 12px 0 2px;
}

.resource-figure img {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
  background: #f2f2f2;
}

.resource-figure figcaption {
  margin-top: 6px;
  width: 100%;
  max-width: 100%;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.4;
  color: #444;
  text-align: center;
}

.memory-text {
  margin: 0;
  line-height: 1.7;
  font-weight: 750;
}

.confuse-list {
  margin: 0;
  padding-left: 1.2em;
  line-height: 1.8;
}

.confuse-list li {
  margin-bottom: 3px;
}

@media (max-width: 768px) {
  .page {
    width: 100%;
    margin: 0 auto;
    padding: 8px 0;
  }

  h1 {
    padding: 8px 12px 0;
    font-size: 20px;
  }

  .lead {
    padding: 0 12px;
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 8px;
  }

  .lead-more summary {
    display: list-item;
  }

  .map-section {
    padding: 8px;
    border-radius: 14px;
    overflow: hidden;
  }

  .map-scroll {
    margin-left: -8px;
    margin-right: -8px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .map-wrap {
    width: 100%;
    max-width: none;
    max-height: none;
    margin: 0 auto;
  }

  .map-img {
    width: 100%;
    max-width: none;
  }

  .map-point {
    width: 34px;
    height: 34px;
  }

  .map-point::after {
    width: 13px;
    height: 13px;
    background: #111;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
  }

  .map-point span {
    padding: .3em .55em;
  }

  .map-point {
    --touch-gap: 10px;
    z-index: 30;
  }

  /* ノイシュヴァンシュタイン城とツークシュピッツェは近接するため、
     互いの黒丸中心にタップ領域が届かない幅に抑え、実方位(北西-南東)に
     沿って少し離して誤タップを防止 */
  .neuschwanstein,
  .zugspitze {
    width: 20px;
    height: 20px;
  }

  .neuschwanstein {
    left: 51.7%;
    top: 87.2%;
    z-index: 34;
  }

  .zugspitze {
    left: 55.0%;
    top: 90.3%;
    z-index: 32;
  }

  .info-card {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 24px 22px 40px;
    border: none;
    border-radius: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  body.card-open {
    overflow: hidden;
  }

  .close-btn {
    top: 12px;
    right: 14px;
    width: 44px;
    height: 44px;
    font-size: 34px;
  }

  .info-card h2 {
    font-size: 20px;
  }

  .resource-figure img {
    height: auto;
    aspect-ratio: 4 / 3;
  }

  .resource-figure figcaption {
    font-size: 12px;
  }

  .resource-item {
    padding: 9px 0;
  }

  .resource-name {
    font-size: 15px;
  }

  .resource-desc,
  .confuse-list {
    font-size: 14px;
  }
}
