/*
 * V158 / IMPERIAL HONOURS ARCHIVE
 * v105 の保存スキーマと frameId は変更せず、表示層だけを豪華に再構成する。
 */
#v105-profile-editor .v105-profile-panel {
    background:
        linear-gradient(135deg, transparent 0 49.75%, rgba(217,183,102,.055) 49.9% 50.1%, transparent 50.25%),
        radial-gradient(circle at 79% 15%, rgba(133,27,43,.19), transparent 34%),
        radial-gradient(circle at 14% 78%, rgba(27,88,83,.12), transparent 35%),
        linear-gradient(142deg, #211713, #08090a 54%, #071113) !important;
}
#v105-profile-editor .v105-profile-panel-header::after {
    content: "";
    position: absolute;
    left: 18px;
    right: 62px;
    bottom: -1px;
    height: 1px;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, #d9b766 15%, rgba(217,183,102,.18) 68%, transparent);
}
#v105-profile-editor .v105-profile-panel-kicker {
    color: #d0b56f;
    text-shadow: 0 0 12px rgba(217,183,102,.22);
}
#v105-profile-editor .v105-profile-panel-body {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}

/* ---------- 称号記録 ---------- */
.v158-title-archive {
    position: relative;
    margin-top: 10px;
    padding: 9px;
    overflow: hidden;
    border: 1px solid rgba(217,183,102,.19);
    background:
        radial-gradient(circle at 92% 0, rgba(145,30,47,.16), transparent 37%),
        linear-gradient(135deg, rgba(28,21,17,.92), rgba(3,5,6,.78));
    box-shadow: inset 0 0 0 1px rgba(255,239,184,.025), inset 0 -20px 45px rgba(0,0,0,.24);
}
.v158-title-archive::before,
.v158-title-archive::after {
    content: "";
    position: absolute;
    pointer-events: none;
}
.v158-title-archive::before {
    inset: 4px;
    border: 1px solid rgba(217,183,102,.08);
}
.v158-title-archive::after {
    top: 0;
    right: 13px;
    width: 72px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #d9b766, transparent);
    box-shadow: 0 0 9px rgba(217,183,102,.45);
}
.v158-title-archive-head {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 9px;
    margin-bottom: 7px;
}
.v158-title-archive-head .v105-section-label { color: #ccb06c; }
.v158-title-archive-head small {
    color: #766d5c;
    font: 700 6px/1 "Courier New", monospace;
    letter-spacing: .16em;
    white-space: nowrap;
}
.v158-title-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
}
.v158-title-chip {
    position: relative;
    min-width: 0;
    min-height: 38px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 6px 8px 6px 12px;
    overflow: hidden;
    border: 1px solid rgba(217,183,102,.16);
    color: #b7aa89;
    background:
        linear-gradient(90deg, rgba(128,23,38,.08), transparent 48%),
        rgba(2,4,5,.68);
    font-family: Georgia, "Yu Mincho", "Hiragino Mincho ProN", serif;
    text-align: left;
    cursor: pointer;
    transition: border-color .16s ease, color .16s ease, background .16s ease, transform .16s ease;
}
.v158-title-chip::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: linear-gradient(#5f151f, #d1ac59 50%, #315f50);
    opacity: .5;
}
.v158-title-chip::after {
    content: "";
    position: absolute;
    right: -13px;
    bottom: -17px;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(217,183,102,.08);
    transform: rotate(45deg);
}
.v158-title-chip strong {
    position: relative;
    z-index: 1;
    display: block;
    overflow: hidden;
    font-size: 8px;
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: .035em;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.v158-title-chip small {
    position: relative;
    z-index: 1;
    display: block;
    overflow: hidden;
    color: #655f53;
    font: 800 5.5px/1 "Courier New", monospace;
    letter-spacing: .12em;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.v158-title-chip:hover,
.v158-title-chip:focus-visible {
    border-color: rgba(236,204,119,.66);
    color: #f0dfb0;
    background: linear-gradient(100deg, rgba(132,24,40,.2), rgba(7,10,10,.92));
    outline: none;
    transform: translateY(-1px);
}
.v158-title-chip.is-selected {
    border-color: #d9b766;
    color: #fff0bd;
    background:
        radial-gradient(circle at 86% 15%, rgba(217,183,102,.13), transparent 34%),
        linear-gradient(105deg, rgba(116,18,32,.36), rgba(6,9,9,.96) 66%);
    box-shadow: 0 0 12px rgba(217,183,102,.15), inset 0 0 0 1px rgba(255,236,174,.045);
}
.v158-title-chip.is-selected::before { opacity: 1; box-shadow: 0 0 6px rgba(217,183,102,.42); }
.v158-title-chip.is-selected small { color: #aa9561; }

/* ---------- 高級プロフィール縁カタログ ---------- */
#v105-frame-grid .v105-frame-choice {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background:
        radial-gradient(circle at 12% 20%, color-mix(in srgb, var(--v105-frame-main) 13%, transparent), transparent 33%),
        linear-gradient(118deg, color-mix(in srgb, var(--v105-frame-main) 8%, #080909), #050707 72%) !important;
}
#v105-frame-grid .v105-frame-choice::before {
    content: "";
    position: absolute;
    inset: 3px;
    z-index: -1;
    pointer-events: none;
    border: 1px solid color-mix(in srgb, var(--v105-frame-main) 13%, transparent);
}
#v105-frame-grid .v105-frame-choice::after {
    content: "";
    position: absolute;
    right: -14px;
    top: -20px;
    z-index: -1;
    width: 42px;
    height: 58px;
    pointer-events: none;
    border-left: 1px solid color-mix(in srgb, var(--v105-frame-main) 17%, transparent);
    transform: rotate(29deg);
}
#v105-frame-grid .v105-frame-choice.is-selected::before {
    border-color: color-mix(in srgb, var(--v105-frame-light) 35%, transparent);
    box-shadow: inset 0 0 10px color-mix(in srgb, var(--v105-frame-main) 9%, transparent);
}
.v158-frame-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.v158-frame-copy strong,
.v158-frame-copy small {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.v158-frame-copy strong {
    color: inherit;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: .035em;
}
.v158-frame-copy small {
    color: color-mix(in srgb, var(--v105-frame-main) 68%, #777062);
    font: 700 5px/1 "Courier New", monospace;
    letter-spacing: .09em;
}
#v105-frame-grid .v105-frame-swatch {
    position: relative;
    overflow: visible;
    color: #080909;
    font-family: Georgia, serif;
    text-shadow: 0 1px rgba(255,255,255,.18);
}
#v105-frame-grid .v105-frame-swatch::before {
    content: "";
    position: absolute;
    inset: 3px;
    border: 1px solid color-mix(in srgb, var(--v105-frame-dark) 75%, transparent);
    clip-path: inherit;
}
#v105-frame-grid .v105-frame-swatch::after {
    content: "";
    position: absolute;
    inset: -3px;
    border: 1px solid color-mix(in srgb, var(--v105-frame-light) 20%, transparent);
    clip-path: inherit;
}

