/* =====================================
   styles/cards.css
   いきものマスター
   カード図鑑デザイン
===================================== */


/* =====================================
   図鑑ページ全体
===================================== */

.encyclopedia-page {
    width: 100%;
    min-height: 100%;
    box-sizing: border-box;
    padding: 18px 14px 110px;
}


/* =====================================
   図鑑ヘッダー
===================================== */

.encyclopedia-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.encyclopedia-header h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1.3;
}

.encyclopedia-header p {
    margin: 5px 0 0;
    font-size: 13px;
    color: #666;
}

.encyclopedia-count {
    flex-shrink: 0;
    min-width: 82px;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    text-align: center;
}

.encyclopedia-count strong {
    display: inline-block;
    font-size: 24px;
    line-height: 1;
}

.encyclopedia-count span {
    font-size: 13px;
    color: #777;
}


/* =====================================
   検索・絞り込み
===================================== */

.encyclopedia-search-area {
    display: grid;
    grid-template-columns: 1fr 120px;
    gap: 10px;
    margin-bottom: 18px;
}

.encyclopedia-search,
.encyclopedia-filter {
    width: 100%;
    min-height: 44px;
    box-sizing: border-box;
    border: 2px solid rgba(80, 100, 80, 0.2);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.95);
    font-size: 15px;
    outline: none;
}

.encyclopedia-search {
    padding: 0 14px;
}

.encyclopedia-filter {
    padding: 0 10px;
}

.encyclopedia-search:focus,
.encyclopedia-filter:focus {
    border-color: #66a85c;
}


/* =====================================
   図鑑カード一覧
===================================== */

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.catalog-empty {
    grid-column: 1 / -1;
    padding: 40px 20px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.9);
    color: #777;
    text-align: center;
}


/* =====================================
   図鑑カード
===================================== */

.catalog-card {
    position: relative;
    width: 100%;
    min-width: 0;
    padding: 8px;
    border: none;
    border-radius: 18px;
    background: linear-gradient(
        145deg,
        #fffdf4,
        #e9e4cd
    );
    box-shadow:
        0 5px 12px rgba(0, 0, 0, 0.18),
        inset 0 0 0 2px rgba(255, 255, 255, 0.55);
    color: #222;
    cursor: pointer;
    overflow: hidden;
    text-align: left;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.catalog-card:active {
    transform: scale(0.97);
}

.catalog-card.found {
    background: linear-gradient(
        145deg,
        #fff8d6,
        #e9c96f
    );
}

.catalog-card.unknown {
    background: linear-gradient(
        145deg,
        #777,
        #343434
    );
    color: white;
}


/* =====================================
   カード番号
===================================== */

.catalog-no {
    margin-bottom: 6px;
    padding-left: 2px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.4px;
}


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

.catalog-card-image,
.catalog-image {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 13px;
    background: #ddd;
    overflow: hidden;
    box-shadow:
        inset 0 0 0 2px rgba(0, 0, 0, 0.15);
}

.catalog-card-image img,
.catalog-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* =====================================
   未発見カード
===================================== */

.card-back,
.catalog-card-back {
    display: flex;
    width: 100%;
    height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background:
        radial-gradient(
            circle at center,
            rgba(255, 255, 255, 0.15),
            transparent 45%
        ),
        repeating-linear-gradient(
            45deg,
            #474747,
            #474747 10px,
            #3b3b3b 10px,
            #3b3b3b 20px
        );
    color: white;
}

.card-back span,
.catalog-card-back-symbol {
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    border: 3px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.22);
    font-size: 38px;
    font-weight: 900;
    line-height: 1;
}

.catalog-card-back-text {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 2px;
}


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

.catalog-name {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 4px 4px;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.25;
    text-align: center;
    word-break: break-word;
}


/* =====================================
   カード下部
===================================== */

.catalog-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 4px 2px 1px;
}

.catalog-category,
.catalog-rarity {
    display: inline-flex;
    min-height: 23px;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: #333;
    font-size: 11px;
    font-weight: 800;
}

.catalog-card.unknown .catalog-category,
.catalog-card.unknown .catalog-rarity {
    background: rgba(255, 255, 255, 0.14);
    color: white;
}


/* =====================================
   保有数
===================================== */

.catalog-owned-count {
    position: absolute;
    top: 8px;
    right: 8px;
    min-width: 31px;
    padding: 4px 7px;
    border-radius: 999px;
    background: #222;
    color: white;
    font-size: 12px;
    font-weight: 900;
    text-align: center;
}


/* =====================================
   詳細画面の背景
===================================== */

