:root {
  --cream: #fff0bf;
  --paper: #f1d596;
  --paper-light: #fff7d7;
  --ink: #302438;
  --line: #302438;
  --gold: #e3b65a;
  --gold-dark: #a86f3f;
  --red: #a84d58;
  --red-dark: #713843;
  --blue: #263a5f;
  --panel-dark: #24233d;
  --deep: #171422;
  --text: #fff4d2;
  --shadow: rgba(8,8,18,.62);
  --aqua: #72e4ff;
  --green: #6ce1b7;
  --safe-top: 0px;
  --safe-bottom: 0px;
  --motion-fast: 120ms;
  --motion-mid: 220ms;
  --motion-slow: 420ms;
  --pixel-ease: cubic-bezier(.2, .8, .2, 1);
  --tarot-card-aspect: 320 / 548;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream);
  font-family: Consolas, "Microsoft YaHei", monospace;
  background:
    linear-gradient(#ffffff08 1px, transparent 1px),
    linear-gradient(90deg, #ffffff08 1px, transparent 1px),
    radial-gradient(circle at 22% 10%, rgba(114,228,255,.16), transparent 26%),
    linear-gradient(135deg, #111827, #1b1b35 64%, #10111f);
  background-size: 18px 18px, 18px 18px, auto, auto;
}

button, input, textarea, select {
  font: inherit;
}

button {
  cursor: pointer;
  transition:
    transform var(--motion-fast) steps(2, end),
    filter var(--motion-fast) steps(2, end),
    box-shadow var(--motion-fast) steps(2, end);
}

button:not(.map-marker):active,
.info-card.clickable:active {
  transform: translate(2px, 2px);
  filter: brightness(1.08);
}

@keyframes view-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes panel-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pixel-pop {
  0% { opacity: 0; transform: translateY(8px) scale(.98); }
  70% { opacity: 1; transform: translateY(-2px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translate(-50%, 0); }
  to { opacity: 0; transform: translate(-50%, -8px); }
}

@keyframes marker-glow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.18); }
}

@keyframes intro-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes intro-focus-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(.98); opacity: .82; }
  50% { transform: translate(-50%, -50%) scale(1.06); opacity: 1; }
}

@keyframes intro-star-drift {
  from { transform: translateY(12px); opacity: .35; }
  to { transform: translateY(-18px); opacity: 1; }
}

