/* ココフォリア立ち絵最適化（Web版） - デスクトップ版（renderer/src/App.css）と同じ配色 */

/*
 * パレット（デスクトップ版と同一）
 *   Bg          #141414  背景
 *   BorderSubtle #3a2e12  弱い枠線
 *   Gold        #c9a84c  アクセント
 *   GoldHover   #e8c46a  明るい金
 *   TextMain    #e2d9c4  本文
 *   TextSoft    #cfc3a8  補足（暗すぎない明るさ）
 *   Danger      #c05050 / #4a1818
 */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #141414;
  color: #e2d9c4;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
    "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
}

/* ドット絵なので、拡大しても補間でぼかさない。 */
.title-icon {
  flex: none;
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
}

.title-text {
  min-width: 0;
}

h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.35;
  color: #e2d9c4;
}

.title-sub {
  margin: 0 0 2px;
  color: #c9a84c;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.lead {
  margin: 0 0 6px;
  color: #cfc3a8;
  font-size: 14px;
  line-height: 1.7;
}

/* どんなときに使うか、の一行。本文より一段落とす。 */
.lead-note {
  margin: 0 0 20px;
  color: #9a8c78;
  font-size: 13px;
  line-height: 1.7;
}

fieldset {
  margin: 0 0 16px;
  padding: 12px 14px 14px;
  border: 1px solid #3a2e12;
  border-radius: 8px;
}

legend {
  padding: 0 6px;
  color: #c9a84c;
  font-size: 13px;
  font-weight: 600;
}

fieldset label {
  display: block;
  padding: 6px 4px;
  color: #cfc3a8;
  font-size: 13px;
  cursor: pointer;
}

fieldset label:hover {
  color: #e2d9c4;
}

fieldset label.is-disabled,
fieldset label.is-disabled:hover {
  color: #4e4538;
  cursor: not-allowed;
}

fieldset input[type="radio"] {
  margin-right: 6px;
  accent-color: #c9a84c;
}

fieldset input[type="radio"]:disabled {
  accent-color: #4e4538;
  cursor: not-allowed;
}

.analysis-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #3a2e12;
  border-radius: 8px;
  background: #1a1a1a;
  font-size: 13px;
}

.analysis-info dt {
  color: #9a8c78;
}

.analysis-info dd {
  margin: 0;
  color: #e2d9c4;
  font-weight: 600;
}

.drop {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 36px 16px;
  margin-bottom: 20px;
  border: 2px dashed #3a2e12;
  border-radius: 12px;
  background: #1a1a1a;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.drop:hover,
.drop:focus-visible {
  border-color: #c9a84c;
  outline: none;
}

.drop.is-dragging {
  border-color: #e8c46a;
  background: #201a0e;
}

.drop p {
  margin: 0;
  font-size: 15px;
  color: #e2d9c4;
}

.drop .hint {
  font-size: 12px;
  color: #9a8c78;
}

/* ネイティブのファイル選択欄は「選択されていません」が潰れて読めないので隠し、
   自前のボタン（label）で開く。キーボードでも押せるよう tabindex と keydown を付ける。 */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.file-button {
  display: inline-block;
  padding: 8px 18px;
  border: 1px solid #6e5218;
  border-radius: 6px;
  background: #262620;
  color: #e2d9c4;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.file-button:hover,
.file-button:focus-visible {
  background: #2f2f27;
  border-color: #c9a84c;
  outline: none;
}

.file-button.is-disabled {
  background: #262620;
  border-color: #4e4538;
  color: #9a8c78;
  cursor: not-allowed;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

button {
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

#convert {
  background: #c9a84c;
  color: #141414;
  border-color: #c9a84c;
}

#convert:hover:not(:disabled) {
  background: #e8c46a;
  border-color: #e8c46a;
}

#convert:disabled {
  background: #4e4538;
  border-color: #4e4538;
  color: #9a8c78;
  cursor: not-allowed;
}

button.danger {
  background: #4a1818;
  color: #f0d9d9;
  border-color: #c05050;
}

button.danger:hover:not(:disabled) {
  background: #c05050;
  color: #140808;
}

button.danger:disabled {
  background: #2a1414;
  border-color: #4a1818;
  color: #8a6a6a;
  cursor: not-allowed;
}

#status {
  min-height: 20px;
  margin: 20px 0 0;
  color: #cfc3a8;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  transition: color 0.15s ease, font-size 0.15s ease;
}

/* 「デスクトップ版を使ってくれ」の案内に付く入手先リンク。指で押せる高さにする。 */
#status a {
  display: inline-block;
  min-height: 24px;
  padding: 4px 0;
  color: #c9a84c;
  font-weight: 600;
}

#status a:hover {
  color: #e8c46a;
}

/*
 * 解析中・変換中は「いま動いている」がひと目で分かるようにする。
 *   - 操作できないもの（見出し・説明文・設定・注意書きなど）は全体をグレーアウトする
 *   - 停止ボタンだけは対象から外し、いつもどおり押せる状態のまま見せる
 *   - 進行状況（#status）はグレーアウトの対象から外し、むしろ他より明るく大きく見せる
 */
body.is-busy .title,
body.is-busy .lead,
body.is-busy .lead-note,
body.is-busy #drop,
body.is-busy #analysis-info,
body.is-busy #settings fieldset,
body.is-busy footer {
  opacity: 0.35;
  filter: grayscale(0.7);
  pointer-events: none;
  transition: opacity 0.15s ease, filter 0.15s ease;
}

/*
 * 処理中の表示は画面の上へ固定する。スマホだと画面が縦に長く、普通に置くと
 * 折りたたみの外へ出てしまい、「動いているのか分からない」と言われたため。
 */
body.is-busy #status {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  margin: 0;
  padding: 14px 16px calc(14px + env(safe-area-inset-top, 0px));
  border: 0;
  border-bottom: 2px solid #c9a84c;
  border-radius: 0;
  background: #201a0e;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
  color: #ffe9b0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.8;
  text-align: center;
}

/* 固定した表示のぶん、中身を下げて隠れないようにする */
body.is-busy main {
  padding-top: 96px;
}

/* 停止ボタンだけは押せるので、固定表示の下でも見つけやすい位置に置く */
body.is-busy .actions {
  position: sticky;
  bottom: 12px;
}

#result {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid #3a2e12;
  border-radius: 8px;
  background: #1a1a1a;
}

#result p {
  margin: 0 0 10px;
  color: #cfc3a8;
  font-size: 13px;
}

#result a {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 6px;
  background: #c9a84c;
  color: #141414;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

#result a:hover {
  background: #e8c46a;
}

footer {
  margin-top: 36px;
  padding-top: 16px;
  border-top: 1px solid #3a2e12;
}

footer p {
  margin: 0 0 8px;
  color: #9a8c78;
  font-size: 12px;
  line-height: 1.6;
}

footer a {
  color: #c9a84c;
}

/* 入手先のリンクは指で押せる高さにし、スマホ幅で途中改行させない。 */
#booth {
  display: inline-block;
  padding: 6px 0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

footer a:hover {
  color: #e8c46a;
}
