/* ================================================================
   基础层：设计令牌 / 页头 / 卡片 / 按钮 / 表单 / toast / 无障碍
   规则来源：ui-ux-pro-max（对比度、focus、触控目标、reduced-motion、
   禁 emoji 图标→SVG、150-300ms 过渡）+ ui-designer（WCAG 2.1 AA、
   设计令牌一致性、状态完整性）
   ================================================================ */

:root {
  /* 表面 */
  --bg: #0b0d12;
  --bg-soft: #11141c;
  --panel: #151924;
  --panel-2: #1c2230;
  --border: #262d3d;
  --border-strong: #38415680;
  /* 文本（对 --bg/--panel 对比度均 ≥ 4.5:1） */
  --text: #e9edf6;
  --muted: #9aa5bc;
  /* 语义色 */
  --accent: #4f8cff;
  --accent-2: #7c5cff;
  --accent-strong: #3b78f0;
  --danger: #f26d64;
  --warn: #e5b567;
  --ok: #4cc99a;
  /* 形状 / 阴影 / 层级 / 动效 */
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 9px;
  --shadow-1: 0 4px 16px rgba(0, 0, 0, .28);
  --shadow-2: 0 14px 40px rgba(0, 0, 0, .42);
  --shadow-glow: 0 10px 30px rgba(79, 140, 255, .16);
  --t: 180ms ease;
  --z-header: 100;
  --z-modal: 500;
  --z-toast: 600;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

/* hidden 属性必须始终生效（避免 display:flex 等作者样式覆盖 UA 的 [hidden] 规则） */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(1100px 540px at 12% -12%, rgba(79, 140, 255, .09), transparent 60%),
    radial-gradient(900px 480px at 92% -6%, rgba(124, 92, 255, .07), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body { overflow-x: hidden; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: rgba(79, 140, 255, .35); }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: #2c3446;
  border-radius: 99px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: #3a4356; }
::-webkit-scrollbar-track { background: transparent; }
html { scrollbar-color: #2c3446 transparent; }

/* 全局可见焦点环（键盘导航） */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 通用图标尺寸（viewBox 24×24 固定） */
.icon { width: 18px; height: 18px; flex-shrink: 0; }
.icon--sm { width: 14px; height: 14px; }
.icon--lg { width: 24px; height: 24px; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 30px 20px 84px;
  min-height: calc(100vh - 130px);
}

.muted { color: var(--muted); }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 56px 20px;
}
.empty__icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--panel);
  border: 1px dashed var(--border);
  color: var(--muted);
}
.empty__icon .icon { width: 26px; height: 26px; }

.warn {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(229, 181, 103, .1);
  border: 1px solid rgba(229, 181, 103, .38);
  color: #edc98b;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
}
.warn .icon { color: var(--warn); margin-top: 3px; }

