/* WTG共通スタイル */

/* 全体のスタイル */
body {
  margin: 0;
  padding: 10px 20px;
  font-family: Arial, sans-serif;
  /* overflow-x: hidden; 不必要なスクロールバーを非表示 */
}

/* 横スクロールの親要素 */
.container {
  display: flex;
  width: max-content;
  /* 子要素の幅に合わせて親要素の幅を調整 */
  overflow-x: auto;
  /* 横スクロール可能にする */
  gap: 10px;
  /* ボックス間のスペース */
  padding: 0px;
  /* 外側の余白 */
  box-sizing: border-box;
  line-height: 1em;
}

.display-none {
    display: none;
}

.input-box {
  width: 400px;
  /* 固定の横幅 */
  /* height: 600px; 明確な高さを指定 */
  /* height: calc(100lvh - 100px); */
  display: flex;
  flex-direction: column;
  /* 子要素を縦に並べる */
  gap: 0px;
  /* 内側の余白 */
  justify-content: flex-start;
  /* 上部揃え */
  align-items: flex-start;
  /* 中央揃え */
  box-sizing: border-box;
  padding: 0px;
  /* 内側の余白を含む */
}

@media (max-width: 576px) {
  /* スマホ時はコンテナを画面幅に合わせ、input-box をデバイス幅に */
  .container {
    width: 100% !important;
  }
  .container .input-box {
    /* body の左右 padding(20px x2) を考慮して 100vw から 40px を差し引く */
    width: calc(100vw - 40px) !important;
    flex: 0 0 calc(100vw - 40px) !important;
    max-width: calc(100vw - 40px) !important;
    min-width: calc(100vw - 40px) !important;
    box-sizing: border-box;
  }
  .container .editting-box {
    /* input-box と同じデバイス幅に合わせる */
    width: calc(100vw - 40px) !important;
    flex: 0 0 calc(100vw - 40px) !important;
    max-width: calc(100vw - 40px) !important;
    min-width: calc(100vw - 40px) !important;
    box-sizing: border-box;
  }
  .container .answer-box {
    /* input-box と同じデバイス幅に合わせる */
    width: calc(100vw - 40px) !important;
    flex: 0 0 calc(100vw - 40px) !important;
    max-width: calc(100vw - 40px) !important;
    min-width: calc(100vw - 40px) !important;
    box-sizing: border-box;
  }
  /* フッター重なり回避（スマホ時） */
  .val-form, .edit-form, .comment-form {
    padding-bottom: 120px;
  }
}

/* 編集ウインドウ内のh4とtextarea間のスペース */
.input-box>h6 {
  margin: 0px 10px 0px 10px;
  /* h4要素の上下マージンを0に設定 上・右・下・左*/
  padding: 0px;
}

/* 入力ウインドウのスタイル */
.val-form {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  /* 親ボックスの高さをフル活用 */
  margin: 0px;
  padding: 0px; /* プルダウンの左右マージン5pxを厳密に満たすために0に調整 */
  gap: 0px;
  /* box-sizing: border-box; */
}

/* フッター重なり回避（共通） */
.val-form { padding-bottom: 100px; }
.edit-form { padding-bottom: 100px; }
.comment-form { padding-bottom: 100px; }

.val-form textarea {
  display: block;
  flex: 0 0 auto;
  width: 95%;
  height: 4em;
  /* resize: none; */
  font-size: 16px;
  margin: 0 auto;
  /* 上部マージンを2pxに設定 上下・左右*/
  padding: 5px;
  /* box-sizing: border-box; */
  line-height: 1.6;
}

.val-form input{
  height: 2em;
  width: 98%;
  margin: 2px 0px;
  padding: 3px;
}

.val-form input#person1{
  height: 3em;
}

.val-form textarea#situation{
  height: 8em;
}

.val-form textarea#persons{
  margin: 3px 0px 0px;
  height: 8em;
}

.val-form textarea#question{
  height: 10em;
}  

.val-form textarea#explanation{
  height: 20em;
}  

.val-form textarea#purpose{
  height: 6em;
}

.val-form textarea#replyTargetEmail{
  font-size: 14px;
  height: 20em;
}

.val-form textarea.direction{
  height: 15em;
}

.val-form textarea.direction-disabled{
  display: none;
}  

.val-form textarea#mail_body{
  height: 30em;
}

.val-form textarea#submission {
  height: 35em;
  width: 95%;
  margin: 0 auto;
  padding: 5px;
  line-height: 1.6;
}

