/* =====================================================================
   ดูดวง.store — tarot.css : ไพ่ทาโรต์ (CSS ล้วน ไม่มีไฟล์รูป)
   ===================================================================== */
:root {
  --tr-mandala: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23e9c46a' stroke-width='.7'%3E%3Ccircle cx='50' cy='50' r='47' stroke-opacity='.45'/%3E%3Ccircle cx='50' cy='50' r='44.5' stroke-width='.4'/%3E%3Cellipse cx='50' cy='25' rx='5.5' ry='15' transform='rotate(0 50 50)'/%3E%3Cellipse cx='50' cy='25' rx='5.5' ry='15' transform='rotate(30 50 50)'/%3E%3Cellipse cx='50' cy='25' rx='5.5' ry='15' transform='rotate(60 50 50)'/%3E%3Cellipse cx='50' cy='25' rx='5.5' ry='15' transform='rotate(90 50 50)'/%3E%3Cellipse cx='50' cy='25' rx='5.5' ry='15' transform='rotate(120 50 50)'/%3E%3Cellipse cx='50' cy='25' rx='5.5' ry='15' transform='rotate(150 50 50)'/%3E%3Cellipse cx='50' cy='25' rx='5.5' ry='15' transform='rotate(180 50 50)'/%3E%3Cellipse cx='50' cy='25' rx='5.5' ry='15' transform='rotate(210 50 50)'/%3E%3Cellipse cx='50' cy='25' rx='5.5' ry='15' transform='rotate(240 50 50)'/%3E%3Cellipse cx='50' cy='25' rx='5.5' ry='15' transform='rotate(270 50 50)'/%3E%3Cellipse cx='50' cy='25' rx='5.5' ry='15' transform='rotate(300 50 50)'/%3E%3Cellipse cx='50' cy='25' rx='5.5' ry='15' transform='rotate(330 50 50)'/%3E%3Cellipse cx='50' cy='36' rx='3.4' ry='8.5' fill='%23e9c46a' fill-opacity='.14' transform='rotate(22.5 50 50)'/%3E%3Cellipse cx='50' cy='36' rx='3.4' ry='8.5' fill='%23e9c46a' fill-opacity='.14' transform='rotate(67.5 50 50)'/%3E%3Cellipse cx='50' cy='36' rx='3.4' ry='8.5' fill='%23e9c46a' fill-opacity='.14' transform='rotate(112.5 50 50)'/%3E%3Cellipse cx='50' cy='36' rx='3.4' ry='8.5' fill='%23e9c46a' fill-opacity='.14' transform='rotate(157.5 50 50)'/%3E%3Cellipse cx='50' cy='36' rx='3.4' ry='8.5' fill='%23e9c46a' fill-opacity='.14' transform='rotate(202.5 50 50)'/%3E%3Cellipse cx='50' cy='36' rx='3.4' ry='8.5' fill='%23e9c46a' fill-opacity='.14' transform='rotate(247.5 50 50)'/%3E%3Cellipse cx='50' cy='36' rx='3.4' ry='8.5' fill='%23e9c46a' fill-opacity='.14' transform='rotate(292.5 50 50)'/%3E%3Cellipse cx='50' cy='36' rx='3.4' ry='8.5' fill='%23e9c46a' fill-opacity='.14' transform='rotate(337.5 50 50)'/%3E%3Ccircle cx='50.00' cy='9.00' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='60.61' cy='10.40' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='70.50' cy='14.49' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='78.99' cy='21.01' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='85.51' cy='29.50' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='89.60' cy='39.39' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='91.00' cy='50.00' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='89.60' cy='60.61' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='85.51' cy='70.50' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='78.99' cy='78.99' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='70.50' cy='85.51' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='60.61' cy='89.60' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='50.00' cy='91.00' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='39.39' cy='89.60' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='29.50' cy='85.51' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='21.01' cy='78.99' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='14.49' cy='70.50' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='10.40' cy='60.61' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='9.00' cy='50.00' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='10.40' cy='39.39' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='14.49' cy='29.50' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='21.01' cy='21.01' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='29.50' cy='14.49' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='39.39' cy='10.40' r='.9' fill='%23e9c46a' stroke='none'/%3E%3Ccircle cx='50' cy='50' r='16'/%3E%3Ccircle cx='50' cy='50' r='11' fill='%23e9c46a' fill-opacity='.1'/%3E%3Cpath d='M50 37 L53.2 46.8 L63 50 L53.2 53.2 L50 63 L46.8 53.2 L37 50 L46.8 46.8Z' fill='%23e9c46a' stroke='none'/%3E%3Cpath d='M50 42 L52 48 L58 50 L52 52 L50 58 L48 52 L42 50 L48 48Z' fill='%23140b2c' stroke='none' transform='rotate(45 50 50)'/%3E%3Ccircle cx='50' cy='50' r='2' fill='%23e9c46a' stroke='none'/%3E%3C/svg%3E");
  --tr-spark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1 L13.4 10.6 L23 12 L13.4 13.4 L12 23 L10.6 13.4 L1 12 L10.6 10.6Z' fill='%23e9c46a'/%3E%3C/svg%3E");
  --tr-cw: 150px;           /* ความกว้างไพ่ผลลัพธ์ */
  --tr-foil: linear-gradient(120deg, #fbe7a8 0%, #e9c46a 30%, #b8892b 52%, #f6d98a 70%, #e9c46a 100%);
}
@media (max-width: 640px) { :root { --tr-cw: 96px; } }

/* ---------- Stepper ---------- */
.tr-steps { list-style: none; margin: 0 auto 28px; padding: 0; display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.tr-steps li {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px;
  font-family: var(--font-head); font-size: .9rem; color: var(--text-3);
  border: 1px solid var(--border); background: var(--surface); transition: color .3s, border-color .3s, background .3s;
}
.tr-steps li b {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 500; font-size: .85rem;
  background: var(--surface-2); color: var(--text-2);
}
.tr-steps li.active { color: var(--gold-2); border-color: var(--border-2); background: rgba(233,196,106,.08); }
.tr-steps li.active b { background: linear-gradient(135deg, var(--gold-2), var(--gold-3)); color: #2a1d05; }
.tr-steps li.done { color: var(--text-2); }
.tr-steps li.done b { background: rgba(139,92,246,.35); color: var(--text); }
@media (max-width: 480px) {
  .tr-steps { gap: 4px; }
  .tr-steps li { padding: 4px 10px 4px 4px; font-size: .78rem; gap: 6px; }
  .tr-steps li b { width: 22px; height: 22px; font-size: .75rem; }
}
.tr-panel { animation: fadeUp .45s ease both; }

/* =====================================================================
   CARD BACK
   ===================================================================== */
.tback {
  display: block; position: relative; border-radius: 9px;
  background:
    var(--tr-spark) 50% 6.5% / 11% auto no-repeat,
    var(--tr-spark) 50% 93.5% / 11% auto no-repeat,
    var(--tr-mandala) 50% 50% / 84% auto no-repeat,
    radial-gradient(circle at 50% 50%, rgba(233,196,106,.16) 0, transparent 38%),
    repeating-linear-gradient(45deg, rgba(233,196,106,.055) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(-45deg, rgba(233,196,106,.055) 0 1px, transparent 1px 9px),
    radial-gradient(120% 80% at 50% 50%, #3b2275 0%, #241347 55%, #130a2a 100%);
  border: 1px solid var(--gold);
  box-shadow:
    inset 0 0 0 3px #170d33,
    inset 0 0 0 4px rgba(233,196,106,.75),
    inset 0 0 22px rgba(139,92,246,.45),
    0 8px 22px -8px rgba(0,0,0,.8);
}

/* =====================================================================
   CARD FACE
   ===================================================================== */
.tface {
  position: relative; display: block; aspect-ratio: 3 / 5; border-radius: 9px; overflow: hidden;
  container-type: inline-size;
  background:
    radial-gradient(90% 55% at 50% 42%, rgba(139,92,246,.30), transparent 70%),
    radial-gradient(60% 30% at 50% 100%, rgba(233,196,106,.10), transparent 70%),
    linear-gradient(165deg, #261748 0%, #150d2d 55%, #0c0720 100%);
  border: 1px solid var(--gold);
  box-shadow:
    inset 0 0 0 3px #140b2b,
    inset 0 0 0 4px rgba(233,196,106,.55),
    inset 0 0 28px rgba(233,196,106,.12),
    0 10px 28px -10px rgba(0,0,0,.85);
  color: var(--gold);
}
.tface::after { /* foil sheen */
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(115deg, transparent 30%, rgba(255,240,200,.09) 44%, transparent 58%);
}
.tface-in { position: absolute; inset: 0; }
.tc-num {
  position: absolute; top: 5cqw; left: 8cqw; font-family: var(--font-head); font-weight: 500;
  font-size: max(8px, 10cqw); line-height: 1;
  background: var(--tr-foil); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tc-num-br { top: auto; left: auto; bottom: 5cqw; right: 8cqw; transform: rotate(180deg); opacity: .55; font-size: max(7px, 7cqw); }
.tc-art { position: absolute; left: 12%; right: 12%; top: 12%; bottom: 29%; display: grid; place-items: center; }
.tc-art svg { display: block; filter: drop-shadow(0 0 1.6cqw rgba(233,196,106,.45)); }

/* major */
.tc-major { position: relative; width: 100%; height: 100%; display: grid; place-items: center; }
.tc-halo {
  position: absolute; width: 70cqw; height: 70cqw; border-radius: 50%;
  border: 1px solid rgba(233,196,106,.55);
  box-shadow: 0 0 0 3cqw rgba(233,196,106,.06), inset 0 0 8cqw rgba(233,196,106,.25), 0 0 10cqw rgba(139,92,246,.35);
  background: radial-gradient(circle, rgba(233,196,106,.16), transparent 70%);
}
.tc-halo::before {
  content: ''; position: absolute; inset: -6cqw; border-radius: 50%; border: 1px dashed rgba(233,196,106,.3);
}
.tc-symbol { position: relative; font-size: 34cqw; line-height: 1; filter: drop-shadow(0 0 3cqw rgba(233,196,106,.55)); }

/* ace */
.tc-ace svg { width: 56cqw; height: 56cqw; }
.tc-ace { position: relative; display: grid; place-items: center; }
.tc-ace::before {
  content: ''; position: absolute; width: 66cqw; height: 66cqw; border-radius: 50%;
  background: radial-gradient(circle, rgba(233,196,106,.22), transparent 68%);
}

/* pips 2–10 */
.tc-pips { position: relative; width: 100%; height: 100%; --ps: 18cqw; }
.tc-pips-lg { --ps: 25cqw; }
.tc-pips-md { --ps: 21cqw; }
.tc-pips i { position: absolute; width: var(--ps); height: var(--ps); transform: translate(-50%, -50%); }
.tc-pips svg { width: 100%; height: 100%; }

/* court */
.tc-court { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1cqw; position: relative; }
.tc-crown { width: 30cqw; height: 30cqw; }
.tc-court > .tr-si { width: 42cqw; height: 42cqw; }
.tc-title {
  margin-top: 1cqw; min-width: 14cqw; padding: .5cqw 3cqw; border-radius: 99px; text-align: center;
  font-family: var(--font-head); font-size: max(8px, 9cqw); line-height: 1.3; font-weight: 500; color: #2a1d05;
  background: var(--tr-foil); box-shadow: 0 0 3cqw rgba(233,196,106,.4);
}

/* names */
.tc-names {
  position: absolute; left: 7%; right: 7%; bottom: 7%; text-align: center;
  padding-top: 2.5cqw; border-top: 1px solid rgba(233,196,106,.35);
}
.tc-th {
  display: block; font-family: var(--font-head); font-weight: 500; font-size: max(9px, 10.5cqw); line-height: 1.25;
  background: var(--tr-foil); -webkit-background-clip: text; background-clip: text; color: transparent;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tc-en {
  display: block; font-size: max(7px, 6.6cqw); line-height: 1.3; letter-spacing: .03em; color: var(--silver-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* =====================================================================
   STEP 1 — spreads & options
   ===================================================================== */
.tr-spreads { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 22px; }
@media (max-width: 760px) { .tr-spreads { grid-template-columns: 1fr; gap: 12px; } }
.tr-spread {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; cursor: pointer;
  padding: 22px 16px 18px; border-radius: var(--radius); color: var(--text);
  background: linear-gradient(160deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: transform .2s, border-color .2s, box-shadow .2s, background .2s;
  font: inherit;
}
.tr-spread:hover { transform: translateY(-3px); border-color: var(--border-2); }
.tr-spread:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px; }
.tr-spread.active {
  border-color: var(--gold); background: linear-gradient(160deg, rgba(233,196,106,.12), rgba(139,92,246,.08));
  box-shadow: 0 0 0 1px var(--gold), var(--shadow-gold), var(--shadow);
}
.tr-spread-vis { display: flex; justify-content: center; gap: 5px; height: 60px; align-items: flex-end; margin-bottom: 6px; }
.tr-spread-vis .tback { width: 34px; height: 57px; border-radius: 5px; transition: transform .3s; }
.tr-spread-vis .tback:nth-child(odd) { transform: translateY(-3px); }
.tr-spread.active .tr-spread-vis .tback { box-shadow: inset 0 0 0 2px #170d33, inset 0 0 0 3px rgba(233,196,106,.75), 0 0 16px rgba(233,196,106,.35); }
.tr-spread-name { font-family: var(--font-head); font-size: 1.25rem; font-weight: 500; }
.tr-spread.active .tr-spread-name { color: var(--gold-2); }
.tr-spread-sub { font-family: var(--font-head); color: var(--gold); font-size: .95rem; }
.tr-spread-pos { font-size: .88rem; color: var(--text-3); line-height: 1.5; }
@media (max-width: 760px) {
  .tr-spread { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto; text-align: left; align-items: center; column-gap: 14px; row-gap: 2px; padding: 14px 16px; }
  .tr-spread-vis { grid-row: 1 / 4; margin: 0; height: 48px; width: 92px; gap: 3px; }
  .tr-spread-vis .tback { width: 22px; height: 37px; border-radius: 4px; }
  .tr-spread-name { font-size: 1.1rem; }
}

.tr-options { display: flex; flex-direction: column; gap: 14px; }
.tr-opt-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tr-opt-label { font-family: var(--font-head); font-size: .9rem; color: var(--text-2); }
.tr-focus { flex-wrap: wrap; max-width: 100%; }
@media (max-width: 480px) {
  .tr-opt-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .tr-focus { display: grid; grid-template-columns: repeat(4, 1fr); border-radius: 16px; }
  .tr-focus button { padding: 8px 4px; font-size: .88rem; }
}
.tr-q-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: -8px; }
.tr-go { justify-content: center; margin-top: 4px; }

/* =====================================================================
   STEP 2 — shuffle & fan
   ===================================================================== */
.tr-stage { --fw: 84px; position: relative; min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
@media (max-width: 560px) { .tr-stage { --fw: 58px; } }
.tr-deck { position: relative; width: calc(var(--fw) * 1.25); height: calc(var(--fw) * 2.08); margin: 20px auto; }
.tr-deck .tback { position: absolute; inset: 0; transform: translate(calc(var(--o) * -1), calc(var(--o) * -1)); }
.tr-deck.shuffling .tback { animation: trRiffle .62s cubic-bezier(.45,.05,.35,1) calc(var(--i) * 45ms) 2 both; }
@keyframes trRiffle {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  30% { transform: translate(calc(var(--s) * 78%), -8%) rotate(calc(var(--s) * 16deg)); }
  62% { transform: translate(calc(var(--s) * -14%), 2%) rotate(calc(var(--s) * -5deg)); }
}
.tr-deck.shuffling { filter: drop-shadow(0 0 18px rgba(233,196,106,.35)); }

.tr-fan { width: 100%; }
.tr-fan-row { position: relative; width: 100%; }
.tr-fan-row + .tr-fan-row { margin-top: -10px; }
.tr-fan-card {
  position: absolute; left: 50%; width: var(--fw); height: calc(var(--fw) * 5 / 3); margin-left: calc(var(--fw) / -2);
  padding: 0; border: 0; background: none; cursor: pointer; border-radius: 9px;
  transform-origin: 50% var(--R, 300px);
  transform: rotate(calc(var(--a, 0) * 1deg));
  transition: transform .42s cubic-bezier(.2,.8,.2,1), opacity .4s ease, filter .3s ease;
  -webkit-tap-highlight-color: transparent;
}
.tr-fan-card .tback { width: 100%; height: 100%; border-radius: inherit; transition: box-shadow .3s; }
.tr-fan.dealing .tr-fan-card { transform: rotate(0deg) translateY(40px) scale(.9); opacity: 0; transition: none; }
.tr-fan.dealing-go .tr-fan-card { transition-delay: calc(var(--i) * 28ms); }
@media (hover: hover) {
  .tr-fan.ready:not(.complete) .tr-fan-card:not(.picked):hover { transform: rotate(calc(var(--a, 0) * 1deg)) translateY(-12px); }
  .tr-fan.ready:not(.complete) .tr-fan-card:not(.picked):hover .tback { box-shadow: inset 0 0 0 3px #170d33, inset 0 0 0 4px rgba(233,196,106,.9), 0 0 16px rgba(233,196,106,.35); }
}
.tr-fan-card:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.tr-fan-card.picked { transform: rotate(calc(var(--a, 0) * 1deg)) translateY(-30px); z-index: 40; }
.tr-fan-card.picked .tback {
  box-shadow: inset 0 0 0 3px #170d33, inset 0 0 0 4px var(--gold-2), 0 0 0 2px var(--gold-2), 0 0 26px 6px rgba(233,196,106,.55);
  animation: trGlow 1.5s ease-in-out infinite alternate;
}
@keyframes trGlow { to { box-shadow: inset 0 0 0 3px #170d33, inset 0 0 0 4px var(--gold-2), 0 0 0 2px var(--gold-2), 0 0 38px 10px rgba(233,196,106,.7); } }
.tr-pick-no {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%); min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px;
  display: none; place-items: center; font-family: var(--font-head); font-size: .78rem; font-weight: 600; color: #2a1d05;
  background: linear-gradient(135deg, var(--gold-2), var(--gold-3)); box-shadow: 0 0 10px rgba(233,196,106,.6);
}
.tr-fan-card.picked .tr-pick-no { display: grid; }
.tr-fan.complete .tr-fan-card:not(.picked) { opacity: .3; filter: grayscale(.5); cursor: default; }

.tr-pickbar { display: flex; align-items: center; justify-content: center; gap: 10px 14px; flex-wrap: wrap; margin-top: 16px; min-height: 32px; text-align: center; }
.tr-counter { font-size: .95rem; padding: 6px 14px; }
.tr-hint { color: var(--text-2); font-family: var(--font-head); font-size: .95rem; }

/* =====================================================================
   STEP 3 — flip & result
   ===================================================================== */
.tr-rhead { text-align: center; }
.tr-rhead h2 { margin: 8px 0 12px; }
.tr-rhead h2 .gradient-text { display: inline-block; font-size: .8em; }
.tr-rmeta { justify-content: center; }
.tr-rq {
  margin: 16px auto 0; max-width: 620px; font-family: var(--font-head); font-size: 1.1rem; color: var(--text);
  overflow-wrap: anywhere;
}

.tr-spread-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 26px 22px; margin: 34px 0 30px; }
@media (max-width: 640px) { .tr-spread-row { gap: 18px 12px; } }
.tr-slot { display: flex; flex-direction: column; align-items: center; gap: 10px; width: var(--tr-cw); }
.tr-slot-label {
  font-family: var(--font-head); font-size: .9rem; color: var(--gold-2); text-align: center; line-height: 1.25; min-height: 2.5em;
  display: flex; align-items: flex-end;
}
@media (max-width: 640px) { .tr-slot-label { font-size: .78rem; } }

.tcard { width: var(--tr-cw); aspect-ratio: 3 / 5; perspective: 1100px; }
.tcard-inner {
  position: relative; width: 100%; height: 100%; transform-style: preserve-3d;
  transform: rotateY(0deg) rotateZ(0deg);
  transition: transform .9s cubic-bezier(.3,.75,.25,1);
}
.tcard.flipped .tcard-inner { transform: rotateY(180deg) rotateZ(0deg); }
.tcard.flipped.rev .tcard-inner { transform: rotateY(180deg) rotateZ(180deg); }
.tside { position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.tside.tback, .tside.tface { width: 100%; height: 100%; aspect-ratio: auto; }
.tside.tface { transform: rotateY(180deg); transition: box-shadow .6s ease .5s; }
.tcard.flipped .tside.tface {
  box-shadow: inset 0 0 0 3px #140b2b, inset 0 0 0 4px rgba(233,196,106,.55), inset 0 0 28px rgba(233,196,106,.12),
    0 0 34px -4px rgba(233,196,106,.45), 0 14px 30px -12px rgba(0,0,0,.9);
}

.tr-details, .tr-summary { transition: opacity .6s ease, transform .6s ease; }
.tr-details.pending, .tr-summary.pending { opacity: 0; transform: translateY(14px); }
.tr-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 18px; margin-bottom: 18px; }
.tr-details .card + .card { margin-top: 0; }
.tr-detail { display: flex; flex-direction: column; }
.tr-detail-head .eyebrow { font-size: .78rem; }
.tr-pos-hint { margin: 2px 0 8px; font-size: .85rem; color: var(--text-3); }
.tr-detail h3 { display: block; margin: 0 0 10px; font-size: 1.25rem; color: var(--gold-2); }
.tr-detail h3 small { display: block; font-size: .8rem; color: var(--silver-2); font-family: var(--font-body); letter-spacing: .03em; }
.tr-kw { margin: 12px 0 4px; }
.tr-kw .chip { font-size: .8rem; padding: 3px 10px; }
.tr-mhead { margin: 14px 0 4px; font-size: .95rem; color: var(--purple-2); font-weight: 400; }
.tr-meaning { color: var(--text); line-height: 1.8; }
.tr-general { font-size: .92rem; color: var(--text-2); }
.tr-general b { color: var(--text-3); font-weight: 500; font-family: var(--font-head); }
.tr-detail .callout { margin-top: auto; margin-bottom: 0; font-size: .95rem; }

.tr-summary h3 { justify-content: center; margin-bottom: 16px; }
.tr-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; text-align: center; }
@media (max-width: 420px) { .tr-tiles { gap: 8px; } .tr-tiles .info-tile { padding: 10px 6px; } }
.tr-bars { margin: 8px 0 4px; }
.tr-bars .bar-row { grid-template-columns: minmax(120px, 190px) 1fr 30px; }
.tr-bars .bar-row small { color: var(--text-3); font-size: .78rem; }
@media (max-width: 480px) { .tr-bars .bar-row { grid-template-columns: 96px 1fr 22px; font-size: .88rem; gap: 8px; } .tr-bars .bar-row small { display: none; } }
.tr-si-inline { width: 1.1em; height: 1.1em; vertical-align: -.18em; }
.tr-answer {
  text-align: center; padding: 18px 16px; margin: 0 auto 18px; max-width: 520px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: radial-gradient(circle at 50% 0, rgba(233,196,106,.16), transparent 70%);
}
.tr-answer .lbl { display: block; font-family: var(--font-head); font-size: .85rem; letter-spacing: .15em; color: var(--text-3); }
.tr-answer b {
  display: block; font-family: var(--font-head); font-size: 2.6rem; font-weight: 500; line-height: 1.2;
  background: var(--tr-foil); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tr-answer.tr-ans-no b { background: linear-gradient(120deg, #d6c8ff, var(--purple-2)); -webkit-background-clip: text; background-clip: text; }
.tr-answer.tr-ans-maybe b { background: linear-gradient(120deg, #eef0f6, var(--silver)); -webkit-background-clip: text; background-clip: text; }
.tr-answer p { margin: 4px 0 0; color: var(--text-2); }

/* =====================================================================
   LIBRARY (78 cards)
   ===================================================================== */
.tr-lib-tools { display: flex; gap: 12px 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 10px; }
.tr-filters .chip { cursor: pointer; font-size: .9rem; padding: 6px 14px; transition: color .2s, border-color .2s, background .2s; }
.tr-filters .chip:hover { color: var(--text); border-color: var(--border-2); }
.tr-filters .chip.active { color: #2a1d05; border-color: transparent; background: linear-gradient(135deg, var(--gold-2), var(--gold-3)); }
.tr-search { max-width: 300px; }
@media (max-width: 720px) { .tr-search { max-width: none; } }
.tr-lib-count { margin: 0 0 14px; }
.tr-lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 14px; }
@media (max-width: 480px) { .tr-lib-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; } }
.tr-lib-card {
  display: block; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 9px; font: inherit;
  transition: transform .22s ease, filter .22s ease;
}
.tr-lib-card:hover { transform: translateY(-4px); filter: drop-shadow(0 8px 18px rgba(233,196,106,.25)); }
.tr-lib-card:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px; }
.tr-lib-card .tface { width: 100%; }
.tr-empty { grid-column: 1 / -1; text-align: center; padding: 30px 0; }

/* Modal */
.tr-modal {
  width: min(860px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 26px; margin: auto;
  color: var(--text); background: linear-gradient(170deg, #1f1540, #120b27); border: 1px solid var(--border-2);
  border-radius: var(--radius); box-shadow: 0 30px 80px -20px rgba(0,0,0,.9), var(--shadow-gold); overflow-y: auto;
}
.tr-modal::backdrop { background: rgba(6, 3, 16, .72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.tr-modal[open] { animation: fadeUp .3s ease both; }
.tr-modal-close {
  position: sticky; top: 0; float: right; margin: -10px -10px 0 0; z-index: 2; width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text-2); font-size: 1rem;
}
.tr-modal-close:hover { color: var(--gold-2); border-color: var(--border-2); }
.tr-m-top { display: grid; grid-template-columns: 150px 1fr; gap: 22px; align-items: center; margin-bottom: 14px; }
.tr-m-advice { margin: 0 0 18px; }
.tr-m-face { width: 150px; }
.tr-m-info h3 { margin: 6px 0 0; font-size: 1.6rem; color: var(--gold-2); display: block; }
.tr-m-en { margin: 0 0 10px; }
.tr-m-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tr-m-side { padding: 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); }
.tr-m-side h4 { margin: 0 0 10px; font-size: 1.05rem; }
.tr-m-up h4 { color: var(--gold-2); }
.tr-m-rev h4 { color: var(--purple-2); }
.tr-m-side .chips { margin-bottom: 10px; }
.tr-m-side .chip { font-size: .8rem; padding: 3px 10px; }
.tr-m-side p { font-size: .95rem; }
.tr-m-side .kv { font-size: .9rem; }
@media (max-width: 640px) {
  .tr-modal { padding: 18px 16px; }
  .tr-m-top { grid-template-columns: 96px 1fr; gap: 14px; }
  .tr-m-face { width: 96px; }
  .tr-m-info h3 { font-size: 1.3rem; }
  .tr-m-sides { grid-template-columns: 1fr; }
  .tr-m-side .kv { grid-template-columns: 1fr; gap: 2px; }
  .tr-m-side .kv dd { margin-bottom: 8px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .tr-deck.shuffling .tback, .tr-fan-card.picked .tback { animation: none; }
  .tcard-inner, .tr-fan-card, .tr-details, .tr-summary { transition: none; }
}
