/* ボディとコンテナのスタイル */
body {
  font-family: 'Meiryo', sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f5f5f5;
  /* Safari でのテキスト自動拡大を無効化 */
  -webkit-text-size-adjust: 100%;
  /* ダブルタップでの拡大を禁止 */
  touch-action: manipulation;
}

.outline {
  max-width: 800px;
  margin: 0 auto;
  padding: 10px;
}

header {
  background-color: #3498db;
  color: white;
  padding: 2px;
  margin: 0;
  width: 100%;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 5px 10px;
  max-width: 800px;
  margin: 0 auto;
}

.ad-container {
  max-width: 800px;
  margin: 0 auto 20px;
  padding: 0 10px;
}

.header-logo {
  flex: 0 0 auto;
  margin-right: 15px;
}

.header-image {
  height: 60px;
  width: auto;
  border-radius: 5px;
  object-fit: cover;
}

.header-text {
  flex: 1;
  text-align: left;
}

header h1 {
  margin: 0;
  font-size: 20px;
}

.creater {
  font-size: 0.8em;
}

.creater a {
  color: white;
  text-decoration: none;
}

/* レスポンシブデザイン対応 */
@media (max-width: 480px) {
  .header-content {
    flex-direction: row;
    align-items: center;
  }

  .header-logo {
    margin-right: 10px;
  }

  .header-image {
    height: 45px;
    /* 小さい画面では画像をやや小さく */
  }

  .header-text {
    text-align: left;
  }

  header h1 {
    font-size: 16px;
  }

  .outline {
    max-width: 100%;
    padding: 5px;
  }
}

.main_container {
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  padding: 20px;
  margin-bottom: 20px;
}

h2 {
  text-align: center;
  color: #2c3e50;
  margin-top: 0;
}

/* サイコロコントロール部分 */
.dice-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.dice-selector {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
}

.dice-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.dice-input-group {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
}

.dice-label {
  font-size: 20px;
  white-space: nowrap;
}

select,
button {
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background-color: white;
  font-size: 24px;
}

.compact-select {
  width: auto;
  padding: 8px;
}

button {
  background-color: #3498db;
  color: white;
  border: none;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s;
  white-space: nowrap;
  /* タッチデバイスでの拡大を防止 */
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  /* タップ時の選択を防止 */
  user-select: none;
  -webkit-user-select: none;
}

button:hover {
  background-color: #2980b9;
}

#diceCount {
  padding: 10px;
  background-color: #f8f9fa;
  font-size: 20px;
  display: block;
  margin: 0 auto;
  text-align: center;
}

/* サイコロコンテナ */
.dice-container {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  margin-top: 20px;
}

/* サイコロのスタイル */
.dice {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  border-radius: 10px;
  color: white;
  text-shadow: 1px 1px 1px black;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  position: relative;
  transition: transform 0.3s ease;
  user-select: none;
  -webkit-user-select: none;
  /* モバイルでのタップ挙動を改善 */
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

.dice.rolling {
  animation: diceRoll 2s ease-in-out;
}

.dice.emphasize {
  animation: emphasize 0.5s ease-in-out;
}

.dice-menu {
  position: absolute;
  background: white;
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 5px;
  display: none;
  flex-direction: column;
  z-index: 10;
}

.dice-menu button {
  padding: 5px;
  margin: 2px 0;
  font-size: 20px;
}

.dice-info {
  background-color: #f8f9fa;
  color: #2c3e50;
  text-align: center;
  padding: 5px;
  font-size: 20px;
  font-weight: bold;
  border-bottom: 1px solid #e9ecef;
  margin-bottom: 5px;
}

/* サイコロの色 */
.dice.red {
  background-color: #e74c3c;
}

.dice.green {
  background-color: #2ecc71;
}

.dice.blue {
  background-color: #3498db;
}

.dice.yellow {
  background-color: #f1c40f;
}

.dice.white {
  background-color: #ecf0f1;
  color: black;
  text-shadow: none;
  border: 1px solid #bdc3c7;
}

.dice.black {
  background-color: #2c3e50;
}

/* アニメーション */
@keyframes diceRoll {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

@keyframes emphasize {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.5);
  }

  100% {
    transform: scale(1);
  }
}

/* レスポンシブデザイン */
@media (max-width: 800px) {
  .outline {
    max-width: 100%;
  }
}

@media (max-width: 600px) {
  .dice-controls {
    padding: 5px;
  }

  .dice-selector {
    flex-wrap: nowrap;
  }

  .dice-actions {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .dice-input-group {
    flex-wrap: nowrap;
    width: 100%;
    font-size: 20px;
    justify-content: center;
  }

  .compact-select {
    font-size: 20px;
    padding: 3px;
    min-width: 35px;
  }

  .dice-label {
    font-size: 20px;
    margin: 0 2px;
  }

  #addDice {
    font-size: 20px;
    padding: 5px;
    white-space: nowrap;
  }

  #rollAllDice {
    font-size: 20px;
    padding: 5px;
  }

  .dice {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }

  .main_container {
    padding: 10px;
  }

  .marker {
    width: 130px;
    min-width: 120px;
  }

  .marker-content {
    padding: 6px;
  }

  .marker-select {
    width: 40px;
    font-size: 20px;
  }

  .marker-button {
    width: 28px;
    height: 25px;
    font-size: 20px;
  }
}

