/* ===== coss ui design tokens (Tailwind palette → plain CSS, Chrome/Orion safe) ===== */
:root {
  --background: #ffffff;
  --foreground: #262626; /* neutral-800 */
  --card: #ffffff;
  --card-foreground: #262626;
  --popover: #ffffff;
  --popover-foreground: #262626;
  --primary: #262626; /* neutral-800 */
  --primary-foreground: #fafafa; /* neutral-50 */
  --secondary: rgba(0, 0, 0, 0.04);
  --secondary-foreground: #262626;
  --muted: rgba(0, 0, 0, 0.04);
  --muted-foreground: #676767; /* neutral-500 ~90% + black */
  --accent: rgba(0, 0, 0, 0.04);
  --accent-foreground: #262626;
  --destructive: #ef4444; /* red-500 */
  --destructive-foreground: #ffffff;
  --info: #3b82f6; /* blue-500 */
  --info-foreground: #1d4ed8; /* blue-700 */
  --success: #10b981; /* emerald-500 */
  --success-foreground: #047857; /* emerald-700 */
  --warning: #f59e0b; /* amber-500 */
  --warning-foreground: #b45309; /* amber-700 */
  --border: rgba(0, 0, 0, 0.08);
  --input: rgba(0, 0, 0, 0.1);
  --ring: #a3a3a3; /* neutral-400 */
  --radius: 0.625rem;
}

/* ===== Website wrapper: PC 600px centered with side margins, mobile adaptive ===== */
html {
  scrollbar-width: none;
  scrollbar-color: transparent transparent;
}
html::-webkit-scrollbar { width: 0; height: 0; display: none; }
body::-webkit-scrollbar { width: 0; height: 0; display: none; }
body {
  background: #ffffff;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  margin: 0;
}
.page-wrap {
  width: 100%;
  max-width: 600px;
  min-height: 100vh;
  background: var(--background);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: none;
  padding: 8px 12px;
  box-sizing: border-box;
}
@media (max-width: 640px) {
  body { background: var(--background); }
  .page-wrap {
    max-width: 100%;
    min-height: 100dvh;
    box-shadow: none;
    padding: 6px 8px;
  }
}

/* ===== Login overlay — 完全复刻 Figma https://focus-dock-26733495.figma.site/ ===== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overscroll-behavior: contain;
}
.login-overlay.hidden { display: none !important; }

/* Figma 画布：白底居中，最大 520px，gap 24px */
.figma-login-overlay {
  font-family: "Noto Sans SC", system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
.figma-login-inner {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
.figma-logo {
  display: block;
  width: 76px;
  height: 76px;
  flex: none;
}
.figma-title-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}
.figma-title {
  font-family: "Alibaba PuHuiTi", "Noto Sans SC", sans-serif;
  font-weight: 700;
  font-size: 30px;
  line-height: 1.5;
  letter-spacing: -0.025em;
  color: #000000;
  margin: 0;
}
.figma-subtitle {
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-weight: 400;
  font-style: normal;
  font-synthesis: none;
  font-variation-settings: normal;
  font-size: 20px;
  line-height: 1.5;
  color: rgba(0,0,0,0.6);
  margin: 0;
}
.figma-field-row {
  width: 100%;
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.figma-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.figma-input {
  width: 100%;
  height: 56px;
  border-radius: 11px;
  border: 1px solid rgba(38,38,38,0.1);
  background: #ffffff;
  padding: 0 20px;
  font-size: 20px;
  font-family: inherit;
  color: #000000;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.figma-input::placeholder {
  color: rgba(0,0,0,0.3);
}
.figma-input:focus {
  border-color: rgba(38,38,38,0.3);
}
.figma-btn {
  border: none;
  border-radius: 11px;
  background: #262626;
  color: #ffffff;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  white-space: nowrap;
}
.figma-btn:hover { background: #3a3a3a; }
.figma-btn:active { background: #1a1a1a; }
.figma-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.figma-btn-enter {
  flex: none;
  width: auto;
  min-width: 87px;
  height: 56px;
  padding: 0 20px;
  font-size: 20px;
  font-weight: 400;
  white-space: nowrap;
}
.figma-btn-install {
  width: 188px;
  height: 56px;
  font-size: 18px;
  font-weight: 400;
  margin-top: 16px;
}
.figma-hint {
  width: 100%;
  font-size: 16px;
  line-height: 1.625;
  color: rgba(0,0,0,0.4);
  margin: 0;
  text-align: left;
  word-break: break-word;
}
.figma-err {
  width: 100%;
  font-size: 13px;
  color: #ef4444;
  text-align: center;
  margin: 0;
}
.figma-err.hidden { display: none !important; }

/* 兼容旧类名（如有残留引用） */
.login-box { width: 100%; max-width: 520px; text-align: center; }
.login-icon { margin-bottom: 16px; }
.login-title { font-size: 20px; font-weight: 700; color: var(--foreground); margin-bottom: 8px; }
.login-desc { font-size: 13px; color: var(--muted-foreground); margin-bottom: 20px; }
.login-field { display: flex; gap: 8px; margin-bottom: 10px; }
.login-input { flex: 1; min-width: 0; height: 40px; background: var(--background); border: 1px solid var(--input); border-radius: 10px; padding: 0 14px; font-size: 13px; outline: none; }
.login-hint { font-size: 11px; color: var(--muted-foreground); line-height: 1.5; }
.login-err { font-size: 12px; color: var(--destructive); margin-top: 10px; }
.login-foot { margin-top: 18px; }

@media (max-width: 480px) {
  .figma-title { font-size: 26px; }
  .figma-subtitle { font-size: 18px; }
  .figma-input { font-size: 18px; height: 50px; }
  .figma-btn-enter { height: 50px; font-size: 18px; }
  .figma-btn-install { height: 50px; font-size: 16px; }
  .figma-hint { font-size: 14px; }
}


* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  position: relative; /* WebKit/Orion: backdrops cover the visual viewport */
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--background);
  color: var(--foreground);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* ===== Scrollbar ===== */
main::-webkit-scrollbar {
  width: 4px;
}
main::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 9999px;
}
main::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.18);
}
main::-webkit-scrollbar-track {
  background: transparent;
}

/* ===== Actions bar ===== */
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 4px 3px;
  flex: none;
}

