/* Brainrot Trades — mobile-first styles.
   Base layout targets phones from 320px wide up. No horizontal scrolling:
   everything is max-width:100% and box-sizing:border-box. */
:root {
  --bg: #0b0f1a;
  --surface: #141a2a;
  --surface2: #1c2440;
  --text: #f2f4fa;
  --muted: #a7b0c6;
  --accent: #22c55e;
  --accent2: #38bdf8;
  --warn: #f59e0b;
  --danger: #ef4444;
  --border: #2a3352;
  --radius: 12px;
  --nav-h: 60px;
  --top-h: 56px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent2); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 8px; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; margin-top: 4px; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
input, select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface2);
  font-size: 16px; /* 16px stops iOS auto-zooming inputs */
}
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 2px;
}
textarea { min-height: 96px; resize: vertical; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }

/* Buttons — at least 44px tall for thumbs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; min-width: 48px;
  padding: 12px 18px;
  border: 0; border-radius: 10px;
  background: var(--accent); color: #06130a;
  font-weight: 700; font-size: 1rem; text-decoration: none;
}
.btn.secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; color: var(--accent2); border: 1px solid var(--border); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.liked { background: var(--accent); color: #06130a; border-color: var(--accent); }

/* Sale listing comments */
.comments { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.comment { margin-bottom: 12px; }
.comment p { margin: 4px 0 8px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--top-h);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 12px;
  background: rgba(11, 15, 26, .96);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; min-width: 0; }
