:root {
  --bg: #120e1b;
  --bg-2: #1a1428;
  --panel: rgba(20, 15, 30, .78);
  --ink: #f1e6d2;
  --ink-soft: #c9bfae;
  --muted: #9a90a6;
  --gold: #d9b77a;
  --gold-2: #c69c5f;
  --line: rgba(217, 183, 122, .35);
  --line-soft: rgba(217, 183, 122, .18);
  --violet: #8d74b5;
  --serif: "Cormorant Garamond", "Lora", Georgia, serif;
  --body: "Lora", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: clip; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ---------- background ---------- */
.sky {
  position: absolute; inset: 0 0 auto 0; height: 820px; z-index: 0; pointer-events: none;
  background: url("/img/landscape.webp") center top / cover no-repeat;
  -webkit-mask-image: linear-gradient(#000 65%, transparent);
          mask-image: linear-gradient(#000 65%, transparent);
}
.sky::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(12, 9, 18, .55), transparent 45%); }
body:not(.is-home) .sky::after { background: radial-gradient(70% 60% at 50% 35%, rgba(12, 9, 18, .7), rgba(12, 9, 18, .25)); }

/* ---------- nav ---------- */
.nav {
  position: relative; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 12px 72px; min-height: 68px; background: linear-gradient(rgba(12, 9, 18, .9), rgba(12, 9, 18, .4));
}
.logo { font-family: var(--serif); font-size: 28px; letter-spacing: .04em; display: flex; align-items: center; gap: 12px; white-space: nowrap; direction: ltr; }
.logo-mark { display: block; width: 42px; height: 42px; object-fit: contain; flex-shrink: 0; }
.nav-links { display: flex; gap: 42px; font-family: var(--serif); font-size: 19px; color: var(--ink-soft); }
.nav-links a { position: relative; padding: 4px 0; }
.nav-links a:hover, .nav-links a.active { color: var(--gold); }
.nav-links a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px; background: var(--gold); }
.btn-outline {
  border: 1px solid var(--gold); border-radius: 999px; padding: 10px 26px; font-family: var(--serif); font-size: 18px;
  display: inline-flex; gap: 16px; align-items: center; transition: background .2s; background: none; cursor: pointer; white-space: nowrap;
}
.btn-outline span { color: var(--gold); }
.btn-outline:hover { background: rgba(217, 183, 122, .12); }
.btn-outline.small { padding: 7px 18px; font-size: 16px; }

/* ---------- buttons & text ---------- */
.btn-gold {
  display: inline-flex; align-items: center; justify-content: center; gap: 22px;
  padding: 15px 44px; border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(180deg, #e8cc97, #c9a066 60%, #b98f57);
  color: #2a1d10; font-family: var(--serif); font-size: 23px; font-weight: 500; text-shadow: none;
  box-shadow: 0 6px 30px rgba(217, 183, 122, .25), inset 0 1px 0 rgba(255, 255, 255, .5);
  transition: transform .2s, box-shadow .2s, opacity .2s;
}
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 8px 40px rgba(217, 183, 122, .38), inset 0 1px 0 rgba(255,255,255,.5); }
.btn-gold:disabled { opacity: .5; cursor: default; transform: none; }
.btn-gold.small { font-size: 18px; padding: 11px 34px; gap: 14px; }
.link { color: var(--gold); border-bottom: 1px solid var(--line); cursor: pointer; background: none; border-top: 0; border-left: 0; border-right: 0; padding: 0; }
.link:hover { border-color: var(--gold); }
.link.danger { color: #d89a9a; border-color: rgba(216, 154, 154, .35); }
.muted { color: var(--muted); }

.view { position: relative; z-index: 2; flex: 1; width: 100%; }
.page { max-width: 1180px; margin: 0 auto; padding: 24px 32px 40px; }
.page-head { text-align: center; margin-bottom: 26px; }
.ornament { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--gold); font-size: 20px; }
.ornament span { width: 72px; height: 1px; background: var(--line); }
.title { font-family: var(--serif); font-weight: 500; font-size: clamp(40px, 5vw, 62px); margin: 4px 0 2px; line-height: 1.05; }
.subtitle { font-family: var(--serif); font-size: 22px; color: #d6cae6; margin: 4px 0 0; }
.rule-title { display: flex; align-items: center; gap: 36px; justify-content: center; font-family: var(--serif); font-weight: 500; font-size: 40px; margin: 0 0 20px; }
.rule-title::before, .rule-title::after { content: ""; height: 1px; flex: 0 1 280px; background: linear-gradient(90deg, transparent, var(--line)); }
.rule-title::after { background: linear-gradient(90deg, var(--line), transparent); }
.hero-text, .page-head, .rule-title, .ritual-text, .slot-num { text-shadow: 0 1px 3px rgba(8, 6, 14, .9), 0 0 18px rgba(8, 6, 14, .8); }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1fr 1.05fr; align-items: center; max-width: 1440px; margin: 0 auto; padding: 10px 72px 0 112px; min-height: 560px; }
.hero h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(52px, 6.4vw, 92px); line-height: .95; margin: 30px 0 18px; color: #f4ead8; }
.lead { font-family: var(--serif); font-size: clamp(22px, 2.2vw, 30px); line-height: 1.25; color: var(--ink-soft); margin: 0 0 34px; }
.hero-cards { position: relative; height: 520px; }
.orbit { position: absolute; inset: -20px 0 0 0; width: 100%; height: 100%; }
.fan { position: absolute; inset: 0; }
.fan-card { position: absolute; top: 50%; left: 50%; aspect-ratio: 2 / 3; filter: drop-shadow(0 18px 30px rgba(0,0,0,.6)); transition: transform .5s; }
.fan-card.left   { width: 200px; transform: translate(-50%, -46%) translateX(-200px) rotate(-8deg); }
.fan-card.right  { width: 200px; transform: translate(-50%, -46%) translateX(200px) rotate(8deg); }
.fan-card.center { width: 255px; transform: translate(-50%, -52%); z-index: 2; }
.hero-cards:hover .fan-card.left  { transform: translate(-50%, -46%) translateX(-215px) rotate(-10deg); }
.hero-cards:hover .fan-card.right { transform: translate(-50%, -46%) translateX(215px) rotate(10deg); }

