/* memory.css — 长期记忆 App */

.memory-page {
  background: var(--c-bg);
}

.memory-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 28px;
  -webkit-overflow-scrolling: touch;
}

.memory-account-hero {
  padding: 22px 18px 12px;
  background: var(--c-bg);
}

.memory-account-title {
  color: var(--c-text);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
}

.memory-account-sub {
  margin-top: 5px;
  color: var(--c-sub);
  font-size: 13px;
}

.memory-account-list {
  padding: 0 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.memory-account-row {
  width: 100%;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--c-text);
  text-align: left;
  cursor: pointer;
}

.memory-account-row:active {
  background: var(--c-surface-2);
}

.memory-account-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-surface-2);
  color: var(--c-sub);
  font-size: 17px;
  font-weight: 600;
}

.memory-account-avatar img,
.memory-story-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.memory-account-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.memory-account-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c-text);
  font-size: 15px;
  font-weight: 650;
}

.memory-account-id {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c-sub);
  font-size: 12px;
}

.memory-account-meta {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  color: var(--c-sub);
  font-size: 12px;
}

.memory-account-meta small {
  color: var(--c-hint);
  font-size: 11px;
}

.memory-story-rail {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 16px 16px 13px;
  background: var(--c-bg);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.memory-story-rail::-webkit-scrollbar { display: none; }

.memory-story-item {
  width: 72px;
  flex: 0 0 72px;
  border: 0;
  background: transparent;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--c-text);
  text-align: center;
  cursor: pointer;
}

.memory-story-avatar-shell {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 2px var(--c-surface-2);
}

.memory-story-item.active .memory-story-avatar-shell {
  background: #fff;
  box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--c-accent);
}

.memory-story-item.is-self .memory-story-avatar-shell {
  background: #fff;
  box-shadow: 0 0 0 4px #fff;
}

.memory-story-item.is-self.active .memory-story-avatar-shell {
  box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--c-accent);
}

.memory-story-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-surface-2);
  color: var(--c-sub);
  font-size: 18px;
  font-weight: 500;
}

.memory-avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.memory-story-add {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #252a31;
  color: #fff;
  font-size: 11px;
  border: 4px solid #fff;
  box-sizing: content-box;
}

.memory-story-add i {
  font-size: inherit;
  line-height: 1;
}

.memory-story-name {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c-sub);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.25;
}

.memory-story-item.active .memory-story-name {
  color: var(--c-text);
  font-weight: 650;
}

.memory-corridor-head {
  margin: 0 14px 10px;
  padding: 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.memory-corridor-title {
  color: var(--c-text);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
}

.memory-corridor-subtitle {
  margin-top: 2px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--c-sub);
  font-size: 12px;
  line-height: 1.5;
  text-align: left;
}

.memory-role-subtitle {
  cursor: pointer;
}

.memory-role-subtitle:active {
  color: var(--c-text);
}

.memory-switch-owner-btn {
  border-radius: var(--r-sm);
}

.memory-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 14px 10px;
  min-height: 72px;
  overflow: hidden;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
}

.memory-metric {
  position: relative;
  min-width: 0;
  padding: 12px 8px 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.memory-metric + .memory-metric::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 1px;
  background: rgba(0, 0, 0, 0.045);
}

.memory-metric span,
.memory-panel-sub,
.memory-meta,
.memory-tags {
  color: var(--c-sub);
  font-size: 12px;
  line-height: 1.5;
}

.memory-metric span {
  font-size: 11px;
  font-weight: 550;
  line-height: 1;
  letter-spacing: 0;
  color: var(--c-hint);
}

.memory-metric strong {
  color: var(--c-text);
  font-size: 24px;
  line-height: 1;
  font-weight: 650;
}

.memory-panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: 12px;
  margin: 0 14px 10px;
}

.memory-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.memory-panel-title {
  color: var(--c-text);
  font-size: 15px;
  font-weight: 650;
}

.memory-filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.memory-filter-grid-compact {
  grid-template-columns: 132px minmax(0, 1fr);
}

.memory-filter-grid input {
  min-width: 0;
}

.memory-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.memory-card {
  background: #fff;
  border: 1px solid var(--c-border-m);
  border-radius: var(--r-sm);
  padding: 12px;
}

.memory-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.memory-title {
  color: var(--c-text);
  font-size: 15px;
  font-weight: 650;
}

.memory-score {
  flex-shrink: 0;
  color: var(--c-hint);
  font-size: 11px;
}

.memory-content-text {
  color: var(--c-text);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.memory-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.memory-tags span {
  background: var(--c-surface-2);
  border-radius: 999px;
  padding: 3px 7px;
}

.memory-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.memory-empty {
  color: var(--c-hint);
  text-align: center;
  padding: 30px 0;
  font-size: 13px;
}

.memory-edit-modal {
  max-width: 360px;
}

.memory-edit-form {
  padding: 0 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.memory-edit-form textarea {
  min-height: 110px;
  resize: none;
}

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

.memory-edit-grid label {
  color: var(--c-sub);
  font-size: 12px;
}
