body {
    margin: 0;
    font-family: Arial, sans-serif;
    color: #fff;
    background: #2c3e50;
}

header {
    background: #34495e;
    color: #fff;
    padding: 20px;
    align-items: center;
    display: flex;
    justify-content: center;
    font-weight: bold;
    font-size: 24px;
}

main {
    padding: 20px;
    margin: 0 auto;
}

#icon {
    position: absolute;
    left: 10px;
}

#icon img {
    width: 30px;
    height: 30px;
}

#url {
    color: #d4f4d2;
}

.container {
    display: flex;
    gap: 30px;
    justify-content: space-between;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.input-section {
    flex: 1;
    background-color: #34495e;
    padding: 10px 20px;
    border-radius: 8px;
}

.deck-selection {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.deck-group {
    flex: 1;
    min-width: 140px;
}

.deck-group input,
.result-selection select,
input,
select,
button {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
    border: none;
}

button,
select {
    background-color: #4a9485;
    color: #fff;
}

button:active {
    transform: scale(0.9);
}

.stats-section {
    flex: 1;
    background-color: #34495e;
    padding: 10px 20px;
    border-radius: 8px;
}

/* 統計表示セクション */

/* テーブル全体のスタイル */
.stats-section table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}


/* テーブルのボディ（各行） */
.stats-section tbody td {
    padding: 10px;
    border: 1px solid #ccc;
    text-align: center;
}



table {
    width: 100%;
    border-collapse: collapse;
}

.table-section {
    background: #34495e;
    padding: 20px;
    border-radius: 8px;
}


.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.table-header h3 {
    margin: 0;
}

#editControls {
    display: flex;
    gap: 8px;
}

#editControls button {
    width: 100px;
    padding: 6px 0;
    font-size: 14px;
    cursor: pointer;
}

#matchTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.icon-button {
    width: 16px;
    height: 16px;
    margin: 0;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

th,
td {
    border: 1px solid #fff;
    padding: 10px;
    text-align: center;
}

input {
    width: 90%;
    box-sizing: border-box;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.7em;
}

nav {
    background: #2c3e50;
    padding: 20px;
    box-shadow: 0 4px 14px rgb(0 0 0 / 0.3);
    text-align: center;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;

    display: inline-flex;
    gap: 30px;

    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

nav ul li a {
    text-decoration: none;
    color: #ecf0f1;
    font-size: 1.1rem;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 10px;
    background: #4a9485;
    transition: background 0.3s ease, color 0.3s ease;
    box-shadow: 0 2px 5px rgb(0 0 0 / 0.4);
    display: inline-block;
}

nav ul li a:hover {
    background: #4a9485;
    color: #fff;
    box-shadow: 0 4px 14px rgb(0 0 0 / 0.5);
}

input[type="number" i] {
    margin: 0;

}

/*対戦成績表用*/
.table-wrapper table {
    border-collapse: collapse;
    table-layout: auto;
    /* 列幅が自動で増えるように */
}

.table-wrapper th,
.table-wrapper td {
    min-width: 120px;
    /* 各マスの幅を固定 or 最小幅で指定 */
    white-space: nowrap;
    text-align: center;
}


/* draw_and_carddata.html専用スタイル */
.draw-and-carddata * {
    box-sizing: border-box;
}

/* ベース設定 */
.draw-and-carddata body {
    font-family: 'Yu Gothic', 'Hiragino Kaku Gothic ProN', sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    /* パネル単体の横スクロール禁止 */
    background-color: #2c3e50;
    color: #ecf0f1;
}

/* 左右パネル */
.draw-and-carddata .left-panel,
.draw-and-carddata .right-panel {
    background-color: #34495e;
    color: #ecf0f1;
    border-radius: 8px;
    padding: 20px;
}

/* ボタン類（共通） */
.draw-and-carddata button,
.draw-and-carddata .button-row button,
.draw-and-carddata .toggle-skill-btn {
    background-color: #4a9485;
    color: #fff;
    border: none;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgb(0 0 0 / 0.4);
}

.draw-and-carddata button:hover {
    background-color: #3f8375;
    box-shadow: 0 4px 10px rgb(0 0 0 / 0.5);
}


.draw-and-carddata button:active,
.draw-and-carddata #resetButton:active,
.draw-and-carddata #resetDeck:active {
    transform: scale(0.9);
}

.draw-and-carddata main {
    padding: 0px;
    margin: 10px;
}

.draw-and-carddata h1 {
    text-align: center;
    font-size: 1.2em;
}

