@charset "UTF-8";

@font-face {
  font-family: "Nonbit";
  src:
    url("../fonts/213chan_nonbit-Regular.woff2") format("woff2"),
    url("../fonts/213chan_nonbit-Regular.otf") format("opentype");
}
@font-face {
  font-family: "BestTen";
  src:
    url("../fonts/BestTen-CRT.woff2") format("woff2"),
    url("../fonts/BestTen-CRT.otf") format("opentype");
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
            -webkit-tap-highlight-color: transparent;
            -webkit-touch-callout: none;
}


html,body {
  overflow-x: hidden;
  overscroll-behavior: none;
}
html {
  background-color: #222222;
}
body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-image: url(../images/bor-p-.png);
  background-size: cover;
  background-attachment: fixed;
  min-height: 100vh;
  min-width: 320px;
  padding: 20px;
}

body,
button {
  font-family: "BestTen", "Arial", sans-serif;
}
h1,
h2,
h3,
h4,
h5 {
  font-family: "Nonbit", "Arial", sans-serif;
}

.hide {
  display: none !important;
}

.fa-square-full.icon-rectangle {
  transform: scaleY(0.625);
}
.fa-hexagon.icon-trapezoid {
  transform: scale(1, 1.75) translateY(25%);
  clip-path: inset(0 0 50% 0);
}
.fa-square.icon-parallelogram {
  transform: scaleY(0.85) skewX(-25deg);
}
.fa-diamond.icon-diamond {
  transform: scale(1.05, 0.85);
}

/* ローディング画面 */
#loadingScreen {
  pointer-events: none;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 3000;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100dvw;
  height: 100dvh;
  opacity: 0;
  background-color: rgba(50, 50, 120, 1);
  transition: all 0.15s ease-out;
}
body.loading #loadingScreen {
  opacity: 1;
}
.scrolling-bg {
  background-size: 1920px 1080px;
  background-image: url(../images/sai-24.png);
  background-repeat: repeat;
  
  /* アニメーションの指定 */
  animation: diagonal-move 30s linear infinite;
}
@keyframes diagonal-move {
  from {
    /* スタート地点 */
    background-position: 0 0;
  }
  to {
    background-position: -1920px 1080px;
  }
}
.loader {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #fff;
}
.loader-spinner {
  /* スピナーのサイズと太さ */
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3; /* 全体の色（薄いグレー） */
  border-top: 5px solid #3498db; /* 動く部分の色（青） */
  border-radius: 50%; /* 円形にする */
  
  /* アニメーション：1秒で1回転、一定速度で無限ループ */
  animation: spin 1s linear infinite;
}
.loader-spinner + .loader-text {
  margin-top: 0.5rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

#gameWrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
  flex-wrap: wrap;
  opacity: 1;
  transition: opacity 0.3s ease-out;
}
body.loading #gameWrapper {
  opacity: 0;
}

#gameContainer {
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 20px;
  flex-shrink: 0;
  position: relative;
  width: fit-content;
  max-width: 100%;
}

#sidePanel {
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 20px;
  min-width: 280px;
  max-width: 320px;
}

#gameCanvas {
  border: 3px solid #333;
  border-radius: 10px;
  display: block;
  margin: 0 auto;
  touch-action: none;
  width: 100%;
  height: auto;
  max-width: 640px;
  max-height: 560px;
}

#gameControls {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
  height: 140px;
  margin: 20px auto 0;
}
#gameControls > * {
  height: 100%;
}
#gameControlButtons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.0rem;
}

.button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 30px;
  font-size: 16px;
  border-radius: 25px;
  cursor: pointer;
  margin: 5px;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  font-weight: bold;
}
.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}
.button:active {
  transform: translateY(0);
}
.button.btn-outline {
  border-radius: 25px;
  padding: 12px 30px;
}
.button.btn-outline::before {
  border-radius: 25px;
}

#info {
  padding: 15px;
  background: #f0f0f0;
  border-radius: 10px;
  display: none;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.info-item {
  text-align: center;
}

.info-label {
  font-size: 12px;
  color: #666;
  margin-bottom: 5px;
}

.info-value {
  font-size: 24px;
  font-weight: bold;
  color: #333;
}

#nextShapePreview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 20px;
  background: #fff;
  border: 2px dashed #667eea;
  border-radius: 10px;
  min-width: 140px;
  min-height: 140px;
}

#shapePreview {
  width: 80px;
  height: 80px;
}

.shape-label {
  font-size: 16px;
  font-weight: bold;
  color: #666;
}

/* ゲームオーバー */
#gameOver {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
#gameOver.show {
  display: flex;
}

#gameOverContent {
  background: white;
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  width: 90%;
  max-width: 500px;
}

