.chart-summary { font-size: 13px; line-height: 1.8; }
.chart-commander-toggle { font-size: 12px; }
.chart-note { color: #b9afcd; font-size: 11px; line-height: 1.7; }
.chart-subtitle { font-size: 14px; margin: 20px 0 12px; }
.mana-curve { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; margin-top: 15px; }
.mana-curve-column { text-align: center; font-size: 11px; }
.mana-curve-track { height: 110px; display: flex; align-items: flex-end; border-bottom: 1px solid #645578; margin: 6px 0; }
.mana-curve-track > div { width: 100%; background: #9470ee; border-radius: 4px 4px 0 0; }
.mana-color-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 96px; align-items: center; gap: 7px; font-size: 11px; margin: 9px 0; }
.mana-color-row > span:last-child { text-align: right; }
.mana-color-track { height: 12px; background: #302645; border-radius: 3px; overflow: hidden; }
.mana-color-track > div { height: 100%; }
.mana-color-W { background: #eee5b3; }
.mana-color-U { background: #57a5df; }
.mana-color-B { background: #a797b3; }
.mana-color-R { background: #e87c69; }
.mana-color-G { background: #73bf89; }
.mana-color-C { background: #c0c4cc; }

.search-pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 14px; margin-bottom: 16px; }
.search-pagination[hidden] { display: none; }
.search-pagination button { padding: 9px 14px; cursor: pointer; }
.search-pagination button:disabled { opacity: .45; cursor: default; }
.search-filters {
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
    padding: 16px;
    border: 1px solid #493c66;
    border-radius: 10px;
    background: #17132b;
}
.search-filters summary,
.deck-transfer summary { cursor: pointer; font-weight: bold; }
.search-filters p { font-size: 12px; line-height: 1.7; color: #c3b8d5; }
.search-filters fieldset { margin: 12px 0; padding: 10px; border: 1px solid #493c66; }
.search-filters fieldset label { display: inline-flex; gap: 5px; margin: 6px 12px 6px 0; }
.search-filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.search-filter-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.search-filter-grid input, .search-filter-grid select {
    box-sizing: border-box; width: 100%; min-width: 0; padding: 9px;
    background: #211a39; color: #eeeeff; border: 1px solid #493c66; border-radius: 6px;
}
.search-filter-check { display: block; margin-top: 10px; font-size: 13px; }
.search-filters button { padding: 9px 14px; cursor: pointer; }
.search-title { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
#openSearchFilters { width: auto; flex-shrink: 0; margin-left: 8px; padding: 7px 12px; font-size: 13px; white-space: nowrap; border: 1px solid #71569a; border-radius: 6px; background: #211a39; color: #eeeeff; cursor: pointer; }
dialog.search-filters-dialog { position: fixed; inset: 0; margin: auto; box-sizing: border-box; width: min(700px, 92vw); max-height: 85dvh; overflow: auto; padding: 20px; border: 1px solid #71569a; border-radius: 12px; background: #191426; color: #eeeeff; }
.search-filters-dialog::backdrop { background: #000b; }
.filter-dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.filter-dialog-heading h2 { margin: 0; font-size: 18px; }
.search-filters #searchFiltersError { color: #ffb6b6; }

.deck-name-editor { display: flex; flex-wrap: wrap; gap: 8px; margin: 5px 0 20px; }
.deck-name-editor input {
    flex: 1 1 180px; min-width: 0; padding: 9px 12px; font: inherit;
    background: #211a39; color: #eeeeff; border: 1px solid #8b7cff; border-radius: 6px;
}
.deck-name-editor button { padding: 8px 12px; cursor: pointer; }
.deck-name-error { flex-basis: 100%; color: #ff8c8c; margin: 0; font-size: 13px; }
.deck-name-error:empty { display: none; }

.deck-transfer {
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #493c66;
    border-radius: 10px;
}
.deck-transfer label { display: block; margin: 14px 0 6px; }
.deck-transfer p { line-height: 1.7; overflow-wrap: anywhere; }
.deck-transfer input, .deck-transfer textarea, .deck-transfer select {
    width: 100%; box-sizing: border-box; padding: 10px;
    background: #211a39; color: #eeeeff; border: 1px solid #493c66; border-radius: 6px;
}
.deck-transfer textarea { resize: vertical; }
#transferStatus { white-space: pre-line; }
.deck-transfer button { padding: 10px 14px; cursor: pointer; }
.deck-transfer button:disabled { opacity: .6; cursor: wait; }
.transfer-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }

/* ========================================
   全体
======================================== */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family:
        "Segoe UI",
        "Yu Gothic",
        "Meiryo",
        sans-serif;

    background:
        linear-gradient(
            135deg,
            #0d0b1d 0%,
            #15112d 50%,
            #0b0918 100%
        );

    color: #eeeeff;

    min-width: 1200px;
}


/* ========================================
   ヘッダー
======================================== */

.top-header {
    height: 70px;

    display: flex;
    align-items: center;

    padding: 0 30px;

    background: rgba(10, 7, 25, 0.95);

    border-bottom: 1px solid #30255a;

    position: sticky;
    top: 0;

    z-index: 100;
}

.site-legal-link { margin-left: auto; padding-left: 16px; flex-shrink: 0; color: #cbb7ff; font-size: 11px; line-height: 1.5; text-align: right; text-decoration: none; }
.site-legal-link span { display: block; text-decoration: underline; }
.site-legal-link:focus-visible { outline: 2px solid #cbb7ff; outline-offset: 3px; }
.legal-page { max-width: 850px; margin: 28px auto; padding: 0 20px 40px; line-height: 1.9; overflow-wrap: anywhere; }
.legal-page h1 { font-size: 24px; }
.legal-page h2 { font-size: 18px; margin-top: 28px; }
.legal-page a { color: #cbb7ff; text-decoration: underline; }
@media (max-width: 800px) {
    .top-header:has(.site-legal-link) { padding: 0 10px; gap: 10px; }
    .top-header:has(.site-legal-link) .logo { font-size: 14px; margin-right: 0; white-space: normal; }
    .top-header:has(.site-legal-link) .main-nav { gap: 10px; min-width: 0; overflow-x: auto; }
    .site-legal-link { padding-left: 0; font-size: 10px; }
}


.logo {
    font-size: 22px;
    font-weight: bold;

    color: #cbb7ff;

    white-space: nowrap;

    margin-right: 50px;
}


.main-nav {
    display: flex;
    gap: 28px;

    height: 100%;

    align-items: center;
}


.main-nav .nav-item {
    color: #b8a7df;

    font-size: 14px;
    line-height: 1.5;
    font-weight: normal;
    text-decoration: none;
    white-space: nowrap;

    cursor: pointer;

    transition: 0.2s;
}


.main-nav .nav-item:hover {
    color: #ffffff;
}


/* ========================================
   メインレイアウト
======================================== */

.main-container {
    width: 100%;

    max-width: 1900px;

    margin: 0 auto;

    padding: 20px;

    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        350px;

    gap: 20px;
}


.main-content {
    min-width: 0;
}


/* ========================================
   パネル共通
======================================== */

.panel {
    background:
        rgba(18, 14, 40, 0.92);

    border: 1px solid #30255a;

    border-radius: 12px;

    margin-bottom: 20px;

    box-shadow:
        0 8px 30px rgba(0, 0, 0, 0.25);
}


.panel-header {
    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 18px 20px;

    border-bottom: 1px solid #2a214b;
}


.panel-header h2 {
    margin: 0;

    font-size: 18px;
}


.panel-subtitle {
    margin: 5px 0 0;

    color: #82799d;

    font-size: 12px;
}


.panel-title {
    padding: 16px 18px;

    font-size: 16px;

    font-weight: bold;

    border-bottom: 1px solid #2a214b;

    color: #ddd2ff;
}


/* ========================================
   検索エリア
======================================== */

.search-area {
    position: sticky;
    top: 70px;
    z-index: 90;
    padding: 12px 0;
    background: #100d20;
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-wrap: wrap;

    align-items: center;

    gap: 20px;

    margin-bottom: 15px;
}


.search-title h2 {
    margin: 0;

    font-size: 20px;

    white-space: nowrap;
}


.search-box {
    flex: 1;
    min-width: 0;

    display: flex;

    height: 46px;
}


.search-box input {
    flex: 1;
    min-width: 0;

    border: 1px solid #493c78;

    border-right: none;

    border-radius: 8px 0 0 8px;

    background: #17132d;

    color: white;

    padding: 0 15px;

    font-size: 14px;

    outline: none;
}


.search-box input:focus {
    border-color: #8d55ff;

    box-shadow:
        0 0 0 2px rgba(141, 85, 255, 0.15);
}


.search-box button {
    width: 60px;

    border: none;

    border-radius: 0 8px 8px 0;

    background: #7437e8;

    color: white;

    font-size: 20px;

    cursor: pointer;

    transition: 0.2s;
}


.search-box button:hover {
    background: #8b52ff;
}


#searchMessage {
    flex: 0 0 100%;
    margin: 0;
    overflow-wrap: anywhere;

    color: #ff8c8c;

    font-size: 13px;
}

#searchMessage:empty { display: none; }


/* ========================================
   ツールバー
======================================== */

.toolbar {
    display: flex;

    align-items: center;

    justify-content: space-between;

    margin-bottom: 15px;

    padding: 10px;

    background: rgba(20, 16, 43, 0.8);

    border: 1px solid #30255a;

    border-radius: 10px;
}


.view-buttons {
    display: flex;

    gap: 5px;
}


.view-button {
    padding: 8px 14px;

    border-radius: 6px;

    border: 1px solid #40336c;

    background: #18142e;

    color: #aaa0c4;

    cursor: pointer;
}


.view-button.active {
    background: #7139df;

    color: white;

    border-color: #8b55ff;
}


.toolbar-options {
    display: flex;

    gap: 15px;
}


.toolbar-options label {
    color: #9d91b9;

    font-size: 13px;
}


.toolbar-options select {
    margin-left: 5px;

    padding: 7px 10px;

    background: #18142e;

    color: white;

    border: 1px solid #40336c;

    border-radius: 6px;
}


/* ========================================
   検索結果
======================================== */

.search-result-panel {
    padding: 15px;
}


.card-result-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(150px, 1fr)
        );

    gap: 14px;
}


.card-result {
    background: #100d20;

    border: 1px solid #30255a;

    border-radius: 9px;

    padding: 8px;

    cursor: pointer;

    transition: 0.2s;
}


.card-result:hover {
    transform: translateY(-4px);

    border-color: #8b55ff;

    box-shadow:
        0 8px 20px rgba(100, 50, 200, 0.25);
}


.card-result img {
    width: 100%;

    display: block;

    border-radius: 7px;
}


.card-result-info {
    padding: 7px 3px 3px;
}


.card-result-info h3 {
    margin: 0 0 5px;

    font-size: 13px;

    color: #ffffff;
}


.card-result-info p {
    margin: 2px 0;

    color: #9489aa;

    font-size: 11px;
}


/* ========================================
   検索結果
   カード追加ボタン
======================================== */

.search-add-button {
    width: 100%;

    margin-top: 10px;

    padding: 8px 10px;

    border: none;

    border-radius: 6px;

    background: #6c3ce9;

    color: white;

    font-size: 14px;

    cursor: pointer;

    transition: 0.2s;
}


.search-add-button:hover {
    background: #8b52ff;
}


.search-add-button:active {
    transform: scale(0.98);
}


/* ========================================
   デッキ枚数
======================================== */

.deck-counter {
    font-size: 20px;

    font-weight: bold;

    color: #ffffff;
}


.deck-counter span:last-child {
    color: #81779a;

    font-size: 14px;
}


/* ========================================
   ルール状態
======================================== */







/*
   重要：
   デッキリスト自体は縦方向にする。
   
   クリーチャー
   ↓
   インスタント
   ↓
   ソーサリー
   ↓
   アーティファクト
   ↓
   エンチャント
   ↓
   土地
*/

#deckList {

    display: block;

    width: 100%;

    padding: 15px;

}


/*
   それぞれの種類を1つの箱にする。
   種類同士は必ず縦に並ぶ。
*/

.deck-category-section {

    display: block;

    width: 100%;

    margin: 0 0 30px 0;

}


/* ========================================
   デッキ種類タイトル
======================================== */

.deck-category-title {

    display: block;

    width: 100%;

    margin: 0 0 10px 0;

    padding: 8px 5px;

    font-size: 15px;

    font-weight: bold;

    color: #eeeeff;

    border-bottom: 1px solid #30255a;

}


/*
   ここだけGrid。

   同じ種類のカードだけ横並びになる。
*/

.deck-card-grid {

    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(90px, 1fr)
        );

    gap: 7px;

    width: 100%;

}


/* ========================================
   デッキカード1枚
======================================== */

.deck-grid-card {

    width: 100%;

    min-width: 0;

    cursor: pointer;

    transition:
        transform 0.15s ease;

}


/* ========================================
   デッキカード画像
======================================== */

.deck-grid-card-image {

    display: block;

    width: 100%;

    height: auto;

    aspect-ratio: 0.716;

    object-fit: cover;

    border-radius: 5px;

}


/* ========================================
   カードにマウスを乗せたとき
======================================== */

.deck-grid-card:hover {

    transform: scale(1.05);

    position: relative;

    z-index: 2;

}


/*
   以前の表示方式で使用していたクラス。
   他の処理との互換性のため残している。
*/

.deck-item {

    position: relative;

    width: 100%;

    min-width: 0;

    background: #0e0b1d;

    border: 1px solid #2d2450;

    border-radius: 9px;

    padding: 8px;

    transition: 0.2s;

    overflow: hidden;
}


.deck-item:hover {

    transform: translateY(-4px);

    border-color: #8150ef;

    box-shadow:
        0 8px 20px rgba(100, 50, 200, 0.25);

}


.deck-card-image {

    width: 100%;

    max-width: 100%;

    height: auto;

    display: block;

    border-radius: 7px;

    object-fit: contain;
}


.deck-card-info {

    display: flex;

    flex-direction: column;

    align-items: stretch;

    width: 100%;

    min-width: 0;

    gap: 8px;

    padding-top: 10px;
}


.deck-card-name {

    display: block;

    width: 100%;

    min-width: 0;

    font-size: 13px;

    color: #eeeeee;

    line-height: 1.4;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}


/* ========================================
   デッキカードのボタンエリア
======================================== */

.deck-card-buttons {

    display: flex;

    align-items: center;

    width: 100%;

    gap: 6px;
}


.deck-card-buttons button {

    flex: 1;

    min-width: 0;

    padding: 6px 8px;

    border: none;

    border-radius: 6px;

    font-size: 10px;

    cursor: pointer;

    white-space: nowrap;

    transition: 0.2s;
}


/* ========================================
   イラスト変更ボタン
======================================== */

.art-change-button {

    background: #6c3ce9;

    color: white;
}


.art-change-button:hover {

    background: #8155f0;

}


/* ========================================
   削除ボタン
======================================== */

.deck-remove-button {

    background: #302840;

    border: 1px solid #4a3c5f !important;

    color: #cfc5df;
}


.deck-remove-button:hover {

    background: #543b70;

    color: white;

}


/* ========================================
   デッキ操作
======================================== */

.deck-actions {

    display: flex;

    gap: 10px;

    padding: 0 15px 15px;

}


.primary-button,
.secondary-button {

    border: none;

    border-radius: 7px;

    padding: 10px 18px;

    cursor: pointer;

    font-size: 13px;

    transition: 0.2s;

}


.primary-button {

    background: #7139df;

    color: white;

}


.primary-button:hover {

    background: #8b52ff;

}


.secondary-button {

    background: #201a38;

    color: #b8accd;

    border: 1px solid #3a2e5e;

}


.secondary-button:hover {

    background: #2d2450;

    color: white;

}


/* ========================================
   統率者
======================================== */

.commander-panel {

    overflow: hidden;

}


.commander-card {

    display: flex;

    gap: 15px;

    padding: 15px;

}


.commander-card img {

    width: 130px;

    height: auto;

    align-self: flex-start;

    border-radius: 8px;

    box-shadow:
        0 5px 15px rgba(0, 0, 0, 0.4);

}


.commander-card h3 {

    margin: 0 0 15px;

    font-size: 15px;

}


.commander-card button {

    background: #2b2149;

    border: 1px solid #49366f;

    color: #cfc2eb;

    border-radius: 6px;

    padding: 8px;

    cursor: pointer;

    font-size: 11px;

}


.commander-card button:hover {

    background: #6935c5;

    color: white;

}


.commander-empty {

    padding: 30px 15px;

    text-align: center;

    color: #817792;

    font-size: 13px;

}


/* ========================================
   空表示
======================================== */

.empty-message {

    text-align: center;

    padding: 45px 20px;

    color: #77708b;

}


.empty-icon {

    font-size: 35px;

    margin-bottom: 10px;

}


.empty-message p {

    margin: 0;

}


/* ========================================
   デッキ分析
======================================== */

.analysis-panel {

    overflow: hidden;

}


.analysis-buttons {

    padding: 15px;

}


.analysis-buttons button {

    width: 100%;

}


.analysis-empty {

    color: #77708b;

    font-size: 12px;

    line-height: 1.7;

    text-align: center;

    padding: 10px 15px 20px;

    margin: 0;

}


.analysis-summary {

    padding: 15px;

    margin: 0 15px 15px;

    background: #17132b;

    border-radius: 8px;

}


.analysis-types {

    display: grid;

    grid-template-columns:
        repeat(2, 1fr);

    gap: 7px;

    padding: 0 15px 15px;

}


.analysis-types p {

    margin: 0;

    padding: 8px;

    background: #211a39;

    border-radius: 6px;

    font-size: 11px;

}


.analysis-messages {

    margin: 0 15px 15px;

    padding: 12px;

    background: #17132b;

    border-radius: 8px;

}


.analysis-messages p {

    margin: 6px 0;

    font-size: 12px;

}


/* ========================================
   デッキ構成
======================================== */

#deckStructure {

    padding: 8px 15px 12px;

}


.structure-row {

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 8px 3px;

    border-bottom: 1px solid #251d41;

    font-size: 12px;

    color: #aaa1bc;

}


.structure-row:last-child {

    border-bottom: none;

}


.structure-row strong {

    color: #eeeeff;

    font-size: 13px;

}


/* ========================================
   ルールチェック
======================================== */
















/* ========================================
   AI分析
======================================== */

.ai-loading {

    padding: 20px;

    text-align: center;

    background: #17132b;

    border-radius: 8px;

    margin: 0 15px 15px;

}


.ai-result {

    margin: 0 15px 15px;

    padding: 15px;

    background: #17132b;

    border-radius: 8px;

    line-height: 1.8;

    font-size: 13px;

}


/* ========================================
   カード詳細
======================================== */

.card-detail {

    display: flex;

    align-items: flex-start;

    gap: 30px;

    padding: 20px;

}


.card-detail .card-image {

    width: 200px;

    height: 280px;
    object-fit: contain;

    flex-shrink: 0;

    border-radius: 10px;

}


.card-detail .card-info {

    flex: 1;

    min-width: 0;
    overflow-wrap: anywhere;

}


.card-detail .card-info h2 {

    margin-top: 0;

    margin-bottom: 20px;

    font-size: 26px;

}


.card-detail .card-info p {

    margin: 12px 0;

    line-height: 1.7;

}


.card-detail .oracle-text {

    line-height: 1.8;

    margin-top: 20px;
    height: 180px;
    min-height: 180px;
    max-height: 180px;
    overflow-y: auto;
    overflow-x: hidden;
    overflow-wrap: anywhere;
    scrollbar-gutter: stable;
    box-sizing: border-box;

}


.card-detail .commander-button {

    margin-top: 10px;

    margin-right: 10px;

    padding: 9px 14px;

    border: none;

    border-radius: 7px;

    background: #7139df;

    color: white;

    cursor: pointer;

    font-size: 12px;

    transition: 0.2s;

}


.card-detail .commander-button:hover {

    background: #8b52ff;

}


/* ========================================
   スクロールバー
======================================== */

::-webkit-scrollbar {

    width: 8px;

    height: 8px;

}


::-webkit-scrollbar-track {

    background: #0c0918;

}


::-webkit-scrollbar-thumb {

    background: #38285d;

    border-radius: 10px;

}


::-webkit-scrollbar-thumb:hover {

    background: #6240a0;

}


/* ========================================
   横幅が広い画面
======================================== */

@media (min-width: 1600px) {

    .main-container {

        grid-template-columns:
            minmax(0, 1fr)
            380px;

        padding: 25px;

    }


    /*
       #deckList のGrid設定はしない。
       デッキ種類は常に縦並びにする。
    */

    .deck-card-grid {

        grid-template-columns:
            repeat(
                auto-fill,
                minmax(90px, 1fr)
            );

    }

}


/* ========================================
   画面が狭い場合
======================================== */

@media (max-width: 1200px) {

    body {

        min-width: 1000px;

    }


    .main-container {

        grid-template-columns:
            minmax(0, 1fr)
            300px;

    }


    /*
       デッキリスト自体は縦並び。
       カードだけ横並び。
    */

    #deckList {

        display: block;

    }


    .deck-card-grid {

        grid-template-columns:
            repeat(
                auto-fill,
                minmax(80px, 1fr)
            );

    }

}


/* ========================================
   スマートフォン・狭い画面
======================================== */

@media (max-width: 700px) {

    body {

        min-width: 0;

    }


    .main-container {

        display: block;

        padding: 10px;

    }


    .card-detail {

        flex-direction: column;

    }


    .card-detail .card-image {

        width: 220px;
        height: 308px;
        max-width: 100%;

    }


    /* --------------------------------
       デッキリスト
    -------------------------------- */

    #deckList {

        display: block;

        width: 100%;

        padding: 10px;

    }


    /* --------------------------------
       種類ごとのカード
    -------------------------------- */

    .deck-card-grid {

        grid-template-columns:
            repeat(
                4,
                minmax(0, 1fr)
            );

        gap: 5px;

    }


    /* --------------------------------
       種類タイトル
    -------------------------------- */

    .deck-category-title {

        font-size: 13px;

        padding: 7px 3px;

    }


    /* --------------------------------
       種類間の余白
    -------------------------------- */

    .deck-category-section {

        margin-bottom: 20px;

    }


    /* --------------------------------
       旧デッキカード
    -------------------------------- */

    .deck-card-name {

        font-size: 12px;

    }


    .deck-card-buttons {

        flex-direction: column;

    }


    .deck-card-buttons button {

        width: 100%;

    }

}


/* ========================================
   イラスト選択モーダル
======================================== */

.illustration-modal {

    position: fixed;

    top: 0;

    left: 0;

    width: 100%;

    height: 100%;

    background: rgba(0, 0, 0, 0.75);

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 30px;

    z-index: 1000;

}


/* ========================================
   モーダルヘッダー
======================================== */

.illustration-modal-header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    border-bottom: 1px solid #30255a;

    padding-bottom: 15px;

    margin-bottom: 10px;

}


.illustration-modal-header h2 {

    margin: 0;

    color: #eeeeff;

    font-size: 20px;

}


/* ========================================
   イラスト一覧
======================================== */

.illustration-grid {

    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(150px, 1fr)
        );

    gap: 15px;

}


/* ========================================
   日本語イラスト選択画面
======================================== */

.illustration-modal-overlay {

    position: fixed;

    inset: 0;

    z-index: 1000;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 20px;

    background: rgba(5, 3, 15, 0.85);

    backdrop-filter: blur(5px);

    box-sizing: border-box;

}


.illustration-modal {

    width: 95%;

    max-width: 1000px;

    height: 90vh;

    max-height: 850px;

    display: flex;

    flex-direction: column;

    background: #15112d;

    border: 1px solid #493c78;

    border-radius: 14px;

    box-shadow:
        0 20px 70px rgba(0, 0, 0, 0.55);

    overflow: hidden;

}


.illustration-modal-header {

    flex-shrink: 0;

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 15px 20px;

    border-bottom: 1px solid #30255a;

}


.illustration-modal-header h2 {

    margin: 0;

    font-size: 18px;

    color: #eeeaff;

}


.illustration-modal-close {

    width: 36px;

    height: 36px;

    border: none;

    border-radius: 8px;

    background: #2a2147;

    color: white;

    font-size: 24px;

    line-height: 1;

    cursor: pointer;

}


.illustration-modal-close:hover {

    background: #7139df;

}


.illustration-modal-subtitle {

    flex-shrink: 0;

    margin: 0;

    padding: 8px 20px;

    color: #9d91b9;

    font-size: 12px;

}


/* ========================================
   イラスト一覧
======================================== */

.illustration-grid {

    flex: 1;

    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(150px, 1fr)
        );

    gap: 14px;

    padding: 16px 20px 20px;

    overflow-y: auto;

    align-content: start;

    box-sizing: border-box;

}


/* ========================================
   イラスト1枚
======================================== */

.illustration-option {

    min-width: 0;

    background: #0e0b1d;

    border: 2px solid #2d2450;

    border-radius: 10px;

    padding: 7px;

    cursor: pointer;

    transition: 0.2s;

    box-sizing: border-box;

}


.illustration-option:hover {

    border-color: #8150ef;

    transform: translateY(-2px);

}


.illustration-option.selected {

    border-color: #9b6cff;

    box-shadow:
        0 0 0 2px rgba(155, 108, 255, 0.2),
        0 8px 25px rgba(100, 50, 200, 0.25);

}


/* ========================================
   カード画像
======================================== */

.illustration-option img {

    width: 100%;

    height: auto;

    display: block;

    border-radius: 6px;

    object-fit: contain;

}


/* ========================================
   カード情報
======================================== */

.illustration-option-info {

    display: flex;

    flex-direction: column;

    gap: 3px;

    padding: 7px 2px 2px;

    min-width: 0;

}


.illustration-option-info strong {

    color: #ffffff;

    font-size: 11px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;

}


.illustration-option-info span {

    color: #9489aa;

    font-size: 9px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;

}


.illustration-option-info small {

    color: #756a8c;

    font-size: 9px;

}


/* ========================================
   選択ボタン
======================================== */

.illustration-select-button {

    width: 100%;

    margin-top: 5px;

    padding: 7px 4px;

    border: none;

    border-radius: 6px;

    background: #6c3ce9;

    color: white;

    font-size: 10px;

    cursor: pointer;

    box-sizing: border-box;

}


.illustration-select-button:hover {

    background: #8b52ff;

}


/* ========================================
   スクロールバー
======================================== */

.illustration-grid::-webkit-scrollbar {

    width: 8px;

}


.illustration-grid::-webkit-scrollbar-track {

    background: #0e0b1d;

}


.illustration-grid::-webkit-scrollbar-thumb {

    background: #493c78;

    border-radius: 4px;

}


.illustration-grid::-webkit-scrollbar-thumb:hover {

    background: #6c3ce9;

}


/* ========================================
   画面が小さい場合
======================================== */

@media (max-width: 700px) {

    .illustration-modal {

        width: 98%;

        height: 92vh;

    }


    .illustration-grid {

        grid-template-columns:
            repeat(
                auto-fill,
                minmax(120px, 1fr)
            );

        gap: 10px;

        padding: 12px;

    }


    .illustration-modal-header h2 {

        font-size: 15px;

    }

}

/* ========================================
   デッキ種類セクション
======================================== */

.deck-category-section {
    display: block;

    width: 100%;

    margin-bottom: 25px;
}


/* ========================================
   デッキ種類タイトル
======================================== */

.deck-category-title {
    display: block;

    width: 100%;

    margin: 20px 0 10px;

    padding: 0 5px;

    font-size: 16px;

    font-weight: bold;

    color: #eeeeff;
}


/* ========================================
   種類ごとのカードグリッド
======================================== */

.deck-category-section .deck-card-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(110px, 1fr)
        );

    gap: 8px;

    width: 100%;
}


/* ========================================
   デッキカード
======================================== */

.deck-category-section .deck-grid-card {
    width: 100%;

    min-width: 0;

    cursor: pointer;

    transition:
        transform 0.15s ease;
}


/* ========================================
   カード画像
======================================== */

.deck-category-section .deck-grid-card-image {
    width: 100%;

    height: auto;

    aspect-ratio: 0.716;

    object-fit: cover;

    display: block;

    border-radius: 5px;
}


/* ========================================
   ホバー
======================================== */

.deck-category-section .deck-grid-card:hover {
    transform: scale(1.05);

    position: relative;

    z-index: 2;
}

/* ========================================
   デッキカテゴリー
======================================== */

.deck-category-section {
    display: block;
    width: 100%;
    margin-bottom: 30px;
}


/* ========================================
   カテゴリータイトル
======================================== */

.deck-category-title {
    display: block;
    width: 100%;

    margin: 20px 0 10px;
    padding: 0 5px;

    font-size: 16px;
    font-weight: bold;

    color: #eeeeff;
}


/* ========================================
   カテゴリー内カードグリッド
======================================== */

.deck-category-section .deck-card-grid {
    display: grid;

    /*
       以前よりカードを少し大きくする
       → 1行に表示される枚数が少なくなる
    */
    grid-template-columns:
        repeat(
            auto-fill,
            minmax(130px, 130px)
        );

    gap: 12px;

    width: 100%;
}


/* ========================================
   カード1枚
======================================== */

.deck-category-section .deck-grid-card {

    width: 130px;

    min-width: 130px;

    box-sizing: border-box;

    cursor: pointer;

    transition:
        transform 0.15s ease;
}


/* ========================================
   カード画像
======================================== */

.deck-category-section .deck-grid-card-image {

    width: 130px;

    height: auto;

    aspect-ratio: 0.716;

    object-fit: cover;

    display: block;

    border-radius: 5px;
}


/* ========================================
   カード情報
======================================== */

.deck-grid-card-info {

    width: 130px;

    box-sizing: border-box;

    padding-top: 5px;
}


/* ========================================
   カード名
======================================== */

.deck-grid-card-name {

    width: 100%;

    font-size: 11px;

    line-height: 1.3;

    margin-bottom: 5px;

    /*
       長いカード名でも
       カードの幅を変えない
    */
    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;
}


/* ========================================
   ボタン部分
======================================== */

.deck-grid-card-buttons {

    display: flex;

    flex-direction: row;

    flex-wrap: nowrap;

    gap: 4px;

    width: 100%;
}


/* ========================================
   イラスト変更ボタン
======================================== */

.deck-grid-card-buttons .art-change-button {

    flex: 1 1 0;

    width: 50%;

    min-width: 0;

    box-sizing: border-box;

    padding: 5px 2px;

    font-size: 9px;

    white-space: nowrap;

    cursor: pointer;
}


/* ========================================
   削除ボタン
======================================== */

.deck-grid-card-buttons .deck-remove-button {

    flex: 1 1 0;

    width: 50%;

    min-width: 0;

    box-sizing: border-box;

    padding: 5px 2px;

    font-size: 9px;

    white-space: nowrap;

    cursor: pointer;
}


/* ========================================
   ホバー
======================================== */

.deck-category-section .deck-grid-card:hover {

    transform: scale(1.05);

    position: relative;

    z-index: 2;
}

/* ========================================
   複数デッキ管理
======================================== */

.deck-manager-panel {
    margin-bottom: 20px;
}


/* デッキ一覧 */

#deckManagerList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 15px;
}


/* デッキカード */

.deck-manager-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 15px;
    box-sizing: border-box;
}


