:root {
  --bg: #eef1f8;
  --panel: #ffffff;
  --text: #2c3344;
  --muted: #8a93a6;
  --line: #e6eaf2;
  --accent: #6b4ad6;
  --accent-2: #3d7cff;
  --green: #069b71;
  --danger: #e85d5d;
  --shell: #11131a;
  --radius: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 58px;
  --side-w: 72px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: linear-gradient(160deg, #1a1d29 0%, #0d0f16 45%, #171a24 100%);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; border: 0; background: none; color: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }

.phone-shell {
  min-height: 100%;
  display: flex;
  justify-content: center;
  padding: 16px 12px calc(16px + var(--safe-bottom));
}
.app {
  width: min(430px, 100%);
  min-height: calc(100vh - 32px);
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(107, 74, 214, 0.18), transparent 55%),
    var(--bg);
  border-radius: 22px;
  overflow: hidden;
  position: relative;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.06),
    0 28px 60px rgba(0,0,0,0.45);
  padding-bottom: calc(var(--tabbar-h) + 8px + var(--safe-bottom));
}

/* Top */
.topbar {
  position: relative;
  color: #fff;
  overflow: hidden;
}
.topbar-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(110deg, rgba(45, 88, 220, 0.92), rgba(98, 52, 180, 0.95)),
    url("../assets/img/top_area_bg-w1ddLS2U.png") center/cover;
  opacity: 1;
}
.topbar-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 12px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #000;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.1;
}
.brand-bal {
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  opacity: 0.95;
}
.brand-bal em { font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; }
.icon-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  color: #fff;
  line-height: 18px;
  font-size: 12px;
}
.top-actions { display: flex; gap: 6px; flex-shrink: 0; }
.top-actions .act {
  width: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: #fff;
  font-size: 11px;
}
.top-actions .act img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

/* Notice */
.notice {
  margin: 8px 10px 0;
  background: #fff;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  box-shadow: 0 2px 10px rgba(40, 50, 90, 0.06);
}
.notice-tag {
  flex-shrink: 0;
  background: linear-gradient(135deg, #6b4ad6, #3d7cff);
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
}
.notice-track {
  overflow: hidden;
  flex: 1;
  min-width: 0;
}
.notice-track p {
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
  animation: marquee 14s linear infinite;
}
@keyframes marquee {
  0% { transform: translateX(0); }
  20% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* Banner */
.banner {
  margin: 10px 10px 0;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  aspect-ratio: 16 / 7.2;
  background: #dfe5f3;
  box-shadow: 0 6px 18px rgba(50, 60, 100, 0.08);
}
.banner-track {
  display: flex;
  height: 100%;
  transition: transform 0.45s ease;
  will-change: transform;
}
.banner-slide {
  flex: 0 0 100%;
  height: 100%;
}
.banner-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.banner-dots {
  position: absolute;
  left: 0; right: 0; bottom: 8px;
  display: flex;
  justify-content: center;
  gap: 5px;
}
.banner-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.55);
  transition: 0.2s;
}
.banner-dots span.on {
  width: 14px;
  border-radius: 999px;
  background: #fff;
}

