:root {
  --bg: #05060d;
  --bg-soft: #0a0d1a;
  --panel: rgba(16, 21, 40, 0.72);
  --panel-solid: #101528;
  --line: rgba(120, 160, 255, 0.18);
  --line-strong: rgba(120, 200, 255, 0.38);
  --neon: #39e6ff;
  --neon-2: #a86bff;
  --neon-3: #ff5ea8;
  --ok: #35e08b;
  --warn: #ffc857;
  --danger: #ff5f6d;
  --text: #e9f1ff;
  --muted: #8b98ba;
  --radius: 18px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  --tabbar-h: 66px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
  font-size: 15px;
  line-height: 1.55;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(760px 460px at 12% -8%, rgba(57, 230, 255, 0.22), transparent 62%),
    radial-gradient(720px 520px at 92% 4%, rgba(168, 107, 255, 0.24), transparent 60%),
    radial-gradient(620px 520px at 50% 108%, rgba(255, 94, 168, 0.16), transparent 62%),
    linear-gradient(180deg, #05060d 0%, #070a16 45%, #05060d 100%);
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(120, 180, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 180, 255, 0.06) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 22%, #000 0%, transparent 76%);
}

a {
  color: var(--neon);
  text-decoration: none;
}

.app {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 18px calc(var(--tabbar-h) + 28px);
}

/* ---------------------------------------------------------------- 顶栏 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  font-size: 14px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--neon), var(--neon-2));
  box-shadow: 0 0 18px rgba(57, 230, 255, 0.55);
  position: relative;
}

.brand-mark::after {
  content: '';
  position: absolute;
  inset: 7px;
  border-radius: 5px;
  border: 2px solid rgba(5, 6, 13, 0.85);
}

.brand span {
  background: linear-gradient(90deg, #fff, #9fe6ff 60%, #cbb4ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(16, 21, 40, 0.7);
  font-size: 12px;
  color: var(--muted);
  max-width: 46vw;
}

.user-chip b {
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 10px var(--ok);
  flex: 0 0 auto;
}

/* ---------------------------------------------------------------- 通用块 */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  padding: 18px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 26px 2px 12px;
}

.section-title h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.04em;
}

.section-title .sub {
  font-size: 12px;
  color: var(--muted);
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border-radius: 22px;
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(420px 220px at 88% 8%, rgba(168, 107, 255, 0.4), transparent 62%),
    radial-gradient(360px 220px at 4% 96%, rgba(57, 230, 255, 0.32), transparent 60%),
    linear-gradient(150deg, rgba(20, 27, 52, 0.95), rgba(9, 12, 24, 0.92));
  box-shadow: var(--shadow);
}

.hero .tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--neon);
  border: 1px solid rgba(57, 230, 255, 0.4);
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(57, 230, 255, 0.08);
}

.hero h1 {
  margin: 14px 0 6px;
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: 0.01em;
}

