:root {
  --primary: #df9a1c;
  --primary-2: #e8a01d;
  --bg: #f5f5f5;
  --card: #fff;
  --text: #333;
  --muted: #999;
  --nav: #9b9b9b;
  --line: #cecece;
  --danger: #ff4a4a;
  --ok: #04be01;
  --max: 480px;
  --tab: 62px;
  --frame: #e6e6e6;
  --chip: #f7f7f7;
  --soft: #fff4e0;
  --soft-text: #9a6a10;
  --banner-bg: linear-gradient(180deg, #fff4d8, #f3c56a);
  --banner-text: #9a6a10;
  --close-bg: #f3f3f3;
  --close-text: #666;
  --label: #666;
  --menu-line: #f3f3f3;
  --tab-line: #f0f0f0;
  --logo-bg: #fff;
  --bar: linear-gradient(180deg, var(--primary-2), var(--primary));
  --bar-solid: var(--primary-2);
  --on-bar: #fff;
  --accent-bg: linear-gradient(180deg, var(--primary-2), var(--primary));
  --on-accent: #fff;
  --raise-shadow: 0 4px 10px rgba(223, 154, 28, 0.35);
  --icon-on: brightness(0) invert(1);
}

html[data-skin="dark"] {
  color-scheme: dark;
  --primary: #f0c059;
  --primary-2: #c9963a;
  --bg: #1c1e23;
  --card: #202329;
  --text: #fff;
  --muted: #adb6c3;
  --nav: #68707b;
  --line: #313843;
  --danger: #ea4e3d;
  --ok: #04be02;
  --frame: #0c0d10;
  --chip: #141417;
  --soft: #2a2418;
  --soft-text: #f0c059;
  --banner-bg: linear-gradient(180deg, #3a3120, #141417);
  --banner-text: #f0c059;
  --close-bg: #313843;
  --close-text: #adb6c3;
  --label: #adb6c3;
  --menu-line: #313843;
  --tab-line: #313843;
  --logo-bg: transparent;
  --bar: #141417;
  --bar-solid: #141417;
  --on-bar: #fff;
  --accent-bg: linear-gradient(180deg, #f0c059, #c9963a);
  --on-accent: #874404;
  --raise-shadow: 0 4px 10px rgba(240, 192, 89, 0.28);
  --icon-on: brightness(0);
}
html[data-skin="dark"] .pill-solid {
  background: var(--primary);
  color: var(--on-accent);
  border-color: var(--primary);
}
html[data-skin="dark"] .recover-card strong { color: var(--primary); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--frame);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}
button, input { font-family: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }

#app {
  width: min(100%, var(--max));
  min-height: 100%;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 12px;
  background: var(--bar);
  color: var(--on-bar);
}
.logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--logo-bg);
}
.topbar h1 {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 600;
}
.top-actions { display: flex; flex: none; gap: 8px; margin-left: auto; }
.pill, .pill-solid {
  height: 28px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid #fff;
  background: transparent;
  color: #fff;
  font-size: 13px;
}
.pill-solid { background: #fff; color: var(--primary); border-color: #fff; }
.session-box { margin-left: auto; text-align: right; line-height: 1.2; }
.session-box b { display: block; font-size: 13px; }
.session-box span { font-size: 12px; opacity: 0.95; }
.back {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--on-bar);
  font-size: 22px;
}

.page { padding: 10px 12px 16px; }
.page.with-tab { padding-bottom: calc(var(--tab) + 16px); }

.banner {
  display: grid;
  place-items: center;
  width: 100%;
  height: 148px;
  border: 0;
  border-radius: 12px;
  background: var(--banner-bg);
  color: var(--banner-text);
}
.banner strong {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 4px;
}

.marquee {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 0 10px;
  height: 32px;
  border-radius: 8px;
  background: var(--card);
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
}
.marquee b { color: var(--primary); flex: none; }
.marquee p { margin: 0; white-space: nowrap; animation: slide 14s linear infinite; }
@keyframes slide {
  from { transform: translateX(20%); }
  to { transform: translateX(-100%); }
}

.menu-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--on-bar);
}
.current-cat { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.drawer-mask {
  position: fixed;
  z-index: 70;
  top: 0;
  bottom: 0;
  left: 50%;
  width: min(100%, var(--max));
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.45);
}
.drawer {
  width: min(78%, 320px);
  height: 100%;
  padding: 14px 14px 28px;
  overflow: auto;
  background: var(--card);
  color: var(--text);
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-head img { width: 42px; height: 42px; border-radius: 10px; }
.drawer-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--close-bg);
  color: var(--close-text);
  font-size: 22px;
  line-height: 1;
}
.drawer-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0;
  padding: 12px;
  border-radius: 12px;
  background: var(--bar);
  color: var(--on-bar);
}
.drawer-user b { display: block; }
.drawer-user span { font-size: 12px; }
.drawer h3 { margin: 8px 0; font-size: 14px; font-weight: 600; }
.drawer-cats, .drawer-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.drawer-cats button, .drawer-links button {
  border: 0;
  border-radius: 10px;
  padding: 8px 4px;
  background: var(--chip);
  color: var(--text);
  font-size: 12px;
}
.drawer-cats img { width: 26px; height: 20px; margin: 0 auto 4px; object-fit: contain; }
.drawer-cats button.on {
  background: var(--accent-bg);
  color: var(--on-accent);
  font-weight: 600;
}
.drawer-cats button.on img { filter: var(--icon-on); }
.drawer-links { margin-bottom: 8px; }
.drawer-links button { height: 40px; }

