/* DayMaster — 手机优先，单文件样式，不拉任何外部字体或资源。 */

:root {
  --bg: #0e1116;
  --panel: #161b24;
  --panel-2: #1c2230;
  --ink: #eef2f8;
  --muted: #94a1b8;
  --line: #2a3242;
  --accent: #6aa9ff; /* 会被五行覆写 */
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

/* hidden 属性必须能压住后面写的 display 规则。
   .actions / .link-fallback 都设了 display:grid，属性选择器和类选择器优先级相同，
   靠来源顺序我们这条又在上文，所以只能 !important。 */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  background-image:
    radial-gradient(120% 70% at 50% -10%, rgba(106, 169, 255, 0.16), transparent 60%),
    radial-gradient(90% 50% at 90% 10%, rgba(180, 140, 255, 0.1), transparent 55%);
}

.shell {
  max-width: 460px;
  margin: 0 auto;
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
}

/* ---------- 页头 ---------- */

.masthead {
  text-align: center;
  margin: 12px 0 26px;
}

.wordmark {
  display: inline-block;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.tagline {
  margin: 8px 0 0;
  font-size: 20px;
  line-height: 1.4;
  color: var(--ink);
}

/* ---------- 输入表单 ---------- */

.intake {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

.field-label {
  font-size: 13px;
  color: var(--muted);
}

/* 输入校验失败时的提示。安静的红色，不做弹窗。 */
.field-error {
  font-size: 13px;
  line-height: 1.5;
  color: #ff9a8a;
}

input.is-invalid {
  border-color: #c9564a;
}

input {
  width: 100%;
  padding: 14px 15px;
  font: inherit;
  font-size: 17px; /* ≥16px 才不会让 iOS 自动放大 */
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  appearance: none;
}

input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

input::placeholder {
  color: #5f6b80;
}

/* 让日期控件在深色底上不难看 */
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.75);
  cursor: pointer;
}

.cta {
  margin-top: 4px;
  padding: 16px;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  color: #08111f;
  background: var(--accent);
  border: 0;
  border-radius: 14px;
  cursor: pointer;
}

.cta:active {
  transform: translateY(1px);
}

