@charset "utf-8";

.last-updated {
  font-size: 1.4rem;
  color: #aaa;
  margin: -40px 0 20px;
  text-align: right;
}

@media screen and (max-width: 768px) {
.last-updated {
  margin: 0px 0 10px;
}
}

.app-container {
  max-width: 1500px;
  margin: 0 auto;
}

.controls {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  margin-bottom: 20px;
}

@media screen and (max-width: 950px) {
  .controls {
    flex-wrap: wrap;
  }
}

.control-group {
  width: 100%;
  border: 1px solid #000;
  padding: 20px;
  border-radius: 5px;
  background-color: rgba(0, 0, 0, 0.45);
  margin-bottom: 10px;
}

.control-group h3 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.8rem;
  color: #fff;
}

button {
  padding: 8px 12px;
  background-color: #000;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.6rem;
}

button:hover {
  opacity: .5;
}

button.danger,
button.success,
button#loadStateBtn,
button#addTierBtn {
  background-color: #0d0300;
  border: 1px solid #666;
}

@media screen and (max-width: 768px) {
  .control-group{
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  .control-group button{
    width: 48%;
  }
}

.tier-container {
  width: 100%;
  background: rgba(13, 3, 0, 0.6);
}

.tier-row {
  display: flex;
  border-top: solid 1px #000;
  border-bottom: solid 1px #000;
  position: relative;
}

.tier-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100px;
  min-height: 80px;
  font-size: 14px;
  font-weight: 500;
  color: #000;
  position: relative;
  font-family: 'Zen Kaku Gothic New', "游ゴシック体", YuGothic, "游ゴシック", "Yu Gothic", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "メイリオ", sans-serif;
}

@media screen and (max-width: 768px) {
  .tier-label {
    font-size: 12px;
    width: 80px;
  }
}

.tier-content {
  flex-grow: 1;
  min-height: 80px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.item-container {
  min-height: 102px;
  margin-top: 20px;
  padding: 10px;
  border: 1px solid #000;
  background-color: rgba(13, 3, 0, 0.6);
  display: flex;
  flex-wrap: wrap;
}

.item {
  width: 80px;
  height: 80px;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

@media screen and (max-width: 768px) {
  .item {
    width: 64px;
    height:64px;
  }
}

.item img {
  max-width: 100%;
  max-height: 100%;
}

.tier-row-controls {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background-color: #000;
}

.tier-row-controls button {
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.tier-edit-tools {
  display: none;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.tier-edit-tools input,
.tier-edit-tools input[type="color"] {
  margin-bottom: 10px;
  padding: 5px;
  width: 80%;
}

.file-input-container {
  margin-top: 20px;
  margin-bottom: 10px;
}

.status-message {
  margin-top: 10px;
  padding: 10px;
  background-color: #f8f9fa;
  border-radius: 4px;
  text-align: center;
  font-style: italic;
  color: #495057;
  min-height: 20px;
}

.tier-label-text {
  min-width: 100px;
  cursor: pointer;
  width: 100%;
  height: 100%;
  align-items: center;
  display: flex;
  justify-content: center;
  padding: 10px;
}

.color-preview {
  width: 20px;
  height: 20px;
  display: inline-block;
  margin-right: 5px;
  border: 1px solid #ccc;
  vertical-align: middle;
}

/* ドラッグ中のスタイル */
.dragging {
  cursor: grabbing;
  opacity: 0.5;
  /* 半透明に設定 */
  transform: scale(1.05);
  transition: transform 0.1s;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* プレビューアイテムのスタイル */
.preview-item {
  opacity: 0.5;
  pointer-events: none;
}

/* 非表示にするクラス */
.hidden {
  display: none !important;
}

/* 設定ボタン */
.tier-settings-btn {
  background-color: #000;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 24px;
  cursor: pointer;
  min-width: 46px;
}

.tier-settings-btn:hover {
  opacity: 0.5;
}


@media screen and (max-width: 768px) {
.tier-settings-btn {
  font-size: 24px;
  padding: 5px 4px;
  min-width: auto;
}
}

/* モーダル用のスタイル */
#overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s, visibility 0.3s;
}

#overlay.active {
  visibility: visible;
  opacity: 1;
}

#modal-wrapper {
  background-color: #fff;
  padding: 20px;
  border-radius: 8px;
  max-width: 80%;
  width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

#modal {
  position: relative;
}

#close {
  position: absolute;
  top: 0;
  right: 0;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#close:before,
#close:after {
  content: '';
  position: absolute;
  width: 20px;
  height: 2px;
  background-color: #333;
}

#close:before {
  transform: rotate(45deg);
}

