@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700;900&family=JetBrains+Mono:wght@400;500&display=swap');

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

:root {
  --font-sans: "Noto Sans SC", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  --touch-target: 44px;
}

html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: white;
  color: black;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

/* Navbar - 优化移动端 */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: white;
  border-bottom: 1px solid black;
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (min-width: 768px) {
  .nav-container {
    padding: 0 1.5rem;
    height: 4rem;
  }
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  min-height: var(--touch-target);
}

.nav-icon {
  width: 1.75rem;
  height: 1.75rem;
  background: black;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

@media (min-width: 768px) {
  .nav-icon {
    width: 2rem;
    height: 2rem;
  }
}

.nav-title {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

@media (min-width: 768px) {
  .nav-title {
    font-size: 1.125rem;
    letter-spacing: -0.05em;
  }
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .nav-actions {
    gap: 1.5rem;
  }
}

/* 搜索框优化 */
.search-box {
  position: relative;
}

.search-input {
  padding: 0.5rem 1rem;
  border: none;
  border-bottom: 1px solid black;
  font-size: 0.875rem;
  outline: none;
  width: 10rem;
  font-family: var(--font-sans);
  min-height: var(--touch-target);
}

@media (min-width: 1024px) {
  .search-input {
    width: 12rem;
  }
}

.user-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  transition: opacity 0.2s;
  min-height: var(--touch-target);
  min-width: var(--touch-target);
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-btn:hover {
  opacity: 0.5;
}

/* 移动端搜索隐藏 */
@media (max-width: 767px) {
  .search-box {
    display: none;
  }
}

/* Main Container - 响应式内边距 */
.main-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

@media (min-width: 768px) {
  .main-container {
    padding: 2rem 1.5rem;
  }
}

@media (min-width: 1024px) {
  .main-container {
    padding: 3rem 1.5rem;
  }
}

.view {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Header Section - 响应式 */
.header-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid black;
  padding-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .header-section {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
  }
}

.main-title {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  animation: titleSlide 0.3s ease-out;
  line-height: 1.1;
}

@media (min-width: 768px) {
  .main-title {
    font-size: 2.5rem;
    letter-spacing: -0.05em;
    margin-bottom: 1rem;
  }
}

@media (min-width: 1024px) {
  .main-title {
    font-size: 3.75rem;
  }
}

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

.subtitle {
  color: #a1a1aa;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

@media (min-width: 768px) {
  .subtitle {
    font-size: 0.75rem;
  }
}

/* 创建按钮 - 移动端优化 */
.create-btn {
  padding: 0.875rem 1.5rem;
  background: black;
  color: white;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 4px 4px 0px 0px rgba(0,0,0,0.2);
  min-height: var(--touch-target);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 768px) {
  .create-btn {
    padding: 1rem 2rem;
    font-size: 0.875rem;
    box-shadow: 8px 8px 0px 0px rgba(0,0,0,0.2);
  }
}

.create-btn:hover {
  background: #27272a;
}

.create-btn:active {
  transform: scale(0.95);
}

/* Category Tabs - 移动端优化 */
.category-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
  .category-tabs {
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
  }
}

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

.category-tab {
  padding: 0.5rem 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1px solid #e4e4e7;
  background: white;
  color: #a1a1aa;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  min-height: var(--touch-target);
  display: inline-flex;
  align-items: center;
}

@media (min-width: 768px) {
  .category-tab {
    padding: 0.5rem 1.5rem;
    font-size: 0.75rem;
  }
}

.category-tab:hover {
  border-color: black;
  color: black;
}

.category-tab.active {
  background: black;
  color: white;
  border-color: black;
}

/* Thread Grid - 响应式 */
.thread-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  animation: gridFade 0.3s ease-in-out;
}

@media (min-width: 768px) {
  .thread-grid {
    gap: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .thread-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
}

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

/* Thread Card - 移动端优化 */
.thread-card {
  padding: 1rem;
  border: 1px solid black;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s;
  animation: cardAppear 0.3s ease-out;
}

@media (min-width: 768px) {
  .thread-card {
    padding: 1.25rem;
  }
}

@media (min-width: 1024px) {
  .thread-card {
    padding: 1.5rem;
  }
}

@keyframes cardAppear {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.thread-card:hover {
  background: #fafafa;
  transform: translateY(-2px);
}

.thread-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

@media (min-width: 768px) {
  .thread-card-header {
    margin-bottom: 1rem;
  }
}

.thread-category {
  font-size: 0.6rem;
  font-weight: 700;
  border: 1px solid black;
  padding: 0.125rem 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.thread-time {
  font-size: 0.6rem;
  color: #a1a1aa;
  font-family: var(--font-mono);
}

.thread-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

@media (min-width: 768px) {
  .thread-title {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
  }
}

@media (min-width: 1024px) {
  .thread-title {
    font-size: 1.25rem;
  }
}

.thread-content {
  color: #71717a;
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (min-width: 768px) {
  .thread-content {
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
  }
}

.thread-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0,0,0,0.1);
}

@media (min-width: 768px) {
  .thread-footer {
    padding-top: 1rem;
  }
}

.thread-author {
  font-size: 0.7rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
}

@media (min-width: 768px) {
  .thread-author {
    font-size: 0.75rem;
  }
}

.thread-replies {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: #a1a1aa;
  font-size: 0.7rem;
  font-family: var(--font-mono);
}

@media (min-width: 768px) {
  .thread-replies {
    font-size: 0.75rem;
  }
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  padding: 4rem 0;
  text-align: center;
  border: 1px dashed #d4d4d8;
}

@media (min-width: 768px) {
  .empty-state {
    padding: 8rem 0;
  }
}

.empty-text {
  font-size: 0.7rem;
  font-weight: 700;
  color: #a1a1aa;
  text-transform: uppercase;
  letter-spacing: 0.3em;
}

@media (min-width: 768px) {
  .empty-text {
    font-size: 0.75rem;
  }
}

/* Thread Detail - 响应式 */
.back-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: black;
  margin-bottom: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  min-height: var(--touch-target);
}

@media (min-width: 768px) {
  .back-btn {
    margin-bottom: 2rem;
  }
}

@media (min-width: 1024px) {
  .back-btn {
    margin-bottom: 3rem;
  }
}

.back-btn:hover {
  opacity: 0.5;
}

.detail-container {
  max-width: 48rem;
  margin: 0 auto;
  animation: fadeIn 0.3s ease-in-out;
}

.detail-main {
  border: 1px solid black;
  padding: 1rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .detail-main {
    padding: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .detail-main {
    padding: 2rem;
    margin-bottom: 3rem;
  }
}

.detail-category {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  border: 1px solid black;
  padding: 0.125rem 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .detail-category {
    font-size: 0.625rem;
    margin-bottom: 1.5rem;
  }
}

.detail-title {
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: 1.5rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

@media (min-width: 768px) {
  .detail-title {
    font-size: 1.875rem;
    margin-bottom: 2rem;
  }
}

@media (min-width: 1024px) {
  .detail-title {
    font-size: 2.25rem;
    letter-spacing: -0.05em;
  }
}

.detail-author-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}

@media (min-width: 768px) {
  .detail-author-section {
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .detail-author-section {
    margin-bottom: 2.5rem;
  }
}

.author-avatar {
  width: 2.25rem;
  height: 2.25rem;
  background: black;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
}

@media (min-width: 768px) {
  .author-avatar {
    width: 2.5rem;
    height: 2.5rem;
  }
}

.author-name {
  font-weight: 700;
  font-size: 0.8rem;
}

@media (min-width: 768px) {
  .author-name {
    font-size: 0.875rem;
  }
}

.author-time {
  font-size: 0.6rem;
  color: #a1a1aa;
  font-family: var(--font-mono);
}

@media (min-width: 768px) {
  .author-time {
    font-size: 0.625rem;
  }
}

.detail-content {
  margin-bottom: 1.5rem;
  line-height: 1.6;
  font-size: 0.9rem;
}

@media (min-width: 768px) {
  .detail-content {
    margin-bottom: 2rem;
    font-size: 0.95rem;
  }
}

@media (min-width: 1024px) {
  .detail-content {
    margin-bottom: 2.5rem;
    font-size: 1rem;
  }
}

/* Replies Section */
.replies-section {
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .replies-section {
    margin-bottom: 3rem;
  }
}

@media (min-width: 1024px) {
  .replies-section {
    margin-bottom: 4rem;
  }
}

.replies-title {
  font-size: 1rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .replies-title {
    font-size: 1.125rem;
    letter-spacing: -0.05em;
    margin-bottom: 2rem;
  }
}

.reply-card {
  border: 1px solid black;
  padding: 1rem;
  margin-bottom: 1rem;
  animation: cardAppear 0.3s ease-out;
}

@media (min-width: 768px) {
  .reply-card {
    padding: 1.25rem;
    margin-bottom: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .reply-card {
    padding: 1.5rem;
    margin-bottom: 2rem;
  }
}

.reply-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

@media (min-width: 768px) {
  .reply-header {
    gap: 0.75rem;
    margin-bottom: 1rem;
  }
}

.reply-avatar {
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid black;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.6rem;
}

@media (min-width: 768px) {
  .reply-avatar {
    width: 2rem;
    height: 2rem;
    font-size: 0.625rem;
  }
}

.reply-author {
  font-size: 0.7rem;
  font-weight: 700;
}

@media (min-width: 768px) {
  .reply-author {
    font-size: 0.75rem;
  }
}

.reply-time {
  font-size: 0.6rem;
  color: #a1a1aa;
  font-family: var(--font-mono);
}

@media (min-width: 768px) {
  .reply-time {
    font-size: 0.625rem;
  }
}

.reply-content {
  font-size: 0.85rem;
  line-height: 1.5;
}

@media (min-width: 768px) {
  .reply-content {
    font-size: 0.875rem;
    line-height: 1.6;
  }
}

/* Reply Form - 移动端优化 */
.reply-form-container {
  position: sticky;
  bottom: 1rem;
  background: white;
  border: 1px solid black;
  padding: 1rem;
  box-shadow: 4px 4px 0px 0px rgba(0,0,0,1);
}

@media (min-width: 768px) {
  .reply-form-container {
    bottom: 1.5rem;
    padding: 1.25rem;
  }
}

@media (min-width: 1024px) {
  .reply-form-container {
    bottom: 2rem;
    padding: 1.5rem;
    box-shadow: 6px 6px 0px 0px rgba(0,0,0,1);
  }
}

.reply-form {
  display: flex;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .reply-form {
    gap: 1rem;
  }
}

.reply-input {
  flex: 1;
  border: none;
  border-bottom: 1px solid black;
  font-size: 0.875rem;
  outline: none;
  padding: 0.5rem 0;
  font-family: var(--font-sans);
  min-height: var(--touch-target);
}

.reply-submit {
  padding: 0 1rem;
  background: black;
  color: white;
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  min-height: var(--touch-target);
  white-space: nowrap;
}

@media (min-width: 768px) {
  .reply-submit {
    padding: 0 1.5rem;
    font-size: 0.75rem;
  }
}

.reply-submit:hover {
  background: #27272a;
}

/* Modal - 响应式优化 */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease-in-out;
}

@media (min-width: 768px) {
  .modal-overlay {
    padding: 1rem;
    background: rgba(255,255,255,0.8);
  }
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  position: relative;
  background: white;
  width: 100%;
  max-width: 100%;
  max-height: 95vh;
  border: 1px solid black;
  padding: 1.25rem;
  box-shadow: 6px 6px 0px 0px rgba(0,0,0,1);
  animation: modalSlide 0.3s ease-out;
  overflow-y: auto;
}

@media (min-width: 640px) {
  .modal-content {
    max-width: 32rem;
    padding: 1.5rem;
  }
}

@media (min-width: 768px) {
  .modal-content {
    max-width: 36rem;
    padding: 2rem;
    box-shadow: 10px 10px 0px 0px rgba(0,0,0,1);
  }
}

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

.modal-title {
  font-size: 1.25rem;
  font-weight: 900;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid black;
  padding-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: -0.02em;
}

@media (min-width: 768px) {
  .modal-title {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    letter-spacing: -0.05em;
  }
}

.form-group {
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .form-group {
    margin-bottom: 1.5rem;
  }
}

.form-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

@media (min-width: 768px) {
  .form-label {
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
  }
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid black;
  outline: none;
  transition: background 0.2s;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  min-height: var(--touch-target);
}

.form-input:focus {
  background: #fafafa;
}

textarea.form-input {
  resize: none;
  min-height: 120px;
}

@media (min-width: 768px) {
  textarea.form-input {
    min-height: 150px;
  }
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 0.75rem;
}

@media (min-width: 768px) {
  .form-actions {
    gap: 1rem;
    padding-top: 1rem;
  }
}

.btn-secondary,
.btn-primary {
  flex: 1;
  padding: 0.75rem;
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1px solid black;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
  min-height: var(--touch-target);
}

@media (min-width: 768px) {
  .btn-secondary,
  .btn-primary {
    font-size: 0.75rem;
  }
}

.btn-secondary {
  background: white;
  color: black;
}

.btn-secondary:hover {
  background: #f4f4f5;
}

.btn-primary {
  background: black;
  color: white;
}

.btn-primary:hover {
  background: #27272a;
}

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

/* Pagination - 移动端优化 */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

@media (min-width: 768px) {
  .pagination {
    gap: 0.5rem;
    margin-top: 3rem;
  }
}

.page-btn {
  padding: 0.5rem 0.75rem;
  border: 1px solid black;
  background: white;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  min-height: var(--touch-target);
  min-width: var(--touch-target);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
  background: black;
  color: white;
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-btn.active {
  background: black;
  color: white;
}

/* 移动端底部安全区域 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .reply-form-container {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }
  
  @media (min-width: 768px) {
    .reply-form-container {
      padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
    }
  }
  
  @media (min-width: 1024px) {
    .reply-form-container {
      padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }
  }
}
