:root {
    --v156-gold:#d8bb69;
    --v156-pale:#f5e8bd;
    --v156-ink:#07090a;
    --v156-wine:#7d1420;
    --v156-emerald:#23483e;
}

/* FREE / RANKED are the only player-facing battle modes. */
#v99-mode-overlay.show.v156-single-route .v99-mode-panel { opacity:0 !important; visibility:hidden !important; pointer-events:none !important; }
#v99-mode-overlay:not(.show).v156-single-route { display:none !important;pointer-events:none !important; }
#v99-mode-overlay [data-v99-mode="dual"],
#v99-selection-progress,
.v99-sub-character,
#v99-ability-slot-badge { display:none !important; visibility:hidden !important; pointer-events:none !important; }
#character-select-screen.v99-dual-selection { --v156-single-only:1; }
#character-grid .character-card.v99-main-locked::after { content:none !important; display:none !important; }

/* The retired formation screen remains as a private compatibility bridge for
   the tutorial and rare-skin trial route. The player only sees this short seal. */
#v99-mode-overlay.show.v156-single-route {
    display:grid !important;
    place-items:center;
    pointer-events:auto !important;
    background:
        radial-gradient(circle at 50% 47%,rgba(216,187,105,.13),transparent 17%),
        radial-gradient(ellipse at center,rgba(96,13,21,.28),transparent 45%),
        linear-gradient(112deg,#020404 0 49.75%,#170709 50.25% 100%) !important;
}
#v99-mode-overlay.show.v156-single-route::after {
    content:"IMPERIAL DUEL REGISTRY\A決闘者を登録中";
    position:absolute;
    left:50%;
    top:50%;
    z-index:4;
    width:min(72vw,430px);
    padding:26px 22px 23px;
    border:1px solid rgba(216,187,105,.5);
    outline:1px solid rgba(125,20,32,.55);
    outline-offset:7px;
    transform:translate(-50%,-50%);
    color:var(--v156-pale);
    text-align:center;
    white-space:pre;
    font:700 10px/2.6 "Courier New",monospace;
    letter-spacing:.32em;
    text-shadow:0 2px 4px #000,0 0 18px rgba(216,187,105,.35);
    background:
        linear-gradient(90deg,transparent,rgba(216,187,105,.7),transparent) center 14px/72% 1px no-repeat,
        linear-gradient(90deg,transparent,rgba(216,187,105,.38),transparent) center calc(100% - 14px)/72% 1px no-repeat,
        rgba(3,5,5,.76);
    box-shadow:0 24px 70px rgba(0,0,0,.72),inset 0 0 34px rgba(125,20,32,.18);
    animation:v156RegistrySeal .42s ease-out both;
}
.v156-route-status {
    position:absolute !important;
    width:1px !important;
    height:1px !important;
    margin:-1px !important;
    padding:0 !important;
    overflow:hidden !important;
    clip:rect(0 0 0 0) !important;
    clip-path:inset(50%) !important;
    white-space:nowrap !important;
}

