:root {
  --paper: #fbfaf4;
  --paper-deep: #f1efe3;
  --ink: #4d2018;
  --red: #bd1916;
  --red-deep: #8d1514;
  --green: #2d6942;
  --green-deep: #19492b;
  --line: rgba(115, 38, 31, .18);
  --shadow: rgba(105, 49, 35, .16);
  --muted: #87685c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(185, 38, 29, .12), transparent 28rem),
    linear-gradient(145deg, #fffdf7 0%, #efe8d7 100%);
  font-family: "Noto Sans SC", "Microsoft YaHei", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-shell {
  width: min(100%, 520px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 14px 12px 24px;
  display: grid;
  align-items: center;
}

.calendar-card {
  position: relative;
  isolation: isolate;
}

.date-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.date-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn,
.today-btn {
  border: 1px solid rgba(45, 105, 66, .28);
  color: var(--green-deep);
  background: rgba(255, 255, 255, .78);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 8px 22px rgba(91, 66, 40, .08);
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 0;
  line-height: 1;
}

.icon-btn span {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: inherit;
  font-size: 28px;
  font-weight: 900;
  line-height: 18px;
  transform: translateY(-1px);
}

.today-btn {
  min-width: 64px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: .08em;
}

.icon-btn:active,
.today-btn:active,
.hour-chip:active {
  transform: translateY(1px) scale(.98);
}

.date-display {
  min-width: 140px;
  height: 42px;
  border: 1px solid rgba(45, 105, 66, .28);
  border-radius: 999px;
  padding: 0 18px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: rgba(255, 255, 255, .84);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 8px 22px rgba(91, 66, 40, .08);
  font-weight: 500;
}

.poster {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 8vw, 58px) clamp(22px, 7vw, 38px) 28px;
  border: 1px solid rgba(164, 37, 28, .28);
  border-radius: 5px;
  min-height: 720px;
  background:
    linear-gradient(90deg, rgba(45, 105, 66, .05), transparent 20%, transparent 80%, rgba(188, 25, 22, .05)),
    var(--paper);
  box-shadow:
    0 22px 54px rgba(78, 45, 29, .18),
    inset 0 0 0 3px rgba(255, 255, 255, .72);
}

.poster::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(189, 25, 22, .08);
  pointer-events: none;
}

.card-watermark {
  position: absolute;
  inset: 74px 0 auto 0;
  height: 430px;
  z-index: -1;
  pointer-events: none;
}

.wheel {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 360px;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: .13;
  background:
    repeating-conic-gradient(from 3deg, rgba(45, 105, 66, .25) 0deg 4deg, transparent 4deg 12deg),
    radial-gradient(circle, transparent 34%, rgba(45,105,66,.18) 35%, transparent 36% 48%, rgba(189,25,22,.14) 49%, transparent 50% 64%, rgba(45,105,66,.18) 65%, transparent 66%);
}

.wheel-two {
  width: 290px;
  opacity: .11;
  transform: translate(-50%, -50%) rotate(11deg);
}

.solar-title {
  color: var(--red);
  text-align: center;
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  font-size: clamp(58px, 18vw, 90px);
  font-weight: 900;
  line-height: .9;
  letter-spacing: .05em;
  text-shadow: 0 2px 0 #f2d0c2, 0 4px 8px rgba(121, 19, 16, .15);
  white-space: nowrap;
}

.date-unit {
  margin: 0 .05em;
  font-family: "Noto Serif SC", "Songti SC", serif;
}

.lunar-line {
  margin-top: 28px;
  color: var(--green-deep);
  text-align: center;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: .45em;
}

.week-title {
  margin: 12px 0 24px;
  color: var(--red);
  text-align: center;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(38px, 12vw, 56px);
  font-weight: 900;
  letter-spacing: .16em;
  text-shadow: 0 2px 0 #f0c5b8;
}

.info-list {
  display: grid;
  gap: 21px;
}

.info-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: start;
  gap: 14px;
}

.row-label {
  margin: 0;
  min-height: 43px;
  display: grid;
  place-items: center;
  border: 2px solid var(--green);
  border-radius: 4px;
  color: var(--red-deep);
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(230, 244, 230, .8));
  font-size: 26px;
  font-weight: 900;
  box-shadow: inset 0 0 0 2px rgba(45,105,66,.08), 0 3px 0 rgba(45,105,66,.16);
}

