.deck-card-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
}

.deck-card-modal[hidden] {
    display: none;
}

.deck-card-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
}

.deck-card-modal-dialog {
    position: relative;
    z-index: 1;
    display: flex;
    width: 95vw;
    height: 80vh;
    padding: 0 16px 20px;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
    box-sizing: border-box;
    overflow: hidden;
}

.deck-card-modal-close {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 0;
    background: #c62828;
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.deck-card-modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.deck-card-modal-title {
    margin: 0;
    width: calc(100% + 32px);
    margin: 0 -16px 12px;
    padding: 5px 5px;
    background: #111111;
    color: #ffffff;
    text-align: center;
    box-sizing: border-box;
    border-radius: 0;
}

.deck-card-modal-title-main {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
}

.deck-card-modal-title-sub {
    margin-top: 1px;
    font-size: 0.7rem;
    line-height: 1.1;
    color: rgba(255, 255, 255, 0.8);
}

.deck-card-modal-header {
    display: flex;
    align-items: center;
    justify-content: stretch;
    gap: 0;
    width: calc(100% + 32px);
    margin: 0 -16px;
}

.deck-card-modal-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    gap: 0;
    padding: 0;
    border-radius: 0;
    background: #f1f1f1;
    flex: 1 1 auto;
}

.deck-card-modal-tab {
    min-width: 0;
    min-height: 40px;
    padding: 8px 14px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #444444;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
}

.deck-card-modal-tab.is-active {
    background: #111111;
    color: #ffffff;
}

.deck-card-modal-close:hover {
    background: #b71c1c;
}

.deck-card-modal-close:focus-visible,
.deck-card-modal-tab:focus-visible {
    outline: 2px solid #111111;
    outline-offset: 2px;
}

.deck-card-modal-panel {
    display: none;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
}

.deck-card-modal-panel.is-active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.deck-card-modal-image {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 100%;
    height: auto;
    border-radius: 12px;
    object-fit: contain;
}

.deck-card-modal-text {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    overflow: auto;
    padding: 0;
    border: 1px solid #292929;
    border-radius: 18px;
    background: #050505;
    color: #f3f3f3;
    box-sizing: border-box;
}

.deck-card-modal-recording {
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: auto;
    padding: 0;
    border: 1px solid #292929;
    border-radius: 18px;
    background: #050505;
    color: #f3f3f3;
    box-sizing: border-box;
}

.deck-card-modal-text-empty {
    padding: 18px;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.7;
}

.deck-card-modal-cv-layout {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.deck-card-modal-cv-row {
    display: grid;
    grid-template-columns: minmax(84px, auto) minmax(0, 1fr) minmax(84px, auto);
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #292929;
    background: #101010;
}

.deck-card-modal-cv-row--secondary {
    min-height: 72px;
}

.deck-card-modal-cv-stat-group {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
}

.deck-card-modal-cv-stat-group.is-right {
    justify-content: flex-end;
}

.deck-card-modal-cv-stat {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    color: #f5f5f5;
}

.deck-card-modal-cv-stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: #1a1a1a;
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.68rem;
    font-weight: 600;
}