.hero h1 em {
  font-style: normal;
  background: linear-gradient(92deg, var(--neon), var(--neon-2) 55%, var(--neon-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.hero-actions {
  display: flex;
  gap: 10px;
}

/* ---------------------------------------------------------------- 按钮 */
.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  border-radius: 14px;
  padding: 13px 20px;
  color: #05060d;
  background: linear-gradient(120deg, var(--neon), #7ac8ff 45%, var(--neon-2));
  box-shadow: 0 10px 26px rgba(57, 230, 255, 0.28);
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
  flex: 1;
  text-align: center;
}

.btn:active {
  transform: scale(0.975);
}

a.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn:disabled {
  filter: grayscale(0.6) brightness(0.8);
  cursor: not-allowed;
  box-shadow: none;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

.btn.block {
  display: block;
  width: 100%;
}

.btn.small {
  padding: 9px 14px;
  font-size: 13px;
  border-radius: 11px;
  flex: 0 0 auto;
}

/* ---------------------------------------------------------------- 表单 */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 7px;
  letter-spacing: 0.03em;
}

.field input,
.field select {
  width: 100%;
  padding: 14px 15px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(8, 11, 22, 0.9);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  appearance: none;
}

.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) calc(50% + 2px), calc(100% - 15px) calc(50% + 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.field input:focus,
.field select:focus {
  border-color: var(--neon);
  box-shadow: 0 0 0 3px rgba(57, 230, 255, 0.16);
}

.field .hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.form-foot {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 16px;
}

.alert {
  display: none;
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 13px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}

.alert.show {
  display: block;
}

.alert.error {
  color: #ffd0d5;
  background: rgba(255, 95, 109, 0.12);
  border-color: rgba(255, 95, 109, 0.4);
}

.alert.success {
  color: #c8ffe4;
  background: rgba(53, 224, 139, 0.12);
  border-color: rgba(53, 224, 139, 0.38);
}

/* ---------------------------------------------------------------- 游戏卡 */
.game-list {
  display: grid;
  gap: 14px;
}

.game-card {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  transition: transform 0.14s ease, border-color 0.2s ease;
}

.game-card:active {
  transform: scale(0.99);
}

.game-card .thumb {
  position: relative;
  flex: 0 0 96px;
  height: 68px;
  border-radius: 13px;
  overflow: hidden;
  background: linear-gradient(135deg, #16223f, #241040);
  border: 1px solid var(--line);
}

.game-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.game-card .thumb.soon::after {
  content: '敬请期待';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #cbb4ff;
  background: rgba(5, 6, 13, 0.72);
  letter-spacing: 0.08em;
}

.game-card .meta {
  min-width: 0;
  flex: 1;
}

.game-card .meta h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.game-card .meta p {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.chip.on {
  color: var(--neon);
  border-color: rgba(57, 230, 255, 0.42);
  background: rgba(57, 230, 255, 0.08);
}

.game-card .go {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--neon);
  border: 1px solid rgba(57, 230, 255, 0.42);
  background: rgba(57, 230, 255, 0.08);
  border-radius: 11px;
  padding: 8px 12px;
}

.game-card.disabled {
  opacity: 0.62;
}

.game-card.disabled .go {
  color: var(--muted);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.03);
}

/* -------------------------------------------------------------- 排行榜 */
.board-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  scrollbar-width: none;
}

.board-tabs::-webkit-scrollbar {
  display: none;
}

.board-tabs button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.board-tabs button.active {
  color: #05060d;
  font-weight: 700;
  border-color: transparent;
  background: linear-gradient(120deg, var(--neon), var(--neon-2));
  box-shadow: 0 8px 20px rgba(57, 230, 255, 0.25);
}

.rank-list {
  display: grid;
  gap: 10px;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.rank-row .no {
  flex: 0 0 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  color: #05060d;
  background: linear-gradient(135deg, #9fb4d8, #d7e3f7);
}

.rank-row.r1 {
  border-color: rgba(255, 200, 87, 0.5);
  box-shadow: 0 0 0 1px rgba(255, 200, 87, 0.18), var(--shadow);
}

.rank-row.r1 .no {
  background: linear-gradient(135deg, #ffd66e, #ffb02e);
}

.rank-row.r2 .no {
  background: linear-gradient(135deg, #e2ecff, #b6c6e2);
}

.rank-row.r3 .no {
  background: linear-gradient(135deg, #ffb98a, #e0854f);
}

.rank-row .who {
  flex: 1;
  min-width: 0;
}

.rank-row .who b {
  display: block;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-row .who span {
  font-size: 11px;
  color: var(--muted);
}

.rank-row .score {
  text-align: right;
  flex: 0 0 auto;
}

.rank-row .score b {
  display: block;
  font-size: 17px;
  color: var(--neon);
  text-shadow: 0 0 16px rgba(57, 230, 255, 0.45);
}

.rank-row .score span {
  font-size: 11px;
  color: var(--muted);
}

.empty {
  text-align: center;
  padding: 30px 16px;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: 16px;
}

/* ---------------------------------------------------------------- 底栏 */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--tabbar-h);
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(8, 11, 22, 0.86);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
  z-index: 20;
}

.tabbar a,
.tabbar button {
  flex: 1;
  max-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  text-decoration: none;
  cursor: pointer;
  border-radius: 12px;
}

.tabbar .ico {
  font-size: 17px;
  line-height: 1;
}

.tabbar .active {
  color: var(--neon);
  text-shadow: 0 0 14px rgba(57, 230, 255, 0.5);
}

.site-footer {
  margin-top: 30px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

/* ---------------------------------------------------------------- 游玩页 */
.player-page {
  padding: 0;
}

/* 游玩页采用上下分栏：控制条占位在上，游戏画面占满剩余空间，二者互不覆盖 */
.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  height: 100vh;
  background: #05060d;
}

.stage iframe {
  display: block;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  border: 0;
}

.stage-top {
  flex: 0 0 auto;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: rgba(5, 6, 13, 0.92);
  border-bottom: 1px solid var(--line);
}

.stage-top .back {
  border: 1px solid var(--line-strong);
  background: rgba(8, 11, 22, 0.7);
  color: var(--text);
  border-radius: 11px;
  padding: 7px 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.stage-top .state {
  flex: 1;
  text-align: right;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-top .state b {
  color: var(--ok);
}

.stage-top .state.warn b {
  color: var(--warn);
}

.stage-top .state.bad b {
  color: var(--danger);
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: none;
  place-items: center;
  padding: 22px;
  background: rgba(3, 4, 10, 0.82);
  backdrop-filter: blur(6px);
}

.overlay.show {
  display: grid;
}

.result {
  width: 100%;
  max-width: 340px;
  text-align: center;
  padding: 22px;
  border-radius: 20px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(160deg, rgba(20, 27, 52, 0.96), rgba(9, 12, 24, 0.96));
  box-shadow: var(--shadow);
}

.result h3 {
  margin: 0 0 4px;
  font-size: 19px;
}

.result .big {
  font-size: 40px;
  font-weight: 800;
  margin: 8px 0 2px;
  background: linear-gradient(92deg, var(--neon), var(--neon-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.result .grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0;
}

.result .grid div {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 9px 6px;
  background: rgba(255, 255, 255, 0.03);
}

.result .grid b {
  display: block;
  font-size: 16px;
}

.result .grid span {
  font-size: 11px;
  color: var(--muted);
}

.result .note {
  font-size: 12px;
  color: var(--muted);
  min-height: 18px;
  margin-bottom: 14px;
}

.result .actions {
  display: flex;
  gap: 10px;
}

.spinner {
  width: 26px;
  height: 26px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 3px solid rgba(57, 230, 255, 0.2);
  border-top-color: var(--neon);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  left: 50%;
  transform: translate(-50%, -20px);
  z-index: 60;
  max-width: 86vw;
  padding: 11px 16px;
  border-radius: 13px;
  font-size: 13px;
  color: var(--text);
  background: rgba(14, 19, 36, 0.96);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.ok {
  border-color: rgba(53, 224, 139, 0.5);
}

.toast.err {
  border-color: rgba(255, 95, 109, 0.55);
}

.skeleton {
  height: 84px;
  border-radius: 16px;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.reveal {
  animation: rise 0.4s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
