/* --- 기존 index.html의 <style> 전체를 여기에 그대로 붙여넣기 --- */
/* =========================================================
   app.css  (원래 index.html의 <style>을 파일로 분리)
   * base.html의 인라인 :root가 색 팔레트를 덮어씁니다.
   * 여기는 기본값(폴백)만 넣어둠
   ========================================================= */

:root{
  /* base.html이 같은 변수명을 인라인으로 주입하여 최종 오버라이드 */
  --bg: #0b0b0f;
  --card: #11131a;
  --border: #232634;
  --text: #e6e8ef;
  --muted: #9aa0aa;
  --button: #1a1f2b;
  --good: #2a5cff;
  --bad: #d43b2f;

  --glyph-w: 0.9em;
  --mark-w:  0.6em;

  /* Firdaria 글리프 고정폭 */
  --fird-glyph-w: 1em;

  /* ZR 셀 패딩 */
  --zr-cell-pad: 2px;

  /* ZR 아이콘 크기 */
  --zr-size: 16px;

  /* Speed 아이콘 크기 */
  --speed-size: 12px;
  
  /* Dignities 아이콘 크기 */
  --dig-size: 14px;

  /* Firdaria 아이콘 크기 */
  --fird-size: 14px;

  /* dignity 마크 간격 / 최소 너비 */
  --mark-gap: 3px;
  --dig-col-min: 30px;

  /* (NEW) 베이스라인 미세 보정 기본값 */
  --baseline-nudge: 0;
}

/* (NEW) CJK에서 한글/한자가 살짝 내려가 보이는 현상 완화 */
html:lang(ko), html:lang(ja),
html:lang(zh-cn), html:lang(zh-tw) { --baseline-nudge: -0.02em; }

*{box-sizing:border-box}
html,body{height:100%;}
body{
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
  margin:0;
}

/* (NEW) 폼 컨트롤 통일 규격 */
.input-like{
  width:100%;
  height:36px;               /* input/select 동일 고정 높이 */
  line-height:1.25;
  padding:8px;
  box-sizing:border-box;
  border:1px solid var(--border);
  border-radius:6px;
  background:var(--card);
  color:var(--text);
}
select.input-like{
  appearance:none;
  -webkit-appearance:none;
  -moz-appearance:none;
  padding-right:28px;        /* 드롭다운 화살표 영역 확보 */
}

/* (NEW) CJK 시각 중심선 보정: 폼/라벨/버튼 등에만 아주 미세 적용 */
label, input, select, button, .title {
  position: relative;
  top: var(--baseline-nudge);
}

/* ===================== 전역 드래그/선택 차단 ===================== */
html, body, .page { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }
img, svg { -webkit-user-drag: none; }
input, textarea, select, .allow-select { -webkit-user-select: text; -moz-user-select: text; -ms-user-select: text; user-select: text; }
/* =============================================================== */

.page{max-width:1280px;margin-inline:auto;padding:14px 14px 40px}

.grid{
  display:grid;
  grid-template-columns:minmax(720px,1fr) 360px;
  gap:14px;
  align-items:start;
}
@media (max-width:1080px){ .grid{grid-template-columns:1fr} }

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:10px;
  padding:12px;
  box-shadow:0 1px 0 rgba(0,0,0,.03)
}
.title{margin:0 0 8px;text-align:center}

/* === Site title (Gienah) 전용: 포커스 링 제거 + 텍스트 너비만 클릭 === */
#siteTitle{
  /* 텍스트 너비만 차지 */
  width: max-content;          /* 현대 브라우저 */
  display: block;              
  margin: 0 auto 8px;          /* 가운데 정렬 */
  /* 포커스 링/탭 하이라이트 제거 (제목에만) */
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
#siteTitle:focus,
#siteTitle:focus-visible{
  outline: none;
  box-shadow: none;
}

.card.chart{border:none;padding:0;background:transparent;box-shadow:none}
.chart-circle{
  width:100%;
  max-width:100%;
  aspect-ratio:1/1;
  border-radius:50%;
  overflow:visible;
  background:var(--card);
  display:flex;align-items:center;justify-content:center
}
.chart-circle svg{
  overflow:visible;
}

