:root {
  --ink: #17171a;
  --muted: #72727a;
  --paper: #f7f7f8;
  --surface: #ffffff;
  --line: #e7e7ea;
  --accent: #5b5bd6;
  --accent-soft: #eeeeff;
  --danger: #c13f3f;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); font-family: var(--sans); scroll-behavior: smooth; }
body { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.site-header {
  height: 64px;
  padding: 0 max(20px, calc((100vw - 1040px) / 2));
  display: grid;
  grid-template-columns: 1fr minmax(260px, 360px) 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 9px;
  width: max-content;
  padding: 0;
  border: 0;
  background: none;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -.02em;
}

.mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: white;
  font-size: 14px;
  font-weight: 800;
}

.search {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
}
.search:focus-within { border-color: #b9b9c4; background: white; }
.search button { border: 0; background: none; padding: 0; display: grid; place-items: center; }
.search svg { width: 17px; color: var(--muted); }
.search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 13px; }

.site-header nav { justify-self: end; display: flex; align-items: center; gap: 9px; position: relative; }
.write-button, .login-button, .primary, .empty button {
  height: 38px;
  border: 0;
  border-radius: 9px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--ink);
  color: white;
  font-weight: 650;
  font-size: 13px;
}
.write-button svg { width: 16px; }
.login-button { color: var(--ink); background: white; border: 1px solid var(--line); }
.login-button:hover { background: var(--paper); }
.primary { background: var(--accent); }
.avatar { width: 36px; height: 36px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--accent-soft); font-weight: 700; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-menu { position: absolute; right: 0; top: 46px; width: 220px; padding: 7px; background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 45px #17171a1a; }
.account-menu button { border: 0; background: none; width: 100%; text-align: left; padding: 10px; border-radius: 7px; font-size: 13px; }
.account-menu button:hover { background: var(--paper); }
.account-name { padding: 8px 10px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.account-name small { color: var(--muted); margin-top: 3px; }
.mobile-search { display: none; }
.icon-button { border: 0; background: none; padding: 8px; }
.toast { position: fixed; right: 24px; top: 78px; z-index: 50; background: var(--ink); color: white; padding: 12px 16px; border-radius: 10px; font-size: 13px; box-shadow: 0 10px 30px #0002; }

main { min-height: calc(100vh - 145px); }
.page-shell { max-width: 760px; margin: 0 auto; padding: 52px 0 90px; }
.home-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 28px; }
.home-head h1 { margin: 0; font-size: 30px; letter-spacing: -.04em; }
.home-head p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.home-head .primary svg { width: 16px; }
.quick-post { width: 100%; height: 62px; border: 1px solid var(--line); border-radius: 14px; background: white; display: flex; align-items: center; gap: 12px; padding: 0 14px; color: var(--muted); text-align: left; }
.quick-post:hover { border-color: #cfcfd5; box-shadow: 0 4px 16px #17171a0a; }
.quick-avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 20px; }
.quick-post > span:nth-child(2) { flex: 1; font-size: 14px; }
.quick-post b { border-radius: 8px; background: var(--paper); color: var(--ink); padding: 8px 12px; font-size: 12px; }

.feed { padding: 32px 0 45px; }
.feed.compact { padding-top: 24px; }
.home-feed { display: grid; gap: 10px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; }
.section-heading > div { display: flex; align-items: center; gap: 10px; }
.section-heading h2 { font-size: 18px; margin: 0; }
.section-heading small { font-size: 11px; color: var(--muted); }
.rule { display: none; }

.article-row { width: 100%; min-height: 94px; border: 1px solid var(--line); border-radius: 14px; background: white; display: grid; grid-template-columns: 1fr 60px 20px; align-items: center; text-align: left; padding: 18px; transition: border-color .15s, transform .15s, box-shadow .15s; }
.feed.compact .article-row + .article-row { margin-top: 10px; }
.article-row:hover { border-color: #cfcfd5; transform: translateY(-1px); box-shadow: 0 6px 18px #17171a0a; }
.article-meta { display: flex; gap: 7px; color: var(--muted); font-size: 11px; }
.article-meta span { color: var(--accent); font-weight: 650; }
.article-meta i { font-style: normal; }
.article-row h3 { font-size: 16px; line-height: 1.5; margin: 7px 0 0; letter-spacing: -.01em; }
.reply-count { display: flex; align-items: center; justify-content: flex-end; gap: 5px; font-size: 12px; color: var(--muted); }
.reply-count svg { width: 16px; }
.arrow { text-align: right; color: #a0a0a8; }

.narrow-page, .form-page { max-width: 760px; margin: 0 auto; padding: 60px 0 100px; }
.narrow-page > h1, .form-page h1 { font-size: 30px; line-height: 1.35; letter-spacing: -.04em; margin: 0; }
.subtle { color: var(--muted); font-size: 13px; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 700; margin: 0 0 12px; }
.user-profile { display: grid; grid-template-columns: 82px 1fr; gap: 22px; align-items: start; padding-bottom: 42px; margin-bottom: 38px; border-bottom: 1px solid var(--line); }
.user-profile h1 { font-size: 30px; letter-spacing: -.04em; margin: 2px 0 0; }
.user-profile p:not(.user-handle) { line-height: 1.7; font-size: 14px; }
.user-profile small { color: var(--muted); }
.user-handle { color: var(--accent); font-size: 12px; font-weight: 650; margin: 0; }
.monogram { width: 76px; height: 76px; background: var(--ink); color: white; display: grid; place-items: center; border-radius: 20px; font-size: 27px; font-weight: 750; }

.article-page { max-width: 760px; margin: 0 auto; padding: 60px 0 110px; }
.article-top { font-size: 12px; color: var(--muted); margin-bottom: 18px; }
.author-link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 650; }
.article-page > h1 { font-size: clamp(30px, 5vw, 44px); line-height: 1.35; letter-spacing: -.045em; margin: 0; }
.thread-label { display: flex; align-items: center; gap: 10px; margin: 34px 0 8px; color: var(--muted); font-size: 10px; font-weight: 650; }
.thread-label i { height: 1px; background: var(--line); flex: 1; }
.thread-label b { font-size: 11px; }
.thread-post { display: grid; grid-template-columns: 44px 1fr; border-top: 1px solid var(--line); padding: 26px 0 34px; }
.post-number { font: 600 12px/1 var(--sans); color: var(--muted); padding-top: 2px; }
.post-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; margin-bottom: 20px; }
.post-meta strong { font-size: 12px; }
.post-meta span, .post-meta time { color: var(--muted); }
.post-meta time { margin-left: auto; }
.post-meta em { font-style: normal; font-size: 9px; font-weight: 700; border-radius: 5px; background: var(--accent-soft); color: var(--accent); padding: 3px 6px; }
.markdown { font-size: 15px; line-height: 1.95; overflow-wrap: anywhere; }
.markdown p { margin: 0; }
.markdown .md-space { height: 14px; }
.markdown h2, .markdown h3, .markdown h4 { line-height: 1.5; margin: 30px 0 10px; }
.markdown h2 { font-size: 22px; }
.markdown h3 { font-size: 18px; }
.markdown h4 { font-size: 16px; }
.markdown ul { padding-left: 22px; }
.markdown blockquote { margin: 18px 0; border-left: 3px solid #d3d3da; padding: 3px 0 3px 17px; color: var(--muted); }
.markdown pre { overflow: auto; padding: 17px 19px; border-radius: 10px; background: #f0f0f2; font: 13px/1.7 ui-monospace, monospace; }
.markdown code { font-family: ui-monospace, monospace; background: #f0f0f2; border-radius: 4px; padding: 2px 5px; font-size: .9em; }
.markdown a { color: var(--accent); text-underline-offset: 3px; }

.reply-form { margin-top: 42px; background: white; border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.reply-form h2 { font-size: 18px; margin: 0 0 17px; }
.reply-form textarea, .inline-editor textarea, .form-page textarea { width: 100%; min-height: 150px; resize: vertical; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); padding: 14px; outline: none; line-height: 1.75; }
.reply-form textarea:focus, .inline-editor input:focus, .inline-editor textarea:focus, .form-page input:focus, .form-page textarea:focus { border-color: var(--accent); background: white; }
.form-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.form-foot small { color: var(--muted); font-size: 10px; }
.form-foot button { border: 0; border-radius: 8px; background: var(--accent); color: white; padding: 10px 16px; font-weight: 650; }
.edit-link { margin-left: 44px; }
.text-button { border: 0; background: none; color: var(--accent); display: inline-flex; align-items: center; gap: 7px; padding: 8px; }
.text-button svg { width: 16px; }
.inline-editor { margin: 18px 0 18px 44px; padding: 18px; background: white; border: 1px solid var(--line); border-radius: 12px; }
.inline-editor input { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); padding: 12px; margin-bottom: 12px; font-weight: 650; }
.inline-editor > div { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }

.editor-page { max-width: 900px; margin: 0 auto; padding: 52px 0 90px; }
.editor-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.editor-head h1 { font-size: 30px; letter-spacing: -.04em; margin: 0; }
.editor-actions { display: flex; gap: 9px; }
.paper { background: white; min-height: 560px; border: 1px solid var(--line); border-radius: 16px; padding: 48px 56px; }
.title-input { display: block; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; outline: none; padding: 0 0 20px; font-size: 34px; font-weight: 750; line-height: 1.35; letter-spacing: -.04em; }
.body-input { display: block; width: 100%; height: 400px; border: 0; background: none; outline: none; resize: none; margin-top: 25px; font-size: 15px; line-height: 1.9; }
.preview-title { font-size: 34px; line-height: 1.4; letter-spacing: -.04em; margin: 0 0 30px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.editor-foot { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; margin-top: 10px; }

.form-page { max-width: 640px; }
.form-page form { margin-top: 36px; padding-top: 30px; border-top: 1px solid var(--line); }
.form-page label { display: block; font-size: 12px; font-weight: 650; margin-bottom: 25px; }
.form-page label > input, .slug-input { width: 100%; height: 46px; border: 1px solid var(--line); border-radius: 9px; background: white; margin-top: 8px; }
.form-page label > input { padding: 0 13px; outline: none; }
.form-page label small { font-weight: 400; color: var(--muted); display: block; margin-top: 7px; }
.form-page textarea { min-height: 105px; margin-top: 8px; }
.slug-input { display: flex; align-items: center; overflow: hidden; }
.slug-input span { padding-left: 13px; color: var(--muted); font-weight: 400; }
.slug-input input { flex: 1; height: 100%; border: 0; background: transparent; outline: none; padding: 0 10px; }

.empty { text-align: center; padding: 62px 24px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.empty > span { color: #b0b0b8; }
.empty h2 { font-size: 17px; margin: 14px 0 7px; }
.empty p { color: var(--muted); font-size: 12px; }
.empty button { margin: 16px auto 0; }
.skeleton { padding: 18px 0; }
.skeleton i { display: block; height: 18px; margin: 14px 0; border-radius: 6px; background: linear-gradient(90deg,#e8e8eb,#f4f4f5,#e8e8eb); background-size: 200%; animation: pulse 1.2s infinite; }
.skeleton i:nth-child(2) { width: 73%; }
.skeleton i:nth-child(3) { width: 52%; }
@keyframes pulse { to { background-position: -200%; } }

footer { max-width: 760px; margin: 0 auto; height: 90px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; color: var(--muted); }
footer > span { font-size: 14px; font-weight: 700; color: var(--ink); }
footer small { font-size: 10px; }

@media (max-width: 900px) {
  .site-header { padding: 0 18px; grid-template-columns: 1fr auto; }
  .site-header > .search { display: none; }
  .site-header > .search.open { display: flex; position: absolute; left: 14px; right: 14px; top: calc(100% + 8px); height: 44px; box-shadow: 0 10px 25px #17171a1c; }
  .mobile-search { display: block; }
  .page-shell, .narrow-page, .article-page, .editor-page, .form-page { margin-left: 20px; margin-right: 20px; }
  .paper { padding: 40px; }
  footer { margin-left: 20px; margin-right: 20px; }
}

@media (max-width: 600px) {
  .site-header { height: 58px; }
  .wordmark span:last-child { font-size: 15px; }
  .mark { width: 28px; height: 28px; border-radius: 8px; }
  .write-button { width: 36px; padding: 0; font-size: 0; }
  .login-button { padding: 0 10px; font-size: 11px; }
  .page-shell { padding-top: 36px; }
  .home-head { align-items: center; margin-bottom: 22px; }
  .home-head h1 { font-size: 25px; }
  .home-head p { font-size: 12px; }
  .home-head .primary { width: 38px; padding: 0; font-size: 0; }
  .quick-post { height: 58px; }
  .quick-post b { display: none; }
  .article-row { grid-template-columns: 1fr 42px 14px; padding: 15px; border-radius: 12px; }
  .article-row h3 { font-size: 15px; }
  .narrow-page, .article-page, .editor-page, .form-page { padding-top: 40px; }
  .narrow-page > h1, .form-page h1 { font-size: 25px; }
  .user-profile { grid-template-columns: 62px 1fr; gap: 16px; }
  .monogram { width: 58px; height: 58px; border-radius: 16px; font-size: 22px; }
  .user-profile h1 { font-size: 25px; }
  .article-page > h1 { font-size: 29px; }
  .thread-post { grid-template-columns: 34px 1fr; padding: 23px 0 30px; }
  .post-meta { flex-wrap: wrap; }
  .post-meta time { width: 100%; margin: 3px 0 0; }
  .markdown { font-size: 14px; }
  .reply-form { padding: 19px; margin-top: 30px; }
  .editor-head { align-items: center; gap: 15px; }
  .editor-head h1 { font-size: 24px; }
  .editor-actions { flex-direction: column-reverse; }
  .paper { padding: 28px 22px; min-height: 500px; border-radius: 12px; }
  .title-input, .preview-title { font-size: 27px; }
  .slug-input span { display: none; }
  .inline-editor, .edit-link { margin-left: 34px; }
  .toast { right: 14px; left: 14px; top: 70px; text-align: center; }
}
