/* UniCycle: design tokens
   Homey and hand-made: warm paper, brown-black ink, a forest green for actions,
   a bookish serif for headings. The highlighter marks free things and nothing else. */
:root {
  --bg:        #fffdf8;
  --surface:   #ffffff;
  --surface-2: #f6f1e8;
  --border:    #e9e1d4;
  --text:      #2d2722;
  --text-dim:  #625850;
  --text-faint:#786d63;
  --brand:     #2f6a4c;
  --brand-soft:#e7f0e8;
  --brand-ink: #224f38;
  --hl:        #f5e04a;
  --hl-ink:    #2d2722;
  --hl-h:      64%;
  --hl-y:      78%;
  --on-brand:  #ffffff;
  --good:      #2f6a4c;
  --good-soft: #e7f0e8;
  --warn:      #b8432f;
  --warn-soft: #fbece7;
  --danger:    #b8432f;
  --radius:    18px;
  --radius-sm: 12px;
  --radius-img:16px;
  --shadow-lg: 0 2px 6px rgba(45,39,34,.08), 0 18px 44px rgba(45,39,34,.16);
  --ff: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --ff-head: "Young Serif", Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#1f1b18; --surface:#27221f; --surface-2:#312b27; --border:#423a34;
    --text:#f4eee7; --text-dim:#c9bfb4; --text-faint:#a39889;
    --brand:#86c9a2; --brand-soft:#26362c; --brand-ink:#b4e0c5;
    --hl:#ecd75a; --good:#86c9a2; --good-soft:#26362c;
    --warn:#f08a7a; --warn-soft:#3d2724; --danger:#f08a7a;
    --shadow-lg:0 2px 6px rgba(0,0,0,.35), 0 18px 44px rgba(0,0,0,.5);
    --hl-h:100%; --hl-y:50%; --on-brand:#14241a;
  }
}
:root[data-theme="dark"] {
    --bg:#1f1b18; --surface:#27221f; --surface-2:#312b27; --border:#423a34;
    --text:#f4eee7; --text-dim:#c9bfb4; --text-faint:#a39889;
    --brand:#86c9a2; --brand-soft:#26362c; --brand-ink:#b4e0c5;
    --hl:#ecd75a; --good:#86c9a2; --good-soft:#26362c;
    --warn:#f08a7a; --warn-soft:#3d2724; --danger:#f08a7a;
    --shadow-lg:0 2px 6px rgba(0,0,0,.35), 0 18px 44px rgba(0,0,0,.5);
    --hl-h:100%; --hl-y:50%; --on-brand:#14241a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin:0; padding:0; }
body {
  font-family: var(--ff);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  font-size: 15px;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- the highlighter ----------
   A band across the lower two-thirds of the text with slanted ends, the way a
   chisel-tip marker lands. Text on it is always dark ink, in both themes. */
.hl {
  background-image: linear-gradient(100deg,
    transparent .1em, var(--hl) .22em, var(--hl) calc(100% - .26em), transparent calc(100% - .08em));
  background-repeat: no-repeat;
  background-size: 100% var(--hl-h);
  background-position: 0 var(--hl-y);
  padding: 0 .2em; margin: 0 -.2em;
  color: var(--hl-ink);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
/* The one orchestrated moment: the price gets marked when a listing opens. */
.detail-head .price .hl { animation: swipe .6s cubic-bezier(.3,.7,.2,1) .12s both; }
@keyframes swipe { from { background-size: 0% var(--hl-h); } }

/* ---------- layout ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 1240px; margin: 0 auto; }
.wordmark { font-family: var(--ff-head); font-size: 22px; color: var(--brand); letter-spacing: -.01em;
  background: none; border: 0; padding: 0; }
.topnav, .topnav-post { display: none; }
button.me-chip { background: none; border: 0; padding: 4px 6px; border-radius: 999px; }
button.me-chip:hover { background: var(--surface-2); }
.topbar-spacer { flex: 1; }
main { flex: 1; width: 100%; max-width: 860px; margin: 0 auto; padding: 22px 16px 100px; }

/* ---------- nav ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--bg) 95%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  background: none; border: 0; padding: 9px 4px 11px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text-faint); font-size: 11px; font-weight: 600;
  position: relative; transition: color .15s;
}
.tabbar button .ico { font-size: 20px; line-height: 1; display: flex; }
.tabbar button[aria-current="true"] { color: var(--brand); }
.tabbar button.post .ico {
  background: var(--brand); color: var(--on-brand);
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-size: 18px;
  margin-bottom: -2px;
}
.tabbar button.post[aria-current="true"] .ico { background: var(--brand-ink); }

/* ---------- type ---------- */
/* Young Serif has one weight; size and colour carry the hierarchy. */
h1 { font-family: var(--ff-head); font-weight: 400; font-size: 29px; line-height: 1.2; letter-spacing: -.01em; margin: 0 0 6px; }
h2 { font-family: var(--ff-head); font-weight: 400; font-size: 19px; line-height: 1.3; margin: 0 0 4px; }
/* Counts and codes beside a heading read better in the body face. */
h1 .faint, h2 .faint, h2 .muted { font-family: var(--ff); font-variant-numeric: lining-nums; }
h3 { font-size: 15.5px; line-height: 1.35; letter-spacing: -.01em; font-weight: 700; margin: 0; }
.sub { color: var(--text-dim); font-size: 15px; margin: 0 0 22px; max-width: 60ch; }
.muted { color: var(--text-dim); font-size: 13.5px; }
.faint { color: var(--text-faint); font-size: 13px; }
.price, .tile-price { font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.price { font-size: 20px; }
.price.xl { font-size: 34px; line-height: 1.1; }
.strike { color: var(--text-faint); text-decoration: line-through; font-size: 13px; font-weight: 500; }

/* ---------- primitives ---------- */
.i {
  width: 1em; height: 1em; flex: none; vertical-align: -.125em;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.i.fill { fill: currentColor; stroke-width: 1.5; }
.btn.link .i { margin-right: 3px; }
.pill .i { font-size: 12px; }

/* A box only where the box means something: a form, a conversation, a note. */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.pad { padding: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }

.btn {
  border: 1px solid transparent; border-radius: 999px;
  padding: 11px 18px; font-size: 14.5px; font-weight: 700;
  background: var(--brand); color: var(--on-brand);
  transition: transform .12s ease, background .15s;
}
.btn:hover { background: var(--brand-ink); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.soft { background: var(--brand-soft); color: var(--brand-ink); }
.btn.soft:hover { background: color-mix(in srgb, var(--brand-soft) 80%, var(--brand)); }
.btn.sm { padding: 7px 13px; font-size: 13px; }
.btn.lg { padding: 14px 24px; font-size: 16px; width: 100%; }
.btn.link { background: none; color: var(--brand); padding: 4px 0; font-weight: 700;
  display: inline-flex; align-items: center; }
.btn.link:hover { background: none; text-decoration: underline; text-underline-offset: 3px; }

.field { display: block; margin-bottom: 15px; }
.field > span { display:block; font-size:13px; font-weight:600; color:var(--text-dim); margin-bottom:5px; }
.input {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
.input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
textarea.input { resize: vertical; min-height: 78px; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 6px;
  font-size: 12.5px; font-weight: 600;
  background: var(--surface-2); color: var(--text-dim);
}
.pill.brand  { background: var(--brand-soft); color: var(--brand-ink); }
.pill.good   { background: var(--good-soft);  color: var(--good); }
.pill.accent { background: var(--warn-soft);  color: var(--warn); }

.avatar {
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-ink);
  display: grid; place-items: center;
  font-size: 14px; font-weight: 700; letter-spacing: .02em;
}
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }
.me-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 14px; font-weight: 600; color: var(--text-dim);
}

.divider { height: 1px; background: var(--border); margin: 18px 0; border: 0; }

.empty { text-align: center; padding: 44px 20px; color: var(--text-dim); }
.card.empty { border: 0; background: none; }
.empty .big { font-size: 34px; margin-bottom: 10px; color: var(--text-faint); display: flex; justify-content: center; }
.empty p { margin: 4px 0 0; }

/* ---------- upload ---------- */
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 34px 20px; text-align: center; background: var(--surface);
  transition: border-color .18s, background .18s;
  cursor: pointer;
}
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone .big { font-size: 30px; color: var(--brand); display: flex; justify-content: center; }
.dropzone h3 { margin: 8px 0 4px; font-size: 16px; }

.progress {
  height: 5px; background: var(--surface-2);
  border-radius: 999px; overflow: hidden; margin-top: 14px;
}
.progress i { display:block; height:100%; background: var(--brand); border-radius:999px;
  transition: width .3s ease; }

.preview-img {
  max-height: 180px; width: auto; max-width: 100%;
  border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; margin: 0 auto;
}

/* ---------- course rows (review screen) ---------- */
.course-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 2px; border-bottom: 1px solid var(--border);
  transition: opacity .15s;
}
.rowlist { border-top: 1px solid var(--border); }
.course-row.off { opacity: .45; }
.check {
  width: 22px; height: 22px; flex: none; margin-top: 2px;
  border-radius: 6px; border: 2px solid var(--border);
  display: grid; place-items: center; background: var(--surface);
  color: var(--on-brand); font-size: 13px; transition: background .15s, border-color .15s;
}
.check[data-on="1"] { background: var(--brand); border-color: var(--brand); }

/* ---------- textbook matches: ruled rows, like an index card ---------- */
.matchlist { border-top: 1px solid var(--border); }
.match { padding: 16px 2px; border-bottom: 1px solid var(--border); cursor: pointer; }
.match:hover h3 { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.match .head { display: flex; gap: 12px; align-items: flex-start; }
.match .body { padding: 10px 0 0 52px; }
.match h3 { margin-top: 6px; }
.best-label { font-size: 13px; font-weight: 700; color: var(--brand); margin-right: 2px; }
.match.flagged .head, .match.flagged .body .between { opacity: .7; }

.reasons { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 5px; }
.reasons li {
  font-size: 13.5px; color: var(--text-dim);
  padding-left: 20px; position: relative; line-height: 1.4;
}
.reasons li::before {
  content: "✓"; position: absolute; left: 1px; top: 0;
  color: var(--brand); font-weight: 700; font-size: 12px;
}
/* A wrong edition reads as a note in the margin, in red. */
.reasons.warnings { border-left: 2px solid var(--warn); padding-left: 10px; }
.reasons.warnings li { color: var(--warn); font-weight: 600; padding-left: 0; }
.reasons.warnings li::before { content: none; }

.score {
  flex: none; min-width: 38px; height: 26px; padding: 0 8px; border-radius: 999px;
  display: grid; place-items: center; font-size: 12.5px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim); border: 1px solid var(--border);
}
.score.top { color: var(--brand-ink); border-color: var(--brand); }
.score.bad { color: var(--warn); border-color: var(--warn); }

/* End-of-term hand-on prompt. */
.wrapup { border-left: 3px solid var(--brand); }
.wrapup.urgent { border-left-color: var(--warn); }
.wrapup-ico { font-size: 22px; line-height: 1; color: var(--brand); display: flex; padding-top: 2px; }
.wrapup.urgent .wrapup-ico { color: var(--warn); }
.wrapup-row { padding: 9px 0; border-top: 1px solid var(--border); }

/* Safety note shown before a first meetup. */
.safety {
  margin-top: 12px; padding: 11px 13px;
  background: var(--brand-soft); color: var(--brand-ink);
  border-radius: var(--radius-sm); font-size: 13.5px; line-height: 1.45;
}
.safety b { font-weight: 700; }

.actions { display: flex; gap: 8px; margin-top: 14px; }
.actions .btn { flex: 1; white-space: nowrap; padding-left: 10px; padding-right: 10px; }
/* The primary action keeps its label; the icon buttons stay compact. */
.actions .btn:first-child { flex: 3; }

/* ---------- messages ---------- */
.thread-item { display:flex; gap:12px; padding:14px 16px; align-items:center; width:100%;
  background:none; border:0; text-align:left; border-bottom:1px solid var(--border); }
.thread-item:last-child { border-bottom: 0; }
.thread-item:hover { background: var(--surface-2); }
.chat { display: flex; flex-direction: column; gap: 9px; padding: 16px; min-height: 260px; }
.bubble {
  max-width: 78%; padding: 9px 13px; border-radius: 16px;
  background: var(--surface-2); font-size: 15px; line-height: 1.45;
  align-self: flex-start; border-bottom-left-radius: 5px;
  overflow-wrap: anywhere;
}
.bubble.mine {
  align-self: flex-end; background: var(--brand); color: var(--on-brand);
  border-bottom-left-radius: 16px; border-bottom-right-radius: 5px;
}
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }

/* ---------- misc ---------- */
.seg { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.seg button { flex:1; border:0; background:none; padding:10px 8px;
  font-size:14px; font-weight:600; color:var(--text-faint);
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.seg button[aria-current="true"] { color: var(--text); border-bottom-color: var(--brand); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 88px; z-index: 100;
  background: var(--text); color: var(--bg);
  padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg); animation: pop .25s ease;
  max-width: calc(100vw - 32px); text-align: center;
}
@keyframes pop { from { opacity:0; transform: translate(-50%, 8px); } }

.modal-back {
  position: fixed; inset: 0; z-index: 90; background: rgba(20,26,36,.45);
  backdrop-filter: blur(3px); display: grid; place-items: end center;
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface); width: 100%; max-width: 540px;
  border-radius: 20px 20px 0 0; max-height: 88dvh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: slide .26s cubic-bezier(.2,.8,.3,1);
  padding-bottom: env(safe-area-inset-bottom);
}
@keyframes slide { from { transform: translateY(24px); } }
@media (min-width: 640px) {
  .modal-back { place-items: center; }
  .modal { border-radius: 20px; }
}

.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: sh 1.3s infinite; border-radius: var(--radius); height: 116px; }
@keyframes sh { from { background-position: 100% 0; } to { background-position: -100% 0; } }

