.app-view-body.xin-lv-body:has(.lr-root) {
  position: relative;
  display: block;
  text-align: left;
  padding: 0;
  overflow: hidden;
  align-items: stretch;
  justify-content: flex-start;
}

.lr-root {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--app-bg, #fbfaf8);
  color: var(--text-1, #2b2622);
  font-size: 14px;
}

.lr-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
}

.lr-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .04em;
}

.lr-head-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, .06);
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.lr-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 16px 12px;
  -webkit-overflow-scrolling: touch;
}

.lr-empty {
  padding: 56px 0;
  text-align: center;
  color: rgba(0, 0, 0, .38);
  font-size: 13px;
}

.lr-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.lr-card {
  padding: 12px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
  cursor: pointer;
  overflow: hidden;
}

.lr-card-img {
  display: block;
  width: 100%;
  border-radius: 8px;
  margin-bottom: 8px;
}

.lr-card-text {
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.lr-card-meta {
  margin-top: 8px;
  font-size: 11px;
  color: rgba(0, 0, 0, .36);
}

.lr-decks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lr-deck {
  padding: 12px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.lr-deck-name {
  font-size: 14px;
  font-weight: 600;
}

.lr-deck-desc {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(0, 0, 0, .42);
}

.lr-set {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lr-set-row {
  padding: 12px;
  border-radius: 12px;
  background: #fff;
  font-size: 13px;
  color: rgba(0, 0, 0, .6);
}

.lr-bar {
  flex: none;
  display: flex;
  border-top: 1px solid rgba(0, 0, 0, .06);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, .92);
}

.lr-tab {
  flex: 1;
  border: none;
  background: none;
  padding: 8px 0;
  font-size: 12px;
  color: rgba(0, 0, 0, .4);
  cursor: pointer;
}

.lr-tab.on {
  color: #2b2622;
  font-weight: 600;
}

.lr-mask {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, .3);
  z-index: 20;
}

.lr-editor {
  width: 100%;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-radius: 16px 16px 0 0;
}

.lr-ta {
  width: 100%;
  min-height: 120px;
  border: none;
  outline: none;
  resize: none;
  font-size: 15px;
  line-height: 1.6;
  font-family: inherit;
  color: inherit;
}

.lr-editor-ops {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 10px;
}

.lr-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 10px;
  background: rgba(0, 0, 0, .06);
  color: inherit;
  font-size: 13px;
  cursor: pointer;
}

.lr-btn-main {
  background: #2b2622;
  color: #fff;
}

/* ---------- 布局补充 ---------- */
.lr-body.lr-body-chat {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.lr-chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.lr-chat-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 12px 8px;
}

.lr-chat-name {
  border: none;
  background: none;
  padding: 4px 6px;
  font-size: 13px;
  color: rgba(0, 0, 0, .5);
  cursor: pointer;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lr-chat-new {
  border: none;
  background: rgba(0, 0, 0, .055);
  color: rgba(0, 0, 0, .6);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.lr-chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 14px 10px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.lr-chat-empty {
  padding: 56px 18px;
  text-align: center;
}

.lr-chat-empty-t {
  font-size: 14px;
  color: rgba(0, 0, 0, .45);
}

.lr-chat-empty-s {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.7;
  color: rgba(0, 0, 0, .32);
}

.lr-msg {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
  max-width: 82%;
}

.lr-msg-me {
  align-items: flex-end;
  margin-left: auto;
}

.lr-msg-them {
  align-items: flex-start;
  margin-right: auto;
}

.lr-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
  background: var(--card-bg, #fff);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

.lr-msg-me .lr-bubble {
  background: #2b2622;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.lr-msg-them .lr-bubble {
  border-bottom-left-radius: 4px;
}

.lr-bubble-soft {
  opacity: .78;
}

.lr-bubble-img {
  display: block;
  max-width: 180px;
  border-radius: 10px;
  margin-bottom: 6px;
}

.lr-msg-time {
  margin-top: 4px;
  font-size: 10px;
  color: rgba(0, 0, 0, .28);
}

.lr-bubble-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 14px;
}

.lr-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .28);
  animation: lrBlink 1.1s infinite ease-in-out;
}

