/* Patchwork - every screen except the stop: stall, sheets, title, help, end, puzzle list. Tokens live in style.css. */

/* ---------- stall ---------- */
.stallbag { flex: none !important; touch-action: none; margin-left: calc(-1 * max(var(--m), var(--sal))); margin-right: calc(-1 * max(var(--m), var(--sar))); }
.stallbag .bag .pockets .pk { touch-action: none; }
.selnote { position: absolute; left: 0; right: 0; top: 0; height: 26px; padding: 0 12px; display: flex; align-items: center; justify-content: center; text-align: center; font-size: .74rem; line-height: 1.1; font-weight: 600; color: var(--sel); opacity: 0; transition: opacity .15s; pointer-events: none; }
.selnote.on { opacity: 1; }
/* lasso select */
.it.sel .it-in { transform: translateY(-3px) scale(1.04); transition: transform .12s ease-out; }
.it.sel .it-in svg { filter: drop-shadow(0 0 1px var(--sel)) drop-shadow(0 0 1px var(--sel)) drop-shadow(0 0 2.5px var(--sel)) drop-shadow(0 4px 3px rgba(0, 0, 0, .3)); }
.it.lasso-hit .it-in svg { filter: drop-shadow(0 0 2px var(--accent)) drop-shadow(0 0 5px var(--accent)); }
.it.lasso-hit .it-in { transform: scale(1.04); }
.lassosvg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; z-index: 48; overflow: visible; opacity: 1; }
.lassosvg.fade { opacity: 0; transition: opacity .2s linear; }
.lassosvg path { fill: none; stroke: var(--accent); stroke-linecap: round; stroke-linejoin: round; }
.lassosvg .lasso-line { stroke-width: 4; }
.lassosvg .lasso-glow { stroke-width: 12; opacity: .25; }
.lassosvg .lasso-close { stroke-width: 1.5; stroke-dasharray: 3 6; opacity: .75; }
.nextrow { display: flex; gap: 8px; align-items: stretch; margin: 2px 0 6px; }
/* shared small stitched linen patch: .patch.sm (cards, rows, rules). Same cream linen + gold stitch as the score patch. */
.patch.sm { border-radius: 16px; }
.patch.sm::before { inset: 4px; border-radius: 12px; border-width: 1.5px; }
.next { flex: 1; min-width: 0; padding: 8px 18px; font-size: .82rem; line-height: 1.25; color: var(--ink); display: flex; flex-direction: column; justify-content: center; }
.next b { font: 800 .98rem/1.2 var(--display); color: var(--burgundy); display: block; }
.next .kp { color: var(--ink); display: block; margin-top: 2px; }
.next .kp u { text-decoration: none; font-weight: 800; color: var(--burgundy); }
/* sell zone: dashed stitched drop target, the twin of the toss zone */
.sellzone {
  position: relative; flex: none; width: 82px; min-height: 52px; border-radius: 16px; border: 2px dashed var(--stitch); color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center;
  font: 800 .74rem/1.15 var(--display); letter-spacing: 0; text-align: center; padding: 2px; background: rgba(243, 235, 220, .7);
}
.sellzone b { font: 900 1.05rem/1 var(--display); color: var(--burgundy); }
.sellzone.active { border-color: var(--burgundy); color: var(--burgundy); animation: pulseop 1s ease-in-out infinite; }
.sellzone.over { background: var(--ok-soft); border-color: var(--ok); color: var(--ink); animation: none; transform: scale(1.05); }
/* tabs: felt. Off = dark olive with cream letters; on = gold felt with burgundy letters (gold = the current one, as on the help dots) */
.tabs { display: flex; gap: 8px; margin: 2px 0 8px; }
.tab {
  --fc: var(--olive-d); position: relative; flex: 1; min-height: 44px; padding: 0 4px; border-radius: 14px; border: 0; color: var(--on-olive);
  font: 800 .92rem/1 var(--display); letter-spacing: .02em; white-space: nowrap;
  box-shadow: var(--lift), var(--edge-felt);
}
.tab::after { content: ""; position: absolute; inset: 3px; border: 2px dashed var(--thread); border-radius: 11px; opacity: .6; pointer-events: none; filter: var(--stitch-under); }
.tab.on { --fc: var(--felt-gold); color: var(--burgundy-d); }
.tab.on::after { opacity: .9; }
.tab:active { transform: translateY(1px); }
.panel { flex: 1 1 0 !important; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; padding: 2px 3px 10px; }
.offers { display: flex; gap: 8px; }
/* offer cards, rows: cream stitched patches */
.offer, .row {
  position: relative; background: var(--cream) var(--tex-linen); box-shadow: var(--lift), var(--edge-linen), inset 0 0 0 1px rgba(185, 128, 26, .2);
}
.offer::before, .row::before { content: ""; position: absolute; inset: 4px; border: 2px dashed var(--thread-gold); border-radius: 12px; pointer-events: none; }
.offer {
  flex: 1; min-width: 0; padding: 12px 11px 10px; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; touch-action: none;
}
.offer .tilebox { height: 44px; display: grid; place-items: center; width: 100%; pointer-events: none; }
.offer .nm { font: 800 .92rem/1.1 var(--display); color: var(--burgundy); pointer-events: none; }
.offer .pr { display: inline-flex; align-items: center; gap: 4px; font: 900 .95rem/1 var(--display); color: var(--burgundy); pointer-events: none; }
.offer .pr svg { width: 18px; height: 18px; }
.offer .tx { font-size: .76rem; line-height: 1.25; color: var(--ink); pointer-events: none; }
.offer.off { opacity: .6; }
.offer.off .pr { color: var(--bad); }
.offer.sold { opacity: .5; background: transparent; box-shadow: none; }
.offer.sold::before { border-color: var(--thread-brown); border-width: 2px; }
.offer.ghosted .tilebox { opacity: .22; }
.offerhint { font-size: .78rem; line-height: 1.3; color: var(--muted); text-align: center; margin: 8px 6px; }
.row { display: flex; align-items: center; gap: 10px; padding: 9px 15px; border-radius: 16px; margin-bottom: 8px; }
.row .rt { flex: 1; min-width: 0; }
.row .rt b { display: block; font: 800 .95rem/1.15 var(--display); color: var(--burgundy); }
.row .rt span { font-size: .78rem; color: var(--ink); display: block; line-height: 1.25; }
.row .tilebox { flex: none; width: 40px; display: grid; place-items: center; overflow: visible; }
.row .tilebox svg { max-width: 40px; height: auto; }
.row .btns { flex: none; display: flex; gap: 6px; }
.row .muted { font: 800 .85rem var(--display); color: var(--muted); padding: 0 8px; }
.pocketnote { --fc: var(--felt-gold); position: relative; padding: 10px 14px; border-radius: 14px; color: var(--burgundy-d); font: 800 .85rem/1.25 var(--display); margin-bottom: 8px; box-shadow: var(--lift), var(--edge-felt); }
.pocketnote::after { content: ""; position: absolute; inset: 3px; border: 2px dashed var(--thread); border-radius: 11px; opacity: .85; pointer-events: none; }
.tiers { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.tiers span { font: 800 .74rem/1 var(--display); padding: 4px 6px; border-radius: 7px; background: var(--slot); color: var(--muted); }
.tiers span.has { --fc: var(--burgundy); color: var(--on-accent); box-shadow: inset 0 -1.5px 0 rgba(0, 0, 0, .18); }
.pilehead { font: 800 .74rem/1 var(--display); color: var(--muted); margin: 2px 0 8px 4px; text-transform: uppercase; letter-spacing: .1em; }
.price { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.price svg { width: 15px; height: 15px; }
.btn .price svg { width: 16px; height: 16px; }
.selnote { color: #14566F; font-weight: 700; font-size: .72rem; }

/* ---------- sheets: a linen card, stitched edge, rounded top ---------- */
#sheet { position: absolute; inset: 0; z-index: 60; display: none; }
#sheet.on { display: block; }
#sheet .bd { position: absolute; inset: 0; background: var(--sheet-bd); opacity: 0; transition: opacity .18s; }
#sheet.show .bd { opacity: 1; }
#sheet .card {
  position: absolute; left: 50%; bottom: 0; width: 100%; max-width: 480px; transform: translate(-50%, 100%); transition: transform .22s cubic-bezier(.2, .8, .2, 1);
  background: var(--surface) var(--tex-linen); border-radius: 26px 26px 0 0; padding: 22px max(22px, var(--sar)) calc(22px + var(--bsafe)) max(22px, var(--sal)); max-height: 84%; overflow-y: auto; touch-action: pan-y;
  box-shadow: 0 -8px 30px var(--shadow), 0 -1px 2px rgba(60, 40, 20, .3), inset 2px 2px 0 rgba(255, 255, 255, .55), inset -2px 0 0 rgba(122, 101, 82, .2);
  outline: 2.5px dashed var(--thread-gold); outline-offset: -8px;
}
#sheet.show .card { transform: translate(-50%, 0); }
.sh-top { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.sh-top .tile { flex: none; min-width: 60px; display: grid; place-items: center; padding: 6px; border-radius: 16px; background: var(--cream) var(--tex-linen); box-shadow: var(--lift-s), var(--edge-linen), inset 0 0 0 1.5px var(--cream-d); }
.sh-top h2 { font: 900 1.4rem/1.1 var(--display); color: var(--burgundy); text-shadow: 0 1px 0 rgba(255, 255, 255, .5); }
.sh-top .sub { color: var(--muted); font-size: .9rem; margin-top: 3px; }
.facts { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 6px 16px; font-size: .95rem; margin: 10px 0; padding: 10px 14px; border-radius: 16px; background: var(--cream) var(--tex-linen); border: 2.5px dashed var(--thread-gold); box-shadow: var(--lift-s), var(--edge-linen); }
.facts:empty { display: none; }
.facts dt { font: 800 .72rem/1.3 var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 0; font-weight: 700; color: var(--ink); }
.facts dd.sh { color: var(--burgundy); }
.rule { position: relative; padding: 12px 14px; border-radius: 16px; background: var(--cream) var(--tex-linen); border: 2.5px dashed var(--thread-gold); box-shadow: var(--lift-s), var(--edge-linen); margin-top: 10px; font-size: .95rem; line-height: 1.38; color: var(--ink); }
.rule small { display: block; font: 800 .7rem/1 var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--burgundy); margin-bottom: 6px; }
.rule.next-lv { background: transparent; border-color: var(--thread-brown); box-shadow: none; }
.tag { --fc: var(--burgundy); position: relative; display: inline-block; font: 800 .72rem/1 var(--display); letter-spacing: .08em; text-transform: uppercase; padding: 6px 10px; border-radius: 8px; color: var(--on-accent); margin-top: 4px; box-shadow: var(--lift-s), var(--edge-felt); }
.tag::after { content: ""; position: absolute; inset: 2px; border: 1.5px dashed var(--thread); border-radius: 6px; opacity: .6; pointer-events: none; }
.sheet-btns { display: flex; gap: 10px; margin-top: 18px; }
.sheet-btns .btn { flex: 1; }
.menu-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.menu-list .btn { min-height: 52px; }
.keeperdia { display: grid; place-items: center; margin: 12px 0 0; }

/* ---------- title / end / help ---------- */
.center { align-items: center; text-align: center; }
.wm { display: flex; align-items: center; justify-content: center; gap: 10px; max-width: 100%; }
.wm .laurel { flex: none; margin-top: -4px; }
.wm .wordmark { flex: 0 1 auto; min-width: 0; max-width: 100%; height: auto; filter: drop-shadow(0 2px 2px rgba(60, 40, 20, .3)); }
.laurel { object-fit: contain; }
.title { justify-content: space-between; padding-top: calc(var(--sat) + 24px); padding-bottom: calc(var(--bsafe) + 20px); }
.title .hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; min-height: 0; }
.title .tagline { color: var(--ink); font: 600 1.08rem/1.35 var(--body); max-width: 24ch; text-wrap: balance; }
.tagrow { display: flex; align-items: center; justify-content: center; gap: 12px; }
.tagrow .laurel { flex: none; }
.title .btns { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 360px; align-self: center; }
.title .soundbtn { position: absolute; top: calc(var(--sat) + 8px); right: max(10px, var(--sar)); }
.soundbtn svg { stroke: var(--burgundy) !important; fill: none; stroke-width: 2.2; width: 22px !important; height: 22px !important; }
.logo .scene { width: min(260px, 66vw); }
.title .btn .cnt { --fc: var(--felt-gold); position: relative; font: 800 .8rem/1 var(--display); color: var(--burgundy-d); padding: 4px 9px; border-radius: 9px; box-shadow: var(--lift-s), var(--edge-felt); }
.endscr { justify-content: space-between; padding-top: calc(var(--sat) + 20px); padding-bottom: calc(var(--bsafe) + 20px); }
.endscr .hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 0; }
.endhead { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 4px; }
.endscr h1 { font: 900 2.3rem/1 var(--display); letter-spacing: .01em; color: var(--burgundy); text-shadow: 0 2px 0 rgba(91, 26, 38, .22); -webkit-text-stroke: 1px var(--burgundy); }
.endscr .why { color: var(--ink); font-size: 1.02rem; max-width: 28ch; }
.statgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 340px; margin-top: 8px; }
.stat { padding: 12px 8px 10px; text-align: center; }
.stat.wide { grid-column: span 2; }
.stat b { display: block; font: 900 1.55rem/1.1 var(--display); color: var(--burgundy); font-variant-numeric: tabular-nums; }
.stat span { display: block; margin-top: 4px; font: 800 .74rem/1 var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.endscr .btns { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 360px; align-self: center; }
.help { padding-top: calc(var(--sat) + 16px); padding-bottom: calc(var(--bsafe) + 14px); justify-content: space-between; }
.help .stepno { font: 800 .8rem/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); text-align: center; }
.help .body { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; padding: 0 6px; }
.help .diagram { padding: 20px 16px; width: 100%; display: grid; place-items: center; min-height: 150px; }
.help h2 { font: 900 1.6rem/1.1 var(--display); color: var(--burgundy); text-shadow: 0 1px 0 rgba(255, 255, 255, .5); }
.help p { color: var(--ink); font-size: 1.02rem; line-height: 1.4; max-width: 30ch; }
.help p b { color: var(--burgundy); }
.dots { display: flex; gap: 12px; justify-content: center; align-items: center; margin: 8px 0 14px; }
.dots i { position: relative; width: 16px; height: 16px; border-radius: 50%; background: url("../assets/trim/button-cream.webp") center / contain no-repeat; opacity: .75; filter: drop-shadow(0 1px 1px rgba(60, 40, 20, .3)); }
.dots i.on { width: 22px; height: 22px; opacity: 1; background-image: url("../assets/trim/button-gold.webp"); }
.help .btns { display: flex; gap: 10px; }
.help .btns .btn { flex: 1; }