/* 週報添削用：字数超過時の枠線スタイル（フォーカス時も適用） */
.val-form textarea#submission.over-limit,
.val-form textarea#submission.over-limit:focus {
  border: 6px groove #c81861 !important;
  outline: none; /* ブラウザデフォルトのフォーカスアウトラインを無効化 */
}

.val-form .row {
  display: flex;
  flex-direction: row;
  gap: 16px; /* ペア間の間隔 */
  margin: 2px 1px;
}

.val-form .radio_choice {
  width: 80%;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 4px; /* ボタンとラベルの距離 */
}

.radio-option label {
  writing-mode: horizontal-tb; /* 横書きに戻す */
  white-space: nowrap;         /* テキストを折り返さない */
}

.select-wrapper {
  position: relative;
  display: block;
}

.val-form .dropdown {
  margin-top: 6px;
  margin-right: 2px;
  padding-right: 25px; /* プルダウンアイコンのためのスペース */
  /* appearance: menulist;          デフォルトのプルダウン矢印を表示 */
  appearance: none; /* デフォルトの矢印アイコンを消す */
  -webkit-appearance: none; /* Safari向け */
  -moz-appearance: none; /* Firefox向け */
  /* background-position: right 5px center;  アイコン位置 */
  background-repeat: no-repeat;
  border: 1px solid #473636;  /* 枠線 */
  padding: 5px 10px;  /* 内側の余白 */
}

.val-form .dropdown.errata {
  font-size: 9px;  /* 文字サイズ */
  width: calc(4ch + 25px); /* 3chは1文字分の幅の3倍 + 20pxはプルダウンアイコンの幅 */
}

.val-form .dropdown.option {
  font-size: 12px;  /* 文字サイズ */
  width: 25px;
}

.val-form .dropdown.choice {
  font-size: 20px;
  text-align: center;
  display: block;
  width: calc(100% - 10px); /* input-box 幅いっぱい（左右 5px マージン） */
  margin: 0 5px 5px;
  box-sizing: border-box;
}

.val-form textarea.option{
  flex: 1;
  /* resize: none; */
}

.val-form textarea.expn{
  flex: 1;
  /* resize: none; */
  height: 15em;
}

.val-form p {
  margin: 1px;
}

/* 週報添削用文字数カウンター */
#chara-counter {
  font-size: 11px;
  color: #555555;
  text-align: right;
  margin-left: auto;
  align-self: flex-end;
}

.val-form .row #back-to-menu { margin-left: auto; margin-right: 10px; }

/* 子要素のスタイル */
.answer-box {
  width: 700px;
  /* 固定の横幅 */
  /* height: 600px; 明確な高さを指定 */
  display: flex;
  flex-direction: column;
  /* 子要素を縦に並べる */
  gap: 0px;
  /* 内側の余白 */
  justify-content: flex-start;
  /* 上部揃え */
  align-items: left;
  /* 中央揃え */
  box-sizing: border-box;
  padding: 4px 5px 4px;
  /* 内側の余白を含む */
  font-size: 14px;
}

.response-container {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* 上詰め対策：.answerクラス */
.answer {
  flex: 0 0 auto;
}

/* 上詰め対策：.comparisonクラス */
.comparison {
  flex: 0 0 auto;
}

.answer-box>h6 {
  margin: 0px 10px 5px 10px;
  /* h4要素の上下マージンを0に設定 上・右・下・左*/
  padding: 0px;
}

.answer-box .row {
  display: flex;
  flex-direction: row;
  /* margin-bottom: 2px; */
  margin: 2px 1px;
}

.answer-box .row #back-to-menu { margin-left: auto; margin-right: 10px; }

.answer-box #reference-text {
  margin-top: 20px;
  /* margin-top: 90px; */
  font-size: 14px;
}

/* 子要素のスタイル */
.editting-box {
  width: 600px;
  /* 固定の横幅 */
  /* height: 600px; 明確な高さを指定 */
  display: flex;
  flex-direction: column;
  /* 子要素を縦に並べる */
  gap: 0px;
  /* 内側の余白 */
  justify-content: flex-start;
  /* 上部揃え */
  align-items: left;
  /* 中央揃え */
  box-sizing: border-box;
  padding: 0px 3px;
  /* 内側の余白を含む */
}