/* 現在開いているデッキ */

.deck-manager-card.current {
    border: 2px solid #8b7cff;
}


/* デッキ名 */

.deck-manager-name {
    font-size: 17px;
    font-weight: bold;
    margin-bottom: 10px;
}


/* デッキ情報 */

.deck-manager-info {
    font-size: 13px;
    color: #aaa;
    margin-bottom: 12px;
    line-height: 1.6;
}


/* ボタン */

.deck-manager-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}


.deck-manager-buttons button {
    flex: 1;
    min-width: 70px;
    padding: 7px 8px;
    font-size: 12px;
    cursor: pointer;
}


/* 空の場合 */

.deck-manager-empty {
    padding: 20px;
    text-align: center;
    color: #999;
}

/* ========================================
   デッキ管理ページ
======================================== */

.deck-page-container {

    width: 100%;

    max-width: 1900px;

    margin: 0 auto;

    padding: 20px;

    box-sizing: border-box;

}


/* デッキページの一覧 */

.deck-page-container
#deckManagerList {

    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(280px, 1fr)
        );

    gap: 20px;

}


/* デッキカード */

.deck-manager-card {

    background:
        rgba(255, 255, 255, 0.05);

    border:
        1px solid
        rgba(255, 255, 255, 0.12);

    border-radius: 12px;

    padding: 20px;

    box-sizing: border-box;

    transition:
        transform 0.2s,
        border-color 0.2s;

}


