/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;700&display=swap');

/* ====== Variables ====== */
:root {
  --font: "Inter","Noto Sans SC",-apple-system,"PingFang SC","Microsoft YaHei",sans-serif;
  --card: rgba(255,255,255,0.94);
  --card-hover: rgba(255,255,255,0.98);
  --text: #1a1410;
  --text2: #5a4530;
  --muted: #9a8570;
  --amber: #f5b971;
  --amber2: #e48750;
  --border: rgba(0,0,0,0.06);
  --shadow: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-hover: 0 8px 25px rgba(0,0,0,0.07);
  --radius: 12px;
  --radius-sm: 8px;
}

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

html { scroll-behavior: smooth; }

/* ====== Body ====== */
body {
  font-family: var(--font);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-color: #0d0a08;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-image:
    linear-gradient(180deg,
      rgba(0,0,0,0.50) 0%,
      rgba(0,0,0,0.20) 30%,
      rgba(0,0,0,0.30) 60%,
      rgba(0,0,0,0.65) 100%);
  position: relative;
}

/* Noise texture overlay — adds visual depth */
body::after {
  content: '';
  position: fixed; inset: 0;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  pointer-events: none;
  z-index: 0;
}

/* ====== Layout ====== */
.page-wrap { max-width: 780px; margin: 0 auto; padding: 0 16px; position: relative; z-index: 1; }