.privacy {
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- 运势卡 ---------- */

.card {
  margin-top: 26px;
  padding: 26px 22px;
  /* 每个日主一套：光晕位置 + 光晕颜色 + 两层底色。
     变量由 app.js 从 theme.js 写进来，没写就退回默认的中性蓝。 */
  background:
    radial-gradient(130% 80% at var(--glow-x, 50%) 0%, var(--glow, transparent), transparent 64%),
    linear-gradient(180deg, var(--panel-top, var(--panel-2)), var(--panel-bottom, var(--panel)));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  /* 卡片顶部一道五行色的光 */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 0 0 1px transparent;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: -1px -1px auto -1px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.card-kicker {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.card-title {
  margin: 6px 0 0;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 680;
}

.card-blurb {
  margin: 10px 0 0;
  color: var(--ink);
  opacity: 0.85;
}

.orb {
  width: 54px;
  height: 54px;
  margin: 0 0 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #fff8, transparent 55%), var(--accent);
  box-shadow: 0 0 26px -6px var(--accent);
}

.divider {
  height: 1px;
  margin: 22px 0;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

.today-head {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.today-line {
  margin: 7px 0 0;
  font-size: 18px;
  line-height: 1.5;
}

/* 日支那一层：比主解读收一档，视觉上明确是「次要信息」 */
.card-under {
  font-size: 16px;
  color: var(--muted);
}

.under-head {
  margin-top: 20px;
  color: var(--muted);
}

.columns {
  display: grid;
  gap: 18px;
  margin-top: 20px;
}

/* 刻意不做双列：卡片最大内宽只有 ~376px，拆两列会让
 * "Say yes to the unplanned invitation" 这种句子折成四行，反而难扫。
 * 真要并排是 M3.2 那张 750×1000 分享图的版式，另做。 */
.col + .col {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.col-label {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.col-label.is-avoid {
  color: #8f7b6a;
}

.col ul {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
}

.col li {
  position: relative;
  padding-left: 16px;
  font-size: 15px;
  line-height: 1.45;
}

.col li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.col.is-avoid li {
  color: var(--muted);
}

.col.is-avoid li::before {
  background: #4a5468;
}

.card-foot {
  margin: 22px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* ---------- 页脚 ---------- */

.footer {
  margin-top: 26px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.linkish {
  margin-top: 10px;
  padding: 6px;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: 0;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- 纯卡片模式（?view=card），M3.2 分享图用 ---------- */

.card-only {
  background-image: none;
}

.card-only .masthead,
.card-only .intake,
.card-only .footer {
  display: none;
}

.card-only .shell {
  padding-top: 18px;
}

.card-only .card {
  margin-top: 0;
}

/* ---------- 内容页（SEO 文章） ---------- */

.article {
  max-width: 660px;
  padding-top: 22px;
}

.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 34px;
}

.navcta {
  padding: 8px 15px;
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.article h1 {
  margin: 0 0 18px;
  font-size: 33px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.article h2 {
  margin: 40px 0 12px;
  font-size: 22px;
  line-height: 1.3;
}

.article h3 {
  margin: 26px 0 6px;
  font-size: 17px;
}

.article p,
.article li,
.article dd {
  color: #c6d1e1;
  line-height: 1.65;
}

.article a {
  color: var(--accent, #6aa9ff);
}

.article strong {
  color: var(--ink);
}

.lede {
  font-size: 19px;
  line-height: 1.55;
  color: var(--ink);
}

.cn {
  font-size: 0.9em;
  opacity: 0.7;
}

/* 日主清单：名字在左、描述在右，窄屏自动堆叠 */
.dm-list {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
}

.dm-list li {
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.dm-name {
  display: block;
  font-weight: 600;
  color: var(--ink);
}

.dm-blurb {
  display: block;
  margin-top: 3px;
  font-size: 15px;
  color: var(--muted);
}

@media (min-width: 560px) {
  .dm-list li {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 18px;
    align-items: baseline;
  }
  .dm-blurb {
    margin-top: 0;
  }
}

.table-wrap {
  overflow-x: auto;
  margin: 18px 0;
}

.pillar-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.pillar-table th,
.pillar-table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.pillar-table th {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.pillar-table .yes {
  color: #5fbf7a;
  font-weight: 600;
}

.pillar-table .no {
  color: var(--muted);
}

.plain-list {
  margin: 14px 0;
  padding-left: 20px;
}

.plain-list li {
  margin: 7px 0;
}

/* 行动召唤块 */
.cta-box {
  margin: 40px 0;
  padding: 26px 22px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 20px;
}

.cta-title {
  margin: 0;
  font-size: 20px;
  font-weight: 620;
  color: var(--ink);
}

.cta-sub {
  margin: 8px 0 18px;
  font-size: 15px;
}

.cta-link {
  display: block;
  text-align: center;
  text-decoration: none;
}

/* 问答 */
.faq {
  margin: 14px 0 0;
}

.faq dt {
  margin-top: 20px;
  font-weight: 600;
  color: var(--ink);
}

.faq dd {
  margin: 6px 0 0;
  font-size: 15px;
}

.footer-links {
  margin-top: 12px;
  font-size: 13px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: underline;
}

/* ---------- 分享操作 ---------- */

.actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

@media (min-width: 380px) {
  .actions {
    grid-template-columns: 1fr 1fr;
  }
  .actions #share {
    grid-column: 1 / -1;
  }
}

.action {
  padding: 14px;
  font: inherit;
  font-size: 15px;
  font-weight: 550;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
}

.action:active {
  transform: translateY(1px);
}

.action.is-primary {
  color: #08111f;
  background: var(--accent, #6aa9ff);
  border-color: transparent;
}

.action-note {
  margin: 10px 0 0;
  font-size: 13px;
  text-align: center;
  color: var(--muted);
}

/* 剪贴板被浏览器挡住时的手动复制兜底 */
.link-fallback {
  margin-top: 12px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  gap: 10px;
}

.link-fallback-hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.link-fallback-input {
  width: 100%;
  padding: 11px 12px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
