/* ======================================
    monster_match.css
    子・親・祖父母入力セクション用スタイル
    （PWA対応・ダーク／ライト対応）
====================================== */

.input-mode {
    display: none;
}
/* --- セクション全体 --- */
.match-inputs {
    max-width: 900px;
    margin: 0 auto;
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* --- 各ブロック --- */
.match-group {
    background: color-mix(in srgb, var(--bg) 95%, var(--accent) 5%);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 18px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.15);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.match-group:hover {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--bg) 90%, var(--accent) 10%);
}

/* --- タイトル --- */
.match-group h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    margin: 5px 0px;
    text-shadow: 0 0 10px rgba(68, 214, 44, 0.3);
    letter-spacing: 0.03em;
}

/* --- 祖父母ブロック --- */
.grand-group {
    margin-top: 12px;
}

@media (min-width: 960px) {
    .grand-group {
        background: rgba(255, 255, 255, 0.03);
        border-top: 1px solid var(--border);
        border-radius: 8px;
        padding: 16px;
    }
}

.grand-group h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 10px;
    border-left: 3px solid var(--accent);
    padding-left: 8px;
}

/* --- ラベルと入力 --- */
.input-row {
    display: grid;
    grid-template-columns: 100px 1fr 100px 1fr;
    gap: 8px 12px;
    align-items: center;
    margin-bottom: 10px;
}

.input-row label {
    font-size: 13px;
    color: var(--muted);
    text-align: right;
}

/* --- 入力フィールド --- */
input[name="monster-list"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
}

input[name="monster-list"]:hover,
input[name="monster-list"]:focus {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, var(--bg));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
    outline: none;
}

/* --- レスポンシブ --- */
@media (max-width: 700px) {
    .match-group {
        padding: 5px 14px;
    }

    .input-row {
        grid-template-columns: 1fr 1fr;
    }

    .input-row label {
        text-align: left;
        padding-left: 4px;
    }
}

/* --- レイアウト：子→（PCで父|母） --- */
.match-inputs {
    display: grid;
    gap: 5px;
    grid-template-columns: 1fr;
    /* モバイル：縦並び */
    grid-template-areas:
        "child"
        "father"
        "mother"
        "noble";
}

/* 子/父/母のエリア割り当て（順番が子→父→母である前提） */
.match-inputs .match-group:nth-of-type(1) {
    grid-area: father;
}

.match-inputs .match-group:nth-of-type(2) {
    grid-area: mother;
}

.match-inputs .match-group:nth-of-type(3) {
    grid-area: noble;
}

/* PCで子は横幅いっぱい、下段で父|母を2カラム */
@media (min-width: 960px) {
    .match-inputs {
        grid-template-columns: 1fr;
        grid-template-areas:
            "father mother"
            "noble  noble";
        align-items: stretch;
        padding: 5px 16px;
        gap: 28px;
    }

    .match-inputs .match-group {
        height: 100%;
    }

    /* カードを等高に */
}

/* ラベルと入力欄の調整 */
.match-group label {
    font-size: 13px;
    color: var(--muted);
    min-width: 50px;
    text-align: right;
}

.match-group .input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.match-group input[type="text"] {
    flex: 1;
    max-width: 280px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-elev);
    color: var(--text);
    font-size: 14px;
    transition: border-color 0.2s;
}

@media (max-width: 768px) {
    .match-group input[type="text"] {
        height: 28px;
    }
}

.match-group input[type="text"]:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 6px rgba(68, 214, 44, 0.25);
}

/* 共通秘伝ブロック */
.secret-group {
    margin-top: 16px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: color-mix(in srgb, var(--bg-elev) 92%, var(--accent) 4%);
}

.secret-group h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.number-input {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.number-input label {
    font-size: 13px;
    color: var(--muted);
    min-width: 90px;
}

.number-input input[type="number"] {
    width: 70px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-elev);
    color: var(--text);
    font-size: 14px;
    padding: 4px;
}

.number-input button {
    width: 28px;
    height: 28px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: color-mix(in srgb, var(--accent) 80%, transparent);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    user-select: none;
}

.number-input button:hover {
    background: var(--accent);
    box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 60%, transparent);
}

/* =========================================
   ノーブル秘伝（テーマ統一・ライト/ダーク両対応）
========================================= */
.noble-secret {
    margin-top: 5px;
}

.noble-secret h4 {
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: 700;
}

.noble-grid {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.noble-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    /* ← ラベル+セレクトを1ブロックにする前提 */
    gap: 10px;
}

