/* app chrome: home, board view, picker, bars */
#root { position: fixed; inset: 0; touch-action: none; }
.board { position: absolute; inset: 0; cursor: grab; user-select: none; -webkit-user-select: none; }
.board.panning { cursor: grabbing; }
.board.dropping { box-shadow: inset 0 0 0 3px #b0001e; }
.layer { position: absolute; inset: 0; transform-origin: 0 0; }
.layer > .item { cursor: grab; }
.pin { pointer-events: auto; cursor: grab; }
svg.strings { z-index: 100000; } .pins { z-index: 100001; }
svg.strings path.hit { fill: none; stroke: transparent; stroke-width: 12; pointer-events: stroke; cursor: pointer; }
svg.strings path.s.sel { stroke-width: 3.6; }
svg.strings path.glow { fill: none; stroke: #3b82f6; stroke-width: 11; opacity: .16; stroke-linecap: round; }
.knob { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: #fff; border: 1.5px solid #b0001e; color: #b0001e;
  font: 600 15px/19px Inter; text-align: center; pointer-events: auto; cursor: crosshair; box-shadow: 0 2px 5px rgba(0,0,0,.2); display: none; z-index: 2; }
.target { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 2px dashed #3b82f6; display: none; pointer-events: none; }

/* photos with real images */
.photo .img .pic { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.mugshot.has-img .img::before { z-index: 1; }
.mugshot.has-img .img::after { content: ""; position: absolute; inset: 0; z-index: 1; background: repeating-linear-gradient(to bottom, transparent 0 19px, rgba(0,0,0,.18) 19px 20px); pointer-events: none; }
.mugshot .placard { z-index: 2; }

/* top bar */
.topbar { z-index: 20; }
.title { padding: 4px 10px 4px 6px; gap: 6px; }
.title .back { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; }
.title .back:hover { background: #fde2e2; }
.logo { width: 20px; height: 20px; stroke: #b0001e; fill: none; stroke-width: 2; }
.tt { font: 600 14px Inter; border: none; background: transparent; color: var(--ui-ink); width: 220px; padding: 6px 4px; border-radius: 5px; outline: none; }
.tt:focus { background: rgba(0,0,0,.05); }
.tools .tool { cursor: pointer; width: auto; min-width: 40px; padding: 0 8px; gap: 6px; display: flex; }
.tools .tool:hover { background: #fde2e2; color: #b0001e; }
.tools .tool .tl { font: 500 12px Inter; }
.tools .tool .k { position: static; }
.rt { display: flex; gap: 8px; align-items: flex-start; }
.rt .btn { cursor: pointer; } .rt .btn:hover { color: #b0001e; }
.seg { display: flex; padding: 3px; gap: 2px; font: 500 12px Inter; }
.seg div { padding: 6px 10px; border-radius: 7px; cursor: pointer; } .seg .on { background: #b0001e; color: #fff; }
.add-m { display: none; }
.zoom { cursor: pointer; user-select: none; } .zoom span:hover { color: #b0001e; }
.empty { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; font: 700 26px/1.3 Caveat; color: var(--ui-muted); pointer-events: none; display: none; }
.fbar { position: absolute; z-index: 30; display: none; padding: 4px; gap: 2px; font: 500 12px Inter; flex-wrap: wrap; max-width: calc(100vw - 16px); }
.fbar > div { padding: 6px 9px; border-radius: 6px; cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.fbar > div:hover, .fbar > div.on { background: #fde2e2; color: #b0001e; }
.fbar i { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.fbar input { font: 700 16px Caveat; width: 180px; padding: 4px 6px; border: 1px solid var(--ui-line); border-radius: 5px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 300; background: #2b2622; color: #fff; font: 500 13px Inter; padding: 10px 14px; border-radius: 8px; }
.fatal { padding: 40px; font: 15px/1.6 Inter; max-width: 560px; margin: 0 auto; }
@media (max-width: 900px) { .tools .tool .tl, .tools .tool .k { display: none; } .tt { width: 150px; } }
@media (max-width: 700px) {
  .topbar .tools, .rt .seg, .rt [data-x="export"], .zoom span[data-z="-"], .zoom span[data-z="+"] { display: none; }
  .add-m { display: block; background: #b0001e !important; color: #fff !important; border-color: #b0001e !important; }
  .tt { width: 46vw; }
}

/* editor extras */
.ed-noimg { position: absolute; left: 0; right: 0; top: 40%; display: flex; gap: 8px; justify-content: center; z-index: 6; }
.ed-noimg .btn { background: var(--ui-bg); border: 1px solid var(--ui-line); cursor: pointer; }
.ed-own { font: 400 12px 'Black Ops One'; letter-spacing: .05em; color: #b0001e; border: 2px dashed currentColor; border-radius: 3px; padding: 3px 7px 2px; background: var(--ui-bg); width: 120px; outline: none; text-transform: uppercase; }
.ed-own.on { border-style: solid; background: #fde2e2; }
.ed-own::placeholder { color: #c98a92; }
.ed-link a { color: #1f4fbf; text-decoration: none; }

/* photo picker */
.modal { position: fixed; inset: 0; z-index: 200; background: rgba(30,25,20,.35); display: grid; place-items: center; padding: 16px; }
.pick { width: min(640px, 100%); max-height: 86vh; display: flex; flex-direction: column; overflow: hidden; font: 13px Inter; }
.pk-tabs { display: flex; border-bottom: 1px solid var(--ui-line); align-items: center; }
.pk-tabs div { padding: 12px 16px; font-weight: 500; color: var(--ui-muted); cursor: pointer; }
.pk-tabs div.on { color: #b0001e; box-shadow: inset 0 -2px #b0001e; }
.pk-x { margin-left: auto; padding: 0 14px; font-weight: 500; color: var(--ui-muted); cursor: pointer; }
.pk-body { padding: 14px; overflow-y: auto; min-height: 260px; }
.pk-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 230px; border: 2px dashed var(--ui-line); border-radius: 10px; cursor: pointer; color: var(--ui-muted); }
.pk-drop b { color: #b0001e; font-size: 15px; } .pk-drop.over { border-color: #b0001e; background: #fde2e2; }
.pk-q { width: 100%; font: 14px Inter; padding: 10px 12px; border: 1px solid var(--ui-line); border-radius: 8px; margin-bottom: 12px; }
.pk-res { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.pk-r { cursor: pointer; border-radius: 6px; overflow: hidden; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.12); display: flex; flex-direction: column; }
.pk-r:hover { outline: 2px solid #b0001e; }
.pk-r img, .pk-ni { width: 100%; aspect-ratio: 4/5; object-fit: cover; background: #e9e4da; display: grid; place-items: center; color: #a39a8c; font-size: 12px; }
.pk-r b { font: 500 12px/1.3 Inter; padding: 6px 8px; color: #2b2622; }
.pk-r.none { opacity: .5; cursor: default; } .pk-r.none:hover { outline: none; }
.pk-hint, .pk-busy { grid-column: 1 / -1; color: var(--ui-muted); padding: 30px 0; text-align: center; }

/* home */
body.home { overflow: auto; background: var(--bg); }
.hm { max-width: 1180px; margin: 0 auto; padding: 22px 24px 60px; }
.hm header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 34px Caveat; color: #2b2622; }
.brand .logo { width: 28px; height: 28px; }
.hm-act { display: flex; gap: 8px; } .hm-act .btn { border: 1px solid var(--ui-line); background: var(--ui-bg); cursor: pointer; }
.hm-act .btn.primary, .btn.primary { background: #b0001e; color: #fff; border-color: #b0001e; }
.hm h2 { font: 600 15px Inter; margin: 0 0 18px; } .hm h2 span { font-weight: 400; color: var(--ui-muted); margin-left: 6px; font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 30px 26px; }
.bc { background: #fff; padding: 10px 10px 0; box-shadow: var(--card-shadow); position: relative; cursor: pointer; transition: transform .15s; }
.bc:hover { transform: rotate(0) scale(1.02) !important; }
.bc .pin { position: absolute; left: 50%; top: 9px; z-index: 2; }
.bc .th { height: 150px; background: #f3eee4; overflow: hidden; }
.bc .th.cork { background: #c49a69; } .bc .th.night { background: #23272e; }
.bc .cap { font: 700 22px/1 Caveat; padding: 9px 0 4px; color: #2b2622; }
.bc .m { font: 11px Inter; color: #8a8174; padding-bottom: 10px; display: flex; justify-content: space-between; gap: 6px; }
.bc .bm { display: flex; gap: 8px; opacity: 0; transition: opacity .15s; } .bc:hover .bm { opacity: 1; }
.bc .bm b { font-weight: 500; color: #8a8174; } .bc .bm b:hover { color: #b0001e; }
.bc.new { background: transparent; box-shadow: none; border: 2px dashed var(--ui-line); padding: 10px; display: flex; flex-direction: column; justify-content: center; min-height: 230px; }
.bc.new .plus { font: 700 64px/1 Caveat; color: #b0001e; text-align: center; } .bc.new .plus.small { font-size: 30px; }
.bc.new .cap, .bc.new .m { text-align: center; display: block; }
.foot { margin-top: 40px; font: 12.5px/1.6 Inter; color: var(--ui-muted); max-width: 620px; }
@media (hover: none) { .bc .bm { opacity: 1; } }