.deck-manager-card:hover {

    transform:
        translateY(-3px);

    border-color:
        rgba(139, 124, 255, 0.6);

}


/* 現在選択中のデッキ */

.deck-manager-card.current {

    border:
        2px solid #8b7cff;

}


/* デッキ名 */

.deck-manager-name {

    font-size: 20px;

    font-weight: bold;

    margin-bottom: 15px;

}


/* デッキ情報 */

.deck-manager-info {

    font-size: 14px;

    color: #aaa;

    line-height: 1.8;

    margin-bottom: 15px;

}


/* ボタン */

.deck-manager-buttons {

    display: flex;

    gap: 8px;

    flex-wrap: wrap;

}


.deck-manager-buttons button {

    flex: 1;

    min-width: 80px;

    padding: 8px 10px;

    font-size: 13px;

    cursor: pointer;

}


/* デッキがない場合 */

.deck-manager-empty {

    padding: 50px 20px;

    text-align: center;

    color: #999;

    font-size: 16px;

}

/* ========================================
   デッキ一覧
======================================== */

.deck-page-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
}


/* デッキ一覧のタイトル */

.deck-page-container h2 {
    margin-bottom: 25px;
    font-size: 28px;
}


/* デッキ一覧 */

#deckManagerList {
    display: flex;
    flex-direction: column;
    gap: 20px;
}


