:root {
  --ios-blue: #007aff;
  --ios-blue-deep: #0066d6;
  --ios-green: #34c759;
  --ios-red: #ff3b30;
  --ios-bg: #f2f2f7;
  --ios-surface: #ffffff;
  --ios-grouped: #ffffff;
  --ios-fill: #e9e9ed;
  --ios-fill-strong: #dedee3;
  --ios-label: #1c1c1e;
  --ios-secondary: #6c6c70;
  --ios-tertiary: #8e8e93;
  --ios-separator: rgba(60, 60, 67, 0.16);
  --bubble-other: #e9e9eb;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ios-label);
  background: var(--ios-bg);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ios-bg);
}

button,
input,
textarea {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-mark {
  position: relative;
  display: inline-block;
  width: 33px;
  height: 33px;
  overflow: hidden;
  background: linear-gradient(150deg, #3b9cff, #0066e8);
  border-radius: 10px;
  box-shadow: 0 5px 14px rgba(0, 122, 255, 0.24);
}

.brand-mark::before {
  position: absolute;
  top: 9px;
  left: 7px;
  width: 18px;
  height: 13px;
  content: "";
  background: white;
  border-radius: 7px 7px 7px 3px;
}

.brand-mark::after {
  position: absolute;
  top: 16px;
  left: 20px;
  width: 4px;
  height: 4px;
  content: "";
  background: var(--ios-blue);
  border: 1.5px solid white;
  border-radius: 50%;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--ios-blue);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.auth-view {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0%, rgba(0, 122, 255, 0.15), transparent 31%),
    radial-gradient(circle at 0% 100%, rgba(90, 200, 250, 0.13), transparent 27%),
    var(--ios-bg);
}

.auth-header {
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(17px + var(--safe-top)) 22px 12px;
}

.auth-secure {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ios-secondary);
  font-size: 11px;
}

.auth-secure i {
  width: 7px;
  height: 7px;
  background: var(--ios-green);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.12);
}

.auth-stage {
  position: relative;
  display: grid;
  flex: 1;
  place-items: center;
  padding: 10px 20px calc(22px + var(--safe-bottom));
  overflow: hidden;
}

.auth-decor {
  position: absolute;
  border: 1px solid rgba(0, 122, 255, 0.09);
  border-radius: 50%;
  pointer-events: none;
}

.auth-decor-one {
  top: -220px;
  right: -170px;
  width: 500px;
  height: 500px;
}

