/* Anchor v1 Product Page（使用 anchor-theme.css tokens，与 Chat 视觉统一） */
/* Feature-frozen: no new capability allowed */

* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; scroll-behavior: smooth; }
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--anchor-text);
  background: var(--anchor-bg);
  padding-bottom: env(safe-area-inset-bottom, 0);
  transition: background-color var(--anchor-transition, 0.15s ease), color var(--anchor-transition, 0.15s ease);
}

.anchor-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 16px 20px;
  padding-top: calc(16px + env(safe-area-inset-top, 0));
  border-bottom: 1px solid var(--anchor-border);
  background: var(--anchor-card);
}
.anchor-back {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--anchor-text-secondary);
  text-decoration: none;
  min-height: var(--anchor-tap);
  line-height: var(--anchor-tap);
  padding: 0 4px;
}
.anchor-back:hover { color: var(--anchor-primary); }
.anchor-title { margin: 0 0 4px; font-size: 22px; font-weight: 600; }
.anchor-subtitle { margin: 0; font-size: 14px; color: var(--anchor-text-secondary); }

.anchor-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
}
.anchor-section { margin-bottom: 24px; }
.anchor-section-title { margin: 0 0 12px; font-size: 16px; font-weight: 600; color: var(--anchor-text); }

.anchor-quickadd-card,
.anchor-memory-card,
.anchor-docstudio-card {
  background: var(--anchor-card);
  border: 1px solid var(--anchor-border);
  border-radius: var(--anchor-radius-sm, 8px);
  box-shadow: var(--anchor-shadow);
  padding: 16px;
}
.anchor-quickadd-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.anchor-quickadd-buttons .btn {
  min-height: var(--anchor-tap);
  min-width: var(--anchor-tap);
  padding: 0 14px;
}
.anchor-quickadd-input {
  width: 100%;
  padding: 12px 14px;
  min-height: 56px;
  max-height: 8em;
  border: 1px solid var(--anchor-border);
  border-radius: 6px;
  font-size: 14px;
  resize: vertical;
  -webkit-appearance: none;
  appearance: none;
  line-height: 1.4;
}
.anchor-quickadd-input:focus {
  outline: none;
  border-color: var(--anchor-primary);
}
.anchor-quickadd-input:disabled { opacity: 0.7; cursor: not-allowed; }
.anchor-quickadd-actions { margin-top: 12px; }
.anchor-quickadd-actions .btn { min-height: var(--anchor-tap); min-width: 80px; }
.anchor-receipt { margin-top: 8px; font-size: 13px; color: var(--anchor-text-secondary); min-height: 20px; }
.anchor-receipt.ok { color: #059669; }
.anchor-receipt.err { color: #dc2626; }
.anchor-retry-wrap { margin-top: 8px; }
.anchor-retry-wrap .btn { min-height: var(--anchor-tap); }

.anchor-list-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.anchor-filter-pill {
  padding: 6px 12px;
  min-height: var(--anchor-tap);
  border-radius: 999px;
  border: 1px solid var(--anchor-border);
  background: var(--anchor-card);
  font-size: 13px;
  cursor: pointer;
  color: var(--anchor-text-secondary);
}
.anchor-filter-pill:hover { background: #f3f4f6; color: var(--anchor-text); }
.anchor-filter-pill[aria-pressed="true"],
.anchor-filter-pill.active {
  background: var(--anchor-primary);
  color: #fff;
  border-color: var(--anchor-primary);
}

.anchor-memory-list {
  max-height: 320px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.anchor-memory-item {
  padding: 12px 10px;
  min-height: var(--anchor-tap);
  border-bottom: 1px solid var(--anchor-border);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}
.anchor-memory-item:last-child { border-bottom: none; }
.anchor-memory-item:hover { background: #f9fafb; }
.anchor-memory-item:active { background: #f3f4f6; }
.anchor-memory-item-selected {
  background: #eff6ff;
  border-left: 3px solid var(--anchor-primary);
  margin-left: -1px;
  padding-left: 11px;
}
.anchor-memory-item .kind { font-size: 11px; color: var(--anchor-text-secondary); margin-right: 8px; }
.anchor-memory-item .text { word-break: break-word; }
.anchor-memory-item .time { font-size: 11px; color: var(--anchor-text-secondary); margin-top: 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  min-height: 44px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--anchor-border);
  background: var(--anchor-card);
  color: var(--anchor-text);
  text-decoration: none;
}
.btn:hover:not(:disabled) { background: #f3f4f6; }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn.primary { background: var(--anchor-primary); color: #fff; border-color: var(--anchor-primary); }
.btn.primary:hover:not(:disabled) { background: #1d4ed8; }
.btn.small { padding: 6px 10px; font-size: 13px; min-height: 44px; }
.muted { color: var(--anchor-text-secondary); }
.small { font-size: 12px; }
.empty { padding: 16px; text-align: center; color: var(--anchor-text-secondary); }
.anchor-empty-copy { margin: 0 0 8px; font-size: 14px; }
.anchor-skeleton {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.anchor-skeleton span {
  display: block;
  height: 14px;
  background: linear-gradient(90deg, var(--anchor-border) 25%, #f3f4f6 50%, var(--anchor-border) 75%);
  background-size: 200% 100%;
  animation: anchor-skeleton 1s ease-in-out infinite;
  border-radius: 4px;
}
.anchor-skeleton span:nth-child(2) { width: 85%; }
.anchor-skeleton span:nth-child(3) { width: 60%; }
@keyframes anchor-skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.anchor-docstudio-card .btn { min-height: var(--anchor-tap); }

/* Drawer */
.anchor-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 100;
  transition: opacity .2s;
}
.anchor-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 360px;
  background: var(--anchor-card);
  box-shadow: -4px 0 20px rgba(0,0,0,.1);
  z-index: 101;
  display: flex;
  flex-direction: column;
  transition: transform .2s;
}
.anchor-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--anchor-border);
}
.anchor-drawer-title { margin: 0; font-size: 16px; }
.anchor-drawer-close {
  min-width: var(--anchor-tap);
  min-height: var(--anchor-tap);
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color: var(--anchor-text-secondary);
}
.anchor-drawer-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.anchor-drawer-text { white-space: pre-wrap; word-break: break-word; }
.anchor-drawer-actions { padding: 16px; border-top: 1px solid var(--anchor-border); }
.anchor-drawer-actions .btn { min-height: var(--anchor-tap); }

.anchor-snackbar {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom, 0));
  left: 16px;
  right: 16px;
  max-width: 400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #111;
  color: #fff;
  border-radius: 8px;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.anchor-snackbar-action {
  margin-left: 12px;
  padding: 4px 10px;
  background: transparent;
  border: none;
  color: #93c5fd;
  cursor: pointer;
  font-size: 14px;
  min-height: 36px;
}

.anchor-footer { padding: 16px 20px; border-top: 1px solid var(--anchor-border); margin-top: 24px; }
.anchor-install-details { margin: 0; }
.anchor-install-details summary { cursor: pointer; }
.anchor-install-details p { margin: 8px 0 0; }

@media (max-width: 375px) {
  .anchor-main { padding: calc(80px + env(safe-area-inset-top, 0)) 12px 16px 12px; }
  .anchor-header { padding: 12px 16px; }
  .anchor-quickadd-card,
  .anchor-memory-card,
  .anchor-docstudio-card { padding: 12px; }
  .anchor-drawer { max-width: 100%; }
}

/* 移动端：header 用 fixed 避免 iOS Safari 软键盘 + sticky 抖动 */
@media (max-width: 768px) {
  .anchor-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
  }
  .anchor-main {
    padding-top: calc(80px + env(safe-area-inset-top, 0));
  }
}
