/* ==========================================================================
   班宠乐园 —— 设计系统
   ========================================================================== */

:root {
  --bg: #FFF8F3;
  --bg-2: #FFF1E6;
  --surface: #FFFFFF;
  --surface-2: #FFFAF6;
  --surface-3: #FFF3EA;
  --ink: #2E2A3B;
  --ink-2: #6C6479;
  --ink-3: #A79EB6;
  --line: #F1E7DF;
  --line-2: #E8DCD2;

  --primary: #FF8A5B;
  --primary-d: #F2713F;
  --primary-l: #FFE6D9;
  --violet: #7C6CF7;
  --violet-l: #EDEAFF;
  --teal: #2EC4B6;
  --teal-l: #DDF7F3;
  --pink: #FF6B9D;
  --pink-l: #FFE4EE;
  --gold: #FFC857;
  --gold-l: #FFF3D6;
  --red: #F4574B;
  --red-l: #FFE7E4;
  --green: #34B37E;
  --green-l: #DFF6EC;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --shadow-1: 0 1px 2px rgba(93, 66, 50, .05), 0 4px 14px rgba(93, 66, 50, .05);
  --shadow-2: 0 4px 10px rgba(93, 66, 50, .07), 0 14px 40px rgba(93, 66, 50, .08);
  --shadow-3: 0 10px 30px rgba(255, 138, 91, .28);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }
svg { display: block; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #E3D6CB; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #D3C3B6; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------- 通用组件 -------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 18px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 600; letter-spacing: .02em;
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line-2);
  transition: transform .12s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-2); }
