/* ---- css/00-tokens.css ---- */
/* 玄枢 design tokens — night sky + Eastern ink, gold hairlines (docs/ARCHITECTURE.md §8).
   Files in static/css are concatenated in name order into /static/css/app.css at startup. */

:root {
  /* night */
  --bg: #0b0a1a;
  --bg-deep: #07061a;
  --surface: #14122b;
  --surface-2: #1c1940;
  --surface-3: #262257;
  --veil: rgba(11, 10, 26, 0.72);

  /* gold */
  --gold: #d4af37;
  --gold-soft: #e8c66a;
  --gold-pale: #f6e3a1;
  --gold-deep: #a8822a;
  --gold-a05: rgba(212, 175, 55, 0.05);
  --gold-a10: rgba(212, 175, 55, 0.1);
  --gold-a15: rgba(212, 175, 55, 0.15);
  --gold-a25: rgba(212, 175, 55, 0.25);
  --gold-a40: rgba(212, 175, 55, 0.4);
  --gold-a70: rgba(212, 175, 55, 0.7);
  --line: rgba(212, 175, 55, 0.18);
  --line-strong: rgba(212, 175, 55, 0.36);
  --line-faint: rgba(255, 255, 255, 0.06);

  /* text (contrast ≥ 4.5:1 on --bg and --surface) */
  --ink: #ece8ff;
  --ink-2: rgba(236, 232, 255, 0.88);
  --muted: #a9a3c9;
  --muted-2: #8d87b2;

  /* accents */
  --violet: #7c5cff;
  --violet-soft: #a892ff;
  --violet-a10: rgba(124, 92, 255, 0.1);
  --violet-a20: rgba(124, 92, 255, 0.2);
  --seal: #c0392b;
  --seal-soft: #e88072;
  --seal-a12: rgba(192, 57, 43, 0.12);
  --seal-a40: rgba(192, 57, 43, 0.45);
  --jade: #2bb39a;
  --jade-soft: #5fd3bb;
  --jade-a12: rgba(43, 179, 154, 0.12);

  /* five elements (text-safe on dark) */
  --wx-wood: #58c48b;
  --wx-fire: #f07560;
  --wx-earth: #d6ad5e;
  --wx-metal: #ece3c4;
  --wx-water: #64a6f4;

  /* type */
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "Source Han Serif CN", "SimSun", serif;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* shape */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 0 0 rgba(255, 255, 255, 0.045) inset, 0 26px 60px -36px rgba(0, 0, 0, 0.9);
  --shadow-glow: 0 0 0 1px rgba(212, 175, 55, 0.26), 0 16px 46px -16px rgba(212, 175, 55, 0.38);
  --shadow-pop: 0 30px 80px -20px rgba(0, 0, 0, 0.75);
  --ring: 0 0 0 3px rgba(232, 198, 106, 0.32);

  /* layout */
  --gutter: 16px;
  --content: 1100px;
  --narrow: 820px;
  --topbar-h: 56px;
  --tabbar-h: 62px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /* motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --dur: 0.22s;

  color-scheme: dark;
}

@media (min-width: 768px) {
  :root {
    --gutter: 24px;
    --topbar-h: 64px;
  }
}

/* ---- css/10-base.css ---- */
/* Base: reset, typography, focus, selection, the night sky. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-padding-top: calc(var(--topbar-h) + var(--safe-top) + 12px);
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

body.is-locked {
  overflow: hidden;
  touch-action: none;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.3;
  color: var(--ink);
}

p,
ul,
ol,
dl,
figure,
blockquote,
pre {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: var(--gold-soft);
  text-decoration: none;
  text-underline-offset: 4px;
}

a:hover {
  text-decoration: underline;
  text-decoration-color: var(--gold-a40);
}

img,
svg {
  display: block;
  max-width: 100%;
}

svg.icon {
  display: inline-block;
  flex: none;
  vertical-align: -0.15em;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

button:disabled {
  cursor: not-allowed;
}

input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

hr {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-a40), transparent);
  margin: 24px 0;
}

table {
  border-collapse: collapse;
  width: 100%;
}

::selection {
  background: rgba(212, 175, 55, 0.35);
  color: var(--ink);
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--gold-soft);
  outline-offset: 2px;
  border-radius: 6px;
}

[hidden] {
  display: none !important;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 175, 55, 0.25) transparent;
}

/* ---------------------------------------------------------------------------------------------
   The night sky: layered CSS stars, nebulae and a faint ink-wash range of mountains. Fixed behind
   everything, no images to download, no JavaScript. */
.starfield {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320' preserveAspectRatio='none'%3E%3Cpath fill='%237c5cff' fill-opacity='.075' d='M0 236c96-26 176-96 284-86s170 118 300 92 196-150 330-130 190 128 312 110 160-86 214-74v172H0Z'/%3E%3Cpath fill='%23d4af37' fill-opacity='.04' d='M0 276c140-28 250-74 380-50s210 82 340 60 230-104 370-84 220 88 350 66v72H0Z'/%3E%3Cpath fill='%230b0a1a' fill-opacity='.55' d='M0 300c180-10 330-36 520-22s380 30 560 14 260-20 360-16v44H0Z'/%3E%3C/svg%3E") bottom / 100% min(34vh, 320px) no-repeat,
    radial-gradient(ellipse 80% 50% at 12% -8%, rgba(124, 92, 255, 0.22), transparent 62%),
    radial-gradient(ellipse 55% 38% at 96% 4%, rgba(212, 175, 55, 0.1), transparent 60%),
    radial-gradient(ellipse 70% 52% at 50% 112%, rgba(124, 92, 255, 0.14), transparent 62%),
    linear-gradient(180deg, #0d0b20 0%, var(--bg) 46%, var(--bg-deep) 100%);
}

.starfield::before,
.starfield::after {
  content: "";
  position: absolute;
  inset: -20%;
  background-repeat: repeat;
  will-change: transform;
}

.starfield::before {
  background-image:
    radial-gradient(1px 1px at 23px 41px, rgba(255, 255, 255, 0.85), transparent 60%),
    radial-gradient(1px 1px at 131px 97px, rgba(255, 255, 255, 0.55), transparent 60%),
    radial-gradient(1.3px 1.3px at 197px 23px, rgba(232, 198, 106, 0.9), transparent 60%),
    radial-gradient(1px 1px at 71px 173px, rgba(255, 255, 255, 0.5), transparent 60%),
    radial-gradient(1px 1px at 211px 191px, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(0.8px 0.8px at 157px 139px, rgba(255, 255, 255, 0.45), transparent 60%);
  background-size: 233px 233px;
  animation: star-drift 180s linear infinite, star-twinkle 7s ease-in-out infinite alternate;
}

.starfield::after {
  background-image:
    radial-gradient(1.5px 1.5px at 61px 211px, rgba(255, 255, 255, 0.9), transparent 60%),
    radial-gradient(1px 1px at 293px 47px, rgba(168, 146, 255, 0.8), transparent 60%),
    radial-gradient(1.3px 1.3px at 349px 307px, rgba(255, 255, 255, 0.6), transparent 60%),
    radial-gradient(1px 1px at 173px 359px, rgba(232, 198, 106, 0.7), transparent 60%),
    radial-gradient(0.9px 0.9px at 13px 97px, rgba(255, 255, 255, 0.5), transparent 60%);
  background-size: 377px 377px;
  animation: star-drift 260s linear infinite reverse, star-twinkle 11s ease-in-out infinite alternate-reverse;
}

@keyframes star-drift {
  to {
    transform: translate3d(-233px, -120px, 0);
  }
}

@keyframes star-twinkle {
  from {
    opacity: 0.5;
  }
  to {
    opacity: 1;
  }
}

/* skip link */
.skip-link {
  position: fixed;
  left: 12px;
  top: calc(var(--safe-top) + 8px);
  z-index: 200;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  transform: translateY(-200%);
  transition: transform var(--dur) var(--ease);
}

.skip-link:focus {
  transform: none;
}

/* ---- css/20-layout.css ---- */
/* Layout: containers, top bar + desktop nav, mobile tab bar, footer, page heads. Mobile first. */

.container {
  width: 100%;
  max-width: var(--content);
  margin-inline: auto;
  padding-left: max(var(--gutter), var(--safe-left));
  padding-right: max(var(--gutter), var(--safe-right));
}

.container--narrow {
  max-width: var(--narrow);
}

.main {
  flex: 1 0 auto;
  width: 100%;
  padding-bottom: 32px;
}

.main:focus {
  outline: none;
}

/* ---- top bar ------------------------------------------------------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: var(--safe-top);
  background: rgba(11, 10, 26, 0.74);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--gold-soft);
}

.brand:hover {
  text-decoration: none;
}

.brand__name {
  font-family: var(--font-serif);
  font-size: 18px;
  letter-spacing: 0.36em;
  margin-right: -0.36em;
  background: linear-gradient(100deg, var(--gold-soft), #fff3c4 40%, var(--gold) 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.topnav {
  display: none;
}

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

.credits-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--gold-a40);
  background: var(--gold-a05);
  color: var(--gold-soft);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  transition: border-color var(--dur), background var(--dur);
}

.credits-pill:hover {
  text-decoration: none;
  border-color: var(--gold-a70);
  background: var(--gold-a10);
}

.credits-pill__vip {
  padding: 0 5px;
  border-radius: 5px;
  background: var(--violet-a20);
  color: var(--violet-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.credits-pill.is-bumped {
  animation: bump 0.6s var(--ease-spring);
}

.lang-toggle,
.topbar__login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  min-width: 44px;
  padding: 0 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.06em;
  position: relative;
  transition: color var(--dur), border-color var(--dur);
}

.lang-toggle::after,
.topbar__login::after {
  content: "";
  position: absolute;
  inset: -5px -2px;
}

.lang-toggle:hover,
.topbar__login:hover {
  text-decoration: none;
  color: var(--gold-soft);
  border-color: var(--gold-a40);
}

.topbar__login {
  display: none;
  border-color: transparent;
  color: var(--ink);
}

@media (min-width: 768px) {
  .topnav {
    display: flex;
    align-items: stretch;
    height: 100%;
    gap: 4px;
  }

  .topnav__link {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0 16px;
    color: var(--muted);
    font-size: 15px;
    letter-spacing: 0.08em;
    transition: color var(--dur);
  }

  .topnav__link::after {
    content: "";
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    opacity: 0;
    transform: scaleX(0.4);
    transition: opacity var(--dur), transform var(--dur) var(--ease);
  }

  .topnav__link:hover {
    text-decoration: none;
    color: var(--ink);
  }

  .topnav__link.is-active {
    color: var(--gold-soft);
  }

  .topnav__link.is-active::after {
    opacity: 1;
    transform: none;
  }

  .topbar__login {
    display: inline-flex;
  }

  .brand__name {
    font-size: 19px;
  }
}

/* ---- announcement ------------------------------------------------------------------------ */
.announcement {
  border-bottom: 1px solid var(--gold-a25);
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.04), rgba(212, 175, 55, 0.13), rgba(212, 175, 55, 0.04));
  color: var(--gold-soft);
  font-size: 14px;
}

.announcement__inner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
}

.announcement__text {
  flex: 1;
  padding: 8px 0;
}

