:root {
  --bg-deep: #04060f;
  --text-main: #e8ecf7;
  --text-dim: #8b93b3;
  --text-body: #d3d9ee;
  --accent: #8ec9ff;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: radial-gradient(ellipse at 50% 20%, #0d1330 0%, var(--bg-deep) 55%, #000 100%);
  color: var(--text-main);
  font-family: -apple-system, "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
}

.cosmic-app {
  position: relative;
  height: 100vh;
  overflow: hidden;
}

.starfield {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 20px 30px, #ffffffaa, transparent),
    radial-gradient(1px 1px at 90px 120px, #ffffff88, transparent),
    radial-gradient(1.5px 1.5px at 160px 60px, #ffffffcc, transparent),
    radial-gradient(1px 1px at 220px 180px, #ffffff77, transparent),
    radial-gradient(1px 1px at 280px 40px, #ffffff99, transparent),
    radial-gradient(1.5px 1.5px at 340px 220px, #ffffffbb, transparent),
    radial-gradient(1px 1px at 40px 200px, #ffffff66, transparent),
    radial-gradient(1px 1px at 380px 100px, #ffffff88, transparent);
  background-repeat: repeat;
  background-size: 400px 260px;
  animation: twinkle 6s ease-in-out infinite alternate;
  opacity: 0.8;
}

@keyframes twinkle {
  from { opacity: 0.45; }
  to { opacity: 0.95; }
}

.site-header {
  position: absolute;
  top: 20px;
  left: 24px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.site-title {
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 0 10px rgba(140, 180, 255, 0.7), 0 0 2px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

.site-node-count {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-main);
  background: rgba(10, 14, 30, 0.6);
  border: 1px solid rgba(140, 180, 255, 0.25);
  border-radius: 999px;
  padding: 3px 10px;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

.site-hub-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: auto;
}

.site-hub-menu button {
  align-self: flex-start;
  background: transparent;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.03em;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9);
  cursor: pointer;
}

.site-hub-menu button:hover {
  color: #fff;
  text-decoration: underline;
}

.node-font-control {
  position: absolute;
  top: 16px;
  right: 20px;
  display: flex;
  gap: 6px;
  z-index: 2;
}

.node-font-control button {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(140, 180, 255, 0.3);
  background: rgba(10, 14, 30, 0.6);
  color: var(--text-main);
  font-size: 11px;
  cursor: pointer;
}

.node-font-control button:hover {
  background: rgba(140, 180, 255, 0.15);
}

.graph-pane {
  position: absolute;
  inset: 0;
}

.react-flow {
  background: transparent !important;
}

.react-flow__edge-path {
  stroke: rgba(140, 180, 255, 0.35);
  stroke-width: 1.4px;
  filter: drop-shadow(0 0 2px rgba(140, 180, 255, 0.4));
}

/* 線に対するクリック操作は使っていないので、線上でも背景ペインの
   ドラッグ移動(cursor: grab)がそのまま効くようにする */
.react-flow__edge {
  pointer-events: none;
  cursor: grab;
}

.react-flow__edge:hover .react-flow__edge-path,
.react-flow__edge.selected .react-flow__edge-path {
  stroke: rgba(210, 226, 255, 0.85);
}

/* 親子ノードをつなぐコネクタ */
.react-flow__edge.edge-tree .react-flow__edge-path {
  stroke: rgba(190, 215, 255, 0.6);
  stroke-width: 1.8px;
}

/* ツリー外の相互参照リンク(両端が表示されているときのみ出現) */
.react-flow__edge.edge-cross .react-flow__edge-path {
  stroke: rgba(140, 180, 255, 0.22);
  stroke-width: 1px;
  stroke-dasharray: 3 5;
  filter: none;
}

@keyframes nodeFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/*
  react-flowはノードの位置を transform: translate(...) のインラインstyleで
  制御している。ここで transform を対象にした @keyframes を使うと
  インラインの translate を上書きして一瞬(0,0)にすっ飛んでしまうため、
  出現アニメーションは opacity のみにする。位置の移動(親からの出現)は
  transition で translate 自体を滑らかに補間させる。
*/
.react-flow__node {
  animation: nodeFadeIn 0.35s ease;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.react-flow__controls {
  background: rgba(10, 14, 30, 0.7);
  border: 1px solid rgba(140, 180, 255, 0.2);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: none;
}

.react-flow__controls button {
  background: transparent;
  border-bottom: 1px solid rgba(140, 180, 255, 0.15);
  fill: var(--text-main);
}

.react-flow__controls button:hover {
  background: rgba(140, 180, 255, 0.15);
}

.react-flow__minimap {
  background: rgba(10, 14, 30, 0.7) !important;
  border: 1px solid rgba(140, 180, 255, 0.2);
  border-radius: 8px;
}

.star-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 120px;
  cursor: pointer;
}

.star-node__orb {
  position: relative;
  width: var(--orb-size, 34px);
  height: var(--orb-size, 34px);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff, var(--star-color) 45%, transparent 75%);
  box-shadow:
    0 0 10px 2px var(--star-color),
    0 0 24px 6px color-mix(in srgb, var(--star-color) 45%, transparent);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.star-node__handle {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  width: 1px !important;
  height: 1px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  border: none !important;
  background: transparent !important;
  opacity: 0;
  pointer-events: none;
}

.star-node__badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(8, 11, 24, 0.95);
  border: 1px solid var(--star-color);
  color: #fff;
  font-size: 11px;
  line-height: 14px;
  text-align: center;
}

.star-node:hover .star-node__orb,
.star-node--selected .star-node__orb {
  transform: scale(1.18);
  box-shadow:
    0 0 16px 4px var(--star-color),
    0 0 38px 10px color-mix(in srgb, var(--star-color) 60%, transparent);
}

/* リンクからジャンプした先のノードを数秒間点滅させて目立たせる */
@keyframes star-flash {
  0%, 100% {
    transform: scale(1);
    box-shadow:
      0 0 10px 2px var(--star-color),
      0 0 24px 6px color-mix(in srgb, var(--star-color) 45%, transparent);
  }
  50% {
    transform: scale(1.35);
    box-shadow:
      0 0 26px 8px var(--star-color),
      0 0 50px 16px color-mix(in srgb, var(--star-color) 75%, transparent);
  }
}

.star-node--flash .star-node__orb {
  animation: star-flash 0.6s ease-in-out infinite;
}

.star-node--flash .star-node__label {
  color: #fff;
}

.star-node__label {
  font-size: var(--node-font-size, 11px);
  text-align: center;
  line-height: 1.3;
  color: var(--text-main);
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9), 0 0 2px #000;
}

.detail-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 88vw;
  min-width: 280px;
  background: rgba(15, 19, 36, 0.92);
  backdrop-filter: blur(10px);
  border-left: 1px solid rgba(140, 180, 255, 0.25);
  color: var(--text-main);
  box-shadow: -20px 0 40px rgba(0, 0, 0, 0.4);
  z-index: 3;
}

/* 本文だけをスクロールさせる領域。リサイズハンドル・ツールバー・閉じる
   ボタンはこの外側にあるので、本文を下までスクロールしても常に
   同じ位置(パネルの上端〜下端)に留まる。 */
.detail-panel__scroll {
  position: absolute;
  inset: 56px 0 0 0;
  overflow-y: auto;
  padding: 0 26px 24px;
}

/* フォントサイズはpx指定のinline styleで.detail-panel自体に乗せ、
   配下の要素はすべてemで追従させることで、A-/A+ボタンで
   見出しも本文も比例して拡大縮小できるようにしている。 */
.detail-panel h2 {
  margin: 4px 0 4px;
  font-size: 1.35em;
  letter-spacing: 0.02em;
  color: #fff;
}

.detail-panel__type {
  display: inline-block;
  font-size: 0.8em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--star-color, var(--accent));
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 2px 10px;
}

.detail-panel p {
  color: var(--text-body);
  line-height: 1.8;
  font-size: 1em;
}

.detail-panel img,
.detail-panel svg {
  max-width: 100%;
  height: auto;
}

.detail-panel img {
  cursor: zoom-in;
  transition: opacity 0.15s ease;
}

.detail-panel img:hover {
  opacity: 0.85;
}

.detail-panel .media-placeholder {
  margin: 12px 0;
}

.detail-panel .katex {
  color: var(--text-main);
  font-size: 1.05em;
}

.detail-panel .katex-display {
  margin: 1em 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.detail-panel__resizer {
  position: absolute;
  top: 0;
  left: -5px;
  width: 10px;
  height: 100%;
  cursor: ew-resize;
  z-index: 4;
}

.detail-panel__resizer::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 4px;
  width: 2px;
  background: rgba(140, 180, 255, 0.15);
  transition: background 0.15s ease;
}

.detail-panel__resizer:hover::after {
  background: rgba(140, 180, 255, 0.6);
}

.detail-panel__toolbar {
  position: absolute;
  top: 16px;
  left: 26px;
  display: flex;
  gap: 6px;
  font-size: 14px;
}

.detail-panel__toolbar button {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(140, 180, 255, 0.3);
  background: rgba(10, 14, 30, 0.6);
  color: var(--text-main);
  font-size: 11px;
  cursor: pointer;
}

.detail-panel__toolbar button:hover {
  background: rgba(140, 180, 255, 0.15);
}

.detail-panel__toolbar button:disabled {
  opacity: 0.35;
  cursor: default;
}

.detail-panel__toolbar button:disabled:hover {
  background: rgba(10, 14, 30, 0.6);
}

.detail-panel__toolbar button.detail-panel__pin {
  width: auto;
  min-width: 28px;
  padding: 0 8px;
  white-space: nowrap;
}

.detail-panel__toolbar button.detail-panel__pin--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #04060f;
  font-weight: 600;
}

.detail-panel__toolbar button.detail-panel__pin--active:hover {
  background: var(--accent);
}

.detail-panel a.wikilink {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}

.detail-panel a.wikilink:hover {
  color: #fff;
}

/* 章ページ下部の前章/次章ナビゲーション(順番に読み進める用) */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid rgba(140, 180, 255, 0.25);
}

.chapter-nav__link {
  flex: 1;
  max-width: 48%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(140, 180, 255, 0.35);
  background: rgba(10, 14, 30, 0.5);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}

.chapter-nav__link:hover {
  background: rgba(140, 180, 255, 0.2);
}

.chapter-nav__link--next {
  text-align: right;
  margin-left: auto;
}

.detail-panel__close {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(140, 180, 255, 0.3);
  background: transparent;
  color: var(--text-main);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.detail-panel__close:hover {
  background: rgba(140, 180, 255, 0.15);
}

/* 人物相関図(常に手前に浮かぶウィンドウ。背景を覆う全画面オーバーレイは
   置かないので、開いたままグラフ側のパン・ズーム・クリックが可能) */
.relation-modal {
  position: fixed;
  top: 15vh;
  left: 30vw;
  width: 40vw;
  height: 60vh;
  min-width: 420px;
  min-height: 320px;
  background: rgba(12, 16, 32, 0.97);
  border: 1px solid rgba(140, 180, 255, 0.25);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
}

.relation-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(140, 180, 255, 0.15);
  cursor: move;
  user-select: none;
}

/* 上下左右+四隅、8方向のリサイズハンドル */
.relation-modal__resizer {
  position: absolute;
}

.relation-modal__resizer--n,
.relation-modal__resizer--s {
  left: 14px;
  right: 14px;
  height: 6px;
  cursor: ns-resize;
}

.relation-modal__resizer--n {
  top: -3px;
}

.relation-modal__resizer--s {
  bottom: -3px;
}

.relation-modal__resizer--e,
.relation-modal__resizer--w {
  top: 14px;
  bottom: 14px;
  width: 6px;
  cursor: ew-resize;
}

.relation-modal__resizer--e {
  right: -3px;
}

.relation-modal__resizer--w {
  left: -3px;
}

.relation-modal__resizer--ne,
.relation-modal__resizer--nw,
.relation-modal__resizer--se,
.relation-modal__resizer--sw {
  width: 16px;
  height: 16px;
}

.relation-modal__resizer--ne {
  top: -3px;
  right: -3px;
  cursor: nesw-resize;
}

.relation-modal__resizer--nw {
  top: -3px;
  left: -3px;
  cursor: nwse-resize;
}

.relation-modal__resizer--se {
  bottom: -3px;
  right: -3px;
  cursor: nwse-resize;
}

.relation-modal__resizer--sw {
  bottom: -3px;
  left: -3px;
  cursor: nesw-resize;
}

.relation-modal__header h2 {
  margin: 0;
  font-size: 16px;
  color: #fff;
  letter-spacing: 0.02em;
}

.relation-modal__close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(140, 180, 255, 0.3);
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  font-size: 14px;
}