@media (max-width: 1080px){
  .chart-circle{width:100%;max-width:100%;}
  .tables-row{ justify-content: center; }
  .tables-row .card{ margin-left:auto; margin-right:auto; max-width:100%; }
}

.tables-row{display:flex;gap:14px;flex-wrap:wrap;margin-top:14px;align-items:flex-start;}

/* ---- 표 기본 ---- */
.table-dig,.table-sect,.table-return{border-collapse:collapse;font-size:14px;white-space:nowrap}
.table-fird,.table-zr,.table-speed,.table-lots{border-collapse:collapse;font-size:12px;white-space:nowrap;min-width:280px}

.table-dig th,.table-dig td,.table-sect th,.table-sect td,
.table-fird th,.table-fird td,.table-zr th,.table-zr td,
.table-speed th,.table-speed td,.table-lots th,.table-lots td{border:1px solid var(--border);text-align:center}

.table-dig th,.table-sect th,.table-fird th,.table-fird td,.table-zr th,.table-zr td,
.table-speed th,.table-speed td,.table-lots th,.table-lots td{background:var(--card);font-weight:normal}

.table-dig caption,.table-sect caption,.table-fird caption,.table-zr caption,.table-speed caption,.table-return caption,
.table-lots caption{
  caption-side: top;text-align:center;font-weight:700;margin-bottom:6px
}
.table-fird caption,.table-zr caption,.table-speed caption,.table-lots caption{font-size:14px}

/* 각 표 패딩 */
.table-fird th,.table-fird td{padding:2px 4px}
.table-fs   th,.table-fs   td{padding:2px 6px}
.table-lots th,.table-lots td{padding:2px 0px}

/* ✅ ZR 표 행 높이 살짝 확대 */
.table-zr th,.table-zr td{padding: var(--zr-cell-pad); vertical-align:middle; line-height:1.4;}

/* Sect 표는 예전 레이아웃처럼 여유 있게 */
.table-sect th,.table-sect td{padding:4px 6px}
/* Sect의 Condition 열은 중앙 정렬 */
.table-sect td:nth-child(5){ text-align:center; }

/* Firdaria/ZR/FS/Lots 열 폭 (Sect는 colgroup 없이 자동폭) */
.table-fird colgroup col:nth-child(1),
.table-zr   colgroup col:nth-child(1),
.table-fird colgroup col:nth-child(2),
.table-zr   colgroup col:nth-child(2){width:92px}
.table-fird colgroup col:nth-child(3),
.table-zr   colgroup col:nth-child(3){width:60px}

.table-fird td:nth-child(2), .table-zr td:nth-child(2){text-align:center}
/* ⛏ 공용 규칙 분리: ZR 3열에는 오른쪽 6px 패딩 불필요 */
.table-fird td:nth-child(3){
  text-align:center;font-variant-numeric:tabular-nums;font-feature-settings:"tnum" 1;padding-right:6px;
}
.table-zr  td:nth-child(3){ text-align:center; } /* 좌우 대칭 패딩유지 */

/* 숫자 정렬(각도/오브 등) */
.num{ font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1, "lnum" 1; }

/* Good/Bad */
.good{ color:var(--good) } .bad{ color:var(--bad) }

.cell{
  display:inline-grid;
  grid-template-columns: var(--glyph-w) var(--mark-w);
  column-gap: var(--mark-gap);
  align-items:center;justify-content:center;
  min-width: max(calc(var(--glyph-w) + var(--mark-w) + var(--mark-gap)), var(--dig-col-min));
}
.cell2{ font-size:11px; }
.cell3{ display:inline-grid; }

.glyph{
  display:inline-flex;width:var(--glyph-w);justify-content:center;line-height:1;
  font-family: "Segoe UI Symbol","Apple Symbols","Noto Sans Symbols2","Arial Unicode MS",system-ui,sans-serif;
}
/* Firdaria Period 열 정렬 고정 */
.table-fird .glyph{
  width: var(--fird-glyph-w);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 14px;
  line-height: 1;
}
/* ZR의 글리프를 더 크게 */
.table-zr   .glyph{width:auto;font-size:18px;line-height:1}
.table-zr.compact .glyph{font-size:18px}