/* ---- bottom tab bar (mobile) ----------------------------------------------------------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0 max(8px, var(--safe-right)) var(--safe-bottom) max(8px, var(--safe-left));
  background: rgba(11, 10, 26, 0.9);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--line);
}

.tabbar::before {
  content: "";
  position: absolute;
  left: 15%;
  right: 15%;
  top: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-a70), transparent);
  opacity: 0.5;
}

.tabbar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  transition: color var(--dur);
}

.tabbar__item:hover {
  text-decoration: none;
}

.tabbar__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 30px;
  border-radius: var(--radius-pill);
  transition: background var(--dur), transform var(--dur) var(--ease-spring);
}

.tabbar__item.is-active {
  color: var(--gold-soft);
}

.tabbar__item.is-active .tabbar__icon {
  background: var(--gold-a15);
  box-shadow: inset 0 0 0 1px var(--gold-a25);
}

.tabbar__item:active .tabbar__icon {
  transform: scale(0.92);
}

@media (min-width: 768px) {
  .tabbar {
    display: none;
  }
}

/* ---- footer -------------------------------------------------------------------------------- */
.footer {
  margin-top: 56px;
  border-top: 1px solid var(--line);
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 20px);
  background: linear-gradient(180deg, transparent, rgba(7, 6, 26, 0.6));
}

.footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 32px;
  padding-bottom: 8px;
  text-align: center;
}

.footer__brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--gold-soft);
  font-family: var(--font-serif);
  letter-spacing: 0.3em;
  opacity: 0.9;
}

.footer__disclaimer {
  max-width: 640px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.8;
}

.footer__ai {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 6px;
}

.footer__links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.footer__links a:hover {
  color: var(--gold-soft);
}

.footer__rights,
.footer__icp {
  color: var(--muted-2);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.footer__icp a {
  color: inherit;
}

@media (min-width: 768px) {
  .footer {
    padding-bottom: 28px;
  }
}

/* ---- page heads & sections ---------------------------------------------------------------- */
.page-head {
  padding-top: 28px;
  padding-bottom: 20px;
}

.page-head__title {
  font-size: 30px;
}

.page-head__sub {
  margin-top: 8px;
  color: var(--muted);
}

@media (min-width: 768px) {
  .page-head {
    padding-top: 44px;
  }

  .page-head__title {
    font-size: 38px;
  }
}

.section {
  margin-top: 40px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-head__title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 24px;
}

.section-head__count {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.section-head__sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

@media (min-width: 768px) {
  .section {
    margin-top: 56px;
  }

  .section-head__title {
    font-size: 28px;
  }
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 18px;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumb a {
  color: var(--muted);
}

.breadcrumb a:hover {
  color: var(--gold-soft);
}

.breadcrumb__sep {
  color: var(--gold-a40);
}

.breadcrumb [aria-current] {
  color: var(--ink-2);
}

/* ---- simple grids & stacks ---------------------------------------------------------------- */
.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stack > * {
  min-width: 0;
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.cluster--center {
  justify-content: center;
}

.cluster--tight {
  gap: 6px;
}

.grid-2,
.grid-3 {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-2--narrow {
    max-width: 480px;
  }

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

@media (min-width: 900px) {
  .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.span-all {
  grid-column: 1 / -1;
}

.hairline {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-a40), transparent);
  margin: 18px 0;
}

.hairline--spaced {
  margin: 40px 0 0;
}

.center {
  text-align: center;
  justify-content: center;
}

div.center {
  display: flex;
}

/* ---- css/30-components.css ---- */
/* Components: buttons, cards, badges, tabs, chips, segmented controls, inputs, checks, switches,
   toasts, modals/sheets, alerts, empty states, skeletons, spinners, seals. */

/* ---- buttons ------------------------------------------------------------------------------ */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: filter var(--dur), background var(--dur), border-color var(--dur), color var(--dur), box-shadow var(--dur), transform 0.12s;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  color: #1a1405;
  background: linear-gradient(180deg, #f3d989 0%, var(--gold-soft) 38%, var(--gold) 78%, #c19a31 100%);
  border-color: rgba(255, 238, 180, 0.5);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.45) inset, 0 12px 30px -12px rgba(212, 175, 55, 0.75);
  font-weight: 600;
}

.btn--primary:hover {
  filter: brightness(1.07) saturate(1.05);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 16px 36px -12px rgba(212, 175, 55, 0.9);
}

.btn--secondary {
  color: var(--gold-soft);
  background: var(--gold-a05);
  border-color: var(--gold-a40);
}

.btn--secondary:hover {
  background: var(--gold-a10);
  border-color: var(--gold-a70);
}

.btn--ghost {
  color: var(--muted);
  background: transparent;
}

.btn--ghost:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
}

.btn--danger {
  color: var(--seal-soft);
  background: var(--seal-a12);
  border-color: var(--seal-a40);
}

.btn--danger:hover {
  background: rgba(192, 57, 43, 0.2);
}

.btn--danger-text {
  color: var(--seal-soft);
}

.btn--sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13.5px;
  border-radius: 10px;
}

/* keep a 44px touch target around small buttons */
.btn--sm::after {
  content: "";
  position: absolute;
  inset: -4px;
}

.btn--lg {
  min-height: 52px;
  padding: 0 26px;
  font-size: 16px;
  border-radius: 14px;
}

.btn--block {
  display: flex;
  width: 100%;
}

.btn--wide {
  width: 100%;
}

@media (min-width: 640px) {
  .btn--wide {
    width: auto;
    min-width: 13rem;
  }
}

.btn--icon {
  width: 46px;
  min-width: 46px;
  padding: 0;
}

.btn > .btn__spinner {
  display: none;
}

.htmx-request .btn > .btn__spinner,
.btn.is-busy > .btn__spinner {
  display: inline-block;
}

.htmx-request button[type="submit"],
.btn.is-busy {
  pointer-events: none;
  filter: saturate(0.85);
}

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  color: var(--muted);
  transition: color var(--dur), background var(--dur);
}

.icon-btn::after {
  content: "";
  position: absolute;
  inset: -2px;
}

.icon-btn:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
}

.icon-btn--sm {
  width: 34px;
  height: 34px;
}

.icon-btn--sm::after {
  inset: -5px;
}

.icon-btn--danger:hover {
  color: var(--seal-soft);
  background: var(--seal-a12);
}

/* ---- cards --------------------------------------------------------------------------------- */
.card {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 42%),
    rgba(20, 18, 43, 0.82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-card);
  padding: 20px;
  min-width: 0;
}

.card + .card {
  margin-top: 16px;
}

.card--glow {
  border-color: var(--gold-a40);
  box-shadow: var(--shadow-card), 0 0 60px -28px rgba(212, 175, 55, 0.5);
}

.card--flush {
  padding: 0;
  overflow: hidden;
}

@media (min-width: 768px) {
  .card {
    padding: 26px 28px;
  }

  .card--flush {
    padding: 0;
  }
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card__head--pad {
  padding: 18px 20px 0;
}

.card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
}

.card__title .icon {
  color: var(--gold-soft);
}

.card__sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

/* ---- badges & tags ------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 0 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--gold-a40);
  background: var(--gold-a10);
  color: var(--gold-soft);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.badge--violet {
  border-color: rgba(124, 92, 255, 0.45);
  background: var(--violet-a10);
  color: var(--violet-soft);
}

.badge--jade {
  border-color: rgba(43, 179, 154, 0.45);
  background: var(--jade-a12);
  color: var(--jade-soft);
}

.badge--seal {
  border-color: var(--seal-a40);
  background: var(--seal-a12);
  color: var(--seal-soft);
}

.badge--muted {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.badge__was {
  opacity: 0.6;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-faint);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.tag--jade {
  color: var(--jade-soft);
  background: var(--jade-a12);
}

.seal {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 10px;
  border: 1.5px solid var(--seal-a40);
  background: radial-gradient(circle at 30% 25%, rgba(232, 128, 114, 0.2), rgba(192, 57, 43, 0.14));
  color: var(--seal-soft);
  font-family: var(--font-serif);
  font-size: 20px;
  box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 4px rgba(192, 57, 43, 0.25);
}

.seal--sm {
  width: 34px;
  height: 34px;
  font-size: 16px;
  border-radius: 8px;
}

/* ---- tabs (link tabs) ------------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(7, 6, 26, 0.45);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tabs__tab {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
  transition: color var(--dur), background var(--dur);
}

.tabs__tab:hover {
  color: var(--ink);
  text-decoration: none;
}

.tabs__tab.is-active,
.tabs__tab[aria-selected="true"] {
  color: var(--gold-soft);
  background: var(--gold-a15);
  box-shadow: inset 0 0 0 1px var(--gold-a40);
}

/* ---- chips (radio/checkbox pills) ------------------------------------------------------- */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-row--scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  margin-inline: calc(var(--gutter) * -1);
  padding: 2px var(--gutter) 6px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent);
}

.chip-row--scroll::-webkit-scrollbar {
  display: none;
}

.chip {
  position: relative;
  display: inline-flex;
  flex: none;
}

.chip > input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.chip > span,
.chip--link,
.chip--ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(7, 6, 26, 0.35);
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--dur), border-color var(--dur), background var(--dur), box-shadow var(--dur);
}

.chip > span:hover,
.chip--link:hover,
.chip--ghost:hover {
  color: var(--ink);
  border-color: var(--gold-a40);
  text-decoration: none;
}

.chip > input:checked + span,
.chip--link.is-active {
  color: var(--gold-soft);
  border-color: var(--gold-a70);
  background: var(--gold-a15);
  box-shadow: 0 0 0 1px var(--gold-a25) inset;
}

.chip > input:focus-visible + span {
  outline: 2px solid var(--gold-soft);
  outline-offset: 2px;
}

.chip > input:disabled + span {
  opacity: 0.45;
  cursor: not-allowed;
}

.chip--ghost {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-style: dashed;
}

@media (pointer: coarse) {
  .chip > span,
  .chip--link {
    min-height: 44px;
  }
}

/* ---- segmented control ------------------------------------------------------------------ */
.segmented {
  display: inline-flex;
  max-width: 100%;
  padding: 4px;
  gap: 2px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(7, 6, 26, 0.5);
}

.segmented__item {
  position: relative;
  display: inline-flex;
  flex: 1 1 auto;
}

.segmented__item > input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.segmented__item > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 3.6em;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--dur), background var(--dur), box-shadow var(--dur);
}

.segmented__item > span:hover {
  color: var(--ink);
}

.segmented__item > input:checked + span {
  color: var(--gold-soft);
  background: var(--gold-a15);
  box-shadow: inset 0 0 0 1px var(--gold-a40);
}

.segmented__item > input:focus-visible + span {
  outline: 2px solid var(--gold-soft);
  outline-offset: 1px;
}

.segmented--sm .segmented__item > span {
  min-height: 34px;
  min-width: 3em;
  padding: 0 11px;
  font-size: 13px;
}

@media (pointer: coarse) {
  .segmented__item > span {
    min-height: 42px;
  }

  .segmented--sm .segmented__item > span {
    min-height: 38px;
  }
}

/* ---- inputs ---------------------------------------------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.field__label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--ink-2);
  font-size: 14px;
}

.field__opt {
  color: var(--muted-2);
  font-size: 12px;
}

.field__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.field__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.field__hint {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.65;
}

.field__error {
  color: var(--seal-soft);
  font-size: 13px;
}

.input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(7, 6, 26, 0.62);
  color: var(--ink);
  font-size: 16px; /* ≥16px: no zoom on iOS */
  line-height: 1.4;
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur);
  -webkit-appearance: none;
  appearance: none;
}

.input::placeholder {
  color: rgba(169, 163, 201, 0.62);
}

.input:hover {
  border-color: var(--gold-a40);
}

