:root {
  color-scheme: light;
  --ink: #4b2434;
  --muted: #9b6679;
  --paper: #fff7fa;
  --line: #f4c7d8;
  --mint: #ffb6cf;
  --coral: #ff6fa5;
  --sky: #ffc9dd;
  --gold: #ffd36e;
  --violet: #d884ff;
  --shadow: 0 18px 50px rgba(170, 63, 105, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 182, 207, 0.55), transparent 28%),
    linear-gradient(145deg, #fff3f8, #ffe3ef 48%, #fff9fc);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 108px minmax(320px, 430px);
  justify-content: center;
  gap: 22px;
  padding: 24px;
}

.side-rail {
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 58px;
  height: 58px;
  margin-bottom: 8px;
}

.brand-mark img {
  width: 100%;
  height: 100%;
}

.rail-button {
  width: 84px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
}

.rail-button.active {
  background: var(--coral);
  color: white;
}

.phone-frame {
  min-height: calc(100vh - 48px);
  max-height: 920px;
  overflow: auto;
  border: 1px solid rgba(255, 143, 184, 0.24);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 20px;
}

.top-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.language-switch {
  margin-left: auto;
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-align: right;
}

.language-switch select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 8px;
  font: inherit;
}

body:not([data-current-view="home"]) .home-only {
  display: none;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 2rem;
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 1.08rem;
}

.icon-button,
.primary-button,
.mini-button,
.reply-form button,
.action-button,
.ghost-button,
.media-picker,
.chat-form button {
  border: 0;
  border-radius: 8px;
}

.icon-button {
  padding: 9px 12px;
  background: var(--coral);
  color: white;
}

