:root {
  --ink: #16181c;
  --muted: #7b818a;
  --paper: #ffffff;
  --soft: #f2f3f5;
  --line: #e6e8eb;
  --accent: #2787f5;
  --accent-dark: #126ed2;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #f5f6f8; }
button, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.shell { width: min(100%, 720px); min-height: 100vh; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 16px max(10px, env(safe-area-inset-bottom)); background: var(--paper); }
.source-context { margin-bottom: 10px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: 0 2px 8px rgba(20,28,38,.05); }
.source-channel { margin: 0 0 4px; color: var(--accent-dark); font-size: 12px; font-weight: 700; }
.source-title { margin: 0; font-size: 16px; line-height: 1.3; letter-spacing: -.01em; }
.source-excerpt { display: -webkit-box; margin: 5px 0 0; overflow: hidden; color: #4d535b; font-size: 13px; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.thread-bar { position: sticky; top: 0; z-index: 5; min-height: 58px; margin: 0 -16px; padding: max(10px, env(safe-area-inset-top)) 16px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); }
.thread-heading { display: flex; align-items: center; gap: 8px; min-width: 0; }
h1 { margin: 0; font-size: 20px; line-height: 1.2; letter-spacing: -.01em; }
.comment-count { min-width: 24px; padding: 2px 7px; border-radius: 999px; color: var(--muted); background: var(--soft); text-align: center; font-size: 12px; }
.icon-button { appearance: none; min-width: 34px; min-height: 34px; padding: 0 8px; border: 0; border-radius: 50%; color: var(--muted); background: transparent; font-weight: 700; letter-spacing: .06em; }
.icon-button:active { background: var(--soft); }

.notice { margin: 10px 0 2px; padding: 10px 12px; border-radius: 10px; color: #744c00; background: #fff4cf; font-size: 13px; line-height: 1.4; }
.thread { min-height: calc(100vh - 142px); }
.comments { display: grid; }
.comment { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; padding: 13px 0 12px; border-bottom: 1px solid var(--line); }
.comment.reply { margin-left: 30px; }
.comment.focused { border-radius: 10px; outline: 2px solid rgba(39,135,245,.35); outline-offset: 4px; }
.comment-avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #58a8ff, #7167e8); font-size: 14px; font-weight: 750; }
.comment-content { min-width: 0; }
.comment-head { min-height: 20px; display: flex; align-items: center; gap: 7px; }
.comment-author { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 700; }
.comment-time { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.comment-head .icon-button { min-width: 26px; min-height: 26px; margin: -4px -7px -4px 0; padding: 0 4px; font-size: 10px; }
.comment-body { margin: 3px 0 5px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.42; }
.comment-actions { min-height: 20px; display: flex; align-items: center; }
.link-button { appearance: none; padding: 2px 0; border: 0; color: var(--accent); background: transparent; font-size: 12px; font-weight: 650; text-decoration: none; }
.empty { padding: 34vh 16px 24px; color: var(--muted); text-align: center; font-size: 14px; }

.composer-dock { position: sticky; bottom: 0; z-index: 6; margin: 0 -16px; padding: 8px 16px max(8px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(14px); }
.reply-notification-offer { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; margin: 0 0 8px; padding: 10px; border: 1px solid #dce9f8; border-radius: 14px; background: #f7fbff; box-shadow: 0 2px 8px rgba(18,110,210,.06); }
.notification-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #e6f1ff; font-size: 16px; }
.notification-copy { min-width: 0; display: grid; gap: 2px; }
.notification-copy strong { font-size: 13px; line-height: 1.2; }
.notification-copy span { color: var(--muted); font-size: 11px; line-height: 1.3; }
.notification-button { min-height: 34px; padding: 0 13px; border: 0; border-radius: 999px; color: #fff; background: var(--accent); font-size: 12px; font-weight: 700; }
.notification-button:active { background: var(--accent-dark); }
.notification-button:disabled { opacity: .55; cursor: wait; }
.reply-banner { padding: 0 4px 7px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 7px 7px 7px 13px; border: 1px solid var(--line); border-radius: 22px; background: var(--soft); }
textarea { width: 100%; min-height: 24px; max-height: 120px; margin: 2px 0; padding: 0; resize: none; overflow-y: auto; border: 0; outline: 0; color: var(--ink); background: transparent; line-height: 1.45; }
textarea::placeholder { color: #9298a1; }
.send-stack { display: flex; align-items: center; gap: 5px; }
.counter { color: var(--muted); font-size: 10px; white-space: nowrap; }
.send-button { width: 32px; height: 32px; flex: 0 0 32px; padding: 0; border: 0; border-radius: 50%; color: white; background: var(--accent); font-size: 21px; font-weight: 700; line-height: 1; }
.send-button:active { background: var(--accent-dark); }
.send-button:disabled { opacity: .42; cursor: wait; }

.brand { font-size: 11px; letter-spacing: .16em; font-weight: 800; color: var(--accent); }
.legal { padding-top: max(22px, env(safe-area-inset-top)); line-height: 1.6; }
.legal h1 { margin-top: 8px; font-size: 30px; }
.legal h2 { margin-top: 1.8rem; }
.legal p, .legal li { color: #4d535b; }
footer { display: flex; justify-content: center; gap: 8px; padding: 28px 0; color: var(--muted); font-size: 13px; }

@media (max-width: 390px) {
  .reply-notification-offer { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 8px; padding: 9px; }
  .notification-icon { width: 30px; height: 30px; }
  .notification-button { padding: 0 10px; }
}

@media (min-width: 721px) {
  .shell { border-right: 1px solid var(--line); border-left: 1px solid var(--line); }
}

@media (prefers-reduced-motion: no-preference) {
  .comment { animation: appear .16s ease-out; }
  @keyframes appear { from { opacity: 0; transform: translateY(3px); } }
}