/* フォーム全体 */
.draw-and-carddata form {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.draw-and-carddata li {
    list-style-type: none;
}


/* ============================================
   🔹 デッキビルダー用レイアウト追加スタイル
============================================ */
.draw-and-carddata body {
    display: flex;
    height: 100vh;
    margin: 0;
    overflow: hidden;
}

/* 左右パネル */
.draw-and-carddata main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}


.draw-and-carddata .left-panel p {
    margin: 0;
    font-size: 12px;
    padding-left: 16px;
}

/* カードドロップゾーン */
.draw-and-carddata .card-drop-zone {
    min-height: 200px;
    margin: 10px 0;
    padding: 10px 0 10px 5px;
    background-color: #3a4b5c;
    border: 1px solid #888;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    width: 100%;
}



.draw-and-carddata .card-drop-zone>div {
    height: 40px;
    max-width: 97%;
}


.draw-and-carddata .card.unknown {
    background-color: rgb(125, 125, 125);
}

.draw-and-carddata .card-drop-zone .card-header {
    margin: 5px 0 0 0;
    width: 150px;
}

.draw-and-carddata .card-drop-zone h2 {
    font-size: 0.9em;
}

.draw-and-carddata .button-row {
    display: flex;
    justify-content: space-between;
    /* 横に並べて間隔空ける */
    gap: 2px;
}

.draw-and-carddata #column,
.draw-and-carddata .target-select-section {
    display: flex;
    flex-direction: column;
    /* ← 縦方向にする */
}

.draw-and-carddata .button-row button {
    flex: 1;
    font-size: 10px;
    margin-bottom: 2px;
}



.draw-and-carddata .drop-instruction {
    font-size: 12px;
    color: #666;
    margin: 0 0 5px 0;
}

.draw-and-carddata .deck-tools {
    display: flex;
    /* 横並びにする */
    gap: 20px;
    /* パネル間のスペース */
    margin-top: 20px;
    justify-content: center;
    /* 中央寄せ */
    flex-wrap: wrap;
    /* 画面幅が狭い場合に折り返す */
    background-color: #f0f0f0;
}


/* ============================================
   🔹 確率計算用スタイル
============================================ */
/*欲しいモンスターを選択*/
.draw-and-carddata .target-select-section select {
    width: 100%;
    /* ← 親要素に合わせて全幅に広がる */
    background-color: #4a9485;
}

.draw-and-carddata .select-container {
    display: flex;
    justify-content: space-between;
    /* または center や start も選べる */
    gap: 2px;
    margin-bottom: 20px;
}

.draw-and-carddata .target-select-section {
    flex: 1;
    /* 均等な3分割 */
    display: flex;
    /* 均等に幅を持たせたい場合 */
    flex-direction: column;
    /* ← labelとselectを縦並びに */
    align-items: flex-start;
    /* 左揃え */
}

.draw-and-carddata .target-button {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.draw-and-carddata .target-button select {
    font-size: 10px;
}

.draw-and-carddata .target-button button {
    margin: 5px 0;
    width: 70px;
}

.draw-and-carddata #checkboxMode {
    display: none;
}

.draw-and-carddata strong {
    font-size: 12px;
}

.draw-and-carddata .card.unknown {
    height: 40px;
}

.draw-and-carddata #resultAreaWrapper {
    display: flex;
    gap: 10px;
    width: 0 auto;
    width: 100%;
}

.draw-and-carddata #prevResultArea,
.draw-and-carddata #resultArea {
    flex: 1;
    border: 1px solid #ccc;
    padding: 8px;
    overflow-x: auto;
    width: 100%;
}

.draw-and-carddata #label-font-size {
    font-size: 0.8em;
}

/* ============================================
   🔹 検索欄
============================================ */
.draw-and-carddata .card:active {
    transform: scale(0.95);
    box-shadow: inset 0 0 5px #aaa;
}



.draw-and-carddata input[type="text"] {
    padding: 10px;
    width: 500px;
    border: 1px solid #bbb;
    font-size: 1em;
    height: 30px;
    margin: 10px 0;
    background-color: #ecf0f1;
    color: #2c3e50;
    border: 1px solid #bbb;
}

.draw-and-carddata button[type="submit"] {
    padding: 10px;
    font-size: 1em;
    width: 100px;
    height: 50px;
    margin: 20px 0;
}


/* フィルター：PCでは横並び */
.draw-and-carddata select {
    appearance: none;
    /* 標準 */
    -webkit-appearance: none;
    /* Safari */
    -moz-appearance: none;
    /* Firefox */
    background: none;
    /* 背景の矢印アイコン除去 */
    background-image: none;
    /* 念のため */
}

.draw-and-carddata .filter-row {
    display: flex;
    justify-content: space-between;
    gap: 2px;
    /* これで上下中央に */
    width: 100%;
    margin-bottom: 10px;
}

