/* 公开只读分享页
 * 主站 app.css 把 html/body 锁成 overflow:hidden（聊天防回弹），
 * 这里必须把 .share-app 钉死视口高度，让 .share-messages 自己滚。
 */
html:has(body.share-page),
body.share-page {
  height: 100% !important;
  max-height: 100% !important;
  overflow: hidden !important;
  overscroll-behavior-y: none;
  background: #f3f5f8;
}

body.share-no-save img {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

@media (max-width: 767px) {
  html:has(body.share-page),
  body.share-page {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
  }
}

.share-page {
  margin: 0;
  background: #f3f5f8;
}

.share-app {
  max-width: 720px;
  margin: 0 auto;
  height: 100%;
  height: 100dvh;
  max-height: 100%;
  max-height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, #eef2f7 0%, #f3f5f8 40%);
}

.share-topbar {
  flex-shrink: 0;
  height: 52px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: rgba(243, 245, 248, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.share-brand {
  color: #64748b;
  display: grid;
  place-items: center;
}

.share-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.share-home {
  font-size: 13px;
  color: #2563eb;
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 8px;
  white-space: nowrap;
}

.share-home:hover {
  background: rgba(37, 99, 235, 0.08);
}

.share-banner {
  flex-shrink: 0;
  text-align: center;
  font-size: 12px;
  color: #64748b;
  padding: 8px 12px 0;
}

.share-messages.messages,
.share-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 12px 14px 28px;
  touch-action: pan-y;
}

.share-status {
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
  padding: 48px 16px;
  flex-shrink: 0;
}

.share-status[hidden],
.share-banner[hidden] {
  display: none !important;
}

.share-status.is-error {
  color: #b91c1c;
}

/* 分享勾选面板（主 App） */
.share-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: end center;
  background: rgba(15, 23, 42, 0.45);
  padding: 0;
}

.share-sheet[hidden] {
  display: none !important;
}

.share-sheet-card {
  width: min(100%, 520px);
  max-height: min(88vh, 720px);
  background: #fff;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.share-sheet-card-pick {
  max-height: min(92vh, 780px);
  height: min(92vh, 780px);
}

.share-sheet-title-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  padding-right: 8px;
}

.share-pick-hint {
  font-size: 12px;
  font-weight: 400;
  color: #94a3b8;
  line-height: 1.3;
}

#shareSettingsSheet {
  z-index: 85;
  place-items: center;
  padding: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
}

#sharePolishDetailSheet {
  z-index: 92;
  place-items: center;
  padding: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
}

#sharePolishDetailBody {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

#sharePolishDetailBody > * {
  flex-shrink: 0;
}

#sharePolishDetailBody .share-polish-live,
#sharePolishDetailBody .share-polish-prompt {
  max-height: none;
  overflow: visible;
}

.share-sheet-card.share-settings-card {
  max-width: 420px;
  width: min(100%, 420px);
  margin: 0;
  border-radius: 16px;
  min-height: 0;
  max-height: calc(100% - 8px);
  max-height: min(90dvh, calc(100% - 8px));
}

.share-settings-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 4px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}


.share-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 8px;
  flex-shrink: 0;
}

.share-sheet-title {
  font-size: 16px;
  font-weight: 700;
}

.share-sheet-x {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.share-sheet-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 16px 10px;
  flex-shrink: 0;
}

.share-tool-btn {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}

.share-tool-btn:hover {
  border-color: #93c5fd;
  color: #2563eb;
}

.share-tool-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.share-tool-btn.is-on {
  background: #6b5cff;
  border-color: #6b5cff;
  color: #fff;
}

.share-polish-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 4px 0 8px;
}

.share-polish-target {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  user-select: none;
}

.share-polish-target input {
  margin: 0;
}

.share-card-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.share-card-tools-hint {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.4;
}

.share-polish-box {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px 12px;
}

.share-polish-box[hidden] {
  display: none !important;
}

.share-polish-box.is-running {
  border-color: #93c5fd;
  background: #eff6ff;
}

.share-polish-label {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 4px;
}

.share-polish-box.is-running .share-polish-label {
  color: #2563eb;
}

.share-polish-live {
  display: block;
  font-size: 11px;
  line-height: 1.45;
  color: #475569;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 8.4em;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  padding: 8px;
  margin: 6px 0 8px;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
}

.share-polish-live[hidden] {
  display: none !important;
}

.share-polish-prompt-wrap {
  margin: 6px 0 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  padding: 6px 8px;
}