@media (min-width: 720px) {
  main { padding-top: 30px; }
  h1 { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ======================= marketplace ======================= */

.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- search + filters --- */
.searchbar { position: relative; margin-bottom: 14px; }
.input.search { padding: 12px 40px 12px 42px; border-radius: 999px; font-size: 15.5px;
  background: var(--surface-2); border-color: transparent; }
.input.search:focus { background: var(--surface); border-color: var(--brand); }
/* We draw our own clear button. */
.input.search::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.search-ico {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  display: flex; font-size: 17px; color: var(--text-faint); pointer-events: none;
}
.clearq {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 0; background: var(--border); color: var(--text-dim);
  width: 26px; height: 26px; border-radius: 50%; font-size: 12px;
  display: grid; place-items: center;
}

.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 14px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 14px; font-weight: 600; color: var(--text-dim);
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { border-color: var(--brand); color: var(--text); }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.chip i { font-style: normal; opacity: .7; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.chip.sm { padding: 6px 11px; font-size: 13px; }
.chips.areas { align-items: center; padding-top: 0; }
.areas-label { flex: none; display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 600; color: var(--text-faint); margin-right: 2px; }
.browse-head { margin: 4px 0 14px; flex-wrap: wrap; row-gap: 8px; }
.browse-head h2 { white-space: nowrap; margin: 0; }
.input.sel { width: auto; padding: 7px 10px; font-size: 13.5px; border-radius: 999px; }

/* --- listing grid: the stuff itself, not boxes around it --- */
.grid {
  display: grid; gap: 22px 14px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.tile { cursor: pointer; display: flex; flex-direction: column; border-radius: var(--radius-img); }
.tile:hover .tile-title { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.tile-img {
  position: relative; aspect-ratio: 1; background: var(--surface-2);
  border-radius: var(--radius-img); overflow: hidden;
}
.thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.ph {
  display: grid; place-items: center; font-size: 36px;
  color: color-mix(in srgb, var(--brand) 60%, var(--surface-2));
  background: var(--surface-2);
}
.thumb.big { border-radius: var(--radius-img); }
/* Square thumb used in compact rows, where there is no sized parent. */
.tile-img .thumb { position: absolute; inset: 0; }
.mini-thumb { aspect-ratio: 1; height: auto; border-radius: var(--radius-sm); }
.detail-ph { aspect-ratio: 16/10; height: auto; font-size: 60px; border-radius: var(--radius-img); }

.heart {
  position: absolute; top: 8px; right: 8px;
  width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--text-dim);
  font-size: 16px; line-height: 1; display: grid; place-items: center;
  transition: transform .14s, color .14s;
}
.heart:active { transform: scale(.88); }
.heart.on { color: #d6365f; }
.heart.on .i { fill: currentColor; }
.heart.big { position: static; width: 44px; height: 44px; font-size: 21px;
  background: var(--surface-2); flex: none; }

.tag {
  position: absolute; left: 8px; top: 8px;
  padding: 2px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 700;
}
.tag.hold { background: var(--surface); color: var(--text); }

.tile-body { padding: 9px 1px 0; }
.tile-price { font-size: 17px; }
.tile-title {
  font-size: 14px; font-weight: 500; line-height: 1.35; margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tile-meta { font-size: 12.5px; color: var(--text-faint); margin-top: 2px; }

/* --- detail --- */
.gallery {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.gallery::-webkit-scrollbar { display: none; }
.gallery img {
  width: 100%; flex: none; scroll-snap-align: center;
  aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius-img);
}
.detail-head { margin-top: 18px; }
.notes { margin-top: 12px; font-size: 14px; }
.notes p { margin: 6px 0 0; font-weight: 400; font-style: italic; color: var(--text-dim); }

/* --- post --- */
.catgrid { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  border-top: 1px solid var(--border); }
.catcard {
  text-align: left; padding: 14px 2px; border: 0; border-bottom: 1px solid var(--border);
  background: none; display: grid; grid-template-columns: 28px 1fr; column-gap: 12px; align-items: start; align-content: start;
}
.catcard:hover b { color: var(--brand); }
.catcard .ico { font-size: 22px; color: var(--brand); display: flex; grid-row: span 2; padding-top: 1px; }
.catcard b { font-size: 15px; letter-spacing: -.01em; }
.catcard i { font-style: normal; font-size: 13px; color: var(--text-faint); }

.photo-row { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-item { position: relative; width: 76px; height: 76px; }
.photo-item img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.photo-x {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px;
  border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-dim); font-size: 11px;
  display: grid; place-items: center;
}
.photo-add {
  width: 76px; height: 76px; border-radius: var(--radius-sm);
  border: 2px dashed var(--border); background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--text-dim); transition: border-color .15s, color .15s;
}
.photo-add:hover { border-color: var(--brand); color: var(--brand); }
.photo-add .i { font-size: 20px; }
.photo-add i { font-style: normal; font-size: 12px; font-weight: 600; }

.hint {
  display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 7px 11px; border-radius: var(--radius-sm); margin: -6px 0 14px;
  background: var(--brand-soft); color: var(--brand-ink); font-size: 13px; font-weight: 600;
}
.cb { width: 18px; height: 18px; accent-color: var(--brand); }
#editionHint { color: var(--warn); }

@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 28px 18px; }
  .gallery img { width: 62%; }
}

/* ---------- sign in ---------- */
.auth { max-width: 420px; margin: 4dvh auto 0; }
.auth-intro { text-align: center; margin-bottom: 22px; }
.auth-intro .sub { margin: 0 auto; }
.auth-wordmark { font-family: var(--ff-head); font-size: 26px; color: var(--brand); }
.auth-title { font-size: 36px; line-height: 1.08; margin: 12px 0 10px; }
.auth-points { display: none; }
.auth-points li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; }
.auth-points .i { font-size: 22px; color: var(--brand); margin-top: 2px; }
.auth-points b { display: block; font-size: 16px; }
.auth-points span { color: var(--text-dim); font-size: 14.5px; }
.field small { display: block; color: var(--text-faint); font-size: 12.5px; margin-top: 5px; }
.field > span em { font-style: normal; font-weight: 500; color: var(--text-faint); }

.auth.single { max-width: 440px; margin: 6dvh auto 0; }
.auth.single .auth-wordmark { text-align: center; }
.code-input { font-size: 24px; font-weight: 700; letter-spacing: .3em; text-align: center;
  font-variant-numeric: tabular-nums; }
.btn.link.forgot { font-size: 13px; padding: 6px 0 0; }

/* ---------- terms, deletion ---------- */
.agree { display: flex; gap: 10px; align-items: flex-start; margin: 2px 0 16px; font-size: 13.5px;
  color: var(--text-dim); line-height: 1.45; cursor: pointer; }
.agree .cb { margin-top: 1px; flex: none; }
.legal-line { margin: 18px 0 0; font-size: 12.5px; }
.danger-zone { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border); }
.danger-zone p { margin: 0 0 6px; }
.btn.link.danger-link { color: var(--danger); }
.btn.danger-btn { background: var(--danger); color: #fff; }
.btn.danger-btn:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }
.legal { max-width: 680px; margin: 0 auto; padding: 40px 20px 80px; line-height: 1.6; }
.legal .auth-wordmark { text-decoration: none; display: inline-block; margin-bottom: 20px; }
.legal h1 { font-size: 34px; margin-bottom: 4px; }
.legal h2 { font-size: 24px; margin: 40px 0 6px; padding-top: 18px; border-top: 1px solid var(--border); }
.legal h3 { font-size: 16px; margin: 22px 0 4px; }
.legal p, .legal li { font-size: 15.5px; color: var(--text); }
.legal ul { padding-left: 20px; margin: 6px 0; }
.legal li { margin: 4px 0; }

/* ---------- admin ---------- */
.admin-seg { overflow-x: auto; }
.admin-seg button { white-space: nowrap; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--border); }
.stat { padding: 14px 2px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.stat b { font-family: var(--ff-head); font-weight: 400; font-size: 30px; line-height: 1.1;
  font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--text-faint); }