/* 各フィルターのペア（ラベル＋セレクト） */
.draw-and-carddata .filter-pair {
    align-items: center;
    flex: 0 0 calc(25%);
    /* ← 縦揃えのカギ */
    gap: 0px;
}

/*exが上にずれるのを解決*/
.draw-and-carddata .filter-pair #sizeAdjustment {
    margin-bottom: 9.5px;
}

.draw-and-carddata .filter-pair label {
    width: 100%;
    text-align: left;
    margin-left: 5px;
}


/* セレクト */
.draw-and-carddata .filter-pair select {
    width: 100%;
    padding: 8px;
    color: white;
    background-color: #4a9485;
}

/* 汎用セレクト・ラベル */
.draw-and-carddata label,
.draw-and-carddata select {
    display: block;
    margin: 5px 0 5px 0;
}


/* スキル選択 */
.draw-and-carddata #skillColumn {
    margin-bottom: 0;
    display: none;
}

.draw-and-carddata #skillSelect {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
    width: 100%;
    max-width: 100%;
}

/*回復からその他まで*/
.draw-and-carddata #skillSelect label {
    background: #4a9485;
    cursor: pointer;
    -webkit-user-select: none;
    /* Safari用 */
    -ms-user-select: none;
    /* IE用（必要なら） */
    user-select: none;
    /* 標準 */
    margin: 0;
    flex: 0 0 calc(17% - 8px);
    /* 横幅を2分割（gapの分を差し引く） */
    font-size: 0.8em;
    margin-bottom: 0;
    align-items: center;
    /* チェックボックスと文字を垂直中央に揃える */
    border-radius: 0;
}

.draw-and-carddata #skillSelect input[type="checkbox"] {
    margin: 10px 0px 10px 5px;
    padding-top: 0px;
    width: 10px;
    accent-color: 29#4b4c4d;
    /* 緑など好きな色に */
}


/* 各スキル詳細 */
.draw-and-carddata [id$="DetailContainer"] {
    margin-bottom: 20px;
    background-color: #ffffff;
    padding: 10px;
    border-left: 4px solid #4b4c4d;
}

/*それぞれの詳細条件*/
.draw-and-carddata .detail-container {
    display: none;
    background-color: #2c3e50;
    color: white;
    border-left: 4px solid #4a9485;
}

/* 検索結果カード以外のボックス */
.draw-and-carddata #resultAreaWrapper,
.draw-and-carddata #prevResultArea,
.draw-and-carddata #resultArea {
    background-color: #3c566f;
    color: #fff;
}

.draw-and-carddata .detail-container select {
    width: 250px;
    height: 35px;
    /* 必要に応じて調整 */
    padding: 8px;
    font-size: 0.8em;
    border: 1px solid #bbb;
    margin: 5px 0 0 0;
    color: white;
    background-color: #3c566f;
}

.draw-and-carddata .detail-container label {
    margin: 0;
    font-size: 0.8em;
}

.draw-and-carddata #searchResetButton {
    width: 200px;
    padding: 20px;
}



/* カード一覧 */
.draw-and-carddata .card-container {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    /* カード間の余白 */
    justify-content: flex-start;
    padding: 0px;
    background-color: #f5f7fa;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* カード本体 */

.draw-and-carddata .click-mark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5em;
    color: white;
    background-color: #4b4c4d;
    padding: 4px 8px;
    border-radius: 8px;
    pointer-events: none;
}

.draw-and-carddata .card {
    padding: 5px;
    border: none;
    flex: 1 1 calc(33.33% - 16px);
    min-width: 160px;
    height: 220px;
}

.draw-and-carddata #space {
    margin-left: 1px;
}


/* カードヘッダー */
.draw-and-carddata .card-header {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 5px 0;
}

.draw-and-carddata .card-header,
.draw-and-carddata .label,
.draw-and-carddata .value {
    font-size: 16px;
}

/* タイプアイコン */
.draw-and-carddata .type-icon,
.draw-and-carddata .energy-icon {
    width: 20px;
    height: 20px;
}

.draw-and-carddata .energy-icon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    position: relative;
    bottom: 1px;
}

.draw-and-carddata .card-title {
    margin: 0;
    padding: 0;
    color: black;
}

.draw-and-carddata .card-info .value {
    margin-top: auto;
}

.draw-and-carddata .card-info p {
    margin: 10px 0 0 0;
    font-size: 12px;
    margin-top: auto;

}


/* カード詳細 */
.draw-and-carddata .card-body {
    padding: 2px;
}

.draw-and-carddata .card-info {
    display: flex;
    justify-content: flex-start;
    gap: 5px;
    margin-bottom: 6px;
}

