/* ============================================================
   Tokens
   ============================================================ */
:root{
  --paper: #EDEEEA;
  --paper-raised: #F6F6F3;
  --ink: #1C1D1B;
  --ink-soft: #5C5E58;
  --ink-faint: #9A9C93;
  --line: #D8D9D2;
  --accent: #2F6F62;
  --accent-soft: #E3ECE9;
  --warn: #A6472F;
  --warn-soft: #F3E4DF;

  --display: "Fraunces", Georgia, serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 3px;
}

*{ box-sizing: border-box; }
html,body{ margin:0; padding:0; }
body{
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a{ color: inherit; text-decoration: none; }
button{ font-family: inherit; }
img{ max-width:100%; display:block; }

::selection{ background: var(--accent-soft); }

:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ============================================================
   App shell
   ============================================================ */
.app{
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  position: relative;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .wordmark{
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.topbar .readout{
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 8px;
  background: var(--paper-raised);
}

main{
  flex: 1;
  padding-bottom: 84px;
}

/* ============================================================
   Bottom nav
   ============================================================ */
.tabbar{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 520px;
  display: flex;
  border-top: 1px solid var(--line);
  background: var(--paper-raised);
  z-index: 20;
}
.tabbar a{
  flex: 1;
  text-align: center;
  padding: 11px 0 9px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-top: 2px solid transparent;
}
.tabbar a svg{
  display: block;
  width: 19px;
  height: 19px;
  margin: 0 auto 5px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tabbar a.active{
  color: var(--ink);
  border-top-color: var(--accent);
}
.tabbar a.active svg{ stroke: var(--accent); }

/* ============================================================
   Post card
   ============================================================ */
.post{
  border-bottom: 1px solid var(--line);
  padding: 16px 20px;
}
.post-head{
  display:flex;
  align-items:center;
  gap: 10px;
  margin-bottom: 8px;
}
.avatar{
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 12px;
  display:flex; align-items:center; justify-content:center;
  flex-shrink: 0;
}
.post-who{ flex: 1; min-width: 0; }
.post-name{ font-weight: 600; font-size: 14px; }
.post-handle{
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-faint);
}
.post-time{
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  white-space: nowrap;
}
.post-body{
  font-size: 14.5px;
  margin: 4px 0 10px;
  cursor: pointer;
}
.stat-row{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
}
.stat-chip{
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3px 7px;
  background: var(--paper-raised);
}
.stat-chip b{ color: var(--ink); font-weight: 600; }

.like-btn{
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3px 8px;
  background: var(--paper-raised);
  cursor: pointer;
  line-height: 1;
}
.like-btn svg{
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
}
.like-btn .like-count{ color: var(--ink); font-weight: 600; }
.like-btn.liked{
  color: var(--warn);
  border-color: var(--warn-soft);
  background: var(--warn-soft);
}
.like-btn.liked svg{ fill: var(--warn); stroke: var(--warn); }
.like-btn.liked .like-count{ color: var(--warn); }

/* Comments / thread */
.thread{
  border-top: 1px dashed var(--line);
  margin-top: 12px;
  padding-top: 10px;
  display: none;
}
.thread.open{ display: block; }
.comment{
  display:flex;
  gap: 9px;
  padding: 8px 0;
}
.comment .avatar{
  width: 26px; height: 26px;
  font-size: 10px;
}
.comment-body{ font-size: 13.5px; }
.comment-name{ font-weight: 600; font-size: 12.5px; margin-right: 6px; }

/* ============================================================
   Composer
   ============================================================ */
.composer{
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.composer textarea{
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  padding: 10px 12px;
  font-family: var(--body);
  font-size: 14px;
  color: var(--ink);
  resize: none;
  min-height: 54px;
}
.composer-foot{
  display:flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn{
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 9px 16px;
  cursor: pointer;
}
.btn:hover{ opacity: 0.88; }
.btn.ghost{
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

/* ============================================================
   Onboarding
   ============================================================ */
.onboard{
  min-height: 100vh;
  display:flex;
  flex-direction: column;
  justify-content: center;
  max-width: 420px;
  margin: 0 auto;
  padding: 32px 24px;
}
.onboard .eyebrow{
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 14px;
}
.onboard h1{
  font-family: var(--display);
  font-size: 34px;
  font-weight: 600;
  line-height: 1.1;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.onboard p.sub{
  color: var(--ink-soft);
  font-size: 14.5px;
  margin: 0 0 30px;
}
.field{ margin-bottom: 20px; }
.field label{
  display:block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.field input[type=text]{
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 8px 2px;
  font-size: 17px;
  font-family: var(--body);
  color: var(--ink);
}
.field input[type=text]:focus{
  border-bottom-color: var(--ink);
}
.tier-group{
  display:flex;
  flex-direction: column;
  gap: 8px;
}
.tier-option{
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content: space-between;
}
.tier-option .t-name{ font-size: 14.5px; font-weight: 600; }
.tier-option .t-desc{ font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.tier-option .t-mark{
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1px solid var(--ink-faint);
  flex-shrink: 0;
}
.tier-option.selected{
  border-color: var(--accent);
  background: var(--accent-soft);
}
.tier-option.selected .t-mark{
  border-color: var(--accent);
  background: var(--accent);
}
.onboard .btn{ width: 100%; margin-top: 8px; padding: 13px 16px; font-size: 12.5px; }

/* ============================================================
   Explore
   ============================================================ */
.list-row{
  display:flex;
  align-items:center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.list-row .meta{ flex: 1; min-width: 0; }
.list-row .name{ font-weight: 600; font-size: 14px; }
.list-row .sub{ font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); }
.list-row .desc{ font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }

.section-label{
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 16px 20px 8px;
}

/* ============================================================
   DMs
   ============================================================ */
.dm-row{
  display:flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.dm-row .meta{ flex: 1; min-width: 0; }
.dm-row .top-line{ display:flex; justify-content: space-between; gap: 8px; }
.dm-row .name{ font-weight: 600; font-size: 14px; }
.dm-row .time{ font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); }
.dm-row .preview{
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dm-row.unread .preview{ color: var(--ink); font-weight: 500; }
.dm-row .unread-mark{
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  flex-shrink: 0;
}

.thread-view{ display:none; }
.thread-view.open{ display:block; }
.thread-header{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.thread-header .back{
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  cursor: pointer;
  padding-right: 6px;
}
.thread-msgs{ padding: 16px 20px; display:flex; flex-direction: column; gap: 10px; }
.msg{
  max-width: 78%;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 13.5px;
}
.msg.them{
  background: var(--paper-raised);
  border: 1px solid var(--line);
  align-self: flex-start;
}
.msg.me{
  background: var(--ink);
  color: var(--paper);
  align-self: flex-end;
}
.msg-time{
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-faint);
  margin-top: 4px;
}
.reply-bar{
  display:flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
}
.reply-bar input{
  flex:1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
  font-family: var(--body);
  font-size: 13.5px;
  background: var(--paper-raised);
}

/* ============================================================
   Profile
   ============================================================ */
.profile-head{
  padding: 24px 20px 16px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.profile-avatar{
  width: 66px; height: 66px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 20px;
  display:flex; align-items:center; justify-content:center;
  margin: 0 auto 12px;
}
.profile-head .name{
  font-family: var(--display);
  font-size: 21px;
  font-weight: 600;
}
.profile-head .handle{
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 2px;
}
.profile-head .tier-tag{
  display:inline-block;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3px 9px;
  color: var(--ink-soft);
}

.stat-grid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}
.stat-grid .cell{
  padding: 14px 8px;
  text-align: center;
  border-left: 1px solid var(--line);
}
.stat-grid .cell:first-child{ border-left: none; }
.stat-grid .num{
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
}
.stat-grid .label{
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 3px;
}

.progress-block{
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.progress-block .p-label{
  display:flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.progress-track{
  height: 5px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.progress-fill{
  height: 100%;
  background: var(--accent);
}

.empty{
  padding: 40px 24px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 13.5px;
}
