/*
 * JavaScript integration contract:
 * - Remove [hidden] and set aria-hidden="false" to open a modal.
 * - Add .is-current / .is-win / .is-loss / .is-up / .is-down where relevant.
 * - All dynamic value/list containers have stable v106-* ids.
 */
:root {
    --v106-rank-gold: #d9b766;
    --v106-rank-gold-pale: #f5dfa4;
    --v106-rank-gold-dim: #8d7747;
    --v106-rank-red: #861c2d;
    --v106-rank-red-dark: #390a12;
    --v106-rank-ink: #050607;
    --v106-rank-panel: #0d0d0e;
    --v106-rank-line: rgba(217, 183, 102, .25);
    --v106-rank-muted: #918873;
}

#v106-rank-record-modal[hidden],
#v106-match-mode-modal[hidden] {
    display: none !important;
}

#v106-rank-record-modal,
#v106-match-mode-modal {
    position: fixed;
    inset: 0;
    z-index: 2147482500;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    padding:
        max(12px, env(safe-area-inset-top))
        max(12px, env(safe-area-inset-right))
        max(12px, env(safe-area-inset-bottom))
        max(12px, env(safe-area-inset-left));
    overflow: hidden;
    color: #ded1ad;
    background:
        radial-gradient(circle at 50% 32%, rgba(126, 20, 35, .21), transparent 42%),
        rgba(0, 0, 0, .88);
    backdrop-filter: blur(9px) saturate(.72);
    -webkit-backdrop-filter: blur(9px) saturate(.72);
    font-family: Georgia, "Yu Mincho", "Hiragino Mincho ProN", serif;
}

#v106-rank-record-modal *,
#v106-match-mode-modal * {
    box-sizing: border-box;
}

.v106-rank-panel,
.v106-mode-panel {
    position: relative;
    width: min(1060px, 100%);
    max-height: min(880px, calc(100dvh - 24px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    isolation: isolate;
    border: 1px solid rgba(217, 183, 102, .7);
    border-radius: 3px;
    clip-path: polygon(0 0, calc(100% - 24px) 0, 100% 24px, 100% 100%, 24px 100%, 0 calc(100% - 24px));
    background:
        radial-gradient(circle at 82% 14%, rgba(125, 24, 38, .17), transparent 31%),
        linear-gradient(143deg, #1c1512, #08090a 58%, #071116);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .94), inset 0 0 70px rgba(0, 0, 0, .5);
}

.v106-rank-panel::before,
.v106-mode-panel::before {
    content: "";
    position: absolute;
    inset: 7px;
    z-index: -1;
    pointer-events: none;
    border: 1px solid rgba(217, 183, 102, .16);
    clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}

.v106-rank-panel::after,
.v106-mode-panel::after {
    content: "♛";
    position: absolute;
    right: 28px;
    top: 5px;
    z-index: -1;
    color: rgba(217, 183, 102, .045);
    font: 900 150px/1 Georgia, serif;
    transform: rotate(8deg);
    pointer-events: none;
}

.v106-rank-header,
.v106-mode-header {
    position: relative;
    flex: 0 0 auto;
    min-height: 76px;
    padding: 15px 62px 13px 22px;
    border-bottom: 1px solid rgba(217, 183, 102, .28);
    background: linear-gradient(90deg, rgba(111, 18, 31, .38), rgba(0, 0, 0, .12) 68%);
}

.v106-rank-kicker {
    color: #ae9865;
    font: 700 8px/1.1 "Courier New", monospace;
    letter-spacing: .36em;
    text-transform: uppercase;
}

.v106-rank-heading {
    margin: 7px 0 0;
    color: var(--v106-rank-gold-pale);
    font: 900 clamp(22px, 3.4vw, 34px)/1 Georgia, "Yu Mincho", serif;
    letter-spacing: .1em;
    text-shadow: 0 3px 0 #000, 0 0 18px rgba(217, 183, 102, .22);
}

.v106-rank-subheading {
    margin-top: 7px;
    color: #8e846f;
    font-size: 9px;
    letter-spacing: .05em;
}

.v106-rank-close {
    position: absolute;
    top: 16px;
    right: 18px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(217, 183, 102, .4);
    border-radius: 1px;
    color: #d6c597;
    background: rgba(6, 7, 8, .8);
    font: 400 21px/1 Georgia, serif;
    cursor: pointer;
}

.v106-rank-close:hover,
.v106-rank-close:focus-visible {
    border-color: #ffe3a0;
    color: #fff1c2;
    outline: none;
}

.v106-rank-scroll {
    min-height: 0;
    padding: 18px 20px 22px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-color: rgba(217, 183, 102, .42) rgba(0, 0, 0, .3);
}

.v106-rank-status {
    position: relative;
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr) minmax(220px, .72fr);
    gap: 18px;
    align-items: center;
    min-height: 150px;
    padding: 18px 20px;
    overflow: hidden;
    border: 1px solid rgba(217, 183, 102, .38);
    background:
        linear-gradient(100deg, rgba(115, 21, 35, .22), transparent 54%),
        rgba(0, 0, 0, .4);
    box-shadow: inset 0 0 34px rgba(0, 0, 0, .55);
}

.v106-rank-crest {
    width: 96px;
    height: 112px;
    display: grid;
    place-items: center;
    justify-self: center;
    border: 1px solid rgba(245, 223, 164, .55);
    clip-path: polygon(50% 0, 92% 15%, 86% 75%, 50% 100%, 14% 75%, 8% 15%);
    color: #130e07;
    background: linear-gradient(145deg, #fff0b1, #d4ad4f 48%, #654315);
    box-shadow: 0 0 22px rgba(217, 183, 102, .25);
    font: 900 40px/1 Georgia, serif;
    text-shadow: 0 1px rgba(255,255,255,.28);
}

.v106-rank-primary {
    min-width: 0;
}

.v106-rank-eyebrow,
.v106-rank-section-kicker {
    color: #9e8b5f;
    font: 700 8px/1.2 "Courier New", monospace;
    letter-spacing: .25em;
}

#v106-current-rank {
    margin-top: 7px;
    overflow: hidden;
    color: #f6e4af;
    font: 900 clamp(23px, 4vw, 37px)/1.12 Georgia, "Yu Mincho", serif;
    letter-spacing: .07em;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 3px 0 #000, 0 0 16px rgba(217, 183, 102, .2);
}

#v106-succession-position:empty {
    display: none;
}

#v106-succession-position {
    margin-top: 6px;
    color: #dcb85d;
    font: 800 11px/1.2 Georgia, "Yu Mincho", serif;
    letter-spacing: .05em;
}

