header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid black;
    padding: 10px 20px;
    min-width: 550px;
}

.logo-area {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-area img {
    height: clamp(35px, 4vw, 50px);
}

.site-name {
    font-size: clamp(15px, 3vw, 24px);
    font-weight: bold;
    margin-left: 10px;
    color: black;
    text-decoration: none;
}

.paw {
    font-size: clamp(15px, 3vw, 24px);
    margin-left: 5px;
}

nav a {
    margin-left: 20px;
    text-decoration: none;
    color: black;
    font-weight: bold;
}

.nav-link {
    margin-left: clamp(10px, 2vw, 20px);
    font-size: clamp(14px, 2vw, 20px);
    text-decoration: none;
    color: black;
    font-weight: bold;
}

.sns-links {
    margin-left: clamp(10px, 2vw, 40px);
    display: flex;
    flex-direction: row;
}

.sns-links img {
    width: clamp(20px, 3vw, 30px);
    height: clamp(20px, 3vw, 30px);
    margin: auto 5px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.sns-links img:hover {
    transform: scale(1.1);
}


body {
    font-family: sans-serif;
    text-align: center;
    background: #fff;
    margin: 0;
    position: relative; /* 追加 */
    overflow: auto;
}

.screen {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-evenly;
    position: absolute;     /* 重ねる */
    top: 80px;
    left: 50%;                     /* 親の50%位置に左端を置く */
    transform: translateX(-50%);   /* 自分の幅の半分だけ左に戻す */
    width: 100%;
    height: 100%;    
    background: white;      /* 下の画面が透けないように */
    z-index: 1;
    opacity: 1;    
    transition: opacity 0.3s ease;
    pointer-events: auto;
}

.title-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.vert-ads-region1 {
    display: flex;
    flex-direction: column;
    width: 300px;
    height: 600px;
    margin-top: 20px;
    /* border: solid 1px red; */
}

.vert-ads-region2 {
    display: flex;
    flex-direction: column;
    width: 300px;
    height: 600px;
    margin-top: 20px;
    /* border: solid 1px red; */
}


.square-ads-container1 {
    display: none;
}

.square-ads-container2,
.square-ads-container3 {
    display: flex;
    margin-top: 50px;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.square-ads-region1,
.square-ads-region2 {
    display: none;
}

.square-ads-region3,
.square-ads-region4,
.square-ads-region5 {
    display: block;
    width: 300px;
    height: 250px;
    /* border: solid 1px red; */
}

.square-ads-region6,
.square-ads-region7,
.square-ads-region8 {
    display: none;
}

.hidden {
    opacity: 0;
    pointer-events: none;
}

button {
    font-size: 24px;
    font-weight: bold;
    margin: 10px;
    padding: 10px 0;
    width: clamp(150px, 30vw, 220px);
    background-color: white;
    border: solid 4px black;
    border-radius: 15px;
}

button:hover {
    cursor: pointer;
    transform: scale(1.1);
}

.stage-options {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 20px;
}

.stage-options2 {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
}

.hp-bar {
    margin: 20px;
    font-size: 1.2em;
}

.enemy {
    margin: 20px;
}

.dog {
    font-size: 4em;
}

.title-logo {
    margin: 20px;
    position: relative;
    width: clamp(350px, 60vw, 450px);
    height: auto;
}

.stage-button {
    width: 150px;
    height: 200px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border: none;
    cursor: pointer;
    font-size: 0;
    /* テキスト非表示 */
}

.stage-select-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.stage-button[data-stage="easy"] {
    background-image: url("./image/stage1.png");
}

.stage-button[data-stage="normal"] {
    background-image: url("./image/stage2.png");
}

.stage-button[data-stage="hard"] {
    background-image: url("./image/stage3.png");
}

.stage-button[data-stage="extreme"] {
    background-image: url("./image/stage4.png");
}

.clear-label {
    margin-top: 80px;
    margin-bottom: 50px;
    width: clamp(400px,80vw,600px);
}

.clear-dog {
    width: 100px;
    margin-bottom: 50px;
}

.dog-container {
    position: relative;
    width: clamp(150px,20vw,200px);
    /* border: solid 1px red;     */
    margin: 10px auto;
}

.dog-back {
    width: clamp(150px,20vw,200px);
}

.hp-bar-container {
    font-size: 20px;
    font-weight: bold;
    width: clamp(150px, 30vw,350px);
    height: clamp(40px,5vw,70px);
    margin: 10px auto;
    border: solid 4px black;
    border-radius: 12px;
    padding: 30px;    
    text-align: left;
}

.hp-bar-outer {
    width: 100%;
    height: clamp(20px,3vw,30px);
    background-color: #ddd;
    border: 1px solid #555;
    border-radius: 4px;
    overflow: hidden;
}

.hp-bar-inner {
    height: 100%;
    width: 100%;
    /* 初期は最大 */
    background-color: gray;
    transition: width 0.3s, background-color 0.3s;
}

.enemy-side {
    display: flex;
    flex-direction: row;
    width: clamp(500px,90vw,800px);
    justify-content: center;
    align-items: center;
    margin-top: 50px;
    /* border: solid 1px black; */
}

.dog-side {
    display: flex;
    flex-direction: row;
    width: clamp(500px,90vw,800px);
    justify-content: center;
    align-items: center;
    margin-top: clamp(100px, 10vw, 150px);
    /* border: solid 1px black; */
}

.enemy-image-container {
    /* border: solid 1px red; */
    position: relative;
    width: clamp(150px,20vw,200px);
    /* 必要に応じて調整 */
    height: auto;
    margin: 10px auto;
}

.enemy-image-container img {
    width: 100%;
    height: auto;
    display: block;
}

.enemy-number-overlay {
    position: absolute;
    top: 50%;
    /* 上から10%の位置 */
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 1.5em;
    font-weight: bold;
    color: black;
}

.extreme-enemy-number {
    color: white;
}

.answer-input {
    font-size: clamp(22px,2vw,32px);
    font-weight: bold;
    border: solid 4px black;
    border-radius: 12px;
    height: clamp(100px,10vw,150px);
    padding-left: 10px;
    width: clamp(500px,80vw,790px);
}

.hp-container img {
    width: clamp(20px,4vw,40px);
    height: auto;
    transition: opacity 0.3s;
}

.enemy-icons-container {
    display: flex;
    justify-content: flex-start;    
    align-items: center;
    margin-top: 10px;
}

#enemy-image {
    transition: opacity 0.5s, transform 0.5s;
}

.enemy-fade-out {
    opacity: 0;
    /* transform: translateX(0); */
    transition: opacity 0.5s;
}

.enemy-fade-in {
    opacity: 0;
    /* transform: translateX(0); */
    transition: opacity 0.5s, transform 0.5s;
}

.enemy-visible {
    opacity: 1;
    /* transform: translateX(0); */
    transition: opacity 0.5s, transform 0.5s;
}

.shoot-number {
    position: absolute;
    font-size: 32px;
    font-weight: bold;
    color: black;
    pointer-events: none;
    transition: transform 0.5s linear, opacity 0.2s;
    z-index: 1000;
}

.hit-flash {
    animation: flash 0.1s ease-in-out 0s 3;
    /* 3回点滅 */
}

@keyframes flash {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.2;
    }
}

.enemy-attack-ball {
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border: solid 4px black;
    border-radius: 50%;
    transition: transform 1s linear;
    z-index: 10;
}

.field-ellipse {
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: clamp(150px,25vw,200px);
    height: clamp(40px,9vw,55px);
    border: 3px solid black;
    border-radius: 50%;
    pointer-events: none;
    z-index: -10;
}

.field-ellipse2 {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    width: clamp(200px,30vw,280px);
    height: clamp(60px,12vw,70px);
    border: 3px solid black;
    border-radius: 50%;
    pointer-events: none;
    z-index: -10;
}

.howto-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* flex-wrap: wrap; */
    gap: 10px;
    max-width: 900px;
    margin: 20px 0;
    text-align: left;
}

