/* 星屿 · 空间液态玻璃设计系统（前台与后台共用）
   层次：3D 场景（最底）→ 玻璃面板 → 抬起的单元格 → 浮动饰件（标签栏、顶栏、弹层） */
:root {
  --ink: rgba(255, 255, 255, .97);
  --ink-2: rgba(255, 255, 255, .74);
  --ink-3: rgba(255, 255, 255, .48);
  --glass: rgba(108, 112, 162, .24);
  --glass-dim: rgba(24, 20, 62, .22);
  --cell: rgba(255, 255, 255, .085);
  --cell-hover: rgba(255, 255, 255, .155);
  --cell-press: rgba(255, 255, 255, .22);
  --hairline: rgba(255, 255, 255, .14);
  --star: #ffd86b;
  --good: #6ef2c4;
  --warn: #ffca72;
  --bad: #ff8fa3;
  --a1: #7c74ff;
  --a2: #ff7ba9;
  --a3: #4ae3c8;
  --r-panel: 34px;
  --r-card: 26px;
  --r-cell: 18px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.32, 1.54, .52, 1);
  --font: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "MiSans",
    "Segoe UI Variable Display", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { height: 100%; width: 100%; max-width: 100%; overflow-x: clip; overscroll-behavior-x: none; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100%; width: 100%; max-width: 100%;
  font: 15px/1.55 var(--font); color: var(--ink);
  background: #1c1b4b;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: clip; overscroll-behavior-x: none;
}
#app { width: 100%; max-width: 100%; overflow-x: clip; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: rgba(255, 255, 255, .28); }
:focus-visible { outline: 2px solid rgba(255, 255, 255, .9); outline-offset: 3px; border-radius: 12px; }
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .25) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .22); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }

/* ---------- 3D 场景与无 WebGL 时的兜底氛围 ---------- */
#scene, .ambient { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
#scene { display: block; opacity: 0; transition: opacity 1.4s ease; }
#scene.on { opacity: 1; }
.ambient {
  background:
    radial-gradient(64vw 62vw at 12% 8%, color-mix(in srgb, var(--a1) 86%, transparent), transparent 64%),
    radial-gradient(58vw 58vw at 88% 20%, color-mix(in srgb, var(--a2) 78%, transparent), transparent 62%),
    radial-gradient(64vw 54vw at 58% 100%, color-mix(in srgb, var(--a3) 74%, transparent), transparent 64%),
    linear-gradient(155deg, #242162, #181948 56%, #241954);
}
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- 玻璃材质 ---------- */
.glass {
  position: relative;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, .17), rgba(255, 255, 255, .05) 42%, rgba(255, 255, 255, .08)),
    linear-gradient(var(--glass-dim), var(--glass-dim)), var(--glass);
  -webkit-backdrop-filter: blur(30px) saturate(175%);
  backdrop-filter: blur(30px) saturate(175%);
  border-radius: var(--r-panel);
  box-shadow: 0 36px 80px -34px rgba(6, 4, 36, .7), 0 2px 12px rgba(6, 4, 36, .16);
}
/* 镜面高光描边：左上亮、右下回亮，像一块有厚度的玻璃 */
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.2px; pointer-events: none;
  background: linear-gradient(145deg, rgba(255, 255, 255, .62), rgba(255, 255, 255, .1) 30%, rgba(255, 255, 255, .03) 62%, rgba(255, 255, 255, .34));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.glass.thick { -webkit-backdrop-filter: blur(44px) saturate(190%); backdrop-filter: blur(44px) saturate(190%); background: linear-gradient(165deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .07) 45%, rgba(255, 255, 255, .1)), linear-gradient(rgba(20, 18, 54, .42), rgba(20, 18, 54, .42)), var(--glass); }

