/* 12 款游戏选单 + 排行榜页面（和游戏同一种卡通风格：米白卡片、深棕粗边） */
:root { --ink: #3b2a20; --cream: #fff6e0; --sky: #2a9fd6; --gold: #ffd23d; --red: #e8452c; --green: #5fc35f; --blue: #4fc3ff; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif; color: var(--ink);
  background: radial-gradient(circle at 50% 0%, #7fd3ff 0%, #2a9fd6 55%, #1b6fa8 100%) fixed;
  padding: max(14px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(30px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
button { font: inherit; color: inherit; cursor: pointer; }
.wrap { max-width: 1000px; margin: 0 auto; }
h1 { text-align: center; color: #fff; font-size: clamp(24px, 5vw, 34px); margin: 4px 0 2px; text-shadow: 0 3px 0 var(--ink), 0 0 2px var(--ink); letter-spacing: 1px; }
.sub { text-align: center; color: #e8f8ff; margin: 0 0 14px; font-size: 15px; }
h2 { margin: 22px 0 10px; color: #fff; font-size: 20px; text-shadow: 0 2px 0 var(--ink); }
.card { background: var(--cream); border: 4px solid var(--ink); border-radius: 22px; box-shadow: 0 6px 0 rgba(0,0,0,.25); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 8px 18px; border: 4px solid var(--ink); border-radius: 18px;
  background: var(--gold); font-weight: 800; font-size: 18px; box-shadow: 0 5px 0 rgba(0,0,0,.25); transition: transform .06s; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.btn.green { background: var(--green); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.btn.blue { background: var(--blue); }
.btn.white { background: #fff; }
.btn.small { min-height: 40px; padding: 4px 12px; font-size: 16px; border-width: 3px; border-radius: 14px; }
.btn[disabled], .btn.off { opacity: .45; pointer-events: none; }
.big { font-size: 24px; min-height: 64px; padding: 10px 28px; border-radius: 22px; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; background: var(--ink); color: #fff; border-radius: 8px; padding: 2px 7px; margin-left: 6px; vertical-align: middle; }
.muted { color: #8a6a4a; font-size: 14px; }
.ava { width: 52px; height: 52px; flex: none; border-radius: 50%; border: 3px solid var(--ink); background-color: #ffe9b0; background-repeat: no-repeat; background-size: 190%; background-position: 50% 4%; }
.ava.s { width: 40px; height: 40px; border-width: 2px; }
.ava.l { width: 72px; height: 72px; }

/* ---------- 选单 ---------- */
.me { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 16px; }
.me .who { flex: 1 1 220px; min-width: 0; }
.me .nick { font-size: 22px; font-weight: 800; }
.me .code { font-size: 15px; margin-top: 2px; }
.me .code b { font-size: 20px; letter-spacing: 3px; background: #fff; border: 2px dashed var(--ink); border-radius: 8px; padding: 0 8px; }
.me .opts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
select { font: inherit; font-size: 16px; min-height: 44px; border: 3px solid var(--ink); border-radius: 12px; padding: 4px 8px; background: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
a.game { display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--ink); padding: 14px 16px; min-height: 104px; transition: transform .08s; }
a.game:hover { transform: translateY(-3px); } a.game:active { transform: translateY(3px); }
.icon { font-size: 40px; width: 62px; height: 62px; flex: none; display: grid; place-items: center; border-radius: 18px; background: var(--c, var(--gold)); border: 3px solid var(--ink); }
.t { font-size: 20px; font-weight: 800; }
.d { font-size: 14px; margin-top: 3px; color: #6a5040; line-height: 1.35; }
.best { font-size: 14px; margin-top: 4px; font-weight: 700; color: #2f7d3a; }
.best.none { color: #a07a5a; font-weight: 400; }
.note { margin: 22px 0 0; color: #e8f8ff; font-size: 14px; line-height: 1.6; }

/* ---------- 排行榜页面 ---------- */
.top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.top .title { flex: 1 1 200px; display: flex; align-items: center; gap: 12px; color: #fff; font-size: clamp(22px, 5vw, 30px); font-weight: 800; text-shadow: 0 3px 0 var(--ink); min-width: 0; }
.hero-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding: 14px 16px; margin-top: 12px; }
.hero-row .info { flex: 1 1 240px; min-width: 0; }
.hero-row .info .l1 { font-size: 15px; }
.hero-row .info .l2 { font-size: 22px; font-weight: 800; margin-top: 2px; }
.tabs { display: flex; gap: 8px; margin: 16px 0 10px; flex-wrap: wrap; }
.tab { flex: 1 1 0; min-width: 110px; min-height: 48px; border: 4px solid var(--ink); border-radius: 16px; background: rgba(255,255,255,.55); font-weight: 800; font-size: 17px; }
.tab.on { background: var(--cream); box-shadow: 0 4px 0 rgba(0,0,0,.2); }
.seg { display: flex; gap: 8px; margin: 0 0 10px; }
.seg button { flex: 1; min-height: 44px; border: 3px solid var(--ink); border-radius: 14px; background: rgba(255,255,255,.6); font-weight: 800; font-size: 16px; }
.seg button.on { background: var(--gold); }
.panel { padding: 8px 10px; }
.row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 2px dashed rgba(59,42,32,.18); min-height: 60px; }
.row:last-child { border-bottom: 0; }
/* 公布排行榜：名次一行一行跳出来 */
@keyframes rowIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.panel.reveal .row { animation: rowIn .38s cubic-bezier(.2,1.4,.4,1) both; }
.panel.reveal .row:nth-child(1) { animation-delay: .35s; } .panel.reveal .row:nth-child(2) { animation-delay: .43s; } .panel.reveal .row:nth-child(3) { animation-delay: .51s; }
.panel.reveal .row:nth-child(4) { animation-delay: .57s; } .panel.reveal .row:nth-child(5) { animation-delay: .62s; } .panel.reveal .row:nth-child(n+6) { animation-delay: .66s; }
.panel.reveal .row.me { animation: rowIn .38s cubic-bezier(.2,1.4,.4,1) .8s both, meGlow 1.2s ease 1.2s 2; }
@keyframes meGlow { 50% { box-shadow: 0 0 0 4px #ffd23d; } }
@media (prefers-reduced-motion: reduce) { .panel.reveal .row { animation: none !important; } }
.row.me { background: #fff1b8; border-radius: 14px; border-bottom-color: transparent; }
.rank { width: 42px; flex: none; text-align: center; font-weight: 900; font-size: 20px; }
.rank.r1 { color: #e0a000; font-size: 26px; } .rank.r2 { color: #8c9aa8; font-size: 24px; } .rank.r3 { color: #b8763a; font-size: 22px; }
.row .nm { flex: 1 1 auto; min-width: 0; font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sc { flex: none; font-weight: 800; font-size: 17px; text-align: right; }
.gap { text-align: center; color: #8a6a4a; padding: 4px; font-weight: 800; letter-spacing: 4px; }
.empty { text-align: center; padding: 22px 10px; color: #8a6a4a; font-size: 16px; line-height: 1.6; }
.msg { padding: 10px 6px; border-bottom: 2px dashed rgba(59,42,32,.18); display: flex; gap: 10px; align-items: center; }
.msg:last-child { border-bottom: 0; }
.msg .txt { flex: 1; min-width: 0; font-size: 16px; line-height: 1.45; }
.msg .when { font-size: 12px; color: #a07a5a; }
.sec { font-weight: 800; font-size: 18px; margin: 10px 4px 2px; }

/* ---------- 选对手（底部弹出的面板）---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(16,24,42,.55); z-index: 50; display: none; }
.sheet { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: min(760px, 100%); max-height: 92vh; overflow: auto; z-index: 51; display: none;
  background: var(--cream); border: 4px solid var(--ink); border-bottom: 0; border-radius: 26px 26px 0 0; padding: 14px 14px max(16px, env(safe-area-inset-bottom)); }
.sheet.open, .sheet-bg.open { display: block; }
.sheet h3 { margin: 2px 0 10px; font-size: 22px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.slot { position: relative; border: 4px dashed var(--ink); border-radius: 18px; padding: 8px 10px; min-height: 76px; display: flex; align-items: center; gap: 8px; background: #fff; cursor: pointer; text-align: left; }
.slot.on { border-style: solid; box-shadow: 0 0 0 4px var(--gold); }
.slot.full { border-style: solid; background: #fff8dc; }
.slot .lb { font-size: 13px; color: #8a6a4a; }
.slot .nn { font-weight: 800; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot .x { position: absolute; top: -12px; right: -10px; width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--ink); background: #fff; font-weight: 900; line-height: 1; }
.addf { display: flex; gap: 8px; margin: 6px 0 4px; flex-wrap: wrap; }
.addf input { flex: 1 1 140px; min-height: 48px; font: inherit; font-size: 20px; letter-spacing: 4px; text-transform: uppercase; border: 3px solid var(--ink); border-radius: 14px; padding: 4px 12px; }
.foot { display: flex; gap: 10px; justify-content: space-between; margin-top: 12px; flex-wrap: wrap; position: sticky; bottom: -16px; background: var(--cream); padding: 8px 0 4px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 14px; font-size: 16px; z-index: 80; max-width: 92vw; text-align: center; display: none; }
.toast.on { display: block; }
@media (max-width: 520px) {
  .row .sc { font-size: 15px; } .row .nm { font-size: 16px; } .rank { width: 32px; font-size: 18px; }
  .ava { width: 44px; height: 44px; }
}

/* 首页：我的好友 */
.friends { margin-top: 10px; padding: 12px 14px; }
.friends .fhead { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 18px; }
.friends .fnew { margin: 8px 0 2px; padding: 8px 12px; background: #fff1b8; border: 2px solid #ffd23d; border-radius: 12px; font-weight: 700; animation: rowIn .4s cubic-bezier(.2,1.4,.4,1) both; }
.friends .flist { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.friends .fchip { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: 2px 12px 2px 3px; font-weight: 700; font-size: 15px; }