.v158-vault-button {
    position: relative;
    width: 100%;
    min-height: 36px;
    display: grid;
    grid-template-columns: 28px minmax(0,1fr) auto;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 6px 10px 6px 7px;
    overflow: hidden;
    border: 1px solid rgba(217,183,102,.25);
    color: #cfc09b;
    background:
        radial-gradient(circle at 88% 40%, rgba(57,130,98,.14), transparent 27%),
        linear-gradient(105deg, rgba(113,20,33,.2), rgba(4,7,8,.92) 54%);
    font-family: Georgia, "Yu Mincho", serif;
    text-align: left;
    cursor: pointer;
}
.v158-vault-button::before {
    content: "♠";
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(217,183,102,.44);
    color: #d9b766;
    background: #080a0a;
    font: 900 14px/1 Georgia, serif;
    transform: rotate(-4deg);
    box-shadow: inset 0 0 0 2px #080a0a, inset 0 0 0 3px rgba(217,183,102,.13);
}
.v158-vault-button > span:first-of-type {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.v158-vault-button strong { font-size: 8px; letter-spacing: .08em; }
.v158-vault-button small {
    color: #7c725d;
    font: 800 5.5px/1 "Courier New", monospace;
    letter-spacing: .14em;
}
.v158-vault-button > span:last-child {
    color: #ae9457;
    font: 800 7px/1 "Courier New", monospace;
    letter-spacing: .08em;
}
.v158-vault-button:hover,
.v158-vault-button:focus-visible {
    border-color: #e1c16b;
    color: #fff0c0;
    background: linear-gradient(105deg, rgba(128,22,39,.34), rgba(7,12,12,.96) 58%);
    box-shadow: 0 0 12px rgba(217,183,102,.14);
    outline: none;
}

/* ---------- 縁の立体オーナメント ---------- */
#v105-home-profile-button,
#v105-profile-preview {
    --v158-crest: "♛";
    --v158-ornament-alpha: .78;
}
[data-v105-frame="imperial"] { --v158-crest:"♛"; --v158-ornament-alpha:.88; }
[data-v105-frame="crimson"]  { --v158-crest:"♦"; --v158-ornament-alpha:.82; }
[data-v105-frame="sapphire"] { --v158-crest:"♠"; --v158-ornament-alpha:.84; }
[data-v105-frame="silver"]   { --v158-crest:"♣"; --v158-ornament-alpha:.76; }
[data-v105-frame="emerald"]  { --v158-crest:"❖"; --v158-ornament-alpha:.82; }
[data-v105-frame="obsidian"] { --v158-crest:"♜"; --v158-ornament-alpha:.9; }