/* Quick */
.quick-row {
  margin: 10px 10px 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.quick {
  background: var(--panel);
  border-radius: 14px;
  padding: 10px 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 10px rgba(40, 50, 90, 0.05);
  transition: transform 0.15s ease;
}
.quick:active { transform: scale(0.96); }
.quick img { width: 30px; height: 30px; object-fit: contain; }
.quick span { font-size: 12px; color: #4a5568; }

/* Game area */
.game-box {
  margin: 12px 8px 0;
  display: flex;
  gap: 8px;
  min-height: 420px;
  align-items: flex-start;
}
.side-menu {
  width: var(--side-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 8px;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  scrollbar-width: none;
  padding-bottom: 12px;
}
.side-menu::-webkit-scrollbar { display: none; }

.side-item {
  width: 100%;
  border-radius: 14px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f4f6fb 100%);
  border: 1px solid rgba(255,255,255,0.8);
  box-shadow: 0 3px 10px rgba(40, 50, 90, 0.06);
  padding: 10px 4px 8px;
  text-align: center;
  color: #6b7385;
  transition: 0.18s ease;
}
.side-item .ico {
  width: 34px;
  height: 34px;
  margin: 0 auto 4px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, #a8b0c4, #7f889c);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.08);
}
.side-item span {
  display: block;
  font-size: 12px;
  line-height: 1.2;
}
.side-item.active {
  color: #fff;
  background: linear-gradient(160deg, #7a57e8 0%, #4f74f0 100%);
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(79, 116, 240, 0.35);
  transform: translateY(-1px);
}
.side-item.active .ico {
  background: rgba(255,255,255,0.2);
  box-shadow: none;
}

.game-panel {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,0.55);
  border-radius: 16px;
  padding: 8px 6px 18px;
  backdrop-filter: blur(6px);
}
.game-toolbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 2px 6px 8px;
}
.game-toolbar h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.game-toolbar span {
  font-size: 12px;
  color: var(--muted);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 8px;
}
.game-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 6px;
}

.game-card {
  position: relative;
  text-align: center;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 14px rgba(40, 50, 90, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}
.game-card:active {
  transform: scale(0.97);
}
.game-card .cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: linear-gradient(145deg, #eceff7, #d9deec);
}
.game-card .badge {
  position: absolute;
  top: 6px;
  right: 6px;
  max-width: 42%;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 10px;
  line-height: 1.3;
  backdrop-filter: blur(4px);
}
.game-card .name {
  padding: 7px 6px 9px;
  font-size: 12px;
  color: #3a4254;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.empty {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 40px 10px;
}

/* Tabbar */
.tabbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 6px 4px calc(6px + var(--safe-bottom));
  background: rgba(255,255,255,0.96);
  border-top: 1px solid var(--line);
  display: flex;
  backdrop-filter: blur(10px);
  z-index: 20;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #8b93a5;
  font-size: 11px;
}
.tab.active { color: var(--accent); font-weight: 600; }
.tab.highlight { color: var(--green); }
.tab-ico {
  width: 22px;
  height: 22px;
  object-fit: contain;
  margin-bottom: 2px;
}
.quick .icon-rebate {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

/* 视口固定：红包雨 */
.red-packet {
  position: fixed;
  right: max(12px, calc(50% - 215px + 12px));
  bottom: calc(var(--tabbar-h) + 78px + var(--safe-bottom));
  width: 68px;
  height: 78px;
  z-index: 9990;
  background: url("../assets/img/red-packet.png") center/100% 100% no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  cursor: pointer;
}
.red-packet .grab {
  margin-top: 18px;
  width: 32px;
  height: 18px;
  background: url("../assets/img/grab.png") center/100% 100% no-repeat;
  animation: pulse 0.45s linear infinite;
}
@keyframes pulse {
  25% { transform: scale(1.08); }
  50% { transform: scale(1.16); }
  75% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* 视口固定：客服悬浮球（始终在屏幕右下角） */
.cs-float {
  position: fixed;
  right: max(14px, calc(50% - 215px + 14px));
  bottom: calc(var(--tabbar-h) + 14px + var(--safe-bottom));
  z-index: 9991;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(145deg, #5b8cff 0%, #6b4ad6 100%);
  box-shadow: 0 10px 24px rgba(79, 116, 240, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  animation: csBob 2.4s ease-in-out infinite;
  cursor: pointer;
}
.cs-float-icon {
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.cs-float-text {
  font-size: 9px;
  opacity: 0.92;
  line-height: 1;
}
.cs-float-dot {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.9);
}
@keyframes csBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@media (max-width: 480px) {
  .red-packet,
  .cs-float {
    right: 12px;
  }
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%) translateY(12px);
  background: rgba(20, 24, 36, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  max-width: min(86vw, 360px);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: 0.22s ease;
  z-index: 9999;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 480px) {
  .phone-shell { padding: 0; }
  .app {
    width: 100%;
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
  }
}