#search {
  flex: 1;
  min-width: 0;
  height: 34px;
  background: var(--background);
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  color: var(--foreground);
  padding: 6px 6px 6px 11px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#search::placeholder {
  color: rgba(103, 103, 103, 0.42);
  font-size: 12px;
  opacity: 1;
}

#search:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

#search:placeholder-shown::-webkit-search-cancel-button {
  display: none;
}

#search::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  height: 20px;
  width: 20px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='11' fill='%23ffffff'/%3E%3Cpath d='M8 8l8 8M16 8l-8 8' stroke='%23a3a3a3' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
}

#search:not(:placeholder-shown)::-webkit-search-cancel-button {
  opacity: 1;
}

#search::-webkit-search-cancel-button:hover {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='11' fill='%23ffffff'/%3E%3Cpath d='M8 8l8 8M16 8l-8 8' stroke='%23676767' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* ===== Tag filter bar ===== */
.tag-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  position: relative;
  padding: 4px 0 9px 4px;
  -webkit-overflow-scrolling: touch;
}

.tag-bar::-webkit-scrollbar {
  display: none;
}

.tag-chip {
  flex: none;
  font-size: 11px;
  line-height: 1;
  font-style: italic;
  color: var(--muted-foreground);
  background: var(--secondary);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.tag-chip:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--foreground);
}

.tag-chip:active {
  background: rgba(0, 0, 0, 0.12);
}

.tag-chip.active {
  color: var(--primary-foreground);
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.tag-chip.active:hover {
  background: var(--primary);
  color: var(--primary-foreground);
}

.tag-chip.active:active {
  background: #1a1a1a;
}

.tag-chip.active::after {
  content: ' ×';
  font-weight: 700;
  margin-left: 2px;
}

.tag-more-btn {
  position: sticky;
  right: 0;
  flex: none;
  align-self: stretch;
  margin-left: auto;
  margin-right: 0;
  height: 32px;
  min-width: 40px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: var(--background);
  box-shadow: none;
  color: var(--muted-foreground);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 6;
  transition: background 0.12s ease;
}

.tag-more-btn:hover {
  background: var(--background);
  color: var(--primary);
}

.tag-more-btn:active {
  background: var(--secondary);
  color: var(--primary);
  transform: scale(0.92);
}

.tag-more-btn svg {
  width: 13px;
  height: 13px;
  transition: transform 0.2s ease;
}

.tag-more-btn.open svg {
  transform: rotate(180deg);
}

/* ===== Permanent filter chips (time + url) ===== */
.tag-chip .tag-chip-caret {
  display: inline-flex;
  align-items: center;
  margin-left: 3px;
  vertical-align: middle;
}

.tag-chip .tag-chip-caret svg {
  width: 9px;
  height: 9px;
  opacity: 0.55;
  transition: transform 0.2s ease;
}

.tag-chip.open .tag-chip-caret svg {
  transform: rotate(180deg);
}

.time-chip,
.url-chip {
  display: inline-flex;
  align-items: center;
  gap: 1px;
}

.tag-chip.time-chip.active::after,
.tag-chip.url-chip.active::after {
  content: '';
}

/* ===== Time dropdown menu ===== */
.time-menu .tag-menu-item .tag-menu-name {
  font-style: normal;
}

/* ===== URL dropdown menu ===== */
.tag-menu.url-menu {
  padding: 5px;
  max-height: none;
  overflow: visible;
}

.url-menu-search {
  flex: none;
  width: 100%;
  height: 30px;
  margin-bottom: 4px;
  background: var(--secondary);
  border: 1px solid var(--input);
  border-radius: 6px;
  color: var(--foreground);
  padding: 4px 10px;
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.url-menu-search::placeholder {
  color: var(--muted-foreground);
}

.url-menu-search:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.url-menu-list {
  max-height: 260px;
  overflow-y: auto;
}

.url-menu-list::-webkit-scrollbar {
  width: 4px;
}

.url-menu-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 999px;
}

.url-menu-item {
  align-items: flex-start;
  padding: 6px 10px;
}

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

.url-menu-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.url-menu-host {
  font-size: 11px;
  color: var(--muted-foreground);
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.url-menu-item.active .url-menu-host {
  color: rgba(255, 255, 255, 0.7);
}

.url-menu-empty {
  padding: 14px 10px;
  text-align: center;
  font-size: 12px;
  color: var(--muted-foreground);
}

.tag-menu-item.filter-menu-cancel {
  border-radius: 0 0 6px 6px;
  color: var(--popover-foreground);
  justify-content: center;
}

.filter-menu-cancel:hover {
  background: var(--secondary);
}

.filter-menu-cancel-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  color: inherit;
}

.filter-menu-cancel-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}

.filter-menu-cancel .tag-menu-name,
.filter-menu-cancel .url-menu-title {
  color: inherit;
  font-weight: 600;
  flex: none;
  text-align: center;
}

.filter-menu-cancel .url-menu-info {
  flex: none;
}

.filter-menu-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
  flex-shrink: 0;
}

/* ===== Tag dropdown menu (matches data management menu) ===== */
.tag-menu {
  position: fixed;
  max-height: min(50vh, 320px);
  overflow-y: auto;
  background: var(--popover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 4px 10px -5px rgba(0, 0, 0, 0.04);
  z-index: 999;
  padding: 5px;
  display: none;
  animation: menu-pop 0.12s ease-out;
}

.tag-menu.show {
  display: block;
}

.tag-menu::-webkit-scrollbar {
  width: 4px;
}

.tag-menu::-webkit-scrollbar-track {
  background: transparent;
}

.tag-menu::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 999px;
}

@keyframes menu-pop {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.tag-menu-list {
  display: flex;
  flex-direction: column;
}

.tag-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--popover-foreground);
  padding: 7px 14px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.tag-menu-item:hover {
  background: var(--secondary);
}

