html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Arial', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  -webkit-text-size-adjust: 100%;
}

.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.top-section {
  flex: 0.5;
  display: flex;
  overflow: hidden;
}

.zone-zhizhi {
  flex: 0.5;
  background-color: #f0f0f0;
  padding: 10px 16px 16px;
  box-sizing: border-box;
  overflow-y: auto;
}

.zone-shibie {
  flex: 0.5;
  background-color: #e0e0e0;
  padding: 10px 16px 16px;
  box-sizing: border-box;
  overflow-y: auto;
}

.bottom-section {
  flex: 0.5;
  background-color: #d0d0d0;
  padding: 10px 16px 16px;
  box-sizing: border-box;
  overflow-y: auto;
}

h2 {
  margin-top: 5px;
  margin-bottom: 8px;
  font-size: 16px;
}

h3 {
  margin: 6px 0 4px;
  font-size: 15px;
}

label {
  font-size: 14px;
}

input, button {
  margin: 3px 0;
}

input[type="date"], input[type="time"], input[type="text"], input[type="password"],
input[type="tel"], select {
  padding: 6px 8px;
  border: 1px solid #bbb;
  border-radius: 4px;
  font-size: 14px;
}

/* 出生信息四个输入框统一宽度与高度，上下对齐 */
#birthDate, #birthTime, #gender, #birthLocation {
  box-sizing: border-box;
  width: 100%;
  height: 36px;
  line-height: 1.3;
  margin: 3px 0;
  vertical-align: middle;
}

button {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  background-color: #4a90d9;
  color: white;
  font-size: 14px;
  cursor: pointer;
  margin-right: 5px;
}

button:hover {
  background-color: #357abd;
}

button:disabled {
  background-color: #999;
  cursor: not-allowed;
}

.time-hint {
  font-size: 13px;
  color: #666;
  margin: 5px 0;
}

.placeholder {
  color: #999;
  font-size: 14px;
  text-align: center;
  padding: 20px 0;
}

/* 设置面板 */
.settings-btn {
  cursor: pointer;
  font-size: 18px;
  float: right;
}

.settings-panel {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 12px;
  margin-top: 8px;
}

.settings-panel h3 {
  margin-top: 0;
}

.settings-panel input {
  width: calc(100% - 12px);
}

#apiStatus {
  margin-left: 5px;
  font-size: 13px;
  color: #666;
}

/* 结果卡片 */
.result-card {
  background: #fff;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 8px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.result-card p {
  margin: 5px 0;
  font-size: 14px;
  line-height: 1.6;
}

.result-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
  color: #333;
  border-bottom: 1px solid #eee;
  padding-bottom: 3px;
}

.error {
  color: #d32f2f;
  font-weight: bold;
}

/* 五行柱状图 */
.element-bars {
  background: #fff;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 8px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.element-bars p {
  margin: 4px 0;
  font-size: 14px;
}

.element-row {
  display: flex;
  align-items: center;
  margin: 4px 0;
}

.element-label {
  width: 44px;
  font-size: 14px;
}

.element-bar-bg {
  flex: 1;
  height: 16px;
  background: #e0e0e0;
  border-radius: 8px;
  margin: 0 8px;
  overflow: hidden;
}

.element-bar-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.3s;
}

.element-val {
  width: 34px;
  font-size: 13px;
  color: #555;
}

/* 行动分析网格 */
.action-grid {
  display: flex;
  gap: 10px;
  height: calc(100% - 30px);
}

.action-main, .action-timeline, .action-extra {
  flex: 1;
  background: #fff;
  border-radius: 6px;
  padding: 10px 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  overflow-y: auto;
}

.action-main p, .action-timeline p, .action-extra p {
  font-size: 14px;
  margin: 4px 0;
  line-height: 1.6;
}

.action-timeline ul {
  margin: 4px 0;
  padding-left: 20px;
}

.action-timeline li {
  font-size: 14px;
  margin: 2px 0;
}

/* 模型搜索 */
.settings-panel select {
  width: 100%;
  padding: 4px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
}

.settings-panel select option {
  padding: 3px 6px;
}

#modelSearch {
  padding: 6px 8px;
  border: 2px solid #4a90d9;
  border-radius: 4px;
  font-size: 14px;
  width: calc(100% - 16px);
}

#modelSearch:focus {
  border-color: #07c160;
  outline: none;
}

#modelStatus {
  display: block;
  margin: 2px 0;
  color: #666;
  font-size: 13px;
}

/* ========== 移动端响应式适配 ========== */

/* 平板 */
@media (max-width: 900px) {
  .zone-zhizhi, .zone-shibie, .bottom-section {
    padding: 8px 12px 12px;
  }
}

/* 手机（竖屏） */
@media (max-width: 600px) {
  /* 三区改为竖排堆叠，整体可滚动 */
  .container {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }

  .top-section {
    flex-direction: column;
    flex: none;
    overflow: visible;
  }

  .zone-zhizhi, .zone-shibie, .bottom-section {
    flex: none;
    width: 100%;
    padding: 10px 12px;
    overflow: visible;
  }

  /* 行动分析网格改为竖排 */
  .action-grid {
    flex-direction: column;
    height: auto;
  }

  .action-main, .action-timeline, .action-extra {
    flex: none;
    width: 100%;
  }

  /* 字号放大，提升移动端可读性 */
  h2 { font-size: 18px; }
  h3 { font-size: 16px; }
  label { font-size: 15px; }

  .result-card p,
  .element-bars p,
  .action-main p, .action-timeline p, .action-extra p,
  .action-timeline li {
    font-size: 15px;
    line-height: 1.7;
  }

  /* 输入控件加大触控区域 */
  input[type="date"], input[type="time"], input[type="text"],
  input[type="password"], input[type="tel"], select {
    font-size: 16px; /* 16px 防止 iOS 自动缩放 */
    padding: 10px 8px;
  }

  /* 移动端出生信息控件加高触控区域 */
  #birthDate, #birthTime, #gender, #birthLocation {
    height: 44px;
  }

  button {
    font-size: 16px;
    padding: 12px 16px;
  }

  /* 大运网格改为2列，卡片更紧凑 */
  .dayun-table {
    font-size: 13px;
  }

  /* 识彼区域天时+起卦同排改为竖排 */
  #shibie-result, #qigua-result {
    min-width: 100% !important;
  }

  /* 地利人和2列改为单列 */
  .result-card > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}