.noble-pair {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.noble-pair label {
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

.noble-select {
    width: 100%;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    transition: border-color 0.2s, background 0.2s;
}

.noble-select:hover {
    border-color: var(--accent);
}

.noble-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}

@media (min-width: 561px) {
    .noble-row {
        grid-template-columns: repeat(3, 1fr);
        /* PCでは2行×3ペア構成 */
    }
}

/* =========================================
    出力カード
========================================= */

/* ===== 結果グリッド ===== */
.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    justify-items: center;
    margin: 12px auto;
    max-width: 1080px;
    width: 100%;
    padding: 0 8px;
}

/* ===== 各カード ===== */
.result-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 3px 0px;
    width: 100%;
    max-width: 165px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform var(--speed) ease, box-shadow var(--speed) ease, border-color var(--speed);
}

.result-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 8px rgba(68, 214, 44, 0.4);
    border-color: var(--accent);
}

/* ===== カード内要素 ===== */
.result-card img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    border-radius: 8px;
    background: var(--bg);
}

.result-card .rank {
    width: 30px;
    height: 30px;
    object-fit: contain;
    vertical-align: bottom;
    background: none;
}

.result-card .monster-name {
    font-size: 0.65em;
    color: var(--text);
    line-height: 1.25;
}

.result-card .monster-value {
    font-weight: bold;
    color: var(--muted);
    font-size: 0.65em;
}

/* ===== レスポンシブ調整 ===== */
@media (max-width: 900px) {
    .result-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 6px;
    }
}

@media (max-width: 600px) {
    .result-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 5px;
    }

    .result-card img {
        width: 50px;
        height: 50px;
    }

    .result-card .rank {
        width: 15px;
        height: 15px;
    }
}