.tag-menu-name {
  flex: 1;
  min-width: 0;
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-menu-item.active {
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 600;
}

.tag-menu-count {
  flex: none;
  font-size: 11px;
  font-style: normal;
  color: var(--muted-foreground);
  background: var(--secondary);
  border-radius: 999px;
  padding: 2px 8px;
  min-width: 20px;
  text-align: center;
}

.tag-menu-item.active .tag-menu-count {
  background: rgba(255, 255, 255, 0.18);
  color: var(--primary-foreground);
}

.tag-menu-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

.tag-menu-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.tag-menu-action svg {
  width: 14px;
  height: 14px;
}

.tag-menu-action:hover {
  background: var(--secondary);
  color: var(--foreground);
}

.tag-menu-action.danger:hover {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

.tag-menu-action.confirm {
  color: #16a34a;
}

.tag-menu-action.confirm:hover {
  background: rgba(22, 163, 74, 0.1);
  color: #16a34a;
}

.tag-del-confirm {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

.tag-del-confirm .tag-menu-action {
  width: auto;
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  flex: none;
}

.tag-del-confirm .tag-del-confirm-btn {
  color: #dc2626;
}

.tag-del-confirm .tag-del-confirm-btn:hover {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

.tag-menu-input {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  background: var(--background);
  border: none;
  border-radius: 8px;
  color: var(--foreground);
  font-size: 12px;
  line-height: 1.5;
  padding: 8px;
  font-family: inherit;
  outline: none;
  cursor: text;
}

.tag-menu-item.active .tag-menu-action {
  color: rgba(255, 255, 255, 0.7);
}

.tag-menu-item.active .tag-menu-action:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.tag-menu-item.active .tag-menu-input {
  background: #3a3a3a;
  color: #ffffff;
}

@media (hover: none), (pointer: coarse) {
  .tag-chip {
    padding: 8px 14px;
    font-size: 13px;
  }

  .tag-more-btn {
    height: 34px;
    min-width: 52px;
    padding: 0 14px;
  }

  .tag-more-btn svg {
    width: 16px;
    height: 16px;
  }

  .tag-menu-item {
    padding: 14px 16px;
    font-size: 14px;
  }
}

/* ===== Buttons (coss ui style) ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 500;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid transparent;
  background: var(--primary);
  color: var(--primary-foreground);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  background: rgba(0, 0, 0, 0.7);
}

.btn.primary {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.btn.primary:hover {
  background: rgba(0, 0, 0, 0.8);
  color: var(--primary-foreground);
}

.btn.secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.btn.secondary:hover {
  background: rgba(0, 0, 0, 0.08);
}

.btn.outline {
  background: var(--background);
  border-color: var(--input);
  color: var(--secondary-foreground);
}

.btn.outline:hover {
  background: var(--accent);
}

.btn.ghost {
  background: transparent;
  color: var(--secondary-foreground);
}

.btn.ghost:hover {
  background: var(--accent);
}

.btn.danger {
  background: var(--destructive);
  color: var(--destructive-foreground);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.btn.danger:hover {
  background: #dc2626;
  color: var(--destructive-foreground);
}

.btn.primary:disabled,
.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Icon button (menu ⋯) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

#cardModeBtn.active {
  background: rgba(0, 0, 0, 0.08);
  color: #262626;
}

#cardModeBtn {
  position: relative;
  margin-right: -6.4px;
}

#cardModeBtn .card-mode-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  transition: opacity 0.4s cubic-bezier(0.42, 0, 0.58, 1), transform 0.4s cubic-bezier(0.42, 0, 0.58, 1);
}

#cardModeBtn .card-mode-icon-off {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

#cardModeBtn .card-mode-icon-on {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.7);
}

#cardModeBtn.active .card-mode-icon-off {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.7);
}

#cardModeBtn.active .card-mode-icon-on {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ===== Dropdown menu ===== */
.menu {
  position: relative;
  display: flex;
  gap: 8px;
}

.menu-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 168px;
  background: var(--popover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 4px 10px -5px rgba(0, 0, 0, 0.04);
  z-index: 10;
  padding: 5px;
  animation: pop-in 0.12s ease-out;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.menu-pop button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--popover-foreground);
  padding: 7px 9px;
  font-size: 13px;
  border-radius: calc(var(--radius) - 4px);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.menu-pop button:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.menu-pop button:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.menu-pop button svg {
  width: 15px;
  height: 15px;
  color: var(--muted-foreground);
}

.menu-pop button.danger {
  color: var(--destructive);
}

.menu-pop button.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

/* ===== List ===== */
main {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 3px 4px 24px;
  min-height: 0;
}

.scroll-stats {
  display: flex;
  height: 0;
  overflow: hidden;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 0;
  font-size: 11px;
  color: rgba(103, 103, 103, 0.42);
  opacity: 0;
  text-align: center;
  flex-shrink: 0;
  line-height: 1;
  mask-image: linear-gradient(to bottom, transparent 0%, black 30%, black 70%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 30%, black 70%, transparent 100%);
  transition: opacity 0.4s cubic-bezier(0.42, 0, 0.58, 1),
              height 0.4s cubic-bezier(0.42, 0, 0.58, 1),
              padding 0.4s cubic-bezier(0.42, 0, 0.58, 1);
}

.scroll-stats.show {
  height: auto;
  padding: 4px 0;
  opacity: 1;
}

.scroll-stats svg {
  flex-shrink: 0;
}

.item {
  position: relative;
  padding: 3px 0 5px;
}

.item:hover .item-line-ctx,
.item-line.active .item-line-ctx {
  height: auto;
  max-height: none;
  opacity: 1;
}

.item-lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.item-line {
  position: relative;
  padding: 5px 3px;
  border-radius: calc(var(--radius) - 4px);
  cursor: pointer;
}

.item-lines .item-line:last-child {
  padding-bottom: 2px;
}

.dot {
  position: absolute;
  top: 11px;
  left: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s ease;
}

.dot:hover {
  transform: scale(1.35);
}

.item-line-main {
  margin-left: 21px;
  min-width: 0;
}

.item-line-text {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--foreground);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 80%, transparent 100%);
}

.item-line-meta {
  margin-top: 5px;
}

.item-line-tag,
.item-line-note {
  display: inline-block;
  vertical-align: top;
  max-width: 100%;
  margin-bottom: 2px;
  padding: 6px 9px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted-foreground);
  background: var(--secondary);
  border-radius: calc(var(--radius) - 4px);
  word-break: break-word;
}

.item-line-tag {
  display: inline-block;
  margin-right: 5px;
  font-style: italic;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.item-line-tag:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--foreground);
}

