* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: 'Inter', 'PingFang SC', system-ui, -apple-system, sans-serif;
  background: #f4f7fc;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  margin: 0;
  color: #0b1b2f;
}
.notepad-card {
  position: relative;
  max-width: 720px;
  width: 100%;
  background: #ffffff;
  border-radius: 36px;
  box-shadow: 0 20px 50px -10px rgba(0, 20, 40, 0.12);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px);
  min-height: 480px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.notepad-header {
  padding: 20px 26px 16px;
  border-bottom: 1px solid #edf2f8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: #fafcff;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.notepad-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0b1b2f;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sync-status {
  font-size: 0.65rem;
  color: #20b86a;
  background: #e6f7ee;
  padding: 2px 12px;
  border-radius: 40px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sync-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #20b86a;
  display: inline-block;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.header-actions {
  display: flex;
  gap: 8px;
}
.btn-icon {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 40px;
  border: 1.5px solid #e3eaf2;
  background: transparent;
  color: #3a4d62;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  font-family: inherit;
  background: #f7faff;
}
.btn-icon:hover {
  background: #e3eaf2;
  color: #0b1b2f;
}
.btn-icon:active {
  transform: scale(0.95);
}
.btn-icon.clear {
  background: #fff1f0;
  border-color: #fcd0ce;
  color: #b3403a;
}
.btn-icon.clear:hover {
  background: #fce4e2;
  border-color: #f7b2ae;
}
.btn-icon.copy-all {
  background: #eef5ff;
  border-color: #c8daf5;
  color: #1d4a8a;
}
.btn-icon.copy-all:hover {
  background: #dce8ff;
}

.notepad-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #ffffff;
}
.notepad-body::-webkit-scrollbar {
  width: 5px;
}
.notepad-body::-webkit-scrollbar-track {
  background: transparent;
}
.notepad-body::-webkit-scrollbar-thumb {
  background: #d6dfe8;
  border-radius: 10px;
}

.empty-note {
  margin: auto;
  text-align: center;
  color: #a0b3c9;
  font-size: 0.95rem;
  padding: 30px 10px;
}
.empty-note .icon {
  font-size: 42px;
  margin-bottom: 12px;
  opacity: 0.6;
}

.note-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 100%;
  cursor: pointer;
  transition: background 0.1s;
  border-radius: 16px;
  padding: 4px 6px 4px 8px;
  margin-bottom: 2px;
}
.note-bubble {
  transition: background 0.15s, border-color 0.15s;
}
.note-item:hover .note-bubble {
  background: #e6edfc;
  border-color: #d3dff5;
}
.note-item:active .note-bubble {
  background: #d9e4fa;
  border-color: #c3d3f2;
}

.note-bubble {
  padding: 10px 18px 10px 16px;
  background: #f0f4fe;
  border-radius: 20px 20px 20px 6px;
  font-size: 0.95rem;
  line-height: 1.55;
  word-break: break-word;
  color: #0b1b2f;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
  border: 1px solid #e9eff8;
  width: 100%;
}
.note-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  padding: 0 6px;
  width: 100%;
}
.note-time {
  font-size: 0.62rem;
  color: #8b9eb3;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.notepad-footer {
  padding: 14px 24px 22px;
  border-top: 1px solid #edf2f8;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
  background: #fafcff;
  padding-bottom: 22px;
}
.notepad-footer input {
  flex: 1;
  padding: 12px 20px;
  border: 1.5px solid #e3eaf2;
  border-radius: 40px;
  font-size: 0.92rem;
  font-family: inherit;
  background: #f7faff;
  color: #0b1b2f;
  transition: border 0.2s, box-shadow 0.2s;
}
.notepad-footer input:focus {
  outline: none;
  border-color: #2469f0;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(36, 105, 240, 0.08);
}
.btn-send {
  padding: 12px 28px;
  background: #0b1b2f;
  color: #fff;
  border: none;
  border-radius: 40px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  font-family: inherit;
  white-space: nowrap;
}
.btn-send:hover {
  background: #1d3148;
}
.btn-send:active {
  transform: scale(0.95);
}