.auth-decor-two {
  bottom: -285px;
  left: -190px;
  width: 520px;
  height: 520px;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(100%, 430px);
  padding: 21px 23px 19px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 28px;
  box-shadow:
    0 24px 65px rgba(54, 72, 101, 0.16),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.auth-illustration {
  position: relative;
  height: 108px;
  margin-bottom: 17px;
  overflow: hidden;
  background:
    linear-gradient(145deg, #dff1ff 0%, #eef7ff 50%, #d5eaff 100%);
  border-radius: 20px;
}

.speech {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  box-shadow: 0 12px 25px rgba(0, 86, 179, 0.18);
}

.speech-back {
  top: 20px;
  right: 37px;
  width: 67px;
  height: 42px;
  font-size: 14px;
  background: #5ac8fa;
  border-radius: 15px 15px 5px;
  transform: rotate(6deg);
}

.speech-front {
  top: 42px;
  left: 50%;
  width: 124px;
  height: 48px;
  gap: 8px;
  background: linear-gradient(145deg, #2093ff, #007aff);
  border-radius: 18px 18px 18px 6px;
  transform: translateX(-50%) rotate(-2deg);
}

.speech-front i {
  width: 7px;
  height: 7px;
  background: white;
  border-radius: 50%;
}

.spark {
  position: absolute;
  width: 7px;
  height: 7px;
  border: 1.5px solid var(--ios-blue);
  transform: rotate(45deg);
}

.spark-one {
  top: 17px;
  left: 43px;
}

.spark-two {
  right: 25px;
  bottom: 17px;
  width: 6px;
  height: 6px;
  border-color: #5ac8fa;
}

.auth-card h1 {
  margin: 0;
  font-size: clamp(28px, 8vw, 34px);
  font-weight: 750;
  letter-spacing: -0.045em;
}

.auth-subtitle {
  margin: 8px 0 19px;
  color: var(--ios-secondary);
  font-size: 12px;
  line-height: 1.55;
}

.auth-form label,
.password-label-row {
  color: var(--ios-secondary);
  font-size: 11px;
  font-weight: 600;
}

.auth-form > label {
  display: block;
  margin: 0 0 6px 3px;
}

.auth-form input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  color: var(--ios-label);
  font-size: 16px;
  background: var(--ios-fill);
  border: 1px solid transparent;
  border-radius: 12px;
  outline: 0;
  transition:
    border-color 150ms ease,
    background 150ms ease;
}

.auth-form input:focus {
  background: white;
  border-color: rgba(0, 122, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.password-label-row {
  display: flex;
  justify-content: space-between;
  margin: 13px 3px 6px;
}

.password-label-row span {
  color: var(--ios-tertiary);
  font-size: 9px;
  font-weight: 400;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 58px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 11px;
  padding: 5px;
  color: var(--ios-blue);
  font-size: 11px;
  background: transparent;
  border: 0;
  transform: translateY(-50%);
}

#confirmField {
  margin-top: 13px;
}

#confirmField label {
  display: block;
  margin: 0 0 6px 3px;
}

.form-error {
  margin: 10px 2px 0;
  color: var(--ios-red);
  font-size: 11px;
  line-height: 1.45;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
  background: var(--ios-blue);
  border: 0;
  cursor: pointer;
}

.auth-submit {
  width: 100%;
  height: 50px;
  margin-top: 14px;
  padding: 0 17px;
  font-size: 15px;
  font-weight: 650;
  border-radius: 13px;
  box-shadow: 0 9px 22px rgba(0, 122, 255, 0.22);
}

.auth-submit:active {
  background: var(--ios-blue-deep);
  transform: scale(0.99);
}

.auth-submit:disabled {
  cursor: wait;
  opacity: 0.55;
}

.auth-switch {
  width: 100%;
  margin: 13px 0 0;
  padding: 5px;
  color: var(--ios-secondary);
  font-size: 11px;
  background: transparent;
  border: 0;
}

.auth-switch strong {
  color: var(--ios-blue);
  font-weight: 600;
}

.auth-note {
  margin: 9px 0 0;
  color: var(--ios-tertiary);
  font-size: 9px;
  line-height: 1.45;
  text-align: center;
}

.app-view {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.app-frame {
  display: grid;
  grid-template-columns: 375px minmax(0, 1fr);
  width: min(100%, 1180px);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--ios-surface);
  border-right: 1px solid rgba(0, 0, 0, 0.04);
  border-left: 1px solid rgba(0, 0, 0, 0.04);
}

.sidebar {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: var(--ios-bg);
  border-right: 1px solid var(--ios-separator);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(65px + var(--safe-top));
  padding: calc(10px + var(--safe-top)) 16px 8px;
  background: rgba(242, 242, 247, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.me-button {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 3px;
  text-align: left;
  background: transparent;
  border: 0;
}

.avatar {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  overflow: hidden;
  color: white;
  font-size: 13px;
  font-weight: 650;
  background: var(--ios-blue);
  border-radius: 50%;
}

.avatar-large {
  width: 41px;
  height: 41px;
}

.me-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.me-copy strong {
  max-width: 145px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.me-copy span {
  color: var(--ios-tertiary);
  font-size: 9px;
}

.connection {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--ios-secondary);
  font-size: 9px;
}

.connection i {
  width: 6px;
  height: 6px;
  background: #ff9f0a;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255, 159, 10, 0.1);
}

.connection.connected i {
  background: var(--ios-green);
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.11);
}

.connection.disconnected i {
  background: var(--ios-red);
  box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.1);
}

.sidebar-panel {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  padding: 4px 12px 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(60, 60, 67, 0.15) transparent;
}

.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 8px 6px 13px;
}

.panel-heading h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 750;
  letter-spacing: -0.045em;
}

.round-action {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  padding: 0 0 2px;
  color: white;
  font-size: 23px;
  font-weight: 300;
  background: var(--ios-blue);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 4px 11px rgba(0, 122, 255, 0.24);
}

.search-entry {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  height: 36px;
  margin: 0 0 10px;
  padding: 0 11px;
  color: var(--ios-tertiary);
  font-size: 12px;
  text-align: left;
  background: var(--ios-fill);
  border: 0;
  border-radius: 10px;
}

.search-entry svg,
.friend-search-form svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.conversation-list,
.friend-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  background: var(--ios-grouped);
  border-radius: 15px;
}

.conversation-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 68px;
  padding: 8px 10px;
  text-align: left;
  background: transparent;
  border: 0;
}

.conversation-item:not(:last-child)::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 67px;
  height: 0.5px;
  content: "";
  background: var(--ios-separator);
}