.row-body {
  min-width: 0;
  padding-top: 5px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--red-deep);
  font-size: 24px;
  font-weight: 900;
}

.info-row:first-child {
  align-items: center;
}

.info-row:first-child .row-body {
  min-height: 43px;
  padding-top: 0;
  align-items: center;
}

.colon {
  color: var(--ink);
  font-weight: 900;
}

.subtle {
  color: var(--ink);
  font-size: 20px;
}

#caiPosition {
  font-size: 22px;
  line-height: 1.35;
}

.color-list {
  min-width: 0;
  flex: 1 1 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
}

.color-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(67, 31, 22, .35);
  box-shadow: inset 0 1px 1px rgba(255,255,255,.75);
}

.zodiac-panel,
.time-panel {
  min-width: 0;
  width: 0;
  flex: 1 1 0;
}

.time-zhi,
.time-ranges,
.time-luck {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 4px;
  align-items: center;
}

.zodiac-badges,
.zodiac-animals,
.zodiac-marks {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: center;
  justify-items: center;
  gap: 4px;
}

.zodiac-badges {
  margin-bottom: 7px;
}

.dot-badge {
  width: 23px;
  height: 23px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 2px 4px rgba(37, 22, 16, .12);
}

.dot-black {
  background: #20201f;
}

.dot-green {
  background: #28824f;
}

.dot-red {
  background: var(--red);
}

.animal {
  width: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--red-deep);
  font-size: 21px;
  font-weight: 900;
  line-height: 1;
}

.mark {
  width: 23px;
  height: 23px;
  margin: 8px auto 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: #9b2d35;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.mark.empty {
  opacity: 0;
}

.time-zhi {
  color: var(--red-deep);
  font-size: 21px;
  font-weight: 900;
  line-height: 1.1;
}

.hour-chip {
  appearance: none;
  width: 100%;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  color: inherit;
  background: transparent;
  font-weight: inherit;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.hour-chip.is-active {
  color: #fff;
  background: var(--red-deep);
}

.time-ranges {
  margin-top: 2px;
  color: #43241d;
  font-family: "Courier New", monospace;
  font-size: 15px;
  line-height: 1.15;
}

.time-ranges span {
  text-align: center;
}

.time-luck {
  margin-top: 8px;
}

.year-row {
  align-items: start;
  margin-top: 12px;
}

.year-body {
  padding-top: 0;
  align-items: stretch;
}

.year-row .row-label {
  min-height: 43px;
}

.year-panel {
  width: 0;
  min-width: 0;
  flex: 1 1 0;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 4px;
}

.year-col {
  min-height: 96px;
  padding: 3px 0;
  display: grid;
  align-content: space-between;
  justify-items: center;
  border-radius: 2px;
  color: #fff;
  font-family: "Courier New", monospace;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}

.year-red {
  background: #c73834;
}

.year-green {
  background: #4c9368;
}

.year-black {
  background: #343434;
}

.lucky-card-section {
  margin-top: 24px;
  padding: 6px 0 0;
  text-align: center;
}

.lucky-card-section h2 {
  margin: 0;
  color: var(--red);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: .04em;
  text-shadow: 0 1px 0 #f1c8b8;
}

.lucky-card-section p {
  margin: 10px 0 0;
  color: #8a5b24;
  font-size: 15px;
}

.lucky-card-stage {
  margin: 20px auto 0;
  display: flex;
  justify-content: center;
  gap: 14px;
}

.mahjong-card {
  position: relative;
  width: 72px;
  height: 98px;
  border: 2px solid #172415;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(31, 64, 42, .14), transparent 10%, transparent 90%, rgba(31, 64, 42, .2)),
    linear-gradient(180deg, #fffef5 0%, #fbfff3 52%, #e2ead7 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, .9),
    inset 0 -8px 14px rgba(44, 76, 49, .18),
    0 0 0 3px #f0c41a,
    0 8px 18px rgba(92, 51, 19, .22);
  color: var(--red-deep);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-weight: 900;
}

.tile-card::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(42, 96, 61, .26);
  border-radius: 5px;
  pointer-events: none;
}

.wan-number {
  position: absolute;
  top: 11px;
  left: 50%;
  transform: translateX(-50%);
  color: #202018;
  font-size: 32px;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255,255,255,.9);
}

