/* 插件市场 H5 页 - 深蓝玻璃主题（与 APP 主题一致） */
:root {
  --bg: #0d1b2a;
  --bg-2: #1b263b;
  --bg-3: #243447;
  --fg: #e0e1dd;
  --muted: #778da9;
  --primary: #4cc9f0;
  --primary-2: #4895ef;
  --danger: #f72585;
  --success: #4ade80;
  --warning: #fbbf24;
  --border: rgba(76, 201, 240, 0.15);
  --glass: rgba(27, 38, 59, 0.6);
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overscroll-behavior: contain; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.5;
  padding-top: calc(56px + var(--safe-top));
  padding-bottom: calc(20px + var(--safe-bottom));
  background-image:
    radial-gradient(circle at 20% 10%, rgba(72, 149, 239, 0.10), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(247, 37, 133, 0.06), transparent 40%);
}

#app { max-width: 640px; margin: 0 auto; padding: 0 14px; }
.hidden { display: none !important; }
.glass {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--border);
}

/* 顶部 */
.top-bar {
  position: fixed;
  top: var(--safe-top);
  left: 0; right: 0;
  z-index: 50;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-radius: 0;
  border-left: none; border-right: none; border-top: none;
}
.top-bar .title { font-size: 17px; font-weight: 600; color: var(--primary); }
.icon-btn {
  background: transparent;
  border: none;
  color: var(--fg);
  font-size: 22px;
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.icon-btn:hover, .icon-btn:active { background: rgba(255,255,255,0.08); }

/* 搜索 */
.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  margin-bottom: 14px;
}
.search-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--fg);
  font-size: 14px;
  outline: none;
}
.search-wrap input::placeholder { color: var(--muted); }

/* 插件列表 */
.plugin-list { display: flex; flex-direction: column; gap: 12px; }
.plugin-card {
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.plugin-card .name {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.plugin-card .meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.plugin-card .desc {
  font-size: 13px;
  color: var(--fg);
  opacity: 0.85;
  margin-bottom: 12px;
  word-break: break-all;
  max-height: 60px;
  overflow: hidden;
}
.plugin-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-primary, .btn-ghost, .btn-danger, .btn-success {
  padding: 9px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: opacity .15s, transform .1s;
}
.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%); color: var(--bg); }
.btn-ghost { background: rgba(76, 201, 240, 0.1); color: var(--primary); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: var(--bg); }
.btn-primary:active, .btn-ghost:active, .btn-danger:active, .btn-success:active { transform: scale(0.97); }
.btn-primary:disabled, .btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }

/* 悬浮按钮 */
.fab {
  position: fixed;
  right: 18px;
  bottom: calc(28px + var(--safe-bottom));
  z-index: 40;
  width: 56px; height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  color: var(--bg);
  font-size: 28px;
  font-weight: bold;
  box-shadow: 0 6px 20px rgba(76, 201, 240, 0.4);
  cursor: pointer;
}

/* 弹窗 */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); }
.modal-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 20px;
  border-radius: var(--radius);
}
.modal-close {
  position: absolute;
  top: 10px; right: 10px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  width: 32px; height: 32px;
  border-radius: 50%;
}
.modal-close:hover { background: rgba(255,255,255,0.08); color: var(--fg); }
.modal h2 { color: var(--primary); margin-bottom: 14px; font-size: 18px; }
.modal .tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.modal .tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 10px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 2px solid transparent;
}
.modal .tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: block; }
.form label > span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.form input, .form textarea {
  width: 100%;
  padding: 10px 12px;
  background: rgba(13, 27, 42, 0.7);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-size: 14px;
  outline: none;
  font-family: inherit;
  resize: vertical;
}
.form input:focus, .form textarea:focus { border-color: var(--primary); }
.form button { margin-top: 4px; width: 100%; }

/* 详情 */
.plugin-detail .name { font-size: 20px; font-weight: 700; color: var(--fg); margin-bottom: 6px; }
.plugin-detail .meta { color: var(--muted); margin-bottom: 12px; }
.plugin-detail .desc { color: var(--fg); margin-bottom: 16px; line-height: 1.6; }
.plugin-detail dl { display: grid; grid-template-columns: 80px 1fr; gap: 8px 12px; margin-bottom: 16px; }
.plugin-detail dt { color: var(--muted); font-size: 12px; }
.plugin-detail dd { color: var(--fg); font-size: 13px; word-break: break-all; }
.plugin-detail .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 提示 */
.toast {
  position: fixed;
  bottom: calc(80px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 200;
  animation: toastIn .25s ease;
  max-width: 90vw;
  text-align: center;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 14px;
}

.load-more { text-align: center; padding: 16px; }
.load-more.hidden { display: none; }

/* 用户信息卡 */
.user-info-card .row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.user-info-card .row:last-child { border: none; }
.user-info-card .label { color: var(--muted); font-size: 13px; }
.user-info-card .value { color: var(--fg); font-size: 13px; font-family: monospace; }
.user-info-card .value.publisher { color: var(--success); font-weight: 600; }
.user-info-card .copy-id {
  margin-top: 12px;
  padding: 10px;
  background: rgba(76, 201, 240, 0.08);
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.user-info-card .copy-id code {
  display: block;
  font-family: monospace;
  color: var(--primary);
  margin-top: 6px;
  font-size: 13px;
  word-break: break-all;
}
