/* DeepSeek 搜索 — 样式 */

:root {
  --brand: #4d6bfe;
  --brand-dark: #3a55e0;
  --brand-soft: #eef1ff;
  --bg: #f7f8fc;
  --surface: #ffffff;
  --text: #15192b;
  --text-soft: #5a6178;
  --text-mute: #8a90a6;
  --line: #e6e8f0;
  --line-strong: #d5d9e6;
  --ok: #17a673;
  --warn: #d97706;
  --err: #dc2626;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(21, 25, 43, .06), 0 1px 3px rgba(21, 25, 43, .04);
  --shadow-md: 0 6px 24px rgba(21, 25, 43, .08);
  --shadow-lg: 0 24px 60px rgba(21, 25, 43, .18);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------ 通用按钮 */

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 18px;
  transition: background .15s, border-color .15s, color .15s, transform .06s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn.primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 4px 14px rgba(77, 107, 254, .25);
}
.btn.primary:hover:not(:disabled) { background: var(--brand-dark); }

.btn.ghost {
  background: transparent;
  color: var(--text-soft);
  border-color: var(--line-strong);
}
.btn.ghost:hover:not(:disabled) { background: #f2f4fa; color: var(--text); }

.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

.icon-btn {
  background: transparent; border: 0; color: var(--text-mute); cursor: pointer;
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
}
.icon-btn:hover { background: #f2f4fa; color: var(--text); }

/* ------------------------------------------------ 登录闸门 */

.gate {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 480px at 50% -10%, #e6ebff 0%, rgba(230, 235, 255, 0) 65%),
    var(--bg);
}

.gate-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 34px 30px 26px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.brand-mark {
  width: 56px; height: 56px; margin: 0 auto 16px;
  border-radius: 16px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid; place-items: center;
}

.gate-card h1 { font-size: 21px; margin: 0 0 6px; letter-spacing: -.01em; }
.gate-sub { margin: 0 0 22px; color: var(--text-mute); font-size: 13.5px; }

.gate-card form { display: flex; flex-direction: column; gap: 10px; }

.gate-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  font: inherit;
  text-align: center;
  letter-spacing: .04em;
  background: #fbfcff;
  color: var(--text);
}
.gate-card input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(77, 107, 254, .12);
}

.gate-error { color: var(--err); font-size: 13px; min-height: 20px; margin: 10px 0 0; }
.gate-foot { color: var(--text-mute); font-size: 12px; margin: 18px 0 0; }

/* ------------------------------------------------ 顶栏 */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 940px; margin: 0 auto;
  padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

.logo {
  display: inline-flex; align-items: center; gap: 9px;
  text-decoration: none; color: var(--text);
  font-weight: 700; letter-spacing: -.01em;
}
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
}
.logo-text { font-size: 16px; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-soft);
  background: #f1f4fc; border: 1px solid var(--line);
  padding: 5px 11px; border-radius: 999px;
}
.pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(23, 166, 115, .14);
}
.pill.bad .dot { background: var(--err); box-shadow: 0 0 0 3px rgba(220, 38, 38, .14); }

/* ------------------------------------------------ 主体 */

.main { max-width: 940px; margin: 0 auto; padding: 30px 20px 60px; }

.search { margin-bottom: 14px; }

.search-field {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 7px 8px 7px 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
.search-field:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(77, 107, 254, .11), var(--shadow-sm);
}
.search-icon { color: var(--text-mute); flex: none; }

.search-field input {
  flex: 1; min-width: 0;
  border: 0; outline: none; background: transparent;
  font: inherit; font-size: 16px;
  color: var(--text);
  padding: 9px 0;
}
.search-field input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-field input::placeholder { color: var(--text-mute); }

.search-opts {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 12px 4px 0;
  color: var(--text-soft); font-size: 13px;
}

.opt-group { display: inline-flex; align-items: center; gap: 8px; }
.opt-label { color: var(--text-mute); }

