* { box-sizing: border-box; }
body {
  padding: 12px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f5f6f7;
  -webkit-text-size-adjust: 100%;
  max-width: 850px;
  margin: auto;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.header-left {
  flex: 1;
  padding-left: 12px;
}

.header-left a {
  font-size: 16px;
  color: #006AFF;
  text-decoration: none;
}

.header-right {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  padding-right: 12px;
}

#settings-content h2 {
  font-size: 1.2em;
}

h1, h2 { 
  margin-top: 0;
  text-align: center;
  font-size: 1.5em;
}

h1 {
  margin: 0;
  flex: 2;
}

#settings {
  margin-bottom: 12px;
}

#remembering-count {
  text-align: center;
}

#settings label {
  display: flex;
  align-items: center;
}

#settings input {
    width: auto;
    margin-right: 8px;
}

#timelineControls {
    margin-bottom: 12px;
}

form {
  background: #fff;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 12px;
  margin-top: 20px;
}

input, button {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  margin: 6px 0;
}

input {
  -webkit-text-size-adjust: 100%;
  autocapitalize: none;
  autocorrect: off;
}

button {
  cursor: pointer;
}

#status {
  margin: 8px 0;
  color: #555;
}

.post {
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  position: relative;
}

.repost {
  padding-bottom: 6px;
  font-size: 0.9em;
}

.reply-indicator {
  color: #666;
  font-size: 0.9em;
  margin-bottom: 4px;
}

.author {
  font-weight: 600;
  display: flex;
  align-items: center;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  margin-right: 8px;
}

.handle {
  color: #666;
  font-size: 0.9em;
  margin-left: 4px;
}

.text {
  margin-top: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

.text a {
  color: #006AFF;
  text-decoration: none;
  overflow-wrap: break-word;
}

.text a:hover {
  text-decoration: underline;
}

.images {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px;
}

.images img {
  width: 100%;
  border-radius: 8px;
  display: block;
}

.video {
  margin-top: 8px;
}

.video video {
  width: 100%;
  border-radius: 8px;
  display: block;
}

.external {
  margin-top: 8px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  text-decoration: none;
}

.external img {
  width: 100%;
  display: block;
  border-radius: 8px;
  margin-top: 8px;
}

.external .info {
  padding: 8px;
  font-size: 0.9em;
  color: #333;
}

.external .info small {
  color: #006AFF;
  text-decoration: none;
  word-break: break-word;
  overflow-wrap: break-word;
}

.external .info small:hover {
  text-decoration: underline;
}

.quoted-post {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px;
  margin-top: 8px;
}

.meta {
  margin-top: 6px;
  font-size: 0.8em;
  color: #777;
}

.meta a {
  text-decoration: none;
  color: inherit;
}

.meta .copyJsonLink {
  position: absolute;
  bottom: 10px;
  right: 10px;
  padding: 4px 8px;
  width: auto;
  font-size: 0.8em;
  color: #DDDDDD;
}

#read-posts-settings {
    margin-top: 12px;
}

#muted-words-settings {
  margin-top: 12px;
}

#muted-words-settings textarea {
  width: 100%;
  height: 20vh;
  resize: vertical;
}

#muted-words-settings small {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8em;
  color: #666;
}

.post-error {
  border: 1px solid red;
  padding: 12px;
  background-color: #fff0f0;
  border-radius: 12px;
  margin-bottom: 12px;
}

.post-error button {
    margin-top: 8px;
}

.divider {
  height: 1px;
  background-color: #ccc;
  margin: 20px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.divider-text {
  background-color: #f5f6f7;
  padding: 0 10px;
  color: #555;
  font-size: 0.9em;
}

#unread-count-overlay {
  position: fixed;
  bottom: -100px; /* Hidden by default */
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.9em;
  z-index: 1000;
  transition: bottom 0.3s ease-in-out;
}

#settings-button {
  background: none;
  border: none;
  width: auto;
  padding: 8px;
  font-size: 20px;
  border-radius: 50%;
  line-height: 1;
}

#settings-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1002;
  display: flex;
  justify-content: center;
  align-items: center;
}

#settings-content {
  background-color: #fff;
  padding: 20px 40px;
  border-radius: 10px;
  position: relative;
  width: 80%;
  max-width: 300px;
}

#resetReadPosts, #logout, #close-settings-button {
  width: auto;
  display: block;
  margin: 6px auto;
}

#refreshButton {
  background: none;
  border: none;
  width: auto;
  display: block;
  margin: 6px auto;
}

#login-button {
  width: 50%;
  display: block;
  margin: 6px auto;
}
