:root {
  --bg: #0E0F12;
  --card: #181A20;
  --raised: #22252D;
  --line: #2A2D35;
  --line-strong: #3A3E48;
  --text: #F2F2F0;
  --muted: #A3A7B0;
  --evo: #4C8DFF;
  --des: #FF8A3D;
  --danger: #FF6B6B;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--evo); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }

.wrap { max-width: 560px; margin: 0 auto; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); font-size: 14px; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 10;
  background: rgba(14, 15, 18, 0.92);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.top .wrap { display: flex; align-items: center; gap: 8px; padding: 10px 16px; }
.logo { font-family: 'Archivo Black', sans-serif; font-size: 24px; letter-spacing: 0.5px; text-decoration: none; line-height: 1; }
.logo .e { color: var(--evo); } .logo .d { color: var(--des); }
.tagline { font-size: 12px; color: var(--muted); }
.spacer { flex: 1; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: none; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; color: var(--text);
  text-decoration: none;
}
.icon-btn:hover { background: var(--raised); }

/* Buttons */
.btn {
  height: 48px; padding: 0 20px; border-radius: 12px; border: none;
  font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-light { background: var(--text); color: var(--bg); }
.btn-ghost { background: var(--raised); color: var(--text); border: 1px solid var(--line-strong); }
.btn-evo { background: var(--evo); color: var(--bg); }
.btn-des { background: var(--des); color: var(--bg); }
.btn-pill { border-radius: 999px; }
.btn-block { width: 100%; }
.btn-sm { height: 40px; padding: 0 14px; font-size: 14px; }
.text-btn { background: none; border: none; color: var(--muted); padding: 8px; font-size: 13px; }
.text-btn:hover { color: var(--text); }

/* Feed */
.feed { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 14px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--raised);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.who { display: flex; flex-direction: column; min-width: 0; }
.who b { font-size: 14px; font-weight: 600; }
.who span { font-size: 12px; color: var(--muted); }
.photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--raised); }
.photo-link { display: block; color: var(--muted); text-decoration: none; }
.caption { margin: 0; padding: 12px 14px 4px; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.vote-area { padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.lock { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.vote-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.split-labels { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; }
.split-labels .e { color: var(--evo); } .split-labels .d { color: var(--des); }
.bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--line); }
.bar .e { background: var(--evo); } .bar .d { background: var(--des); }
.bar > div { transition: width 0.6s ease; }

.load-more { display: flex; justify-content: center; padding: 0 16px 24px; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }

/* Floating new-post button */
.fab {
  position: fixed; right: max(16px, calc(50% - 264px)); bottom: calc(20px + env(safe-area-inset-bottom));
  height: 52px; padding: 0 22px; border-radius: 999px; border: none;
  background: var(--text); color: var(--bg); font-weight: 700;
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}

/* Post / debate page */
.section { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.section-title { padding: 16px 16px 6px; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 0.6px; text-transform: uppercase; }
.comments { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.comment { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.comment-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.comment-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comment-head .time { white-space: nowrap; }
.comment-head b { font-size: 13px; font-weight: 600; }
.comment-head .time { font-size: 12px; color: var(--muted); }
.comment-head .text-btn { margin-left: auto; padding: 4px 6px; }
.comment-body { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tag { font-size: 11px; font-weight: 700; color: var(--bg); border-radius: 999px; padding: 3px 8px; }
.tag.e { background: var(--evo); } .tag.d { background: var(--des); }
.tag.c { background: var(--text); }

.composer {
  position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--line);
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px;
}
.composer-row { display: flex; gap: 8px; align-items: flex-end; }

/* Forms */
.form { padding: 20px 16px 32px; display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 13px; font-weight: 600; }
.input, textarea.input {
  width: 100%; min-height: 46px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--card); color: var(--text); padding: 11px 12px; font-size: 16px;
}
textarea.input { resize: vertical; min-height: 46px; }
.input:focus { outline: 2px solid var(--evo); outline-offset: 1px; border-color: transparent; }
.hint { font-size: 12px; color: var(--muted); }

.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--card); padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.tabs button { height: 40px; border: none; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; }
.tabs button.on { background: var(--raised); color: var(--text); }

.picker {
  height: 220px; border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--card);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  color: var(--muted); overflow: hidden; position: relative; cursor: pointer;
}
.picker img { width: 100%; height: 100%; object-fit: cover; }
.picker input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.side-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.side-pick button { height: 48px; border-radius: 12px; font-weight: 700; background: transparent; }
.side-pick .e { border: 2px solid var(--evo); color: var(--evo); }
.side-pick .d { border: 2px solid var(--des); color: var(--des); }
.side-pick .e.on { background: var(--evo); color: var(--bg); }
.side-pick .d.on { background: var(--des); color: var(--bg); }

.rules { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13px; color: var(--muted); }

/* Bottom sheet (report menu) */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 560px; background: var(--card); border-top-left-radius: 20px; border-top-right-radius: 20px;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px;
}
.sheet h2 { margin: 0 0 6px; font-size: 17px; }
.sheet .opt { height: 48px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--raised); text-align: left; padding: 0 14px; font-weight: 500; }
.sheet .opt.danger { color: var(--danger); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom));
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; z-index: 60;
}

