body {
    background: radial-gradient(ellipse at top,
            #352047,
            #100b19 70%);
    background-attachment: fixed;
    color: #e8d9b5;
    font-family: "Yu Gothic", sans-serif;
    text-align: center;
    min-height: 100vh;
    margin: 0;
  padding: 10px;
    box-sizing: border-box;
}

h1 {
    color: #e5c47e;
    font-size: 40px;
    letter-spacing: 5px;
    text-shadow: 0 0 15px #a67c35;
    margin: 10px 0;
}

h2 {
    color: #e5c47e;
}

button {
    background: linear-gradient(#49305e, #21152f);
    color: #e5c47e;
    border: 1px solid #c9a45c;
    border-radius: 6px;
padding: 8px 24px;
    margin: 5px;
    font-size: 18px;
    cursor: pointer;
}

button:hover {
    background: #604079;
    box-shadow: 0 0 15px #c9a45c;
}

button:disabled {
    opacity: 0.5;
    cursor: default;
}

#cards {
    display: flex;
    justify-content: center;
    gap: 15px;
  margin: 5px 0;
}

#result {
    color: #e5c47e;
    font-size: 22px;
    margin: 8px 0;
}

#characterImage {
    width: auto !important;
    height: auto;
    max-width: 95%;
    max-height: 36vh;
    object-fit: contain;
    margin-top: 20px;
    border: 2px solid #c9a45c;
    border-radius: 8px;
    box-shadow: 0 0 25px #634780;
}
#collection {
    justify-content: center;
}

progress {
    accent-color: #c9a45c;
}

#cards span {
    box-sizing: border-box;
    border: 2px solid #c9a45c !important;
    border-radius: 5px;
    box-shadow: 0 0 8px rgba(201, 164, 92, 0.4);
}

/* 魔導書の召喚演出 */

#grimoire {
    margin: 40px auto;
    perspective: 1000px;
}

#grimoire[hidden] {
    display: none;
}

.book {
    position: relative;
    width: 320px;
    max-width: 90%;
    height: 220px;
    margin: auto;
    transform-style: preserve-3d;
    filter: drop-shadow(0 0 15px #c9a45c);
}

.book-base {
    position: absolute;
    inset: 0;
    background: #382019;
    border: 3px solid #c9a45c;
    border-radius: 8px;
}

.book-paper {
    position: absolute;
    inset: 8px;
    background: linear-gradient(90deg,
            #c9ae7b,
            #f5e6c2 46%,
            #94734b 50%,
            #f5e6c2 54%,
            #c9ae7b);
    border-radius: 4px;
}

#bookCover {
    position: absolute;
    top: 0;
    left: 50%;
    width: 50%;
    height: 100%;
    box-sizing: border-box;
    background: linear-gradient(135deg, #58352b, #21130f);
    border: 4px double #c9a45c;
    border-radius: 5px;
    color: #e5c47e;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transform-origin: left center;
    transform-style: preserve-3d;
    transition: transform 0.8s ease-in-out;
}

#bookCover span {
    font-size: 36px;
}

#bookCover p {
    font-size: 16px;
    letter-spacing: 3px;
}

#bookCover.open {
    transform: rotateY(-180deg);
}

.book-page {
    position: absolute;
    top: 8px;
    left: 50%;
    width: calc(50% - 8px);
    height: calc(100% - 16px);
    box-sizing: border-box;
    background: repeating-linear-gradient(#f5e6c2 0px,
            #f5e6c2 14px,
            #bba47a 15px,
            #f5e6c2 16px);
    border: 1px solid #bba47a;
    transform-origin: left center;
    animation: turnPage 0.35s ease-in-out forwards;
}

@keyframes turnPage {
    from {
        transform: rotateY(0deg);
    }

    to {
        transform: rotateY(-180deg);
    }
}

/* 画像版の魔導書 */

#grimoire {
    margin: 20px auto 0;
    width: auto;
    max-width: 95%;
}

#grimoireImage {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 36vh;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 0 30px #a855f7;
}

/* スマートフォン対応 */

#rotateNotice {
    display: none;
}



@media (pointer: coarse) {
    body {
        padding: 8px;
    }

    h1 {
        font-size: 20px;
        margin: 5px 0;
    }

    button {
        padding: 8px 16px;
        font-size: 14px;
    }


    #cards {
        gap: 8px;
        margin: 10px 0;
    }

    #cards img,
    #cards span {
        width: 60px !important;
        height: 90px !important;
    }

    #result {
        font-size: 16px;
        margin: 8px 0;
    }

    #characterImage,
    #grimoire {
        width: 95%;
        max-width: 95%;
    }
}
/* 魔導書のスマホ表示 */
@media (pointer: coarse) {
    #collection {
        gap: 15px;
    }

    #collection > div {
        width: 100% !important;
        max-width: 400px;
    }

    #collection img {
        max-width: 100%;
        height: auto;
    }

    progress {
        max-width: 90%;
    }

    #rarityFilter button {
        padding: 6px 10px;
        margin: 3px;
    }
}

@media (orientation: landscape) and (pointer: coarse) {
    #collection > div {
        width: 45% !important;
    }
}