/**
 * 用語解説ツールチップ用CSS
 * 使い方: <span class="glossary-term" data-tooltip="用語の説明文">用語</span>
 */

.glossary-term {
  color: #0066cc;
  border-bottom: 1px dotted #0066cc;
  cursor: help;
  position: relative;
  display: inline;
}

.glossary-term::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  width: 280px;
  max-width: 90vw;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  pointer-events: none;
  margin-bottom: 8px;
}

.glossary-term::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #333;
  margin-bottom: -4px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 1001;
}

.glossary-term:hover::after,
.glossary-term:hover::before {
  opacity: 1;
  visibility: visible;
}

/* スマートフォン対応 - 画面中央に表示 */
@media screen and (max-width: 767px) {
  .glossary-term::after {
    position: fixed;
    bottom: auto;
    top: 50%;
    left: 50% !important;
    transform: translate(-50%, -50%);
    width: calc(100vw - 40px);
    max-width: 320px;
    font-size: 13px;
    padding: 15px 18px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    margin-bottom: 0;
  }
  .glossary-term::before {
    display: none;
  }
}