@keyframes intro-dialogue-in {
  0% { opacity: 0; transform: translateY(18px); }
  70% { opacity: 1; transform: translateY(-3px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes intro-type-pop {
  0% { opacity: .2; transform: translateY(4px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes church-line-in {
  from { opacity: .45; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes church-hint-blink {
  0%, 100% { opacity: .45; }
  50% { opacity: 1; }
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.device {
  width: min(1280px, calc(100vw - 48px));
  height: calc(100vh - 48px);
  min-height: 680px;
  padding: 12px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  background: #101222;
  border: 6px solid #8f6b4d;
  box-shadow: 14px 14px 0 #070914;
}

.desktop-nav {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  color: var(--cream);
  background:
    linear-gradient(#ffffff0a 1px, transparent 1px),
    linear-gradient(90deg, #ffffff0a 1px, transparent 1px),
    #17182d;
  background-size: 18px 18px;
  border: 4px solid #2b1d35;
  box-shadow: inset -6px -6px 0 rgba(6, 7, 17, .46);
  overflow-y: auto;
}

.desktop-brand {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 3px solid rgba(143, 107, 77, .64);
}

.desktop-brand img {
  width: 46px;
  height: 46px;
  display: block;
  object-fit: cover;
  background: #241833;
  border: 3px solid #302438;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, .36);
}

.desktop-brand strong,
.desktop-brand span,
.desktop-account-summary span,
.desktop-account-summary b {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desktop-brand strong {
  font-size: 14px;
  line-height: 1.25;
}

.desktop-brand span {
  margin-top: 4px;
  color: #e3b65a;
  font-size: 11px;
  font-weight: 900;
}

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

.desktop-stats div,
.desktop-account-summary {
  padding: 10px;
  background: rgba(255, 240, 191, .08);
  border: 3px solid rgba(255, 240, 191, .22);
}

.desktop-stats span,
.desktop-account-summary span {
  color: #cdbf95;
  font-size: 10px;
  font-weight: 900;
}

.desktop-stats b,
.desktop-account-summary b {
  margin-top: 3px;
  color: #fff0bf;
  font-size: 16px;
}

.desktop-nav-list {
  display: grid;
  gap: 8px;
}

.desktop-nav-btn {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  color: var(--cream);
  background: #2b3358;
  border: 3px solid #1b1b2e;
  box-shadow: 4px 4px 0 rgba(5, 6, 14, .58);
  font-size: 13px;
  font-weight: 900;
  text-align: left;
}

.desktop-nav-btn.active,
.desktop-nav-btn:hover {
  color: var(--ink);
  background: var(--gold);
  border-color: #8c5a37;
}

.desktop-nav-btn.accent {
  margin-top: 4px;
  background: #713843;
}

.desktop-nav-btn.accent.active,
.desktop-nav-btn.accent:hover {
  background: var(--gold);
}

.desktop-sync-note {
  margin: auto 0 0;
  color: #cdbf95;
  font-size: 11px;
  line-height: 1.55;
  font-weight: 800;
}

.screen {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 4px solid var(--line);
  background: #111526;
  image-rendering: pixelated;
}

.view {
  display: none;
  position: absolute;
  inset: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.view.active {
  display: block;
  animation: view-enter var(--motion-mid) var(--pixel-ease);
}

.view-page {
  color: var(--ink);
  background:
    linear-gradient(#30243810 1px, transparent 1px),
    linear-gradient(90deg, #30243810 1px, transparent 1px),
    linear-gradient(180deg, #f1d797, #dcb879);
  background-size: 18px 18px, 18px 18px, auto;
}

.view-page.dark {
  color: var(--cream);
  background:
    linear-gradient(#ffffff0a 1px, transparent 1px),
    linear-gradient(90deg, #ffffff0a 1px, transparent 1px),
    linear-gradient(180deg, #233452, #293554 58%, #5f7e58);
  background-size: 18px 18px, 18px 18px, auto;
}

.map-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  filter: saturate(1.05) contrast(1.02);
  animation: town-breath 14s steps(4, end) infinite;
}

.map-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8,10,20,.7), rgba(8,10,20,.04) 28%, rgba(8,10,20,.68)),
    radial-gradient(circle at 50% 40%, transparent 35%, rgba(4,6,14,.3));
  pointer-events: none;
}


.pixel-panel {
  background: rgba(31,30,52,.88);
  border: 4px solid #8f6b4d;
  box-shadow: 5px 5px 0 rgba(8,8,18,.62);
}

.view.active .pixel-panel,
.view.active .page-top,
.view.active .primary-action,
.view.active .secondary-action,
.view.active .list-item,
.view.active .card-grid button,
.view.active .shop-grid article {
  animation: panel-enter var(--motion-mid) var(--pixel-ease);
}

.map-marker {
  position: absolute;
  z-index: 5;
  transform: translate(-50%, -100%);
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--ink);
}

.map-marker:active {
  transform: translate(calc(-50% + 2px), calc(-100% + 2px));
}

.map-marker i {
  display: block;
  width: 22px;
  height: 22px;
  margin: 0 auto 4px;
  background: var(--gold);
  border: 4px solid var(--line);
  box-shadow: 0 0 16px rgba(230,183,91,.85), 4px 4px 0 rgba(6,8,18,.55);
  transform: rotate(45deg);
  animation: marker-glow 2.8s steps(4, end) infinite;
}

.map-marker:nth-of-type(2n) {
  animation: building-float 7s steps(3, end) infinite;
}

.map-marker:nth-of-type(2n + 1) {
  animation: building-float 8s steps(3, end) infinite reverse;
}

.map-marker.done i {
  background: var(--green);
  box-shadow: 0 0 18px rgba(108,225,183,.9), 4px 4px 0 rgba(6,8,18,.55);
}

@keyframes town-breath {
  0%, 100% { filter: saturate(1.05) contrast(1.02) brightness(1); }
  50% { filter: saturate(1.1) contrast(1.03) brightness(1.04); }
}

@keyframes building-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -2px; }
}

.map-marker span {
  display: inline-block;
  padding: 4px 6px;
  background: var(--cream);
  border: 3px solid var(--line);
  box-shadow: 3px 3px 0 rgba(8,8,18,.6);
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.map-marker:hover span,
.map-marker:focus-visible span {
  filter: brightness(1.08);
}

.home-ambient-effects {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.ambient-light,
.ambient-crystal {
  position: absolute;
  display: block;
  pointer-events: none;
}

.ambient-light {
  width: 5px;
  height: 5px;
  margin: -2px 0 0 -2px;
  background: rgba(246, 205, 112, .72);
  box-shadow:
    0 0 6px rgba(245, 196, 88, .46),
    0 0 14px rgba(222, 143, 57, .22);
  image-rendering: pixelated;
  animation: ambient-lamp-flicker 4.2s steps(5, end) infinite;
}

.ambient-light::before {
  content: "";
  position: absolute;
  inset: -8px;
  background: radial-gradient(circle, rgba(242, 198, 109, .16), transparent 60%);
}

.light-daily-left { left: 42%; top: 42%; animation-delay: .4s; }
.light-daily-right { left: 63%; top: 42%; animation-delay: 1.6s; }
.light-library { left: 86%; top: 47%; animation-delay: 2.5s; }
.light-cases { left: 29%; top: 46%; animation-delay: 1s; }
.light-meditation { left: 33%; top: 64%; animation-delay: 2.1s; }
.light-spirit { left: 66%; top: 65%; animation-delay: .8s; }
.light-church-left { left: 27%; top: 82%; animation-delay: 2.9s; }
.light-church-right { left: 75%; top: 82%; animation-delay: 1.4s; }

.ambient-crystal {
  left: 50%;
  top: 54%;
  width: 74px;
  height: 86px;
  margin: -43px 0 0 -37px;
  background:
    radial-gradient(ellipse at 50% 52%, rgba(196, 249, 255, .62) 0 10%, rgba(91, 210, 255, .34) 11% 30%, rgba(35, 126, 255, .16) 31% 50%, transparent 68%),
    radial-gradient(ellipse at 50% 74%, rgba(90, 210, 255, .28), transparent 58%);
  border-radius: 50%;
  box-shadow:
    0 0 18px rgba(112, 221, 255, .42),
    0 0 40px rgba(74, 174, 255, .28),
    0 0 70px rgba(43, 106, 255, .16);
  mix-blend-mode: screen;
  opacity: .62;
  animation: ambient-crystal-pulse 3.8s steps(6, end) infinite;
}

.ambient-crystal::before {
  content: "";
  position: absolute;
  left: 31%;
  top: 11%;
  width: 38%;
  height: 70%;
  background: radial-gradient(ellipse, rgba(230, 255, 255, .72), rgba(112, 232, 255, .2) 44%, transparent 72%);
  border-radius: 50%;
  filter: blur(2px);
  animation: ambient-crystal-core 2.6s steps(5, end) infinite;
}

.ambient-crystal::after {
  content: "";
  position: absolute;
  left: 47%;
  top: 4%;
  width: 6%;
  height: 92%;
  background: linear-gradient(180deg, transparent, rgba(237, 255, 255, .78) 38%, rgba(132, 235, 255, .24), transparent);
  border-radius: 999px;
  filter: blur(1px);
  animation: ambient-crystal-shine 2.9s steps(4, end) infinite;
}

@keyframes ambient-lamp-flicker {
  0%, 100% { opacity: .34; transform: scale(.9); filter: brightness(.9); }
  35% { opacity: .62; transform: scale(1); filter: brightness(1.04); }
  55% { opacity: .44; transform: scale(.94); filter: brightness(.94); }
  75% { opacity: .72; transform: scale(1.04); filter: brightness(1.08); }
}

@keyframes ambient-crystal-pulse {
  0%, 100% { opacity: .46; transform: translateY(0) scale(.94); filter: blur(.4px) brightness(.92); }
  45% { opacity: .82; transform: translateY(-1px) scale(1.08); filter: blur(.1px) brightness(1.26); }
  68% { opacity: .56; transform: translateY(0) scale(1); filter: blur(.3px) brightness(1); }
}

@keyframes ambient-crystal-core {
  0%, 100% { opacity: .32; transform: scale(.82); }
  50% { opacity: .86; transform: scale(1.08); }
}

@keyframes ambient-crystal-shine {
  0%, 100% { opacity: .12; transform: scaleY(.76); }
  45% { opacity: .62; transform: scaleY(1); }
  65% { opacity: .24; transform: scaleY(.86); }
}

.home-bottom-decor {
  position: absolute;
  left: 50%;
  bottom: 2.3%;
  width: min(86%, 390px);
  height: 18.5%;
  z-index: 3;
  transform: translateX(-50%);
  pointer-events: none;
}

.home-bottom-decor::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 0;
  height: 56%;
  background:
    radial-gradient(ellipse at 78% 52%, rgba(136, 199, 212, .2) 0 3px, transparent 4px 18px),
    radial-gradient(ellipse at 63% 64%, rgba(245, 209, 122, .12) 0 2px, transparent 3px 16px),
    linear-gradient(90deg, transparent 0 24%, rgba(18, 42, 61, .24) 34% 100%);
  border-radius: 46% 48% 8% 8%;
  box-shadow: inset 0 8px 0 rgba(7, 15, 26, .18);
}

.shore-path {
  position: absolute;
  left: 44%;
  bottom: 14%;
  width: 14%;
  height: 68%;
  background:
    radial-gradient(circle at 50% 18%, rgba(236, 194, 112, .2) 0 2px, transparent 3px),
    linear-gradient(90deg, transparent 0 34%, rgba(92, 78, 63, .18) 36% 64%, transparent 66%),
    repeating-linear-gradient(180deg, rgba(136, 108, 72, .18) 0 3px, rgba(32, 31, 38, .26) 3px 7px);
  clip-path: polygon(39% 0, 61% 0, 90% 100%, 10% 100%);
  opacity: .72;
  filter: drop-shadow(0 0 4px rgba(240, 191, 100, .08));
}

.moon-dock {
  position: absolute;
  left: 55%;
  bottom: 23%;
  width: 30%;
  height: 23%;
  transform: rotate(-4deg);
  opacity: .78;
}

.moon-dock::before,
.moon-dock::after,
.moon-dock span {
  content: "";
  position: absolute;
  background: rgba(93, 68, 47, .72);
  border: 2px solid rgba(36, 25, 31, .72);
  box-shadow: 0 0 8px rgba(246, 192, 92, .12);
}

.moon-dock::before {
  left: 0;
  right: 0;
  top: 42%;
  height: 8px;
}

.moon-dock::after {
  left: 8%;
  right: 12%;
  top: 63%;
  height: 7px;
}

.moon-dock span {
  top: 25%;
  width: 7px;
  height: 30px;
}

.moon-dock span:nth-child(1) { left: 14%; }
.moon-dock span:nth-child(2) { left: 49%; }
.moon-dock span:nth-child(3) { right: 13%; }

.shore-lantern {
  position: absolute;
  width: 8px;
  height: 18px;
  background: linear-gradient(#6a4a2d 0 28%, #f2c76b 28% 64%, #503924 64%);
  border: 2px solid rgba(33, 24, 31, .82);
  box-shadow: 0 0 12px rgba(240, 181, 82, .6), 0 0 2px rgba(255, 236, 174, .9);
  animation: lantern-breathe 3.6s steps(4, end) infinite;
}

.shore-lantern::before {
  content: "";
  position: absolute;
  left: 2px;
  bottom: 100%;
  width: 2px;
  height: 13px;
  background: rgba(75, 54, 39, .8);
}

.lantern-left {
  left: 27%;
  bottom: 34%;
}

.lantern-right {
  right: 22%;
  bottom: 28%;
  animation-delay: .8s;
}

.reed-bed {
  position: absolute;
  width: 58px;
  height: 34px;
  background:
    linear-gradient(98deg, transparent 0 46%, rgba(50, 83, 58, .52) 47% 51%, transparent 52%),
    linear-gradient(84deg, transparent 0 58%, rgba(68, 101, 66, .48) 59% 63%, transparent 64%),
    linear-gradient(107deg, transparent 0 28%, rgba(43, 72, 54, .5) 29% 33%, transparent 34%),
    radial-gradient(circle at 22% 82%, rgba(83, 87, 58, .44) 0 4px, transparent 5px),
    radial-gradient(circle at 48% 76%, rgba(48, 88, 61, .42) 0 5px, transparent 6px),
    radial-gradient(circle at 72% 88%, rgba(102, 82, 58, .38) 0 3px, transparent 4px);
  opacity: .64;
}

.reed-left {
  left: 11%;
  bottom: 18%;
}

.reed-right {
  right: 8%;
  bottom: 18%;
  transform: scaleX(-1);
}

.water-glint {
  position: absolute;
  height: 2px;
  background: rgba(240, 211, 132, .5);
  box-shadow: 0 0 7px rgba(153, 218, 226, .34);
  animation: water-glimmer 4.8s steps(4, end) infinite;
}

.glint-one {
  right: 11%;
  bottom: 35%;
  width: 24px;
}

.glint-two {
  right: 21%;
  bottom: 18%;
  width: 15px;
  animation-delay: 1.5s;
}

.glint-three {
  left: 15%;
  bottom: 27%;
  width: 12px;
  animation-delay: 2.4s;
}

.firefly {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #f7d76b;
  box-shadow: 0 0 8px rgba(247, 215, 107, .9);
  animation: firefly-twinkle 3.8s steps(4, end) infinite;
}

.fly-one {
  left: 18%;
  bottom: 55%;
}

.fly-two {
  left: 69%;
  bottom: 58%;
  animation-delay: 1.1s;
}

.fly-three {
  right: 15%;
  bottom: 47%;
  animation-delay: 2s;
}

@keyframes lantern-breathe {
  0%, 100% { filter: brightness(.88); box-shadow: 0 0 8px rgba(240, 181, 82, .44); }
  50% { filter: brightness(1.12); box-shadow: 0 0 15px rgba(240, 181, 82, .72); }
}

@keyframes water-glimmer {
  0%, 100% { opacity: .18; transform: translateX(0); }
  50% { opacity: .72; transform: translateX(3px); }
}

@keyframes firefly-twinkle {
  0%, 100% { opacity: .2; transform: translateY(0); }
  50% { opacity: .95; transform: translateY(-3px); }
}

body.intro-running .map-marker,
body.intro-running .hud-menu-btn {
  pointer-events: none;
}

.intro-overlay {
  position: absolute;
  inset: 0;
  z-index: 80;
  overflow: hidden;
  color: var(--cream);
  background:
    radial-gradient(
      circle at var(--intro-x, 50%) var(--intro-y, 50%),
      rgba(5, 7, 18, 0) 0,
      rgba(5, 7, 18, 0) calc(var(--intro-size, 160px) * .56),
      rgba(5, 7, 18, .16) calc(var(--intro-size, 160px) * .82),
      rgba(5, 7, 18, .68) calc(var(--intro-size, 160px) * 1.28)
    ),
    linear-gradient(180deg, rgba(7,10,24,.36), rgba(8,11,24,0) 42%, rgba(5,7,18,.5));
  animation: intro-fade var(--motion-slow) var(--pixel-ease);
}

.intro-overlay.hidden {
  display: none;
}

.intro-sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.intro-sky i {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #fff8d7;
  box-shadow: 0 0 6px rgba(255,248,215,.48);
  opacity: .62;
  animation: intro-star-drift 1.8s steps(5, end) infinite alternate;
}

.intro-sky i:nth-child(1) { left: 13%; top: 18%; animation-delay: -.2s; }
.intro-sky i:nth-child(2) { left: 27%; top: 43%; animation-delay: -.7s; }
.intro-sky i:nth-child(3) { left: 42%; top: 13%; animation-delay: -1.1s; }
.intro-sky i:nth-child(4) { left: 58%; top: 25%; animation-delay: -.4s; }
.intro-sky i:nth-child(5) { left: 78%; top: 18%; animation-delay: -.9s; }
.intro-sky i:nth-child(6) { left: 84%; top: 52%; animation-delay: -1.3s; }
.intro-sky i:nth-child(7) { left: 18%; top: 72%; animation-delay: -.6s; }
.intro-sky i:nth-child(8) { left: 62%; top: 76%; animation-delay: -1.5s; }

.intro-focus {
  --intro-x: 50%;
  --intro-y: 44%;
  --intro-size: 160px;
  position: absolute;
  left: var(--intro-x);
  top: var(--intro-y);
  width: var(--intro-size);
  height: var(--intro-size);
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 248, 215, .5);
  border-radius: 50%;
  background: transparent;
  box-shadow:
    0 0 0 3px rgba(44, 31, 55, .18),
    inset 0 0 0 2px rgba(44, 31, 55, .18);
  pointer-events: none;
  animation: intro-focus-pulse 1.55s steps(5, end) infinite;
}

.intro-focus::before,
.intro-focus::after {
  display: none;
}

.intro-dialogue {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
  max-height: min(42%, 320px);
  padding: 9px 11px 10px;
  background: rgba(255,240,191,.96);
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 rgba(8,8,18,.72);
  color: var(--ink);
  animation: intro-dialogue-in var(--motion-slow) var(--pixel-ease);
}

.intro-overlay[data-dialogue-position="top"] .intro-dialogue {
  top: calc(72px + var(--safe-top));
  bottom: auto;
}

.intro-kicker {
  color: var(--red-dark);
  font-size: 10px;
  font-weight: 900;
  margin-bottom: 3px;
}

.intro-dialogue h2 {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.12;
  text-shadow: 2px 2px 0 rgba(227,182,90,.45);
}

.intro-dialogue p {
  min-height: 72px;
  max-height: 150px;
  margin: 0;
  color: #433247;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.62;
  text-wrap: pretty;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow-y: auto;
  scrollbar-width: thin;
}

.intro-dialogue p.typing {
  animation: intro-type-pop var(--motion-mid) steps(4, end);
}

.intro-progress {
  display: flex;
  gap: 5px;
  margin: 7px 0 7px;
}

.intro-progress span {
  width: 12px;
  height: 7px;
  background: #c9a663;
  border: 2px solid var(--line);
}

.intro-progress span.done,
.intro-progress span.active {
  background: var(--green);
}

.intro-progress span.active {
  box-shadow: 0 0 12px rgba(108,225,183,.85);
}

.intro-actions {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 8px;
}

.intro-actions button {
  height: 34px;
  border: 3px solid var(--line);
  box-shadow: 3px 3px 0 rgba(8,8,18,.65);
  font-size: 12px;
  font-weight: 900;
}

.intro-skip {
  color: var(--cream);
  background: #3d4b71;
}

.intro-next {
  color: var(--ink);
  background: var(--gold);
}


/* HUD 悬浮资源条 */
.map-hud {
  position: absolute;
  top: calc(10px + var(--safe-top));
  left: 10px;
  right: 10px;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}

.hud-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
}

.hud-day {
  padding: 3px 10px;
  background: rgba(31,30,52,.88);
  border: 2px solid #8f6b4d;
  box-shadow: 2px 2px 0 rgba(8,8,18,.6);
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 1px;
}

.hud-greeting {
  padding: 3px 10px;
  background: rgba(31,30,52,.82);
  border: 2px solid #8f6b4d;
  box-shadow: 2px 2px 0 rgba(8,8,18,.6);
  color: var(--cream);
  font-size: 10px;
  font-weight: 900;
}

.hud-stats {
  display: flex;
  gap: 6px;
  pointer-events: none;
}

.hud-stats span {
  padding: 4px 8px;
  background: rgba(31,30,52,.82);
  border: 2px solid #8f6b4d;
  box-shadow: 2px 2px 0 rgba(8,8,18,.6);
  color: var(--cream);
  font-size: 10px;
  font-weight: 900;
}

.hud-menu-btn {
  pointer-events: all;
  padding: 4px 10px;
  background: rgba(31,30,52,.82);
  border: 2px solid #8f6b4d;
  box-shadow: 2px 2px 0 rgba(8,8,18,.6);
  color: var(--cream);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 2px;
}

/* 设置面板 */
.settings-panel {
  position: absolute;
  top: calc(50px + var(--safe-top));
  right: 10px;
  z-index: 20;
  width: 200px;
  padding: 12px;
  animation: pixel-pop var(--motion-mid) var(--pixel-ease);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: var(--cream);
}

.settings-header strong {
  font-size: 12px;
}

.settings-header button {
  width: 24px;
  height: 24px;
  background: transparent;
  border: 2px solid #8f6b4d;
  color: var(--cream);
  font-size: 14px;
  display: grid;
  place-items: center;
}

.announcement-banner {
  position: fixed;
  left: 50%;
  top: calc(var(--safe-top, 0px) + 10px);
  transform: translateX(-50%);
  z-index: 940;
  width: min(92vw, 430px);
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 3px solid #302438;
  background: #fff0bf;
  color: #302438;
  box-shadow: 4px 4px 0 rgba(48,36,56,.28);
  font-size: 12px;
  line-height: 1.35;
}

.announcement-banner strong,
.announcement-banner span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.announcement-banner button {
  width: 26px;
  height: 26px;
  border: 2px solid #302438;
  background: #f3c76a;
  color: #302438;
  font-weight: 900;
  line-height: 1;
}

.announcement-modal {
  position: fixed;
  inset: 0;
  z-index: 960;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 12, 24, .62);
}

.announcement-modal-panel {
  width: min(88vw, 380px);
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 4px solid #302438;
  background: #fff6d5;
  color: #302438;
  box-shadow: 6px 6px 0 rgba(15, 12, 24, .42);
}

.announcement-modal-panel h3 {
  margin: 0;
  font-size: 18px;
}

.announcement-modal-panel p {
  margin: 0;
  color: #5a3820;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.announcement-modal-panel button {
  width: 100%;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--cream);
  font-size: 11px;
  padding: 4px 0;
}

.settings-volume {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  margin: 4px 0 2px;
  color: var(--cream);
  font-size: 11px;
  font-weight: 900;
}

.settings-volume input {
  grid-column: 1 / -1;
  width: 100%;
  height: 22px;
  padding: 0;
  accent-color: var(--gold);
}

.settings-volume b {
  color: var(--gold);
}

.settings-divider {
  border: none;
  border-top: 2px solid #8f6b4d;
  margin: 8px 0;
}

.settings-action {
  display: block;
  width: 100%;
  padding: 7px;
  margin-top: 6px;
  background: #332b4a;
  border: 2px solid #8f6b4d;
  color: var(--cream);
  font-size: 10px;
  font-weight: 900;
  text-align: center;
}

.settings-action.danger {
  border-color: var(--red);
  color: #ffaaaa;
}

.settings-toggle {
  min-width: 42px;
  height: 26px;
  color: var(--ink);
  background: var(--gold);
  border: 2px solid #8f6b4d;
  font-size: 11px;
  font-weight: 900;
}

.settings-toggle.off {
  color: var(--cream);
  background: #3d4b71;
}

.license-panel {
  margin: 6px 0 10px;
  padding: 10px;
  border: 2px solid rgba(143, 107, 77, .72);
  background: linear-gradient(180deg, rgba(31, 30, 52, .74), rgba(23, 22, 42, .86));
  box-shadow: inset 0 0 0 1px rgba(255, 241, 201, .06);
}

.license-panel p {
  margin: 4px 0;
  color: rgba(255, 243, 220, .9);
  font-size: 11px;
  line-height: 1.48;
}

#license-status-badge {
  color: #ffe8ab;
}

#license-status-badge.premium {
  color: #ffd76d;
}

#license-status-badge.tier-free {
  color: #ffe8ab;
}

#license-status-badge.tier-lite {
  color: #ffd88a;
}

#license-status-badge.tier-pro {
  color: #ffd269;
}

#license-status-badge.tier-max {
  color: #dcc8ff;
}

.license-panel .settings-row {
  padding-top: 0;
}

.license-panel #license-detail-text {
  color: #fff3cf;
}

.license-panel #license-ai-quota {
  color: #f3d27c;
  font-weight: 900;
}

.license-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  margin-top: 8px;
}

.license-code-row input {
  min-width: 0;
  border: 2px solid #302438;
  background: #fff8dc;
  color: #302438;
  padding: 8px;
  font: inherit;
  font-size: 12px;
}

.compact-settings-action {
  margin-top: 6px;
  min-height: 30px;
  font-size: 11px;
}

.purchase-panel {
  margin-top: 8px;
  padding: 10px;
  border: 2px solid rgba(48, 36, 56, .2);
  background: linear-gradient(180deg, rgba(255, 251, 235, .9), rgba(255, 244, 220, .78));
}

.membership-page-panel {
  margin: 12px 0 24px;
}

.purchase-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.purchase-panel strong {
  display: block;
  color: #302438;
  font-size: 12px;
}

#purchase-panel-note {
  color: #7a4d18;
  font-size: 10px;
  font-weight: 700;
}