/* ========================================
   デッキカード
======================================== */

.deck-manager-card {
    display: flex;
    flex-direction: row;

    width: 100%;
    box-sizing: border-box;

    gap: 25px;

    padding: 20px;

    background: #ffffff;

    border: 1px solid #ddd;

    border-radius: 15px;

    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}


/* マウスを乗せたとき */

.deck-manager-card:hover {
    transform: translateY(-4px);

    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.15);
}


/* ========================================
   統率者画像
======================================== */

.deck-commander-image {
    width: 120px;

    flex-shrink: 0;

    display: flex;

    align-items: flex-start;

    justify-content: center;
}


/* 統率者カード画像 */

.deck-commander-image img {
    width: 120px;

    height: auto;

    border-radius: 8px;

    display: block;

    box-shadow:
        0 3px 8px rgba(0, 0, 0, 0.25);
}


/* 統率者未設定 */

.no-commander-image {
    width: 120px;

    height: 167px;

    display: flex;

    align-items: center;

    justify-content: center;

    text-align: center;

    background: #eeeeee;

    border-radius: 8px;

    color: #888;

    font-size: 14px;

    line-height: 1.6;
}


/* ========================================
   デッキ情報
======================================== */

.deck-manager-info {
    flex: 1;

    min-width: 0;
}