.v106-rank-rp-block {
    min-width: 0;
    padding: 12px 14px;
    border-left: 2px solid rgba(217, 183, 102, .52);
    background: rgba(0, 0, 0, .27);
}

.v106-rank-rp-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.v106-rank-rp-label {
    color: #93886f;
    font-size: 9px;
    letter-spacing: .08em;
}

#v106-current-rp {
    color: #f2d98f;
    font: 900 21px/1 Georgia, serif;
    white-space: nowrap;
}

.v106-rank-progress-track {
    position: relative;
    height: 8px;
    margin-top: 12px;
    overflow: hidden;
    border: 1px solid rgba(217, 183, 102, .25);
    background: #020303;
}

#v106-rank-progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #771525, #d3aa4d 82%, #ffedac);
    box-shadow: 0 0 10px rgba(217, 183, 102, .42);
    transition: width .45s ease;
}

.v106-rank-progress-copy {
    display: flex;
    justify-content: space-between;
    gap: 9px;
    margin-top: 7px;
    color: #7f7766;
    font: 700 8px/1.3 "Courier New", monospace;
}

#v106-next-rank-copy {
    overflow: hidden;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.v106-rank-section {
    margin-top: 18px;
}

.v106-rank-section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 9px;
    padding-bottom: 7px;
    border-bottom: 1px solid rgba(217, 183, 102, .18);
}

.v106-rank-section-title {
    margin-top: 4px;
    color: #dfc98f;
    font: 900 15px/1.2 Georgia, "Yu Mincho", serif;
    letter-spacing: .09em;
}

.v106-rank-section-note {
    color: #6f695c;
    font: 700 7px/1.3 "Courier New", monospace;
    text-align: right;
}

.v106-rank-metrics {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 7px;
}

.v106-rank-metric {
    min-width: 0;
    min-height: 86px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 6px;
    border: 1px solid rgba(217, 183, 102, .2);
    background: linear-gradient(155deg, rgba(84, 19, 29, .14), rgba(0, 0, 0, .44));
}

