/* Bảng hoạt động mới (gói A/B/C/K): bài giảng, thư pháp, giếng chùa, "Hôm nay ở chùa", băng khoảnh khắc chung.
   Dùng token màu của game.css; mọi lớp bắt đầu bằng .hd- để không va lớp toàn cục. */
dialog.hd-dialog[open] {
  text-align: left;
  width: min(560px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: 92dvh;
  padding: 22px 22px 18px;
  overflow: auto;
}
.hd-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
  padding-right: 44px;
}
.hd-head h2 {
  margin: 0;
}
.hd-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-sunk);
  color: var(--cream);
  cursor: pointer;
}
.hd-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.hd-close:hover,
.hd-close:focus-visible {
  border-color: var(--line-strong);
  color: var(--gold-hi);
}
.hd-kicker {
  margin: 0 0 8px;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
}
.hd-lead {
  margin: 0 0 14px;
  color: var(--cream);
  line-height: 1.55;
}
.hd-muted {
  margin: 12px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--milk);
}
.hd-status {
  min-height: 1.4em;
  margin: 10px 0 0;
  color: var(--gold-hi);
  line-height: 1.5;
}
.hd-primary {
  margin-top: 14px;
}
.hd-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.hd-row .hd-primary {
  flex: 1;
}
.hd-ghost {
  margin-top: 14px;
  min-height: 54px;
  padding: 0 20px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface-sunk);
  color: var(--cream);
  font: inherit;
  cursor: pointer;
}
.hd-ghost:hover,
.hd-ghost:focus-visible {
  color: var(--gold-hi);
}
.hd-dialog [hidden],
.hd-moment[hidden] {
  display: none !important;
}

/* ---- Bài giảng */
.hd-ornament {
  height: 1px;
  margin: 6px auto 16px;
  width: 40%;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.hd-lesson-title {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  color: var(--gold-hi);
  text-align: center;
}
.hd-lesson-body {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  color: var(--cream);
  text-align: center;
}
.hd-lesson .hd-muted {
  text-align: center;
}

/* ---- Thư pháp */
.hd-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.hd-chip {
  min-width: 52px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface-sunk);
  color: var(--cream);
  font-family: var(--serif);
  font-size: 18px;
  cursor: pointer;
}
.hd-chip[aria-checked='true'] {
  background: var(--selected-fill);
  border-color: var(--gold);
  color: var(--gold-hi);
  box-shadow: var(--glow);
}
.hd-chips.hd-locked .hd-chip {
  opacity: 0.55;
  cursor: default;
}
.hd-paper-wrap {
  display: grid;
  place-items: center;
}
.hd-paper {
  display: block;
  border-radius: 10px;
  box-shadow:
    inset 0 0 0 1px rgba(80, 50, 20, 0.25),
    0 10px 24px rgba(0, 0, 0, 0.35);
  touch-action: none;
}
.hd-paper.hd-live {
  cursor: crosshair;
  outline: 2px solid rgba(243, 201, 115, 0.45);
  outline-offset: 3px;
}

/* ---- Giếng chùa */
.hd-wishes {
  display: grid;
  gap: 6px;
  max-height: min(42dvh, 360px);
  overflow: auto;
  padding: 2px;
}
.hd-wish {
  text-align: left;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-sunk);
  color: var(--cream);
  font: inherit;
  line-height: 1.4;
  cursor: pointer;
}
.hd-wish[aria-checked='true'] {
  background: var(--selected-fill);
  border-color: var(--gold);
  color: var(--gold-hi);
}
.hd-check {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  color: var(--cream);
  cursor: pointer;
}
.hd-check input {
  width: 20px;
  height: 20px;
  accent-color: var(--gold);
}

/* ---- Hôm nay ở chùa */
.hd-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.hd-stat {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-sunk);
}
.hd-stat b {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  color: var(--gold-hi);
}
.hd-stat span {
  font-size: 13px;
  color: var(--cream);
}
.hd-stat small {
  font-size: 11.5px;
  color: var(--milk);
}
.hd-goal {
  margin-top: 14px;
}
.hd-goal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
  color: var(--cream);
}
.hd-goal-head span {
  color: var(--milk);
  text-align: right;
}
.hd-bar {
  height: 8px;
  margin-top: 6px;
  border-radius: var(--r-pill);
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  overflow: hidden;
}
.hd-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--jade), var(--gold));
}

/* ---- Băng khoảnh khắc chung (đêm hoa đăng, cây đại nở hoa, huy hiệu lễ) */
.hd-moment {
  position: fixed;
  z-index: 60;
  left: 50%;
  top: calc(18px + var(--safe-t));
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 32px));
  padding: 14px 20px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--sheet-fill), rgba(36, 25, 15, 0.92);
  box-shadow: var(--shadow), var(--glow);
  color: var(--gold-hi);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.5;
  text-align: center;
  pointer-events: none;
}
.hd-moment.hd-show {
  animation: hd-moment 9s var(--ease) both;
}
@keyframes hd-moment {
  0% {
    opacity: 0;
    transform: translate(-50%, -12px);
  }
  6%,
  88% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -6px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .hd-moment.hd-show {
    animation: none;
  }
}
@media (max-width: 480px) {
  dialog.hd-dialog[open] {
    padding: 18px 14px 14px;
  }
  .hd-lesson-body {
    font-size: 16.5px;
  }
  .hd-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
