:root {
  --bg: #f6f6f4; --panel: #fff; --ink: #1d1f22; --muted: #6b7078; --line: #e2e2de;
  --accent: #2f5597; --accent-soft: #e8eef8; --ok: #1f7a4d; --ok-soft: #e4f3ea;
  --ng: #b3261e; --ng-soft: #fbe9e7; --wait: #8a6d00; --wait-soft: #fbf3d6; --on-accent: #fff;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #16171a; --panel: #1f2125; --ink: #e8e8e6; --muted: #9aa0a8; --line: #33363c;
    --accent: #8fb0ea; --accent-soft: #23304a; --ok: #6fcf9a; --ok-soft: #1c3328; --ng: #f08a80; --ng-soft: #3a2220;
    --wait: #e5c55a; --wait-soft: #39321a; --on-accent: #0f1420; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.6; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.top { display: flex; align-items: center; gap: 24px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; color: var(--ink); font-size: 17px; }
.top nav { display: flex; gap: 16px; }
.stage { margin-left: auto; font-size: 13px; color: var(--muted); }
main { max-width: 1180px; margin: 0 auto; padding: 24px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 28px 0 10px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card { display: block; color: inherit; }
.card:hover { text-decoration: none; border-color: var(--accent); }
.card .name { font-weight: 700; font-size: 16px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a.on { color: var(--ink); border-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
table { border-collapse: collapse; width: 100%; background: var(--panel); }
th, td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; background: var(--bg); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.ok { background: var(--ok-soft); color: var(--ok); }
.ng { background: var(--ng-soft); color: var(--ng); }
.wait { background: var(--wait-soft); color: var(--wait); }
.none { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
button, .btn { font: inherit; border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); font-weight: 600; padding: 7px 14px; border-radius: 7px; cursor: pointer; }
button.sub { background: transparent; color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
select, input[type=text], input[type=password] { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); width: 100%; max-width: 640px; }
label.field { display: block; margin: 10px 0; }
label.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 3px; }
.tool { margin-bottom: 14px; }
.tool p { margin: 4px 0 8px; }
pre.log { background: #111; color: #ddd; padding: 12px; border-radius: 8px; overflow: auto; max-height: 420px; font-size: 12px; line-height: 1.45; white-space: pre-wrap; word-break: break-all; }
.md table { margin: 8px 0 14px; font-size: 14px; }
.md h1 { font-size: 19px; margin-top: 4px; }
.md code { background: var(--bg); padding: 0 4px; border-radius: 4px; font-size: 13px; }
.md pre { background: var(--bg); padding: 10px; border-radius: 6px; overflow: auto; }
.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.imgs figure { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: zoom-in; }
.imgs img { width: 100%; height: 200px; object-fit: contain; background: #fff; display: block; }
.imgs figcaption { font-size: 12px; padding: 6px 8px; color: var(--muted); word-break: break-all; }
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 20; display: flex; align-items: center; justify-content: center; }
.viewer[hidden] { display: none; }
.viewer img { max-width: 96vw; max-height: 94vh; background: #fff; }
.viewer .close { position: absolute; top: 12px; right: 16px; font-size: 22px; background: transparent; border: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.err { color: var(--ng); }
.steps { margin: 0; padding-left: 18px; font-size: 13px; }
@media (max-width: 640px) { main { padding: 16px; } .top { gap: 12px; padding: 10px 16px; flex-wrap: wrap; } .stage { margin-left: 0; } th, td { padding: 6px; } }
td select { min-width: 110px; }

.sheet { position: relative; border: 1px solid var(--line); background: #fff; margin-bottom: 8px; }
.sheet img { display: block; width: 100%; }
.sheet.pinning { cursor: crosshair; outline: 3px solid var(--accent); }
.sheet .box { position: absolute; border: 3px solid #e0262b; border-radius: 4px; box-shadow: 0 0 0 2px rgba(255,255,255,.8); }
.sheet .box.manual { border-color: #2f6fe0; }
.sheet .box.st-対象外 { opacity: .35; border-style: dashed; }
.sheet .box.st-対応済み { border-color: #1f9a5a; }
.sheet .box span { position: absolute; top: -12px; left: -12px; min-width: 22px; height: 22px; border-radius: 11px; background: #e0262b; color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.sheet .box.manual span { background: #2f6fe0; }
.issue { display: grid; grid-template-columns: 32px 220px 1fr; gap: 14px; margin-bottom: 12px; align-items: start; }
.issue .num { font-weight: 700; font-size: 18px; }
.issue .crop { width: 220px; max-height: 220px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 6px; cursor: zoom-in; }
textarea { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); width: 100%; max-width: 640px; }
input[type=file] { font: inherit; }
@media (max-width: 640px) { .issue { grid-template-columns: 1fr; } .issue .crop { width: 100%; } }

/* ---- わかりやすい画面（ホーム・手順・図面の一覧） */
.lead { font-size: 15px; color: var(--ink); margin: 4px 0 18px; }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 8px; }
.action { display: flex; gap: 16px; align-items: center; padding: 22px; border-radius: 14px; background: var(--panel); border: 2px solid var(--accent); color: var(--ink); }
.action:hover { text-decoration: none; background: var(--accent-soft); }
.action b { display: block; font-size: 19px; margin-bottom: 4px; }
.action span { font-size: 14px; color: var(--muted); }
.action.off { border-color: var(--line); opacity: .6; }
.action .ic { flex: none; width: 54px; height: 54px; border-radius: 12px; background: var(--accent); color: #fff; font-size: 28px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.action .ic.red { background: #d0312d; font-size: 22px; }
.facts { list-style: none; padding: 0; margin: 10px 0 6px; font-size: 14px; }
.facts li { margin: 3px 0; }
.card .go { font-size: 13px; color: var(--accent); font-weight: 600; margin-top: 6px; }
.howto { margin-top: 24px; }
.howto summary { cursor: pointer; font-weight: 600; }
.howto li { margin: 6px 0; }
.step { display: flex; gap: 16px; margin-bottom: 14px; }
.step .sn { flex: none; width: 36px; height: 36px; border-radius: 18px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 17px; display: flex; align-items: center; justify-content: center; }
.step.done .sn { background: var(--ok-soft); color: var(--ok); }
.step .sb { flex: 1; min-width: 0; }
.step h3 { margin: 4px 0 8px; font-size: 17px; }
.btn { display: inline-block; }
.btn:hover { text-decoration: none; opacity: .92; }
.btn.sub { background: transparent; color: var(--accent); }
button.big { font-size: 16px; padding: 10px 22px; }
.bar { height: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin: 10px 0; max-width: 640px; }
.bar[hidden] { display: none; }
.bar > div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.bar.busy > div { width: 35%; animation: slide 1.2s infinite ease-in-out; }
@keyframes slide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.upl { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.upl .bar { flex-basis: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px; font-size: 13px; }
.chip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.k-main { background: var(--accent-soft); color: var(--accent); }
.k-sub { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.thumb { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; color: var(--ink); }
.thumb:hover { text-decoration: none; border-color: var(--accent); }
.thumb img { width: 100%; height: 160px; object-fit: contain; background: #fff; display: block; border-bottom: 1px solid var(--line); }
.thumb .cap { padding: 6px 9px 9px; }
.thumb .t { font-weight: 600; font-size: 14px; margin-top: 2px; word-break: break-all; }
.pageview { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .pageview { grid-template-columns: 1fr; } }
.lead-box { margin: 10px 0 6px; }

.pageview .sheet { min-height: 200px; background: #fff; }
.pageview .sheet::before { content: '図面を表示しています…（はじめて開くページは数秒かかります）'; position: absolute; top: 12px; left: 12px; color: #888; font-size: 13px; }
.pageview .sheet img { position: relative; z-index: 1; }
.fb-btn { position: fixed; right: 18px; bottom: 18px; z-index: 15; border-radius: 99px; padding: 10px 18px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal form { width: 100%; max-width: 560px; }
.bigurl { font-size: 20px; font-weight: 700; font-family: ui-monospace, Menlo, monospace; margin: 6px 0; }
#share-msg { max-width: 100%; }
.top nav { flex-wrap: wrap; }
.view3d { height: 520px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 10px 0 4px; background: #eef1f5; }
.shape { margin: 14px 0 22px; }
.olwrap { position: relative; border: 1px solid var(--line); background: #fff; max-width: 1100px; }
.olwrap img { display: block; width: 100%; }
.olwrap svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.olwrap.drawing { outline: 3px solid #2f6fe0; cursor: crosshair; }
table.lv input { max-width: 120px; }
.layers label { margin-left: 10px; white-space: nowrap; }
.tip3d { position: absolute; z-index: 3; background: rgba(20,22,26,.88); color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 6px; pointer-events: none; white-space: nowrap; }
.tip3d[hidden] { display: none; }
input[type=color] { width: 48px; height: 28px; border: 1px solid var(--line); border-radius: 6px; background: none; padding: 0; }
.aibox { background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; margin: 6px 0 4px; max-width: 640px; }
.elbox { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 6px 0 4px; max-width: 640px; }
.hlbar { margin-bottom: 12px; border-color: #ff7a1a; }
.propbox { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; margin: 6px 0 4px; max-width: 640px; }
.propbox.adopted { border: 1px solid var(--ok); }
.mform { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; font-size: 13px; }
.mform select, .mform input { width: auto; }
.imgs.renders { grid-template-columns: repeat(auto-fill, minmax(520px, 1fr)); }
.imgs.renders img { height: auto; max-height: 360px; }