#gameOverContent h2 {
  font-size: 32px;
  margin-bottom: 20px;
  color: #764ba2;
}

#gameOverContent p {
  font-size: 18px;
  margin-bottom: 30px;
  color: #666;
}

#gameOver #retryBtn {
  pointer-events: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease-out;
}
#gameOver.show-retry-btn #retryBtn {
  pointer-events: auto;
  opacity: 1;
  transform: translateX(0);
}

#instructions {
  padding: 15px;
  background: #e8f4f8;
  border-radius: 10px;
  font-size: 14px;
  color: #333;
  line-height: 1.6;
}

/* ステージ表示 */
#stageDisplay {
  display: none;
  text-align: center;
  margin-bottom: 10px;
  padding: 10px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
  color: white;
  font-size: 18px;
  font-weight: bold;
}

/* ステージクリア画面 */
#stageClearScreen {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  z-index: 1500;
}
#stageClearScreen.show {
  display: flex;
}

#stageClearContent {
  background: white;
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  width: 90%;
  max-width: 440px;
}

#stageClearContent h2 {
  font-size: 28px;
  margin-bottom: 20px;
  color: #667eea;
}

#stageClearContent p {
  font-size: 18px;
  margin-bottom: 10px;
  color: #666;
}

#nextStageBtn {
  pointer-events: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease-out;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 15px 40px;
  font-size: 20px;
  border-radius: 30px;
  cursor: pointer;
  font-weight: bold;
  margin-top: 20px;
}

#nextStageBtn.show {
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
}

#nextStageBtn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.5);
}

#nextStageBtn:active {
  transform: translateY(0);
}

/* リザルト画面 */
#resultScreen {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  justify-content: center;
  align-items: center;
  z-index: 2000;
}
#resultScreen.show {
  display: flex;
}

#resultContent {
  background: white;
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

#resultContent h2 {
  font-size: 36px;
  margin-bottom: 30px;
  color: #764ba2;
}

#resultContent .result-title {
  font-size: 24px;
  margin-bottom: 20px;
  color: #667eea;
}

#stageScoresList {
  margin: 20px 0;
  padding: 20px;
  background: #f5f5f5;
  border-radius: 10px;
}

.stage-score-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 20px;
  margin: 5px 0;
  background: white;
  border-radius: 5px;
  font-size: 18px;
}

.stage-score-item.total {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: bold;
  font-size: 20px;
  margin-top: 15px;
}

#resultRetryBtn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 15px 40px;
  font-size: 20px;
  border-radius: 30px;
  cursor: pointer;
  font-weight: bold;
  margin-top: 20px;
  transition: all 0.3s;
}

#resultRetryBtn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.5);
}

#resultRetryBtn:active {
  transform: translateY(0);
}

#sideControls {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
#sideControls button {
  min-width: 190px;
}

/* スタート画面 */
#startScreen {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-image: url(../images/sai-24.png);
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 1;
  transition: all 0.3s ease-out;
  overflow: hidden; /* 内部コンテンツのはみ出し防止 */
}
#startScreen.invisible {
  opacity: 0;
}

#startScreenContent {
  position: relative;
  padding: 40px;           /* 60px 80px → 40px に縮小 */
  border-radius: 30px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
  background: white;
  width: 90%;              /* 画面幅に追従 */
  max-width: 520px;        /* 上限を設定 */
  transform: translateY(0);
  transition: all 0.3s ease-out;
  animation: slideIn 0.5s ease-out;
}
#startScreen.invisible #startScreenContent {
  transform: translateY(-20px);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#startScreenContent h1 {
  font-size: 36px;
  margin-bottom: 20px;
  color: #764ba2;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

#startScreenContent p {
  font-size: 16px;
  color: #666;
  margin-bottom: 30px;
  line-height: 1.6;
}

#startButton {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 25px 70px;
  font-size: 28px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: bold;
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

#startButton:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(102, 126, 234, 0.5);
}

#startButton:active {
  transform: translateY(0);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

.start-hint {
  margin-top: 20px;
  font-size: 14px;
  color: #999;
}

#startBottomButtons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.0rem;
}
#startBottomButtons .btn {
  margin-top: 0;
}

/* スタート画面の音声ミュートボタン */
#startMuteBtn {
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #667eea;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 18px;
  color: #667eea;
}

#startMuteBtn:hover {
  background: white;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* 音声コントロールモジュール */
#audioControlModule {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
  min-width: 140px;
}

#muteToggleBtn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid #667eea;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  align-self: center;
}

#muteToggleBtn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#muteToggleBtn:active {
  transform: scale(0.95);
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.volume-label {
  font-size: 13px;
  color: #666;
  min-width: 34px;
  font-weight: 500;
}

