/*
 * 商品説明文のデッキリスト（:::deck ブロック）の見た目。
 * product.html / bundle.html / 管理画面のプレビューで共通に使う。
 * 説明文側の `.product-description img { display:block }` 等に負けないよう、
 * 画像のルールは必ずクラス2つ以上で書く。
 */

/* ── クリックして開くバー ───────────────────────────── */
.deck-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
    width: 100%;
    margin: 18px 0;
    padding: 8px 14px 8px 8px;
    background: linear-gradient(180deg, #2b2413 0%, #16141b 60%, #101017 100%);
    border: 1px solid rgba(212, 175, 55, .5);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
    color: #fff;
    font: inherit;
    line-height: 1.4;
    text-align: left;
    white-space: normal;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}

.deck-bar:hover,
.deck-bar:focus-visible {
    border-color: #d4af37;
    box-shadow: 0 0 0 1px rgba(212, 175, 55, .35), 0 8px 20px rgba(0, 0, 0, .45);
    transform: translateY(-1px);
    outline: none;
}

.deck-bar-thumb {
    flex: 0 0 auto;
    width: 46px;
    aspect-ratio: 63 / 88;
    border-radius: 5px;
    background: #000;
    overflow: hidden;
}

.deck-bar .deck-bar-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    border: none;
    border-radius: 0;
    object-fit: cover;
}

.deck-bar-text {
    flex: 1 1 auto;
    min-width: 0;
}

.deck-bar-title {
    display: block;
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}

.deck-bar-sub {
    display: block;
    margin-top: 2px;
    font-size: .78rem;
    font-weight: 600;
    color: rgba(212, 175, 55, .95);
}

.deck-bar-arrow {
    flex: 0 0 auto;
    color: #d4af37;
    font-size: .9rem;
}

@media (max-width: 480px) {
    .deck-bar-title { font-size: .92rem; }
    .deck-bar-thumb { width: 40px; }
}

/* ── モーダル ───────────────────────────────────────── */
.deck-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, .8);
    overflow-y: auto;
    overscroll-behavior: contain;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}

.deck-modal-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.deck-modal {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    max-width: 620px;
    margin: auto;
    padding: 22px 18px 26px;
    background: #12141b;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 16px;
    color: #e7e8ee;
    font-size: .95rem;
    line-height: 1.7;
    white-space: normal;
    text-align: left;
    transform: translateY(12px) scale(.97);
    transition: transform .2s;
}

.deck-modal-overlay.is-open .deck-modal {
    transform: translateY(0) scale(1);
}

.deck-modal-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: #a3a7b5;
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
}

.deck-modal-close:hover {
    color: #fff;
}

.deck-modal-title {
    margin: 0 32px 16px 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: #fff;
}

/* 収録カードの上に出る説明文（**太字**・画像・リンクが使える） */
.deck-modal-intro {
    margin: 0 0 18px;
    color: rgba(255, 255, 255, .88);
    font-size: .93rem;
    line-height: 1.8;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

/* モーダル内と管理画面のプレビューで同じ見た目にするため、.deck-modal で縛らない */
.deck-modal-intro strong {
    color: #fff;
    font-weight: 800;
}

.deck-modal-intro a {
    color: #d4af37;
    text-decoration: underline;
}

/* 説明文の画像はカード1枚が読める程度の大きさに抑える（横2枚並べても収まる幅） */
.deck-modal-intro img {
    display: block;
    width: 100%;
    max-width: 280px;
    height: auto;
    margin: 12px auto;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 8px;
}

/* 続けて置かれた画像は横2枚ずつ並べる（3枚目からは次の行に折り返す） */
.deck-modal-intro .deck-intro-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: start;
    max-width: 580px;
    margin: 12px auto;
}

.deck-modal-intro .deck-intro-row img {
    max-width: 100%;
    margin: 0;
}

.deck-modal-hero {
    text-align: center;
}

.deck-modal .deck-modal-hero img {
    display: inline-block;
    width: 100%;
    max-width: 260px;
    height: auto;
    margin: 0 0 20px;
    border: none;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .55);
}

.deck-modal-panel {
    border: 1px solid rgba(212, 175, 55, .55);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, .02);
}

.deck-modal-panel-head {
    padding: 8px 14px;
    background: linear-gradient(180deg, #d9b845 0%, #b3901f 100%);
    color: #fff;
    font-weight: 800;
    font-size: .95rem;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

.deck-modal-body {
    padding: 14px 16px;
}

.deck-modal-note {
    margin-bottom: 10px;
    color: #a3a7b5;
    font-size: .82rem;
}

.deck-modal-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.deck-modal-list li {
    display: flex;
    gap: 12px;
    align-items: baseline;
    padding: 5px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, .07);
}

.deck-modal-list li:last-child {
    border-bottom: none;
}

.deck-modal-count {
    flex: 0 0 3.4em;
    color: #d4af37;
    font-weight: 800;
    font-size: .9rem;
}

.deck-modal-name {
    flex: 1 1 auto;
    font-weight: 600;
    color: #fff;
}

.deck-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.deck-modal-grid:empty {
    display: none;
}

@media (min-width: 520px) {
    .deck-modal-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.deck-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .45);
}

.deck-modal .deck-card img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 63 / 88;
    margin: 0;
    border: none;
    border-radius: 0;
    object-fit: contain;
}

.deck-card-count {
    position: absolute;
    right: 5px;
    bottom: 5px;
    padding: 1px 7px;
    background: rgba(0, 0, 0, .78);
    border: 1px solid rgba(212, 175, 55, .6);
    border-radius: 999px;
    color: #d4af37;
    font-size: .72rem;
    font-weight: 800;
    line-height: 1.5;
}
