/* ==========================================================================
   夺宝 H5 —— 配色取自 云购 demo-ui.html（TG Mini App 暗色）
   基础组件（按钮/卡片/表格/输入框）来自同目录 app.css，这里只做移动端外壳与夺宝件
   ========================================================================== */

:root {
  --tg-bg: #0f0f0f;
  --tg-2: #1a1a1a;
  --tg-3: #242424;
  --tg-text: #ffffff;
  --tg-hint: #8e8e93;
  --tg-link: #0a84ff;
  --tg-btn: #0a84ff;
  --tg-ok: #22c55e;
  --tg-bad: #ef4444;
}

body.h5 {
  background: var(--tg-bg);
  color: var(--tg-text);
  -webkit-tap-highlight-color: transparent;
}

.h5-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  background: var(--tg-bg);
  border-left: 1px solid #1c1c1e;
  border-right: 1px solid #1c1c1e;
}

/* ---------------------------------------------------------------- 顶栏 */
.h5-top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(15, 15, 15, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #1c1c1e;
}
.h5-logo {
  font-weight: 700;
  font-size: 17px;
  color: var(--tg-text);
}
.h5-logo span { color: var(--tg-btn); }
.h5-top-r { display: flex; align-items: center; gap: 10px; }
.h5-credit {
  font-size: 12px;
  color: var(--tg-hint);
  background: var(--tg-2);
  border: 1px solid #2c2c2e;
  border-radius: 999px;
  padding: 3px 10px;
}
.h5-credit b { color: var(--tg-btn); font-size: 13px; }
.h5-top-link { font-size: 13px; color: var(--tg-link); }

/* ---------------------------------------------------------------- 主体 */
.h5-main {
  flex: 1;
  padding: 14px 14px calc(72px + env(safe-area-inset-bottom));
}

/* ---------------------------------------------------------------- 底部 Tab */
.h5-tab {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  display: flex;
  background: rgba(26, 26, 26, .96);
  backdrop-filter: blur(10px);
  border-top: 1px solid #2c2c2e;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 30;
}
.h5-tab a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 0 8px;
  color: var(--tg-hint);
  font-size: 11px;
  text-decoration: none;
}
.h5-tab a i { font-style: normal; font-size: 18px; line-height: 1; }
.h5-tab a.active { color: var(--tg-btn); }