/* デッキ名 */

.deck-manager-info h3 {
    margin: 5px 0 15px 0;

    font-size: 22px;

    word-break: break-word;
}


/* デッキ詳細 */

.deck-detail {
    margin-bottom: 18px;
}


/* 詳細1行 */

.deck-detail p {
    display: flex;

    flex-direction: column;

    margin: 8px 0;
}


/* 項目名 */

.deck-detail span {
    font-size: 12px;

    color: #888;
}


/* 内容 */

.deck-detail strong {
    font-size: 15px;

    margin-top: 2px;
}


/* ========================================
   現在のデッキ
======================================== */

.current-deck {
    border: 2px solid #4a90e2;

    box-shadow:
        0 5px 15px rgba(74, 144, 226, 0.2);
}


/* 現在のデッキラベル */

.current-deck-label {
    display: inline-block;

    margin-bottom: 5px;

    padding: 4px 8px;

    border-radius: 5px;

    background: #4a90e2;

    color: white;

    font-size: 12px;

    font-weight: bold;
}


/* ========================================
   ボタン
======================================== */

.deck-manager-buttons {
    display: flex;

    flex-wrap: wrap;

    gap: 7px;
}


.deck-manager-buttons button {
    padding: 7px 12px;

    border: none;

    border-radius: 6px;

    cursor: pointer;

    font-size: 13px;
}