/* ---------- puzzles (intro sheet, level list) ---------- */
.sheet-col { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.introp { color: var(--ink); line-height: 1.45; font-size: .98rem; margin-bottom: 10px; }
.introp b { color: var(--burgundy); }

.plistscr { padding-bottom: calc(var(--bsafe) + 12px); }
.plistscr .top { display: block; min-height: 0; padding-top: calc(var(--sat) + 6px); }
.plistscr .hdr .btn { flex: none; min-height: 44px; padding: 0 14px; }
.plistscr .brand { justify-content: center; padding-right: 58px; }
.plist { flex: 1 1 0 !important; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; padding: 14px 3px 10px; }
.pgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 8px; }
.ptile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 2px; min-height: 96px; padding: 10px 4px 8px;
  border: 0; border-radius: 16px; background: var(--cream) var(--tex-linen); text-align: center; min-width: 0; color: var(--ink);
  box-shadow: var(--lift), var(--edge-linen), inset 0 0 0 1px rgba(185, 128, 26, .2);
}
.ptile::before { content: ""; position: absolute; inset: 4px; border: 2px dashed var(--thread-gold); border-radius: 12px; pointer-events: none; }
.ptile .pn { font: 900 1.5rem/1 var(--display); font-variant-numeric: tabular-nums; color: var(--burgundy); }
.ptile .pname { font: 600 .74rem/1.15 var(--body); letter-spacing: -.01em; color: var(--ink); padding: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; max-width: 100%; }
.ptile .pst { display: flex; align-items: center; justify-content: center; gap: 3px; min-height: 18px; font: 800 .76rem/1 var(--display); font-variant-numeric: tabular-nums; color: var(--olive-d); }
.ptile .pst em { font-style: normal; }
.ptile .pst .nx { --fc: var(--burgundy); font: 800 .74rem/1 var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--on-accent); padding: 4px 7px; border-radius: 8px; }
.ptile .tk { fill: none; stroke: var(--olive); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.ptile.solved::before { border-color: var(--olive); border-width: 2px; }
.ptile.solved .pn { color: var(--olive-d); }
.ptile.next { --fc: var(--felt-gold); background-color: var(--fc); color: var(--burgundy-d); box-shadow: var(--lift), var(--edge-felt); }
.ptile.next::before { border-color: var(--thread); border-width: 2px; }
.ptile.next .pname { color: var(--burgundy-d); font-weight: 700; }
.ptile.locked { opacity: .55; box-shadow: var(--lift-s); background: rgba(243, 235, 220, .45); }
.ptile.locked::before { border-color: var(--thread-brown); opacity: .7; }
.ptile .lk-body { fill: var(--muted); } .ptile .lk-arc { fill: none; stroke: var(--muted); stroke-width: 2.4; stroke-linecap: round; }
.ptile:active:not(.locked) { transform: translateY(1px); }

/* a line of small print at the foot of the menu: the screen as measured, for bug reports */
.buildline { margin-top: 14px; text-align: center; font: 600 .74rem/1 var(--body); color: var(--muted); opacity: .8; }

@container app (max-height: 700px) {
  .offer { padding: 8px 9px 7px; gap: 2px; }
  .offer .tilebox { height: 34px; }
  .offer .tx { font-size: .72rem; line-height: 1.2; }
  .next { padding: 5px 16px; }
  .title { padding-top: calc(var(--sat) + 12px); }
  .title .hero { gap: 8px; }
  .logo .scene { width: min(200px, 56vw); }
  .help .diagram { padding: 12px; min-height: 110px; }
  .help .body { gap: 12px; }
  .endscr .hero { gap: 8px; }
  .statgrid { gap: 8px; }
  .stat { padding: 8px 6px; }
  .sheet-col, .menu-list { gap: 8px; }
  #sheet .card { padding-top: 18px; }
}

/* ---------- wool pass (see the end of style.css): yarn stitches, frays and tanglies for the screens.css surfaces ---------- */
.tab::after { border: 0 solid transparent; border-radius: 0; border-image: var(--ys-cream-10) 10 / 10px / 0 round; opacity: .75; filter: none; }
.pocketnote::after { border: 0 solid transparent; border-radius: 0; border-image: var(--ys-cream-10) 10 / 10px / 0 round; opacity: .9; }
.offer::before, .row::before, .ptile::before { border: 0 solid transparent; border-radius: 0; border-image: var(--ys-gold-12) 12 / 12px / 0 round; }
.ptile.next::before { border-image: var(--ys-cream-12) 12 / 12px / 0 round; }
.ptile.solved::before { border-image: var(--ys-olive-12) 12 / 12px / 0 round; }
.ptile.locked::before { border-image: var(--ys-brown-12) 12 / 12px / 0 round; }
.offer.sold::before { border-image: var(--ys-brown-12) 12 / 12px / 0 round; }
.ptile.next::after, .ptile.locked::after, .offer.sold::after { display: none; }

/* ---------- start-up splash (js/ui.js boot): shown only if the art takes a moment to load ---------- */
.splash { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; height: 100%; }
.splash p { margin: 0; font: 800 1.05rem/1.2 var(--display); color: var(--thread-brown); letter-spacing: .02em; }
.splash .thread { width: 120px; height: 3px; border-radius: 2px; background: rgba(122, 101, 82, .22); overflow: hidden; }
.splash .thread i { display: block; width: 40%; height: 100%; border-radius: 2px; background: var(--felt-gold); animation: spliceThread 1.1s ease-in-out infinite; }
@keyframes spliceThread { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) { .splash .thread i { animation: none; width: 100%; } }
