:root {
  color-scheme: light;
  --ink: #1f1a14;
  --muted: #746b60;
  --paper: #fff9ef;
  --line: #ead9bd;
  --gold: #c9902e;
  --red: #c74735;
  --green: #177c59;
  --blue: #275f9f;
  --shadow: 0 18px 45px rgba(94, 55, 18, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    linear-gradient(135deg, rgba(199, 71, 53, 0.08), transparent 38%),
    linear-gradient(225deg, rgba(39, 95, 159, 0.08), transparent 42%),
    var(--paper);
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 0 0 40px;
}

.hero {
  position: relative;
  display: block;
  width: 100vw;
  min-height: clamp(500px, 66vw, 720px);
  margin-left: calc(50% - 50vw);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 249, 239, 0) 70%, var(--paper) 100%),
    url("assets/header-caishen-slogan.png");
  background-position: center top;
  background-size: cover;
}

.board-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.hero-copy {
  position: relative;
  min-height: clamp(420px, 58vw, 560px);
  padding: 0;
}

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

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.hero-copy .eyebrow {
  color: #ffd47a;
}

h1,
h2 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(34px, 5vw, 58px);
}

h2 {
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 500;
}

.subcopy {
  max-width: 620px;
  margin: 18px 0 0;
  font-size: clamp(16px, 2vw, 21px);
  line-height: 1.7;
}

.god-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(330px, calc(100vw - 48px));
  gap: 14px;
  margin: -22px auto 0;
  padding: 14px 18px 18px;
  border: 0;
  border-radius: 999px 999px 8px 8px;
  background: linear-gradient(180deg, rgba(255, 249, 239, 0.04), rgba(255, 249, 239, 0.64));
  box-shadow: 0 14px 30px rgba(94, 55, 18, 0.08);
}

.primary-btn,
.ghost-btn,
.icon-btn {
  min-height: 46px;
  border-radius: 8px;
  padding: 0 22px;
  font-weight: 800;
}

.primary-btn {
  color: white;
  background: var(--red);
}

.ghost-btn {
  color: var(--ink);
  border: 1px solid var(--line);
  background: white;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  color: #5f5850;
  border: 0;
  background: transparent;
}

.icon-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.icon-btn.loading svg {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.fortune-text {
  min-height: 52px;
  line-height: 1.7;
  color: var(--muted);
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.86);
}

.fortune-strip {
  margin-top: 0;
  border: 0;
  border-radius: 0;
  padding: 20px 22px 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 249, 239, 0), var(--paper) 34%),
    transparent;
  box-shadow: none;
}

.fortune-strip > div:first-child {
  grid-column: 1 / -1;
}

.market-head {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  align-items: center;
  margin-top: 28px;
}

.accuracy-panel {
  display: flex;
  width: fit-content;
  max-width: 100%;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-top: 12px;
  padding: 7px 10px;
  color: #70685f;
  border: 1px solid rgba(234, 217, 189, 0.72);
  border-radius: 999px;
  background: rgba(255, 249, 239, 0.52);
  font-size: 12px;
  line-height: 1.45;
}

.accuracy-panel strong.up {
  color: var(--red);
  font-size: 15px;
  font-weight: 600;
}

.accuracy-panel strong.down {
  color: var(--green);
  font-size: 15px;
  font-weight: 600;
}

.disclaimer {
  margin: 7px 0 0 2px;
  color: #8a8278;
  font-size: 11px;
  line-height: 1.5;
}

.metric-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-family: "Songti SC", "STSong", "Noto Serif SC", "SimSun", serif;
  font-size: 14px;
}

.fortune-strip strong {
  font-family: "Songti SC", "STSong", "Noto Serif SC", "SimSun", serif;
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 700;
}

#luckScore {
  display: inline-block;
  font-size: clamp(34px, 6vw, 54px);
  line-height: 1;
}

#luckScore.good {
  color: var(--red);
}

#luckScore.bad {
  color: var(--green);
}

#luckyAction {
  color: var(--gold);
}

#avoidAction {
  color: #5f5850;
  font-weight: 500;
}

