/* ── 사이드 패널 (Notion 스타일) */
#panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: var(--panel-w);
  min-width: var(--panel-min);
  max-width: var(--panel-max);
  z-index: 200;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-panel);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--t-slow);
}

#panel.open { transform: translateX(0); }

/* 드래그 핸들 */
#panel-resize {
  position: absolute;
  top: 0; bottom: 0; left: -4px;
  width: 8px;
  cursor: col-resize;
  z-index: 10;
}

#panel-resize::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 3px;
  width: 2px;
  background: transparent;
  transition: background var(--t-fast);
}

#panel-resize:hover::after,
#panel-resize.dragging::after {
  background: var(--accent-blue);
}

/* 헤더 */
.panel-header {
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel-header);
  flex-shrink: 0;
}

.panel-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

#panel-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: 16px;
  transition: all var(--t-fast);
  flex-shrink: 0;
  margin-left: var(--sp-2);
  margin-top: -2px;
}

#panel-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.panel-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.3px;
}

.panel-badge-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
}

#panel-name {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  line-height: var(--leading-tight);
  margin-bottom: var(--sp-1);
}

#panel-alias {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

#panel-disambig {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
  margin-top: var(--sp-2);
}

/* 바디 — 스크롤 가능 */
.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4) var(--sp-5);
}

/* 섹션 */
.panel-section {
  margin-bottom: var(--sp-5);
}

.panel-section-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: #a78bfa;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--sp-3);
}

/* 필드 행 */
.field-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: var(--sp-2);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}

/* 이의신청은 **라벨 자체를 누르는** 것으로 한다.
   아이콘을 줄마다 넣어봤는데(라벨 안 → 전용 칸 → 여백에 절대배치) 좁은
   패널에서 폭을 먹거나 줄마다 높이가 어긋났다. 아이콘이 없으면 그 문제가
   아예 없다. 표는 아이콘이 없던 때와 완전히 같다.

   점선 밑줄은 **상시** 신호다. 호버만으로는 아무도 못 찾는다 —
   눌러도 된다는 걸 가만히 있을 때 알려야 한다.
   (이 앱이 이미 쓰는 표시다: modal.css 의 점선 밑줄) */
.field-label.war {
  cursor: pointer;
  /* border-bottom 을 쓰면 라벨 칸(110px) 끝까지 줄이 그어져서
     "원작 ————" 처럼 보인다. text-decoration 은 **글자 길이만큼만** 긋는다. */
  text-decoration: underline dotted rgba(255,150,70,0.45);
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: color .12s, text-decoration-color .12s;
}
.field-label.war:hover {
  color: rgba(255,180,100,1);
  text-decoration-color: rgba(255,150,70,0.95);
}

/* 즉시 뜨는 설명. 브라우저 기본 title 은 1초쯤 기다려야 떠서 "안 뜬다" 로
   느껴진다. 직접 그려서 호버하자마자 보이게 한다. */
#field-tip {
  position: fixed; z-index: 3000; pointer-events: none;
  background: rgba(10,14,34,0.97);
  border: 1px solid rgba(255,150,70,0.45);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11.5px; line-height: 1.5;
  color: rgba(255,200,150,0.95);
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

.field-row:last-child { border-bottom: none; }

.field-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: var(--weight-semibold);
  padding-top: 1px;
}

.field-value {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
  word-break: break-word;
}

.field-value a {
  color: var(--text-accent);
}

/* 연결된 행성 칩 */
.rel-chips { display: flex; flex-wrap: wrap; gap: var(--sp-1); }

.rel-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
}

.rel-chip:hover {
  border-color: var(--border-hover);
  background: var(--bg-hover);
  color: var(--text-primary);
}

.rel-chip-arrow {
  font-size: var(--text-sm);
  color: #a78bfa;
  font-weight: var(--weight-bold);
  margin: 0 2px;
}

.rel-chip-period {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 4px;
}