.relation-modal__close:hover {
  background: rgba(140, 180, 255, 0.15);
}

.relation-modal__canvas {
  flex: 1;
  position: relative;
}

.relation-modal .react-flow {
  background: transparent !important;
}

.relation-modal .react-flow__edge-path {
  stroke: rgba(180, 200, 255, 0.5);
  stroke-width: 1.5px;
}

.relation-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  background: #14192c;
  border: 1.5px solid var(--group-color);
  box-shadow: 0 0 10px color-mix(in srgb, var(--group-color) 40%, transparent);
  box-sizing: border-box;
  text-align: center;
}

.relation-node__badges {
  position: absolute;
  top: -6px;
  right: -6px;
  display: flex;
  gap: 3px;
}

.relation-node__badge {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(12, 16, 32, 0.95);
}

.relation-node__label {
  font-size: 13px;
  color: #fff;
  font-weight: 600;
  line-height: 1.4;
}

.relation-node__reading {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
}

.relation-node__summary {
  font-size: 11px;
  color: var(--group-color);
  line-height: 1.4;
}

.relation-group-box {
  width: 100%;
  height: 100%;
  border: 1.5px dashed var(--group-color);
  border-radius: 14px;
  background: color-mix(in srgb, var(--group-color) 12%, transparent);
  position: relative;
  box-sizing: border-box;
}

