/* style.css の中身 */
:root {
  --color-const: #be185d;
  --color-law: #3b82f6;
  --color-order: #10b981;
  --color-rule: #f59e0b;
  /* 昼モード：少しだけグレーに寄せた、目に優しい白 */
  --bg-light-base: #e2e8f0; /* Slate-200 */
  --bg-light-card: #f1f5f9; /* Slate-100 */

  /* 夜モード：深い紺色で、真っ黒よりも高級感を出すよ */
  --bg-dark-base: #0f172a; /* Slate-900 */
  --bg-dark-card: #1e293b; /* Slate-800 */

  /* 華を出すためのアクセントカラー */
  --color-accent-light: rgba(59, 130, 246, 0.08); /* 涼やかな青 */
  --color-accent-dark: rgba(245, 158, 11, 0.1); /* 暖かなアンバー（琥珀色） */
}

.type-constitution {
  border-left: 6px solid var(--color-const) !important;
}

.type-law {
  border-left: 6px solid var(--color-law) !important;
}

.type-order {
  border-left: 6px solid var(--color-order) !important;
}

.type-rule {
  border-left: 6px solid var(--color-rule) !important;
}

.marked-row {
  background-color: rgba(244, 63, 94, 0.05) !important;
}
/* ボディの背景を微調整 */
body {
  background-color: var(--bg-light-base);
}
.dark body {
  background-color: var(--bg-dark-base);
}
.dark .marked-row {
  background-color: rgba(244, 63, 94, 0.1) !important;
}

.sticky-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
}

.sort-header {
  cursor: pointer;
  transition: color 0.2s;
}

.sort-header:hover {
  color: #3b82f6;
}

.gc-active {
  background-color: #f43f5e !important;
  color: white !important;
  box-shadow: 0 0 15px rgba(244, 63, 94, 0.5);
  transform: scale(1.05);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fadeIn {
  animation: fadeIn 0.3s ease-out;
}

.modal-container {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.modal-body {
  overflow-y: auto;
  flex-grow: 1;
  scrollbar-width: thin;
}

/* 検索条件パネル：閉じている状態 */
.panel-collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0 !important;
  overflow: hidden;
  pointer-events: none;
}

/* 検索条件パネル：開いている状態 */
.panel-expanded {
  max-height: 1000px; /* 中身が収まる十分な高さ */
  opacity: 1;
  overflow: visible;
}

/* ソート中の列を強調する「華」のクラス */
.sorted-column-highlight {
  background-color: var(--color-accent-light) !important;
  border-left: 1px solid rgba(59, 130, 246, 0.1);
  border-right: 1px solid rgba(59, 130, 246, 0.1);
  transition: all 0.3s ease;
}

.dark .sorted-column-highlight {
  background-color: var(--color-accent-dark) !important;
  border-left: 1px solid rgba(245, 158, 11, 0.1);
  border-right: 1px solid rgba(245, 158, 11, 0.1);
}

/* ヘッダーのアクティブバーをよりお淑やかに */
.active-header-bar {
  position: relative;
}

.active-header-bar::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 10%;
  width: 80%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #3b82f6, transparent);
  border-radius: 99px;
}

.dark .active-header-bar::after {
  background: linear-gradient(90deg, transparent, #f59e0b, transparent);
}

/* 詳細エリアの表示状態 */
#advancedSearchContent.expanded {
  display: block;
  opacity: 1;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tierチップのアクティブ表示 */
.tier-chip.active {
  background-color: #3b82f6;
  color: white;
  border-color: #3b82f6;
  box-shadow: 0 4px 6px -1px rgb(59 130 246 / 0.5);
}

/* モーダル本体のスタイル調整例 */
#modalOverlay::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

#modalOverlay {
  width: 90%; /* スマホでは画面いっぱいに近く */
  max-width: 1200px; /* PCではこの幅以上広がらない（現状より少し広め） */
  padding: 0;
  border: none;
  border-radius: 1.5rem;
  margin: auto;
}

#modalOverlay .modal-box {
  min-width: 80%; /* 「最低でもこれくらいは広がってね」というお願い */
}

/* 帆波の桜色ツールチップ */
.tooltip-sakura {
  --tooltip-color: #fef2f2; /* 薄い桜色（背景） */
  --tooltip-text-color: #991b1b; /* 濃い紅梅色（文字） */
}

.tooltip-sakura:before {
  background-color: var(--tooltip-color) !important;
  color: var(--tooltip-text-color) !important;
  border: 1px solid #fee2e2; /* 繊細な境界線 */
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1); /* 柔らかい影 */
  max-width: 24rem; /* 約384px。情報の網羅性を担保するサイズ */
  width: max-content;
  text-align: left;
  font-family: monospace; /* 数式っぽく見せるなら等幅フォント */
  font-size: 0.35rem;
  line-height: 1.4;
  padding: 1rem;
}

/* 下の三角部分の色も合わせます */
.tooltip-sakura:after {
  border-top-color: var(--tooltip-color) !important;
}

/* --- 依存関係MAP 演出用スタイル --- */

/* 矢印コネクターの強化 */
.law-arrow {
  position: absolute;
  top: 15%;
  height: 3px; /* 太くしました */
  background: #94a3b8; /* slate-400 */
  z-index: 0;
  transition: all 0.5s ease;
}

.dark .law-arrow {
  background: #475569; /* slate-600 */
}

/* 矢印の先端 */
.law-arrow::after {
  content: "";
  position: absolute;
  right: -4px;
  top: -5px;
  color: #f59e0b; /* amber-500 */
  border-top: 6.5px solid transparent;
  border-bottom: 6.5px solid transparent;
  border-left: 10px solid currentColor;
}

/* シミュレーション中の矢印（汚染状態） */
.law-arrow.is-corrupted {
  background: #ef4444 !important; /* rose-500 */
  color: #ef4444 !important;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
  z-index: 10;
}

/* ひび割れ（バキバキ演出） */
.crack-effect {
  position: relative;
  overflow: hidden;
}

.crack-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  /* 鋭い亀裂の描画（透過画像のようなライン） */
  background-image:
    linear-gradient(115deg, transparent 49.5%, #ef4444 50%, transparent 50.5%),
    linear-gradient(245deg, transparent 49.5%, #ef4444 50%, transparent 50.5%),
    linear-gradient(10deg, transparent 49.7%, #ef4444 50%, transparent 50.3%);
  background-size: 120% 120%;
  z-index: 5;
  background-repeat: no-repeat;
  /* JSから渡される変数で位置と回転をズラす */
  background-position: var(--crack-x, 50%) var(--crack-y, 50%);
  transform: scale(1.5) rotate(var(--crack-rotate, 0deg));
}

/* 深刻なダメージ時のノイズ */
.focus-node-damaged {
  animation: focus-shake 0.1s infinite;
  border-color: #ef4444 !important;
  background-color: rgba(244, 63, 94, 0.2) !important;
}

@keyframes focus-shake {
  0% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(1px, -1px);
  }
  50% {
    transform: translate(-1px, 1px);
  }
  75% {
    transform: translate(1px, -1px);
  }
  100% {
    transform: translate(-1px, 1px);
  }
}