.deck-card-modal-cv-stat-icon.is-pitch {
    background: linear-gradient(135deg, #3d4f24, #7c9b2f);
}

.deck-card-modal-cv-stat-icon.is-cost {
    background: linear-gradient(135deg, #49311a, #af6b1b);
}

.deck-card-modal-cv-stat-icon.is-intellect {
    background: linear-gradient(135deg, #2b375f, #4b73d1);
}

.deck-card-modal-cv-stat-icon.is-life {
    background: linear-gradient(135deg, #5b1e23, #cb4d57);
}

.deck-card-modal-cv-stat-icon.is-power {
    background: linear-gradient(135deg, #4a2812, #d06d2c);
}

.deck-card-modal-cv-stat-icon.is-defense {
    background: linear-gradient(135deg, #14382b, #2c9c7b);
}

.deck-card-modal-cv-stat-icon.is-quantity {
    background: linear-gradient(135deg, #3a2b4f, #8a62c5);
}

.deck-card-modal-cv-stat-value {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
}

.deck-card-modal-cv-title-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
}

.deck-card-modal-cv-title {
    width: 100%;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    text-wrap: balance;
}

.deck-card-modal-cv-title-sub {
    width: 100%;
    font-size: 0.76rem;
    line-height: 1.25;
    text-align: center;
    color: rgba(255, 255, 255, 0.68);
}

.deck-card-modal-cv-body {
    flex: 1 1 auto;
    padding: 18px 14px;
    border-bottom: 1px solid #292929;
    background: #0d0d0d;
}

.deck-card-modal-cv-text-panel[hidden] {
    display: none;
}

.deck-card-modal-cv-text-paragraph {
    margin: 0;
    color: #f3f3f3;
    font-size: 0.97rem;
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: break-word;
}

.deck-card-modal-cv-text-paragraph + .deck-card-modal-cv-text-paragraph {
    margin-top: 12px;
}

.deck-card-modal-cv-text-paragraph strong {
    font-weight: 800;
}

.deck-card-modal-cv-type-line {
    min-width: 0;
    padding: 0 8px;
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    text-wrap: balance;
    color: #f0f0f0;
}

.deck-card-modal-cv-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 14px;
    background: #070707;
}

.deck-card-modal-cv-meta-item {
    padding: 10px 12px;
    border: 1px solid #292929;
    border-radius: 12px;
    background: #111111;
}

.deck-card-modal-cv-meta-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
}

.deck-card-modal-cv-meta-value {
    margin-top: 4px;
    font-size: 0.93rem;
    line-height: 1.45;
    color: #f5f5f5;
    word-break: break-word;
}

.deck-card-modal-cv-variant-switcher {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid #292929;
    background: #000000;
}

.deck-card-modal-cv-variant-button {
    min-height: 48px;
    padding: 12px;
    border: none;
    background: #111111;
    color: rgba(255, 255, 255, 0.82);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
}

.deck-card-modal-cv-variant-button + .deck-card-modal-cv-variant-button {
    border-left: 1px solid #292929;
}

.deck-card-modal-cv-variant-button.is-active {
    background: #000000;
    color: #ffffff;
}

.deck-card-modal-cv-variant-button:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: -2px;
}

.deck-card-modal-recording-layout {
    min-height: 100%;
    padding: 0 18px;
    background: #0d0d0d;
    box-sizing: border-box;
}

.deck-card-modal-recording-list {
    display: flex;
    flex-direction: column;
}

.deck-card-modal-recording-line {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 2px 3px;
    border-bottom: 1px solid #292929;
}

.deck-card-modal-recording-line-set {
    min-width: 0;
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.1;
    color: #f5f5f5;
    word-break: break-word;
}

.deck-card-modal-recording-line-set-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.18s ease, opacity 0.18s ease;
}

.deck-card-modal-recording-line-set-link:hover,
.deck-card-modal-recording-line-set-link:focus-visible {
    color: #ffd36a;
    text-decoration: underline;
    text-underline-offset: 0.12em;
}

.deck-card-modal-recording-line-meta {
    min-width: 0;
}

.deck-card-modal-recording-line-detail {
    font-size: 0.6rem;
    font-weight: 600;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.78);
    word-break: break-word;
}

@media (max-width: 640px) {
    .deck-card-modal-cv-row {
        grid-template-columns: minmax(56px, auto) minmax(0, 1fr) minmax(56px, auto);
        gap: 8px;
        padding: 10px 12px;
    }

    .deck-card-modal-cv-row--secondary {
        grid-template-columns: minmax(64px, auto) minmax(0, 1fr) minmax(64px, auto);
    }

    .deck-card-modal-cv-stat-group {
        gap: 6px;
        flex-wrap: wrap;
    }

    .deck-card-modal-cv-stat {
        gap: 5px;
    }

    .deck-card-modal-cv-stat-icon {
        width: 24px;
        height: 24px;
        font-size: 0.62rem;
    }

    .deck-card-modal-cv-stat-value {
        font-size: 0.9rem;
    }

    .deck-card-modal-cv-title {
        font-size: 0.95rem;
    }

    .deck-card-modal-cv-title-sub {
        font-size: 0.7rem;
    }

    .deck-card-modal-cv-type-line {
        font-size: 0.88rem;
    }

    .deck-card-modal-cv-meta-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .deck-card-modal-recording-line {
        gap: 2px;
        padding: 10px 2px 3px;
    }
}

body.is-modal-open {
    overflow: hidden;
}