/* ---------- spread tiles ---------- */
.start { max-width: 1400px; margin: 0 auto; padding: 10px 80px 10px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.tile {
  position: relative; overflow: hidden; border: 1px solid rgba(217, 183, 122, .22); border-radius: 12px;
  padding: 26px 22px 22px; text-align: center; min-height: 240px; background: var(--panel);
  display: flex; flex-direction: column; align-items: center; transition: border-color .25s, transform .25s;
}
.tile::before, .tile::after { content: ""; position: absolute; bottom: 0; width: 110px; height: 160px; opacity: .5; background: var(--leaf) no-repeat bottom / contain; pointer-events: none; }
.tile::before { left: 0; }
.tile::after { right: 0; transform: scaleX(-1); }
.tile:hover { transform: translateY(-3px); border-color: rgba(217, 183, 122, .6); }
.tile.featured { border-color: rgba(217, 183, 122, .8); background: radial-gradient(120% 90% at 50% 0%, #3a2b52 0%, #251c37 55%, #1a1428 100%); }
.tile-art { width: calc(100% + 44px); margin: -26px -22px 12px; aspect-ratio: 3 / 2; overflow: hidden; background: #151020; position: relative; }
.tile-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 70%, var(--panel)); pointer-events: none; }
.tile-art img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .45s ease; }
.tile:hover .tile-art img { transform: scale(1.035); }
@media (prefers-reduced-motion: reduce) { .tile-art img { transition: none; } .tile:hover .tile-art img { transform: none; } }
.tile h3 { font-family: var(--serif); font-weight: 500; font-size: 29px; margin: 10px 0 6px; }
.tile p { font-family: var(--serif); font-size: 17px; color: var(--ink-soft); margin: 0 0 6px; position: relative; }
.tile .count { font-size: 13px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 18px; }
.round-btn { margin-top: auto; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--gold); display: grid; place-items: center; font-size: 18px; transition: background .25s; position: relative; }
.tile.featured .round-btn { background: radial-gradient(circle, #8d74b5, #5d4a86); border-color: #e2d4f2; }
.tile:hover .round-btn { background: rgba(217, 183, 122, .2); }
.more { text-align: center; margin: 22px 0 0; font-family: var(--serif); font-size: 20px; }

/* ---------- cards (shared) ---------- */
.card-img { position: relative; width: 100%; height: 100%; border-radius: 9px; overflow: hidden; box-shadow: 0 0 0 1px rgba(217, 183, 122, .55); background: #17111f; container-type: inline-size; }
.card-img img, .card-img svg { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; }
.plaque {
  position: absolute; left: 50%; bottom: 5%; transform: translateX(-50%); max-width: 88%; overflow: hidden; text-overflow: ellipsis;
  padding: .25em .9em; border: 1px solid rgba(217, 183, 122, .7); border-radius: 3px; background: rgba(14, 11, 24, .85);
  color: var(--gold); font-family: var(--serif); font-weight: 600; font-size: clamp(7px, 6.2cqw, 15px); letter-spacing: .1em; text-transform: uppercase; white-space: nowrap;
}
.is-rev > .card-img, .card-img.is-rev { transform: rotate(180deg); }

.card3d { --t: 5px; position: relative; width: 100%; aspect-ratio: 2 / 3; perspective: 1200px; cursor: pointer; border: 0; padding: 0; background: none; display: block; }
.card3d .inner, .demo-card .inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.card3d.open .inner { transform: rotateY(180deg); }
.card3d.flipping .inner { animation: flip 600ms forwards; }
@keyframes flip {
  0%   { transform: rotateY(0); animation-timing-function: cubic-bezier(.45, 0, .7, .4); }
  50%  { transform: translateY(-12px) rotateY(90deg) scale(1.05); animation-timing-function: cubic-bezier(.3, .6, .55, 1); }
  100% { transform: rotateY(180deg); }
}
.card-back, .card-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 10px; }
/* faces sit on either side of the card's thickness */
.card-back { transform: translateZ(calc(var(--t) / 2)); filter: drop-shadow(0 0 14px rgba(240, 190, 140, .35)); }
.card-face { transform: rotateY(180deg) translateZ(calc(var(--t) / 2)); filter: drop-shadow(0 12px 24px rgba(0,0,0,.5)); }
.edge {
  position: absolute; top: 8px; bottom: 8px; left: calc(var(--t) / -2); width: var(--t); transform: rotateY(90deg);
  background: linear-gradient(90deg, #6e5028, #f6dfa6 45%, #c79a5a 60%, #6e5028); box-shadow: 0 0 12px rgba(246, 214, 150, .55);
}
.edge.r { left: calc(100% - var(--t) / 2); }
.card3d:not(.open):not(.flipping) .card-back { filter: none; }
.card3d:not(.open):hover .card-back { filter: drop-shadow(0 0 26px rgba(240, 190, 140, .7)); }
@keyframes breathe { 50% { filter: drop-shadow(0 0 24px rgba(240, 190, 140, .6)); } }
.card3d.open { cursor: default; }

/* ---------- ritual ---------- */
.ritual { max-width: 860px; margin: 0 auto; text-align: center; }
.positions-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 10px; list-style: none; padding: 0; margin: 0 0 26px; counter-reset: pos; }
.positions-list li { counter-increment: pos; border: 1px solid var(--line-soft); border-radius: 999px; padding: 5px 14px; font-family: var(--serif); font-size: 16px; color: var(--ink-soft); background: rgba(14, 11, 24, .6); }
.positions-list li::before { content: counter(pos) " · "; color: var(--gold); }
.ask-form { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.ask-form textarea {
  width: 100%; resize: vertical; min-height: 96px; border-radius: 14px; padding: 18px 22px; background: rgba(14, 11, 24, .82);
  border: 1px solid var(--line); color: var(--ink); font-family: var(--serif); font-size: 22px; outline: none;
}
.ask-form textarea:focus { border-color: var(--gold); }
.tips { width: 100%; text-align: left; border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px 18px; background: rgba(14, 11, 24, .6); font-size: 15px; color: var(--ink-soft); }
.tips summary { cursor: pointer; font-family: var(--serif); font-size: 18px; color: var(--gold); }
.tips ul { margin: 10px 0 2px; padding-left: 20px; line-height: 1.55; }
.check { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; color: var(--ink-soft); cursor: pointer; }
.check input { accent-color: var(--gold); width: 18px; height: 18px; }
.ritual-text { font-family: var(--serif); font-size: 22px; color: var(--ink-soft); margin: 0 0 22px; }
.ritual-text b { color: var(--gold); font-weight: 500; }

.deck-pile { position: relative; width: 150px; aspect-ratio: 2 / 3; margin: 30px auto 36px; }
.deck-pile .card-img { position: absolute; inset: 0; box-shadow: 0 0 0 1px rgba(217,183,122,.55), 0 10px 24px rgba(0,0,0,.5); }
.deck-pile .card-img:nth-child(2) { transform: translate(3px, -3px); }
.deck-pile .card-img:nth-child(3) { transform: translate(6px, -6px); }
.deck-pile.shuffling .card-img:nth-child(1) { animation: riffle-l 600ms ease-in-out 3; }
.deck-pile.shuffling .card-img:nth-child(3) { animation: riffle-r 600ms ease-in-out 3; }
@keyframes riffle-l { 50% { transform: translate(-90px, 6px) rotate(-12deg); } }
@keyframes riffle-r { 50% { transform: translate(96px, 0) rotate(12deg); } }

.cut-piles { display: flex; justify-content: center; gap: 46px; margin: 30px 0 10px; }
.cut-pile { position: relative; width: 120px; aspect-ratio: 2 / 3; background: none; border: 0; padding: 0; cursor: pointer; transition: transform .25s; }
.cut-pile .card-img { position: absolute; inset: 0; }
.cut-pile .card-img:nth-child(2) { transform: translate(3px, -3px); }
.cut-pile:hover { transform: translateY(-10px); }
.cut-pile:hover .card-img { box-shadow: 0 0 0 1px var(--gold), 0 0 28px rgba(240, 190, 140, .55); }

.fan-scroll { width: min(1120px, calc(100vw - 32px)); margin: 10px 0 0 50%; transform: translateX(-50%); }
.fan-deck { position: relative; }
.fan-slot { position: absolute; background: none; border: 0; padding: 0; cursor: pointer; transition: transform .2s, opacity .3s; transform-origin: 50% 120%; }
.fan-slot .card-img { box-shadow: 0 0 0 1px rgba(217,183,122,.5), -3px 0 10px rgba(0,0,0,.6); }
.fan-slot:hover, .fan-slot:focus-visible { z-index: 100 !important; translate: 0 -16px; }
.fan-slot.taken { opacity: 0; pointer-events: none; translate: 0 -60px; }
/* numbered places for the cards being chosen */
.pick-slots { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: -6px 0 14px; }
.pick-slot {
  position: relative; width: 34px; aspect-ratio: 2 / 3; border-radius: 4px; display: grid; place-items: center;
  border: 1px dashed rgba(217, 183, 122, .45); background: rgba(14, 11, 24, .55) center / cover no-repeat;
  transition: border-color .25s, box-shadow .25s, transform .25s;
}
.pick-slot b { font-family: var(--serif); font-weight: 500; font-size: 15px; color: var(--muted); }
.pick-slot.next { border: 1px solid var(--gold); box-shadow: 0 0 14px rgba(240, 190, 140, .45); transform: translateY(-2px); }
.pick-slot.next b { color: var(--gold); }
.pick-slot.filled { border: 1px solid rgba(217, 183, 122, .8); background-image: url("/img/back.webp"); animation: slotLand .35s ease-out; }
.pick-slot.filled b { opacity: 0; }
@keyframes slotLand { 40% { transform: scale(1.15); box-shadow: 0 0 22px rgba(240, 190, 140, .8); } }
.fly-card {
  position: fixed; z-index: 70; pointer-events: none; transform-origin: 0 0;
  transition: transform .45s cubic-bezier(.3, .7, .25, 1), opacity .45s; filter: drop-shadow(0 0 16px rgba(240, 190, 140, .6));
}
.fly-card .card-img { width: 100%; height: 100%; }

.fan-wrap { position: relative; transition: opacity .5s, transform .6s cubic-bezier(.4, 0, .2, 1); }
.fan-cue { display: none; }
/* all cards chosen: the deck sinks away and the slots glow before the reading opens */
.dealt .fan-wrap { opacity: 0; transform: translateY(40px); pointer-events: none; }
.dealt .pick-slot.filled { animation: slotGlow 1s ease-in-out both; }
@keyframes slotGlow { 50% { box-shadow: 0 0 24px rgba(240, 190, 140, .85); transform: translateY(-4px); } }

.notice {
  max-width: 640px; margin: 10px auto; padding: 26px 30px; border: 1px solid var(--line); border-radius: 14px; background: rgba(20, 15, 30, .88);
  font-family: var(--serif); font-size: 20px; line-height: 1.45; text-align: center;
}
.notice h2 { font-weight: 500; font-size: 30px; margin: 0 0 10px; }
.notice p { margin: 0 0 12px; color: var(--ink-soft); }
.notice .actions { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; margin-top: 18px; align-items: center; }

/* ---------- reading ---------- */
.reading-meta { text-align: center; margin: -10px 0 18px; }
.reading-q { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--gold); margin: 6px auto 0; max-width: 720px; }
.layout { position: relative; margin: 10px auto 0; }
.slot { position: absolute; transform: translate(-50%, -50%); }
.slot-num {
  position: absolute; top: -12px; left: -12px; z-index: 5; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: #1c1529; border: 1px solid var(--gold); color: var(--gold); font-family: var(--serif); font-size: 14px;
}
/* Keep labels upright even when the crossing card is rotated. Use lining digits
   instead of the display font's uneven old-style numerals. */
.slot-num {
  font-family: Arial, sans-serif; font-variant-numeric: lining-nums tabular-nums;
  font-weight: 400; font-style: normal; line-height: 1; letter-spacing: 0;
  padding: 0; text-align: center; direction: ltr;
  transform: rotate(calc(0deg - var(--slot-rotation, 0deg)));
}
.pick-slot b { font-family: Arial, sans-serif; font-variant-numeric: lining-nums tabular-nums; line-height: 1; }
.slot.crossing { z-index: 3; }
.layout-actions { text-align: center; margin: 22px 0 6px; }

.interpret { list-style: none; padding: 0; margin: 34px auto 0; max-width: 860px; display: grid; gap: 14px; }
.interpret li { display: grid; grid-template-columns: 74px 1fr; gap: 18px; align-items: start; padding: 18px 20px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--panel); animation: fadeIn .45s both; }
.interpret li.pending { grid-template-columns: 1fr; color: var(--muted); font-family: var(--serif); font-size: 17px; animation: none; }
.interpret .thumb { width: 74px; aspect-ratio: 2 / 3; }
.interpret .pos { font-family: var(--serif); font-size: 15px; color: var(--muted); margin: 0 0 4px; }
.interpret .pos b { color: var(--gold); font-weight: 500; }
.interpret h3 { font-family: var(--serif); font-weight: 500; font-size: 25px; margin: 0 0 6px; }
.tag { display: inline-block; font-family: var(--body); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #e6c3c3; border: 1px solid rgba(230, 195, 195, .4); border-radius: 999px; padding: 2px 8px; vertical-align: middle; margin-left: 8px; }
.kw { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.kw span { font-size: 12px; color: var(--ink-soft); background: rgba(217, 183, 122, .1); border-radius: 999px; padding: 2px 10px; }
.interpret p.text { margin: 0; font-size: 16px; line-height: 1.6; color: var(--ink); }

.summary { max-width: 860px; margin: 26px auto 0; padding: 22px 26px; border: 1px solid var(--line); border-radius: 14px; background: radial-gradient(120% 90% at 50% 0%, #2d2242, #1a1428); animation: fadeIn .5s both; }
.summary h2 { font-family: var(--serif); font-weight: 500; font-size: 28px; margin: 0 0 10px; }
.summary p { margin: 0 0 10px; line-height: 1.6; font-size: 16px; }
.summary p:last-child { margin-bottom: 0; }
.note-box { max-width: 860px; margin: 22px auto 0; }
.note-box label { display: block; font-family: var(--serif); font-size: 20px; margin-bottom: 8px; }
.note-box textarea { width: 100%; min-height: 100px; resize: vertical; border-radius: 12px; padding: 14px 16px; background: rgba(14, 11, 24, .82); border: 1px solid var(--line-soft); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.5; outline: none; }
.note-box textarea:focus { border-color: var(--gold); }
.note-box .row { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 16px; flex-wrap: wrap; }

/* ---------- day ---------- */
.day { display: grid; grid-template-columns: 280px 1fr; gap: 48px; align-items: center; max-width: 900px; margin: 0 auto; }
.day-info h2 { font-family: var(--serif); font-weight: 500; font-size: 42px; margin: 0 0 8px; }
.day-info .advice { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--gold); margin: 14px 0 0; }
.day-info p.text { line-height: 1.65; font-size: 17px; margin: 0; }
.day-hint { text-align: center; font-family: var(--serif); font-size: 22px; color: var(--ink-soft); }

/* ---------- encyclopedia ---------- */
.tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; }
.tabs a { font-family: var(--serif); font-size: 18px; padding: 6px 18px; border: 1px solid var(--line-soft); border-radius: 999px; background: rgba(14, 11, 24, .6); color: var(--ink-soft); }
.tabs a.active, .tabs a:hover { border-color: var(--gold); color: var(--gold); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 22px 18px; }
.grid a { text-align: center; font-family: var(--serif); font-size: 17px; color: var(--ink-soft); transition: transform .2s; }
.grid a:hover { transform: translateY(-4px); color: var(--gold); }
.grid .thumb { aspect-ratio: 2 / 3; margin-bottom: 8px; }
.card-page { display: grid; grid-template-columns: 320px 1fr; gap: 48px; align-items: start; }
.card-page .big { aspect-ratio: 2 / 3; }
.card-page h1 { font-family: var(--serif); font-weight: 500; font-size: 52px; margin: 0; line-height: 1; }
.card-page .meta { color: var(--muted); font-family: var(--serif); font-size: 19px; margin: 8px 0 22px; }
.card-page h2 { font-family: var(--serif); font-weight: 500; font-size: 26px; margin: 22px 0 8px; color: var(--gold); }
.card-page p { line-height: 1.65; font-size: 17px; margin: 0 0 8px; }
.pager { display: flex; justify-content: space-between; margin-top: 34px; font-family: var(--serif); font-size: 18px; }

/* ---------- journal ---------- */
.journal { list-style: none; padding: 0; margin: 0 auto; max-width: 900px; display: grid; gap: 14px; }
.journal a.entry { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; padding: 18px 22px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--panel); transition: border-color .2s; }
.journal a.entry:hover { border-color: var(--gold); }
.journal h3 { font-family: var(--serif); font-weight: 500; font-size: 24px; margin: 0 0 4px; }
.journal .q { font-family: var(--serif); font-style: italic; color: var(--gold); font-size: 18px; margin: 0 0 4px; }
.journal .date { font-size: 13px; color: var(--muted); }
.minis { display: flex; gap: 4px; }
.minis .thumb { width: 34px; aspect-ratio: 2 / 3; }
.empty { text-align: center; font-family: var(--serif); font-size: 22px; color: var(--ink-soft); padding: 40px 0; }

/* ---------- footer, toast, misc ---------- */
.site-footer { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 30px 24px 34px; }
.site-footer .lotus { width: 28px; height: 18px; }
.rule-line { display: flex; align-items: center; gap: 22px; font-size: 13px; color: var(--muted); width: min(820px, 100%); justify-content: center; text-align: center; margin: 0; }
.rule-line::before, .rule-line::after { content: ""; flex: 1; min-width: 30px; height: 1px; background: var(--line); }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; background: #2a2140; border: 1px solid var(--line); padding: 12px 24px; border-radius: 999px; font-family: var(--serif); font-size: 18px; transition: .3s; z-index: 50; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.loading { text-align: center; color: var(--muted); font-family: var(--serif); font-size: 20px; padding: 60px 0; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  .fan-cue.show, .pick-slot { animation: none !important; }
  .card3d.flipping .inner { animation: none; transform: rotateY(180deg); }
  .card3d .card-back, .deck-pile .card-img { animation: none !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .nav { padding: 12px 28px; }
  .nav-links { gap: 26px; font-size: 17px; }
  .hero { padding: 10px 32px 0; }
  .fan-card.left, .fan-card.right { width: 160px; }
  .fan-card.center { width: 205px; }
  .fan-card.left  { transform: translate(-50%, -46%) translateX(-160px) rotate(-8deg); }
  .fan-card.right { transform: translate(-50%, -46%) translateX(160px) rotate(8deg); }
  .start { padding: 10px 32px; }
}
@media (max-width: 860px) {
  .nav { padding: 10px 16px; flex-wrap: wrap; gap: 10px; }
  .logo { font-size: 22px; gap: 10px; }
  .nav-cta { display: none; }
    .nav-links { display: none; order: 3; width: 100%; flex-direction: column; gap: 4px; padding: 8px 0 6px; }
  .hero { grid-template-columns: 1fr; padding: 0 16px; text-align: center; min-height: 0; }
  .hero-cards { height: 330px; order: -1; margin-top: 8px; }
  .orbit { inset: 0; }
  .fan-card.left, .fan-card.right { width: 112px; }
  .fan-card.center { width: 150px; }
  .fan-card.left, .hero-cards:hover .fan-card.left  { transform: translate(-50%, -46%) translateX(-96px) rotate(-8deg); }
  .fan-card.right, .hero-cards:hover .fan-card.right { transform: translate(-50%, -46%) translateX(96px) rotate(8deg); }
  .hero h1 { margin-top: 8px; }
  .start { padding: 36px 16px 0; }
  .rule-title { font-size: 30px; gap: 14px; }
  .rule-title::before, .rule-title::after { flex-basis: 30px; }
  .tiles { grid-template-columns: 1fr; }
  .page { padding: 16px 16px 30px; }
  .subtitle { font-size: 18px; }
  .btn-gold { padding: 13px 32px; font-size: 20px; }
  .cut-piles { gap: 16px; }
  .cut-pile { width: 90px; }
  .interpret li { grid-template-columns: 56px 1fr; gap: 12px; padding: 14px; }
  .interpret .thumb { width: 56px; }
  .interpret h3 { font-size: 21px; }
  .day, .card-page { grid-template-columns: 1fr; gap: 24px; }
  .day .card3d, .card-page .big { max-width: 230px; margin: 0 auto; }
  .card-page h1 { font-size: 40px; text-align: center; }
  .card-page .meta { text-align: center; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 16px 10px; }
  .grid a { font-size: 14px; }
  .journal a.entry { grid-template-columns: 1fr; }
  .slot-num { width: 20px; height: 20px; font-size: 11px; top: -9px; left: -9px; }
}

/* ---------- language switcher ---------- */
.nav-tools { display: flex; align-items: center; gap: 14px; }
.lang { position: relative; }
.lang-btn {
  display: inline-flex; align-items: center; gap: 6px; background: none; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; color: var(--ink-soft); font-size: 13px; letter-spacing: .06em;
}
.lang-btn:hover, .lang-btn[aria-expanded="true"] { border-color: var(--gold); color: var(--gold); }
.lang-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; }
/* ---------- right-to-left languages ---------- */
/* Card layouts are geometry, not text: they keep their left-to-right order. */
.layout, .fan-scroll, .fan-deck, .hero-cards, .deck-pile, .cut-piles, .minis { direction: ltr; }
[dir="rtl"] .tips { text-align: right; }
[dir="rtl"] .arrow { transform: scaleX(-1); }
[dir="rtl"] .arrow-back { transform: none; }
[dir="rtl"] .sky::after { background: linear-gradient(270deg, rgba(12, 9, 18, .55), transparent 45%); }



/* ---------- language panel ---------- */
.lang-panel {
  position: absolute; top: calc(100% + 10px); inset-inline-end: 0; z-index: 40;
  width: 340px; padding: 10px; display: flex; flex-direction: column; gap: 8px;
  background: #1a1428; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
  animation: popIn .16s ease-out;
}
@keyframes popIn { from { opacity: 0; transform: translateY(-6px); } }
.sheet-handle { display: none; }
.lang-search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line-soft); border-radius: 10px; background: rgba(10, 8, 16, .6); }
.lang-search:focus-within { border-color: var(--gold); }
.lang-search svg { width: 17px; height: 17px; flex-shrink: 0; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; }
.lang-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--ink); font: 15px var(--body); padding: 10px 0; }
.lang-search input::-webkit-search-cancel-button { filter: invert(.7); }
.lang-list { list-style: none; margin: 0; padding: 0; max-height: min(60vh, 440px); overflow-y: auto; overscroll-behavior: contain; }
.lang-list button {
  width: 100%; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name check" "local check"; align-items: center;
  column-gap: 10px; text-align: start; background: none; border: 0; border-radius: 10px; padding: 9px 12px; cursor: pointer; color: var(--ink);
}
.lang-list button:hover, .lang-list button:focus-visible { background: rgba(217, 183, 122, .1); outline: none; }
.lang-name { grid-area: name; font-family: var(--body); font-size: 15px; }
.lang-local { grid-area: local; font-size: 12px; color: var(--muted); }
.lang-check { grid-area: check; color: var(--gold); font-size: 16px; }
.lang-list [aria-selected="true"] button { background: rgba(217, 183, 122, .1); }
.lang-list [aria-selected="true"] .lang-name { color: var(--gold); }
.lang-empty { padding: 14px; text-align: center; color: var(--muted); }
.sheet-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(5, 4, 9, .6); backdrop-filter: blur(2px); animation: fadeIn .2s both; }