/* Two physical Joker cards for queue selection. */
#v106-match-mode-modal .v106-mode-panel { width:min(940px,96vw) !important; }
#v106-match-mode-modal .v106-rank-kicker { color:#bba05a !important; }
#v106-match-mode-modal .v106-rank-heading { letter-spacing:.16em !important; }
#v106-match-mode-modal .v106-mode-choice-grid { gap:clamp(20px,5vw,64px) !important; }
#v106-match-mode-modal .v156-free-joker {
    --joker-main:#183d35;
    --joker-deep:#061512;
    --joker-metal:#a88942;
    --joker-paper:#f3e6c2;
    --joker-jewel:#347d69;
}
#v106-match-mode-modal .v156-ranked-joker {
    --joker-main:#811722;
    --joker-deep:#25060a;
    --joker-metal:#b58b3c;
    --joker-paper:#f4e2bc;
    --joker-jewel:#c22b3c;
}
#v106-match-mode-modal .v156-joker-card {
    width:clamp(158px,24vw,230px) !important;
    height:clamp(232px,35vw,338px) !important;
    border-radius:15px !important;
}
#v106-match-mode-modal .v156-joker-card .v120-card-face {
    border-radius:15px;
    border-color:rgba(147,117,48,.92);
    box-shadow:
        0 24px 52px rgba(0,0,0,.82),
        0 0 0 1px rgba(0,0,0,.55),
        inset 0 0 0 5px #eadbb5,
        inset 0 0 0 7px #7b612c;
}
#v106-match-mode-modal .v156-joker-card .v120-card-front {
    isolation:isolate;
    justify-content:flex-start;
    gap:0;
    padding:23px 22px 19px;
    overflow:hidden;
    background:
        radial-gradient(circle at 50% 37%,rgba(37,72,62,.17),transparent 29%),
        repeating-linear-gradient(135deg,rgba(43,34,18,.026) 0 1px,transparent 1px 5px),
        linear-gradient(145deg,#f4ecd7,#d9c9a6 68%,#c8b58b);
    color:#17221f;
}
#v106-match-mode-modal #v106-select-ranked-match .v120-card-front {
    background:
        radial-gradient(circle at 50% 37%,rgba(125,20,32,.22),transparent 31%),
        repeating-linear-gradient(45deg,rgba(103,21,29,.035) 0 1px,transparent 1px 5px),
        linear-gradient(145deg,#f5ead0,#dcc69c 68%,#c5aa73);
    color:#791621;
}
#v106-match-mode-modal .v156-joker-card .v120-card-front::before {
    inset:10px;
    z-index:-1;
    border:1px solid color-mix(in srgb,currentColor 62%,#99763b);
    border-radius:9px;
    box-shadow:inset 0 0 0 3px rgba(255,255,255,.18),inset 0 0 22px rgba(0,0,0,.06);
}
#v106-match-mode-modal .v156-joker-card .v120-card-front::after {
    content:attr(data-v156-decree);
    left:50%;
    bottom:12px;
    z-index:2;
    color:color-mix(in srgb,currentColor 72%,#735c32);
    font-size:6px;
    letter-spacing:.24em;
}
.v156-joker-corner {
    position:absolute;
    left:16px;
    top:16px;
    z-index:4;
    display:grid;
    justify-items:center;
    color:currentColor;
    font:900 8px/1 "Courier New",monospace;
    letter-spacing:-.06em;
}
.v156-joker-corner i { margin-top:3px;font:normal 14px/1 Georgia,serif; }
.v156-joker-corner.bottom { left:auto;top:auto;right:16px;bottom:16px;transform:rotate(180deg); }
.v156-joker-crest {
    position:relative;
    z-index:1;
    display:grid;
    place-items:center;
    width:min(76%,158px);
    aspect-ratio:180/216;
    margin:-1px auto -7px;
    color:currentColor;
    filter:drop-shadow(0 7px 9px rgba(0,0,0,.18));
}
.v156-joker-crest::before,
.v156-joker-crest::after {
    content:"";
    position:absolute;
    left:50%;
    width:74%;
    height:1px;
    transform:translateX(-50%);
    background:linear-gradient(90deg,transparent,currentColor,transparent);
    opacity:.58;
}
.v156-joker-crest::before { top:8%; }
.v156-joker-crest::after { bottom:9%; }
.v156-imperial-joker-svg { width:100%;height:100%;overflow:visible;transition:transform .24s ease,filter .24s ease; }
.v156-joker-arch-fill { fill:var(--joker-main);opacity:.07; }
.v156-joker-ornament,
.v156-joker-ray,
.v156-joker-sword,
.v156-joker-sword-guard,
.v156-joker-face-line,
.v156-joker-mantle-line,
.v156-joker-filigree {
    fill:none;
    stroke:var(--joker-main);
    stroke-linecap:round;
    stroke-linejoin:round;
}
.v156-joker-ornament { stroke-width:1.8;opacity:.78; }
.v156-joker-ray { stroke-width:1.5;opacity:.29; }
.v156-joker-sword { stroke-width:2;opacity:.42; }
.v156-joker-sword-guard { stroke-width:2.5;opacity:.56; }
.v156-joker-face-line,
.v156-joker-mantle-line { stroke-width:1.8;opacity:.63; }
.v156-joker-filigree { stroke-width:2;opacity:.56; }
.v156-joker-cap-shadow,
.v156-joker-mantle { fill:var(--joker-deep); }
.v156-joker-cap { fill:var(--joker-main);stroke:var(--joker-metal);stroke-width:1.6; }
.v156-joker-cap-center { fill:var(--joker-deep);stroke:var(--joker-metal);stroke-width:1.6; }
.v156-joker-bell { fill:var(--joker-metal);stroke:var(--joker-deep);stroke-width:1.5; }
.v156-joker-face { fill:var(--joker-paper);stroke:var(--joker-main);stroke-width:2.5; }
.v156-joker-face-shadow { fill:var(--joker-main);opacity:.13; }
.v156-joker-mask { fill:var(--joker-main);stroke:var(--joker-metal);stroke-width:1.4; }
.v156-joker-eye { fill:var(--joker-jewel); }
.v156-joker-ruff { fill:var(--joker-paper);stroke:var(--joker-main);stroke-width:2.3; }
.v156-joker-seal-ring { fill:var(--joker-paper);stroke:var(--joker-metal);stroke-width:3; }
.v156-joker-seal-open { stroke-dasharray:76 15;stroke-dashoffset:9; }
.v156-joker-seal-mark { fill:var(--joker-main); }
.v156-ranked-joker .v156-joker-seal-ring { fill:var(--joker-main);filter:drop-shadow(0 0 4px rgba(126,20,32,.3)); }
.v156-ranked-joker .v156-joker-seal-mark { fill:var(--joker-paper); }
.v156-joker-word {
    position:absolute;
    left:-4px;
    top:50%;
    transform:translateY(-50%);
    color:currentColor;
    font:900 clamp(7px,.75vw,10px)/1 "Courier New",monospace;
    letter-spacing:.18em;
    writing-mode:vertical-rl;
    opacity:.72;
}
.v156-joker-card .v106-mode-choice-kicker {
    margin-top:3px !important;
    color:color-mix(in srgb,currentColor 76%,#705b30) !important;
    font-size:7px !important;
    letter-spacing:.25em !important;
}
.v156-joker-card .v106-mode-choice-title {
    margin:6px 0 4px !important;
    color:#24170c !important;
    font-size:clamp(16px,2.2vw,21px) !important;
}
.v156-joker-card .v106-mode-choice-copy {
    min-height:2.8em;
    color:#5b4d35 !important;
    font-size:8px !important;
    line-height:1.5 !important;
}
.v156-joker-card .v106-mode-choice-meta {
    margin-top:8px !important;
    padding:6px 8px !important;
    color:#735f34 !important;
    font-size:6px !important;
}
.v156-joker-card:hover:not(:disabled) .v156-joker-crest,
.v156-joker-card:focus-visible .v156-joker-crest { filter:drop-shadow(0 8px 9px rgba(0,0,0,.2)) drop-shadow(0 0 7px color-mix(in srgb,currentColor 28%,transparent)); }
.v156-joker-card:hover:not(:disabled) .v156-imperial-joker-svg,
.v156-joker-card:focus-visible .v156-imperial-joker-svg { transform:translateY(-2px); }

/* Character portraits fill the illustration row with the face and upper body. */
#v106-match-mode-modal .v156-joker-card .v120-card-front {
    display:grid !important;
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:minmax(0,1fr) auto auto auto auto;
    justify-items:center;
    align-content:stretch;
}
#v106-match-mode-modal .v156-joker-card .v156-joker-crest.v194-mode-character-crest {
    width:100%;
    height:100%;
    min-width:0;
    min-height:0;
    margin:0 auto;
    padding-bottom:3px;
    box-sizing:border-box;
    aspect-ratio:auto;
    filter:none;
    pointer-events:none;
    overflow:hidden;
}
.v194-mode-character-crest::before,
.v194-mode-character-crest::after { content:none; }
.v194-mode-character {
    display:block;
    width:100%;
    height:100%;
    min-width:0;
    min-height:0;
    object-fit:cover;
    object-position:center 27%;
    filter:
        drop-shadow(1px 0 0 #fff3d8)
        drop-shadow(-1px 0 0 #fff3d8)
        drop-shadow(0 1px 0 #fff3d8)
        drop-shadow(0 -1px 0 #fff3d8)
        drop-shadow(0 2px 3px rgba(54,32,14,.42));
    transition:transform 100ms ease-out;
    user-select:none;
    -webkit-user-drag:none;
}
.v156-ranked-joker .v194-mode-character { object-position:center 35%; }
@media (max-width:420px), (max-height:500px) and (orientation:landscape) {
    .v194-mode-character { object-position:center 34%; }
}
.v156-joker-card:hover:not(:disabled) .v194-mode-character,
.v156-joker-card:focus-visible .v194-mode-character { transform:translateY(-2px); }

/* Rulebook replacement for the retired dual-character chapter. */
#v103-rulebook .v103-visual.v156-rulebook-joker-visual #v103-rulebook-image { display:none !important; }
.v156-rulebook-jokers[hidden] { display:none !important; }
.v156-rulebook-jokers {
    position:absolute;
    inset:0;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:clamp(14px,3vw,34px);
    padding:clamp(18px,4vw,48px);
    background:radial-gradient(circle at center,rgba(145,25,34,.2),transparent 42%),linear-gradient(135deg,#030606,#17090a);
}
.v156-guide-joker {
    position:relative;
    width:min(34%,150px);
    aspect-ratio:49/73;
    display:grid;
    place-items:center;
    border:1px solid #b79243;
    border-radius:10px;
    color:#213e36;
    background:linear-gradient(145deg,#f1e8d2,#cdbb93);
    box-shadow:0 17px 35px rgba(0,0,0,.66),inset 0 0 0 5px #e9d8ae,inset 0 0 0 6px #82672f;
    transform:rotate(-4deg);
}
.v156-guide-joker:last-child { color:#7d1420;transform:rotate(4deg); }
.v156-guide-joker b { font:900 clamp(22px,4vw,43px)/1 Georgia,serif; }
.v156-guide-joker small { position:absolute;bottom:11%;font:800 7px/1.2 "Courier New",monospace;letter-spacing:.16em; }
.v156-guide-rule { display:grid;gap:8px; }

/* Close the mathematically visible gap while preserving the diagonal split. */
@media (min-width:701px) {
    #v61-character-clash .v61-fighter-player { clip-path:polygon(0 0,100% 0,83.4% 100%,0 100%) !important; }
    #v61-character-clash .v61-fighter-enemy { clip-path:polygon(16.6% 0,100% 0,100% 100%,0 100%) !important; }
    #v61-character-clash .v156-clash-divider { clip-path:polygon(54.72% 0,55.08% 0,45.28% 100%,44.92% 100%); }
}
@media (max-width:700px) {
    #v61-character-clash .v61-fighter-player { clip-path:polygon(0 0,100% 0,82.7% 100%,0 100%) !important; }
    #v61-character-clash .v61-fighter-enemy { clip-path:polygon(17.3% 0,100% 0,100% 100%,0 100%) !important; }
    #v61-character-clash .v156-clash-divider { clip-path:polygon(55.65% 0,56.08% 0,44.35% 100%,43.92% 100%); }
}
#v61-character-clash .v156-clash-divider {
    position:absolute;
    inset:0;
    z-index:7;
    pointer-events:none;
    opacity:0;
    background:linear-gradient(180deg,transparent 0,#9e7b35 7%,#f1d786 28%,#fff0b0 50%,#d4ad50 72%,#76531c 93%,transparent 100%);
    filter:drop-shadow(0 0 2px #000) drop-shadow(0 0 7px rgba(216,187,105,.46));
}
#v61-character-clash.show .v61-fighter-player {
    animation:v156PlayerCollisionAligned 4.05s cubic-bezier(.18,.78,.18,1) both !important;
}
#v61-character-clash.show .v61-fighter-enemy {
    animation:v156EnemyCollisionAligned 4.05s cubic-bezier(.18,.78,.18,1) both !important;
}
#v61-character-clash.show .v156-clash-divider { animation:v156DividerIn .55s .58s ease-out both; }

@keyframes v156RegistrySeal {
    from { opacity:0;transform:translate(-50%,-50%) scale(.96);filter:blur(5px); }
    to { opacity:1;transform:translate(-50%,-50%) scale(1);filter:none; }
}
@keyframes v156DividerIn {
    0% { opacity:0;filter:blur(5px) drop-shadow(0 0 12px rgba(255,235,170,.75)); }
    45% { opacity:.9;filter:blur(0) drop-shadow(0 0 9px rgba(255,235,170,.68)); }
    100% { opacity:.58;filter:drop-shadow(0 0 2px #000) drop-shadow(0 0 6px rgba(216,187,105,.38)); }
}
@keyframes v156PlayerCollisionAligned {
    0%,7% { opacity:0;transform:translate3d(-112%,0,0);filter:blur(13px) brightness(.5); }
    25% { opacity:1;transform:translate3d(-4%,0,0);filter:blur(0) brightness(.9); }
    29% { transform:translate3d(2.5%,0,0) scale(1.025);filter:brightness(1.35); }
    34%,87% { opacity:1;transform:translate3d(0,0,0);filter:brightness(.9); }
    100% { opacity:0;transform:translate3d(-9%,0,0) scale(1.04);filter:blur(4px) brightness(.55); }
}
@keyframes v156EnemyCollisionAligned {
    0%,7% { opacity:0;transform:translate3d(112%,0,0);filter:blur(13px) brightness(.5); }
    25% { opacity:1;transform:translate3d(4%,0,0);filter:blur(0) brightness(.9); }
    29% { transform:translate3d(-2.5%,0,0) scale(1.025);filter:brightness(1.35); }
    34%,87% { opacity:1;transform:translate3d(0,0,0);filter:brightness(.9); }
    100% { opacity:0;transform:translate3d(9%,0,0) scale(1.04);filter:blur(4px) brightness(.55); }
}

@media (max-width:520px) {
    #v106-match-mode-modal .v106-mode-choice-grid { gap:10px !important; }
    #v106-match-mode-modal .v156-joker-card { width:min(43vw,172px) !important;height:min(63vw,252px) !important; }
    #v106-match-mode-modal .v156-joker-card .v120-card-front { padding:18px 14px 15px; }
    .v156-joker-corner { left:12px;top:12px;font-size:6px; }
    .v156-joker-corner.bottom { left:auto;top:auto;right:12px;bottom:12px; }
    .v156-joker-corner i { font-size:11px; }
    .v156-joker-crest { width:70%;margin-top:0; }
    .v156-joker-ornament,.v156-joker-filigree { stroke-width:2.2; }
    .v156-joker-card .v106-mode-choice-title { font-size:14px !important;margin-top:3px !important; }
    .v156-joker-card .v106-mode-choice-copy { font-size:6.5px !important; }
    .v156-joker-card .v106-mode-choice-meta { margin-top:5px !important;font-size:5.5px !important; }
}
@media (max-height:500px) and (orientation:landscape) {
    #v106-match-mode-modal .v106-mode-header { padding-bottom:5px !important; }
    #v106-match-mode-modal .v106-rank-subheading { margin-bottom:4px !important; }
    #v106-match-mode-modal .v156-joker-card { width:128px !important;height:188px !important; }
    #v106-match-mode-modal .v156-joker-card .v120-card-front { padding:15px 12px 12px; }
    .v156-joker-crest { width:61%;margin-top:-5px; }
    .v156-joker-card .v106-mode-choice-copy { display:none !important; }
    .v156-joker-card .v106-mode-choice-meta { margin-top:3px !important;padding:4px !important; }
}
@media (prefers-reduced-motion:reduce) {
    #v99-mode-overlay.show.v156-single-route::after,
    #v61-character-clash.show .v156-clash-divider { animation:none !important;opacity:.58;filter:none; }
    .v156-joker-crest,.v156-imperial-joker-svg,.v194-mode-character { transition:none !important;transform:none !important; }
}
@media (forced-colors:active) {
    #v106-match-mode-modal .v156-joker-card .v120-card-face { border:2px solid CanvasText !important;box-shadow:none !important; }
    #v106-match-mode-modal .v156-joker-card .v120-card-front { color:CanvasText !important;background:Canvas !important; }
    #v61-character-clash .v156-clash-divider { background:CanvasText;filter:none; }
}
