/* driver.jsガイド中のボタンアイコン消失対策 */
.driver-active-element {
  z-index: 1000001 !important; /* オーバーレイ(999999)より上に設定 */
  background-color: #ffffff !important; /* 背景色を白に強制してアイコンを浮き出させる */
  position: relative !important;
  isolation: isolate; /* 子要素の z-index を有効化 */

  margin: 5px; /* ハイライト時の余白を確保 */
  pointer-events: auto !important;
}

/* ボタンの中の画像への対策 */
.driver-active-element img {
  opacity: 1 !important;
  visibility: visible !important;
  position: relative !important;
  z-index: 1000002 !important;
  display: inline-block !important; /* 描画を確実にする */
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
}

button {
  min-width: 40px;
  min-height: 40px;
  padding: 10px;
}

button > img {
  height: 1.3em;
  width: 1.3em;
}

header,
#service_logo,
#HelpWindow,
#HelpContent,
#button_help,
canvas,
video,
#SpriteEditTab,
footer,
#button_edit,
#button_camera,
#button_flip {
  position: absolute;
}

header {
  width: 100%;
  top: 0;
  left: 0;
  z-index: 2;
}

#service_logo {
  height: 40px;
  padding: 4px;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

#HelpWindow {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  top: 0;
  right: 0;
  background-color: aliceblue;
  display: none;
  z-index: 2;
}

#HelpContent {
  position: relative;
  padding: 80px;
  margin: 20px;
  background-color: aliceblue;
}

#button_help {
  padding: 4px;
  top: 10px;
  right: 10px;
}

canvas,
video {
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

canvas {
  z-index: 0;
  border: 3px solid #a4cff086;
  image-rendering: -webkit-optimize-contrast; /* Safari用 */
  image-rendering: auto;
}

video {
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 1px solid#dc7f7f3f;
}

#SpriteEditTab {
  width: 100%;
  bottom: 60px;
  left: 0;
  background-color: aliceblue;
  display: none;
  z-index: 1;
  overflow-x: auto;
  white-space: nowrap;
}

footer {
  width: 100%;
  height: 60px; /* 明示的に高さを指定 */
  bottom: 0;
  left: 0;
  z-index: 5; /* 他の要素より手前に出す */
  display: flex; /* flexbox を使用してボタンを横並びにする */
  justify-content: space-around; /* ボタンを均等に配置 */
  align-items: center; /* 上下中央に配置 */
  background: transparent; /* 背景が必要ならここに追加 */
  position: absolute;
}

#button_edit,
#button_camera,
#button_flip {
  position: relative !important; /* absolute から変更 */
  bottom: auto !important; /* bottom: 10px を打ち消し */
  left: auto !important;
  right: auto !important;
  transform: none !important; /* transform によるズレを防止 */
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#button_edit {
  left: 10px;
}

#button_camera {
  left: 50%;
  transform: translateX(-50%);
}

#button_flip {
  right: 10px;
}

.accordion {
  display: flex;
  flex-direction: column;
}

.accordion-item {
  margin-bottom: 10px;
}

.accordion-item .accordion-header {
  cursor: pointer;
  background-color: lightgray;
  padding: 10px;
}

.accordion-item .accordion-content {
  display: block;
  padding: 10px;
  max-height: 1000px;
}

#SpriteEditTab {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  overflow-x: auto;
}

#SpriteEditTab button {
  width: 60px;
  height: 60px;
  margin: 2px;
  padding: 2px;
  flex-shrink: 0;
}

#SpriteEditTab #SpriteAddWindow {
  left: 0px;
  margin-left: 10px;
}

#SpriteEditTab button.selected {
  border-color: blue;
}

#SpriteEditTab img {
  object-fit: contain;
  width: 100%;
  height: 100%;
}

#SpriteAddWindow {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: sandybrown;
  z-index: 2;
  overflow-y: auto;
}
#SpriteAddWindow.driver-active-element {
  position: fixed !important; /* 絶対配置ではなく固定配置を維持 */
  z-index: 1000001 !important;
  display: block !important; /* 強制表示 */
  background-color: sandybrown !important; /* 元の色を維持 */
}
.close_add_sprite {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  margin: 10px 0;
}

#CardButtons {
  position: absolute;
  bottom: 5px;
  width: 100%;
  display: flex;
  justify-content: center;
}

#CardButtons button {
  margin: 0 5px;
}

#Img_Modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3;
}

#Img_Modal img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.chara_card {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 5px;
  padding: 5px;
  border: 2px solid #ccc;
  border-radius: 5px;
  width: 10%;
}

.sprite-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.button-container {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-top: 5px;
}

.button-container button {
  padding: 5px;
  font-size: 0.9em;
}

/* キャラクター編集タブの固定 */
.driver-active-element#SpriteEditTab {
  position: absolute !important;
  bottom: 60px !important;
  left: 0 !important;
  width: 100% !important;
  transform: none !important;
}

@media (max-width: 480px) {
  .chara_card {
    width: auto;
  }
}