.panel { padding: 26px 28px; max-width: 100%; overflow-x: clip; }
.panel + .panel, .stack > * + * { margin-top: 20px; }
.panel-title { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-head .more { font-size: 14px; color: var(--ink-2); padding: 4px 10px; border-radius: 99px; }
.panel-head .more:hover { background: var(--cell-hover); color: var(--ink); }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- 布局外壳：左侧浮动标签栏 + 顶部饰件 + 内容 ---------- */
.shell { position: relative; z-index: 2; min-height: 100vh; min-height: 100dvh; width: 100%; max-width: 100%; overflow-x: clip; padding: 92px 28px 60px 116px; }
.content { width: 100%; max-width: 1180px; min-width: 0; margin: 0 auto; }

.tabbar {
  position: fixed; z-index: 30; left: 22px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 38px; width: 68px;
  transition: width .45s var(--ease); overflow: hidden;
}
.tabbar:hover, .tabbar:focus-within { width: 176px; }
.tab {
  display: flex; align-items: center; gap: 12px; height: 48px; min-width: 48px; padding: 0 12px; border-radius: 24px;
  color: var(--ink-2); white-space: nowrap; font-weight: 600; font-size: 15px; position: relative;
  transition: background .25s, color .25s;
}
.tab svg { flex: none; }
.tab span { opacity: 0; transform: translateX(-6px); transition: opacity .3s, transform .4s var(--ease); }
.tabbar:hover .tab span, .tabbar:focus-within .tab span { opacity: 1; transform: none; }
.tab:hover { background: var(--cell-hover); color: var(--ink); }
.tab.on { background: rgba(255, 255, 255, .92); color: #1b1840; box-shadow: 0 6px 20px rgba(255, 255, 255, .22); }
.tab-sep { height: 1px; margin: 6px 12px; background: var(--hairline); }
.brand-dot { width: 38px; height: 38px; flex: none; transition: transform .42s var(--spring); filter: drop-shadow(0 5px 14px rgba(255, 117, 151, .4)); }
.brand:hover .brand-dot { transform: rotate(-10deg) scale(1.1); }
.brand-tld { background: linear-gradient(90deg, #ffd166, #ff85a2 55%, #5ef2d6); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }
.brand-sub { font-size: 12px; font-weight: 650; padding: 2px 9px; border-radius: 99px; background: rgba(255, 255, 255, .14); color: var(--ink-2); letter-spacing: .01em; }

.topbar {
  position: fixed; z-index: 29; top: 20px; left: 116px; right: 28px; display: flex; justify-content: center; pointer-events: none;
}
.topbar-inner { width: 100%; max-width: 1180px; display: flex; align-items: center; gap: 12px; }
.topbar-inner > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 12px; height: 54px; padding: 0 22px 0 10px; border-radius: 27px; font-weight: 750; font-size: 18px; letter-spacing: .01em; }
.search {
  flex: 1; min-width: 0; max-width: 460px; margin-left: auto; height: 48px; border-radius: 24px; display: flex; align-items: center; gap: 10px; padding: 0 18px; color: var(--ink-2);
}
.search input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0; font-size: 15px; color: var(--ink); }
.search input::placeholder { color: var(--ink-3); }
.search kbd { font: 600 12px var(--font); color: var(--ink-3); border: 1px solid var(--hairline); border-radius: 7px; padding: 1px 7px; }
.icon-btn {
  width: 48px; height: 48px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--ink); flex: none;
  transition: transform .3s var(--spring), background .2s;
}
.icon-btn:hover { background-color: var(--cell-hover); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.sm { width: 38px; height: 38px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .5);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 22px; border-radius: 22px;
  font-weight: 650; font-size: 15px; background: var(--cell-hover); color: var(--ink); white-space: nowrap; position: relative;
  transition: transform .35s var(--spring), background .2s, box-shadow .3s, opacity .2s;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
}
.btn:hover { background: rgba(255, 255, 255, .22); }
.btn:active { transform: scale(.96); }
.btn.primary { background: rgba(255, 255, 255, .94); color: #1b1840; box-shadow: 0 10px 30px -8px rgba(255, 255, 255, .45); }
.btn.primary:hover { background: #fff; }
.btn.danger { color: var(--bad); }
.btn.sm { height: 36px; padding: 0 16px; font-size: 14px; border-radius: 18px; }
.btn.lg { height: 52px; padding: 0 30px; font-size: 17px; border-radius: 26px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* “获取 / 打开” 胶囊，以及下载中的进度环 */
.get {
  --p: 0; min-width: 76px; height: 34px; padding: 0 18px; border-radius: 17px; font-weight: 700; font-size: 14px; letter-spacing: .02em;
  background: rgba(255, 255, 255, .18); color: #fff; display: inline-grid; place-items: center; flex: none; position: relative;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); transition: transform .35s var(--spring), background .2s, min-width .3s var(--ease);
}
.get:hover { background: rgba(255, 255, 255, .3); }
.get:active { transform: scale(.94); }
.get.open { background: rgba(255, 255, 255, .94); color: #1b1840; }
.get.lg { height: 48px; min-width: 132px; font-size: 17px; border-radius: 24px; padding: 0 30px; }
.get.busy { min-width: 34px; width: 34px; padding: 0; background: none; box-shadow: none; }
.get.lg.busy { min-width: 48px; width: 48px; }
.get.busy::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255, 255, 255, .22) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px));
}
.get.busy::after { content: ""; width: 28%; height: 28%; border-radius: 3px; background: #fff; }
.get.busy.spin::before { animation: spin 1s linear infinite; background: conic-gradient(#fff 25%, rgba(255, 255, 255, .22) 0); }
@keyframes spin { to { transform: rotate(1turn); } }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 16px; font-size: 13.5px; font-weight: 600;
  background: var(--cell); color: var(--ink-2); white-space: nowrap; transition: background .2s, color .2s, transform .3s var(--spring);
}
button.chip:hover, a.chip:hover { background: var(--cell-hover); color: var(--ink); }
.chip.on { background: rgba(255, 255, 255, .92); color: #1b1840; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; font-weight: 650; background: var(--cell-hover); color: var(--ink); }
.badge.good { background: rgba(126, 240, 192, .18); color: var(--good); }
.badge.warn { background: rgba(255, 197, 110, .18); color: var(--warn); }
.badge.bad { background: rgba(255, 143, 160, .18); color: var(--bad); }

/* ---------- 游戏图标 ---------- */
.gicon {
  --s: 64px; width: var(--s); height: var(--s); flex: none; border-radius: 23%; overflow: hidden; position: relative;
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: calc(var(--s) * .44); line-height: 1;
  box-shadow: 0 10px 24px -10px rgba(4, 2, 30, .8), inset 0 0 0 1px rgba(255, 255, 255, .22);
  background: linear-gradient(140deg, var(--c1, #7c6cff), var(--c2, #ff7ea8) 60%, var(--c3, #41c8e0));
}
.gicon img { width: 100%; height: 100%; object-fit: cover; }
.gicon::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(160deg, rgba(255, 255, 255, .35), transparent 38%); pointer-events: none; }

/* ---------- 星级 ---------- */
.stars { display: inline-flex; position: relative; line-height: 0; color: rgba(255, 255, 255, .22); }
.stars .fill { position: absolute; left: 0; top: 0; overflow: hidden; white-space: nowrap; color: var(--star); }
.stars svg { flex: none; }
.rate { display: inline-flex; gap: 6px; }
.rate button { color: rgba(255, 255, 255, .3); transition: transform .3s var(--spring), color .15s; padding: 4px; border-radius: 10px; }
.rate button.on { color: var(--star); }
.rate button:hover { transform: scale(1.22) rotate(-6deg); }

/* ---------- 3D 磁吸倾斜 ---------- */
[data-tilt] {
  --rx: 0deg; --ry: 0deg; --tx: 0px; --ty: 0px; --mx: 50%; --my: 50%; --lift: 0;
  transform: perspective(900px) translate3d(var(--tx), var(--ty), 0) rotateX(var(--rx)) rotateY(var(--ry)) scale(calc(1 + var(--lift) * .025));
  transform-style: preserve-3d; transition: transform .7s var(--ease); will-change: transform;
}
[data-tilt].tilting { transition: transform .12s linear; }
[data-tilt] > .glare {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: var(--lift); transition: opacity .4s; z-index: 3;
  background: radial-gradient(380px circle at var(--mx) var(--my), rgba(255, 255, 255, .26), rgba(255, 255, 255, .06) 40%, transparent 65%);
  mix-blend-mode: plus-lighter;
}
[data-tilt] .pop { transform: translateZ(calc(var(--lift) * 34px)); transition: transform .5s var(--ease); }
[data-tilt] .pop-2 { transform: translateZ(calc(var(--lift) * 18px)); transition: transform .5s var(--ease); }
[data-magnet] { transition: transform .5s var(--spring); }

/* ---------- 表单 ---------- */
.field { display: block; }
.field + .field { margin-top: 16px; }
.field > .label { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 650; margin-bottom: 7px; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.input, .textarea, .select {
  width: 100%; background: rgba(10, 8, 40, .28); border: 0; outline: 0; border-radius: 16px; padding: 12px 16px; font-size: 15px; color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .13), inset 0 2px 6px rgba(0, 0, 0, .18); transition: box-shadow .2s, background .2s;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .textarea:focus, .select:focus { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .7), 0 0 0 5px rgba(255, 255, 255, .1); background: rgba(10, 8, 40, .4); }
.textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.select { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.select option { background: #26245a; color: #fff; }
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { width: 50px; height: 30px; border-radius: 15px; background: rgba(255, 255, 255, .16); position: relative; transition: background .25s; flex: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .35s var(--spring); box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.switch input:checked + i { background: var(--good); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 2px solid #fff; outline-offset: 3px; }
.form-error { color: var(--bad); font-size: 13.5px; min-height: 20px; margin-top: 10px; }

/* ---------- 弹层 ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; background: rgba(8, 6, 34, .38); animation: fade .25s ease; overflow-y: auto; }
.sheet { width: min(460px, 100%); padding: 30px; border-radius: 38px; animation: rise .5s var(--ease); margin: auto; }
.sheet.wide { width: min(720px, 100%); }
.sheet h2 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.sheet .sub { color: var(--ink-2); margin-top: 6px; }
.sheet-close { position: absolute; top: 16px; right: 16px; }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }
.seg { display: inline-flex; padding: 4px; border-radius: 22px; background: rgba(10, 8, 40, .28); gap: 2px; }
.seg button { height: 36px; padding: 0 18px; border-radius: 18px; font-weight: 650; font-size: 14px; color: var(--ink-2); transition: background .25s, color .25s; }
.seg button.on { background: rgba(255, 255, 255, .92); color: #1b1840; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(26px) scale(.96); } }

.toasts { position: fixed; z-index: 90; left: 50%; bottom: 30px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast { padding: 12px 20px; border-radius: 24px; font-weight: 600; font-size: 14.5px; display: flex; gap: 10px; align-items: center; animation: rise .45s var(--ease); pointer-events: auto; max-width: min(520px, 88vw); }
.toast.bad svg { color: var(--bad); }
.toast.good svg { color: var(--good); }
.toast.out { opacity: 0; transform: translateY(10px); transition: all .3s; }

.menu { position: fixed; z-index: 70; min-width: 220px; padding: 8px; border-radius: 26px; animation: rise .35s var(--ease); }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; border-radius: 18px; font-weight: 600; font-size: 14.5px; text-align: left; color: var(--ink); }
.menu-item:hover { background: var(--cell-hover); }
.menu-head { padding: 10px 14px 12px; }

.empty { text-align: center; padding: 56px 20px; color: var(--ink-2); }
.empty h3 { font-size: 20px; color: var(--ink); margin-bottom: 8px; }
.empty .btn { margin-top: 20px; }

.skeleton { border-radius: var(--r-card); background: linear-gradient(100deg, rgba(255,255,255,.06) 30%, rgba(255,255,255,.14) 50%, rgba(255,255,255,.06) 70%); background-size: 300% 100%; animation: shimmer 1.6s infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }

/* ---------- 窄屏：标签栏落到底部，像 iOS 的浮动标签栏 ---------- */
@media (max-width: 860px) {
  .shell { padding: calc(74px + env(safe-area-inset-top, 0px)) 12px calc(104px + env(safe-area-inset-bottom, 0px)); }
  .tabbar { left: 50%; top: auto; bottom: max(12px, env(safe-area-inset-bottom, 12px)); transform: translateX(-50%); flex-direction: row; width: auto !important; border-radius: 34px; padding: 6px 8px; gap: 2px; max-width: calc(100vw - 20px); }
  .tab { height: 44px; min-width: 44px; padding: 0 10px; }
  .tab span { display: none; }
  .tab-sep { width: 1px; height: 26px; margin: 9px 3px; }
  .tab.hide-sm { display: none; }
  .topbar { left: 12px; right: 12px; top: max(12px, env(safe-area-inset-top, 12px)); }
  .topbar-inner { gap: 8px; }
  .brand b { display: none; }
  .brand { height: 46px; padding: 0 7px; border-radius: 23px; flex: none; }
  .brand-dot { width: 32px; height: 32px; }
  .search { height: 44px; padding: 0 12px; gap: 7px; }
  .search kbd { display: none; }
  .topbar-inner .btn.glass { height: 44px !important; padding: 0 14px; font-size: 14px; flex: none; }
  .topbar-inner .icon-btn { width: 44px; height: 44px; }
  .panel { padding: 18px 16px; }
  [data-tilt] { transform: none !important; will-change: auto; }
  :root { --r-panel: 26px; --r-card: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  [data-tilt] { transform: none !important; }
}
