/* SHOCKER_V56_LOG_OVERLAY_AND_KEYBOARD_EXTENSION */

/* 盤面内ログは小型プレビューとして残し、操作は独立した大型ログで行う。 */
.opponent-chain-log-title {
    position: relative !important;
    z-index: 8 !important;
    pointer-events: auto !important;
}

#v56-chain-log-open {
    min-width: 58px;
    min-height: 22px;
    margin: -3px 0 -3px auto;
    padding: 3px 7px;
    border: 1px solid rgba(255, 188, 132, .88);
    border-radius: 6px;
    background: linear-gradient(180deg, rgba(138, 43, 31, .98), rgba(58, 8, 8, .98));
    box-shadow: 0 0 8px rgba(255, 88, 64, .3);
    color: #fff0d3;
    font-family: "Courier New", monospace;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .03em;
    cursor: pointer;
    touch-action: manipulation;
    pointer-events: auto !important;
}

#v56-chain-log-open:focus-visible,
#v56-chain-log-close:focus-visible,
#v56-chain-log-scroll:focus-visible {
    outline: 3px solid #ffe59b;
    outline-offset: 2px;
}

#opponent-chain-log {
    height: 44px !important;
    min-height: 36px !important;
    max-height: 44px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    resize: none !important;
    pointer-events: auto !important;
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

#v56-chain-log-overlay[hidden] {
    display: none !important;
}

#v56-chain-log-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    padding: clamp(10px, 3vw, 34px);
    pointer-events: auto;
}

.v56-chain-log-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 2, 8, .9);
    backdrop-filter: blur(5px);
    cursor: zoom-out;
}

.v56-chain-log-dialog {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(920px, 96vw);
    height: min(760px, 90dvh);
    min-height: min(420px, 88dvh);
    overflow: hidden;
    border: 2px solid rgba(234, 103, 86, .78);
    border-radius: 16px;
    background:
        linear-gradient(145deg, rgba(38, 8, 12, .99), rgba(6, 7, 14, .99));
    box-shadow:
        0 24px 90px rgba(0, 0, 0, .92),
        0 0 34px rgba(208, 49, 49, .24),
        inset 0 0 36px rgba(255, 111, 75, .05);
    color: #f8e9d3;
}

.v56-chain-log-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 60px;
    padding: 11px 15px 10px 19px;
    border-bottom: 1px solid rgba(255, 137, 106, .34);
    background: rgba(70, 14, 17, .76);
}

.v56-chain-log-heading {
    min-width: 0;
}

.v56-chain-log-heading strong {
    display: block;
    color: #ffd5ad;
    font-family: "Courier New", monospace;
    font-size: clamp(15px, 2.5vw, 22px);
    letter-spacing: .12em;
}

.v56-chain-log-heading span {
    display: block;
    margin-top: 3px;
    color: rgba(255, 225, 199, .68);
    font-size: 10px;
    letter-spacing: .04em;
}

#v56-chain-log-close {
    flex: 0 0 auto;
    min-width: 88px;
    min-height: 40px;
    padding: 8px 13px;
    border: 1px solid rgba(255, 216, 158, .76);
    border-radius: 9px;
    background: linear-gradient(180deg, #7f3a28, #40110f);
    color: #fff2d8;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
}

#v56-chain-log-scroll {
    box-sizing: border-box;
    min-height: 0;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    padding: 16px 18px 28px;
    scrollbar-gutter: stable both-edges;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    user-select: none;
}

#v56-chain-log-scroll.v56-dragging {
    cursor: grabbing;
    touch-action: none;
}

#v56-chain-log-scroll .opponent-chain-log-entry,
#v56-chain-log-scroll .opponent-chain-log-empty {
    box-sizing: border-box;
    width: 100%;
    min-height: 38px;
    margin: 0 0 9px;
    padding: 9px 11px;
    border: 1px solid rgba(255, 147, 117, .22);
    border-radius: 8px;
    background: rgba(255, 255, 255, .035);
    font-size: clamp(12px, 2vw, 16px);
    line-height: 1.45;
    user-select: text;
}

.v56-chain-log-foot {
    padding: 8px 16px 10px;
    border-top: 1px solid rgba(255, 137, 106, .22);
    background: rgba(34, 6, 10, .88);
    color: rgba(255, 225, 199, .72);
    font-size: 10px;
    text-align: center;
}

body.v56-chain-log-open {
    overflow: hidden !important;
}

/* 能力画面でキーボード選択中の項目を明示する。 */
#character-ability-overlay .ability-btn.v56-keyboard-selected {
    position: relative;
    outline: 4px solid #ffe06b !important;
    outline-offset: 3px;
    box-shadow:
        0 0 0 2px rgba(0, 0, 0, .82),
        0 0 22px rgba(255, 220, 86, .86) !important;
    transform: translateY(-2px);
}

#character-ability-overlay .ability-btn.v56-keyboard-selected::after {
    content: attr(data-v56-keyboard-label);
    position: absolute;
    top: -11px;
    right: -9px;
    min-width: 20px;
    padding: 3px 5px;
    border: 1px solid #241300;
    border-radius: 999px;
    background: #ffe06b;
    color: #281600;
    font: 700 10px/1 "Courier New", monospace;
}

@media (max-width: 520px) {
    #v56-chain-log-overlay {
        padding: 7px;
    }

    .v56-chain-log-dialog {
        width: 98vw;
        height: 94dvh;
        min-height: 0;
        border-radius: 12px;
    }

    .v56-chain-log-head {
        min-height: 52px;
        padding: 8px 9px 8px 13px;
    }

    #v56-chain-log-close {
        min-width: 76px;
        min-height: 38px;
    }

    #v56-chain-log-scroll {
        padding: 12px 10px 22px;
    }
}
