/* Screen layouts: header, home lists, list grid, item cards, add/preview sheet, share link page, help. */
.top{position:sticky; top:0; z-index:10; background:var(--bg); display:grid; grid-template-columns:44px 1fr 44px; align-items:center;
  padding:12px 0; border-bottom:1px solid var(--line); margin-bottom:6px}
.brand{font-family:var(--display); font-size:1.65rem; font-weight:600; text-align:center; letter-spacing:.02em}
.brand small{display:block; font-family:var(--font); font-size:.58rem; font-weight:600; letter-spacing:.32em; text-transform:uppercase; color:var(--muted); margin-top:2px}
.top .spacer{width:42px}

/* paste bar on home */
.paste-bar{display:flex; gap:0; align-items:stretch; background:var(--surface); border:1px solid var(--ink); border-radius:var(--r); margin:18px 0 26px}
.paste-bar input{border:0; background:none; flex:1; min-width:0; padding:.95em .9em; outline:none; font-size:.95rem}
.paste-bar .btn{border-radius:0; border-width:0 0 0 1px}
.paste-bar .btn.ghost{border-color:var(--line-2)}
.section-h{display:flex; align-items:baseline; justify-content:space-between; margin:6px 0 14px; padding-bottom:10px; border-bottom:1px solid var(--line)}
.section-h h2{font-size:1.5rem}

/* lists grid */
.lists{display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:16px}
.list-card{border:1px solid var(--line); padding:0; text-align:left; background:var(--surface); border-radius:var(--r-card); overflow:hidden;
  display:grid; color:inherit; transition:box-shadow .2s, border-color .2s}