.conversation-item:active,
.conversation-item.active {
  background: rgba(0, 122, 255, 0.08);
}

.friend-avatar-wrap {
  position: relative;
  flex: 0 0 auto;
}

.friend-avatar-wrap .avatar {
  width: 47px;
  height: 47px;
  font-size: 14px;
}

.online-dot {
  position: absolute;
  right: 0;
  bottom: 1px;
  width: 11px;
  height: 11px;
  background: #b7b7bc;
  border: 2px solid white;
  border-radius: 50%;
}

.online-dot.online {
  background: var(--ios-green);
}

.conversation-copy {
  min-width: 0;
  flex: 1;
}

.conversation-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.conversation-line strong {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-line time {
  flex: 0 0 auto;
  color: var(--ios-tertiary);
  font-size: 10px;
}

.conversation-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  margin-top: 4px;
}

.conversation-preview p {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--ios-secondary);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unread-badge,
.section-title b {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  color: white;
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
  background: var(--ios-blue);
  border-radius: 9px;
}

.system-tag {
  display: inline-flex;
  align-items: center;
  height: 16px;
  padding: 0 5px;
  color: var(--ios-blue);
  font-size: 8px;
  font-weight: 600;
  background: rgba(0, 122, 255, 0.09);
  border-radius: 5px;
}

.list-empty {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-height: 220px;
  color: var(--ios-secondary);
  text-align: center;
}

.list-empty > span {
  color: var(--ios-blue);
  font-size: 30px;
}

.list-empty strong {
  margin-top: 7px;
  color: var(--ios-label);
  font-size: 13px;
}

.list-empty p {
  margin: 6px 0;
  font-size: 11px;
}

.request-section {
  margin-bottom: 13px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 7px 7px;
  color: var(--ios-secondary);
  font-size: 11px;
}

.request-card {
  padding: 10px;
  margin-bottom: 7px;
  background: white;
  border-radius: 14px;
}

.request-person {
  display: flex;
  align-items: center;
  gap: 10px;
}

.request-person .avatar {
  width: 39px;
  height: 39px;
  font-size: 12px;
}

.request-copy {
  min-width: 0;
}

.request-copy strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-copy span {
  color: var(--ios-tertiary);
  font-size: 9px;
}

.request-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 9px;
}

.request-actions button {
  height: 31px;
  font-size: 11px;
  border: 0;
  border-radius: 8px;
}

.request-actions .accept {
  color: white;
  background: var(--ios-blue);
}

.request-actions .reject {
  color: var(--ios-label);
  background: var(--ios-fill);
}

.friend-list {
  flex: 0 0 auto;
  padding: 0 9px;
  margin-bottom: 16px;
}

.friend-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 8px 2px;
}

.friend-row:not(:last-child)::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 50px;
  height: 0.5px;
  content: "";
  background: var(--ios-separator);
}

.friend-row .avatar {
  width: 40px;
  height: 40px;
  font-size: 12px;
}

.friend-row-copy {
  min-width: 0;
  flex: 1;
}

.friend-row-copy strong {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
}

.friend-row-copy span {
  display: block;
  margin-top: 3px;
  color: var(--ios-tertiary);
  font-size: 9px;
}

.friend-row button {
  padding: 6px 10px;
  color: var(--ios-blue);
  font-size: 10px;
  background: rgba(0, 122, 255, 0.08);
  border: 0;
  border-radius: 8px;
}

.profile-panel {
  padding-right: 16px;
  padding-left: 16px;
}

.profile-panel .panel-heading {
  padding-right: 2px;
  padding-left: 2px;
}

.profile-hero {
  display: flex;
  align-items: center;
  flex-direction: column;
  padding: 24px 12px;
  background:
    radial-gradient(circle at 85% 0%, rgba(0, 122, 255, 0.16), transparent 42%),
    white;
  border-radius: 18px;
}

.profile-avatar {
  width: 76px;
  height: 76px;
  font-size: 27px;
  border: 4px solid white;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.profile-hero h2 {
  margin: 11px 0 3px;
  font-size: 21px;
  letter-spacing: -0.03em;
}

.profile-hero p {
  margin: 0;
  color: var(--ios-secondary);
  font-size: 11px;
}

.profile-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin: 10px 0;
}

.profile-details div {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 5px;
  padding: 13px;
  background: white;
  border-radius: 13px;
}

.profile-details span {
  color: var(--ios-tertiary);
  font-size: 9px;
}

.profile-details strong {
  font-size: 15px;
}

.profile-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 46px;
  padding: 0 14px;
  margin-bottom: 8px;
  font-size: 13px;
  background: white;
  border: 0;
  border-radius: 12px;
}

