:root {
  --bg: var(--tg-theme-bg-color, #f4f5f7);
  --text: var(--tg-theme-text-color, #17212b);
  --hint: var(--tg-theme-hint-color, #687684);
  --link: var(--tg-theme-link-color, #2481cc);
  --button: var(--tg-theme-button-color, #2481cc);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --secondary: var(--tg-theme-secondary-bg-color, #ffffff);
  --thread-line-color: rgba(36, 129, 204, .28);
  --low: #15803d;
  --medium: #a16207;
  --high: #b91c1c;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.app { width: 100%; max-width: 820px; margin: 0 auto; padding: env(safe-area-inset-top) 14px calc(16px + env(safe-area-inset-bottom)); }
.status, .post-card, .discussion, .comment, .branch-card, .analysis-card { background: var(--secondary); border-radius: 18px; padding: 14px; margin: 12px 0; box-shadow: 0 8px 22px rgba(0,0,0,.06); }
.dev-banner { position: sticky; top: 0; z-index: 5; text-align: center; padding: 8px; background: #facc15; color: #111827; font-weight: 800; }
.post-card img { width: 100%; border-radius: 14px; display: block; margin-bottom: 12px; }
.post-card h1 { font-size: 22px; margin: 8px 0; }
.post-card__meta, .comment__meta, .comment__parent, .comment__badge { color: var(--hint); font-size: 13px; }
.post-card__body.collapsed { max-height: 220px; overflow: hidden; position: relative; }
a { color: var(--link); }
button { border: 0; border-radius: 12px; background: var(--button); color: var(--button-text); padding: 9px 12px; font-weight: 650; cursor: pointer; }
button.secondary { background: transparent; color: var(--link); border: 1px solid var(--thread-line-color); }
.discussion__header { display: grid; gap: 10px; }
.discussion__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.branch-card__preview { color: var(--hint); }
.comment { position: relative; border-left: 4px solid transparent; }
.comment--mine { border-left-color: var(--button); }
.comment--highlight { outline: 3px solid rgba(36,129,204,.35); }
.comment__header { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.comment__number { font-weight: 800; color: var(--link); }
.comment__avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--thread-line-color); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.comment__text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 10px 0; }
.comment__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.comment__children { margin-left: 18px; padding-left: 14px; border-left: 2px solid var(--thread-line-color); }
.comment__children > .comment::before { content: ""; position: absolute; left: -16px; top: 30px; width: 14px; border-top: 2px solid var(--thread-line-color); }
.level-low { color: var(--low); }
.level-medium { color: var(--medium); }
.level-high { color: var(--high); }
.reply-panel { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; background: rgba(0,0,0,.35); }
.reply-panel__card { width: 100%; max-width: 820px; margin: 0 auto; padding: 16px; border-radius: 20px 20px 0 0; background: var(--secondary); }
.reply-panel textarea { width: 100%; resize: vertical; border: 1px solid var(--thread-line-color); border-radius: 12px; padding: 10px; background: var(--bg); color: var(--text); }
.reply-panel__actions { display: flex; justify-content: flex-end; gap: 8px; }
.error-text { color: var(--high); min-height: 1.2em; }
@media (max-width: 520px) { .comment__children { margin-left: 10px; padding-left: 10px; } .comment__children .comment__children .comment__children { margin-left: 0; } }