.rel-chip-del {
  display: none;
  background: none;
  border: none;
  color: rgba(255, 80, 80, 0.6);
  font-size: 10px;
  cursor: pointer;
  padding: 0 0 0 4px;
  line-height: 1;
}
.rel-chip:hover .rel-chip-del { display: inline; }
.rel-chip-del:hover { color: rgba(255, 80, 80, 1); }

/* 구분선 */
.panel-sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--sp-4) 0;
}


/* 구분자 — "중구" 가 넷이면 이게 없으면 어느 쪽인지 알 수가 없다 */
.edge-drop-dis {
  font-size: 11px;
  color: rgba(160, 196, 255, 0.6);
  margin-left: 2px;
}


/* 구분자 — "중구" 가 다섯이라 이름만으론 어느 쪽에 연결됐는지 알 수 없다 */
.rel-chip-dis { font-size: 10px; color: rgba(160, 196, 255, 0.55); margin-left: 4px; font-weight: 400; }


/* ── 평가 ── 좋다 / 보통 / 나쁨. 같은 버튼 다시 누르면 취소다. */
#rate-asof { font-size: 10px; font-weight: 400; color: rgba(150,180,255,.45); margin-left: 6px; letter-spacing: 0; text-transform: none; }
.rate-btns { display: flex; gap: 5px; }
.rate-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 4px;
  background: rgba(100,140,255,.06);
  border: 1px solid rgba(100,140,255,.2);
  border-radius: 6px;
  color: rgba(200,216,255,.7);
  font-family: inherit; font-size: 12.5px; cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.rate-btn > i { font-size: 15px; line-height: 1; flex-shrink: 0; }
.rate-lbl { white-space: nowrap; }
.rate-btn:hover { background: rgba(100,140,255,.13); color: #e6eeff; }
.rate-n { font-size: 11px; font-variant-numeric: tabular-nums; color: rgba(150,180,255,.5); }
.rate-btn.on { background: rgba(127,214,168,.18); border-color: rgba(127,214,168,.6); color: #eaffef; }
.rate-btn.on .rate-n { color: rgba(214,255,233,.8); }


/* 평가 직후 뜨는 한 줄 — 안 쓰고 닫아도 평가는 남는다 */
#rate-reason { display: flex; gap: 5px; margin-top: 8px; }
#rr-input {
  flex: 1; min-width: 0;
  background: rgba(6,9,22,.6); border: 1px solid rgba(127,214,168,.4);
  border-radius: 5px; padding: 7px 10px;
  color: #e6eeff; font-family: inherit; font-size: 12.5px;
}
#rr-send, #rr-skip {
  background: rgba(127,214,168,.16); border: 1px solid rgba(127,214,168,.4);
  border-radius: 5px; color: #d6ffe9; cursor: pointer;
  font-family: inherit; font-size: 12px; padding: 0 10px;
}
#rr-skip { background: none; border-color: rgba(100,140,255,.2); color: rgba(150,180,255,.5); }


/* 빈 칸 채우기 칩 — 「채울 수 있는 정보」를 글자 나열이 아니라 누를 것으로.
   예전엔 "영문 이름, 사망일, 국적…" 이라고만 적혀 있어서, 채우려면 연필을
   눌러 편집 모달을 열고 그 칸을 찾아야 했다. 여기서 바로 끝난다. */
.fill-chip {
  background: rgba(52,211,153,0.08);
  border: 1px solid rgba(52,211,153,0.28);
  border-radius: var(--r-full);
  color: rgba(150,235,195,0.9);
  font-family: inherit; font-size: 11px;
  padding: 4px 10px; cursor: pointer;
  transition: all .12s;
}
.fill-chip:hover {
  background: rgba(52,211,153,0.18);
  border-color: rgba(52,211,153,0.6);
  color: #dfffee;
}

/* 이미 담아둔 칸 — 발진 전이라 아직 서버엔 없다 */
.fill-chip.queued {
  background: rgba(52,211,153,0.22);
  border-color: rgba(52,211,153,0.65);
  color: #eaffef;
}
