:root {
  --bg: #ffffff;
  --page: #f6f6f6;
  --text: #000000;
  --muted: #8e8e93;
  --line: #d1d1d6;
  --bar: rgba(246, 246, 246, 0.92);
  --theirs: #e9e9eb;
  --theirs-text: #000000;
  --mine: #0b84fe;
  --mine-text: #ffffff;
  --momenta: #1c1c1e;
  --card: #ffffff;
  --field: #ffffff;
  --sheet: #f2f2f7;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --page: #000000;
    --text: #ffffff;
    --muted: #8e8e93;
    --line: #38383a;
    --bar: rgba(22, 22, 24, 0.92);
    --theirs: #262629;
    --theirs-text: #ffffff;
    --momenta: #48484a;
    --card: #1c1c1e;
    --field: #1c1c1e;
    --sheet: #1c1c1e;
  }
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font:
    17px/1.3 -apple-system,
    BlinkMacSystemFont,
    'SF Pro Text',
    'Helvetica Neue',
    Arial,
    sans-serif;
  -webkit-text-size-adjust: 100%;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
a {
  color: inherit;
}
.muted {
  color: var(--muted);
}

.page {
  min-height: 100dvh;
  background: var(--page);
  padding: calc(env(safe-area-inset-top) + 24px) 16px calc(env(safe-area-inset-bottom) + 32px);
  max-width: 560px;
  margin: 0 auto;
}
.page h1 {
  font-size: 30px;
  margin: 8px 0;
}
.page h2 {
  font-size: 20px;
  margin: 24px 0 8px;
}
body:has(.page) {
  background: var(--page);
}
.card > * {
  margin: 0;
}
.card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}
input,
select {
  border: 1px solid var(--line);
  background: var(--field);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 17px;
  color: var(--text);
}
button,
.button {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--theirs);
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
button.primary {
  background: var(--mine);
  color: #fff;
}
button:disabled {
  opacity: 0.5;
}
.share .link {
  font-size: 14px;
  word-break: break-all;
  background: var(--page);
  border-radius: 10px;
  padding: 10px;
  margin: 8px 0;
}
.row {
  display: flex;
  gap: 8px;
}
.row > button {
  flex: 1;
}
.fine {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}
.groups {
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--card);
  border-radius: 14px;
}
.groups li + li {
  border-top: 1px solid var(--line);
}
.groups a {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  text-decoration: none;
}
.groups span {
  font-size: 14px;
}

.chat {
  height: var(--app-h, 100dvh);
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.bar {
  display: flex;
  align-items: center;
  padding: calc(env(safe-area-inset-top) + 6px) 8px 6px;
  background: var(--bar);
  border-bottom: 0.5px solid var(--line);
  backdrop-filter: blur(20px);
}
.bar .back {
  font-size: 34px;
  line-height: 1;
  color: var(--mine);
  text-decoration: none;
  padding: 0 12px 4px 6px;
}
.bar .title {
  flex: 1;
  background: none;
  padding: 0 40px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-weight: 400;
  font-size: 12px;
  min-width: 0;
}
.bar .name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.avatars {
  display: flex;
}
.avatars .avatar + .avatar {
  margin-left: -10px;
}
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border: 2px solid var(--bar);
  flex: none;
}