.btn:active { transform: scale(.97); }
.btn--primary {
  background: linear-gradient(135deg, #FF9C6E, var(--primary));
  border-color: transparent; color: #fff; box-shadow: var(--shadow-3);
}
.btn--primary:hover { background: linear-gradient(135deg, #FF8F5E, var(--primary-d)); }
.btn--violet { background: linear-gradient(135deg, #9184FF, var(--violet)); border-color: transparent; color: #fff; box-shadow: 0 10px 26px rgba(124, 108, 247, .26); }
.btn--violet:hover { filter: brightness(1.03); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn--danger { color: var(--red); border-color: #F8CFC9; background: #FFF6F5; }
.btn--danger:hover { background: var(--red-l); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn--xs { height: 27px; padding: 0 9px; font-size: 12px; border-radius: 8px; }
.btn--lg { height: 48px; padding: 0 26px; font-size: 16px; border-radius: var(--r-lg); }
.btn--block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, .select, .textarea {
  height: 42px; padding: 0 13px; border-radius: var(--r-md);
  border: 1.5px solid var(--line-2); background: var(--surface);
  transition: border-color .16s, box-shadow .16s; width: 100%;
}
.textarea { height: auto; padding: 11px 13px; resize: vertical; min-height: 96px; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3.5px rgba(255, 138, 91, .14);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--ink-2);
  border: none; cursor: pointer; transition: background .15s, transform .15s;
}
button.chip:hover { background: #EFE6FF; }
button.chip:active { transform: scale(.97); }
button.chip::after { content: '▾'; font-size: 9px; opacity: .6; margin-left: 1px; }
.chip--gold { background: var(--gold-l); color: #B07B12; }
.chip--violet { background: var(--violet-l); color: #5B49D6; }
.chip--teal { background: var(--teal-l); color: #1B9184; }
.chip--pink { background: var(--pink-l); color: #D64A7B; }
.chip--red { background: var(--red-l); color: var(--red); }
.chip--green { background: var(--green-l); color: #23906A; }

.seg {
  display: inline-flex; padding: 3px; gap: 3px;
  background: var(--surface-3); border-radius: var(--r-md);
}
.seg button {
  height: 32px; padding: 0 15px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; color: var(--ink-2); transition: all .16s;
}
.seg button.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(93, 66, 50, .12); }

.divider { height: 1px; background: var(--line); margin: 18px 0; }

.empty {
  padding: 54px 20px; text-align: center; color: var(--ink-3); font-size: 14px;
}
.empty-emoji { font-size: 40px; margin-bottom: 10px; opacity: .8; }

/* --------------------------------- 骨架 ---------------------------------- */

#root { min-height: 100vh; }

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 224px; flex: 0 0 224px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  padding: 20px 14px 14px;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }
.brand__logo {
  width: 38px; height: 38px; border-radius: 12px; flex: 0 0 38px;
  background: linear-gradient(140deg, #FFB27A, #FF7A9C 55%, #8B7BF8);
  display: grid; place-items: center; font-size: 20px;
  box-shadow: 0 6px 16px rgba(255, 138, 91, .3);
}
.brand__name { font-size: 16.5px; font-weight: 800; letter-spacing: .02em; }
.brand__sub { font-size: 11px; color: var(--ink-3); letter-spacing: .06em; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__item {
  display: flex; align-items: center; gap: 10px;
  height: 42px; padding: 0 12px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 600; color: var(--ink-2);
  transition: background .15s, color .15s;
}
.nav__item:hover { background: var(--surface-3); color: var(--ink); }
.nav__item.is-active { background: var(--primary-l); color: var(--primary-d); }
.nav__item.is-active .nav__ico { transform: scale(1.08); }
.nav__ico { width: 20px; text-align: center; font-size: 16px; transition: transform .15s; }

/* ------------------------------- 班级列表 -------------------------------- */

.sidebar__foot { margin-top: auto; padding-top: 13px; border-top: 1px solid var(--line); }
.sidebar__foot-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; font-weight: 800; letter-spacing: .06em;
  color: var(--ink-3); padding: 0 3px 8px;
}
.sidebar__foot-count { font-weight: 700; opacity: .8; }

.class-list { display: flex; flex-direction: column; gap: 5px; max-height: 216px; overflow-y: auto; margin-bottom: 10px; }
.class-list::-webkit-scrollbar { width: 5px; }
.class-list__empty { font-size: 11.5px; color: var(--ink-3); line-height: 1.6; padding: 4px 4px 8px; }
.class-item {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 8px 9px; border-radius: var(--r-md);
  text-align: left; transition: background .15s, box-shadow .15s;
  border: 1.5px solid transparent;
}
.class-item:hover { background: var(--surface-3); }
.class-item.is-active {
  background: var(--primary-l); border-color: rgba(255, 138, 91, .3);
}
.class-item__dot {
  width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px;
  background: var(--line-2); transition: background .15s, box-shadow .15s;
}
.class-item.is-active .class-item__dot { background: var(--primary); box-shadow: 0 0 0 3px rgba(255, 138, 91, .2); }
.class-item__body { flex: 1; min-width: 0; }
.class-item__name {
  display: block; font-size: 13px; font-weight: 700; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.class-item.is-active .class-item__name { color: var(--primary-d); }
.class-item__meta {
  display: block; font-size: 10.5px; color: var(--ink-3); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 66px; flex: 0 0 66px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 26px; border-bottom: 1px solid var(--line);
  background: rgba(255, 248, 243, .86);
  backdrop-filter: saturate(1.4) blur(12px);
  position: sticky; top: 0; z-index: 30;
}
.topbar__title { font-size: 18px; font-weight: 800; letter-spacing: .01em; }
.topbar__sub { font-size: 12.5px; color: var(--ink-3); margin-left: 2px; }
.topbar__spacer { flex: 1; }

.page { padding: 24px 26px 60px; max-width: 1360px; width: 100%; }

.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { font-size: 21px; font-weight: 800; letter-spacing: .01em; }
.page-head p { font-size: 13px; color: var(--ink-3); margin-top: 3px; }
.page-head__actions { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; }

/* -------------------------------- 仪表盘 --------------------------------- */

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 13px; margin-bottom: 22px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 15px 17px; box-shadow: var(--shadow-1); position: relative; overflow: hidden;
}
.stat__label { font-size: 12.5px; color: var(--ink-3); font-weight: 600; letter-spacing: .03em; }
.stat__value { font-size: 27px; font-weight: 800; margin-top: 5px; letter-spacing: -.01em; line-height: 1.15; }
.stat__unit { font-size: 13px; font-weight: 600; color: var(--ink-3); margin-left: 3px; }
.stat__ico { position: absolute; right: 12px; top: 12px; font-size: 21px; opacity: .18; }
.stat--primary .stat__value { color: var(--primary-d); }
.stat--violet .stat__value { color: var(--violet); }
.stat--teal .stat__value { color: var(--teal); }
.stat--gold .stat__value { color: #D5961C; }

.toolbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap;
}
.search {
  height: 38px; width: 220px; padding: 0 13px 0 34px; border-radius: var(--r-md);
  border: 1.5px solid var(--line-2); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%23A79EB6' stroke-width='2.6' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.6-3.6'/%3E%3C/svg%3E") no-repeat 12px center;
  transition: border-color .16s, box-shadow .16s;
}
.search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3.5px rgba(255, 138, 91, .14); }
.toolbar__spacer { flex: 1; }

/* ------------------------------- 宠物墙 ---------------------------------- */

.pet-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(162px, 1fr));
}
.pet-grid--8 { grid-template-columns: repeat(8, minmax(0, 1fr)); }

.pet-card {
  position: relative; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--r-lg);
  padding: 12px 10px 11px; text-align: center;
  transition: transform .18s cubic-bezier(.34, 1.4, .64, 1), box-shadow .2s, border-color .2s;
  overflow: hidden;
}
.pet-card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(120% 80% at 50% 0%, rgba(255, 200, 160, .18), transparent 62%);
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
.pet-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: #FFD9C2; }
.pet-card:hover::after { opacity: 1; }
.pet-card.is-empty { border-style: dashed; background: var(--surface-2); }
.pet-card.is-selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255, 138, 91, .16); }
.pet-card__stage { position: absolute; top: 8px; left: 10px; }
.pet-card__rank {
  position: absolute; top: 8px; right: 9px; width: 21px; height: 21px;
  border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; color: #fff; background: var(--ink-3);
}
.pet-card__rank.r1 { background: linear-gradient(140deg, #FFD86B, #FFAE1F); }
.pet-card__rank.r2 { background: linear-gradient(140deg, #D6DEE9, #A8B6C6); }
.pet-card__rank.r3 { background: linear-gradient(140deg, #F2BE8A, #D08A4E); }
.pet-card__art { display: grid; place-items: center; height: 126px; margin: 2px 0 0; }
.pet-card__name { font-size: 14.5px; font-weight: 800; letter-spacing: .01em; }
.pet-card__pet { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; height: 16px; overflow: hidden; }
.pet-card__bar {
  height: 5px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 9px 4px 0;
}
.pet-card__bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #FFC48F, var(--primary)); transition: width .5s cubic-bezier(.4, 0, .2, 1); }
.pet-card__foot { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 7px; font-size: 11.5px; color: var(--ink-2); font-weight: 600; }
.pet-card__foot span { display: inline-flex; align-items: center; gap: 2px; }
.pet-card__feed {
  position: absolute; right: 7px; bottom: 7px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--gold-l); display: grid; place-items: center; font-size: 13px;
  opacity: 0; transition: opacity .16s, transform .16s; transform: scale(.85);
}
.pet-card:hover .pet-card__feed { opacity: 1; transform: scale(1); }
.pet-card__feed:hover { background: var(--gold); }

.pet-svg { display: block; overflow: visible; }
.pet-svg.is-hungry { filter: saturate(.6) brightness(.97); }
.pet-svg.is-idle { animation: petIdle 3.4s ease-in-out infinite; }
@keyframes petIdle {
  0%, 100% { transform: translateY(0) }
  50% { transform: translateY(-4px) }
}
.pet-mini { display: inline-grid; place-items: center; }

.hungry-flag {
  position: absolute; top: 8px; right: 34px; font-size: 12px;
  background: var(--red-l); color: var(--red); border-radius: 99px; padding: 1px 7px; font-weight: 700;
}

/* -------------------------------- 评分面板 -------------------------------- */

.modal-mask {
  position: fixed; inset: 0; background: rgba(46, 36, 42, .38);
  backdrop-filter: blur(3px); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.97) } to { opacity: 1; transform: none } }

.modal {
  background: var(--surface); border-radius: var(--r-xl);
  width: 100%; max-width: 560px; max-height: 88vh; overflow: auto;
  box-shadow: 0 24px 70px rgba(60, 40, 30, .26);
  animation: popIn .22s cubic-bezier(.34, 1.3, .64, 1);
}
.modal--wide { max-width: 760px; }
.modal__head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 22px 14px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--surface); z-index: 2; border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.modal__title { font-size: 17px; font-weight: 800; }
.modal__sub { font-size: 12.5px; color: var(--ink-3); }
.modal__close {
  margin-left: auto; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-size: 17px; color: var(--ink-3);
  transition: background .15s;
}
.modal__close:hover { background: var(--surface-3); color: var(--ink); }
.modal__body { padding: 18px 22px 22px; }
.modal__foot {
  display: flex; gap: 9px; justify-content: flex-end;
  padding: 14px 22px 20px; border-top: 1px solid var(--line);
  position: sticky; bottom: 0; background: var(--surface);
}

.score-student { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.score-student__name { font-size: 17px; font-weight: 800; }
.score-student__meta { font-size: 12.5px; color: var(--ink-3); }

.item-group { margin-bottom: 14px; }
.item-group__title {
  font-size: 12px; font-weight: 700; color: var(--ink-3); letter-spacing: .08em;
  margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.item-group__title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(119px, 1fr)); gap: 8px; }
.score-item {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 11px; border-radius: var(--r-md);
  border: 1.5px solid var(--line); background: var(--surface-2);
  text-align: left; transition: all .14s; position: relative;
}
.score-item:hover { border-color: var(--primary); background: #fff; transform: translateY(-1px); }
.score-item:active { transform: scale(.97); }
.score-item__ico { font-size: 15px; }
.score-item__name { font-size: 12.5px; font-weight: 700; flex: 1; line-height: 1.25; }
.score-item__val { font-size: 12px; font-weight: 800; color: var(--primary-d); }
.score-item--sub .score-item__val { color: var(--red); }
.score-item--sub:hover { border-color: #F6B7AE; }
.score-item.is-busy { opacity: .5; pointer-events: none; }

.quick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }

/* -------------------------------- 排行榜 --------------------------------- */

.rank-layout { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .rank-layout { grid-template-columns: 1fr; } }

.rank-list { display: flex; flex-direction: column; }
.rank-row {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--r-md); transition: background .15s;
}
.rank-row:hover { background: var(--surface-2); }
.rank-row__no {
  width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: var(--ink-3); background: var(--surface-3); flex: 0 0 24px;
}
.rank-row__no.top1 { background: linear-gradient(140deg, #FFDE7A, #FFB020); color: #fff; }
.rank-row__no.top2 { background: linear-gradient(140deg, #DEE6F0, #A9B8C9); color: #fff; }
.rank-row__no.top3 { background: linear-gradient(140deg, #F6C99B, #CE8B4C); color: #fff; }
.rank-row__name { font-size: 14px; font-weight: 700; min-width: 66px; }
.rank-row__bar { flex: 1; height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.rank-row__bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #FFD3A8, var(--primary)); }
.rank-row__val { font-size: 13px; font-weight: 800; color: var(--ink-2); min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; }

.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; align-items: end; }
.podium__item {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 12px 8px; text-align: center; box-shadow: var(--shadow-1);
}
.podium__item.first { padding-top: 18px; padding-bottom: 18px; background: linear-gradient(180deg, #FFFBF0, #fff); border-color: #FFE7B8; }
.podium__crown { font-size: 17px; }
.podium__name { font-size: 13.5px; font-weight: 800; margin-top: 3px; }
.podium__val { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }

/* --------------------------------- 商城 ---------------------------------- */

.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.shop-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 15px; box-shadow: var(--shadow-1); display: flex; flex-direction: column;
  transition: transform .16s, box-shadow .18s;
}
.shop-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.shop-card__top { display: flex; align-items: flex-start; gap: 10px; }
.shop-card__ico {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  font-size: 21px; background: var(--surface-3); flex: 0 0 42px;
}
.shop-card__name { font-size: 14.5px; font-weight: 800; line-height: 1.35; }
.shop-card__desc { font-size: 12px; color: var(--ink-3); margin-top: 3px; line-height: 1.45; min-height: 34px; }
.shop-card__foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.shop-card__cost { font-size: 14px; font-weight: 800; color: #D5961C; display: inline-flex; align-items: center; gap: 3px; }

/* --------------------------------- 表格 ---------------------------------- */

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-1); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; font-size: 13.5px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; font-weight: 700; color: var(--ink-3); letter-spacing: .04em; background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td.num { font-variant-numeric: tabular-nums; }

/* --------------------------------- 日志 ---------------------------------- */

.log-list { display: flex; flex-direction: column; }
.log-item { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px dashed var(--line); }
.log-item:last-child { border-bottom: none; }
.log-item__ico { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); font-size: 14px; flex: 0 0 30px; }
.log-item__main { flex: 1; min-width: 0; }
.log-item__title { font-size: 13px; font-weight: 700; }
.log-item__time { font-size: 11.5px; color: var(--ink-3); }
.log-item__val { font-size: 13.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.log-item__val.pos { color: var(--green); }
.log-item__val.neg { color: var(--red); }

/* --------------------------------- Toast --------------------------------- */

.toast-wrap { position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: rgba(46, 42, 59, .94); color: #fff; padding: 10px 18px; border-radius: 99px;
  font-size: 13.5px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
  animation: toastIn .24s cubic-bezier(.34, 1.4, .64, 1);
  display: flex; align-items: center; gap: 7px; max-width: 82vw;
}
.toast--ok { background: linear-gradient(135deg, #45C08A, #2FA277); }
.toast--err { background: linear-gradient(135deg, #F2705F, #DC4C3D); }
.toast--gold { background: linear-gradient(135deg, #FFD36E, #F0A317); color: #5C3E00; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.94) } to { opacity: 1; transform: none } }

/* --------------------------------- 登录 ---------------------------------- */

.login {
  min-height: 100vh; display: grid; grid-template-columns: 1.08fr .92fr;
  background: var(--bg);
}
.login__art {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center;
  padding: 56px 60px; background: linear-gradient(150deg, #FFF3E6 0%, #FFE9EF 46%, #EFEBFF 100%);
}
.login__art::before, .login__art::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(46px); opacity: .5;
}
.login__art::before { width: 320px; height: 320px; background: #FFC48F; top: -70px; right: -50px; }
.login__art::after { width: 280px; height: 280px; background: #B7A8FF; bottom: -70px; left: -40px; }
.login__slogan { font-size: 38px; font-weight: 900; line-height: 1.24; letter-spacing: -.01em; position: relative; z-index: 1; }
.login__slogan em { font-style: normal; background: linear-gradient(120deg, #FF7A3D, #FF5E8A 60%, #7C6CF8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login__desc { margin-top: 16px; font-size: 14.5px; color: var(--ink-2); max-width: 400px; line-height: 1.75; position: relative; z-index: 1; }
.login__pets { display: flex; gap: 6px; margin-top: 34px; position: relative; z-index: 1; }
.login__pets > div { animation: floatUp 4s ease-in-out infinite; }
.login__pets > div:nth-child(2) { animation-delay: .5s; }
.login__pets > div:nth-child(3) { animation-delay: 1s; }
.login__pets > div:nth-child(4) { animation-delay: 1.5s; }
@keyframes floatUp { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-9px) } }

.login__panel { display: flex; align-items: center; justify-content: center; padding: 40px 34px; background: var(--surface); }
.login__box { width: 100%; max-width: 360px; }
.login__tabs { display: flex; gap: 22px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.login__tab {
  padding: 0 2px 11px; font-size: 15px; font-weight: 700; color: var(--ink-3);
  border-bottom: 2.5px solid transparent; margin-bottom: -1px; transition: all .16s;
}
.login__tab.is-active { color: var(--ink); border-bottom-color: var(--primary); }
.login__hint { font-size: 12px; color: var(--ink-3); line-height: 1.6; margin-top: 12px; }

/* -------------------------------- 大屏模式 ------------------------------- */

.big {
  min-height: 100vh; background: linear-gradient(160deg, #FFF6EC, #FFF0F4 45%, #F1EEFF);
  padding: 22px 26px 30px; display: flex; flex-direction: column; gap: 16px;
}
.big__head { display: flex; align-items: center; gap: 14px; }
.big__title { font-size: 26px; font-weight: 900; letter-spacing: .01em; }
.big__sub { font-size: 13.5px; color: var(--ink-2); }
.big__grid {
  display: grid; gap: 12px; flex: 1; min-height: 0;
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
  grid-auto-rows: minmax(132px, 1fr);
  align-content: stretch;
}
.big__card {
  background: rgba(255, 255, 255, .82); border: 1.5px solid rgba(255, 255, 255, .9);
  border-radius: 22px; padding: 8px 8px 10px; text-align: center;
  box-shadow: 0 8px 24px rgba(120, 90, 70, .08);
  display: flex; flex-direction: column; align-items: stretch; justify-content: center;
  overflow: hidden;
  transition: transform .3s cubic-bezier(.34, 1.4, .64, 1), box-shadow .3s;
}
.big__art { flex: 1 1 auto; min-height: 0; display: grid; place-items: center; width: 100%; }
.big__art .pet-svg { width: 78%; height: auto; max-height: 100%; }
.big__card.is-bump { transform: scale(1.06); box-shadow: 0 14px 36px rgba(255, 138, 91, .3); }
.big__card.is-bump::after { content: ""; }
.big__name { font-size: 15px; font-weight: 800; }
.big__meta { font-size: 11.5px; color: var(--ink-3); }
.big__lv { font-size: 11px; font-weight: 800; color: var(--primary-d); background: var(--primary-l); border-radius: 99px; padding: 1px 8px; display: inline-block; }

.big-ticker {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px;
  background: rgba(255, 255, 255, .8); border-radius: 18px; overflow: hidden;
}
.big-ticker__label { font-size: 12.5px; font-weight: 800; color: var(--primary-d); white-space: nowrap; }
.big-ticker__track { flex: 1; overflow: hidden; position: relative; height: 22px; }
.big-ticker__inner { display: flex; gap: 34px; white-space: nowrap; animation: ticker 26s linear infinite; position: absolute; }
@keyframes ticker { from { transform: translateX(0) } to { transform: translateX(-50%) } }

/* ------------------------------ 小组排名条 -------------------------------- */

.group-strip {
  display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 16px;
  background: linear-gradient(120deg, #FFF7F2, #FBF7FF);
  border: 1px solid #FFE8DC; border-radius: var(--r-lg); box-shadow: var(--shadow-1);
}
.group-strip__head {
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  padding-right: 14px; border-right: 1px dashed #FFD8C6; min-width: 78px;
}
.group-strip__head b { font-size: 13px; font-weight: 900; color: var(--ink); }
.group-strip__head span { font-size: 10.5px; color: var(--ink-3); font-weight: 600; }
.group-strip__list { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; align-items: center; }
.group-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 12px 6px 8px; border-radius: 999px;
  background: #fff; border: 1.5px solid var(--line); box-shadow: 0 2px 8px rgba(180, 130, 100, .06);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.group-pill:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(180, 130, 100, .13); }
.group-pill.is-1 { border-color: #F5CE72; background: linear-gradient(120deg, #FFFCF0, #FFF6DC); }
.group-pill.is-2 { border-color: #DDE3EC; background: linear-gradient(120deg, #FBFCFE, #F3F6FA); }
.group-pill.is-3 { border-color: #EBD3BF; background: linear-gradient(120deg, #FFFBF7, #FBF1E8); }
.group-pill__medal { font-size: 15px; line-height: 1; }
.group-pill__name { font-size: 12.5px; font-weight: 800; color: var(--ink); }
.group-pill__val { font-size: 11px; font-weight: 700; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.group-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 14px 14px; border-radius: var(--r-lg);
  background: var(--surface); border: 1.5px solid var(--line); box-shadow: var(--shadow-1);
  min-width: 0;
}
.group-card.is-1 { border-color: #F5CE72; box-shadow: 0 12px 30px rgba(245, 206, 114, .22); }
.group-card.is-2 { border-color: #DDE3EC; }
.group-card.is-3 { border-color: #EBD3BF; }
.group-card__medal { font-size: 26px; line-height: 1; }
.group-card__name { font-size: 14.5px; font-weight: 900; color: var(--ink); text-align: center; }
.group-card__xp { font-size: 11.5px; font-weight: 700; color: var(--ink-3); }
.group-card__xp b { font-size: 17px; color: var(--primary-d); font-weight: 900; }
.group-card__pets { display: flex; justify-content: center; gap: -6px; margin-top: 2px; }
.group-card__pets > * { margin-left: -9px; }
.group-card__pets > *:first-child { margin-left: 0; }
.group-card__meta { font-size: 10.5px; color: var(--ink-3); font-weight: 600; text-align: center; }

.group-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 12px; margin-bottom: 16px; }

.member-dots { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; max-width: 100%; }
.member-dot {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #fff;
  background: linear-gradient(140deg, #FFB48C, var(--primary));
  border: 1.5px solid #fff; box-shadow: 0 1px 4px rgba(180, 130, 100, .18);
}

/* ------------------------------ 小组概览 -------------------------------- */

.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.mini-stat {
  background: var(--surface-3); border-radius: var(--r-md);
  padding: 12px 8px; text-align: center;
}
.mini-stat b { display: block; font-size: 22px; font-weight: 900; color: var(--ink); line-height: 1.2; }
.mini-stat span { font-size: 10.5px; color: var(--ink-3); font-weight: 700; }

.tip-box {
  background: #FFF9F0; border: 1px solid #FFE9CC; border-radius: var(--r-md);
  padding: 12px 14px;
}
.tip-box b { font-size: 12px; font-weight: 800; color: #C4801F; }
.tip-box p { font-size: 12px; color: #9A7B4E; line-height: 1.65; margin-top: 4px; }

.hint-line { font-size: 12px; color: var(--ink-3); line-height: 1.6; margin-top: 12px; }

.login__feats {
  display: flex; gap: 18px; margin-top: 34px; position: relative; z-index: 1;
  font-size: 12.5px; color: var(--ink-2); font-weight: 600;
}

/* -------------------------------- 工具页 --------------------------------- */

.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.tool-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-1); }
.tool-card h3 { font-size: 15px; font-weight: 800; margin-bottom: 4px; }
.tool-card p { font-size: 12.5px; color: var(--ink-3); margin-bottom: 14px; line-height: 1.55; }

.picker-result {
  min-height: 92px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--surface-3), var(--surface-2));
  border-radius: var(--r-lg); font-size: 30px; font-weight: 900; letter-spacing: .04em;
  margin: 12px 0; border: 1px dashed var(--line-2); transition: all .2s;
}
.picker-result.is-rolling { color: var(--ink-3); }
.picker-result.is-done { background: linear-gradient(140deg, #FFF3D6, #FFE8D6); border-color: #FFD9A8; color: var(--primary-d); animation: popIn .3s; }

.timer-display {
  font-size: 46px; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums;
  letter-spacing: .02em; margin: 12px 0; color: var(--ink);
}
.timer-display.is-warn { color: var(--red); }

/* -------------------------------- 响应式 --------------------------------- */

.mobile-only { display: none; }

@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login__art { display: none; }
  .login__panel { min-height: 100vh; }

  .app { flex-direction: column; }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: auto; width: auto;
    flex-direction: row; padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
    border-right: none; border-top: 1px solid var(--line); z-index: 50;
    justify-content: space-around; gap: 0;
  }
  .brand, .sidebar__foot { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav__item {
    flex-direction: column; gap: 2px; height: auto; padding: 6px 4px; font-size: 10.5px;
    flex: 1; border-radius: 12px; letter-spacing: 0;
  }
  .nav__ico { font-size: 17px; width: auto; }
  .nav__item.is-active { background: transparent; color: var(--primary-d); }

  .mobile-only { display: flex; }
  .mobile-hide { display: none !important; }
  #btnBig { display: none; }
  .topbar { height: auto; min-height: 58px; padding: 8px 14px; flex-wrap: wrap; gap: 8px; }
  .topbar__title { font-size: 16px; }
  .page { padding: 16px 14px 96px; }
  .pet-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .pet-card__art { height: 96px; }
  .rank-layout { grid-template-columns: 1fr; }
  .modal { max-height: 92vh; }
  .modal__body { padding: 14px 16px 18px; }
  .item-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .stat-row { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .shop-grid { grid-template-columns: 1fr; }
  .big__grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

@media (max-width: 420px) {
  .pet-grid { grid-template-columns: repeat(2, 1fr); }
}