.dayrows { border-top: 1px solid var(--border); margin-top: 8px; }
.dayrow { display: grid; grid-template-columns: 130px 1fr 36px; gap: 12px; align-items: center;
  padding: 7px 2px; border-bottom: 1px solid var(--border); font-size: 13.5px; color: var(--text-dim); }
.dayrow i { display: block; height: 8px; border-radius: 4px; background: var(--brand); }
.dayrow b { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.admin-list { border-top: 1px solid var(--border); }
.admin-row { display: flex; flex-wrap: wrap; gap: 10px 16px; padding: 16px 2px; border-bottom: 1px solid var(--border); }
.admin-row .grow { flex: 1 1 280px; }
.admin-row.done { opacity: .7; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.btn.ghost.danger { color: var(--danger); }
.report-words { margin: 8px 0 0; font-style: italic; color: var(--text-dim); white-space: pre-wrap; }
.admin-link { display: inline-flex; align-items: center; gap: 6px; }

.filter-label { display: none; }
.chat-split .chat, .thread-pane .chat { overflow-y: auto; }

/* ======================= wide screens =======================
   Same app, laid out for a laptop: tabs move to the top bar, the page widens,
   and the views that benefit get a second column. */
@media (min-width: 960px) {
  .tabbar { display: none !important; }
  .topbar { padding: 12px 32px; }
  .topbar-inner { max-width: 1176px; }
  .topnav { display: flex; gap: 4px; margin-left: 28px; }
  .topnav button {
    background: none; border: 0; padding: 8px 14px; border-radius: 999px;
    font-size: 14.5px; font-weight: 600; color: var(--text-dim);
  }
  .topnav button:hover { background: var(--surface-2); color: var(--text); }
  .topnav button[aria-current="true"] { color: var(--brand-ink); background: var(--brand-soft); }
  .topnav-post { display: inline-flex; align-items: center; gap: 6px; }
  .toast { bottom: 32px; }

  main { max-width: 1240px; padding: 32px 32px 72px; }
  main.v-post, main.v-matches, main.v-onboard, main.v-review { max-width: 800px; }
  main.v-auth { max-width: 1120px; }

  /* sign in: the pitch on the left, the form on the right */
  .auth { max-width: none; margin: 8dvh 0 0; display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 80px; align-items: center; }
  .auth-intro { text-align: left; margin: 0; }
  .auth-intro .sub { margin: 0; font-size: 17px; }
  .auth-title { font-size: 68px; line-height: 1.02; letter-spacing: -.02em; margin: 18px 0 16px; }
  .auth-points { display: grid; gap: 20px; list-style: none; padding: 0; margin: 36px 0 0; }
  .auth-panel { width: 100%; max-width: 440px; justify-self: end; }
  .auth.single { display: block; max-width: 440px; margin: 10dvh auto 0; }

  /* browse: filters in a sidebar, more columns of listings */
  .browse { display: grid; grid-template-columns: 220px minmax(0, 1fr); column-gap: 40px; align-items: start; }
  .browse > .searchbar { grid-column: 1 / -1; max-width: 620px; margin-bottom: 26px; }
  .filters { position: sticky; top: 88px; }
  .filter-label, .areas-label {
    display: block; font-size: 13px; font-weight: 700; color: var(--text-faint);
    padding: 0 12px 6px; margin: 0;
  }
  .filters .chips { flex-direction: column; align-items: stretch; overflow: visible; gap: 1px; padding: 0 0 22px; }
  .filters .chip {
    border: 0; background: none; border-radius: 10px; padding: 8px 12px;
    justify-content: flex-start; color: var(--text-dim);
  }
  .filters .chip i { margin-left: auto; }
  .filters .chip:hover { background: var(--surface-2); color: var(--text); }
  .filters .chip.on { background: var(--brand-soft); color: var(--brand-ink); }
  .filters .chips.areas .areas-label .i { display: none; }
  .browse-head { margin-top: 0; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 32px 22px; }

  /* a listing: photos beside the details */
  .detail { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 44px; align-items: start; }
  .detail-media { position: sticky; top: 88px; }
  .detail .gallery img { width: 100%; }
  .detail-head { margin-top: 0; }

  /* chats: the list and the open conversation together */
  .chat-split { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
  .thread-list { max-height: calc(100dvh - 210px); overflow-y: auto; }
  .thread-item[aria-current="true"] { background: var(--brand-soft); }
  .thread-pane { display: flex; flex-direction: column; height: calc(100dvh - 210px); }
  .thread-pane .chat { flex: 1; min-height: 0; }
  .thread-none { padding-top: 120px; }

  /* my stuff */
  .mylist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .v-me .seg { max-width: 460px; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 24px; }
  .admin-seg { max-width: 560px; }
  .dayrows { max-width: 640px; }
  .v-me #profForm { max-width: 560px; }
  .v-me #signOut { max-width: 240px; }
}
