:root {
  --bg: #ffffff;
  --paper: #ffffff;
  --panel: #ffffff;
  --text: #151515;
  --muted: #6d7168;
  --line: #e6eadf;
  --soft: #f8fbf0;
  --accent: #b6ff2e;
  --accent2: #9eea18;
  --accentDark: #3f5f00;
  --ok: #16a34a;
  --bad: #e5484d;
  --shadow: 0 14px 36px rgba(32, 48, 0, .08);
  --r: 22px;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  background: #ffffff;
  color: var(--text);
  font-family: Helvetica, Arial, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: max(16px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(26px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}
.app { width: min(1060px, 100%); margin: 0 auto; }
.hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 10px 0 14px; }
h1 { margin: 0; font-size: clamp(34px, 8vw, 76px); line-height: .9; letter-spacing: -.06em; }
.subtitle { margin: 12px 0 0; color: var(--muted); font-size: 15px; line-height: 1.7; max-width: 620px; }
.lang { display: flex; gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 999px; background: #fff; box-shadow: 0 8px 20px rgba(0,0,0,.04); flex: 0 0 auto; }
.lang button { appearance: none; border: 0; background: transparent; color: var(--muted); border-radius: 999px; padding: 8px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.lang button.active { color: #101010; background: var(--accent); font-weight: 850; }
.notice { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: baseline; background: var(--soft); border: 1px solid #e0f5b3; border-radius: 20px; padding: 13px 15px; color: var(--muted); margin: 4px 0 14px; }
.notice .buildTag { display:none; }
.notice strong { color: var(--text); }
.mainGrid, .outputGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.outputGrid { margin-top: 14px; grid-template-columns: minmax(280px, .9fr) minmax(280px, 1fr); }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; }
.stepPanel { display: grid; gap: 15px; align-content: start; }
.stepHead { display: flex; gap: 12px; align-items: flex-start; }
.stepNo { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 16px; background: var(--accent); color: #111; font-size: 22px; font-weight: 900; flex: 0 0 auto; }
h2 { margin: 0; font-size: 22px; letter-spacing: -.035em; }
.stepHead p { margin: 6px 0 0; color: var(--muted); line-height: 1.55; font-size: 14px; }
.field { display: grid; gap: 8px; }
.field > span { font-size: 13px; font-weight: 850; color: var(--text); }
.field small { color: var(--muted); line-height: 1.55; font-size: 12px; }
input, textarea, select { width: 100%; border: 1.5px solid var(--line); border-radius: 18px; background: #fff; color: var(--text); padding: 14px 14px; font: inherit; font-size: 16px; outline: none; transition: border-color .15s ease, box-shadow .15s ease; }
input::placeholder, textarea::placeholder { color: transparent; }
input:focus, textarea:focus, select:focus { border-color: var(--accent2); box-shadow: 0 0 0 5px rgba(182,255,46,.34); }
.keyRequired { padding: 12px; border-radius: 20px; background: #fbfff2; border: 1px solid #e0f5b3; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn, .fileButton { appearance: none; border: 1.5px solid var(--line); border-radius: 18px; min-height: 48px; padding: 13px 16px; background: #fff; color: var(--text); font: inherit; font-weight: 850; font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.btn.primary, .fileButton { background: var(--accent); border-color: #a7ef1d; color: #111; box-shadow: 0 10px 24px rgba(151, 218, 0, .18); }
.btn:hover, .fileButton:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.fileBox { display: flex; align-items: center; gap: 10px; border: 1.5px dashed #dce8c4; border-radius: 20px; padding: 12px; background: #fbfff3; }
.fileButton { position: relative; white-space: nowrap; }
.fileButton input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.fileName { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.panelTop { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.meta, .status { color: var(--muted); font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 9px; background: #fff; }
.status.pass { color: #0f6f32; border-color: rgba(22,163,74,.28); background: rgba(22,163,74,.08); }
.status.fail { color: #b42328; border-color: rgba(229,72,77,.28); background: rgba(229,72,77,.08); }
canvas { display: block; width: 100%; max-width: 512px; aspect-ratio: 1 / 1; height: auto; border-radius: 18px; background: #111; image-rendering: auto; }
.imagePanel { display: grid; justify-items: stretch; align-content: start; }
.resultPanel { display: grid; gap: 10px; align-content: start; }
.resultBox { display: grid; gap: 12px; }
.resultStatus { margin: 0; padding: 12px 14px; border-radius: 18px; background: #fbfff2; color: var(--muted); border: 1px solid #e0f5b3; line-height: 1.55; }
.resultStatus.passText { color: #0f6f32; background: rgba(22,163,74,.08); border-color: rgba(22,163,74,.24); font-weight: 850; }
.resultStatus.failText { color: #b42328; background: rgba(229,72,77,.08); border-color: rgba(229,72,77,.24); font-weight: 850; }
.resultField textarea { min-height: 112px; resize: vertical; font-size: 16px; line-height: 1.55; font-weight: 650; }
.copy { justify-self: start; }
.details { border-top: 1px solid var(--line); padding-top: 10px; }
.details summary { cursor: pointer; color: var(--muted); font-weight: 750; }
pre { white-space: pre-wrap; word-break: break-word; margin: 12px 0 0; padding: 14px; border-radius: 18px; background: #101010; color: #e9ffd0; font-size: 12px; line-height: 1.55; max-height: 280px; overflow: auto; }
.helpPanel { margin-top: 14px; }
.helpPanel ol { margin: 12px 0 0 22px; padding: 0; color: var(--muted); line-height: 1.7; }
.tiny { color: var(--muted); font-size: 12px; line-height: 1.65; }
.visuallyHidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
@media (max-width: 820px) {
  .hero { flex-direction: column; }
  .mainGrid, .outputGrid { grid-template-columns: 1fr; }
  h1 { font-size: clamp(42px, 14vw, 74px); }
  .actions .btn { flex: 1 1 auto; }
}

.buildTag { font-size: 11px; font-weight: 850; letter-spacing: .08em; color: #3f5f00; border: 1px solid #d9efad; border-radius: 999px; padding: 4px 8px; background: #fff; }

.resultImageWrap{display:grid;gap:10px}.resultImageWrap.isHidden{display:none}.resultImageLabel{font-size:13px;font-weight:850;color:var(--text)}#resultImage{display:block;width:100%;max-width:100%;border-radius:18px;border:1px solid var(--line);background:#111}
/* AP56.2: keep the image picker native so Android/Edge/Chrome reliably opens the file chooser. */
.imageFileBox { align-items: stretch; flex-direction: column; }
.nativeFileInput {
  position: static;
  opacity: 1;
  width: 100%;
  min-height: 44px;
  padding: 10px 0;
  font: inherit;
  color: var(--text);
  cursor: pointer;
}

.autoHint{margin:0 0 12px;color:var(--muted);font-size:12px;line-height:1.55}.nativeFileInput{display:block;width:100%;padding:10px 0}
.btn.mini { min-height: 38px; padding: 9px 12px; border-radius: 14px; font-size: 12px; justify-self: start; }