.v158-profile-ornament {
    position: absolute;
    inset: 4px;
    z-index: 4;
    display: block;
    pointer-events: none;
    opacity: var(--v158-ornament-alpha);
    filter: drop-shadow(0 0 4px var(--v105-frame-glow));
}
.v158-profile-ornament::before,
.v158-profile-ornament::after {
    content: "";
    position: absolute;
    pointer-events: none;
}
.v158-profile-ornament::before {
    inset: 2px;
    border: 1px solid color-mix(in srgb, var(--v105-frame-light) 34%, transparent);
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
.v158-profile-ornament::after {
    left: 18%;
    right: 18%;
    top: 0;
    bottom: 0;
    border-top: 1px solid color-mix(in srgb, var(--v105-frame-main) 44%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--v105-frame-main) 44%, transparent);
}
.v158-ornament-corner {
    position: absolute;
    width: 22px;
    height: 22px;
    display: block;
    color: var(--v105-frame-light);
}
.v158-ornament-corner::after {
    content: "";
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--v105-frame-light);
    transform: rotate(45deg);
    box-shadow: 0 0 5px var(--v105-frame-glow);
}
.v158-ornament-corner.nw { left:0;top:0;border-left:2px solid var(--v105-frame-main);border-top:2px solid var(--v105-frame-main); }
.v158-ornament-corner.ne { right:0;top:0;border-right:2px solid var(--v105-frame-main);border-top:2px solid var(--v105-frame-main); }
.v158-ornament-corner.sw { left:0;bottom:0;border-left:2px solid var(--v105-frame-main);border-bottom:2px solid var(--v105-frame-main); }
.v158-ornament-corner.se { right:0;bottom:0;border-right:2px solid var(--v105-frame-main);border-bottom:2px solid var(--v105-frame-main); }
.v158-ornament-corner.nw::after { left:-3px;top:-3px; }
.v158-ornament-corner.ne::after { right:-3px;top:-3px; }
.v158-ornament-corner.sw::after { left:-3px;bottom:-3px; }
.v158-ornament-corner.se::after { right:-3px;bottom:-3px; }
.v158-ornament-crest {
    position: absolute;
    left: 50%;
    top: -2px;
    width: 42px;
    height: 23px;
    display: grid;
    place-items: center;
    color: var(--v105-frame-light);
    background:
        linear-gradient(135deg, transparent 0 16%, color-mix(in srgb, var(--v105-frame-dark) 88%, #080909) 17% 83%, transparent 84%),
        transparent;
    transform: translateX(-50%);
}
.v158-ornament-crest::before,
.v158-ornament-crest::after {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
.v158-ornament-crest::before {
    content: "";
    inset: 2px 4px;
    border-top: 1px solid var(--v105-frame-main);
    border-bottom: 1px solid color-mix(in srgb, var(--v105-frame-main) 42%, transparent);
    clip-path: polygon(12% 0,88% 0,100% 50%,88% 100%,12% 100%,0 50%);
}
.v158-ornament-crest::after {
    content: var(--v158-crest);
    top: 4px;
    font: 900 12px/1 Georgia, serif;
    text-shadow: 0 0 7px var(--v105-frame-glow), 0 1px #000;
}
#v105-profile-preview .v158-profile-ornament { inset: 6px; }
#v105-profile-preview .v158-ornament-corner { width: 34px; height: 34px; }
#v105-profile-preview .v158-ornament-crest { width: 58px; height: 28px; }
#v105-profile-preview .v158-ornament-crest::after { top: 5px; font-size: 15px; }
#v105-home-profile-button .v158-profile-ornament { inset: 3px; opacity: .64; }
#v105-home-profile-button .v158-ornament-corner { width: 14px; height: 14px; }
#v105-home-profile-button .v158-ornament-corner::after { width:3px;height:3px; }
#v105-home-profile-button .v158-ornament-crest { left:auto;right:15px;top:-1px;width:24px;height:14px;transform:none; }
#v105-home-profile-button .v158-ornament-crest::after { top:2px;font-size:8px; }

/* シーズン装具が優先装着されている場合も、装具に合う紋章へ切り替える。 */
body[data-v137-profile-frame="jade-order"] #v105-home-profile-button,
body[data-v137-profile-frame="jade-order"] #v105-profile-preview { --v158-crest:"❖"; --v158-ornament-alpha:.84; }
body[data-v137-profile-frame="ruby-command"] #v105-home-profile-button,
body[data-v137-profile-frame="ruby-command"] #v105-profile-preview { --v158-crest:"♦"; --v158-ornament-alpha:.86; }
body[data-v137-profile-frame="black-seal-crown"] #v105-home-profile-button,
body[data-v137-profile-frame="black-seal-crown"] #v105-profile-preview { --v158-crest:"♛"; --v158-ornament-alpha:.94; }

@media (max-width: 700px) {
    .v158-title-archive { margin-top:7px;padding:6px; }
    .v158-title-archive-head { margin-bottom:5px; }
    .v158-title-archive-head small { display:none; }
    .v158-title-grid { grid-template-columns:repeat(2,minmax(0,1fr));gap:3px; }
    .v158-title-chip { min-height:29px;padding:4px 5px 4px 9px;gap:1px; }
    .v158-title-chip strong { font-size:6px; }
    .v158-title-chip small { font-size:4.5px;letter-spacing:.06em; }
    .v158-frame-copy small { display:none; }
    .v158-frame-copy strong { font-size:5.5px; }
    .v158-vault-button { min-height:29px;grid-template-columns:21px minmax(0,1fr);gap:5px;padding:3px 5px; }
    .v158-vault-button::before { width:19px;height:19px;font-size:10px; }
    .v158-vault-button small,
    .v158-vault-button > span:last-child { display:none; }
    #v105-profile-preview .v158-ornament-crest { width:34px;height:20px; }
    #v105-profile-preview .v158-ornament-crest::after { top:3px;font-size:10px; }
    #v105-profile-preview .v158-ornament-corner { width:20px;height:20px; }
}
@media (max-height: 480px) and (min-width: 701px) {
    .v158-title-archive { margin-top:4px;padding:4px 5px; }
    .v158-title-archive-head { margin-bottom:3px; }
    .v158-title-grid { grid-template-columns:repeat(6,minmax(0,1fr));gap:3px; }
    .v158-title-chip { min-height:23px;padding:3px 3px 3px 7px; }
    .v158-title-chip strong { font-size:5.5px; }
    .v158-title-chip small,
    .v158-frame-copy small { display:none; }
    .v158-frame-copy strong { font-size:5.5px; }
    .v158-vault-button { min-height:23px;margin-top:3px;padding:2px 5px;grid-template-columns:18px minmax(0,1fr); }
    .v158-vault-button::before { width:16px;height:16px;font-size:8px; }
    .v158-vault-button small,
    .v158-vault-button > span:last-child { display:none; }
}
@media (prefers-reduced-motion: reduce) {
    .v158-title-chip { transition:none; }
}
