:root {
  --bg: #f7f5ef;
  --ink: #232323;
  --muted: #6b675e;
  --line: #ded8ca;
  --accent: #0f766e;
  --paper: #fffdf8;
}

/* ── reset ── */
*, *::before, *::after { box-sizing: border-box; }
img { max-width: 100%; height: auto; display: block; }

/* ── base ── */
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(0.95rem, 2.5vw, 1.05rem);
  line-height: 1.75;
  -webkit-text-size-adjust: 100%;
}
main {
  width: min(1040px, 100% - 32px);
  margin: 0 auto;
  padding: 32px 0 64px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── hero ── */
.hero { padding: 28px 0 24px; border-bottom: 1px solid var(--line); }
.hero h1 { margin: 0; font-size: clamp(1.8rem, 5vw, 4rem); line-height: 1.1; word-break: keep-all; }
.meta { margin: 0 0 8px; color: var(--muted); font-size: 0.85rem; }

/* ── index grid ── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 14px;
  padding-top: 20px;
}
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  overflow: hidden;
}
.card h2 { margin: 0 0 8px; font-size: clamp(1rem, 3vw, 1.18rem); line-height: 1.35; word-break: keep-all; }
.card p { margin: 0 0 12px; font-size: 0.9rem; color: var(--muted); }

/* ── card thumbnail ── */
.card-img {
  width: calc(100% + 32px);
  margin: -16px -16px 14px;
  height: 160px;
  object-fit: cover;
  border-radius: 10px 10px 0 0;
}

/* ── tags ── */
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

/* ── post ── */
.post {
  max-width: 720px;
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: clamp(16px, 4vw, 32px);
}
.post h1 {
  margin: 8px 0 14px;
  font-size: clamp(1.4rem, 5vw, 2.4rem);
  line-height: 1.2;
  word-break: keep-all;
}
.back { display: inline-block; margin-bottom: 20px; color: var(--muted); font-size: 0.9rem; }

/* ── cover image ── */
.cover {
  width: 100%;
  max-height: clamp(180px, 40vw, 400px);
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 20px;
}

/* ── post content ── */
.content { margin-top: 24px; }
.content h2 { margin-top: 28px; font-size: clamp(1.1rem, 3.5vw, 1.4rem); line-height: 1.3; word-break: keep-all; }
.content h3 { font-size: clamp(1rem, 3vw, 1.2rem); }
.content p { margin: 0 0 1em; }
.content ul, .content ol { padding-left: 1.4em; }
.content li { margin-bottom: 0.3em; }

/* ── table: scrollable on mobile ── */
.content .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 16px 0; }
.content table { width: 100%; min-width: 360px; border-collapse: collapse; font-size: 0.9rem; }
.content th, .content td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; white-space: nowrap; }
.content th { background: #ece7da; }

/* ── ad slot ── */
.ad-slot { margin: 20px 0; overflow: hidden; }

/* ── dashboard ── */
.empty { padding: 24px 0; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 20px 0; }
.stats div { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #faf7ef; }
.stats strong { display: block; font-size: 1.8rem; line-height: 1.1; }
.stats span { color: var(--muted); font-size: 0.85rem; }

/* ── mobile ── */
@media (max-width: 480px) {
  main { width: 100%; padding: 0 0 48px; }
  .hero { padding: 16px 16px 16px; }
  .grid { gap: 10px; padding: 12px 12px 0; }
  .card { border-radius: 8px; padding: 14px; }
  .card-img { width: calc(100% + 28px); margin: -14px -14px 12px; height: 140px; }
  .post { border-radius: 0; border-left: none; border-right: none; padding: 16px; }
  .cover { border-radius: 0; max-height: 200px; }
  .content table { font-size: 0.82rem; }
  .content th, .content td { padding: 6px 8px; }
  .stats { grid-template-columns: 1fr; }
}

@media (min-width: 481px) and (max-width: 768px) {
  .cover { max-height: 280px; }
  .card-img { height: 150px; }
}

.pagination { display:flex; justify-content:space-between; align-items:center; margin-top:18px; } .pagination a { color:var(--accent); }
