:root {
  color-scheme: light;
  --page: #eef2ff;
  --post: #d6daf0;
  --post-alt: #dce0f3;
  --ink: #000;
  --link: #34345c;
  --green: #117743;
  --border: #b7c5d9;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body { min-width: 320px; background: var(--page); color: var(--ink); font: 13px Arial, Helvetica, sans-serif; }
button, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.chat-app { width: min(100%, 1000px); height: 100%; height: 100dvh; display: flex; flex-direction: column; margin: 0 auto; background: var(--page); }
.chat-header { height: 48px; flex: 0 0 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--border); }
.wordmark { color: #af0a0f; font-size: 20px; font-weight: bold; letter-spacing: -.5px; text-decoration: none; }
.header-right { display: flex; align-items: center; gap: 17px; }
.admin-button { padding: 4px 8px; border: 1px solid #b7c5d9; border-radius: 2px; background: #f7f8fc; color: #34345c; cursor: pointer; font-size: 11px; }
.admin-button:hover { background: #e6e9f4; }
.admin-button-primary { border-color: #789922; background: #d6daf0; font-weight: bold; }
.admin-message { min-height: 0; margin: 0; color: #a00; font-size: 11px; }
.admin-message:not(:empty) { min-height: 16px; }
.admin-dialog { width: min(360px, calc(100% - 28px)); padding: 0; border: 1px solid #9eacc1; background: #eef2ff; box-shadow: 0 8px 36px rgba(0, 0, 0, .28); }
.admin-dialog::backdrop { background: rgba(20, 25, 38, .45); }
.admin-login-form { display: grid; gap: 8px; padding: 18px; }
.admin-login-form h2 { margin: 0; color: #af0a0f; font-size: 18px; }
.admin-login-form p { margin: 0 0 4px; color: #555; font-size: 12px; }
.admin-login-form label { color: #333; font-size: 11px; font-weight: bold; }
.admin-login-form input { width: 100%; padding: 7px; border: 1px solid #b7c5d9; background: #fff; font: 13px Arial, Helvetica, sans-serif; }
.admin-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 5px; }
.connection { display: flex; align-items: center; gap: 6px; color: #555; font-size: 11px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #62a35b; }
.connection.error .status-dot { background: #b44; }

.chat-history { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; padding: 0 18px 14px; scroll-behavior: smooth; }
.room-strip { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border); }
.room-name { color: #333; font-size: 12px; font-weight: bold; }
.room-hash { color: #789922; }
.room-divider { padding: 0 4px; color: #888; font-weight: normal; }
.room-detail { color: #666; font-size: 10px; }
.room-detail span { color: var(--green); font-weight: bold; }
.history-toolbar { min-height: 34px; display: flex; align-items: center; justify-content: space-between; color: #333; font-size: 12px; }
.thread-number { color: #789922; font-weight: bold; }
.thread-description { color: #666; }
.feed { width: 100%; margin-top: auto; padding: 0 0 8px; }
.feed-placeholder { min-height: 110px; display: flex; align-items: center; justify-content: center; gap: 8px; color: #555; font-size: 12px; }
.loader { width: 12px; height: 12px; border: 2px solid #c4c9d8; border-top-color: #555; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { padding: 26px 12px; text-align: center; }
.empty-flower { margin-bottom: 4px; color: #789922; font-size: 18px; }
.empty-state h3 { margin: 0 0 5px; font-size: 15px; }
.empty-state p { margin: 0; color: #555; font-size: 12px; line-height: 1.5; }
.load-older { padding: 3px 7px; border: 1px solid #b7c5d9; background: #e6e9f4; color: var(--link); cursor: pointer; font-size: 11px; }
.load-older:hover { background: #d6daf0; }

.post { width: fit-content; max-width: 100%; min-width: min(360px, 100%); margin: 4px 0 6px; padding: 9px 11px; border: 1px solid #c4c9df; background: var(--post); scroll-margin-top: 10px; }
.post:nth-child(even) { background: var(--post-alt); }
.post:last-child { margin-bottom: 0; }
.post-header { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.avatar-mark { display: none; }
.post-author { overflow: hidden; color: var(--green); font-size: 12px; font-weight: bold; text-overflow: ellipsis; white-space: nowrap; }
.post-time { color: #555; font-size: 11px; white-space: nowrap; }
.post-number { color: #555; font-size: 11px; white-space: nowrap; }
.post-body { max-width: 760px; margin: 8px 0 0; color: #000; font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-body a { color: #34345c; text-decoration: underline; overflow-wrap: anywhere; }
.post-body strong { font-weight: 700; }
.post-body mark { padding: 0 .08em; color: inherit; }
.post-body code { padding: 1px 4px; border: 1px solid rgba(80, 80, 100, .16); background: rgba(255, 255, 255, .45); font: 12px monospace; }
.post-body .greentext { color: #789922; }
.post-reply-context { max-width: 760px; margin: 7px 0 0; padding: 4px 7px; border-left: 2px solid #789922; background: rgba(255, 255, 255, .32); color: #555; font-size: 11px; line-height: 1.45; }
.post-reply-context strong { color: var(--link); font-weight: normal; }
.post-actions { display: flex; justify-content: flex-end; margin-top: 5px; }
.post-moderation { display: flex; align-items: center; gap: 10px; margin-right: auto; color: #555; font-size: 10px; }
.moderation-button { padding: 0; border: 0; background: transparent; color: #900; cursor: pointer; font-size: 10px; }
.moderation-button:hover { text-decoration: underline; }
.reply-button { padding: 0; border: 0; background: transparent; color: var(--link); cursor: pointer; font-size: 11px; }
.reply-button:hover, .reply-button:focus-visible { text-decoration: underline; }

.chat-footer { flex: 0 0 auto; padding: 11px 18px max(13px, env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: #e6e9f4; }
.replying-to { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; padding: 6px 8px; border: 1px solid #c4c9df; background: var(--post); color: #444; font-size: 11px; }
.cancel-reply { padding: 0 4px; border: 0; background: transparent; color: #444; cursor: pointer; font-size: 16px; }
#post-form { width: min(100%, 700px); margin: 0 auto; padding: 8px; border: 1px solid #b7c5d9; background: #f7f8fc; }
#post-form:focus-within { border-color: #8398b2; }
.composer-label { margin: 0 0 5px; color: #333; font-size: 11px; font-weight: bold; }
.format-toolbar { min-height: 40px; display: flex; align-items: center; flex-wrap: wrap; gap: 2px; margin: 0 0 7px; padding: 4px; border: 1px solid #d7dce5; border-radius: 4px; background: linear-gradient(#fff, #f8f9fb); box-shadow: 0 1px 2px rgba(25, 35, 55, .05); }
.toolbar-group { min-height: 30px; position: relative; display: flex; align-items: center; gap: 2px; padding: 0 5px; border-right: 1px solid #e0e4eb; }
.toolbar-group:last-child { border-right: 0; }
.font-size-select { width: 67px; height: 29px; padding: 0 5px; border: 1px solid #e0e4eb; border-radius: 3px; background: #fff; color: #303745; font-size: 11px; }
.format-button { width: 29px; height: 29px; display: inline-grid; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 3px; background: transparent; color: #343a46; cursor: pointer; font: 13px Arial, Helvetica, sans-serif; }
.format-button:hover, .format-button:focus-visible, .format-button[aria-expanded="true"] { border-color: #c9d1df; background: #eef2f8; outline: none; }
.italic-button { font-family: Georgia, serif; }
.code-button { font-size: 10px; }
.link-button { font-size: 15px; }
.palette-control { position: relative; }
.color-toggle { position: relative; font-size: 15px; }
.color-indicator, .highlight-indicator { position: absolute; right: 5px; bottom: 3px; left: 5px; height: 3px; border-radius: 2px; background: linear-gradient(90deg, #b42318, #c45100, #947000, #26734d, #087e8b, #2457c5, #7047a3, #b42370); }
.highlight-toggle { font-size: 16px; }
.highlight-indicator { height: 4px; background: #ffe27a; }
.color-palette { position: absolute; z-index: 6; top: calc(100% + 7px); left: 0; width: 176px; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; justify-items: center; gap: 5px; padding: 9px; border: 1px solid #cbd2df; border-radius: 5px; background: #fff; box-shadow: 0 8px 24px rgba(25, 35, 55, .18); }
.palette-title { grid-column: 1 / -1; justify-self: start; padding: 0 0 3px; color: #4d5666; font-size: 10px; font-weight: bold; }
.color-swatch { width: 23px; height: 23px; padding: 0; border: 1px solid rgba(31, 41, 55, .18); border-radius: 50%; background: var(--swatch-color); cursor: pointer; }
.color-swatch:hover, .color-swatch:focus-visible { outline: 2px solid #6885b2; outline-offset: 2px; }
.highlight-palette { width: 146px; }
.emoji-control { position: relative; }
.emoji-picker { position: absolute; z-index: 6; bottom: 36px; left: 0; width: 208px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 6px; border: 1px solid #aebbd0; border-radius: 4px; background: #fff; box-shadow: 0 5px 18px rgba(25, 35, 55, .16); }
.emoji-picker button { min-height: 31px; border: 1px solid transparent; border-radius: 3px; background: transparent; cursor: pointer; font-size: 19px; }
.emoji-picker button:hover, .emoji-picker button:focus-visible { border-color: #b7c5d9; background: #e6e9f4; outline: none; }
textarea { display: block; width: 100%; min-height: 72px; max-height: 180px; resize: vertical; padding: 9px; border: 1px solid #b7c5d9; border-radius: 3px; outline: 0; background: #fff; color: #000; font: 13px Arial, Helvetica, sans-serif; line-height: 1.5; }
textarea::placeholder { color: #777; }
textarea:focus { border-color: #7f8da3; }
textarea:disabled { cursor: not-allowed; }
.composer-bottom, .composer-details { display: flex; align-items: center; }
.composer-bottom { justify-content: space-between; gap: 12px; padding-top: 7px; }
.composer-details { min-width: 0; gap: 10px; }
.identity-note { overflow: hidden; color: #555; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.character-count { flex: 0 0 auto; color: #666; font-size: 10px; }
.submit-button { min-width: 66px; padding: 5px 13px; border: 1px solid #aaa; border-radius: 2px; background: linear-gradient(#fff, #e8e8e8); color: #111; cursor: pointer; font-size: 12px; }
.submit-button:hover:not(:disabled) { background: #fff; }
.submit-button:disabled { cursor: not-allowed; opacity: .55; }
.composer-actions { display: flex; align-items: center; gap: 7px; }
.attach-button { padding: 6px 9px; border: 1px solid #bac5d6; border-radius: 2px; background: #fff; color: #354764; cursor: pointer; font-size: 11px; }
.attach-button:hover:not(:disabled) { background: #e9edf5; }
.attach-button:disabled { cursor: not-allowed; opacity: .55; }
.media-hint { margin: 5px 0 0; color: #818795; font-size: 10px; }
.attachment-preview { position: relative; width: fit-content; max-width: 100%; display: flex; align-items: center; gap: 9px; margin: 0 0 8px; padding: 5px 28px 5px 5px; border: 1px solid #c4c9df; background: #e4e7f5; }
.attachment-preview img { width: auto; max-width: 100px; height: 60px; object-fit: cover; }
.attachment-name { max-width: min(360px, 55vw); overflow: hidden; color: #555; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.remove-attachment { position: absolute; top: 3px; right: 4px; width: 20px; height: 20px; border: 0; background: transparent; color: #555; cursor: pointer; font-size: 17px; }
#post-form.dragging-file { outline: 2px dashed #60789b; outline-offset: 3px; background: #edf1f9; }
.form-message { min-height: 0; margin: 0; color: #a00; font-size: 11px; line-height: 1.5; }
.form-message:not(:empty) { min-height: 14px; margin-top: 6px; }
.form-message.success { color: #276339; }
.post-media-link { position: relative; display: block; width: fit-content; max-width: 100%; margin: 10px 0 2px; }
.post-media { display: block; width: auto; max-width: min(100%, 520px); max-height: 520px; border: 1px solid #b7c5d9; background: #fff; object-fit: contain; }
.gif-badge { position: absolute; top: 7px; left: 7px; padding: 3px 5px; background: rgba(0, 0, 0, .72); color: #fff; font-size: 10px; font-weight: bold; letter-spacing: .04em; }
.post:has(.post-media) .post-body { margin-top: 7px; }
.post:has(.post-media) .post-body[hidden] { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

.avatar-mark { width: 27px; height: 27px; display: grid; flex: 0 0 27px; overflow: hidden; place-items: center; border: 1px solid #bac5d6; border-radius: 50%; background: #f7f8fc; color: #536887; font-size: 10px; }
.avatar-mark img { width: 100%; height: 100%; object-fit: cover; }
.composer-details { flex-wrap: wrap; }
.identity-avatar { width: 22px; height: 22px; flex: 0 0 22px; border: 1px solid #bac5d6; border-radius: 50%; object-fit: cover; }
.name-button { padding: 0; border: 0; background: transparent; color: #34345c; cursor: pointer; font-size: 10px; text-decoration: underline; white-space: nowrap; }
.name-button:hover { color: #a20c11; }
.name-button:disabled { cursor: not-allowed; opacity: .5; }
.feature-hint { color: #818795; font-size: 9px; }
.draft-status { color: #68758a; font-size: 9px; }
.draft-status:not(:empty)::before { content: "· "; color: #9ba4b3; }
.avatar-edit-row { display: flex; align-items: center; gap: 8px; }
.avatar-preview-large, .avatar-placeholder { width: 54px; height: 54px; display: grid; flex: 0 0 54px; place-items: center; overflow: hidden; border: 1px solid #b7c5d9; border-radius: 50%; background: #f7f8fc; color: #536887; font-size: 20px; object-fit: cover; }
.avatar-placeholder[hidden], .avatar-preview-large[hidden] { display: none; }
.profile-picture-hint { color: #666; font-size: 10px; }

@media (max-width: 600px) {
  .chat-header { height: 43px; flex-basis: 43px; padding: 0 11px; }
  .wordmark { font-size: 18px; }
  .connection { font-size: 10px; }
  .chat-history { padding: 0 9px 10px; }
  .room-strip { min-height: 34px; }
  .room-detail { font-size: 9px; }
  .chat-footer { padding: 8px 9px max(9px, env(safe-area-inset-bottom)); }
  .post { min-width: min(280px, 100%); padding: 8px; }
}

@media (max-width: 370px) {
  .wordmark { font-size: 16px; }
  .room-detail { display: none; }
  .post-time { font-size: 10px; }
  .character-count { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Keep the imageboard layout quiet: make the posts and conversation tools the focus. */
.chat-app { width: min(100%, 1080px); border-right: 1px solid #d7ddeb; border-left: 1px solid #d7ddeb; background: #f7f8fc; }
.chat-header { height: 58px; flex-basis: 58px; padding: 0 24px; background: #f7f8fc; }
.wordmark { color: #a20c11; font-size: 22px; letter-spacing: -.7px; }
.header-right { gap: 12px; }
.connection { gap: 0; font-size: 0; }
.status-dot { width: 9px; height: 9px; }
.connection.error .status-dot { box-shadow: 0 0 0 3px rgba(180, 68, 68, .12); }
.chat-history { padding: 0 24px 20px; }
.history-toolbar { min-height: 54px; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid #cbd4e2; color: #555; }
.load-older { flex: 0 0 auto; padding: 6px 9px; border: 1px solid #b9c5d6; background: #fff; }
.saved-filter { flex: 0 0 auto; padding: 6px 9px; border: 1px solid #c2c8d9; background: #fff; color: #536887; cursor: pointer; font-size: 11px; }
.saved-filter:hover, .saved-filter[aria-pressed="true"] { border-color: #9eacc1; background: #e2e7f1; color: #34345c; }
.saved-filter:disabled { cursor: wait; opacity: .65; }
.search-box { min-width: 150px; width: min(260px, 34vw); height: 30px; display: flex; align-items: center; gap: 7px; margin-left: auto; padding: 0 8px; border: 1px solid #c7cfdd; background: #fff; color: #6e7785; font-size: 17px; }
.search-box:focus-within { border-color: #768aa7; box-shadow: 0 0 0 2px rgba(79, 105, 142, .1); }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: #222; font: 12px Arial, Helvetica, sans-serif; }
.search-box input::placeholder { color: #8b9098; }
.search-box input::-webkit-search-cancel-button { cursor: pointer; }
#clear-search { padding: 0 2px; border: 0; background: transparent; color: #666; cursor: pointer; font-size: 17px; }
.message-count { color: #777; font-size: 11px; white-space: nowrap; }
.jump-latest { flex: 0 0 auto; padding: 6px 9px; border: 1px solid #9eacc1; background: #e2e7f1; color: #34345c; cursor: pointer; font-size: 11px; font-weight: bold; }
.jump-latest:hover { background: #d6daf0; }
.feed { margin-top: 0; padding: 10px 0 8px; }
.post { width: 100%; min-width: 0; margin: 0 0 7px; padding: 12px 14px; border: 1px solid #c4c9df; background: #e4e7f5; }
.post:nth-child(even) { background: #eaecf7; }
.post:last-child { margin-bottom: 0; }
.post-header { gap: 9px; }
.post-author { font-size: 13px; }
.post-time, .post-number { color: #646978; font-size: 11px; }
.post-body { max-width: 840px; margin-top: 9px; font-size: 14px; line-height: 1.6; }
.post-reply-context { max-width: 840px; margin-top: 8px; padding: 6px 9px; }
.reply-parent-link { color: #39724e; font-weight: 650; text-decoration: none; }
.reply-parent-link:hover, .reply-parent-link:focus-visible { color: #245a38; text-decoration: underline; outline: none; }
.post-actions { margin-top: 7px; }
.reply-button { padding: 4px 8px; border: 1px solid #c2c8d9; background: rgba(255, 255, 255, .5); font-size: 11px; }
.reply-button:hover, .reply-button:focus-visible { background: #fff; text-decoration: none; }
.bookmark-button.is-saved { color: #8a6415; font-weight: bold; }
.copy-link-button { color: #536887; }
.empty-state { padding: 42px 12px; color: #555; }
.empty-state h3 { color: #333; font-size: 16px; }
.empty-state p { max-width: 460px; margin: 0 auto; color: #666; }
.chat-footer { padding: 12px 24px max(14px, env(safe-area-inset-bottom)); border-top: 1px solid #c5cddd; background: #e9ecf6; }
#post-form { width: min(100%, 900px); padding: 10px; border-color: #bac5d6; background: #f8f9fc; }
.composer-label { margin-bottom: 7px; color: #343b48; font-size: 12px; }
.format-toolbar { gap: 4px; margin-bottom: 7px; }
.format-button { width: 29px; height: 27px; border-color: #d8dce5; background: #fff; }
.format-button:hover, .format-button:focus-visible { border-color: #8d9bb0; background: #e9edf5; }
textarea { min-height: 68px; padding: 9px; border-color: #bac5d6; font-size: 14px; }
.composer-bottom { padding-top: 9px; }
.media-hint { font-size: 10px; }
.submit-button { min-width: 76px; padding: 7px 16px; border-color: #536887; background: #5e7395; color: #fff; font-size: 12px; font-weight: bold; }
.submit-button:hover:not(:disabled) { background: #485f82; }
.identity-note { color: #5c6573; }
.character-count { color: #818795; }
.form-message { font-size: 11px; }

@media (max-width: 600px) {
  .chat-header { height: 52px; flex-basis: 52px; padding: 0 12px; }
  .wordmark { font-size: 19px; }
  .chat-history { padding: 0 10px 12px; }
  .history-toolbar { min-height: 48px; gap: 7px; }
  .search-box { min-width: 100px; width: auto; flex: 1 1 120px; }
  .message-count { font-size: 10px; }
  .load-older { padding: 6px; font-size: 10px; }
  .saved-filter { padding: 6px; font-size: 10px; }
  .chat-footer { padding: 9px 10px max(10px, env(safe-area-inset-bottom)); }
  #post-form { padding: 8px; }
  .post { padding: 10px; }
  .post-media { max-width: 100%; max-height: 360px; }
  .media-hint { line-height: 1.4; }
  .attach-button span { display: none; }
  .identity-note { max-width: 155px; }
  .avatar-edit-row { flex-wrap: wrap; }
}

@media (max-width: 390px) {
  .wordmark { font-size: 17px; }
  .history-toolbar { flex-wrap: wrap; padding: 6px 0; }
  .search-box { order: 2; flex-basis: 100%; }
  .message-count { margin-left: auto; }
  .post-time { font-size: 9px; }
}

.notification-button { position: relative; min-width: 30px; height: 29px; border: 1px solid #b7c5d9; border-radius: 2px; background: #f7f8fc; color: #34345c; cursor: pointer; font-size: 15px; }
.notification-button:hover, .notification-button[aria-expanded="true"] { background: #e6e9f4; }
.notification-count { position: absolute; top: -6px; right: -7px; min-width: 16px; height: 16px; display: grid; place-items: center; padding: 0 3px; border: 1px solid #fff; border-radius: 10px; background: #ae171b; color: #fff; font-size: 9px; font-weight: bold; }
.notification-panel { position: fixed; z-index: 5; top: 64px; right: max(15px, calc((100vw - 1080px) / 2)); width: min(330px, calc(100vw - 24px)); max-height: min(440px, calc(100vh - 80px)); overflow: auto; border: 1px solid #9eacc1; background: #f7f8fc; box-shadow: 0 6px 22px rgba(0, 0, 0, .18); }
.notification-heading { display: flex; align-items: center; justify-content: space-between; padding: 10px; border-bottom: 1px solid #cbd4e2; color: #343b48; font-size: 12px; }
.notification-clear { padding: 0; border: 0; background: transparent; color: #34345c; cursor: pointer; font-size: 10px; text-decoration: underline; }
.notification-empty { margin: 0; padding: 18px 12px; color: #666; font-size: 11px; line-height: 1.5; }
.notification-item { width: 100%; display: grid; gap: 4px; padding: 10px; border: 0; border-bottom: 1px solid #e0e3eb; background: transparent; cursor: pointer; text-align: left; }
.notification-item:hover { background: #eaecf7; }
.notification-item.is-unread { border-left: 3px solid #647c9f; background: #edf0f8; }
.notification-item-title { color: #275f39; font-size: 11px; font-weight: bold; }
.notification-item-excerpt { overflow: hidden; color: #333; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.notification-item-time { color: #777; font-size: 10px; }
.edited-label { color: #777; font-size: 10px; font-style: italic; }
.edit-message-input { min-height: 64px; margin-top: 8px; }
.edit-actions { display: flex; justify-content: flex-end; gap: 7px; }
.reaction-bar { position: relative; display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.reaction-chip, .reaction-add { min-height: 25px; padding: 3px 7px; border: 1px solid #c2c8d9; border-radius: 12px; background: rgba(255, 255, 255, .62); cursor: pointer; font-size: 11px; }
.reaction-chip:hover, .reaction-add:hover { border-color: #8397b1; background: #fff; }
.reaction-chip.is-reacted { border-color: #7187a4; background: #d6e0f0; color: #243a5c; font-weight: bold; }
.reaction-add { min-width: 26px; padding: 2px 6px; color: #536887; font-size: 14px; }
.reaction-add-wrap { position: relative; }
.reaction-picker { position: absolute; z-index: 2; bottom: 30px; left: 0; display: grid; grid-template-columns: repeat(4, 34px); gap: 3px; padding: 5px; border: 1px solid #aebbd0; background: #f7f8fc; box-shadow: 0 3px 12px rgba(0, 0, 0, .15); }
.reaction-picker button { height: 31px; border: 1px solid transparent; background: transparent; cursor: pointer; font-size: 17px; }
.reaction-picker button:hover { border-color: #b7c5d9; background: #e6e9f4; }
.notification-highlight { animation: notification-flash 1.8s ease; }
@keyframes notification-flash { 0%, 100% { outline: 0 solid transparent; } 20%, 70% { outline: 3px solid #8298b6; outline-offset: 2px; } }
.gif-toggle { width: 31px; font-size: 10px; font-weight: bold; }
.gif-toggle:disabled { cursor: not-allowed; opacity: .5; }
.gif-dialog { width: min(660px, calc(100% - 24px)); max-width: 660px; max-height: min(680px, calc(100vh - 28px)); }
.gif-search-dialog { display: grid; gap: 10px; padding: 15px; }
.gif-dialog-heading { display: flex; align-items: center; justify-content: space-between; }
.gif-dialog-heading h2 { margin: 0; color: #af0a0f; font-size: 18px; }
.dialog-close { width: 28px; height: 28px; border: 1px solid #b7c5d9; background: #fff; color: #444; cursor: pointer; font-size: 20px; }
#gif-search-form { display: flex; gap: 7px; }
#gif-search-form input { min-width: 0; flex: 1; padding: 8px; border: 1px solid #b7c5d9; background: #fff; font: 13px Arial, Helvetica, sans-serif; }
.gif-message { min-height: 14px; margin: 0; color: #555; font-size: 11px; }
.gif-results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; max-height: 410px; overflow: auto; }
.gif-result-card { min-width: 0; overflow: hidden; border: 1px solid #b7c5d9; background: #fff; }
.gif-result { min-height: 90px; overflow: hidden; padding: 0; border: 1px solid #b7c5d9; background: #fff; cursor: pointer; }
.gif-result:hover, .gif-result:focus-visible { outline: 2px solid #647c9f; outline-offset: 1px; }
.gif-result img { width: 100%; height: 120px; display: block; object-fit: cover; }
.gif-result-card .gif-result { width: 100%; display: block; border: 0; }
.media-attribution { display: block; overflow: hidden; padding: 5px 6px; color: #536887; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.media-attribution { width: fit-content; padding: 3px 0 0; }
.edit-actions { margin-top: 7px; }

@media (max-width: 600px) {
  .notification-panel { top: 58px; right: 8px; }
}

@media (max-width: 520px) {
  .gif-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gif-result img { height: 105px; }
}

:root {
  --page: #f3f5f2;
  --post: #fff;
  --post-alt: #fff;
  --ink: #202923;
  --link: #315c4a;
  --green: #347451;
  --border: #e1e6e1;
}

body { background: #f3f5f2; color: #202923; font-family: Inter, "Segoe UI", Arial, sans-serif; }
.chat-app { width: min(100%, 1120px); border: 0; background: #f7f8f6; box-shadow: 0 0 48px rgba(32, 48, 37, .055); }
.chat-header { height: 64px; flex-basis: 64px; padding: 0 30px; border-color: #e8ebe7; background: rgba(255, 255, 255, .94); }
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: #244b38; font-size: 20px; font-weight: 750; letter-spacing: -.7px; }
.wordmark::before { width: 27px; height: 27px; display: inline-grid; place-items: center; border-radius: 9px; background: #e7f1e9; content: "🌱"; font-size: 15px; }
.header-right { gap: 10px; }
.notification-button, .admin-button { min-height: 34px; border: 1px solid #e1e6e1; border-radius: 8px; background: #fff; color: #455349; }
.notification-button:hover, .notification-button[aria-expanded="true"], .admin-button:hover { border-color: #cddbcf; background: #f2f7f2; }
.connection { font-size: 11px; }
.status-dot { box-shadow: 0 0 0 4px #e7f2e9; }

.chat-history { padding: 0 30px 20px; }
.history-toolbar { position: sticky; z-index: 2; top: 0; min-height: 62px; padding: 0 0 10px; border-bottom-color: #e6eae5; background: #f7f8f6; }
.search-box { width: min(320px, 36vw); height: 36px; border-color: #e0e5df; border-radius: 9px; background: #fff; }
.search-box:focus-within { border-color: #8caf94; box-shadow: 0 0 0 3px rgba(76, 133, 89, .1); }
.saved-filter, .load-older, .jump-latest { min-height: 34px; border-color: #e0e5df; border-radius: 8px; background: #fff; color: #506154; }
.saved-filter:hover, .saved-filter[aria-pressed="true"], .load-older:hover, .jump-latest:hover { border-color: #c9dccb; background: #edf5ed; color: #315c3d; }
.message-count { color: #7e887f; }
.feed { padding-top: 15px; }
.post { position: relative; margin-bottom: 8px; padding: 12px 16px 10px; border: 1px solid #e6eae5; border-radius: 12px; background: #fff; box-shadow: 0 2px 8px rgba(38, 54, 41, .035); transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.post:nth-child(even) { background: #fff; }
.post:hover { border-color: #d7e2d7; box-shadow: 0 5px 16px rgba(38, 54, 41, .07); transform: translateY(-1px); }
.post-header { align-items: center; gap: 9px; }
.avatar-mark { width: 31px; height: 31px; flex-basis: 31px; border-color: #e3eae2; background: #f0f5ee; color: #54715a; }
.post-author { color: #316d49; font-size: 13px; }
.post-time, .post-number { color: #879087; font-size: 11px; }
.post-number { margin-left: auto; padding: 3px 7px; border-radius: 20px; background: #f3f5f2; color: #6c786e; }
.post-body { margin: 7px 0 0 40px; color: #28322b; font-size: 14px; line-height: 1.55; }
.post-reply-context { margin: 6px 0 0 40px; border-radius: 0 8px 8px 0; border-left-color: #75a17b; background: #f4f8f2; }
.reaction-bar { margin: 6px 0 0 40px; }
.post-actions { margin: 5px 0 0 40px; }
.post-actions button { min-height: 28px; padding: 4px 9px; border: 1px solid #e5e9e4; border-radius: 7px; background: #fff; color: #657267; }
.post-actions button:hover { border-color: #cddccd; background: #f4f8f3; color: #315c3d; }

.chat-footer { padding: 12px 30px max(18px, env(safe-area-inset-bottom)); border-top: 1px solid #e5e9e4; background: rgba(255, 255, 255, .97); }
#post-form { width: min(100%, 940px); padding: 14px; border: 1px solid #e1e7e0; border-radius: 14px; background: #fff; box-shadow: 0 8px 28px rgba(34, 52, 38, .08); }
#post-form:focus-within { border-color: #b8d0b9; box-shadow: 0 8px 30px rgba(34, 80, 45, .1), 0 0 0 3px rgba(76, 133, 89, .08); }
.composer-label { margin: 0 0 10px; color: #26392d; font-size: 14px; font-weight: 700; letter-spacing: -.15px; }
.format-toolbar { min-height: 44px; flex-wrap: nowrap; gap: 3px; margin-bottom: 9px; padding: 5px 7px; overflow-x: auto; border: 1px solid #e8ece7; border-radius: 9px; background: #f8f9f7; box-shadow: none; scrollbar-width: thin; }
.toolbar-group { min-height: 31px; flex: 0 0 auto; gap: 3px; padding: 0 7px; border-right-color: #e1e6df; }
.toolbar-group:first-child { padding-left: 0; }
.toolbar-group:last-child { padding-right: 0; }
.font-size-select { width: 76px; height: 31px; border-color: #e1e6df; border-radius: 6px; color: #48564b; }
.format-button { width: 31px; height: 31px; border-color: transparent; border-radius: 6px; background: transparent; color: #48544a; transition: background .14s ease, border-color .14s ease, color .14s ease; }
.format-button:hover, .format-button:focus-visible, .format-button[aria-expanded="true"] { border-color: #d8e4d8; background: #eaf2e9; color: #285c39; }
.color-palette, .emoji-picker { border-color: #e0e6df; border-radius: 10px; box-shadow: 0 12px 32px rgba(32, 48, 37, .16); }
textarea { min-height: 76px; padding: 12px 13px; border-color: #e5e9e4; border-radius: 9px; background: #fff; color: #26312a; font-family: inherit; font-size: 14px; line-height: 1.6; }
textarea:focus { border-color: #8caf94; box-shadow: 0 0 0 3px rgba(76, 133, 89, .09); }
textarea::placeholder { color: #9aa39a; }
.composer-bottom { padding-top: 10px; }
.composer-details { gap: 9px; }
.identity-note { color: #707c72; }
.name-button { color: #3d7450; font-weight: 600; }
.character-count { color: #8c968d; }
.submit-button { min-height: 36px; min-width: 84px; border: 1px solid #2f6a44; border-radius: 8px; background: #34764b; color: #fff; font-size: 12px; font-weight: 700; box-shadow: 0 2px 4px rgba(33, 84, 48, .15); }
.submit-button:hover:not(:disabled) { background: #28643d; }
.attach-button { min-height: 36px; padding: 6px 11px; border-color: #e0e7df; border-radius: 8px; color: #526657; }
.attach-button:hover:not(:disabled) { background: #f2f7f1; }
.media-hint { margin: 8px 2px 0; color: #89938a; }
.form-message:not(:empty) { padding: 7px 10px; border-radius: 7px; background: #fff3f1; }
.form-message.success:not(:empty) { background: #edf7ed; }

@media (max-width: 700px) {
  .chat-header { padding: 0 16px; }
  .chat-history { padding: 0 16px 14px; }
  .chat-footer { padding: 10px 12px max(12px, env(safe-area-inset-bottom)); }
  .post { padding: 13px 12px 11px; border-radius: 10px; }
  .post-body, .post-reply-context, .post-actions, .reaction-bar { margin-left: 0; }
}

@media (max-width: 520px) {
  .chat-header { height: 56px; flex-basis: 56px; }
  .wordmark { font-size: 17px; }
  .wordmark::before { width: 25px; height: 25px; }
  .header-right { gap: 7px; }
  .history-toolbar { min-height: 55px; }
  .format-toolbar { margin-right: -2px; margin-left: -2px; }
  #post-form { padding: 11px; border-radius: 12px; }
  .composer-bottom { align-items: flex-end; }
  .composer-details { gap: 6px; }
  .identity-note { max-width: 170px; }
  .composer-actions { gap: 5px; }
}

.gif-dialog {
  height: min(680px, calc(100vh - 28px));
  height: min(680px, calc(100dvh - 28px));
  max-height: calc(100vh - 28px);
  max-height: calc(100dvh - 28px);
  padding: 0;
  overflow: clip;
}
.gif-search-dialog {
  height: 100%;
  min-height: 0;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  box-sizing: border-box;
}
.gif-results {
  min-height: 0;
  align-content: start;
  grid-auto-rows: max-content;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (max-height: 480px) {
  .gif-dialog { height: calc(100vh - 16px); height: calc(100dvh - 16px); max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); }
  .gif-search-dialog { gap: 6px; padding: 10px; }
}

.composer-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.composer-heading .composer-label { margin-bottom: 10px; }
.preview-toggle { margin: 0 0 8px; padding: 5px 9px; border: 1px solid #e1e6e1; border-radius: 6px; background: #fff; color: #506154; cursor: pointer; font-size: 11px; }
.preview-toggle:hover, .preview-toggle[aria-pressed="true"] { border-color: #c9dccb; background: #edf5ed; color: #315c3d; }
.emoji-picker { position: fixed; z-index: 20; width: min(360px, calc(100vw - 32px)); height: min(390px, calc(100dvh - 190px)); display: block; padding: 0; border: 1px solid #e0e6df; border-radius: 10px; background: #fff; box-shadow: 0 12px 32px rgba(32, 48, 37, .16); --background: #fff; --border-color: #e0e6df; --category-emoji-size: 18px; --emoji-size: 21px; --input-border-color: #e0e6df; --input-border-radius: 7px; --input-font-color: #28322b; --input-placeholder-color: #89938a; --indicator-color: #34764b; --button-hover-background: #edf5ed; --category-font-color: #47564a; }
.format-toolbar { flex-wrap: wrap; overflow: visible; }
.color-palette { top: auto; bottom: calc(100% + 7px); }
.emoji-picker:not(:defined) { display: grid; place-items: center; padding: 16px; color: #707c72; font-size: 12px; }
.poll-toggle { min-height: 29px; padding: 0 9px; border: 1px solid #e1e6e1; border-radius: 6px; background: #fff; color: #506154; cursor: pointer; font-size: 11px; white-space: nowrap; }
.poll-toggle:hover, .poll-toggle[aria-expanded="true"] { border-color: #c9dccb; background: #edf5ed; color: #315c3d; }
.composer-preview { min-height: 76px; max-height: 180px; overflow: auto; padding: 12px 13px; border: 1px solid #e5e9e4; border-radius: 9px; background: #fff; color: #28322b; font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.composer-preview:empty::before { color: #9aa39a; content: "Nothing to preview yet."; }
.poll-editor { display: grid; gap: 8px; margin: 8px 0; padding: 11px; border: 1px solid #e1e7e0; border-radius: 9px; background: #f8faf7; }
.poll-editor-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px; color: #34483a; font-size: 12px; }
.poll-editor-heading span { color: #7b867c; font-size: 10px; }
.poll-option-inputs { display: grid; gap: 6px; }
.poll-option-row { display: flex; gap: 6px; }
.poll-option-row input { min-width: 0; flex: 1; height: 34px; padding: 7px 9px; border: 1px solid #dfe6de; border-radius: 6px; background: #fff; color: #28322b; font: inherit; font-size: 12px; }
.poll-remove-option, .poll-add-option { border: 1px solid #dfe6de; border-radius: 6px; background: #fff; color: #526657; cursor: pointer; }
.poll-remove-option { width: 34px; font-size: 17px; }
.poll-add-option { justify-self: start; padding: 6px 9px; font-size: 11px; }
.poll-remove-option:hover, .poll-add-option:hover { border-color: #c9dccb; background: #edf5ed; }
.poll-card { max-width: 560px; margin: 10px 0 0 40px; padding: 12px; border: 1px solid #e2e9e1; border-radius: 10px; background: #fbfcfa; }
.poll-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; color: #425547; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.poll-vote-total { color: #7b867c; font-size: 10px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.poll-options { display: grid; gap: 6px; }
.poll-option { position: relative; min-height: 37px; display: flex; align-items: center; gap: 8px; overflow: hidden; padding: 7px 9px; border: 1px solid #e2e8e1; border-radius: 7px; background: #fff; color: #344238; cursor: pointer; text-align: left; }
.poll-option:hover { border-color: #bfd4c0; background: #f7fbf6; }
.poll-option[aria-pressed="true"] { border-color: #86b18d; box-shadow: 0 0 0 2px rgba(76, 133, 89, .08); }
.poll-option-bar { position: absolute; inset: 0 auto 0 0; z-index: 0; background: #e8f2e6; pointer-events: none; }
.poll-option-label, .poll-option-result { position: relative; z-index: 1; }
.poll-option-label { min-width: 0; flex: 1; overflow-wrap: anywhere; font-size: 12px; }
.poll-option-result { color: #68766b; font-size: 11px; white-space: nowrap; }
.poll-vote-button { min-height: 32px; margin-top: 8px; padding: 6px 12px; border: 1px solid #34764b; border-radius: 7px; background: #34764b; color: #fff; cursor: pointer; font-size: 11px; font-weight: 650; }
.poll-vote-button:hover:not(:disabled) { background: #28643d; }
.poll-vote-button:disabled { cursor: not-allowed; opacity: .55; }
.delete-own-button { color: #a1443c !important; }
.delete-own-button:hover, .delete-own-button:focus-visible { border-color: #efd0cc !important; background: #fff5f3 !important; color: #8d3029 !important; }

@media (max-width: 600px) {
  .poll-card { margin-left: 0; }
  .emoji-picker { height: min(390px, calc(100dvh - 220px)); }
}
