* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: #f5f2eb;
  color: #1c1917;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

#app {
  max-width: 560px;
  margin: 0 auto;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
}

.container {
  padding: 16px 14px 40px;
}

.hero {
  padding: 8px 4px 16px;
}

.hero-title {
  font-size: 24px;
  font-weight: 700;
  color: #1c1917;
  letter-spacing: 1px;
}

.hero-sub {
  margin-top: 4px;
  font-size: 12px;
  color: #78716c;
}

.card {
  background: #ffffff;
  border-radius: 12px;
  padding: 12px 16px 20px;
  border: 1px solid #e7e2d8;
  box-shadow: 0 3px 12px rgba(28, 25, 23, 0.04);
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid #f1ede4;
}

.label {
  font-size: 14px;
  color: #44403c;
  font-weight: 500;
  flex-shrink: 0;
  margin-right: 10px;
}

.input {
  flex: 1;
  text-align: right;
  font-size: 14px;
  color: #1c1917;
  border: none;
  outline: none;
  background: transparent;
}

.picker-input, .picker-select {
  font-size: 14px;
  color: #a63a2b;
  font-weight: 500;
  border: 1px solid #e7e2d8;
  background: #fbf8f1;
  border-radius: 6px;
  padding: 5px 8px;
  outline: none;
}

.chk {
  width: 18px;
  height: 18px;
  accent-color: #a63a2b;
}

.seg-group {
  display: flex;
  background: #f5f2eb;
  border-radius: 7px;
  padding: 2px;
}

.seg-btn {
  padding: 5px 11px;
  font-size: 12px;
  color: #57534e;
  border-radius: 5px;
}

.seg-btn.active {
  background: #1c1917;
  color: #ffffff;
  font-weight: 500;
}

.solar-preview {
  margin-top: 10px;
  padding: 9px 11px;
  background: #fbf8f1;
  border-left: 3px solid #b45309;
  border-radius: 5px;
  font-size: 12px;
  color: #78350f;
}

.submit-btn {
  width: 100%;
  margin-top: 18px;
  background: #a63a2b;
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  height: 44px;
  letter-spacing: 2px;
}

.submit-btn:active {
  opacity: 0.9;
}

.history-section {
  margin-top: 20px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px 8px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
}

.section-count {
  font-size: 12px;
  color: #78716c;
}

.record-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.record-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid #e7e2d8;
  border-radius: 9px;
  padding: 11px 12px;
  cursor: pointer;
}

.record-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.record-name {
  font-size: 15px;
  font-weight: 600;
}

.record-tag {
  font-size: 11px;
  color: #a63a2b;
  background: #fdf2f0;
  padding: 1px 6px;
  border-radius: 4px;
}

.record-sub {
  margin-top: 3px;
  font-size: 12px;
  color: #78716c;
}

.record-del {
  font-size: 12px;
  color: #a8a29e;
  padding: 6px 8px;
}

/* 命盘页 */
.page {
  padding: 10px 8px 36px;
}

.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.back-btn {
  font-size: 13px;
  color: #44403c;
  font-weight: 500;
  padding: 5px 8px;
  background: #ffffff;
  border: 1px solid #e7e2d8;
  border-radius: 6px;
}

