/* ddlink · dd api 主题：叠在 Sub2API 自带样式之上，只改外观不改内容。 */
@font-face {
  font-family: "DD Sans";
  src: url("/dd-font/DMSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "DD Sans";
  src: url("/dd-font/DMSans-SemiBold.ttf") format("truetype");
  font-weight: 500 700;
  font-display: swap;
}

html,
body,
button,
input,
select,
textarea {
  font-family: "DD Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", ui-sans-serif, system-ui, sans-serif;
}
body {
  -webkit-font-smoothing: antialiased;
}
::selection {
  background: rgba(36, 107, 253, 0.18);
}

/* 品牌名渐变改成墨色实字，和首页一致。 */
.text-gradient {
  background-image: none !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
  color: #0b1630 !important;
}
html.dark .text-gradient {
  color: #ffffff !important;
}

/* 主按钮：品牌蓝实色，去掉渐变。 */
.btn-primary {
  background-image: none !important;
  background-color: #246bfd !important;
  box-shadow: 0 6px 18px -8px rgba(36, 107, 253, 0.6) !important;
}
.btn-primary:hover:not(:disabled) {
  background-color: #1650d0 !important;
}

/* 输入框：更高、更清楚的焦点。 */
.input {
  border-color: #dfe5ee;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  border-color: #246bfd !important;
  box-shadow: 0 0 0 4px rgba(36, 107, 253, 0.14) !important;
  outline: none !important;
}

/* ---------- 登录 / 注册：左表单，右品牌栏（#dd-auth-aside 由 dd-brand.js 注入） ---------- */
#dd-auth-aside {
  display: none;
}
/* 登录页右上角的中英切换，和首页导航里的按钮同款。 */
#dd-auth-lang {
  display: none;
}
html.dd-auth #dd-auth-lang {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  min-width: 44px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #d6dde8;
  background: rgba(255, 255, 255, 0.85);
  color: #5f6f8c;
  font: 600 13px/1 "DD Sans", "PingFang SC", ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s;
}
html.dd-auth #dd-auth-lang:hover {
  color: #0b1630;
  border-color: #98a6bd;
}
html.dark.dd-auth #dd-auth-lang {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.75);
}
html.dd-auth body {
  background: #ffffff;
}
html.dd-auth #app > div.min-h-screen {
  background:
    radial-gradient(600px 320px at 0% 0%, rgba(36, 107, 253, 0.06), transparent 70%),
    #ffffff;
}
/* 自带的渐变底和光斑换成干净的白底。 */
html.dd-auth #app > div.min-h-screen > div.absolute.inset-0,
html.dd-auth #app > div.min-h-screen > div.pointer-events-none {
  display: none !important;
}
html.dd-auth #app > div.min-h-screen > div.relative.z-10 {
  max-width: 400px;
}

/* 品牌块：图标 + 名称横排，左对齐。 */
html.dd-auth #app .mb-8.text-center {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 12px;
  text-align: left;
  margin-bottom: 40px;
}
html.dd-auth #app .mb-8.text-center > div:first-child {
  grid-row: span 2;
  width: 44px !important;
  height: 44px !important;
  margin: 0 !important;
  border-radius: 12px !important;
  box-shadow: 0 6px 16px -8px rgba(36, 107, 253, 0.6) !important;
}
html.dd-auth #app .mb-8.text-center h1 {
  margin: 0 !important;
  font-size: 20px !important;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
html.dd-auth #app .mb-8.text-center p {
  margin: 2px 0 0 !important;
  font-size: 13px !important;
  color: #5f6f8c !important;
}

/* 表单卡片去掉毛玻璃，直接放在白底上。 */
html.dd-auth #app .card-glass {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding: 0 !important;
}
html.dd-auth #app .card-glass h2 {
  font-size: 30px !important;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: #0b1630;
}
html.dd-auth #app .card-glass h2,
html.dd-auth #app .card-glass h2 + p {
  text-align: left;
}
html.dd-auth #app .card-glass .text-center:has(> h2) {
  text-align: left;
}
html.dd-auth #app .card-glass h2 + p {
  color: #5f6f8c !important;
  font-size: 15px !important;
}
html.dd-auth #app .input-label {
  font-size: 13px;
  font-weight: 600;
  color: #2a3a57;
}
html.dd-auth #app .input {
  height: 46px;
  font-size: 15px;
  background: #ffffff !important;
  border: 1px solid #dfe5ee !important;
  box-shadow: 0 1px 2px rgba(11, 22, 48, 0.04);
}
html.dd-auth #app .input:hover {
  border-color: #c7d0de !important;
}
html.dd-auth #app .btn-primary {
  height: 46px;
  border-radius: 12px !important;
  font-size: 15px;
  font-weight: 600;
  background-color: #0b1630 !important;
  box-shadow: 0 1px 2px rgba(11, 22, 48, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}
html.dd-auth #app .btn-primary:hover:not(:disabled) {
  background-color: #1b2a4d !important;
}
html.dd-auth #app .card-glass a,
html.dd-auth #app .mt-6.text-center a {
  color: #246bfd;
  font-weight: 600;
}
html.dd-auth #app .mt-6.text-center {
  text-align: left;
}
html.dd-auth #app .mt-8.text-center.text-xs {
  text-align: left;
  margin-top: 48px;
}

