* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
body {
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
  background: #f6f7f9;
  color: #1c2733;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
a { color: #1565c0; word-break: break-all; }

.site-header {
  background: #ffffff;
  border-bottom: 3px solid #1565c0;
  padding: 20px 16px 14px;
  text-align: center;
}
.site-header h1 { margin: 0 0 6px; font-size: 1.5rem; }
.badge-proto {
  display: inline-block; vertical-align: middle;
  background: #fff3e0; color: #e65100; border: 1px solid #ffb74d;
  border-radius: 6px; font-size: .75rem; padding: 1px 8px; margin-left: 4px;
}
.tagline { margin: 0; color: #44566a; font-size: .92rem; }

.container { max-width: 720px; margin: 0 auto; padding: 12px; }

.notice-box {
  background: #fff8e1;
  border: 2px solid #f9a825;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 0 14px;
  font-size: .92rem;
}
.notice-box h2 { margin: 0 0 8px; font-size: 1.05rem; }
.notice-box p { margin: 6px 0; }
.notice-box ul { margin: 6px 0 0; padding-left: 1.3em; }

.card {
  background: #fff;
  border: 1px solid #d8dee5;
  border-radius: 12px;
  padding: 16px;
  margin: 0 0 14px;
}
.card h2 { margin: 0 0 8px; font-size: 1.12rem; border-left: 5px solid #1565c0; padding-left: 8px; }
.hint { color: #5a6b7d; font-size: .87rem; margin: 4px 0 10px; }
.status { min-height: 1.4em; font-size: .9rem; color: #0d47a1; margin: 8px 0 0; white-space: pre-wrap; word-break: break-word; }
.status.error { color: #c62828; }

.btn {
  appearance: none; border: 1px solid #90a4ae; background: #fff; color: #1c2733;
  border-radius: 8px; padding: 10px 16px; font-size: .95rem; cursor: pointer; min-height: 48px;
}
.btn:hover { background: #eef3f7; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: #1565c0; border-color: #1565c0; color: #fff; font-weight: 700; }
.btn-primary:hover { background: #0d47a1; }
.btn-ghost { color: #546e7a; margin-top: 8px; }
.btn-big { width: 100%; font-size: 1.02rem; min-height: 52px; }
.btn-sample { min-height: 44px; font-size: .88rem; padding: 8px 12px; }

.row { display: flex; gap: 8px; }
.row .btn { flex: 0 0 auto; }
.text-input {
  border: 1px solid #90a4ae; border-radius: 8px; padding: 10px;
  font-size: 1rem; min-height: 48px; max-width: 100%; width: 100%;
  font-family: inherit;
}
.grow { flex: 1 1 auto; min-width: 0; }
.area { min-height: 110px; resize: vertical; margin-bottom: 10px; }

.samples { margin-top: 14px; border-top: 1px dashed #d8dee5; padding-top: 10px; }
.samples-title { font-size: .85rem; color: #5a6b7d; margin: 0 0 8px; }
.sample-btns { display: flex; flex-wrap: wrap; gap: 8px; }

.video-wrap {
  margin-top: 10px; border-radius: 10px; overflow: hidden; background: #000;
}
.video-wrap video { display: block; width: 100%; max-height: 320px; object-fit: cover; }

.result { margin: 0 0 14px; }
.result-banner {
  border-radius: 12px; padding: 18px 16px; text-align: center;
  border: 2px solid #b0bec5; background: #eceff1;
}
.result-banner .rb-icon { font-size: 2.2rem; line-height: 1.2; }
.result-banner .rb-title { font-size: 1.25rem; font-weight: 800; margin: 4px 0; }
.result-banner .rb-sub { font-size: .9rem; margin: 0; }
.result-banner.level-red { background: #fdecea; border-color: #c62828; color: #7f1010; }
.result-banner.level-yellow { background: #fff8e1; border-color: #f9a825; color: #6d4c00; }
.result-banner.level-green { background: #e8f5e9; border-color: #2e7d32; color: #144d1b; }
.result-banner.level-nodata, .result-banner.level-notlisted, .result-banner.level-unknown { background: #eceff1; border-color: #78909c; color: #37474f; }

.product-info {
  background: #fff; border: 1px solid #d8dee5; border-radius: 12px;
  padding: 12px 16px; margin-top: 10px; font-size: .95rem;
}
.product-info .pi-name { font-weight: 800; font-size: 1.05rem; }
.product-info .pi-meta { color: #5a6b7d; font-size: .85rem; }

.shop-link {
  background: #fff; border: 1px solid #d8dee5; border-radius: 12px;
  padding: 10px 16px; margin-top: 10px; font-size: .95rem;
}
.shop-link a { font-weight: 700; }
.shop-link .shop-note { color: #5a6b7d; font-size: .8rem; margin: 4px 0 0; }

.match-item {
  background: #fff; border: 1px solid #d8dee5; border-left: 8px solid #b0bec5;
  border-radius: 10px; padding: 12px 14px; margin-top: 10px;
}
.match-item.level-red { border-left-color: #c62828; }
.match-item.level-yellow { border-left-color: #f9a825; }
.match-item .mi-name { font-weight: 800; font-size: 1.02rem; }
.match-item .mi-class { display: inline-block; background: #eceff1; border-radius: 6px; padding: 0 8px; font-size: .78rem; color: #37474f; margin-left: 6px; }
.match-item .mi-term { font-size: .85rem; color: #5a6b7d; margin: 2px 0; }
.match-item .mi-note { font-size: .9rem; margin: 4px 0 0; }

.next-steps { background: #fff; border: 1px solid #d8dee5; border-radius: 10px; padding: 12px 14px; margin-top: 10px; }
.next-steps .ns-title { font-weight: 700; margin: 0 0 8px; font-size: .95rem; }
.ns-btns { display: flex; flex-wrap: wrap; gap: 8px; }

.ing-details { background: #fff; border: 1px solid #d8dee5; border-radius: 10px; padding: 10px 14px; margin-top: 10px; }
.ing-details summary { cursor: pointer; font-size: .9rem; font-weight: 700; }
.ing-text { font-size: .88rem; white-space: pre-wrap; word-break: break-word; color: #37474f; }
.scope-note { font-size: .85rem; color: #5a6b7d; margin: 10px 2px 0; }

.site-footer { background: #fff; border-top: 1px solid #d8dee5; padding-bottom: 24px; }
.site-footer h2 { font-size: 1.05rem; margin: 14px 0 6px; }
.foot-list { margin: 0; padding-left: 1.3em; font-size: .9rem; color: #37474f; }
.foot-list li { margin: 4px 0; }

@media (max-width: 480px) {
  .site-header h1 { font-size: 1.28rem; }
  .card { padding: 12px; }
  .result-banner .rb-title { font-size: 1.12rem; }
}

.subhead { font-size: 1rem; margin: 18px 0 2px; }
.subhead:first-of-type { margin-top: 6px; }

.webview-notice {
  background: #fdecea;
  border: 2px solid #c62828;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 0 14px;
}
.webview-notice .wv-title { font-weight: 800; font-size: 1.05rem; color: #7f1010; margin: 0 0 6px; }
.webview-notice p { margin: 6px 0; font-size: .92rem; }
.webview-notice .wv-url {
  background: #fff; border: 1px dashed #c62828; border-radius: 8px;
  padding: 8px 10px; font-size: .85rem; word-break: break-all;
  user-select: all; -webkit-user-select: all;
}
.webview-notice .wv-steps { font-size: .85rem; color: #5a6b7d; }

.progress { background: #e3eaf1; border-radius: 6px; height: 10px; overflow: hidden; margin-top: 10px; }
.progress-bar { background: #1565c0; height: 100%; width: 0; transition: width .2s ease; }

.lang-switch { display: flex; gap: 8px; margin: 10px 0; }
.lang-btn { flex: 1 1 0; appearance: none; border: 1px solid #90a4ae; background: #fff; color: #1c2733; border-radius: 8px; padding: 10px 8px; font-size: .92rem; cursor: pointer; min-height: 44px; }
.lang-btn.is-active { background: #1565c0; border-color: #1565c0; color: #fff; font-weight: 700; }
.legal h3 { margin: 1.4em 0 .4em; font-size: 1.02rem; }
.legal p, .legal li { line-height: 1.75; }
.legal ul { padding-left: 1.3em; }
.ocr-result { margin-top: 10px; }
.ocr-result .area { margin-bottom: 10px; }

.register-box {
  background: #e8f5e9; border: 1px solid #a5d6a7; border-radius: 10px;
  padding: 12px 14px; margin-top: 10px;
}
.register-box .ns-title { font-weight: 700; margin: 0 0 4px; font-size: .95rem; }

.unverified-badge {
  background: #fff3e0; border: 2px solid #fb8c00; border-radius: 10px;
  padding: 10px 14px; margin-top: 10px; font-size: .9rem;
}
.unverified-badge .uv-title { font-weight: 800; color: #e65100; margin: 0 0 4px; font-size: 1rem; }
.unverified-badge p { margin: 0; }

.report-box {
  background: #fff; border: 1px solid #d8dee5; border-radius: 10px;
  padding: 12px 14px; margin-top: 10px;
}
.report-box .ns-title { font-weight: 700; margin: 0 0 4px; font-size: .95rem; }
.report-box .area { margin-bottom: 10px; }

.history-item { display: flex; align-items: baseline; gap: 8px; padding: 8px 2px; border-top: 1px dashed #d8dee5; font-size: .92rem; }
.history-item:first-child { border-top: none; }
.history-item .hi-icon { flex: 0 0 auto; }
.history-item .hi-main { flex: 1 1 auto; min-width: 0; overflow-wrap: break-word; }
.history-item .hi-label { font-weight: 700; }
.history-item .hi-hits { display: block; color: #5a6b7d; font-size: .83rem; }
.history-item .hi-time { flex: 0 0 auto; color: #5a6b7d; font-size: .8rem; }

/* ============ 画面下部の固定バー（処理中・結果の見失い防止） ============ */
body.has-sticky { padding-bottom: 76px; }
.sticky-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; display: flex; align-items: center; gap: 10px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: #263238; color: #fff; box-shadow: 0 -3px 12px rgba(0,0,0,.28); font-size: .92rem; }
.sticky-bar[hidden] { display: none; }
.sticky-bar .sb-icon { font-size: 1.3rem; line-height: 1; flex: none; }
.sticky-bar .sb-text { flex: 1 1 auto; line-height: 1.4; }
.sticky-bar .sb-jump { flex: none; background: #fff; color: #0d47a1; border: 0; border-radius: 999px; padding: 9px 14px; font-size: .92rem; font-weight: 700; }
.sticky-bar .sb-close { flex: none; background: transparent; border: 0; color: inherit; font-size: 1.25rem; line-height: 1; padding: 6px 8px; }
.sticky-bar.level-red { background: #c62828; }
.sticky-bar.level-yellow { background: #f9a825; color: #212121; }
.sticky-bar.level-green { background: #2e7d32; }
.sticky-bar.level-nodata, .sticky-bar.level-notlisted, .sticky-bar.level-unknown { background: #546e7a; }
.sticky-bar.mode-busy { background: #1565c0; }
.sticky-bar.mode-error { background: #d84315; }
.sticky-bar.mode-info { background: #263238; }