/* 開く */

.deck-open-button {
    background: #4a90e2;

    color: white;
}

.deck-open-button:hover {
    background: #357abd;
}


/* 名前変更 */

.deck-rename-button {
    background: #eeeeee;

    color: #333;
}

.deck-rename-button:hover {
    background: #dddddd;
}


/* 削除 */

.deck-delete-button {
    background: #eeeeee;

    color: #c0392b;
}

.deck-delete-button:hover {
    background: #f5d6d3;
}


/* デッキなし */

.no-deck-message {
    padding: 50px;

    text-align: center;

    color: #888;
}


/* ========================================
   スマホ対応
======================================== */

@media (max-width: 600px) {

    .deck-page-container {
        padding: 15px;
    }

    #deckManagerList {
    display: flex;
    flex-direction: column;
     }

    .deck-manager-card {
        gap: 12px;

        padding: 15px;
    }

    .deck-commander-image {
        width: 90px;
    }

    .deck-commander-image img {
        width: 90px;
    }

    .no-commander-image {
        width: 90px;

        height: 126px;
    }

    .deck-manager-info h3 {
        font-size: 18px;
    }

}

/* ========================================
   デッキ一覧 最終レイアウト
======================================== */

.deck-page-container {
    width: 100%;
    max-width: 1900px;
    margin: 0 auto;
    padding: 20px;
}


/* デッキ一覧は縦に並べる */

#deckManagerList {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px;

    width: 100%;
}


/* ========================================
   デッキ1個を横長にする
======================================== */

.deck-manager-card {
    display: flex !important;
    flex-direction: row !important;

    width: 100% !important;
    min-height: 220px;

    padding: 20px;

    gap: 25px;

    background:
        rgba(255, 255, 255, 0.05);

    border:
        1px solid
        rgba(255, 255, 255, 0.12);

    border-radius: 12px;

    box-sizing: border-box;
}


/* ========================================
   統率者画像
======================================== */

.deck-commander-image {
    width: 140px;

    min-width: 140px;

    flex-shrink: 0;

    display: flex;

    align-items: flex-start;

    justify-content: center;
}


.deck-commander-image img {
    width: 140px;

    height: auto;

    display: block;

    border-radius: 8px;

    box-shadow:
        0 5px 15px
        rgba(0, 0, 0, 0.4);
}


/* 統率者未設定 */

.no-commander-image {
    width: 140px;

    height: 195px;

    display: flex;

    align-items: center;

    justify-content: center;

    text-align: center;

    background: #211a39;

    border-radius: 8px;

    color: #888;

    font-size: 13px;
}


/* ========================================
   デッキ情報
======================================== */

.deck-manager-info {
    flex: 1;

    min-width: 0;

    display: flex;

    flex-direction: column;

    justify-content: flex-start;
}


/* デッキ名 */

.deck-manager-info h3 {
    margin: 5px 0 20px;

    font-size: 24px;

    color: #eeeeff;
}


/* ========================================
   デッキ詳細
======================================== */

.deck-detail {
    display: flex;

    gap: 50px;

    margin-bottom: 25px;
}


.deck-detail p {
    display: flex;

    flex-direction: column;

    margin: 0;
}


.deck-detail span {
    color: #82799d;

    font-size: 12px;

    margin-bottom: 4px;
}


.deck-detail strong {
    color: #eeeeff;

    font-size: 16px;
}


/* ========================================
   ボタン
======================================== */

.deck-manager-buttons {
    display: flex;

    gap: 10px;

    margin-top: auto;

    flex-wrap: nowrap;
}


.deck-manager-buttons button {
    flex: 0 0 auto;

    min-width: 100px;

    padding: 9px 18px;

    border: none;

    border-radius: 7px;

    cursor: pointer;

    font-size: 12px;
}


/* 開く */

.deck-open-button {
    background: #7139df;

    color: white;
}


.deck-open-button:hover {
    background: #8b52ff;
}


/* 名前変更 */

.deck-rename-button {
    background: #302840;

    color: #d8cdec;

    border: 1px solid #493c66 !important;
}


.deck-rename-button:hover {
    background: #44365d;
}


/* 削除 */

.deck-delete-button {
    background: #302840;

    color: #e58b8b;

    border: 1px solid #493c66 !important;
}


.deck-delete-button:hover {
    background: #54343f;
}


/* ========================================
   現在開いているデッキ
======================================== */

.deck-manager-card.current-deck {
    border: 2px solid #8b7cff;

    box-shadow:
        0 0 20px
        rgba(139, 124, 255, 0.15);
}


.current-deck-label {
    display: inline-block;

    width: fit-content;

    margin-bottom: 8px;

    padding: 4px 9px;

    background: #7139df;

    color: white;

    border-radius: 5px;

    font-size: 11px;

    font-weight: bold;
}

/* ========================================
   統率者ボタン
======================================== */

.commander-card-info {
    flex: 1;
    min-width: 0;
}


.commander-card-buttons {
    display: flex;
    flex-direction: column;

    gap: 8px;

    width: 100%;
}


/* イラスト変更 */

.commander-art-button {
    width: 100%;

    padding: 8px 10px;

    border: none;

    border-radius: 6px;

    background: #7139df;

    color: white;

    font-size: 11px;

    cursor: pointer;
}


.commander-art-button:hover {
    background: #8b52ff;
}


/* 統率者解除 */

.commander-remove-button {
    width: 100%;

    padding: 8px 10px;

    border: 1px solid #49366f;

    border-radius: 6px;

    background: #2b2149;

    color: #cfc2eb;

    font-size: 11px;

    cursor: pointer;
}


.commander-remove-button:hover {
    background: #543b70;

    color: white;
}

/* 晴れる屋へのリンク */

.hareruya-card-link {

    display: inline-block;

    margin-top: 18px;
    margin-bottom: 15px;

    padding: 9px 14px;

    border: 1px solid #493c78;
    border-radius: 7px;

    background: #201a38;

    color: #cbb7ff;

    font-size: 12px;

    text-decoration: none;

    cursor: pointer;

    transition: 0.2s;
}