.profile-action.danger {
  color: var(--ios-red);
}

.profile-action strong {
  color: var(--ios-tertiary);
  font-size: 10px;
  font-weight: 500;
}

.notification-action strong.enabled {
  color: var(--ios-green);
}

.notification-action strong.blocked {
  color: var(--ios-red);
}

.version-note {
  margin: 18px 0;
  color: var(--ios-tertiary);
  font-size: 9px;
  text-align: center;
}

.bottom-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-height: calc(58px + var(--safe-bottom));
  padding: 4px 19px var(--safe-bottom);
  background: rgba(249, 249, 251, 0.93);
  border-top: 0.5px solid var(--ios-separator);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  color: var(--ios-tertiary);
  font-size: 9px;
  background: transparent;
  border: 0;
}

.nav-item svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.nav-item.active {
  color: var(--ios-blue);
}

.nav-badge {
  position: absolute;
  top: 3px;
  left: calc(50% + 7px);
  width: 7px;
  height: 7px;
  background: var(--ios-red);
  border: 1.5px solid #f9f9fb;
  border-radius: 50%;
}

.chat-pane {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: white;
}

.chat-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  flex-direction: column;
  padding: 30px;
  text-align: center;
}

.empty-orbit {
  position: relative;
  width: 138px;
  height: 138px;
  margin-bottom: 25px;
  border: 1px solid rgba(0, 122, 255, 0.12);
  border-radius: 50%;
}

.empty-orbit::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 82px;
  height: 56px;
  content: "";
  background: linear-gradient(145deg, #2093ff, #007aff);
  border-radius: 24px 24px 24px 7px;
  box-shadow: 0 13px 29px rgba(0, 122, 255, 0.22);
  transform: translate(-50%, -50%) rotate(-3deg);
}

.empty-orbit::after {
  position: absolute;
  top: 61px;
  left: 60px;
  width: 7px;
  height: 7px;
  content: "";
  background: white;
  border-radius: 50%;
  box-shadow:
    16px 0 white,
    32px 0 white;
}

.empty-orbit span {
  position: absolute;
  width: 8px;
  height: 8px;
  border: 1.5px solid #5ac8fa;
  transform: rotate(45deg);
}

.empty-orbit span:first-child {
  top: 18px;
  right: 24px;
}

.empty-orbit span:last-child {
  bottom: 18px;
  left: 24px;
  border-color: var(--ios-blue);
}

.chat-empty h2 {
  margin: 4px 0 9px;
  font-size: 30px;
  line-height: 1.16;
  letter-spacing: -0.045em;
}

.chat-empty > p:last-child {
  margin: 0;
  color: var(--ios-secondary);
  font-size: 12px;
}