/* Speed 표 글리프 */
.table-speed .glyph{width:auto;font-size:14px;line-height:1}

/* Essential Dignities — Pt(첫 열) SVG 아이콘을 Speed와 동일 스케일로 */
.table-dig .icon-svg{
  /* Speed 표와 동일 변수 사용(없으면 14px로 폴백) */
  width:  var(--dig-size, 14px);
  height: var(--dig-size, 14px);
  vertical-align: middle;
  transform:translateY(1px);
}
/* 글리프(문자)는 기존 크기를 유지 — 따로 만지지 않음 */

.table-fird .icon-svg{
  /* Speed 표와 동일 변수 사용(없으면 14px로 폴백) */
  width:  var(--fird-size, 12px);
  height: var(--fird-size, 12px);
  vertical-align: middle;
  transform:translateY(1px);
}

/* Pt 열의 2글자(As/Mc/Ds/Ic 등)만 살짝 축소 */
.table-dig .glyph-2ch,
.table-speed .glyph-2ch,
.table-fstars .glyph-2ch{ font-size:12px; width:auto; letter-spacing:0; line-height:1; }
@media (max-width: 720px){
  .table-dig.compact .glyph-2ch,
  .table-speed.compact .glyph-2ch,
  .table-fstars .glyph-2ch{ font-size:11px; }
  .cell2{ font-size:10px;}
}

.mark{display:inline-flex;width:var(--mark-w);justify-content:center;align-items:center;font-size:12px;line-height:1;text-align:center;transform:translateY(1px);}
.mark.minus{color:inherit}
.score-wrap{display:inline-flex;align-items:center;justify-content:flex-end;gap:3px;white-space:nowrap;margin-right:2px;transform:translateX(-5px)}
.score-num{display:inline-block;width:4ch;text-align:right;font-variant-numeric:tabular-nums;font-feature-settings:"tnum" 1, "lnum" 1}
.score-p{width:.9ch;text-align:left}
@media (max-width: 720px){
  .table-dig .icon-svg{transform:translateY(2px)}
  .mark{transform:translateY(2.5px)}
  .score-num, .score-p{transform:translateY(1px)}
}

/* 글리프/구분자도 고정 배치: 항상 가운데 */
.fird-period{
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  justify-content: center;
}

.fird-period .sep{
  width: 0.8em;          /* 구분자도 고정폭 */
  text-align: center;
  display: inline-block;
  opacity: .9;
  font-size: 12px;
}