.share-polish-prompt-wrap[hidden] {
  display: none !important;
}

.share-polish-prompt-wrap summary {
  cursor: pointer;
  font-size: 12px;
  color: #2563eb;
  user-select: none;
}

.share-polish-prompt {
  display: block;
  font-size: 11px;
  line-height: 1.45;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 12em;
  overflow-y: auto;
  margin: 6px 0 2px;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
}

.share-polish-cover,
.share-polish-live img,
.share-polish-inline-cover,
.share-polish-history-item img {
  cursor: zoom-in;
}

.share-polish-cover {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  margin: 8px 0 6px;
  background: #fff;
}

.share-polish-live img,
.share-polish-inline-cover {
  display: block;
  max-width: 120px;
  max-height: 120px;
  width: auto;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  margin: 8px 0 4px;
  background: #fff;
}

.share-polish-img-pending {
  display: inline-block;
  color: #2563eb;
  font-size: 11px;
}

.share-polish-history-item.is-remat .share-polish-history-summary {
  color: #2563eb;
}

.share-polish-history-item img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: #f1f5f9;
}

.share-polish-title {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
}

.share-polish-summary {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
  line-height: 1.4;
}

.share-polish-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.share-polish-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.share-polish-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.share-polish-history-empty {
  font-size: 12px;
  color: #94a3b8;
  padding: 4px 0;
}

.share-polish-history-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  color: inherit;
}

.share-polish-history-item:hover {
  border-color: #93c5fd;
}

.share-polish-history-item.is-pending {
  border-color: #93c5fd;
  background: #f8fbff;
}

.share-polish-history-main {
  flex: 1;
  min-width: 0;
}

.share-polish-history-side {
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  pointer-events: none;
}

.share-polish-history-acts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  pointer-events: auto;
}

.share-polish-history-acts button {
  border: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.92);
  color: #2563eb;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.share-polish-history-acts button[data-polish-act="stop"] {
  color: #dc2626;
  border-color: #fecaca;
}

