/* StarNote 资料站 — 浅色主题，Apple 式极简 */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --line: #e3e3e6;
  --line-soft: #eeeeef;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #a1a1a6;
  --accent: #0071e3;
  --accent-soft: #e8f2fd;
  --ok: #0f7b52;
  --ok-soft: #e6f4ed;
  --warn: #a35b00;
  --warn-soft: #fdf1e3;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 20px rgba(0, 0, 0, .04);
  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla";
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC",
    "Helvetica Neue", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px 80px;
}

/* ---------- 头部 ---------- */

header.site {
  padding: 44px 0 20px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.brand h1 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

.brand .sub {
  font-size: 13px;
  color: var(--text-3);
}

.notice {
  margin-top: 14px;
  padding: 11px 14px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #0058b0;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.notice b { font-weight: 600; }

/* ---------- 搜索 ---------- */

.searchbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 12px 0;
  background: linear-gradient(var(--bg) 72%, rgba(245, 245, 247, 0));
}

.searchbox {
  position: relative;
  display: flex;
  align-items: center;
}

.searchbox input {
  width: 100%;
  padding: 11px 40px 11px 38px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.searchbox input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, .12);
}

.searchbox .icon {
  position: absolute;
  left: 13px;
  width: 16px;
  height: 16px;
  color: var(--text-3);
  pointer-events: none;
}

.searchbox .clear {
  position: absolute;
  right: 10px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: var(--line);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.searchbox.has input + .clear { display: flex; }

/* ---------- 分组 tab ---------- */

.tabs-primary {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 4px 0 14px;
}

.tabs-primary button {
  padding: 7px 15px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
}

.tabs-primary button:hover { border-color: var(--text-3); color: var(--text); }

.tabs-primary button[aria-selected="true"] {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

.tabs-primary .count {
  margin-left: 6px;
  font-size: 12px;
  opacity: .6;
}

/* ---------- 分类 tab ---------- */

.tabs-secondary {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs-secondary::-webkit-scrollbar { display: none; }

.tabs-secondary button {
  position: relative;
  padding: 9px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-2);
  background: none;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s;
}

.tabs-secondary button:hover { color: var(--text); }

.tabs-secondary button[aria-selected="true"] {
  color: var(--text);
  font-weight: 600;
}

.tabs-secondary button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

.tabs-secondary .count {
  margin-left: 5px;
  font-size: 12px;
  color: var(--text-3);
  font-weight: 400;
}

/* ---------- 列表 ---------- */

.list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.row:last-child { border-bottom: 0; }

.row:hover { background: var(--surface-2); }

.row .meta { min-width: 0; }

.row .name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
}

.row .code {
  margin-top: 6px;
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace, var(--emoji);
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  padding: 6px 9px;
  line-height: 1.55;
  word-break: break-all;
  display: none;
}

.row.open .code { display: block; }

.row .code.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.row:not(.open) .code { display: none; }

.row .actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.btn {
  padding: 7px 14px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}

.btn:hover { border-color: var(--text-3); }

.btn:active { transform: scale(.97); }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.primary:hover { background: #0077ed; }

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
  padding: 7px 9px;
}

.btn.ghost:hover { background: var(--line-soft); color: var(--text); }

.btn.copied {
  background: var(--ok-soft);
  border-color: var(--ok);
  color: var(--ok);
}

/* ---------- 空态 / 加载 ---------- */

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

.skeleton {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.skeleton i {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 37%, #eee 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}

.skeleton i + i { margin-top: 8px; width: 55%; }

@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ---------- 页脚 ---------- */

footer.site {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--text-3);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

footer.site a { color: var(--text-2); text-decoration: none; }
footer.site a:hover { color: var(--accent); }

/* ---------- toast ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 16px);
  padding: 10px 18px;
  font-size: 14px;
  color: #fff;
  background: rgba(29, 29, 31, .94);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 100;
  max-width: 90vw;
  text-align: center;
}

#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 响应式 ---------- */

@media (max-width: 600px) {
  header.site { padding-top: 28px; }
  .brand h1 { font-size: 22px; }
  .row {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 13px 15px;
  }
  .row .actions { justify-content: flex-end; }
  .btn { padding: 7px 13px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