.wan-suit {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  color: #b81517;
  font-size: 31px;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255,255,255,.9);
}

.tile-grid {
  position: relative;
  z-index: 1;
  width: 52px;
  height: 74px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  align-items: center;
  justify-items: center;
  gap: 2px;
}

.dot-pos-1,
.stick-pos-1 { grid-area: 1 / 1; }
.dot-pos-2,
.stick-pos-2 { grid-area: 1 / 2; }
.dot-pos-3,
.stick-pos-3 { grid-area: 1 / 3; }
.dot-pos-4,
.stick-pos-4 { grid-area: 2 / 1; }
.dot-pos-5,
.stick-pos-5 { grid-area: 2 / 2; }
.dot-pos-6,
.stick-pos-6 { grid-area: 2 / 3; }
.dot-pos-7,
.stick-pos-7 { grid-area: 3 / 1; }
.dot-pos-8,
.stick-pos-8 { grid-area: 3 / 2; }
.dot-pos-9,
.stick-pos-9 { grid-area: 3 / 3; }

.circle-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #1e5d35;
  background:
    radial-gradient(circle, #c92828 0 28%, #f7f2e5 30% 44%, transparent 46%),
    repeating-radial-gradient(circle, transparent 0 2px, rgba(30, 93, 53, .75) 3px 4px),
    #f8f4e9;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.9);
}

.circle-dot.dot-red {
  border-color: #b61f1f;
}

.circle-dot.dot-black {
  border-color: #232323;
}

.bamboo-stick {
  width: 8px;
  height: 22px;
  border-radius: 7px;
  border: 1px solid rgba(9, 74, 39, .7);
  background:
    repeating-linear-gradient(180deg, #0c7a3c 0 5px, #d6f1dc 5px 7px),
    #0d7540;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.22),
    0 1px 0 rgba(255,255,255,.6);
}

.bamboo-stick.stick-red {
  border-color: rgba(168, 24, 27, .72);
  background:
    repeating-linear-gradient(180deg, #b81e22 0 5px, #ffe7de 5px 7px),
    #b81e22;
}

.bamboo-one {
  position: relative;
  z-index: 1;
  color: #0d6d3d;
  font-size: 42px;
  line-height: 1;
  transform: rotate(-10deg);
  text-shadow: 1px 1px 0 #dff1df;
}

.honor-mark {
  position: relative;
  z-index: 1;
  color: #1f211d;
  font-size: 42px;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255,255,255,.9);
}

.honor-red .honor-mark {
  color: #bd171d;
}

.honor-green .honor-mark {
  color: #177543;
}

.honor-white .honor-mark {
  width: 34px;
  height: 46px;
  border: 3px solid #222;
  border-radius: 2px;
  color: transparent;
  background: rgba(255,255,255,.45);
}

.card-back {
  display: flex;
}

.card-back::before {
  content: "";
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px double #335c78;
  background:
    radial-gradient(circle, #c52625 0 18%, transparent 19%),
    repeating-conic-gradient(#235f93 0deg 18deg, #f7f3e8 18deg 36deg);
}

.draw-card-btn {
  margin-top: 18px;
  min-width: 134px;
  height: 38px;
  border: 1px solid rgba(141, 21, 20, .28);
  border-radius: 999px;
  color: #fff;
  background: var(--red-deep);
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 6px 15px rgba(105, 31, 22, .18);
}

.draw-card-btn:disabled {
  cursor: default;
  opacity: .72;
}

.lucky-card-section .lucky-card-note {
  margin-top: 16px;
}

.luck-tag {
  width: 22px;
  height: 22px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.luck-good {
  background: #b43135;
  clip-path: polygon(50% 2%, 98% 50%, 50% 98%, 2% 50%);
}

.luck-mid {
  background: #2f8f65;
  clip-path: polygon(50% 2%, 98% 50%, 50% 98%, 2% 50%);
}

.luck-bad {
  background: #242424;
  clip-path: polygon(50% 2%, 98% 50%, 50% 98%, 2% 50%);
}

.detail-strip {
  margin-top: 24px;
  padding: 14px 15px;
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.42);
  font-size: 14px;
  line-height: 1.55;
}

.detail-strip div {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
}

.detail-label {
  color: var(--green-deep);
  font-weight: 900;
}

.detail-strip strong {
  color: var(--red-deep);
}

.hour-detail {
  margin-top: 14px;
  padding: 14px 15px;
  border: 1px solid rgba(45,105,66,.2);
  border-radius: 6px;
  background: rgba(250, 253, 246, .72);
}

.hour-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--red-deep);
  font-weight: 900;
}

.hour-detail-head span {
  color: var(--green-deep);
}

.hour-detail-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}