.input:focus,
.input:focus-visible {
  outline: none;
  border-color: var(--gold-a70);
  box-shadow: var(--ring);
  background: rgba(7, 6, 26, 0.8);
}

.input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.input[readonly] {
  color: var(--ink-2);
  background: rgba(7, 6, 26, 0.4);
}

.input:user-invalid {
  border-color: var(--seal-a40);
}

.select {
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d4af37' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  text-overflow: ellipsis;
}

.select option {
  background: var(--surface);
  color: var(--ink);
}

.textarea {
  min-height: 96px;
  padding: 12px 14px;
  line-height: 1.7;
  resize: vertical;
}

.textarea-wrap {
  position: relative;
}

.textarea-wrap .textarea {
  padding-bottom: 28px;
}

.textarea-wrap__count {
  position: absolute;
  right: 12px;
  bottom: 8px;
  color: var(--muted-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.input--icon {
  padding-left: 42px;
}

.input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.input--code {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: var(--font-mono);
}

.input--num {
  width: 6.5em;
  min-height: 40px;
}

.input-group {
  display: flex;
  gap: 8px;
}

.input-group > .input {
  flex: 1;
  min-width: 0;
}

.search {
  position: relative;
  display: block;
  flex: 1;
  min-width: 0;
}

.search__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search__input {
  padding-left: 42px;
  border-radius: var(--radius-pill);
}

/* checkbox */
.check {
  position: relative;
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 32px;
  padding: 4px 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.55;
  cursor: pointer;
}

.check > input[type="checkbox"],
.check > input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.check__box {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border-radius: 6px;
  border: 1.5px solid var(--gold-a40);
  background: rgba(7, 6, 26, 0.6);
  transition: background var(--dur), border-color var(--dur);
}

.check > input:checked + .check__box {
  border-color: var(--gold);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f6e3a1' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5.5 12.5 4 4L18.5 7.5'/%3E%3C/svg%3E") center / 15px no-repeat,
    var(--gold-a40);
}

.check > input:focus-visible + .check__box {
  outline: 2px solid var(--gold-soft);
  outline-offset: 2px;
}

.check--inline {
  min-height: 34px;
  font-size: 13px;
}

/* switch */
.switch {
  position: relative;
  display: inline-flex;
  flex: none;
  width: 48px;
  height: 28px;
}

.switch__input {
  position: absolute;
  inset: -8px;
  width: calc(100% + 16px);
  height: calc(100% + 16px);
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.switch__input:disabled {
  cursor: not-allowed;
}

.switch__track {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(7, 6, 26, 0.75);
  transition: background var(--dur), border-color var(--dur);
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--muted-2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform var(--dur) var(--ease-spring), background var(--dur);
}

.switch__input:checked + .switch__track {
  background: rgba(212, 175, 55, 0.32);
  border-color: var(--gold-a70);
}

.switch__input:checked + .switch__track::after {
  transform: translateX(20px);
  background: var(--gold-pale);
}

.switch__input:focus-visible + .switch__track {
  outline: 2px solid var(--gold-soft);
  outline-offset: 2px;
}

.switch__input:disabled + .switch__track {
  opacity: 0.45;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-faint);
  background: rgba(7, 6, 26, 0.3);
}

.toggle-row.is-disabled {
  opacity: 0.55;
}

.toggle-row__label {
  color: var(--ink-2);
  font-size: 14px;
}

.toggle-row__text {
  min-width: 0;
}

/* ---- listbox (autocomplete) -------------------------------------------------------------- */
.listbox {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  max-height: 288px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: rgba(28, 25, 64, 0.98);
  box-shadow: var(--shadow-pop);
  overscroll-behavior: contain;
}

.listbox__option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
}

.listbox__option[aria-selected="true"],
.listbox__option:hover {
  background: var(--gold-a15);
  color: var(--gold-soft);
}

.listbox__empty {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 14px;
}

/* ---- alerts & notes ------------------------------------------------------------------------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--violet-a20);
  background: var(--violet-a10);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.6;
}

.alert .icon {
  margin-top: 2px;
}

.alert--info .icon {
  color: var(--violet-soft);
}

.alert--error {
  border-color: var(--seal-a40);
  background: var(--seal-a12);
}

.alert--error .icon {
  color: var(--seal-soft);
}

.alert--warn {
  border-color: var(--gold-a40);
  background: var(--gold-a10);
}

.alert--warn .icon {
  color: var(--gold-soft);
}

.alert--success {
  border-color: rgba(43, 179, 154, 0.4);
  background: var(--jade-a12);
}

.alert__body {
  flex: 1;
  min-width: 0;
}

.alert__list {
  margin: 4px 0 0;
  padding-left: 1.2em;
  list-style: disc;
}

.alert__list li + li {
  margin-top: 2px;
}

.alert + * {
  margin-top: 14px;
}

.banner {
  margin-bottom: 18px;
}

.note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.65;
}

.note .icon {
  margin-top: 3px;
}

.note--warn {
  color: var(--gold-soft);
}

.notice-box {
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(7, 6, 26, 0.35);
  font-size: 14.5px;
  line-height: 1.7;
}

.notice-box > * + * {
  margin-top: 10px;
}

.notice-box__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.notice-box--gold {
  border-color: var(--gold-a40);
  background: var(--gold-a05);
}

.notice-box--gold .notice-box__title {
  color: var(--gold-soft);
}

.notice-box--seal {
  border-color: var(--seal-a40);
  background: rgba(192, 57, 43, 0.07);
}

.notice-box--seal .notice-box__title {
  color: var(--seal-soft);
}

.disclaimer {
  margin-top: 26px;
  text-align: center;
  color: var(--muted-2);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.disclaimer::before,
.disclaimer::after {
  content: "—";
  margin: 0 8px;
  color: var(--gold-a40);
}

/* ---- toasts -------------------------------------------------------------------------------- */
.toast-stack {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(var(--safe-top) + 12px);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 460px;
  width: auto;
  min-height: 46px;
  padding: 10px 10px 10px 16px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: rgba(28, 25, 64, 0.97);
  box-shadow: var(--shadow-pop);
  color: var(--ink);
  font-size: 14px;
  pointer-events: auto;
  animation: toast-in 0.36s var(--ease) both;
}

.toast.is-leaving {
  animation: toast-out 0.28s var(--ease) both;
}

.toast--success .icon,
.toast--success .toast__icon {
  color: var(--jade-soft);
}

.toast--error {
  border-color: var(--seal-a40);
}

.toast--error .icon,
.toast--error .toast__icon {
  color: var(--seal-soft);
}

.toast--info .icon {
  color: var(--violet-soft);
}

.toast__text {
  flex: 1;
}

.toast__close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--muted);
}

.toast__close:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
}

/* ---- dialogs: modal + bottom sheet ------------------------------------------------------- */
dialog {
  padding: 0;
  border: 0;
  margin: auto;
  background: transparent;
  color: inherit;
  max-width: none;
  max-height: none;
}

dialog::backdrop {
  background: rgba(5, 4, 15, 0.72);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.modal {
  width: min(100vw - 32px, 440px);
}

.modal__panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 40%), var(--surface);
  box-shadow: var(--shadow-pop);
  animation: rise-in 0.32s var(--ease) both;
}

.modal__title {
  font-size: 19px;
}

.modal__body {
  color: var(--muted);
  font-size: 14.5px;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.sheet {
  width: 100%;
  max-width: 100%;
  margin: auto 0 0;
}

.sheet__panel {
  max-height: 88vh; /* browsers without dvh (older WeChat / X5 WebViews) */
  max-height: min(88vh, 88dvh);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 30%), var(--surface);
  box-shadow: var(--shadow-pop);
  padding-bottom: var(--safe-bottom);
  animation: sheet-in 0.36s var(--ease) both;
}

.sheet__panel::before {
  content: "";
  display: block;
  width: 40px;
  height: 4px;
  margin: 10px auto 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.18);
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px 12px 20px;
  border-bottom: 1px solid var(--line);
}

.sheet__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
}

.sheet__title .icon {
  color: var(--gold-soft);
}

.sheet__body {
  padding: 18px 20px 22px;
}

@media (min-width: 640px) {
  .sheet {
    width: min(100vw - 48px, 520px);
    margin: auto;
  }

  .sheet__panel {
    border-radius: var(--radius-lg);
    border-bottom: 1px solid var(--line-strong);
    padding-bottom: 0;
    animation: rise-in 0.32s var(--ease) both;
  }

  .sheet__panel::before {
    display: none;
  }
}