/* ============================================
   タイラント表ビュー（テーブル）専用スタイル
============================================ */
.result-table-wrapper {
    width: 100%;
    max-width: 960px;
    /* ← PCで伸びないように */
    margin: 0 auto;
    /* 中央寄せ */
    padding: 6px 0;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

/* ヘッダー */
.result-table thead th {
    background: linear-gradient(180deg,
            color-mix(in srgb, var(--accent) 12%, transparent),
            color-mix(in srgb, var(--bg-elev) 90%, transparent));
    padding: 12px 10px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    text-align: left;
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.03em;
}

/* ボディ */
.result-table tbody td {
    padding: 10px 12px;
    font-size: 14px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

/* ランク画像 */
.result-table td img.rank {
    width: 20px;
    height: 20px;
    display: block;
}

/* 交互ライン */
.result-table tbody tr:nth-child(even) {
    background: color-mix(in srgb, var(--accent) 5%, var(--bg-elev) 95%);
}

/* ホバー */
.result-table tbody tr:hover {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    transition: background 0.15s ease;
}

/* スマホ最適化 */
@media (max-width: 560px) {
    .result-table-wrapper {
        padding: 4px 0;
        max-width: 100%;
        /* ← スマホは全幅でOK */
    }

    .result-table thead th {
        font-size: 13px;
        padding: 10px 8px;
    }

    .result-table tbody td {
        font-size: 13px;
        padding: 8px 8px;
    }

    .result-table td img.rank {
        width: 18px;
        height: 18px;
    }
}

/* ===== フィルタボタン ===== */
.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.btn-filter {
    background: var(--bg-elev);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background var(--speed), color var(--speed), border-color var(--speed);
}

.btn-filter:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-filter.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

/* =========================================================
   出力モード切替
========================================================= */
.output-mode-group {
    position: fixed;
    right: 20px;
    bottom: 84px;
    z-index: 2000;
    background: var(--bg-elev);
    border-radius: 12px;
    padding: 10px 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* ==== 枠の光がぐるっと回る ==== */
.output-mode-group::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 0.8px;
    background: linear-gradient(90deg,
            transparent,
            color-mix(in srgb, var(--accent) 80%, transparent),
            transparent);
    background-size: 300% 300%;
    animation: border-glow 4s linear infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

@keyframes border-glow {
    0% {
        background-position: 0% 0%;
    }

    25% {
        background-position: 100% 0%;
    }

    50% {
        background-position: 100% 100%;
    }

    75% {
        background-position: 0% 100%;
    }

    100% {
        background-position: 0% 0%;
    }
}

/* hoverやタップで少し強調 */
.output-mode-group:hover {
    opacity: 1;
}

.output-mode-group {
    background: color-mix(in srgb, var(--bg-elev) 95%, transparent);
}


/* スマホ用：下部中央に縮小配置 */
@media (max-width: 768px) {
    .output-mode-group {
        position: static;
        /* ← 追従やめる */
        right: auto;
        bottom: auto;
        transform: none;
        width: 100%;
        margin: 16px auto;
        border-radius: 8px;
    }
}


.output-mode-group h3 {
    margin-bottom: 0.2em;
    color: var(--text);
    text-align: center;
}

.output-mode-controls {
    display: flex;
    justify-content: center;
    gap: 1em;
    flex-wrap: wrap;
}

.output-btn {
    padding: 0.6em 1.2em;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    transition: background var(--speed), color var(--speed), border var(--speed), box-shadow var(--speed);
    min-width: 110px;
}

.output-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.output-btn[aria-pressed="true"] {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 0 10px rgba(68, 214, 44, 0.5);
}

.mode-note {
    margin-top: 0.8em;
    font-size: 0.85em;
    color: var(--muted);
    text-align: center;
}

/* スマホ対応 */
@media (max-width: 640px) {
    .output-mode-controls {
        gap: 0.6em;
    }

    .output-btn {
        flex: 1 1 45%;
        min-width: 120px;
    }
}

.result-controls {
    padding: 10px 0;
    text-align: center;
}

/* ===============================
   タイラント実行ボタン スタイル
=============================== */
.tyrant-action {
    margin: 2em 0;
    text-align: center;
}

.tyrant-action .btn-main {
    appearance: none;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 0.8em 2em;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition:
        background var(--speed),
        box-shadow var(--speed),
        transform var(--speed);
    box-shadow: 0 0 12px rgba(68, 214, 44, 0.25);
    pointer-events: auto;
    z-index: 10;
}

.tyrant-action .btn-main:hover {
    background: #3ac427;
    box-shadow: 0 0 20px rgba(68, 214, 44, 0.55);
    transform: translateY(-2px);
}

.tyrant-action .btn-main:active {
    background: #33a722;
    transform: translateY(0);
    box-shadow: 0 0 8px rgba(68, 214, 44, 0.3);
}

/* ダークテーマでも馴染む発光 */
[data-theme="dark"] .tyrant-action .btn-main {
    color: #fff;
    background: var(--accent);
    box-shadow: 0 0 10px rgba(68, 214, 44, 0.35);
}

/* スマホサイズ調整 */
@media (max-width: 640px) {
    .tyrant-action .btn-main {
        width: 85%;
        font-size: 0.95rem;
        padding: 0.9em 0;
    }
}


/* ============================================
   出力形式切替（カード / テーブル）
============================================ */
.view-mode {
    display: flex;
    justify-content: center;
    /* ← 中央寄せ */
    gap: 10px;
    margin: 0px;
}

.view-mode label {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-elev);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    user-select: none;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.18s ease;
}

.view-mode input[type="radio"] {
    display: none;
}

/* 選択時 */
.view-mode label:has(input[type="radio"]:checked) {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    box-shadow: 0 0 12px rgba(68, 214, 44, .25);
    font-weight: 700;
}

/* ホバー */
.view-mode label:hover {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(68, 214, 44, .18);
}

/* スマホ最適化（幅が狭い時の余白調整） */
@media (max-width: 560px) {
    .view-mode {
        gap: 8px;
        margin: 10px 0 4px;
    }

    .view-mode label {
        padding: 7px 12px;
        font-size: 13px;
    }
}


/* ================================
   タブ切り替え（Tyrant 両親/片親 ver）
================================ */
.tab_area {
    margin: 15px;
}

/* ラジオボタンは隠す */
.tab_area input[type="radio"] {
    display: none;
}

/* タブ共通 */
.tab_area .tab_class {
    padding: 10px 50px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid var(--border);
    color: var(--muted);
    background: color-mix(in srgb, var(--bg-elev) 85%, transparent);
    transition: all 0.2s ease;
}

/* hover */
.tab_area .tab_class:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 8px rgba(68, 214, 44, 0.25);
}

/* ================================
   ★ 選択中のタブを強調
   → #tab1:checked + a という並びを利用
================================ */
#tab1:checked+.tab_class,
#tab2:checked+.tab_class {
    color: var(--accent);
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, var(--bg-elev));
    box-shadow: 0 0 10px rgba(68, 214, 44, 0.25),
        inset 0 0 16px rgba(68, 214, 44, 0.15);
}