.item-line-tag:active {
  background: rgba(0, 0, 0, 0.12);
}

.item-line-note {
  white-space: pre-wrap;
}

.item-line-ctx {
  position: relative;
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted-foreground);
  opacity: 0.85;
  overflow: visible;
  width: fit-content;
  max-width: 100%;
  height: auto;
  max-height: none;
  transition: opacity 0.3s ease;
}

.item-line-ctx-text {
  padding-left: 9px;
  word-break: break-word;
}

/* 引用原文左侧竖杠：顶部 30% 透明度渐变到底部 100% */
.item-line-ctx::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.024), rgba(0, 0, 0, 0.08));
}

/* 仅动画运行期间显示底部渐变（JS 在 transitionstart/end 切换 .anim） */
.item-line-ctx.anim {
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 82%, rgba(0, 0, 0, 0.45) 94%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 82%, rgba(0, 0, 0, 0.45) 94%, transparent 100%);
}

/* 内容不足 3 行：不截断、不展开动画 */
.item-line-ctx.short {
  height: auto;
  max-height: none;
  -webkit-mask-image: none;
  mask-image: none;
}

 .item-line-ctx strong {
  font-weight: 600;
  text-decoration: underline;
  text-decoration-style: dashed;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(0, 0, 0, 0.35);
}