@keyframes sheet-in {
  from {
    transform: translateY(40px);
    opacity: 0.4;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
}

/* ---- empty / skeleton / spinner -------------------------------------------------------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 20px;
  text-align: center;
}

.empty__glyph {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  margin-bottom: 18px;
  border-radius: 50%;
  border: 1px solid var(--gold-a40);
  background: radial-gradient(circle at 35% 30%, rgba(232, 198, 106, 0.16), rgba(212, 175, 55, 0.04));
  color: var(--gold-soft);
  font-family: var(--font-serif);
  font-size: 26px;
  box-shadow: var(--shadow-glow);
}

.empty__title {
  font-size: 18px;
}

.empty__body {
  margin-top: 8px;
  max-width: 360px;
  color: var(--muted);
  font-size: 14px;
}

.skeleton {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 0;
}

.skeleton__line {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(232, 198, 106, 0.12) 50%, rgba(255, 255, 255, 0.05) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}

.skeleton__line:nth-child(3n + 1) {
  width: 92%;
}

.skeleton__line:nth-child(3n + 2) {
  width: 78%;
}

.skeleton__line:nth-child(3n) {
  width: 55%;
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

.spinner {
  display: inline-block;
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  opacity: 0.85;
  animation: spin 0.8s linear infinite;
}

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

.pulse-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold-soft);
  box-shadow: 0 0 0 0 rgba(232, 198, 106, 0.6);
  animation: pulse 1.6s ease-out infinite;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 8px rgba(232, 198, 106, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(232, 198, 106, 0);
  }
}

@keyframes bump {
  40% {
    transform: scale(1.12);
  }
}

/* htmx indicators (htmx's own inline indicator styles are disabled for the CSP) */
.htmx-indicator {
  opacity: 0;
  transition: opacity 0.2s;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}

.load-more {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.load-more:empty {
  display: none;
}

/* ---- css/40-home.css ---- */
/* Home: hero + astrolabe, daily widgets, catalog (search, chips, category sections, module cards),
   bonus band. */

.eyebrow {
  color: rgba(232, 198, 106, 0.92);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

.gold-text {
  background-image: linear-gradient(100deg, var(--gold-soft) 0%, #fff3c4 22%, var(--gold) 45%, var(--gold-soft) 70%, #fff3c4 85%, var(--gold) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: text-shimmer 9s linear infinite;
}

@keyframes text-shimmer {
  from {
    background-position: 200% center;
  }
  to {
    background-position: -200% center;
  }
}

/* ---- hero ---------------------------------------------------------------------------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 28px;
  padding-top: 28px;
}

.hero__copy {
  position: relative;
  z-index: 1;
}

.hero__title {
  margin-top: 16px;
  font-size: clamp(38px, 11vw, 66px);
  line-height: 1.12;
  letter-spacing: 0.04em;
}

.hero__line {
  display: block;
}

.hero__line.gold-text {
  padding-bottom: 4px;
}

.hero__subtitle {
  margin-top: 18px;
  max-width: 34em;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.85;
}

.hero__cta {
  margin-top: 26px;
}

.hero__cta .btn {
  flex: 1 1 auto;
}

.hero__features {
  display: grid;
  gap: 10px;
  margin-top: 28px;
  color: var(--muted);
  font-size: 14px;
}

.hero__features li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero__features .icon {
  color: var(--gold-soft);
}

.hero__art {
  position: relative;
  width: min(80vw, 400px);
  margin: 0 auto;
  order: -1;
  aspect-ratio: 1;
}

.hero__glow {
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.35), rgba(124, 92, 255, 0) 70%);
  filter: blur(30px);
  animation: breathe 6s ease-in-out infinite;
}

.astrolabe {
  position: relative;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 40px rgba(212, 175, 55, 0.18));
}

.astrolabe__ring {
  transform-box: view-box;
  transform-origin: 50% 50%;
}

.astrolabe__ring--outer {
  animation: spin 140s linear infinite;
}

.astrolabe__ring--inner {
  animation: spin 260s linear infinite reverse;
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.06);
  }
}

@media (min-width: 480px) {
  .hero__cta .btn {
    flex: 0 0 auto;
  }

  .hero__features {
    grid-template-columns: repeat(3, auto);
    justify-content: start;
    gap: 10px 22px;
  }
}

@media (min-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 24px;
    padding-top: 64px;
    padding-bottom: 8px;
  }

  .hero__art {
    order: 0;
    width: 100%;
    max-width: 440px;
  }

  .hero__subtitle {
    font-size: 16px;
  }
}

/* ---- widgets ----------------------------------------------------------------------------- */
.widget-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

@media (min-width: 768px) {
  .widget-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.widget {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    radial-gradient(ellipse 80% 60% at 100% 0%, rgba(124, 92, 255, 0.14), transparent 70%),
    rgba(20, 18, 43, 0.82);
  box-shadow: var(--shadow-card);
}

.widget__head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.widget__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
}

.widget__title .icon {
  color: var(--gold-soft);
}

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

.widget__body {
  min-height: 72px;
}

.widget__more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  min-height: 36px;
  font-size: 14px;
}

.daily {
  min-height: 60px;
}

/* ---- catalog ----------------------------------------------------------------------------- */
.catalog {
  margin-top: 36px;
}

.catalog__tools {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 8px;
}

.catalog__tools .chip-row {
  flex-wrap: nowrap;
  overflow-x: auto;
  margin-inline: calc(var(--gutter) * -1);
  padding: 2px var(--gutter) 6px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.catalog__tools .chip-row::-webkit-scrollbar {
  display: none;
}

.catalog__submit {
  align-self: flex-start;
}

.catalog__status {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
}

.catalog--page {
  margin-top: 4px;
}

.page-head__title .section-head__count {
  margin-left: 4px;
}

@media (min-width: 900px) {
  .catalog__tools {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .catalog__tools .search {
    flex: 0 0 300px;
    order: 2;
  }

  .catalog__tools .chip-row {
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    overflow: visible;
  }
}

.category {
  margin-top: 30px;
}

.category__head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.category__titles {
  min-width: 0;
}

.category__title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 21px;
}

.category__count {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 400;
  color: var(--muted-2);
}

.category__blurb {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13.5px;
}

.card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

@media (min-width: 420px) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
}

.module-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 42%),
    rgba(20, 18, 43, 0.82);
  box-shadow: var(--shadow-card);
  color: var(--ink);
  transition: transform 0.3s var(--ease), border-color 0.3s, box-shadow 0.3s;
  overflow: hidden;
}

.module-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 100% 0%, rgba(212, 175, 55, 0.12), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.module-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--gold-a40);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

.module-card:hover::before {
  opacity: 1;
}

.module-card:active {
  transform: scale(0.99);
}

.module-card.is-disabled {
  opacity: 0.55;
}

.module-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.module-card__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--gold-a40);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.16), transparent);
  color: var(--gold-soft);
  transition: border-color 0.3s;
}

.module-card:hover .module-card__icon {
  border-color: var(--gold-a70);
}

.module-card__name {
  margin-top: 14px;
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.module-card__summary {
  display: -webkit-box;
  margin-top: 6px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
}

.module-card__foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 12px;
  min-height: 30px;
}

.module-card__go {
  margin-left: auto;
  color: transparent;
  transition: color 0.3s, transform 0.3s var(--ease);
}

.module-card:hover .module-card__go {
  color: var(--gold-soft);
  transform: translateX(2px);
}

/* ---- bonus band ------------------------------------------------------------------------- */
.bonus {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  margin-top: 48px;
  overflow: hidden;
}

.bonus::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.18), transparent 70%);
  pointer-events: none;
}

.bonus__icon {
  color: var(--gold-soft);
}

.bonus__title {
  font-size: 20px;
}

.bonus__body {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

@media (min-width: 640px) {
  .bonus {
    flex-direction: row;
    align-items: center;
  }

  .bonus__text {
    flex: 1;
  }
}

/* ---- css/50-forms.css ---- */
/* Module form frame and form components: birth form, city picker, question box, image upload. */

.module-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding-top: 18px;
}

.module-head__icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--gold-a40);
  background: radial-gradient(circle at 35% 30%, rgba(232, 198, 106, 0.22), rgba(212, 175, 55, 0.03));
  color: var(--gold-soft);
  box-shadow: var(--shadow-glow);
}

.module-head__text {
  min-width: 0;
}

.module-head__title {
  font-size: 27px;
  line-height: 1.25;
}

.module-head__summary {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.75;
}

.module-head__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12.5px;
}

@media (min-width: 768px) {
  .module-head__icon {
    width: 68px;
    height: 68px;
  }

  .module-head__title {
    font-size: 36px;
  }
}

.module-form {
  margin-top: 8px;
}

.module-form__body {
  gap: 22px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
}

.form-actions--start {
  justify-content: flex-start;
  margin-top: 4px;
}

.form-actions--end {
  justify-content: flex-end;
  align-self: end;
  margin-top: 0;
}

.module-result:empty {
  display: none;
}

.module-result {
  margin-top: 22px;
  scroll-margin-top: calc(var(--topbar-h) + var(--safe-top) + 12px);
}

.module-custom {
  margin-top: 8px;
}

/* ---- birth form ------------------------------------------------------------------------- */
.birth {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.birth + .birth {
  margin-top: 6px;
  padding-top: 22px;
  border-top: 1px dashed var(--line);
}

.birth__legend {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  margin-bottom: 18px;
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--ink);
}

.birth__legend::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  transform: rotate(45deg);
  border: 1px solid var(--gold);
  background: var(--gold-a25);
}

.date-row {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 8px;
}

.time-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 8px;
}

.birth__save {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* city picker */
.city {
  position: relative;
}

.city__search {
  position: relative;
}

.city__picked {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 6px 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gold-a40);
  background: var(--gold-a05);
}

.city__pin {
  color: var(--gold-soft);
}

.city__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.city__coord {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* question box suggestions */
.suggest {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.suggest__label {
  color: var(--muted-2);
  font-size: 12px;
  margin-right: 2px;
}

.consent__hint {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.consent__hint .icon {
  margin-top: 3px;
  color: var(--jade-soft);
}

/* ---- image upload ------------------------------------------------------------------------ */
.upload__guide {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.upload__guide .icon {
  margin-top: 3px;
  color: var(--gold-soft);
}

.upload__drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 168px;
  padding: 24px;
  border-radius: var(--radius);
  border: 1.5px dashed var(--gold-a40);
  background:
    radial-gradient(ellipse 60% 70% at 50% 40%, rgba(212, 175, 55, 0.08), transparent 70%),
    rgba(7, 6, 26, 0.35);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur), background var(--dur);
}

.upload__drop:hover,
.upload.is-dragging .upload__drop {
  border-color: var(--gold-a70);
  background-color: rgba(212, 175, 55, 0.06);
}

.upload__icon {
  color: var(--gold-soft);
}

.upload__cta {
  color: var(--ink);
  font-size: 15px;
}

.upload__hint {
  color: var(--muted);
  font-size: 12.5px;
}

.upload.is-busy .upload__icon {
  animation: breathe 1.4s ease-in-out infinite;
}

.upload__previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.upload__previews img {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gold-a40);
  background: var(--bg-deep);
}

.upload__previews:has(img:only-child) {
  grid-template-columns: minmax(0, 1fr);
}

.upload__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.upload__count {
  margin-right: auto;
  color: var(--muted);
  font-size: 13px;
}

/* ---- css/60-reading.css ---- */
/* AI reading: panel, streaming prose, follow-up chat, share, answer page, feedback stars. */

.result-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.result-section > .card + .card,
.module-output > .card + .card {
  margin-top: 0;
}

.module-output {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.module-output:empty {
  display: none;
}

/* module error box (a broken module never breaks the page) */
.module-error {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px dashed var(--seal-a40);
  background: rgba(192, 57, 43, 0.06);
}

.module-error__glyph {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 10px;
  border: 1px solid var(--seal-a40);
  color: var(--seal-soft);
  font-family: var(--font-serif);
  font-size: 18px;
}

.module-error__title {
  color: var(--ink);
  font-weight: 600;
}

.module-error__body {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13.5px;
}

/* ---- the reading panel ------------------------------------------------------------------ */
.reading {
  padding: 0;
  overflow: hidden;
  scroll-margin-top: calc(var(--topbar-h) + var(--safe-top) + 12px);
}

.reading__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.06), transparent 60%);
}

.reading__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
}

.reading__title .icon {
  color: var(--gold-soft);
}

.reading__meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.reading__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--gold-soft);
  font-size: 12.5px;
}

.reading__body {
  padding: 22px 20px 26px;
}

@media (min-width: 768px) {
  .reading__head {
    padding: 18px 28px;
  }

  .reading__body {
    padding: 30px 34px 32px;
  }
}

.reading__idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 10px 0 6px;
  text-align: center;
}

.reading__orb {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.28), rgba(124, 92, 255, 0) 68%);
  animation: breathe 4s ease-in-out infinite;
}

.reading__hint {
  max-width: 28em;
  color: var(--muted);
  font-size: 14px;
}

.reading__connecting {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--gold-soft);
  font-size: 14px;
}

.reading__pane + .reading__pane,
.reading__text + .reading__pane {
  margin-top: 16px;
}

.reading__note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13.5px;
}

.reading__controls {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.reading__done {
  margin-top: 10px;
}

.reading__done .cluster {
  margin-top: 18px;
}

.reading__saved {
  margin-top: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}

.reading__text.is-streaming {
  min-height: 120px;
}

/* ---- prose (AI Markdown) ---------------------------------------------------------------- */
.prose {
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.95;
  overflow-wrap: anywhere;
}

.prose > * + * {
  margin-top: 0.9em;
}

.prose h1,
.prose h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 1.8em;
  font-size: 19px;
  color: var(--gold-soft);
  letter-spacing: 0.06em;
}

.prose > h1:first-child,
.prose > h2:first-child {
  margin-top: 0;
}

.prose h1::before,
.prose h2::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  transform: rotate(45deg);
  border: 1px solid var(--gold);
  background: var(--gold-a25);
}

.prose h3,
.prose h4 {
  margin-top: 1.5em;
  font-size: 16.5px;
  color: var(--ink);
}

.prose strong,
.prose b {
  color: var(--gold-soft);
  font-weight: 600;
}

.prose em {
  color: var(--violet-soft);
  font-style: normal;
}

.prose ul,
.prose ol {
  padding-left: 1.3em;
}

.prose li + li {
  margin-top: 0.35em;
}

.prose ul > li {
  position: relative;
}

.prose ul > li::before {
  content: "";
  position: absolute;
  left: -1em;
  top: 0.85em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold-a70);
}