/* planet color classes */
.pl-Sun{color:#caa23a}.pl-Moon{color:#caa23a}.pl-Mercury{color:#7a3db8}.pl-Venus{color:#1aa7a0}
.pl-Mars{color:#d43b2f}.pl-Jupiter{color:#7f7f7f}.pl-Saturn{color:#8B4513}

/* etc color = text */
.fird-nav .dots, .fird-nav .glyph[class*="Node"]{
  color: var(--text);
}

/* button */
button[disabled]{opacity:.45;cursor:not-allowed;filter:grayscale(.25)}

/* ===== Firdaria 내비 ===== */
.fird-nav{display:flex;align-items:center;justify-content:center;gap:6px;padding:2px;font-weight:normal}
.fird-nav .glyph{
  width: var(--fird-glyph-w);    /* 표와 동일한 고정폭 */
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 15px;
  line-height: 1;
  background: none;
  border: none;
  padding: 0;
  margin: 0;                     /* 버튼 기본 여백 제거(브라우저별 안전) */
  font-weight: normal;
  cursor: pointer;
}
.fird-nav .dots{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:none;
  border:none;
  margin:0;
  padding:0;
  font-weight:normal;
  user-select:none;
  cursor: pointer;
}

/* ===== ZR ===== */
.zr-title-btn{background:none;border:none;color:inherit;font:inherit;padding:0;margin:0;cursor:default;}
.zr-title-btn:hover,.zr-title-btn:focus{cursor:default; outline:none; text-decoration:none;}
.zr-enter{background:none;border:none;padding:0;margin:0;cursor:default;}

/* ★ 공용 SVG 아이콘: 모든 표에서 사용 */
.icon-svg{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:var(--zr-size);
  height:var(--zr-size);
  vertical-align:middle;
}

/* 표별 보정이 필요한 경우도 두 클래스 모두 적용 */
.table-speed .icon-svg{
  width:var(--speed-size);
  height:var(--speed-size);
  transform:translateY(-1px);
}

.table-zr tr.lb td{ border-bottom:2px dashed var(--muted); }

/* === ZR 행성 아이콘 === */
.table-zr .icon-svg .pl-Jupiter, .pl-Venus, .pl-Mars, .pl-Saturn{
  justify-content: center;
  align-items: center;
  transform:translateY(1px);
}

/* === LB 아이콘(노란 번개) === */
.lb-icon{
  color:#f2c84b;
  font-size:18px;
  line-height:1;
  display:grid;
  justify-content: center;
  align-items:center;
  margin:0;
  transform:translateY(-1px);
  padding:0px 3px;
}

/* === ZR 마커 컨테이너: grid로 정확 중앙 정렬 === */
.zr-marks{
  display: grid;
  grid-auto-flow: column;
  justify-content: center;
  align-items: center;
  column-gap: 3px;
}
.zr-marks > *{ display:block; line-height:1; }

.zr-peak{font-size:14px}
.zr-peak.ym{color:#f2c84b}
.zr-peak.bm{color:var(--good)}

/* F/S 색상 */
.fs-fast{ color:#2eaf49; }
.fs-slow{ color:#caa23a; }
.fs-retro{ color:var(--bad); }

/* === 공통: 클릭 영역 & hover 반응 === */
circle.planet-hit,
g.house-hit > circle {
  cursor: pointer;
  fill: rgba(128,128,128,0);
}

/* === 모바일(터치: hover 제한, 포인터 굵음) === */
@media (hover: none) and (pointer: coarse) {
  circle.planet-hit,
  g.house-hit > circle {
    transition: fill 0.15s ease;
  }
  circle.planet-hit:hover,
  g.house-hit > circle:hover {
    fill: rgba(128,128,128,0.25);
  }
}

/* === PC(마우스: hover 지원, 포인터 정밀) === */
@media (hover: hover) and (pointer: fine) {
  circle.planet-hit,
  g.house-hit > circle {
    transition: fill 0.35s ease;
  }
}

/* 비강조(비관련) 애스펙트: 선(<line>)과 중앙 아이콘(<g>) 모두 대상 */
.aspect-line.disabled,
.aspect-icon.disabled {
  opacity: 0.2;                 /* 요소 전체 불투명도 ↓ → stroke/fill 동시에 흐림 */
  stroke-opacity: 0.2 !important;/* (보강) inline style의 stroke-opacity도 강제로 ↓ */
}

dialog.place-dlg { border: 1px solid var(--border); border-radius: 12px; padding: 0; background: var(--card); color: var(--text); width: min(360px, 92vw); }
.place-box { padding: 10px; }
.place-head { display:flex; gap:8px; align-items:center; }
.place-head input { flex:1; padding:8px; border:1px solid var(--border); border-radius:8px; background:var(--bg); color:var(--text); }
.place-list { max-height: 50vh; overflow: auto; margin-top: 8px; }
.place-item { padding: 8px 10px; border-bottom: 1px dashed var(--border); cursor: pointer; }
.place-item:hover { background: rgba(127,127,127,0.10); }
.place-dlg .hint { font-size: 12px; color: var(--muted); margin: 8px 10px 12px; }
.place-list .nores { padding: 12px; color: var(--muted); }

.return-btn:hover { background: var(--button); transition: background .2s ease; }
.return-bar .icon-svg svg { width: 28px; height: 28px; display: block; }

/* 리턴 모달: 내용 폭에 딱 맞게 */
#solarDlg, #lunarDlg, #mercuryDlg, #venusDlg, #marsDlg, #jupiterDlg, #saturnDlg {
  width: fit-content;    /* 내용만큼만 */
  max-width: none;       /* 상위 고정폭 무력화 */
  padding: 0;
}

/* 리턴 모달을 내용 폭에 맞게 */
#solarDlg .place-box,
#lunarDlg .place-box,
#mercuryDlg .place-box,
#venusDlg .place-box,
#marsDlg .place-box,
#jupiterDlg .place-box,
#saturnDlg .place-box {
  display: inline-block;
  width: auto;
  max-width: none;
  padding: 8px 10px;
}

/* 루나 날짜 목록: 빈 리스트/마커 숨기기 */
#lunarDlg .date-list,
#mercuryDlg .date-list,
#venusDlg .date-list,
#marsDlg .date-list,
#jupiterDlg .date-list,
#saturnDlg .date-list {
  list-style: none;  /* 불릿 제거 */
  padding: 0;
  margin: 0;
}

/* 아무 날짜도 없으면 완전히 숨김 */
#lunarDlg .date-list:empty,
#mercuryDlg .date-list:empty,
#venusDlg .date-list:empty,
#marsDlg .date-list:empty,
#jupiterDlg .date-list:empty,
#saturnDlg .date-list:empty {
  display: none;
}

#placeClose, #solarClose, #lunarClose, #mercuryClose, #venusClose, #marsClose, #jupiterClose, #saturnClose, #settingsClose, #shareClose {
  border: none; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted);
}