.setup { max-width: 560px; margin: 40px auto; padding: 0 16px; }
.setup code { background: var(--raised); padding: 2px 6px; border-radius: 6px; }

/* ---------- Update 2: profiles, follows, comment votes ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
img.avatar { object-fit: cover; padding: 0; }
.who-link { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.who-link:hover b { text-decoration: underline; }
.icon-btn .avatar { border: 1px solid var(--line-strong); }

/* Profile */
.profile-head { padding: 20px 16px 16px; display: flex; flex-direction: column; gap: 14px; border-bottom: 1px solid var(--line); }
.profile-top { display: flex; align-items: center; gap: 20px; }
.stats { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); text-align: center; }
.stat { display: flex; flex-direction: column; }
.stat b { font-size: 18px; }
.stat span { font-size: 12px; color: var(--muted); }
.profile-name { font-weight: 700; font-size: 16px; }
.profile-bio { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; padding: 2px 0 16px; }
.tile { position: relative; display: block; aspect-ratio: 1 / 1; background: var(--raised); overflow: hidden; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile-lock {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(14, 15, 18, 0.75); color: var(--text); display: flex; align-items: center; justify-content: center;
}
.pic-wrap .avatar { border: 2px solid var(--line-strong); }

/* Comments: sorting + votes */
.comments-head { display: flex; align-items: center; justify-content: space-between; }
.sort-bar { display: flex; gap: 4px; text-transform: none; letter-spacing: 0; }
.sort-btn { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; }
.sort-btn.on { background: var(--raised); color: var(--text); }
.comment-tags { display: flex; gap: 6px; }
.comment-row { display: flex; gap: 10px; align-items: flex-start; }
.comment-row .comment-body { flex: 1; min-width: 0; }
.votes { display: flex; flex-direction: column; align-items: center; gap: 0; flex-shrink: 0; margin: -4px -4px -4px 0; }
.vote-btn { width: 36px; height: 32px; border: none; background: transparent; color: var(--muted); border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.vote-btn:hover:not(:disabled) { background: var(--raised); color: var(--text); }
.vote-btn:disabled { opacity: 0.35; cursor: default; }
.vote-btn.up.on { color: var(--evo); }
.vote-btn.down.on { color: var(--des); }
.score { font-size: 13px; font-weight: 700; min-width: 2ch; text-align: center; }

/* ---------- Update 3: status, predictions, replies, swipe, notifications ---------- */
.tabs-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.name-row { display: inline-flex; align-items: center; gap: 6px; }

/* Status badges: Good = green, Great = purple, Master = gold */
.lvl { display: inline-flex; align-items: center; font-size: 10px; font-weight: 800; letter-spacing: 0.5px;
  border-radius: 999px; padding: 2px 7px; color: var(--bg); white-space: nowrap; line-height: 1.4; vertical-align: middle; }
.lvl-1 { background: #7ED492; }
.lvl-2 { background: #B794FF; }
.lvl-3 { background: #F5C542; }
.profile-name { display: flex; align-items: center; gap: 8px; }

.ribbon { display: flex; align-items: center; gap: 6px; padding: 8px 14px; font-size: 12px; font-weight: 800; letter-spacing: 0.6px;
  background: #F5C542; color: var(--bg); }
.card:has(.ribbon) { border-color: #F5C542; }

/* Voting with a bonus guess */
.vote-flow { display: flex; flex-direction: column; gap: 10px; }
.picked { display: flex; justify-content: center; }
.guess-q { font-size: 14px; font-weight: 600; text-align: center; }
.guess-btn.e { color: var(--evo); border-color: var(--evo); }
.guess-btn.d { color: var(--des); border-color: var(--des); }
.guess { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.guess.ok { color: #7ED492; }
.guess.miss { color: var(--muted); }

/* Replies */
.thread { display: flex; flex-direction: column; gap: 8px; }
.replies { display: flex; flex-direction: column; gap: 8px; margin-left: 18px; padding-left: 12px; border-left: 2px solid var(--line-strong); }
.reply-btn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 0; }
.reply-bar { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.reply-bar .text-btn { margin-left: auto; }

/* Header bell */
.bell { position: relative; }
.bell .dot { position: absolute; top: 6px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--des); color: var(--bg); font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.top .wrap { gap: 2px; }

/* Level-up celebration */
.celebrate { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--bg); }
.celebrate.lvl-1 { background: #7ED492; } .celebrate.lvl-2 { background: #B794FF; } .celebrate.lvl-3 { background: #F5C542; }

/* Profile status panel */
.status-panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.status-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.status-val { font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.how summary { cursor: pointer; font-size: 13px; color: var(--evo); }
.how p { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.tile-tier { position: absolute; left: 6px; bottom: 6px; font-size: 9px; }

/* Swipe mode */
.swipe-wrap { padding: 12px 16px 24px; }
.swipe-card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; display: flex; flex-direction: column; }
.swipe-photo { position: relative; aspect-ratio: 4 / 5; max-height: 56vh; width: 100%; background: var(--raised);
  touch-action: pan-y; cursor: grab; transition: transform 0.25s ease; user-select: none; -webkit-user-select: none; }
.swipe-photo.dragging { transition: none; cursor: grabbing; }
.swipe-photo img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.swipe-label { position: absolute; top: 18px; padding: 6px 12px; border-radius: 10px; font-weight: 900; font-size: 18px; letter-spacing: 1px;
  opacity: 0; border: 3px solid; background: rgba(14, 15, 18, 0.55); }
.swipe-label.e { left: 16px; color: var(--evo); border-color: var(--evo); transform: rotate(-10deg); }
.swipe-label.d { right: 16px; color: var(--des); border-color: var(--des); transform: rotate(10deg); }
.swipe-info { padding: 12px 14px 0; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.swipe-caption { margin: 0; font-size: 16px; font-weight: 500; white-space: pre-wrap; overflow-wrap: anywhere; }
.swipe-bottom { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }

/* Notifications */
.inbox { display: flex; flex-direction: column; }
.note { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.note:hover { background: var(--card); }
.note.unread { background: rgba(76, 141, 255, 0.08); }
.note-text { flex: 1; min-width: 0; font-size: 14px; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.note-thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.note-icon { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: var(--des); color: var(--bg); }
.who .lvl { color: var(--bg); font-size: 10px; }
.note-icon.lvl-1 { background: #7ED492; } .note-icon.lvl-2 { background: #B794FF; } .note-icon.lvl-3 { background: #F5C542; }
.who .name-row { color: var(--text); font-size: 14px; }

/* Debate page: photo pinned under the header, shrinking as you scroll */
.pinned-photo { position: sticky; z-index: 5; overflow: hidden; background: var(--raised);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45); aspect-ratio: auto; }
.pinned-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Sound button shows a small dot when in voice-only mode */
.sound-btn { position: relative; }

/* ---------- Update 4: custom choices + descriptions ---------- */
.description { margin: 0; padding: 4px 14px 0; color: var(--muted); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.section .description { padding: 0; font-size: 15px; }
.description.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.desc-wrap { display: flex; flex-direction: column; align-items: flex-start; }
.more-btn { padding: 2px 14px; }
.swipe-info .description { padding: 0; }
.swipe-info .more-btn { padding: 2px 0; }
.matchup { display: flex; align-items: center; gap: 8px; padding: 8px 14px 0; font-weight: 800; font-size: 14px; letter-spacing: 0.3px; flex-wrap: wrap; }
.matchup .e { color: var(--evo); } .matchup .d { color: var(--des); }
.matchup .vs { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 4px; }
.choice-grid[hidden] { display: none; }
.e-label { color: var(--evo); } .d-label { color: var(--des); }
.choice-a:focus { outline-color: var(--evo); } .choice-b:focus { outline-color: var(--des); }
.side-pick button { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 8px; }
.vote-row .btn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.form .tabs button { font-size: 13px; padding: 0 6px; }