.prose ol {
  list-style: decimal;
}

.prose ol > li::marker {
  color: var(--gold-soft);
}

.prose blockquote {
  padding-left: 16px;
  border-left: 2px solid var(--gold-a40);
  color: var(--muted);
}

.prose hr {
  margin: 1.6em 0;
}

.prose table {
  display: block;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6;
}

.prose th,
.prose td {
  padding: 8px 12px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.prose th {
  color: var(--gold-soft);
  background: var(--gold-a05);
  font-weight: 500;
}

.prose code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.prose--sm {
  font-size: 15px;
  line-height: 1.85;
}

/* blinking caret after the last block while streaming */
.prose.is-streaming > :last-child:not(ul):not(ol)::after,
.prose.is-streaming > ul:last-child > li:last-child::after,
.prose.is-streaming > ol:last-child > li:last-child::after,
.prose.is-streaming:empty::after {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: -0.15em;
  border-radius: 1px;
  background: var(--gold-soft);
  animation: caret 1s steps(1) infinite;
}

@keyframes caret {
  50% {
    opacity: 0;
  }
}

.typing {
  display: inline-flex;
  gap: 5px;
  padding: 6px 0;
}

.typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold-soft);
  opacity: 0.4;
  animation: typing 1.2s ease-in-out infinite;
}

.typing i:nth-child(2) {
  animation-delay: 0.15s;
}

.typing i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing {
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* ---- follow-up chat ----------------------------------------------------------------------- */
.followup {
  padding: 20px;
  border-top: 1px solid var(--line);
}

.card:not(.reading) > .followup {
  padding: 0;
  border-top: 0;
}

@media (min-width: 768px) {
  .followup {
    padding: 26px 34px 30px;
  }
}

.followup__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.followup__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
}

.followup__title .icon {
  color: var(--gold-soft);
}

.followup__hint {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
}

.chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat:empty {
  display: none;
}

.bubble {
  max-width: 92%;
  padding: 12px 16px;
  border-radius: 18px;
  animation: rise-in 0.3s var(--ease) both;
}

.bubble--user {
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  border: 1px solid rgba(124, 92, 255, 0.32);
  background: var(--violet-a10);
}

.bubble--assistant {
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(7, 6, 26, 0.5);
}

@media (min-width: 640px) {
  .bubble {
    max-width: 82%;
  }
}

.bubble__who {
  margin-bottom: 4px;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--gold-soft);
  opacity: 0.8;
}

.bubble--user .bubble__who {
  color: var(--violet-soft);
}

.bubble__text {
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.75;
}

.chat-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.chat-form__input {
  flex: 1;
  min-height: 46px;
  max-height: 160px;
  padding: 11px 14px;
  resize: none;
  line-height: 1.5;
}

.chat-form__send {
  height: 46px;
}

/* ---- share --------------------------------------------------------------------------------- */
.share__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 0;
  color: var(--gold-soft);
  font-size: 14px;
}

.share__poster {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.share__poster img {
  width: min(64vw, 260px);
  border-radius: 14px;
  border: 1px solid var(--gold-a40);
  box-shadow: var(--shadow-glow);
  -webkit-touch-callout: default;
  user-select: auto;
}

.share__poster figcaption {
  color: var(--muted);
  font-size: 12.5px;
}

.is-wechat [data-share-download] {
  display: none;
}

.share-inline {
  margin-top: 22px;
}

/* ---- reading detail & shared ----------------------------------------------------------- */
.reading-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.reading-page > .card + .card {
  margin-top: 0;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding-top: 18px;
}

.detail-head__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--gold-a40);
  color: var(--gold-soft);
}

.detail-head__title {
  font-size: 24px;
  line-height: 1.35;
}

.detail-head__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

@media (min-width: 768px) {
  .detail-head__title {
    font-size: 30px;
  }
}

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

.answer__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
}

.answer__title .icon {
  color: var(--gold-soft);
}

.answer__actions {
  margin-top: 20px;
}

.answer__actions form {
  display: contents;
}

.shared-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(124, 92, 255, 0.25);
  background: var(--violet-a10);
  color: var(--violet-soft);
  font-size: 12.5px;
  text-align: center;
}

.shared-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 18px;
  text-align: center;
}

.shared-head__icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 1px solid var(--gold-a40);
  color: var(--gold-soft);
  box-shadow: var(--shadow-glow);
}

.shared-head__title {
  font-size: 26px;
  line-height: 1.35;
}

.shared-head__meta {
  color: var(--muted);
  font-size: 12.5px;
}

.shared-cta {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

/* ---- feedback stars (row-reverse so plain sibling selectors light up lower stars) -------- */
.feedback {
  text-align: center;
}

.feedback__title {
  font-size: 16px;
  font-family: var(--font-sans);
  font-weight: 500;
}

.feedback__form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.stars {
  display: inline-flex;
  flex-direction: row-reverse;
  justify-content: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
}

.stars__item {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: rgba(255, 255, 255, 0.16);
  cursor: pointer;
  transition: color 0.15s, transform 0.15s var(--ease-spring);
}

.stars__item > input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.stars__item:hover,
.stars__item:hover ~ .stars__item,
.stars__item:has(input:checked),
.stars__item:has(input:checked) ~ .stars__item {
  color: var(--gold-soft);
}

.stars__item:hover {
  transform: scale(1.12);
}

.stars__item:has(input:focus-visible) {
  outline: 2px solid var(--gold-soft);
  border-radius: 10px;
}

.feedback__more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 460px;
}

.danger-zone {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}

/* ---- css/70-kit.css ---- */
/* Module kit: generic visual building blocks for module templates (modules cannot ship CSS).
   Documented in internal/web/doc.go — prefer these classes over inline styles (CSP-friendly). */

/* five-element colours: text, SVG fills and dots */
.wx-wood { color: var(--wx-wood); }
.wx-fire { color: var(--wx-fire); }
.wx-earth { color: var(--wx-earth); }
.wx-metal { color: var(--wx-metal); }
.wx-water { color: var(--wx-water); }

svg .wx-wood,
svg .wx-fire,
svg .wx-earth,
svg .wx-metal,
svg .wx-water {
  fill: currentColor;
}

.bg-wx-wood { background: rgba(88, 196, 139, 0.14); border-color: rgba(88, 196, 139, 0.4); }
.bg-wx-fire { background: rgba(240, 117, 96, 0.14); border-color: rgba(240, 117, 96, 0.4); }
.bg-wx-earth { background: rgba(214, 173, 94, 0.14); border-color: rgba(214, 173, 94, 0.4); }
.bg-wx-metal { background: rgba(236, 227, 196, 0.1); border-color: rgba(236, 227, 196, 0.34); }
.bg-wx-water { background: rgba(100, 166, 244, 0.14); border-color: rgba(100, 166, 244, 0.4); }

.tone-gold { color: var(--gold-soft); }
.tone-violet { color: var(--violet-soft); }
.tone-jade { color: var(--jade-soft); }
.tone-seal { color: var(--seal-soft); }
.tone-muted { color: var(--muted); }

/* columns: equal cells; collapse to two on narrow phones for 4+ */
.columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.columns--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.columns--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.columns--5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.columns--6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.columns--12 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (min-width: 640px) {
  .columns--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .columns--6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .columns--12 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 359px) {
  .columns--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* tiles */
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 14px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(7, 6, 26, 0.4);
  text-align: center;
}

.tile--accent {
  border-color: var(--gold-a70);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.14), rgba(212, 175, 55, 0.03));
  box-shadow: var(--shadow-glow);
}

.tile--column {
  gap: 8px;
  padding: 14px 6px 12px;
}

.tile__label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.tile__value {
  font-family: var(--font-serif);
  font-size: 30px;
  line-height: 1.1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.tile--accent .tile__value {
  color: var(--gold-soft);
  font-size: 40px;
}

.tile__foot {
  color: var(--muted-2);
  font-size: 11.5px;
}

/* big serif characters (stems, branches, hexagram names …) */
.glyph {
  font-family: var(--font-serif);
  font-size: 26px;
  line-height: 1.15;
  font-weight: 600;
}

.glyph--lg {
  font-size: 34px;
}

.glyph--xl {
  font-size: clamp(30px, 9vw, 44px);
  text-shadow: 0 0 22px currentColor;
}

/* key/value lists */
.kv {
  display: grid;
  gap: 10px;
}

.kv > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-faint);
}

.kv dt {
  color: var(--muted);
  font-size: 13px;
}

.kv dd {
  margin: 0;
  text-align: right;
  font-size: 14px;
}

.kv dd.big {
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--gold-soft);
}

.kv--row {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.kv--row > div {
  flex-direction: column;
  align-items: flex-start;
  border: 0;
}

.kv--row dd {
  text-align: left;
}

/* split: chart + legend side by side on wider screens */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  margin-top: 20px;
}

.split:first-child {
  margin-top: 0;
}

