/* Gun wall builder */
.wb-head { margin-bottom: clamp(1.25rem, 3vw, 2rem); }
.wb-head h1 { font-size: clamp(2.3rem, 5vw, 3.4rem); margin: .6rem 0 .15em; }
.wb-head .lead { max-width: 60ch; margin: 0; }
.wb-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: clamp(1.5rem, 3.5vw, 3rem); align-items: start; }
.wb-stage { position: sticky; top: 88px; }
.wb-board-wrap { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px 10px; }
.wb-board { position: relative; display: grid; grid-template-columns: 24px auto; grid-template-rows: 22px auto; width: max-content; margin: 0 auto; }
.wb-corner { grid-area: 1 / 1; }
.wb-ruler { position: relative; font: 600 .68rem/1 var(--body); color: var(--muted); }
.wb-ruler-x { grid-area: 1 / 2; }
.wb-ruler-y { grid-area: 2 / 1; }
.wb-ruler i { position: absolute; background: var(--line); }
.wb-ruler-x i { bottom: 0; width: 1px; height: 6px; }
.wb-ruler-x i.maj { height: 10px; background: var(--ruler-maj); }
.wb-ruler-y i { right: 0; height: 1px; width: 6px; }
.wb-ruler-y i.maj { width: 10px; background: var(--ruler-maj); }
.wb-ruler b { position: absolute; font-weight: 600; white-space: nowrap; }
.wb-ruler-x b { top: 1px; transform: translateX(-50%); }
.wb-ruler-y b { right: 12px; transform: translateY(-50%); }
.wb-wall { grid-area: 2 / 2; position: relative; overflow: hidden; user-select: none; -webkit-user-select: none; background-color: var(--paint, #efebe3); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); touch-action: pan-y; }
.wb-wall::before { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; background: radial-gradient(120% 90% at 35% 0%, rgba(255, 255, 255, .16), transparent 60%), linear-gradient(to bottom, transparent 65%, rgba(0, 0, 0, .07)); }
.wb-wall.f-shiplap { background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--ppi) * 5.55px), rgba(0, 0, 0, .2) calc(var(--ppi) * 5.55px), rgba(0, 0, 0, .2) calc(var(--ppi) * 5.75px), rgba(255, 255, 255, .28) calc(var(--ppi) * 5.75px), rgba(255, 255, 255, .28) calc(var(--ppi) * 6px)); }
.wb-wall.f-wood, .wb-wall.f-brick, .wb-wall.f-block { background-repeat: repeat; }
.wb-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; z-index: 0; pointer-events: none; }
.wb-item { position: absolute; z-index: 1; padding: 0; margin: 0; border: 0; background: none; cursor: grab; touch-action: none; border-radius: 2px;
  filter: drop-shadow(calc(var(--ppi) * .45px) calc(var(--ppi) * .8px) calc(var(--ppi) * .7px) rgba(0, 0, 0, .38)); }