.relation-group-box__label {
  position: absolute;
  top: 8px;
  left: 14px;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--group-color);
  text-transform: uppercase;
}

/* 画像クリックで開く拡大表示 */
.image-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(2, 4, 10, 0.9);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  cursor: zoom-out;
}

.image-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.image-lightbox__close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(140, 180, 255, 0.4);
  background: rgba(10, 14, 30, 0.7);
  color: var(--text-main);
  font-size: 18px;
  cursor: pointer;
}

.image-lightbox__close:hover {
  background: rgba(140, 180, 255, 0.2);
}

.image-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(140, 180, 255, 0.4);
  background: rgba(10, 14, 30, 0.7);
  color: var(--text-main);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.image-lightbox__nav:hover {
  background: rgba(140, 180, 255, 0.2);
}

.image-lightbox__nav--prev {
  left: 20px;
}

.image-lightbox__nav--next {
  right: 20px;
}

.image-lightbox__counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(10, 14, 30, 0.7);
  border: 1px solid rgba(140, 180, 255, 0.3);
  color: var(--text-main);
  font-size: 13px;
  letter-spacing: 0.04em;
  z-index: 2;
}

/* 挿絵スライドショー(HUB直下の「挿絵スライドショー」ノードから開く) */
.image-slideshow {
  position: fixed;
  inset: 0;
  background: rgba(2, 4, 10, 0.9);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

/* stage: 2つのスロット(layer)を同じ全画面の上に重ねるための土台。
   クロスフェードのフェード自体はlayer側(このdiv)が担い、img自身には
   一切フェードを掛けない。そうすることで、in→outに役割が変わっても
   img要素は再生成されず、そこまでに進んでいたkenburns等のズーム状態
   (transformのforwards保持)がフェードアウト中もそのまま保たれる。 */
.image-slideshow__stage {
  position: absolute;
  inset: 0;
}

.image-slideshow__layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.image-slideshow__layer--in {
  z-index: 1;
  animation: slideshow-layer-fade-in 2s ease-in-out forwards;
}

.image-slideshow__layer--out {
  z-index: 0;
  animation: slideshow-layer-fade-out 2s ease-in-out forwards;
}

@keyframes slideshow-layer-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideshow-layer-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

.image-slideshow__img {
  max-width: 80vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  cursor: default;
  pointer-events: auto;
}

/* フェードアウト中の画像はもうクリック対象ではないので、下に隠れている
   だけの透明な要素としてクリックを素通りさせる。 */
.image-slideshow__layer--out .image-slideshow__img {
  pointer-events: none;
}

/* 自動再生OFFのときは、kenburns-*・blur-focusなどの持続効果を一切
   掛けない(画像を静止させる)。切り替え自体のクロスフェード
   (.image-slideshow__layer側のアニメーション)はこの対象に含めない。 */
.image-slideshow--paused .image-slideshow__img {
  animation: none;
}

/* 画像が切り替わるたび(非アクティブ側スロットのimgが新しい画像で
   再生成される)、以下のいずれかの持続的な動きがランダムに割り当てられ、
   最初から走る。継続時間(9s)はあえて自動送りの間隔(6s、
   SLIDESHOW_INTERVAL_MS)より長くしてあり、次の画像へ切り替わるまでの
   間ずっと動き続け、パンが途中で止まって見えることがないようにして
   いる。easeを使わずlinearにしているのも、終盤で減速して「止まった」
   ように見えるのを防ぐため。 */
.image-slideshow__img--kenburns-center {
  animation: slideshow-kenburns-scale 9s linear forwards;
  transform-origin: center center;
}

.image-slideshow__img--kenburns-pan-tl {
  animation: slideshow-kenburns-scale 9s linear forwards;
  transform-origin: 20% 20%;
}

.image-slideshow__img--kenburns-pan-tr {
  animation: slideshow-kenburns-scale 9s linear forwards;
  transform-origin: 80% 20%;
}

.image-slideshow__img--kenburns-pan-bl {
  animation: slideshow-kenburns-scale 9s linear forwards;
  transform-origin: 20% 80%;
}

.image-slideshow__img--kenburns-pan-br {
  animation: slideshow-kenburns-scale 9s linear forwards;
  transform-origin: 80% 80%;
}

@keyframes slideshow-kenburns-scale {
  from { transform: scale(1); }
  to { transform: scale(1.14); }
}

.image-slideshow__img--blur-focus {
  animation: slideshow-blur-focus 1.4s ease-out forwards;
  transform-origin: center center;
}

@keyframes slideshow-blur-focus {
  from { filter: blur(18px); transform: scale(1.04); }
  to { filter: blur(0); transform: scale(1); }
}

.image-slideshow__close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(140, 180, 255, 0.4);
  background: rgba(10, 14, 30, 0.7);
  color: var(--text-main);
  font-size: 18px;
  cursor: pointer;
  z-index: 2;
  transition: opacity 0.3s ease;
}