.conversation {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.conversation-header {
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: calc(66px + var(--safe-top));
  padding: calc(10px + var(--safe-top)) 16px 8px;
  background: rgba(249, 249, 251, 0.88);
  border-bottom: 0.5px solid var(--ios-separator);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.conversation-header .avatar {
  width: 39px;
  height: 39px;
  font-size: 13px;
}

.back-button {
  display: none;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--ios-blue);
  background: transparent;
  border: 0;
}

.back-button svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.chat-identity {
  min-width: 0;
  flex: 1;
}

.chat-identity > div {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-identity h2 {
  max-width: 240px;
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-identity p {
  margin: 2px 0 0;
  color: var(--ios-tertiary);
  font-size: 9px;
}

.system-badge {
  display: inline-flex;
  align-items: center;
  height: 17px;
  padding: 0 5px;
  color: var(--ios-blue);
  font-size: 8px;
  background: rgba(0, 122, 255, 0.09);
  border-radius: 5px;
}

.chat-admin-button {
  flex: 0 0 auto;
  padding: 6px 9px;
  color: var(--ios-blue);
  font-size: 10px;
  background: rgba(0, 122, 255, 0.08);
  border: 0;
  border-radius: 8px;
}

.message-viewport {
  flex: 1;
  min-height: 0;
  padding: 18px 18px 8px;
  overflow-x: hidden;
  overflow-y: auto;
  background: white;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(60, 60, 67, 0.15) transparent;
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(100%, 730px);
  min-height: 1px;
  margin: 0 auto;
}

.date-divider {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 7px 0 8px;
  color: var(--ios-tertiary);
  font-size: 9px;
}

.date-divider::before,
.date-divider::after {
  flex: 1;
  height: 0.5px;
  content: "";
  background: var(--ios-separator);
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  max-width: 82%;
  animation: message-in 170ms ease-out;
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

.message-row.own {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 27px;
  height: 27px;
  margin-bottom: 15px;
  color: white;
  font-size: 10px;
  font-weight: 600;
  border-radius: 50%;
}

.message-row.own .message-avatar {
  display: none;
}

.message-content {
  min-width: 0;
}

.message-time {
  margin: 0 5px 4px;
  color: var(--ios-tertiary);
  font-size: 8px;
}

.message-row.own .message-time {
  text-align: right;
}

.message-bubble {
  max-width: 100%;
  padding: 8px 12px;
  color: var(--ios-label);
  font-size: 15px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  background: var(--bubble-other);
  border: 0;
  border-radius: 17px 17px 17px 5px;
}

.message-row.own .message-bubble {
  color: white;
  background: var(--ios-blue);
  border-radius: 17px 17px 5px 17px;
}

.message-bubble.deleted {
  padding: 7px 11px;
  color: var(--ios-tertiary);
  font-size: 11px;
  font-style: italic;
  background: var(--ios-fill);
}

.message-row.own .message-bubble.deleted {
  color: var(--ios-tertiary);
  background: var(--ios-fill);
}

.admin-message-action {
  display: block;
  margin: 3px 5px 0 auto;
  padding: 2px 6px;
  color: var(--ios-blue);
  font-size: 9px;
  background: transparent;
  border: 0;
}

.message-bubble.image-bubble {
  max-width: min(220px, 64vw);
  padding: 0;
  overflow: hidden;
  background: transparent;
  border-radius: 7px;
}

.message-row.own .message-bubble.image-bubble {
  background: transparent;
  border-radius: 7px;
}

.image-bubble img {
  display: block;
  width: 100%;
  min-width: 105px;
  max-height: 285px;
  object-fit: cover;
  background: #ddd;
  border-radius: 7px;
}

.media-caption {
  margin: 0;
  padding: 7px 7px 4px;
  color: var(--ios-label);
  font-size: 12px;
  white-space: pre-wrap;
}

.message-bubble.voice-bubble {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100px;
  min-width: 94px;
  max-width: 190px;
  padding: 10px 12px;
  color: var(--ios-label);
  text-align: left;
  cursor: pointer;
}

.message-row.own .message-bubble.voice-bubble {
  color: white;
}

.message-row.own .voice-bubble {
  flex-direction: row-reverse;
}

.voice-bubble.voice-medium {
  width: 135px;
}

.voice-bubble.voice-long {
  width: 175px;
}

.voice-play-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 50%;
}

.voice-play-icon::before {
  width: 0;
  height: 0;
  margin-left: 2px;
  content: "";
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid currentColor;
}

.message-row:not(.own) .voice-play-icon {
  color: var(--ios-blue);
  background: rgba(0, 122, 255, 0.1);
}

.voice-bubble.playing .voice-play-icon::before {
  width: 7px;
  height: 9px;
  margin: 0;
  border: 0;
  border-right: 2px solid currentColor;
  border-left: 2px solid currentColor;
}

.voice-waveform {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  height: 18px;
}

.voice-waveform::before,
.voice-waveform::after {
  position: absolute;
  top: 50%;
  right: 0;
  width: 10px;
  height: 10px;
  content: "";
  border-right: 1.7px solid currentColor;
  border-radius: 50%;
  opacity: 0.48;
  transform: translateY(-50%);
}

.voice-waveform::after {
  right: 5px;
  width: 17px;
  height: 17px;
  opacity: 0.3;
}

.message-row.own .voice-waveform {
  transform: scaleX(-1);
}

.voice-bubble.playing .voice-waveform::before {
  animation: voice-arc 760ms ease-in-out infinite;
}

.voice-bubble.playing .voice-waveform::after {
  animation: voice-arc 760ms 180ms ease-in-out infinite;
}

@keyframes voice-arc {
  50% {
    opacity: 0.9;
    transform: translateY(-50%) scale(1.08);
  }
}

.voice-duration {
  flex: 0 0 auto;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.messages-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  flex-direction: column;
  min-height: 260px;
  color: var(--ios-secondary);
  font-size: 11px;
  text-align: center;
}

.messages-empty span {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 9px;
  color: var(--ios-blue);
  font-size: 23px;
  background: rgba(0, 122, 255, 0.08);
  border-radius: 50%;
}

.typing-line {
  min-height: 17px;
  padding: 1px 21px 2px;
  color: var(--ios-tertiary);
  font-size: 9px;
}

.upload-status {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 25px;
  margin: 0 16px 3px;
  padding: 5px 10px;
  color: var(--ios-secondary);
  font-size: 10px;
  background: rgba(0, 122, 255, 0.07);
  border-radius: 9px;
}

.upload-status i {
  width: 11px;
  height: 11px;
  border: 1.5px solid rgba(0, 122, 255, 0.24);
  border-top-color: var(--ios-blue);
  border-radius: 50%;
  animation: upload-spin 700ms linear infinite;
}

@keyframes upload-spin {
  to {
    transform: rotate(360deg);
  }
}

.message-composer {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 5px;
  min-height: 52px;
  margin: 0 10px calc(8px + var(--safe-bottom));
  padding: 6px;
  background: var(--ios-fill);
  border: 0;
  border-radius: 22px;
}

.message-composer textarea {
  flex: 1;
  width: 100%;
  min-height: 38px;
  max-height: 112px;
  padding: 9px 4px 7px;
  overflow-y: auto;
  color: var(--ios-label);
  font-size: 16px;
  line-height: 1.35;
  resize: none;
  background: transparent;
  border: 0;
  outline: 0;
}

.message-composer textarea::placeholder {
  color: var(--ios-tertiary);
}

.composer-tool,
.mic-button,
.send-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 35px;
  height: 35px;
  margin-bottom: 1px;
  padding: 0;
  border: 0;
  border-radius: 50%;
}

.composer-tool {
  position: relative;
  color: var(--ios-secondary);
  background: transparent;
}

.composer-tool.uploading svg {
  opacity: 0.2;
}

.composer-tool.uploading::after {
  position: absolute;
  width: 17px;
  height: 17px;
  content: "";
  border: 2px solid rgba(0, 122, 255, 0.22);
  border-top-color: var(--ios-blue);
  border-radius: 50%;
  animation: upload-spin 650ms linear infinite;
}

.composer-tool svg,
.mic-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.emoji-toggle {
  font-size: 23px;
  line-height: 1;
}

.quick-toggle svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.quick-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 16;
  display: flex;
  max-height: min(55vh, 470px);
  padding: 12px;
  flex-direction: column;
  background: rgba(249, 249, 251, 0.97);
  border: 0.5px solid var(--ios-separator);
  border-radius: 18px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.quick-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 9px;
}

.quick-panel-heading > div {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.quick-panel-heading strong {
  font-size: 15px;
}

.quick-panel-heading span {
  color: var(--ios-tertiary);
  font-size: 9px;
}

.quick-panel-heading button {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  padding: 0 0 2px;
  color: var(--ios-secondary);
  font-size: 20px;
  background: var(--ios-fill);
  border: 0;
  border-radius: 50%;
}

.quick-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  min-height: 50px;
  overflow-y: auto;
}

.quick-empty {
  grid-column: 1 / -1;
  padding: 20px 8px;
  color: var(--ios-tertiary);
  font-size: 11px;
  text-align: center;
}

.quick-item {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: white;
  border-radius: 12px;
}

.quick-send {
  display: flex;
  align-items: flex-start;
  width: 100%;
  min-height: 55px;
  padding: 11px;
  overflow: hidden;
  color: var(--ios-label);
  font-size: 12px;
  line-height: 1.4;
  text-align: left;
  background: transparent;
  border: 0;
}

.quick-send.text {
  padding-right: 31px;
}

.quick-send.image {
  display: block;
  height: 108px;
  min-height: 108px;
  padding: 0;
}

.quick-send img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.quick-send p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.quick-delete {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  padding: 0 0 1px;
  color: white;
  font-size: 15px;
  background: rgba(0, 0, 0, 0.46);
  border: 0;
  border-radius: 50%;
}

.quick-add-row {
  display: flex;
  gap: 6px;
  margin-top: 9px;
}

.quick-add-row input {
  min-width: 0;
  flex: 1;
  height: 36px;
  padding: 0 10px;
  color: var(--ios-label);
  font-size: 16px;
  background: white;
  border: 0;
  border-radius: 9px;
  outline: 0;
}

.quick-add-row button,
.quick-image-add {
  height: 36px;
  padding: 0 12px;
  color: white;
  font-size: 11px;
  font-weight: 600;
  background: var(--ios-blue);
  border: 0;
  border-radius: 9px;
}

.quick-image-add {
  width: 100%;
  margin-top: 7px;
  color: var(--ios-blue);
  background: rgba(0, 122, 255, 0.08);
}

.emoji-picker {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  left: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
  padding: 8px;
  background: rgba(249, 249, 251, 0.96);
  border: 0.5px solid var(--ios-separator);
  border-radius: 18px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 15;
  animation: emoji-in 150ms ease-out;
}

@keyframes emoji-in {
  from {
    opacity: 0;
    transform: translateY(5px) scale(0.98);
  }
}

.emoji-picker button {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 0;
  font-size: 25px;
  background: transparent;
  border: 0;
  border-radius: 9px;
}

.emoji-picker button:active {
  background: var(--ios-fill);
}

.mic-button {
  color: var(--ios-secondary);
  background: transparent;
}

.mic-button.recording {
  color: var(--ios-red);
}

.send-button {
  display: none;
  color: white;
  background: var(--ios-blue);
  box-shadow: 0 3px 9px rgba(0, 122, 255, 0.24);
}

.send-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
  stroke: var(--ios-blue);
  stroke-width: 1;
}