.purchase-tier-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.purchase-period-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.purchase-tier-chip {
  min-height: 30px;
  border: 2px solid rgba(48, 36, 56, .22);
  background: rgba(255, 248, 220, .88);
  color: #5e4332;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
}

.purchase-tier-chip.active {
  border-color: #8a5b12;
  background: #fff0c2;
  color: #6f470b;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.45);
}

.membership-current-card,
.membership-account-card,
.membership-cloud-card,
.membership-target-card {
  margin-top: 10px;
  padding: 10px;
  border: 2px solid rgba(48, 36, 56, .16);
  background: rgba(255,255,255,.72);
}

.membership-current-card {
  background: linear-gradient(180deg, rgba(255,255,255,.88), rgba(255,248,230,.9));
}

.membership-account-card {
  background: linear-gradient(180deg, rgba(247, 244, 255, .9), rgba(255, 248, 230, .86));
}

.auth-entry-page {
  position: relative;
  min-height: 100%;
  padding: calc(42px + var(--safe-top)) 22px calc(28px + var(--safe-bottom));
  display: none;
  align-items: center;
  justify-content: center;
  background: #101222;
  overflow: hidden;
}

.auth-entry-page.active {
  display: flex;
}

.auth-entry-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 10, 22, .1), rgba(8, 10, 22, .72)),
    url("assets/night-map.png") center/cover no-repeat;
  filter: saturate(.86) brightness(.78);
}

.auth-entry-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  padding: 18px;
  border: 4px solid #302438;
  background: linear-gradient(180deg, rgba(255, 248, 220, .96), rgba(247, 239, 255, .92));
  box-shadow: 8px 8px 0 rgba(0, 0, 0, .28);
}

.auth-entry-panel h1 {
  margin: 8px 0 6px;
  color: #302438;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.auth-entry-panel p {
  margin: 0;
  color: #6a4c3b;
  font-size: 12px;
  line-height: 1.55;
}

.auth-entry-panel .settings-action {
  min-height: 38px;
}

.auth-channel-tabs {
  display: none;
}

.membership-cloud-card {
  border-color: rgba(97, 78, 142, .24);
  background: linear-gradient(180deg, rgba(241, 236, 255, .92), rgba(255, 248, 231, .78));
}

.membership-target-card {
  border-color: rgba(138, 91, 18, .22);
  background: rgba(255, 246, 215, .86);
}

.membership-eyebrow {
  display: block;
  color: #8a5b12;
  font-size: 10px;
  font-weight: 700;
}

.membership-current-main {
  margin-top: 4px;
}

#membership-current-title {
  display: block;
  color: #302438;
  font-size: 14px;
}

#membership-current-subtitle {
  display: block;
  margin-top: 4px;
  color: #6a4c3b;
  font-size: 11px;
  line-height: 1.45;
}

#membership-account-title {
  display: block;
  margin-top: 4px;
  color: #302438;
  font-size: 13px;
  overflow-wrap: anywhere;
}

#membership-cloud-title {
  display: block;
  margin-top: 4px;
  color: #302438;
  font-size: 13px;
}

#membership-account-subtitle,
#membership-cloud-subtitle {
  display: block;
  margin-top: 4px;
  color: #6a4c3b;
  font-size: 11px;
  line-height: 1.45;
}

.auth-form-grid {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.auth-form-grid input {
  min-width: 0;
  border: 2px solid rgba(48, 36, 56, .3);
  background: #fff8dc;
  color: #302438;
  padding: 8px;
  font: inherit;
  font-size: 12px;
}

.auth-form-grid input[hidden],
.auth-code-row[hidden] {
  display: none;
}

.auth-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(92px, .48fr);
  gap: 6px;
}

.auth-code-row .settings-action {
  margin: 0;
  min-height: 36px;
  padding-inline: 6px;
  font-size: 10px;
}

.auth-legal-inline {
  display: grid;
  grid-template-columns: 15px minmax(0, 1fr);
  gap: 6px;
  align-items: flex-start;
  margin-top: 8px;
  color: rgba(79, 59, 49, .86);
  font-size: 9px;
  line-height: 1.6;
}

.auth-legal-inline input {
  width: 14px;
  height: 14px;
  margin: 2px 0 0;
  accent-color: #8a5b12;
}

.legal-inline-link,
.auth-text-link {
  border: 0;
  background: transparent;
  color: #6f470b;
  font: inherit;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0 1px;
}

.auth-primary-actions {
  margin-top: 12px;
}

.auth-primary-actions .settings-action {
  width: 100%;
}

.auth-secondary-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: rgba(79, 59, 49, .72);
  font-size: 10px;
  line-height: 1.5;
}

.auth-secondary-links .settings-action {
  min-height: 0;
  margin: 0;
  padding: 0 1px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #6f470b;
  font-size: 10px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

.membership-card {
  min-height: 94px;
  padding: 8px;
  border: 2px solid rgba(48, 36, 56, .18);
  background: rgba(255,255,255,.58);
  cursor: pointer;
  transition: transform var(--motion-fast) steps(2, end), box-shadow var(--motion-fast) steps(2, end), border-color var(--motion-fast) steps(2, end), background-color var(--motion-fast) steps(2, end);
}

.membership-card:focus-visible {
  outline: 3px solid #8a5b12;
  outline-offset: 2px;
}

.membership-card:active {
  transform: translateY(1px);
}

.membership-card.active {
  border-color: #8a5b12;
  background: rgba(255, 243, 205, .95);
  transform: translateY(-1px);
}

.membership-card.current {
  box-shadow: inset 0 0 0 1px rgba(92, 63, 155, .25), 0 0 0 1px rgba(92, 63, 155, .08);
}

.membership-card b,
.membership-card small,
.membership-card p {
  display: block;
}

.membership-card b {
  color: #302438;
  font-size: 12px;
}

.membership-card small {
  margin-top: 2px;
  color: #8a5b12;
  font-size: 10px;
  font-weight: 700;
}

.membership-card p {
  margin: 6px 0 0;
  font-size: 10px;
  line-height: 1.45;
}

.membership-card.current b::after {
  content: " 当前";
  color: #5c3f9b;
  font-size: 10px;
}

.membership-target-card #purchase-plan-text {
  margin: 4px 0 0;
  color: #302438;
  font-size: 12px;
  font-weight: 900;
}

.membership-target-card #purchase-guide-text {
  margin: 6px 0 0;
  color: #6a4c3b;
  font-size: 10px;
  line-height: 1.5;
}

.compliance-card {
  margin-top: 8px;
  padding: 8px;
  border: 2px solid rgba(48, 36, 56, .18);
  background: rgba(255, 255, 255, .66);
}

.compliance-check {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 7px;
  align-items: flex-start;
  color: #4f3b31;
  font-size: 10px;
  line-height: 1.45;
}

.compliance-check input {
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  accent-color: #8a5b12;
}

.legal-link-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin-top: 8px;
}

.legal-link-row button {
  min-height: 28px;
  border: 2px solid rgba(48, 36, 56, .18);
  background: rgba(255, 248, 220, .88);
  color: #6f470b;
  font: inherit;
  font-size: 9px;
  font-weight: 900;
}

.purchase-coming-soon {
  color: #5c3f9b;
  font-weight: 700;
  margin-top: 8px;
}

#view-membership {
  padding-bottom: calc(28px + var(--safe-bottom));
}

.purchase-device-box {
  margin-top: 8px;
  padding: 8px;
  border: 2px solid #302438;
  background: #fff8dc;
}

.purchase-device-box span {
  display: block;
  color: #6a4c3b;
  font-size: 10px;
  margin-bottom: 4px;
}

.purchase-device-box code {
  display: block;
  color: #302438;
  font-size: 11px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

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

.purchase-actions .settings-action {
  margin-top: 8px;
}

.page-top {
  min-height: calc(58px + var(--safe-top));
  padding: calc(9px + var(--safe-top)) 18px 9px;
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  gap: 10px;
}

.page-top h2 {
  margin: 0;
  text-align: center;
  font-size: 20px;
}

.page-top-spacer {
  width: 36px;
  height: 36px;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--gold);
  border: 3px solid #4e3340;
  box-shadow: 3px 3px 0 var(--gold-dark);
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

.dark .icon-button {
  color: var(--cream);
  background: #3d4b71;
  border-color: #1b1b2e;
  box-shadow: 3px 3px 0 #101224;
}

.draw-hero {
  margin: 0 18px 14px;
  min-height: 310px;
  padding: 18px;
  position: relative;
  overflow: visible;
  color: var(--cream);
  background:
    linear-gradient(#ffffff10 1px, transparent 1px),
    linear-gradient(90deg, #ffffff10 1px, transparent 1px),
    #293a5f;
  background-size: 18px 18px;
}

.daily-hero-copy {
  position: relative;
  z-index: 4;
  max-width: calc(100% - 176px);
}

.draw-hero h3 {
  position: relative;
  z-index: 2;
  margin: 0;
  font-size: 27px;
  line-height: 1.08;
  text-shadow: 3px 3px 0 #241833;
}

.draw-hero p {
  position: relative;
  z-index: 2;
  margin: 0 0 10px;
  color: #e9d097;
  font-size: 12px;
  font-weight: 900;
}

.tarot-card,
.big-card,
.quiet-card {
  background-color: #241833;
  background-image: var(--equipped-card-back-image, url("assets/card-backs/classic.webp"));
  background-size: cover;
  background-position: center;
  border: 7px solid #fff4d2;
  box-shadow: 8px 8px 0 #1b1728;
  position: relative;
}

.tarot-card {
  position: absolute;
  right: 18px;
  top: 20px;
  width: 136px;
  aspect-ratio: var(--tarot-card-aspect);
  height: auto;
  z-index: 3;
  cursor: pointer;
  transition: filter .12s ease, transform .12s ease;
}

.tarot-card.daily-card-back {
  background-image: var(--equipped-card-back-image, url("assets/card-backs/classic.webp"));
  background-size: cover;
}

.tarot-card.daily-card-back::after {
  display: none;
}

.tarot-card:focus-visible {
  outline: 4px solid var(--gold);
  outline-offset: 4px;
}

.tarot-card.has-art {
  padding: 0;
  border: 0;
  background: transparent;
}

.tarot-card.has-art::before {
  display: none;
}

.tarot-card .card-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tarot-card::before,
.big-card::before {
  content: "";
  position: absolute;
  width: 30px;
  height: 30px;
  background: var(--gold);
  border: 4px solid #aa713d;
}

.tarot-card::before {
  left: 35px;
  top: 38px;
}

.tarot-card.daily-card-back::before {
  display: none;
}

.tarot-card.has-art::after {
  display: none;
}

.tarot-card span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--ink);
  font-size: 30px;
  font-weight: 900;
}

.daily-card-hint {
  position: absolute;
  right: 18px;
  top: 262px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 136px;
  min-height: 34px;
  margin: 0;
  padding: 5px 8px;
  color: #fff0bf;
  background: rgba(36, 24, 51, .88);
  border: 3px solid rgba(166, 109, 59, .92);
  box-shadow: 3px 3px 0 rgba(8, 8, 18, .45);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}

.daily-card-hint::before {
  content: none;
}

#daily-card-hint[hidden] {
  display: none;
}

.draw-hero.daily-pending .daily-card-hint {
  animation: dailyHintPulse 1.7s steps(2, end) infinite;
}

@keyframes dailyHintPulse {
  0%, 100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.22);
  }
}

.altar {
  position: absolute;
  right: 24px;
  bottom: 26px;
  width: 178px;
  height: 58px;
  background: #b67a42;
  border: 5px solid #4f352d;
  box-shadow: inset -10px -9px 0 #805139, 7px 7px 0 #1b1728;
  z-index: 2;
}

.form-panel {
  margin: 0 18px 14px;
  padding: 14px;
  color: var(--ink);
  background: rgba(255,240,191,.97);
}

.dark .form-panel {
  color: var(--cream);
  background: rgba(31,30,52,.88);
}

.form-panel p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 700;
}

.row-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  color: #73513e;
  font-size: 12px;
  font-weight: 900;
}

.dark .row-label {
  color: #e9d097;
}

label {
  display: block;
  margin: 10px 0 6px;
  color: #73513e;
  font-size: 11px;
  font-weight: 900;
}

input, textarea, select, .search-box {
  width: 100%;
  color: var(--ink);
  background: #fff7d7;
  border: 3px solid #94704c;
  padding: 10px;
  font-size: 13px;
  font-weight: 800;
  outline: none;
  transition:
    border-color var(--motion-fast) steps(2, end),
    box-shadow var(--motion-fast) steps(2, end),
    background-color var(--motion-fast) steps(2, end);
}

input:focus,
textarea:focus,
select:focus,
.search-box:focus {
  border-color: var(--line);
  box-shadow: 3px 3px 0 rgba(48,36,56,.28);
  background: #fffbea;
}

textarea {
  min-height: 88px;
  max-height: 180px;
  resize: vertical;
  line-height: 1.45;
  overflow-y: auto;
}

.primary-action,
.secondary-action {
  width: calc(100% - 36px);
  margin: 0 18px 14px;
  height: 50px;
  color: var(--cream);
  background: var(--red);
  border: 4px solid var(--line);
  box-shadow: 5px 5px 0 var(--red-dark);
  font-size: 15px;
  font-weight: 900;
}

.primary-action:active,
.secondary-action:active {
  box-shadow: 2px 2px 0 var(--red-dark);
}

.secondary-action {
  background: #3d4b71;
  box-shadow: 5px 5px 0 #20284a;
}

.secondary-action:active {
  box-shadow: 2px 2px 0 #20284a;
}

.two-cards,
.info-card {
  min-height: 70px;
  padding: 12px;
  color: var(--ink);
  background: rgba(255,240,191,.96);
  border: 4px solid var(--line);
  box-shadow: 4px 4px 0 rgba(48,36,56,.28);
}

.info-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.info-card span {
  color: #73513e;
  font-size: 11px;
  font-weight: 700;
}

#view-daily .two-cards {
  display: grid;
  gap: 14px;
  margin: 0 18px 22px;
  padding: 0;
  min-height: 0;
  color: inherit;
  background: transparent;
  border: 0;
  box-shadow: none;
}

#view-daily .info-card {
  min-height: 78px;
  padding: 16px 18px;
  color: var(--cream);
  background: #24223e;
  border-color: #2b1d35;
  box-shadow: 5px 5px 0 rgba(12, 10, 24, .55);
}

#view-daily .info-card strong {
  color: #fff0bf;
  font-size: 14px;
}

#view-daily .info-card span {
  color: #c99f75;
  font-size: 12px;
}

#view-daily .info-card.clickable {
  background: #2c3358;
}

.note-label {
  margin-top: 14px;
}