.muted,
.accuracy-panel p {
  color: var(--muted);
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.board-card {
  min-height: 0;
  border-radius: 8px;
  padding: 14px;
}

.board-card.pinned {
  border-color: rgba(201, 144, 46, 0.82);
}

.board-top,
.board-stats {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.board-name {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}

.board-code {
  color: var(--muted);
  font-size: 12px;
}

.pin-btn {
  flex: 0 0 auto;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 500;
}

.pin-btn.active {
  color: #7b230f;
  border-color: rgba(201, 144, 46, 0.72);
  background: rgba(255, 226, 162, 0.32);
}

.tag {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;
}

.tag.up {
  color: var(--red);
  background: rgba(199, 71, 53, 0.11);
}

.tag.down {
  color: var(--green);
  background: rgba(23, 124, 89, 0.11);
}

.tag.flat {
  color: var(--blue);
  background: rgba(39, 95, 159, 0.11);
}

.today-market {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 10px;
}

.today-market span {
  color: var(--muted);
  font-size: 13px;
}

.today-market strong {
  font-size: 24px;
  font-weight: 600;
}

.today-market strong.up {
  color: var(--red);
}

.today-market strong.down {
  color: var(--green);
}

.board-stats span {
  color: var(--muted);
  font-size: 12px;
}

.board-stats strong {
  display: block;
  margin-top: 4px;
  font-weight: 500;
}

.prediction-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(234, 217, 189, 0.78);
}

.prediction-cell {
  min-width: 0;
  text-align: center;
}

.prediction-cell > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.prediction-cell strong {
  display: block;
  font-weight: 500;
}

.prediction-cell > .tag {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  justify-content: center;
}

.prediction-cell div span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.prediction-cell .hit {
  color: var(--red);
}

.prediction-cell .miss {
  color: var(--green);
}

@media (max-width: 860px) {
  body {
    background: var(--paper);
  }

  .shell {
    width: 100%;
    padding-bottom: 34px;
  }

  .hero {
    height: auto;
    min-height: 0;
    margin-bottom: 0;
    overflow: visible;
    background:
      linear-gradient(180deg, rgba(255, 249, 239, 0) 64%, rgba(255, 249, 239, 0.72) 84%, var(--paper) 100%),
      url("assets/header-caishen-slogan.png");
    background-color: var(--paper);
    background-position: center top;
    background-repeat: no-repeat;
    background-size: cover;
  }

  .market-grid {
    grid-template-columns: 1fr;
    padding-inline: 16px;
  }

  .hero-copy {
    height: clamp(480px, 128vw, 540px);
    min-height: 0;
  }

  .god-panel {
    position: relative;
    left: auto;
    width: min(335px, calc(100vw - 40px));
    gap: 10px;
    margin: -72px auto 0;
    padding: 10px 14px 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
  }

  .primary-btn {
    min-height: 48px;
    padding: 0 28px;
    border-radius: 9px;
    box-shadow: 0 10px 22px rgba(130, 45, 28, 0.16);
  }

  .fortune-text {
    display: -webkit-box;
    min-height: auto;
    max-width: 340px;
    overflow: hidden;
    font-size: 15px;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .fortune-strip {
    width: 100vw;
    margin: 16px 0 0 calc(50% - 50vw);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 4px 20px 14px;
    gap: 8px;
    background: var(--paper);
  }

  .fortune-strip > div:first-child {
    grid-column: auto;
  }

  .metric-label {
    margin-bottom: 4px;
    font-size: 12px;
  }

  .fortune-strip strong {
    font-size: clamp(17px, 5vw, 22px);
  }

  #luckScore {
    font-size: clamp(28px, 8vw, 38px);
  }

  #luckyAction,
  #avoidAction {
    font-size: clamp(18px, 5vw, 23px);
  }

  .fortune-strip,
  .market-head {
    align-items: center;
  }

  .market-head,
  .accuracy-panel,
  .disclaimer {
    margin-inline: 16px;
  }

  .market-head {
    background: var(--paper);
  }

  .prediction-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .hero {
    height: auto;
    min-height: 0;
    margin-bottom: 0;
    background-position: center top;
    background-repeat: no-repeat;
    background-size: cover;
  }

  .hero-copy {
    height: 500px;
    min-height: 0;
  }

  .fortune-text {
    font-size: 16px;
  }
}
