/* Constellation tarot cards (js/tarot.js, 2026-10-07) — the full card the
   sky page and the profile open, and the small cards of the profile strip.
   A gold-edged frame in the constellation's colour (--acc). Above the sky
   page's full-screen mode (z-index 600). Motion — the flip-in, the sheen,
   the twinkling — is off under reduced motion. */
.modal-overlay.tarot-overlay{
  z-index:700;padding:16px;gap:12px;
  background:radial-gradient(ellipse 70% 60% at 50% 40%,rgba(48,54,108,.5),rgba(3,5,14,.94) 72%);
}
/* Keeps the overlay's fade layer after the .15s fade-in: when it was
   dropped, the buttons on top (×, ‹ ›, save / share) were redrawn just as
   the card came up (measured, 2026-10-11). */
.modal-overlay.tarot-overlay.open{will-change:opacity;}
.tarot-stage{display:flex;flex-direction:column;align-items:center;justify-content:safe center;max-height:100%;overflow-y:auto;perspective:1400px;padding:6px 2px;overscroll-behavior:contain;}
.tarot-card{
  --acc:#FFD98E;--gold:#E9D29A;
  position:relative;flex:none;width:min(360px,calc(100vw - 32px));border-radius:24px;padding:2px;
  background:linear-gradient(150deg,#F4E3B4,#9D7B3D 32%,#F6E8BE 52%,#8A672B 78%,#E7CF95);
  box-shadow:0 0 0 1px rgba(255,236,190,.25),0 30px 80px rgba(0,0,0,.6),0 0 60px rgba(255,217,142,.12);
  transform-origin:50% 50%;
}
/* The flip ends on a transform that changes nothing but is still 3D
   (rotateY(0) scale(1) translateZ(0)), so the card stays on the layer it
   animated on: ending on `none` dropped that layer the moment the card had
   appeared and redrew the whole card into the page — on Android a moment
   late (2026-10-10; iPhone and desktop were fine). That alone did not stop
   the blink; the rest was the star layers, see .tarot-art. Both ends list
   the same functions, so the motion is exactly what it was. */
.tarot-card.flip{animation:tarot-flip .85s cubic-bezier(.2,.75,.25,1) both;}
@keyframes tarot-flip{0%{transform:rotateY(-100deg) scale(.86) translateZ(0);opacity:0}55%{opacity:1}100%{transform:rotateY(0deg) scale(1) translateZ(0);opacity:1}}
.tarot-inner{
  position:relative;overflow:hidden;border-radius:22px;padding:18px 22px 20px;text-align:center;color:#F4F6FF;
  font-family:'Pretendard',sans-serif;
  background:
    radial-gradient(1px 1px at 12% 18%,#fff 50%,transparent 51%),radial-gradient(1px 1px at 84% 12%,#fff 50%,transparent 51%),
    radial-gradient(1.4px 1.4px at 70% 46%,#fff 50%,transparent 51%),radial-gradient(1px 1px at 22% 62%,#dfe6ff 50%,transparent 51%),
    radial-gradient(1px 1px at 90% 74%,#fff 50%,transparent 51%),radial-gradient(1.2px 1.2px at 8% 88%,#fff 50%,transparent 51%),
    radial-gradient(60% 42% at 50% 30%,rgba(255,255,255,.07),transparent 70%),
    linear-gradient(180deg,#151b3c,#0b1026 62%,#120e28);
  box-shadow:inset 0 0 0 7px #0d1229,inset 0 0 0 8px rgba(233,210,154,.55),inset 0 0 0 12px #0d1229,inset 0 0 0 13px rgba(233,210,154,.22);
}
/* The constellation's own colour washing up from behind the painting. */
.tarot-inner::before{content:"";position:absolute;inset:0;pointer-events:none;
  background:radial-gradient(50% 34% at 50% 34%,var(--acc),transparent 72%);opacity:.22;}
.tarot-inner > *{position:relative;}
.tarot-top{display:flex;align-items:center;justify-content:space-between;margin:2px 4px 0;min-height:18px;
  font-family:Georgia,'Times New Roman',serif;font-size:13px;letter-spacing:.14em;color:var(--gold);}
.tarot-orn{font-size:18px;color:var(--gold);text-shadow:0 0 12px rgba(255,226,160,.8);}
.tarot-word{margin:6px 0 2px;font-size:30px;font-weight:800;letter-spacing:.06em;color:var(--acc);text-shadow:0 0 18px rgba(255,255,255,.18);word-break:keep-all;}
/* The painting keeps one layer of its own, clipped to its box (every
   painting and star glow lies inside it). Chrome lifts each twinkling star
   onto a layer of its own; while the card turns, everything drawn after the
   stars rides along in one bundle, and the moment the turn ends Chrome
   re-sorts it — the name and every line below it went onto a brand-new
   layer at ~0.87s (measured with DevTools LayerTree at 412x915 @2.625,
   2026-10-11). A new layer has nothing drawn yet, and Android's WebView
   showed that as the whole lower half of the card blinking. With the stars
   kept inside this box nothing below the painting overlaps them, so there
   is nothing to re-sort. */
.tarot-art{position:relative;width:78%;margin:4px auto 2px;aspect-ratio:1;transform:translateZ(0);contain:paint;}
.tarot-svg{display:block;width:100%;height:100%;overflow:visible;}
.tarot-fig{opacity:.92;}
.tarot-lines line{stroke:var(--acc);stroke-width:.8;stroke-opacity:.8;stroke-linecap:round;}
.tarot-stars path{fill:#FFF8E2;}
.tarot-star{animation:tarot-tw 2.8s ease-in-out infinite;animation-delay:var(--d,0s);}
@keyframes tarot-tw{0%,100%{opacity:1}50%{opacity:.5}}
.tarot-name{margin:4px 0 0;font-size:24px;font-weight:800;letter-spacing:-.01em;color:#fff;}
.tarot-en{margin:2px 0 10px;font-family:Georgia,'Times New Roman',serif;font-style:italic;font-size:14px;color:var(--gold);}
.tarot-meaning{margin:0 auto 8px;max-width:28em;font-size:14px;line-height:1.65;color:rgba(244,246,255,.86);word-break:keep-all;}
.tarot-wish{margin:0 auto 4px;font-size:14.5px;font-weight:600;color:#fff;word-break:keep-all;}
.tarot-line{margin:0 0 12px;font-family:Georgia,'Times New Roman',serif;font-style:italic;font-size:13px;color:rgba(244,246,255,.62);}
.tarot-tags{display:flex;justify-content:center;flex-wrap:wrap;gap:8px;}
.tarot-tags span{padding:5px 14px;border-radius:999px;font-size:13px;font-weight:600;color:#fff;
  border:1px solid rgba(233,210,154,.55);background:rgba(255,255,255,.05);}
.tarot-foot{margin-top:14px;font-family:Georgia,'Times New Roman',serif;font-style:italic;font-size:11px;letter-spacing:.06em;color:rgba(233,210,154,.6);}
/* A slow band of light crossing the card. It moves by transform only, on
   its own compositor layer: animating `left` re-laid out and repainted the
   card under it every frame, and Android Chrome re-rasterised the text each
   time, so the letters shook and flickered as the band passed (2026-10-07;
   iPhone and desktop were fine). translateX percentages are of the band
   (38% of the card): -158% / 342% are the old left -60% / 130%. */
.tarot-sheen{position:absolute;inset:0;border-radius:24px;pointer-events:none;z-index:2;overflow:hidden;transform:translateZ(0);contain:paint;}
.tarot-sheen::after{content:"";position:absolute;top:-30%;bottom:-30%;width:38%;left:0;
  background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);transform:translateX(-158%) skewX(-14deg);
  will-change:transform;animation:tarot-sheen 6s ease-in-out 1.1s infinite;}
@keyframes tarot-sheen{0%{transform:translateX(-158%) skewX(-14deg)}35%,100%{transform:translateX(342%) skewX(-14deg)}}
.tarot-x{position:fixed;top:calc(14px + env(safe-area-inset-top,0px));right:14px;z-index:3;width:42px;height:42px;border-radius:50%;
  border:1px solid rgba(255,255,255,.22);background:rgba(10,14,30,.6);color:#fff;font-size:24px;line-height:1;cursor:pointer;}
.tarot-nav{flex:none;width:46px;height:46px;border-radius:50%;border:1px solid rgba(233,210,154,.45);
  background:rgba(10,14,30,.55);color:var(--gold,#E9D29A);font-size:28px;line-height:1;cursor:pointer;color:#E9D29A;}
.tarot-nav:hover,.tarot-x:hover{background:rgba(255,255,255,.12);}
@media (max-width:640px){
  /* Arrows sit low at the sides so the card keeps the whole width. */
  .modal-overlay.tarot-overlay{padding:12px 8px;}
  .tarot-nav{position:fixed;bottom:calc(16px + env(safe-area-inset-bottom,0px));z-index:3;width:42px;height:42px;}
  .tarot-nav.prev{left:14px;}
  .tarot-nav.next{right:14px;}
  .tarot-word{font-size:26px;}
  .tarot-name{font-size:21px;}
  .tarot-inner{padding:16px 16px 18px;}
}

/* Save / share under the card. */
.tarot-actions{display:flex;justify-content:center;margin-top:14px;flex:none;}
.tarot-share{appearance:none;cursor:pointer;padding:10px 22px;border-radius:999px;border:1px solid rgba(233,210,154,.6);
  background:rgba(10,14,30,.55);color:#F4E3B4;font-family:'Pretendard',sans-serif;font-size:14px;font-weight:700;}
.tarot-share:hover{background:rgba(255,255,255,.1);}
.tarot-share:disabled{opacity:.5;cursor:progress;}
/* The buttons around the card keep layers of their own for the same reason:
   while the card animates, whatever is drawn after it is lifted onto a
   separate layer and dropped back when the animation ends — a redraw of
   ×, ‹ › and "save / share" right after the card has appeared. */
.tarot-x,.tarot-nav,.tarot-actions{transform:translateZ(0);}

/* ---------- the small card (profile strip) ---------- */
.tarot-mini{--acc:#FFD98E;display:block;width:96px;text-decoration:none;color:inherit;text-align:center;}
.tarot-mini-card{display:block;border-radius:12px;padding:1.5px;
  background:linear-gradient(150deg,#F4E3B4,#9D7B3D 32%,#F6E8BE 52%,#8A672B 78%,#E7CF95);
  box-shadow:0 6px 16px rgba(10,14,40,.22);transition:transform .15s ease-out,box-shadow .15s ease-out;}
.tarot-mini:hover .tarot-mini-card,.tarot-mini:focus-visible .tarot-mini-card{transform:translateY(-3px) rotate(-1.5deg);box-shadow:0 12px 26px rgba(10,14,40,.32);}
.tarot-mini-inner{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;
  aspect-ratio:2 / 3;border-radius:11px;padding:7px 6px 6px;overflow:hidden;
  background:radial-gradient(60% 40% at 50% 55%,color-mix(in srgb,var(--acc) 35%,transparent),transparent 72%),linear-gradient(180deg,#151b3c,#0b1026 70%,#120e28);
  box-shadow:inset 0 0 0 3px #0d1229,inset 0 0 0 4px rgba(233,210,154,.5);}
.tarot-mini-num{font-family:Georgia,'Times New Roman',serif;font-size:9px;letter-spacing:.12em;color:#E9D29A;line-height:1;margin-top:2px;}
.tarot-mini-word{font-family:'Pretendard',sans-serif;font-size:12.5px;font-weight:800;color:var(--acc);margin-top:3px;line-height:1.2;word-break:keep-all;}
.tarot-mini-inner img,.tarot-mini-svg{display:block;width:92%;flex:1;min-height:0;object-fit:contain;margin-top:2px;}
.tarot-mini-svg svg{width:100%;height:100%;}
.tarot-mini-name{display:block;margin-top:6px;font-family:'Pretendard',sans-serif;font-size:11.5px;font-weight:600;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}

@media (prefers-reduced-motion: reduce){
  .tarot-card.flip,.tarot-star,.tarot-sheen::after{animation:none !important;}
  .tarot-mini-card{transition:none;}
}