/* 悬浮滚动按钮 */
.scroll-fab {
  position: absolute;
  right: 20px;
  bottom: 86px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #ffffff;
  color: #2469f0;
  border: 1.5px solid #e3eaf2;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 20px -6px rgba(11, 27, 47, 0.18);
  z-index: 999;
  transition: 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.scroll-fab.show {
  display: flex;
  animation: fadeIn 0.2s ease;
}
.scroll-fab:hover {
  background: #eef5ff;
  border-color: #c8daf5;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -6px rgba(36, 105, 240, 0.25);
}
.scroll-fab:active {
  transform: scale(0.92);
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 27, 47, 0.30);
  backdrop-filter: blur(2px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
.modal-box {
  background: #ffffff;
  border-radius: 28px;
  padding: 32px 28px 28px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: 0 30px 60px -12px rgba(0,0,0,0.20);
  animation: slideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes slideUp {
  from { transform: translateY(20px) scale(0.94); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-icon {
  width: 56px;
  height: 56px;
  background: #fff1f0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 14px;
}
.modal-box h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.modal-box p {
  font-size: 0.88rem;
  color: #4a5f74;
  line-height: 1.5;
  margin-bottom: 22px;
}
.modal-actions {
  display: flex;
  gap: 12px;
}
.btn-cancel {
  flex: 1;
  padding: 11px;
  border: 1.5px solid #e3eaf2;
  border-radius: 40px;
  background: #f7faff;
  color: #3a4d62;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  font-family: inherit;
  font-size: 0.9rem;
}
.btn-cancel:hover {
  background: #edf2f8;
}
.btn-confirm-clear {
  flex: 1;
  padding: 11px;
  border: none;
  border-radius: 40px;
  background: #d9453e;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  font-family: inherit;
  font-size: 0.9rem;
}
.btn-confirm-clear:hover {
  background: #b3403a;
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0b1b2f;
  color: #f7faff;
  padding: 10px 26px;
  border-radius: 60px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 10px 30px -8px rgba(0,0,0,0.2);
  opacity: 0;
  transition: 0.25s ease;
  pointer-events: none;
  z-index: 200;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 640px) {
body { padding: 0; align-items: stretch; min-height: 100svh;}
.notepad-card { 
  height: 100vh; 
  height: 100svh; 
  border-radius: 0; 
  max-width: 100%; 
  box-shadow: none;
}
.notepad-header { padding: 14px 16px; }
.notepad-body { padding: 14px 14px 4px; }
.notepad-footer { 
  padding: 10px 16px 12px; 
  gap: 8px; 
  flex-shrink: 0;
}
.btn-icon span { display: none; }
.btn-icon { padding: 6px 12px; }
.btn-send { padding: 12px 18px; font-size: 0.85rem; }
.note-bubble { font-size: 0.9rem; }
.toast { bottom: 70px; }
.scroll-fab {
  position: fixed;
  right: 16px;
  bottom: calc(70px + env(safe-area-inset-bottom, 0px));
}
  }

/* 置顶便签 */
.note-item.pinned .note-bubble {
  background: #fff8e6;
  border-color: #f6e3b0;
}
.note-item.pinned:hover .note-bubble {
  background: #fdf0c8;
  border-color: #efd994;
}
.note-item.pinned:active .note-bubble {
  background: #fbe8b0;
  border-color: #e8cf82;
}
.pin-tag {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  color: #b7791f;
  background: #fdf0c8;
  padding: 1px 10px;
  border-radius: 40px;
  flex-shrink: 0;
}

/* 滑动显示的操作按钮 */
:root {
  --swipe-w: 84px;
}
.note-item {
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}
.note-item {
  --swipe: 0px;
}
.note-item.open {
  --swipe: var(--swipe-w);
}
.note-content {
  position: relative;
  z-index: 1;
  width: calc(100% - var(--swipe));
  transition: width 0.25s cubic-bezier(0.3, 0.7, 0.3, 1);
}

.swipe-actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--swipe-w);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.note-item.open .swipe-actions,
.note-item.dragging .swipe-actions {
  opacity: 1;
  pointer-events: auto;
}
.swipe-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.swipe-btn:hover {
  opacity: 0.7;
}
.swipe-btn:active {
  transform: scale(0.85);
}
.swipe-btn.pin {
  color: #d99a1c;
}
.swipe-btn.del {
  color: #e0463f;
}

/* ===== 图片功能 ===== */
.btn-attach {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid #e3eaf2;
  background: #f7faff;
  color: #3a4d62;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn-attach:hover {
  background: #e3eaf2;
  color: #0b1b2f;
}
.btn-attach:active {
  transform: scale(0.92);
}

/* 待发送图片预览条 */
.pending-bar {
  display: none;
  flex-shrink: 0;
  padding: 4px 24px 0;
  background: #fafcff;
  border-top: 1px solid #edf2f8;
}
.pending-bar.show {
  display: block;
}
.pending-bar.show + .notepad-footer {
  border-top: none;
  padding-top: 10px;
}
.pending-list {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 10px 10px 0 0;
  scrollbar-width: none;
}
.pending-list::-webkit-scrollbar {
  display: none;
}
.pending-thumb {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}
.pending-thumb img {
  display: block;
  height: 72px;
  max-width: 160px;
  width: auto;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid #e3eaf2;
}
.pending-remove {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: #0b1b2f;
  color: #fff;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* 气泡里的图片 */
.note-bubble.has-img {
  width: fit-content;
  max-width: 100%;
  padding: 6px;
}
.note-imgs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: 320px;
  max-width: 100%;
}
.note-imgs.n1 {
  grid-template-columns: 1fr;
}
.note-imgs.n2,
.note-imgs.n4 {
  grid-template-columns: repeat(2, 1fr);
}
.note-img-box {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: #dfe7f3;
}
.note-imgs.n1 .note-img-box {
  max-height: 380px;
  border-radius: 14px;
}
.note-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}
.note-img-box.broken::after {
  content: '图片不可用';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  color: #8b9eb3;
}
.note-text {
  padding: 8px 10px 4px;
}

/* 大图预览 */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(8, 16, 28, 0.88);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lightbox.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
}
.lightbox-close {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* 大图预览：切换按钮 / 计数 */
.lightbox-nav {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 64px;
  border: none;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.lightbox-nav.prev { left: 12px; }
.lightbox-nav.next { right: 12px; }
.lightbox.multi .lightbox-nav {
  display: flex;
}
.lightbox-count {
  position: absolute;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.16);
  padding: 3px 14px;
  border-radius: 40px;
}
.lightbox-count:empty {
  display: none;
}

@media (max-width: 640px) {
  .pending-bar { padding: 4px 16px 0; }
  .btn-attach { width: 40px; height: 40px; }
  .note-imgs { width: 260px; }
}
