* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: ui-monospace, 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
  font-size: 14px;
  line-height: 1.6;
  color: #333;
  background: #faf8f5;
  padding: 10px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #ccc;
}

.logo {
  font-weight: bold;
  color: #333;
  text-decoration: none;
}

nav {
  display: flex;
  gap: 10px;
  align-items: center;
}

nav a, nav button {
  color: #666;
  text-decoration: none;
  font-family: inherit;
  font-size: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

nav a:hover, nav button:hover {
  color: #000;
}

.username-display {
  display: flex;
  gap: 5px;
  align-items: center;
}

.username-display button {
  font-size: 12px;
  color: #999;
}

.username-edit {
  display: flex;
  gap: 5px;
  align-items: center;
}

.username-edit input {
  width: 100px;
  padding: 2px 5px;
  border: 1px solid #ccc;
  font-family: inherit;
  font-size: inherit;
}

.username-edit button {
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  color: #666;
}

.username-edit button::before {
  content: '[ ';
}

.username-edit button::after {
  content: ' ]';
}

.username-edit button:hover {
  color: #000;
}

.logout-form {
  display: inline;
}

main {
  max-width: 800px;
}

h1 {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 10px;
}

.posts {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.post-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid #e8e6e2;
}

.post-card:last-child {
  border-bottom: none;
}

.post-preview {
  color: #555;
  font-size: 13px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.post-card a {
  color: #333;
  text-decoration: none;
}

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

.post-card .meta {
  color: #999;
  font-size: 12px;
}

.post-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.post-card .date {
  color: #999;
  flex-shrink: 0;
  width: 7.5em;
}

.post-card .author {
  color: #666;
  text-decoration: none;
}

.post-card .author:hover {
  text-decoration: underline;
}

.post-meta {
  color: #888;
  font-size: 12px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.delete-form {
  display: inline;
}

.delete-btn {
  background: none;
  border: none;
  color: #c00;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  padding: 0;
}

.delete-btn:hover {
  text-decoration: underline;
}

.post-content h1 {
  margin-bottom: 5px;
}

.post-content .content {
  white-space: pre-wrap;
  margin-top: 20px;
  word-break: break-word;
}

.post-content .content a {
  color: #0066cc;
  text-decoration: none;
}

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

.inline-media {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 12px 0;
  border-radius: 4px;
}

.pagination {
  display: flex;
  gap: 15px;
  margin-top: 20px;
  font-size: 12px;
}

.pagination a {
  color: #333;
  text-decoration: none;
}

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

.pagination span {
  color: #999;
}

.empty-state {
  color: #888;
}

.auth-container {
  max-width: 300px;
  margin-top: 40px;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
}

.form-group input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  font-family: inherit;
  font-size: inherit;
}

.btn {
  padding: 0;
  background: none;
  color: #333;
  border: none;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

.btn::before {
  content: '[ ';
}

.btn::after {
  content: ' ]';
}

.btn:hover {
  color: #000;
}

.error-message {
  color: #c00;
  margin-bottom: 10px;
}

.success-message {
  color: #666;
}

.success-message p {
  margin-bottom: 10px;
}

.error-container {
  margin-top: 40px;
}

.error-container h1 {
  color: #c00;
}

.error-container p {
  color: #666;
  margin-bottom: 15px;
}

.error-container a {
  color: #333;
}

.back-link {
  display: inline-block;
  margin-top: 30px;
  color: #666;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.write-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.write-form textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.6;
  resize: vertical;
}

.write-form .btn {
  align-self: flex-start;
}

footer {
  margin-top: 40px;
  padding-top: 10px;
  border-top: 1px solid #e8e6e2;
  font-size: 12px;
  color: #999;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

footer a {
  color: #999;
  text-decoration: none;
}

footer a:hover {
  color: #333;
}

/* ── Comments / Threaded ──────────────────────────────────────────────────── */

.comments-section {
  margin-top: 30px;
  padding-top: 15px;
  border-top: 1px solid #e8e6e2;
}

.comments-heading {
  font-size: 13px;
  font-weight: normal;
  color: #888;
  margin-bottom: 12px;
}

.comment-form,
.reply-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.comment-form textarea,
.reply-form textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  background: transparent;
  color: inherit;
}

.btn-sm {
  font-size: 12px;
  align-self: flex-start;
}

.login-prompt {
  font-size: 12px;
  color: #888;
  margin-bottom: 12px;
}

.login-prompt a {
  color: #0066cc;
  text-decoration: none;
}

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

.comment {
  margin-bottom: 10px;
}

.comment-header {
  font-size: 12px;
  color: #888;
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.comment-header a {
  color: #555;
  text-decoration: none;
  font-weight: bold;
}

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

.comment-date {
  color: #aaa;
}

.comment-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  margin: 2px 0 4px;
}

.reply-toggle {
  font-size: 12px;
  margin-bottom: 4px;
}

.reply-toggle summary {
  cursor: pointer;
  color: #888;
  list-style: none;
  display: inline;
}

.reply-toggle summary::-webkit-details-marker {
  display: none;
}

.reply-toggle summary:hover {
  color: #555;
}

.reply-toggle[open] .reply-form {
  margin-top: 6px;
}

.comment-children {
  margin-left: 20px;
  padding-left: 12px;
  border-left: 1px solid #ddd;
}

/* ── Explore ──────────────────────────────────────────────────────────────── */

.explore-nav {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.explore-btn {
  color: #333;
  text-decoration: none;
  font-size: 13px;
  padding: 4px 0;
}

.explore-btn:hover {
  text-decoration: underline;
}

.explore-btn-disabled {
  color: #bbb;
  cursor: default;
}

.explore-btn-disabled:hover {
  text-decoration: none;
}

.explore-post .explore-content {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.75;
}

.explore-post .explore-content a {
  color: #0066cc;
  text-decoration: none;
}

.explore-post .explore-content a:hover {
  text-decoration: underline;
}

.explore-meta {
  color: #888;
  font-size: 12px;
  margin-top: 20px;
  padding-top: 10px;
  border-top: 1px solid #e8e6e2;
}

.explore-meta a {
  color: #666;
  text-decoration: none;
}

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

/* ── About ────────────────────────────────────────────────────────────────── */

.about-page {
  max-width: 600px;
}

.about-page p {
  color: #666;
  margin-bottom: 16px;
  line-height: 1.75;
}

.about-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.about-actions a {
  color: #333;
  text-decoration: none;
}

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

/* dark mode toggle button */
.dark-toggle {
  color: #aaa;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  padding: 0;
}

.dark-toggle::after {
  content: 'dark';
}

.dark-toggle:hover {
  color: #333;
}

/* dark mode overrides */
html.dark body {
  background: #111;
  color: #ccc;
}

html.dark header {
  border-bottom-color: #2a2a2a;
}

html.dark .logo {
  color: #ccc;
}

html.dark nav a,
html.dark nav button {
  color: #777;
}

html.dark nav a:hover,
html.dark nav button:hover {
  color: #ccc;
}

html.dark .username-display button {
  color: #555;
}

html.dark .username-edit input {
  border-color: #333;
  background: #1a1a1a;
  color: #ccc;
}

html.dark .username-edit button {
  color: #777;
}

html.dark .username-edit button:hover {
  color: #ccc;
}

html.dark .post-card {
  border-bottom-color: #222;
}

html.dark .post-card a {
  color: #ccc;
}

html.dark .post-card .date,
html.dark .post-preview {
  color: #666;
}

html.dark .post-card .author {
  color: #888;
}

html.dark .post-meta {
  color: #666;
}

html.dark .post-content .content a {
  color: #5599dd;
}

html.dark .pagination a {
  color: #ccc;
}

html.dark .pagination span {
  color: #666;
}

html.dark .empty-state {
  color: #666;
}

html.dark .form-group input {
  border-color: #333;
  background: #1a1a1a;
  color: #ccc;
}

html.dark .btn {
  color: #ccc;
}

html.dark .btn:hover {
  color: #fff;
}

html.dark .write-form textarea {
  border-color: #333;
  background: #1a1a1a;
  color: #ccc;
}

html.dark .back-link {
  color: #777;
}

html.dark .success-message {
  color: #777;
}

html.dark .error-container p {
  color: #888;
}

html.dark .error-container a {
  color: #ccc;
}

html.dark .comments-section {
  border-top-color: #2a2a2a;
}

html.dark .comment-form textarea,
html.dark .reply-form textarea {
  border-color: #333;
  background: #1a1a1a;
  color: #ccc;
}

html.dark .comment-header a {
  color: #aaa;
}

html.dark .comment-date {
  color: #555;
}

html.dark .comment-body {
  color: #bbb;
}

html.dark .reply-toggle summary {
  color: #555;
}

html.dark .reply-toggle summary:hover {
  color: #aaa;
}

html.dark .comment-children {
  border-left-color: #333;
}

html.dark .login-prompt a {
  color: #5599dd;
}

html.dark footer {
  border-top-color: #2a2a2a;
}

html.dark footer a {
  color: #555;
}

html.dark footer a:hover {
  color: #ccc;
}

html.dark .explore-btn {
  color: #ccc;
}

html.dark .explore-btn-disabled {
  color: #444;
}

html.dark .explore-post .explore-content a {
  color: #5599dd;
}

html.dark .explore-meta {
  color: #666;
  border-top-color: #2a2a2a;
}

html.dark .explore-meta a {
  color: #888;
}

html.dark .dark-toggle {
  color: #555;
}

html.dark .dark-toggle::after {
  content: 'light';
}

html.dark .dark-toggle:hover {
  color: #ccc;
}

html.dark .about-page p {
  color: #999;
}

html.dark .about-actions a {
  color: #ccc;
}