.list-panel {
  margin: 0 18px 20px;
  display: grid;
  gap: 10px;
}

.list-item {
  padding: 12px;
  color: var(--ink);
  background: rgba(255,240,191,.96);
  border: 4px solid var(--line);
  box-shadow: 4px 4px 0 rgba(48,36,56,.28);
}

.list-item strong {
  display: block;
  margin-bottom: 5px;
}

.list-item small {
  display: block;
  color: #73513e;
  line-height: 1.4;
}

.library-head {
  margin: 0 18px 10px;
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 14px;
  align-items: center;
}

.big-card {
  aspect-ratio: var(--tarot-card-aspect);
  height: auto;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 14px 10px;
  color: var(--ink);
  text-align: center;
  cursor: pointer;
}

.big-card.has-art {
  padding: 0;
  border: 0;
  background: transparent;
}

.big-card::before {
  left: 41px;
  top: 36px;
}

.big-card.has-art::before {
  display: none;
}

.card-art {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
}

.big-card .card-mark,
.mini-card-face .card-mark {
  display: grid;
  place-items: center;
  background: var(--gold);
  border: 3px solid #aa713d;
  box-shadow: 3px 3px 0 rgba(48,36,56,.28);
  font-weight: 900;
}

.big-card .card-mark {
  width: 44px;
  height: 44px;
  font-size: 25px;
}

.big-card strong {
  position: relative;
  z-index: 2;
  font-size: 18px;
}

.big-card small {
  position: relative;
  z-index: 2;
  max-width: 88px;
  color: #73513e;
  font-size: 10px;
  line-height: 1.35;
  font-weight: 900;
}

#library-card-name {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 30px;
}

#library-card-meta {
  margin: 0 0 12px;
  color: #73513e;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 900;
}

.badge-pill {
  display: inline-block;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--gold);
  border: 3px solid #8c5a37;
  font-size: 12px;
  font-weight: 900;
}

.tab-row {
  margin: 0 18px 10px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.tab-row button,
.time-options button {
  height: 38px;
  color: var(--ink);
  background: #d0a458;
  border: 3px solid #8c5a37;
  font-size: 12px;
  font-weight: 900;
}

.tab-row button.active,
.time-options button.active {
  background: #fff7d7;
  border-color: var(--line);
}

.search-box {
  width: calc(100% - 36px);
  margin: 0 18px 14px;
}

#view-library .search-box {
  position: sticky;
  top: 6px;
  z-index: 5;
  margin-bottom: 10px;
  box-shadow: 4px 4px 0 rgba(48,36,56,.24);
}

.card-grid,
.shop-grid {
  margin: 0 18px 18px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.card-grid button,
.shop-grid article {
  min-height: 112px;
  color: var(--ink);
  background: rgba(255,240,191,.96);
  border: 4px solid var(--line);
  box-shadow: 4px 4px 0 rgba(48,36,56,.28);
  font-size: 12px;
  font-weight: 900;
}

.card-grid button {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 8px;
  align-items: center;
  text-align: left;
}

.card-grid button.active {
  border-color: var(--red);
}

.card-grid button:active,
.spread-card:active,
.draw-slot:active,
.pick-slot:active,
.quiet-card:active,
.tarot-card:active {
  filter: brightness(1.08);
}

.mini-card-face {
  width: 38px;
  aspect-ratio: var(--tarot-card-aspect);
  display: grid;
  place-items: center;
  position: relative;
  background:
    linear-gradient(90deg, transparent 46%, rgba(255,244,210,.38) 46% 58%, transparent 58%),
    linear-gradient(180deg, #fff0bf, #d2965e 58%, #604661);
  border: 4px solid #fff4d2;
  box-shadow: 3px 3px 0 rgba(48,36,56,.3);
}

.mini-card-face.has-art {
  background: transparent;
  border: 0;
  overflow: hidden;
}

.mini-card-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: auto;
}

.mini-card-face .card-mark {
  width: 24px;
  height: 24px;
  font-size: 14px;
}

.annotation-badge {
  position: absolute;
  right: 4px;
  top: 4px;
  z-index: 4;
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--gold);
  border: 3px solid var(--line);
  box-shadow: 2px 2px 0 rgba(48,36,56,.35);
  font-size: 11px;
  font-weight: 900;
}

.card-grid strong {
  display: block;
  margin-bottom: 4px;
}

.card-grid small {
  display: block;
  color: #73513e;
  line-height: 1.3;
}

#view-library .card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#view-library .card-grid button {
  min-height: 112px;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 8px;
  padding: 9px;
  font-size: 12px;
}

#view-library .mini-card-face {
  width: 40px;
  aspect-ratio: var(--tarot-card-aspect);
  border-width: 3px;
}

#view-library .card-grid strong,
#view-library .card-grid small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-detail-modal {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 50;
  padding: calc(14px + var(--safe-top)) 14px 14px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  background: rgba(17, 21, 38, .78);
}

.card-detail-modal.open {
  display: block;
  animation: view-enter var(--motion-mid) var(--pixel-ease);
}

.card-detail-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: calc(100% - 12px);
  padding: 16px 16px calc(24px + var(--safe-bottom));
  overflow: visible;
  color: var(--ink);
  background: rgba(255,240,191,.98);
}

.card-detail-modal.open .card-detail-panel {
  animation: pixel-pop var(--motion-mid) var(--pixel-ease);
}

.legal-modal {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 980;
  padding: calc(16px + var(--safe-top)) 14px calc(16px + var(--safe-bottom));
  overflow-y: auto;
  background: rgba(17, 21, 38, .82);
}

.legal-modal.open {
  display: block;
}

.legal-modal-panel {
  width: 100%;
  min-height: calc(100% - 8px);
  padding: 16px;
  background: rgba(255, 240, 191, .98);
  color: var(--ink);
}

.legal-modal-body {
  display: grid;
  gap: 10px;
}

.legal-modal-body p {
  margin: 0;
  color: #4f3b31;
  font-size: 12px;
  line-height: 1.7;
}

.legal-modal-body .legal-version {
  color: #8a5b12;
  font-size: 10px;
  font-weight: 900;
}

.legal-modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.detail-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  min-width: 0;
}

.detail-top > div {
  min-width: 0;
}

.detail-top h3 {
  margin: 4px 0 0;
  font-size: 27px;
  overflow-wrap: anywhere;
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(96px, 118px) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
  min-width: 0;
}

.detail-card-face {
  width: 100%;
  min-width: 0;
  aspect-ratio: var(--tarot-card-aspect);
  height: auto;
  cursor: default;
}

#detail-card-meta {
  margin: 0;
  color: #73513e;
  font-size: 13px;
  line-height: 1.55;
  font-weight: 900;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.detail-copy {
  display: grid;
  gap: 10px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.detail-copy article {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 12px;
  overflow: hidden;
  background: #fff7d7;
  border: 3px solid #94704c;
}

.card-library-detail-modal .card-detail-panel {
  padding: 14px 14px calc(22px + var(--safe-bottom));
  background:
    linear-gradient(90deg, rgba(255, 247, 215, .72) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(255, 247, 215, .7) 0 1px, transparent 1px 100%),
    rgba(255, 240, 191, .98);
  background-size: 22px 22px, 22px 22px, auto;
}

.card-library-detail-modal .detail-top {
  margin-bottom: 12px;
}

.card-library-detail-modal .detail-hero {
  grid-template-columns: minmax(98px, 128px) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin: 0 0 18px;
  padding: 12px;
  background: rgba(255, 247, 215, .76);
  border: 3px solid rgba(148, 112, 76, .86);
  box-shadow: 4px 4px 0 rgba(42, 32, 45, .18);
}

.card-library-detail-modal .detail-card-face {
  aspect-ratio: var(--tarot-card-aspect);
  height: auto;
  box-shadow: 6px 6px 0 #1b1728;
}

.card-library-detail-modal #detail-card-meta {
  font-size: 12px;
  line-height: 1.5;
}

.card-library-detail-modal .detail-copy {
  gap: 14px;
  overflow: visible;
}

.card-library-detail-modal .detail-copy article {
  margin: 0;
  padding: 14px 14px 13px;
  background: rgba(255, 248, 222, .96);
  border: 3px solid rgba(148, 112, 76, .88);
  box-shadow: 4px 4px 0 rgba(42, 32, 45, .12);
}

.card-library-detail-modal .detail-copy article + article {
  margin-top: 2px;
}

.card-library-detail-modal .detail-copy strong {
  margin-bottom: 7px;
}

.card-library-detail-modal .annotation-panel {
  margin-top: 18px;
  padding: 14px;
  background: rgba(255, 248, 222, .94);
  border: 3px solid rgba(148, 112, 76, .88);
  box-shadow: 4px 4px 0 rgba(42, 32, 45, .14);
}

.card-library-detail-modal .annotation-panel input,
.card-library-detail-modal .annotation-panel textarea {
  border-width: 3px;
}

.card-library-detail-modal .annotation-list {
  gap: 10px;
}

.detail-copy strong {
  display: block;
  margin-bottom: 6px;
  color: var(--red-dark);
  font-size: 13px;
}

.detail-copy p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
  font-weight: 800;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.detail-copy article.case-reading-article {
  max-height: none;
  overflow: visible;
}

.case-review-panel {
  max-height: min(78vh, 720px);
}

.case-review-editor {
  display: grid;
  gap: 12px;
  padding: 0 16px 16px;
}

#case-review-note {
  min-height: clamp(260px, 42vh, 430px);
  max-height: 52vh;
  font-size: 15px;
  line-height: 1.62;
}

#case-reading-panel {
  margin-top: 18px;
  padding: 18px;
}

.case-question-summary {
  margin: 14px 0 0;
  padding: 14px 16px;
  border: 4px solid var(--ink);
  background: rgba(255, 248, 214, 0.92);
  box-shadow: 6px 6px 0 var(--shadow);
}

.case-question-summary .row-label {
  margin-bottom: 8px;
}

#case-question-summary-text {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.55;
  word-break: break-word;
}

#case-reading {
  min-height: clamp(220px, 34vh, 360px);
  max-height: 48vh;
  margin-bottom: 0;
  font-size: 15px;
  line-height: 1.62;
}

.reading-scroll-shell {
  position: relative;
  margin-bottom: 14px;
}

.reading-scroll-shell #case-reading {
  width: 100%;
  padding-right: 22px;
  resize: vertical;
  overflow-y: auto;
  scrollbar-color: var(--ink) rgba(44, 31, 55, .18);
  scrollbar-width: thin;
}

.reading-scroll-shell #case-reading::-webkit-scrollbar {
  width: 13px;
}

.reading-scroll-shell #case-reading::-webkit-scrollbar-track {
  border-left: 3px solid rgba(44, 31, 55, .38);
  background: rgba(44, 31, 55, .1);
}

.reading-scroll-shell #case-reading::-webkit-scrollbar-thumb {
  border: 3px solid rgba(255, 248, 214, .88);
  background: var(--ink);
}

.reading-scroll-hint {
  position: absolute;
  right: 18px;
  bottom: 9px;
  padding: 2px 7px;
  color: rgba(44, 31, 55, .78);
  background: rgba(255, 248, 214, .86);
  border: 2px solid rgba(44, 31, 55, .38);
  font-size: 10px;
  font-weight: 900;
  pointer-events: none;
  opacity: .8;
  transition: opacity .2s ease;
}

.reading-scroll-shell:focus-within .reading-scroll-hint,
.reading-scroll-shell.ai-writing .reading-scroll-hint {
  opacity: .42;
}

.reading-scroll-shell.ai-writing #case-reading {
  box-shadow:
    inset 0 0 0 2px rgba(120, 190, 255, .5),
    6px 6px 0 var(--shadow);
}

.reading-scroll-shell.oracle-line-fade #case-reading {
  animation: oracleLineFade .58s ease-out;
}

@keyframes oracleLineFade {
  from {
    filter: brightness(1.08);
  }
  to {
    filter: brightness(1);
  }
}

.library-note-panel {
  padding: 12px;
}

.library-note-panel #library-meaning {
  margin-bottom: 10px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-line;
}

.note-save-action {
  width: 100%;
  margin: 10px 0 0;
}

#card-note {
  min-height: 78px;
  max-height: 112px;
  font-size: 13px;
  line-height: 1.45;
}

.detail-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
}

.detail-tags b {
  padding: 3px 7px;
  color: var(--ink);
  background: var(--gold);
  border: 2px solid #8c5a37;
  font-size: 11px;
}

.oracle-button {
  height: 66px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  line-height: 1.15;
}

.oracle-button span,
.oracle-button small {
  display: block;
  pointer-events: none;
}

.oracle-button span {
  font-size: 16px;
  font-weight: 900;
}

.oracle-button small {
  font-size: 10px;
  opacity: .82;
}

.oracle-button.loading {
  position: relative;
  overflow: hidden;
  grid-template-columns: 46px minmax(0, 1fr);
  grid-template-rows: 1fr 1fr;
  place-items: center start;
  column-gap: 12px;
  height: 74px;
  padding: 9px 16px;
  background:
    linear-gradient(90deg, rgba(114, 228, 255, .13), transparent 34%, rgba(227, 182, 90, .16)),
    #344668;
  border-color: #7da8e8;
  box-shadow: 4px 4px 0 #1c223e, inset 0 0 0 3px rgba(255,244,210,.13);
}

.oracle-button.loading::before {
  content: "";
  position: absolute;
  inset: 8px 12px;
  z-index: 0;
  background:
    radial-gradient(circle at 24% 42%, rgba(255,244,210,.42) 0 2px, transparent 3px),
    radial-gradient(circle at 66% 34%, rgba(114,228,255,.42) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 68%, rgba(255,244,210,.3) 0 1px, transparent 2px);
  opacity: .74;
  animation: oracle-stars-drift 2.4s steps(5, end) infinite;
}

.oracle-button.loading::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 7px;
  height: 5px;
  background:
    linear-gradient(90deg, var(--gold), rgba(114,228,255,.85), rgba(255,244,210,.35), var(--gold));
  box-shadow: 0 0 0 2px rgba(48,36,56,.32), 0 0 10px rgba(114,228,255,.34);
  transform-origin: left center;
  animation: oracle-progress 2.8s steps(10, end) infinite;
  z-index: 1;
}

.oracle-button.loading span,
.oracle-button.loading small {
  position: relative;
  z-index: 2;
}

.oracle-button.loading > span:not(.oracle-crystal) {
  align-self: end;
  font-size: 15px;
  text-shadow: 2px 2px 0 #1b1728;
}

.oracle-button.loading small {
  align-self: start;
  color: rgba(255,244,210,.84);
  letter-spacing: 0;
}