.image-slideshow__close:hover {
  background: rgba(140, 180, 255, 0.2);
}

.image-slideshow__playtoggle {
  position: absolute;
  top: 20px;
  right: 68px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(140, 180, 255, 0.4);
  background: rgba(10, 14, 30, 0.7);
  color: var(--text-main);
  font-size: 15px;
  cursor: pointer;
  z-index: 2;
  transition: opacity 0.3s ease;
}

.image-slideshow__playtoggle:hover {
  background: rgba(140, 180, 255, 0.2);
}

.image-slideshow__bgmtoggle {
  position: absolute;
  top: 20px;
  right: 112px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(140, 180, 255, 0.4);
  background: rgba(10, 14, 30, 0.7);
  color: var(--text-main);
  font-size: 15px;
  cursor: pointer;
  z-index: 2;
  transition: opacity 0.3s ease;
}

.image-slideshow__bgmtoggle:hover {
  background: rgba(140, 180, 255, 0.2);
}

.image-slideshow__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(140, 180, 255, 0.4);
  background: rgba(10, 14, 30, 0.7);
  color: var(--text-main);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  transition: opacity 0.3s ease;
}

.image-slideshow__nav:hover {
  background: rgba(140, 180, 255, 0.2);
}

.image-slideshow__nav--prev {
  left: 20px;
}

