* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: #f8f9fa;
  color: #333;
  line-height: 1.6;
  padding: 20px;
  max-width: 1000px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.container {
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.08);
  padding: 30px;
  width: 100%;
  max-width: 700px;
}

header {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eaeaea;
}

h1 {
  color: #2c3e50;
  font-size: 28px;
  margin-bottom: 8px;
  font-weight: 600;
}

.subtitle {
  color: #7f8c8d;
  font-size: 16px;
  font-weight: normal;
}

.section-title {
  font-size: 18px;
  color: #2c3e50;
  margin-bottom: 15px;
  font-weight: 600;
  text-align: center;
}

/* 选项卡样式 */
.tab-header {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 20px;

  padding-bottom: 10px;
}

.tab-item {
  font-size: 16px;
  color: #64748b;
  cursor: pointer;
  padding: 8px 4px;
  position: relative;
  transition: color 0.2s ease;
  user-select: none;
}

.tab-item:hover {
  color: #334155;
}

.tab-item.active {
  color: #2c3e50;
  font-weight: 600;
}

.tab-item.active::after {
  content: "";
  position: absolute;
  bottom: -11px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: #2c3e50;
}

/* 指定起卦数字格子 */
.number-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 300px;
  margin: 0 auto;
}

.number-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f1f5f9;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 20px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
}

.number-cell:hover {
  background-color: #e2e8f0;
  border-color: #cbd5e1;
  transform: translateY(-2px);
}

.number-cell:active {
  transform: translateY(0);
}

.number-cell.selected {
  background-color: #3b82f6;
  border-color: #2563eb;
  color: white;
}

/* 已选宫位显示区域 */
.selected-positions {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 16px;
  padding: 16px 20px;
  background-color: #f8f9fa;
  border-radius: 8px;
}

.position-slot {
  font-size: 20px;
  font-weight: 600;
  color: #94a3b8;
  min-width: 60px;
  text-align: center;
}

.position-slot.filled {
  color: #2c3e50;
}

