html {
    touch-action: manipulation;
    overscroll-behavior: none;
    touch-action: none;
}
body {
    margin: 0;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 100vh;
    background-color: #222;
}

#player-hp-ui {
    display: none;
    position: absolute;
    top: 5vh;
    left: 5vw;
    color: rgb(255, 255, 255);
    background: rgba(0, 0, 0, 0);
    padding: 10px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 1.5vw;
    text-shadow: 
        -1px -1px 0 #000000,  /* 左上 */
        1px -1px 0 #000000,  /* 右上 */
        -1px  1px 0 #000000,  /* 左下 */
        1px  1px 0 #000000,  /* 右下 */
        -1px  0px 0 #000000,  /* 左 */
        1px  0px 0 #000000,  /* 右 */
        0px -1px 0 #000000,  /* 上 */
        0px  1px 0 #000000;  /* 下 */
    font-family: sans-serif;
}

/* HPバーのスタイル */
#hp-bar {
    width: 16vw;
    height: 3.2vh;
    background: linear-gradient(to right, #444, #222);
    border-radius: 100px;
    border: 1px solid #fff;
    overflow: hidden;
    margin-bottom: 10px;
    position: relative; /* 子要素のabsolute基準点 */
}
/* ダメージ分を表示するオーバーレイ（z-indexをinnerより低く設定） */
#hp-damage-overlay {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%; /* 初期は最大HP */
    background-color: rgba(255, 0, 0, 0.5); /* 赤色で透明度あり */
    z-index: 1; /* innerの下 */
    /* オーバーレイもアニメーションさせる */
    transition: width 0.5s ease-out 0.1s; /* innerより少し遅延させて、なめらかに消えるように */
}
/* HPバー内の進行状況を示す部分 */
#hp-bar-inner {
    height: 100%;
    width: 100%;
    background: linear-gradient(to bottom, #90ee90, #008000); /* 初期は黄緑 */
    border-radius: 0px;
    position: relative;
    z-index: 2; /* オーバーレイの上 */
    transition: width 0.3s ease-out; /* 幅の変更を0.7秒でなめらかに */
}

#hp-text {
    position: absolute;
    bottom: 0;
    right: 3vh;
    font-size: 1.2vw;
    z-index: 3;
}

/* HPバーのスタイル */
.buff-circle {
    width: 3.2vh;
    height: 3.2vh;
    border: 1px solid #fff;
    margin: 0.5vh;
    position: relative; /* 子要素のabsolute基準点 */
    border-radius: 30%;
    background-color: rgb(88, 88, 88);
    overflow: hidden; /* 円の外を隠す */
    display: inline-block;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: rgba(255, 255, 255);
    opacity: 1;
    user-select: none;
    box-shadow: 
        -0.3vh -0.3vh 0 #fbffca81,  /* 左上 */
        0.3vh -0.3vh 0 #fbffca81,  /* 右上 */
        -0.3vh  0.3vh 0 #fbffca81,  /* 左下 */
        0.3vh  0.3vh 0 #fbffca81,  /* 右下 */
        -0.3vh  0px 0 #fbffca81,  /* 左 */
        0.3vh  0px 0 #fbffca81,  /* 右 */
        0px -0.3vh 0 #fbffca81,  /* 上 */
        0px  0.3vh 0 #fbffca81;  /* 下 */
    font-family: sans-serif;
}
.buff-on {
    background: linear-gradient(to bottom, #0073ff, #1100ff); /* 初期は黄緑 */
}
.buff--off {
    background-color: rgb(70, 70, 70);
}

#sp {
    position: relative;
    width: 25.0vh;
    height: 0vh;
    background: rgba(0, 0, 0, 0.6);
    padding: 2vh 0vw;
    border-radius: 100px;
    display: flex; /* Flexboxを有効にする */
    justify-content: center; /* 主軸（横方向）の中央揃え */
    align-items: center; /* 交差軸（縦方向）の中央揃え */
}
.sp-circle {
    width: 2.0vh;
    height: 2.0vh;
    border: 1px solid #fff;
    margin: 0 0.8vh;
    position: relative; /* 子要素のabsolute基準点 */
    border-radius: 50%;
    background-color: rgb(88, 88, 88);
    overflow: hidden; /* 円の外を隠す */
    display: inline-block;
    justify-content: center;
    align-items: center;
    color: rgba(255, 255, 255);
    opacity: 1;
    user-select: none;
    box-shadow: 
        -0.3vh -0.3vh 0 #fbffca81,  /* 左上 */
        0.3vh -0.3vh 0 #fbffca81,  /* 右上 */
        -0.3vh  0.3vh 0 #fbffca81,  /* 左下 */
        0.3vh  0.3vh 0 #fbffca81,  /* 右下 */
        -0.3vh  0px 0 #fbffca81,  /* 左 */
        0.3vh  0px 0 #fbffca81,  /* 右 */
        0px -0.3vh 0 #fbffca81,  /* 上 */
        0px  0.3vh 0 #fbffca81;  /* 下 */
    font-family: sans-serif;
}
.sp-on {
    background: linear-gradient(to bottom, #ffffff, #a2a2a2); /* 初期は黄緑 */
}
.sp-off {
    background-color: rgb(32, 32, 32);
}

#total-actions {
    color: rgb(0, 60, 144);
    background: rgba(0, 0, 0, 0);
    padding: 10px;
    font-weight: bold;
    font-size: 3.2vw;
    text-shadow: 
        -1px -1px 0 #ffffff,  /* 左上 */
        1px -1px 0 #ffffff,  /* 右上 */
        -1px  1px 0 #ffffff,  /* 左下 */
        1px  1px 0 #ffffff,  /* 右下 */
        -1px  0px 0 #ffffff,  /* 左 */
        1px  0px 0 #ffffff,  /* 右 */
        0px -1px 0 #ffffff,  /* 上 */
        0px  1px 0 #ffffff;  /* 下 */
    font-family: sans-serif;
    border-radius: 5px;
}