/* ---------------------------------------------------------------- 英雄区 */
.hero {
  background: linear-gradient(150deg, #10213f 0%, #0f1b33 45%, #141414 100%);
  border: 1px solid #23304a;
  border-radius: 16px;
  padding: 18px 16px 16px;
  margin-bottom: 14px;
}
.hero-badge {
  display: inline-block;
  font-size: 11px;
  color: var(--tg-ok);
  background: rgba(34, 197, 94, .12);
  border: 1px solid rgba(34, 197, 94, .35);
  border-radius: 999px;
  padding: 2px 9px;
  margin-bottom: 10px;
}
.hero h1 { margin: 0 0 6px; font-size: 24px; line-height: 1.25; }
.hero-sub { margin: 0 0 14px; font-size: 13px; line-height: 1.65; color: var(--tg-hint); }
.hero-sub b { color: var(--tg-btn); }
.hero-acts { display: flex; flex-direction: column; gap: 8px; }
.hero-acts .btn { padding: 11px 14px; font-size: 14px; border-radius: 12px; }
.hero-acts .btn.primary { background: var(--tg-btn); border-color: var(--tg-btn); }
.hero-acts .btn.primary:hover { background: #0a78e0; border-color: #0a78e0; }
.hero-acts .btn:not(.primary) {
  background: rgba(255, 255, 255, .06);
  border-color: #333;
}
.hero-stat {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  font-size: 12px;
  color: var(--tg-hint);
}
.hero-stat b { color: var(--tg-text); font-size: 14px; }
.hero-stat .dotsep { opacity: .4; }

/* ---------------------------------------------------------------- 分段 Tab */
.tabs {
  display: flex;
  gap: 6px;
  background: var(--tg-2);
  border: 1px solid #2c2c2e;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 12px;
}
.tabs button {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--tg-hint);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.tabs button.active { background: var(--tg-btn); color: #fff; font-weight: 600; }

/* ---------------------------------------------------------------- 期次卡片 */
.round-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.round-card {
  display: block;
  background: var(--tg-2);
  border: 1px solid #2c2c2e;
  border-radius: 14px;
  padding: 14px;
  color: inherit;
  text-decoration: none;
}
.round-card:hover { border-color: #3a3a3c; text-decoration: none; }
.round-top { display: flex; gap: 12px; align-items: center; }
.round-cover {
  width: 58px;
  height: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  border-radius: 12px;
  background: var(--tg-3);
  overflow: hidden;
}
.round-cover img { width: 100%; height: 100%; object-fit: cover; }
.round-info { flex: 1; min-width: 0; }
.round-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.round-meta { font-size: 12px; color: var(--tg-hint); display: flex; gap: 8px; flex-wrap: wrap; }
.round-no { color: var(--tg-btn); }
.round-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #2c2c2e;
  font-size: 12px;
  color: var(--tg-hint);
}
.round-foot .go { color: var(--tg-btn); font-weight: 600; }
.round-badge {
  font-size: 11px;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--tg-3);
  color: var(--tg-hint);
}
.round-badge.open { background: rgba(10, 132, 255, .16); color: #4da3ff; }
.round-badge.lock { background: rgba(240, 198, 116, .14); color: #f0c674; }
.round-badge.draw { background: rgba(34, 197, 94, .16); color: var(--tg-ok); }
.round-badge.soon { background: rgba(255, 255, 255, .08); color: var(--tg-hint); }

/* 进度条 */
.prog { height: 6px; border-radius: 999px; background: var(--tg-3); overflow: hidden; margin-top: 10px; }
.prog i { display: block; height: 100%; background: var(--tg-btn); border-radius: 999px; transition: width .3s; }

/* ---------------------------------------------------------------- 中奖榜 */
.winner-list { display: flex; flex-direction: column; gap: 2px; }
.winner-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #232325;
  font-size: 13px;
}
.winner-row:last-child { border-bottom: none; }
.winner-row .w-prize { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.winner-row .w-nick { color: var(--tg-hint); }
.winner-row .w-no { color: var(--tg-ok); font-weight: 600; }

/* ---------------------------------------------------------------- 期次详情 */
.back { display: inline-block; font-size: 13px; color: var(--tg-link); margin-bottom: 10px; }
.detail-cover {
  height: 170px;
  border-radius: 16px;
  background: var(--tg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  overflow: hidden;
  margin-bottom: 14px;
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.detail-title { margin: 0 0 6px; font-size: 20px; }
.kv-rows { display: flex; flex-direction: column; gap: 9px; font-size: 13px; }
.kv-rows div { display: flex; justify-content: space-between; gap: 12px; }
.kv-rows dt, .kv-rows .k { color: var(--tg-hint); }
.kv-rows .v { text-align: right; word-break: break-all; }
.kv-rows .v.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

.my-tickets { display: flex; flex-wrap: wrap; gap: 8px; }
.ticket {
  min-width: 44px;
  text-align: center;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(10, 132, 255, .16);
  border: 1px solid rgba(10, 132, 255, .4);
  color: #4da3ff;
  font-weight: 700;
  font-size: 15px;
}
.ticket.win { background: rgba(34, 197, 94, .18); border-color: rgba(34, 197, 94, .5); color: var(--tg-ok); }

.join-bar {
  position: sticky;
  bottom: calc(64px + env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  background: rgba(26, 26, 26, .96);
  backdrop-filter: blur(10px);
  border: 1px solid #2c2c2e;
  border-radius: 14px;
  z-index: 20;
}
.join-bar .btn { flex: 1; padding: 12px; font-size: 15px; border-radius: 12px; }

/* 公平性验证块 */
.fair {
  background: var(--tg-2);
  border: 1px dashed #3a3a3c;
  border-radius: 12px;
  padding: 12px;
  font-size: 12px;
  color: var(--tg-hint);
  line-height: 1.7;
  word-break: break-all;
}
.fair code {
  display: block;
  margin-top: 6px;
  padding: 8px;
  background: #101010;
  border-radius: 8px;
  color: #9cc3ff;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11.5px;
  white-space: pre-wrap;
}
.fair .ok { color: var(--tg-ok); }
.fair .no { color: var(--tg-bad); }

/* ---------------------------------------------------------------- 我的 */
.me-head {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--tg-2);
  border: 1px solid #2c2c2e;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
}
.me-avatar {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tg-btn), #6d5cff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
}
.me-nick { font-size: 16px; font-weight: 600; }
.me-sub { font-size: 12px; color: var(--tg-hint); margin-top: 3px; }
.me-sub b { color: var(--tg-text); }
.me-count { margin-left: auto; text-align: center; }
.me-count b { display: block; font-size: 26px; line-height: 1.1; color: var(--tg-btn); }
.me-count span { font-size: 11px; color: var(--tg-hint); }

.bind-list { display: flex; flex-direction: column; gap: 10px; }
.bind-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--tg-2);
  border: 1px solid #2c2c2e;
  border-radius: 12px;
  padding: 12px;
}
.bind-t { font-size: 14px; font-weight: 600; }
.bind-d { font-size: 12px; color: var(--tg-hint); margin-top: 3px; }
.bind-d.done { color: var(--tg-ok); }
.bind-item .btn { margin-left: auto; flex-shrink: 0; }

.entry-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #232325;
  font-size: 13px;
}
.entry-row:last-child { border-bottom: none; }
.entry-no {
  min-width: 46px;
  text-align: center;
  padding: 4px 6px;
  border-radius: 8px;
  background: var(--tg-3);
  color: var(--tg-hint);
  font-weight: 700;
}
.entry-no.win { background: rgba(34, 197, 94, .18); color: var(--tg-ok); }
.entry-mid { flex: 1; min-width: 0; }
.entry-mid .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-mid .s { font-size: 11px; color: var(--tg-hint); margin-top: 2px; }

.grant-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #232325;
  font-size: 13px;
}
.grant-row:last-child { border-bottom: none; }
.grant-row .g-amt { color: var(--tg-ok); font-weight: 700; min-width: 34px; }
.grant-row .g-note { flex: 1; min-width: 0; color: var(--tg-hint); }
.grant-row .g-time { font-size: 11px; color: #6b7280; }

/* 扫码页在 H5 下的微调 */
body.h5 .login-page { min-height: auto; padding: 0; display: block; }
body.h5 .card { background: var(--tg-2); border-color: #2c2c2e; }
body.h5 .btn { background: var(--tg-3); border-color: #333; }
body.h5 .btn.primary { background: var(--tg-btn); border-color: var(--tg-btn); }
body.h5 input, body.h5 select { background: #101010; border-color: #333; }
body.h5 .h5-top + .h5-main .head h2 { font-size: 20px; }

@media (max-width: 400px) {
  .h5-main { padding: 12px 10px calc(72px + env(safe-area-inset-bottom)); }
  .hero h1 { font-size: 21px; }
}

/* ---------------------------------------------------------------- 轻提示 */
.yg-toast {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  z-index: 90;
  max-width: 82vw;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(34, 197, 94, .95);
  color: #04240f;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transition: .25s;
  pointer-events: none;
  text-align: center;
}
.yg-toast.err { background: rgba(239, 68, 68, .96); color: #fff; }
.yg-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   抽奖首页 / 砍一刀 / 好友助力
   ========================================================================== */

/* 顶栏：语言切换 */
.h5-lang {
  font-size: 12px;
  color: var(--tg-hint);
  background: var(--tg-2);
  border: 1px solid #2c2c2e;
  border-radius: 999px;
  padding: 3px 9px;
  line-height: 1.4;
}
.h5-lang:hover { color: var(--tg-text); border-color: #3a3a3c; }

/* 抽奖主按钮区 */
.hero-box {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #2c2c2e;
  border-radius: 16px;
  background: linear-gradient(180deg, #171717, #121212);
}
.hero-count {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--tg-hint);
  font-size: 13px;
}
.hero-count b {
  font-size: 30px;
  font-weight: 800;
  color: var(--tg-text);
  font-variant-numeric: tabular-nums;
}
.btn.big { padding: 13px 16px; font-size: 16px; border-radius: 14px; font-weight: 700; }
.hero-box .btn + .btn { margin-top: 8px; }
.hero-box .btn.block { border: 1px solid #333; }
#btn-draw.is-empty { opacity: .65; }
.hero-limit { margin-top: 8px; text-align: center; font-size: 12px; color: var(--tg-hint); }

/* 返回链接 */
.back-link {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--tg-link);
}

/* 奖品池 */
.pool-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.pool-item {
  background: #141414;
  border: 1px solid #2c2c2e;
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}
.pool-cover {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  overflow: hidden;
}
.pool-cover img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }
.pool-title {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--tg-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pool-meta { margin-top: 3px; font-size: 11px; color: var(--tg-hint); }

/* 中奖头 */
.win-head { display: flex; gap: 14px; align-items: center; margin: 6px 0 16px; }
.win-cover {
  width: 76px; height: 76px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 38px;
  background: var(--tg-2);
  border: 1px solid #2c2c2e;
  border-radius: 16px;
  overflow: hidden;
}
.win-cover img { width: 100%; height: 100%; object-fit: cover; }
.win-head-i { min-width: 0; }
.win-head-i .cap { font-size: 12px; color: var(--tg-hint); }
.win-head-i h1 { margin: 4px 0 8px; font-size: 19px; line-height: 1.3; word-break: break-word; }

/* 砍一刀卡片 */
.cut-card { padding: 16px; }
.cut-head {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 13px; color: var(--tg-hint); margin-bottom: 8px;
}
.cut-head b { font-size: 22px; font-weight: 800; color: var(--tg-text); font-variant-numeric: tabular-nums; }
.prog.big { height: 14px; border-radius: 999px; background: #101010; border: 1px solid #2c2c2e; }
.prog.big i { display: block; height: 100%; background: linear-gradient(90deg, #22c55e, #a3e635); border-radius: 999px; transition: width .4s; }
.cut-tip { margin-top: 10px; font-size: 13px; color: var(--tg-hint); min-height: 18px; }
.cut-acts { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.cut-helpers { margin-top: 18px; padding-top: 14px; border-top: 1px dashed #2c2c2e; }
.cut-helpers .cap { font-size: 13px; color: var(--tg-hint); }
.cut-help-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.cut-help-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; background: #141414; border: 1px solid #2c2c2e; border-radius: 10px;
  font-size: 13px;
}
.cut-help-row.me { border-color: rgba(10, 132, 255, .5); }
.ch-av {
  width: 22px; height: 22px; border-radius: 50%;
  background: #2c2c2e; color: var(--tg-text);
  display: flex; align-items: center; justify-content: center; font-size: 11px;
}
.ch-nick { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-pct { color: var(--tg-bad); font-weight: 700; font-variant-numeric: tabular-nums; }

.cut-share { margin-top: 16px; }
.cut-link { display: flex; gap: 8px; margin-top: 8px; }
.cut-link input {
  flex: 1; min-width: 0; padding: 9px 10px; font-size: 12px;
  background: #101010; border: 1px solid #333; border-radius: 10px; color: var(--tg-hint);
}
.cut-link .btn { flex: none; }

/* 我的中奖行 */
.win-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; background: #141414; border: 1px solid #2c2c2e;
  border-radius: 12px; margin-bottom: 8px;
  text-decoration: none; color: inherit;
}
.win-row-cover {
  width: 44px; height: 44px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; background: var(--tg-2); border-radius: 10px; overflow: hidden;
}
.win-row-cover img { width: 100%; height: 100%; object-fit: cover; }
.win-row-mid { flex: 1; min-width: 0; }
.win-row-title {
  font-size: 14px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.win-row-meta { margin-top: 4px; font-size: 11px; color: var(--tg-hint); }
.win-row .prog { margin-top: 6px; }

/* 好友助力页 */
.help-head { text-align: center; padding: 22px 0 6px; }
.help-av {
  width: 64px; height: 64px; margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; background: var(--tg-2); border: 1px solid #2c2c2e; border-radius: 50%;
}
.help-head h1 { margin: 0; font-size: 21px; }
.help-head p { margin: 8px 0 0; font-size: 13px; color: var(--tg-hint); }
.help-state {
  margin-top: 14px; padding: 12px 14px; text-align: center;
  background: rgba(34, 197, 94, .12); border: 1px solid rgba(34, 197, 94, .4); border-radius: 12px;
}
.help-state-t { font-size: 16px; font-weight: 700; color: var(--tg-ok); }
.help-state-s { margin-top: 4px; font-size: 13px; color: var(--tg-hint); }
.help-head .win-head { justify-content: center; }

/* H5 弹层 */
.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 22px;
  background: rgba(0, 0, 0, .6);
}
.modal-card {
  width: 100%; max-width: 340px;
  background: var(--tg-2); border: 1px solid #2c2c2e;
  border-radius: 18px; padding: 22px 18px 18px;
  text-align: center;
}
.yg-modal-icon { font-size: 44px; line-height: 1; }
.modal-card h3 { margin: 12px 0 0; font-size: 18px; word-break: break-word; }
.modal-card p { margin: 8px 0 0; font-size: 13px; color: var(--tg-hint); line-height: 1.55; }
.yg-modal-acts { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
body.h5 .modal-card .btn.block { border: 1px solid #333; }
body.h5 .modal-card .btn.primary { border-color: var(--tg-btn); }
