:root {
    --v157-hover-in:75ms;
    --v157-hover-out:120ms;
    --v157-joker-hover:110ms;
    --v157-joker-flip:520ms;
    --v157-card-back-image:var(--v151-default-card-back);
    --v157-card-back-color:#bd0711;
    --v157-card-back-border:#d8b85f;
    --v157-card-back-ink:#fff1c5;
    --v157-card-back-kind:default;
    --v157-card-back-surface:#bd0711 var(--v151-default-card-back) 50% 50% / 100% 100% no-repeat border-box border-box;
}

body[data-v137-card-back="discarded-decree"] {
    --v157-card-back-kind:discarded-decree;
    --v157-card-back-image:
        linear-gradient(154deg,transparent 42%,rgba(226,198,122,.24) 43% 44%,transparent 45%),
        radial-gradient(circle at 50% 49%,#8e2133 0 7%,#d0ac59 8% 9%,transparent 10% 22%,rgba(208,172,89,.32) 23% 24%,transparent 25%),
        repeating-linear-gradient(45deg,#110709 0 8px,#310c13 8px 10px);
    --v157-card-back-color:#17070a;
    --v157-card-back-border:#c8aa60;
    --v157-card-back-surface:
        linear-gradient(154deg,transparent 42%,rgba(226,198,122,.24) 43% 44%,transparent 45%) 50% 50% / 100% 100% no-repeat border-box border-box,
        radial-gradient(circle at 50% 49%,#8e2133 0 7%,#d0ac59 8% 9%,transparent 10% 22%,rgba(208,172,89,.32) 23% 24%,transparent 25%) 50% 50% / 100% 100% no-repeat border-box border-box,
        #17070a repeating-linear-gradient(45deg,#110709 0 8px,#310c13 8px 10px) 50% 50% / 100% 100% no-repeat border-box border-box;
}
body[data-v137-card-back="emerald-code"] {
    --v157-card-back-kind:emerald-code;
    --v157-card-back-image:
        radial-gradient(circle at center,#d6bb6c 0 3%,#225f49 4% 14%,transparent 15% 27%,rgba(214,187,108,.28) 28% 29%,transparent 30%),
        repeating-conic-gradient(from 45deg,#06110e 0 12deg,#194a39 12deg 24deg);
    --v157-card-back-color:#071612;
    --v157-card-back-border:#d6bb6c;
    --v157-card-back-surface:
        radial-gradient(circle at center,#d6bb6c 0 3%,#225f49 4% 14%,transparent 15% 27%,rgba(214,187,108,.28) 28% 29%,transparent 30%) 50% 50% / 100% 100% no-repeat border-box border-box,
        #071612 repeating-conic-gradient(from 45deg,#06110e 0 12deg,#194a39 12deg 24deg) 50% 50% / 100% 100% no-repeat border-box border-box;
}
body[data-v137-card-back="twin-regalia"] {
    --v157-card-back-kind:twin-regalia;
    --v157-card-back-image:
        radial-gradient(circle at 43% 50%,rgba(53,142,106,.9) 0 8%,transparent 9%),
        radial-gradient(circle at 57% 50%,rgba(159,36,54,.92) 0 8%,transparent 9%),
        radial-gradient(circle at center,transparent 0 23%,#d7b65e 24% 25%,transparent 26%),
        repeating-conic-gradient(#18090d 0 10deg,#3b151b 10deg 20deg);
    --v157-card-back-color:#13090d;
    --v157-card-back-border:#f0d079;
    --v157-card-back-surface:
        radial-gradient(circle at 43% 50%,rgba(53,142,106,.9) 0 8%,transparent 9%) 50% 50% / 100% 100% no-repeat border-box border-box,
        radial-gradient(circle at 57% 50%,rgba(159,36,54,.92) 0 8%,transparent 9%) 50% 50% / 100% 100% no-repeat border-box border-box,
        radial-gradient(circle at center,transparent 0 23%,#d7b65e 24% 25%,transparent 26%) 50% 50% / 100% 100% no-repeat border-box border-box,
        #13090d repeating-conic-gradient(#18090d 0 10deg,#3b151b 10deg 20deg) 50% 50% / 100% 100% no-repeat border-box border-box;
}

/* One final surface contract for every genuinely hidden playing card. The
   ID-bearing branches deliberately outrank the older v64/v137/v151 rules. */
body :is(
    #player-field > .card.card-back:not(.sasara-inspected-card),
    #opponent-field > .card.card-back:not(.sasara-inspected-card),
    #hand-zone > .card.card-back:not(.sasara-inspected-card),
    #v68-motion-layer .card.card-back:not(.sasara-inspected-card),
    .attack-motion-layer .card.card-back:not(.sasara-inspected-card),
    .card.card-back:not(.sasara-inspected-card),
    #player-deck-pile,
    #opp-deck-pile,
    #opponent-hand-cards > .opponent-mini-card:not(.monty-revealed-card),
    .opponent-mini-card:not(.monty-revealed-card),
    #toss-o-card.card-back,
    #toss-p-card.card-back,
    #v106-match-mode-modal .v120-card-back,
    #v99-mode-overlay .v120-card-back,
    #v101-character-encyclopedia .v101-card-slot.is-locked,
    #v122-onboarding .v122-card-back
) {
    --v157-card-back-contract:unified-v157;
    border-color:var(--v157-card-back-border) !important;
    background-color:var(--v157-card-back-color) !important;
    background-image:var(--v157-card-back-image) !important;
    background-position:50% 50% !important;
    background-repeat:no-repeat !important;
    background-size:100% 100% !important;
    background-origin:border-box !important;
    background-clip:border-box !important;
    background-attachment:scroll !important;
    background-blend-mode:normal !important;
}

/* The owner still needs the value of a face-down field card. Keep that
   information readable without replacing the shared back artwork. */
#player-field > .card.card-back:not(.sasara-inspected-card) {
    isolation:isolate;
    color:var(--v157-card-back-ink) !important;
    font-weight:900 !important;
    text-shadow:0 2px 3px #210003,0 0 6px #000,0 0 11px #000 !important;
}
#player-field > .card.card-back:not(.sasara-inspected-card)::before {
    content:"";
    position:absolute;
    left:16%;
    right:16%;
    top:50%;
    z-index:-1;
    height:34%;
    border:1px solid rgba(255,239,190,.68);
    border-radius:4px;
    transform:translateY(-50%);
    background:rgba(72,0,7,.78);
    box-shadow:0 2px 7px rgba(0,0,0,.58),inset 0 0 10px rgba(255,222,137,.08);
    pointer-events:none;
}

/* Revealed information must never inherit a hidden-card surface. */
body .opponent-mini-card.monty-revealed-card:not(#v157-hidden-card) {
    border-color:#777 !important;
    color:#18130a !important;
    background:#eee6d3 linear-gradient(145deg,#fffdf5,#ddd1b8) 50% 50% / 100% 100% no-repeat border-box !important;
    background-color:#eee6d3 !important;
    background-image:linear-gradient(145deg,#fffdf5,#ddd1b8) !important;
    background-position:50% 50% !important;
    background-repeat:no-repeat !important;
    background-size:100% 100% !important;
    background-origin:border-box !important;
    background-clip:border-box !important;
    text-shadow:none !important;
}
body :is(
    #opponent-field > .card.card-back.sasara-inspected-card,
    #v68-motion-layer .card.card-back.sasara-inspected-card,
    .card.card-back.sasara-inspected-card
) {
    color:#18130a !important;
    border-color:#63baff !important;
    background-color:#d6e8f6 !important;
    background-image:
        linear-gradient(rgba(255,255,255,.86),rgba(214,232,246,.9)),
        repeating-linear-gradient(135deg,#295f85 0 8px,#17364d 8px 16px) !important;
    background-position:50% 50% !important;
    background-repeat:no-repeat !important;
    background-size:100% 100% !important;
    box-shadow:0 0 0 2px rgba(58,167,255,.22),0 0 14px rgba(58,167,255,.38) !important;
}
body :is(
    #opponent-field > .card.card-back.sasara-inspected-card,
    #v68-motion-layer .card.card-back.sasara-inspected-card,
    .card.card-back.sasara-inspected-card
)::after {
    content:"確認中";
    position:absolute;
    right:2px;
    bottom:2px;
    padding:1px 3px;
    border-radius:3px;
    color:#eaf7ff;
    background:rgba(12,66,102,.82);
    font-size:8px;
    line-height:1.2;
    pointer-events:none;
}

/* Old context-specific crests and frames made equipped backs look different. */
body .toss-card-visual.card-back::before,
body .toss-card-visual.card-back::after,
body :is(#toss-o-card.card-back,#toss-p-card.card-back)::before,
body :is(#toss-o-card.card-back,#toss-p-card.card-back)::after,
body #v101-character-encyclopedia .v101-card-slot.is-locked::before,
body #v101-character-encyclopedia .v101-card-slot.is-locked::after,
body .v101-card-slot.is-locked::before,
body .v101-card-slot.is-locked::after,
body :is(#v106-match-mode-modal,#v99-mode-overlay) .v120-card-back::before,
body :is(#v106-match-mode-modal,#v99-mode-overlay) .v120-card-back::after,
body :is(#v106-match-mode-modal,#v99-mode-overlay) .v120-card-back > b,
body .v120-card-back::before,
body .v120-card-back::after,
body .v120-card-back > b {
    content:none !important;
    display:none !important;
}
body :is(#v106-match-mode-modal,#v99-mode-overlay) .v120-card-back > small {
    position:absolute !important;
    right:12% !important;
    bottom:15px !important;
    left:12% !important;
    z-index:2 !important;
    padding:5px 4px !important;
    border:1px solid rgba(255,245,226,.74) !important;
    border-radius:3px !important;
    color:#fff8e8 !important;
    background:rgba(91,0,8,.82) !important;
    box-shadow:0 2px 8px rgba(0,0,0,.55) !important;
    text-shadow:0 1px 2px #000 !important;
}

/* Mode-card hover, including room battles, is independent from click-to-flip. */
#v106-match-mode-modal:not([hidden]) #v106-select-free-match.v156-joker-card:not(.v120-selected):not(.v120-dismissed) .v120-card-inner {
    animation:v120DealLeft .42s cubic-bezier(.16,.82,.18,1) backwards !important;
}
#v106-match-mode-modal:not([hidden]) #v106-select-ranked-match.v156-joker-card:not(.v120-selected):not(.v120-dismissed) .v120-card-inner {
    animation:v120DealRight .42s .04s cubic-bezier(.16,.82,.18,1) backwards !important;
}
#v106-match-mode-modal :is(.v156-joker-card,.v187-room-card):not(.v120-selected):not(.v120-dismissed) .v120-card-inner {
    transition:transform 110ms cubic-bezier(.2,.78,.2,1),filter 90ms ease-out !important;
    transition-delay:0s !important;
}
#v106-match-mode-modal :is(.v156-joker-card,.v187-room-card).v120-selected .v120-card-inner {
    transition:transform 520ms cubic-bezier(.17,.78,.16,1.06),filter 160ms ease !important;
    transition-delay:0s !important;
}
#v106-match-mode-modal :is(.v156-joker-card,.v187-room-card) .v120-card-front {
    transition:border-color 80ms ease-out,box-shadow 100ms ease-out !important;
}
#v106-match-mode-modal :is(.v156-joker-card,.v187-room-card):hover:not(:disabled) .v120-card-front,
#v106-match-mode-modal :is(.v156-joker-card,.v187-room-card):focus-visible .v120-card-front {
    border-color:#f0d27b !important;
    box-shadow:0 24px 52px rgba(0,0,0,.82),0 0 0 1px rgba(0,0,0,.55),0 0 22px rgba(216,187,105,.24),inset 0 0 0 5px #eadbb5,inset 0 0 0 7px #7b612c !important;
}
#v106-match-mode-modal .v156-imperial-joker-svg {
    transition:transform 100ms ease-out !important;
}

/* v67 lengthened every battle-card hover to .34s and animated a costly
   drop-shadow. Keep the same physical lift, but make it immediate and light. */
body.v45-battle-active :is(#hand-zone,#player-field,#opponent-field) > .card {
    transition:transform 120ms cubic-bezier(.2,.78,.2,1),filter 100ms ease-out,box-shadow 120ms ease-out,opacity 180ms ease !important;
    transition-delay:0s !important;
}
#title-screen.v153-grand-assembly.v154-awaken-enabled .v153-character-card {
    transition:translate 100ms ease-out,border-color 120ms ease-out,box-shadow 120ms ease-out !important;
    transition-delay:0s !important;
}
button.v101-card-slot {
    transition:transform 110ms ease-out,border-color 110ms ease-out,box-shadow 110ms ease-out !important;
    transition-delay:0s !important;
}
@media (hover:hover) and (pointer:fine) {
    body.v45-battle-active :is(#hand-zone,#player-field,#opponent-field) > .card:hover:not(.selected-card) {
        transform:perspective(700px) translateY(-7px) rotateX(1.5deg) rotateZ(-.6deg) scale(1.045) !important;
        filter:brightness(1.08) saturate(1.05) !important;
        transition-duration:75ms,60ms,75ms,180ms !important;
        transition-delay:0s !important;
        will-change:transform;
    }
}

@media (max-width:520px) {
    body :is(#v106-match-mode-modal,#v99-mode-overlay) .v120-card-back > small { bottom:11px !important;padding:4px 3px !important; }
}
@media (prefers-reduced-motion:reduce) {
    #v106-match-mode-modal:not([hidden]) :is(.v156-joker-card,.v187-room-card) .v120-card-inner {
        animation:none !important;
        transition:none !important;
    }
    body.v45-battle-active :is(#hand-zone,#player-field,#opponent-field) > .card,
    #title-screen.v153-grand-assembly.v154-awaken-enabled .v153-character-card,
    button.v101-card-slot,
    #v106-match-mode-modal .v156-imperial-joker-svg {
        transition:none !important;
    }
}
