[hidden] { display: none !important; }
:root {
  --bg: #f6f1e8; --paper: #fffdf9; --ink: #2b2622; --ink2: #6b625a; --line: #e4dccf; --line2: #d3c8b6;
  --pri: #17695e; --pri2: #0f5148; --pri-soft: #e2f0ec; --acc: #e8873a;
  --err: #c8372d; --err-soft: #fbe7e4; --warn: #b77700; --warn-soft: #fff3d6; --info: #3d6fa8; --info-soft: #e7eff9;
  --mat: #e9f1ee; --mat-edge: #b9cfc8; --grid1: rgba(23, 105, 94, .10); --grid5: rgba(23, 105, 94, .26);
  --r: 12px; --shadow: 0 6px 24px rgba(60, 40, 20, .12);
  --font: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Zen Maru Gothic", "BIZ UDPGothic", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --top: 56px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--font); -webkit-text-size-adjust: 100%; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--acc); outline-offset: 2px; }
.sc-skip { position: absolute; left: -999px; top: 0; }
.sc-skip:focus { left: 8px; z-index: 99; background: #fff; padding: 6px 10px; }

/* 上の帯 */
.sc-top { height: var(--top); display: flex; align-items: center; gap: 10px; padding: 0 12px; padding-top: env(safe-area-inset-top); background: var(--paper); border-bottom: 1px solid var(--line); }
.sc-logo { display: flex; align-items: center; gap: 6px; border: 0; background: none; padding: 4px 6px; border-radius: 10px; color: var(--pri); }
.sc-logo:hover { background: var(--pri-soft); }
.sc-logo-ic { width: 28px; height: 28px; }
.sc-logo-text { font-weight: 800; font-size: 18px; letter-spacing: .04em; white-space: nowrap; }
.sc-pname { flex: 1 1 120px; min-width: 60px; max-width: 280px; border-color: transparent; background: transparent; font-weight: 600; }
.sc-pname:hover, .sc-pname:focus { border-color: var(--line2); background: #fff; }
.sc-top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

/* ボタン・入力 */
.sc-btn { border: 1px solid var(--line2); background: #fff; border-radius: 999px; padding: 7px 14px; font-weight: 600; line-height: 1.3; min-height: 40px; }
.sc-btn:hover { border-color: var(--pri); color: var(--pri); }
.sc-btn:disabled { opacity: .45; cursor: default; }
.sc-primary { background: var(--pri); border-color: var(--pri); color: #fff; }
.sc-primary:hover { background: var(--pri2); color: #fff; }
.sc-danger { color: var(--err); }
.sc-danger:hover { border-color: var(--err); color: var(--err); }
.sc-small { font-size: 12.5px; }
.sc-btn.sc-small { padding: 4px 10px; min-height: 32px; }
.sc-big { padding: 12px 22px; font-size: 16px; }
.sc-wide { width: 100%; margin: 6px 0; }
.sc-ibtn { width: 40px; height: 40px; border-radius: 999px; border: 1px solid transparent; background: none; display: inline-grid; place-items: center; font-size: 18px; font-weight: 700; color: var(--ink); }
.sc-ibtn:hover { background: var(--pri-soft); }
.sc-ibtn:disabled { opacity: .3; }
.sc-ibtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sc-input { border: 1px solid var(--line2); background: #fff; border-radius: 10px; padding: 7px 10px; min-height: 40px; width: 100%; }
.sc-input:focus { border-color: var(--pri); outline: none; box-shadow: 0 0 0 3px var(--pri-soft); }
.sc-textarea { resize: vertical; min-height: 72px; }
select.sc-input { padding-right: 28px; }
.sc-muted { color: var(--ink2); }
.sc-strong { font-weight: 700; }
.sc-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sc-end { justify-content: flex-end; margin-top: 14px; }
.sc-spacer { flex: 1; }
.sc-x { border: 0; background: none; font-size: 24px; line-height: 1; width: 40px; height: 40px; border-radius: 999px; color: var(--ink2); }
.sc-x:hover { background: var(--line); }

/* 3つの列 */
.sc-main { height: calc(100% - var(--top)); display: grid; grid-template-columns: 76px 320px 1fr 320px; }
.sc-rail { display: flex; flex-direction: column; gap: 2px; padding: 8px 6px; background: var(--paper); border-right: 1px solid var(--line); }
.sc-rail button { border: 0; background: none; border-radius: 12px; padding: 8px 2px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; color: var(--ink2); position: relative; }
.sc-rail button span:first-child { font-size: 20px; line-height: 1.2; }
.sc-rail button:hover { background: var(--pri-soft); color: var(--pri); }
.sc-rail button.is-on { background: var(--pri); color: #fff; }
.sc-left, .sc-right { background: var(--paper); overflow-y: auto; overscroll-behavior: contain; }
.sc-left { border-right: 1px solid var(--line); }
.sc-right { border-left: 1px solid var(--line); padding: 4px 14px 24px; }
.sc-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 4px; position: sticky; top: 0; background: var(--paper); z-index: 2; }
.sc-panel-head h2 { font-size: 17px; margin: 0; }
.sc-panel-body { padding: 4px 14px 24px; }
.sc-only-s { display: none !important; }
.sc-center { display: flex; flex-direction: column; min-width: 0; }
.sc-toolbar { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-bottom: 1px solid var(--line); background: rgba(255, 253, 249, .7); }
.sc-matsel { width: auto; max-width: 260px; }
.sc-size { font-size: 13px; font-weight: 700; color: var(--pri); background: var(--pri-soft); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.sc-stage { flex: 1; position: relative; overflow: hidden; touch-action: none; background: radial-gradient(circle at 30% 20%, #faf6ee, #efe7da); }
.sc-canvas { display: block; user-select: none; -webkit-user-select: none; }

/* マット */
.sc-mat-edge { fill: #d8e6e1; stroke: var(--mat-edge); stroke-width: .6; }
.sc-mat { fill: var(--mat); }
.sc-cutarea { fill: none; stroke: rgba(23, 105, 94, .35); stroke-width: .5; stroke-dasharray: 3 2; }
.sc-grid1 { stroke: var(--grid1); stroke-width: .25; fill: none; }
.sc-grid5 { stroke: var(--grid5); stroke-width: .35; fill: none; }
.sc-ruler { font-size: 4px; fill: #6a8a83; font-family: var(--font); }
.sc-ruler-y { text-anchor: end; }
.sc-ruler-u { text-anchor: end; }
.sc-item { cursor: move; }
.sc-fill { stroke: none; }
.sc-fill.is-white { stroke: #9b9289; stroke-width: .8px; vector-effect: non-scaling-stroke; }
.sc-line { fill: none; stroke-width: 1.4px; vector-effect: non-scaling-stroke; }
.sc-line.is-score { stroke-dasharray: 5 3; }
.sc-hit { fill: transparent; }
.sc-item-wait { fill: rgba(0, 0, 0, .06); stroke: #bbb; stroke-dasharray: 2 2; stroke-width: .5; }
.sc-item-err { fill: var(--err-soft); stroke: var(--err); stroke-width: .5; }
.sc-selbox { fill: none; stroke: var(--acc); }
.sc-handle { fill: #fff; stroke: var(--acc); cursor: nwse-resize; }
.sc-handle-rot { cursor: grab; fill: var(--acc); }
.sc-hi { fill: rgba(200, 55, 45, .12); stroke: var(--err); stroke-width: 1.6px; vector-effect: non-scaling-stroke; stroke-dasharray: 4 2; }
.sc-hi-warn { fill: rgba(183, 119, 0, .12); stroke: var(--warn); }
.sc-hi-info { fill: rgba(61, 111, 168, .12); stroke: var(--info); }

/* 一覧 */
.sc-search { margin: 4px 0 8px; }
.sc-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.sc-chip { border: 1px solid var(--line2); background: #fff; border-radius: 999px; padding: 4px 10px 4px 5px; font-size: 13px; display: inline-flex; align-items: center; gap: 5px; min-height: 34px; }
.sc-chip:hover { border-color: var(--pri); }
.sc-chip.is-on { background: var(--pri); border-color: var(--pri); color: #fff; }
.sc-chip-ic { width: 22px; height: 22px; border-radius: 999px; background: var(--pri-soft); color: var(--pri); display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.sc-chip.is-on .sc-chip-ic { background: rgba(255, 255, 255, .25); color: #fff; }
.sc-chip-n { font-size: 11px; opacity: .65; }
.sc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.sc-card { border: 1px solid var(--line); background: #fff; border-radius: var(--r); padding: 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 112px; }
.sc-card:hover { border-color: var(--pri); box-shadow: 0 2px 10px rgba(23, 105, 94, .15); }
.sc-card.is-on { border-color: var(--acc); box-shadow: 0 0 0 2px var(--acc); }
.sc-thumb { width: 100%; aspect-ratio: 1; display: grid; place-items: center; background: repeating-conic-gradient(#f7f3ec 0 25%, #fff 0 50%) 0 0/12px 12px; border-radius: 8px; }
.sc-thumb-svg { width: 86%; height: 86%; }
.sc-thumb-svg .is-white { stroke: #aaa; stroke-width: .6px; vector-effect: non-scaling-stroke; }
.sc-thumb-err { font-size: 11px; color: var(--err); }
.sc-card-name { font-size: 12px; line-height: 1.3; text-align: center; font-weight: 600; word-break: break-all; }

/* 設定 */
.sc-props-head { padding: 10px 0 2px; }
.sc-h2 { font-size: 18px; margin: 0 0 2px; }
.sc-h3 { font-size: 14px; margin: 14px 0 8px; color: var(--ink2); letter-spacing: .03em; }
.sc-sec { border-bottom: 1px dashed var(--line); padding-bottom: 12px; }
.sc-sec:last-child { border-bottom: 0; }
.sc-lab { display: block; font-size: 13px; font-weight: 600; margin: 8px 0 4px; }
.sc-row .sc-lab { margin: 0; display: flex; align-items: center; gap: 6px; }
.sc-sizerow .sc-lab { flex: 1; }
.sc-field { margin-bottom: 10px; }
.sc-numrow { display: flex; gap: 8px; align-items: center; }
.sc-range { flex: 1; accent-color: var(--pri); min-width: 60px; }
.sc-numbox { display: inline-flex; align-items: center; gap: 4px; }
.sc-num { width: 76px; text-align: right; }
.sc-unit { font-size: 12px; color: var(--ink2); }
.sc-check { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 14px; cursor: pointer; }
.sc-check input { width: 20px; height: 20px; accent-color: var(--pri); flex: none; }
.sc-swatches { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0 8px; }
.sc-sw { width: 28px; height: 28px; border-radius: 999px; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line2); padding: 0; }
.sc-sw.is-on { box-shadow: 0 0 0 3px var(--acc); }
.sc-sw-custom { width: 32px; height: 30px; border: 0; padding: 0; background: none; }
.sc-layer-name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.sc-dot { width: 14px; height: 14px; border-radius: 999px; display: inline-block; border: 1px solid rgba(0, 0, 0, .2); flex: none; }
.sc-dot.is-line { background: none; border: 3px dashed; }
.sc-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 12px; }
.sc-note { background: var(--warn-soft); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.sc-layerlist { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.sc-layerlist li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.sc-btngrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0; }
.sc-imgprev img { max-width: 100%; max-height: 180px; border-radius: 10px; margin: 6px 0; display: block; }

/* 素材 */
.sc-matcard { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin-bottom: 10px; }
.sc-matcard-title { font-weight: 800; margin-bottom: 4px; }
.sc-dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0 8px; font-size: 13px; }
.sc-dl dt { color: var(--ink2); }
.sc-dl dd { margin: 0; font-weight: 600; }
.sc-matlist { display: grid; gap: 6px; }
.sc-matbtn { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: var(--r); padding: 8px 10px; display: flex; flex-direction: column; gap: 1px; }
.sc-matbtn:hover { border-color: var(--pri); }
.sc-matbtn.is-on { border-color: var(--pri); box-shadow: 0 0 0 2px var(--pri); background: var(--pri-soft); }
.sc-matbtn-name { font-weight: 700; }

/* 点検 */
.sc-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 999px; font-size: 12px; color: #fff; padding: 0 6px; }
.sc-count:empty { display: none; }
.sc-count.is-error { background: var(--err); }
.sc-count.is-warn { background: var(--warn); }
.sc-issues { display: grid; gap: 6px; list-style: none; padding: 0; margin: 0; }
.sc-issue { text-align: left; border: 0; border-left: 4px solid; border-radius: 8px; padding: 7px 10px; font-size: 13px; display: flex; flex-direction: column; gap: 2px; background: var(--info-soft); border-color: var(--info); }
.sc-issue.is-error { background: var(--err-soft); border-color: var(--err); }
.sc-issue.is-warn { background: var(--warn-soft); border-color: var(--warn); }
.sc-issue.is-ok { background: var(--pri-soft); border-color: var(--pri); }
.sc-badge { font-size: 11px; font-weight: 800; }
.sc-link { font-size: 12px; color: var(--pri); text-decoration: underline; }
.sc-ok { color: var(--pri); font-weight: 700; }

/* 窓 */
.sc-modal-bg { position: fixed; inset: 0; background: rgba(43, 38, 34, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.sc-modal { background: var(--paper); border-radius: 18px; box-shadow: var(--shadow); width: min(440px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 16px 20px 20px; }
.sc-modal-wide { width: min(760px, 100%); }
.sc-modal-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.sc-modal-head h2 { margin: 0; font-size: 20px; flex: 1; }
.sc-steps-dots { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0; width: 100%; counter-reset: s; }
.sc-steps-dots li { flex: 1; font-size: 12px; padding: 4px 8px; border-radius: 999px; background: var(--line); color: var(--ink2); text-align: center; counter-increment: s; }
.sc-steps-dots li::before { content: counter(s) ". "; }
.sc-steps-dots li.is-on { background: var(--pri); color: #fff; }
.sc-steps-dots li.is-done { background: var(--pri-soft); color: var(--pri); }
.sc-opts { display: grid; gap: 2px; }
.sc-guide { padding-left: 24px; margin: 8px 0; }
.sc-guide > li { margin-bottom: 14px; }
.sc-guide-title { font-weight: 800; font-size: 15.5px; }
.sc-guide ul { margin: 4px 0; padding-left: 18px; }
.sc-guide p { margin: 4px 0; }
.sc-warn { background: var(--warn-soft); border-radius: 8px; padding: 6px 10px; font-size: 13.5px; }
.sc-tip { background: var(--info-soft); border-radius: 8px; padding: 6px 10px; font-size: 13.5px; }
.sc-startgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin: 12px 0; }
.sc-startcard { border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 14px 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; min-height: 116px; }
.sc-startcard:hover { border-color: var(--pri); box-shadow: 0 4px 16px rgba(23, 105, 94, .15); transform: translateY(-1px); }
.sc-startic { width: 38px; height: 38px; border-radius: 12px; background: var(--pri-soft); color: var(--pri); display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.sc-menu { position: fixed; z-index: 60; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: grid; min-width: 180px; }
.sc-menu button { border: 0; background: none; text-align: left; padding: 10px 12px; border-radius: 8px; }
.sc-menu button:hover { background: var(--pri-soft); }
.sc-ask p { font-size: 15px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 40px); opacity: 0; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; transition: .25s; z-index: 80; pointer-events: none; max-width: calc(100vw - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* タブレット：右の列をせまく */
@media (max-width: 1180px) {
  .sc-main { grid-template-columns: 72px 280px 1fr 280px; }
}

/* スマホ：マットを大きく、パネルは下から */
@media (max-width: 899px) {
  :root { --top: 52px; }
  .sc-logo-text { font-size: 15px; }
  .sc-pname { display: none; }
  .sc-hide-s { display: none; }
  .sc-file { padding: 6px 10px; font-size: 13px; }
  .sc-export-btn { padding: 6px 12px; font-size: 13px; }
  .sc-only-s { display: inline-flex !important; }
  .sc-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  #btn-zin, #btn-zout { display: none; }
  .sc-toolbar { overflow: hidden; }
  .sc-rail button { min-width: 0; }
  .sc-center { grid-row: 1; }
  .sc-rail { grid-row: 2; flex-direction: row; justify-content: space-around; border-right: 0; border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .sc-rail button { flex: 1; font-size: 11px; }
  .sc-left, .sc-right { position: fixed; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom)); max-height: 66dvh; z-index: 40; border: 0; border-radius: 18px 18px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, .18); transform: translateY(calc(100% + 90px)); transition: transform .22s ease; }
  body[data-sheet="designs"] .sc-left, body[data-sheet="text"] .sc-left, body[data-sheet="image"] .sc-left, body[data-sheet="material"] .sc-left { transform: none; }
  body[data-sheet="props"] .sc-right, body[data-sheet="check"] .sc-right { transform: none; }
  body[data-sheet="check"] #props, body[data-sheet="check"] #overview { display: none; }
  .sc-sheet-head { display: flex !important; justify-content: flex-end; position: sticky; top: 0; background: var(--paper); z-index: 2; }
  .sc-toolbar { padding: 4px 8px; }
  .sc-matsel { max-width: 46vw; font-size: 13px; }
  .sc-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
  #check-count-s:not(:empty) { position: absolute; top: 2px; right: 18%; background: var(--err); color: #fff; border-radius: 999px; font-size: 10px; min-width: 16px; height: 16px; display: grid; place-items: center; }
  .sc-modal { padding: 14px 14px 18px; }
}
@media (max-width: 400px) {
  .sc-logo-text { display: none; }
  .sc-top { gap: 6px; padding: 0 8px; }
  .sc-top-actions { gap: 2px; }
}
@media print {
  body { overflow: visible; background: #fff; }
  .sc-top, .sc-main, #toast { display: none !important; }
  .sc-modal-bg { position: static; background: none; padding: 0; display: block; }
  .sc-modal { box-shadow: none; max-height: none; width: auto; }
  .sc-modal .sc-row, .sc-x, .sc-steps-dots { display: none !important; }
}

.sc-adv { margin: 6px 0; }
.sc-adv summary { cursor: pointer; font-size: 13px; color: var(--ink2); padding: 6px 0; }
@media (max-width: 899px) { body[data-sheet="props"] .sc-right { max-height: 58dvh; } }
.sc-ptc-cut { stroke: #c8372d; stroke-dasharray: 4 3; fill: none; }
.sc-thumb-svg .sc-ptc-cut { stroke-width: 1px; vector-effect: non-scaling-stroke; }

.sc-hit.is-pending { fill: rgba(246, 241, 232, .55); }
.sc-wait-text { font-size: 5px; fill: var(--ink2); text-anchor: middle; font-family: var(--font); }
.sc-thumb-wait { font-size: 11px; color: var(--ink2); }
@media (max-width: 899px) {
  .sc-rail { position: relative; z-index: 45; background: var(--paper); }
  .sc-sw { width: 34px; height: 34px; }
  .sc-check input { width: 24px; height: 24px; }
}
