:root {
  --filing-height: 38px;
  --bg: #fbf8fb;
  --surface: #ffffff;
  --surface-soft: #fff3f6;
  --surface-mint: #eff9f6;
  --ink: #2f2933;
  --muted: #7c7280;
  --line: #eadfe6;
  --rose: #d86f87;
  --rose-deep: #ad4962;
  --teal: #4fa59c;
  --blue: #6f86c7;
  --lemon: #f0c96a;
  --danger: #c85b5b;
  --shadow: 0 14px 38px rgba(126, 82, 106, 0.12);
  --shadow-soft: 0 8px 22px rgba(126, 82, 106, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(216, 111, 135, 0.08), transparent 36%),
    linear-gradient(225deg, rgba(79, 165, 156, 0.09), transparent 34%),
    linear-gradient(180deg, #fffdfd 0%, var(--bg) 62%, #f2fbf8 100%);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

button,
.checkin-uploader,
.media-open-button {
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease, background-color 0.18s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.checkin-uploader:focus-within {
  outline: 3px solid rgba(111, 134, 199, 0.28);
  outline-offset: 2px;
}

img {
  display: block;
  max-width: 100%;
}

.app {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: calc(100vh - var(--filing-height));
}

.sidebar {
  position: sticky;
  top: 0;
  height: calc(100vh - var(--filing-height));
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  box-shadow: 10px 0 28px rgba(126, 82, 106, 0.07);
}

.brand,
.pair-card,
.person-line,
.top-actions,
.section-title,
.control-row,
.range-line,
.datetime-line {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--rose), var(--teal));
  font-weight: 800;
}

.brand span,
.pair-card span,
.person-line span,
.eyebrow,
.muted,
.meta,
.empty {
  color: var(--muted);
}

.brand strong,
.brand span,
.pair-card strong,
.pair-card span,
.person-line strong,
.person-line span {
  display: block;
}

.pair-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #fff7fa, #f0fbf8);
}

.pair-card img,
.person-line img,
.profile-button img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 2px solid #ffffff;
  box-shadow: var(--shadow-soft);
}

.avatar-button {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.avatar-button img,
.message-avatar {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.avatar-button:hover img,
.message-avatar:hover,
.profile-button:hover img {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(126, 82, 106, 0.16);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item,
.icon-button,
.profile-button,
.primary-button,
.ghost-button,
.text-button,
.send-button,
.file-pill,
.segmented button,
.action-chip {
  border: 0;
  border-radius: 8px;
}

.nav-item {
  position: relative;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  color: var(--rose-deep);
  background: #fff0f4;
}

.nav-item.active {
  box-shadow: inset 3px 0 0 var(--rose);
}

.nav-item i {
  min-width: 8px;
  height: 8px;
  margin-left: auto;
  border-radius: 99px;
}

.nav-item i.on {
  background: var(--teal);
}

.nav-item .nav-badge {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  margin-left: auto;
  padding: 0 6px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--rose);
  box-shadow: 0 6px 14px rgba(216, 111, 135, 0.24);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
}

.nav-item .nav-badge[hidden] {
  display: none;
}

[data-icon] {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

[data-icon] svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stage {
  min-width: 0;
  padding: 28px;
}

.topbar {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.22;
}

h2 {
  margin-bottom: 12px;
  font-size: 22px;
  line-height: 1.32;
}

h3 {
  margin-bottom: 10px;
  font-size: 17px;
}

.api-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 260px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

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

.api-field input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.icon-button,
.profile-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--rose-deep);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.icon-button {
  width: 42px;
}

.profile-button {
  padding: 4px 12px 4px 4px;
  color: var(--ink);
}

.auth-panel,
.pair-setup,
.home-hero,
.summary-card,
.composer,
.chat-panel,
.wish-form,
.points-panel,
.whisper-form,
.profile-form,
.item-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: var(--shadow-soft);
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.7fr) minmax(240px, 0.7fr);
  gap: 16px;
  align-items: stretch;
  padding: 18px;
  margin-bottom: 18px;
}