/* 特に小さい画面（iPhone SE等）向け */
@media (max-width: 375px) {
  .dice-label {
    font-size: 20px;
    margin: 0 1px;
  }

  .compact-select {
    font-size: 20px;
    padding: 2px;
    min-width: 30px;
  }

  #addDice {
    font-size: 20px;
    padding: 5px;
  }

  .marker {
    width: 120px;
    min-width: 100px;
  }

  .marker-title {
    font-size: 20x;
  }

  .marker-select {
    width: 36px;
    font-size: 20px;
  }

  .marker-button {
    width: 24px;
    height: 24px;
    font-size: 20px;
  }

  .marker-icon {
    width: 14px;
    height: 14px;
    margin-right: 3px;
  }
}

/* 使い方の説明 */
.instructions {
  margin-top: 40px;
  padding: 20px;
  background-color: #f8f9fa;
  border-radius: 10px;
  border: 1px solid #e9ecef;
}

.instructions h3 {
  color: #2c3e50;
  margin-top: 0;
  border-bottom: 2px solid #3498db;
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.instructions ol,
.instructions ul {
  padding-left: 20px;
}

.instructions li {
  margin-bottom: 10px;
  line-height: 1.6;
}

.tips {
  margin-top: 20px;
  padding: 15px;
  background-color: #e8f4f8;
  border-left: 4px solid #3498db;
  border-radius: 0 5px 5px 0;
}

.tips h4 {
  margin-top: 0;
  color: #3498db;
}

/* 数値マーカーのスタイル */
.section-title {
  margin: 40px 0 15px;
  color: #2c3e50;
  font-size: 20px;
  text-align: center;
  font-weight: bold;
  border-bottom: 2px solid #3498db;
  padding-bottom: 10px;
}

.marker-container {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  margin-top: 20px;
  align-items: flex-start;
}

.marker {
  width: 150px;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease, max-width 0.3s ease;
  order: 0;
  /* 表示マーカーを前に配置 */
  /* タッチデバイスでの拡大・選択を防止 */
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  user-select: none;
  -webkit-user-select: none;
}

.marker.highlight {
  animation: markerHighlight 0.5s ease;
}

.marker-title {
  color: white;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  font-weight: bold;
  font-size: 14px;
  justify-content: space-between;
}

.marker-content {
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.marker-icon {
  width: 16px;
  height: 16px;
  margin-right: 5px;
  vertical-align: middle;
  background-color: white;
  border-radius: 50%;
  padding: 2px;
}

.marker-control {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.marker-select {
  width: 60px;
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  padding: 3px;
}

.marker-button {
  width: 34px;
  height: 28px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  padding: 0;
}

.marker-button.minus {
  background-color: #f8d7da;
  color: #721c24;
}

.marker-button.plus {
  background-color: #d4edda;
  color: #155724;
}

.marker-button:hover {
  filter: brightness(0.9);
}

.marker-toggle-button {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: none;
  background-color: rgba(255, 255, 255, 0.3);
  color: white;
  border-radius: 50%;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 5px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.marker-toggle-button:hover {
  background-color: rgba(255, 255, 255, 0.5);
}

.marker.hidden {
  opacity: 0.7;
  transform: scale(0.95);
  max-width: 100px;
  min-width: auto;
  transition: all 0.3s ease;
  order: 999;
  /* 非表示マーカーを後ろに配置 */
}

.marker.hidden .marker-content {
  display: none;
}

.marker.hidden .marker-title {
  padding: 4px 6px;
  font-size: 12px;
}

@keyframes markerHighlight {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

/* SNSボタン部分 */
.sns_container {
  margin: 20px 0;
}



.hidden_box {
  margin-top: 100px;
  margin-bottom: 30px;
  /*前後の余白*/
  padding: 0;
}

.hidden_box label {
  padding: 15px;
  font-weight: bold;
  border: solid 2px #ffffff;
  cursor: pointer;
  border-radius: 4px;
  border-style: solid;
  border-width: 2px;
  border-color: #2c3e50;
}

/*ボタンホバー時*/

.hidden_box label:hover {
  background: #ec9943;
}

/*チェックは見えなくする*/

.hidden_box #show_label {
  display: none;
  margin-top: 20px;
}

/*中身を非表示にしておく*/

.hidden_box .hidden_show {
  height: 0;
  padding: 0;
  margin-top: 20px;
  overflow: hidden;
  opacity: 0;
  transition: 0.8s;
}

/*クリックで中身表示*/

.hidden_box input:checked~.hidden_show {
  padding: 10px 0;
  height: auto;
  opacity: 1;
}