#enemy-hp-ui {
    display: none;
    position: absolute;
    top: 10vh;
    left: 50%;
    color: rgb(255, 255, 255);
    background: rgba(0, 0, 0, 0);
    padding: 10px;
    font-weight: bold;
    font-size: 1.5vw;
    text-shadow: 
        -1px -1px 0 #000000,  /* 左上 */
        1px -1px 0 #000000,  /* 右上 */
        -1px  1px 0 #000000,  /* 左下 */
        1px  1px 0 #000000,  /* 右下 */
        -1px  0px 0 #000000,  /* 左 */
        1px  0px 0 #000000,  /* 右 */
        0px -1px 0 #000000,  /* 上 */
        0px  1px 0 #000000;  /* 下 */
    font-family: sans-serif;
    border-radius: 5px;
    transform: translate(-50%, -50%);
}

/* HPバーのスタイル */
#enemy-hp-bar {
    width: 40vw;
    height: 3.2vh;
    background: linear-gradient(to right, #444, #222);
    border-radius: 100px;
    border: 1px solid #fff;
    overflow: hidden;
    margin-bottom: 10px;
    position: relative; /* 子要素のabsolute基準点 */
}
/* ダメージ分を表示するオーバーレイ（z-indexをinnerより低く設定） */
#enemy-hp-damage-overlay {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%; /* 初期は最大HP */
    background-color: rgba(255, 0, 0, 0.5); /* 赤色で透明度あり */
    z-index: 1; /* innerの下 */
    /* オーバーレイもアニメーションさせる */
    transition: width 0.5s ease-out 0.1s; /* innerより少し遅延させて、なめらかに消えるように */
}
/* HPバー内の進行状況を示す部分 */
#enemy-hp-bar-inner {
    height: 100%;
    width: 100%;
    background: linear-gradient(to bottom, #90ee90, #008000); /* 初期は黄緑 */
    border-radius: 0px;
    position: relative;
    z-index: 2; /* オーバーレイの上 */
    transition: width 0.3s ease-out; /* 幅の変更を0.7秒でなめらかに */
}

#enemy-hp-text {
    position: absolute;
    bottom: 0;
    right: 3vh;
    font-size: 1.2vw;
    z-index: 3;
}

#damage-ui {
    font-family: "sans-serif";
    display: none;
    position: absolute;
    top: 10vh;
    right: 5vw;
    color: rgb(219, 0, 208);
    background: rgba(0, 0, 0, 0);
    padding: 10px;
    font-weight: bold;
    font-size: 1.6vw;
    text-shadow: 
        -1px -1px 0 #ffffff,  /* 左上 */
        1px -1px 0 #ffffff,  /* 右上 */
        -1px  1px 0 #ffffff,  /* 左下 */
        1px  1px 0 #ffffff,  /* 右下 */
        -1px  0px 0 #ffffff,  /* 左 */
        1px  0px 0 #ffffff,  /* 右 */
        0px -1px 0 #ffffff,  /* 上 */
        0px  1px 0 #ffffff;  /* 下 */
    border-radius: 5px;
}

#total-damage {
    font-family: "Nico Moji";
    font-size: 3.2vw;
}