/* 引文行内「翻译 / 原文」切换：纯文字、与引文融为一体，色值与引文一致但透明度降50%。悬停去掉下划线变蓝绿并加同色无尾箭头 ›。热区用 padding+负margin+伪元素外扩。 */
.ctx-translate-btn {
  color: rgba(103, 103, 103, 0.42);
  font-size: inherit;
  font-family: inherit;
  line-height: inherit;
  white-space: nowrap;
  cursor: pointer;
  margin: -7px -9px -7px -9px;
  padding: 7px 9px;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  display: none;
  opacity: 0;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.ctx-translate-btn::before {
  content: '';
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: -3px;
  right: -3px;
}

.ctx-translate-btn::after {
  content: '›';
  margin-left: 2px;
  font-size: inherit;
  line-height: 1;
  color: rgba(103, 103, 103, 0.42);
  transition: color 0.15s ease;
}

.ctx-translate-btn:hover {
  color: #00c9e0;
  text-decoration: none;
}

.ctx-translate-btn:hover::after {
  color: #00c9e0;
}

.ctx-translate-btn:active {
  color: #00c9e0;
  text-decoration: none;
}

.ctx-translate-btn:active::after {
  color: #00c9e0;
}

.ctx-translate-btn.loading::after {
  display: none;
}

/* 与引文(.item-line-ctx)完全一致的显隐条件：hover 整条 item 或该行处于 active
   隐藏时 display:none 使其不占位，竖杠高度仅为引文高度 */
.item:hover .ctx-translate-btn,
.item-line.active .ctx-translate-btn {
  display: inline;
  opacity: 1;
}

@media (hover: none), (pointer: coarse) {
  .ctx-translate-btn::before {
    top: -6px;
    bottom: -6px;
    left: -6px;
    right: -6px;
  }
}

.tag-inline {
  font-style: italic;
  font-weight: 600;
  color: var(--muted-foreground);
}

.item-edit {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin-top: 7px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.5;
  color: var(--foreground);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
  cursor: text;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.item-edit:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(163, 163, 163, 0.25);
}

.item-edit:empty::before {
  content: attr(data-placeholder);
  color: var(--muted-foreground);
  opacity: 0.7;
  pointer-events: none;
}

.item-foot {
  display: grid;
  grid-template-rows: 0fr;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  justify-items: end;
  padding-top: 6px;
  opacity: 0;
  color: #a3a3a3;
  transition: grid-template-rows 0.28s ease, opacity 0.25s ease;
}

.item-foot > * {
  min-height: 0;
  overflow: hidden;
}

.item:hover .item-foot,
.item.tap-active .item-foot {
  grid-template-rows: 1fr;
  opacity: 1;
}

.item-foot-row {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.item-url {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  font-size: 11px;
  color: inherit;
  cursor: pointer;
}

.item-url-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-url-sep {
  flex: none;
  margin: 0 5px;
  color: inherit;
}

.item-url-arrow {
  display: inline-flex;
  align-items: center;
  flex: none;
  margin-right: 3px;
  color: inherit;
}

.item-time {
  flex: none;
  font-size: 11px;
  color: inherit;
  cursor: pointer;
}

.item-url:hover,
.item-url:hover .item-url-name,
.item-url:hover .item-url-sep,
.item-url:hover .item-url-arrow {
  color: var(--secondary-foreground);
}

.item-time:hover {
  color: var(--secondary-foreground);
}

.item-foot-play {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(78, 255, 128, 0.18);
  color: #0b3d1f;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, transform 0.15s, color 0.15s;
}

.item-foot-play svg {
  width: 10px;
  height: 10px;
}

.item-foot-play:hover {
  background: rgba(78, 255, 128, 0.4);
  transform: scale(1.08);
}

.item-foot-play:active {
  transform: scale(0.94);
}

.line-acts {
  position: absolute;
  top: 6px;
  right: 2px;
  display: flex;
  gap: 10px;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.item:not(:hover):not(.tap-active) .item-line:not(.active):not(.confirming):not(.editing) .line-acts .line-act {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px);
}
.item:hover .line-acts .line-act,
.item.tap-active .line-acts .line-act,
.item-line.active .line-acts .line-act,
.item-line.confirming .line-acts .line-act,
.item-line.editing .line-acts .line-act {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.item-line .item-line-main {
  padding-right: 56px;
}
/* 激活时给文字留出右侧空间，避免图标遮挡 */
.item-line.active .item-line-main {
  padding-right: 110px;
}

.item-line.active .item-line-meta {
  margin-right: 0;
}

/* 删除确认中：仅保留“确定删除 | 取消”，隐藏相邻按钮 */
.item-line.confirming .line-acts > .line-act {
  display: none;
}

.item-line.confirming .line-acts {
  opacity: 1;
  pointer-events: auto;
}

.line-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: #ffffff;
  color: var(--muted-foreground);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: color 0.12s ease, opacity 0.28s ease, transform 0.28s ease;
}

.line-act svg {
  width: 12px;
  height: 12px;
}

.line-act:hover {
  color: var(--foreground);
}

.line-act.danger:hover {
  color: #dc2626;
}

.line-act-more-wrap {
  position: relative;
  display: inline-flex;
}

.note-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 192px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 4px 10px -5px rgba(0, 0, 0, 0.06);
  z-index: 50;
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: menu-in 0.14s ease-out;
}

.note-more-menu.hidden {
  display: none !important;
}

.note-more-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: #262626;
  padding: 10px 12px;
  font-size: 13px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.note-more-menu button:hover {
  background: rgba(0, 0, 0, 0.05);
}

.note-more-menu button:active {
  background: rgba(0, 0, 0, 0.08);
}

.note-more-menu button svg {
  width: 15px;
  height: 15px;
  color: #676767;
  flex: none;
}

.note-more-menu button.danger {
  color: #dc2626;
}

.note-more-menu button.danger svg {
  color: #dc2626;
}

.line-act-more.open {
  background: rgba(0, 0, 0, 0.08);
  color: #262626;
}

/* 编辑时仅保留对勾按钮，隐藏其余图标按钮 */
.item-line.editing .line-act:not(.edit-btn) {
  display: none;
}

/* 删除确认：删除按钮原地变为“确认删除 | 取消” */
.line-act-confirm-wrap {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.line-act-confirm-wrap .line-act {
  width: auto;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
}

.line-act-confirm {
  color: #ffffff;
  background: #dc2626;
}

.line-act-confirm:hover {
  background: #b91c1c;
  color: #ffffff;
}

.line-act-cancel {
  color: var(--muted-foreground);
  background: #ffffff;
}

.line-act-cancel:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* ===== Touch devices ===== */
@media (hover: none), (pointer: coarse) {
  .line-act {
    width: 34px;
    height: 34px;
  }

  .line-act svg {
    width: 17px;
    height: 17px;
  }

  .dot {
    width: 16px;
    height: 16px;
    top: 7px;
  }

  .item-line-main {
    margin-left: 24px;
  }
}

/* ===== Empty state ===== */
.empty {
  display: none;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  color: var(--muted-foreground);
}

.empty-icon-wrap {
  margin-bottom: 20px;
  border-radius: 16px;
  background: var(--secondary);
  box-shadow: inset 0 0 0 1px var(--border);
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-icon-img {
  display: block;
  opacity: 0.85;
}

.empty-title {
  margin-bottom: 6px;
  font-size: 16px;
  font-weight: 600;
  color: var(--foreground);
  letter-spacing: 0.02em;
}

.empty-tips {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.7;
  color: var(--muted-foreground);
  margin-top: 12px;
}

.empty-tips + .empty-tips {
  margin-top: 12px;
}

.empty-foot {
  font-size: 11px;
  color: var(--muted-foreground);
  opacity: 0.7;
  margin-top: 18px;
}

.empty .whl-mark {
  position: relative;
  z-index: 0;
  padding: 0 3px;
  border-radius: 0;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  font-weight: bold;
  filter: url(#whl-rough);
}

.empty .whl-mark::after {
  content: '';
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: -3px;
  right: -3px;
  z-index: 1;
  transform: skewX(-1.2deg);
  pointer-events: none;
}

.empty .whl-mark.c-red { background: linear-gradient(to right, rgba(255, 122, 166, 0) 0%, rgba(255, 122, 166, 0.66) 20%, rgba(255, 122, 166, 0.72) 80%, rgba(255, 122, 166, 0) 100%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 12' preserveAspectRatio='none'%3E%3Cpath d='M0 5.5 C 15 4.8 30 6.2 45 5.6 C 60 5 75 6.4 100 5.8' stroke='white' stroke-width='2' fill='none' opacity='0.7'/%3E%3C/svg%3E"); background-size: 100% 100%, 100% 14px; background-position: 0 0, 0 0; background-repeat: no-repeat, no-repeat; }
.empty .whl-mark.c-orange { background: linear-gradient(to right, rgba(255, 241, 0, 0) 0%, rgba(255, 241, 0, 0.6) 20%, rgba(255, 241, 0, 0.66) 80%, rgba(255, 241, 0, 0) 100%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 12' preserveAspectRatio='none'%3E%3Cpath d='M0 5.5 C 15 4.8 30 6.2 45 5.6 C 60 5 75 6.4 100 5.8' stroke='white' stroke-width='2' fill='none' opacity='0.7'/%3E%3C/svg%3E"); background-size: 100% 100%, 100% 14px; background-position: 0 0, 0 0; background-repeat: no-repeat, no-repeat; }
.empty .whl-mark.c-green { background: linear-gradient(to right, rgba(57, 255, 20, 0) 0%, rgba(57, 255, 20, 0.62) 20%, rgba(57, 255, 20, 0.68) 80%, rgba(57, 255, 20, 0) 100%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 12' preserveAspectRatio='none'%3E%3Cpath d='M0 5.5 C 15 4.8 30 6.2 45 5.6 C 60 5 75 6.4 100 5.8' stroke='white' stroke-width='2' fill='none' opacity='0.7'/%3E%3C/svg%3E"); background-size: 100% 100%, 100% 14px; background-position: 0 0, 0 0; background-repeat: no-repeat, no-repeat; }
.empty .whl-mark.c-blue { background: linear-gradient(to right, rgba(0, 229, 255, 0) 0%, rgba(0, 229, 255, 0.62) 20%, rgba(0, 229, 255, 0.68) 80%, rgba(0, 229, 255, 0) 100%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 12' preserveAspectRatio='none'%3E%3Cpath d='M0 5.5 C 15 4.8 30 6.2 45 5.6 C 60 5 75 6.4 100 5.8' stroke='white' stroke-width='2' fill='none' opacity='0.7'/%3E%3C/svg%3E"); background-size: 100% 100%, 100% 14px; background-position: 0 0, 0 0; background-repeat: no-repeat, no-repeat; }
.empty .whl-mark.c-purple { background: linear-gradient(to right, rgba(221, 157, 255, 0) 0%, rgba(221, 157, 255, 0.66) 20%, rgba(221, 157, 255, 0.72) 80%, rgba(221, 157, 255, 0) 100%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 12' preserveAspectRatio='none'%3E%3Cpath d='M0 5.5 C 15 4.8 30 6.2 45 5.6 C 60 5 75 6.4 100 5.8' stroke='white' stroke-width='2' fill='none' opacity='0.7'/%3E%3C/svg%3E"); background-size: 100% 100%, 100% 14px; background-position: 0 0, 0 0; background-repeat: no-repeat, no-repeat; }
.empty .whl-mark.c-yellow { background: linear-gradient(to right, rgba(255, 241, 0, 0) 0%, rgba(255, 241, 0, 0.6) 20%, rgba(255, 241, 0, 0.66) 80%, rgba(255, 241, 0, 0) 100%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 12' preserveAspectRatio='none'%3E%3Cpath d='M0 5.5 C 15 4.8 30 6.2 45 5.6 C 60 5 75 6.4 100 5.8' stroke='white' stroke-width='2' fill='none' opacity='0.7'/%3E%3C/svg%3E"); background-size: 100% 100%, 100% 14px; background-position: 0 0, 0 0; background-repeat: no-repeat, no-repeat; }

/* ===== Modal / Dialog ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  padding: 20px;
  animation: fade-in 0.15s ease-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-box {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: dialog-in 0.18s ease-out;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  border-radius: 7px;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.modal-close:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.modal-close svg {
  width: 16px;
  height: 16px;
}

.modal-body {
  padding: 18px;
}

.modal-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 7px;
}

.id-row {
  display: flex;
  gap: 7px;
}

.id-input {
  flex: 1;
  min-width: 0;
  height: 34px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  background: var(--background);
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  padding: 0 11px;
  color: var(--foreground);
  outline: none;
  white-space: nowrap;
  overflow-x: auto;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.id-input:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.modal-hint {
  font-size: 11px;
  color: var(--muted-foreground);
  line-height: 1.6;
  margin-top: 10px;
}

.modal-time {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-time svg {
  width: 13px;
  height: 13px;
}

.modal-foot {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: var(--secondary);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(10px);
  background: var(--foreground);
  color: var(--background);
  border-radius: var(--radius);
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  max-width: 340px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
}

.toast-msg {
  flex: 1 1 auto;
  min-width: 0;
}

.toast-undo {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: #4eff80;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
  white-space: nowrap;
  pointer-events: auto;
}

.toast-undo:hover {
  text-decoration: underline;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 归档按钮样式 */
.line-act.archived {
  color: #f59e0b;
}

/* 菜单激活态 */
.menu-pop button.active {
  background: rgba(0, 0, 0, 0.08);
  font-weight: 600;
}

.menu-pop button.active::after {
  content: '\2713';
  margin-left: 6px;
  font-size: 12px;
}

/* 导出菜单 */
.export-menu {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  padding: 12px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
}

.export-menu-title {
  font-size: 12px;
  color: #6b7280;
  padding: 0 4px;
}

.export-menu button {
  width: 100%;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
}

.export-menu button:hover {
  background: #f3f4f6;
}

.export-menu button.cancel {
  color: #6b7280;
  border: none;
  background: transparent;
}

/* 子菜单（与 .menu-pop 定位一致） */
.local-submenu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 168px;
  max-width: 260px;
  max-height: calc((100vh - 90px) * 2 / 3);
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 4px 10px -5px rgba(0, 0, 0, 0.06);
  z-index: 60;
  padding: 5px;
  transform-origin: top right;
  opacity: 0;
  transform: scale(0.95) translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.local-submenu::-webkit-scrollbar {
  width: 4px;
}

.local-submenu::-webkit-scrollbar-track {
  background: transparent;
}

.local-submenu::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 4px;
}

.local-submenu.submenu-enter {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.local-submenu.submenu-exit {
  opacity: 0;
  transform: scale(0.95) translateY(-4px);
}

.local-submenu-head {
  display: flex;
  align-items: center;
  padding: 0 0 0 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  margin-bottom: 2px;
}

.local-submenu-back {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 10px;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  color: #676767;
  font-size: 13px;
}

.local-submenu-back svg {
  width: 15px;
  height: 15px;
}

.local-submenu-back:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.local-submenu-back:active {
  background: var(--accent);
  color: var(--accent-foreground);
  opacity: 0.8;
}

.local-submenu-body button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  border: none;
  background: none;
  font-size: 13px;
  color: #262626;
  border-radius: 8px;
  cursor: pointer;
}

.local-submenu-body button:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.local-submenu-body button:active {
  background: var(--accent);
  color: var(--accent-foreground);
  opacity: 0.8;
}

.local-submenu-item {
  padding: 0;
}

.local-submenu-body .local-item-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

 .lang-item-btn {
   flex-direction: row !important;
   align-items: center !important;
   justify-content: space-between;
   gap: 8px !important;
   width: 100%;
 }
 .lang-item-btn.active {
   background: rgba(0, 0, 0, 0.08);
   font-weight: 600;
 }

.lang-check {
  color: #262626;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.lang-check svg {
  width: 14px;
  height: 14px;
  display: block;
}

.local-item-main {
  font-size: 13px;
  color: #262626;
}

.local-submenu-hint {
  font-size: 11px;
  color: #9ca3af;
  padding: 0;
}

/* ===== Card Mode (Tinder style) ===== */
.card-view {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px 24px 6px;
  overflow: visible;
  margin-top: -20px;
  position: relative;
}

.card-stack {
  flex: 1 1 auto;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 40px;
  min-height: 200px;
  overflow: visible;
}

.tinder-card {
  position: absolute;
  top: 80px;
  box-sizing: border-box;
  width: calc(100% - 20px);
  max-width: 360px;
  max-height: calc(100% - 190px);
  display: flex;
  flex-direction: column;
  overflow: clip;
  overflow-clip-margin: 8px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.12), 0 2px 8px -2px rgba(0, 0, 0, 0.08);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  transition: transform 0.3s ease, opacity 0.3s ease;
  will-change: transform;
  padding: 14px 16px;
}

.tinder-card .item {
  padding: 0;
  background: none;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tinder-card .item-lines {
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible;
  overflow-y: visible;
}

.tinder-card .dot {
  left: 4px;
  top: 13px;
}

.tinder-card:active {
  cursor: grabbing;
}

.tinder-card.swipe-left {
  box-shadow: 0 4px 20px -2px rgba(255, 80, 80, 0.3);
}

.tinder-card.swipe-right {
  box-shadow: 0 4px 20px -2px rgba(80, 200, 120, 0.3);
}

/* Swipe overlay: badges float ABOVE the card (not clipped, not part of card content) */
.card-swipe-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 8;
  overflow: visible;
}

.swipe-badge {
  position: absolute;
  top: 100px;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.swipe-badge::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #fff;
  filter: blur(12px);
  z-index: -1;
}

.swipe-badge-nope {
  right: 20px;
  transform: rotate(15deg);
}

.swipe-badge-like {
  left: 20px;
  transform: rotate(-15deg);
}

.confetti-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  will-change: transform, opacity;
}

.confetti-rect {
  width: 10px;
  height: 6px;
  border-radius: 2px;
}

.confetti-circle {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.confetti-tri {
  width: 12px;
  height: 10px;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.confetti-line {
  width: 2px;
  height: 16px;
  border-radius: 1px;
}

.confetti-star {
  width: 14px;
  height: 14px;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.confetti-svg {
  width: 24px;
  height: 12px;
  overflow: visible;
}

@keyframes confetti-fly {
  0% {
    transform: translate(0px, 0px) rotate(0deg) scale(0.2);
    opacity: 0;
  }
  18% {
    transform: translate(calc(var(--x1) * 0.18), calc(var(--y1) * 0.18)) rotate(calc(var(--r) * 0.18)) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--x1), var(--y1)) rotate(var(--r)) scale(0.6);
    opacity: 0;
  }
}

.card-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
}

.card-nav-group {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 96px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 32px;
}

.card-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: #f5f5f5;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s, color 0.15s;
}

.card-btn:active {
  transform: scale(0.92);
}

.card-btn:disabled {
  opacity: .32;
  cursor: not-allowed;
}

.card-btn:disabled:active {
  transform: none;
}

.card-btn svg {
  width: 22px;
  height: 22px;
}

.card-btn-left:hover,
.card-btn-right:hover {
  background: #eee;
}

.card-btn-tts:hover {
  background: #f0f0f0;
}

.card-btn-autoplay {
  position: relative;
  background: #4eff80;
  color: #062b16;
}

.card-btn-autoplay:hover {
  background: #63ff94;
}

.card-btn-autoplay.active {
  color: #4eff80;
  background: #262626;
  box-shadow: 0 0 9px 3px rgba(78, 255, 128, 0.45);
  animation: autoplay-glow 5.5s ease-in-out infinite;
}

@keyframes autoplay-glow {
  0%, 100% {
    box-shadow: 0 0 9px 3px rgba(78, 255, 128, 0.45);
  }
  33% {
    box-shadow: 0 0 15px 6px rgba(255, 241, 0, 0.55);
  }
  66% {
    box-shadow: 0 0 19px 8px rgba(221, 157, 255, 0.6);
  }
}

.card-btn-autoplay.active::before {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(78, 255, 128, 0.5), rgba(255, 241, 0, 0.5), rgba(221, 157, 255, 0.5), rgba(78, 255, 128, 0.5));
  animation: autoplay-ring 5.5s ease-in-out infinite;
  z-index: -1;
  filter: blur(4px);
  pointer-events: none;
}

@keyframes autoplay-ring {
  0%, 100% {
    transform: rotate(0deg) scale(1);
    opacity: 0.45;
  }
  50% {
    transform: rotate(180deg) scale(1.06);
    opacity: 0.9;
  }
}

.card-btn-tts.active {
  color: #262626;
}

.card-menu {
  position: relative;
  display: flex;
}

.card-menu .menu-pop,
.card-menu .local-submenu {
  top: auto;
  bottom: calc(100% + 6px);
  left: 0;
  right: auto;
}

.card-btn-exit {
  color: #ff5050;
  background: transparent;
}

.card-btn-exit:hover {
  background: #ffecec;
}

.card-btn-left,
.card-btn-right,
.card-btn-menu,
.card-btn-exit {
  width: 38.4px;
  height: 38.4px;
}

.card-btn-left svg,
.card-btn-right svg,
.card-btn-exit svg {
  width: 17.6px;
  height: 17.6px;
}

.card-btn-menu svg {
  width: 14.4px;
  height: 14.4px;
}

.card-btn-menu {
  background: transparent;
}

.card-btn-menu:hover {
  background: #f5f5f5;
}

.card-counter {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  z-index: 20;
  text-align: center;
  font-size: 12px;
  color: rgba(103, 103, 103, 0.42);
  padding: 0;
}

/* ===== 语音设置（两级菜单） ===== */
.local-submenu-body button.voice-opt.active {
  background: rgba(0, 0, 0, 0.08);
  font-weight: 600;
}

.local-submenu-body button.voice-opt.active::after {
  content: '';
  width: 14px;
  height: 14px;
  margin-left: 6px;
  flex: none;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23262626' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
}

/* ===== 多选模式 ===== */
.multi-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 6px 8px 16px;
  background: #ffffff;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.multi-header.hidden { display: none !important; }
.multi-header button {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  font-size: 14px;
  color: #262626;
  cursor: pointer;
  padding: 4px 4px;
}
.multi-header button svg { width: 16px; height: 16px; flex: none; }
.multi-header button:hover { background: rgba(0,0,0,0.06); border-radius: 6px; }
.multi-header button:active { opacity: 0.6; }

.multi-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 4px;
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
  background: #ffffff;
  border-top: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 -8px 24px rgba(0,0,0,0.08);
}

.multi-bar.hidden { display: none !important; }

.multi-bar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5px;
  background: none;
  border: none;
  color: #262626;
  font-size: 11px;
  cursor: pointer;
  padding: 4px 2px;
  border-radius: 8px;
  transition: background 0.15s ease;
}
.multi-bar button:hover { background: rgba(0,0,0,0.06); }
.multi-bar button svg { width: 20px; height: 20px; color: #262626; }
.multi-bar button:active { opacity: 0.7; }
.multi-bar .multi-sep { color: #d1d5db; align-self: center; }
.multi-bar .multi-confirm { color: #dc2626; }
.multi-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  background: none;
}
.multi-icon svg { width: 20px; height: 20px; color: #262626; }
.multi-confirm {
  display: none;
  width: 100%;
  align-items: flex-end;
  justify-content: space-around;
  gap: 4px;
}
.multi-bar.confirming .multi-confirm {
  display: flex !important;
}
.multi-bar.confirming > button[data-multi] {
  display: none !important;
}
.multi-confirm-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5px;
  background: none;
  border: none;
  color: #262626;
  font-size: 11px;
  cursor: pointer;
  padding: 4px 2px;
  border-radius: 8px;
  transition: background 0.15s ease;
}
.multi-confirm-btn:hover { background: rgba(0,0,0,0.06); }
.multi-confirm-btn:active { opacity: 0.7; }
.multi-confirm-btn.confirm { color: #dc2626; }
.multi-confirm-btn.confirm .multi-icon svg { color: #dc2626; }
.multi-confirm-sep { color: #d1d5db; align-self: center; padding-bottom: 6px; font-size: 14px; }

body.multi-select .actions { display: none !important; }
body.multi-select #tagBar { display: none !important; }
body.multi-select .scroll-stats { display: none !important; }
body.multi-select .line-acts { display: none !important; }
body.multi-select .item-foot { pointer-events: none !important; }
body.multi-select .item-foot .item-url,
body.multi-select .item-foot .item-time,
body.multi-select .item-foot .item-foot-play { pointer-events: none !important; cursor: default !important; }
body.multi-select .item-line { cursor: pointer; }
body.multi-select #list { padding-bottom: 84px; }
body.multi-select .card-view { padding-bottom: 84px; }
body.multi-select .item-line.active .item-line-main { padding-right: 0 !important; }
body.multi-select .toast { bottom: 84px !important; }
.multi-dot {
  width: 16px !important;
  height: 16px !important;
  top: 10px !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dot.multi-dot.selected svg,
body.multi-select .dot svg { width: 16px !important; height: 16px !important; color: #262626; display: block; }
.dot.multi-dot:not(.selected) { opacity: 1; }
body.multi-select .dot { width: 16px !important; height: 16px !important; top: 10px !important; background: transparent !important; border: none !important; box-shadow: none !important; padding: 0 !important; display: flex; align-items: center; justify-content: center; }
body.multi-select .item-line-main { margin-left: 19px !important; }
.multi-line .item-line-main { padding-right: 56px !important; }
.multi-line .item-line-text { -webkit-line-clamp: 3; }

#cardModeBtn:disabled { opacity: .38; cursor: not-allowed; }
@media (hover: none), (pointer: coarse) {
  /* 显隐统一：底部网址时间行与右上角三按钮使用完全相同的触发条件与过渡。
     触屏下不使用 :hover（避免 iOS 粘滞 hover 造成残留），仅由条级类驱动 */
  .item-line .line-acts { opacity: 1; pointer-events: auto; transform: none; transition: opacity 0.28s ease, transform 0.28s ease; }
  .item:not(.tap-active):not(:has(.item-line.active)):not(:has(.item-line.editing)):not(:has(.item-line.confirming)) .line-acts .line-act,
  .item:not(.tap-active):not(:has(.item-line.active)):not(:has(.item-line.editing)):not(:has(.item-line.confirming)) .item-foot {
    opacity: 0 !important;
    pointer-events: none !important;
    grid-template-rows: 0fr;
  }
  .item:not(.tap-active):not(:has(.item-line.active)):not(:has(.item-line.editing)):not(:has(.item-line.confirming)) .line-acts .line-act {
    transform: translateY(-3px);
  }
  .item.tap-active .line-acts .line-act,
  .item:has(.item-line.active) .line-acts .line-act,
  .item.tap-active .item-foot,
  .item:has(.item-line.active) .item-foot {
    opacity: 1 !important;
    pointer-events: auto !important;
    grid-template-rows: 1fr;
  }
  .item.tap-active .line-acts .line-act,
  .item:has(.item-line.active) .line-acts .line-act {
    transform: translateY(0);
  }
  .item-line.editing .line-acts .line-act,
  .item-line.confirming .line-acts .line-act {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateY(0);
  }
  .item-line .item-line-main { padding-right: 56px; }
  .item.tap-active, .tinder-card:active { outline: 0; border-color: transparent; box-shadow: none; transform: none; }
  html, body { overflow-x: hidden; max-width: 100vw; overscroll-behavior-x: none; touch-action: pan-y; }
  /* 注意：不要把 .item 放进 overflow-x:hidden 列表 —— 规范会把它的 overflow-y 从
     visible 强制变成 auto，导致每条笔记出现自己的纵向滚动 */
  body, #list, .card-view, .card-stack { overflow-x: hidden; max-width: 100vw; }
  .tag-bar { overscroll-behavior-x: contain; }
  input, textarea, [contenteditable] { font-size: 16px !important; -webkit-text-size-adjust: 100%; }
  html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }

  .item-line-meta { margin-top: 16px !important; }
  .item-line-ctx { margin-top: 12px !important; }
  .item-foot { padding-top: 7px !important; }
  .item-foot { transition: opacity 0.28s ease, grid-template-rows 0.28s ease; }
}

/* ===== Override for web centering (must be last) ===== */
html {
  height: auto !important;
  min-height: 100% !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}
body {
  height: auto !important;
  min-height: 100% !important;
  overflow: visible !important;
  overflow-x: hidden !important;
  background: #ffffff !important;
  display: block !important;
}
.page-wrap {
  margin: 0 auto !important;
  box-shadow: none !important;
  padding: 8px 12px !important;
  box-sizing: border-box !important;
  overflow: visible !important;
}
@media (max-width: 640px) {
  body { background: var(--background) !important; }
}

/* ===== Web scrollbars: remove inner scroll, keep only browser scrollbar, no horizontal ===== */
main {
  overflow: visible !important;
  overflow-y: visible !important;
  overflow-x: visible !important;
  flex: none !important;
  height: auto !important;
  min-height: 0 !important;
  overscroll-behavior: auto !important;
}
main::-webkit-scrollbar,
main::-webkit-scrollbar-thumb,
main::-webkit-scrollbar-track {
  display: none !important;
  width: 0 !important;
  background: transparent !important;
}
.tag-bar {
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
.tag-bar::-webkit-scrollbar {
  display: none !important;
  height: 0 !important;
}
.page-wrap {
  overflow: visible !important;
}