.message-composer.has-text .mic-button {
  display: none;
}

.message-composer.has-text .send-button {
  display: grid;
}

.recording-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  min-height: 50px;
  margin: 0 10px 7px;
  padding: 7px 10px;
  background: rgba(255, 59, 48, 0.08);
  border-radius: 15px;
}

.recording-cancel,
.recording-send {
  flex: 0 0 auto;
  padding: 7px 11px;
  font-size: 11px;
  border: 0;
  border-radius: 9px;
}

.recording-cancel {
  color: var(--ios-secondary);
  background: rgba(255, 255, 255, 0.8);
}

.recording-send {
  color: white;
  background: var(--ios-red);
}

.recording-state {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.recording-state > i {
  width: 9px;
  height: 9px;
  background: var(--ios-red);
  border-radius: 50%;
  animation: recording-pulse 1s ease-in-out infinite;
}

@keyframes recording-pulse {
  50% {
    opacity: 0.35;
  }
}

.recording-state > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.recording-state strong {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.recording-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 16px;
}

.recording-wave b {
  width: 2px;
  height: 6px;
  background: var(--ios-red);
  border-radius: 2px;
  animation: recording-wave 650ms ease-in-out infinite alternate;
}

.recording-wave b:nth-child(2) {
  height: 13px;
  animation-delay: -200ms;
}

.recording-wave b:nth-child(3) {
  height: 9px;
  animation-delay: -400ms;
}

.recording-wave b:nth-child(4) {
  height: 15px;
  animation-delay: -300ms;
}

.recording-wave b:nth-child(5) {
  height: 7px;
  animation-delay: -500ms;
}

@keyframes recording-wave {
  to {
    height: 3px;
  }
}

.modal-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.friend-modal {
  position: fixed;
  z-index: 31;
  top: 50%;
  left: 50%;
  width: min(calc(100% - 30px), 470px);
  max-height: min(82dvh, 640px);
  padding: 11px 20px 22px;
  overflow-y: auto;
  background: var(--ios-bg);
  border-radius: 24px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.24);
  transform: translate(-50%, -50%);
}

