/* ============ 经典原版 UI 风格（浅灰窗口 + 白色面板） ============ */
:root {
  --window-bg: #ece9d8;
  --panel-bg: #ffffff;
  --title-bg: #f1f1f0;
  --menu-bg: #d4d0c8;
  --bar-line: #a0a0a0;
  --ink: #1a1a1a;
  --accent: #000080;
  --line: #c8c4bc;
  --table-head: #d4d0c8;
}

/* 桌面端 StarFont 字形（星座/星体符号与原程序一致） */
@font-face {
  font-family: 'StarFont';
  src: url('fonts/StarFont.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  background: var(--window-bg);
  color: var(--ink);
  font-size: 14px;
}

/* ---------- 顶部：标题栏 + 菜单栏 ---------- */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.titlebar {
  display: flex;
  align-items: baseline;
  gap: 12px;
  background: var(--title-bg);
  border-bottom: 1px solid var(--bar-line);
  padding: 6px 12px;
}
.app-title {
  font-size: 16px;
  font-weight: bold;
  color: var(--accent);
}
.titlebar .subtitle { font-size: 12px; color: #666; }

.menubar {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--menu-bg);
  border-bottom: 1px solid var(--bar-line);
  padding: 2px 6px;
}
.menu-item {
  padding: 3px 12px;
  font-size: 13px;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
}
.menu-item:hover { background: #e8e4dc; border-color: var(--bar-line); }
.menu-item.active { background: #ffffff; border-color: var(--bar-line); font-weight: bold; }
.menu-item[title]:not(.active) { cursor: not-allowed; opacity: 0.75; }
.menu-spacer { flex: 1; }

/* 設定下拉面板 */
.menu-drop { position: relative; }
.settings-panel {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--bar-line);
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.3);
  padding: 8px;
}
.settings-title {
  font-size: 12px;
  font-weight: bold;
  color: var(--accent);
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
  margin-bottom: 6px;
}
.settings-bodies {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 10px;
  max-height: 320px;
  overflow-y: auto;
}
.settings-bodies label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}

/* ---------- 主区域布局：左输入面板 + 右星盘 ---------- */
main {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 10px;
  padding: 10px;
  align-items: start;
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--bar-line);
  border-radius: 4px;
  box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(0, 0, 0, 0.15);
  padding: 10px;
}

.panel-title {
  font-size: 13px;
  font-weight: bold;
  color: var(--accent);
  border-bottom: 1px solid var(--line);
  padding: 2px 2px 6px;
  margin-bottom: 10px;
}

/* ---------- 出生资料表单（紧凑行式，接近原版） ---------- */
.form-panel form {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.form-panel form > label {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.form-panel input,
.form-panel select {
  width: 100%;
  padding: 3px 6px;
  border: 1px solid #7f9db9;
  border-radius: 2px;
  background: #fff;
  font-size: 13px;
}

.geo-fieldset {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 6px 8px;
  margin: 0;
}
.geo-fieldset legend {
  font-size: 12px;
  color: var(--accent);
  padding: 0 4px;
}
.geo-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.geo-row input { width: 72px; }
.geo-row select { width: 60px; }

.form-panel button {
  margin-top: 4px;
  padding: 6px 0;
  border: 1px solid #8a8578;
  border-radius: 3px;
  background: linear-gradient(#fdfdfd, #e8e4dc);
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}
.form-panel button:hover { background: linear-gradient(#ffffff, #efebe3); }

/* ---------- 星盘区域 ---------- */
.result-panel { min-width: 0; }
.chart {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 480px;
}
.chart svg {
  width: 100%;
  height: auto;
  max-width: 1000px;
  display: block;
}
.chart .glyph { font-family: 'StarFont'; }
.hint { color: #999; }

/* ---------- 下方表格 ---------- */
.tables {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.table-block { min-width: 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
th {
  background: var(--table-head);
  border: 1px solid var(--bar-line);
  padding: 4px 6px;
  text-align: left;
  font-weight: bold;
}
td {
  border: 1px solid var(--line);
  padding: 3px 6px;
}
tbody tr:nth-child(even) { background: #faf9f6; }
.retro { color: #c0392b; font-weight: bold; }
.deg { color: #666; font-size: 12px; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  main { grid-template-columns: 1fr; }
  .tables { grid-template-columns: 1fr; }
}
