:root {
  color: #172033;
  background: #f5f7fb;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f5f7fb; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }

.app-shell { width: min(100%, 760px); margin: 0 auto; padding: env(safe-area-inset-top) 16px 32px; }
.site-header { min-height: 72px; display: flex; align-items: center; }
.brand-block h1, .modal-header h2 { margin: 0; color: #121b2d; font-size: 25px; line-height: 1.15; font-weight: 760; letter-spacing: 0; }
.eyebrow { margin: 0 0 4px; color: #64748b; font-size: 12px; font-weight: 650; letter-spacing: 0; }
.avatar { flex: 0 0 auto; display: inline-grid; place-items: center; width: 34px; height: 34px; overflow: hidden; border-radius: 7px; color: #1555ca; background: #e7f0ff; font-size: 15px; font-weight: 800; }
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.avatar-small { width: 28px; height: 28px; font-size: 13px; }
.home-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 14px; }
.home-actions > button { width: 100%; }
.account-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; overflow: hidden; }
.account-button > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.feed-toolbar { position: sticky; top: 0; z-index: 2; margin: 0 -16px; padding: 8px 16px 12px; background: rgba(245, 247, 251, .96); border-bottom: 1px solid #e9edf4; backdrop-filter: blur(10px); }
.category-scroller { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.category-scroller::-webkit-scrollbar { display: none; }
.category-chip { flex: 0 0 auto; min-height: 34px; padding: 0 13px; color: #526076; background: #fff; border: 1px solid #dfe6ef; border-radius: 7px; font-size: 14px; font-weight: 650; white-space: nowrap; }
.category-chip.is-active { color: #fff; background: #2563dc; border-color: #2563dc; }
.feed-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; }
.sort-tabs { display: inline-flex; gap: 18px; align-items: center; }
.sort-tab { padding: 4px 0; color: #7b8798; background: transparent; border: 0; font-size: 15px; font-weight: 650; }
.sort-tab.is-active { color: #172033; font-weight: 780; }
.primary-button, .secondary-button { min-height: 38px; padding: 0 18px; border-radius: 7px; font-size: 15px; font-weight: 720; }
.primary-button { color: #fff; background: #2563dc; border: 1px solid #2563dc; }
.secondary-button { color: #334155; background: #fff; border: 1px solid #dfe6ef; }

.feed { padding-top: 14px; }
.loading-state { padding: 48px 0; color: #738095; text-align: center; }
.post-card { margin-bottom: 12px; padding: 17px; background: #fff; border: 1px solid #e6ebf2; border-radius: 8px; box-shadow: 0 2px 8px rgba(25, 45, 76, .035); }
.post-main { display: block; width: 100%; padding: 0; text-align: left; color: inherit; background: transparent; border: 0; }
.post-meta, .comment-heading { display: flex; align-items: center; gap: 8px; min-width: 0; }
.post-author { min-width: 0; overflow: hidden; color: #24324a; font-size: 15px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.post-category { margin-left: auto; color: #637087; font-size: 13px; white-space: nowrap; }
.post-meta time, .comment-heading time { flex: 0 0 auto; color: #8a96a8; font-size: 12px; white-space: nowrap; }
.post-card h2 { margin: 14px 0 7px; color: #172033; font-size: 19px; line-height: 1.35; letter-spacing: 0; }
.post-content { display: -webkit-box; margin: 0; overflow: hidden; color: #536177; font-size: 15px; line-height: 1.65; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.post-stats { display: flex; gap: 18px; align-items: center; margin-top: 14px; color: #758197; font-size: 13px; }
.post-action { display: inline-flex; align-items: center; gap: 4px; padding: 0; color: inherit; background: transparent; border: 0; white-space: nowrap; }
.post-action.is-active { color: #2563dc; font-weight: 700; }
.action-icon { font-size: 20px; line-height: 1; }
.comment-preview { display: grid; gap: 6px; margin-top: 14px; padding: 10px 11px; background: #f7f9fc; border-left: 2px solid #d6e2f6; border-radius: 0 6px 6px 0; }
.comment-preview p { display: flex; gap: 6px; min-width: 0; margin: 0; color: #647187; font-size: 13px; }
.comment-preview strong { flex: 0 0 auto; color: #435169; }
.comment-preview span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picture-badge { flex: 0 0 auto; display: inline-grid; place-items: center; width: 19px; height: 19px; color: #526b8e; border: 1px solid #aebcd0; border-radius: 4px; font-size: 11px; line-height: 1; }
.image-grid { display: grid; gap: 7px; margin-top: 13px; overflow: hidden; border-radius: 7px; }
.image-grid-1 { grid-template-columns: minmax(0, 360px); }
.image-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.image-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.image-grid img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 6px; background: #edf1f7; }
.image-grid-1 img { max-height: 360px; object-fit: contain; background: #f2f5f9; }
.empty-state { padding: 64px 20px; color: #748198; text-align: center; }
.empty-state p { margin: 0 0 16px; }

.modal { width: min(100%, 680px); height: min(100%, 860px); padding: 0; color: inherit; background: #fff; border: 0; border-radius: 8px; box-shadow: 0 20px 70px rgba(15, 23, 42, .22); }
.modal::backdrop { background: rgba(15, 23, 42, .42); }
.modal-sheet { display: grid; gap: 17px; max-height: min(100vh, 860px); padding: 22px; overflow-y: auto; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.icon-button, .back-button { display: inline-grid; place-items: center; min-width: 36px; min-height: 36px; padding: 0; color: #46546a; background: #f2f5f9; border: 1px solid #e1e7f0; border-radius: 7px; }
.icon-button { font-size: 26px; line-height: 1; }
.back-button { padding: 0 10px; font-size: 14px; font-weight: 700; }
label { display: grid; gap: 7px; color: #354157; font-size: 14px; font-weight: 700; }
input, select, textarea { width: 100%; padding: 11px 12px; color: #172033; background: #fff; border: 1px solid #d9e1ec; border-radius: 7px; outline: none; }
textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: #2563dc; box-shadow: 0 0 0 3px rgba(37, 99, 220, .12); }
.check-row { display: flex; align-items: center; gap: 9px; }
.check-row input { width: 17px; height: 17px; margin: 0; accent-color: #2563dc; }
.form-error { min-height: 20px; margin: -3px 0 0; color: #bd2d25; font-size: 13px; }
.modal-actions, .comment-submit-row { display: flex; justify-content: flex-end; gap: 9px; }
.attachment-control { display: flex; align-items: flex-start; gap: 9px; }
.file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.image-picker { display: inline-grid; flex: 0 0 auto; place-items: center; width: 38px; height: 38px; padding: 0; color: #536b8d; background: #fff; border: 1px solid #b6c4d7; border-radius: 7px; font-size: 14px; font-weight: 750; cursor: pointer; }
.selected-images { display: flex; flex-wrap: wrap; gap: 7px; }
.selected-images img { width: 38px; height: 38px; object-fit: cover; border-radius: 6px; }
.profile-avatar-control { display: grid; justify-items: start; gap: 7px; }
.profile-avatar-picker { display: inline-flex; align-items: center; gap: 10px; color: #334155; cursor: pointer; }
.profile-avatar-preview { width: 58px; height: 58px; font-size: 21px; }
.profile-avatar-control p { margin: 0; color: #7a8799; font-size: 12px; }

.detail-modal { width: min(100%, 760px); height: 100%; border-radius: 0; }
.detail-sheet { height: 100%; max-height: none; padding: 0; overflow: hidden; }
.detail-header { flex: 0 0 auto; align-items: center; padding: calc(env(safe-area-inset-top) + 14px) 17px 14px; border-bottom: 1px solid #e7ecf3; }
.detail-header h2 { font-size: 18px; }
.detail-header > span { width: 56px; }
.detail-scroll { padding: 16px; overflow-y: auto; }
.detail-post { padding-bottom: 18px; border-bottom: 1px solid #e7ecf3; }
.detail-post h1 { margin: 15px 0 8px; color: #172033; font-size: 23px; line-height: 1.32; letter-spacing: 0; }
.detail-content { margin: 0; color: #3d4b61; line-height: 1.75; white-space: pre-wrap; }
.detail-stats { margin-top: 18px; }
.comments-section { padding: 20px 0 28px; }
.comments-section h2 { margin: 0 0 16px; font-size: 20px; letter-spacing: 0; }
.comment-list { display: grid; gap: 19px; }
.comment-item > p, .reply-item > p { margin: 9px 0 7px 36px; color: #3c4a60; line-height: 1.58; white-space: pre-wrap; }
.comment-item > .comment-image-grid { margin-left: 36px; }
.reply-item > .comment-image-grid { margin-left: 0; }
.comment-image-grid { width: min(100%, 240px); }
.comment-heading strong { color: #2d3a50; font-size: 14px; }
.comment-heading time { margin-left: auto; }
.text-button { margin-left: 36px; padding: 0; color: #547096; background: transparent; border: 0; font-size: 13px; font-weight: 650; }
.comment-actions { display: flex; align-items: center; justify-content: flex-end; gap: 18px; margin: 8px 0 0 36px; }
.comment-actions .text-button { margin-left: 0; }
.comment-like { display: inline-flex; align-items: center; gap: 4px; padding: 0; color: #718098; background: transparent; border: 0; font-size: 13px; }
.comment-like span:first-child { font-size: 20px; line-height: 1; }
.comment-like.is-active { color: #2563dc; font-weight: 700; }
.reply-list { display: grid; gap: 13px; margin: 12px 0 0 36px; padding: 12px; background: #f7f9fc; border-left: 2px solid #d7e3f8; border-radius: 0 6px 6px 0; }
.reply-item > p { margin-left: 0; }
.reply-item .text-button { margin-left: 0; }
.reply-item .comment-actions { margin-left: 0; }
.reply-to { color: #61718a; }
.comments-empty { margin: 0; color: #8390a4; }
.comment-form { display: grid; gap: 10px; margin-top: 24px; padding-top: 17px; border-top: 1px solid #e7ecf3; }
.comment-form textarea { min-height: 74px; }
.reply-context { min-height: 18px; margin: 0; color: #52709b; font-size: 13px; }
.toast { position: fixed; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 20px); left: 16px; z-index: 10; max-width: 420px; margin: 0 auto; padding: 11px 14px; color: #fff; background: #24324a; border-radius: 7px; box-shadow: 0 8px 25px rgba(15, 23, 42, .18); font-size: 14px; opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity .18s ease, transform .18s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (min-width: 720px) {
  .app-shell { padding-right: 24px; padding-left: 24px; }
  .feed-toolbar { margin-right: -24px; margin-left: -24px; padding-right: 24px; padding-left: 24px; }
  .detail-modal { height: min(92vh, 860px); border-radius: 8px; }
}