@media (min-width: 1024px) {
  html.dd-auth #app > div.min-h-screen {
    width: 50%;
  }
  #dd-auth-aside {
    position: fixed;
    inset: 0 0 0 50%;
    z-index: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
    color: #ffffff;
    background: #0b1630;
    isolation: isolate;
    font-family: "DD Sans", "PingFang SC", ui-sans-serif, system-ui, sans-serif;
  }
  html:not(.dd-auth) #dd-auth-aside {
    display: none;
  }
  html.dd-auth #dd-auth-lang {
    right: calc(50% + 24px);
  }
  #dd-auth-aside::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
      radial-gradient(520px 360px at 90% 0%, rgba(36, 107, 253, 0.55), transparent 70%),
      radial-gradient(460px 320px at 10% 100%, rgba(40, 165, 249, 0.28), transparent 70%);
  }
  #dd-auth-aside::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image:
      linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
      linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 70% at 60% 40%, #000 20%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 60% 40%, #000 20%, transparent 80%);
  }
  .dd-aa-inner {
    width: min(480px, calc(100% - 128px));
    margin: 0 auto;
  }
  .dd-aa-eyebrow {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.18em;
    color: #8fb4ff;
  }
  #dd-auth-aside h2 {
    margin: 18px 0 0;
    font-size: 40px;
    line-height: 1.15;
    letter-spacing: -0.03em;
    font-weight: 650;
    color: #ffffff;
  }
  .dd-aa-lead {
    margin: 16px 0 0;
    font-size: 16px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.68);
  }
  .dd-aa-list {
    list-style: none;
    margin: 28px 0 0;
    padding: 0;
    display: grid;
    gap: 12px;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.86);
  }
  .dd-aa-list li {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .dd-aa-list li::before {
    content: "";
    flex: none;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / 12px no-repeat,
      #246bfd;
  }
  .dd-aa-code {
    margin-top: 36px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(5, 10, 24, 0.6);
    box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.6);
    overflow: hidden;
  }
  .dd-aa-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  .dd-aa-bar i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
  }
  .dd-aa-bar span {
    margin-left: auto;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
  }
  .dd-aa-code pre {
    margin: 0;
    padding: 16px 18px;
    font: 13px/1.75 ui-monospace, "SF Mono", Menlo, monospace;
    color: #d7def0;
    white-space: pre;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .dd-aa-code .k {
    color: #8ab4ff;
  }
  .dd-aa-code .s {
    color: #a5e3b5;
  }
}

/* ---------- 控制台：浅色模式下贴近首页的暖白底、细描边 ---------- */
html:not(.dark) body,
html:not(.dark) #app > div.min-h-screen.bg-gray-50 {
  background-color: #fbfaf7;
}
html:not(.dark) .card {
  border-color: #e7ebf2;
  box-shadow: 0 1px 2px rgba(11, 22, 48, 0.04), 0 12px 32px -20px rgba(11, 22, 48, 0.12);
}
html:not(.dark) .sidebar {
  border-color: #e7ebf2;
}
html:not(.dark) .sidebar-header {
  border-color: #eef1f6;
}
.sidebar-link-active {
  font-weight: 600;
  box-shadow: inset 3px 0 0 #246bfd;
}
html:not(.dark) .sidebar-link:not(.sidebar-link-active):hover {
  color: #0b1630;
}
html:not(.dark) header.glass {
  background-color: rgba(251, 250, 247, 0.8);
  border-color: #e7ebf2;
}
/* 侧栏品牌名用墨色，和首页标识一致。 */
html:not(.dark) .sidebar-brand-title {
  color: #0b1630;
  letter-spacing: -0.01em;
}
.sidebar-logo {
  box-shadow: 0 6px 16px -8px rgba(36, 107, 253, 0.6) !important;
}

/* 普通用户页面页脚里指向上游开源仓库的 GitHub 图标不显示；管理员菜单里的保留。 */
a[href="https://github.com/Wei-Shaw/sub2api"]:not(.dropdown-item) {
  display: none !important;
}

/* ---------- 邀请有礼：被邀请人首充提示（dd-brand.js 注入） ---------- */
#dd-invite-nudge {
  position: fixed; right: 20px; bottom: 20px; z-index: 60; width: min(320px, calc(100vw - 32px));
  padding: 16px 18px; border-radius: 14px; background: #0b1630; color: #dbe4f5;
  box-shadow: 0 16px 40px -12px rgba(11, 22, 48, .55); font-size: 13px; line-height: 1.6;
}
#dd-invite-nudge strong { display: block; color: #fff; font-size: 15px; margin-bottom: 4px; }
#dd-invite-nudge .dd-in-go {
  display: inline-flex; align-items: center; height: 32px; margin-top: 10px; padding: 0 14px; border-radius: 999px;
  background: #246bfd; color: #fff; font-weight: 600; text-decoration: none;
}
#dd-invite-nudge .dd-in-go:hover { background: #1650d0; }
#dd-invite-nudge .dd-in-close {
  position: absolute; top: 6px; right: 8px; width: 28px; height: 28px; border: 0; background: transparent;
  color: #8a97ad; font-size: 20px; line-height: 1; cursor: pointer;
}
#dd-invite-nudge .dd-in-close:hover { color: #fff; }