@media (min-width: 640px) {
  .split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

/* SVG charts */
.chart {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

.chart svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart__grid {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}

.chart__axis {
  stroke: rgba(212, 175, 55, 0.22);
  stroke-width: 1;
}

.chart__shape {
  fill: rgba(212, 175, 55, 0.2);
  stroke: var(--gold-soft);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.chart__line {
  fill: none;
  stroke: var(--gold-soft);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart__label {
  fill: var(--muted);
  font-family: var(--font-serif);
  font-size: 13px;
}

.chart__ring {
  fill: none;
  stroke: var(--gold-a40);
  stroke-width: 0.8;
}

.chart__slice {
  fill: rgba(7, 6, 26, 0.5);
  stroke: var(--line);
  stroke-width: 1;
}

.chart__slice.is-active {
  fill: rgba(212, 175, 55, 0.16);
  stroke: var(--gold-a70);
}

.chart__text {
  fill: var(--ink);
  font-size: 12px;
}

/* legend */
.legend {
  display: grid;
  gap: 8px;
}

.legend__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(7, 6, 26, 0.35);
  border: 1px solid var(--line-faint);
}

.legend__key {
  color: var(--muted);
  font-size: 13px;
  margin-right: auto;
}

.legend__value {
  margin-left: auto;
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

/* meters (score bars drawn as SVG rects) */
.meters {
  display: grid;
  gap: 12px;
}

.meter {
  display: grid;
  grid-template-columns: 4.5em minmax(0, 1fr) 3em;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.meter__label {
  color: var(--muted);
}

.meter__bar {
  width: 100%;
  height: 8px;
}

.meter__track {
  fill: rgba(255, 255, 255, 0.07);
}

.meter__fill {
  fill: var(--gold-soft);
}

.meter__value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

/* score ring */
.ring {
  position: relative;
  width: 168px;
  margin: 0 auto;
}

.ring svg {
  width: 100%;
  height: auto;
}

.ring__track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 9;
  stroke-linecap: round;
}

.ring__value {
  fill: none;
  stroke: var(--gold-soft);
  stroke-width: 9;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(232, 198, 106, 0.6));
}

.ring__label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ring__num {
  font-family: var(--font-serif);
  font-size: 44px;
  line-height: 1;
  color: var(--gold-soft);
  font-variant-numeric: tabular-nums;
}

.ring__unit {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

/* pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--gold-a40);
  background: var(--gold-a10);
  color: var(--gold-soft);
  font-size: 13px;
}

/* simple data table for module results */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  min-width: 100%;
  font-size: 14px;
}

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

.table th {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  background: rgba(7, 6, 26, 0.35);
}

.table tbody tr:hover td {
  background: rgba(212, 175, 55, 0.03);
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table .actions {
  text-align: right;
}

/* tarot-like card spreads */
.spread {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.spread__slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(28vw, 150px);
}

.spread--1 .spread__slot {
  width: min(46vw, 190px);
}

.spread__caption {
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.flip {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 5 / 8.4;
  perspective: 900px;
  cursor: pointer;
  border-radius: 12px;
}

.flip__inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.9s var(--ease);
}

.flip.is-flipped .flip__inner,
.flip[aria-pressed="true"] .flip__inner {
  transform: rotateY(180deg);
}

.flip__back,
.flip__front {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.flip__front {
  transform: rotateY(180deg);
}

.flip--reversed .flip__front > * {
  transform: rotate(180deg);
}

.cardback {
  border: 1px solid var(--gold-a40);
  background:
    repeating-linear-gradient(45deg, rgba(212, 175, 55, 0.08) 0 1px, transparent 1px 10px),
    repeating-linear-gradient(-45deg, rgba(212, 175, 55, 0.08) 0 1px, transparent 1px 10px),
    radial-gradient(circle at 50% 50%, #2a2160, #13102e 70%);
  box-shadow: inset 0 0 0 5px rgba(11, 10, 26, 0.9), inset 0 0 0 6px var(--gold-a40), 0 12px 28px -12px rgba(0, 0, 0, 0.8);
}

.cardface {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 12px 8px;
  border: 1px solid var(--gold-a70);
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(124, 92, 255, 0.3), transparent 70%),
    linear-gradient(180deg, #1c1940, #0e0c24);
  box-shadow: inset 0 0 0 4px rgba(11, 10, 26, 0.85), inset 0 0 0 5px var(--gold-a40), 0 14px 30px -12px rgba(212, 175, 55, 0.35);
  color: var(--gold-soft);
  text-align: center;
}

.cardface__num {
  font-family: var(--font-serif);
  font-size: 14px;
  letter-spacing: 0.12em;
}

.cardface__name {
  font-family: var(--font-serif);
  font-size: clamp(15px, 4.4vw, 19px);
  color: var(--ink);
  letter-spacing: 0.12em;
}

.cardface__star {
  color: var(--gold-soft);
  opacity: 0.85;
}

/* coins (六爻 tosses) */
.coins {
  display: flex;
  justify-content: center;
  gap: 14px;
  perspective: 600px;
}

.coin {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff2c2, #e2bb55 45%, #a8822a 100%);
  box-shadow: inset 0 0 0 3px rgba(122, 90, 20, 0.6), 0 8px 18px -8px rgba(0, 0, 0, 0.8);
  transform-style: preserve-3d;
}

.coin::after {
  content: "";
  position: absolute;
  inset: 37%;
  border-radius: 2px;
  background: var(--bg);
  box-shadow: 0 0 0 2px rgba(122, 90, 20, 0.7);
}

.coin[data-face="yin"],
.coin.is-yin {
  filter: brightness(0.82) saturate(0.85);
}

/* hexagram lines */
.hexagram {
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  width: 120px;
}

.yao {
  display: flex;
  gap: 14%;
  height: 10px;
}

.yao::before,
.yao::after {
  content: "";
  flex: 1;
  border-radius: 3px;
  background: var(--gold-soft);
}

.yao--yang::after {
  display: none;
}

.yao--moving::before,
.yao--moving::after {
  background: var(--seal-soft);
  box-shadow: 0 0 10px rgba(232, 128, 114, 0.6);
}

/* lot cylinder (签筒) */
.lot-tube {
  position: relative;
  width: 110px;
  height: 150px;
  margin: 0 auto;
  border-radius: 14px 14px 22px 22px;
  background: linear-gradient(90deg, #5b1f19, #9a3326 45%, #5b1f19);
  box-shadow: inset 0 0 0 3px rgba(232, 198, 106, 0.45), 0 18px 34px -16px rgba(0, 0, 0, 0.9);
  transform-origin: 50% 90%;
}

.lot-tube::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: -34px;
  height: 46px;
  background: repeating-linear-gradient(90deg, #e2c27a 0 6px, transparent 6px 12px);
  border-radius: 3px 3px 0 0;
}

.lot-stick {
  display: block;
  width: 12px;
  height: 120px;
  margin: 0 auto;
  border-radius: 3px;
  background: linear-gradient(180deg, #f3dda2, #c9a453);
  box-shadow: 0 0 18px rgba(232, 198, 106, 0.5);
}

/* the wooden fish */
.muyu {
  display: grid;
  place-items: center;
  padding: 10px 0;
}

.muyu__fish {
  position: relative;
  display: grid;
  place-items: center;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 1px solid var(--gold-a40);
  background: radial-gradient(circle at 35% 30%, #6b4a1f, #3b2710 70%);
  color: var(--gold-pale);
  box-shadow: inset 0 -10px 30px rgba(0, 0, 0, 0.5), 0 20px 50px -20px rgba(212, 175, 55, 0.5);
  touch-action: manipulation;
  user-select: none;
  transition: transform 0.08s;
}

.muyu__fish:active,
.muyu__fish.is-hit {
  transform: scale(0.94);
}

.tap-float {
  position: absolute;
  left: 50%;
  top: 10%;
  color: var(--gold-soft);
  font-family: var(--font-serif);
  font-size: 18px;
  white-space: nowrap;
  pointer-events: none;
  animation: float-up 1s var(--ease) forwards;
}

@keyframes float-up {
  from {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -70px);
  }
}

/* four number tiles: two by two on phones */
@media (max-width: 479px) {
  .numtiles.columns--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* nine-grid of digits (built-in 生命灵数): three tiles per row */
.numgrid {
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
}

.numgrid .tile {
  min-height: 74px;
}

/* a question restated above its answer (built-in 大师问答) */
.ask__text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
}

.ask .note {
  margin-top: 12px;
}

/* ---- css/75-ritual.css ---- */
/* Ritual motion used by ritual.js hooks (data-ritual="flip|coins|shake|reveal|count|tap|shuffle|pick").
   Without JavaScript everything is shown in its final state. */

/* staggered entrance */
.rise {
  animation: rise-in 0.55s var(--ease) both;
}

.rise--1 { animation-delay: 50ms; }
.rise--2 { animation-delay: 100ms; }
.rise--3 { animation-delay: 150ms; }
.rise--4 { animation-delay: 200ms; }
.rise--5 { animation-delay: 250ms; }
.rise--6 { animation-delay: 300ms; }
.rise--7 { animation-delay: 350ms; }
.rise--8 { animation-delay: 400ms; }

/* reveal: children fade up one by one once armed by ritual.js */
.reveal.is-armed .reveal__item {
  opacity: 0;
  transform: translateY(10px);
}

.reveal.is-armed .reveal__item.is-shown {
  opacity: 1;
  transform: none;
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}

/* coin toss */
.coin.is-tossing {
  animation: coin-toss 0.9s var(--ease) both;
}

@keyframes coin-toss {
  0% {
    transform: translateY(0) rotateX(0);
  }
  45% {
    transform: translateY(-70px) rotateX(900deg);
  }
  100% {
    transform: translateY(0) rotateX(1800deg);
  }
}

/* lot cylinder shake */
.lot-tube.is-shaking,
[data-ritual="shake"] .is-shaking {
  animation: shake 0.42s ease-in-out infinite;
}

@keyframes shake {
  0%,
  100% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(-9deg) translateX(-3px);
  }
  75% {
    transform: rotate(9deg) translateX(3px);
  }
}

.lot-stick.is-rising {
  animation: stick-rise 0.9s var(--ease-spring) both;
}

@keyframes stick-rise {
  from {
    transform: translateY(60px);
    opacity: 0;
  }
}

/* deck shuffle */
.shuffle.is-shuffling > * {
  animation: shuffle 0.7s var(--ease) both;
}

.shuffle.is-shuffling > :nth-child(odd) {
  animation-name: shuffle-alt;
}

@keyframes shuffle {
  40% {
    transform: translateX(-26px) rotate(-6deg);
  }
}

@keyframes shuffle-alt {
  40% {
    transform: translateX(26px) rotate(6deg);
  }
}

/* pick: face-down fan where the visitor chooses N cards */
.pick {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.pick__card {
  width: 46px;
  aspect-ratio: 5 / 8.4;
  border-radius: 8px;
  transition: transform 0.25s var(--ease), box-shadow 0.25s;
}

.pick__card:hover {
  transform: translateY(-6px);
}

.pick__card.is-picked,
.pick__card[aria-pressed="true"] {
  transform: translateY(-14px);
  box-shadow: 0 0 0 2px var(--gold-soft), 0 14px 26px -10px rgba(212, 175, 55, 0.6);
}

/* glow pulse used for "your turn" hints */
.ritual-hint {
  animation: breathe 2.4s ease-in-out infinite;
}

/* ---------------------------------------------------------------------------------------------
   Reduced motion: no drifting stars, no spinning rings, no flips — final states immediately. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .starfield::before,
  .starfield::after,
  .astrolabe__ring,
  .gold-text {
    animation: none !important;
  }
}

/* ---- css/80-pages.css ---- */
/* Page-specific layouts: history, account, auth, admin, legal, status and confirm pages. */

/* ---- history ------------------------------------------------------------------------------ */
.history {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history__item {
  animation: rise-in 0.4s var(--ease) both;
}

.history__link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 14px 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(20, 18, 43, 0.82);
  color: var(--ink);
  transition: border-color var(--dur), transform var(--dur) var(--ease);
}

.history__link:hover {
  text-decoration: none;
  border-color: var(--gold-a40);
}

.history__link:active {
  transform: scale(0.995);
}

.history__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--gold-a25);
  color: var(--gold-soft);
}

.history__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.history__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15.5px;
}

.history__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12.5px;
}

.history__meta [aria-hidden] {
  color: var(--gold-a40);
}

.history__shared {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--violet-soft);
}

.history__go {
  color: var(--muted-2);
  transition: transform var(--dur), color var(--dur);
}

.history__link:hover .history__go {
  color: var(--gold-soft);
  transform: translateX(2px);
}

/* ---- account ------------------------------------------------------------------------------ */
.account__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-top: 4px;
}

.account__grid > .stack {
  gap: 16px;
}

.account .card + .card {
  margin-top: 0;
}

@media (min-width: 1000px) {
  .account__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 36px 24px;
  text-align: center;
}

.welcome__title {
  font-size: 24px;
}

.welcome__body {
  max-width: 30em;
  color: var(--muted);
}

.guest-band {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
  border-color: var(--gold-a40);
}

.guest-band__title {
  font-size: 18px;
}

.guest-band__body {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

@media (min-width: 720px) {
  .guest-band {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.profile-card__who {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--gold-a70);
  background: radial-gradient(circle at 35% 30%, rgba(246, 227, 161, 0.35), rgba(212, 175, 55, 0.06));
  color: var(--gold-pale);
  font-family: var(--font-serif);
  font-size: 22px;
}

.profile-card__names {
  min-width: 0;
}

.profile-card__name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-card__email {
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.balance {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--gold-a25);
  background: linear-gradient(120deg, rgba(212, 175, 55, 0.1), rgba(212, 175, 55, 0.02));
}

.balance__label {
  color: var(--muted);
  font-size: 12.5px;
}

.balance__value {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  color: var(--gold-soft);
  font-family: var(--font-serif);
  font-size: 34px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.balance__vip {
  text-align: right;
  color: var(--violet-soft);
  font-size: 12.5px;
}

.streak {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.streak__day {
  display: grid;
  place-items: center;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.streak__day.is-filled {
  border-color: var(--gold-a70);
  background: rgba(212, 175, 55, 0.2);
  color: var(--gold-soft);
}

.streak__day.is-gift {
  border-style: dashed;
  color: var(--gold-soft);
}

.checkin {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.locked-wrap {
  position: relative;
}

.locked-wrap.is-locked > :not(.locked-wrap__hint) {
  opacity: 0.38;
  pointer-events: none;
  user-select: none;
}

.locked-wrap__hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--gold-soft);
  font-size: 14px;
}

.rows {
  display: flex;
  flex-direction: column;
}

.rows__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line-faint);
}

.rows__item:first-child {
  border-top: 0;
  padding-top: 2px;
}

.rows__main {
  min-width: 0;
}

.rows__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.rows__sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12.5px;
}

.rows__actions {
  display: flex;
  flex: none;
  gap: 2px;
}

.ledger__amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ledger__amount .is-plus {
  color: var(--jade-soft);
}

.ledger__amount .is-minus {
  color: var(--ink-2);
}

/* ---- auth ----------------------------------------------------------------------------------- */
.auth {
  display: flex;
  justify-content: center;
  padding-top: 28px;
}

.auth__card {
  width: 100%;
  max-width: 460px;
  padding: 30px 22px;
}

@media (min-width: 768px) {
  .auth {
    padding-top: 56px;
  }

  .auth__card {
    padding: 36px 36px 30px;
  }
}

.auth__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 26px;
  text-align: center;
}

.auth__title {
  margin-top: 6px;
  font-size: 25px;
}

.auth__sub {
  color: var(--muted);
  font-size: 14px;
}

.auth__or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 14px;
  color: var(--muted-2);
  font-size: 12.5px;
}

.auth__or::before,
.auth__or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.auth__providers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth__note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.auth__switch {
  margin-top: 20px;
  text-align: center;
  font-size: 14px;
}

/* ---- admin ---------------------------------------------------------------------------------- */
.admin-head {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin .card + .card,
.admin .card + .stat-grid,
.admin .stat-grid + .card {
  margin-top: 16px;
}

.admin__filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.admin__filters .select {
  width: auto;
  min-width: 10em;
}

.admin__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin: 16px 0;
}

.admin__grid > .card + .card {
  margin-top: 0;
}

@media (min-width: 900px) {
  .admin__grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  }
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 900px) {
  .stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
  }

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