.list-card:hover{box-shadow:var(--shadow); border-color:var(--line-2)}
.cover{aspect-ratio:4/5; display:grid; grid-template-columns:1fr 1fr; grid-template-rows:1fr 1fr; gap:1px; background:var(--line)}
.cover.one{grid-template-columns:1fr; grid-template-rows:1fr}
.cover img{width:100%; height:100%; object-fit:contain; background:#fff; display:block; min-height:0; padding:6px}
.cover .emo{grid-column:1/-1; grid-row:1/-1; display:grid; place-items:center; font-size:2.6rem; background:var(--surface-2);
  border-bottom:3px solid var(--lc,var(--ink))}
.list-card .meta{padding:12px 14px 14px; display:grid; gap:3px; border-top:3px solid var(--lc,var(--ink))}
.list-card .name{font-family:var(--display); font-weight:600; font-size:1.08rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.new-list{border:1px dashed var(--line-2); background:transparent; min-height:180px; place-items:center; color:var(--muted); gap:6px; align-content:center;
  font-size:.72rem; font-weight:600; letter-spacing:.16em; text-transform:uppercase}

/* list screen */
.list-head{display:grid; gap:14px; margin:14px 0 18px; text-align:center; justify-items:center}
.list-title{display:grid; gap:6px; justify-items:center}
.list-title .emo{font-size:1.8rem; line-height:1}
.list-title h1{font-size:2rem; overflow-wrap:anywhere}
.list-title .rule{width:44px; height:3px; background:var(--lc,var(--ink))}
/* "safe" keeps the first chip reachable when the row is wider than the screen (plain center would cut it off). */
.list-head .chips{justify-content:safe center; width:100%}
.items{display:grid; grid-template-columns:repeat(auto-fill,minmax(155px,1fr)); gap:18px 14px}
.item-card{border:0; padding:0; text-align:left; background:transparent; overflow:hidden; display:grid; grid-template-rows:auto 1fr; color:inherit; position:relative}
.item-card.got{opacity:.55}
.thumb{aspect-ratio:4/5; background:#fff; display:grid; place-items:center; overflow:hidden; border:1px solid var(--line); border-radius:var(--r-card)}
.thumb img{width:100%; height:100%; object-fit:contain; padding:12px; transition:transform .3s}
.item-card:hover .thumb img{transform:scale(1.03)}
.thumb .noimg{font-size:2.2rem; opacity:.4}
.item-card .body{padding:10px 2px 4px; display:grid; gap:3px; align-content:start}
.item-card .store{font-size:.62rem; font-weight:600; letter-spacing:.16em; text-transform:uppercase; color:var(--muted)}
.item-card .title{font-size:.9rem; line-height:1.35; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden}
.item-card .price{font-weight:700; font-size:.98rem}
.item-card .tags{position:absolute; top:8px; left:8px; display:flex; gap:4px; flex-wrap:wrap}
.fab{position:fixed; right:16px; bottom:calc(18px + env(safe-area-inset-bottom,0px)); z-index:20; box-shadow:0 6px 20px rgba(0,0,0,.18)}

/* add / item sheets */
.preview{display:grid; grid-template-columns:116px 1fr; gap:16px; align-items:start}
.preview .pic{width:116px; aspect-ratio:4/5; background:#fff; border:1px solid var(--line); border-radius:var(--r-card); overflow:hidden; display:grid; place-items:center}
.preview .pic img{width:100%; height:100%; object-fit:contain; padding:6px}
.preview .pic .noimg{font-size:2rem; opacity:.4}
.pic-btn{font-size:.68rem; font-weight:600; letter-spacing:.14em; text-transform:uppercase; color:var(--ink); background:none; border:0; padding:8px 0 0;
  text-decoration:underline; text-underline-offset:3px}
.loading-line{height:14px; border-radius:var(--r); margin:8px 0}
.big-pic{width:100%; aspect-ratio:1; max-height:46vh; background:#fff; border:1px solid var(--line); border-radius:var(--r-card); display:grid; place-items:center; overflow:hidden}
.big-pic img{width:100%; height:100%; object-fit:contain; padding:16px}
.price-in{position:relative; display:block}
.price-in span{position:absolute; left:.85em; top:50%; transform:translateY(-50%); color:var(--muted); letter-spacing:0; font-size:.98rem; font-weight:400; text-transform:none}
.price-in .input{padding-left:1.6em}
.swatches{display:flex; gap:10px; flex-wrap:wrap}
.swatch{width:30px; height:30px; border-radius:50%; border:2px solid var(--surface); box-shadow:0 0 0 1px var(--line-2)}
.swatch[aria-pressed="true"]{box-shadow:0 0 0 2px var(--ink)}
.emoji-picks{display:flex; gap:4px; flex-wrap:wrap}
.emoji-picks button{border:1px solid var(--line); background:var(--surface); border-radius:var(--r); font-size:1.2rem; width:40px; height:40px}
.share-box{display:flex; align-items:stretch; border:1px solid var(--ink); border-radius:var(--r)}
.share-box input{border:0; background:none; flex:1; min-width:0; font-size:.88rem; outline:none; padding:0 12px}
.share-box .btn{border-radius:0}
.claim-row{display:flex; align-items:center; gap:8px; background:var(--ok-bg); color:var(--ok); border-radius:var(--r); padding:10px 12px; font-weight:500}
.bought-note{color:var(--ok); font-weight:600; font-size:.84rem}
.item-sheet-title{font-family:var(--display); font-size:1.35rem; line-height:1.25}

/* help */
.help-hero{padding:28px 20px 22px; text-align:center; border-bottom:1px solid var(--line); margin-bottom:6px}
.help-hero h1{font-size:2rem}
.help-search{display:flex; gap:8px; align-items:center; background:var(--surface); border:1px solid var(--ink); border-radius:var(--r); padding:2px 6px 2px 14px; margin:16px auto 0; max-width:520px}
.help-search input{border:0; background:none; flex:1; min-width:0; padding:.85em .2em; outline:none}
.topic{border-bottom:1px solid var(--line)}
.topic summary{cursor:pointer; list-style:none; padding:16px 2px; font-family:var(--display); font-size:1.08rem; font-weight:600; display:flex; justify-content:space-between; gap:10px}
.topic summary::-webkit-details-marker{display:none}
.topic summary::after{content:"+"; font-family:var(--font); font-weight:300; font-size:1.4rem; line-height:1; color:var(--muted)}
.topic[open] summary::after{content:"−"}
.topic .tb{padding:0 2px 18px; display:grid; gap:8px; color:var(--ink)}
.topic ol,.topic ul{margin:0; padding-left:20px; display:grid; gap:4px}

/* family code + shared page */
.center{min-height:100vh; display:grid; place-items:center; padding:24px}
.code-card{max-width:420px; width:100%; text-align:center; border-top:3px solid var(--ink)}
.code-input{letter-spacing:.4em; font-size:1.4rem; text-align:center}
.shared-hero{text-align:center; padding:26px 8px 20px; border-bottom:1px solid var(--line); margin-bottom:20px; display:grid; gap:8px; justify-items:center}
.shared-hero .emo{font-size:2rem; line-height:1}
.shared-hero h1{font-size:2.1rem}
.shared-hero .rule{width:44px; height:3px; background:var(--lc,var(--ink))}

@media (max-width:420px){ .grid2{grid-template-columns:1fr 1fr} .grid3{grid-template-columns:1fr 1fr} .grid3 > :first-child{grid-column:1/-1} .preview{grid-template-columns:96px 1fr} .preview .pic{width:96px} }