/* ====== Header ====== */
.header {
  position: sticky; top: 12px; z-index: 100;
  background: rgba(10,8,6,0.72);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  max-width: 748px; margin: 0 auto;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; height: 44px;
}
.brand { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; color: #eee7e0; user-select: none; }
.brand span { font-size: 16px; }
.header-actions { display: flex; align-items: center; gap: 4px; }

/* ====== Tabs ====== */
.tabs {
  display: flex; gap: 1px; padding: 0 12px 7px;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0; padding: 5px 10px; border: none;
  background: transparent; color: #6a5a4a;
  font-size: 11.5px; font-weight: 500; font-family: var(--font);
  cursor: pointer; transition: all 0.15s; border-radius: 7px;
}
.tab:hover { color: #d4c5b0; background: rgba(255,255,255,0.04); }
.tab.active { color: var(--amber); background: rgba(245,185,113,0.1); font-weight: 600; }

/* ====== Buttons ====== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 6px 15px; border: none; border-radius: 999px;
  font-size: 12px; font-weight: 600; font-family: var(--font);
  cursor: pointer; transition: all 0.15s; white-space: nowrap; line-height: 1.3;
}
.btn-primary {
  background: linear-gradient(135deg, var(--amber), var(--amber2));
  color: #1a1410; box-shadow: 0 3px 10px rgba(245,185,113,0.2);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(245,185,113,0.3); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: rgba(255,255,255,0.05); color: #c4b5a5;
  border: 1px solid rgba(255,255,255,0.07);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); color: #eee7e0; }
.btn-ghost { background: transparent; color: #8a7560; padding: 6px 9px; }
.btn-ghost:hover { color: #c4b5a5; }
.btn-sm { padding: 4px 11px; font-size: 11px; }

/* ====== Hero ====== */
.hero { text-align: center; padding: 44px 0 24px; }
.hero h1 {
  font-size: 28px; font-weight: 800; letter-spacing: -0.3px;
  background: linear-gradient(180deg, #f5ede5 0%, #c4b5a0 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}
.hero p { color: #9a8570; font-size: 13px; margin-bottom: 20px; line-height: 1.7; }
.hero-actions { display: flex; justify-content: center; gap: 8px; }
.hero-actions .btn { padding: 8px 20px; font-size: 13px; }

/* ====== Stats ====== */
.stats { text-align: center; padding: 0 0 18px; font-size: 11.5px; color: #6a5a4a; }
.stats strong { color: #b8a694; font-weight: 600; }

/* ====== Wall ====== */
.wall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 10px;
}

/* ====== Card ====== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  animation: fadeUp 0.3s ease both;
  transition: all 0.2s;
}
.card:hover {
  background: var(--card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

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

.card__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.card__body { font-size: 13.5px; line-height: 1.7; color: var(--text); word-break: break-word; white-space: pre-wrap; }
.card__bot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); }
.card__time { font-size: 10.5px; color: var(--muted); }

/* ====== Badges ====== */
.badge { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.badge-treehole { background: rgba(124,109,240,0.12); color: #6a5ad8; }
.badge-rant { background: rgba(251,146,60,0.12); color: #d08030; }
.badge-share { background: rgba(52,211,153,0.12); color: #28a870; }
.badge-help { background: rgba(251,191,36,0.12); color: #c4901a; }
.badge-suggest { background: rgba(34,211,238,0.12); color: #18aec8; }

/* ====== Views ====== */
.view { display: none; text-align: center; padding: 50px 0; }
.view.active { display: block; }
.loading-dots { display: flex; justify-content: center; gap: 5px; margin-bottom: 10px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); opacity: 0.3; animation: dot 1.2s ease-in-out infinite; }
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot { 0%,80%,100% { transform: scale(0.5); opacity: 0.3; } 40% { transform: scale(1); opacity: 0.8; } }
.loading-text { font-size: 12px; color: #6a5a4a; }
.empty-icon { font-size: 40px; margin-bottom: 10px; display: block; }
.empty-text { font-size: 12.5px; color: #8a7560; margin-bottom: 12px; }
.load-more { text-align: center; padding: 14px 0 28px; }

/* ====== Random ====== */
.random-result { display: none; margin-top: 16px; text-align: left; }
.random-result.active { display: block; }

/* ====== Modal ====== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: #f5f0ea; border-radius: 14px;
  max-width: 440px; width: 100%; padding: 20px;
  transform: scale(0.95); transition: transform 0.2s;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-overlay.active .modal { transform: scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-title { font-size: 14px; font-weight: 700; color: #1a1410; }
.modal-close { width: 24px; height: 24px; border: none; background: rgba(0,0,0,0.04); border-radius: 6px; cursor: pointer; color: #8a7560; font-size: 14px; display: flex; align-items: center; justify-content: center; transition: 0.15s; }
.modal-close:hover { background: rgba(0,0,0,0.1); color: #1a1410; }

/* ====== Form ====== */
.form-group { margin-bottom: 12px; }
.form-label { display: block; font-size: 11px; font-weight: 600; color: #5a4530; margin-bottom: 4px; }
.form-select, .form-input, .form-textarea {
  width: 100%; padding: 7px 10px;
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: 8px; color: #1a1410;
  font-size: 12.5px; font-family: var(--font);
  outline: none; transition: border-color 0.15s;
}
.form-select:focus, .form-input:focus, .form-textarea:focus { border-color: var(--amber); box-shadow: 0 0 0 2px rgba(245,185,113,0.12); }
.form-textarea { min-height: 95px; resize: vertical; line-height: 1.6; }
.form-hint { font-size: 10px; color: #9a8570; margin-top: 2px; }
.form-char-count { text-align: right; font-size: 10.5px; color: #9a8570; margin-top: 2px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.form-status { display: none; font-size: 11.5px; padding: 6px 10px; border-radius: 7px; margin-bottom: 10px; }
.form-status.success { display: block; background: rgba(52,211,153,0.08); color: #2a8a5a; border: 1px solid rgba(52,211,153,0.1); }
.form-status.error { display: block; background: rgba(248,113,113,0.08); color: #c04040; border: 1px solid rgba(248,113,113,0.1); }

/* ====== Toast ====== */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(10,8,6,0.9); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 999px; padding: 8px 18px; font-size: 12px;
  color: #eee7e0; z-index: 300; opacity: 0;
  transition: all 0.3s; pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ====== Footer ====== */
.footer { text-align: center; padding: 24px 0 28px; color: #5a4a3a; font-size: 11.5px; line-height: 1.8; }
.footer a { color: #6a5a4a; text-decoration: none; border-bottom: 1px dotted #5a4a3a; transition: color 0.15s; }
.footer a:hover { color: #b8a694; }

/* ====== Responsive ====== */
@media (max-width: 640px) {
  .header { top: 8px; border-radius: 12px; }
  .hero { padding: 32px 0 18px; }
  .hero h1 { font-size: 22px; }
  .wall-grid { grid-template-columns: 1fr; gap: 8px; }
  .modal { padding: 16px; }
}
