
/* Layout: 上に物件の切り替えと操作、下いっぱいに3D、その下に読み取り結果 */
:root {
  --bg: #eef2f1; --surface: #ffffff; --ink: #17211f; --muted: #5b6a67; --line: #cad6d3;
  --accent: #1d5f8a; --fan: #c4372f; --inlet: #2f8a57; --air: #2f72b8; --ac: #2b67b0;
  --f-display: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", sans-serif;
  --f-body: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  --f-data: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --scene: #e9eeed;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0f1615; --surface: #172220; --ink: #e5edeb; --muted: #94a6a2; --line: #2d3c39;
  --accent: #6fb0dc; --fan: #ee6c60; --inlet: #6cc08a; --air: #5f9fe0; --ac: #6fa6e6; --scene: #1a2422; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0f1615; --surface: #172220; --ink: #e5edeb; --muted: #94a6a2; --line: #2d3c39;
  --accent: #6fb0dc; --fan: #ee6c60; --inlet: #6cc08a; --air: #5f9fe0; --ac: #6fa6e6; --scene: #1a2422; color-scheme: dark; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 14px; line-height: 1.55; }
.wrap { max-width: 1280px; margin: 0 auto; padding-inline: 16px; padding-block: 16px 28px; display: grid; gap: 12px; }
h1 { font-family: var(--f-display); font-size: 1.45rem; margin: 0; text-wrap: balance; }
.brand { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; }
.brand img { height: 2.6rem; max-width: 40vw; width: auto; object-fit: contain; grid-row: span 2; }
.brand img[hidden] { display: none; }
.brand h1, .brand .sub { grid-column: 2; }
.brand:has(img[hidden]) { display: block; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: .85rem; max-width: 80ch; }
.props { display: flex; flex-wrap: wrap; gap: 8px; }
.prop { font: inherit; text-align: left; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; cursor: pointer; display: grid; gap: 1px; min-width: 220px; }
.prop b { font-family: var(--f-display); font-size: .95rem; }
.prop small { color: var(--muted); font-size: .76rem; }
.prop[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.bar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.grp { display: inline-flex; align-items: center; gap: 6px; }
.grp > span:first-child { font-size: .75rem; color: var(--muted); letter-spacing: .05em; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.seg button { font: inherit; font-size: .82rem; background: var(--bg); color: var(--ink); border: 0; padding: 4px 10px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--surface); }
.seg button[hidden] { display: none; }
label.chk { display: inline-flex; align-items: center; gap: 5px; font-size: .84rem; cursor: pointer; }
label.chk[hidden] { display: none; }
input[type=range] { width: 140px; accent-color: var(--accent); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stage { position: relative; background: var(--scene); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; height: min(70vh, 700px); min-height: 380px; }
.stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.hint { position: absolute; left: 10px; bottom: 8px; font-size: .78rem; color: var(--muted); background: color-mix(in srgb, var(--surface) 80%, transparent); padding: 2px 8px; border-radius: 4px; pointer-events: none; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -1px; margin-right: 5px; }
.legend span[hidden] { display: none; }
.notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.note { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; font-size: .84rem; min-width: 0; }
.note h2 { font-family: var(--f-display); font-size: .92rem; margin: 0 0 4px; }
.note ul { margin: 0; padding-left: 1.1em; }
.note li { margin: 2px 0; }
.simbox { display: grid; gap: 6px; }
.simbox[hidden] { display: none; }
.bt { font-family: var(--f-display); font-size: .85rem; color: var(--accent); min-width: 5.5em; }
output, .time { font-family: var(--f-data); font-size: .8rem; min-width: 3.4em; }
select { font: inherit; font-size: .82rem; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 4px; padding: 3px 4px; }
.btn { font: inherit; font-size: .82rem; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 4px; padding: 4px 10px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.legend i.dot { border-radius: 50%; }
.legend i.ring { box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px #333; }
.scale { position: absolute; right: 10px; top: 10px; background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px; font-size: .75rem; display: grid; gap: 3px; pointer-events: none; }
.scale[hidden] { display: none; }
.scale canvas { width: 200px; height: 10px; border-radius: 2px; }
.scale .ends { display: flex; justify-content: space-between; font-family: var(--f-data); color: var(--muted); }
table.res { border-collapse: collapse; width: 100%; font-size: .82rem; }
table.res th, table.res td { text-align: left; padding: 2px 6px 2px 0; border-bottom: 1px solid var(--line); font-weight: 400; }
table.res td.n { font-family: var(--f-data); text-align: right; white-space: nowrap; }
.warn { color: var(--fan); font-weight: 700; }
.caut { color: #b8740a; font-weight: 700; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .caut { color: #f2b544; } }
.muted { color: var(--muted); }
.pickhint { position: absolute; left: 10px; top: 10px; font-size: .78rem; background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line); border-radius: 4px; padding: 3px 8px; pointer-events: none; }
.pickhint[hidden] { display: none; }
.detail { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 12px; display: grid; gap: 10px; }
.detail[hidden] { display: none; }
.dhead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.dno { font-family: var(--f-display); font-size: 1.5rem; line-height: 1; width: 2.2rem; height: 2.2rem; border-radius: 50%; display: grid; place-items: center; color: #fff; background: #3f9a5b; flex: none; }
.dtitle { display: grid; gap: 2px; flex: 1 1 260px; min-width: 0; }
.dtitle b { font-family: var(--f-display); font-size: 1.05rem; }
.lvl { justify-self: start; font-size: .8rem; font-weight: 700; color: #fff; border-radius: 3px; padding: 1px 8px; }
.dbtns { display: flex; gap: 6px; flex-wrap: wrap; }
.btn.primary { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.dbody { display: grid; grid-template-columns: minmax(0, 3fr) minmax(220px, 2fr); gap: 14px; align-items: start; }
@media (max-width: 760px) { .dbody { grid-template-columns: 1fr; } }
.dfig { margin: 0; display: grid; gap: 6px; min-width: 0; }
.dfig canvas { width: 100%; height: auto; display: block; }
.dfig figcaption { font-size: .74rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: center; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -2px; margin-right: 3px; }
.sw.stud { background: linear-gradient(90deg, transparent 4px, #d9a46a 4px 8px, transparent 8px); box-shadow: inset 0 0 0 1px var(--line); }
.sw.win { background: #fff; box-shadow: inset 0 0 0 2px #2f72b8; }
.dtext { font-size: .86rem; display: grid; gap: 6px; }
.dtext p { margin: 0; }
.dtext .big { font-size: .95rem; }
.dtext .dew { font-size: .86rem; line-height: 1.6; }
.dtext dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
.dtext dt { color: var(--muted); }
.dtext dd { margin: 0; font-family: var(--f-data); font-size: .82rem; }
.wide { grid-column: 1 / -1; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.chip { font: inherit; font-size: .9rem; border: 0; border-radius: 50%; width: 1.9rem; height: 1.9rem; color: #fff; cursor: pointer; display: grid; place-items: center; font-weight: 700; }
.chip:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.rowlab { font-size: .78rem; color: var(--muted); min-width: 6.5em; }
.tally { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .82rem; margin: 2px 0 8px; }
.tally b { font-family: var(--f-data); }
.rank { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 4px; }
.rank button { font: inherit; text-align: left; width: 100%; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 4px; padding: 5px 8px; cursor: pointer; display: flex; gap: 8px; align-items: baseline; }
.rank button:hover { border-color: var(--accent); }
.rank .chip { width: 1.6rem; height: 1.6rem; font-size: .8rem; flex: none; cursor: inherit; }
.prop.add { border-style: dashed; color: var(--accent); }
.prop .x { float: right; font-size: .75rem; color: var(--muted); }
.jww { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; display: grid; gap: 8px; }
.jhead { display: flex; align-items: center; justify-content: space-between; }
.jhead h2 { font-family: var(--f-display); font-size: 1.1rem; margin: 0; color: #12806f; }
.jnote { margin: 2px 0 0; }
body.importing .jww { border: 2px solid #12806f; box-shadow: 0 2px 10px rgba(18,128,111,.12); }
body.importing .wrap > :not(header):not(.props):not(#jwwBox) { display: none !important; }
.jsteps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.jsteps > li { border-top: 1px solid var(--line); padding-top: 8px; display: grid; gap: 6px; }
.jt { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.jrow { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.jrow input[type=number] { width: 4.5em; }
.jrow input, .jrow select { font: inherit; font-size: .84rem; }
.jgrid { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr); gap: 12px; align-items: start; }
@media (max-width: 860px) { .jgrid { grid-template-columns: 1fr; } }
.jlayers { max-height: 460px; overflow: auto; border: 1px solid var(--line); border-radius: 4px; }
.jlayers table { border-collapse: collapse; width: 100%; font-size: .78rem; }
.jlayers th, .jlayers td { padding: 3px 6px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.jlayers th { position: sticky; top: 0; background: var(--surface); color: var(--muted); font-weight: 400; }
.jlayers tr.on td { background: color-mix(in srgb, var(--fan) 12%, transparent); }
.jlayers td.n { text-align: right; font-family: var(--f-data); }
.jlayers select { font-size: .78rem; }
.jprev canvas { width: 100%; height: 460px; display: block; border: 1px solid var(--line); border-radius: 4px; background: #fff; cursor: crosshair; touch-action: none; }
.jres { display: grid; gap: 8px; }
.jres .fl { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.jres canvas { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.jres ul { margin: 0; padding-left: 1.1em; font-size: .82rem; }
.small { font-size: .76rem; }
[hidden] { display: none !important; }
.actions { gap: 10px; }
.tog { font: inherit; font-size: .92rem; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; border-radius: 6px; padding: 7px 16px; cursor: pointer; border: 1.5px solid var(--accent); background: var(--surface); color: var(--accent); }
.tog input { width: 17px; height: 17px; margin: 0; accent-color: #fff; }
.tog.kar { border-color: #12806f; color: #12806f; }
.tog.kar:has(input:checked) { background: #12806f; color: #fff; }
.tog:has(input:checked):not(.kar) { background: var(--accent); color: var(--surface); }
.tog.pdf { background: var(--accent); color: var(--surface); }
.tog.pdf:disabled { opacity: .6; cursor: progress; }
.status { font-size: .82rem; color: var(--muted); }
.pbtns { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.devctl { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.devctl:empty { display: none; }
.devctl .dc { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 3px 7px; }
.devctl .dc i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.devctl .dc input[type=number] { width: 4.2em; font: inherit; }
.devctl .dc select { font-size: .8rem; padding: 1px 2px; }
.devctl .dc.off { opacity: .55; }
.devctl .dlab { font-size: .75rem; color: var(--muted); }
.placebox { display: grid; gap: 0; }
.placebox .bar { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.pwrap { background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 6px 6px; padding: 8px 12px 10px; }
.pwrap canvas { width: 100%; height: 380px; display: block; background: #fff; border: 1px solid var(--line); border-radius: 4px; touch-action: none; }
.phint { margin: 6px 0 0; font-size: .8rem; color: #0b5a4e; }
.focusbar { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; background: color-mix(in srgb, var(--surface) 92%, transparent); border: 2px solid var(--accent); border-radius: 6px; padding: 5px 6px 5px 12px; font-size: .86rem; font-weight: 700; z-index: 2; max-width: calc(100% - 20px); }
.pbtns .btn[aria-pressed="true"] { background: #12806f; color: #fff; border-color: #12806f; }
.place .status { color: #0b5a4e; }
.placing canvas { cursor: crosshair !important; }
.plist { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; overflow-x: auto; }
.plist table { border-collapse: collapse; font-size: .82rem; width: 100%; }
.plist th, .plist td { text-align: left; padding: 3px 8px 3px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.plist th { color: var(--muted); font-weight: 400; }
.plist input { width: 5em; font: inherit; }
.plist select { font: inherit; font-size: .8rem; }
.method { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; }
.method h2 { font-family: var(--f-display); font-size: 1rem; margin: 0 0 6px; }
.method h3 { font-size: .86rem; margin: 0 0 2px; color: var(--accent); }
.method p { margin: 0; font-size: .82rem; }
.mcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 12px 26px; }
@media (max-width: 520px) { .mcols { grid-template-columns: 1fr; } }
.method h3 { font-size: .9rem; margin: 6px 0 3px; color: var(--ink); }
.method p { margin: 0 0 6px; font-size: .84rem; line-height: 1.65; }
.eq { font-family: var(--f-data); font-size: .8rem; background: var(--bg); border-radius: 4px; padding: 5px 9px; margin: 4px 0 6px; display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
.method .hl { color: var(--fan); font-weight: 700; } .method .hl2 { color: #b8740a; font-weight: 700; }
.mtabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; margin-top: 10px; }
.mtab { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; max-height: 340px; overflow: auto; }
.mtab h4 { margin: 0 0 4px; font-size: .84rem; }
.mtab table { border-collapse: collapse; width: 100%; font-size: .78rem; }
.mtab th, .mtab td { text-align: left; padding: 3px 6px 3px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.mtab th { color: var(--muted); font-weight: 400; position: sticky; top: -8px; background: var(--surface); }
.mtab td.n { font-family: var(--f-data); text-align: right; white-space: nowrap; }
.karcard table.res td.lv { font-weight: 700; white-space: nowrap; }

/* ---- サーバー版で足したもの ---- */
[hidden] { display: none !important; }
.topline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.userbox { display: flex; gap: 8px; align-items: center; font-size: .85rem; color: var(--muted); }
.userbox a { color: var(--accent); }
.banner { background: var(--surface); border: 1px solid var(--accent); border-radius: 6px; padding: 8px 12px; font-size: .88rem; }
.banner.warn { border-color: var(--fan); }
.sharebox { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; }
.sharebox input[type=text] { flex: 1 1 320px; min-width: 0; font: inherit; font-family: var(--f-data); font-size: .8rem; padding: 4px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); color: var(--ink); }
.devctl.ro { pointer-events: none; opacity: .75; }
body.viewonly .placebox, body.viewonly #shareMake, body.viewonly .userbox, body.viewonly #props { display: none !important; }
/* ログイン・管理の画面 */
body.login { min-height: 100vh; display: grid; place-items: center; margin: 0; }
.loginwrap { width: 100%; padding: 16px; box-sizing: border-box; display: grid; place-items: center; }
.loginbox { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 22px; display: grid; gap: 12px; box-sizing: border-box; }
.loginbox h1 { font-size: 1.2rem; }
.loginbox label { display: grid; gap: 4px; font-size: .9rem; }
.loginbox input, .admin input, .admin select { font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); color: var(--ink); min-width: 0; }
.err { color: var(--fan); min-height: 1.2em; margin: 0; font-size: .88rem; }
.admin { max-width: 1100px; margin: 0 auto; padding: 16px; display: grid; gap: 14px; }
.admin section { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; display: grid; gap: 10px; }
.admin h2 { font-size: 1.05rem; margin: 0; }
.admin table { border-collapse: collapse; width: 100%; font-size: .86rem; }
.admin th, .admin td { text-align: left; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin th { color: var(--muted); font-weight: 400; }
.admin .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin .pw { font-family: var(--f-data); font-size: 1.05rem; background: var(--bg); padding: 6px 10px; border-radius: 5px; border: 1px dashed var(--accent); user-select: all; }
.admin .scroll { overflow-x: auto; }
.admin .tag { display: inline-block; font-size: .75rem; padding: 0 6px; border-radius: 3px; background: var(--bg); border: 1px solid var(--line); }
.admin .props-pick { display: flex; flex-wrap: wrap; gap: 4px 12px; max-width: 520px; }
.admin .props-pick label { font-size: .82rem; display: inline-flex; gap: 4px; align-items: center; }
.admin .w5 { width: 5em; } .admin .logoprev { height: 36px; width: auto; }