.thread {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 12px 12px;
  overscroll-behavior: contain;
}
.stamp,
.system {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin: 14px 0 6px;
}
.msg {
  display: flex;
  flex-direction: column;
  margin-top: 2px;
}
.msg.mine {
  align-items: flex-end;
}
.msg.theirs {
  align-items: flex-start;
}
.sender {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 2px 12px;
}
.bubble {
  position: relative;
  max-width: 78%;
  padding: 8px 13px;
  border-radius: 19px;
  background: var(--theirs);
  color: var(--theirs-text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.msg.mine .bubble {
  background: var(--mine);
  color: var(--mine-text);
}
.msg.mine .bubble a {
  color: var(--mine-text);
}
.bubble.poll,
.bubble.link {
  padding: 0;
  overflow: hidden;
  min-width: 220px;
}
.quote {
  font-size: 13px;
  opacity: 0.75;
  border-left: 3px solid currentColor;
  padding-left: 8px;
  margin-bottom: 4px;
}
.tapbacks {
  position: absolute;
  top: -14px;
  display: flex;
  gap: 2px;
  background: var(--theirs);
  border: 2px solid var(--bg);
  border-radius: 14px;
  padding: 1px 6px;
  font-size: 14px;
}
.msg.theirs .tapbacks {
  right: -10px;
}
.msg.mine .tapbacks {
  left: -10px;
}
.tapbacks .mine {
  filter: drop-shadow(0 0 2px var(--mine));
}
.tapbacks small {
  font-size: 10px;
  color: var(--muted);
}
.bubble:has(.tapbacks) {
  margin-top: 14px;
}
.receipt {
  font-size: 11px;
  color: var(--muted);
  margin: 2px 4px 0;
}
.linkcard {
  display: flex;
  flex-direction: column;
  padding: 10px 13px;
  text-decoration: none;
  gap: 2px;
}
.linkcard span {
  font-size: 13px;
  opacity: 0.7;
  word-break: break-all;
}
.poll {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  gap: 6px;
  min-width: 240px;
}
.poll-tag {
  font-size: 12px;
  color: var(--muted);
}
.poll .option {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border-radius: 10px;
  padding: 9px 10px;
  font-weight: 400;
  text-align: left;
}
.poll .check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--muted);
  display: grid;
  place-items: center;
  font-size: 12px;
  flex: none;
}
.poll .option.on .check {
  background: var(--mine);
  border-color: var(--mine);
  color: #fff;
}
.poll .label {
  flex: 1;
}
.poll .count {
  font-size: 12px;
  color: var(--muted);
}
.bubble.typing {
  display: flex;
  gap: 4px;
  padding: 12px 14px;
}
.bubble.typing i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  animation: blink 1.2s infinite;
}
.bubble.typing i:nth-child(2) {
  animation-delay: 0.2s;
}
.bubble.typing i:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes blink {
  0%,
  60%,
  100% {
    opacity: 0.3;
  }
  30% {
    opacity: 1;
  }
}

.composer {
  background: var(--bar);
  border-top: 0.5px solid var(--line);
  padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px);
}
.composer .row {
  align-items: flex-end;
}
.composer textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 7px 14px;
  background: var(--bg);
  font-size: 17px;
  line-height: 1.3;
  max-height: 140px;
  outline: none;
}
.composer .send {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  padding: 0;
  background: var(--mine);
  color: #fff;
  font-size: 20px;
  line-height: 34px;
}
.replying {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  padding: 4px 6px 6px;
}
.replying button {
  background: none;
  padding: 0 6px;
  font-size: 20px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, 92vw);
}
.tapback-row {
  display: flex;
  justify-content: space-around;
  background: var(--card);
  border-radius: 28px;
  padding: 6px;
}
.tapback-row button {
  background: none;
  font-size: 26px;
  padding: 6px;
  border-radius: 50%;
}
.tapback-row button.on {
  background: var(--mine);
}
.menu .preview .bubble {
  max-width: 100%;
}
.actions {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 14px;
  overflow: hidden;
}
.actions button {
  background: none;
  border-radius: 0;
  text-align: left;
  font-weight: 400;
}
.actions button + button {
  border-top: 0.5px solid var(--line);
}
.sheet {
  align-self: flex-end;
  width: 100%;
  max-width: 560px;
  max-height: 88%;
  overflow-y: auto;
  background: var(--sheet);
  border-radius: 14px 14px 0 0;
  padding: 16px 16px calc(env(safe-area-inset-bottom) + 20px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sheet .close {
  align-self: flex-end;
  background: none;
  color: var(--mine);
  padding: 4px;
}
.sheet h2 {
  margin: 0;
  text-align: center;
  font-size: 20px;
}
.sheet h3 {
  font-size: 13px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 12px 0 0;
}
.sheet form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.people {
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--card);
  border-radius: 12px;
}
.people li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
}
.people li + li {
  border-top: 0.5px solid var(--line);
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 80px);
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 15px;
  z-index: 20;
}

.plan-page main {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}
.plan-page .tag {
  font-size: 13px;
  color: var(--muted);
}
.plan-page h2 {
  font-size: 15px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 20px 0 4px;
}
.plan-page ul {
  padding-left: 18px;
}
.plan-page li span {
  color: var(--muted);
  font-size: 14px;
  margin-left: 6px;
}