.volume-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: #e0e0e0;
  outline: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  transition: all 0.2s;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.volume-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.volume-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
}

.volume-value {
  font-size: 12px;
  color: #999;
  min-width: 25px;
  text-align: right;
}

/* タッチ操作 */
#touchControls {
  display: none;
}

.touchDropBtn {
  width: 60px;
  height: 60px;
  border-radius: 60px;
  border: none;
  background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
  color: white;
  font-size: 36px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.touchDropBtn:active {
  transform: scale(0.95);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.touchDropBtn .touch-drop-btn-text {
  font-size: 12px;
  font-weight: 300;
  padding-top: 5px;
  margin-bottom: -8px;
}
.touchDropBtn i {
  margin-bottom: -6px;
}

/* ステージ選択画面とクリア画面のスタイル */

/* モーダル基本スタイル */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  overflow: hidden; /* 内部コンテンツのはみ出し防止 */
}
.modal.show {
  display: flex;
  opacity: 1;
}
.modal > * {
  position: relative;
}
.modal .btn-close {
  position: absolute;
  right: 1rem;
  top: 1rem;
  font-size: 1.5rem;
  color: #999;
}

/* クレジット画面 */
#creditScreen {
  backdrop-filter: blur(10px);
  z-index: 3000;
}
#creditScreenInner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
  background: white;
}

#creditScreenInner h2 {
  text-align: center;
  font-size: 32px;
  margin-bottom: 30px;
  color: #333;
}

#creditContent {
  width: 100%;
  overflow-y: auto;
}
#creditContent *:not(i) {
  font-family:
    "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans",
    "Noto Sans JP", sans-serif;
}

#creditContent h3 {
  padding-bottom: 5px;
  border-bottom: 1px dotted #333;
}
.credit-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px 20px;
  padding-top: 10px;
}
.credit-list + h3 {
  margin-top: 1rem;
  padding-top: 1rem;
}
.credit-list-item * + * {
  margin-top: 5px;
}
.credit-title {
  font-weight: bold;
}
.credit-author,
.credit-source,
.credit-license {
  font-size: 14px;
  opacity: 0.8;
}
.credit-source i {
  margin-left: 0.3rem;
}

.copyrights-and-disclaimer {
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: #666;
}
.copyrights-and-disclaimer ol li::before {
  display: inline-block;
  content: "※";
}

/* ステージ選択画面 */
#stageSelectScreen {
  backdrop-filter: blur(10px);
}
#stageSelectScreenInner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
  background: white;
}

#stageSelectScreenInner h2 {
  text-align: center;
  font-size: 32px;
  margin-bottom: 30px;
  color: #333;
}

#stageSelectContent {
  width: 100%;
  overflow-y: auto;
}

.stage-buttons-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.stage-select-btn {
  min-height: 120px;
  padding: 20px;
  border: 3px solid #4ecdc4;
  border-radius: 15px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stage-select-btn:hover:not(:disabled) {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  border-color: #45b7d1;
}

.stage-select-btn:active:not(:disabled) {
  transform: translateY(-2px);
}

.stage-select-btn.cleared {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  border-color: #38f9d7;
}

.stage-select-btn.locked {
  background: linear-gradient(135deg, #999 0%, #666 100%);
  border-color: #999;
  color: #bbb;
  cursor: not-allowed;
  opacity: 0.6;
}

.stage-number {
  font-size: 24px;
  margin-bottom: 10px;
}

.stage-highscore {
  font-size: 14px;
  opacity: 0.9;
}

.locked-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 40px;
}

/* 親ステージクリア画面 */
#parentStageClearScreen {
  backdrop-filter: blur(10px);
}

#parentStageClearContent {
  background: white;
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 560px;
  text-align: center;
  max-height: 90vh;
  overflow-y: auto;
}

#parentStageClearTitle {
  font-size: 28px;
  margin-bottom: 20px;
  color: #333;
}
#newRecordLabel {
  color: #21c759;
  opacity: 1;
  transform: translateX(0);
  transition: all 0.2s ease-out;
}
#newRecordLabel.invisible {
  opacity: 0;
  transform: translateX(20px);
}

.scores-list {
  margin: 20px 0;
}

.stage-score-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 20px;
  margin: 8px 0;
  background: #f5f5f5;
  border-radius: 10px;
  font-size: 16px;
}

.stage-score-item.total {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: bold;
  font-size: 18px;
  margin-top: 15px;
}

.total-score {
  font-size: 24px;
  font-weight: bold;
  color: #667eea;
  margin: 20px 0;
}

.btn,
#nextParentStageBtn {
  padding: 15px 40px;
  font-size: 18px;
  font-weight: bold;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 20px;
}

.btn:hover,
#nextParentStageBtn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.btn:active,
#nextParentStageBtn:active {
  transform: translateY(-1px);
}