.auth-copy {
  padding: 8px 10px;
}

.auth-form,
.inline-form,
.wish-form,
.whisper-form,
.profile-form {
  display: grid;
  gap: 10px;
}

.auth-form {
  padding: 16px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.auth-form:nth-child(3) {
  background: var(--surface-mint);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  outline: 0;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  padding: 12px;
  resize: vertical;
  line-height: 1.65;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(216, 111, 135, 0.14);
}

.primary-button,
.ghost-button,
.send-button,
.text-button,
.action-chip,
.file-pill {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  font-weight: 700;
}

.primary-button,
.send-button {
  color: #ffffff;
  background: linear-gradient(135deg, var(--rose), var(--teal));
  box-shadow: 0 10px 22px rgba(216, 111, 135, 0.16);
}

.ghost-button,
.text-button,
.action-chip,
.file-pill {
  color: var(--rose-deep);
  background: #fff0f4;
}

.text-button {
  background: transparent;
}

.pair-setup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr);
  gap: 14px;
  padding: 18px;
  margin-bottom: 18px;
}

.pair-setup[hidden] {
  display: none;
}

.invite-list {
  display: grid;
  gap: 8px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.home-hero {
  min-height: 190px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 18px;
  align-items: stretch;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 241, 244, 0.84)),
    linear-gradient(90deg, rgba(216, 111, 135, 0.16), rgba(79, 165, 156, 0.12));
}

.home-hero h2 {
  max-width: 760px;
  margin-bottom: 10px;
  font-size: 30px;
}

.points-meter,
.points-panel {
  display: grid;
  place-items: center;
  align-content: center;
  color: #ffffff;
  background: linear-gradient(155deg, var(--rose), var(--blue));
}

.points-meter {
  border-radius: 8px;
}

.points-meter strong,
.points-panel strong {
  font-size: 54px;
  line-height: 1;
}

.points-meter span,
.points-meter small,
.points-panel span,
.points-panel small {
  color: rgba(255, 255, 255, 0.86);
}

.summary-grid,
.two-columns,
.card-grid,
.wish-layout,
.whisper-layout {
  display: grid;
  gap: 16px;
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 16px 0;
}

.summary-card {
  min-height: 118px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 16px;
}

.summary-card strong {
  font-size: 28px;
}

.two-columns {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
}

.section-title {
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title h2 {
  margin: 0;
}

.section-title > .primary-button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.stack {
  display: grid;
  gap: 12px;
}

.item-card {
  padding: 15px;
}

.item-card p:last-child {
  margin-bottom: 0;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 8px;
  color: var(--rose-deep);
  background: #fff0f4;
  font-size: 13px;
  font-weight: 700;
}

.status-tag.good {
  color: #ffffff;
  background: var(--teal);
}

.status-tag.warn {
  color: #765012;
  background: #fff2cf;
}

.status-tag.done {
  color: #ffffff;
  background: var(--blue);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.media-grid img,
.preview-row img,
.protected-media {
  width: 100%;
  aspect-ratio: 1.24;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.media-placeholder {
  min-height: 130px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff8fa;
}

.composer {
  padding: 18px;
  margin-bottom: 16px;
}

.checkin-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.choice-field {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-size: 13px;
}

.field-head small {
  color: var(--muted);
  font-weight: 600;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-chip {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #ffffff;
  font-size: 13px;
  font-weight: 700;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.choice-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(216, 111, 135, 0.45);
  box-shadow: var(--shadow-soft);
}

.choice-chip.active {
  color: #ffffff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--rose), var(--teal));
  box-shadow: 0 8px 18px rgba(216, 111, 135, 0.14);
}

.choice-field input {
  width: 100%;
}

.checkin-photo-panel {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  margin-top: 12px;
}

.checkin-uploader {
  position: relative;
  min-height: 126px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px dashed rgba(216, 111, 135, 0.45);
  border-radius: 8px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 240, 244, 0.72), rgba(239, 249, 246, 0.78)),
    #ffffff;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.checkin-uploader:hover,
.checkin-uploader.drag-over {
  transform: translateY(-1px);
  border-color: var(--rose);
  box-shadow: var(--shadow-soft);
  background:
    linear-gradient(135deg, rgba(255, 229, 236, 0.86), rgba(227, 249, 243, 0.9)),
    #ffffff;
}

.checkin-uploader input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.checkin-uploader strong,
.checkin-uploader small {
  display: block;
}

.checkin-uploader small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.upload-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--rose), var(--teal));
  box-shadow: var(--shadow-soft);
}

