.bg-wrap { width: min(1040px, calc(100% - 32px)); }

.bg-hero { margin: 18px 0 14px; padding: 8px 4px 0; }
.bg-hero h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.12; }

.bg-ref { margin-top: 16px; }

.bg-section-head { margin: 4px 0 10px; }
.bg-section-head h2 {
  margin: 0 0 4px;
  font-family: "ZCOOL KuaiLe", "PingFang SC", sans-serif;
  font-size: 1.3rem;
}
.bg-section-head p { margin: 0; color: var(--bark); font-size: 0.86rem; line-height: 1.65; }

.bg-front-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
}
.bg-front-picker span { color: var(--bark); font-size: 0.78rem; }
.bg-front-picker button {
  min-height: 32px;
  padding: 4px 10px;
  border: 1.5px solid var(--gold);
  border-radius: 999px;
  background: #fffdf8;
  color: var(--ink);
  font-size: 0.76rem;
}
.bg-front-picker button.on { background: var(--moss); color: #f7eed4; }
.bg-front-picker button:hover:not(.on) { background: #fff1cc; filter: none; }

.bg-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.bg-card {
  position: relative;
  height: 196px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  perspective: 900px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.bg-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.38s ease;
}
.bg-card.flipped .bg-inner { transform: rotateY(180deg); }

.bg-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 9px 7px;
  border: 2px solid var(--gold);
  border-radius: 14px;
  background: #fffdf8;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.bg-back { transform: rotateY(180deg); }

.bg-card.is-focus .bg-face {
  border-color: #b9862b;
  background: #fff0c7;
  box-shadow: 0 0 0 3px rgba(216, 181, 106, 0.35);
}

.bg-name {
  font-family: "ZCOOL KuaiLe", "PingFang SC", sans-serif;
  font-size: 2rem;
  line-height: 1.05;
}
.bg-symbol {
  color: #6a4a2a;
  font-size: 1.25rem;
  line-height: 1;
  letter-spacing: 0.1em;
}
.bg-front-label { color: #9a7a52; font-size: 0.64rem; letter-spacing: 0.08em; }
.bg-front-value {
  font-family: "ZCOOL KuaiLe", "PingFang SC", sans-serif;
  font-size: 1.8rem;
  line-height: 1.08;
}
.bg-front-value.small { font-size: 1.08rem; }
.bg-hint { color: #9a7a52; font-size: 0.64rem; margin-top: 2px; }

.bg-lines {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 64%;
  margin: 3px 0;
}
.bg-bar {
  display: block;
  height: 8px;
  border-radius: 2px;
  background: #6a4a2a;
}
.bg-bar.yin { display: flex; gap: 10px; background: transparent; }
.bg-bar.yin::before, .bg-bar.yin::after {
  content: "";
  display: block;
  flex: 1;
  height: 8px;
  border-radius: 2px;
  background: #6a4a2a;
}
.bg-lines.big { width: 72%; }
.bg-lines.big .bg-bar, .bg-lines.big .bg-bar.yin::before, .bg-lines.big .bg-bar.yin::after { height: 10px; }

.bg-back .bg-name { font-size: 1.5rem; }
.bg-back .bg-line-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  color: #5a3a20;
  font-size: 0.7rem;
  line-height: 1.5;
}
.bg-back .bg-tag {
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(216, 181, 106, 0.22);
  color: #5a3a20;
  font-size: 0.66rem;
  font-weight: 700;
}
.bg-back .bg-small { color: #7a5a3a; font-size: 0.64rem; line-height: 1.45; text-align: center; }
.el-木 { color: #2f6b3d; }
.el-火 { color: #a3341f; }
.el-土 { color: #7b5320; }
.el-金 { color: #8a6b12; }
.el-水 { color: #1f4f76; }

.bg-flip-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.bg-flip-actions button {
  min-height: 38px;
  padding: 6px 12px;
  border: 2px solid var(--gold);
  border-radius: 12px;
  background: #fffdf8;
  font-size: 0.8rem;
}
.bg-flip-actions button:hover { background: #fff1cc; filter: none; }

.bg-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 12px 0 0;
  color: var(--bark);
  font-size: 0.8rem;
  line-height: 1.6;
}
.bg-legend b { color: #8a5a12; }

.bg-drill { margin-top: 16px; }
.bg-progressline { display: flex; justify-content: space-between; gap: 10px; color: var(--bark); font-size: 0.82rem; }
.bg-progressline p { margin: 0; }

.bg-question h2 {
  margin: 8px 0 10px;
  font-family: "ZCOOL KuaiLe", "PingFang SC", sans-serif;
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  line-height: 1.45;
}
.bg-target {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 8px 0 12px;
  padding: 10px;
  border: 2px dashed var(--gold);
  border-radius: 14px;
  background: #fffdf8;
}
.bg-target .bg-big { font-family: "ZCOOL KuaiLe", sans-serif; font-size: 2.2rem; line-height: 1; }

.bg-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bg-option {
  min-height: 46px;
  padding: 9px 12px;
  border: 2px solid var(--gold);
  border-radius: 12px;
  background: #fffdf8;
  color: var(--ink);
  font-size: 0.95rem;
  text-align: left;
}
.bg-option:hover:not(:disabled) { background: #fff1cc; filter: none; }
.bg-option:disabled { cursor: default; opacity: 0.86; }
.bg-option.correct { background: #d9ead6; border-color: #3a6b45; }
.bg-option.wrong { background: #f3d4cc; border-color: #a3341f; }

.bg-feedback { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: #fbf3df; line-height: 1.7; font-size: 0.9rem; }
.bg-feedback.ok { background: #e3efdf; }
.bg-feedback.bad { background: #f6e0da; }
.bg-feedback b { color: #5a3a20; }

.bg-next { margin-top: 12px; min-height: 44px; padding: 8px 18px; border: 2px solid var(--gold); border-radius: 12px; background: var(--moss); color: #f7eed4; }

.bg-result { margin: 8px 0 0; padding: 14px; border: 2px solid #3a6b45; border-radius: 14px; background: #e3efdf; }
.bg-result h2 { margin: 0 0 6px; font-family: "ZCOOL KuaiLe", sans-serif; font-size: 1.2rem; }
.bg-result p { margin: 6px 0; line-height: 1.65; }
.bg-result .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.bg-result .actions a, .bg-result .actions button {
  min-height: 42px;
  padding: 8px 14px;
  border: 2px solid var(--gold);
  border-radius: 12px;
  background: var(--moss);
  color: #f7eed4;
  text-decoration: none;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
}
.bg-result .actions .ghost { background: #fffdf8; color: var(--ink); }

.bg-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.bg-actions button, .bg-actions .pill { min-height: 40px; padding: 7px 12px; border-width: 2px; border-radius: 12px; font-size: 0.84rem; }
.bg-actions .ghost { background: #fffdf8; }

.bg-note { margin-top: 16px; padding: 18px 20px; }
.bg-note h2 { margin: 0 0 8px; font-family: "ZCOOL KuaiLe", sans-serif; font-size: 1.25rem; }
.bg-note p, .bg-note li { line-height: 1.75; }
.bg-note ul { padding-left: 22px; }
.bg-note b { color: #5a3a20; }

@media (max-width: 760px) {
  .bg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bg-card { height: 184px; }
}

@media (max-width: 430px) {
  .bg-wrap { width: calc(100% - 20px); }
  .bg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .bg-card { height: 174px; }
  .bg-options { grid-template-columns: 1fr; }
}


.bg-color-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 10px;
  color: var(--bark);
  font-size: 0.78rem;
}
.bg-color-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 3px 9px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: #fffdf8;
  color: #5a3a20;
  font-size: 0.76rem;
  cursor: pointer;
}
.bg-color-toggle input {
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--moss);
}
.bg-back .bg-color-toggle { margin-top: 2px; }

body.no-el-color .el-木,
body.no-el-color .el-火,
body.no-el-color .el-土,
body.no-el-color .el-金,
body.no-el-color .el-水 { color: var(--ink); }