.share-btn {
  font-size: 12px;
  color: #a63a2b;
  font-weight: 500;
  padding: 5px 10px;
  background: #fdf2f0;
  border: 1px solid #f3d2cc;
  border-radius: 6px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.year-ctrl {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #e7e2d8;
  border-radius: 7px;
  padding: 2px 6px;
  gap: 6px;
}

.year-btn {
  width: 24px;
  height: 24px;
  font-size: 17px;
  color: #a63a2b;
  font-weight: 600;
}

.year-text {
  font-size: 12px;
  font-weight: 500;
}

.mode-toggle {
  display: flex;
  background: #e7e2d8;
  border-radius: 6px;
  padding: 2px;
}

.mode-btn {
  padding: 4px 10px;
  font-size: 11px;
  color: #57534e;
  border-radius: 5px;
}

.mode-btn.active {
  background: #1c1917;
  color: #ffffff;
  font-weight: 500;
}

.board {
  background: #ffffff;
  border: 1.5px solid #44403c;
  border-radius: 5px;
  overflow: hidden;
}

.board-row {
  display: flex;
  width: 100%;
}

.board-mid {
  display: flex;
  width: 100%;
  border-top: 1px solid #d6d0c4;
  border-bottom: 1px solid #d6d0c4;
}

.mid-side {
  width: 25%;
  display: flex;
  flex-direction: column;
}

.board-row .cell {
  width: 25%;
  border-right: 1px solid #d6d0c4;
}

.board-row .cell:last-child {
  border-right: none;
}

.mid-side .cell {
  width: 100%;
  border-bottom: 1px solid #d6d0c4;
}

.mid-side .cell:last-child {
  border-bottom: none;
}

.cell {
  min-height: 98px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #ffffff;
  cursor: pointer;
}

.cell.is-sanfang {
  background: #fdf8ef;
}

.cell.is-selected {
  background: #fef2ee;
  box-shadow: inset 0 0 0 2px #a63a2b;
}

.cell-stars {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.major-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
}

.star-major {
  font-size: 11.5px;
  font-weight: 700;
  color: #a63a2b;
  line-height: 1.2;
}

.star-bright {
  font-size: 9.5px;
  color: #78716c;
}

.mutagen-tag {
  font-size: 9.5px;
  padding: 0 3px;
  border-radius: 3px;
  color: #ffffff;
  font-weight: 600;
  line-height: 1.3;
}

.m-lu { background: #15803d; }
.m-quan { background: #b91c1c; }
.m-ke { background: #1d4ed8; }
.m-ji { background: #581c87; }

.minor-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 3px;
  margin-top: 1px;
}

.star-minor {
  font-size: 9.5px;
  color: #2563eb;
  line-height: 1.2;
}

.star-minor.is-tough {
  color: #6b7280;
}

.cell-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: 3px;
}

.cell-footer-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
}

.palace-name {
  font-size: 10.5px;
  font-weight: 600;
}

.palace-name.is-ming {
  color: #ffffff;
  background: #a63a2b;
  padding: 0 3px;
  border-radius: 3px;
}

.body-badge {
  font-size: 9px;
  color: #b45309;
  border: 1px solid #b45309;
  padding: 0 2px;
  border-radius: 3px;
  line-height: 1.1;
}

.decadal-range {
  font-size: 9px;
  color: #78716c;
}

.stem-branch {
  font-size: 9.5px;
  color: #57534e;
  font-weight: 500;
}

.horo-strip {
  margin-top: 2px;
  padding-top: 2px;
  border-top: 1px dashed #e7e2d8;
  display: flex;
  justify-content: space-between;
  font-size: 9px;
}

.horo-dec { color: #b45309; }
.horo-yr { color: #1d4ed8; }

.center-box {
  width: 50%;
  border-left: 1px solid #d6d0c4;
  border-right: 1px solid #d6d0c4;
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #fbf8f1;
}

.center-title-row {
  border-bottom: 1px solid #e7e2d8;
  padding-bottom: 4px;
}

.center-name {
  font-size: 13.5px;
  font-weight: 700;
}

.center-class {
  font-size: 11px;
  color: #a63a2b;
  font-weight: 600;
}

.center-lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 5px 0;
}

.center-line {
  font-size: 10.5px;
  color: #44403c;
  line-height: 1.35;
}

.center-horo {
  color: #92400e;
}

.center-tip {
  font-size: 10px;
  color: #a8a29e;
  text-align: center;
}

/* 详批卡片 */
.detail-card {
  margin-top: 10px;
  background: #ffffff;
  border: 1px solid #e7e2d8;
  border-radius: 10px;
  padding: 13px;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1ede4;
}

.detail-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-title {
  font-size: 16px;
  font-weight: 700;
}

.detail-badge {
  font-size: 10.5px;
  color: #b45309;
  background: #fef3c7;
  padding: 1px 5px;
  border-radius: 4px;
}

.detail-badge-sub, .detail-shen {
  font-size: 11px;
  color: #78716c;
}

.role-desc {
  margin-top: 8px;
  font-size: 13px;
  color: #57534e;
}

.sanfang-box {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}

.sanfang-item {
  flex: 1;
  background: #fbf8f1;
  border: 1px solid #ece6d9;
  border-radius: 6px;
  padding: 6px;
  display: flex;
  flex-direction: column;
}

.sf-label {
  font-size: 10.5px;
  color: #78716c;
}

.sf-stars {
  font-size: 11.5px;
  font-weight: 600;
  margin-top: 2px;
}

.empty-note {
  margin-top: 8px;
  padding: 8px 9px;
  background: #fef9c3;
  border-radius: 6px;
  font-size: 12.5px;
  color: #713f12;
}

.star-block {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid #f1ede4;
}

.star-block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sb-name {
  font-size: 14.5px;
  font-weight: 700;
  color: #a63a2b;
}

.sb-nature {
  font-size: 11.5px;
  color: #b45309;
}

.sb-summary {
  margin-top: 4px;
  font-size: 13px;
  color: #292524;
  line-height: 1.55;
}

.sb-mutagen {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 6px;
  background: #f9fafb;
  padding: 6px 8px;
  border-radius: 5px;
}

.sb-mutagen-text {
  font-size: 12px;
  color: #374151;
  flex: 1;
}

.sb-traits {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sb-trait {
  font-size: 12px;
  color: #57534e;
}

.hints-box {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #f1ede4;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hint-line {
  font-size: 12px;
  color: #44403c;
}

.horo-detail {
  margin-top: 8px;
  padding: 7px 9px;
  background: #f5f2eb;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hd-line {
  font-size: 11.5px;
  color: #57534e;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: rgba(28, 25, 23, 0.9);
  color: #ffffff;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 999;
}

.toast.show {
  opacity: 1;
}
