﻿:root {
  --bg: #120a24;
  --surface: #201032;
  --surface-strong: #fff4fb;
  --fg: #261922;
  --muted: #8d6f85;
  --subtle: #bd91b5;
  --border: #ead1e4;
  --accent: #ff69ad;
  --accent-pressed: #b93675;
  --accent-soft: #ffe8f6;
  --bubble-me: #ffd7ec;
  --bubble-other: #fff6fb;
  --link: #8b4a81;
  --danger: #fa5151;
  --warning: #fab702;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  --font-body: "MiSans", "HarmonyOS Sans SC", "Alibaba PuHuiTi", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 78% 16%, rgba(255, 105, 173, 0.2), transparent 120px),
    linear-gradient(180deg, #160c2a 0%, #f8ecf5 43%, #fff7fb 100%);
  overflow: hidden;
}

.app.ios {
  --nav-height: 54px;
}

.app.android {
  --nav-height: 58px;
  --accent: #ff69ad;
  --accent-soft: #ffe8f6;
  background:
    radial-gradient(circle at 74% 10%, rgba(255, 105, 173, 0.18), transparent 118px),
    linear-gradient(180deg, #180d2d 0%, #f8eef7 46%, #fff8fb 100%);
}

.topbar {
  min-height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-bottom: 1px solid rgba(255, 190, 236, 0.22);
  backdrop-filter: blur(18px);
  flex: 0 0 auto;
  color: #fff4fb;
}

.android .topbar {
  padding: 8px 16px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid rgba(255, 190, 236, 0.22);
  box-shadow: none;
}

.topbar-title {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.title-with-logo {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  column-gap: 9px;
  align-items: center;
}

.title-with-logo .mini-logo {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  box-shadow: 0 8px 18px rgba(255, 90, 117, 0.2);
}

.title-with-logo .topbar-title {
  min-width: 0;
}

.topbar-title h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: 0;
  color: #fff4fb;
}

.android .topbar-title h1 {
  font-size: 21px;
}

.topbar-title small {
  margin-top: 2px;
  color: #e8c7e3;
  font-size: 12px;
  line-height: 1.2;
}

.icon-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn,
.back-btn,
.send-btn,
.chip-btn,
.fab {
  min-width: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  color: currentColor;
  background: transparent;
  border-radius: 999px;
}

.icon-btn:active,
.back-btn:active,
.chip-btn:active {
  background: rgba(0, 0, 0, 0.06);
}

.icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.screen-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 90px;
}

.screen-scroll::-webkit-scrollbar {
  display: none;
}

.search {
  margin: 10px 14px 8px;
  min-height: 40px;
  border-radius: 12px;
  background: var(--surface-strong);
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  font-size: 14px;
  border: 1px solid transparent;
}

.android .search {
  border-radius: 24px;
  background: #f2e8e5;
  margin-top: 12px;
}

.section-label {
  margin: 18px 16px 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.conversation-list,
.settings-list {
  background: var(--surface-strong);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.android .conversation-list,
.android .settings-list {
  margin: 0 12px;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.conversation-row,
.setting-row {
  min-height: 72px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
}

.conversation-row:first-child,
.setting-row:first-child {
  border-top: 0;
}

.android .conversation-row,
.android .setting-row {
  border-top-color: #edf0ed;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(145deg, #24103d, #ff69ad);
  position: relative;
  overflow: hidden;
}

.avatar::after {
  content: "";
  position: absolute;
  inset: auto -18px -24px auto;
  width: 54px;
  height: 54px;
  background: rgba(255, 255, 255, 0.24);
  border-radius: 999px;
}

.avatar.blue {
  background:
    radial-gradient(circle at 52% 33%, #ffd6eb 0 9px, transparent 10px),
    radial-gradient(circle at 50% 58%, #30203d 0 20px, transparent 21px),
    linear-gradient(145deg, #1b1434, #8d4cff 48%, #ff69ad);
}

.avatar.gold {
  background:
    radial-gradient(circle at 50% 32%, #fff1e7 0 9px, transparent 10px),
    radial-gradient(circle at 50% 58%, #f2b489 0 20px, transparent 21px),
    linear-gradient(145deg, #55304d, #ffb176 45%, #ff69ad);
}

.avatar.dark {
  background:
    radial-gradient(circle at 50% 32%, #e7d7ff 0 9px, transparent 10px),
    radial-gradient(circle at 50% 58%, #261831 0 20px, transparent 21px),
    linear-gradient(145deg, #130b22, #583179 50%, #ff69ad);
}

.avatar.me {
  background:
    radial-gradient(circle at 50% 32%, #fff6fb 0 9px, transparent 10px),
    radial-gradient(circle at 50% 58%, #d58fd1 0 20px, transparent 21px),
    linear-gradient(145deg, #7a3eff, #ff69ad);
}

.presence {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: var(--accent);
  border: 2px solid var(--surface-strong);
}

.row-main {
  min-width: 0;
}

.row-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.row-title strong {
  font-size: 16px;
  line-height: 1.3;
  font-weight: 560;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta {
  align-self: stretch;
  min-width: 42px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 7px;
  color: var(--subtle);
  font-size: 12px;
  font-family: var(--font-mono);
}

.badge {
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-family: var(--font-mono);
}

.pin {
  color: var(--link);
  font-size: 11px;
  font-weight: 600;
}

.quick-panel {
  margin: 12px 14px;
  padding: 14px;
  background: var(--surface-strong);
  border-radius: 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
}

.android .quick-panel {
  margin-inline: 12px;
  border: 0;
}

.quick-panel h2 {
  margin: 0;
  font-size: 16px;
}

.quick-panel p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.market-hero {
  margin: 12px 14px 14px;
  padding: 18px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 88% 18%, rgba(255, 233, 248, 0.22), transparent 84px),
    radial-gradient(circle at 72% 80%, rgba(255, 105, 173, 0.28), transparent 92px),
    linear-gradient(135deg, #1a1032 0%, #4c1d62 55%, #ff69ad 100%);
  color: #fff;
  overflow: hidden;
  position: relative;
}

.market-hero::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -36px;
  width: 132px;
  height: 132px;
  border-radius: 999px;
  background: rgba(255, 190, 236, 0.18);
  box-shadow: 0 0 38px rgba(255, 105, 173, 0.36);
}

.market-hero::before {
  content: "☾";
  position: absolute;
  right: 28px;
  top: 18px;
  z-index: 1;
  color: #ffd4ef;
  font-size: 24px;
  text-shadow: 0 0 18px rgba(255, 105, 173, 0.8);
}

.market-hero h2 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

.market-hero p {
  position: relative;
  z-index: 1;
  margin: 8px 0 0;
  max-width: 25ch;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  line-height: 1.55;
}

.story-strip {
  margin: 0 14px 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.story-chip {
  min-height: 66px;
  padding: 10px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface-strong) 92%, #ffd4ef);
  border: 1px solid color-mix(in srgb, var(--border) 74%, #ff69ad);
}

.android .story-chip {
  border: 0;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.story-chip strong {
  display: block;
  font-size: 13px;
  line-height: 1.25;
}

.story-chip span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 14px 8px;
  -webkit-overflow-scrolling: touch;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 13px;
  font-weight: 560;
}

.filter-chip.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #ff9ad1 52%, #9a63ff);
  color: #fff;
}

.role-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 0 14px 96px;
}

.role-card {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 244, 251, 0.96), rgba(255, 235, 247, 0.9)),
    var(--surface-strong);
  border: 1px solid color-mix(in srgb, var(--border) 76%, #ff69ad);
  box-shadow: 0 10px 26px rgba(84, 28, 78, 0.08);
}

.android .role-card {
  border: 1px solid color-mix(in srgb, var(--border) 76%, #ff69ad);
  box-shadow: 0 10px 26px rgba(84, 28, 78, 0.08);
}

.role-card .avatar {
  width: 78px;
  height: 92px;
  border-radius: 16px;
  align-self: stretch;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.26), 0 10px 22px rgba(60, 22, 61, 0.12);
}

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

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

.role-top h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.role-tag {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-soft), #ffd5ee);
  color: var(--accent-pressed);
  font-size: 11px;
  font-weight: 650;
}

.role-desc {
  margin: 5px 0 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.role-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.role-meta {
  color: var(--subtle);
  font-family: var(--font-mono);
  font-size: 11px;
}

.start-chat {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, #27132b, #ff69ad);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
}

.primary-pill {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #ff9ad1 52%, #9a63ff);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.tabbar {
  flex: 0 0 auto;
  min-height: 70px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(18px);
  padding: 5px 4px 8px;
}

.android .tabbar {
  min-height: 72px;
  border-top: 0;
  box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05);
  background: var(--surface-strong);
}

.tab {
  min-height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
}

.tab.active {
  color: var(--accent);
  font-weight: 600;
}

.tab .icon {
  width: 22px;
  height: 22px;
}

.chat {
  background:
    radial-gradient(circle at 82% 18%, rgba(255, 105, 173, 0.2), transparent 110px),
    radial-gradient(circle at 18% 82%, rgba(118, 74, 255, 0.24), transparent 130px),
    linear-gradient(180deg, #150d2b 0%, #25133d 58%, #32184b 100%);
}

.message-area {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 14px 12px 12px;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.78) 0 1px, transparent 1.8px),
    linear-gradient(to top, rgba(255, 105, 173, 0.16), transparent 38%);
  background-size: 118px 118px, 100% 100%;
}

.message-area::-webkit-scrollbar {
  display: none;
}

.timestamp {
  display: table;
  margin: 8px auto 16px;
  padding: 4px 8px;
  border-radius: 5px;
  background: rgba(255, 244, 252, 0.12);
  color: #e8c7e3;
  font-size: 11px;
}

.msg-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 12px 0;
}

.msg-row.me {
  justify-content: flex-end;
}

.msg-avatar {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(145deg, #261340, #ff69ad);
  box-shadow: 0 0 18px rgba(255, 105, 173, 0.22);
}

.bubble {
  max-width: min(72%, 260px);
  min-height: 44px;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.58;
  color: #1a1a1a;
  word-break: break-word;
  animation: pop-in 180ms ease-out;
}

.bubble.other {
  background: var(--bubble-other);
  border-top-left-radius: 4px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.bubble.me {
  background: var(--bubble-me);
  color: #111936;
  border-top-right-radius: 4px;
}

.typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.typing i {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.45;
  animation: dot 1s infinite ease-in-out;
}

.typing i:nth-child(2) {
  animation-delay: 140ms;
}

.typing i:nth-child(3) {
  animation-delay: 280ms;
}

.inputbar {
  flex: 0 0 auto;
  background: rgba(29, 15, 48, 0.88);
  border-top: 1px solid rgba(255, 190, 236, 0.24);
  padding: 8px 8px 10px;
  backdrop-filter: blur(18px);
}

.compose-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.compose-field {
  flex: 1 1 auto;
  min-height: 44px;
  max-height: 92px;
  padding: 8px 12px;
  background: rgba(255, 244, 252, 0.9);
  border: 1px solid rgba(255, 190, 236, 0.28);
  border-radius: 18px;
  resize: none;
  outline: none;
  font-size: 15px;
  line-height: 1.45;
}

.android .compose-field {
  border-radius: 22px;
  background: rgba(255, 244, 252, 0.9);
  border-color: rgba(255, 190, 236, 0.28);
}

.compose-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 105, 173, 0.16);
}

.voice-capture {
  display: none;
  flex: 1 1 auto;
  min-height: 44px;
  border-radius: 20px;
  background: rgba(255, 244, 252, 0.9);
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 15px;
  font-weight: 560;
}

.inputbar.voice-mode .compose-field {
  display: none;
}

.inputbar.voice-mode .voice-capture {
  display: block;
}

.send-btn {
  min-width: 54px;
  padding: 0 13px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), #ff9ad1 52%, #9a63ff);
  color: #fff;
  font-size: 14px;
  font-weight: 650;
}

.send-btn:disabled {
  background: #d7d7d7;
  color: #888;
}

.panel {
  display: none;
  padding: 12px 6px 2px;
}

.panel.open {
  display: block;
}

.emoji-grid,
.attach-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.emoji-grid button,
.attach-item {
  min-height: 48px;
  border-radius: 14px;
  background: #fff;
  color: var(--fg);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 14px;
}

.attach-item span {
  color: var(--muted);
  font-size: 12px;
}

.sheet {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 20;
  background: var(--surface-strong);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 8px;
  transform: translateY(130%);
  transition: transform 200ms ease;
}

.sheet.open {
  transform: translateY(0);
}

.sheet button {
  width: 100%;
  min-height: 46px;
  text-align: left;
  padding: 0 14px;
  background: transparent;
  color: var(--fg);
  border-radius: 12px;
}

.sheet button:active {
  background: rgba(0, 0, 0, 0.05);
}

.profile-head {
  padding: 18px 16px 14px;
  background: var(--surface-strong);
  border-bottom: 1px solid var(--border);
}

.android .profile-head {
  margin: 12px;
  border: 0;
  border-radius: 22px;
}

.profile-card {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  align-items: center;
  gap: 14px;
}

.profile-card .avatar {
  width: 60px;
  height: 60px;
  border-radius: 18px;
}

.profile-name {
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
  font-weight: 700;
}

.profile-id {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.status-card {
  margin-top: 16px;
  padding: 12px;
  border-radius: 16px;
  background: var(--accent-soft);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.status-card strong {
  display: block;
  font-size: 15px;
}

.status-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.relationship-card {
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  background: #fff3ef;
  border: 1px solid #f0d5cc;
}

.android .relationship-card {
  background: #fff3ef;
  border-color: #f0d5cc;
}

.relationship-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.relationship-head strong {
  font-size: 15px;
}

.relationship-head span {
  color: var(--muted);
  font-size: 12px;
}

.progress-line {
  margin-top: 10px;
  height: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.progress-line i {
  display: block;
  width: 58%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffd7a8, var(--accent), #ff8a63);
}

.trait-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.trait-row span {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 90, 117, 0.11);
  color: var(--accent-pressed);
  font-size: 11px;
  font-weight: 650;
}

.setting-row {
  grid-template-columns: 34px minmax(0, 1fr) auto;
  min-height: 56px;
}

.setting-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
}

.setting-row strong {
  font-size: 15px;
  font-weight: 560;
}

.setting-row span {
  color: var(--muted);
  font-size: 13px;
}

.fab {
  position: fixed;
  right: 18px;
  bottom: 86px;
  z-index: 10;
  min-width: 56px;
  min-height: 56px;
  background: linear-gradient(135deg, var(--accent), #ff8a63);
  color: #fff;
  box-shadow: 0 12px 26px rgba(255, 90, 117, 0.3);
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes dot {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-3px);
    opacity: 0.9;
  }
}

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