/* ==========================================================================
 * 学习成长记录平台 —— 样式表
 * 可爱活泼 / 圆润卡片 / 明确的点击反馈 / 克制的动画
 * ========================================================================== */
:root {
  --brand: #6c5ce7;
  --brand-2: #a29bfe;
  --pink: #ff7aa8;
  --mint: #35d6a4;
  --sun: #ffc93c;
  --sky: #4dabf7;
  --coral: #ff8f6b;
  --ink: #2f2b3a;
  --ink-2: #6b6580;
  --line: #ece9f5;
  --bg: #f6f4ff;
  --card: #ffffff;
  --shadow: 0 6px 20px rgba(108, 92, 231, .1);
  --shadow-lg: 0 14px 40px rgba(108, 92, 231, .18);
  --r: 18px;
  --r-lg: 26px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC",
               "Microsoft YaHei", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(900px 500px at 8% -8%, #e8e2ff 0%, transparent 60%),
    radial-gradient(800px 460px at 105% 4%, #ffe8f2 0%, transparent 58%),
    radial-gradient(700px 520px at 50% 108%, #e2fbf3 0%, transparent 62%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
.muted { color: var(--ink-2); }
.hide { display: none !important; }

/* --------------------------------------------------------------- 布局 */
#app { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  padding: calc(10px + var(--safe-t)) 14px 10px;
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .logo {
  width: 34px; height: 34px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, var(--brand), var(--pink));
  display: grid; place-items: center; color: #fff; font-size: 18px;
  box-shadow: 0 4px 12px rgba(108, 92, 231, .35);
}
.topbar h1 { font-size: 16px; margin: 0; font-weight: 800; letter-spacing: .3px; }
.topbar .sub { font-size: 11px; color: var(--ink-2); margin-top: 1px; }
.topbar .spacer { flex: 1; }

.netdot {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px;
  padding: 5px 10px; border-radius: 999px; background: #eef7f1; color: #1f9d63; font-weight: 700;
}
.netdot i { width: 7px; height: 7px; border-radius: 50%; background: #23c47c; display: block; }
.netdot.off { background: #fff1e8; color: #d1743a; }
.netdot.off i { background: #ff9f43; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .3 } }

main { flex: 1; padding: 14px 14px calc(88px + var(--safe-b)); max-width: 1180px; width: 100%; margin: 0 auto; }
.page { animation: pageIn .28s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }

/* 底部导航 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; padding: 6px 6px calc(6px + var(--safe-b));
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(16px) saturate(1.6);
  border-top: 1px solid var(--line);
}
.tabbar button {
  flex: 1; border: 0; background: none; padding: 7px 2px 5px; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10.5px; color: var(--ink-2); font-weight: 700; transition: .18s; cursor: pointer;
}
.tabbar button span.ic { font-size: 20px; line-height: 1; transition: transform .22s cubic-bezier(.34,1.56,.64,1); }
.tabbar button.on { color: var(--brand); background: linear-gradient(180deg, #f1eeff, #fff); }
.tabbar button.on span.ic { transform: translateY(-3px) scale(1.16); }
.tabbar button:active span.ic { transform: scale(.86); }

/* --------------------------------------------------------------- 通用件 */
.card {
  background: var(--card); border-radius: var(--r-lg); padding: 16px;
  box-shadow: var(--shadow); border: 1px solid #f2effc; margin-bottom: 14px;
}
.card.tight { padding: 12px; }
.sec-title { font-size: 15px; font-weight: 800; margin: 0 0 10px; display: flex; align-items: center; gap: 7px; }
.sec-title small { font-weight: 600; color: var(--ink-2); font-size: 11.5px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }

.btn {
  border: 0; border-radius: 14px; padding: 11px 16px; font-weight: 800; font-size: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; cursor: pointer;
  box-shadow: 0 6px 16px rgba(108, 92, 231, .3); transition: transform .12s, box-shadow .2s, filter .2s;
}
.btn:active { transform: scale(.95); box-shadow: 0 2px 8px rgba(108, 92, 231, .3); }
.btn:disabled { filter: grayscale(.7); opacity: .55; box-shadow: none; cursor: not-allowed; }
.btn.pink { background: linear-gradient(135deg, #ff7aa8, #ff9f6b); box-shadow: 0 6px 16px rgba(255, 122, 168, .32); }
.btn.mint { background: linear-gradient(135deg, #35d6a4, #4dabf7); box-shadow: 0 6px 16px rgba(53, 214, 164, .3); }
.btn.sun  { background: linear-gradient(135deg, #ffc93c, #ff9f2e); box-shadow: 0 6px 16px rgba(255, 159, 46, .3); color: #6a4300; }
.btn.ghost { background: #f4f1ff; color: var(--brand); box-shadow: none; border: 1.5px solid #e6e0ff; }
.btn.sm { padding: 7px 12px; font-size: 12.5px; border-radius: 11px; }
.btn.xs { padding: 5px 9px; font-size: 11.5px; border-radius: 9px; box-shadow: none; }
.btn.block { width: 100%; }
.btn.danger { background: linear-gradient(135deg, #ff6b6b, #ee5253); box-shadow: 0 6px 16px rgba(238, 82, 83, .28); }

input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 13px; padding: 11px 13px;
  background: #fbfaff; outline: none; transition: .18s; font-size: 14px;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); background: #fff; box-shadow: 0 0 0 4px rgba(162, 155, 254, .18); }
textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
label.fld { display: block; margin-bottom: 10px; }
label.fld span { display: block; font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 5px; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 6px 11px; border-radius: 999px;
  background: #f3f0ff; color: var(--brand); font-size: 12px; font-weight: 700; border: 1.5px solid transparent;
  cursor: pointer; transition: .16s;
}
.chip.on { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.chip:active { transform: scale(.94); }
.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.pill.g { background: #e7f9f1; color: #159d68; }
.pill.y { background: #fff5db; color: #b57e00; }
.pill.r { background: #ffecec; color: #d63d3d; }
.pill.b { background: #e9f2ff; color: #2f7ad6; }

.toastwrap { position: fixed; left: 0; right: 0; top: calc(12px + var(--safe-t)); z-index: 999; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: rgba(47, 43, 58, .94); color: #fff; padding: 10px 16px; border-radius: 14px;
  font-size: 13px; font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .22); max-width: 90vw;
  animation: toastIn .3s cubic-bezier(.34,1.56,.64,1) both;
}
.toast.warn { background: #ff9f43; }
.toast.ok { background: linear-gradient(135deg, #35d6a4, #2bb98c); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(.9) } to { opacity: 1; transform: none } }

/* --------------------------------------------------------------- 宠物 */
.pet-svg { display: block; overflow: visible; }
.pet-breathe { animation: breathe 3.4s ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { transform: translateY(0) }
  50% { transform: translateY(-3.2px) }
}
.pet-twinkle { animation: twinkle 2.6s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: .25; transform: scale(.7) } 50% { opacity: 1; transform: scale(1.15) } }

.pethero { display: flex; gap: 14px; align-items: center; }
.pethero .stagewrap { position: relative; flex: none; }
.petstage {
  width: 190px; height: 190px; border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #fff 0%, #f4f1ff 62%, #ebe6ff 100%);
  display: grid; place-items: center; box-shadow: inset 0 -8px 22px rgba(108, 92, 231, .1);
}
.petmeta { flex: 1; min-width: 0; }
.petname { font-size: 19px; font-weight: 900; letter-spacing: .5px; }
.petstage-tag { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.lvbadge {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px;
  background: linear-gradient(135deg, var(--sun), #ff9f2e); color: #6a4300; font-weight: 900; font-size: 12px;
  box-shadow: 0 3px 10px rgba(255, 159, 46, .3);
}
.bar { height: 11px; border-radius: 999px; background: #efecfb; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--pink)); transition: width .6s cubic-bezier(.34,1.2,.64,1); }
.bar.mood > i { background: linear-gradient(90deg, #35d6a4, #ffc93c); }
.bar.mood.low > i { background: linear-gradient(90deg, #ff9f43, #ff6b6b); }

.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: #faf9ff; border: 1px solid #f0ecff; border-radius: 16px; padding: 10px 8px; text-align: center; }
.stat b { display: block; font-size: 19px; font-weight: 900; color: var(--brand); }
.stat span { font-size: 10.5px; color: var(--ink-2); font-weight: 700; }

/* 进化时间轴 */
.evoline { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 8px; }
.evoitem { flex: none; width: 76px; text-align: center; opacity: .42; filter: grayscale(1); transition: .3s; }
.evoitem.done { opacity: 1; filter: none; }
.evoitem.cur { transform: scale(1.08); }
.evoitem .evoname { font-size: 10px; font-weight: 800; color: var(--ink-2); margin-top: -6px; }
.evoitem.cur .evoname { color: var(--brand); }

/* 升级庆祝 */
.celebrate {
  position: fixed; inset: 0; z-index: 900; display: grid; place-items: center;
  background: rgba(30, 24, 54, .58); backdrop-filter: blur(6px); animation: fadeIn .3s both;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.celebox {
  background: #fff; border-radius: 30px; padding: 22px 24px 18px; text-align: center; max-width: 340px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35); animation: pop .5s cubic-bezier(.34,1.56,.64,1) both; position: relative; overflow: hidden;
}
@keyframes pop { 0% { transform: scale(.5) rotate(-6deg); opacity: 0 } 100% { transform: none; opacity: 1 } }
.celebox h2 { margin: 6px 0 2px; font-size: 21px; background: linear-gradient(135deg, var(--brand), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.confetti { position: absolute; width: 9px; height: 14px; border-radius: 3px; animation: fall 2.2s linear infinite; }
@keyframes fall { 0% { transform: translateY(-40px) rotate(0) } 100% { transform: translateY(420px) rotate(560deg) } }
.raysvg { position: absolute; inset: -30%; animation: spin 14s linear infinite; opacity: .5; z-index: 0; }
@keyframes spin { to { transform: rotate(360deg) } }

/* --------------------------------------------------------------- 记录 */
.reclist { display: flex; flex-direction: column; gap: 9px; }
.recitem {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border-radius: 16px;
  background: #fbfaff; border: 1px solid #f1eefc; animation: pageIn .25s both;
}
.recitem .ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-size: 17px; flex: none; background: #fff; box-shadow: var(--shadow); }
.recitem .t { flex: 1; min-width: 0; }
.recitem .t b { font-size: 13.5px; font-weight: 700; display: block; line-height: 1.45; word-break: break-word; }
.recitem .t small { color: var(--ink-2); font-size: 11px; }
.recitem .p { color: var(--mint); font-weight: 900; font-size: 13px; flex: none; }

/* --------------------------------------------------------------- 商城 */
.shopgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 11px; }
.shopitem {
  background: #fff; border-radius: 20px; padding: 14px 12px; text-align: center; border: 1.5px solid #f1eefc;
  box-shadow: var(--shadow); transition: .2s; position: relative; overflow: hidden;
}
.shopitem:active { transform: scale(.97); }
.shopitem .emo { font-size: 34px; display: block; margin-bottom: 6px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.12)); }
.shopitem .nm { font-weight: 800; font-size: 13.5px; }
.shopitem .no { font-size: 11px; color: var(--ink-2); min-height: 15px; margin: 3px 0 8px; }
.shopitem .cost { font-weight: 900; color: #b57e00; background: #fff5db; border-radius: 999px; padding: 3px 10px; font-size: 12px; display: inline-block; }
.shopitem.cant { opacity: .55; }

/* --------------------------------------------------------------- 卡牌 */
.gcard {
  position: relative; border-radius: 14px; background: linear-gradient(170deg, #fffdf8, #f3f0ff);
  border: 2px solid var(--rar); padding: 6px 6px 5px; box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
  width: 118px; transition: transform .18s, box-shadow .18s; user-select: none;
}
.gcard:active { transform: translateY(-3px) scale(1.03); box-shadow: 0 10px 24px rgba(0, 0, 0, .2); }
.gcard.rar-传说 { box-shadow: 0 0 0 1px #ffe08a, 0 6px 20px rgba(255, 159, 46, .45); }
.gcard-artwrap { border-radius: 9px; overflow: hidden; height: 62px; background: #ddd; }
.card-art { width: 100%; height: 62px; display: block; }
.gcard-cost {
  position: absolute; left: -6px; top: -6px; width: 26px; height: 26px; border-radius: 50%; z-index: 2;
  background: radial-gradient(circle at 35% 30%, #7fd7ff, #2a72c9); color: #fff; font-weight: 900;
  display: grid; place-items: center; font-size: 14px; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}
.gcard-name { font-size: 12.5px; font-weight: 900; text-align: center; margin-top: 4px; line-height: 1.2; }
.gcard-title { font-size: 9.5px; color: var(--ink-2); text-align: center; line-height: 1.2; min-height: 11px; }
.gcard-skill { font-size: 9.5px; text-align: center; line-height: 1.3; min-height: 24px; margin-top: 3px; color: #4a4359; }
.gcard-skill b { color: var(--brand); }
.gcard-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 3px; }
.gcard-atk, .gcard-hp { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 12px; border: 1.5px solid #fff; }
.gcard-atk { background: linear-gradient(135deg, #ffca3a, #f08a00); }
.gcard-hp { background: linear-gradient(135deg, #ff7a7a, #d63031); }
.gcard-book { font-size: 8.5px; color: var(--ink-2); }
.gcard-count { position: absolute; right: -5px; top: -5px; background: var(--brand); color: #fff; font-size: 10px; font-weight: 900; border-radius: 999px; padding: 2px 6px; border: 2px solid #fff; }
.gcard-locked { filter: grayscale(1) brightness(.94); opacity: .62; }
.gcard-lock { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 900; color: #fff; background: rgba(40, 36, 56, .42); border-radius: 12px; }
.gcard-sm { width: 92px; }
.gcard-sm .gcard-artwrap, .gcard-sm .card-art { height: 48px; }
.gcard-sm .gcard-skill { min-height: 20px; font-size: 8.5px; }
.cardgrid { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.bookrow { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 6px; }
.bookcard {
  flex: none; width: 118px; border-radius: 18px; padding: 12px 10px; text-align: center; cursor: pointer;
  background: #fff; border: 1.5px solid #f1eefc; box-shadow: var(--shadow); transition: .18s;
}
.bookcard:active { transform: scale(.96); }
.bookcard .cv { font-size: 28px; }
.bookcard .bn { font-weight: 800; font-size: 13px; margin-top: 3px; }
.bookcard .ba { font-size: 10px; color: var(--ink-2); }
.bookcard .bp { font-size: 10px; margin-top: 5px; }

/* 答题 */
.qbox { background: linear-gradient(160deg, #fff, #faf8ff); border-radius: 22px; padding: 16px; border: 1.5px solid #efeafd; }
.qopts { margin-top: 6px; }
.qopt {
  display: block; width: 100%; text-align: left; border: 1.5px solid var(--line); background: #fff;
  border-radius: 14px; padding: 12px 14px; margin-bottom: 9px; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: .16s;
}
.qopt:active { transform: scale(.98); }
.qopt.right { border-color: #35d6a4; background: #eafaf4; color: #10855c; }
.qopt.wrong { border-color: #ff6b6b; background: #ffefef; color: #c0392b; }
.qopt:disabled { cursor: default; }

/* 对战 */
.arena { background: linear-gradient(180deg, #2b2450, #3d3468 45%, #241f42); border-radius: 22px; padding: 12px; color: #fff; }
.hero { display: flex; align-items: center; gap: 10px; }
.heroface { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; border: 3px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12); }
.hp { background: linear-gradient(135deg, #ff7a7a, #d63031); border-radius: 999px; padding: 2px 10px; font-weight: 900; font-size: 13px; }
.mana { background: linear-gradient(135deg, #7fd7ff, #2a72c9); border-radius: 999px; padding: 2px 10px; font-weight: 900; font-size: 13px; }
.board { min-height: 84px; display: flex; gap: 7px; justify-content: center; align-items: center; padding: 7px; border-radius: 14px; background: rgba(255, 255, 255, .07); margin: 8px 0; flex-wrap: wrap; }
.minion {
  width: 62px; border-radius: 12px; background: linear-gradient(170deg, #fffdf8, #e9e4ff); color: var(--ink);
  border: 2px solid #d8cfff; padding: 4px 3px 3px; text-align: center; cursor: pointer; position: relative; transition: .16s;
}
.minion.ready { border-color: #35d6a4; box-shadow: 0 0 0 2px rgba(53, 214, 164, .45); }
.minion.sel { transform: translateY(-6px); box-shadow: 0 0 0 3px var(--sun); }
.minion.taunt { border-color: #8d7cff; background: linear-gradient(170deg, #efe9ff, #d9cfff); }
.minion.shield { box-shadow: 0 0 0 3px rgba(255, 216, 90, .8); }
.minion .g { font-size: 20px; font-weight: 900; font-family: "Noto Serif SC", serif; }
.minion .n { font-size: 9px; font-weight: 800; line-height: 1.1; }
.minion .s { display: flex; justify-content: space-between; margin-top: 2px; padding: 0 2px; }
.minion .s b { font-size: 11px; }
.minion .s .a { color: #e8890a; }
.minion .s .h { color: #d63031; }
.minion .kw { position: absolute; top: -7px; left: 50%; transform: translateX(-50%); font-size: 8px; background: var(--brand); color: #fff; border-radius: 999px; padding: 1px 5px; white-space: nowrap; }
.hand { display: flex; gap: 6px; overflow-x: auto; padding: 8px 2px; }
.hand .gcard { flex: none; }
.hand .gcard.playable { box-shadow: 0 0 0 2px #35d6a4, 0 6px 16px rgba(53, 214, 164, .4); }
.battlelog { max-height: 92px; overflow-y: auto; font-size: 11px; line-height: 1.7; color: rgba(255, 255, 255, .78); background: rgba(0, 0, 0, .22); border-radius: 12px; padding: 7px 10px; }

/* --------------------------------------------------------------- 大屏 */
body.wallmode { background: #14102b; }
.wall { padding: 18px 22px; color: #fff; }
.wallhead { display: flex; align-items: baseline; gap: 14px; margin-bottom: 14px; }
.wallhead h1 { font-size: 30px; margin: 0; background: linear-gradient(135deg, #ffd24d, #ff7aa8, #a29bfe); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wallgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.wallcard {
  background: linear-gradient(170deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .05));
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 22px; padding: 10px; text-align: center;
  backdrop-filter: blur(6px); animation: pageIn .4s both;
}
.wallcard .wn { font-weight: 900; font-size: 15px; margin-top: 2px; }
.wallcard .wl { font-size: 11px; color: #ffd88a; font-weight: 800; }
.wallcard .wb { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .18); margin-top: 6px; overflow: hidden; }
.wallcard .wb > i { display: block; height: 100%; background: linear-gradient(90deg, #ffd24d, #ff7aa8); }
.wallcard.top1 { border-color: #ffd24d; box-shadow: 0 0 26px rgba(255, 210, 77, .35); }

/* --------------------------------------------------------------- 后台 */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11.5px; color: var(--ink-2); padding: 8px 6px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 6px; border-bottom: 1px solid #f6f4fd; vertical-align: middle; }
.tbl tr:active { background: #faf8ff; }
.scrollx { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rank { display: flex; align-items: center; gap: 9px; padding: 8px 4px; border-bottom: 1px dashed #f0edfa; }
.rank .no { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; font-weight: 900; font-size: 12px; background: #f2effc; color: var(--ink-2); }
.rank .no.g1 { background: linear-gradient(135deg, #ffd24d, #ff9f2e); color: #6a4300; }
.rank .no.g2 { background: linear-gradient(135deg, #dfe6ef, #b8c4d4); color: #465166; }
.rank .no.g3 { background: linear-gradient(135deg, #ffbe8f, #e08b52); color: #6a3a12; }
.distbar { display: flex; height: 26px; border-radius: 10px; overflow: hidden; margin: 8px 0 4px; }
.distbar > i { display: block; height: 100%; }

/* 登录 */
.login { max-width: 420px; margin: 6vh auto; }
.login .hero { text-align: center; margin-bottom: 16px; display: block; }
.login .hero .t { font-size: 24px; font-weight: 900; margin-top: 6px; }
.login .hero .s { color: var(--ink-2); font-size: 13px; }
.namegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; max-height: 220px; overflow-y: auto; padding: 2px; }
.namebtn { border: 1.5px solid var(--line); background: #fff; border-radius: 13px; padding: 10px 4px; font-weight: 700; font-size: 13px; cursor: pointer; transition: .15s; }
.namebtn.on { border-color: var(--brand); background: #f3f0ff; color: var(--brand); }
.namebtn:active { transform: scale(.95); }

.modal { position: fixed; inset: 0; z-index: 800; background: rgba(30, 24, 54, .5); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fadeIn .2s both; }
.modalbox { background: #fff; border-radius: 24px; padding: 18px; width: 100%; max-width: 400px; max-height: 84vh; overflow-y: auto; animation: pop .32s cubic-bezier(.34,1.56,.64,1) both; }

@media (min-width: 780px) {
  .pethero { gap: 26px; }
  .petstage { width: 240px; height: 240px; }
  main { padding-bottom: calc(96px + var(--safe-b)); }
  .statgrid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 380px) {
  .gcard { width: 104px; }
  .statgrid { grid-template-columns: repeat(2, 1fr); }
}
@media print { .tabbar, .topbar { display: none } }
