/* 统一深色电影主题 — 客户端全站（首页 + 兑换 / 订单 / 订阅 / 初始化）。
   星空背景 + 流星 + 玻璃卡片。后台 admin 不加载本文件。 */

/* 跨文档视图过渡：提交卡密等页面跳转时平滑淡入淡出（支持的浏览器自动生效，不支持则正常跳转） */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .42s; }

:root {
  --bg: #07080a;
  --bg-2: #0d0f14;

  --ink: #f5f7fb;        /* 主标题 */
  --ink-soft: #c6cdd9;
  --text: #cdd3de;       /* 正文 */
  --muted: #8b94a5;      /* 弱化 */
  --faint: #5b6474;      /* 极弱 */

  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.07);

  --accent: #2f6bff;
  --accent-hover: #4c83ff;
  --accent-soft: rgba(47, 107, 255, 0.14);
  --grad: linear-gradient(115deg, #19c2ff 0%, #2f6bff 52%, #7b5bff 100%);

  --pending: #f5b740;    --pending-bg: rgba(245, 183, 64, 0.13);
  --processing: #5b9bff; --processing-bg: rgba(91, 155, 255, 0.14);
  --done: #3ddc84;       --done-bg: rgba(61, 220, 132, 0.13);
  --problem: #ff6b6b;    --problem-bg: rgba(255, 107, 107, 0.13);

  --radius: 18px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 30px 70px -28px rgba(0, 0, 0, 0.8);

  --ease: cubic-bezier(.2, .8, .2, 1);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", system-ui, sans-serif;
  --font-serif: "Fraunces", ui-serif, Georgia, "Songti SC", "Noto Serif CJK SC", serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body.site {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--font-sans); color: var(--text); font-size: 15px; line-height: 1.65;
  background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: #7fb0ff; text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 {
  font-family: var(--font-serif); color: var(--ink); font-weight: 560;
  letter-spacing: -0.015em; margin: 0 0 .45em; line-height: 1.16; font-optical-sizing: auto;
}
h1 { font-size: 2.1rem; font-variation-settings: "opsz" 60; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .86rem; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; }
.nowrap { white-space: nowrap; }
code { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; font-size: .88em; background: rgba(255, 255, 255, 0.07); padding: 1px 6px; border-radius: 6px; color: var(--ink-soft); word-break: break-all; }
strong { color: var(--ink); }

/* ---------- 深空背景：黑洞 + 流星星空 ---------- */

/* 星河背景图 + canvas 微光/流星。图片在最底，半透明暗色叠层保证文字清晰，canvas 流星叠在最上。 */
.space-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; background: #050507 url("/static/img/stars-bg.jpg") center / cover no-repeat; }
/* 压暗叠层：整体压暗 + 左侧更深，托住标题/正文 */
.space-bg::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(5, 6, 10, 0.82) 0%, rgba(5, 6, 10, 0.45) 55%, rgba(5, 6, 10, 0.62) 100%), linear-gradient(180deg, rgba(5, 6, 10, 0.35), transparent 30%, transparent 62%, rgba(5, 6, 10, 0.6) 100%); }
#space-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

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

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(8, 9, 12, 0.94);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: 1080px; margin: 0 auto; padding: 0 22px; height: 64px; display: flex; align-items: center; gap: 24px; }
.brand { font-family: var(--font-serif); font-weight: 600; font-size: 1.1rem; letter-spacing: -0.01em; color: var(--ink); }
.brand .dot { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.topbar nav { display: flex; gap: 28px; margin-left: auto; }
.topbar nav a { position: relative; color: #e3e8f0; font-size: 1rem; font-weight: 500; letter-spacing: .02em; }
.topbar nav a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: -6px; height: 1.5px; background: var(--grad); border-radius: 2px; transition: right .3s var(--ease); }
.topbar nav a:hover { color: var(--ink); text-decoration: none; }
.topbar nav a:hover::after, .topbar nav a.active::after { right: 0; }
.topbar nav a.active { color: var(--ink); }

.container { position: relative; z-index: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 48px 22px 64px; flex: 1; }
.narrow { max-width: 600px; }

/* ---------- 招牌渐变光带 / 标题 ---------- */

.hero-glow { height: 4px; border-radius: 4px; margin-bottom: 26px; background: linear-gradient(120deg, #19c2ff, #2f6bff, #7b5bff, #19c2ff); background-size: 220% 100%; animation: bg-pan 7s linear infinite; }
.display { font-family: var(--font-serif); color: var(--ink); font-size: clamp(2.4rem, 6vw, 3.8rem); line-height: 1.02; letter-spacing: -0.025em; font-weight: 560; margin: 0 0 .32em; font-optical-sizing: auto; font-variation-settings: "opsz" 144; }
.display .em, .grad-text { font-style: italic; font-weight: 500; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.lede { color: var(--ink-soft); font-size: 1.1rem; line-height: 1.65; max-width: 48ch; }

/* ---------- 胶囊徽标 ---------- */

.pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 15px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-soft); font-size: .82rem; font-weight: 500; }
.pill .grad-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 10px rgba(47, 107, 255, .7); }

/* ---------- 卡片（玻璃质感） ---------- */

.card {
  position: relative;
  background: #101216;
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 22px;
  box-shadow: 0 44px 100px -36px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: 30px; transition: box-shadow .25s var(--ease), border-color .2s, transform .25s var(--ease);
}
.card + .card { margin-top: 18px; }

.grid-3 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-2 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.feature { display: block; padding: 26px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: border-color .15s, box-shadow .15s, transform .15s; }
.feature:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-3px); text-decoration: none; }