.brand-icon { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; flex: none; }
.brand-name { font-weight: 800; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.top-actions .btn { min-height: 40px; padding: 8px 12px; font-size: .92rem; }
.userchip { display: flex; align-items: center; gap: 6px; font-size: .9rem; max-width: 46vw; }
.userchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Badges */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: .72rem; font-weight: 800; letter-spacing: .02em;
  background: var(--accent2); color: #06202f; vertical-align: middle;
}
.badge.owner { background: #facc15; color: #231a00; }
.badge.coowner { background: #c084fc; color: #2a0a44; }
.badge.admin { background: #34d399; color: #06281c; }
.badge.verified { background: var(--accent); color: #06130a; }
.badge.ballpark { background: var(--warn); color: #241a00; }

/* Layout */
.view { padding: 16px 12px calc(var(--nav-h) + 24px); max-width: 860px; margin: 0 auto; width: 100%; }
.view.nonav { padding-bottom: 24px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  min-width: 0;
}
.card h2 { margin-top: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .grid.two { grid-template-columns: 1fr 1fr; } }
@media (min-width: 760px) { .grid.three { grid-template-columns: 1fr 1fr 1fr; } }

/* Landing */
.hero { text-align: center; padding: 28px 8px 8px; }
.hero img.hero-icon { width: 96px; height: 96px; margin: 0 auto 12px; border-radius: 20px; }
.hero .price-tag { font-size: 2rem; font-weight: 800; color: var(--accent); }
.feature-list { list-style: none; padding: 0; margin: 0 0 12px; }
.feature-list li { padding: 10px 0 10px 34px; position: relative; border-bottom: 1px solid var(--border); }
.feature-list li:last-child { border-bottom: 0; }
.feature-list li::before { content: "✓"; position: absolute; left: 6px; top: 10px; color: var(--accent); font-weight: 800; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; padding: 10px 0 10px 44px; position: relative; }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 8px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-weight: 800;
}

/* Price list */
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.toolbar input { flex: 1; min-width: 0; }
.brainrot-card { display: flex; gap: 12px; align-items: flex-start; }
.brainrot-card img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: var(--surface2); flex: none; }
.brainrot-card .no-pic {
  width: 72px; height: 72px; flex: none;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: .68rem; font-weight: 700; color: var(--muted);
  background: var(--surface2); border: 1px dashed var(--border); border-radius: 10px;
  padding: 4px;
}
.brainrot-card .info { min-width: 0; flex: 1; }
.brainrot-card .info h3 { margin-bottom: 2px; word-break: break-word; }
.price { font-size: 1.15rem; font-weight: 800; color: var(--accent); }
.range { color: var(--muted); font-size: .9rem; }

/* Checker */
.checker-result { font-size: 1.1rem; }
.checker-result .big { font-size: 1.6rem; font-weight: 800; color: var(--accent); }
.trait-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 10px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface2);
  font-size: .95rem;
}
.chip[aria-pressed="true"] { background: var(--accent); color: #06130a; border-color: var(--accent); font-weight: 700; }

/* Rarity chart */
.rarity-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 4px; border-bottom: 1px solid var(--border); min-width: 0;
}
.rarity-row .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rarity-row .pct { font-weight: 700; white-space: nowrap; }
.bar { height: 8px; border-radius: 4px; background: var(--surface2); overflow: hidden; margin: 2px 0 8px; }
.bar > span { display: block; height: 100%; background: var(--accent2); }

/* Chat */
.chat-log { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.chat-msg { background: var(--surface2); border-radius: 10px; padding: 10px 12px; overflow-wrap: anywhere; }
.chat-msg .meta { font-size: .8rem; color: var(--muted); margin-bottom: 2px; }
.chat-form { display: flex; gap: 8px; position: sticky; bottom: calc(var(--nav-h) + 8px); }
.chat-form input { flex: 1; min-width: 0; }

/* Bottom nav — the phone navigation. Scrolls sideways if narrow. */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: var(--nav-h);
  display: flex; overflow-x: auto; scrollbar-width: none;
  background: rgba(11, 15, 26, .97);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav::-webkit-scrollbar { display: none; }
.bottomnav a {
  flex: 1 0 auto; min-width: 52px; min-height: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: .68rem; font-weight: 600;
  padding: 6px 4px;
}
.bottomnav a .ico { font-size: 1.15rem; line-height: 1; }
.bottomnav a.active { color: var(--accent); }

/* Floating chat button */
.chat-fab {
  position: fixed; right: 14px; bottom: calc(var(--nav-h) + 14px); z-index: 45;
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--accent); color: #06130a; font-size: 1.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .5);
}

/* Forms, paywall, tables */
.form-note { font-size: .9rem; color: var(--muted); }
.error { background: #3a1620; border: 1px solid var(--danger); color: #ffd7de; padding: 12px; border-radius: 10px; margin-bottom: 12px; overflow-wrap: anywhere; }
.success { background: #0f2e1c; border: 1px solid var(--accent); color: #c9f5d8; padding: 12px; border-radius: 10px; margin-bottom: 12px; }
.paywall { text-align: center; padding: 24px 8px; }
.paywall .price-tag { font-size: 2.2rem; font-weight: 800; color: var(--accent); }
.checklist { list-style: none; padding: 0; margin: 0 0 12px; }
.checklist li { margin-bottom: 8px; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 0; }
.checklist input { width: 24px; height: 24px; min-height: 24px; flex: none; margin-top: 2px; }
table.plain { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.plain th, table.plain td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.plain th { color: var(--muted); font-size: .8rem; text-transform: uppercase; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 12px); z-index: 60;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; text-align: center;
}
footer.site { text-align: center; color: var(--muted); font-size: .82rem; padding: 8px 12px 24px; }
footer.site a { color: var(--muted); }

/* Desktop: centre the bottom nav like a dock, widen the view */
@media (min-width: 860px) {
  .view { padding: 24px 20px calc(var(--nav-h) + 32px); }
  .bottomnav { left: 50%; transform: translateX(-50%); width: 640px; border: 1px solid var(--border); border-bottom: 0; border-radius: 16px 16px 0 0; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* Private messages, friends, member lists, modals — appended for the DM + friends features. */
.conv-row { display: block; text-decoration: none; color: inherit; }
.conv-row:hover { border-color: var(--accent2); }
.conv-name { display: block; font-weight: 700; }
.conv-last { display: block; color: var(--muted); font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-meta { display: block; font-size: .8rem; color: var(--muted); margin-top: 4px; }
.chat-msg.mine { background: #17351f; border: 1px solid #1f5c33; }
.modal {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0, 0, 0, .65);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-box {
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px 16px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
}
@media (min-width: 600px) {
  .modal { align-items: center; padding: 20px; }
  .modal-box { border-radius: 16px; }
}
.dm-report { margin-top: 8px; }