.share-polish-dlg-msg {
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.share-polish-dlg-msg.is-user {
  background: #eff6ff;
}

.share-polish-dlg-msg.is-assistant {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.share-polish-dlg-who {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 2px;
}

.share-polish-dlg-txt {
  font-size: 13px;
  color: #0f172a;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 8em;
  overflow: hidden;
}

.share-polish-dlg-sec {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  margin: 10px 0 6px;
}

.share-polish-history-time {
  font-size: 11px;
  color: #94a3b8;
  flex-shrink: 0;
  padding: 1px 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  pointer-events: none;
}

.share-polish-history-title {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
}

.share-polish-history-summary {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
  line-height: 1.35;
}

.share-polish-history-action {
  font-size: 11px;
  color: #2563eb;
  flex-shrink: 0;
  padding-top: 1px;
}

.share-cover-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.share-cover-opts {
  display: flex;
  gap: 8px;
}

.share-cover-opt {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}

.share-cover-opt.is-on {
  background: #6b5cff;
  border-color: #6b5cff;
  color: #fff;
}

.share-cover-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.share-cover-thumb {
  width: 48px;
  height: 48px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: #f1f5f9;
  cursor: pointer;
}

.share-cover-thumb.is-on {
  border-color: #6b5cff;
}

.share-cover-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.share-wx-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f3f4f6;
  border-radius: 8px;
  padding: 8px 10px;
}

.share-wx-card img {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: #6b5cff;
}

.share-wx-card-text {
  min-width: 0;
  flex: 1;
}

.share-wx-card-title {
  font-size: 14px;
  color: #111827;
  font-weight: 500;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.share-wx-card-desc {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.share-expire {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
}

.share-expire select {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 12px;
  background: #fff;
}

.share-pick-list {
  flex: 1;
  min-height: 180px;
  overflow: auto;
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.share-pick-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e8edf5;
  background: #f8fafc;
  user-select: none;
}

.share-pick-item.is-on {
  border-color: #93c5fd;
  background: #eff6ff;
}

.share-pick-item.is-img-hidden {
  border-color: #fdba74;
  background: #fff7ed;
}

.share-pick-check {
  display: block;
  margin: 0;
  cursor: pointer;
}

.share-pick-check input,
.share-pick-item input {
  margin-top: 3px;
}

.share-pick-body {
  min-width: 0;
}

.share-pick-meta {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 4px;
}

.share-pick-text {
  font-size: 13px;
  color: #334155;
  line-height: 1.45;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.share-pick-imgs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.share-pick-imgs[hidden] {
  display: none !important;
}

.share-pick-img {
  position: relative;
  width: 72px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
}

.share-pick-img img {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: cover;
}

.share-pick-img-check {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 2px;
  font-size: 11px;
  color: #64748b;
  background: #fff;
}

.share-pick-img-check input {
  margin: 0;
  flex-shrink: 0;
}

.share-pick-img.is-hidden {
  border-color: #fdba74;
}

.share-pick-img.is-hidden img {
  filter: grayscale(1) brightness(0.85);
  opacity: 0.55;
}

.share-pick-img.is-hidden .share-pick-img-check {
  background: #ffedd5;
  color: #c2410c;
  font-weight: 600;
}

.share-pick-item.is-img-hidden .share-pick-meta {
  color: #c2410c;
}

.share-result {
  padding: 0 16px 10px;
  flex-shrink: 0;
}

.share-result[hidden] {
  display: none !important;
}

.share-result-row {
  display: flex;
  gap: 8px;
}

.share-result-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  background: #f8fafc;
}

.share-result-hint {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #64748b;
}

.share-sheet-actions {
  display: flex;
  gap: 8px;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #eef2f7;
  flex-shrink: 0;
}

.share-sheet-btn {
  flex: 1;
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: #e2e8f0;
  color: #334155;
}

.share-sheet-btn.primary {
  background: #2563eb;
  color: #fff;
}

.share-sheet-btn.danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.share-confirm-card {
  max-width: 360px;
  width: calc(100% - 32px);
  margin: auto;
  max-height: none;
}

.share-confirm-text {
  margin: 0;
  padding: 8px 16px 18px;
  font-size: 14px;
  line-height: 1.5;
  color: #475569;
}

.share-copy-body {
  padding: 0 16px 12px;
}

.share-copy-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: #334155;
  padding: 8px 0 10px;
  cursor: pointer;
  user-select: none;
}

.share-switch {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  height: 28px;
  display: inline-block;
}

.share-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.share-switch-ui {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 0.2s ease;
  pointer-events: none;
}

.share-switch-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  transition: transform 0.2s ease;
}

.share-switch input:checked + .share-switch-ui {
  background: #2563eb;
}

.share-switch input:checked + .share-switch-ui::after {
  transform: translateX(18px);
}

.share-switch input:disabled {
  cursor: not-allowed;
}

.share-copy-switch.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.share-copy-tip {
  margin: 0 0 10px;
  font-size: 12px;
  color: #b45309;
}

.share-copy-tip[hidden] {
  display: none !important;
}

.share-copy-preview-label {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 6px;
}

.share-copy-preview {
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 13px;
  line-height: 1.55;
  color: #0f172a;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 40vh;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.share-sheet-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.share-sheet-extra {
  padding: 0 16px 10px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.share-expire-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.share-expire-label {
  font-size: 12px;
  color: #64748b;
}

.share-expire-seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: #f1f5f9;
}

.share-expire-opt {
  border: none;
  border-radius: 9px;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  cursor: pointer;
}

.share-expire-opt.is-on {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.share-title-field,
.share-pass-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
}

.share-title-field input,
.share-title-field textarea,
.share-pass-field input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
  font-family: inherit;
  resize: vertical;
}

.share-pass-field input {
  letter-spacing: 0.12em;
}

.share-check-field {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.45;
}

.share-check-field input {
  margin-top: 2px;
  flex-shrink: 0;
}

