/**
 * UI 拡張専用（プレフィックスクラスのみ）。既存セレクタへの干渉を避ける。
 */

.lib-footer-safe {
  box-sizing: border-box;
  margin-top: 2rem;
  padding: 1.25rem clamp(1rem, 3vw, 1.75rem) calc(1.25rem + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, #0f1c2e 0%, #0b1524 100%);
  color: rgba(248, 250, 252, 0.92);
  border-top: 1px solid rgba(201, 162, 77, 0.35);
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
}

.lib-footer-safe__inner {
  max-width: 1120px;
  margin: 0 auto;
}

.lib-footer-safe__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  align-items: center;
  justify-content: center;
  margin: 0 0 0.45rem;
  padding: 0;
  list-style: none;
}

.lib-footer-safe__nav a {
  color: rgba(248, 250, 252, 0.95);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
}

.lib-footer-safe__nav a:hover {
  text-decoration: underline;
  color: #e4c56f;
}

.lib-footer-safe__note {
  margin: 0;
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.5;
  color: rgba(148, 163, 184, 0.95);
}

/* 英語 UI のみ表示（#app 内注記の集約先） */
.lib-footer-safe__i18n {
  margin: 0.75rem 0 0;
  text-align: left;
  max-width: 48rem;
  margin-left: auto;
  margin-right: auto;
  font-size: 0.7rem;
  line-height: 1.65;
  color: rgba(148, 163, 184, 0.88);
  font-weight: 400;
}

.lib-floating-ui {
  position: fixed;
  z-index: 99940;
  left: clamp(0.5rem, 2vw, 1rem);
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  pointer-events: none;
}

.lib-floating-ui button {
  pointer-events: auto;
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 50%;
  border: 1px solid rgba(15, 28, 46, 0.2);
  background: rgba(255, 255, 255, 0.96);
  color: #0f1c2e;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(15, 28, 46, 0.14);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.lib-floating-ui button:hover {
  transform: translateY(-1px);
  border-color: rgba(201, 162, 77, 0.55);
  box-shadow: 0 8px 24px rgba(15, 28, 46, 0.18);
}

.lang-toggle {
  position: fixed;
  z-index: 99945;
  top: auto;
  bottom: calc(6.25rem + env(safe-area-inset-bottom, 0px));
  right: clamp(0.5rem, 2vw, 1rem);
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #0f1c2e;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 28, 46, 0.14);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(15, 28, 46, 0.1);
  user-select: none;
}

.lang-toggle:hover {
  border-color: rgba(201, 162, 77, 0.45);
}

@media (prefers-reduced-motion: reduce) {
  .lib-floating-ui button {
    transition: none;
  }
}

/* 研究ライブラリー・カテゴリ（<details> アコーディオン） */
.lib-research-lib-acc {
  box-sizing: border-box;
  border: 1px solid rgba(15, 28, 46, 0.12);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}

.lib-research-lib-acc-sum {
  cursor: pointer;
  list-style: none;
  padding: 16px 18px;
  font-weight: 700;
  font-size: 1.05rem;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.lib-research-lib-acc-sum::-webkit-details-marker {
  display: none;
}

.lib-research-lib-acc-sum::after {
  content: "";
  width: 0.45em;
  height: 0.45em;
  margin-top: -0.15em;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.lib-research-lib-acc[open] > .lib-research-lib-acc-sum::after {
  transform: rotate(-135deg);
  margin-top: 0.15em;
}

.lib-research-lib-acc-panel {
  padding: 0 18px 18px;
  border-top: 1px solid rgba(15, 28, 46, 0.08);
}

.lib-research-lib-acc-title {
  flex: 1;
  min-width: 0;
  text-align: left;
}

@media (prefers-reduced-motion: reduce) {
  .lib-research-lib-acc-sum::after {
    transition: none;
  }
}