.howto-block {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    max-width: 900px;
}

.howto-img {
    width: clamp(250px, 26vw, 300px);
    height: auto;
    flex-shrink: 0;
}

.howto-text {
    font-size: clamp(14px, 2vw, 18px);
    font-weight: 600;
    line-height: 1.5;
    max-width: 400px;
}

.audio-settings {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.audio-settings div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.audio-settings input[type="range"] {
    width: 150px;
}

#prime-input.cooldown {
    background-color: rgb(170, 170, 170);
    /* 灰色 */
    /* color: #ccc; */
}

.prime-list {
    font-size: 22px;
    font-weight: bold;
    text-align: center;
    margin-top: 20px;
    line-height: 1.5;
}

.prime-list p {
    margin: 5px 0;
}

.link-to-pf {
    font-size: 24px;
    font-weight: bold;
    margin: 10px;
    padding: 10px 0;
    width: clamp(350px,60vw,500px);
    color: black;
    background-color: white;
    border: solid 4px black;
    border-radius: 15px;
    text-decoration: none;
}

.link-to-pf:hover {
    transform: scale(1.1);
}

.result-section-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.gameover-section-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

@media (max-width: 1450px) {
    .vert-ads-region2 {
        display: none;
    }
    .square-ads-region6,
    .square-ads-region7,
    .square-ads-region8 {
        display: block;
        width: 300px;
        height: 250px;
        /* border: solid 1px red; */
    }
}

@media (max-width: 1200px) {
    .screen {
        flex-direction: column;
        align-items: center;
    }

    .vert-ads-region1 {
        display: none;
    }

    .square-ads-container1 {
        display: flex;
        margin-top: 50px;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 20px;
    }

    .square-ads-region1,
    .square-ads-region2 {
        display: block;
        width: 300px;
        height: 250px;
        /* border: solid 1px red; */
    }
}

@media (max-width: 950px) {
    .square-ads-region5 {
        display: none;
    }
}

@media (max-width: 850px) {
    .square-ads-region8 {
        display: none;
    }
}

@media (max-width: 750px) {
    .stage-options {
        display: none;
    }

    .stage-options2 {
        display: flex;
    }    
}

@media (max-width: 600px) {
    .square-ads-region2,
    .square-ads-region4,
    .square-ads-region8 {
        display: none;
    }
}