.search {
  display: flex;
  margin-top: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}
.search input {
  flex: 1;
  height: 36px;
  border: 0;
  outline: none;
  padding: 0 14px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 10px;
  gap: 8px;
}
.card { position: relative; }
.play {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
}
.card > button:first-child,
.cover {
  position: relative;
  width: 100%;
}
.card img,
.game-fallback {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 10px;
  background: var(--soft);
}
.group-title { margin: 14px 0 0; font-size: 15px; font-weight: 600; }
.game-fallback {
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--soft-text);
  text-align: center;
  padding: 8px;
}
.card span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fav {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 14px;
}
.fav.on { color: #ffd76a; }

.empty {
  margin-top: 28px;
  text-align: center;
  color: var(--muted);
}
.empty strong {
  display: block;
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 18px;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(100%, var(--max));
  height: var(--tab);
  transform: translateX(-50%);
  background: var(--card);
  border-top: 1px solid var(--tab-line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  border: 0;
  background: transparent;
  color: var(--nav);
  font-size: 11px;
}
.tabbar button.on { color: var(--primary); }
.tabbar svg { display: block; margin: 0 auto 2px; }
.tab-raise {
  position: relative;
  top: -14px;
}
.tab-raise i {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin: 0 auto 2px;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--on-accent);
  box-shadow: var(--raise-shadow);
}

.auth {
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bar-solid) 0 132px, var(--bg) 132px);
}
.auth-head {
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 8px;
  color: var(--on-bar);
}
.auth-card {
  margin: 12px;
  padding: 22px 16px 18px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}
.brand {
  width: 72px;
  height: 72px;
  margin: 0 auto 8px;
  border-radius: 16px;
}
.auth-card h2 { margin: 0 0 16px; text-align: center; font-size: 20px; }
.field { margin-bottom: 12px; }
.field label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--label); }
.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: var(--card);
  color: var(--text);
  font-size: 15px;
}
.field input:focus { border-color: var(--primary); }
.pwd { position: relative; }
.pwd input { padding-right: 64px; }
.pwd button {
  position: absolute;
  top: 0;
  right: 0;
  height: 42px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
}
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0 14px; font-size: 13px; color: var(--label); }
.submit {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 22px;
  background: var(--accent-bg);
  color: var(--on-accent);
  font-size: 16px;
}
.form-error { min-height: 18px; margin: 0 0 8px; color: var(--danger); font-size: 13px; }
.switch { margin: 14px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
.note { margin: 10px 0 0; text-align: center; font-size: 12px; color: var(--muted); }

.mine-head {
  margin: -10px -12px 12px;
  padding: 18px 16px 20px;
  background: var(--bar);
  color: var(--on-bar);
}
.who { display: flex; align-items: center; gap: 12px; }
.avatar {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  font-size: 22px;
  font-weight: 700;
}
.who p { margin: 4px 0 0; font-size: 13px; opacity: 0.9; }
.balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 14px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
  font: inherit;
  text-align: left;
}
.recover-card {
  margin-bottom: 12px;
  padding: 18px 16px;
  border-radius: 12px;
  background: var(--bar);
  color: var(--on-bar);
}
.recover-card p { margin: 0; font-size: 13px; opacity: 0.9; }
.recover-card strong { display: block; margin-top: 6px; font-size: 28px; }
.recover-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 14px;
  font-size: 14px;
}
.recover-btn { margin-top: 16px; }
.recover-btn:disabled { opacity: 0.7; }
.guest-actions { display: flex; gap: 8px; margin-top: 14px; }
.menu {
  overflow: hidden;
  border-radius: 12px;
  background: var(--card);
}
.menu button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 14px;
  border: 0;
  border-bottom: 1px solid var(--menu-line);
  background: transparent;
  color: var(--text);
  font-size: 15px;
}
.menu button:last-child { border-bottom: 0; }
.logout {
  width: 100%;
  height: 44px;
  margin-top: 16px;
  border: 0;
  border-radius: 22px;
  background: var(--card);
  color: var(--danger);
  font-size: 15px;
}

.mask {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.45);
}
.dialog {
  width: min(100%, 320px);
  padding: 16px;
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  text-align: center;
}
.dialog img {
  width: 120px;
  height: 160px;
  margin: 0 auto 10px;
  object-fit: cover;
  border-radius: 10px;
}
.dialog h3 { margin: 0 0 8px; }
.dialog p { margin: 0 0 14px; color: var(--primary); font-size: 18px; font-weight: 700; }

.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 50;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 13px;
}
.enter-mask {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  text-align: center;
}
.enter-mask strong {
  display: block;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 2px;
}
.enter-mask span {
  display: block;
  margin-top: 12px;
  font-size: 18px;
  font-weight: 600;
}

.soon-mark {
  width: 72px;
  height: 72px;
  margin: 48px auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--primary);
  font-size: 28px;
}