.hareruya-card-link:hover {

    background: #2d2450;

    border-color: #8150ef;

    color: #ffffff;

}
.deck-display-picker { display: flex; align-items: center; gap: 10px; margin: 12px 0; font-size: 13px; }
.deck-display-picker select { padding: 7px; background: #211a39; color: white; border: 1px solid #493c66; border-radius: 6px; }
#deckList.deck-stacked { display: block; }
#deckList.deck-stacked .deck-category-section { width: 100%; margin: 0; min-width: 0; }
#deckList.deck-stacked .deck-category-title { font-size: 13px; margin: 8px 0 12px; }
#deckList.deck-stacked .deck-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-items: start; gap: 20px 16px; padding-bottom: 60px; }
#deckList.deck-stacked .deck-mana-column { min-width: 0; }
#deckList.deck-stacked .deck-mana-column h4 { margin: 0 0 10px; font-size: 14px; color: #cbb7ff; }
#deckList.deck-stacked .deck-mana-pile { display: flex; flex-direction: column; }
#deckList.deck-stacked .deck-grid-card { position: relative; width: 140px; min-width: 0; height: 196px; padding: 0; overflow: visible; border-radius: 7px; }
#deckList.deck-stacked .deck-grid-card + .deck-grid-card { margin-top: -164px; }
#deckList.deck-stacked .deck-grid-card-image { width: 140px; height: 196px; object-fit: contain; }
#deckList.deck-stacked .deck-grid-card-info { display: none; position: absolute; top: 100%; left: 0; width: 140px; background: #211a39; border-radius: 6px; padding: 5px; box-sizing: border-box; }
#deckList.deck-stacked .deck-grid-card:hover, #deckList.deck-stacked .deck-grid-card:focus-within { z-index: 10; transform: translateX(5px); }
#deckList.deck-stacked .deck-grid-card:hover .deck-grid-card-info, #deckList.deck-stacked .deck-grid-card:focus-within .deck-grid-card-info { display: block; }
.deck-stack-count { position: absolute; right: 4px; top: 5px; background: #000c; color: white; padding: 1px 5px; border-radius: 4px; font-size: 12px; pointer-events: none; }
.card-detail-visual { flex: 0 0 200px; display: flex; flex-direction: column; align-items: stretch; }
.card-detail .card-detail-visual .commander-button { margin: 10px 0 0; }
@media (max-width: 768px) {
    .card-detail-visual { flex: none; width: 220px; max-width: 100%; }
}
/* 価格欄のない詳細表示。文章量によらず枠の高さを一定に保つ。 */
#cardInfo:has(> .card-detail) {
    height: 420px;
    max-height: max(320px, calc(100dvh - 180px));
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
    box-sizing: border-box;
}
#cardInfo > .card-detail { width: 100%; box-sizing: border-box; padding: 16px; gap: 24px; }
@media (max-width: 768px) {
    #cardInfo:has(> .card-detail) { height: 540px; }
    #cardInfo > .card-detail { padding: 12px; gap: 16px; }
}
.library-search-dialog { box-sizing: border-box; width: min(960px, 94vw); max-height: 90dvh; padding: 18px; border: 1px solid #9c85be; border-radius: 10px; color: #fff; background: #211b30; overflow: auto; }
.library-search-dialog::backdrop { background: #000b; }
.library-search-dialog input, .library-search-dialog select { max-width: 100%; padding: 8px; }
.library-search-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.library-search-card img { width: 100%; border-radius: 8px; }
.library-search-card p { font-size: 12px; overflow-wrap: anywhere; }
.library-search-card button { width: 100%; padding: 8px; cursor: pointer; }
.library-search-footer { position: sticky; bottom: -18px; padding: 12px 0; background: #211b30; }
.library-search-footer small { display: block; margin-top: 6px; }
.generation-page { max-width: 1000px; margin: 24px auto; padding: 0 16px; }
.generation-page fieldset { border: 0; padding: 0; min-width: 0; }
.generation-page [hidden] { display: none; }
.generation-page .preserve-lines { white-space: pre-wrap; }
.generation-page #generationStatus { white-space: pre-wrap; overflow-wrap: anywhere; }
.combo-page details { padding: 14px 0; border-bottom: 1px solid #493c66; }
.combo-page details p { white-space: pre-wrap; }
.combo-card-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 190px)); gap: 16px; margin: 18px 0; }
.combo-card { margin: 0; padding: 8px; border: 1px solid #493c66; border-radius: 10px; min-width: 0; }
.combo-card-missing { border-color: #d6a24b; background: rgba(214,162,75,.08); }
.combo-card img { display: block; width: 100%; height: auto; border-radius: 7px; margin-bottom: 8px; }
.combo-card figcaption { font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.combo-image-button { display: block; width: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.combo-image-button:focus-visible { outline: 3px solid #cbb7ff; outline-offset: 3px; }
.combo-image-dialog { max-width: 92vw; max-height: 94dvh; padding: 16px; border: 1px solid #756196; border-radius: 12px; background: #201a38; color: #fff; }
.combo-image-dialog::backdrop { background: rgba(0,0,0,.8); }
.combo-image-dialog button { display: block; margin-left: auto; padding: 8px 14px; cursor: pointer; }
.combo-image-dialog p { margin: 10px 0; overflow-wrap: anywhere; }
.combo-image-dialog img { display: block; max-width: 100%; max-height: 74dvh; width: auto; height: auto; margin: auto; border-radius: 10px; }
.playtest-page { max-width: 1440px; }
.play-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px; }
.play-card { min-width: 0; border: 1px solid #493c66; padding: 10px; border-radius: 10px; }
.play-card img { width: 100%; height: auto; border-radius: 8px; }
.play-card p { overflow-wrap: anywhere; }
.play-card button, .play-card select { max-width: 100%; margin: 4px 0; padding: 6px; }
.play-card .combo-image-button { padding: 0; }
.play-tapped { transform: rotate(12deg) scale(.85); opacity: .75; }
.playtest-table .playtest-page { max-width: none; margin: 10px auto; padding: 0 10px; }
.playtest-table .playtest-page > section { padding: 10px 14px; margin-bottom: 8px; }
.playtest-table h1, .playtest-table #playTitle { font-size: 18px; margin: 4px 0; }
.playtest-table #playInfo, .playtest-table #playStatus { margin: 6px 0; }
.playtest-table #playZones { display: grid; grid-template-columns: minmax(300px, 1fr) repeat(4, 150px); gap: 8px; }
.playtest-table .play-zone { padding: 8px; margin: 0; min-width: 0; border: 2px solid #494354; }
.playtest-table .play-zone h2 { font-size: 13px; margin: 0 0 8px; }
.playtest-table .play-zone-battlefield { grid-column: 1 / -1; grid-row: 1; background-color: #202124; background-image: linear-gradient(#ffffff04 1px, transparent 1px), linear-gradient(90deg, #ffffff04 1px, transparent 1px); background-size: 20px 20px; }
.playtest-table .play-zone-battlefield .play-card-grid { position: relative; display: block; height: max(380px, 48vh); overflow: visible; }
.playtest-table .play-zone-battlefield .play-card { position: absolute; }
.playtest-table .play-zone-hand { grid-column: 1; grid-row: 2; }
.playtest-table .play-zone-library { grid-column: 2; grid-row: 2; }
.playtest-table .play-zone-graveyard { grid-column: 3; grid-row: 2; }
.playtest-table .play-zone-exile { grid-column: 4; grid-row: 2; }
.playtest-table .play-zone-command { grid-column: 5; grid-row: 2; }
.playtest-table .play-card-grid { display: flex; gap: 6px; overflow: auto; min-height: 215px; }
.playtest-table .play-card { width: 110px; flex: 0 0 110px; box-sizing: border-box; padding: 3px; background: #18171e; cursor: grab; }
.playtest-table .play-card p { font-size: 10px; margin: 2px 0; max-height: 28px; overflow: auto; }
.playtest-table .play-card img { display: block; height: 145px; object-fit: contain; }
.playtest-table .play-card-actions { position: relative; font-size: 12px; cursor: pointer; }
.playtest-table .play-card-actions[open] { z-index: 20; background: #272333; padding: 4px; }
.playtest-table .play-card:focus-within, .playtest-table .play-card:hover { z-index: 30; }
.playtest-table .play-tapped { transform: rotate(90deg) scale(.72); }
.playtest-table .play-drop-active { border-color: #bc9cff; box-shadow: inset 0 0 24px #956af433; }
.playtest-table .play-dragging { opacity: .45; }
.playtest-table { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
.playtest-table .top-header { flex-shrink: 0; }
.playtest-table .playtest-page { flex: 1; min-height: 0; width: 100%; box-sizing: border-box; display: flex; flex-direction: column; margin: 0; padding: 6px; gap: 5px; }
.playtest-table .playtest-page > section { flex-shrink: 0; padding: 5px 10px; margin: 0; }
.playtest-table .play-setup { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.playtest-table .play-setup h1 { font-size: 15px; }
.playtest-table .play-setup details { position: relative; }
.playtest-table .play-setup details[open] p { position: absolute; z-index: 50; background: #242030; padding: 14px; width: min(320px, 65vw); max-height: 45vh; overflow: auto; }
.playtest-table #playStatus { font-size: 12px; }
.playtest-table #playControls { display: flex; flex-direction: column; align-items: stretch; gap: 5px; }
.playtest-table .play-turn-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 12px; }
.playtest-table .play-control-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.play-workspace { display: flex; gap: 8px; flex: 1; min-height: 0; overflow: hidden; }
#playDeckSidebar { flex: 0 0 280px; overflow: auto; min-height: 0; background: #211b30; padding: 10px; box-sizing: border-box; border: 1px solid #493c66; border-radius: 8px; }
#playDeckSidebar h2 { font-size: 15px; margin: 10px 0; }
#playDeckSidebar p { font-size: 12px; line-height: 1.5; }
#playDeckSidebar button, #playDeckSidebar select { padding: 5px; margin: 4px; }
#playDeckSidebar table { width: 100%; font-size: 11px; border-collapse: collapse; }
#playDeckSidebar td, #playDeckSidebar th { padding: 4px 2px; border-bottom: 1px solid #493c66; }
.play-deck-row { display: flex; gap: 6px; align-items: start; font-size: 12px; padding: 5px 0; }
.play-deck-row input { flex: 0 0 auto; }
.play-workspace #playZones { overflow: auto; }
@media (max-width: 800px) { #playDeckSidebar { flex-basis: 220px; } .play-workspace { overflow-x: auto; } .play-workspace #playZones { min-width: 400px; } }
.playtest-table #playStart { margin: 0; padding: 5px 9px; min-height: 28px; font-size: 12px; line-height: 1.3; cursor: pointer; }
.playtest-table #playControls[hidden] { display: none; }
.playtest-table #playTitle { font-size: 14px; }
.playtest-table #opening p, .playtest-table #playing p { font-size: 11px; margin: 2px 0; }
.playtest-table #playZones { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr) 250px; grid-template-columns: minmax(300px, 1fr) 150px repeat(3, 125px); }
.playtest-table .play-zone { display: flex; flex-direction: column; min-height: 0; padding: 5px; }
.playtest-table .play-card-grid { min-height: 0; flex: 1; }
.playtest-table .play-zone-battlefield .play-card-grid { height: auto; min-height: 0; flex: 1; overflow: auto; }
.playtest-table .play-card { position: relative; height: 154px; }
.playtest-table .play-card-name { display: none; }
.playtest-table .play-card:not(:has(img)) .play-card-name { display: block; padding-top: 30px; }
.playtest-table .play-more { position: absolute; top: 4px; right: 4px; margin: 0; padding: 0; width: 30px; height: 28px; border: 1px solid #c1addb; border-radius: 6px; color: white; background: #211b30ed; font-size: 22px; line-height: 1; cursor: pointer; }
.playtest-table .play-card-actions { position: fixed; margin: 0; width: 220px; max-height: min(280px, 80dvh); overflow: auto; padding: 10px; color: white; background: #272333; border: 1px solid #9c85be; border-radius: 8px; box-shadow: 0 8px 30px #0008; }
.playtest-table .play-card-actions button, .playtest-table .play-card-actions select { display: block; width: 100%; }
.playtest-table .play-card-actions p { max-height: none; font-size: 13px; }
.playtest-table .play-card > button[aria-pressed] { position: absolute; bottom: 3px; left: 3px; width: calc(100% - 6px); font-size: 10px; background: #272333ed; color: white; }
.playtest-table .play-card > button[aria-pressed="true"] { background: #6846ac; outline: 2px solid #dcc6ff; }
.play-library-pile { width: 110px; height: 150px; border: 3px double #9785bf; border-radius: 8px; color: #e0d7f4; background: repeating-linear-gradient(45deg, #30283f, #30283f 8px, #251f33 8px, #251f33 16px); white-space: pre-line; cursor: pointer; }
.playtest-table #playActionButtons { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.playtest-table #playActionButtons button { margin: 0; padding: 5px 9px; min-height: 28px; font-size: 12px; line-height: 1.3; cursor: pointer; }
.playtest-table .play-library-pile { position: relative; padding: 0; overflow: hidden; }
.play-library-pile img { display: block; width: 100%; height: 100%; object-fit: contain; }
.play-library-pile span { position: absolute; bottom: 4px; left: 0; right: 0; background: #17121edb; color: white; padding: 3px 0; font-size: 11px; }
@media (max-width: 950px) {
    .playtest-table #playZones { grid-template-columns: repeat(4, minmax(120px, 1fr)); overflow-x: auto; }
    .playtest-table .play-zone-hand { grid-column: 1 / -1; }
    .playtest-table .play-zone-library { grid-column: 1; grid-row: 3; }
    .playtest-table .play-zone-graveyard { grid-column: 2; grid-row: 3; }
    .playtest-table .play-zone-exile { grid-column: 3; grid-row: 3; }
    .playtest-table .play-zone-command { grid-column: 4; grid-row: 3; }
}
@media (max-width: 950px) {
    .playtest-table #playZones { grid-template-columns: minmax(300px, 1fr) 150px repeat(3, 115px); grid-template-rows: minmax(180px, 1fr) 250px; overflow: auto; }
    .playtest-table .play-zone-hand { grid-column: 1; grid-row: 2; }
    .playtest-table .play-zone-library { grid-column: 2; grid-row: 2; }
    .playtest-table .play-zone-graveyard { grid-column: 3; grid-row: 2; }
    .playtest-table .play-zone-exile { grid-column: 4; grid-row: 2; }
    .playtest-table .play-zone-command { grid-column: 5; grid-row: 2; }
}
@media (max-height: 600px) {
    .playtest-table #opening p, .playtest-table #playing p { max-height: 32px; overflow: auto; }
}
.playtest-table .playtest-page { display: grid; grid-template-columns: minmax(0, 1fr) 280px; grid-template-rows: auto auto minmax(0, 1fr); align-items: stretch; }
.playtest-table .play-setup { grid-column: 1; grid-row: 1; }
.playtest-table #playControls { grid-column: 1; grid-row: 2; }
.playtest-table .play-workspace { grid-column: 1; grid-row: 3; min-width: 0; }
.playtest-table #playDeckSidebar { grid-column: 2; grid-row: 1 / 4; }
.playtest-table .play-zone-battlefield { grid-column: 1 / 4; }
#playCardPreview { grid-column: 4 / 6; grid-row: 1; min-height: 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px; border: 1px solid #493c66; border-radius: 8px; background: #191621; overflow: hidden; }
#playCardPreview img { min-height: 0; max-height: calc(100% - 44px); width: 100%; object-fit: contain; border-radius: 8px; }
#playCardPreview p { flex-shrink: 0; max-height: 36px; overflow: auto; margin: 6px 0 0; font-size: 12px; text-align: center; }
#playDeckSidebar [tabindex]:focus-visible { outline: 2px solid #cbb7ff; }
@media (max-width: 800px) { .playtest-table .playtest-page { grid-template-columns: minmax(0, 1fr) 220px; } }
