:root {
  --btn-color: #0066cc;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: #1a1a1a;
  background: #fff;
}

#app {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
}

/* Loading */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f0f0f0;
  border-top-color: var(--btn-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-small {
  padding: 12px;
  text-align: center;
  color: #666;
  font-size: 14px;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  body {
    background: #0a0a0a;
    color: #e0e0e0;
  }
  .tab {
    color: #888;
  }
  .tab:hover {
    background: #2a2a2a;
  }
  .tab.active {
    background: var(--btn-color);
    color: #fff;
  }
  .pds-dropdown {
    background: #1a1a1a;
    border-color: #333;
  }
  .pds-option {
    color: #e0e0e0;
  }
  .pds-option:hover {
    background: #2a2a2a;
  }
  .pds-option.selected {
    background: linear-gradient(135deg, #1a2a3a 0%, #152535 100%);
  }
  .pds-name {
    color: #e0e0e0;
  }
  .pds-check {
    border-color: #555;
  }
  .profile {
    background: #16181c;
    border-color: #2f3336;
  }
  .profile-name {
    color: #e7e9ea;
  }
  .profile-handle,
  .profile-handle-link {
    color: #71767b;
  }
  .profile-description {
    color: #e7e9ea;
  }
  .profile-avatar-placeholder {
    background: #2f3336;
  }
  .service-item {
    background: #2a2a2a;
    color: #e0e0e0;
  }
  .service-item:hover {
    background: #333;
  }
  .post-item {
    border-color: #333;
  }
  .post-link:hover {
    background: #1a1a1a;
  }
  .browser-input {
    background: #1a1a1a;
    border-color: #333;
    color: #e0e0e0;
  }
}

/* Header */
#header {
  margin-bottom: 24px;
}

.header-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.header-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}

.header-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
}

.header-btn:hover {
  background: #e0e0e0;
}

.header-btn.at-btn {
  background: var(--btn-color);
  color: #fff;
  border-color: var(--btn-color);
}

.header-btn.at-btn:hover {
  background: var(--btn-color);
  filter: brightness(0.85);
}

.header-btn.login-btn {
  color: #666;
}

.login-icon {
  width: 18px;
  height: 18px;
  opacity: 0.6;
}

.header-btn.login-btn:hover .login-icon {
  opacity: 0.9;
}

.header-btn.user-btn {
  width: auto;
  padding: 8px 12px;
  background: var(--btn-color);
  color: #fff;
  border-color: var(--btn-color);
  font-size: 13px;
  font-weight: 500;
}

/* Post Form */
.post-form-container {
  padding: 20px 0;
}

.post-form-container h3 {
  font-size: 18px;
  margin-bottom: 16px;
}

.post-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.post-form-title {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
}

.post-form-body {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
}

.post-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.post-form-collection {
  font-size: 12px;
  color: #888;
  font-family: monospace;
}

.post-form-btn {
  padding: 10px 24px;
  background: var(--btn-color);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

.post-form-btn:hover {
  background: #0052a3;
}

.post-form-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.post-status {
  margin-top: 12px;
}

.post-success {
  color: #155724;
}

.post-error {
  color: #dc3545;
}

/* Mode Tabs */
.mode-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  align-items: center;
}

.tabs-scroll {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 1;
  min-width: 0;
}

.tabs-scroll::-webkit-scrollbar {
  display: none;
}

.tab {
  padding: 8px 16px;
  text-decoration: none;
  color: #666;
  border: none;
  background: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.tab:hover {
  background: #f0f0f0;
}

.tab.active {
  background: var(--btn-color);
  color: #fff;
}

/* PDS Selector */
.pds-selector {
  position: relative;
  margin-left: auto;
}

.pds-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 180px;
  z-index: 1000;
  overflow: hidden;
}

.pds-dropdown.show {
  display: block;
}

.pds-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
}

.pds-option:hover {
  background: #f5f5f5;
}

.pds-option.selected {
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4ff 100%);
}

.pds-name {
  color: #333;
  font-weight: 500;
}

.pds-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: all 0.2s;
  color: transparent;
}

.pds-option.selected .pds-check {
  background: var(--btn-color);
  border-color: var(--btn-color);
  color: #fff;
}

/* Profile */
.profile {
  display: flex;
  gap: 16px;
  padding: 20px;
  background: #f5f5f5;
  border-radius: 12px;
  margin-bottom: 24px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

.profile-avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #e0e0e0;
}