.catalog-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding:
        calc(22px + env(safe-area-inset-top))
        14px
        calc(30px + env(safe-area-inset-bottom));
    background: rgba(0, 0, 0, 0.7);
    overflow-y: auto;
    box-sizing: border-box;
}


/* =====================================
   詳細画面本体
===================================== */

.catalog-detail {
    position: relative;
    width: min(100%, 480px);
    margin: auto;
    padding: 22px 16px 28px;
    border-radius: 24px;
    background: #fffdf4;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.38);
    box-sizing: border-box;
}

.catalog-detail h2 {
    margin: 16px 0 10px;
    font-size: 25px;
    line-height: 1.25;
    text-align: center;
}

.catalog-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: rgba(20, 20, 20, 0.85);
    color: white;
    font-size: 20px;
    font-weight: 900;
    cursor: pointer;
}

.detail-number {
    padding-right: 44px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 900;
}


/* =====================================
   詳細画面の大きなカード
===================================== */

.detail-main-card,
.catalog-detail-card {
    width: min(82%, 310px);
    margin: 0 auto;
    padding: 8px;
    border-radius: 20px;
    background: linear-gradient(
        145deg,
        #fff2ad,
        #d3a83c
    );
    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.25),
        inset 0 0 0 3px rgba(255, 255, 255, 0.5);
}

.detail-main-card img,
.catalog-detail-card-image {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 14px;
    object-fit: cover;
    background: #ddd;
}


/* =====================================
   詳細画面タグ
===================================== */

.catalog-detail-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
    margin-bottom: 20px;
}

.catalog-detail-tags span {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    padding: 3px 11px;
    border-radius: 999px;
    background: #e6f2df;
    color: #355b31;
    font-size: 13px;
    font-weight: 800;
}


/* =====================================
   リアル写真
===================================== */

.catalog-real-photo {
    margin-top: 22px;
}

.catalog-real-photo h3 {
    margin: 0 0 9px;
    font-size: 17px;
}

.catalog-detail-image {
    display: block;
    width: 100%;
    max-height: 330px;
    border-radius: 17px;
    object-fit: cover;
    background: #ddd;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.15);
}


/* =====================================
   説明
===================================== */

.catalog-description {
    margin-top: 18px;
    padding: 15px;
    border-radius: 15px;
    background: #f1eee1;
    font-size: 15px;
    line-height: 1.75;
}


/* =====================================
   詳細情報
===================================== */

.catalog-detail-info {
    margin-top: 17px;
    border-radius: 16px;
    background: white;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.catalog-detail-info p {
    display: grid;
    grid-template-columns: 95px 1fr;
    gap: 10px;
    margin: 0;
    padding: 12px 14px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.catalog-detail-info p:last-child {
    border-bottom: none;
}

.catalog-detail-info strong {
    color: #4b6846;
}

.catalog-detail-info span {
    min-width: 0;
    word-break: break-word;
}


/* =====================================
   未発見の詳細
===================================== */

.unknown-detail {
    text-align: center;
}

.detail-card-back,
.detail-unknown-card {
    display: flex;
    width: min(78%, 280px);
    aspect-ratio: 3 / 4;
    margin: 0 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 13px;
    border: 7px solid #666;
    border-radius: 20px;
    background:
        radial-gradient(
            circle at center,
            rgba(255, 255, 255, 0.13),
            transparent 46%
        ),
        repeating-linear-gradient(
            45deg,
            #454545,
            #454545 12px,
            #353535 12px,
            #353535 24px
        );
    color: white;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
}

.detail-card-question,
.detail-unknown-card .catalog-card-back-symbol {
    display: grid;
    width: 90px;
    height: 90px;
    place-items: center;
    border: 4px solid rgba(255, 255, 255, 0.82);
    border-radius: 50%;
    font-size: 56px;
    font-weight: 900;
}

.detail-card-unknown,
.detail-unknown-card .catalog-card-back-text {
    font-size: 16px;
    font-weight: 900;
    letter-spacing: 3px;
}

.unknown-message {
    margin: 14px 0 6px;
    font-weight: 800;
}

.unknown-hint {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}


/* =====================================
   画面幅が広いとき
===================================== */

@media (min-width: 620px) {

    .catalog-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

}


/* =====================================
   小さいスマホ
===================================== */

@media (max-width: 370px) {

    .encyclopedia-page {
        padding-left: 10px;
        padding-right: 10px;
    }

    .encyclopedia-search-area {
        grid-template-columns: 1fr;
    }

    .catalog-grid {
        gap: 9px;
    }

    .catalog-card {
        padding: 6px;
    }

    .catalog-name {
        font-size: 12px;
    }

}