.control-row {
  flex-wrap: wrap;
  margin-top: 10px;
}

.control-row label {
  display: grid;
  min-width: 150px;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.file-pill {
  position: relative;
  min-width: auto;
  color: var(--rose-deep);
}

.file-pill input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.preview-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, 1fr));
  gap: 8px;
  min-height: 126px;
}

.preview-row:empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 243, 246, 0.58));
}

.preview-row:empty::after {
  content: "图片预览";
  display: grid;
  place-items: center;
  min-height: 126px;
  color: var(--muted);
  font-size: 13px;
}

.preview-thumb {
  position: relative;
  min-height: 126px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff8fa;
  box-shadow: var(--shadow-soft);
}

.preview-thumb img {
  width: 100%;
  height: 100%;
  min-height: 126px;
  object-fit: cover;
}

.preview-remove {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(47, 41, 51, 0.72);
  box-shadow: var(--shadow-soft);
}

.preview-thumb span {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  overflow: hidden;
  padding: 5px 7px;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(47, 41, 51, 0.56);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chat-panel {
  min-height: calc(100vh - 126px);
  display: grid;
  grid-template-rows: auto minmax(340px, 1fr) auto auto;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 241, 244, 0.45), rgba(239, 249, 246, 0.55)),
    rgba(255, 255, 255, 0.94);
}