.profile-info {
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.profile-name {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}

.profile-handle {
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
}

.profile-handle-link {
  color: #666;
  text-decoration: none;
}

.profile-handle-link:hover {
  color: var(--btn-color);
  text-decoration: underline;
}

.profile-desc {
  font-size: 14px;
  color: #444;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Services */
.services {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.service-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f5f5f5;
  border-radius: 20px;
  text-decoration: none;
  color: #333;
  font-size: 13px;
  transition: background 0.2s;
}

.service-item:hover {
  background: #e8e8e8;
}

.service-favicon {
  width: 16px;
  height: 16px;
}

.service-name {
  font-weight: 500;
}

/* Post List */
.post-list {
  list-style: none;
  margin-top: 24px;
  margin-bottom: 24px;
}

.post-item {
  border-bottom: 1px solid #eee;
}

.post-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 8px;
  text-decoration: none;
  color: inherit;
}

.post-link:hover {
  background: #f9f9f9;
}

.post-title {
  font-weight: 500;
}

.post-date {
  font-size: 13px;
  color: #888;
}

/* New post from API (not in static) */
.post-item-new {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Post Form */
.post-form-container {
  padding: 20px 0;
  margin-bottom: 32px;
}

.post-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.post-form-title {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
}

.post-form-body {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
}

.post-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.post-form-collection {
  font-size: 12px;
  color: #888;
  font-family: monospace;
}

.post-form-btn {
  padding: 10px 24px;
  background: var(--btn-color);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

.post-form-btn:hover {
  opacity: 0.9;
}

.post-form-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.post-status {
  margin-top: 12px;
}

.post-success {
  color: #155724;
}

.post-error {
  color: #dc3545;
}

/* Post Detail */
.post-detail {
  padding: 20px 0;
}

.post-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #eee;
}

.post-header .post-title {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.post-header .post-date {
  font-size: 14px;
  color: #888;
}

.json-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  background: #f0f0f0;
  color: #666;
  border-radius: 4px;
  text-decoration: none;
  font-family: monospace;
  font-size: 12px;
}

.json-btn:hover {
  background: #e0e0e0;
  color: #333;
}

/* Record Delete Button */
.record-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  margin-top: 12px;
  background: #dc3545;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.record-delete-btn:hover {
  background: #c82333;
}

.record-delete-btn:disabled {
  background: #6c757d;
  cursor: not-allowed;
}

/* Post Edit Button */
.post-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  margin-left: 8px;
  background: var(--btn-color);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.post-edit-btn:hover {
  opacity: 0.85;
}

.record-merge-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  margin-left: 8px;
  background: var(--btn-color);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.record-merge-btn:hover {
  opacity: 0.85;
}

.record-merge-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Post Edit Form */
.post-edit-form {
  margin-top: 16px;
  padding: 16px;
  background: #f9f9f9;
  border-radius: 8px;
}

.post-edit-title {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
}

.post-edit-content {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 200px;
}

.post-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}

.post-edit-cancel {
  padding: 8px 16px;
  background: #6c757d;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

.post-edit-cancel:hover {
  background: #5a6268;
}

.post-edit-save {
  padding: 8px 16px;
  background: var(--btn-color);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

.post-edit-save:hover {
  opacity: 0.9;
}

.post-edit-save:disabled {
  background: #6c757d;
  cursor: not-allowed;
}

.edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  background: #28a745;
  color: #fff;
  border: none;
  border-radius: 4px;
  text-decoration: none;
  font-family: monospace;
  font-size: 12px;
  cursor: pointer;
}

.edit-btn:hover {
  background: #218838;
}

/* Discussion */
.discussion-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #e0e0e0;
}

.discussion-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #f5f5f5;
  color: #333;
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
}

.discussion-link:hover {
  background: #e8e8e8;
}

.discussion-link svg {
  color: var(--btn-color);
}

.discussion-posts {
  margin-top: 16px;
}

.discussion-post {
  display: block;
  padding: 12px;
  margin-bottom: 8px;
  background: #fafafa;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s;
}

.discussion-post:hover {
  background: #f0f0f0;
}

.discussion-author {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.discussion-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.discussion-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ddd;
}

.discussion-author-info {
  flex: 1;
  min-width: 0;
}

.discussion-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discussion-handle {
  display: block;
  font-size: 12px;
  color: #666;
}

.discussion-date {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
}

.discussion-text {
  font-size: 14px;
  color: #444;
  line-height: 1.5;
  word-break: break-word;
}


/* Edit Form */
.edit-form-container {
  padding: 20px 0;
}

.edit-form-container h3 {
  font-size: 18px;
  margin-bottom: 16px;
}

.edit-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.edit-form-title {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
}

.edit-form-body {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  resize: vertical;
  min-height: 200px;
  font-family: inherit;
}