.draw-and-carddata #cardContainer {
    gap: 10px;
    padding: 10px;
    background-color: rgb(52, 73, 94);
}

/* トグルボタンのスタイル */
.draw-and-carddata .toggle-skill-btn {
    display: none;
    padding: 8px;
    margin-bottom: 10px;
    font-size: 12px;
    border: none;
    cursor: pointer;
}

/* デフォルト：大画面では表示 */
.draw-and-carddata #skillSection {
    display: block;
    background-color: #3a4f61;
    color: #fff;
    padding: 10px 0;
    margin: 10px 0;
}


.draw-and-carddata .card.grass {
    background-color: #d4f4d2;
    /* 少し鮮やかに */
    color: #2e5c2e;
}

.draw-and-carddata .card.fire {
    background-color: #ffe4e1;
    color: #bb2f2f;
}

.draw-and-carddata .card.water {
    background-color: #dceeff;
    color: #225577;
}

.draw-and-carddata .card.electric {
    background-color: #fffac0;
    color: #886600;
}

.draw-and-carddata .card.psychic {
    background-color: #f7dbfa;
    color: #722e80;
}

.draw-and-carddata .card.fighting {
    background-color: #ffe7c2;
    color: #7a3f00;
}

.draw-and-carddata .card.dark {
    background-color: #cccccc;
    color: #222222;
}

.draw-and-carddata .card.steel {
    background-color: #e0e0e0;
    color: #444444;
}

.draw-and-carddata .card.dragon {
    background-color: #fef3c4;
    color: #774400;
}

.draw-and-carddata .card.colorless {
    background-color: #f3f3f3;
    color: #555555;
}


@media screen and (max-width: 1600px) {
    .draw-and-carddata #skillSelect label {
        flex: 0 0 calc(25% - 8px);
        /* 横幅を2分割（gapの分を差し引く） */
    }
}



/* メディア対応（タブレット） */
@media screen and (max-width: 1100px) {
    .container {
        gap: 10px;
        margin-bottom: 10px;
    }

    /*対戦数と勝率のみサイズ固定*/
    th.fixed,
    td.fixed {
        width: 50px;
    }

    .deck-selection {
        display: inline;
    }

    .draw-and-carddata form {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }

    .draw-and-carddata input[type="text"] {
        width: 250px;
        max-width: 90%;
        font-size: 1em;
    }

    /* カードドロップゾーン */
    .draw-and-carddata .card-drop-zone {
        grid-template-columns: repeat(2, 1fr);
        gap: 3px;

    }


    .draw-and-carddata #skillSelect {
        gap: 8px;
        display: flex;
        flex-wrap: wrap;
    }

    .draw-and-carddata #skillSelect label {
        flex: 0 0 calc(30%);
    }



    .draw-and-carddata .toggle-skill-btn {
        display: block;
    }

    .draw-and-carddata #skillSection {
        display: none;
        margin-bottom: 10px;
    }

    .draw-and-carddata h4 {
        display: none;
    }

    .table-wrapper {
        overflow-x: auto;
        width: 100%;
    }

    /*対戦成績表用*/
    .table-wrapper th,
    .table-wrapper td {
        padding: 8px 5px;
        font-size: 1em;
    }

}

@media screen and (max-width: 768px) {
    .container {
        display: inline;
    }

    h3 {
        margin: 10px 0;
    }

    #myDeckSelect,
    #oppDeckSelect,
    #winLoseSelect,
    #addMatchSelect {
        height: 35px;
    }

    .stats-section table {
        margin-bottom: 0px;
        font-size: 10px;
    }

    /*勝率表示表の名前の大きさ*/
    th.flexible {
        min-width: 200px;
    }

    th.fixed,
    td.fixed {
        width: auto;
    }

    .input-section,
    .stats-section {
        padding: 10px 10px;
        margin-bottom: 10px;
    }

    .table-wrapper th,
    .table-wrapper td {
        min-width: 100px;
        font-weight: normal;
    }

    .icon-button {
        width: 8px;
        height: 8px;
        margin: 0;
        font-size: 8px;
    }

    /* カードドロップゾーン */
    .draw-and-carddata .card-drop-zone {
        display: flex;
        flex-direction: column;
    }

    .draw-and-carddata main {
        gap: 5px;
    }

    .draw-and-carddata .left-panel,
    .draw-and-carddata .right-panel {
        padding: 5px;
    }

    .draw-and-carddata .button-row {
        flex-direction: column;
        gap: 2px;
    }

    .draw-and-carddata .card {
        height: 160px;
    }

    .table-wrapper th,
    .table-wrapper td {
        font-size: 0.7em;
    }
}

@media screen and (min-width: 1100px) {
    .draw-and-carddata #skillSection {
        display: block !important;
    }
}