.sheet-handle {
  width: 36px;
  height: 4px;
  margin: 0 auto 16px;
  background: rgba(60, 60, 67, 0.2);
  border-radius: 4px;
}

.modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.modal-heading h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0 0 2px;
  color: var(--ios-secondary);
  font-size: 22px;
  background: var(--ios-fill);
  border: 0;
  border-radius: 50%;
}

.modal-subtitle {
  margin: 7px 0 16px;
  color: var(--ios-secondary);
  font-size: 11px;
}

.friend-search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 5px 5px 11px;
  color: var(--ios-tertiary);
  background: white;
  border-radius: 12px;
}

.friend-search-form input {
  min-width: 0;
  flex: 1;
  height: 38px;
  color: var(--ios-label);
  font-size: 16px;
  background: transparent;
  border: 0;
  outline: 0;
}

.friend-search-form button {
  height: 34px;
  padding: 0 12px;
  color: white;
  font-size: 11px;
  background: var(--ios-blue);
  border: 0;
  border-radius: 9px;
}

.search-hint {
  margin: 9px 2px 8px;
  color: var(--ios-tertiary);
  font-size: 10px;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px 9px;
  background: white;
  border-radius: 13px;
}

.search-result .avatar {
  width: 40px;
  height: 40px;
  font-size: 12px;
}

.search-result-copy {
  min-width: 0;
  flex: 1;
}

.search-result-copy strong {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
}

.search-result-copy span {
  display: block;
  margin-top: 3px;
  color: var(--ios-tertiary);
  font-size: 9px;
}

.search-result button {
  min-width: 60px;
  min-height: 31px;
  padding: 0 9px;
  color: white;
  font-size: 10px;
  background: var(--ios-blue);
  border: 0;
  border-radius: 8px;
}