.edit-form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.edit-cancel-btn {
  padding: 10px 24px;
  background: #6c757d;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

.edit-cancel-btn:hover {
  background: #5a6268;
}

.edit-submit-btn {
  padding: 10px 24px;
  background: #28a745;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

.edit-submit-btn:hover {
  background: #218838;
}

.edit-submit-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Discussion Section */
.discussion-section {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid #eee;
}

.discussion-section h3 {
  font-size: 18px;
  margin-bottom: 16px;
}

.discuss-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--btn-color);
  color: #fff;
  border-radius: 20px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.discuss-link:hover {
  background: var(--btn-color);
  filter: brightness(0.85);
}

.discuss-link svg {
  width: 18px;
  height: 18px;
}

.discussion-posts {
  margin-top: 20px;
}

.loading-small {
  color: #888;
  font-size: 14px;
}

.no-discussion {
  color: #888;
  font-size: 14px;
}

.discussion-post {
  display: block;
  padding: 16px;
  margin-bottom: 12px;
  background: #f9f9f9;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
}

.discussion-post:hover {
  background: #f0f0f0;
}

.discussion-author {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.discussion-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.discussion-author-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.discussion-name {
  font-weight: 600;
  font-size: 14px;
}

.discussion-handle {
  font-size: 12px;
  color: #888;
}

.discussion-date {
  font-size: 12px;
  color: #888;
}

.discussion-text {
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.post-content {
  font-size: 16px;
  line-height: 1.8;
}

/* Markdown Styles */
.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: 600;
  line-height: 1.3;
}

.post-content h1 { font-size: 1.75em; }
.post-content h2 { font-size: 1.5em; }
.post-content h3 { font-size: 1.25em; }
.post-content h4 { font-size: 1.1em; }

.post-content p {
  margin-bottom: 1em;
}

.post-content ul,
.post-content ol {
  margin-bottom: 1em;
  padding-left: 1.5em;
}

.post-content li {
  margin-bottom: 0.25em;
}

.post-content a {
  color: var(--btn-color);
  text-decoration: none;
}

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

.post-content blockquote {
  margin: 1em 0;
  padding: 0.5em 1em;
  border-left: 4px solid #ddd;
  background: #f9f9f9;
  color: #666;
}

.post-content code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 0.9em;
  padding: 0.15em 0.4em;
  background: #f0f0f0;
  border-radius: 4px;
}

.post-content pre {
  margin: 1em 0;
  padding: 1em;
  background: #1e1e1e;
  border-radius: 8px;
  overflow-x: auto;
}

.post-content pre code {
  display: block;
  padding: 0;
  background: transparent;
  color: #d4d4d4;
  font-size: 14px;
  line-height: 1.5;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.post-content hr {
  margin: 2em 0;
  border: none;
  border-top: 1px solid #eee;
}

.post-content table {
  width: 100%;
  margin: 1em 0;
  border-collapse: collapse;
}

.post-content th,
.post-content td {
  padding: 0.5em;
  border: 1px solid #ddd;
  text-align: left;
}

.post-content th {
  background: #f5f5f5;
  font-weight: 600;
}

/* Highlight.js Theme Overrides */
.hljs-keyword,
.hljs-selector-tag,
.hljs-built_in,
.hljs-name,
.hljs-tag { color: #569cd6; }
.hljs-string,
.hljs-title,
.hljs-section,
.hljs-attribute,
.hljs-literal,
.hljs-template-tag,
.hljs-template-variable,
.hljs-type,
.hljs-addition { color: #ce9178; }
.hljs-comment,
.hljs-quote,
.hljs-deletion,
.hljs-meta { color: #6a9955; }
.hljs-number,
.hljs-regexp,
.hljs-symbol,
.hljs-variable,
.hljs-link { color: #b5cea8; }
.hljs-function { color: #dcdcaa; }
.hljs-attr { color: #9cdcfe; }

.post-footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}

.back-link {
  color: var(--btn-color);
  text-decoration: none;
}

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

/* Utility */
.no-posts,
.no-data,
.error {
  padding: 40px;
  text-align: center;
  color: #888;
}

.loading {
  padding: 40px;
  text-align: center;
  color: #666;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e0e0e0;
  border-top-color: var(--btn-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Skeleton UI */
.browser-skeleton {
  padding: 16px 0;
}

.skeleton-header {
  margin-bottom: 16px;
}

.skeleton-title {
  width: 120px;
  height: 20px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

.skeleton-list {
  list-style: none;
}

.skeleton-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid #eee;
}

.skeleton-icon {
  width: 24px;
  height: 24px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

.skeleton-text {
  flex: 1;
  height: 16px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  max-width: 200px;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@media (prefers-color-scheme: dark) {
  .skeleton-title,
  .skeleton-icon,
  .skeleton-text {
    background: linear-gradient(90deg, #2a2a2a 25%, #333 50%, #2a2a2a 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
  }
  .skeleton-item {
    border-color: #333;
  }
}

/* Footer Links */
.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 40px;
  padding: 20px 0;
}

.footer-link-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: #666;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-link-item:hover {
  color: var(--btn-color);
}

.footer-link-item svg {
  width: 24px;
  height: 24px;
}

.footer-link-item [class^="icon-"] {
  font-size: 24px;
}

.footer-link-favicon {
  width: 24px;
  height: 24px;
}

@media (prefers-color-scheme: dark) {
  .footer-link-item {
    color: #888;
  }
  .footer-link-item:hover {
    color: var(--btn-color);
  }
}

/* Footer */
.site-footer {
  margin-top: 20px;
  padding: 20px 0;
  text-align: center;
  font-size: 13px;
  color: #888;
}

.site-footer p {
  margin: 4px 0;
}

/* Language Selector (above content) */
.lang-selector {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
  position: relative;
}

.lang-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #666;
  padding: 8px 16px;
}

.lang-btn:hover {
  background: #f0f0f0;
}

.lang-icon {
  width: 20px;
  height: 20px;
  opacity: 0.6;
}

.lang-btn:hover .lang-icon {
  opacity: 0.9;
}

.lang-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 100px;
  z-index: 100;
  overflow: hidden;
}

.lang-dropdown.show {
  display: block;
}

.lang-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
}

.lang-option:hover {
  background: #f5f5f5;
}

.lang-option.selected {
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4ff 100%);
}

.lang-name {
  color: #333;
  font-weight: 500;
}

.lang-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: all 0.2s;
}

.lang-option.selected .lang-check {
  background: var(--btn-color);
  border-color: var(--btn-color);
  color: #fff;
}

.lang-option:not(.selected) .lang-check {
  color: transparent;
}

/* Content Header (above post list) */
.content-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 8px;
}

@media (prefers-color-scheme: dark) {
  .lang-btn {
    background: transparent;
    color: #888;
  }
  .lang-btn:hover {
    background: #2a2a2a;
  }
  .lang-icon {
    filter: invert(0.7);
  }
  .lang-dropdown {
    background: #1a1a1a;
    border-color: #333;
  }
  .lang-option:hover {
    background: #2a2a2a;
  }
  .lang-option.selected {
    background: linear-gradient(135deg, #1a2a3a 0%, #1a3040 100%);
  }
  .lang-name {
    color: #e0e0e0;
  }
}

/* AT Browser */
.server-info {
  padding: 16px 0;
  border-bottom: 1px solid #eee;
  margin-bottom: 8px;
}

.server-info h3 {
  font-size: 18px;
  margin-bottom: 12px;
}

.server-details {
  font-size: 13px;
}

.server-row {
  display: flex;
  gap: 12px;
  padding: 6px 0;
}

.server-row dt {
  font-weight: 600;
  min-width: 40px;
  color: #666;
}

.server-row dd {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 12px;
  word-break: break-all;
  color: #333;
}

.services-list,
.collections,
.records,
.record-detail {
  padding: 16px 0;
}

.services-list h3,
.collections h3,
.records h3,
.record-detail h3 {
  font-size: 18px;
  margin-bottom: 12px;
}

.service-list {
  list-style: none;
}

.service-list-item {
  border-bottom: 1px solid #eee;
}

.service-list-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  text-decoration: none;
  color: inherit;
}

.service-list-link:hover {
  background: #f9f9f9;
}

.service-list-favicon {
  width: 24px;
  height: 24px;
}

.service-list-name {
  flex: 1;
  font-weight: 500;
}

.service-list-count {
  font-size: 13px;
  color: #888;
}

.collection-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.collection-header-favicon {
  width: 24px;
  height: 24px;
}

.collection-list,
.record-list {
  list-style: none;
}

.collection-item,
.record-item {
  border-bottom: 1px solid #eee;
}

.collection-link,
.record-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  text-decoration: none;
  color: inherit;
  font-family: monospace;
  font-size: 14px;
}

.collection-link:hover,
.record-link:hover {
  background: #f9f9f9;
}

.collection-nsid {
  flex: 1;
}

.record-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.record-item .record-link {
  flex: 1;
}

.delete-btn-small {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid #ddd;
  border-radius: 4px;
  color: #999;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  margin-right: 8px;
}

.delete-btn-small:hover {
  background: #fee;
  border-color: #f88;
  color: #c00;
}

.collection-link,
.record-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  text-decoration: none;
  color: inherit;
  font-family: monospace;
  font-size: 14px;
}

.collection-link:hover,
.record-link:hover {
  background: #f9f9f9;
}

.collection-favicon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.collection-nsid {
  flex: 1;
}

.collection-service {
  font-size: 12px;
  color: #888;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.record-link {
  display: flex;
  gap: 16px;
  overflow: hidden;
  min-width: 0;
}

.record-rkey {
  color: var(--btn-color);
  min-width: 120px;
  flex-shrink: 0;
}

.record-preview {
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.record-count {
  font-size: 13px;
  color: #888;
  margin-bottom: 12px;
}

/* Record Detail */
.record-header {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #eee;
}

.record-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.record-header-top h3 {
  margin: 0;
}

/* Validate Button */
.validate-btn {
  padding: 6px 12px;
  background: #f0f0f0;
  color: #666;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.validate-btn:hover {
  background: #e8e8e8;
  color: #333;
}

.validate-btn:disabled {
  background: #f5f5f5;
  color: #999;
  cursor: not-allowed;
}

/* Validate Result */
.validate-result {
  margin-top: 8px;
  font-size: 13px;
}

.validate-valid {
  color: #155724;
  background: #d4edda;
  padding: 4px 8px;
  border-radius: 4px;
}

.validate-invalid {
  color: #721c24;
  background: #f8d7da;
  padding: 4px 8px;
  border-radius: 4px;
}

.validate-error {
  display: block;
  margin-top: 4px;
  color: #721c24;
  font-family: monospace;
  font-size: 12px;
  word-break: break-all;
}

.record-uri,
.record-cid {
  font-family: monospace;
  font-size: 12px;
  color: #666;
  margin: 4px 0;
  word-break: break-all;
}

.schema-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  margin-top: 8px;
}

.schema-verified {
  background: #d4edda;
  color: #155724;
}

.schema-none {
  background: #f0f0f0;
  color: #666;
}

.delete-btn {
  display: inline-block;
  padding: 6px 12px;
  background: #dc3545;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  margin-left: 8px;
}

.delete-btn:hover {
  background: #c82333;
}

.delete-btn:disabled {
  background: #999;
  cursor: not-allowed;
}

/* JSON View */
.json-view {
  background: #f5f5f5;
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
}

.json-view pre {
  margin: 0;
}

.json-view code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 13px;
  line-height: 1.5;
}

/* Dark mode additions */
@media (prefers-color-scheme: dark) {
  .header-input {
    background: #1a1a1a;
    border-color: #333;
    color: #e0e0e0;
  }
  .header-btn {
    background: #2a2a2a;
    border-color: #333;
    color: #e0e0e0;
  }
  .header-btn:hover {
    background: #333;
  }
  .header-btn.at-btn,
  .header-btn.user-btn {
    background: var(--btn-color);
    border-color: var(--btn-color);
    color: #fff;
  }
  .post-form-title,
  .post-form-body {
    background: #1a1a1a;
    border-color: #333;
    color: #e0e0e0;
  }
  .json-btn {
    background: #2a2a2a;
    color: #888;
  }
  .json-btn:hover {
    background: #333;
    color: #e0e0e0;
  }
  .edit-form-title,
  .edit-form-body {
    background: #1a1a1a;
    border-color: #333;
    color: #e0e0e0;
  }
  .tab:hover {
    background: #333;
  }
  .tab.active {
    background: var(--btn-color);
  }
  .service-list-link:hover,
  .collection-link:hover,
  .record-link:hover {
    background: #1a1a1a;
  }
  .service-list-item,
  .collection-item,
  .record-item,
  .record-header {
    border-color: #333;
  }
  .json-view {
    background: #1a1a1a;
  }
  .schema-verified {
    background: #1e3a29;
    color: #75b798;
  }
  .schema-none {
    background: #2a2a2a;
    color: #888;
  }
  .validate-btn {
    background: #2a2a2a;
    border-color: #444;
    color: #888;
  }
  .validate-btn:hover {
    background: #333;
    color: #e0e0e0;
  }
  .validate-valid {
    background: #1e3a29;
    color: #75b798;
  }
  .validate-invalid {
    background: #3a1e1e;
    color: #f5a5a5;
  }
  .validate-error {
    color: #f5a5a5;
  }
  .delete-btn {
    background: #dc3545;
  }
  .delete-btn:hover {
    background: #c82333;
  }
  /* Dark mode markdown */
  .post-content blockquote {
    border-color: #444;
    background: #1a1a1a;
    color: #aaa;
  }
  .post-content code {
    background: #2a2a2a;
  }
  .post-content th {
    background: #2a2a2a;
  }
  .post-content th,
  .post-content td {
    border-color: #444;
  }
  .post-content hr {
    border-color: #333;
  }
}

/* Browser Section */
#browser {
  margin: 32px 0;
}