.chat-header {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.chat-header-actions,
.card-actions,
.feed-toolbar,
.wish-actions,
.gentle-responses {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-header-actions {
  justify-content: flex-end;
}

.message-list {
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: min(76%, 720px);
}

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

.message.other {
  align-self: flex-start;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  cursor: pointer;
}

.bubble {
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.55;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.message.mine .bubble {
  color: #ffffff;
  border: 0;
  background: linear-gradient(135deg, var(--rose), var(--teal));
}

.message-media {
  max-width: 250px;
}

.message-media img {
  width: 250px;
  border-radius: 8px;
  border: 3px solid #ffffff;
  box-shadow: var(--shadow-soft);
}

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

.message-content time {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.message.mine .message-content time {
  text-align: right;
}

.media-open-button {
  width: 100%;
  display: block;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.media-open-button:hover {
  box-shadow: 0 12px 26px rgba(126, 82, 106, 0.17);
}

.voice-message {
  display: grid;
  gap: 5px;
}

.voice-message > span {
  color: var(--muted);
  font-size: 12px;
}

.chat-draft {
  min-width: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: rgba(255, 250, 251, 0.96);
}

.attachment-draft,
.recording-draft {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
}

.attachment-draft > img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.attachment-draft > div strong,
.attachment-draft > div small,
.recording-draft > div strong,
.recording-draft > div small {
  display: block;
  overflow-wrap: anywhere;
}

.attachment-draft > div small,
.recording-draft > div small {
  margin-top: 3px;
  color: var(--muted);
}

.voice-draft {
  grid-template-columns: minmax(170px, 280px) minmax(0, 1fr) auto auto;
}

.voice-draft audio {
  width: 100%;
  height: 42px;
}

.recording-draft {
  grid-template-columns: 14px minmax(0, 1fr) auto;
}

.recording-pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 0 rgba(200, 91, 91, 0.4);
  animation: recordingPulse 1.25s ease-out infinite;
}

#voiceButton.recording {
  color: #ffffff;
  background: var(--danger);
  animation: recordingButton 1.2s ease-in-out infinite;
}

.message-media audio {
  width: min(260px, 70vw);
}

.chat-input {
  min-height: 72px;
  display: grid;
  grid-template-columns: 42px 42px minmax(0, 1fr) 48px;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.feed-toolbar {
  justify-content: space-between;
  margin: 0 0 14px;
}

.segmented.compact {
  width: min(360px, 100%);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card-actions {
  justify-content: flex-end;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.danger-button,
.danger-text-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  color: var(--danger);
  background: #fff0f0;
  font-weight: 700;
}

.danger-button {
  color: #ffffff;
  background: var(--danger);
}

.wish-actions {
  align-items: stretch;
  flex-direction: column;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.wish-offer-input {
  display: grid;
  grid-template-columns: auto minmax(100px, 180px);
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 700;
}

.waiting-note {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--lemon);
  color: #69593b;
  background: #fff9e9;
}

.whisper-kind {
  margin-left: 8px;
  color: var(--muted);
  font-size: 13px;
}

.gentle-responses {
  margin-top: 12px;
}

.gentle-responses button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(79, 165, 156, 0.28);
  border-radius: 8px;
  color: #377a73;
  background: var(--surface-mint);
  font-weight: 700;
}

.topic-reply {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.wish-layout,
.whisper-layout {
  grid-template-columns: 340px minmax(0, 1fr);
}

.wish-form,
.whisper-form,
.profile-form {
  align-content: start;
  padding: 18px;
}

.points-panel {
  min-height: 154px;
  border-radius: 8px;
  padding: 18px;
}

.range-line,
.datetime-line {
  align-items: center;
  color: var(--muted);
}

.datetime-line {
  justify-content: space-between;
  flex-wrap: wrap;
}

.datetime-line input {
  width: min(220px, 100%);
}

.range-line input {
  width: 110px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
  border-radius: 8px;
  background: #f5eef4;
}

.segmented button {
  min-height: 36px;
  color: var(--muted);
  background: transparent;
}

.segmented button.active {
  color: var(--rose-deep);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.profile-form {
  max-width: 620px;
  margin: 40px auto;
  text-align: center;
}

.profile-avatar-editor {
  position: relative;
  width: 104px;
  height: 104px;
  margin: 0 auto 8px;
}

.profile-avatar-editor > img {
  width: 104px;
  height: 104px;
  object-fit: cover;
  border: 4px solid #ffffff;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.avatar-edit-button {
  position: absolute;
  right: -9px;
  bottom: -7px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--rose), var(--teal));
}

.profile-form > img {
  width: 96px;
  height: 96px;
  margin: 0 auto 8px;
  border-radius: 8px;
  border: 4px solid #ffffff;
  box-shadow: var(--shadow);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(47, 41, 51, 0.28);
  backdrop-filter: blur(8px);
}

.profile-card-modal {
  position: relative;
  width: min(440px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 243, 246, 0.92), rgba(239, 249, 246, 0.9)),
    #ffffff;
  box-shadow: var(--shadow);
}

.media-viewer {
  padding: 18px;
  background: rgba(25, 22, 27, 0.82);
}

.media-viewer-dialog {
  position: relative;
  width: min(1080px, 100%);
  max-height: calc(100vh - 36px);
  display: grid;
  place-items: center;
}

.media-viewer-dialog > img {
  max-width: 100%;
  max-height: calc(100vh - 36px);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

.media-viewer-dialog .modal-close {
  z-index: 2;
  color: #ffffff;
  background: rgba(47, 41, 51, 0.72);
}

.detail-dialog {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100vh - 44px);
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.detail-dialog .item-card {
  border: 0;
  padding: 0;
  box-shadow: none;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  min-height: 34px;
  width: 34px;
}

.partner-card-head {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.partner-card-head img {
  width: 74px;
  height: 74px;
  border-radius: 8px;
  border: 4px solid #ffffff;
  box-shadow: var(--shadow-soft);
}

.partner-card-head h2 {
  margin-bottom: 4px;
}

.profile-meta-list {
  display: grid;
  gap: 9px;
  margin: 0;
}

.profile-meta-list div {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid rgba(234, 223, 230, 0.9);
}

.profile-meta-list dt {
  color: var(--muted);
  font-weight: 700;
}

.profile-meta-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 50;
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(47, 41, 51, 0.92);
  transform: translateX(-50%);
  box-shadow: var(--shadow);
}

.toast.error {
  background: var(--danger);
}

@keyframes recordingPulse {
  70% {
    box-shadow: 0 0 0 10px rgba(200, 91, 91, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(200, 91, 91, 0);
  }
}

@keyframes recordingButton {
  50% {
    box-shadow: 0 0 0 5px rgba(200, 91, 91, 0.14);
  }
}

@media (max-width: 1080px) {
  .app {
    grid-template-columns: 1fr;
    padding-bottom: 74px;
  }

  .sidebar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 30;
    height: 70px;
    padding: 8px;
    display: block;
    border-right: 0;
    border-top: 1px solid var(--line);
  }

  .brand,
  .pair-card {
    display: none;
  }

  .nav {
    height: 100%;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
  }

  .nav-item {
    min-height: 54px;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    padding: 3px;
    font-size: 12px;
  }

  .nav-item.active {
    box-shadow: inset 0 3px 0 var(--rose);
  }

  .stage {
    padding: 18px;
  }

  .auth-panel,
  .pair-setup,
  .two-columns,
  .card-grid,
  .checkin-meta-grid,
  .checkin-photo-panel,
  .wish-layout,
  .whisper-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .stage {
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .api-field {
    min-width: 100%;
  }

  h1 {
    font-size: 23px;
  }

  h2 {
    font-size: 19px;
  }

  .home-hero,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .home-hero h2 {
    font-size: 24px;
  }

  .message {
    max-width: 92%;
  }

  .chat-input {
    grid-template-columns: 42px 42px minmax(0, 1fr) 44px;
  }

  .chat-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .chat-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .attachment-draft,
  .voice-draft {
    grid-template-columns: 50px minmax(0, 1fr);
  }

  .attachment-draft > button,
  .voice-draft > button {
    width: 100%;
  }

  .voice-draft audio {
    grid-column: 1 / -1;
  }

  .segmented {
    grid-template-columns: 1fr;
  }

  .segmented.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .choice-row {
    gap: 6px;
  }

  .choice-chip {
    flex: 1 1 calc(50% - 6px);
  }

  .preview-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-title,
  .control-row {
    align-items: flex-start;
  }
}

.app.locked {
  display: block;
  min-height: calc(100vh - var(--filing-height));
  max-width: 100vw;
  overflow: hidden;
}

.app.locked .sidebar,
.app.locked .topbar,
.app.locked .pair-setup,
.app.locked .page {
  display: none;
}

.app.locked .stage {
  min-height: calc(100vh - var(--filing-height));
  padding: 0;
}

.site-footer {
  min-height: var(--filing-height);
  display: grid;
  place-items: center;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  text-align: center;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--rose-deep);
  text-decoration: underline;
}

.app.locked .auth-panel {
  display: grid;
}

.auth-screen {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  justify-items: center;
  min-height: calc(100vh - var(--filing-height));
  margin: 0;
  padding: clamp(16px, 4vw, 42px);
  overflow: hidden;
  max-width: 100vw;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(135deg, rgba(216, 111, 135, 0.14), transparent 40%),
    linear-gradient(225deg, rgba(79, 165, 156, 0.13), transparent 38%),
    linear-gradient(180deg, #fff9fb 0%, #f6fbfa 100%);
  box-shadow: none;
}

.auth-screen::before {
  content: "";
  position: absolute;
  left: var(--auth-x, 50%);
  top: var(--auth-y, 50%);
  width: min(560px, 56vw);
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(circle, rgba(216, 111, 135, 0.18), transparent 62%),
    radial-gradient(circle at 70% 68%, rgba(79, 165, 156, 0.16), transparent 54%);
  filter: blur(10px);
  transform: translate(-50%, -50%);
  transition: left 160ms ease, top 160ms ease;
}

.auth-ribbon {
  position: absolute;
  width: 72vw;
  height: 140px;
  border-radius: 8px;
  opacity: 0.34;
  filter: blur(1px);
  transform: rotate(-16deg);
  animation: ribbonDrift 10s ease-in-out infinite alternate;
}

.ribbon-a {
  top: 10%;
  left: -22%;
  background: linear-gradient(90deg, transparent, rgba(216, 111, 135, 0.34), rgba(240, 201, 106, 0.22), transparent);
}

.ribbon-b {
  right: -24%;
  bottom: 8%;
  background: linear-gradient(90deg, transparent, rgba(79, 165, 156, 0.28), rgba(111, 134, 199, 0.20), transparent);
  animation-delay: -2s;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(1080px, calc(100vw - clamp(32px, 8vw, 84px)));
  min-height: clamp(560px, 72vh, 680px);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  overflow: hidden;
  border: 1px solid rgba(234, 223, 230, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 28px 80px rgba(126, 82, 106, 0.18);
  backdrop-filter: blur(22px);
  animation: authEnter 520ms ease both;
  transform:
    perspective(1200px)
    rotateX(calc(var(--auth-tilt-y, 0) * -1deg))
    rotateY(calc(var(--auth-tilt-x, 0) * 1deg));
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.auth-card:hover {
  box-shadow: 0 34px 92px rgba(126, 82, 106, 0.22);
}

.auth-visual {
  position: relative;
  min-height: 100%;
  padding: 34px;
  color: var(--ink);
  background:
    linear-gradient(150deg, rgba(255, 244, 247, 0.96), rgba(237, 249, 246, 0.94)),
    #ffffff;
  overflow: hidden;
}

.auth-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(216, 111, 135, 0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 165, 156, 0.09) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 82%);
}

.auth-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand strong,
.auth-brand span {
  display: block;
}

.auth-brand span {
  color: var(--muted);
  margin-top: 3px;
}

.auth-motion {
  position: relative;
  z-index: 1;
  min-height: 470px;
  margin-top: 38px;
}

.motion-line {
  position: absolute;
  left: 8%;
  right: 8%;
  height: 3px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--rose), var(--lemon), var(--teal));
  box-shadow: 0 10px 24px rgba(216, 111, 135, 0.18);
  animation: linePulse 3.8s ease-in-out infinite;
}

.line-one {
  top: 118px;
  transform: rotate(12deg);
}

.line-two {
  top: 282px;
  transform: rotate(-10deg);
  animation-delay: -1.1s;
}

.motion-card {
  position: absolute;
  width: min(270px, 78%);
  padding: 18px;
  border: 1px solid rgba(234, 223, 230, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  animation: cardFloat 5.6s ease-in-out infinite;
  transform:
    translate3d(
      calc(var(--auth-tilt-x, 0) * 3px),
      calc(var(--auth-tilt-y, 0) * 3px),
      0
    );
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.motion-card:hover {
  box-shadow: 0 18px 46px rgba(126, 82, 106, 0.17);
}

.motion-card span,
.motion-card strong {
  display: block;
}

.motion-card span {
  color: var(--rose-deep);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.motion-card strong {
  line-height: 1.45;
}

.card-left {
  top: 56px;
  left: 6%;
}

.card-right {
  top: 178px;
  right: 4%;
  animation-delay: -1.8s;
}

.card-bottom {
  left: 18%;
  bottom: 36px;
  animation-delay: -3s;
}

.auth-box {
  padding: 34px;
  display: grid;
  align-content: center;
  background: rgba(255, 255, 255, 0.94);
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px;
  margin-bottom: 20px;
  border-radius: 8px;
  background: #f5eef4;
}

.auth-switch button {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.auth-switch button.active {
  color: var(--rose-deep);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
  animation: switchPop 220ms ease both;
}

.auth-box .auth-form {
  display: none;
  padding: 0;
  background: transparent;
  animation: formSlide 260ms ease both;
}

.auth-box .auth-form.active {
  display: grid;
}

.auth-box .auth-form h2 {
  margin-bottom: 8px;
  font-size: 25px;
}

.auth-box .auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-box .auth-form input {
  height: 46px;
  font-size: 15px;
}

.auth-submit {
  margin-top: 4px;
}

.auth-inline-switch {
  justify-self: center;
}

.slide-verify {
  user-select: none;
}

.slide-track {
  position: relative;
  height: 48px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(90deg, #fff6f8, #f2fbf8);
}

.slide-track::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.75) 45%, transparent 70%);
  transform: translateX(-100%);
  animation: slideShine 2.4s ease-in-out infinite;
}

.slide-progress {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(135deg, rgba(216, 111, 135, 0.82), rgba(79, 165, 156, 0.82));
  transition: width 160ms ease;
}

.slide-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.slide-handle {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 8px;
  color: var(--rose-deep);
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(126, 82, 106, 0.18);
  touch-action: none;
  transition: transform 160ms ease, color 160ms ease, background 160ms ease;
}

.slide-handle:hover {
  color: #ffffff;
  background: linear-gradient(135deg, var(--rose), var(--teal));
}

.slide-verify.dragging .slide-handle {
  transition: none;
}

.slide-verify.dragging .slide-progress {
  transition: none;
}

.slide-verify[data-verified="true"] .slide-label {
  color: #ffffff;
}

.slide-verify[data-verified="true"] .slide-handle {
  color: #ffffff;
  background: var(--teal);
}

.slide-verify.shake {
  animation: sliderShake 340ms ease;
}

@keyframes authEnter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ribbonDrift {
  from {
    transform: translateX(-2%) rotate(-16deg);
  }
  to {
    transform: translateX(3%) rotate(-13deg);
  }
}

@keyframes linePulse {
  0%,
  100% {
    opacity: 0.48;
    transform-origin: center;
  }
  50% {
    opacity: 0.9;
  }
}

@keyframes cardFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes formSlide {
  from {
    opacity: 0;
    transform: translateX(14px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes switchPop {
  from {
    transform: scale(0.96);
  }
  to {
    transform: scale(1);
  }
}

@keyframes slideShine {
  0% {
    transform: translateX(-100%);
  }
  55%,
  100% {
    transform: translateX(100%);
  }
}

@keyframes sliderShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-8px);
  }
  75% {
    transform: translateX(8px);
  }
}

@media (max-width: 860px) {
  .auth-screen {
    align-items: center;
    padding: 14px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .auth-card {
    width: 100%;
    max-width: 680px;
    grid-template-columns: 1fr;
    min-height: auto;
    transform: none;
  }

  .auth-visual {
    min-height: 250px;
  }

  .auth-motion {
    min-height: 210px;
    margin-top: 22px;
  }

  .motion-card {
    position: relative;
    width: 100%;
    inset: auto;
    margin-bottom: 10px;
  }

  .motion-line {
    display: none;
  }

  .auth-box {
    padding: 22px;
  }
}

@media (max-width: 560px) {
  .auth-screen {
    padding: 10px;
  }

  .auth-card {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    border-radius: 8px;
  }

  .auth-visual {
    padding: 20px;
  }

  .auth-motion {
    min-height: 0;
  }

  .motion-card:nth-of-type(n + 2) {
    display: none;
  }

  .auth-box .auth-form h2 {
    font-size: 21px;
  }

  .auth-box {
    min-width: 0;
    padding: 18px;
  }

  .auth-ribbon {
    width: 100vw;
  }

  .slide-label {
    padding-left: 48px;
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  .stage {
    padding: 10px;
  }

  .nav-item b {
    font-size: 11px;
  }

  .chat-panel {
    min-height: calc(100vh - 176px);
  }

  .chat-input {
    grid-template-columns: 40px 40px minmax(0, 1fr) 42px;
    padding: 8px;
  }

  .message-list {
    padding: 12px;
  }

  .message-media,
  .message-media img {
    width: min(230px, 68vw);
  }

  .profile-meta-list div {
    grid-template-columns: 64px minmax(0, 1fr);
  }
}

@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;
  }
}