/* 清除按钮 */
.clear-btn {
  display: block;
  margin: 0 auto 20px;
  padding: 12px 32px;
  font-size: 16px;
  color: #64748b;
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.clear-btn:hover {
  background-color: #e2e8f0;
  color: #475569;
}

/* 开始排盘按钮 */
.start-btn {
  display: block;
  width: 100%;
  max-width: 300px;
  margin: 20px auto 0;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  background-color: #2c3e50;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.start-btn:hover {
  background-color: #34495e;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(44, 62, 80, 0.2);
}

.start-btn:active {
  transform: translateY(0);
}

/* 随机数起卦输入框样式 */
.random-input-wrapper {
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  padding: 0 0 1px;
}

.random-input-hint {
  margin: 0 0 8px 0;
  padding: 0;
  font-size: 18px;
  color: #64748b;
  text-align: center;
  word-wrap: break-word;
}

.random-input-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.random-input-field {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 8px;
  background-color: #f1f5f9;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  color: #475569;
  outline: none;
  transition: all 0.2s ease;
}

.random-input-field::placeholder {
  font-size: 14px;
  font-weight: 400;
  color: #94a3b8;
  letter-spacing: 1px;
}

.random-input-field:focus {
  background-color: #e2e8f0;
  border-color: #cbd5e1;
  transform: translateY(-2px);
}

/* 生成随机数按钮 */
.random-generate-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

.random-generate-btn:hover {
  background: linear-gradient(135deg, #cbd5e1 0%, #b8c5d6 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.15);
}

.random-generate-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px -1px rgba(59, 130, 246, 0.3);
}

/* 日期起卦简约容器 */
.date-simple-box {
  max-width: 300px;
  margin: 0 auto;
  padding: 24px 20px;
  text-align: center;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.date-simple-text {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 12px;
}

.date-preview {
  font-size: 20px;
  font-weight: 600;
  color: #334155;
  padding: 12px 24px;
  background-color: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  display: inline-block;
}

/* 卦象表格容器 - 蓝白简约风格 */
.gua-container {
  border: 1px solid #e0e6ed;
  border-radius: 8px;
  margin: 25px 0;
  overflow: hidden;
  background-color: #fff;
}

/* 卦象内容表格 */
.gua-table {
  width: 100%;
  border-collapse: collapse;
}

.gua-table tr {
  border-bottom: 1px solid #e0e6ed;
}

.gua-table tr:last-child {
  border-bottom: none;
}

.gua-table td {
  padding: 18px 10px;
  text-align: center;
  font-size: 18px;
  font-weight: 500;
  color: #2c3e50;
  border-right: 1px solid #e0e6ed;
}

.gua-table td:last-child {
  border-right: none;
}

/* 第一行特殊样式（天地人行） */
.tiandiren-row td {
  font-size: 26px;
  font-weight: 600;
  color: #2c3e50;
  background-color: #eef2f7;
}

/* 第二行特殊样式（六宫行） */
.liugong-row td {
  font-size: 20px;
  font-weight: 600;
  color: #2c3e50;
  background-color: #f5f8fc;
}

/* 第三行特殊样式（地支行） */
.branch-row td {
  font-size: 22px;
  font-weight: 600;
  color: #2c3e50;
  background-color: #fafbfc;
}

/* 旺衰行特殊样式 */
.state-row td {
  color: #2c3e50;
  /* font-weight: 600; */
}

/* 六亲行特殊样式 */
.meaning-row td {
  color: #2c3e50;
}

/* 十二长生行特殊样式 */
.diwang-row td {
  color: #2c3e50;
  font-weight: 500;
}

/* 六神行特殊样式 */
.liushen-row td {
  color: #2c3e50;
}

/* 日期选择部分样式 */
.date-section {
  margin-bottom: 30px;
  padding: 20px;
  background-color: #f8f9fa;
  border-radius: 10px;
  border: 1px solid #eaeaea;
}

.date-selectors {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.selector-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
}

.selector-group label {
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
  text-align: center;
}

.date-select {
  padding: 10px 12px;
  font-size: 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  background-color: white;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

.date-select:hover {
  border-color: #cbd5e1;
  background-color: #f8fafc;
  transform: translateY(-1px);
}

.date-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 五行颜色样式 */
.color-jin,
.color-jin td {
  color: #d4af37 !important;
}

.color-mu,
.color-mu td {
  color: #228b22 !important;
}

.color-shui,
.color-shui td {
  color: #1e90ff !important;
}

.color-huo,
.color-huo td {
  color: #dc143c !important;
}

.color-tu,
.color-tu td {
  color: #8b4513 !important;
}

/* 解读部分 */
.explanation {
  background-color: #f9f9f9;
  padding: 20px;
  border-radius: 8px;
  margin-top: 30px;
  border-left: 4px solid #95a5a6;
}

.explanation h3 {
  color: #2c3e50;
  margin-bottom: 12px;
  font-size: 18px;
}

.explanation p {
  margin-bottom: 10px;
  color: #555;
}

footer {
  text-align: center;
  margin-top: 30px;
  color: #7f8c8d;
  font-size: 14px;
  padding-top: 20px;
  border-top: 1px solid #eaeaea;
  width: 100%;
}

@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .container {
    padding: 20px;
  }

  .gua-table td {
    padding: 14px 8px;
    font-size: 16px;
  }

  .branch-row td {
    font-size: 20px;
  }
}

@media (max-width: 768px) {
  .date-selectors {
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }

  .selector-group {
    width: 100%;
    max-width: 300px;
  }
}

@media (max-width: 480px) {
  .gua-table td {
    padding: 12px 5px;
    font-size: 15px;
  }

  .branch-row td {
    font-size: 18px;
  }

  .date-section {
    padding: 15px;
  }

  .selector-group {
    max-width: 250px;
  }

  .date-select {
    font-size: 14px;
    padding: 8px 10px;
  }
}

/* 象意弹出框样式 */
.meaning-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.popup-content {
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 600px;
  overflow: hidden;
}

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #eaeaea;
  background-color: #f8f9fa;
}

.popup-header h3 {
  margin: 0;
  color: #2c3e50;
  font-size: 20px;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  font-size: 28px;
  color: #7f8c8d;
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background-color: #eaeaea;
  color: #2c3e50;
}

.popup-body {
  padding: 24px;
  font-size: 16px;
  line-height: 1.8;
  color: #34495e;
}
