/* 元ツールのダークテーマを踏襲。スマホ利用があるので余白とタップ領域を広めに取る。 */
:root {
  --bg: #070c18;
  --card: #0e1525;
  --inner: #060d1b;
  --field: #050b16;
  --line: #1b2a45;
  --text: #c9d8f0;
  --muted: #4a6080;
  --blue: #60a5fa;
  --red: #f87171;
  --green: #4ade80;
  --amber: #fbbf24;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--blue); }

.wrap { max-width: 1200px; margin: 0 auto; }

header.bar {
  display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
header.bar h1 { font-size: 18px; margin: 0; color: var(--blue); }
header.bar .sub { font-size: 11px; color: var(--muted); }
header.bar nav { display: flex; gap: 8px; align-items: center; font-size: 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}
.card h2 { font-size: 13px; margin: 0 0 10px; color: var(--blue); font-weight: 600; }

.inner {
  background: var(--inner);
  border: 1px solid #132035;
  border-radius: 6px;
  padding: 10px;
}

.grid2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 900px) { .grid2 { grid-template-columns: 1fr 1fr; } }

input[type=url], input[type=text], input[type=password], textarea {
  width: 100%;
  background: var(--field);
  border: 1px solid #152035;
  color: var(--text);
  border-radius: 6px;
  padding: 10px;
  font-size: 15px; /* iOSの自動ズームを防ぐため16px近辺を維持 */
  font-family: inherit;
}
input:focus, textarea:focus { border-color: #3b82f6; outline: none; }
input::placeholder { color: #2d4060; }
textarea { resize: vertical; }
textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

button {
  font-family: inherit;
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid #1d4ed8;
  background: #0d1e3a;
  color: var(--blue);
  padding: 10px 14px;
  font-size: 13px;
  min-height: 40px;
}
button:hover:not(:disabled) { background: #152a55; }
button:disabled { opacity: .4; cursor: not-allowed; }
button.sm { padding: 6px 10px; font-size: 12px; min-height: 32px; }
button.ghost { background: #0e1e35; border-color: #1b2f50; color: #6080a0; }
button.done { background: #042b0f; border-color: #15803d; color: var(--green); }
button.fail { background: #3a0808; border-color: #7f1d1d; color: #fca5a5; }
button.primary {
  width: 100%;
  background: linear-gradient(135deg, #1d4ed8, #7c3aed);
  border: none; color: #fff; font-weight: 600;
  padding: 14px; font-size: 15px;
}

.row { display: flex; gap: 8px; align-items: center; }
.row > input { flex: 1; }

.note { font-size: 11px; min-height: 14px; margin-top: 4px; color: var(--muted); }
.note.ok { color: var(--green); }
.note.err { color: var(--red); }
.note.load { color: var(--blue); }

.label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.tabs button {
  flex: 1 1 auto; min-width: 90px;
  background: transparent; border: 1px solid var(--line); color: var(--muted);
}
.tabs button.active { background: #162d5c; color: var(--blue); border-color: #2a4d8a; }

.spec-row { display: flex; gap: 10px; padding: 7px 10px; font-size: 12px; cursor: pointer; }
.spec-row:nth-child(even) { background: rgba(29, 78, 216, .05); }
.spec-row:hover { background: #0f1d35; }
.spec-row .k { color: var(--muted); width: 40%; max-width: 180px; flex-shrink: 0; }
.spec-row .v { color: #e2e8f0; word-break: break-word; }

.badge {
  display: inline-block; padding: 4px 10px; border-radius: 6px;
  font-size: 12px; font-weight: 600;
}
.v-ok    { background: #042b0f; border: 1px solid #15803d; color: var(--green); }
.v-check { background: #2a2a00; border: 1px solid #854d0e; color: var(--amber); }
.v-ng    { background: #2a0808; border: 1px solid #7f1d1d; color: #fca5a5; }

.cond-likenew    { background: #042b0f; border: 1px solid #15803d; color: var(--green); }
.cond-verygood   { background: #1a3a0a; border: 1px solid #4d7c0f; color: #84cc16; }
.cond-good       { background: #2a2a00; border: 1px solid #854d0e; color: var(--amber); }
.cond-acceptable { background: #2a1500; border: 1px solid #9a3412; color: #fb923c; }
.cond-forparts   { background: #2a0808; border: 1px solid #7f1d1d; color: #fca5a5; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.gallery a { display: block; aspect-ratio: 1; background: #050b16; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.gallery img { width: 100%; height: 100%; object-fit: cover; }

.chars.ok { color: var(--green); }
.chars.warn { color: var(--amber); }
.chars.over { color: var(--red); }

.report { white-space: pre-wrap; font-size: 12px; color: #a0b8d0; max-height: 420px; overflow-y: auto; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 11px; }

.spinner { display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #132035; }
th { color: var(--muted); font-weight: 500; font-size: 11px; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: #1e3050; border-radius: 3px; }

/* 画像の選択(タップで選ぶ。選択中は枠とチェックで示す) */
.pick { position: relative; display: block; aspect-ratio: 1; cursor: pointer;
        background: #050b16; border: 2px solid var(--line); border-radius: 6px;
        overflow: hidden; transition: border-color .15s; }
.pick.on { border-color: var(--blue); }
.pick img { width: 100%; height: 100%; object-fit: cover; opacity: .45; transition: opacity .15s; }
.pick.on img { opacity: 1; }
.pick input { position: absolute; top: 6px; left: 6px; width: 20px; height: 20px;
              margin: 0; z-index: 1; cursor: pointer; }

/* タイトルの追加候補語 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { background: #0e1e35; border: 1px solid #1b2f50; color: var(--blue);
        font-size: 12px; padding: 5px 10px; min-height: 30px; border-radius: 14px; }
.chip:hover { background: #162840; }
.chip.over { border-color: #7f1d1d; color: var(--red); }