/* ---------------- 页头 ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: rgba(11, 13, 18, .78);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  border-bottom: 1px solid rgba(38, 45, 61, .8);
}
.site-header__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 13px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand .icon {
  width: 22px;
  height: 22px;
  color: var(--accent);
  filter: drop-shadow(0 0 8px rgba(79, 140, 255, .5));
}
.brand__name {
  background: linear-gradient(90deg, #e9edf6 0%, #9db8ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
.site-nav { display: flex; gap: 6px; }
.site-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  padding: 9px 15px;
  border-radius: 10px;
  font-size: 14px;
  transition: background var(--t), color var(--t);
}
.site-nav__link:hover {
  color: var(--text);
  background: var(--panel);
  text-decoration: none;
}
.site-nav__link.is-active {
  color: var(--accent);
  background: rgba(79, 140, 255, .13);
  font-weight: 600;
}

/* ---------------- 面板 / 表单 ---------------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 30px;
  box-shadow: var(--shadow-2);
}
.setup-panel { max-width: 440px; margin: 48px auto; }
.setup-panel h1 { margin: 0 0 8px; font-size: 22px; letter-spacing: .01em; }

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 15px 0;
  font-size: 14px;
}
.field > span { color: var(--muted); }

input[type="text"],
input[type="password"],
input[type="number"],
input:not([type]),
select,
textarea {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 11px 14px;
  min-height: 44px;
  font-size: 15px;
  font-family: var(--font);
  width: 100%;
  transition: border-color var(--t), box-shadow var(--t);
}
textarea { min-height: 64px; resize: vertical; line-height: 1.6; }
input::placeholder { color: #6b7691; }
input:hover, select:hover { border-color: #333c50; }
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, .18);
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  min-height: 44px;
}
.check input {
  width: 17px;
  height: 17px;
  min-height: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-error {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ff9089;
  font-size: 13px;
  margin: 8px 0 0;
}
.form-error--busy { color: var(--muted); }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

/* ---------------- 按钮 ---------------- */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 16px;
  min-height: 40px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--panel-2);
  color: var(--text);
  transition: background var(--t), border-color var(--t), filter var(--t),
    box-shadow var(--t), color var(--t);
}
.btn:hover { filter: brightness(1.14); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn .icon { width: 16px; height: 16px; }
.btn--primary {
  background: linear-gradient(135deg, var(--accent), #5f7dff);
  color: #fff;
  box-shadow: 0 6px 18px rgba(79, 140, 255, .28);
}
.btn--primary:hover { background: linear-gradient(135deg, var(--accent-strong), #4f6ef2); }
.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn--ghost:hover { background: var(--panel-2); border-color: #3a4356; filter: none; }
.btn--danger {
  background: rgba(242, 109, 100, .14);
  border-color: rgba(242, 109, 100, .45);
  color: #ff9089;
}
.btn--danger:hover { background: rgba(242, 109, 100, .24); filter: none; }
.btn--block { width: 100%; margin-top: 8px; }
.btn--mini {
  min-height: 34px;
  padding: 6px 11px;
  font-size: 13px;
  border-radius: 8px;
  gap: 5px;
}
.btn--mini .icon { width: 14px; height: 14px; }

/* ---------------- 首页卡片 ---------------- */
.home-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 4px 0 18px;
  font-size: 13px;
}
.home-hint .icon { color: var(--warn); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 15px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;   /* 卡片内容居中 */
  gap: 4px;
  background: linear-gradient(180deg, rgba(28, 34, 48, .55), rgba(21, 25, 36, .9));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 16px 16px;
  color: var(--text);
  text-align: center;    /* 卡片文字居中 */
  font-family: var(--font);
  cursor: pointer;
  min-height: 138px;
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(79, 140, 255, .65);
  box-shadow: var(--shadow-glow);
  text-decoration: none;
}
.card:active { transform: translateY(-1px); }

.card__icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  font-size: 24px;
  line-height: 1;
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(79, 140, 255, .2), rgba(124, 92, 255, .14));
  border: 1px solid rgba(124, 140, 255, .28);
}
.card__icon .icon { width: 22px; height: 22px; color: #a5bcff; }

.card__title {
  font-size: 15px;
  font-weight: 600;
  margin-top: 8px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card__url {
  font-size: 12px;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card__url--masked {
  font-family: var(--mono);
  letter-spacing: .16em;
  color: #b9c2d6;
}
.card__note {
  font-size: 11px;
  color: var(--muted);
  opacity: .85;
}

/* 锁定芯片（替代 emoji 🔒） */
.card__lockchip {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 99px;
  background: rgba(229, 181, 103, .12);
  color: var(--warn);
  border: 1px solid rgba(229, 181, 103, .38);
}
.card__lockchip .icon { width: 12px; height: 12px; }

.card--locked {
  background:
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, .014) 0 10px, transparent 10px 20px),
    var(--bg-soft);
  border-style: dashed;
  border-color: #333c50;
}
.card--locked:hover {
  border-color: rgba(229, 181, 103, .65);
  box-shadow: 0 10px 26px rgba(229, 181, 103, .08);
}

.card__badge {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 99px;
}
.card__badge--unlocked {
  background: rgba(76, 201, 154, .13);
  color: var(--ok);
  border: 1px solid rgba(76, 201, 154, .4);
}
.card__badge .icon { width: 12px; height: 12px; }

/* ---------------- 首页分组（分类） ---------------- */
.home-groups {
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.card-group__title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 600;
  color: #c3ccdd;
  letter-spacing: .02em;
  margin: 0 0 14px;
}
.card-group__title::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

/* ---------------- 首页页眉 / 页脚横幅 ---------------- */
.home-banner {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 20px;
  font-size: 15px;
  color: var(--text);
  white-space: pre-line;
  line-height: 1.6;
  margin: 0 0 18px;
}
.home-banner--bottom {
  margin: 26px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: transparent;
  border: 1px dashed var(--border);
}

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 16px);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 18px;
  border-radius: 11px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t), transform var(--t);
  z-index: var(--z-toast);
  box-shadow: var(--shadow-2);
  max-width: calc(100vw - 40px);
}
.toast--show { opacity: 1; transform: translate(-50%, 0); }
.toast--ok { border-color: rgba(76, 201, 154, .5); }
.toast--warn { border-color: rgba(229, 181, 103, .5); }
.toast--error { border-color: rgba(242, 109, 100, .5); }

/* ---------------- 响应式 / 触控目标 ---------------- */
@media (max-width: 640px) {
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .container { padding: 20px 14px 64px; }
  .panel { padding: 22px; }
  /* 触控目标 ≥ 44px */
  .btn { min-height: 44px; }
  .btn--mini { min-height: 44px; }
  .site-nav__link { padding: 12px 16px; }
  .card { min-height: 128px; }
}

/* ---------------- 无障碍：减少动态效果 ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .card:hover { transform: none; }
}