.oracle-crystal {
  grid-row: 1 / 3;
  position: relative;
  width: 38px;
  height: 38px;
  border: 3px solid rgba(255,244,210,.72);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,.95) 0 5px, transparent 6px),
    radial-gradient(circle at 58% 58%, rgba(114,228,255,.92), rgba(79,112,188,.62) 48%, rgba(32,25,56,.9) 74%);
  box-shadow:
    0 0 0 3px rgba(114,228,255,.14),
    0 0 14px rgba(114,228,255,.62),
    2px 3px 0 #1b1728,
    inset -4px -5px 0 rgba(28, 38, 82, .32);
  animation: oracle-crystal-gaze 1.9s steps(6, end) infinite;
}

@keyframes oracle-progress {
  0% { transform: scaleX(.12); opacity: .72; }
  55% { transform: scaleX(.72); opacity: 1; }
  100% { transform: scaleX(1); opacity: .78; }
}

.oracle-crystal::after {
  display: none;
}

.oracle-crystal i {
  position: absolute;
  display: block;
  width: 4px;
  height: 4px;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(255,244,210,.8);
  animation: oracle-orbit 1.8s steps(6, end) infinite;
}

.oracle-crystal i:nth-child(1) { left: 9px; top: 18px; animation-delay: -.2s; }
.oracle-crystal i:nth-child(2) { left: 22px; top: 11px; width: 3px; height: 3px; animation-delay: -.7s; }
.oracle-crystal i:nth-child(3) { left: 24px; top: 24px; width: 3px; height: 3px; animation-delay: -1.1s; }

@keyframes oracle-crystal-gaze {
  0%, 100% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
  50% {
    transform: translateY(-2px) scale(1.04);
    filter: brightness(1.16);
  }
}

@keyframes oracle-orbit {
  0%, 100% { transform: translate(0, 0); opacity: .58; }
  33% { transform: translate(5px, -3px); opacity: 1; }
  66% { transform: translate(-3px, 4px); opacity: .8; }
}

@keyframes oracle-stars-drift {
  0%, 100% { transform: translateX(0); opacity: .46; }
  50% { transform: translateX(8px); opacity: .82; }
}

.oracle-reading h4 {
  margin: 2px 0 14px;
  text-align: center;
  color: var(--red-dark);
  font-size: 22px;
  line-height: 1.2;
}

.oracle-reading p {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.68;
  font-weight: 800;
}

.oracle-reading p strong {
  display: inline;
  margin: 0;
  color: var(--red-dark);
  font-size: 15px;
  font-weight: 900;
}

.compact-action {
  width: 100%;
  margin: 10px 0 12px;
}

.annotation-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 4px solid rgba(48,36,56,.24);
  min-width: 0;
  overflow: hidden;
}

.annotation-panel input,
.annotation-panel textarea {
  margin-bottom: 8px;
  min-width: 0;
}

.annotation-list {
  display: grid;
  gap: 10px;
}

.annotation-item {
  min-width: 0;
  max-width: 100%;
  padding: 12px;
  overflow: hidden;
  color: var(--ink);
  background: #fff7d7;
  border: 3px solid #94704c;
}

.annotation-item strong {
  display: block;
  margin-bottom: 6px;
  color: var(--red-dark);
}

.annotation-item p {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.45;
  font-weight: 800;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.annotation-tags {
  display: block;
  margin-bottom: 10px;
  color: #73513e;
  font-size: 11px;
  font-weight: 900;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.annotation-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.annotation-actions button {
  height: 34px;
  color: var(--ink);
  background: #d0a458;
  border: 3px solid #8c5a37;
  font-size: 12px;
  font-weight: 900;
}

.quiet-card {
  position: relative;
  width: 162px;
  aspect-ratio: var(--tarot-card-aspect);
  height: auto;
  margin: 34px auto 20px;
  box-shadow: 0 0 0 6px var(--line), 10px 10px 0 #111224, 0 0 42px rgba(114,228,255,.2);
  cursor: pointer;
  transition: transform 0.2s;
}

#view-meditation {
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: max(48px, calc(28px + var(--safe-bottom)));
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

#view-meditation .page-top {
  min-height: calc(82px + var(--safe-top));
  padding: calc(7px + var(--safe-top)) 18px 7px;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  overflow: hidden;
}

#view-meditation .meditation-top-actions {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px;
  grid-auto-rows: 38px;
  gap: 8px;
  justify-content: end;
  align-content: start;
}

#view-meditation .meditation-top-actions .icon-button {
  width: 38px;
  height: 38px;
  min-width: 38px;
}

.meditation-top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-button.active {
  color: var(--ink);
  background: var(--gold);
  border-color: #8c5a37;
  box-shadow: inset -4px -4px 0 #aa713d;
}

.icon-button.mini {
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  font-size: 20px;
}

.meditation-player-panel {
  display: none;
  position: absolute;
  z-index: 6;
  top: 76px;
  left: 50%;
  width: min(338px, calc(100% - 28px));
  max-height: calc(100% - 96px - max(12px, env(safe-area-inset-bottom)));
  padding: 14px;
  transform: translateX(-50%);
  color: var(--cream);
  background: #16182b;
  border: 4px solid var(--line);
  box-shadow: 8px 8px 0 #070914;
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.meditation-player-panel.open {
  display: flex;
  flex-direction: column;
}

.meditation-menu-panel {
  display: none;
  position: absolute;
  z-index: 7;
  top: 82px;
  right: 18px;
  width: 156px;
  padding: 8px;
  color: var(--cream);
  background: #16182b;
  border: 4px solid var(--line);
  box-shadow: 8px 8px 0 #070914;
}

.meditation-menu-panel.open {
  display: grid;
  gap: 8px;
}

.meditation-menu-panel button {
  min-height: 42px;
  padding: 8px 10px;
  color: var(--cream);
  background: #44506f;
  border: 3px solid #1d1f34;
  box-shadow: inset -4px -4px 0 rgba(19, 22, 41, .38);
  font-size: 16px;
  font-weight: 900;
}

.meditation-player-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 12px;
  align-items: center;
  padding: 2px 2px 12px;
}

.meditation-player-head span,
.meditation-track-item small {
  display: block;
  color: #e9d097;
  font-size: 11px;
  font-weight: 900;
}

.meditation-player-head strong,
.meditation-track-item span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}

.meditation-track-list {
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  align-content: start;
  gap: 9px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 2px 2px 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.meditation-track-item {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  text-align: left;
  color: var(--cream);
  background: #2b3146;
  border: 3px solid #1d1f34;
  box-shadow: inset -4px -4px 0 #202538;
  touch-action: pan-y;
}

.meditation-track-item::after {
  content: "♪";
  color: #e9d097;
  font-size: 16px;
  line-height: 1;
  opacity: .68;
}

.meditation-track-item.active {
  color: var(--ink);
  background: #d7b55b;
  border-color: #8c5a37;
  box-shadow: inset -4px -4px 0 #aa713d;
}

.meditation-track-item.active small {
  color: #604034;
}

.meditation-track-item.active::after {
  color: var(--ink);
  opacity: 1;
}

.meditation-next-action {
  width: 100%;
  margin-top: 12px;
  padding: 10px 12px;
  color: var(--cream);
  background: #44506f;
  border: 3px solid #1d1f34;
  box-shadow: 5px 5px 0 #070914, inset -4px -4px 0 rgba(19, 22, 41, .38);
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}

.quiet-card:hover {
  transform: scale(1.02);
}

.quiet-card.med-card-back {
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiet-card.med-card-back::before {
  content: "";
  position: absolute;
  left: 66px;
  top: 54px;
  width: 30px;
  height: 30px;
  background: var(--gold);
  border: 4px solid #aa713d;
}

.quiet-card.med-card-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(180deg, #fff0bf, #d2965e 56%, #604661);
}

#view-meditation .quiet-card {
  width: min(166px, 48vw);
  aspect-ratio: var(--tarot-card-aspect);
  height: auto;
  margin: 16px auto 10px;
}

#view-meditation .quiet-card::before,
#view-meditation .quiet-card.med-card-back::before {
  left: calc(50% - 15px);
  top: 20%;
}

#view-meditation .quiet-card.med-card-face {
  padding: 14px;
}

#view-meditation .quiet-card.med-card-face .card-art {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.quiet-card.med-card-face.reversed .card-art {
  transform: rotate(180deg);
}

.quiet-card.flipping {
  animation: cardFlip 0.4s ease-in-out;
}

@keyframes cardFlip {
  0% { transform: rotateY(0deg); }
  50% { transform: rotateY(90deg); }
  100% { transform: rotateY(0deg); }
}

.card-flip-hint {
  text-align: center;
  color: var(--cream);
  font-size: 14px;
  margin: -10px 0 20px;
  opacity: 0.7;
}

#view-meditation .card-flip-hint {
  min-height: 18px;
  margin: 0 18px 6px;
  font-size: 12px;
  line-height: 1.25;
}

.meditation-history-list {
  max-height: 60vh;
  overflow-y: auto;
  padding: 10px 0;
}

.med-record-item {
  background: #fff7d7;
  border: 3px solid #94704c;
  padding: 12px 16px;
  margin-bottom: 12px;
  border-radius: 4px;
}

.med-record-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-weight: bold;
  color: var(--ink);
}

.med-record-date {
  font-size: 12px;
  color: #5a3820;
  font-weight: 900;
  margin-bottom: 8px;
}

.med-record-note {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 800;
  margin: 0;
  padding-top: 8px;
  border-top: 2px solid rgba(48, 36, 56, .45);
}

.timer {
  text-align: center;
  margin-bottom: 20px;
}

#view-meditation .timer {
  margin-bottom: 8px;
}

#timer-display {
  color: var(--cream);
  font-size: 52px;
  line-height: 1;
  font-weight: 900;
  text-shadow: 4px 4px 0 #241833;
}

#view-meditation #timer-display {
  font-size: clamp(38px, 10vw, 50px);
}

#timer-hint {
  margin: 8px 0 0;
  color: #e9d097;
  font-size: 13px;
  font-weight: 900;
}

#view-meditation #timer-hint {
  margin-top: 4px;
  font-size: 12px;
}

.time-options {
  margin: 0 18px 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

#view-meditation .time-options {
  margin: 0 18px 10px;
  gap: 6px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#view-meditation .time-options button {
  height: 46px;
  min-height: 46px;
}

#view-meditation #timer-toggle {
  width: calc(100% - 36px);
  height: 46px;
  min-height: 46px;
  margin: 0 18px 10px;
}

.hold-finish-action {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  text-align: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.hold-finish-action span {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  height: 100%;
  line-height: 1.15;
  text-align: center;
}

.hold-finish-action i {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  background: rgba(255, 216, 119, .34);
  pointer-events: none;
  transform: scaleX(var(--hold-progress, 0));
  transform-origin: left center;
}

.meditation-note-panel {
  display: block;
  margin: 10px 18px 0;
  padding: 10px;
}

.meditation-note-panel textarea {
  min-height: 96px;
  height: 96px;
  margin-bottom: 8px;
}

.meditation-note-panel #save-meditation-btn {
  height: 38px;
  min-height: 38px;
  margin: 0;
  display: block;
}

.meditation-note-panel #save-meditation-btn:disabled {
  opacity: .55;
}

#view-meditation.meditation-note-open .time-options,
#view-meditation.meditation-note-open #timer-toggle,
#view-meditation.meditation-save-visible .time-options,
#view-meditation.meditation-save-visible #timer-toggle {
  display: grid;
}

#view-meditation.meditation-note-open .quiet-card,
#view-meditation.meditation-save-visible .quiet-card {
  width: min(166px, 48vw);
  aspect-ratio: var(--tarot-card-aspect);
  height: auto;
  margin-top: 16px;
}

#view-meditation.meditation-note-open .timer,
#view-meditation.meditation-save-visible .timer {
  margin-bottom: 6px;
}

@media (max-height: 760px) {
  #view-meditation .quiet-card {
    width: min(154px, 46vw);
    aspect-ratio: var(--tarot-card-aspect);
    height: auto;
    margin-top: 14px;
  }

  #view-meditation #timer-display {
    font-size: 38px;
  }

  #view-meditation #timer-toggle {
    height: 40px;
    min-height: 40px;
    margin-bottom: 8px;
  }

  #view-meditation .time-options button {
    height: 40px;
    min-height: 40px;
  }
}

.time-options button {
  color: var(--cream);
  background: #3d465d;
  border-color: #1d1f34;
  box-shadow: inset -4px -4px 0 #2d3145;
}

.time-options button.active {
  color: var(--ink);
  background: var(--gold);
  border-color: #8c5a37;
  box-shadow: inset -4px -4px 0 #aa713d;
}

#view-meditation.meditation-awake-active .quiet-card {
  animation: meditationCardDrift 18s ease-in-out infinite alternate;
}

#view-meditation.meditation-awake-active .timer {
  animation: meditationDrift 18s ease-in-out infinite alternate;
}

#view-meditation.meditation-awake-active .timer {
  animation-delay: -8s;
}

#view-meditation.meditation-burn-guard {
  filter: brightness(.86) saturate(.88);
}

#view-meditation.meditation-burn-guard .quiet-card,
#view-meditation.meditation-burn-guard .timer,
#view-meditation.meditation-burn-guard .time-options,
#view-meditation.meditation-burn-guard .primary-action,
#view-meditation.meditation-burn-guard .feed-top {
  opacity: .82;
}

#view-meditation.meditation-burn-guard .quiet-card {
  box-shadow: 0 0 0 4px rgba(48, 36, 56, .86), 6px 6px 0 rgba(17, 18, 36, .82), 0 0 22px rgba(114, 228, 255, .12);
}

#view-meditation.meditation-burn-guard #timer-display {
  text-shadow: 2px 2px 0 rgba(36, 24, 51, .78);
}

@keyframes meditationDrift {
  0% { transform: translate3d(-2px, 1px, 0); }
  50% { transform: translate3d(2px, -2px, 0); }
  100% { transform: translate3d(1px, 2px, 0); }
}

@keyframes meditationCardDrift {
  0% { left: -2px; top: 1px; }
  50% { left: 2px; top: -2px; }
  100% { left: 1px; top: 2px; }
}


.research-hero {
  margin: 0 18px 14px;
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border-color: var(--green);
  background:
    radial-gradient(circle at 88% 22%, rgba(108,225,183,.2), transparent 34%),
    rgba(35, 32, 54, .94);
}

.research-hero strong {
  display: block;
  margin: 3px 0 6px;
  color: var(--cream);
  font-size: 18px;
  text-shadow: 2px 2px 0 var(--line);
}

.research-hero p {
  margin: 0;
  color: #d8c59b;
  font-size: 11px;
  line-height: 1.55;
}

