:root {
  --bg-color: #eee; /* ライトモードの背景色 */
  --text-color: #333; /* ライトモードのテキスト色 */
  --toggle-bg: #888; /* トグル背景色 */
  --toggle-handle: #ffffff; /* トグルハンドルの色 */
  --toggle-on-bg: #4caf50; /* トグルオン時の背景色 */
--border-color: #E2E8F0;
            
}

body {
  background-color: var(--bg-color);
  color: var(--text-color); line-height: 1.6;
  margin: 10px;
  transition: background-color 0.3s, color 0.3s; /* スムーズな色の変化 */
}

div { overflow-wrap: anywhere;}

.dark-mode {
  --bg-color: #000; /* ダークモードの背景色 */
  --text-color: #ccc; /* ダークモードのテキスト色 */
  --toggle-bg: #000;
  --toggle-handle: #fff;
  --toggle-on-bg: #8bc34a;
  
}
       
.toggle-container {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.toggle-label {
  margin-right: 10px;
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 20px;
  cursor: pointer;
  background-color: var(--toggle-bg);
  border-radius: 10px;
  transition: background-color 0.3s;
}

.toggle-switch::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: var(--toggle-handle);
  top: 2px;
  left: 2px;
  transition: transform 0.3s;
}

a { text-decoration: none;
   color: var(--toggle-on-bg);
}

.toggle-switch.active {
  background-color: var(--toggle-on-bg);
}

.toggle-switch.active::before {
  transform: translateX(20px);
}


#main {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.cl {
    padding: 10px; width: 380px;  
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
.cr { padding: 10px; max-width: 380px;}

@media (min-width: 1024px) {
  .cl {
   width: 600px;
  }
  .cr {
    width: 400px;
  }
}

  h1 { text-align: center; }

  h3 { margin: 10px; }
 

  textarea {
    background-color: var(--bg-color);
    color: var(--text-color);
    width: 100%;
    min-height: 120px;                /* 好みで調整 */
    box-sizing: border-box;           /* パディング・ボーダーを幅に含める */
    padding: 1em; padding-right: 2em;          
    font-family: inherit;
    font-size: 1em;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
            
        }

 .button-container {
     text-align: center;
        }

  select {
      background-color:var(--toggle-bg);
      color: white;
      margin-bottom: 5px;
 }

        button {
            
            border: none;
            border-radius: 4px;
            cursor: pointer;
            
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

#sendButton:hover {
  background-color: #45a049;
        }

#sendButton:disabled {
  background-color: dimgrey;
  color: linen;
  opacity: 1;
}

#reloadBt { top: 2.5em; }

#sendButton, #regenBt {
 background-color:var(--toggle-on-bg);
 color: white;
 padding: 5px 20px; margin: 10px;
 }

 #output {
     display:none;
     margin-top: 20px;
     padding: 15px;
     border: 1px solid #ddd;
     border-radius: 4px;
     //overflow-wrap: break-word;
        }

        #output img {
            max-width: 100%;
            height: auto;
            margin-bottom: 10px;
        }
.meta-block { overflow-wrap: normal; overflow-x: clip;}

.block { 
    margin-bottom: 20px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    
}

.image-container {
    text-align: center;
    margin-top: 10px;
}
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* 画面幅に合わせて自動調整 */
    gap: 10px;
    margin-top: 10px;
}
 img {
    width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.loading {
    text-align: center;
    margin-top: 10px;
    display: none;
}
 .block {
            opacity: 0;
            transform: translateY(60px);
            transition: opacity 0.5s, transform 0.5s;
        }

 .block.visible {
            opacity: 1;
            transform: translateY(0);
        }

#helpDiv { line-height:1.2; display: none}

#helpDiv.visible { display:block;}

#helpBt { font-size:1.2em; margin-left: 10px;}

#history { color: var(--toggle-on-bg); counter-reset: sub;}

.hisItem { display:block; margin:10px; }

.b, a.active { color: var(--text-color); font-weight:bold; }

 a.disabled { color:gray; }

.tag {      
      border-radius: 4px;
      cursor: pointer;     
    }

 pre { overflow:auto }

 
.textarea-wrapper {
    position: relative;               /* 子要素の絶対配置の基点 */
    display: inline-block;            /* 必要なら幅・高さは textarea が決める */
    width: 100%;                  /* 横幅が画面をはみ出さないように */
  }

  .clear-btn {
    position: absolute;
    top: 0.2em;                       /* textarea の padding と合わせる */
    right: 0.2em;
    width: 1.4em;
    height: 1.4em;
    line-height: 1.4em;
    text-align: center;
    font-size: 1.4rem;
    color: #666;
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s ease-in-out;
  }

  .clear-btn:hover,
  .clear-btn:focus {
    opacity: 1;
    color: #d00;
    outline: none;
  }

 .sourceBt { margin-left: 10px;}

 .hidden { display: none; }