.stat {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(20, 18, 43, 0.82);
  min-width: 0;
}

.stat__label {
  color: var(--muted);
  font-size: 12.5px;
}

.stat__value {
  margin-top: 4px;
  color: var(--gold-soft);
  font-family: var(--font-serif);
  font-size: 26px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.stat__unit {
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 13px;
}

.stat__sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.stat--violet .stat__value {
  color: var(--violet-soft);
}

.stat--jade .stat__value {
  color: var(--jade-soft);
}

.stat--seal {
  border-color: var(--seal-a40);
}

.stat--seal .stat__sub {
  color: var(--seal-soft);
}

.bars {
  width: 100%;
  height: auto;
}

.bars__axis {
  stroke: var(--line);
}

.bars__bar {
  fill: var(--gold);
  fill-opacity: 0.75;
  transition: fill-opacity var(--dur);
}

.bars__bar:hover {
  fill-opacity: 1;
}

.bars__value {
  fill: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.bars__label {
  fill: var(--muted-2);
  font-size: 12px;
}

.cell-name {
  display: block;
}

.share-bar {
  display: block;
  width: 100%;
  max-width: 220px;
  height: 4px;
  margin-top: 6px;
}

.share-bar__track {
  fill: rgba(255, 255, 255, 0.07);
}

.share-bar__fill {
  fill: var(--gold-soft);
}

.quota__body {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.quota__gauge {
  width: 120px;
  height: auto;
}

.quota__track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 10;
  stroke-linecap: round;
}

.quota__arc {
  fill: none;
  stroke: var(--jade-soft);
  stroke-width: 10;
  stroke-linecap: round;
}

.quota--gold .quota__arc {
  stroke: var(--gold-soft);
}

.quota--seal .quota__arc {
  stroke: var(--seal-soft);
}

.quota__pct {
  fill: var(--ink);
  font-family: var(--font-serif);
  font-size: 22px;
}

.quota__label {
  fill: var(--muted);
  font-size: 11px;
}

.grid-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-top: 12px;
}

@media (min-width: 640px) {
  .grid-form {
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    align-items: end;
  }
}

.generated {
  margin-top: 18px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--gold-a25);
  background: rgba(7, 6, 26, 0.5);
}

.generated__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--gold-soft);
  font-size: 14px;
}

.generated__list {
  max-height: 220px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.9;
  letter-spacing: 0.08em;
  white-space: pre;
}

/* ---- legal ---------------------------------------------------------------------------------- */
.legal {
  padding-top: 22px;
}

.legal__intro {
  color: var(--ink-2);
  font-size: 15.5px;
  line-height: 1.9;
}

.legal__toc {
  margin-top: 20px;
}

.legal__toc-title {
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.2em;
  margin-bottom: 8px;
}

.legal__toc ol {
  list-style: decimal;
  padding-left: 1.4em;
  color: var(--muted);
  font-size: 14px;
  line-height: 2;
}

.legal__section {
  margin-top: 30px;
  scroll-margin-top: calc(var(--topbar-h) + var(--safe-top) + 16px);
}

.legal__heading {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 19px;
  margin-bottom: 12px;
}

.legal__num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 8px;
  border: 1px solid var(--gold-a40);
  color: var(--gold-soft);
  font-family: var(--font-sans);
  font-size: 13px;
}

.legal__section p {
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.95;
}

.legal__section p + p {
  margin-top: 10px;
}

.legal__contact {
  margin-top: 30px;
  color: var(--muted);
  font-size: 14px;
}

/* ---- status & confirm ------------------------------------------------------------------- */
.status-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 64px;
  padding-bottom: 24px;
  text-align: center;
}

.status-page__glyph {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  margin-bottom: 10px;
  border-radius: 22px;
  border: 1.5px solid var(--seal-a40);
  background: radial-gradient(circle at 35% 30%, rgba(232, 128, 114, 0.18), rgba(192, 57, 43, 0.08));
  color: var(--seal-soft);
  font-family: var(--font-serif);
  font-size: 40px;
  box-shadow: inset 0 0 0 5px var(--bg), inset 0 0 0 6px rgba(192, 57, 43, 0.25);
  animation: rise-in 0.5s var(--ease) both;
}

.status-page__code {
  color: var(--muted-2);
  font-family: var(--font-mono);
  letter-spacing: 0.3em;
  font-size: 13px;
}

.status-page__title {
  font-size: 26px;
}

.status-page__body {
  max-width: 28em;
  margin-bottom: 12px;
  color: var(--muted);
}

.confirm-card {
  margin-top: 40px;
  text-align: center;
}

.confirm-card__title {
  font-size: 22px;
}

.confirm-card__body {
  margin: 10px 0 20px;
  color: var(--muted);
}

.confirm-card form {
  justify-content: center;
}

/* ---- css/82-login.css ---- */
/* Sign-in options (templates/components/login.html): provider buttons, the phone + SMS form with its
   captcha, "open in WeChat" with a QR code of the page, and the account page's linked logins. */

/* ---- provider buttons ----------------------------------------------------------------------- */
.provider {
  gap: 10px;
  letter-spacing: 0.04em;
}

.provider--wechat_mp,
.provider--wechat_open {
  background: #07c160;
  border-color: #07c160;
  color: #fff;
}

.provider--wechat_mp:hover,
.provider--wechat_open:hover {
  filter: brightness(1.06);
}

.provider--qq {
  background: rgba(18, 183, 245, 0.12);
  border-color: rgba(18, 183, 245, 0.5);
  color: #dff5ff;
}

.provider--google {
  background: #f4f2fb;
  border-color: #f4f2fb;
  color: #1d1b2e;
}

.provider:active {
  transform: scale(0.985);
}

.auth__agree {
  margin-top: 10px;
  color: var(--muted-2);
  font-size: 12.5px;
  text-align: center;
}

.auth__alert {
  margin-bottom: 16px;
}

.auth__tabs {
  margin-bottom: 16px;
}

.auth__tabs .tabs__tab {
  flex: 1;
  justify-content: center;
  gap: 6px;
}

/* ---- phone form ------------------------------------------------------------------------------ */
.phone-input {
  position: relative;
}

.phone-input__cc {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 16px;
  pointer-events: none;
}

.phone-input .input {
  padding-left: 52px;
  letter-spacing: 0.04em;
}

.captcha {
  display: grid;
  grid-template-columns: 132px 1fr;
  grid-template-areas: "img input" "refresh refresh";
  align-items: center;
  gap: 8px 10px;
}

.captcha__img {
  grid-area: img;
  width: 132px;
  height: 48px;
  border-radius: 8px;
  background: #f3ead2;
}

.captcha__img--empty {
  display: grid;
  place-items: center;
  color: var(--seal);
}

.captcha__input {
  grid-area: input;
  min-width: 0;
  text-transform: uppercase;
  letter-spacing: 0.3em;
}

.captcha__refresh {
  grid-area: refresh;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  color: var(--muted);
  font-size: 13.5px;
}

@media (min-width: 420px) {
  .captcha {
    grid-template-columns: 132px 1fr auto;
    grid-template-areas: "img input refresh";
  }
}

.phone-form__send .btn[disabled] {
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

/* ---- open in WeChat ---------------------------------------------------------------------------- */
.wx-open {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 4px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(7, 193, 96, 0.35);
  background: rgba(7, 193, 96, 0.07);
}

.wx-open__qr {
  flex: none;
  width: 108px;
  padding: 6px;
  border-radius: 10px;
  background: #fbf6e8;
}

.qr {
  width: 100%;
  height: auto;
}

.qr__bg {
  fill: #fbf6e8;
}

.qr__fg {
  fill: #0b0a1a;
}

.wx-open__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.wx-open__title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #7fe0ab;
  font-weight: 600;
  font-size: 14.5px;
}

.wx-open__body {
  color: var(--muted);
  font-size: 13px;
}

.wx-open__link {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--ink-2);
  font-size: 12.5px;
  -webkit-user-select: all;
  user-select: all;
}

@media (max-width: 359px) {
  .wx-open {
    flex-direction: column;
    align-items: stretch;
  }

  .wx-open__qr {
    align-self: center;
  }
}

/* ---- linked logins (account page) ------------------------------------------------------------- */
.logins__item {
  align-items: center;
}

.logins__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--gold-a05);
  color: var(--gold-soft);
}

.logins__icon--wechat {
  color: #3ddc84;
  border-color: rgba(7, 193, 96, 0.4);
  background: rgba(7, 193, 96, 0.08);
}

.logins__icon--qq {
  color: #5fd0ff;
  border-color: rgba(18, 183, 245, 0.4);
  background: rgba(18, 183, 245, 0.08);
}