#content {
  margin: 48px 0;
}

.browser-section {
  margin-bottom: 20px;
}

.browser-title {
  font-size: 14px;
  font-weight: 600;
  color: #666;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Collection buttons (horizontal) */
.collection-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.collection-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f5f5f5;
  border-radius: 20px;
  text-decoration: none;
  color: #333;
  font-size: 13px;
  transition: background 0.2s;
}

.collection-btn:hover {
  background: #e8e8e8;
}

.collection-btn-icon {
  width: 16px;
  height: 16px;
}

/* Browser row layout */
.browser-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.browser-row .collection-buttons {
  margin-bottom: 0;
}

/* Link buttons (same style as collection buttons) */
.link-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f5f5f5;
  border-radius: 20px;
  text-decoration: none;
  color: #333;
  font-size: 13px;
  transition: background 0.2s;
}

.link-btn:hover {
  background: #e8e8e8;
}

.link-btn-icon {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
}

.link-btn-icon svg {
  width: 100%;
  height: 100%;
}

.no-collections,
.no-records {
  padding: 20px;
  text-align: center;
  color: #888;
  font-size: 14px;
}

/* Record list in browser */
.record-list {
  list-style: none;
}

.record-item {
  border-bottom: 1px solid #eee;
}

.record-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 8px;
  text-decoration: none;
  color: inherit;
}