/* [PATCH] 설정 모달 우상단 X 고정 */
.settings-dlg .place-head { position: relative; }
#settingsClose {
  position: absolute;
  top: 0px;
  right: 0px;
  line-height: 1;
}

/* Return 테이블 행성 아이콘 간격 */
.table-return .return-icons{
  display:flex;
  gap:12px;                /* ← 여기 숫자만 바꿔 간격 조절 */
  align-items:center;
  justify-content:center;
  flex-wrap:wrap;
}
@media (max-width: 420px){
  .table-return .return-icons{ gap:10px; } /* 모바일에서 더 타이트하게 */
}

/* (NEW) Fixed Stars, Lots 아이콘/글리프 스케일을 Dignities와 통일 */
.table-fstars .icon-svg{
  /* Dignities와 동일 변수 사용(기본 14px) */
  width:  var(--dig-size, 14px);
  height: var(--dig-size, 14px);
  transform:translateY(-1px);
}

.table-lots .icon-svg{
  /* Dignities와 동일 변수 사용(기본 14px) */
  width:  var(--dig-size, 14px);
  height: var(--dig-size, 14px);
  transform:translateY(-1px);
}

/* ---- 모바일 자동 다이어트 ---- */
@media (max-width: 720px){
  .tables-row .card{ max-width:100%; overflow-x:auto; }
  .table-dig.compact, .table-sect.compact{ font-size: 12px; }
  .table-fird.compact, .table-zr.compact, .table-speed.compact, .table-fs.compact, .table-lots.compact{ font-size: 11px; }
  .table-dig.compact caption, .table-sect.compact caption, .table-fird.compact caption, .table-zr.compact caption, .table-speed.compact caption, .table-fs.compact caption, .table-lots.compact caption{ font-size: 13px; }
  .table-dig.compact th, .table-dig.compact td,
  .table-sect.compact th, .table-sect.compact td,
  .table-fird.compact th, .table-fird.compact td,
  .table-zr.compact th, .table-zr.compact td,
  .table-speed.compact th, .table-speed.compact td,
  .table-fs.compact th, .table-fs.compact td,
  .table-lots.compact th, .table-lots.compact td,
  .table-return.compact th, .table-return.compact td{
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .table-fird.compact colgroup col,
  .table-zr.compact   colgroup col,
  .table-fird.compact, .table-zr.compact, .table-speed.compact, .table-fs.compact, .table-lots.compact, .table-return.compact{ min-width:0; }
}