.hero-band {
  min-height: 164px;
  margin: 22px 0 18px;
  border-radius: 18px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background:
    radial-gradient(circle at 78% 22%, rgba(255, 211, 110, 0.48), transparent 31%),
    linear-gradient(135deg, #ff8fb8, #ffb6cf 55%, #fff0f6);
}

.orbit-visual {
  position: relative;
  min-height: 164px;
}

.note-shape {
  position: absolute;
  width: 58px;
  height: 42px;
  border-radius: 7px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

.note-one {
  left: 28px;
  top: 36px;
  background: #ffffff;
  transform: rotate(-10deg);
}

.note-two {
  left: 102px;
  top: 70px;
  background: #ffd36e;
  transform: rotate(8deg);
}

.note-three {
  left: 72px;
  top: 116px;
  background: #ff6fa5;
  transform: rotate(-3deg);
}

.hero-copy {
  display: flex;
  align-items: end;
  padding: 18px;
  color: white;
  font-weight: 700;
  font-size: 1.18rem;
  line-height: 1.25;
}

.quota-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  border: 1px solid rgba(255, 143, 184, 0.32);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.profile-quota {
  margin: 16px 0 0;
}

.profile-saved {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.quota-strip strong,
.quota-strip span {
  display: block;
}

.quota-strip span {
  color: var(--muted);
  font-size: 0.84rem;
}

.mini-button {
  min-height: 36px;
  padding: 0 12px;
  background: var(--coral);
  color: white;
  white-space: nowrap;
}

.mood-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.mood-chip {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  padding: 0 14px;
}

.mood-chip.active {
  border-color: var(--coral);
  color: var(--coral);
  font-weight: 700;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0;
  color: var(--muted);
}

.section-head h2 {
  color: var(--ink);
}

.note-feed {
  display: grid;
  gap: 12px;
}

.note-card,
.composer,
.billing-panel,
.profile-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 16px;
}

.note-meta,
.note-actions,
.composer-footer,
.composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mood-pill {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.mood-Hopeful {
  background: rgba(112, 199, 167, 0.22);
  color: #14634a;
}

.mood-期待 {
  background: rgba(255, 111, 165, 0.16);
  color: #c72f75;
}

.mood-Quiet,
.mood-安静 {
  background: rgba(122, 167, 255, 0.22);
  color: #244f9f;
}

.mood-Funny,
.mood-开心 {
  background: rgba(244, 184, 74, 0.25);
  color: #7a5200;
}

.mood-Question,
.mood-提问 {
  background: rgba(143, 126, 231, 0.22);
  color: #4c3cad;
}

.time-label,
.note-author,
.reply-list,
#charCount {
  color: var(--muted);
  font-size: 0.86rem;
}

.note-text {
  margin: 14px 0 10px;
  font-size: 1.03rem;
  line-height: 1.45;
}

.reply-list {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.reply-item {
  border-left: 3px solid var(--mint);
  padding-left: 9px;
}

.reply-form {
  display: none;
  grid-template-columns: 1fr 66px;
  gap: 8px;
  margin: 12px 0;
}

.reply-form.open {
  display: grid;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  min-height: 138px;
  resize: vertical;
}

label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.composer {
  display: grid;
  gap: 14px;
}

.composer-footer {
  flex-wrap: wrap;
}

.composer-footer .media-picker {
  min-height: 42px;
}

.note-attachment {
  margin: 10px 0 0;
}

.note-attachment:empty {
  display: none;
}

.note-attachment .chat-attachment {
  max-width: 100%;
}

.primary-button,
.reply-form button {
  background: var(--coral);
  color: white;
  min-height: 42px;
  padding: 0 16px;
}

.action-button {
  min-height: 38px;
  padding: 0 14px;
  background: #eef2f5;
  color: var(--ink);
}

.action-button.saved {
  background: var(--coral);
  color: white;
}

.profile-panel {
  text-align: center;
}

.billing-head {
  align-items: flex-start;
  margin-top: 0;
}

.billing-head p,
.billing-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.balance-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #ff6fa5, #ff9cc2);
  color: white;
  padding: 16px;
}

.balance-card span {
  color: rgba(255, 255, 255, 0.72);
}

.balance-card strong {
  font-size: 2rem;
}

.plan-grid {
  display: grid;
  gap: 10px;
}

.plan-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  text-align: left;
}

.plan-card:hover {
  border-color: var(--coral);
}

.plan-card span {
  color: var(--coral);
  font-weight: 800;
}

.profile-form,
.chat-panel {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.profile-form label,
.chat-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.profile-form input,
.profile-form select,
.chat-panel input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 44px;
  padding: 0 12px;
  font: inherit;
}

.profile-form select:disabled {
  color: var(--muted);
  background: #fff5f8;
}

.account-line,
.lock-note,
.policy-links {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  word-break: break-all;
}

.policy-links a {
  color: var(--coral);
  font-weight: 700;
}

.profile-billing {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.chat-panel {
  min-height: 58vh;
}

.chat-launch {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(255, 143, 184, 0.42);
  border-radius: 12px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 12px 26px rgba(255, 111, 165, 0.12);
}

.chat-launch strong {
  font-size: 1.08rem;
}

.chat-launch span {
  color: var(--muted);
  line-height: 1.45;
}

.chat-window-section {
  display: none;
}

.chat-panel.expanded .chat-launch {
  display: none;
}

.chat-panel.expanded .chat-window-section {
  display: flex;
}

.chat-panel.expanded .chat-peer-card,
.chat-panel.expanded .chat-thread,
.chat-panel.expanded .chat-form {
  display: grid;
}

.chat-panel.expanded .media-status {
  display: block;
}

.chat-panel.expanded {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 0;
  background: #f4f4f4;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
}

.chat-panel.expanded .chat-head {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 10px 4px 12px;
}

.chat-peer-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.chat-panel.expanded .chat-peer-card {
  border-radius: 0;
  border-width: 0 0 1px;
}

.chat-thread {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 420px;
  max-height: 58vh;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: #f4f4f4;
  padding: 12px;
}

.chat-panel.expanded .chat-thread {
  min-height: 0;
  max-height: none;
}

.chat-message {
  max-width: 78%;
  border-radius: 6px;
  background: #fff;
  border: 0;
  padding: 8px 10px;
  position: relative;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.chat-message.mine {
  justify-self: end;
  background: #ff7fb2;
  color: white;
}

.chat-message.unread {
  box-shadow: 0 0 0 2px rgba(255, 111, 165, 0.18);
}

.chat-message span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-bottom: 4px;
}

.chat-message.mine span {
  color: rgba(255, 255, 255, 0.78);
}

.chat-message p {
  margin: 0;
  line-height: 1.45;
}

.chat-attachment {
  display: block;
  width: 100%;
  max-width: 260px;
  margin-top: 8px;
  border-radius: 8px;
}

.chat-attachment.image,
.chat-attachment.video {
  max-height: 260px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #fff;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  background: #f7f7f7;
  border-top: 1px solid var(--line);
  padding: 8px;
}

.chat-form button,
.media-picker,
.ghost-button {
  min-height: 44px;
  padding: 0 13px;
  display: inline-grid;
  place-items: center;
  background: var(--coral);
  color: white;
  font: inherit;
  font-weight: 800;
}

.ghost-button,
.media-picker {
  background: #fff0f5;
  color: var(--coral);
  border: 1px solid #ffc4d7;
}

.media-status {
  color: var(--muted);
  font-size: 0.82rem;
  min-height: 20px;
}

.avatar {
  width: 74px;
  height: 74px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: linear-gradient(135deg, #ff6fa5, #ffb6cf);
  color: white;
  font-weight: 800;
  overflow: hidden;
}

.avatar-button {
  border: 0;
  cursor: pointer;
}

.avatar-button:active {
  transform: scale(0.98);
}

.avatar.has-image {
  background: #fff;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.stats-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 6px;
}

.stats-grid strong,
.stats-grid span {
  display: block;
}

.stats-grid span {
  color: var(--muted);
  font-size: 0.78rem;
}

.empty-state {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 22px;
  text-align: center;
}

@media (max-width: 720px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 0;
    gap: 0;
  }

  .phone-frame {
    min-height: 100vh;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding-left: 20px;
    padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  }

  .side-rail {
    position: fixed;
    z-index: 10;
    inset: auto 12px calc(0px + env(safe-area-inset-bottom, 0px));
    transform: none;
    flex-direction: row;
    justify-content: space-around;
    width: auto;
    padding: 8px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 12px 32px rgba(16, 24, 32, 0.18);
  }

  .brand-mark {
    display: none;
  }

  .rail-button {
    width: 64px;
    min-height: 44px;
  }

  .hero-band {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    align-items: start;
  }
}