#nextParentStageBtn + btn {
  margin-left: 1rem;
}

.btn-outline {
  position: relative;
  background: transparent;
  background-image: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.btn-outline::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 2px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.btn.btn-outline {
  border-radius: 10px;
  padding: 15px 40px;
}
.btn.btn-outline::before {
  border-radius: 10px;
}

/* ===== スマホ向けレスポンシブ ===== */

/* サイドパネルモーダル関連の基本設定 */
#instructionsMobile {
  display: none;
}

.touchHelpBtn {
  display: flex;
  flex-direction: column;
  width: 45px;
  height: 45px;
  border-radius: 45px;
  border: none;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}
.touchHelpBtn:active {
  transform: scale(0.95);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}
.touchHelpBtn i {
  margin-top: -2px;
  margin-bottom: 1px;
}
.touchHelpBtn .touch-help-btn-text {
  font-size: 10px;
  font-weight: 300;
}

/* サイドパネルモーダル */
#sidePanelModal {
  z-index: 1200;
  align-items: flex-end;
}
#sidePanelModalInner {
  position: relative;
  background: white;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  padding: 24px 20px 32px;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
}
#sidePanelModalInner h2 {
  font-size: 20px;
  margin-bottom: 16px;
  color: #333;
  text-align: center;
}
#sidePanelModalInner .btn-close {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 1.4rem;
  color: #999;
}
#sidePanelModalContent .button {
  display: block;
  width: 100%;
  margin: 6px 0;
  text-align: center;
}

@media (max-width: 900px) {
  #gameWrapper {
    flex-wrap: nowrap;
    min-height: 600px;
  }
  #gameContainer {
    max-width: 320px;
    padding: 0.75rem 0.5rem;
    border-radius: 12px;
    height: calc(100dvh - (0.5rem * 2 + 1.5rem));
    min-height: 542px;
  }
  #gameCanvas {
    max-width: 100%;
    min-width: 285px;
    width: fit-content;
    height: auto;
    min-height: 347px;
    max-height: calc(100dvh - (1.0rem * 2 + 150px));
  }
  
  #sidePanel {
    width: 100%;
    max-width: 600px;
    border-radius: 12px;
    height: calc(100dvh - (0.5rem * 2 + 1.5rem));
    min-height: 542px;
    overflow-y: scroll;
  }
  #gameControls {
    margin-top: 1.0rem;
    gap: 10px;
  }
  #nextShapePreview {
    padding: 0.5rem 1.0rem;
  }
  #audioControlModule {
    padding: 1.0rem 0.75rem;
  }
  #muteToggleBtn {
    width: 45px;
    height: 45px;
    font-size: 18px;
  }
  .volume-control {
    gap: 6px;
  }
  .volume-label{
    min-width: 30px;
  }
  .volume-slider {
    width: 100%;
  }
  .volume-value {
    min-width: 18px;
  }

  #touchControls {
    display: none;
  }
}

@media (max-width: 768px) {
  body {
    padding: 8px;
  }

  #gameWrapper {
    gap: 8px;
  }

  /* スタート画面コンテンツ */
  #startScreenContent {
    padding: 30px 20px;
  }
  #startScreenContent h1 {
    font-size: 26px;
    margin-bottom: 16px;
  }
  #startScreenContent p {
    font-size: 12px;
    margin-bottom: 20px;
  }
  #startButton {
    padding: 22px 36px;
    font-size: 22px;
  }

  /* サイドパネルモーダル関連のSP時設定 */
  #touchControls {
    display: block;
  }
  #sidePanel {
    display: none;
  }
  #instructionsPC {
    display: none;
  }
  #instructionsMobile {
    display: block;
  }

  /* モーダル内コンテンツ */
  #creditScreenInner,
  #stageSelectScreenInner {
    padding: 20px;
    width: 95%;
  }
  #creditScreenInner h2,
  #stageSelectScreenInner h2 {
    font-size: 22px;
    margin-bottom: 16px;
  }
  .credit-list {
    grid-template-columns: 1fr;
  }

  .stage-buttons-container {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 12px;
  }
  .stage-select-btn {
    min-height: 100px;
    padding: 12px;
    font-size: 15px;
  }
  .stage-number {
    font-size: 18px;
  }
  .stage-highscore {
    font-size: 12px;
  }

  #parentStageClearContent {
    padding: 20px;
    width: 95%;
  }
  #parentStageClearTitle {
    font-size: 20px;
  }

  #gameOverContent,
  #stageClearContent,
  #resultContent {
    padding: 24px 16px;
    width: 95%;
  }

  .btn,
  #nextParentStageBtn {
    padding: 12px 24px;
    font-size: 16px;
  }
}