.segmented {
  display: inline-flex; background: #eef0f7; border-radius: 9px; padding: 3px; gap: 2px;
}
.segmented button {
  border: 0; background: transparent; font: inherit; font-size: 12.5px;
  color: var(--text-soft); padding: 4px 11px; border-radius: 7px; cursor: pointer;
}
.segmented button.on {
  background: #fff; color: var(--brand); font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.track {
  width: 36px; height: 21px; border-radius: 999px; background: #d8dcea;
  position: relative; transition: background .18s; flex: none;
}
.thumb {
  position: absolute; top: 2px; left: 2px; width: 17px; height: 17px;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .18s;
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track .thumb { transform: translateX(15px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(77, 107, 254, .25); }
.switch-label { color: var(--text-soft); }

.hint { margin-left: auto; color: var(--text-mute); font-size: 12px; }

/* ------------------------------------------------ 状态行 */

.status { min-height: 22px; font-size: 13px; color: var(--text-mute); padding: 6px 4px 4px; }
.status.err { color: var(--err); }

/* ------------------------------------------------ 结果 */

.results { display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
.card:hover { border-color: #d7dcee; box-shadow: var(--shadow-md); }

.card-top {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-mute);
  margin-bottom: 7px; flex-wrap: wrap;
}
.favicon {
  width: 16px; height: 16px; border-radius: 4px; object-fit: cover;
  background: #eef0f7; flex: none;
}
.site { color: var(--text-soft); font-weight: 600; }
.dot-sep { color: var(--line-strong); }

.badge {
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
  border: 1px solid transparent; letter-spacing: .01em;
}
.badge.hi { background: #e7f8f1; color: var(--ok); border-color: #c6efe0; }
.badge.mid { background: #fff5e6; color: var(--warn); border-color: #fde7c3; }
.badge.auth { background: #eef1ff; color: var(--brand); border-color: #dbe1ff; }
.badge.official { background: var(--brand); color: #fff; border-color: var(--brand); }

.card h3 { margin: 0 0 6px; font-size: 17.5px; line-height: 1.45; letter-spacing: -.01em; }
.card h3 a { color: #1b3bd4; text-decoration: none; }
.card h3 a:hover { text-decoration: underline; }
.card h3 a:visited { color: #5b3fd4; }

.snippet { margin: 0; color: var(--text-soft); font-size: 14px; }

.summary {
  margin: 9px 0 0; color: var(--text-soft); font-size: 13.5px;
  border-left: 3px solid var(--brand-soft); padding-left: 11px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.summary.open { -webkit-line-clamp: unset; }

.card-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.card-actions .spacer { flex: 1; }
.card-actions a.btn { text-decoration: none; display: inline-flex; align-items: center; }

/* 骨架屏 */
.skeleton { display: flex; flex-direction: column; gap: 12px; }
.sk-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
}
.sk-line {
  height: 12px; border-radius: 6px; margin-bottom: 9px;
  background: linear-gradient(90deg, #eef0f7 25%, #e3e7f3 37%, #eef0f7 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}
.sk-line.w40 { width: 40%; }
.sk-line.w70 { width: 70%; }
.sk-line.w95 { width: 95%; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* 欢迎页 */
.intro { margin-top: 26px; }
.intro h2 { font-size: 27px; margin: 0 0 8px; letter-spacing: -.02em; }
.intro p { margin: 0 0 18px; color: var(--text-soft); }
.intro-points {
  list-style: none; padding: 0; margin: 0; display: grid; gap: 9px;
  color: var(--text-soft); font-size: 14px;
}
.intro-points li { padding-left: 20px; position: relative; }
.intro-points li::before {
  content: ""; position: absolute; left: 4px; top: 8px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--brand); opacity: .7;
}
.intro-points b { color: var(--text); }
code {
  background: #eef0f7; padding: 1px 5px; border-radius: 5px;
  font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #3b4266;
}

/* ------------------------------------------------ 正文抽屉 */

.drawer { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.drawer[aria-hidden="false"] { pointer-events: auto; }

.drawer-backdrop {
  position: absolute; inset: 0; background: rgba(18, 21, 38, .38);
  opacity: 0; transition: opacity .22s;
}
.drawer[aria-hidden="false"] .drawer-backdrop { opacity: 1; }

.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(720px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  transform: translateX(102%);
  transition: transform .26s cubic-bezier(.32, .72, 0, 1);
  display: flex; flex-direction: column;
}
.drawer[aria-hidden="false"] .drawer-panel { transform: none; }

.drawer-head {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 18px 12px; border-bottom: 1px solid var(--line);
}
.drawer-titles { flex: 1; min-width: 0; }
.drawer-head h3 {
  margin: 0 0 4px; font-size: 16px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.drawer-url {
  font-size: 12.5px; color: var(--brand); text-decoration: none;
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.drawer-url:hover { text-decoration: underline; }

.drawer-toolbar {
  display: flex; gap: 8px; padding: 10px 18px;
  border-bottom: 1px solid var(--line); background: #fbfcff;
}

.drawer-body {
  flex: 1; overflow: auto; padding: 22px 26px 60px;
  font-size: 15px; line-height: 1.78; color: #22273c;
}

.drawer-body.loading { display: grid; place-items: center; color: var(--text-mute); font-size: 14px; }

.drawer-body h1, .drawer-body h2, .drawer-body h3, .drawer-body h4 {
  line-height: 1.35; margin: 1.5em 0 .6em; letter-spacing: -.01em;
}
.drawer-body h1 { font-size: 24px; }
.drawer-body h2 { font-size: 20px; }
.drawer-body h3 { font-size: 17px; }
.drawer-body p { margin: 0 0 1em; }
.drawer-body a { color: #1b3bd4; }
.drawer-body ul, .drawer-body ol { padding-left: 1.4em; margin: 0 0 1em; }
.drawer-body li { margin: .3em 0; }
.drawer-body img { max-width: 100%; height: auto; border-radius: 10px; }
.drawer-body blockquote {
  margin: 0 0 1em; padding: 2px 0 2px 14px;
  border-left: 3px solid var(--line-strong); color: var(--text-soft);
}
.drawer-body pre {
  background: #f6f8fd; border: 1px solid var(--line);
  padding: 13px 15px; border-radius: 10px; overflow: auto; font-size: 13px; line-height: 1.6;
}
.drawer-body code {
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.drawer-body pre code { background: transparent; padding: 0; }
.drawer-body table { border-collapse: collapse; width: 100%; margin: 0 0 1em; font-size: 14px; }
.drawer-body th, .drawer-body td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
.drawer-body th { background: #f6f8fd; }
.drawer-body hr { border: 0; border-top: 1px solid var(--line); margin: 1.6em 0; }
.drawer-body .raw {
  white-space: pre-wrap; word-break: break-word;
  font: 13px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #333a55;
}

/* ------------------------------------------------ 页脚 / 提示 */

.foot {
  max-width: 940px; margin: 0 auto; padding: 24px 20px 40px;
  color: var(--text-mute); font-size: 12.5px;
}
.foot .sep { margin: 0 6px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: #1b2036; color: #fff; font-size: 13.5px;
  padding: 10px 18px; border-radius: 11px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  z-index: 90; max-width: min(520px, calc(100vw - 40px)); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: #991b1b; }

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

@media (max-width: 640px) {
  .main { padding: 20px 14px 40px; }
  .topbar-inner { padding: 10px 14px; }
  .logo-text { font-size: 15px; }
  .search-field { padding-left: 13px; }
  .search-field input { font-size: 16px; }
  .search-opts { gap: 12px; }
  .hint { display: none; }
  .intro h2 { font-size: 22px; }
  .card { padding: 14px; }
  .card h3 { font-size: 16px; }
  .drawer-body { padding: 18px 16px 50px; }
  .drawer-toolbar { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