.research-hero > b {
  min-width: 76px;
  padding: 10px 8px;
  display: grid;
  place-items: center;
  background: #fff0bf;
  border: 4px solid #4f352d;
  box-shadow: 4px 4px 0 #161225;
  color: var(--line);
  font-size: 20px;
}

.research-hero > b small {
  margin-top: 2px;
  color: #713843;
  font-size: 10px;
}

.research-service-grid {
  margin: 0 18px 14px;
  display: grid;
  gap: 10px;
}

.research-service-card {
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr minmax(86px, auto);
  gap: 10px;
  align-items: center;
}

.research-service-card.unlocked {
  border-color: var(--green);
  box-shadow: 4px 4px 0 rgba(48,36,56,.28), 0 0 0 3px rgba(108,225,183,.22);
}

.research-service-card span {
  display: block;
  margin-bottom: 4px;
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
}

.research-service-card strong {
  display: block;
  color: var(--cream);
  font-size: 14px;
  text-shadow: 2px 2px 0 var(--line);
}

.research-service-card p {
  margin: 5px 0 0;
  color: #d8c59b;
  font-size: 11px;
  line-height: 1.5;
}

.research-service-card button {
  width: 100%;
  min-width: 86px;
}

.workshop-result-panel,
.card-back-collection {
  margin: 0 18px 14px;
}

.workshop-result-content {
  min-height: 84px;
  color: var(--cream);
  font-size: 12px;
  line-height: 1.65;
}

.workshop-result-content p {
  margin: 0;
}

.workshop-result-head {
  margin-bottom: 10px;
  display: grid;
  gap: 3px;
}

.workshop-result-head strong {
  color: var(--gold);
  font-size: 15px;
  text-shadow: 2px 2px 0 var(--line);
}

.workshop-result-head span {
  color: #d8c59b;
  font-size: 11px;
  font-weight: 900;
}

.workshop-result-section {
  margin-top: 8px;
  padding: 9px;
  background: rgba(255, 240, 191, .08);
  border: 3px solid rgba(170, 113, 61, .75);
}

.workshop-result-section b {
  display: block;
  margin-bottom: 4px;
  color: var(--green);
  font-size: 12px;
}

.workshop-result-section p {
  margin: 0;
  color: var(--cream);
}

.card-back-collection .shop-grid {
  margin: 10px 0 0;
}


.shop-grid article {
  padding: 10px;
}

.card-back-item {
  display: grid;
  align-content: start;
  gap: 7px;
}

.card-back-item.equipped {
  border-color: var(--green);
  box-shadow: 4px 4px 0 rgba(48,36,56,.28), 0 0 0 3px rgba(108,225,183,.26);
}

.card-back-preview {
  width: 100%;
  aspect-ratio: 0.66;
  min-height: 118px;
  border: 5px solid #fff4d2;
  box-shadow: 5px 5px 0 #1b1728;
  background-color: #241833;
  background-image: var(--card-back-image);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  cursor: pointer;
}

.card-back-preview::before {
  display: none;
}

.card-back-action {
  width: 100%;
  height: 38px;
  margin: 4px 0 0;
  font-size: 12px;
}

.card-back-action:disabled {
  opacity: .72;
  filter: saturate(.7);
}

.shop-grid strong {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
}

.shop-grid span {
  color: #73513e;
  font-size: 11px;
  font-weight: 900;
}

.desktop-notes {
  display: none;
}

.desktop-notes h2 {
  margin: 0 0 18px;
  font-size: 42px;
  text-shadow: 4px 4px 0 #422848;
}

.desktop-notes p {
  max-width: 620px;
  color: #d8c59b;
  font-size: 18px;
  line-height: 1.65;
}

.desktop-grid {
  max-width: 660px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.desktop-grid div {
  padding: 14px;
  background: rgba(37,35,60,.78);
  border: 4px solid #8f6b4d;
  box-shadow: 5px 5px 0 #0d1020;
}

.desktop-grid strong {
  display: block;
  margin-bottom: 6px;
  color: #fff8d7;
  font-size: 15px;
}

.desktop-grid span {
  display: block;
  color: #d8c59b;
  font-size: 13px;
  line-height: 1.45;
}

.desktop-notes {
  display: none;
}

@media (min-width: 901px) {
  body {
    overflow: hidden;
  }

  .view-page {
    margin: 0;
    padding: 18px;
  }

  .view-page.active {
    display: block;
  }

  .page-top {
    min-height: 54px;
    padding: 0;
    grid-template-columns: 38px minmax(0, 1fr) 38px;
  }

  .page-top h2 {
    text-align: left;
    font-size: 26px;
  }

  .page-top > .icon-button[data-route="home"] {
    visibility: hidden;
  }

  .settings-panel {
    top: 18px;
    right: 18px;
    width: 260px;
  }

  .auth-entry-panel {
    width: min(520px, calc(100% - 64px));
    margin: 0 auto;
  }

  #view-home .map-bg {
    object-fit: contain;
    padding: 14px;
  }

  #view-home .map-shade {
    background: radial-gradient(circle at 50% 42%, rgba(13, 16, 34, .08), rgba(13, 16, 34, .36) 72%, rgba(13, 16, 34, .58));
  }

  .map-marker span {
    font-size: 14px;
  }

  #view-daily.active {
    display: grid;
    grid-template-columns: minmax(420px, 1.15fr) minmax(320px, .85fr);
    grid-template-rows: auto auto auto 1fr;
    gap: 16px;
    align-items: start;
  }

  #view-daily .page-top {
    grid-column: 1 / -1;
  }

  #view-daily .draw-hero,
  #view-daily .form-panel,
  #view-daily .secondary-action,
  #view-daily .two-cards {
    margin: 0;
  }

  #view-daily .draw-hero {
    grid-row: 2 / span 4;
    min-height: min(560px, calc(100vh - 120px));
  }

  #view-daily .form-panel,
  #view-daily .secondary-action,
  #view-daily .two-cards {
    width: 100%;
  }

  #view-daily .tarot-card {
    right: clamp(56px, 9vw, 130px);
    top: 72px;
    width: 180px;
  }

  #view-daily .daily-card-hint {
    right: clamp(56px, 9vw, 130px);
    top: 386px;
    width: 180px;
  }

  #view-daily .altar {
    right: clamp(36px, 7vw, 96px);
    bottom: 54px;
    width: 260px;
  }

  #view-library.active {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    grid-template-rows: auto auto auto minmax(0, 1fr);
    gap: 14px 18px;
    align-items: start;
    overflow: hidden;
  }

  #view-library .page-top {
    grid-column: 1 / -1;
  }

  #view-library .search-box {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    margin: 0;
    position: static;
  }

  #view-library .card-grid {
    grid-column: 1;
    grid-row: 3 / span 2;
    margin: 0;
    grid-template-columns: 1fr;
    align-content: start;
    max-height: calc(100vh - 190px);
    overflow-y: auto;
    padding-right: 4px;
  }

  #view-library .library-head,
  #view-library .tab-row,
  #view-library .library-note-panel {
    grid-column: 2;
    margin: 0;
  }

  #view-library .library-head {
    grid-template-columns: 150px minmax(0, 1fr);
    align-items: start;
  }

  #view-library .big-card {
    width: 150px;
  }

  #view-library .tab-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #view-library .library-note-panel {
    min-height: 0;
    overflow-y: auto;
  }

  #view-cases.active {
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr) minmax(300px, 360px);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 14px;
    overflow: hidden;
  }

  #view-cases .page-top {
    grid-column: 1 / -1;
  }

  #view-cases .case-step {
    grid-column: 1 / 3;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
  }

  #view-cases .form-panel,
  #view-cases .primary-action,
  #view-cases .secondary-action,
  #view-cases .list-panel {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  #case-list {
    grid-column: 3;
    grid-row: 2;
    margin: 0;
    align-content: start;
    overflow-y: auto;
    padding-right: 4px;
  }

  #step-reading[style*="block"] {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 410px);
    gap: 14px;
    align-items: start;
  }

  #spread-display,
  #case-question-summary {
    grid-column: 1;
  }

  #case-reading-panel,
  #save-case-btn {
    grid-column: 2;
  }

  #view-meditation.active {
    display: grid;
    grid-template-columns: minmax(340px, 1fr) minmax(340px, 440px);
    grid-template-rows: auto auto auto auto minmax(0, 1fr);
    gap: 12px 18px;
    align-items: start;
    overflow: hidden;
  }

  #view-meditation .page-top {
    grid-column: 1 / -1;
  }

  #view-meditation .quiet-card,
  #view-meditation .card-flip-hint,
  #view-meditation .timer,
  #view-meditation .time-options,
  #view-meditation #timer-toggle {
    grid-column: 1;
  }

  #view-meditation .quiet-card {
    width: min(230px, 30vw);
    margin: 14px auto 8px;
  }

  #view-meditation .timer,
  #view-meditation .time-options,
  #view-meditation #timer-toggle,
  #view-meditation .card-flip-hint {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  #view-meditation .meditation-note-panel {
    grid-column: 2;
    grid-row: 2 / span 4;
    align-self: stretch;
    display: grid;
    grid-template-rows: auto minmax(260px, 1fr) auto;
    margin: 14px 0 0;
  }

  #view-meditation .meditation-note-panel textarea {
    height: auto;
    min-height: 260px;
  }

  #view-meditation .meditation-player-panel {
    left: auto;
    right: 18px;
    top: 76px;
    width: 360px;
    transform: none;
  }

  #view-membership.active {
    overflow-y: auto;
  }

  #view-membership .membership-page-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
  }

  #view-membership .purchase-panel-head,
  #view-membership .purchase-tier-switch,
  #view-membership .purchase-period-switch,
  #view-membership .membership-grid,
  #view-membership .membership-target-card,
  #view-membership .compliance-card,
  #view-membership .purchase-coming-soon,
  #view-membership .purchase-device-box,
  #view-membership .purchase-actions,
  #view-membership .license-code-row,
  #view-membership #membership-refresh-license-btn {
    grid-column: 1 / -1;
  }

  #view-membership .membership-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .card-detail-modal,
  .legal-modal,
  .announcement-modal {
    position: absolute;
    display: none;
    place-items: center;
    padding: 28px;
  }

  .card-detail-modal.open,
  .legal-modal.open {
    display: grid;
  }

  .card-detail-panel,
  .legal-modal-panel {
    width: min(980px, 100%);
    max-height: calc(100vh - 120px);
    min-height: 0;
    overflow-y: auto;
  }

  .card-library-detail-modal .card-detail-panel {
    width: min(1080px, 100%);
  }
}

.debug-state {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.toast {
  animation: toast-in var(--motion-mid) var(--pixel-ease);
}

.toast.toast-error {
  background: #ffe0d6 !important;
  border-color: var(--red-dark) !important;
}

.toast.toast-out {
  animation: toast-out var(--motion-mid) var(--pixel-ease) forwards;
}

/* ── 占卜案例新流程 ─────────────────────────── */

.case-step {
  padding-top: 4px;
}

.case-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 4px 0 12px;
}

.case-mode-switch button {
  height: 40px;
  color: var(--ink);
  background: #d0a458;
  border: 3px solid #8c5a37;
  box-shadow: 3px 3px 0 #5a3820;
  font-size: 13px;
  font-weight: 900;
}

.case-mode-switch button.active {
  background: #fff7d7;
  border-color: var(--line);
}

/* 牌阵选择网格 */
.spread-category-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 4px 0 8px;
}

.spread-category-tabs button {
  min-height: 34px;
  color: var(--ink);
  background: #d0a458;
  border: 3px solid #8c5a37;
  box-shadow: 2px 2px 0 #5a3820;
  font-size: 11px;
  font-weight: 900;
}

.spread-category-tabs button.active {
  background: #fff7d7;
  border-color: var(--line);
}

.spread-select-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.spread-option-wrap {
  position: relative;
}

.spread-option {
  min-height: 168px;
  width: 100%;
  height: 100%;
  padding: 8px 8px 10px;
  background: #d0a458;
  border: 3px solid #8c5a37;
  box-shadow: 3px 3px 0 #5a3820;
  color: var(--ink);
  text-align: center;
}

.spread-option b {
  display: block;
  font-size: 13px;
  margin-bottom: 3px;
  line-height: 1.18;
}

.spread-option small {
  display: block;
  font-size: 10px;
  color: #5a3820;
  font-weight: 900;
}

.spread-option.active {
  background: #fff7d7;
  border-color: var(--line);
}