/* ---------- 表单 ---------- */

.field { margin-bottom: 18px; }
label { display: block; font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 500; margin-bottom: 9px; color: var(--muted); }
.hint { font-size: .82rem; color: var(--muted); margin-top: 7px; }

input:not([type]), input[type="text"], input[type="password"], input[type="email"], input[type="number"],
input[type="search"], input[type="date"], input[type="tel"], select, textarea {
  width: 100%; padding: 12px 14px; font: inherit; font-size: .95rem; color: var(--ink);
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); border-radius: 12px; outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { border-color: rgba(255, 255, 255, 0.42); background: rgba(255, 255, 255, 0.06); box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.07); }
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { resize: vertical; min-height: 130px; line-height: 1.55; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86rem; }
.field:focus-within > label { color: #e6ebf3; }

select {
  -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 38px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238b94a5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 15px;
}
select option { color: #111; }

/* 分段切换（订阅查询 新版/深度） */
.seg-toggle { display: inline-flex; gap: 4px; padding: 4px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); border-radius: 12px; }
.seg-toggle .seg-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; padding: 8px 18px; margin: 0; border-radius: 9px; font-size: .9rem; font-weight: 500; letter-spacing: normal; text-transform: none; color: var(--muted); cursor: pointer; transition: color .15s, background .15s; }
.seg-toggle .seg-btn input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.seg-toggle .seg-btn:hover { color: var(--ink); }
.seg-toggle .seg-btn:has(input:checked) { background: #e6ebf3; color: #0c0d10; }

.checkbox { display: flex; align-items: flex-start; gap: 10px; text-transform: none; letter-spacing: normal; }
.checkbox input { width: auto; margin-top: 3px; accent-color: var(--accent); }
.checkbox label { text-transform: none; letter-spacing: normal; color: var(--text); }

/* ---------- 按钮 ---------- */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 12px 22px; font: inherit; font-weight: 550; line-height: 1; border: 1px solid transparent; border-radius: 999px; cursor: pointer; transition: background .15s, border-color .15s, box-shadow .2s var(--ease), transform .15s var(--ease), opacity .15s; text-decoration: none; }
.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: #1b1e24; color: #fff; border-color: rgba(255, 255, 255, 0.16); box-shadow: 0 16px 38px -16px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.1); }
.btn-primary:hover { background: #23262e; border-color: rgba(255, 255, 255, 0.3); transform: translateY(-1px); box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.16); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--problem); color: #2a0a0a; }
.btn-danger:hover { filter: brightness(1.1); }
.btn-sm { padding: 8px 15px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- 徽标 / 状态 ---------- */

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: .8rem; font-weight: 600; line-height: 1.5; background: var(--surface-2); color: var(--muted); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-product { background: rgba(255, 255, 255, 0.08); color: #e6ebf3; }
.badge-product::before { display: none; }
.st-unused, .st-pending { background: var(--pending-bg); color: var(--pending); }
.st-used { background: var(--surface-2); color: var(--muted); }
.st-disabled { background: var(--problem-bg); color: var(--problem); }
.st-processing { background: var(--processing-bg); color: var(--processing); }
.st-done { background: var(--done-bg); color: var(--done); }
.st-problem { background: var(--problem-bg); color: var(--problem); }

/* ---------- 提示条 ---------- */

.alert { padding: 13px 15px; border-radius: var(--radius-sm); border: 1px solid var(--border); margin-bottom: 16px; font-size: .92rem; }
.alert-error { background: var(--problem-bg); border-color: rgba(255, 107, 107, 0.4); color: #ff9b9b; }
.alert-success { background: var(--done-bg); border-color: rgba(61, 220, 132, 0.4); color: #7df0ad; }
.alert-info { background: var(--accent-soft); border-color: rgba(47, 107, 255, 0.4); color: #9cc0ff; }
.alert-warn { background: var(--pending-bg); border-color: rgba(245, 183, 64, 0.4); color: #ffd27a; }

/* ---------- 兑换三步进度 ---------- */

.steps { display: flex; align-items: center; gap: 8px; margin-bottom: 28px; }
.step { display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: .85rem; font-weight: 500; }
.step .num { width: 25px; height: 25px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--faint); font-size: .8rem; border: 1px solid var(--border); }
.step.active { color: var(--ink); }
.step.active .num { background: #e6ebf3; color: #0c0d10; border-color: transparent; }
.step.done .num { background: rgba(255, 255, 255, 0.14); color: #e6ebf3; border-color: rgba(255, 255, 255, 0.2); }
.step-line { flex: 1; height: 1px; background: var(--border); min-width: 16px; }

/* ---------- 表格 ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: rgba(12, 14, 20, 0.5); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 12px 15px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: rgba(255, 255, 255, 0.03); color: var(--muted); font-weight: 600; font-size: .82rem; }
tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
tbody tr:last-child td { border-bottom: none; }

/* ---------- 杂项 ---------- */

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 9px 14px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; color: var(--text); }

/* 会员信息卡片（订阅查询结果） */
.sub-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sub-card-head h3 { margin: 0; }
.sub-kv .row { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.sub-kv .row:last-child { border-bottom: none; }
.sub-kv .k { color: var(--muted); font-size: .92rem; flex: none; }
.sub-kv .v { color: var(--ink); font-weight: 600; text-align: right; word-break: break-all; }

pre.code-box { background: rgba(0, 0, 0, 0.4); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px; font-size: .8rem; max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-all; margin: 0; color: var(--ink-soft); }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row input { font-family: ui-monospace, Menlo, monospace; font-size: .82rem; }

.empty { text-align: center; color: var(--muted); padding: 44px 20px; }
.spacer { height: 18px; }
.flex { display: flex; gap: 12px; align-items: center; }
.flex-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.stat { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); font-family: var(--font-sans); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.toolbar .field { margin-bottom: 0; }

/* ---------- 初始化页（setup） ---------- */

.auth-wrap { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 440px; }

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

.site-foot { position: relative; z-index: 1; border-top: 1px solid var(--border); }
.site-foot-inner { max-width: 1080px; margin: 0 auto; padding: 22px; display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: center; align-items: center; text-align: center; font-size: .82rem; color: var(--muted); }

/* ---------- 入场动画 ---------- */

.page-fx > * { animation: rise .6s var(--ease) both; }
.page-fx > .center { animation-delay: .02s; }
.page-fx > .display, .page-fx > h1 { animation-delay: .08s; }
.page-fx > .lede { animation-delay: .15s; }
.page-fx > .card { animation-delay: .2s; }
.page-fx > .card + .card { animation-delay: .3s; }

@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bg-pan { from { background-position: 0% 50%; } to { background-position: 200% 50%; } }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(47, 107, 255, .45); } 70% { box-shadow: 0 0 0 9px rgba(47, 107, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(47, 107, 255, 0); } }

@media (max-width: 640px) {
  .container { padding: 26px 16px 48px; }
  .card { padding: 22px; border-radius: 18px; }
  .card + .card { margin-top: 14px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; }
  h1 { font-size: 1.75rem; }
  /* 顶栏在手机上换行：品牌一行、导航占满下一行 */
  .topbar-inner { height: auto; min-height: 54px; padding: 10px 16px; flex-wrap: wrap; gap: 8px 16px; }
  .topbar nav { width: 100%; margin-left: 0; gap: 18px; }
  .topbar nav a { font-size: .92rem; }
  .toolbar { gap: 8px; }
  .btn { padding: 12px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .page-fx > * { opacity: 1 !important; transform: none !important; }
}