/* ---------- confirm dialog ---------- */
.dialog-wrap {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px;
  background: rgba(5, 4, 9, .65); backdrop-filter: blur(3px); animation: fadeIn .18s both;
}
.dialog-wrap.closing { opacity: 0; transition: opacity .18s; }
.dialog {
  width: min(420px, 100%); padding: 26px 26px 22px; text-align: center; border: 1px solid var(--line); border-radius: 18px;
  background: radial-gradient(120% 90% at 50% 0%, #2d2242, #1a1428); box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
  animation: popIn .2s ease-out;
}
.dialog p { font-family: var(--serif); font-size: 24px; line-height: 1.3; margin: 12px 0 22px; }
.dialog-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.dialog-actions > * { flex: 1 1 140px; justify-content: center; }
.btn-danger {
  display: inline-flex; align-items: center; justify-content: center; padding: 7px 18px; border-radius: 999px; cursor: pointer;
  font-family: var(--serif); font-size: 16px; color: #f5d9d9; background: rgba(160, 60, 70, .25); border: 1px solid rgba(225, 140, 140, .55);
  transition: background .2s;
}
.btn-danger:hover { background: rgba(170, 60, 70, .45); }

/* ---------- bottom tab bar (phones) ---------- */
.tabbar { display: none; }

@media (max-width: 860px) {
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  body.sheet-open { overflow: hidden; }

  .nav {
    position: sticky; top: 0; z-index: 30; flex-wrap: nowrap; min-height: 0;
    padding: calc(8px + env(safe-area-inset-top)) 16px 8px; gap: 10px;
    /* No backdrop-filter here: it would make the fixed language sheet position itself inside the header. */
    background: rgba(14, 10, 22, .94);
    border-bottom: 1px solid rgba(217, 183, 122, .1);
  }
  body.sheet-open .nav { z-index: 50; }
  .logo { font-size: 20px; gap: 8px; }
  .logo-mark { width: 34px; height: 34px; }
  .nav-links, .nav-cta { display: none; }
  .nav-tools { gap: 0; }
  .lang-btn { height: 38px; padding: 0 12px; font-size: 13px; }

  .lang-panel {
    position: fixed; inset: auto 0 0 0; top: auto; width: auto; z-index: 40;
    padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; border-bottom: 0;
    max-height: 82vh; animation: sheetUp .26s cubic-bezier(.2, .8, .2, 1);
  }
  @keyframes sheetUp { from { transform: translateY(100%); } }
  .sheet-handle { display: block; width: 42px; height: 4px; border-radius: 2px; background: rgba(217, 183, 122, .35); margin: 2px auto 6px; }
  .lang-search input { font-size: 16px; padding: 12px 0; }
  .lang-list { max-height: none; flex: 1; }
  .lang-list button { padding: 12px 12px; min-height: 52px; }
  .lang-name { font-size: 17px; }

  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(14, 10, 22, .9); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(217, 183, 122, .14);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; padding: 4px 2px;
    color: var(--muted); border-radius: 12px; position: relative; -webkit-tap-highlight-color: transparent;
  }
  .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
  .tabbar span { font-size: 10.5px; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: .01em; }
  .tabbar a.active { color: var(--gold); }
  .tabbar a.active::before { content: ""; position: absolute; top: 0; width: 26px; height: 2px; border-radius: 2px; background: var(--gold); box-shadow: 0 0 10px rgba(217, 183, 122, .8); }
  .tabbar a:active { background: rgba(217, 183, 122, .08); }

  .toast { bottom: calc(86px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); text-align: center; }
  .site-footer { padding: 24px 20px 12px; }
  .rule-line { font-size: 12px; gap: 12px; }

  /* home */
  .hero { gap: 0; }
  .hero-cards { height: 300px; margin-top: 4px; }
  .hero h1 { font-size: clamp(40px, 12vw, 54px); margin: 4px 0 12px; }
  .lead { font-size: 19px; margin-bottom: 24px; }
  .hero .btn-gold { width: 100%; max-width: 340px; }
  .start { padding: 40px 16px 0; }
  .tiles { gap: 14px; }
  .tile { min-height: 0; padding: 22px 18px 18px; }
  .tile h3 { font-size: 26px; }

  /* pages */
  .page { padding: 18px 16px 28px; }
  .page-head { margin-bottom: 18px; }
  .title { font-size: clamp(34px, 10vw, 44px); }
  .ornament span { width: 44px; }

  /* ritual */
  .positions-list { gap: 6px; margin-bottom: 18px; }
  .positions-list li { font-size: 14px; padding: 4px 11px; }
  .ask-form textarea { font-size: 19px; min-height: 110px; padding: 14px 16px; }
  .ask-form .btn-gold { width: 100%; }
  .ritual-text { font-size: 20px; }
  .cut-piles { gap: 14px; }
  .cut-pile { width: 28vw; max-width: 110px; }
  .fan-scroll {
    width: 100vw; margin: 6px 0 0 50%; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
            mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  }
  .fan-scroll::-webkit-scrollbar { display: none; }
  .fan-slot:hover { translate: none; }
  .fan-slot:active { translate: 0 -12px; }
  .pick-slots { gap: 6px; margin-bottom: 8px; }
  .pick-slot { width: 28px; }
  .pick-slot b { font-size: 13px; }
  .fan-cue {
    display: block; position: absolute; top: 50%; width: 34px; height: 34px; margin-top: -17px; border-radius: 50%; z-index: 120;
    background: rgba(14, 10, 22, .78); border: 1px solid var(--line); pointer-events: none; opacity: 0; transition: opacity .3s;
  }
  .fan-cue::after {
    content: ""; position: absolute; top: 50%; left: 50%; width: 9px; height: 9px; margin: -5px 0 0 -6px;
    border: solid var(--gold); border-width: 0 2px 2px 0; transform: rotate(-45deg);
  }
  .fan-cue.left { left: 6px; transform: scaleX(-1); }
  .fan-cue.right { right: 6px; }
  .fan-cue.show { opacity: 1; animation: cuePulse 1.6s ease-in-out infinite; }
  @keyframes cuePulse { 50% { box-shadow: 0 0 14px rgba(240, 190, 140, .5); } }

  /* reading */
  .reading-q { font-size: 19px; }
  .layout-actions .btn-outline { width: 100%; max-width: 340px; justify-content: center; }
  .interpret { margin-top: 26px; gap: 12px; }
  .summary { padding: 18px; }
  .summary h2 { font-size: 24px; }
  .note-box .row { flex-direction: column-reverse; align-items: stretch; }
  .note-box .row .btn-gold { width: 100%; }
  .note-box .row .link { align-self: center; }

  /* cards */
  .tabs { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; margin: 0 -16px 22px; padding: 2px 16px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { flex-shrink: 0; font-size: 16px; padding: 6px 14px; }
  .card-page h2 { font-size: 23px; }
  .pager { gap: 16px; font-size: 16px; }

  .dialog p { font-size: 22px; }
}

/* Crawlable language links remain available without JavaScript. */
.seo-languages { margin: 1.5rem auto; max-width: 65rem; padding: 0 1rem; }
.seo-languages summary { cursor: pointer; }
.seo-languages nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem 1rem; padding: 1rem 0; }
.card-page .big > img, .grid .thumb > img { max-width: 100%; height: auto; }

/* Consistent geometric arrows, independent of font metrics and language. */
.arrow {
  display: inline-block; position: relative; width: 20px; height: 20px;
  flex: 0 0 20px; vertical-align: middle; font-size: 0; line-height: 1;
}
.arrow::before {
  content: ""; position: absolute; left: 2px; top: 9px;
  width: 15px; height: 2px; border-radius: 1px; background: currentColor;
}
.arrow::after {
  content: ""; position: absolute; right: 3px; top: 6px;
  width: 8px; height: 8px; border-top: 2px solid currentColor;
  border-right: 2px solid currentColor; transform: rotate(45deg);
}
.arrow-back { transform: scaleX(-1); }
.pager .link { display: inline-flex; align-items: center; gap: 8px; }
.fan-cue::after { margin: 0; transform: translate(-65%, -50%) rotate(-45deg); }
