:root {
  --bg-1: #0ea5e9;
  --bg-2: #6366f1;
  --bg-3: #ec4899;
  --card: rgba(255, 255, 255, 0.9);
  --text: #0f172a;
  --muted: #475569;
  --border: #e2e8f0;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.loader[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 15% 20%, rgba(99,102,241,0.12), transparent 35%),
    radial-gradient(circle at 80% 0%, rgba(236,72,153,0.14), transparent 30%),
    linear-gradient(145deg, #ffffff, #eef2ff);
  color: var(--text);
  min-height: 100vh;
  font-size: 19px;
}

a { color: #1d4ed8; }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 22px;
  position: sticky;
  top: 0;
  backdrop-filter: blur(18px);
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--border);
  z-index: 10;
  box-shadow: 0 10px 30px rgba(99,102,241,0.08);
}
header h1 { margin: 0; font-size: 26px; color: var(--text); letter-spacing: 0.5px; }
header p { margin: 4px 0 0; color: var(--muted); }
#today-yi-ji { color: #334155; font-size: 14px; text-align: right; }
.header-right { display: flex; align-items: flex-start; gap: 12px; }
.lang-switch {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  border: 1px solid rgba(99,102,241,0.20);
  background: rgba(99,102,241,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.2px;
  color: #334155;
  text-decoration: none;
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(226,232,240,0.9);
  white-space: nowrap;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.lang-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(99,102,241,0.16); }
.lang-btn:active { transform: translateY(0); }
.lang-btn.active {
  border: none;
  color: #0b1224;
  background: linear-gradient(120deg, rgba(14,165,233,0.95), rgba(99,102,241,0.95), rgba(236,72,153,0.95));
  box-shadow: 0 14px 30px rgba(99,102,241,0.22);
}

main { max-width: 1024px; margin: 0 auto; padding: 18px; display: grid; gap: 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 18px 40px rgba(15,23,42,0.1);
  transform: perspective(800px) translateZ(0);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: perspective(800px) translateZ(10px) rotateX(0.8deg) rotateY(-0.8deg);
  box-shadow: 0 24px 55px rgba(99,102,241,0.18);
}
.no-3d .card,
.no-3d .card:hover {
  transform: none;
  box-shadow: 0 12px 30px rgba(15,23,42,0.08);
}

.hero {
  background: linear-gradient(135deg, rgba(14,165,233,0.18), rgba(236,72,153,0.18));
  border: 1px solid rgba(99,102,241,0.2);
}
.slogan { margin-top: 14px; display: grid; gap: 10px; }
.slogan-text { margin: 0; font-weight: 800; color: #0f172a; letter-spacing: .2px; }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.feature {
  display: flex; gap: 10px; align-items: flex-start;
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(99,102,241,0.18);
  border-radius: 16px;
  padding: 12px;
}
.feature strong { display: block; font-size: 14px; }
.feature-sub { font-size: 12px; color: #475569; line-height: 1.3; }
.feature-ico {
  width: 34px; height: 34px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(14,165,233,0.25), rgba(99,102,241,0.25), rgba(236,72,153,0.25));
  border: 1px solid rgba(99,102,241,0.25);
  color: #0f172a;
  font-weight: 900;
  flex: 0 0 auto;
}
.community {
  font-size: 13px;
  color: #334155;
  background: rgba(255,255,255,0.65);
  border: 1px dashed rgba(99,102,241,0.25);
  border-radius: 14px;
  padding: 10px 12px;
}
.lead { font-size: 18px; color: var(--text); margin: 6px 0; }
.lead.subtle { color: var(--muted); font-size: 16px; }
.card h2, .card h3 { margin-top: 0; color: var(--text); }

label { display: block; margin: 12px 0; color: var(--muted); font-weight: 600; }
.field .label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.help {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(99,102,241,0.35);
  background: rgba(255,255,255,0.8);
  color: #334155;
  font-weight: 900;
  display: inline-grid;
  place-items: center;
  padding: 0;
}
.field-hint { display: block; margin-top: 6px; font-size: 13px; color: #64748b; }
.examples {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.examples-title {
  font-size: 13px;
  color: #475569;
  font-weight: 800;
  margin-right: 2px;
}
.example-chip {
  width: auto;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(99,102,241,0.18);
  background: rgba(255,255,255,0.75);
  color: #0f172a;
  font-weight: 800;
  font-size: 13px;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.example-chip:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(99,102,241,0.16); }
.example-chip:active { transform: translateY(0); }
.ritual {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.65);
  border: 1px solid rgba(99,102,241,0.18);
  color: #334155;
  font-size: 14px;
}
input, textarea, select, button {
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
  font-size: 16px;
}
textarea { min-height: 90px; resize: vertical; }
button {
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.1s ease, background 0.2s ease, box-shadow 0.2s ease;
}
button:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(99,102,241,0.16); }
button:active { transform: translateY(0); }
button.secondary { background: #e2e8f0; color: #0f172a; border: none; }
button[type=submit] { background: linear-gradient(120deg,var(--bg-1),var(--bg-2),var(--bg-3)); border: none; color: #0b1224; margin-top: 10px; }
.link {
  width: auto;
  padding: 0;
  border: none;
  background: transparent;
  color: #1d4ed8;
  text-decoration: underline;
  font-weight: 800;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f8fafc;
  display: grid;
  place-items: center;
  font-size: 20px;
  line-height: 1;
  padding: 0;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 10px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text);
  background: #f8fafc;
  transition: all .15s;
  width: auto;
}
.chip.active { background: var(--bg-2); color: #ffffff; border-color: var(--bg-2); box-shadow: 0 10px 20px rgba(99,102,241,0.3); }
.chip .chip-ico { width: 16px; height: 16px; margin-right: 8px; display: inline-block; vertical-align: -2px; }
.chip svg { width: 16px; height: 16px; }

.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit,minmax(200px,1fr)); margin-top: 10px; }
.tile {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: #f8fafc;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
  opacity: 0;
  transform: translateY(10px) scale(0.99);
  animation: tileIn .45s ease forwards;
  animation-delay: var(--delay, 0s);
}
.tile h4 { margin: 0 0 6px; color: var(--text); }
.tile small { color: #64748b; }
.tile.tarot-upright { border-left: 5px solid #22c55e; }
.tile.tarot-reversed { border-left: 5px solid #fb923c; }
.tile.answer { background: linear-gradient(135deg, rgba(99,102,241,0.10), rgba(236,72,153,0.10)); }
.tile .pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid rgba(148,163,184,0.6);
  background: rgba(255,255,255,0.65);
}
.tile .pill.up { border-color: rgba(34,197,94,0.55); color: #166534; }
.tile .pill.rev { border-color: rgba(251,146,60,0.55); color: #9a3412; }
.tile .hl { color: #ef4444; font-weight: 900; }
@keyframes tileIn {
  to { opacity: 1; transform: translateY(0) scale(1); }
}
pre {
  white-space: pre-wrap;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
}
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
#history { margin-top: 12px; font-size: 14px; color: var(--muted); }
.history-item { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.result-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.oracle-card {
  margin-top: 12px;
  border-radius: 20px;
  padding: 14px 14px;
  border: 1px solid rgba(99,102,241,0.22);
  background: linear-gradient(135deg, rgba(14,165,233,0.12), rgba(99,102,241,0.12), rgba(236,72,153,0.10));
  box-shadow: 0 18px 40px rgba(99,102,241,0.14);
}
.oracle-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.3px;
  color: #334155;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.68);
  border: 1px solid rgba(226,232,240,0.9);
}
.oracle-text {
  margin-top: 10px;
  font-size: 22px;
  line-height: 1.35;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: 0.2px;
}
.oracle-text .quote {
  color: #0b1224;
}
.oracle-text .quote::before { content: "“"; }
.oracle-text .quote::after { content: "”"; }
.badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(14,165,233,0.2), rgba(236,72,153,0.2));
  border: 1px solid rgba(99,102,241,0.25);
  color: #0f172a;
  font-weight: 900;
  font-size: 12px;
}
.yearline { color: #334155; font-size: 12px; font-weight: 700; }
.reading-head { display:flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.byline { font-size: 13px; color: #64748b; font-weight: 800; }
.evidence { margin-top: 12px; }
.evidence summary {
  cursor: pointer;
  font-weight: 900;
  color: #1f2937;
}
.evidence summary::marker { color: rgba(99,102,241,0.9); }
#glossary-btn { margin-top: 10px; }

/* Skeleton for almanac */
.skeleton {
  display: grid;
  gap: 6px;
  align-items: end;
}
.skeleton-line {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(226,232,240,0.9), rgba(241,245,249,0.9), rgba(226,232,240,0.9));
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}
.skeleton-line.w1 { width: 220px; }
.skeleton-line.w2 { width: 260px; }
.skeleton-line.w3 { width: 240px; }
@keyframes shimmer {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

.toast {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(15,23,42,0.9); color: #e5e7eb; padding: 10px 14px;
  border-radius: 12px; border: 1px solid #1e293b; box-shadow: 0 10px 30px rgba(0,0,0,0.25); z-index: 30;
}
.loader {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15,23,42,0.35);
  backdrop-filter: blur(6px);
  z-index: 40;
  gap: 12px;
  text-align: center;
}
.loader-info { width: min(420px, 86vw); display: grid; gap: 10px; }
.loader-step { margin: 0; color: rgba(226,232,240,0.95); font-size: 14px; font-weight: 800; }
.progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.22);
  overflow: hidden;
}
.bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(14,165,233,0.9), rgba(99,102,241,0.9), rgba(236,72,153,0.9));
  border-radius: 999px;
  transition: width .35s ease;
}
.ritual-deck {
  position: relative;
  width: 160px;
  height: 140px;
}
.stars {
  position: absolute;
  inset: -30px;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.85) 0 2px, transparent 3px),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.7) 0 1px, transparent 2px),
    radial-gradient(circle at 70% 70%, rgba(255,255,255,0.6) 0 1px, transparent 2px),
    radial-gradient(circle at 35% 75%, rgba(255,255,255,0.65) 0 1px, transparent 2px);
  filter: blur(0.2px);
  opacity: 0.9;
  animation: starsDrift 2.4s ease-in-out infinite;
}
.deck { position: absolute; inset: 0; display: grid; place-items: center; perspective: 800px; }
.deck .card {
  position: absolute;
  width: 92px;
  height: 128px;
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.95), rgba(241,245,249,0.9));
  border: 1px solid rgba(255,255,255,0.6);
  box-shadow: 0 22px 60px rgba(15,23,42,0.35);
  transform-style: preserve-3d;
  overflow: hidden;
}
.deck .card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 30% 25%, rgba(99,102,241,0.25), transparent 55%),
    radial-gradient(circle at 80% 65%, rgba(236,72,153,0.22), transparent 55%),
    linear-gradient(135deg, rgba(14,165,233,0.15), rgba(99,102,241,0.15));
  border: 1px solid rgba(99,102,241,0.22);
}
.deck .c1 { transform: translateX(-22px) rotate(-6deg); animation: flip1 1.6s ease-in-out infinite; }
.deck .c2 { transform: translateX(0) rotate(0deg); animation: flip2 1.6s ease-in-out infinite; }
.deck .c3 { transform: translateX(22px) rotate(6deg); animation: flip3 1.6s ease-in-out infinite; }
@keyframes flip1 { 0%,100% { transform: translateX(-22px) rotate(-6deg) rotateY(0); } 50% { transform: translateX(-22px) rotate(-6deg) rotateY(180deg); } }
@keyframes flip2 { 0%,100% { transform: translateX(0) rotate(0deg) rotateY(0); } 50% { transform: translateX(0) rotate(0deg) rotateY(180deg); } }
@keyframes flip3 { 0%,100% { transform: translateX(22px) rotate(6deg) rotateY(0); } 50% { transform: translateX(22px) rotate(6deg) rotateY(180deg); } }
@keyframes starsDrift { 0%,100% { transform: translateY(0); opacity: 0.85; } 50% { transform: translateY(-6px); opacity: 1; } }
.loader p { color: #e2e8f0; margin: 0; font-weight: 700; }

.no-3d .card:hover { transform: none; box-shadow: 0 12px 30px rgba(15,23,42,0.08); }
.no-3d .stars,
.no-3d .deck .card { animation: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .stars, .deck .card { animation: none !important; }
  /* 关闭动效时，tile 不能依赖动画“从透明变可见” */
  .tile { animation: none !important; opacity: 1; transform: none; }
  button:hover { transform: none; box-shadow: none; }
}

/* Footer + modal */
.footer {
  max-width: 1024px;
  margin: 0 auto;
  padding: 18px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  color: #64748b;
  font-size: 13px;
}
.modal, .share-sheet {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(8px);
  z-index: 60;
  padding: 16px;
}
.modal-card, .share-card {
  width: min(720px, 94vw);
  max-height: min(86vh, 860px);
  overflow: auto;
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(226,232,240,0.9);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(2,6,23,0.28);
  padding: 16px;
}
.modal-head, .share-head { display:flex; align-items:center; justify-content: space-between; gap: 12px; }
.modal-head h3, .share-head h3 { margin: 0; }
.modal-body { color:#0f172a; font-size: 15px; line-height: 1.6; }
.modal-actions { margin-top: 12px; display:flex; justify-content: flex-end; }
.share-card canvas {
  width: 100%;
  height: auto;
  border-radius: 16px;
  border: 1px solid rgba(226,232,240,0.9);
  background: #fff;
}
.share-actions { display:flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.share-hint { margin: 10px 0 0; font-size: 12px; color:#64748b; }

@media (max-width: 720px) {
  /* 移动端不置顶：避免占用可视区域影响阅读 */
  header { position: static; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px; }
  .header-right { width: 100%; justify-content: space-between; align-items: flex-start; gap: 10px; }
  #today-yi-ji { text-align: left; }
  .lang-switch { padding: 6px; }
  .lang-btn { padding: 10px 12px; font-size: 14px; }
  main { padding: 12px; }
  .card { padding: 14px; }
  input, textarea, button { font-size: 17px; } /* 便于移动端点击 */
  .grid { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr; }
  .result-meta { justify-content: flex-start; }
}