/* 編集ウインドウ内のh4とtextarea間のスペース */
.editting-box>h6 {
  margin: 0px 10px 0px 10px;
  /* h4要素の上下マージンを0に設定 上・右・下・左*/
  padding: 0px;
}
.editting-box>p {
  margin: 5px 0px 0px;
  /* h4要素の上下マージンを0に設定 上・右・下・左*/
  padding: 0px;
}
.editting-box .row {
  display: flex;
  flex-direction: row;
  /* margin-bottom: 2px; */
  margin: 2px 1px;
}

/* 編集ウインドウのスタイル */
.edit-form {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  /* 親ボックスの高さをフル活用 */
  margin: 0px;
  padding: 2px 2px;
  gap: 0px;
  box-sizing: border-box;
}

.edit-form textarea {
  flex: 1;
  width: 100%;
  height: 90%;
  min-height: calc(100svh - 200px);
  /* 親ボックスの高さをフル活用 */
  /* resize: none; */
  /* font-size: 16px; */
  margin: 2px 0px;
  /* 上部マージンを2pxに設定 上下・左右*/
  padding: 2px;
  box-sizing: border-box;
}

.edit-form input[type="submit"] {
  align-self: flex-end;
  margin: 0px;
  padding: 2px 5px;
  font-size: 16px;
  cursor: pointer;
}

.comment-box {
  width: 400px;
  /* 固定の横幅 */
  /* height: 600px; 明確な高さを指定 */
  display: flex;
  flex-direction: column;
  /* 子要素を縦に並べる */
  gap: 0px;
  /* 内側の余白 */
  justify-content: flex-start;
  /* 上部揃え */
  align-items: left;
  /* 中央揃え */
  box-sizing: border-box;
  padding: 0px 3px;
  /* 内側の余白を含む */
  font-size: 16px;
}

/* 編集ウインドウ内のh4とtextarea間のスペース */
.comment-box>h6 {
  margin: 0px 10px 0px 10px;
  /* h4要素の上下マージンを0に設定 上・右・下・左*/
  padding: 0px;
}
.comment-box>p {
  margin: 5px 0px 0px;
  /* h4要素の上下マージンを0に設定 上・右・下・左*/
  padding: 0px;
}

/* コメント・ウインドウのスタイル */
.comment-form {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  /* 親ボックスの高さをフル活用 */
  margin: 0px;
  padding: 2px 2px;
  gap: 0px;
  box-sizing: border-box;
  position: relative;
}
/* statement_evaluator fixes */
.comment-box .row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.comment-box .row > #back-to-menu {
  margin-left: auto;
}

/* Equal height for three columns, driven by CSS var set via JS */
.container > .comment-box,
.container > .input-box,
.container > .answer-box,
.container > .editting-box {
  height: var(--columns-height, calc(100lvh - 100px));
}

.d-flex {
  display: flex;
  flex-direction: row;
}

.flying-text {
  position: fixed;
  top: 0;   /* Web Animations API の translate 基点 */
  left: 0;  /* Web Animations API の translate 基点 */
  background: #e8f4ff;
  padding: 8px 10px;  /* 上下のパディングを少し調整 */
  border-radius: 4px;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  white-space: nowrap;  /* 行の折り返しを防止 */
  margin: 0;
  box-sizing: border-box;
  height: 24px;  /* 行の高さを固定 */
  line-height: 1.2;  /* テキストの行高さを調整 */
  overflow: hidden;  /* はみ出しを防止 */
  /* 長い行のテキスト処理 */
  text-overflow: ellipsis;
  max-width: 80vw;
}

.flying-text.animate {
  opacity: 0;
  transform: scale(0.5);
}

#generated-text {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 10px;
  border: 1px solid #ddd;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  /* ストリーミングで受け取ったテキストの改行をそのまま表示する */
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5rem;
}

#result.copied {
  background-color: #e8f4ff;
  box-shadow: 0 0 15px rgba(0, 123, 255, 0.3);
  animation: glow 0.8s ease-in-out;
}

@keyframes glow {
  0% {
      box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
  }
  50% {
      box-shadow: 0 0 20px rgba(0, 123, 255, 0.5);
  }
  100% {
      box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
  }
}