.search-result button:disabled {
  color: var(--ios-secondary);
  background: var(--ios-fill);
}

.image-viewer {
  position: fixed;
  z-index: 60;
  display: grid;
  place-items: center;
  inset: 0;
  padding: calc(30px + var(--safe-top)) 14px calc(24px + var(--safe-bottom));
  background: rgba(0, 0, 0, 0.94);
  animation: viewer-in 160ms ease-out;
}

@keyframes viewer-in {
  from {
    opacity: 0;
  }
}

.image-viewer img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 5px;
}

.image-viewer-close {
  position: absolute;
  top: calc(13px + var(--safe-top));
  right: 16px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0 0 2px;
  color: white;
  font-size: 25px;
  background: rgba(255, 255, 255, 0.18);
  border: 0;
  border-radius: 50%;
  backdrop-filter: blur(10px);
}

body.viewer-open {
  overflow: hidden;
}

.image-send-preview {
  position: fixed;
  z-index: 65;
  display: flex;
  align-items: center;
  justify-content: center;
  inset: 0;
  padding: calc(53px + var(--safe-top)) 13px calc(78px + var(--safe-bottom));
  background: #000;
}

.image-send-preview img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.image-preview-close {
  position: absolute;
  top: calc(13px + var(--safe-top));
  left: 15px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0 0 2px;
  color: white;
  font-size: 26px;
  background: rgba(255, 255, 255, 0.15);
  border: 0;
  border-radius: 50%;
}

.image-preview-actions {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px calc(12px + var(--safe-bottom));
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(16px);
}

.image-preview-actions button {
  min-width: 74px;
  height: 38px;
  font-size: 14px;
  font-weight: 600;
  border: 0;
  border-radius: 8px;
}

.image-preview-cancel {
  color: white;
  background: rgba(255, 255, 255, 0.15);
}

.image-preview-send {
  color: white;
  background: #07c160;
}

body.image-preview-open {
  overflow: hidden;
}

.toast {
  position: fixed;
  z-index: 70;
  top: calc(15px + var(--safe-top));
  left: 50%;
  max-width: calc(100vw - 36px);
  padding: 9px 14px;
  color: white;
  font-size: 11px;
  text-align: center;
  background: rgba(28, 28, 30, 0.92);
  border-radius: 999px;
  box-shadow: 0 9px 28px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px);
  transition:
    opacity 150ms ease,
    transform 150ms ease;
  backdrop-filter: blur(12px);
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 820px) {
  .app-frame {
    display: block;
    width: 100%;
    border: 0;
  }

  .sidebar {
    width: 100%;
    height: 100dvh;
    border: 0;
  }

  .chat-pane {
    position: fixed;
    z-index: 20;
    inset: 0;
    display: none;
    background: white;
  }

  body.chat-open .chat-pane {
    display: flex;
  }

  body.chat-open .sidebar {
    visibility: hidden;
  }

  .back-button {
    display: grid;
  }

  .chat-empty {
    display: none;
  }

  .conversation-header {
    padding-right: 13px;
    padding-left: 9px;
  }

  .message-viewport {
    padding-right: 13px;
    padding-left: 13px;
  }

  .message-row {
    max-width: 88%;
  }

  .friend-modal {
    top: auto;
    bottom: 0;
    width: 100%;
    max-height: 82dvh;
    padding-bottom: calc(22px + var(--safe-bottom));
    border-radius: 24px 24px 0 0;
    transform: translate(-50%, 0);
  }
}

@media (max-width: 390px) {
  .auth-stage {
    padding-right: 13px;
    padding-left: 13px;
  }

  .auth-card {
    padding-right: 18px;
    padding-left: 18px;
  }

  .auth-illustration {
    height: 94px;
  }

  .speech-front {
    top: 35px;
  }

  .speech-back {
    top: 14px;
  }

  .sidebar-panel {
    padding-right: 9px;
    padding-left: 9px;
  }

  .message-bubble {
    font-size: 14px;
  }

  .message-bubble.image-bubble {
    max-width: 72vw;
  }
}

@media (min-width: 821px) and (max-height: 690px) {
  .auth-illustration {
    height: 83px;
    margin-bottom: 12px;
  }

  .speech-front {
    top: 29px;
    height: 44px;
  }

  .speech-back {
    top: 11px;
  }

  .auth-card {
    padding-top: 16px;
    padding-bottom: 15px;
  }

  .auth-subtitle {
    margin-bottom: 13px;
  }
}

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