/* Game-wide layer on top of core.css (the mockup kit).
   Cards, Favors, consumables and tooltips are lifted from docs/reference/mockups-v2/3-trial.html
   and 4-market.html and made global so every screen, overlay and pack uses the same pieces. */
@import url("./fonts.css");

:root {
  --suit-S: #243a73; --suit-H: #e8443a; --suit-C: #2f8f5b; --suit-D: #f08a1c;
  --speed: 1;
}
html, body { background: #0b0716; }
body { cursor: url("../../assets/ui/cursor.svg") 3 2, default; }
button { background: none; border: 0; padding: 0; cursor: inherit; }
img { -webkit-user-drag: none; }
.ico { width: 1em; height: 1em; display: inline-block; vertical-align: -0.14em; flex: none; }
.btn .ico { width: 1em; height: 1em; }

/* ---------- stage (same 1920×1080 contract as the mockups) ---------- */
#stage { position: fixed; left: 50%; top: 50%; width: 1920px; height: 1080px; transform-origin: center; overflow: clip; contain: strict; background: #1a1030; }
#world { position: absolute; inset: 0; transform-origin: 50% 55%; will-change: transform; }
#screens, .screen { position: absolute; inset: 0; overflow: clip; }
.bg { position: absolute; inset: -24px; background-size: cover; background-position: center; will-change: transform; }
#fx { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; pointer-events: none; z-index: 900; }
#flash { position: absolute; inset: 0; pointer-events: none; z-index: 940; opacity: 0; }
#overlay { position: absolute; inset: 0; z-index: 700; pointer-events: none; }
#overlay > * { pointer-events: auto; }
#tips { position: absolute; inset: 0; z-index: 980; pointer-events: none; }
#pops { position: absolute; inset: 0; z-index: 960; pointer-events: none; }
.letterbox { position: fixed; inset: 0; background: #07050d; }
.hidden { display: none !important; }

/* ---------- rich rules text (mockup .kP / .kF palette) ---------- */
.t-p { color: var(--points-d); font-weight: 900; }
.t-f { color: var(--factor-d); font-weight: 900; }
.t-x { color: #fff; background: var(--factor); border-radius: 6px; padding: 0 6px; font-weight: 900; }
.t-g { color: var(--gold-d); font-weight: 900; }
.t-h { color: var(--sea-d); font-weight: 900; }
.t-k { font-weight: 900; }
.t-muted { opacity: .6; font-weight: 800; }
.t-s-S { color: var(--suit-S); font-weight: 900; } .t-s-H { color: var(--suit-H); font-weight: 900; }
.t-s-C { color: var(--suit-C); font-weight: 900; } .t-s-D { color: var(--suit-D); font-weight: 900; }

/* ---------- tooltip (mockup 3-trial .tip) ---------- */
.tip { position: absolute; width: 330px; padding: 16px 18px 16px; pointer-events: none;
  background: var(--bone); color: var(--ink); border: 4px solid var(--ink); border-radius: 18px; box-shadow: 0 8px 0 var(--ink);
  opacity: 0; transform: translateY(8px) scale(.92); transition: opacity .12s, transform .18s cubic-bezier(.2,1.8,.4,1); }
.tip.show { opacity: 1; transform: none; }
.tip h4 { margin: 0; font: 400 26px/1.05 var(--f-chunk); }
.tip .meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px; }
.tip .tag { font: 900 12px/1 var(--f-body); letter-spacing: 2px; text-transform: uppercase; padding: 4px 7px; border-radius: 6px; border: 2px solid var(--ink); background: var(--bone-2); }
.tip .tag.r1 { background: var(--olive); } .tip .tag.r2 { background: var(--sky); color: #fff; } .tip .tag.r3 { background: #c05ad9; color: #fff; } .tip .tag.r4 { background: var(--gold); }
.tip .tag.ed { background: linear-gradient(90deg, #ff9a8a, #ffe08a, #b7e08a, #8fd0ff, #d0a8ff); }
.tip .fx { font: 900 20px/1.25 var(--f-body); background: #fff; border: 3px solid var(--ink); border-radius: 12px; padding: 8px 12px; }
.tip .fx + .fx { margin-top: 6px; }
.tip .fl { margin-top: 10px; font: italic 800 16px/1.3 var(--f-body); opacity: .72; }
.tip .keys { margin-top: 10px; font: 900 12px/1 var(--f-body); letter-spacing: 1px; text-transform: uppercase; opacity: .55; }

/* ---------- playing cards (mockup 3-trial .card) ---------- */
.card { position: absolute; left: 0; top: 0; width: 150px; height: 210px; cursor: pointer; will-change: transform;
  --x: 0px; --y: 0px; --r: 0deg; --lift: 0px; --s: 1;
  transform: translate(var(--x), calc(var(--y) + var(--lift))) rotate(var(--r)) scale(var(--s));
  transition: transform calc(.42s / var(--speed)) cubic-bezier(.2,1.25,.4,1), opacity .3s; }
.card.nt { transition: none; }
.card.static { position: relative; }
.card:hover:not(.busy) { --lift: -18px; }
.card.sel { --lift: -54px; }
.card.sel:hover { --lift: -60px; }
.card.drag { transition: none; --s: 1.06; z-index: 500 !important; }
.card .flip { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .32s cubic-bezier(.3,1.3,.5,1); }
.card.down .flip { transform: rotateY(180deg); }
.card .face, .card .cardback { backface-visibility: hidden; }
.card .face { position: absolute; inset: 0; border-radius: 16px; background: var(--bone); border: 4px solid var(--ink); box-shadow: 0 7px 0 var(--ink); overflow: hidden; animation: cfloat 3.4s ease-in-out infinite; animation-delay: var(--d, 0s); }
@keyframes cfloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.card.sel .face { box-shadow: 0 0 0 6px var(--gold), 0 13px 0 4px var(--ink); animation: none; }
.card.forced .face { box-shadow: 0 0 0 6px var(--sky), 0 13px 0 4px var(--ink); }
.card .idx { position: absolute; left: 9px; top: 6px; display: flex; flex-direction: column; align-items: center; font: 400 44px/1 var(--f-chunk); color: var(--sc); z-index: 2; }
.card .idx i { width: 26px; height: 26px; margin-top: 2px; display: block; }
.card .idx i svg { width: 100%; height: 100%; display: block; }
.card .idx.br { left: auto; top: auto; right: 9px; bottom: 6px; transform: rotate(180deg); }
.card .pip { position: absolute; left: 50%; top: 54%; width: 86px; height: 86px; transform: translate(-50%, -50%); }
.card .pip svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.card .pip .sh { transform: translate(5px, 6px); opacity: .25; }
.card .pip.face-art { width: 118px; height: 128px; top: 55%; }
.card .pip.face-art img { width: 100%; height: 100%; object-fit: contain; }
.card .band { position: absolute; left: 0; right: 0; bottom: 0; height: 12px; background: var(--sc); opacity: .9; }
.card .band.t { top: 0; bottom: auto; }
.card.hit .face { animation: chit calc(.38s / var(--speed)) cubic-bezier(.2,2,.4,1); }
@keyframes chit { 0% { transform: scale(1); } 40% { transform: scale(1.2) rotate(-5deg); } 100% { transform: scale(1); } }
.card.dim { opacity: .45; }
.card.scoring:not(.sel) .face { box-shadow: 0 0 0 4px var(--points), 0 7px 0 var(--ink); }
.card .seal { position: absolute; right: 10px; top: 54px; width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--ink); z-index: 3; box-shadow: inset 0 -4px 0 rgba(0,0,0,.25); }
.card .seal.gold { background: #f2b830; } .card .seal.red { background: #e8443a; } .card .seal.blue { background: #3b73d9; } .card .seal.purple { background: #8a4bd0; }
.card .tag { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%) rotate(-6deg); font: 400 15px/1 var(--f-chunk); letter-spacing: 1px; color: #fff; background: var(--ink); border: 3px solid var(--ink); border-radius: 8px; padding: 3px 8px 4px; z-index: 3; white-space: nowrap; }
/* debuffed by a Divine Trial rule (mockup "soggy" treatment, generalised) */
.card.debuff .face::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 58%; background: linear-gradient(180deg, rgba(90, 70, 120, 0), rgba(60, 40, 90, .5)); pointer-events: none; }
.card.debuff .tag { background: var(--wine); }
/* card back (mockup .cardback) */
.cardback { position: absolute; inset: 0; border-radius: 16px; background: #c8553d; border: 4px solid var(--ink); box-shadow: 0 6px 0 var(--ink); overflow: hidden; }
.card .cardback { transform: rotateY(180deg); }
.cardback::before { content: ""; position: absolute; inset: 9px; border: 3px solid var(--ink); border-radius: 10px; }
.cardback::after { content: ""; position: absolute; left: 9px; right: 9px; top: 22px; height: 16px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M0 14h13V3H4v7h5' fill='none' stroke='%231d1233' stroke-width='2.4'/%3E%3C/svg%3E") repeat-x; }
.cardback img { position: absolute; left: 50%; top: 56%; width: 80px; height: 80px; transform: translate(-50%, -50%); }
/* alterations */
.card.e-bonus .face { background: #f5d3a3; } .card.e-mult .face { background: #fbd9cc; }
.card.e-wild .face { background: conic-gradient(from 45deg, #ffd6d0 0 25%, #d4dcff 0 50%, #d2f0de 0 75%, #ffe4c2 0); }
.card.e-glass .face { background: rgba(215, 240, 255, .85); } .card.e-steel .face { background: #d6dce4; }
.card.e-stone .face { background: #a09a94; } .card.e-stone .idx, .card.e-stone .pip, .card.e-stone .band { display: none; }
.card.e-gold .face { background: #ffe08a; } .card.e-lucky .face { background: #fff1c2; }

/* ---------- finishes (editions) — cards & favors ---------- */
.ed-foil::before, .ed-holo::before, .ed-poly::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 4; }
.card.ed-foil .face::before, .card.ed-holo .face::before, .card.ed-poly .face::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.ed-foil::before, .card.ed-foil .face::before { background: linear-gradient(115deg, transparent 25%, rgba(255, 220, 160, .6) 45%, rgba(255,255,255,.75) 50%, rgba(210, 130, 60, .35) 58%, transparent 75%); background-size: 250% 100%; animation: foilsweep 3s linear infinite; mix-blend-mode: overlay; }
.ed-holo::before, .card.ed-holo .face::before { background: repeating-linear-gradient(110deg, rgba(255,80,80,.25) 0 12px, rgba(255,220,80,.25) 12px 24px, rgba(80,255,160,.25) 24px 36px, rgba(80,160,255,.25) 36px 48px, rgba(200,80,255,.25) 48px 60px); background-size: 200% 100%; animation: foilsweep 5s linear infinite; mix-blend-mode: color-dodge; }
.ed-poly::before, .card.ed-poly .face::before { background: linear-gradient(135deg, #ff4d4d, #ffd24d, #4dff88, #4db8ff, #c04dff, #ff4d4d); background-size: 300% 300%; mix-blend-mode: color; opacity: .5; animation: polyshift 4s linear infinite; }
.ed-neg { filter: invert(.9) hue-rotate(180deg); }
@keyframes foilsweep { to { background-position: -250% 0; } }
@keyframes polyshift { to { background-position: 300% 300%; } }

/* ---------- Favors (mockup .favor, sized by --w/--h like the market mockup) ---------- */
.favor { --fc: #ffb37a; --w: 112px; --h: 160px; position: relative; flex: none; width: var(--w); height: var(--h); border-radius: 16px; background: var(--bone);
  border: 4px solid var(--ink); box-shadow: 0 6px 0 var(--ink); cursor: pointer; transition: transform .2s cubic-bezier(.2,1.8,.4,1); }
.favor:hover { transform: translateY(-8px) rotate(-3deg); z-index: 5; }
.favor .art { position: absolute; left: 6px; right: 6px; top: 6px; height: 60%; border-radius: 10px; background: var(--fc); display: grid; place-items: center; overflow: hidden; }
.favor .art::before { content: ""; position: absolute; width: 130%; height: 130%; border-radius: 50%; background: rgba(255,255,255,.22); top: -60%; right: -60%; }
.favor .art img { position: relative; width: 84%; height: 88%; object-fit: contain; }
.favor .nm { position: absolute; left: 4px; right: 4px; bottom: 6px; height: 30%; display: grid; place-items: center; text-align: center; font: 400 16px/1.02 var(--f-chunk); color: var(--ink); }
.favor .gem { position: absolute; right: -9px; top: -9px; width: 24px; height: 24px; border-radius: 6px; transform: rotate(45deg); border: 3px solid var(--ink); background: var(--olive); z-index: 5; }
.favor.r2 .gem { background: var(--sky); } .favor.r3 .gem { background: #c05ad9; } .favor.r4 .gem { background: var(--gold); box-shadow: 0 0 14px var(--gold); }
.favor .ord { position: absolute; left: -8px; top: -10px; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--bone); font: 400 16px/28px var(--f-chunk); text-align: center; z-index: 5; }
.favor .stk { position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%); display: flex; gap: 3px; z-index: 5; }
.favor .stk span { font: 900 10px/1 var(--f-body); letter-spacing: 1px; padding: 3px 5px; border-radius: 5px; background: var(--ink); color: var(--bone); white-space: nowrap; }
.favor.fire { animation: fav-fire calc(.45s / var(--speed)) cubic-bezier(.2,2,.4,1); }
@keyframes fav-fire { 0% { transform: none; } 35% { transform: translateY(-20px) scale(1.18) rotate(-6deg); } 100% { transform: none; } }
.favor.off { filter: grayscale(1) brightness(.6); }
.favor.masked .art img, .favor.masked .nm { visibility: hidden; }
.favor.masked { background: #3a2f5a; }
.favor.drag { transition: none; z-index: 400; }
.favor.empty { background: transparent; border: 4px dashed rgba(223, 250, 242, .45); box-shadow: none; display: grid; place-items: center; color: rgba(223, 250, 242, .7); font: 400 18px/1.1 var(--f-chunk); text-align: center; cursor: default; }
.favor.empty:hover { transform: none; }
.favor.land { animation: land .5s cubic-bezier(.2,2,.4,1); }
@keyframes land { 0% { transform: scale(1.5) rotate(-10deg); } 60% { transform: scale(.92) rotate(2deg); } 100% { transform: none; } }
.favor.unknown .art img { filter: brightness(0) opacity(.35); } .favor.unknown .nm { visibility: hidden; }

/* ---------- consumables (mockup 3-trial .consum) ---------- */
.consum { --w: 100px; --h: 140px; position: relative; flex: none; width: var(--w); height: var(--h); border-radius: 14px; border: 4px solid var(--ink); box-shadow: 0 6px 0 var(--ink); overflow: hidden; cursor: pointer; transition: transform .2s cubic-bezier(.2,1.8,.4,1); }
.consum:hover { transform: translateY(-8px) rotate(3deg); }
.consum img { position: absolute; left: 8%; right: 8%; top: 6%; width: 84%; height: 68%; object-fit: contain; }
.consum span { position: absolute; left: 4px; right: 4px; bottom: 6px; text-align: center; font: 400 14px/1.05 var(--f-chunk); color: var(--bone); }
.consum.k-invocation { background: #27306e; } .consum.k-constellation { background: #16204f; } .consum.k-mystery { background: #12404a; }
.consum.k-decree { background: #8a4527; } .consum.k-gift { background: #6b3a2a; } .consum.k-boss { background: #231a33; }
.consum.k-pack { background: transparent; border: 0; box-shadow: none; overflow: visible; }
.consum.k-pack img { top: 0; height: 82%; filter: drop-shadow(0 8px 0 #1d1233); }
.consum.k-pack span { bottom: -2px; color: #fff; background: var(--ink); border-radius: 10px; padding: 5px 8px 6px; left: 50%; right: auto; transform: translateX(-50%); white-space: nowrap; font-size: 18px; }
.consum.empty { background: transparent; border: 4px dashed rgba(223, 250, 242, .45); box-shadow: none; cursor: default; }
.consum.empty:hover { transform: none; }

.bump { animation: bump .32s cubic-bezier(.2,2,.4,1); }
