* {
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}
html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}
body {
  margin: 0;
  padding: 0;
  font-family: "Noto Sans JP", sans-serif;
  font-optical-sizing: auto;
  font-weight: 700;
  font-style: normal;
  text-align: center;
  background: #000;
  color: #fff;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  overflow: hidden;
  width: 100%;
  height: 100%;
  touch-action: none;
}
p {
  margin: 0;
  padding: 0;
}
img {
  -webkit-user-drag: none;  /* Safari / iOS */
  pointer-events: none;  /* マウス操作も不可にする場合 */
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
#main-bg,
#game-bg_effect,
.character-intro,
.charatext-intro,
#countdownImage,
.game-text,
.game-sdchara,
#game-line img,
.result-img,
.share-img {
  width: 100%;
  height: 100%;
}

#main {
  overflow: hidden; /* 横がはみ出したら切り取る */
}
.main-load {
  opacity: 0;
  transition: opacity 0.3s ease;
}
.main-load.loaded {
  opacity: 1;
}

/* --------------------
背景画像 
-------------------- */
#main-bg {
  display: block;
  margin: auto;
  width: auto;
  object-fit: cover;
  position: absolute;
  right: 0;
  left: 0;
}
#game-bg_effect {
  display: block;
  margin: auto;
  width: auto;
  object-fit: cover;
  position: absolute;
  right: 0;
  left: 0;
}

/* --------------------
①タイトル画面 
-------------------- */
#title-container {
  position: relative;
  height: 100vh;
  width: 100%;
  opacity: 1;
  transition: opacity 0.5s ease-out;
  display: flex;
  justify-content: center;
  align-items: center;
}
/* フェードアウト用 */
#title-container.fade-out {
  opacity: 0;
  pointer-events: none; /* フェード中はクリック無効にする */
}
#title-container img {
  max-height: 100%;
  max-width: 100%;
}
.title-start {
  cursor: pointer;
  position: relative;
  pointer-events: auto;
  z-index: 10; /* 背景より前面に配置 */
  transform-origin: center center;
  transition: transform 0.15s ease;
}
.title-start.shrink {
  transform: translateX(-50%) scale(0.98) !important;
}
#bgm-toggle-btn {
  pointer-events: auto;
  z-index: 99;
}

/* --------------------
②説明 
-------------------- */
/* キャラクター */
#character-container {
  display: block;
}
.character-intro {
  cursor: pointer;
  pointer-events: auto;
}
.character-intro.slide-in {
  opacity: 0;
  position: absolute;
  bottom: 0;
  left: -50%;
  transition: left 0.7s ease-out, opacity 0.7s ease-out;
}
.character-intro.slide-in.show {
  left: 0;
  opacity: 1;
}
.charatext-intro {
  cursor: pointer;
  pointer-events: auto;
}
/* フェードインアニメーション */
.fade-in {
  opacity: 0;
  transition: opacity 0.3s ease-in;
}
.fade-in.show {
  opacity: 1;
}
/* カウントダウン */
#countdownOverlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 1;
}
#countdownImage {
  position: relative;
  z-index: 2;
  width: auto;
}
#countdownImage {
  width: auto;
}
.countdown-fade {
  opacity: 0;
  transition: opacity 0.25s ease-in;
}
.countdown-fade.show {
  opacity: 1;
}

/* --------------------
③ゲーム本編 
-------------------- */
#game-container {
  width: 100%;
  height: 100%;
  position: relative;
  cursor: pointer;
}
.game-text {
  z-index: 1;
  position: absolute;
  left: 0;
}
.game-sdchara {
  position: absolute;
  left: 0;
  z-index: 3;
}
#game-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}
#game-line img {
  position: absolute;
  left: 0;
  z-index: 999;
}
/* 右上タイマー */
#timeCounter {
  background-image: url(../img/game_time.png);
  background-size: contain;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DSEG7Modern', sans-serif;
  font-weight: bold;
  color: #fff;
  text-shadow: 1px 1px 5px rgba(30,136,204,1),-1px -1px 5px rgba(30,136,204,1),0px 0px 15px rgba(30,136,204,1),0px 0px 10px rgba(30,136,204,.7),0px 0px 5px rgba(30,136,204,.5);
  text-align: center;
  position: absolute;
  top: 10px;
  right: 30px;
}
#timeCounter.warning {
  text-shadow: 1px 1px 5px rgba(255,36,36,1),-1px -1px 5px rgba(255,36,36,1),0px 0px 15px rgba(255,36,36,1),0px 0px 10px rgba(255,36,36,.7),0px 0px 5px rgba(255,36,36,.5);
}
/* クリックエフェクト用 */
#clickEffectCanvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 999;
}

/* --------------------
リザルトアニメーション
-------------------- */
/* ホワイトアウト用 */
#whiteout {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: white;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity 0.3s ease;
}
#whiteout.active {
  opacity: 1;
}
#animation-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}
/* スプライトアニメーション共通 */
#result-animation {
  pointer-events: none;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background-repeat: no-repeat;
  background-position: 0 0;
  display: none;
}

/* --------------------
リザルト画面
-------------------- */
#result-container {
  background: #000;
}
#fade-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: black;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 20;
  display: block;
}
.result-in {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.result-in.show {
  opacity: 1;
  transform: scale(1);
}
.result-img {
  position: absolute;
  top: 0;
  left: 0;
}
/* スコアのバンッ */
#score-display {
  display: block;
  font-size: 13vh;
  font-weight: bold;
  color: #fff;
  text-align: center;
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%) scale(0.5);
  opacity: 0;
  transition: transform 0.4s ease, opacity 0.4s ease;
  letter-spacing: -5px;
  line-height: 1;
}
.score-text.show {
  opacity: 1;
  transform: translateX(-50%) scale(1.2);
}
.score-text.show.done {
  transform: translateX(-50%) scale(1);
}
#result-btn {
  position: absolute;
  right: 0;
  left: 0;
  top: 53%;
  opacity: 0;
  transition: opacity 0.7s ease-in-out;
  z-index: 2;
}
#result-btn.in {
  opacity: 1;
}
#result-btn p {
  font-size: 2vh;
  color: #fff;
  animation: blink 2s infinite;
  letter-spacing: 0.1em;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* --------------------
シェア画面
-------------------- */
#share-container {
  background-color: #000;
  height: 100vh;
  display: none;
}
#share-score {
  color: #fff;
  font-size: 7.6vh;
  position: absolute;
  top: 52%;
  right: 5%;
  line-height: 1;
  letter-spacing: -3px;
}
#share-score::first-letter {
  color: #FF0000;
}
#share-score::before {
  content: "Lv.";
}
#share-title {
  color: #fff;
  font-size: 3.6vh;
  position: absolute;
  top: 59%;
  right: 4%;
}
.share-img {
  position: absolute;
  top: 0;
  left: 0;
}
#share-retrytext {
  font-size: 2.7vh;
  position: absolute;
  top: 65%;
  right: 4%;
  text-align: right;
}
#share-present img {
  max-width: 59%;
  position: absolute;
  top: 74%;
  right: 4%;
  cursor: pointer;
  pointer-events: auto;
}
#share-sns img {
  max-width: 58%;
  position: absolute;
  top: 86%;
  right: 5%;
  cursor: pointer;
  pointer-events: auto;
}
#share-restart {
  cursor: pointer;
  max-width: 25%;
  height: auto;
  pointer-events: auto;
  position: absolute;
  top: auto;
  left: 0;
  bottom: 0;
}
#audio-resume-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.4rem;
  text-align: center;
  cursor: pointer;
  color: #fff;
}