.spread-option.locked {
  background: linear-gradient(180deg, #d8b36d, #c79d55);
}

.spread-option.locked b,
.spread-option.locked small {
  opacity: .96;
}

.spread-card-count,
.spread-preview-btn,
.spread-delete-btn,
.spread-lock-badge {
  position: absolute;
  top: 6px;
  z-index: 3;
  height: 22px;
  display: inline-grid;
  place-items: center;
  color: var(--cream);
  background: var(--line);
  border: 2px solid rgba(255, 244, 210, 0.72);
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
}

.spread-card-count {
  left: 6px;
  min-width: 30px;
}

.spread-preview-btn {
  right: 6px;
  min-width: 34px;
}

.spread-lock-badge {
  left: 50%;
  transform: translateX(-50%);
  min-width: 52px;
  padding: 0 6px;
  background: #8a5b12;
  border-color: rgba(255, 244, 210, 0.82);
}

.spread-preview-btn:active {
  filter: brightness(1.2);
}

.spread-delete-btn {
  top: auto;
  bottom: 6px;
  right: 6px;
  min-width: 34px;
  background: #7a2e2e;
  border-color: #cc6666;
}

.spread-delete-btn:active {
  filter: brightness(1.3);
}

.spread-diagram {
  position: relative;
  width: 100%;
  height: 170px;
  margin: 0 auto 8px;
  background:
    linear-gradient(#30243814 1px, transparent 1px),
    linear-gradient(90deg, #30243814 1px, transparent 1px),
    rgba(255, 247, 215, 0.5);
  background-size: 14px 14px;
  border: 2px solid rgba(48, 36, 56, 0.32);
}

.spread-diagram.compact {
  height: 106px;
  margin-top: 24px;
  overflow: hidden;
}

.spread-diagram.hex-preview::before,
.spread-diagram.hex-preview::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62%;
  height: 62%;
  border: 1px solid rgba(224, 186, 88, 0.36);
  transform: translate(-50%, -50%) rotate(30deg);
  clip-path: polygon(50% 0, 100% 86%, 0 86%);
  pointer-events: none;
}

.spread-diagram.hex-preview::after {
  transform: translate(-50%, -50%) rotate(210deg);
}

.spread-diagram-card {
  position: absolute;
  width: 24px;
  height: 34px;
  transform: translate(-50%, -50%) rotate(var(--diagram-rotate, 0deg));
  display: grid;
  place-items: center;
  color: var(--gold);
  background: #171422;
  border: 2px solid #fff4d2;
  box-shadow: 2px 2px 0 rgba(48,36,56,.45);
  font-size: 12px;
  font-weight: 900;
}

.spread-diagram.medium .spread-diagram-card {
  width: 22px;
  height: 31px;
  font-size: 10px;
}

.spread-diagram.dense .spread-diagram-card {
  width: 17px;
  height: 24px;
  font-size: 9px;
  border-width: 1px;
  box-shadow: 1px 1px 0 rgba(48,36,56,.45);
}

.spread-diagram.crowded .spread-diagram-card {
  width: 14px;
  height: 20px;
  font-size: 8px;
}

.spread-diagram.compact .spread-diagram-card {
  width: 16px;
  height: 23px;
  font-size: 9px;
  border-width: 1px;
  box-shadow: 1px 1px 0 rgba(48,36,56,.45);
}

.spread-diagram.compact.crowded .spread-diagram-card {
  width: 11px;
  height: 16px;
  font-size: 7px;
}

.spread-diagram.compact.celtic-cross .spread-diagram-card {
  width: 10px;
  height: 15px;
  font-size: 7px;
}

.spread-diagram.compact .spread-diagram-card em {
  display: none;
}

.spread-diagram-card em {
  position: absolute;
  left: 50%;
  top: calc(100% + 2px);
  width: 64px;
  transform: translateX(-50%);
  color: #5a3820;
  font-style: normal;
  font-size: 8px;
  line-height: 1.1;
  white-space: normal;
}

.spread-preview-panel {
  min-height: auto;
}

.spread-preview-layout {
  display: grid;
  gap: 14px;
}

.spread-preview-layout .spread-diagram {
  height: 280px;
  margin: 0;
  background-size: 18px 18px;
}

.spread-preview-layout .spread-diagram-card {
  width: 38px;
  height: 54px;
  font-size: 14px;
}

.spread-preview-layout .spread-diagram.medium .spread-diagram-card,
.spread-preview-layout .spread-diagram.dense .spread-diagram-card {
  width: 34px;
  height: 48px;
  font-size: 13px;
  border-width: 2px;
}

.spread-preview-layout .spread-diagram.crowded .spread-diagram-card {
  width: 28px;
  height: 40px;
  font-size: 12px;
}

.spread-preview-layout .spread-diagram.celtic-cross .spread-diagram-card {
  width: 26px;
  height: 38px;
  font-size: 11px;
}

.spread-slot-list {
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
  list-style: none;
}

.spread-slot-list li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 900;
}

.spread-slot-list b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--gold);
  background: #171422;
  border: 2px solid #fff4d2;
}

.custom-spread-panel {
  margin-top: 10px;
  padding: 10px;
  background: rgba(255, 247, 215, 0.6);
  border: 3px solid rgba(48, 36, 56, 0.55);
}

.custom-spread-panel input {
  margin-bottom: 8px;
}

.custom-spread-slots {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.custom-spread-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.custom-spread-actions .compact-action {
  width: 100%;
  min-width: 0;
  padding-inline: 8px;
  font-size: 13px;
}

.save-custom-spread-btn {
  color: var(--ink);
  background: var(--gold);
  border-color: #8c5a37;
  box-shadow: 4px 4px 0 #5a3820, inset -4px -4px 0 #aa713d;
}

.custom-slot-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  margin: 0;
}

.custom-slot-row span {
  display: grid;
  place-items: center;
  height: 34px;
  color: var(--cream);
  background: var(--line);
  font-size: 12px;
}

.custom-slot-row input {
  margin: 0;
}

@media (max-width: 360px) {
  .custom-spread-actions {
    grid-template-columns: 1fr;
  }
}

/* 洗牌区 */
.shuffle-area {
  margin: 14px 18px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
}

.deck-pile {
  width: 88px;
  height: 138px;
  position: relative;
  background-color: #241833;
  background-image: var(--equipped-card-back-image, url("assets/card-backs/classic.webp"));
  background-size: cover;
  background-position: center;
  border: 5px solid #fff4d2;
  box-shadow: 6px 6px 0 #1b1728, 4px 4px 0 4px #3d3060;
  cursor: pointer;
  transition: transform .1s;
  touch-action: none;
}

.deck-pile::before,
.deck-pile::after {
  content: "";
  position: absolute;
  inset: -5px;
  z-index: -1;
  background-color: #241833;
  background-image: var(--equipped-card-back-image, url("assets/card-backs/classic.webp"));
  background-size: cover;
  background-position: center;
  border: 5px solid #fff4d2;
  box-shadow: 4px 4px 0 #1b1728;
}

.deck-pile::before { transform: translate(-10px, 8px) rotate(-6deg); }
.deck-pile::after { transform: translate(10px, 8px) rotate(6deg); }
.deck-pile.shuffling::before { animation: shuffleLeft 1.4s steps(2, end) infinite; }
.deck-pile.shuffling::after { animation: shuffleRight 1.4s steps(2, end) infinite; }
.deck-pile.shuffle-pulse { animation: deckPulse .24s steps(2, end); }
.deck-pile.ready { box-shadow: 6px 6px 0 #1b1728, 4px 4px 0 4px #3d3060, 0 0 0 6px rgba(215,181,91,.34); }
.deck-pile.dealing { pointer-events: none; transform: translateY(2px); }
.deck-pile:active { transform: scale(.97); }
.deck-pile.done { opacity: .5; cursor: default; }

#skip-shuffle-btn {
  width: min(180px, 70%);
  margin: 0;
  font-size: 12px;
}

#shuffle-hint {
  color: #73513e;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

#flying-card-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.flying-draw-card {
  position: absolute;
  left: 0;
  top: 0;
  width: 62px;
  height: 96px;
  background:
    linear-gradient(90deg, transparent 47%, rgba(255,244,210,.42) 47% 58%, transparent 58%),
    linear-gradient(180deg, #2f2942, #6a4d68 56%, #241833);
  border: 4px solid #fff4d2;
  box-shadow: 4px 4px 0 #1b1728;
  animation: flyDrawCard .42s cubic-bezier(.2,.8,.2,1) forwards;
  transform: translate(var(--fly-from-x), var(--fly-from-y)) rotate(-8deg) scale(1);
}

/* 已抽出的牌槽 */
#drawn-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 0 18px 14px;
}

.draw-slot {
  width: 62px;
  height: 96px;
  background:
    linear-gradient(90deg, transparent 47%, rgba(255,244,210,.42) 47% 58%, transparent 58%),
    linear-gradient(180deg, #fff0bf, #d2965e 56%, #604661);
  border: 4px solid #fff4d2;
  box-shadow: 4px 4px 0 #1b1728;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: transform .15s;
  position: relative;
  overflow: hidden;
}

.draw-slot.empty {
  opacity: .58;
  background:
    linear-gradient(90deg, transparent 47%, rgba(255,244,210,.22) 47% 58%, transparent 58%),
    linear-gradient(180deg, #fff6d7, #d7bd83 56%, #a57a62);
}

.draw-slot.filled {
  opacity: 1;
}

.draw-slot.fresh {
  animation: drawSlotPop .32s steps(2, end);
}

.draw-slot small {
  font-size: 9px;
  font-weight: 900;
  color: var(--ink);
  text-align: center;
  padding: 0 2px;
  position: relative;
  z-index: 2;
}

.draw-slot img {
  width: 100%;
  height: 80%;
  object-fit: cover;
}

.draw-slot .card-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--gold);
  border: 2px solid #aa713d;
  font-size: 16px;
  font-weight: 900;
  color: var(--ink);
}

.draw-slot.reversed { transform: none; }
.draw-slot.reversed img,
.draw-slot.reversed .card-mark { transform: rotate(180deg); }
.draw-slot.reversed small { transform: none; }

@keyframes shuffleLeft {
  0%, 100% { transform: translate(-10px, 8px) rotate(-6deg); }
  50% { transform: translate(-22px, 2px) rotate(-13deg); }
}

@keyframes shuffleRight {
  0%, 100% { transform: translate(10px, 8px) rotate(6deg); }
  50% { transform: translate(22px, 2px) rotate(13deg); }
}

@keyframes deckPulse {
  0% { transform: translateX(0) rotate(0); }
  35% { transform: translateX(-8px) rotate(-4deg); }
  70% { transform: translateX(8px) rotate(4deg); }
  100% { transform: translateX(0) rotate(0); }
}

@keyframes flyDrawCard {
  0% { transform: translate(var(--fly-from-x), var(--fly-from-y)) rotate(-8deg) scale(1); opacity: 1; }
  58% { transform: translate(var(--fly-to-x), calc(var(--fly-to-y) - 64px)) rotate(7deg) scale(1.04); opacity: 1; }
  100% { transform: translate(var(--fly-to-x), var(--fly-to-y)) rotate(0) scale(.96); opacity: .2; }
}

@keyframes drawSlotPop {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.06); }
  100% { transform: translateY(0) scale(1); }
}

/* 自选牌 */
.pick-panel {
  margin-bottom: 14px;
}

.pick-slots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.pick-slot {
  min-height: 70px;
  padding: 8px;
  color: var(--ink);
  background: #d0a458;
  border: 3px solid #8c5a37;
  box-shadow: 3px 3px 0 #5a3820;
  text-align: left;
}

.pick-slot.active {
  background: #fff7d7;
  border-color: var(--line);
}

.pick-slot.filled {
  background: #fff0bf;
}

.pick-slot small,
.pick-slot span {
  display: block;
  color: #73513e;
  font-size: 10px;
  font-weight: 900;
}

.pick-slot strong {
  display: block;
  margin: 3px 0;
  font-size: 13px;
  line-height: 1.25;
}

.pick-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.pick-tools .compact-action {
  margin: 0;
  width: 100%;
}

.pick-card-grid {
  padding-bottom: 18px;
}

.pick-card-grid button:disabled {
  opacity: .48;
  cursor: not-allowed;
}

/* 牌阵展示（解读步骤） */
.spread-grid-display {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 14px 18px;
}

.spread-board-shell {
  margin: 14px 18px;
}

.spread-board-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.spread-board-status b {
  color: var(--cream);
  background: var(--line);
  border: 2px solid rgba(255, 244, 210, 0.72);
  padding: 3px 7px;
}

.spread-board-display {
  --case-card-scale: 1;
  position: relative;
  height: clamp(420px, 74vh, 640px);
  background:
    linear-gradient(#30243814 1px, transparent 1px),
    linear-gradient(90deg, #30243814 1px, transparent 1px),
    rgba(255, 240, 191, 0.72);
  background-size: 18px 18px;
  border: 4px solid rgba(48, 36, 56, 0.85);
  box-shadow: 4px 4px 0 rgba(48,36,56,.25);
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
}

.spread-board-shell.readonly {
  margin: 8px 0 12px;
}

.spread-board-shell.readonly .spread-board-display {
  height: clamp(360px, 58vh, 520px);
}

.spread-card {
  --card-rotate: 0deg;
  width: 64px;
  aspect-ratio: var(--tarot-card-aspect);
  height: auto;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(var(--card-rotate)) scale(var(--case-card-scale));
  transform-origin: center;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  cursor: grab;
  overflow: visible;
  touch-action: none;
  perspective: 900px;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}

.spread-card:active {
  cursor: grabbing;
}

.spread-card.selected {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.spread-card.face-down {
  z-index: 6;
}

.spread-card.face-down.selected {
  z-index: 7;
}

.spread-card.flipped {
  z-index: 3;
}

.spread-card.flipping {
  z-index: 12;
  cursor: default;
}

.spread-card-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform .18s steps(3, end);
  will-change: transform;
}

.spread-card.flipped .spread-card-inner {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
}

.spread-card.flipping .spread-card-inner {
  animation: spread-card-inner-flip .58s cubic-bezier(.2,.82,.2,1) forwards;
  -webkit-animation: spread-card-inner-flip .58s cubic-bezier(.2,.82,.2,1) forwards;
}

.spread-card-side {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  border: 3px solid #fff4d2;
  box-shadow: 4px 4px 0 #1b1728;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}

.spread-card-front {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
  border: 0;
  background: transparent;
}

.spread-card-back {
  transform: rotateY(0deg);
  -webkit-transform: rotateY(0deg);
}

.spread-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #fff4d2;
  pointer-events: none;
}

.spread-card .card-mark {
  width: 34px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--gold);
  border: 2px solid #aa713d;
  font-size: 16px;
  font-weight: 900;
  color: var(--ink);
  pointer-events: none;
}

.spread-card-back,
.spread-card-back-mini {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--gold);
  background-color: #241833;
  background-image: var(--equipped-card-back-image, url("assets/card-backs/classic.webp"));
  background-size: cover;
  background-position: center;
  font-weight: 900;
  pointer-events: none;
}

.spread-card-back-mini {
  width: 32px;
  aspect-ratio: var(--tarot-card-aspect);
  margin: 0 auto 4px;
}

.spread-card-index {
  position: absolute;
  left: -8px;
  top: -8px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  color: var(--cream);
  background: var(--line);
  border: 2px solid #fff4d2;
  font-size: 10px;
  font-weight: 900;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}

.spread-card.flipping .spread-card-index,
.spread-card.flipped .spread-card-index {
  opacity: 0;
  transform: scale(.7);
}

.spread-card.reversed img,
.spread-card.reversed .card-mark {
  transform: rotate(180deg);
}

@keyframes spread-card-inner-flip {
  0% {
    transform: rotateY(0deg) scale(1);
    -webkit-transform: rotateY(0deg) scale(1);
    filter: brightness(1);
  }
  42% {
    transform: rotateY(88deg) scale(1.04);
    -webkit-transform: rotateY(88deg) scale(1.04);
    filter: brightness(1.18);
  }
  50% {
    transform: rotateY(96deg) scale(1.04);
    -webkit-transform: rotateY(96deg) scale(1.04);
    filter: brightness(1.28);
  }
  100% {
    transform: rotateY(180deg) scale(1);
    -webkit-transform: rotateY(180deg) scale(1);
    filter: brightness(1);
  }
}