.wb-item:active { cursor: grabbing; }
.wb-item img { width: 100%; height: 100%; pointer-events: none; -webkit-user-drag: none; user-select: none; }
.wb-item.flip img { transform: scaleX(-1); }
.wb-item:focus { outline: none; }
.wb-item.is-sel { outline: 2px dashed var(--accent); outline-offset: 4px; }
.wb-item.is-clash { outline: 2px solid #c62828; outline-offset: 4px; }
.wb-item.is-sel.is-clash { outline-style: dashed; }
.is-calibrating .wb-item, .is-calibrating .wb-dim { opacity: .25; pointer-events: none; }
.wb-dim { position: absolute; z-index: 2; height: 0; border-top: 1.5px solid var(--accent); pointer-events: none; }
.wb-dim::before, .wb-dim::after { content: ""; position: absolute; top: -5px; width: 1.5px; height: 9px; background: var(--accent); }
.wb-dim::before { left: 0; } .wb-dim::after { right: 0; }
.wb-dim span { position: absolute; left: 50%; top: -6px; transform: translate(-50%, -100%); background: var(--photo-bg); color: var(--ink); font: 600 .72rem/1 var(--body); padding: .22rem .38rem; border-radius: 5px; box-shadow: 0 1px 4px rgba(0, 0, 0, .18); white-space: nowrap; }
.wb-guide { position: absolute; left: 0; right: 0; z-index: 2; border-top: 1px dashed var(--accent); pointer-events: none; }
.wb-tools { position: absolute; z-index: 6; display: none; gap: 2px; padding: 3px; background: #17191b; border-radius: 10px; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.wb-tools.show { display: flex; }
.wb-tools button { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .6rem; border: 0; border-radius: 7px; background: none; color: #fff; font: 600 .8rem/1 var(--body); cursor: pointer; white-space: nowrap; }
.wb-tools button:hover { background: rgba(255, 255, 255, .14); }
.wb-tools button[aria-pressed="true"] { color: #ffb48f; }
.wb-calib { position: absolute; inset: 0; z-index: 4; display: none; }
.is-calibrating .wb-calib { display: block; }
.wb-calib svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.wb-calib line { stroke: var(--accent); stroke-width: 3; }
.wb-calib line.halo { stroke: #fff; stroke-width: 7; opacity: .85; }
.wb-handle { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 3px solid #fff; background: rgba(212, 84, 28, .85); box-shadow: 0 2px 8px rgba(0, 0, 0, .35); cursor: move; touch-action: none; padding: 0; }
.wb-handle::after { content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: #fff; }
.wb-bar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .25rem 1rem; margin-top: .55rem; padding: 0 .15rem; font-size: .86rem; color: var(--muted); }
.wb-bar b { color: var(--ink); font-weight: 600; }
.wb-hint { margin: .6rem 0 0; font-size: .86rem; color: var(--muted); text-align: center; }

.wb-step { padding: 1.35rem 0; border-top: 1px solid var(--line); }
.wb-step:first-child { padding-top: 0; border-top: 0; }
.wb-step h2 { display: flex; align-items: center; gap: .6rem; font-size: 1.45rem; margin: 0 0 .9rem; }
.wb-num { display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--ink); color: var(--on-ink); font-size: 1rem; flex: none; }
.wb-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 1rem; background: var(--bg-alt); border-radius: 10px; }
.wb-tabs button { padding: .6rem .5rem; border: 0; border-radius: 7px; background: none; font: 600 .92rem/1 var(--body); color: var(--ink-2); cursor: pointer; }
.wb-tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.wb-size { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: 1rem; }
.wb-field { display: grid; gap: .35rem; font-weight: 600; font-size: .88rem; }
.wb-field small { font-weight: 400; color: var(--muted); }
.wb-input { position: relative; }
.wb-input input { width: 100%; font: inherit; font-weight: 500; padding: .65rem 2.2rem .65rem .8rem; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); }
.wb-input input:focus { outline: none; border-color: var(--accent); background: var(--field-focus); box-shadow: 0 0 0 4px rgba(212, 84, 28, .12); }
.wb-input::after { content: "in"; position: absolute; right: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .88rem; pointer-events: none; }
.wb-label { font-weight: 600; font-size: .88rem; margin: 0 0 .45rem; }
.wb-finishes { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; margin-bottom: 1rem; }
.wb-finish { display: grid; gap: .3rem; padding: 0; border: 0; background: none; font: 600 .78rem/1.15 var(--body); color: var(--ink-2); cursor: pointer; text-align: center; }
.wb-finish i { display: block; aspect-ratio: 1; border-radius: 9px; border: 2px solid var(--line); background-color: var(--paint, #efebe3); background-size: cover; }
.wb-finish[aria-pressed="true"] i { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.wb-finish[aria-pressed="true"] { color: var(--ink); }
.wb-paints { display: flex; flex-wrap: wrap; gap: .5rem; }
.wb-paint { width: 32px; height: 32px; padding: 0; border-radius: 50%; border: 2px solid rgba(0, 0, 0, .12); cursor: pointer; }
.wb-paint[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.wb-paints-wrap.off { opacity: .4; pointer-events: none; }
.wb-photo-panel p { color: var(--ink-2); font-size: .95rem; }
.wb-photo-panel ol { margin: 0 0 1rem; padding-left: 1.2rem; color: var(--ink-2); font-size: .95rem; }
.wb-photo-panel ol li + li { margin-top: .3rem; }
.wb-calib-box { display: none; padding: 1rem; margin-top: 1rem; border-radius: 12px; background: var(--soft-accent); }
.wb-calib-box.show { display: block; }
.wb-calib-box p { margin: 0 0 .75rem; font-size: .93rem; color: var(--ink-2); }
.wb-calib-row { display: flex; gap: .6rem; align-items: end; }
.wb-calib-row .wb-field { flex: 1; }
.wb-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.wb-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.btn-sm { padding: .65rem 1rem; font-size: .92rem; }
.wb-tray { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: 1rem; }
.wb-card { display: grid; grid-template-rows: 132px auto; gap: .55rem; padding: .8rem .8rem .9rem; border: 2px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); text-align: left; font: inherit; cursor: grab; touch-action: none; transition: border-color .15s; }
.wb-card:hover, .wb-card:focus-visible { border-color: var(--accent); outline: none; }
.wb-card .pic { display: grid; place-items: center; border-radius: 8px; background: var(--bg-alt); overflow: hidden; }
.wb-card .pic img { height: 118px; width: auto; pointer-events: none; -webkit-user-drag: none; filter: drop-shadow(1px 2px 2px rgba(0, 0, 0, .25)); }
.wb-card strong { color: var(--ink); display: block; font: 700 1.15rem/1.05 var(--head); text-transform: uppercase; letter-spacing: .02em; }
.wb-card span { display: block; font-size: .82rem; color: var(--muted); line-height: 1.3; margin-top: .15rem; }
.wb-card .add { display: inline-flex; align-items: center; gap: .3rem; margin-top: .45rem; color: var(--accent); font-weight: 600; font-size: .85rem; }
.wb-spacing { display: grid; gap: .35rem; margin-bottom: .9rem; font-weight: 600; font-size: .88rem; }
.wb-spacing div { display: flex; align-items: center; gap: .75rem; }
.wb-spacing input { flex: 1; accent-color: var(--accent); }
.wb-spacing output { min-width: 3.2rem; text-align: right; font-weight: 600; }
.wb-sum { padding: 1.15rem 1.25rem; border-radius: 12px; background: var(--card); box-shadow: var(--shadow); }
.wb-sum table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.wb-sum td { padding: .35rem 0; vertical-align: top; }
.wb-sum td:last-child { text-align: right; white-space: nowrap; }
.wb-sum .muted { color: var(--muted); font-size: .86rem; }
.wb-sum tr.total td { padding-top: .7rem; border-top: 1px solid var(--line); font: 700 1.35rem/1 var(--head); }
.wb-warn { display: none; margin: .8rem 0 0; padding: .65rem .8rem; border-radius: 9px; background: var(--soft-error-bg); color: var(--soft-error); font-size: .88rem; }
.wb-warn.show { display: block; }
.wb-warn[hidden] { display: none; }
.wb-sum .actions { margin-top: 1.1rem; }
.wb-sum .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.wb-empty { display: none; position: absolute; inset: 0; z-index: 1; place-items: center; padding: 1rem; text-align: center; pointer-events: none; }
.wb-empty span { padding: .6rem .9rem; border-radius: 10px; background: var(--chip-bg); color: var(--ink-2); font-size: .92rem; }
.wb-wall.is-empty .wb-empty { display: grid; }
.wb-toast { position: fixed; left: 50%; bottom: 18px; z-index: 60; display: inline-flex; align-items: center; gap: .6rem; padding: .7rem .9rem .7rem 1.1rem; border: 0; border-radius: 999px; background: var(--ink); color: var(--on-ink); font: 600 .92rem/1 var(--body); box-shadow: 0 8px 24px rgba(0, 0, 0, .3); cursor: pointer; white-space: nowrap; transform: translate(-50%, calc(100% + 40px)); visibility: hidden; transition: transform .25s, visibility .25s; }
.wb-toast.show { transform: translate(-50%, 0); visibility: visible; }
.wb-toast b { color: #ffb48f; }
@media (max-width: 960px) {
  .wb-grid { grid-template-columns: 1fr; }
  .wb-stage { position: static; }
}
@media (max-width: 620px) {
  .wb-board-wrap { padding: 8px 8px 6px; margin-inline: -8px; }
  .wb-finishes { grid-template-columns: repeat(5, 1fr); gap: .35rem; }
  .wb-finish { font-size: .7rem; }
  .wb-card { grid-template-rows: 110px auto; }
  .wb-card .pic img { height: 98px; }
}
