body {
  font-family: sans-serif;
  font-size: 1.2em;
  margin: 0;
  padding: 16px;
}

.wrapper {
  display: block;
  max-width: 600px;
  margin: 0 auto;
  word-wrap: break-word;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0;
}

.tab {
  font-size: 1.2em;
  cursor: pointer;
  padding: 4px 10px;
  border-right: 2px solid black;
  text-decoration: none;
  color: inherit;
}

.tab:first-child {
  padding-left: 0;
}

.tab.active {
  text-decoration: underline;
}

.hr {
  margin: 8px 0 16px 0;
}

/* Platform filters */
.platform-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.platform-filter {
  font-size: 0.85em;
  padding: 4px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  text-decoration: none;
  color: inherit;
}

.platform-filter.active {
  font-weight: bold;
  border-color: black;
}

/* Search */
#search-input {
  font-size: 1.5em;
  width: 100%;
  box-sizing: border-box;
}

.search-form {
  margin-bottom: 16px;
}

.sort-controls {
  margin-top: 8px;
  margin-bottom: 16px;
  line-height: 1.7em;
}

.sort-button {
  font-size: 1em;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  text-decoration: none;
}

.sort-button.active {
  text-decoration: underline;
  font-weight: bold;
}

.result-count {
  color: gray;
  font-size: 0.9em;
}

.no-results {
  font-style: italic;
  color: gray;
}

/* Post card */
.post {
  background-color: #e8e8e8;
  max-width: 600px;
  padding: 16px;
  font-family: sans-serif;
  font-size: 1em;
  border: 2px solid black;
  border-radius: 16px;
  margin-bottom: 16px;
}

.post .post-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.post .display_name {
  margin-bottom: 0;
  margin-top: 0;
  font-weight: bold;
}

.post .user_name {
  margin-top: 4px;
  color: gray;
}

/* Platform badges */
.platform-badge {
  font-size: 0.75em;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: bold;
  white-space: nowrap;
}

.platform-twitter {
  background-color: #1da1f2;
  color: white;
}

.platform-mastodon {
  background-color: #6364ff;
  color: white;
}

.platform-bluesky {
  background-color: #0085ff;
  color: white;
}

/* Reply indicator */
.reply-indicator {
  font-size: 0.85em;
  color: gray;
  margin-top: 0;
  margin-bottom: 0;
}

/* Source link */
.source-link {
  font-size: 0.85em;
}

.post .full_text {
  line-height: 1.5;
}

.post .created_at {
  margin-bottom: 0;
}

.post .created_at a {
  color: inherit;
}

.post .post-meta {
  display: flex;
  gap: 16px;
}

.post .favorite_count,
.post .repost_count {
  display: inline-block;
  margin-bottom: 0;
  font-size: 0.9em;
}

/* Media */
.post img {
  max-height: 100%;
  vertical-align: bottom;
  width: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.post video {
  max-height: 100%;
  vertical-align: bottom;
  width: 100%;
  border-radius: 8px;
}

.post ul {
  display: flex;
  flex-wrap: wrap;
  list-style-type: none;
  gap: 8px;
  padding-left: 0;
  margin-bottom: 0;
}

.post li {
  height: 20vh;
  width: 20vh;
  flex-grow: 1;
}

/* Threads */
.thread {
  margin-top: 16px;
}

.post.parent {
  margin-bottom: 16px;
  margin-right: 64px;
  max-width: calc(600px - 64px);
  background-color: white;
}

.post.child {
  margin-top: 16px;
  margin-left: 64px;
  max-width: calc(600px - 64px);
  background-color: white;
}

/* Search results (live search) */
.search-result {
  /* padding: 12px 0; */
  border-bottom: 1px solid #ddd;
}

.search-result .full_text {
  line-height: 1.5;
}

.search-result .result-date {
  font-size: 0.9em;
  color: gray;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 0;
}

.page-link {
  font-size: 1em;
}

.page-info {
  color: gray;
}

/* Responsive */
@media screen and (max-width: 599px) {
  .post li {
    height: 15vh;
    width: 15vh;
    flex-grow: 1;
  }

  .post.parent,
  .post.child {
    margin-left: 32px;
    margin-right: 32px;
    max-width: calc(100% - 32px);
  }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  body {
    background-color: black;
    color: white;
  }

  a {
    color: #33ff00;
    text-decoration: none;
  }

  a:hover {
    color: #33ff00;
    text-decoration: underline;
  }

  .post {
    background-color: black;
    border: 1px solid gray;
    border-radius: 5px;
  }

  .post.parent,
  .post.child {
    background-color: black;
  }

  .post .favorite_count,
  .post .repost_count,
  .post .created_at {
    color: #33ff00;
  }

  .post .created_at a {
    color: #33ff00;
  }

  .reply-indicator a {
    color: #33ff00;
  }

  .tab {
    border-right-color: gray;
  }

  .sort-button {
    color: #33ff00;
  }

  #search-input {
    background-color: black;
    color: white;
    border: 1px solid gray;
  }

  .search-result {
    border-bottom-color: #333;
  }

  .platform-filter {
    border-color: #555;
    color: #33ff00;
  }

  .platform-filter.active {
    border-color: #33ff00;
  }
}
