.number-energy-head {
  min-height: 142px;
  padding: 25px 18px 22px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #fff;
  background: linear-gradient(145deg, var(--red2), var(--red));
}

.number-energy-head .back {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  margin-left: -8px;
  border: 0;
  background: transparent;
  color: inherit;
}

.number-energy-head svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.number-energy-head small { color: #efcdd0; font-size: 8px; letter-spacing: .18em; }
.number-energy-head h2 { margin: 5px 0 4px; font: 600 24px var(--serif); }
.number-energy-head p { margin: 0; color: #efcdd0; font-size: 10px; }
.number-energy-head.result-mode { min-height: 128px; }

.number-energy-body,
.number-energy-result-body { padding: 18px; }

.number-energy-types {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.number-energy-types button {
  min-width: 0;
  min-height: 124px;
  padding: 12px 7px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--ivory);
  color: var(--ink);
  text-align: center;
  transition: border-color .16s, background .16s, transform .16s;
}

.number-energy-types button:active { transform: translateY(1px); }
.number-energy-types button.active { border-color: var(--red); background: #fff7f3; box-shadow: 0 8px 22px rgba(117, 47, 34, .1); }
.number-energy-types span { width: 45px; height: 45px; margin: 0 auto 10px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; color: var(--red); font: 600 12px var(--serif); }
.number-energy-types b,
.number-energy-types small { display: block; }
.number-energy-types b { font: 600 14px var(--serif); }
.number-energy-types small { margin-top: 4px; color: var(--muted); font-size: 8px; line-height: 1.45; }

.number-energy-form {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--ivory);
  box-shadow: var(--shadow);
}

.number-energy-gender { margin: 0 0 17px; padding: 0; border: 0; }
.number-energy-gender legend { margin-bottom: 8px; font-size: 12px; font-weight: 600; }
.number-energy-gender .segment span {
  height: 45px;
  margin: 0;
  display: grid;
  place-items: center;
  border-radius: 0;
  background: var(--paper);
  font-size: 11px;
  font-weight: 400;
  line-height: 1;
  text-align: center;
}
.number-energy-gender .segment label:last-child span { border-radius: 0; }
.number-energy-gender-hint { margin: 7px 0 0; color: var(--red); font-size: 9px; line-height: 1.55; }
.number-energy-gender.gender-invalid .segment span { border-color: var(--red); box-shadow: 0 0 0 1px rgba(163,7,18,.13); }
.number-energy-gender.gender-invalid .number-energy-gender-hint { font-weight: 700; }

.number-energy-form label > span { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 600; }
.number-energy-form .number-energy-gender .segment label > span { height: 45px; margin: 0; display: grid; place-items: center; font-size: 11px; font-weight: 400; line-height: 1; text-align: center; }
.number-energy-form input[name="energyValue"] { width: 100%; height: 51px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; outline: none; background: var(--paper); color: var(--ink); font-size: 16px; letter-spacing: .05em; }
.number-energy-form input[name="energyValue"]:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(163, 7, 18, .08); }
.number-energy-form input[aria-invalid="true"] { border-color: #b4232e; }
.number-energy-hint { margin: 8px 0 0; color: var(--muted); font-size: 9px; }
.number-energy-error { min-height: 18px; margin: 4px 0 8px; color: #b4232e; font-size: 10px; }

.number-energy-chart {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(150deg, #fffdf7, #ede1cf);
}

.number-energy-chart header { padding: 16px 17px 13px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.number-energy-chart header span { color: var(--red); font-size: 9px; }
.number-energy-chart header b { font: 600 16px var(--serif); }
.number-energy-nodes { padding: 24px 16px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.number-energy-node { width: 43px; height: 43px; display: grid; place-items: center; border: 1px solid rgba(139, 96, 48, .3); border-radius: 50%; background: rgba(255, 253, 247, .86); color: #6f4b21; font: 600 18px var(--serif); box-shadow: 0 5px 12px rgba(75, 48, 25, .08); }
.number-energy-node[data-digit="1"], .number-energy-node[data-digit="2"] { color: #1855bd; }
.number-energy-node[data-digit="3"], .number-energy-node[data-digit="8"], .number-energy-node[data-digit="9"] { color: #b07b05; }
.number-energy-node[data-digit="4"], .number-energy-node[data-digit="5"] { color: #187746; }
.number-energy-node[data-digit="6"], .number-energy-node[data-digit="7"] { color: #d44f5d; }

.number-energy-pairs { padding: 15px 16px 18px; border-top: 1px solid var(--line); background: rgba(255,255,255,.38); }
.number-energy-pairs h3 { margin: 0 0 11px; font: 600 14px var(--serif); }
.number-energy-pairs > div { display: flex; flex-wrap: wrap; gap: 7px; }
.number-energy-pairs span { min-width: 42px; padding: 6px 9px; border: 1px solid rgba(118, 82, 47, .18); border-radius: 999px; background: rgba(255,253,247,.78); text-align: center; font: 600 11px var(--serif); }

.number-energy-summary { margin-top: 14px; display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--ivory); }
.number-energy-summary div { padding: 13px 6px; text-align: center; border-right: 1px solid var(--line); }
.number-energy-summary div:last-child { border-right: 0; }
.number-energy-summary small,
.number-energy-summary b { display: block; }
.number-energy-summary small { color: var(--muted); font-size: 8px; }
.number-energy-summary b { margin-top: 4px; font: 600 13px var(--serif); }
.number-energy-note { margin: 14px 0 0; padding: 13px 15px; border-radius: 14px; background: rgba(231,216,190,.52); color: var(--muted); font-size: 10px; line-height: 1.8; text-align: center; }

@media (max-width: 360px) {
  .number-energy-types { gap: 6px; }
  .number-energy-types button { min-height: 116px; padding-inline: 4px; }
  .number-energy-types span { width: 40px; height: 40px; }
  .number-energy-node { width: 39px; height: 39px; }
}

@media (prefers-reduced-motion: reduce) {
  .number-energy-types button { transition: none; }
}

/* 首页三列工具入口：八字、数字能量、头像 */
.tool-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.tool-grid .tool-card {
  height: 92px;
  padding: 6px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.tool-grid .tool-card::after { display: none; }
.tool-grid .tool-card:nth-child(1) {
  border-color: rgba(111, 55, 47, .28);
  background: linear-gradient(145deg, #a86155, #8f4b43);
  color: #fff8ef;
}
.tool-grid .tool-card:nth-child(1) small { color: rgba(255, 244, 231, .82); }
.tool-grid .tool-card:nth-child(2) {
  border-color: rgba(151, 115, 52, .3);
  background: linear-gradient(145deg, #f1e3bd, #dcc28a);
  color: #5d431f;
}
.tool-grid .tool-card:nth-child(2) small { color: #79623e; }

.tool-grid .symbol {
  width: 3em;
  height: 38px;
  margin: 0 auto 4px;
  font-size: 15.6px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-weight: 700;
  letter-spacing: .02em;
  text-shadow: none !important;
}

.tool-grid .tool-card b {
  width: 100%;
  font-size: 11.2px;
  line-height: 1.28;
  text-align: center;
}

.tool-grid .tool-card small {
  width: 100%;
  font-size: 8px;
  line-height: 1.3;
  margin-top: 3px;
  text-align: center;
}

.avatar-tool { text-align: center; }
.tool-grid .avatar-tool {
  border-color: rgba(33, 118, 163, .3);
  background: linear-gradient(145deg, #e3f3f7, #bedee8);
  color: #174f69;
}
.tool-grid .avatar-tool small { color: #46748a; }
.tool-grid .avatar-symbol {
  color: #2176a3;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* goldsand 主题在本文件之后加载，这里明确覆盖三张入口卡片与文字图标 */
html.ui-theme-goldsand .tool-grid .tool-card:nth-child(1) {
  border-color: rgba(111, 55, 47, .28) !important;
  background: linear-gradient(145deg, #a86155, #8f4b43) !important;
  color: #fff8ef !important;
}
html.ui-theme-goldsand .tool-grid .tool-card:nth-child(2) {
  border-color: rgba(151, 115, 52, .3) !important;
  background: linear-gradient(145deg, #f1e3bd, #dcc28a) !important;
  color: #5d431f !important;
}
html.ui-theme-goldsand .tool-grid .avatar-tool {
  border-color: rgba(33, 118, 163, .3) !important;
  background: linear-gradient(145deg, #e3f3f7, #bedee8) !important;
  color: #174f69 !important;
}
html.ui-theme-goldsand .tool-grid .symbol,
html.ui-theme-goldsand .tool-grid .tool-card.primary .symbol {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif !important;
  font-weight: 700 !important;
  text-shadow: none !important;
}
html.ui-theme-goldsand .tool-grid .tool-card:nth-child(1) .symbol { color: #fff7e8 !important; }
html.ui-theme-goldsand .tool-grid .tool-card:nth-child(2) .symbol { color: #684717 !important; }
html.ui-theme-goldsand .tool-grid .avatar-tool .symbol { color: #176b92 !important; }
.tool-avatar {
  width: 38px;
  height: 38px;
  margin: 0 auto 6px;
  display: block;
  overflow: hidden;
  border: 2px solid rgba(163, 7, 18, .2);
  border-radius: 50%;
  background: #fff;
}

.tool-avatar img {
  width: 116%;
  height: 116%;
  object-fit: cover;
  transform: translate(-7%, -7%);
}

@media (max-width: 360px) {
  .tool-grid { gap: 6px; }
  .tool-grid .tool-card { height: 90px; padding: 5px; }
  .tool-grid .symbol { width: 39px; height: 35px; font-size: 14px; }
  .tool-grid .tool-card b { font-size: 9.2px; line-height: 1.3; }
  .tool-grid .tool-card small { font-size: 6.8px; line-height: 1.25; }
  .tool-avatar { width: 36px; height: 36px; }
}

.avatar-reading-head { background: linear-gradient(145deg, #7d2135, #b94b60); }
.avatar-reading-body { padding: 18px; }
.avatar-reading-form { padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--ivory); box-shadow: var(--shadow); }
.avatar-upload-box { display: block; cursor: pointer; }
.avatar-upload-box input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.avatar-preview { width: 154px; height: 154px; margin: 3px auto 15px; display: grid; place-items: center; align-content: center; gap: 8px; overflow: hidden; border: 1px dashed rgba(163,7,18,.42); border-radius: 18px; background: linear-gradient(145deg,#fffaf2,#eadac4); color: var(--red); }
.avatar-preview b { font: 300 36px/1 var(--sans); }
.avatar-preview small { font-size: 10px; }
.avatar-preview img { width: 100%; height: 100%; grid-area: 1 / 1; object-fit: cover; }
.avatar-preview img + small { grid-area: 1 / 1; align-self: end; width: 100%; padding: 8px 4px 12px; background: linear-gradient(transparent,rgba(0,0,0,.62)); color: #fff; text-align: center; }
.avatar-reading-form > p { margin: 0 0 16px; color: var(--muted); font-size: 9px; line-height: 1.75; text-align: center; }
.avatar-reading-form .red-btn:disabled { cursor: not-allowed; opacity: .42; }

/* 四个数字能量入口：与首页工具卡片一致的扁矩形，无圆形文字框。 */
.number-energy-types { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.number-energy-types button { min-height:96px; padding:18px 10px; border-radius:14px; box-shadow:0 8px 0 rgba(201,151,62,.10); }
.number-energy-types button:nth-child(1) { background:linear-gradient(145deg,#a86155,#8f4b43); border-color:#97594d; color:#fff8ef; }
.number-energy-types button:nth-child(2) { background:linear-gradient(145deg,#f1e3bd,#dcc28a); border-color:#ceb478; color:#684717; }
.number-energy-types button:nth-child(3) { background:linear-gradient(145deg,#e3f3f7,#bedee8); border-color:#a2cbdc; color:#176b92; }
.number-energy-types button:nth-child(4) { background:linear-gradient(145deg,#e9efde,#ccd8b8); border-color:#b9c69f; color:#50643d; }
.number-energy-types button.active { outline:2px solid currentColor; outline-offset:2px; }
.number-energy-types button span { display:block; width:auto; height:auto; margin:0 0 8px; border:0; border-radius:0; background:none; color:inherit; font:700 19px/1.4 var(--sans); }
.number-energy-types button small { margin:0; color:inherit; opacity:.85; font-size:12px; line-height:1.5; }
.number-energy-types button:focus-visible { outline:3px solid currentColor; outline-offset:3px; }