.record-link:hover {
  background: #f9f9f9;
}

.record-title {
  font-weight: 500;
  flex: 1;
}

.record-date {
  font-size: 13px;
  color: #888;
  margin-left: 12px;
}

/* Record detail view */
.record-detail {
  padding: 20px 0;
}

.record-header {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #eee;
}

.record-header .record-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.record-meta {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: #666;
}

.record-collection {
  font-family: monospace;
}

.record-rkey {
  font-family: monospace;
  color: var(--btn-color);
}

.record-content {
  margin-top: 16px;
}

.record-json {
  background: #f5f5f5;
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 13px;
  line-height: 1.5;
}

/* Back navigation */
.back-nav {
  margin-top: 24px;
}

.back-nav a {
  color: var(--btn-color);
  text-decoration: none;
}

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

/* Footer */
.footer {
  margin-top: 40px;
  padding: 20px 0;
  text-align: center;
}

.license {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.license-icon {
  width: 24px;
  height: 24px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.license-icon:hover {
  opacity: 1;
}

.footer-content {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #888;
}

.footer-title {
  font-weight: 500;
}

@media (prefers-color-scheme: dark) {
  .browser-title {
    color: #888;
  }
  .collection-btn {
    background: #2a2a2a;
    color: #e0e0e0;
  }
  .collection-btn:hover {
    background: #3a3a3a;
  }
  .link-btn {
    background: #2a2a2a;
    color: #e0e0e0;
  }
  .link-btn:hover {
    background: #3a3a3a;
  }
  .collection-item .collection-link {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
  }
  .collection-item .collection-link:hover {
    background: var(--btn-color);
    border-color: var(--btn-color);
    color: #fff;
  }
  .record-json {
    background: #1a1a1a;
    color: #d4d4d4;
  }
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-container {
  position: relative;
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  background: #fff;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  font-size: 24px;
  color: #666;
  cursor: pointer;
  border-radius: 6px;
}

.modal-close:hover {
  background: #f0f0f0;
  color: #333;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* Browser tab button styling */
button.tab {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

/* Dark mode modal */
@media (prefers-color-scheme: dark) {
  .modal-container {
    background: #1a1a1a;
  }
  .modal-header {
    border-color: #333;
  }
  .modal-header h2 {
    color: #e0e0e0;
  }
  .modal-close {
    color: #888;
  }
  .modal-close:hover {
    background: #333;
    color: #e0e0e0;
  }
}

/* Chat Styles - Bluesky social-app style */
.chat-container {
  margin: 10px 0;
}

.chat-list {
  display: flex;
  flex-direction: column;
}

.chat-message {
  display: flex;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid #e0e0e0;
  max-width: 100%;
  overflow: hidden;
}

.chat-message:last-child {
  border-bottom: none;
}

.chat-avatar-col {
  flex-shrink: 0;
}

.chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-avatar-placeholder {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.chat-content-col {
  flex: 1;
  min-width: 0;
}

.chat-message-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.chat-author {
  font-weight: 600;
  color: #1a1a1a;
  text-decoration: none;
  font-size: 0.95rem;
}

.chat-author:hover {
  text-decoration: underline;
}

.chat-time {
  color: #888;
  font-size: 0.85rem;
  text-decoration: none;
}

.chat-time:hover {
  text-decoration: underline;
  color: #666;
}

.chat-content {
  line-height: 1.5;
  color: #1a1a1a;
  overflow-wrap: break-word;
  word-break: break-word;
  min-width: 0;
  overflow: hidden;
}

.chat-content p {
  margin: 0 0 8px 0;
}

.chat-content p:last-child {
  margin-bottom: 0;
}

.chat-content pre {
  background: #f5f5f5;
  padding: 10px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.9rem;
  margin: 8px 0;
  max-width: 100%;
}

.chat-content code {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.chat-content pre code {
  background: none;
  padding: 0;
}

.chat-content a {
  color: var(--btn-color);
}

.chat-content table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 0.9rem;
  max-width: 100%;
}

.chat-content th,
.chat-content td {
  border: 1px solid #ddd;
  padding: 6px 10px;
}

.chat-content th {
  background: #f5f5f5;
}

.chat-content ul,
.chat-content ol {
  margin: 8px 0;
  padding-left: 1.5em;
}

.chat-content li {
  margin: 4px 0;
}

/* Dark mode chat */
@media (prefers-color-scheme: dark) {
  .chat-message {
    border-color: #333;
  }

  .chat-author {
    color: #e0e0e0;
  }

  .chat-time {
    color: #888;
  }

  .chat-time:hover {
    color: #aaa;
  }

  .chat-content {
    color: #e0e0e0;
  }

  .chat-content pre {
    background: #2a2a2a;
  }

  .chat-content code {
    background: #333;
  }

  .chat-content th,
  .chat-content td {
    border-color: #444;
  }

  .chat-content th {
    background: #2a2a2a;
  }

  .chat-avatar-placeholder {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  }

  .chat-thread-item {
    border-color: #333;
  }

  .chat-thread-item:hover {
    background: #2a2a2a;
  }

  .chat-thread-preview {
    color: #999;
  }
}

/* Chat Type Badge */
.chat-type-badge {
  font-size: 0.7em;
  padding: 1px 6px;
  border-radius: 3px;
}

.chat-type-badge[data-type="log"] {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.chat-type-badge[data-type="ue"] {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

@media (prefers-color-scheme: dark) {
  .chat-type-badge[data-type="log"] {
    background: rgba(59, 130, 246, 0.25);
    color: #60a5fa;
  }

  .chat-type-badge[data-type="ue"] {
    background: rgba(168, 85, 247, 0.25);
    color: #c084fc;
  }
}

/* Chat Thread List */
.chat-thread-list {
  display: flex;
  flex-direction: column;
}

.chat-thread-item {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid #e0e0e0;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.15s;
}

.chat-thread-item:hover {
  background: #f5f5f5;
}

.chat-thread-item:last-child {
  border-bottom: none;
}

.chat-thread-content {
  flex: 1;
  min-width: 0;
}

.chat-thread-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.chat-thread-header .chat-type-badge {
  order: 1;
  margin-left: auto;
}

.chat-thread-header .chat-author {
  font-weight: 600;
  color: #1a1a1a;
}

.chat-thread-header .chat-time {
  color: #888;
  font-size: 0.85rem;
}

.chat-thread-preview {
  color: #666;
  font-size: 0.95rem;
  line-height: 1.4;
  white-space: pre-line;
}

/* Chat Edit Button */
.chat-edit-btn {
  color: #888;
  font-size: 0.8rem;
  text-decoration: none;
  margin-left: 8px;
}

.chat-edit-btn:hover {
  color: var(--btn-color);
  text-decoration: underline;
}

/* Chat Edit Form */
.chat-edit-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.chat-edit-container h2 {
  margin-bottom: 20px;
  font-size: 1.2rem;
}

.chat-edit-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.chat-edit-content {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  min-height: 200px;
}

.chat-edit-content:focus {
  outline: none;
  border-color: var(--btn-color);
}

.chat-edit-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-edit-collection {
  color: #888;
  font-size: 0.85rem;
}

.chat-edit-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
}

.chat-edit-cancel {
  color: #666;
  text-decoration: none;
  padding: 8px 16px;
}

.chat-edit-cancel:hover {
  text-decoration: underline;
}

.chat-edit-save {
  background: var(--btn-color);
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}

.chat-edit-save:hover {
  opacity: 0.9;
}

.chat-edit-save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chat-edit-status {
  margin-top: 10px;
}

.chat-edit-success {
  color: #22c55e;
}

.chat-edit-error {
  color: #ef4444;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .chat-edit-btn {
    color: #888;
  }

  .chat-edit-btn:hover {
    color: var(--btn-color);
  }

  .chat-edit-content {
    background: #1a1a1a;
    border-color: #333;
    color: #e0e0e0;
  }

  .chat-edit-content:focus {
    border-color: var(--btn-color);
  }

  .chat-edit-cancel {
    color: #999;
  }
}

/* ==================== Link Page ==================== */
.link-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

.link-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.link-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.link-empty {
  text-align: center;
  color: #888;
  padding: 40px 20px;
}

.link-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.link-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-radius: 12px;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}

.link-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.link-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.link-icon svg {
  width: 100%;
  height: 100%;
}

.link-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.link-service {
  font-size: 1.1rem;
  font-weight: 600;
}

.link-username {
  font-size: 0.95rem;
  opacity: 0.8;
}

/* GitHub */
.link-github {
  background: linear-gradient(135deg, #24292e 0%, #1a1e22 100%);
  color: #fff;
}

.link-github:hover {
  background: linear-gradient(135deg, #2d3339 0%, #24292e 100%);
}

/* X (Twitter) */
.link-x {
  background: linear-gradient(135deg, #000000 0%, #14171a 100%);
  color: #fff;
}

.link-x:hover {
  background: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
}

/* YouTube */
.link-youtube {
  background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
  color: #fff;
}

.link-youtube:hover {
  background: linear-gradient(135deg, #ff1a1a 0%, #ff0000 100%);
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .link-item:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  }
}

/* Link Header Actions */
.link-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Link Edit Form */
.link-edit-form {
  margin-bottom: 20px;
  padding: 16px;
  background: #f5f5f5;
  border-radius: 8px;
  max-width: 100%;
  box-sizing: border-box;
}

.link-edit-item {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.link-edit-service {
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
  min-width: 0;
}

.link-edit-username {
  flex: 1;
  min-width: 120px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
}

.link-edit-remove {
  padding: 4px 10px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

.link-edit-remove:hover {
  background: #dc2626;
}

.link-edit-add {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #ddd;
  flex-wrap: wrap;
}

.link-edit-add select,
.link-edit-add input {
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
  min-width: 0;
}

.link-edit-add input {
  flex: 1;
  min-width: 120px;
}

#link-add-btn {
  padding: 8px 14px;
  background: var(--btn-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

#link-add-btn:hover {
  opacity: 0.9;
}

.link-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

#link-edit-cancel {
  padding: 8px 16px;
  background: #888;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#link-edit-save {
  padding: 8px 16px;
  background: var(--btn-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#link-edit-save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.link-edit-success {
  color: #22c55e;
}

.link-edit-error {
  color: #ef4444;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .link-edit-form {
    background: #2a2a2a;
  }

  .link-edit-service,
  .link-edit-username,
  .link-edit-add select,
  .link-edit-add input {
    background: #1a1a1a;
    border-color: #444;
    color: #e0e0e0;
  }

  .link-edit-add {
    border-top-color: #444;
  }
}

/* Note styles */
.note-list { margin: 1rem 0; }
.note-item { padding: 0.5rem 0; border-bottom: 1px solid #eee; }
.note-link { display: flex; gap: 1rem; text-decoration: none; color: inherit; }
.note-link:hover { opacity: 0.7; }
.note-date { color: #888; font-size: 0.85rem; white-space: nowrap; }
.note-title { font-weight: 500; }
.note-tags { margin-top: 0.25rem; }
.note-tag { font-size: 0.75rem; color: #666; background: #f0f0f0; padding: 0.1rem 0.4rem; border-radius: 3px; margin-right: 0.25rem; }
.note-empty { color: #888; padding: 2rem 0; text-align: center; }

.note-detail { margin: 1rem 0; }
.note-detail-title { font-size: 1.4rem; margin-bottom: 0.25rem; }
.note-detail-meta { color: #888; font-size: 0.85rem; margin-bottom: 1.5rem; }
.note-section { margin-bottom: 1.5rem; }
.note-section-label { font-size: 0.8rem; color: #999; border-bottom: 1px solid #eee; padding-bottom: 0.25rem; margin-bottom: 0.75rem; }
.note-content { line-height: 1.8; }
.note-paywall { text-align: center; color: #c0a060; margin: 2rem 0; font-size: 0.9rem; }

.note-actions { display: flex; gap: 0.5rem; margin: 1rem 0; flex-wrap: wrap; align-items: center; }
.note-copy-btn { font-size: 0.8rem; padding: 0.3rem 0.8rem; background: #f5f5f5; border: 1px solid #ddd; border-radius: 4px; cursor: pointer; }
.note-copy-btn:hover { background: #e8e8e8; }
.note-copy-status { font-size: 0.8rem; color: #4a4; }

.note-edit { margin: 1rem 0; }
.note-edit-input { width: 100%; padding: 0.5rem; font-size: 1rem; border: 1px solid #ddd; border-radius: 4px; margin-bottom: 0.5rem; box-sizing: border-box; }
.note-edit-label { display: block; font-size: 0.8rem; color: #888; margin: 0.75rem 0 0.25rem; }
.note-edit-textarea { width: 100%; padding: 0.5rem; font-family: monospace; font-size: 0.85rem; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box; }
.note-edit-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.note-edit-actions button { padding: 0.3rem 1rem; border: 1px solid #ddd; border-radius: 4px; cursor: pointer; }

@media (prefers-color-scheme: dark) {
  .note-item { border-bottom-color: #333; }
  .note-tag { background: #333; color: #aaa; }
  .note-section-label { border-bottom-color: #333; }
  .note-copy-btn { background: #2a2a2a; border-color: #444; color: #ccc; }
  .note-copy-btn:hover { background: #333; }
  .note-edit-input, .note-edit-textarea { background: #1a1a1a; color: #eee; border-color: #444; }
  .note-edit-actions button { background: #2a2a2a; border-color: #444; color: #ccc; }
}