.image-slideshow__nav--next {
  right: 20px;
}

.image-slideshow__counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(10, 14, 30, 0.7);
  border: 1px solid rgba(140, 180, 255, 0.3);
  color: var(--text-main);
  font-size: 13px;
  letter-spacing: 0.04em;
  z-index: 2;
  transition: opacity 0.3s ease;
}

/* マウスがしばらく動かないと、画像はそのままにボタン類だけをフェード
   アウトする。動かせばimage-slideshow側のonMouseMoveで即座に戻る。 */
.image-slideshow--controls-hidden .image-slideshow__close,
.image-slideshow--controls-hidden .image-slideshow__playtoggle,
.image-slideshow--controls-hidden .image-slideshow__bgmtoggle,
.image-slideshow--controls-hidden .image-slideshow__nav,
.image-slideshow--controls-hidden .image-slideshow__counter {
  opacity: 0;
  pointer-events: none;
}

/* 検索パネル(常に手前に浮かぶウィンドウ。背景操作は妨げない) */
.search-panel {
  position: fixed;
  top: 12vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, 90vw);
  max-height: 70vh;
  background: rgba(12, 16, 32, 0.97);
  border: 1px solid rgba(140, 180, 255, 0.25);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
}

.search-panel__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(140, 180, 255, 0.15);
  cursor: move;
  user-select: none;
}

.search-panel__handle {
  flex-shrink: 0;
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.search-panel__input {
  flex: 1;
  background: rgba(6, 9, 20, 0.7);
  border: 1px solid rgba(140, 180, 255, 0.25);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-main);
  font-size: 14px;
  cursor: text;
}

.search-panel__input:focus {
  outline: none;
  border-color: rgba(140, 180, 255, 0.6);
}

.search-panel__close {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid rgba(140, 180, 255, 0.3);
  background: transparent;
  color: var(--text-main);
  font-size: 14px;
  cursor: pointer;
}

.search-panel__close:hover {
  background: rgba(140, 180, 255, 0.15);
}

.search-panel__results {
  overflow-y: auto;
  padding: 6px;
}

.search-panel__empty {
  padding: 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

.search-panel__item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.search-panel__item:hover {
  background: rgba(140, 180, 255, 0.12);
}

.search-panel__item-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.search-panel__item-snippet {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
  line-height: 1.5;
}