.share-check-sub {
  margin-left: 20px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.share-check-sub[hidden] {
  display: none !important;
}

.share-export-opts {
  margin: 4px 16px 8px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.share-export-opts-label {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
}

#shareExportOptsSheet .share-export-opts {
  margin-top: 8px;
}

.share-export-poster.is-compact .messages {
  gap: 8px;
}

.share-export-poster.is-compact .msg {
  margin: 0;
}

.share-export-poster.is-compact .bubble {
  padding: 8px 10px;
}

.share-export-poster .md-code-more,
.share-export-poster .md-code-actions {
  display: none !important;
}

.share-export-poster .md-code:not(.is-collapsed) pre {
  max-height: none !important;
}

.share-export-poster .md-code:not(.is-collapsed) pre::after {
  display: none !important;
}

.share-gate {
  padding: 20px 16px;
  display: flex;
  justify-content: center;
}

.share-gate[hidden] {
  display: none !important;
}

.share-comments {
  position: relative;
  z-index: 20;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

.share-comments[hidden] {
  display: none !important;
}

.share-comments-sheet {
  background: #fff;
  border-top: 1px solid #e2e8f0;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
  padding-bottom: 0;
}

.share-comments-handle {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  width: 100%;
  margin: 0;
  padding: 6px 12px 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
}

.share-comments.is-collapsed .share-comments-handle {
  padding: 5px 12px calc(5px + env(safe-area-inset-bottom, 0px));
}

.share-comments-grip {
  align-self: center;
  width: 28px;
  height: 3px;
  border-radius: 999px;
  background: #cbd5e1;
  margin-bottom: 4px;
}

.share-comments.is-collapsed .share-comments-grip {
  margin-bottom: 2px;
}

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

.share-comments-head {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.share-comments.is-collapsed .share-comments-head {
  font-size: 13px;
}

.share-comments-count {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  border-radius: 999px;
  padding: 1px 7px;
}

.share-comments-count:empty {
  display: none;
}

.share-comments-chevron {
  margin-left: auto;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  transition: transform 0.2s ease;
}

.share-comments.is-collapsed .share-comments-chevron {
  transform: rotate(180deg);
}

.share-comments-drag-hint {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.share-comments.is-collapsed .share-comments-drag-hint {
  display: none;
}

.share-comments-panel {
  display: flex;
  flex-direction: column;
  max-height: min(52vh, 460px);
  overflow: hidden;
  transition: max-height 0.24s ease, opacity 0.18s ease;
  opacity: 1;
}

.share-comments.is-collapsed .share-comments-panel {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.share-comments-hint {
  flex-shrink: 0;
  margin: 0 14px 8px;
  font-size: 12px;
  color: #94a3b8;
}

.share-comments-scroll {
  flex: 1 1 auto;
  min-height: 80px;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0 14px 8px;
}

.share-comments.is-collapsed .share-comments-scroll {
  overflow: hidden;
}

.share-comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 0;
}

.share-comments-compose {
  flex-shrink: 0;
  padding: 8px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #eef2f7;
  background: #fff;
}

.share-comments-compose .share-comments-form,
.share-comments-compose .share-comments-login {
  margin: 0;
}

.share-comments-form textarea {
  margin-bottom: 8px;
}

.share-messages.messages.has-comments-dock,
.share-messages.has-comments-dock {
  padding-bottom: 12px;
}

.share-comment-item {
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 10px;
}

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

.share-comment-meta {
  font-size: 11px;
  color: #94a3b8;
}

.share-comment-del {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  padding: 0 2px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.share-comment-del:active {
  color: #ef4444;
}

.share-comment-body {
  font-size: 13px;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
}

.share-comments-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 8px;
  resize: vertical;
}

.share-comments-empty {
  font-size: 13px;
  color: #94a3b8;
  padding: 8px 0;
}

.share-lock {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.share-lock[hidden] {
  display: none !important;
}

.share-lock-card {
  width: min(100%, 360px);
  background: #fff;
  border-radius: 16px;
  padding: 22px 18px 18px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.1);
  text-align: center;
}

.share-lock-title {
  font-size: 17px;
  font-weight: 700;
  color: #1f2937;
}

.share-lock-tip {
  margin: 8px 0 14px;
  font-size: 13px;
  color: #94a3b8;
}

.share-lock-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 18px;
  letter-spacing: 0.2em;
  text-align: center;
  margin-bottom: 12px;
}

.share-lock-btn {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 12px;
  background: #2563eb;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.share-lock-btn:disabled {
  opacity: 0.6;
}

.share-lock-error {
  margin-top: 10px;
  color: #b91c1c;
  font-size: 13px;
}

.share-lock-error[hidden] {
  display: none !important;
}

/* 导出长图：离屏海报（复用气泡/代码块真实样式） */
.share-export-poster {
  width: 720px;
  box-sizing: border-box;
  padding: 28px 22px 24px;
  background: linear-gradient(180deg, #e8edf5 0%, #f3f5f8 28%, #f8fafc 100%);
  color: #1f2937;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.share-export-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  margin-bottom: 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.share-export-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #64748b;
  background: #eef2f7;
  flex-shrink: 0;
}

.share-export-head-text {
  min-width: 0;
  flex: 1;
}

.share-export-head-text h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
}

.share-export-head-text p {
  margin: 4px 0 0;
  font-size: 12px;
  color: #94a3b8;
}

.share-export-poster .messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0;
  overflow: visible;
  flex: none;
  height: auto;
  max-height: none;
}

.share-export-poster .bubble {
  max-width: min(520px, calc(100% - 48px));
}

.share-export-poster .bubble:has(.md-code),
.share-export-poster .bubble:has(.md-table-wrap) {
  max-width: min(640px, calc(100% - 48px));
}

.share-export-poster .msg-col-assistant {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.share-export-poster .msg-meta {
  display: inline-flex;
  align-items: center;
  padding: 0 2px;
}

.share-export-poster .msg-duration,
.share-page .msg-duration {
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.share-page .msg-col-assistant {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.share-page .msg-meta {
  display: inline-flex;
  align-items: center;
  padding: 0 2px;
}

.share-export-poster.is-compact .msg-meta {
  margin-top: -2px;
}

.share-export-poster .md-code-btn {
  pointer-events: none;
}

.share-export-foot {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px dashed rgba(148, 163, 184, 0.45);
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
}

.share-export-mount {
  position: fixed;
  left: -10000px;
  top: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 1;
}

.share-export-preview {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: end center;
  background: rgba(15, 23, 42, 0.5);
  padding: 0;
}

.share-export-preview[hidden] {
  display: none !important;
}

.share-export-preview-panel {
  width: min(100%, 560px);
  max-height: min(92vh, 860px);
  background: #fff;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.share-export-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  flex-shrink: 0;
}

.share-export-preview-title {
  font-size: 16px;
  font-weight: 700;
}

.share-export-preview-x {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.share-export-preview-tip {
  padding: 0 16px 8px;
  font-size: 12px;
  color: #94a3b8;
  flex-shrink: 0;
}

.share-export-preview-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 12px 12px;
  background: #eef2f7;
  -webkit-overflow-scrolling: touch;
}

.share-export-preview-scroll img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: #fff;
}

.share-export-preview-actions {
  display: flex;
  gap: 8px;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #eef2f7;
  flex-shrink: 0;
}

@media (min-width: 720px) {
  .share-export-preview {
    place-items: center;
    padding: 24px;
  }
  .share-export-preview-panel {
    border-radius: 18px;
  }
}

/* 侧栏：我的分享 */
.shares-head {
  margin-top: 0;
  display: none;
}

.shares-refresh {
  color: #94a3b8 !important;
}

.shares-refresh:hover {
  color: #2563eb !important;
  background: rgba(37, 99, 235, 0.08) !important;
}

.shares-list {
  margin-top: 0;
  max-height: none;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 0;
}

.shares-empty {
  font-size: 12px;
  color: #94a3b8;
  padding: 8px 4px 4px;
}

.share-row {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.share-row.is-dead {
  opacity: 0.72;
  background: #f8fafc;
}

.share-row-title {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.share-row-meta {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.4;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.share-row-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: #eaf3ff;
  color: #2563eb;
}

.share-row-badge.revoked {
  background: #f1f5f9;
  color: #64748b;
}

.share-row-badge.expired {
  background: #fff7ed;
  color: #c2410c;
}

.share-row-badge.deleted {
  background: #f1f5f9;
  color: #64748b;
}

.share-row-badge.locked {
  background: #fef3c7;
  color: #b45309;
}

.share-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.share-row-btn {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #2563eb;
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.share-row-btn:hover {
  border-color: #93c5fd;
  background: #dbeafe;
  color: #1d4ed8;
}

.share-row-btn.danger {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #64748b;
}

.share-row-btn.danger:hover {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #dc2626;
}

.share-detail-card {
  height: min(88vh, 720px);
  max-height: min(88vh, 720px);
}

.share-detail-meta {
  flex: 0 1 auto;
  max-height: min(32vh, 260px);
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.share-detail-card.is-meta-collapsed .share-detail-meta {
  display: none;
}

.share-detail-summary {
  padding: 0 16px 8px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.45;
}

.share-detail-summary strong {
  color: #334155;
  font-weight: 700;
}

.share-detail-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  margin-bottom: 6px;
}

.share-detail-fact-wide {
  grid-column: 1 / -1;
}

.share-detail-row {
  margin-bottom: 6px;
}

.share-detail-link-line,
.share-detail-pass-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.share-detail-link {
  flex: 1;
  min-width: 0;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.share-detail-pass {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
  color: #0f172a;
}

.share-detail-copy-btn {
  flex: 0 0 auto;
  border: 1px solid #dbe3ee;
  background: #fff;
  color: #2563eb;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}

.share-detail-icon-btn {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fff;
  color: #64748b;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.share-detail-icon-btn .share-eye-off {
  display: none !important;
}

.share-detail-icon-btn.is-shown .share-eye-open {
  display: none !important;
}

.share-detail-icon-btn.is-shown .share-eye-off {
  display: block !important;
}

.share-detail-charts {
  padding: 0 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.share-detail-charts[hidden] {
  display: none !important;
}

.share-chart-card {
  border: 1px solid #e8edf5;
  border-radius: 12px;
  background: #f8fafc;
  padding: 8px 10px;
}

.share-chart-title {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
}

.share-chart-row {
  display: grid;
  grid-template-columns: minmax(72px, 34%) 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 5px;
}

.share-chart-row:last-child {
  margin-bottom: 0;
}

.share-chart-name {
  font-size: 11px;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.share-chart-track {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.share-chart-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
  min-width: 2px;
  transition: width 0.35s ease;
}

.share-chart-card[data-kind="device"] .share-chart-bar {
  background: linear-gradient(90deg, #34d399, #059669);
}

.share-chart-card[data-kind="region"] .share-chart-bar {
  background: linear-gradient(90deg, #fbbf24, #d97706);
}

.share-chart-count {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  min-width: 28px;
  text-align: right;
}

.share-chart-more {
  margin-top: 4px;
}

.share-chart-more > summary {
  list-style: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: #2563eb;
  padding: 4px 0 2px;
}

.share-chart-more > summary::-webkit-details-marker,
.share-chart-more > summary::marker {
  display: none;
}

.share-chart-more[open] > summary {
  margin-bottom: 4px;
}

.share-detail-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 16px 6px;
  flex-shrink: 0;
  border-top: 1px solid #eef2f7;
}

.share-detail-list-label {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
}

.share-detail-meta-toggle {
  border: none;
  background: transparent;
  color: #2563eb;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 0;
  cursor: pointer;
}

.share-detail-list {
  flex: 1;
  min-height: 160px;
  overflow: auto;
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
}

.share-view-item {
  border: 1px solid #e8edf5;
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px 12px;
}

.share-view-time {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 4px;
}

.share-view-line {
  font-size: 12px;
  color: #64748b;
  line-height: 1.45;
  word-break: break-all;
}

.share-view-empty {
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  padding: 28px 12px;
}

.topbar-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 2px;
}

.topbar-share,
.topbar-new {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #64748b;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.topbar-share:hover,
.topbar-new:hover {
  background: rgba(255, 255, 255, 0.85);
  color: var(--accent);
}

@media (min-width: 720px) {
  .share-sheet {
    place-items: center;
    padding: 24px;
  }

  .share-sheet-card {
    border-radius: 18px;
    max-height: min(80vh, 680px);
  }

  .share-sheet-card.share-settings-card {
    max-height: min(80dvh, calc(100% - 48px));
  }

  .share-detail-card {
    height: min(80vh, 680px);
    max-height: min(80vh, 680px);
  }
}

.guest-pass-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.guest-pass-head .share-row-title {
  flex: 1;
  min-width: 0;
}

.guest-pass-revoke {
  flex-shrink: 0;
  margin: -2px 0 0 0;
  border: none;
  background: none;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 4px;
  cursor: pointer;
  line-height: 1.2;
}

.guest-pass-revoke:hover {
  color: #dc2626;
}

.guest-pass-form {
  margin: 0 0 8px;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guest-pass-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}

.guest-pass-field input[type="number"] {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
  width: 100%;
}

.guest-pass-expiry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.guest-pass-radio {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: #334155;
  font-size: 12px;
}

.guest-pass-expiry input[type="number"] {
  width: 72px;
  flex: 0 0 auto;
}

.guest-pass-create {
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  background: #5b4dff;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.guest-pass-create:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.guest-pass-chats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 0 0;
}

.guest-pass-subhead {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  padding: 2px 2px 0;
}

.guest-pass-chat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 8px;
  background: #f8fafc;
}

.guest-pass-chat-title {
  font-size: 12px;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.guest-chat-view-card {
  width: min(100%, 560px);
  height: min(88vh, 740px);
  max-height: min(88vh, 740px);
  display: flex;
  flex-direction: column;
}

.guest-chat-view-hint {
  margin: 0;
  padding: 0 14px 8px;
  font-size: 12px;
  color: #94a3b8;
}

.guest-view-messages {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px 16px;
  min-height: 0;
}

.guest-view-empty {
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  padding: 24px 8px;
}

.guest-pass-dialog-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 16px 16px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}

.guest-pass-dialog-field input {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
}
