:root {
  color-scheme: dark;
  --bg-base: #0e1621;
  --surface: #172432;
  --surface-strong: #1c2a3a;
  --input: #111d2a;
  --stroke: #8db4d226;
  --stroke-bright: #adcde352;
  --text-primary: #f2f7fc;
  --text-secondary: #9db1c4;
  --text-muted: #8299ae;
  --accent-primary: #2ea6ff;
  --accent-rose: #ff829b;
  --accent-amber: #f2c07c;
  --accent-emerald: #73d6b1;
  --safe-top: max(var(--tg-inset-top, 0px), env(safe-area-inset-top, 0px));
  --safe-bottom: max(var(--tg-inset-bottom, 0px), env(safe-area-inset-bottom, 0px));
  --safe-left: max(var(--tg-inset-left, 0px), env(safe-area-inset-left, 0px));
  --safe-right: max(var(--tg-inset-right, 0px), env(safe-area-inset-right, 0px));
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  --radius: 25px;
}

[data-theme-accent="cyan"] { --accent-primary: #53d2ee; }
[data-theme-accent="purple"] { --accent-primary: #b691ff; }
[data-theme-accent="emerald"] { --accent-primary: #52d4a9; }
[data-theme-accent="rose"] { --accent-primary: #fb8eaa; }
[data-theme-accent="amber"] { --accent-primary: #f5bc63; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg-base); }
body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;
  color: var(--text-primary);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; }
button {
  color: inherit;
  background: none;
  padding: 0;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}
a { color: inherit; }
button:disabled { opacity: .56; cursor: default; }
:where(button, a, input, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 3px;
}
p, h1, h2, h3 { margin: 0; }
.muted { color: var(--text-muted); }
.tg-icon { display: inline-block; flex: none; width: 20px; height: 20px; vertical-align: middle; }
.icon-xs { width: 14px; height: 14px; }
.icon-sm { width: 17px; height: 17px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 23px; height: 23px; }
.icon-xl { width: 30px; height: 30px; }
.icon-verify { color: var(--accent-primary); }

.archive-wallpaper, .archive-snow {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
.archive-wallpaper {
  background: #0e1621 url("./coso-wallpaper.webp") 0 0 / 420px auto repeat;
}
.archive-snow { z-index: 1; display: block; width: 100%; height: 100%; }

.app-container {
  position: relative;
  z-index: 2;
  width: min(100%, 720px);
  margin-inline: auto;
  padding: calc(12px + var(--safe-top)) max(16px, var(--safe-right))
           calc(103px + var(--safe-bottom)) max(16px, var(--safe-left));
}
.app-header, .bottom-nav, .chat-view-header, .media-sheet {
  background: #172432;
  border: 1px solid var(--stroke);
  box-shadow: inset 0 1px #e6f4ff21, 0 9px 28px #050b154d;
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .app-header, .bottom-nav, .chat-view-header, .media-sheet {
    background: linear-gradient(155deg, #2b435bb5, #172432db 44%, #13202de8);
    -webkit-backdrop-filter: blur(13px) saturate(135%);
    backdrop-filter: blur(13px) saturate(135%);
  }
}
.app-header {
  position: sticky;
  top: calc(8px + var(--safe-top));
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 80px;
  padding: 10px 12px 10px 18px;
  border-radius: 29px;
}
.header-brand { color: #a7c7de; font-size: 12px; font-weight: 650; }
.header-title { font-size: clamp(22px, 5.5vw, 29px); line-height: 1.15; letter-spacing: -.035em; font-weight: 720; }
.header-right, .chat-view-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.icon-btn, .sheet-close-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--stroke);
  color: #cfe7f8;
  background: #c2e6ff10;
}
.icon-btn:active, .sheet-close-btn:active { background: #c2e6ff26; }
.spinning .tg-icon, .btn-spinner { animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.user-block {
  margin: 14px 0 24px;
  padding: 8px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  border-radius: 19px;
  background: #172432ed;
  border: 1px solid var(--stroke);
}
.avatar-wrap {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: #38536a;
}
#user-avatar-initial { font-weight: 680; color: #e8f4ff; }
.user-avatar { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.user-meta { min-width: 0; }
.user-name-row { display: flex; align-items: center; gap: 5px; }
.user-name { font-size: 14px; font-weight: 680; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-id-btn { display: flex; align-items: center; gap: 5px; color: var(--text-secondary); font: 11px/1.6 var(--mono); }

.app-content { position: relative; }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: tab-in .22s cubic-bezier(.22,.75,.32,1); }
.tab-pane.tab-leaving {
  display: block;
  position: absolute;
  inset: 0 0 auto;
  pointer-events: none;
  animation: tab-out .18s ease both;
}
@keyframes tab-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes tab-out {
  to { opacity: 0; transform: translateY(-5px); }
}
.app-container:not([hidden]), .tg-stub-card { animation: app-in .22s ease-out; }
.app-container.app-leaving { animation: app-out .17s ease both; pointer-events: none; }
@keyframes app-in { from { opacity: 0; } }
@keyframes app-out { to { opacity: 0; } }
.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-inline: 3px;
  margin-bottom: 10px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 730;
  letter-spacing: .075em;
}
.badge-count, .chat-date-bubble {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 3px 8px;
  min-width: 25px;
  justify-content: center;
  border-radius: 999px;
  font-weight: 650;
  letter-spacing: 0;
  color: #cbe4f7;
  background: #284259;
  font-size: 11px;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}
.search-box, .chat-search-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  border: 1px solid var(--stroke);
  background: var(--input);
  border-radius: 17px;
}
.search-box { margin-bottom: 13px; padding: 0 10px 0 13px; }
.search-box input, .chat-search-bar input {
  min-width: 0;
  flex: 1;
  height: 46px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--text-primary);
  outline: none;
  font-size: 16px;
}
.search-box:focus-within, .chat-search-bar:focus-within { border-color: var(--accent-primary); }
input::placeholder, textarea::placeholder { color: var(--text-muted); }
.search-icon, .clear-btn { color: var(--text-secondary); }
.clear-btn { display: grid; place-items: center; width: 30px; height: 34px; }
.filter-pills-row, .chat-filter-bar {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-pills-row::-webkit-scrollbar, .chat-filter-bar::-webkit-scrollbar { display: none; }
.filter-pills-row { margin-bottom: 12px; padding: 1px 2px 4px; }
.filter-pill, .chat-filter-chip, .track-chip, .chip {
  border: 1px solid var(--stroke);
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--text-secondary);
  background: #182737;
  font-size: 13px;
  font-weight: 630;
  white-space: nowrap;
}
.filter-pill.active, .chat-filter-chip.active, .track-chip.active, .chip.active {
  color: #ecf8ff;
  background: #224661;
  border-color: #69bbef57;
}
.chat-filter-chip { display: inline-flex; gap: 5px; align-items: center; }

.native-card, .deleted-card, .expiring-card, .cmd-card {
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
}
.native-card { overflow: hidden; }
.native-card:has(.chats-list:empty) { display: none; }
.chats-list { display: grid; }
.chat-item {
  display: flex;
  align-items: center;
  min-width: 0;
  width: 100%;
  min-height: 70px;
  gap: 11px;
  padding: 10px 13px;
  text-align: left;
}
.chat-item + .chat-item { border-top: 1px solid var(--stroke); }
.chat-item:active, .clickable:active { background: #21394d; }
.chat-avatar-wrap {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  overflow: hidden;
  color: #e8f4ff;
  border: 1px solid #a9d8fa2f;
  border-radius: 50%;
  background: #355976;
}
.chat-item:nth-child(3n + 2) .chat-avatar-wrap { background: #385d60; }
.chat-item:nth-child(3n) .chat-avatar-wrap { background: #514968; }
.chat-avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.chat-avatar-fallback { font-size: 16px; font-weight: 680; }
.chat-meta { flex: 1; min-width: 0; }
.chat-meta-top, .chat-meta-bottom { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.chat-title, .chat-last-msg, .deleted-author, .deleted-uname, .expiring-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-title, .deleted-author { font-size: 15px; font-weight: 670; }
.chat-time, .deleted-time { color: var(--text-muted); flex: none; font-size: 11px; font-variant-numeric: tabular-nums; }
.chat-last-msg { color: var(--text-secondary); font-size: 13px; }
.chat-last-msg .tg-icon { margin-right: 1px; }
.chat-dead-badge { flex: none; color: var(--accent-rose); font-size: 10px; white-space: nowrap; }
.compact-mode .chat-item { min-height: 57px; padding-block: 6px; }
.compact-mode .chat-avatar-wrap { width: 36px; height: 36px; }

.deleted-feed {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}
.deleted-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: #182737;
}
.deleted-card--wide { grid-column: 1 / -1; }
.deleted-card--deleted { background: #1b2837; }
.deleted-card--edited { background: #172b3b; }
.deleted-card--focus { border-color: var(--accent-primary); box-shadow: inset 0 0 0 1px #68bcff42; }
.deleted-card-head, .deleted-user-wrap { min-width: 0; display: flex; align-items: center; gap: 9px; }
.deleted-user-wrap .chat-avatar-wrap { width: 36px !important; height: 36px !important; }
.deleted-author-info, .deleted-author-name-row { min-width: 0; }
.deleted-author-name-row { display: flex; align-items: baseline; gap: 6px; }
.deleted-uname { font-size: 11px; color: var(--text-muted); }
.deleted-head-right { display: flex; flex-wrap: wrap; gap: 5px; }
.deleted-badge, .bubble-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
}
.deleted-badge.del, .chip-deleted { color: #ff9aab; background: #ff648521; }
.deleted-badge.edit, .chip-edited { color: #ffce95; background: #ffbc6620; }
.deleted-badge.media { color: #a8d7fb; background: #2681bf30; }
.deleted-card-body, .edit-version-text, .bubble-text {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.deleted-card-body { font-size: 14px; }
.deleted-card--wide .deleted-card-body { font-size: 15px; }
.archive-attachment {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 15px;
  color: #b8dbf7;
  background: #27455c;
  font-size: 13px;
  font-weight: 650;
}
.history-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  margin-top: auto;
  min-height: 30px;
  color: #a8d7fb;
  font-size: 12px;
  text-align: left;
}
.expired-alert-banner {
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  color: #f2d4a9;
  background: #3e342a;
  font-size: 12px;
}
.load-more-wrap { text-align: center; margin-top: 14px; }
.expiring-list, .commands-list { display: grid; gap: 9px; }
.expiring-card, .cmd-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px; }
.expiring-left, .cmd-meta, .expiring-meta { min-width: 0; }
.expiring-left { display: flex; align-items: center; gap: 10px; }
.expiring-meta { display: grid; }
.expiring-title { font-weight: 650; }
.expiring-timer { font-size: 12px; color: var(--accent-amber); }
.expiring-icon-box, .setting-icon-box, .media-banner-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 39px;
  height: 39px;
  border-radius: 13px;
  color: #a3d8ff;
  background: #29455d;
}
.expiring-icon-box { color: #ffce95; background: #47392e; }
.cmd-header-row { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.cmd-syntax {
  padding: 3px 8px;
  max-width: 100%;
  border-radius: 9px;
  border: 1px solid #79bdee59;
  background: #284259;
  color: #c9e8ff;
  font: 650 12px var(--mono);
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.cmd-syntax-off { border-color: #fb8eaa94; background: #4a2d3e; color: #ffb9c9; }
.cmd-name-text, .setting-title { font-weight: 670; }
.cmd-desc { color: var(--text-secondary); font-size: 13px; }
.cmd-copy-wrap { flex: none; }

.empty-state, .error-state, .tg-stub-card {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-height: 190px;
  padding: 24px 18px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: 25px;
}
.empty-state h3, .error-state h3 { font-size: 18px; letter-spacing: -.02em; }
.empty-state p, .error-state p, .tg-stub-desc { max-width: 36ch; color: var(--text-secondary); font-size: 13px; }
.empty-illustration-img { display: block; width: 64px; height: 64px; object-fit: contain; }
.empty-icon-wrap, .error-icon-wrap, .tg-stub-icon { display: grid; place-items: center; }
.error-icon-wrap, .tg-stub-icon { width: 48px; height: 48px; border-radius: 16px; background: #2c4359; }
.tg-stub {
  position: fixed;
  inset: 0;
  z-index: 3;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.tg-stub-card { width: min(100%, 390px); }
.tg-stub-title { font-size: 27px; }
.tg-stub-sub { font-weight: 650; }
.btn, .retry-btn, .tg-stub-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  min-height: 40px;
  border-radius: 13px;
  font-size: 13px;
  font-weight: 690;
  text-decoration: none;
}
.btn-primary, .retry-btn, .tg-stub-btn { background: var(--accent-primary); color: #0b1c2b; }
.btn-secondary { background: #284259; color: #dcedfb; border: 1px solid var(--stroke); }
.btn-sm { min-height: 36px; }
.skeleton-row, .skeleton-card { background: #9bc0df17; border-radius: 15px; }
.skeleton-row { height: 48px; margin: 9px; }
.skeleton-card { min-height: 85px; }
.deleted-feed .skeleton-card:first-child { grid-column: 1 / -1; }

.setting-item { padding: 12px 13px; }
.setting-item + .setting-item { border-top: 1px solid var(--stroke); }
.setting-row, .setting-btn-row, .track-delay-row, .input-with-action { display: flex; align-items: center; gap: 10px; }
.setting-meta { flex: 1; min-width: 0; }
.setting-title { font-size: 14px; }
.setting-desc { color: var(--text-secondary); font-size: 12px; line-height: 1.35; }
.setting-icon-box.afk { background: #383957; color: #c7bcff; }
.setting-icon-box.danger { background: #4a2d3e; color: var(--accent-rose); }
.danger-text { color: var(--accent-rose); }
.setting-subpanel { display: none; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--stroke); }
.setting-subpanel.open { display: block; }
.native-card + .section-label { margin-top: 22px; }
.field-title { display: block; font-size: 12px; font-weight: 670; color: var(--text-secondary); margin-bottom: 6px; }
.textarea-field, .input-field {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: var(--input);
  color: var(--text-primary);
  font-size: 16px;
}
.input-field.inline { width: 75px; }
.textarea-field { min-height: 78px; resize: vertical; }
.input-with-action .input-field { flex: 1; min-width: 0; }
.track-chips, .quick-chips, .accent-palette-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.setting-btn-row, .track-delay-row { margin-top: 10px; flex-wrap: wrap; }
.tg-switch { position: relative; flex: none; display: block; width: 44px; height: 30px; cursor: pointer; }
.tg-switch input { position: absolute; margin: 0; opacity: 0; inset: 0; width: 100%; z-index: 1; cursor: pointer; }
.tg-slider { position: absolute; inset: 2px 0; border-radius: 999px; background: #375068; transition: background .18s ease; }
.tg-slider::after { content: ""; position: absolute; inset: 3px auto auto 3px; width: 20px; height: 20px; border-radius: 50%; background: #f2f8fe; transition: transform .18s ease; }
.tg-switch input:checked + .tg-slider { background: var(--accent-primary); }
.tg-switch input:checked + .tg-slider::after { transform: translateX(18px); }
.tg-switch input:focus-visible + .tg-slider { outline: 2px solid var(--accent-primary); outline-offset: 3px; }
.accent-circle-btn { width: 25px; height: 25px; border-radius: 50%; border: 2px solid transparent; }
.accent-circle-btn.active { border-color: #f0f8ff; }
.radar-ring { display: none; }
.ping-good { color: var(--accent-emerald); }
.ping-medium { color: var(--accent-amber); }
.ping-bad { color: var(--accent-rose); }
.timer-banner { padding: 8px 10px; border-radius: 12px; background: #284259; margin-bottom: 10px; }
.timer-banner-left { display: flex; gap: 8px; align-items: center; }
.limit-foot { display: flex; align-items: center; justify-content: flex-end; gap: 7px; font-size: 11px; color: var(--text-muted); }
.limit-track { width: 55px; height: 4px; border-radius: 999px; background: #2a4359; overflow: hidden; }
.limit-fill { width: 0; height: 100%; background: var(--accent-primary); }
.letter-limit-box.over-limit .limit-fill { background: var(--accent-rose); }
.hold-pill { position: relative; isolation: isolate; overflow: hidden; height: 34px; min-width: 105px; border-radius: 999px; background: #49283b; color: #ffb2be; }
.hold-label { position: relative; padding-inline: 8px; font-size: 11px; font-weight: 700; }
.hold-label.top, .hold-check { display: none; }
.hold-fill { position: absolute; z-index: -1; inset: 0; background: #704051; transform: scaleX(0); transform-origin: left center; }
.hold-pill.is-holding .hold-fill { transform: scaleX(1); transition: transform 1.2s linear; }
.hold-pill.done .hold-check { display: inline-block; width: 16px; height: 16px; }
.hold-pill.done .hold-label { display: none; }
.btn-spinner, .btn-check { display: none; }
.is-loading .btn-spinner, .is-success .btn-check { display: inline-block; }
.is-loading .btn-text, .is-success .btn-text { display: none; }

.chat-open { overflow: hidden; }
.chat-open:not(.chat-closing) .app-header,
.chat-open:not(.chat-closing) .app-content,
.chat-open:not(.chat-closing) .bottom-nav,
.chat-open:not(.chat-closing) .user-block { visibility: hidden; }
.chat-view {
  position: fixed;
  z-index: 6;
  inset: 0;
  flex-direction: column;
  width: min(100%, 720px);
  margin-inline: auto;
  padding: calc(8px + var(--safe-top)) max(11px, var(--safe-right)) 0 max(11px, var(--safe-left));
}
.chat-view.panel-entering, .chat-view.panel-leaving { border-radius: 26px; overflow: hidden; }
.chat-view.panel-entering { animation: chat-in .24s cubic-bezier(.2,.8,.25,1); }
.chat-view.panel-leaving {
  background: #0e1621 url("./coso-wallpaper.webp") 0 0 / 420px auto repeat;
  pointer-events: none;
  animation: chat-out .2s ease both;
}
@keyframes chat-in {
  from { opacity: .14; transform: translateX(10%); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes chat-out {
  to { opacity: 0; transform: translateX(10%); }
}
.chat-view-header { display: flex; align-items: center; gap: 9px; padding: 7px; border-radius: 22px; flex: none; }
.chat-view-avatar-wrap { width: 40px; height: 40px; flex: none; border-radius: 50%; overflow: hidden; background: #38536a; }
.chat-circle-avatar { position: relative; display: grid; place-items: center; width: 100%; height: 100%; font-weight: 680; color: #e8f4ff; }
.chat-view-meta { min-width: 0; flex: 1; display: grid; }
.chat-view-name, .chat-view-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-view-name { font-size: 15px; font-weight: 680; }
.chat-view-status { color: var(--text-secondary); font-size: 11px; }
.chat-search-bar { margin: 7px 0 0; padding: 0 9px 0 12px; flex: none; }
.chat-filter-bar { flex: none; padding: 8px 1px; }
.chat-messages-container {
  flex: 1;
  min-height: 0;
  padding: 7px 2px calc(13px + var(--safe-bottom));
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #496785 transparent;
}
.chat-date-bubble { display: flex; margin: 4px auto; color: #e3f2fd; background: #263d52; white-space: nowrap; }
.chat-messages-list { display: flex; flex-direction: column; gap: 7px; }
.chat-bubble-wrap { display: flex; align-items: flex-end; gap: 7px; min-width: 0; }
.bubble-avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: #38536a;
  color: #e8f4ff;
  font-size: 13px;
  font-weight: 680;
}
.bubble-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.chat-bubble-wrap.out { justify-content: flex-end; }
.chat-bubble {
  --quote-fill: #192b3c;
  position: relative;
  isolation: isolate;
  max-width: min(85%, calc(100% - 41px), 520px);
  min-width: 76px;
  padding: 8px 11px 6px;
  overflow-wrap: anywhere;
  background: var(--quote-fill);
  border-radius: 22px;
  box-shadow: 0 2px 6px #0000001f;
}
.chat-bubble.out { --quote-fill: #214864; }
.chat-bubble.deleted-msg { box-shadow: inset 0 0 0 1px #df8da93d; }
.chat-bubble::after {
  content: "";
  position: absolute;
  z-index: -1;
  bottom: 0;
  left: -6px;
  width: 32px;
  height: 15px;
  background: var(--quote-fill);
  clip-path: path("M 15 0 H 32 V 15 H 4 C 2 15 1.5 14 3.5 13 C 8 10.5 11 5.5 15 0 Z");
  pointer-events: none;
}
.chat-bubble.out::after { left: auto; right: -6px; transform: scaleX(-1); }
.bubble-author, .bubble-forward { min-width: 0; display: flex; align-items: center; gap: 5px; color: #a6d9fc; font-size: 11px; overflow-wrap: anywhere; }
.bubble-author { margin-bottom: 3px; }
.author-name { font-weight: 700; }
.author-handle, .bubble-meta-right, .media-sub { color: #a4b8cb; font-size: 11px; }
.bubble-forward, .bubble-reply, .archive-inline-media {
  position: relative;
  max-width: 100%;
  margin: 3px 0;
  overflow: hidden;
  border-radius: 12px;
  color: #b6c8d9;
}

.archive-inline-surface { display: grid; min-width: 0; place-items: center; }
.archive-inline-placeholder { display: none; }
.archive-inline-media:not([data-state="ready"]) .archive-inline-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: 5px;
  padding: 8px;
  font-size: 12px;
  text-align: center;
  background: var(--surface);
}
.archive-inline-media[data-state="error"] .archive-inline-surface { visibility: hidden; min-height: 48px; }
.archive-media-retry {
  color: var(--text-primary);
  border: 0;
  border-radius: 5px;
  background: rgba(82, 166, 247, 0.14);
  font: inherit;
  cursor: pointer;
}
.archive-media-unavailable { color: #9cacc1; font-size: 12px; }

.archive-inline-photo, .archive-inline-video, .archive-inline-animation { width: min(68vw, 360px); }
.archive-inline-photo:not([data-state="ready"]), .archive-inline-video:not([data-state="ready"]),
.archive-inline-animation:not([data-state="ready"]) { min-height: 120px; }
.archive-inline-media img, .archive-inline-media video {
  display: block;
  width: 100%;
  max-height: 370px;
  object-fit: contain;
}
.archive-inline-media video { background: var(--input); }
.archive-inline-media img { height: auto; }
.archive-image-zoom {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.archive-inline-sticker {
  width: min(43vw, 172px);
  aspect-ratio: 1;
  background: transparent;
}
.archive-inline-sticker .archive-inline-surface { width: 100%; height: 100%; }
.archive-inline-sticker canvas, .archive-inline-sticker img, .archive-inline-sticker video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}
.archive-inline-voice, .archive-inline-audio {
  width: min(60vw, 244px);
  min-height: 42px;
  border-radius: 22px;
  background: #192b3c;
}
.archive-standalone.out :is(.archive-inline-voice, .archive-inline-audio) { background: #214864; }
.archive-inline-video_note { width: min(53vw, 192px); aspect-ratio: 1; border-radius: 50%; }
.archive-inline-video_note .archive-inline-surface { height: 100%; }
.archive-inline-video_note video { width: 100%; height: 100%; object-fit: cover; }
.archive-circle-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 35, 0.8);
  color: #fff;
  font-size: 17px;
  cursor: pointer;
}
.archive-circle-play.playing:not(:focus-visible):not(:hover) { opacity: 0.24; }
.archive-document-link {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: rgba(82, 166, 247, 0.12);
  color: var(--text-primary);
  text-decoration: none;
}
.archive-inline-document { min-height: 39px; }

.bubble-text { font-size: 15px; }
.chat-link { color: #8ad2ff; }
.chat-bubble-footer, .bubble-meta-right, .bubble-chips-left { display: flex; align-items: center; gap: 5px; }
.chat-bubble-footer { justify-content: flex-end; margin-top: 3px; }
.bubble-chips-left { margin-right: auto; flex-wrap: wrap; }
.bubble-meta-right { white-space: nowrap; }
.chip-edited { cursor: pointer; }
.highlight-flash .chat-bubble { outline: 2px solid var(--accent-primary); outline-offset: 2px; }

.bottom-nav {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: calc(9px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 24px - var(--safe-left) - var(--safe-right)), 690px);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  padding: 5px;
  border-radius: 28px;
}
.nav-item {
  min-width: 0;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  border: 1px solid transparent;
  border-radius: 19px;
  color: #a8bdd0;
  font-size: clamp(9px, 2.45vw, 12px);
  font-weight: 650;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.nav-item.active { color: #e4f4ff; border-color: #a9d7fb35; background: linear-gradient(145deg, #59829d65, #315c7c75); box-shadow: inset 0 1px #eef8ff2b; }
.nav-item.active .tg-icon { color: #82ceff; }
.nav-icon-wrap { position: relative; display: grid; place-items: center; }
.nav-dot-badge { position: absolute; top: -1px; right: -2px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-primary); }
.toast { z-index: 7; position: fixed; top: calc(var(--safe-top) + 10px); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 28px); padding: 10px 14px; border: 1px solid var(--stroke-bright); border-radius: 16px; background: #1c3043; box-shadow: 0 8px 22px #0006; }
.toast-content { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.toast-indicator { background: var(--accent-primary); width: 6px; height: 6px; border-radius: 50%; }
.toast-progress-bar { height: 2px; background: #7ab8e3; margin-top: 5px; transform-origin: left center; border-radius: 5px; }

.media-modal { position: fixed; z-index: 10; inset: 0; align-items: flex-end; justify-content: center; padding: 9px; }
.media-modal.panel-entering { animation: overlay-in .24s ease-out; }
.media-modal.panel-entering .media-sheet { animation: sheet-in .24s cubic-bezier(.2,.8,.25,1); }
.media-modal.panel-leaving { pointer-events: none; animation: overlay-out .2s ease both; }
.media-modal.panel-leaving .media-sheet { animation: sheet-out .2s ease both; }
@keyframes overlay-in { from { opacity: 0; } }
@keyframes overlay-out { to { opacity: 0; } }
@keyframes sheet-in { from { transform: translateY(42px); } }
@keyframes sheet-out {
  from { transform: translateY(var(--sheet-from, 0px)); }
  to { transform: translateY(calc(var(--sheet-from, 0px) + 52px)); }
}
.media-modal-backdrop { position: absolute; inset: 0; background: #050b14b8; }
.media-sheet { position: relative; width: min(100%, 600px); border-radius: 28px; max-height: 85dvh; padding: 8px 13px calc(13px + var(--safe-bottom)); overflow: auto; }
.sheet-handle-bar { display: grid; place-items: center; padding: 3px 0 6px; }
.sheet-handle { width: 34px; height: 4px; border-radius: 99px; background: #90b4d081; }
.media-modal-top { display: flex; align-items: center; justify-content: space-between; gap: 9px; margin: 2px 0 8px; }
.sheet-title { font-weight: 680; overflow-wrap: anywhere; }
.sheet-close-btn { width: 36px; height: 36px; flex: none; }
.media-sheet-body img, .media-sheet-body video { max-width: 100%; max-height: 60dvh; object-fit: contain; border-radius: 15px; margin-inline: auto; }
.edits-chain-list { display: grid; gap: 8px; }
.edit-version-card { background: var(--input); border-radius: 14px; padding: 9px 11px; border: 1px solid var(--stroke); }
.edit-version-header { display: flex; justify-content: space-between; gap: 8px; padding-bottom: 4px; }
.edit-version-badge, .edit-version-time { font-size: 11px; color: var(--text-secondary); }

@media (min-width: 620px) {
  .app-container { padding-inline: 20px; }
  .deleted-feed { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .deleted-card--wide { grid-column: span 2; }
  .deleted-card--focus { grid-column: 1 / -1; }
  .chat-view { padding-inline: 20px; }
  .chat-item { padding-inline: 17px; }
}
@media (max-width: 365px) {
  .app-container { padding-inline: 10px; }
  .deleted-feed { gap: 7px; }
  .deleted-card { gap: 7px; padding: 10px; }
  .deleted-uname { display: none; }
  .chat-dead-badge .tg-icon { display: none; }
}
@media (max-width: 600px) {
  .archive-snow { z-index: 7; opacity: .7; }
}
@media (max-width: 440px) {
  .chat-filter-chip { padding-inline: 9px; }
  .chat-filter-chip .tg-icon { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .app-container:not([hidden]), .tg-stub-card, .tab-pane.active { animation: none; }
  .tg-slider, .tg-slider::after { transition: none; }
  .spinning .tg-icon, .btn-spinner { animation: none; }
}

.account-settings { display: grid; gap: 9px; margin-top: 20px; }
.account-settings fieldset { display: grid; gap: 10px; min-width: 0; border: 0; padding: 0; margin: 0; }
.account-settings a { color: #a3d8ff; }
.settings-card { display: grid; gap: 11px; padding: 13px; }
.settings-card h3 { margin: 0; font-size: 15px; }
.settings-card-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.settings-card-body, .settings-form, .settings-allow-list { display: grid; gap: 8px; }
.settings-form label { font-size: 13px; font-weight: 650; }
.settings-form .input-field, .settings-form .textarea-field { width: 100%; }
.settings-form .btn { justify-self: start; }
.settings-form .setting-btn-row { flex-wrap: wrap; }
.settings-form .btn:not(.btn-primary), .settings-allow-list .btn { background: #29455d; color: #e2f0fb; }
.settings-form .btn.danger-text { color: #ffb9c9; }
.settings-check { display: flex; align-items: center; gap: 8px; }
.settings-check input { accent-color: var(--accent-primary, #58b4f4); }
.settings-allow-list > div { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.settings-form button:disabled, .settings-allow-list button:disabled { opacity: .6; }

.settings-card h3, #chat-settings summary { font-size: 15px; font-weight: 720; }
.setting-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 39px; }
.setting-switch-row > span:first-child { flex: 1; }
.account-settings .setting-btn-row { flex-wrap: wrap; }
.account-settings .input-field, .account-settings .textarea-field {
  min-height: 40px;
  border: 1px solid #485e72;
  border-radius: 12px;
}
.account-settings select { color-scheme: dark; }
#gemini-key::placeholder { color: #b0c9de; letter-spacing: .04em; }
#chat-settings summary { cursor: pointer; margin-bottom: 5px; }
#chat-settings-controls { gap: 10px; }
#chat-settings-controls .input-field { width: 100%; }
#chat-schedules .schedule-entry { display: grid; align-items: initial; gap: 5px; padding: 9px 0; border-top: 1px solid #304658; }
#chat-schedules .schedule-entry > span { overflow-wrap: anywhere; }
#tab-settings .tg-switch { width: 48px; height: 28px; }
#tab-settings .tg-slider {
  inset: 0;
  border-radius: 100px;
  background: #263a4d;
  border: 1px solid #607c92;
  box-shadow: inset 0 1px 3px #090f1855;
}
#tab-settings .tg-slider::after {
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #e5f1fb;
  box-shadow: 0 1px 3px #0007;
}
#tab-settings .tg-switch input:checked + .tg-slider {
  background: #3a98d7;
  border-color: #7bc0f1;
}
#tab-settings .tg-switch input:checked + .tg-slider::after { transform: translateX(20px); }
#tab-settings .tg-switch input:disabled + .tg-slider { opacity: .65; }


.chat-bubble-wrap { gap: 9px; }
.bubble-author { color: var(--archive-author, var(--text-primary)); font-weight: 650; font-size: 13px; }
.bubble-avatar { background: color-mix(in srgb, var(--archive-author, var(--accent-primary)) 30%, var(--surface)); }
.chat-bubble-time { color: var(--text-secondary); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chat-bubble .quote-inline-time {
  display: inline-block;
  width: 53px;
  margin-inline-start: 5px;
}
.chat-bubble .quote-inline-time time {
  position: absolute;
  inset-inline-end: 11px;
  inset-block-end: 6px;
}
.chat-messages-container { padding-inline: 5px; }
.chat-open .archive-snow { visibility: hidden; }
.archive-older { display: block; margin-inline: auto; }

.archive-standalone {
  display: grid;
  justify-items: start;
  max-width: min(calc(100% - 41px), 520px);
  min-width: 0;
  overflow-wrap: anywhere;
}
.archive-standalone.out { justify-items: end; }
.archive-standalone .bubble-author { max-width: 100%; padding-inline: 6px; margin-bottom: 0; }
.archive-standalone .chat-bubble-footer {
  padding: 1px 6px;
  margin: 0 3px;
  background: var(--surface);
  border-radius: 9px;
}
.archive-standalone .bubble-text {
  padding: 4px 8px;
  border-radius: 11px;
  background: var(--surface);
}
.highlight-flash .archive-standalone { outline: 2px solid var(--accent-primary); outline-offset: 3px; border-radius: 15px; }
.archive-inline-video_note { background: var(--input); }
.archive-inline-video_note .archive-circle-play {
  display: grid;
  place-items: center;
  color: var(--text-primary);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}
.archive-inline-video .archive-inline-surface { background: var(--input); }
.archive-player-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 4px 9px 4px 5px;
  color: var(--text-primary);
}
.archive-inline-video .archive-player-controls { background: var(--surface-strong); }
.archive-player-play {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: var(--bg-base);
}
.archive-play-icon {
  display: block;
  width: 11px;
  height: 13px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.playing > .archive-play-icon {
  clip-path: polygon(0 0, 36% 0, 36% 100%, 0 100%, 0 0, 64% 0, 100% 0, 100% 100%, 64% 100%, 64% 0);
}
.archive-player-seek {
  appearance: none;
  min-width: 27px;
  width: 100%;
  height: 20px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  accent-color: var(--accent-primary);
}
.archive-player-seek::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--accent-primary) var(--archive-progress, 0%), var(--stroke-bright) var(--archive-progress, 0%));
}
.archive-player-seek::-webkit-slider-thumb {
  appearance: none;
  width: 10px;
  height: 10px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: var(--accent-primary);
}
.archive-player-seek::-moz-range-track { height: 3px; border-radius: 4px; background: var(--stroke-bright); }
.archive-player-seek::-moz-range-progress { background: var(--accent-primary); }
.archive-player-seek::-moz-range-thumb { border: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-primary); }
.archive-player-time { font-size: 11px; font-variant-numeric: tabular-nums; color: var(--text-secondary); white-space: nowrap; }
.archive-player-sound { flex: 0 0 18px; color: var(--text-primary); }
.archive-player-sound[aria-pressed="true"] { opacity: .46; }
.archive-player-full { flex: 0 0 22px; color: var(--text-secondary); font-size: 19px; line-height: 1; }
.archive-display-name {
  min-width: 0;
  overflow: hidden;
  white-space: pre;
  text-overflow: ellipsis;
  unicode-bidi: isolate;
  font-family: system-ui, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

.chat-title, .chat-view-name {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.archive-profile-emoji {
  display: inline-flex;
  flex: 0 0 1.15em;
  width: 1.15em;
  height: 1.15em;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.archive-profile-emoji:not(.ready) { visibility: hidden; }
.archive-profile-emoji canvas, .archive-profile-emoji img, .archive-profile-emoji video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.archive-event {
  align-self: center;
  display: grid;
  justify-items: center;
  gap: 4px;
  max-width: min(94%, 420px);
  padding: 7px 12px;
  margin: 3px 0;
  border-radius: 13px;
  background: var(--surface-strong);
  color: #d7e4f0;
  font-size: 12px;
  text-align: center;
  overflow-wrap: anywhere;
}

.archive-event-line { display: flex; align-items: baseline; gap: 7px; }
.archive-event-line time { flex: 0 0 auto; color: #9cacc1; font-size: 10px; }
.archive-event-author { display: flex; gap: 5px; align-items: center; min-width: 0; max-width: 100%; color: var(--archive-author); }
.archive-event-target, .archive-older {
  border: 0;
  border-radius: 8px;
  background: rgba(82, 166, 247, 0.12);
  color: var(--text-primary);
  padding: 5px 8px;
  font: inherit;
  cursor: pointer;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.archive-older { align-self: center; font-size: 12px; margin-bottom: 4px; padding: 7px 12px; }
.archive-older[hidden] { display: none; }
.archive-older:disabled { opacity: 0.7; cursor: wait; }


.bottom-nav { grid-template-columns: repeat(6,minmax(0,1fr)); }
.bottom-nav .nav-item > span { font-size: clamp(8px,2.38vw,11px); }
#tab-modules, .pm-dialog {
  --pm-bg: #101e2b;
  --pm-panel: #172937;
  --pm-stroke: #9dc6e335;
  --pm-text: #e9f4ff;
  --pm-muted: #aec4d6;
  --pm-accent: #8fd7fa;
  --pm-green: #80e7b0;
  --pm-red: #ffa2ad;
  color: var(--pm-text);
}
#tab-modules { padding-bottom: 12px; }
#tab-modules [hidden], .pm-dialog [hidden] { display: none !important; }
.pm-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: clamp(13px,3.8vw,22px); margin-bottom: 12px;
  border: 1px solid var(--pm-stroke); border-radius: 22px;
  background: radial-gradient(ellipse at 100% -30%,#387d9c8c,transparent 65%),#172c3d;
}
.pm-dialog h2, .pm-card h3 { margin: 0; font-weight: 720; overflow-wrap: anywhere; }
.pm-empty p, .pm-help p { margin: 5px 0 0; color: var(--pm-muted); font-size: 13px; line-height: 1.45; }
.pm-hero p { margin: 0; color: var(--pm-text); font-size: clamp(13px,3.8vw,16px); font-weight: 590; line-height: 1.35; }
.pm-primary, .pm-secondary, .pm-danger, .pm-close, .pm-filters button, .pm-vote {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 8px 13px; border-radius: 12px; font-size: 13px; font-weight: 700;
  white-space: normal; cursor: pointer; border: 1px solid transparent;
}
.pm-primary { color: #0c212d; background: linear-gradient(150deg,#c0ebff,#75c9f2); border-color: #dbf4ff66; }
.pm-create { flex: 0 0 auto; }
.pm-create svg, .pm-vote svg { width: 17px; height: 17px; flex: none; }
.pm-secondary, .pm-close, .pm-filters button { color: var(--pm-text); background: #9ed5ff11; border-color: var(--pm-stroke); }
.pm-danger { color: var(--pm-red); background: #ee829520; border-color: #ee829550; }
.pm-primary:disabled, .pm-secondary:disabled, .pm-vote:disabled, .pm-danger:disabled { opacity: .58; cursor: wait; }
.pm-primary[aria-pressed=true] { background: #a7b3bd24; border-color: #a7b3bd40; color: #c3ced7; }
.pm-primary[aria-busy=true]::before, .pm-status.pm-loading::before {
  content: ""; width: 12px; height: 12px; flex: none; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: pm-spin .75s linear infinite;
}
@keyframes pm-spin { to { transform: rotate(360deg); } }
.pm-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.pm-filters button { min-height: 35px; border-radius: 999px; padding: 6px 12px; font-size: 12px; color: var(--pm-muted); }
.pm-filters button[aria-pressed=true] { color: #e5f7ff; background: #456d88; border-color: #b6e0fd62; }
.pm-status { display: flex; align-items: center; gap: 8px; color: var(--pm-muted); font-size: 13px; }
.pm-status:not(:empty) { margin: 7px 0 12px; }
.pm-status.pm-error, .pm-form-error { color: var(--pm-red); }
.pm-list { display: grid; gap: 12px; }
@media (min-width: 650px) { .pm-list { grid-template-columns: repeat(2,minmax(0,1fr)); } }
.pm-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--pm-stroke); border-radius: 21px; background: var(--pm-panel); }
.pm-cover { width: 100%; aspect-ratio: 16/9; display: block; position: relative; overflow: hidden; background: linear-gradient(155deg,#2c5974,#192b3a); border-bottom: 1px solid var(--pm-stroke); }
.pm-cover img { width: 100%; height: 100%; display: block; object-fit: cover; }
.pm-card-body { padding: 13px; flex: 1; display: flex; flex-direction: column; gap: 9px; }
.pm-card h3 { font-size: 18px; }
.pm-card p { color: var(--pm-muted); font-size: 13px; line-height: 1.48; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.pm-card .pm-slug { width: fit-content; max-width: 100%; color: var(--pm-accent); font: 12px ui-monospace,monospace; overflow-wrap: anywhere; }
.pm-card-actions, .pm-card-footer, .pm-form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.pm-card-actions { margin-top: auto; padding-top: 3px; }
.pm-card-footer { margin-top: 3px; padding-top: 10px; border-top: 1px solid var(--pm-stroke); }
.pm-card-footer .pm-total { margin-left: auto; color: var(--pm-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.pm-vote { padding: 5px 7px; min-height: 32px; border-radius: 9px; color: var(--pm-green); background: #6be4a111; }
.pm-vote.pm-down { color: var(--pm-red); background: #f8849513; }
.pm-vote[aria-pressed=true] { border-color: currentColor; }
.pm-badge { width: fit-content; padding: 4px 8px; border-radius: 8px; background: #b7d9f51f; color: #d6ebfb; font-size: 11px; }
.pm-badge[data-state=pending] { color: #ffe2a9; background: #efbf6d24; }
.pm-badge[data-state=approved] { color: var(--pm-green); background: #6be4a115; }
.pm-badge[data-state=rejected], .pm-badge[data-state=revoked] { color: var(--pm-red); background: #f8849518; }
.pm-empty { grid-column: 1/-1; padding: 27px 18px; border: 1px dashed var(--pm-stroke); border-radius: 20px; text-align: center; background: #172937a6; }
.pm-empty h3 { margin: 0; font-size: 17px; }
.pm-empty button { margin-top: 14px; }
.pm-more { margin: 13px auto 0; display: flex; }
.pm-dialog { padding: 0; border: 1px solid var(--pm-stroke); border-radius: 22px; background: var(--pm-bg); width: min(94vw,560px); max-width: none; max-height: 88vh; max-height: min(88dvh,760px); box-shadow: 0 24px 80px #000b; }
.pm-dialog::backdrop { background: #050a12b8; }
.pm-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 15px; border-bottom: 1px solid var(--pm-stroke); position: sticky; top: 0; background: var(--pm-bg); z-index: 1; }
.pm-dialog-head h2 { font-size: 17px; }
.pm-close { width: 36px; min-height: 36px; padding: 0; font-size: 24px; }
.pm-dialog-body { display: grid; gap: 13px; padding: 14px; }
.pm-dialog-body .pm-cover { aspect-ratio: auto; border: 1px solid var(--pm-stroke); border-radius: 14px; }
.pm-dialog-body .pm-cover img { height: auto; max-height: 350px; object-fit: contain; }
.pm-form { display: grid; gap: 12px; min-width: 0; }
.pm-field { display: grid; gap: 5px; font-size: 13px; font-weight: 650; color: var(--pm-text); }
.pm-field input, .pm-field textarea, .pm-field select {
  display: block; min-width: 0; width: 100%; min-height: 40px; padding: 9px 10px; color: var(--pm-text);
  font: inherit; font-size: 16px; background: #0c1722; border: 1px solid var(--pm-stroke); border-radius: 10px;
}
.pm-field textarea { min-height: 72px; resize: vertical; }
.pm-field textarea.pm-editor { min-height: 174px; font: 13px/1.6 ui-monospace,Consolas,monospace; tab-size: 4; }
.pm-field input[type=file] { font-size: 13px; }
.pm-field small { color: var(--pm-muted); font-weight: 400; }
.pm-copyline { display: flex; gap: 7px; flex-wrap: wrap; }
.pm-help { border: 1px solid var(--pm-stroke); border-radius: 12px; background: #9ed5ff0a; padding: 10px; font-size: 13px; }
.pm-help summary { cursor: pointer; color: var(--pm-accent); font-weight: 700; }
.pm-code, .pm-output {
  display: block; white-space: pre; overflow: auto; max-height: 290px; margin: 0; padding: 11px;
  border: 1px solid var(--pm-stroke); border-radius: 12px; color: #d4d4d4; background: #0c141e;
  font: 13px/1.63 ui-monospace,Consolas,monospace; tab-size: 4; user-select: text; -webkit-user-select: text;
}
.pm-output { white-space: pre-wrap; overflow-wrap: anywhere; color: #b8efcd; }
.pm-token-keyword { color: #cf9cdd; }
.pm-token-function { color: #dcdcaa; }
.pm-token-variable { color: #9cdcfe; }
.pm-token-string { color: #e7aa94; }
.pm-token-comment { color: #91aa7d; }
.pm-token-number { color: #b5cea8; }
.pm-token-op { color: #bfcaf0; }
.pm-code-line { display: block; min-height: 1.63em; padding-left: 35px; position: relative; }
.pm-code-line::before { content: attr(data-line); position: absolute; left: 0; width: 25px; text-align: right; color: #8ca4bc; user-select: none; }
.pm-code > code { display: block; min-width: max-content; }
.pm-author { display: flex; gap: 7px; align-items: center; min-width: 0; color: var(--pm-muted); font-size: 13px; font-weight: 650; }
.pm-author-identity { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-width: 0; }
.pm-author-name, .pm-author-handle { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 100%; }
.pm-author-name { color: var(--pm-text); }
.pm-author-handle { color: var(--pm-muted); font-weight: 500; font-size: 11px; }
.pm-author .archive-profile-emoji { width: 16px; height: 16px; flex: none; }
.pm-avatar { position: relative; isolation: isolate; display: inline-grid; flex: none; place-items: center; width: 29px; height: 29px; border-radius: 50%; overflow: hidden; border: 1px solid #a9d8f552; color: #d7efff; background: linear-gradient(140deg,#526a87,#24465b); }
.pm-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pm-version { color: var(--pm-accent); margin-left: auto; font-size: 11px; white-space: nowrap; font-weight: 550; }
.pm-check { display: flex; align-items: center; gap: 8px; width: fit-content; flex-direction: row-reverse; }
.pm-check input { width: 17px; min-height: 17px; appearance: auto; accent-color: var(--pm-accent); }
.pm-ai-controls { display: grid; gap: 8px; padding: 11px; border: 1px solid var(--pm-stroke); border-radius: 14px; background: #8fd7fa11; }
.pm-external > .pm-field, .pm-external > button, .pm-external > .pm-form-error:not(:empty) { margin-top: 9px; }
.pm-ai-history { display: flex; flex-direction: column; gap: 8px; min-height: 85px; max-height: 250px; overflow: auto; overscroll-behavior: contain; }
.pm-ai-bubble { align-self: flex-start; max-width: 88%; padding: 9px 11px; border: 1px solid var(--pm-stroke); border-radius: 14px 14px 14px 4px; background: var(--pm-panel); overflow-wrap: anywhere; }
.pm-ai-bubble strong { font-size: 11px; color: var(--pm-accent); }
.pm-ai-bubble p { margin: 3px 0 0; font-size: 14px; line-height: 1.4; white-space: pre-wrap; }
.pm-ai-bubble.pm-ai-user { align-self: flex-end; background: #2a4b64; border-radius: 14px 14px 4px 14px; }
.pm-ai-chat .pm-field textarea { min-height: 58px; }
.pm-update-notice { padding: 9px 11px; border: 1px solid var(--pm-stroke); border-radius: 10px; }
.pm-demo {
  position: relative; isolation: isolate; overflow: hidden; min-width: 0; display: grid; gap: 9px;
  padding: clamp(12px,4vw,18px); border: 1px solid #87b7dd48; border-radius: 18px;
  background: linear-gradient(150deg,#10273acf,#0b1528b8), #0e1621 url("/panel/assets/coso-wallpaper.webp") center / 390px auto repeat;
  font-family: inherit;
}
.pm-demo-compact { border: 0; border-radius: 0; border-bottom: 1px solid var(--pm-stroke); }
.pm-demo-head { display: flex; gap: 8px; align-items: center; justify-content: space-between; min-width: 0; }
.pm-demo-head .pm-author { flex: 1; }
.pm-demo-head .pm-secondary { min-height: 32px; padding: 5px 8px; font-size: 11px; flex: 0 0 auto; }
.pm-demo-chat { display: grid; gap: 6px; min-width: 0; }
.pm-demo-bubble { width: fit-content; max-width: 92%; overflow-wrap: anywhere; white-space: pre-wrap; padding: 7px 10px; font-size: 13px; line-height: 1.45; color: #f0f8ff; }
.pm-demo-invocation { justify-self: end; background: #24587f; border: 1px solid #9ed5ff38; border-radius: 13px 13px 4px 13px; font-family: ui-monospace,Consolas,monospace; }
.pm-demo-quote { justify-self: start; border-left: 2px solid #8cc5e9; background: #112d46; color: #c8dff2; border-radius: 2px 10px 10px 2px; font-size: 12px; }
.pm-demo-reply { justify-self: end; background: #173c59; border: 1px solid #9ed5ff38; border-radius: 13px 13px 4px 13px; }
.pm-demo-output { font: inherit; }
.pm-demo-output:is(strong, em, code) { font: revert; }
.pm-demo-kind { display: block; color: #97d8fc; font-size: 11px; margin-bottom: 3px; }
.pm-demo-poll { list-style: none; margin: 5px 0 0; padding: 0; display: grid; gap: 4px; font-size: 12px; }
.pm-demo-poll li { background: #94d3ff15; border-radius: 7px; padding: 4px 7px; }
.pm-demo-progress { min-width: min(165px, 100%); }
.pm-demo-progress-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; color: var(--pm-accent); font-variant-numeric: tabular-nums; }
.pm-demo-progress-row progress { min-width: 70px; width: 100%; height: 7px; accent-color: var(--pm-accent); flex: 1; }
.pm-demo-progress-row span { flex: 0 0 34px; text-align: right; font-size: 11px; }
.pm-demo-compact .pm-demo-output, .pm-demo-compact .pm-demo-quote { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pm-demo-reply .pm-cover { margin: 4px 0 6px; max-width: 310px; }
.pm-demo-play .pm-demo-quote { animation: pm-demo-enter .28s ease both; }
.pm-demo-play .pm-demo-invocation { animation: pm-demo-enter .35s .12s ease both; }
.pm-demo-play .pm-demo-reply { animation: pm-demo-enter .42s .48s ease both; }
@keyframes pm-demo-enter { from { opacity: 0; transform: translateY(7px) scale(.98); } to { opacity: 1; transform: none; } }
@media(prefers-reduced-motion: reduce) {
  .pm-demo-play .pm-demo-bubble { animation: none; }
  .pm-demo-head .pm-secondary { display: none; }
}
.pm-command { color: var(--pm-accent); font-family: ui-monospace,monospace; overflow-wrap: anywhere; }
.pm-note, .pm-form-error { margin: 0; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.pm-note { color: var(--pm-muted); white-space: pre-wrap; }
.pm-danger-box { border-top: 1px solid var(--pm-stroke); padding-top: 10px; }
#tab-modules :focus-visible, .pm-dialog :focus-visible { outline: 2px solid var(--pm-accent); outline-offset: 2px; }
@media(max-width: 365px) { .pm-create { padding-inline: 8px; } .pm-filters button { padding-inline: 8px; } }
@media(prefers-reduced-motion: reduce) { .pm-primary[aria-busy=true]::before, .pm-status.pm-loading::before { animation: none; } }