.btn {
  display: flex;
  padding: 5px 2px;
  min-height: 40px;
  cursor: pointer;
  border-radius: 3px;
  user-select: none;
  transition: all 0.3s ease-in-out;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  justify-content: space-around;
  position: relative;
  overflow: hidden;
  align-items: center;
  margin: 2px;
  width: 180px;
  font-size: 16px;
  font-weight: 600;
  flex-direction: column;
  line-height: 1.5;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn.active {
  transform: scale(0.95);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.btn-multiline {
  /* 改行を保持し、表示する */
  white-space: pre-line;
  /* ボタンの最小幅を設定
  min-width: 120px; */
  /* 余白を追加して読みやすく
  padding: 0.5rem 1rem;
  /* テキストを中央寄せ */
  /* text-align: center; */
}

.btn-disabled {
  color: gray;
  cursor: not-allowed;
}

.btn.btn-back { width: auto; min-width: 40px; max-width: 80px; display: inline-flex; flex-direction: row; align-items: center; justify-content: center; column-gap: 4px; white-space: nowrap; }
.btn.btn-back .material-icons { font-size: 18px; line-height: 1; }

.btn2 {
  position: relative;
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin: 2px 2px 30px;
  width: 180px;
  border-radius: 3px;
  padding: 10px 25px;
  color: rgb(75, 71, 37);
  transition: 0.3s ease-in-out;
  font-weight: 600;
  background: rgb(231, 218, 97, 0.7);
  flex-direction: column;
}

.btn2:hover {
  background-color: rgba(228, 188, 10, 0.7);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn2.active {
  transform: scale(0.95);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  background-color: rgba(78, 73, 21);
}

.btn2.btn2select {
  color: rgb(235, 228, 167);
  background: rgb(108, 119, 107, 0.8);
}

.material-symbols-outlined {
  font-variation-settings:
  'FILL' 0,
  'wght' 400,
  'GRAD' 0,
  'opsz' 100
}

/* --- JSが付与する共通UIクラス --- */

/* ユーザーメッセージ表示（panel_helpers / チャット） */
.user-message {
    background-color: #e3f2fd;
    padding: 10px;
    margin: 10px 0;
    border-left: 4px solid #2196f3;
    border-radius: 4px;
}

/* エラーメッセージ表示 */
.error-message {
    background-color: #ffe6e6;
    color: #d32f2f;
    border: 1px solid #ffcdd2;
    border-left: 4px solid #d32f2f;
    border-radius: 4px;
    padding: 15px;
    margin: 10px 0;
    font-size: 14px;
}

/* ストリーミング中プレースホルダ */
.response-streaming {
    white-space: pre-wrap;
}

/* コピーアニメーション用フィードバックコンテナ（writing_copy.js） */
.copy-feedback-container {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 9999;
}

/* コピーアニメーション行要素 */
.copy-animation-line {
    position: absolute;
    font-family: inherit;
    font-size: inherit;
    white-space: pre;
    padding: 2px 4px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    margin: 0;
    left: 0;
}

/* Markdownテーブル整列クラス（panel_helpers.js） */
.panel-md-table th.align-left,
.panel-md-table td.align-left  { text-align: left; }
.panel-md-table th.align-center,
.panel-md-table td.align-center { text-align: center; }
.panel-md-table th.align-right,
.panel-md-table td.align-right  { text-align: right; }

/* ボタン無効化クラス（common.js） */
.js-btn-disabled {
    pointer-events: none;
    opacity: 0.3;
}

/* ページ別のフッター余白調整：メール生成（email_generator_01.html） */
@media (max-width: 576px) {
  /* スマホ時は +20px 余白を追加（ベース120px → 140px） */
  .container:has(select#tone) .val-form { padding-bottom: 140px !important; }
}
@media (min-width: 577px) {
  /* デスクトップ時は +20px 余白を追加（ベース100px → 120px） */
  .container:has(select#tone) .val-form { padding-bottom: 120px !important; }
}

/* ページ別のフッター余白調整：メール評価（email_evaluator.html） */
@media (max-width: 576px) {
  .container:has(select#messegeAction) .val-form { padding-bottom: 160px !important; }
}
@media (min-width: 577px) {
  .container:has(select#messegeAction) .val-form { padding-bottom: 120px !important; }
}

/* ページ別のフッター余白調整：拡張思考（extended_thinking.html） */
@media (max-width: 576px) {
  .container:has(select#complexity) .val-form { padding-bottom: 160px !important; }
}
@media (min-width: 577px) {
  .container:has(select#complexity) .val-form { padding-bottom: 120px !important; }
}

.upload-btn {
  min-height: 40px;
  cursor: pointer;
}

/* 禁止用語置換通知 */
.replacement-note {
  font-size: 14pt;
  margin: 10px 0;
}