.lr-dot:nth-child(2) { animation-delay: .18s; }
.lr-dot:nth-child(3) { animation-delay: .36s; }

@keyframes lrBlink {
  0%, 80%, 100% { opacity: .25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

.lr-chat-input {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(0, 0, 0, .06);
  background: rgba(255, 255, 255, .9);
}

.lr-chat-ta {
  flex: 1;
  min-height: 38px;
  max-height: 96px;
  padding: 9px 12px;
  border: none;
  border-radius: 18px;
  background: rgba(0, 0, 0, .05);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: inherit;
  outline: none;
  resize: none;
}

.lr-chat-send {
  flex: none;
  width: 42px;
  height: 38px;
  border: none;
  border-radius: 19px;
  background: #2b2622;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}

/* ---------- 表单与面板 ---------- */
.lr-label {
  margin: 12px 0 6px;
  font-size: 12px;
  color: rgba(0, 0, 0, .42);
}

.lr-hint {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.6;
  color: rgba(0, 0, 0, .34);
}

.lr-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: rgba(0, 0, 0, .05);
  font-family: inherit;
  font-size: 14px;
  color: inherit;
  outline: none;
}

.lr-seg {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.lr-seg-btn {
  padding: 7px 14px;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, .05);
  color: rgba(0, 0, 0, .55);
  font-size: 12px;
  cursor: pointer;
}

.lr-seg-btn.on {
  background: #2b2622;
  color: #fff;
}

.lr-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.lr-chip {
  padding: 6px 12px;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, .05);
  color: rgba(0, 0, 0, .55);
  font-size: 12px;
  cursor: pointer;
}

.lr-chip.on {
  background: #2b2622;
  color: #fff;
}

.lr-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.lr-imgbox {
  margin-top: 6px;
}

.lr-img-preview {
  display: block;
  max-width: 100%;
  max-height: 180px;
  border-radius: 10px;
}

.lr-editor-tall {
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.lr-editor-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.lr-btn-danger {
  margin-top: 6px;
  background: rgba(200, 60, 50, .1);
  color: #b33a30;
  align-self: flex-start;
}

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

.lr-deck-tag {
  flex: none;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .05);
  color: rgba(0, 0, 0, .45);
}

.lr-deck-meta {
  margin-top: 6px;
  font-size: 11px;
  color: rgba(0, 0, 0, .35);
}

.lr-stat {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.lr-stat-cell {
  flex: 1;
  padding: 10px 0;
  border-radius: 12px;
  background: var(--card-bg, #fff);
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

.lr-stat-num {
  font-size: 17px;
  font-weight: 600;
}

.lr-stat-key {
  margin-top: 2px;
  font-size: 11px;
  color: rgba(0, 0, 0, .4);
}

/* ---------- 底部弹层 ---------- */
.lr-mask-sheet {
  align-items: flex-end;
}

.lr-sheet {
  width: 100%;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 76vh;
  overflow-y: auto;
}

.lr-sheet-title {
  padding: 6px 8px;
  font-size: 12px;
  color: rgba(0, 0, 0, .4);
}

.lr-sheet-btn {
  width: 100%;
  padding: 13px 14px;
  border: none;
  border-radius: 12px;
  background: rgba(0, 0, 0, .04);
  color: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.lr-sheet-cancel {
  text-align: center;
  color: rgba(0, 0, 0, .5);
}

.lr-sheet-danger {
  color: #b33a30;
}

/* 宽屏（桌面浏览器预览）保持手机壳宽度，避免应用被拉全屏 */
@media (min-width: 560px) {
  .lr-root {
    right: auto;
    left: 50%;
    width: 430px;
    transform: translateX(-50%);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .04);
  }
}

/* 卡组拖动排序 */
.lr-deck {
  -webkit-user-drag: element;
}

.lr-deck-dragging {
  opacity: .55;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .12);
}

/* 轻提示 */
.lr-toast {
  position: absolute;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  max-width: 82%;
  padding: 9px 14px;
  border-radius: 12px;
  background: rgba(28, 24, 32, .9);
  color: #fff;
  font-size: 12.5px;
  line-height: 1.45;
  text-align: center;
  z-index: 60;
  pointer-events: none;
  animation: lr-toast-in .18s ease-out;
}

@keyframes lr-toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