#enemy-damage-ui {
    font-family: "sans-serif";
    display: none;
    position: absolute;
    top: 22.5vh;
    right: 5vw;
    color: rgb(0, 115, 255);
    background: rgba(0, 0, 0, 0);
    padding: 10px;
    font-weight: bold;
    font-size: 1.6vw;
    text-shadow: 
        -1px -1px 0 #ffffff,  /* 左上 */
        1px -1px 0 #ffffff,  /* 右上 */
        -1px  1px 0 #ffffff,  /* 左下 */
        1px  1px 0 #ffffff,  /* 右下 */
        -1px  0px 0 #ffffff,  /* 左 */
        1px  0px 0 #ffffff,  /* 右 */
        0px -1px 0 #ffffff,  /* 上 */
        0px  1px 0 #ffffff;  /* 下 */
    border-radius: 5px;
}

#enemy-total-damage {
    font-family: "Nico Moji";
    font-size: 3.2vw;
}

#homeScreen {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #000;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    background-image: url("../Picture/BG.png");
    /* または外部URL: background-image: url("https://example.com/photo.jpg"); */
    background-size: cover;        /* 要素いっぱいに拡大（切れることがある） */
    background-position: center;   /* 中央を基点に表示 */
    background-repeat: no-repeat;  /* 繰り返さない */
    background-attachment: fixed;  /* スクロールしても固定（パララックス風） */

}

.gamepad {
    visibility: hidden;
    position: absolute;
    bottom: 15vh;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}
.joystick {
    width: 10vw; /* 画面幅の20% */
    height: 10vw; /* 画面幅の20% */
    left: 10vw;
    background: rgba(170, 170, 170, 0.4);
    border-radius: 50%;
    position: relative;
}
.stick {
    width: 70%;
    height: 70%;
    background: rgb(56, 111, 127);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* 背景画像を挿入 */
.stick img {
    user-select: none;
    /* ベンダープレフィックスを追加すると、より広範囲のブラウザに対応できます */
    -webkit-user-select: none; /* Chrome, Safari, Edge */
    -moz-user-select: none;    /* Firefox */
    -ms-user-select: none;     /* Internet Explorer/Edge */
    /* 画像のドラッグ開始を禁止 */
    -webkit-user-drag: none;
    width: 100%;
    height: 100%;
    object-fit: cover; /* 画像を円いっぱいにフィット */
}

@media screen and (orientation: portrait) {
    body {
        transform: rotate(90deg);
        transform-origin: center center;
        width: 100vh;
        height: 100vw;
        overflow: hidden;
        position: fixed;
        top: 0;
        left: 0;
    }
    .gamepad {
        bottom: 5%;
        left: 5%;
        width: 90%;
        height: 20%;
    }
}

#box {
    right: 15vw;
    width: 50vh;
    height: 50vh;
    border-radius: 50%;
    /* background-color: rgba(128, 128, 128, 0); <--- この行を削除 */
    overflow: hidden; /* 円の外を隠す */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: rgba(255, 255, 255, 0);
    opacity: 0.8;
    user-select: none;
}

/* 背景画像を挿入 */
#box img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 画像を円いっぱいにフィット */
}

#boxImage {
  width: 120px;
  height: 120px;
  transition: transform 0.25s ease, filter 0.25s ease;
}

/* フリック方向ごとの一時アニメーション */
.flick-right {
  transform: translateX(40px) scale(0.5);
}

.flick-left {
  transform: translateX(-40px) scale(0.5);
}

.flick-up {
  transform: translateY(-40px) scale(0.5);
}

.flick-down {
  transform: translateY(40px) scale(0.5);
}

/* 明度アップ */
.brighten {
  filter: brightness(1.5);
}

@media screen and (orientation: portrait) {
    body {
        width: 100vh;
        height: 100vw;
        transform: rotate(90deg);
        transform-origin: center center;
        overflow: hidden;
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) rotate(90deg);
    }
}

/* ボタン共通 */
button {
    margin: 1vh;
    padding: 1vh 1vw;
    font-size: 1.1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: linear-gradient(to bottom, #484848, #969696);
    color: white;
    text-shadow: 1px 1px 2px black;
    box-shadow: 0 4px 6px rgba(0,0,0,0.4);
    transition: 0.2s;
}

/* ホバー＆クリック */
button:hover {
    background: linear-gradient(to bottom, #0f0f0f, #616161);
}
button:active {
    background: linear-gradient(to bottom, #9a9a9a, #e3e3e3);
}

#stop-btn {
    display: none;
    position: absolute;
    top: 2vh;
    right: 2vw;
}

#restart-btn {
    display: none;
    position: absolute;
    top: 2vh;
    right: 2vw;
}