.spread-board-tools {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.spread-board-tools span {
  grid-column: 1 / -1;
  color: #5a3820;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.35;
}

.spread-scale-control {
  min-width: 0;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: #5a3820;
  font-size: 11px;
  font-weight: 900;
}

.spread-scale-control span {
  grid-column: auto;
  white-space: nowrap;
}

.spread-scale-control input {
  width: 100%;
  min-width: 0;
  accent-color: #302438;
}

.spread-selected-info {
  display: grid;
  gap: 5px;
  margin-top: 8px;
  padding: 8px;
  color: var(--ink);
  background: rgba(255, 247, 215, .72);
  border: 3px solid rgba(48, 36, 56, .55);
  font-size: 12px;
  font-weight: 900;
}

.spread-selected-info span {
  color: #5a3820;
  line-height: 1.35;
}

.spread-selected-info button {
  width: fit-content;
}

/* AI辅助按钮 */
#ai-assist-btn {
  background: #3d4b71;
  border-color: #6688cc;
  box-shadow: 3px 3px 0 #20284a;
}

/* 案例列表 */
.case-list-item {
  cursor: pointer;
  transition: border-color .1s;
}
.case-list-item:hover { border-color: var(--gold); }

.case-date {
  color: #a08060 !important;
  font-size: 10px !important;
  margin-top: 4px;
}

/* 分享按钮行 */
.share-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 16px 16px;
}

.share-actions .compact-action {
  margin: 0;
  width: 100%;
  font-size: 12px;
}

@media (max-width: 900px) {
  :root {
    --safe-top: max(28px, env(safe-area-inset-top));
  }

  .app-shell {
    display: block;
    padding: 0;
  }

  .device {
    width: 100vw;
    height: 100vh;
    padding: 0;
    min-height: 0;
    display: block;
    border: 0;
    box-shadow: none;
  }

  .desktop-nav {
    display: none;
  }

  .screen {
    border: 0;
  }

  .church-consult-scene {
    min-height: min(540px, calc(100vh - 190px));
    margin-left: -8px;
    margin-right: -8px;
    padding: 22px 12px 14px;
  }

  .church-scene-guest {
    top: 30px;
  }

  .church-guest-avatar,
  .church-guest-avatar-img.scene {
    width: 136px;
    height: 136px;
  }

  .church-dialogue-box {
    min-height: 132px;
    padding: 12px 13px 10px;
  }

  .church-question-text {
    font-size: 14px;
    line-height: 1.6;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

/* ── 抽牌动画 ─────────────────────────────────── */
@keyframes card-deal {
  0%   { transform: translateY(-120px) rotate(-18deg) scale(.7); opacity: 0; }
  60%  { transform: translateY(6px) rotate(1deg) scale(1.04); opacity: 1; }
  100% { transform: translateY(0) rotate(0) scale(1); opacity: 1; }
}

@keyframes card-flip {
  0%   { transform: scaleX(1); }
  50%  { transform: scaleX(0); }
  100% { transform: scaleX(1); }
}

.tarot-card.dealing {
  animation: card-deal .55s cubic-bezier(.22,.68,0,1.2) forwards;
}

.tarot-card.flipping {
  animation: card-flip .4s ease-in-out forwards;
}

/* ── 历史记录卡片可点击 ─────────────────────────── */
.info-card.clickable {
  cursor: pointer;
  transition: border-color .15s;
}
.info-card.clickable:hover { border-color: var(--gold); }

/* ── 日运历史弹窗列表 ────────────────────────────── */
.daily-history-list {
  display: grid;
  gap: 10px;
  padding-bottom: 8px;
}

.daily-history-item {
  padding: 12px;
  background: #fff7d7;
  border: 3px solid #94704c;
}

.daily-history-item .dh-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.daily-history-item .dh-date {
  color: #73513e;
  font-size: 11px;
  font-weight: 900;
}

.daily-history-item .dh-card {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.daily-history-item .dh-mini-card {
  width: 36px;
  height: 56px;
  flex-shrink: 0;
  background:
    linear-gradient(90deg, transparent 47%, rgba(255,244,210,.42) 47% 58%, transparent 58%),
    linear-gradient(180deg, #fff0bf, #d2965e 56%, #604661);
  border: 3px solid #fff4d2;
  box-shadow: 2px 2px 0 #1b1728;
  overflow: hidden;
}

.daily-history-item .dh-mini-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.daily-history-item .dh-card-name {
  font-size: 15px;
  font-weight: 900;
  color: var(--ink);
}

.daily-history-item .dh-note {
  color: #4a3428;
  font-size: 12px;
  line-height: 1.5;
  font-weight: 700;
  white-space: pre-wrap;
}

/* ── 深夜教堂 ─────────────────────────────────────── */
.church-intro {
  text-align: center;
  color: var(--cream);
  opacity: 0.7;
  font-size: 14px;
  line-height: 1.7;
  padding: 16px 0 8px;
}

.church-guest-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  background: var(--deep);
  border: 2px solid var(--line);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.church-guest-card.done {
  opacity: 0.72;
}

.church-guest-card.church-guest-special {
  border-color: #e0ba58;
  box-shadow: inset 0 0 18px rgba(224, 186, 88, 0.18), 0 0 14px rgba(224, 186, 88, 0.22);
  animation: church-special-glow 2.8s ease-in-out infinite;
}

@keyframes church-special-glow {
  0%, 100% { box-shadow: inset 0 0 18px rgba(224, 186, 88, 0.18), 0 0 14px rgba(224, 186, 88, 0.22); }
  50% { box-shadow: inset 0 0 28px rgba(224, 186, 88, 0.32), 0 0 24px rgba(224, 186, 88, 0.38); }
}

.church-special-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 900;
  color: #ffe9a8;
  background: linear-gradient(135deg, #3a2410, #5a3414);
  border: 1px solid #f3c76a;
  border-radius: 3px;
  padding: 2px 6px;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
  box-shadow: 0 0 8px rgba(243, 199, 106, 0.45);
}

.church-guest-body {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.church-guest-avatar-sm {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.church-guest-avatar-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  border: 2px solid rgba(243, 199, 106, 0.55);
  background: #15101f;
}

.church-guest-avatar-img.large {
  width: 72px;
  height: 72px;
}

.church-guest-avatar-img.scene {
  width: 150px;
  height: 150px;
  border-width: 3px;
  box-shadow: 0 10px 0 rgba(18, 13, 30, 0.78), 0 0 22px rgba(243, 199, 106, 0.28);
}

.church-guest-avatar-img.fallback {
  display: grid;
  place-items: center;
  font-size: 28px;
}

.church-guest-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.church-guest-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 8px;
}

.church-guest-info strong {
  color: var(--cream);
  font-size: 15px;
  line-height: 1.25;
}

.church-guest-info span {
  color: var(--gold);
  font-size: 12px;
  line-height: 1.25;
}

.church-guest-info p {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
}

.church-guest-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.church-guest-info small {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 2px 6px;
  border: 1px solid rgba(243, 199, 106, 0.28);
  background: rgba(243, 199, 106, 0.08);
  color: #aaa;
  font-size: 12px;
  line-height: 1.25;
}

.church-wait-badge {
  color: var(--gold);
  font-size: 11px;
}

.church-done-badge {
  color: #7cdb8a;
  font-size: 11px;
}

.church-receive-btn {
  width: 100%;
  margin-top: auto;
}

.church-guest-avatar {
  width: 150px;
  height: 150px;
  flex-shrink: 0;
  line-height: 1;
}

.church-guest-name {
  color: var(--gold);
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 4px;
}

.church-guest-bg {
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.church-consult-scene {
  position: relative;
  min-height: min(560px, calc(100vh - 210px));
  margin: 4px -10px 14px;
  padding: 28px 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  border: 3px solid rgba(166, 113, 62, 0.9);
  background: #15182b url("assets/church/church-consult-room.webp") center / cover no-repeat;
  box-shadow: 0 8px 0 rgba(27, 20, 42, 0.86);
}

.church-consult-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(10, 12, 28, 0.1), rgba(9, 10, 22, 0.4) 64%, rgba(8, 7, 17, 0.76)),
    radial-gradient(circle at 50% 34%, rgba(242, 194, 99, 0.18), transparent 34%);
  pointer-events: none;
}

.church-scene-guest {
  position: absolute;
  top: 44px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 1;
}

.church-scene-nameplate {
  min-width: 190px;
  max-width: 78vw;
  padding: 8px 12px;
  text-align: center;
  background: rgba(22, 18, 35, 0.88);
  border: 2px solid rgba(243, 199, 106, 0.72);
  box-shadow: 0 4px 0 rgba(16, 12, 26, 0.78);
}

.church-scene-nameplate .church-guest-name {
  margin: 0 0 3px;
}

.church-scene-nameplate .church-guest-bg {
  font-size: 12px;
  color: rgba(255, 242, 190, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.church-dialogue-box {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 142px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  padding: 14px 16px 12px;
  border: 3px solid rgba(243, 199, 106, 0.92);
  background: rgba(21, 18, 37, 0.93);
  color: var(--cream);
  box-shadow: 0 6px 0 rgba(20, 15, 32, 0.86);
  font: inherit;
}

.church-dialogue-box:active {
  transform: translateY(1px);
}

.church-dialogue-speaker {
  width: fit-content;
  max-width: 100%;
  padding: 4px 10px;
  color: #23172f;
  background: var(--gold);
  font-size: 13px;
  font-weight: 800;
}

.church-question-text {
  color: var(--cream);
  font-size: 15px;
  line-height: 1.65;
  margin: 0;
  min-height: 50px;
}

.church-question-text.speaking {
  animation: church-line-in 180ms steps(2, end);
}

.church-dialogue-hint {
  align-self: flex-end;
  color: rgba(243, 199, 106, 0.76);
  font-size: 12px;
  animation: church-hint-blink 1.1s steps(2, end) infinite;
}

.church-hint {
  text-align: center;
  color: #aaa;
  font-size: 13px;
  margin: 8px 0;
}

.church-clue-panel {
  margin: 0 10px 12px;
  padding: 10px;
  border-color: var(--gold);
  background: rgba(25, 24, 42, .9);
}

.church-clue-content {
  color: var(--cream);
  font-size: 11px;
  line-height: 1.55;
}

.church-clue-content .workshop-result-head {
  margin-bottom: 6px;
}

.church-clue-content .workshop-result-section {
  padding: 7px;
  margin-top: 6px;
}

.church-clue-panel button {
  width: 100%;
  margin-top: 8px;
}

.church-drawn-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.church-drawn-cards.is-busy {
  opacity: .72;
  pointer-events: none;
}

#church-cards-area {
  animation: church-line-in 180ms steps(2, end);
}

.church-card-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  background: var(--deep);
  border: 2px solid var(--gold);
  padding: 7px 6px 8px;
  width: calc(25% - 6px);
  min-width: 82px;
  max-width: 98px;
  gap: 4px;
}

.church-card-pos {
  color: var(--gold);
  font-size: 11px;
}

.church-card-face {
  width: 43px;
  aspect-ratio: var(--tarot-card-aspect);
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(90deg, transparent 47%, rgba(255,244,210,.3) 47% 58%, transparent 58%),
    linear-gradient(180deg, #fff0bf, #d2965e 56%, #604661);
  border: 3px solid #fff4d2;
  box-shadow: 3px 3px 0 #1b1728;
}

.church-card-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.church-card-face.has-art {
  border: 0;
  background: transparent;
}

.church-card-face.reversed img,
.church-card-face.reversed .card-mark {
  transform: rotate(180deg);
}

.church-card-face .card-mark {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--gold);
  border: 2px solid #aa713d;
  font-size: 14px;
  font-weight: 900;
}

.church-card-chip strong {
  color: var(--cream);
  font-size: 12px;
  text-align: center;
  line-height: 1.15;
}

.church-card-chip small {
  color: #aaa;
  font-size: 10px;
  line-height: 1.15;
  text-align: center;
}

.church-card-remove {
  margin-top: 5px;
  min-width: 52px;
  height: 26px;
  color: var(--cream);
  background: #6f2f45;
  border: 2px solid #d2965e;
  font-size: 11px;
  font-weight: 900;
}

.church-undo-card-btn {
  color: var(--cream);
  background: #36384f;
  border-color: #d2965e;
}

.church-feedback-panel {
  text-align: left;
  padding: 20px 16px;
}

.church-feedback-stars {
  font-size: 24px;
  color: var(--gold);
  margin-bottom: 12px;
  letter-spacing: 4px;
  text-align: center;
}

.church-feedback-panel p {
  color: var(--cream);
  font-size: 14px;
  line-height: 1.7;
  margin: 0;
}

.church-feedback-section {
  padding: 11px 12px;
  margin-bottom: 10px;
  background: rgba(13, 15, 31, .52);
  border: 2px solid rgba(227, 182, 90, .72);
  box-shadow: 3px 3px 0 rgba(8, 8, 18, .42);
}

.church-feedback-section strong {
  display: block;
  margin-bottom: 6px;
  color: var(--gold);
  font-size: 13px;
}

.church-feedback-section p {
  font-size: 13px;
  line-height: 1.65;
}

.church-reward-badge {
  display: block;
  width: min(100%, 360px);
  background: var(--gold);
  color: #1a1528;
  font-weight: 900;
  font-size: clamp(13px, 3.2vw, 16px);
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  padding: 12px 16px;
  margin: 18px auto 18px;
  border: 2px solid rgba(26, 21, 40, 0.22);
  box-shadow: 4px 4px 0 rgba(8, 8, 18, .42);
}

#church-next-btn {
  width: min(100%, 430px);
  min-height: 62px;
  margin: 0 auto;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.church-history-guest {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.church-history-modal {
  padding: calc(18px + var(--safe-top)) 12px calc(18px + var(--safe-bottom));
}

.church-history-panel {
  min-height: 0;
  max-height: calc(100vh - var(--safe-top) - var(--safe-bottom) - 36px);
  display: flex;
  flex-direction: column;
  padding: 14px 10px 12px;
  overflow: hidden;
}

.church-history-panel .detail-top {
  flex: 0 0 auto;
  padding: 0 0 10px;
}

#church-history-list.meditation-history-list {
  flex: 1 1 auto;
  max-height: none;
  min-height: 0;
  padding: 4px 0 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.church-history-item {
  padding: 10px;
  margin-bottom: 10px;
  border-width: 3px;
}

.church-history-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.church-history-guest b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.church-history-reward {
  padding: 3px 6px;
  border: 2px solid #94704c;
  background: #e7bd56;
  box-shadow: 2px 2px 0 rgba(48,36,56,.28);
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
}

.church-history-question {
  font-size: 13px;
}

.church-history-summary {
  margin-top: 8px;
  color: #5a3820;
  font-size: 12px;
  line-height: 1.45;
}

.church-history-avatar-img {
  width: 26px;
  height: 26px;
  object-fit: cover;
  image-rendering: pixelated;
  border: 1px solid rgba(243, 199, 106, 0.45);
  background: #15101f;
}

.church-history-avatar-fallback {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;

}