#close:after {
  transform: rotate(-45deg);
}

#color-select {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

#color-select span {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-block;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

#color-select span.selected {
  box-shadow: 0 0 0 3px #4a6ea9, 0 1px 3px rgba(0, 0, 0, 0.2);
}

.settings-label {
  width: 100%;
  padding: 8px;
  box-sizing: border-box;
  border: 1px solid #ddd;
  border-radius: 4px;
  resize: vertical;
  font-size: 1.6rem;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  margin: 15px 0;
}

.modal-buttons button {
  flex: 1;
  padding: 8px;
}

/* 保存関連のコントロール */
.save-controls {
  margin-top: 10px;
  display: flex;
  gap: 10px;
}

input[type="file"] {
  font-size: 1.6rem;
  ;
}


/* タッチデバイス用の基本設定 */
@media (pointer: coarse) {
  .item {
    touch-action: none;
    /* ブラウザのデフォルトタッチ動作を無効化 */
    user-select: none;
    /* テキスト選択を防止 */
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }
}


@media screen and (max-width: 768px) {

  .content:has(.item-container:not(:empty)) {
    padding-bottom: 140px;
  }

  .heading02+.item-container:not(:empty) {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 110px;
    display: flex;
    align-items: end;
    z-index: 10000;
    margin-top: 0;
    background: linear-gradient(180deg, rgba(26, 26, 23, 0.95) 0%, rgba(13, 3, 0, 0.98) 100%);

    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6);

    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
  }

  .heading02+.item-container:not(:empty)::-webkit-scrollbar {
    display: none;
  }

  .heading02+.item-container:not(:empty) .item {
    width: 70px;
    height: 70px;
  }


  .item-container:not(:empty)+* .heading02,
  .heading02:has(+ .item-container:not(:empty)) {
    display: none;
  }
  .heading02+.item-container:not(:empty)::before,
  .heading02+.item-container:not(:empty)::after {
    content: '';
    position: absolute;
    top: 0;
    width: 20px;
    height: 100%;
    pointer-events: none;
    z-index: 1;
  }

  .heading02+.item-container:not(:empty)::before {
    left: 0;
    background: linear-gradient(90deg, rgba(26, 26, 23, 0.8) 0%, transparent 100%);
  }

  .heading02+.item-container:not(:empty)::after {
    right: 0;
    background: linear-gradient(270deg, rgba(26, 26, 23, 0.8) 0%, transparent 100%);
  }

  .heading02+.item-container:empty {
    position: static;
    height: auto;
    min-height: 102px;
    background-color: rgba(13, 3, 0, 0.6);
    border: 1px solid #000;
    box-shadow: none;
  }
}

@media screen and (max-width: 768px) {
  .content.has-mobile-items {
    padding-bottom: 140px;
  }

  .item-container.mobile-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    z-index: 1000;
    margin-top: 0;
    background: linear-gradient(180deg, rgba(26, 26, 23, 0.95) 0%, rgba(13, 3, 0, 0.98) 100%);
    border-top: 1px solid #444;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6);
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
  }

  .item-container.mobile-fixed::-webkit-scrollbar {
    display: none;
  }

  .item-container.mobile-fixed .item {

    flex-shrink: 0;
    margin-right: 8px;
  }


  .heading02.mobile-hidden {
    display: none;
  }

  .item-container.mobile-fixed::before,
  .item-container.mobile-fixed::after {
    content: '';
    position: absolute;
    top: 0;
    width: 20px;
    height: 100%;
    pointer-events: none;
    z-index: 1;
  }

  .item-container.mobile-fixed::before {
    left: 0;
    background: linear-gradient(90deg, rgba(26, 26, 23, 0.8) 0%, transparent 100%);
  }

  .item-container.mobile-fixed::after {
    right: 0;
    background: linear-gradient(270deg, rgba(26, 26, 23, 0.8) 0%, transparent 100%);
  }
}

@media (pointer: coarse) and (max-width: 768px) {
  .item-container.mobile-fixed {
    touch-action: pan-x;
  }

  .item-container.mobile-fixed .item {
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }
}

/* スワイプインジケーター（疑似要素で追加） */
@media screen and (max-width: 768px) {
  .item-container.mobile-fixed[data-show-swipe="true"]::after {
    content: '< ここをタッチしてスワイプ >';
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: #aaa;
    opacity: 0.8;
    animation: fadeInOut 3s ease-in-out infinite;
    pointer-events: none;
    z-index: 2;
    background: none;
    width: auto;
    height: auto;
  }

  @keyframes fadeInOut {
    0%, 100% {
      opacity: 0.4;
    }

    50% {
      opacity: 0.8;
    }
  }
}