:root {
  /* 主题色：碧色（他的应援色，浅蓝）+ 灰蓝（他自己喜欢的颜色） */
  --bi: #8fd3ee; --bi-soft: #e5f4fb; --bi-deep: #4fb3dc;
  --gb: #6d8aa6; --gb-deep: #4f6d8a; --gb-soft: #e9eff5;
  --bg: #eef4f8; --card: #ffffff; --ink: #24344a; --sub: #6f8296; --line: #d8e4ec;
  --accent: var(--gb); --accent2: #a9d9ee; --good: #5fb59a; --bad: #d9767a; --mirror: #c9dcea;
  --soft: #eaf4fa; --soft2: #f4f9fc; --shadow: rgba(40,70,100,.08); --overlay: rgba(15,25,40,.45);
  --night: #0b1222;
  --r: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; }
body { overscroll-behavior: none; }
#app { max-width: 440px; margin: 0 auto; min-height: 100%; padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 96px); }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.hidden { display: none !important; }

/* 标题页 */
.title-screen { min-height: 88vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; }
.mirror { width: 220px; height: 260px; position: relative; border-radius: 50% 50% 46% 46%; background: linear-gradient(160deg, #eef3fb, var(--mirror)); box-shadow: inset 0 0 0 6px #fff, 0 10px 30px rgba(80,120,160,.25); overflow: hidden; }
.mirror .shard { position: absolute; font-size: 28px; opacity: .85; }
.mirror::after { content: ""; position: absolute; inset: 0; background:
  linear-gradient(115deg, transparent 30%, rgba(255,255,255,.7) 31%, transparent 33%),
  linear-gradient(40deg, transparent 55%, rgba(255,255,255,.6) 56%, transparent 58%),
  linear-gradient(170deg, transparent 62%, rgba(255,255,255,.5) 63%, transparent 65%); }
.game-title { font-size: 30px; font-weight: 700; letter-spacing: 1px; margin: 6px 0 0; }
.game-title small { display: block; font-size: 15px; font-weight: 500; color: var(--sub); letter-spacing: 6px; margin-top: 4px; }
.slogan { color: var(--sub); font-size: 14px; }
.en-sub { font-style: italic; letter-spacing: .08em; color: var(--gb); font-size: 14px; margin: -4px 0 10px; }
.btn { display: block; width: 100%; padding: 15px; border-radius: 14px; background: linear-gradient(135deg, var(--bi-deep), var(--gb)); color: #fff; font-weight: 600; font-size: 16px; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn:disabled { opacity: .45; }
.stack { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 300px; }

/* 卡片 */
.card { background: var(--card); border-radius: var(--r); padding: 14px; margin-bottom: 12px; box-shadow: 0 2px 10px var(--shadow); }
.h { font-size: 13px; color: var(--sub); margin: 0 0 8px; display: flex; justify-content: space-between; align-items: center; }
.tier { text-align: left; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.tier b { font-size: 18px; }
.tier div { color: var(--sub); font-size: 13px; margin-top: 4px; }

/* 顶栏 */
.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.top .who { font-weight: 700; font-size: 17px; }
.top .when { font-size: 12px; color: var(--sub); }
.money { font-size: 13px; background: #fff; padding: 6px 10px; border-radius: 99px; border: 1px solid var(--line); }
.gear { font-size: 20px; padding: 4px 0 4px 8px; }

/* 豚豚 */
.kid { display: flex; gap: 14px; align-items: center; }
.avatar { width: 92px; height: 92px; border-radius: 26px; background: linear-gradient(160deg, var(--bi-soft), #cfe6f3); display: grid; place-items: center; font-size: 54px; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.kid .mood { display: inline-block; font-size: 13px; padding: 4px 10px; border-radius: 99px; background: var(--soft); margin-bottom: 6px; }
.kid .say { font-size: 14px; color: var(--sub); line-height: 1.5; }

/* 饼图 + 圆环 */
.charts { display: flex; gap: 12px; align-items: center; }
.pie { width: 112px; height: 112px; border-radius: 50%; flex: none; position: relative; }
.pie::after { content: ""; position: absolute; inset: 30%; background: #fff; border-radius: 50%; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; font-size: 12px; flex: 1; }
.legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 4px; }
.rings { display: flex; justify-content: space-around; margin-top: 12px; }
.ring { width: 64px; text-align: center; font-size: 12px; color: var(--sub); }
.ring .r { width: 54px; height: 54px; margin: 0 auto 4px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; position: relative; }
.ring .r::before { content: ""; position: absolute; inset: 6px; background: #fff; border-radius: 50%; }
.ring .r i { position: relative; font-style: normal; }
.num { font-size: 10px; color: var(--accent); }

/* 活动格 */
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot { border: 1.5px dashed var(--accent2); border-radius: 14px; min-height: 78px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; text-align: center; background: var(--soft2); }
.slot.filled { border-style: solid; background: #fff; }
.slot.locked { border-color: var(--gb); background: var(--gb-soft); }
.slot .ic { font-size: 24px; }
.slot .c { color: var(--sub); font-size: 11px; }
.comps { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 9px 12px; border-radius: 99px; background: #fff; border: 1px solid var(--line); font-size: 13px; }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip.match::after { content: " ✨"; }
.chip:disabled { opacity: .4; }
.hint { font-size: 12px; color: var(--sub); margin-top: 8px; }
.footer { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(env(safe-area-inset-bottom) + 12px); background: linear-gradient(transparent, var(--bg) 30%); }
.footer .inner { max-width: 408px; margin: 0 auto; }
.costline { text-align: center; font-size: 12px; color: var(--sub); margin-bottom: 6px; }

/* 选择列表（底部弹出） */
.sheet { position: fixed; inset: 0; background: rgba(15,25,40,.35); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet .panel { background: var(--bg); width: 100%; max-width: 440px; max-height: 78vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 16px 16px calc(env(safe-area-inset-bottom) + 16px); }
.opt { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: #fff; border-radius: 14px; padding: 12px; margin-bottom: 8px; }
.opt .ic { font-size: 26px; }
.opt small { display: block; color: var(--sub); font-size: 12px; margin-top: 2px; }
.opt:disabled { opacity: .4; }

/* 事件弹窗 */
.modal { position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: center; justify-content: center; z-index: 30; padding: 16px; }
.modal .box { background: #fff; width: 100%; max-width: 408px; max-height: 88vh; overflow: auto; border-radius: 22px; padding: 18px; animation: pop .25s ease; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.modal .pic { width: 100%; border-radius: 14px; margin-bottom: 12px; display: block; }
.modal h3 { margin: 0 0 10px; font-size: 18px; }
.modal p { white-space: pre-line; line-height: 1.7; font-size: 15px; margin: 0 0 14px; }
.modal .res { background: var(--soft2); border-radius: 12px; padding: 12px; }
.choice { display: block; width: 100%; text-align: left; padding: 13px 14px; margin-top: 8px; border-radius: 12px; background: var(--soft); font-size: 15px; }
.choice:disabled { opacity: .4; }
.modal input { width: 100%; font-size: 20px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); margin: 6px 0; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }
.delta { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.delta span { font-size: 12px; padding: 4px 8px; border-radius: 99px; background: var(--gb-soft); }
.delta .up { color: #2f8f68; } .delta .down { color: #c05050; }
.egg { font-size: 12px; color: var(--gb-deep); background: var(--bi-soft); padding: 6px 10px; border-radius: 99px; display: inline-block; margin-bottom: 10px; }

/* 图鉴 */
.shards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.shard-card { border-radius: 14px; padding: 12px; background: linear-gradient(160deg, var(--bi-soft), #d3e6f2); font-size: 13px; min-height: 70px; }
.shard-card.lock { background: var(--gb-soft); color: #9fb0c0; }
.shard-card b { display: block; font-size: 14px; margin-bottom: 4px; }
.tag { font-size: 11px; padding: 2px 6px; border-radius: 6px; background: #fff; margin-left: 4px; }
.dev { font-size: 12px; white-space: pre-wrap; background: #fff; padding: 10px; border-radius: 10px; }

/* 红包九宫格 */
.grid9 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pk { aspect-ratio: 1; border-radius: 14px; background: linear-gradient(160deg, #f26b5b, #d94a3d); color: #ffe7a8; font-size: 30px; font-weight: 700; box-shadow: inset 0 -4px 0 rgba(0,0,0,.12); }
.pk:disabled { font-size: 16px; background: var(--gb-soft); color: var(--sub); box-shadow: none; }
.pk.mine { background: linear-gradient(160deg, #ffd56b, #f4a93c); color: #7a3b10; font-size: 18px; }

.real { margin: 10px 0 4px; text-align: center; animation: realIn 1.2s ease; }
.real img { width: 100%; border-radius: 14px; display: block; margin-bottom: 10px; box-shadow: 0 0 0 3px var(--bi-soft), 0 6px 20px rgba(79,179,220,.35); }
@keyframes realIn { from { opacity: 0; filter: blur(8px); transform: scale(.96); } to { opacity: 1; filter: none; transform: none; } }
.shard-card[data-real] { cursor: pointer; }

/* 标题页：首图 + 夜空底色 */
/* 三种写法都认：新旧版本的 ui.js 混在一起时（浏览器缓存）也不会出错 */
html.night, html.night body, body.night, html:has(.hero-on), html:has(.hero-on) body { background: var(--night); }
html.night #app, body.night #app, html:has(.hero-on) #app { padding-top: 0; }
.title-screen.hero-on { justify-content: flex-start; gap: 0; color: #e6f3fa; min-height: 100vh; }
.hero { position: relative; margin: 0 -16px; width: calc(100% + 32px); }
.hero img { display: block; margin: 0 auto; width: min(100%, calc(54vh * 0.75)); height: auto;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 38%; background: linear-gradient(transparent, var(--night)); pointer-events: none; }
.hero-text { position: relative; z-index: 1; margin-top: -6vh; }
.hero::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 10%; background: linear-gradient(var(--night), transparent); z-index: 1; pointer-events: none; }
.hero-on .game-title { font-family: "Didot", "Bodoni 72", "Songti SC", Georgia, serif; font-size: 40px; font-weight: 600; letter-spacing: 3px; color: #f2f9fd;
  text-shadow: 0 0 18px rgba(143,211,238,.75), 0 0 2px rgba(255,255,255,.9); }
.hero-on .game-title small { color: var(--bi); letter-spacing: 10px; font-family: "Songti SC", serif; }
.hero-on .en-sub { color: #a7c3d8; margin: 6px 0 10px; }
.hero-on .slogan { color: #b9cad8; }
.hero-on .btn { box-shadow: 0 4px 18px rgba(79,179,220,.35); }
.hero-on .btn.ghost { background: rgba(255,255,255,.06); color: #e6f3fa; border: 1px solid rgba(143,211,238,.45); }
.hero-on .stack { margin: 22px auto 24px; }
.mirror-img { width: 150px; border-radius: 16px; box-shadow: 0 8px 26px rgba(40,70,100,.35); }

/* 更新提示 */
.upd { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 88px); z-index: 40;
  background: var(--gb-deep); color: #fff; padding: 10px 16px; border-radius: 99px; font-size: 13px; box-shadow: 0 6px 20px rgba(20,40,60,.3); }
.toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 16px); transform: translateX(-50%); z-index: 50;
  background: rgba(36,52,74,.92); color: #fff; padding: 9px 16px; border-radius: 99px; font-size: 13px; animation: pop .25s ease; }
.ver { font-size: 12px; color: var(--sub); text-align: center; margin: 4px 0 10px; }

/* 图片加载好之前不显示，避免闪出「打不开的图片」图标 */
img.wait { visibility: hidden; }
.modal .pic.wait { display: none; }
