/* MAN TAROT — mystical + cute + premium (navy / purple / gold) and its
   lobby card theme. Separate from JARVIS and the other games. */

.jv-gc--tarot {
  --gc-bg: linear-gradient(160deg, #1d1650 0%, #2d1b69 60%, #3b1f73 100%); --gc-ink: #fff7e0; --gc-sub: #cdbff5;
  --gc-accent: #e9c46a; --gc-accent-ink: #1a1440; --gc-glow: rgba(196, 181, 253, 0.55);
  --gc-art-bg: radial-gradient(circle at 70% 30%, rgba(245, 210, 122, 0.18), transparent 55%), #140f3a;
  border-color: rgba(233, 196, 106, 0.45);
}
.jv-gc--tarot .jv-gc-badge { background: #c4b5fd; color: #1a1440; }

.tr-root { --gold: #e9c46a; --ink: #f5ecff; --dim: #b9aee0; position: relative; max-width: 1000px; margin: 0 auto; padding: 16px 12px 26px; color: var(--ink); border-radius: 22px; overflow: hidden; font-family: ui-rounded, 'SF Pro Rounded', 'Noto Sans Thai', system-ui, sans-serif;
  background: radial-gradient(ellipse at 20% 0%, rgba(124, 77, 255, 0.28), transparent 55%), radial-gradient(ellipse at 90% 100%, rgba(233, 196, 106, 0.14), transparent 55%), linear-gradient(180deg, #120e33, #0b0924); }
.tr-content { position: relative; z-index: 1; }
.tr-sky { position: absolute; inset: 0; pointer-events: none; }
.tr-sky i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff; opacity: 0.2; animation: tr-twinkle 3.6s ease-in-out infinite; }
@keyframes tr-twinkle { 50% { opacity: 0.9; transform: scale(1.6); } }

.tr-head { text-align: center; margin-bottom: 10px; }
.tr-logo { font-family: Georgia, 'Noto Serif Thai', serif; font-size: 26px; font-weight: 700; letter-spacing: 0.12em; }
.tr-logo b { color: var(--gold); text-shadow: 0 0 18px rgba(233, 196, 106, 0.5); }
.tr-tag { margin: 4px 0 0; color: var(--dim); font-size: 13.5px; }
.tr-h { font-size: 14px; margin: 18px 0 10px; color: #e9ddff; } .tr-h small { color: var(--dim); font-weight: 400; }
.tr-center { text-align: center; color: var(--dim); }
.tr-disclaimer { margin: 18px auto 0; max-width: 640px; text-align: center; font-size: 12px; color: #a99fd0; line-height: 1.6; }

.tr-btn { font: inherit; font-size: 14px; font-weight: 700; background: rgba(20, 16, 52, 0.9); border: 1px solid rgba(196, 181, 253, 0.35); color: var(--ink); padding: 10px 18px; border-radius: 999px; cursor: pointer; touch-action: manipulation; }
.tr-btn:hover:not(:disabled) { border-color: var(--gold); }
.tr-btn:disabled { opacity: 0.6; cursor: wait; }
.tr-primary { background: linear-gradient(135deg, #e9c46a, #f5d27a); color: #1a1440; border-color: transparent; font-weight: 900; letter-spacing: 0.04em; box-shadow: 0 6px 22px rgba(233, 196, 106, 0.35); }
.tr-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 18px; }

.tr-topics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tr-chip, .tr-mode { font: inherit; color: var(--ink); background: rgba(24, 19, 60, 0.85); border: 1.5px solid rgba(196, 181, 253, 0.25); border-radius: 16px; padding: 12px 10px; cursor: pointer; font-size: 14px; font-weight: 700; }
.tr-chip.on, .tr-mode.on { border-color: var(--gold); box-shadow: 0 0 18px rgba(233, 196, 106, 0.3); background: rgba(58, 42, 134, 0.7); }
.tr-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tr-mode { display: flex; flex-direction: column; gap: 4px; text-align: left; }
.tr-mode span { font-size: 12px; color: var(--dim); font-weight: 400; }
.tr-q { width: 100%; box-sizing: border-box; font: inherit; font-size: 14px; color: var(--ink); background: rgba(12, 10, 36, 0.9); border: 1px solid rgba(196, 181, 253, 0.3); border-radius: 14px; padding: 12px 14px; }
.tr-q:focus, .tr-q.need { outline: none; border-color: var(--gold); }

/* shuffle */
.tr-shuffling { position: relative; height: 230px; margin: 30px auto 10px; width: 140px; }
.tr-sh { position: absolute; inset: 0; width: 120px; left: 10px; animation: tr-shuffle 1.6s ease-in-out infinite; animation-delay: calc(var(--i) * -0.12s); }
.tr-sh svg { width: 100%; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5)); }
@keyframes tr-shuffle { 0%, 100% { transform: translateX(0) rotate(0); } 25% { transform: translateX(calc((var(--i) - 3) * 22px)) rotate(calc((var(--i) - 3) * 5deg)); } 50% { transform: translateX(0) rotate(0); } 75% { transform: translateY(-14px) rotate(calc((3 - var(--i)) * 3deg)); } }

/* pick fan */
/* 78 face-down cards: 13 columns x 6 rows, overlapping (card wider than its
   column step) with a gentle arc per row (--r / --y set per card in JS). */
.tr-fan { --cw: 64px; --step: 44px; display: grid; grid-template-columns: repeat(13, var(--step)); justify-content: center; row-gap: 16px; padding: 16px calc(var(--cw) - var(--step)) 8px 0; }
.tr-pick { position: relative; width: var(--cw); aspect-ratio: 3 / 5; padding: 0; border: 0; background: none; cursor: pointer; transform: translateY(var(--y)) rotate(var(--r)); transform-origin: 50% 120%; transition: transform 0.2s ease, opacity 0.3s ease; touch-action: manipulation; }
.tr-pick svg { width: 100%; height: 100%; display: block; filter: drop-shadow(-2px 3px 4px rgba(0, 0, 0, 0.5)); }
.tr-pick:hover:not(:disabled), .tr-pick:focus-visible { transform: translateY(calc(var(--y) - 14px)) rotate(var(--r)); z-index: 2; outline: none; }
.tr-pick.taken { transform: translateY(calc(var(--y) - 20px)) rotate(var(--r)) scale(0.92); opacity: 0.25; }
.tr-count { color: var(--gold); }

/* spread + flip */
.tr-spread { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin-top: 8px; --cw: 130px; }
.tr-slot { display: flex; flex-direction: column; align-items: center; gap: 6px; width: var(--cw); }
.tr-label { font-size: 12.5px; color: #e9ddff; text-align: center; }
.tr-card { position: relative; width: var(--cw); aspect-ratio: 3 / 5; padding: 0; border: 0; background: none; cursor: pointer; perspective: 900px; }
.tr-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); border-radius: 10px; }
.tr-face svg { width: 100%; height: 100%; display: block; }
.tr-front { transform: rotateY(180deg); }
.tr-card.flipped .tr-back { transform: rotateY(-180deg); }
.tr-card.flipped .tr-front { transform: rotateY(0); box-shadow: 0 0 22px rgba(233, 196, 106, 0.4); }
.tr-card:not(.flipped):hover .tr-back { transform: translateY(-4px); }
.tr-art { display: block; width: 100%; height: 100%; }
.tr-card.rev .tr-art { transform: rotate(180deg); }
.tr-spread-daily { --cw: 170px; }

/* Celtic Cross: cross (1-6) + staff (7-10) */
.tr-spread-celtic { display: grid; --cw: 92px; grid-template-columns: repeat(3, var(--cw)) 24px var(--cw); grid-template-rows: repeat(4, auto); gap: 10px 14px; justify-content: center; }
.tr-spread-celtic .tr-pos-5 { grid-column: 2; grid-row: 1; }
.tr-spread-celtic .tr-pos-4 { grid-column: 1; grid-row: 2 / span 2; align-self: center; }
.tr-spread-celtic .tr-pos-1 { grid-column: 2; grid-row: 2 / span 2; align-self: center; }
.tr-spread-celtic .tr-pos-2 { grid-column: 2; grid-row: 2 / span 2; align-self: center; z-index: 2; }
.tr-spread-celtic .tr-pos-2 .tr-card { transform: rotate(90deg); }
/* the crossing card shares card 1's combined label */
.tr-spread-celtic .tr-pos-2 .tr-label { visibility: hidden; }
.tr-spread-celtic .tr-pos-6 { grid-column: 3; grid-row: 2 / span 2; align-self: center; }
.tr-spread-celtic .tr-pos-3 { grid-column: 2; grid-row: 4; }
.tr-spread-celtic .tr-pos-10 { grid-column: 5; grid-row: 1; }
.tr-spread-celtic .tr-pos-9 { grid-column: 5; grid-row: 2; }
.tr-spread-celtic .tr-pos-8 { grid-column: 5; grid-row: 3; }
.tr-spread-celtic .tr-pos-7 { grid-column: 5; grid-row: 4; }
.tr-spread-celtic .tr-label { font-size: 11px; }

/* meanings */
.tr-meanings { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.tr-mean { display: grid; grid-template-columns: 74px 1fr; gap: 14px; padding: 14px; border-radius: 18px; background: rgba(24, 19, 60, 0.8); border: 1px solid rgba(196, 181, 253, 0.22); animation: tr-in 0.4s ease; }
@keyframes tr-in { from { opacity: 0; transform: translateY(8px); } }
.tr-mean-art svg { width: 100%; display: block; }
.tr-mean-art.rev svg { transform: rotate(180deg); }
.tr-mean-pos { font-size: 12px; color: var(--gold); font-weight: 800; letter-spacing: 0.04em; }
.tr-mean-pos small { color: var(--dim); font-weight: 400; }
.tr-mean h4 { margin: 4px 0 6px; font-size: 17px; font-family: Georgia, 'Noto Serif Thai', serif; }
.tr-mean h4 span { font-family: ui-rounded, 'Noto Sans Thai', sans-serif; font-size: 14px; color: #e9ddff; font-weight: 600; }
.tr-mean h4 em { font-style: normal; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(233, 196, 106, 0.18); color: var(--gold); vertical-align: middle; }
.tr-mean h4 em.tr-rev { background: rgba(255, 111, 168, 0.18); color: #ff9cc7; }
.tr-mean p { margin: 4px 0; font-size: 13.5px; line-height: 1.65; color: #e6ddff; }
.tr-kw { color: var(--dim) !important; font-size: 12.5px !important; }
.tr-topic { color: #fff3cf !important; }
.tr-summary:empty { display: none; }
.tr-summary { margin-top: 18px; padding: 18px; border-radius: 20px; border: 1px solid rgba(233, 196, 106, 0.5); background: radial-gradient(ellipse at 50% 0%, rgba(233, 196, 106, 0.12), transparent 60%), rgba(20, 16, 52, 0.9); }
.tr-summary h3 { margin: 0 0 8px; font-family: Georgia, 'Noto Serif Thai', serif; color: var(--gold); }
.tr-summary p { margin: 6px 0; line-height: 1.7; font-size: 14px; }
.tr-ai { margin-top: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.tr-ai small { color: var(--dim); font-size: 11.5px; }
.tr-ai-btn { border-color: var(--gold); }
.tr-ai-text { text-align: left; width: 100%; padding: 12px 14px; border-radius: 14px; background: rgba(124, 77, 255, 0.14); border: 1px solid rgba(196, 181, 253, 0.4); }
.tr-ai-text b { color: #c4b5fd; }
.tr-err { color: #ff9cc7; font-size: 13px; margin: 0; }

@media (max-width: 640px) {
  .tr-topics, .tr-modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tr-modes .tr-mode:last-child { grid-column: span 2; }
  .tr-spread { --cw: 96px; gap: 10px; }
  .tr-spread-daily { --cw: 150px; }
  .tr-spread-celtic { --cw: 56px; gap: 8px 8px; grid-template-columns: repeat(3, var(--cw)) 6px var(--cw); }
  .tr-spread-celtic .tr-label { font-size: 9.5px; }
  .tr-fan { --cw: 40px; --step: 24px; row-gap: 12px; }
  .tr-mean { grid-template-columns: 58px 1fr; padding: 12px; }
}
/* Result screen (reading): roomier, easier to read, uses the width.
   Desktop = auto-fit grid of meaning cards; each card puts the art beside
   its title and lets the text run the card's full width (content div is
   display:contents so its children join the card grid — no markup change). */
/* the shared mini-game frame is 980px; widen it only while a Tarot result is shown */
.jv-games:has(.tr-screen-reading) { max-width: 1240px; }
.tr-root.tr-screen-reading { max-width: 1180px; padding: 22px 24px 30px; }
.tr-screen-reading .tr-meanings { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-top: 26px; align-items: start; }
.tr-screen-reading .tr-mean { grid-template-columns: 64px minmax(0, 1fr); column-gap: 14px; row-gap: 0; align-content: start; padding: 18px 20px; border-radius: 20px; background: rgba(24, 19, 60, 0.62); border-color: rgba(196, 181, 253, 0.18); }
.tr-screen-reading .tr-mean > div:not(.tr-mean-art) { display: contents; }
.tr-screen-reading .tr-mean-art { grid-row: 1 / span 3; align-self: start; }
.tr-screen-reading .tr-mean-pos, .tr-screen-reading .tr-mean h4, .tr-screen-reading .tr-mean .tr-kw { grid-column: 2; }
.tr-screen-reading .tr-mean-pos { font-size: 12.5px; line-height: 1.5; }
.tr-screen-reading .tr-mean h4 { margin: 4px 0 4px; font-size: 18px; line-height: 1.35; }
.tr-screen-reading .tr-mean h4 em { white-space: nowrap; display: inline-block; }
.tr-screen-reading .tr-mean p { grid-column: 1 / -1; margin: 10px 0 0; font-size: 15px; line-height: 1.8; }
.tr-screen-reading .tr-mean .tr-kw { margin-top: 2px; font-size: 13px !important; line-height: 1.6; }
.tr-screen-reading .tr-mean .tr-topic { padding: 10px 14px; border-radius: 14px; background: rgba(233, 196, 106, 0.08); border: 1px solid rgba(233, 196, 106, 0.2); }
.tr-screen-reading .tr-summary { margin-top: 22px; padding: 26px clamp(18px, 4vw, 44px); }
.tr-screen-reading .tr-summary > h3, .tr-screen-reading .tr-summary > p, .tr-screen-reading .tr-ai { max-width: 860px; margin-left: auto; margin-right: auto; }
.tr-screen-reading .tr-summary h3 { margin-bottom: 12px; font-size: 21px; }
.tr-screen-reading .tr-summary > p { margin-top: 0; margin-bottom: 12px; font-size: 15.5px; line-height: 1.85; }
.tr-screen-reading .tr-ai { margin-top: 18px; gap: 8px; }
.tr-screen-reading .tr-ai-text { padding: 18px 22px; border-radius: 18px; background: rgba(124, 77, 255, 0.1); border-color: rgba(196, 181, 253, 0.3); }
.tr-screen-reading .tr-ai-text b { display: block; margin-bottom: 8px; font-size: 15px; letter-spacing: 0.02em; }
.tr-screen-reading .tr-ai-text p { margin: 0; font-size: 15.5px; line-height: 1.85; }
.tr-screen-reading .tr-end { margin-top: 24px; }
@media (max-width: 640px) {
  .tr-root.tr-screen-reading { padding: 16px 10px 24px; border-radius: 18px; }
  .tr-screen-reading .tr-meanings { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 20px; }
  .tr-screen-reading .tr-mean { grid-template-columns: 52px minmax(0, 1fr); column-gap: 12px; padding: 14px; border-radius: 16px; }
  .tr-screen-reading .tr-mean h4 { font-size: 17px; }
  .tr-screen-reading .tr-mean p, .tr-screen-reading .tr-summary > p, .tr-screen-reading .tr-ai-text p { font-size: 15px; line-height: 1.75; }
  .tr-screen-reading .tr-mean .tr-topic { padding: 9px 12px; }
  .tr-screen-reading .tr-summary { padding: 18px 14px; border-radius: 18px; }
  .tr-screen-reading .tr-summary h3 { font-size: 19px; }
  .tr-screen-reading .tr-ai-text { padding: 14px 14px; border-radius: 14px; }
  .tr-screen-reading .tr-end .tr-btn { flex: 1 1 auto; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .tr-sky i, .tr-sh { animation: none; }
  .tr-face { transition-duration: 0.01s; }
}
