:root {
  --wx-bg: #ededed;
  --wx-panel: #f7f7f7;
  --wx-border: #d5d5d5;
  --wx-outgoing: #95ec69;
  --wx-green: #07c160;
  --wx-text: #111111;
  --wx-muted: #9a9a9a;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #d7d7d7;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    "Microsoft YaHei", sans-serif;
  color: var(--wx-text);
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

button {
  font: inherit;
}

.phone {
  width: min(420px, 100vw);
  height: min(100dvh, 880px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--wx-bg);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.24);
  position: relative;
}

.status-bar {
  height: 30px;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: flex-end;
  padding: 4px 16px 6px;
  background: var(--wx-bg);
  font-size: 13px;
  font-weight: 600;
  z-index: 3;
}

.status-time {
  min-width: 46px;
  justify-self: start;
}

.usage-progress {
  min-width: 0;
  text-align: center;
  color: #9a9a9a;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.status-icons {
  display: flex;
  align-items: center;
  gap: 5px;
  justify-self: end;
}

.status-icons svg {
  display: block;
}

.status-icons .signal {
  width: 18px;
  height: 12px;
}

.status-icons .wifi {
  width: 16px;
  height: 12px;
}

.status-icons .battery {
  width: 27px;
  height: 12px;
}

.chat-header {
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 6px;
  background: var(--wx-bg);
  border-bottom: 1px solid var(--wx-border);
  z-index: 2;
}

.header-button {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--wx-text);
  cursor: pointer;
}

.header-button svg {
  width: 24px;
  height: 24px;
}

.chat-heading {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.chat-name {
  font-size: 17px;
  font-weight: 500;
  line-height: 1.25;
}

.chat-title-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.trial-badge {
  padding: 2px 6px;
  border-radius: 999px;
  background: #9a9a9a;
  color: #fff;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.2;
}

.chat-sub {
  height: 14px;
  font-size: 11px;
  line-height: 14px;
  color: var(--wx-muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 18px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.system-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0 14px;
}

.system-pill {
  max-width: 88%;
  padding: 3px 9px;
  border-radius: 4px;
  background: #c8c8c8;
  color: #6b6b6b;
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 14px;
  animation: message-in 0.18s ease-out;
}

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

.avatar {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.avatar-image {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 6px;
  object-fit: cover;
}

.message-row.incoming .avatar {
  background: #57a5f5;
}

.message-row.outgoing {
  flex-direction: row-reverse;
}

.message-row.outgoing .avatar {
  background: #a6a6a6;
}

.message-content {
  max-width: calc(100% - 92px);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.message-row.incoming .message-content {
  align-items: flex-start;
}

.message-row.outgoing .message-content {
  align-items: flex-end;
}

.bubble {
  max-width: 100%;
  padding: 8px 11px;
  border-radius: 6px;
  font-size: 16px;
  line-height: 1.42;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-row.incoming .bubble {
  background: #fff;
  border-top-left-radius: 2px;
}

.message-row.outgoing .bubble {
  background: var(--wx-outgoing);
  border-top-right-radius: 2px;
}

.message-time {
  margin-top: 3px;
  font-size: 10px;
  color: var(--wx-muted);
}

.composer {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  background: var(--wx-panel);
  border-top: 1px solid var(--wx-border);
}

.composer-button {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  color: #333;
  cursor: pointer;
}

.composer-button svg {
  width: 24px;
  height: 24px;
}

.composer-input-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  height: 38px;
  background: #fff;
  border: 1px solid #dadada;
  border-radius: 6px;
}

.composer-input {
  width: 100%;
  height: 100%;
  padding: 0 10px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  color: var(--wx-text);
}

.composer-input:disabled {
  color: #888;
}

.send-button {
  height: 36px;
  flex-shrink: 0;
  padding: 0 16px;
  border: none;
  border-radius: 6px;
  background: var(--wx-green);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.send-button:disabled {
  opacity: 0.45;
  cursor: default;
}

@media (max-width: 480px) {
  body {
    align-items: stretch;
    background: var(--wx-bg);
  }

  .phone {
    width: 100vw;
    height: 100dvh;
    box-shadow: none;
  }
}
