/* ====== 基本（元のモバイル前提スタイル） ====== */
html {
    -ms-touch-action: none;
}

body,
canvas,
div {
    display: block;
    outline: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    -khtml-user-select: none;
}

/* Remove spin of input type number */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    /* display: none; <- Crashes Chrome on hover */
    -webkit-appearance: none;
    margin: 0;
    /* <-- Apparently some margin are still there even though it's hidden */
}

body {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    margin: 0;
    cursor: default;
    color: #888;
    background-color: #333;
    text-align: center;
    font-family: Helvetica, Verdana, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    /* fix bug: https://github.com/cocos-creator/2d-tasks/issues/791 */
    /* overflow cannot be applied in Cocos2dGameContainer, 
       otherwise child elements will be hidden when Cocos2dGameContainer rotated 90 deg */
    overflow: hidden; /* ← モバイルでは全画面固定。PCでは後で上書き */
}

#Cocos2dGameContainer {
    position: absolute;
    margin: 0;
    left: 0px;
    top: 0px;
    display: -webkit-box;
    -webkit-box-orient: horizontal;
    -webkit-box-align: center;
    -webkit-box-pack: center;
}

canvas {
    background-color: rgba(0, 0, 0, 0);
}

a:link,
a:visited { color: #666; }

a:active,
a:hover { color: #666; }

p.header { font-size: small; }
p.footer { font-size: x-small; }

#splash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff url(./singleColor.png) no-repeat center;
    background-size: 100%;
}

.progress-bar {
    background-color: #1a1a1a;
    position: absolute;
    left: 25%;
    top: 80%;
    height: 15px;
    padding: 5px;
    width: 50%;
    border-radius: 5px;
    box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444;
}

.progress-bar span {
    display: block;
    height: 100%;
    border-radius: 3px;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset;
    transition: width .4s ease-in-out;
    background-color: #34c2e3;
}

.stripes span {
    background-size: 30px 30px;
    background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
    animation: animate-stripes 1s linear infinite;
}

@keyframes animate-stripes {
    0%   { background-position: 0 0; }
    100% { background-position: 60px 0; }
}

/* ====== ここから“PC/ブラウザ対応”の追記（後勝ち） ====== */

/* 高さ計算の事故を防ぐために明示 */
html, body { height: 100%; }

/* 今回のHTMLに合わせたレイアウト（#canvasDiv / #GameCanvas） */
#canvasDiv {
  position: relative;
  width: 100vw;      /* まずは画面いっぱい確保 */
  height: 100vh;
  margin: 0 auto;
}

#GameCanvas {
  display: block;
  width: 100%;
  height: 100%;      /* 高さ0事故を防止（必要になったら後で auto に戻せる） */
  background-color: transparent;
  image-rendering: auto; /* ドット絵なら pixelated も可 */
}

/* スプラッシュがクリックをブロックしないように最適化 */
#splash {
  inset: 0;
  background-size: cover;  /* PCの引き伸ばしに強い */
  pointer-events: none;
}

/* PC幅での見やすさ上書き */
@media (min-width: 900px) {
  body {
    position: static;      /* モバイルの absolute を緩和 */
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;        /* はみ出す場合はスクロール可 */
  }
  #canvasDiv {
    max-width: 1400px;     /* 好みに応じて調整 */
    max-height: 90vh;
  }
}
/* --- PC幅ではキャンバスの縦横比を維持して伸びないようにする --- */
@media (min-width: 900px) {
  #canvasDiv {
    /* 画面内に収める上限（好みで調整） */
    max-width: 1200px;
    max-height: 90vh;
    margin: 0 auto;
  }
  #GameCanvas {
    width: 100%;
    height: auto;     /* ★ここがポイント：高さは自動 → 縦横比維持 */
  }
}