.logins__phone {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.logins__phone-title {
  margin-bottom: 12px;
  font-size: 15px;
}

/* "sign in again" before changing login methods: the text wraps, the button keeps to the end */
.logins__reauth {
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.logins__reauth > span {
  flex: 1 1 200px;
}

.logins__reauth .btn {
  flex: none;
  min-height: 44px;
}

/* ---- css/85-pay.css ---- */
/* Payments: top-up page, pay sheet, order page, mock cashier, admin products (handlers_pay.go). */

.pay {
  padding-bottom: 40px;
}

/* room for the fixed pay bar above the tab bar */
.pay--checkout {
  padding-bottom: calc(var(--tabbar-h) + 96px + var(--safe-bottom));
}

@media (min-width: 768px) {
  .pay--checkout {
    padding-bottom: 64px;
  }
}

/* ---- wallet strip ----------------------------------------------------------------------- */
.pay-wallet {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  margin-bottom: 18px;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(120deg, var(--gold-a10), transparent 60%), var(--surface);
}

.pay-wallet__label {
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.pay-wallet__value {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 24px;
  font-family: var(--font-serif);
  color: var(--gold-soft);
}

.pay-wallet__vip {
  margin-top: 4px;
  color: var(--violet-soft);
}

/* ---- product options -------------------------------------------------------------------- */
.pay-section + .pay-section {
  margin-top: 28px;
}

.pay-section__head {
  margin-bottom: 12px;
}

.pay-section__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
}

.pay-section__title .icon {
  color: var(--gold-soft);
}

.pay-section__sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.pay-perks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  font-size: 13.5px;
  color: var(--ink-2);
}

.pay-perks li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.pay-perks .icon {
  color: var(--jade-soft);
}

.pay-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 640px) {
  .pay-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

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

.pay-option {
  position: relative;
  display: block;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pay-option__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.pay-option__card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 100%;
  padding: 18px 14px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur), transform 0.12s;
}

.pay-option:hover .pay-option__card {
  border-color: var(--line-strong);
}

.pay-option__input:checked + .pay-option__card {
  border-color: var(--gold);
  background: linear-gradient(180deg, var(--gold-a10), transparent 70%), var(--surface-2);
  box-shadow: var(--shadow-glow);
}

.pay-option__input:focus-visible + .pay-option__card {
  box-shadow: var(--ring);
}

.pay-option--vip .pay-option__input:checked + .pay-option__card {
  border-color: var(--violet-soft);
  background: linear-gradient(180deg, var(--violet-a20), transparent 70%), var(--surface-2);
  box-shadow: 0 0 0 1px rgba(168, 146, 255, 0.4), 0 16px 46px -16px rgba(124, 92, 255, 0.45);
}

.pay-option__badge {
  position: absolute;
  top: -9px;
  right: 12px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #1a1405;
  background: linear-gradient(180deg, #f3d989, var(--gold));
}

.pay-option__amount {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.pay-option__num {
  font-family: var(--font-serif);
  font-size: 30px;
  line-height: 1.1;
  color: var(--gold-soft);
}

.pay-option--vip .pay-option__num {
  color: var(--violet-soft);
}

.pay-option__unit {
  font-size: 13px;
  color: var(--muted);
}

.pay-option__title {
  font-size: 14px;
  color: var(--ink-2);
}

.pay-option__bonus {
  font-size: 12.5px;
  color: var(--jade-soft);
}

.pay-option__price {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
}

.pay-option__alt,
.pay-option__hint {
  font-size: 12px;
  color: var(--muted-2);
}

.pay-option__check {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #1a1405;
  background: var(--gold);
}

.pay-option__input:checked + .pay-option__card .pay-option__check {
  display: inline-flex;
}

.pay-option--vip .pay-option__check {
  background: var(--violet-soft);
}

/* ---- channels ------------------------------------------------------------------------------ */
.pay-channels {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  min-width: 0;
}

.pay-channels--page {
  margin-top: 24px;
}

.pay-channels__legend {
  margin-bottom: 8px;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.pay-channel {
  position: relative;
  display: block;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pay-channel__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.pay-channel__box {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color var(--dur), background var(--dur);
}

.pay-channel__input:checked + .pay-channel__box {
  border-color: var(--gold);
  background: var(--gold-a05);
}

.pay-channel__input:focus-visible + .pay-channel__box {
  box-shadow: var(--ring);
}

.pay-channel__mark {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: var(--surface-3);
}

.pay-channel__mark--wechat {
  background: #1a9e57;
}

.pay-channel__mark--alipay {
  background: #1677d2;
}

.pay-channel__mark--stripe {
  background: #5b4fd6;
}

.pay-channel__mark--mock {
  color: #1a1405;
  background: var(--gold-soft);
}

.pay-channel__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.pay-channel__name {
  font-weight: 600;
}

.pay-channel__hint {
  font-size: 12.5px;
  color: var(--muted);
}

.pay-channel__check {
  display: none;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #1a1405;
  background: var(--gold);
}

.pay-channel__input:checked + .pay-channel__box .pay-channel__check {
  display: inline-flex;
}

/* ---- sticky pay bar ------------------------------------------------------------------------ */
.pay-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  z-index: 30;
  border-top: 1px solid var(--line);
  background: rgba(11, 10, 26, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.pay-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: var(--content);
  margin: 0 auto;
  padding: 10px calc(var(--gutter) + var(--safe-right)) 10px calc(var(--gutter) + var(--safe-left));
}

.pay-bar__sum {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pay-bar__label {
  font-size: 12px;
  color: var(--muted);
}

.pay-bar__title {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pay-bar__price {
  font-weight: 700;
}

@media (min-width: 768px) {
  .pay-bar {
    position: sticky;
    bottom: 16px;
    margin-top: 24px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
  }
}

/* ---- pay sheet ------------------------------------------------------------------------------ */
.pay-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.pay-summary__title {
  font-weight: 600;
}

.pay-summary__grant {
  font-size: 13px;
  color: var(--muted);
}

.pay-summary__price {
  font-family: var(--font-serif);
  font-size: 26px;
  line-height: 1.1;
  color: var(--gold-soft);
  white-space: nowrap;
}

.pay-agree {
  margin-top: 10px;
  font-size: 12.5px;
  text-align: center;
  color: var(--muted-2);
}

.pay-step__hint {
  margin: 6px 0 14px;
  font-size: 13px;
  text-align: center;
  color: var(--muted);
}

.pay-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 4px auto 12px;
}

.pay-qr .qr,
.pay-qr__img {
  display: block;
  width: 232px;
  max-width: 100%;
  height: auto;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: #fff;
}

.pay-qr figcaption {
  font-size: 14px;
  color: var(--ink-2);
}

.pay-wait {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 12px;
  font-size: 14px;
  color: var(--muted);
}

.pay-wait--lg {
  margin-top: 18px;
  font-size: 16px;
  color: var(--ink-2);
}

.pay-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 0 4px;
  text-align: center;
}

.pay-success__seal {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  color: var(--jade-soft);
  background: var(--jade-a12);
  box-shadow: 0 0 0 1px rgba(95, 211, 187, 0.35);
  animation: rise-in 0.4s var(--ease) both;
}

.pay-success__title {
  font-size: 20px;
}

.pay-success__body {
  color: var(--ink-2);
}

.pay-success__sub {
  font-size: 13.5px;
  color: var(--violet-soft);
}

.pay-success .cluster {
  margin-top: 8px;
}

.pay-success--page {
  margin-bottom: 18px;
}

/* ---- order page ------------------------------------------------------------------------------ */
.pay-receipt .kv {
  margin: 16px 0;
}

.pay-receipt .kv dt {
  white-space: nowrap;
}

.pay-receipt__id {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.pay-receipt__id .mono {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.pay-receipt__amount {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--gold-soft);
}

.pay-pending {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.pay-pending__hint {
  font-size: 13px;
  text-align: center;
  color: var(--muted);
}

.pay-gate {
  margin-top: 24px;
}

.pay-gate__body {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--ink-2);
}

.pay-gate__body .icon {
  flex: none;
  margin-top: 3px;
  color: var(--gold-soft);
}

.pay-notes {
  margin-top: 28px;
  font-size: 13px;
  color: var(--muted-2);
}

.pay-notes ul {
  margin: 0;
  padding-left: 1.2em;
}

.pay-notes li + li {
  margin-top: 4px;
}

.pay-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 14px 0 32px;
  font-size: 12.5px;
  color: var(--muted-2);
}

/* ---- mock cashier ------------------------------------------------------------------------- */
.pay-mock__card {
  margin-top: 16px;
  text-align: center;
}

.pay-mock__amount {
  font-family: var(--font-serif);
  font-size: 40px;
  color: var(--gold-soft);
}

.pay-mock__what {
  margin: 4px 0;
}

.pay-mock__id {
  margin-bottom: 18px;
  font-size: 12.5px;
  color: var(--muted-2);
}

/* ---- admin products ------------------------------------------------------------------------ */
.pay-products-table .input {
  min-width: 6.5rem;
}

.pay-products-table .input--num {
  min-width: 5.5rem;
}

@media (prefers-reduced-motion: reduce) {
  .pay-success__seal {
    animation: none;
  }

  .pay-option__card,
  .pay-channel__box {
    transition: none;
  }
}

/* ---- css/90-utilities.css ---- */
/* Utilities, progressive-enhancement switches and print. */

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

.muted {
  color: var(--muted);
}

.small {
  font-size: 12.5px;
}

.nowrap {
  white-space: nowrap;
}

.truncate {
  max-width: 22em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mono {
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}

.seal-text {
  color: var(--seal-soft);
}

.stars-text {
  color: var(--gold-soft);
  letter-spacing: 0.1em;
}

/* Progressive enhancement: app.js adds .js to <html>. Without scripting, conditional form parts
   are all shown and JS-only controls are hidden. */
.js [data-nojs-only] {
  display: none !important;
}

@media (scripting: none) {
  [data-js-only] {
    display: none !important;
  }

  [data-show-when][hidden] {
    display: block !important;
  }

  .time-row[data-show-when][hidden] {
    display: grid !important;
  }

  label.check[data-show-when][hidden] {
    display: inline-flex !important;
  }
}

@media print {
  .topbar,
  .tabbar,
  .footer,
  .starfield,
  .toast-stack,
  .notice-overlay,
  .module-form,
  .chat-form,
  .reading__controls,
  .reading__done .cluster,
  .danger-zone,
  .feedback {
    display: none !important;
  }

  body {
    background: #fff;
    color: #111;
  }

  .card {
    border-color: #ccc;
    background: #fff;
    box-shadow: none;
  }

  .prose,
  .prose strong,
  .prose h2 {
    color: #111;
  }
}

/* ---- css/95-h5.css ---- */
/* H5 / in-app browser audit (docs/PLATFORM.md §3): safe areas in landscape, touch targets, no sticky
   hover effects on touch screens, momentum scrolling and no scroll chaining under dialogs. Loaded last. */

/* notched phones in landscape: keep sheets and toasts clear of the rounded corners and the sensor housing */
.sheet__panel {
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.toast-stack {
  padding-left: max(16px, var(--safe-left));
  padding-right: max(16px, var(--safe-right));
}

.modal {
  max-height: calc(100vh - var(--safe-top) - var(--safe-bottom) - 24px);
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 24px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

dialog[open] {
  overscroll-behavior: contain;
}

/* touch screens: a tap must not leave a card lifted (sticky :hover), and tabs get full 44px targets */
@media (hover: none) {
  .module-card:hover {
    transform: none;
    border-color: var(--line);
    box-shadow: var(--shadow-card);
  }

  .module-card:hover::before {
    opacity: 0;
  }

  .btn:hover,
  .provider:hover {
    filter: none;
  }
}

@media (pointer: coarse) {
  .tabs__tab {
    min-height: 44px;
  }

  .captcha__refresh,
  .footer__links a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

/* the WeChat in-app browser draws its own top bar: no translucent header effects behind it */
.is-wechat .topbar {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: rgba(11, 10, 26, 0.96);
}