.v106-rank-metric-label {
    color: #817966;
    font-size: 8px;
    letter-spacing: .06em;
    text-align: center;
}

.v106-rank-metric-value {
    max-width: 100%;
    margin-top: 8px;
    overflow: hidden;
    color: #ead8a7;
    font: 900 18px/1 Georgia, serif;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.v106-rank-two-column {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
    gap: 14px;
}

.v106-rank-card {
    min-width: 0;
    padding: 13px;
    border: 1px solid rgba(217, 183, 102, .21);
    background: rgba(0, 0, 0, .34);
}

#v106-recent-match-list {
    display: grid;
    gap: 6px;
    min-height: 76px;
}

#v106-recent-match-list:empty::after {
    content: "まだランク戦の記録はありません。";
    display: grid;
    place-items: center;
    min-height: 76px;
    color: #6f695c;
    border: 1px dashed rgba(217, 183, 102, .16);
    font-size: 9px;
}

.v106-rank-history-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    min-height: 42px;
    padding: 7px 9px;
    border-left: 2px solid #665b43;
    color: #9e947d;
    background: rgba(255, 255, 255, .025);
    font-size: 9px;
}

.v106-rank-history-row.is-win { border-left-color: #d0aa4e; }
.v106-rank-history-row.is-loss { border-left-color: #7f1a2a; }
.v106-rank-history-result { color: #e0ca91; font-weight: 900; }
.v106-rank-history-rp.is-up { color: #dcbc62; }
.v106-rank-history-rp.is-down { color: #b7757e; }

#v106-rank-system-summary {
    min-height: 76px;
    color: #a59a80;
    font-size: 10px;
    line-height: 1.75;
}

#v106-rank-system-summary:empty::after {
    content: "勝敗による爵位点の増減と、皇位継承順位の概要を表示します。";
    color: #6f695c;
}

.v106-rank-table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(217, 183, 102, .19);
    background: rgba(0, 0, 0, .32);
}

.v106-rank-table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    color: #aa9f85;
    font-size: 9px;
}

.v106-rank-table th,
.v106-rank-table td {
    padding: 9px 12px;
    border-bottom: 1px solid rgba(217, 183, 102, .12);
    text-align: left;
}

.v106-rank-table th {
    color: #d7c28c;
    background: rgba(112, 23, 36, .18);
    font: 800 8px/1.2 "Courier New", monospace;
    letter-spacing: .14em;
}

.v106-rank-table tbody tr:last-child td { border-bottom: 0; }
.v106-rank-table tbody tr.is-current {
    color: #f0dca8;
    background: linear-gradient(90deg, rgba(130, 27, 43, .25), rgba(217, 183, 102, .07));
    box-shadow: inset 3px 0 #d9b766;
}

.v106-rank-footer,
.v106-mode-footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-height: 61px;
    padding: 10px 20px max(10px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(217, 183, 102, .27);
    background: rgba(3, 4, 5, .91);
}

.v106-rank-footer-note {
    min-width: 0;
    margin-right: auto;
    color: #796f5b;
    font: 700 8px/1.35 "Courier New", monospace;
    letter-spacing: .05em;
}

.v106-rank-action {
    min-width: 144px;
    min-height: 41px;
    padding: 9px 15px;
    border: 1px solid rgba(217, 183, 102, .4);
    border-radius: 1px;
    color: #d7c69b;
    background: linear-gradient(180deg, #2b261f, #0b0c0c);
    font: 800 10px/1 Georgia, "Yu Mincho", serif;
    letter-spacing: .09em;
    cursor: pointer;
}

.v106-rank-action:hover,
.v106-rank-action:focus-visible {
    border-color: #ebcc72;
    color: #fff0bf;
    outline: none;
}

/* Match-mode choice modal */
.v106-mode-panel {
    width: min(760px, 100%);
}

.v106-mode-body {
    padding: 24px;
    overflow: auto;
}

.v106-mode-choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.v106-mode-choice {
    position: relative;
    min-height: 244px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 22px 20px 18px;
    overflow: hidden;
    border: 1px solid rgba(217, 183, 102, .27);
    border-radius: 1px;
    color: #a99e83;
    background:
        radial-gradient(circle at 82% 20%, rgba(217, 183, 102, .09), transparent 34%),
        linear-gradient(155deg, #171516, #050607 74%);
    font-family: Georgia, "Yu Mincho", serif;
    text-align: left;
    cursor: pointer;
}

.v106-mode-choice::after {
    position: absolute;
    right: -3px;
    bottom: -25px;
    color: rgba(217, 183, 102, .075);
    font: 900 125px/1 Georgia, serif;
    pointer-events: none;
}

#v106-select-free-match::after { content: "♠"; }
#v106-select-ranked-match::after { content: "♛"; }

.v106-mode-choice:hover,
.v106-mode-choice:focus-visible {
    border-color: #d9b766;
    color: #d9c899;
    outline: none;
    box-shadow: 0 0 22px rgba(217, 183, 102, .12), inset 0 0 28px rgba(217, 183, 102, .04);
    transform: translateY(-2px);
}

#v106-select-ranked-match {
    border-color: rgba(181, 45, 63, .5);
    background:
        radial-gradient(circle at 82% 20%, rgba(217, 183, 102, .11), transparent 34%),
        linear-gradient(145deg, rgba(116, 20, 34, .28), #070708 66%);
}

#v106-select-ranked-match:hover,
#v106-select-ranked-match:focus-visible {
    border-color: #e0bd67;
    box-shadow: 0 0 24px rgba(142, 25, 41, .28), inset 0 0 34px rgba(128, 22, 37, .12);
}

.v106-mode-choice-kicker {
    position: relative;
    z-index: 1;
    color: #8e7c55;
    font: 700 8px/1.2 "Courier New", monospace;
    letter-spacing: .25em;
}

.v106-mode-choice-title {
    position: relative;
    z-index: 1;
    margin-top: 10px;
    color: #f0dca6;
    font: 900 25px/1.1 Georgia, "Yu Mincho", serif;
    letter-spacing: .09em;
}

.v106-mode-choice-copy {
    position: relative;
    z-index: 1;
    max-width: 88%;
    margin-top: 14px;
    color: #8f8774;
    font-size: 10px;
    line-height: 1.7;
}

.v106-mode-choice-meta {
    position: relative;
    z-index: 1;
    margin-top: auto;
    padding-top: 24px;
    color: #c4ad73;
    font: 800 8px/1.35 "Courier New", monospace;
    letter-spacing: .07em;
}

@media (max-width: 900px) {
    .v106-rank-status {
        grid-template-columns: 92px minmax(0, 1fr) minmax(205px, .65fr);
        gap: 13px;
        padding-inline: 14px;
    }
    .v106-rank-crest { width: 80px; height: 96px; font-size: 34px; }
    .v106-rank-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
    #v106-rank-record-modal,
    #v106-match-mode-modal {
        padding:
            max(7px, env(safe-area-inset-top))
            max(7px, env(safe-area-inset-right))
            max(7px, env(safe-area-inset-bottom))
            max(7px, env(safe-area-inset-left));
    }
    .v106-rank-panel,
    .v106-mode-panel { max-height: calc(100dvh - 14px); }
    .v106-rank-header,
    .v106-mode-header { min-height: 66px; padding: 12px 51px 10px 14px; }
    .v106-rank-kicker { font-size: 6px; letter-spacing: .23em; }
    .v106-rank-heading { margin-top: 6px; font-size: 21px; }
    .v106-rank-subheading { margin-top: 5px; font-size: 7px; }
    .v106-rank-close { top: 12px; right: 12px; width: 34px; height: 34px; }
    .v106-rank-scroll { padding: 12px 11px 16px; }
    .v106-rank-status {
        grid-template-columns: 70px minmax(0, 1fr);
        min-height: 138px;
        gap: 10px;
        padding: 12px;
    }
    .v106-rank-crest { width: 62px; height: 76px; font-size: 27px; }
    #v106-current-rank { font-size: clamp(19px, 6vw, 25px); }
    .v106-rank-rp-block {
        grid-column: 1 / -1;
        padding: 9px 10px;
        border-left-width: 1px;
    }
    #v106-current-rp { font-size: 17px; }
    .v106-rank-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
    .v106-rank-metric { min-height: 70px; }
    .v106-rank-metric-label { font-size: 7px; }
    .v106-rank-metric-value { margin-top: 6px; font-size: 15px; }
    .v106-rank-two-column { grid-template-columns: 1fr; }
    .v106-rank-section-title { font-size: 13px; }
    .v106-rank-section-note { display: none; }
    .v106-rank-history-row { grid-template-columns: 43px minmax(0, 1fr) auto; gap: 7px; }
    .v106-rank-history-row > :nth-child(4) { display: none; }
    .v106-rank-footer,
    .v106-mode-footer { min-height: 56px; padding: 8px 11px max(8px, env(safe-area-inset-bottom)); }
    .v106-rank-footer-note { display: none; }
    .v106-rank-action { width: 100%; min-width: 0; }
    .v106-mode-body { padding: 13px 12px; }
    .v106-mode-choice-grid { grid-template-columns: 1fr; gap: 9px; }
    .v106-mode-choice { min-height: 154px; padding: 16px 14px 13px; }
    .v106-mode-choice-title { margin-top: 7px; font-size: 21px; }
    .v106-mode-choice-copy { max-width: 82%; margin-top: 9px; font-size: 9px; line-height: 1.55; }
    .v106-mode-choice-meta { padding-top: 13px; font-size: 7px; }
    .v106-mode-choice::after { right: 0; bottom: -19px; font-size: 94px; }
}

@media (max-width: 370px) {
    .v106-rank-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .v106-mode-choice-copy { max-width: 78%; }
}

@media (max-height: 660px) and (min-width: 701px) {
    .v106-rank-header,
    .v106-mode-header { min-height: 61px; padding-top: 10px; padding-bottom: 9px; }
    .v106-rank-heading { margin-top: 4px; font-size: 25px; }
    .v106-rank-subheading { display: none; }
    .v106-rank-status { min-height: 126px; }
    .v106-mode-choice { min-height: 205px; }
}

@media (prefers-reduced-motion: reduce) {
    #v106-rank-progress-fill,
    .v106-mode-choice { transition-duration: .01ms !important; }
}

body.v106-rank-overlay-open,
body.v106-queue-overlay-open { overflow: hidden !important; }

#v43-match-result-reason { white-space: pre-line; }

#v105-home-profile-button .v105-profile-kicker { display: none !important; }
.v106-profile-rank {
    display: block;
    max-width: 100%;
    margin-top: 3px;
    overflow: hidden;
    color: #d7b65f;
    font: 800 7px/1.1 "Courier New", monospace;
    letter-spacing: .03em;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.v106-profile-preview-rank {
    position: relative;
    max-width: 92%;
    margin-top: 8px;
    padding: 5px 10px;
    overflow: hidden;
    border: 1px solid rgba(217, 183, 102, .32);
    color: #e7c970;
    background: rgba(0, 0, 0, .42);
    font: 800 8px/1.1 "Courier New", monospace;
    letter-spacing: .05em;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.v106-history-empty {
    min-height: 106px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 7px;
    padding: 14px;
    border: 1px dashed rgba(217, 183, 102, .18);
    color: #756d5b;
    text-align: center;
}
.v106-history-empty span { color: #a58a4c; font-size: 22px; }
.v106-history-empty strong { color: #b9a77d; font-size: 10px; }
.v106-history-empty small { max-width: 390px; font-size: 8px; line-height: 1.55; }
.v106-rank-history-result { display: grid; gap: 3px; }
.v106-rank-history-result strong { color: #e0ca91; font-size: 10px; }
.v106-rank-history-result span { color: #716a5c; font-size: 7px; }
.v106-rank-history-teams { min-width: 0; display: grid; gap: 3px; }
.v106-rank-history-teams span,
.v106-rank-history-teams small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.v106-rank-history-teams span { color: #b0a48a; }
.v106-rank-history-teams small { color: #716a5c; font-size: 7px; }
.v106-rank-history-rp { display: grid; gap: 3px; justify-items: end; font-weight: 900; white-space: nowrap; }
.v106-rank-history-rp small { color: #756e60; font-size: 7px; font-weight: 700; }
.v106-system-rules { display: grid; gap: 3px; margin: 9px 0; }
.v106-system-rules > div { display: grid; grid-template-columns: minmax(86px, .8fr) 1.2fr; gap: 8px; padding: 5px 7px; background: rgba(255,255,255,.025); }
.v106-system-rules dt { color: #c0ab77; }
.v106-system-rules dd { margin: 0; text-align: right; }
.v106-formation-summary { margin: 9px 0 0; padding-top: 8px; border-top: 1px solid rgba(217,183,102,.13); color: #c1ae7c; }
.v106-tier-gem {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 8px;
    border: 1px solid currentColor;
    transform: rotate(45deg);
    background: currentColor;
    opacity: .72;
}
.v106-rank-table tr[data-tone="iron"] { --v106-tier-color:#74777a; }
.v106-rank-table tr[data-tone="silver"] { --v106-tier-color:#c7cdd1; }
.v106-rank-table tr[data-tone="bronze"] { --v106-tier-color:#b87843; }
.v106-rank-table tr[data-tone="emerald"] { --v106-tier-color:#4f9a70; }
.v106-rank-table tr[data-tone="sapphire"] { --v106-tier-color:#5790bf; }
.v106-rank-table tr[data-tone="violet"] { --v106-tier-color:#9272bd; }
.v106-rank-table tr[data-tone="crimson"] { --v106-tier-color:#bd5363; }
.v106-rank-table tr[data-tone="gold"] { --v106-tier-color:#d9b766; }
.v106-rank-table tr[data-tone="platinum"] { --v106-tier-color:#e2e1d8; }
.v106-rank-table tr[data-tone="imperial"] { --v106-tier-color:#ffe59a; }
.v106-rank-table tr[data-tone] .v106-tier-gem { color: var(--v106-tier-color); }
.v106-rank-status[data-tone="iron"] .v106-rank-crest { filter: grayscale(.75) brightness(.78); }
.v106-rank-status[data-tone="silver"] .v106-rank-crest { filter: grayscale(.85) brightness(1.05); }
.v106-rank-status[data-tone="bronze"] .v106-rank-crest { filter: sepia(.55) saturate(.75); }
.v106-rank-status[data-tone="emerald"] .v106-rank-crest { filter: hue-rotate(69deg) saturate(.76); }
.v106-rank-status[data-tone="sapphire"] .v106-rank-crest { filter: hue-rotate(165deg) saturate(.84); }
.v106-rank-status[data-tone="violet"] .v106-rank-crest { filter: hue-rotate(222deg) saturate(.75); }
.v106-rank-status[data-tone="crimson"] .v106-rank-crest { filter: hue-rotate(302deg) saturate(1.1); }
.v106-rank-status[data-tone="platinum"] .v106-rank-crest { filter: grayscale(.72) brightness(1.18); }
.v106-rank-status[data-tone="imperial"] .v106-rank-crest { box-shadow: 0 0 28px rgba(255,213,91,.48); }
#v106-ranked-battle-badge {
    position: fixed;
    top: max(7px, env(safe-area-inset-top));
    left: 50%;
    z-index: 12940;
    display: none;
    grid-template-columns: auto auto;
    gap: 0 7px;
    align-items: center;
    max-width: min(300px, 60vw);
    padding: 5px 11px 6px;
    border: 1px solid rgba(229, 197, 112, .55);
    clip-path: polygon(7px 0, 100% 0, calc(100% - 7px) 100%, 0 100%);
    color: #f0d58b;
    background: linear-gradient(90deg, rgba(81, 10, 20, .94), rgba(7, 9, 10, .94));
    box-shadow: 0 5px 20px rgba(0,0,0,.55);
    transform: translateX(-50%);
    pointer-events: none;
}
#v106-ranked-battle-badge.show { display: grid; }
#v106-ranked-battle-badge > span { grid-row: 1 / 3; font-size: 18px; }
#v106-ranked-battle-badge > strong { font: 900 9px/1.1 Georgia, "Yu Mincho", serif; letter-spacing: .12em; }
#v106-ranked-battle-badge > small { overflow: hidden; color: #aa9870; font: 700 6px/1.1 "Courier New", monospace; white-space: nowrap; text-overflow: ellipsis; }

@media (max-width: 700px) {
    .v106-profile-rank { font-size: 6.5px; }
    .v106-profile-preview-rank { margin-top: 5px; padding-block: 4px; font-size: 7px; }
    .v106-system-rules > div { grid-template-columns: 1fr; gap: 2px; }
    .v106-system-rules dd { text-align: left; }
    #v106-ranked-battle-badge { top: max(37px, env(safe-area-inset-top)); max-width: 54vw; }
}