.hour-detail-grid p {
  margin: 0;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 7px;
  align-items: start;
  font-size: 13px;
  line-height: 1.45;
}

.hour-detail-grid span {
  color: var(--green-deep);
  font-weight: 900;
}

.hour-detail-grid b {
  color: var(--ink);
  font-weight: 700;
}

.poster-foot {
  margin-top: 25px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  color: rgba(117, 36, 29, .62);
  font-size: 13px;
  letter-spacing: .2em;
}

.poster-foot span {
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(117,36,29,.68), transparent);
}

@media (max-width: 560px) {
  .page-shell {
    padding: 10px 8px 18px;
  }

  .poster {
    min-height: auto;
    padding: 28px 12px 22px;
  }

  .date-head {
    gap: 6px;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
  }

  .date-display {
    min-width: 138px;
    height: 38px;
    padding: 0 8px;
  }

  .today-btn {
    min-width: 52px;
    height: 36px;
    padding: 0 10px;
  }

  .solar-title {
    font-size: clamp(40px, 13.8vw, 54px);
    letter-spacing: 0;
  }

  .lunar-line {
    margin-top: 22px;
    font-size: 16px;
    letter-spacing: .28em;
  }

  .week-title {
    margin-bottom: 20px;
  }

  .info-list {
    gap: 18px;
  }

  .info-row {
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 6px;
  }

  .row-label {
    min-height: 38px;
    font-size: 19px;
  }

  .row-body {
    gap: 4px;
    font-size: 19px;
  }

  .info-row:first-child .row-body {
    min-height: 38px;
  }

  .subtle {
    font-size: 16px;
  }

  #caiPosition {
    font-size: 19px;
  }

  .color-list {
    gap: 8px 11px;
  }

  .time-zhi,
  .time-ranges,
  .time-luck {
    gap: 2px;
  }

  .zodiac-badges,
  .zodiac-animals,
  .zodiac-marks {
    gap: 2px;
  }

  .dot-badge {
    width: 22px;
    height: 22px;
    font-size: 12px;
  }

  .animal {
    font-size: 20px;
  }

  .time-zhi {
    font-size: 16px;
  }

  .mark {
    width: 21px;
    height: 21px;
    font-size: 12px;
  }

  .time-ranges {
    font-size: 10px;
  }

  .luck-tag {
    width: 17px;
    height: 17px;
    font-size: 10px;
  }

  .year-panel {
    gap: 2px;
  }

  .year-col {
    min-height: 86px;
    font-size: 11px;
  }

  .year-row .row-label {
    min-height: 38px;
  }

  .lucky-card-stage {
    gap: 10px;
  }

  .mahjong-card {
    width: 58px;
    height: 80px;
  }

  .wan-number {
    top: 9px;
    font-size: 26px;
  }

  .wan-suit {
    bottom: 10px;
    font-size: 25px;
  }

  .tile-grid {
    width: 43px;
    height: 60px;
    gap: 1px;
  }

  .circle-dot {
    width: 12px;
    height: 12px;
    border-width: 2px;
  }

  .bamboo-stick {
    width: 7px;
    height: 18px;
  }

  .bamboo-one,
  .honor-mark {
    font-size: 34px;
  }

  .honor-white .honor-mark {
    width: 28px;
    height: 38px;
    border-width: 3px;
  }
}

@media (max-width: 390px) {
  .dot-badge {
    width: 19px;
    height: 19px;
    font-size: 11px;
  }

  .animal {
    font-size: 17px;
  }

  .mark {
    width: 18px;
    height: 18px;
    font-size: 11px;
  }
}
