/* ===================== 设计令牌 ===================== */
:root {
  --bg: #fff6ea;            /* 明亮暖奶油 */
  --bg-soft: #ffeeda;
  --surface: #ffffff;
  --surface-2: #fff6ec;
  --line: #f2dcc0;
  --text: #40270f;          /* 深暖棕文字 */
  --text-soft: #9a7452;
  --primary: #ff7a1a;       /* 篮球橙 */
  --primary-600: #e8650a;
  --accent: #f59e0b;        /* 暖橙金 */
  --gold: #f0a500;
  --danger: #ef4658;
  --radius: 16px;
  --shadow: 0 10px 28px rgba(224, 122, 26, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255, 165, 0, 0.18), transparent 60%),
    radial-gradient(1000px 500px at -10% 110%, rgba(255, 122, 26, 0.14), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  min-height: 100%;
}

/* ===================== 顶部导航 ===================== */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px clamp(16px, 4vw, 48px);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.logo { display: flex; align-items: center; gap: 12px; }
.logo-ball {
  width: 34px; height: 34px; border-radius: 50%;
  background:
    radial-gradient(circle at 32% 30%, #ffb066, var(--primary) 55%, var(--primary-600));
  position: relative;
  box-shadow: inset 0 -4px 8px rgba(0,0,0,.25);
}
.logo-ball::before,
.logo-ball::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(0,0,0,.35);
}
.logo-ball::before { clip-path: inset(0 49% 0 49%); }
.logo-ball::after { clip-path: inset(49% 0 49% 0); }
.logo-text { font-size: 20px; font-weight: 800; letter-spacing: .5px; }

.tabs { display: flex; gap: 8px; background: var(--surface); padding: 5px; border-radius: 999px; border: 1px solid var(--line); }
.tab-btn {
  border: none; background: transparent; color: var(--text-soft);
  font-size: 15px; font-weight: 700; padding: 9px 20px; border-radius: 999px;
  cursor: pointer; transition: all .2s;
}
.tab-btn.is-active { background: var(--primary); color: #2a1400; box-shadow: 0 4px 12px rgba(255,122,26,.4); }

/* ===================== 主区 / 视图 ===================== */
.site-main {
  padding: clamp(10px, 2vh, 20px) clamp(12px, 4vw, 40px);
  max-width: 1180px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.5vh, 16px);
}
.view { display: none; animation: fade .35s ease; }
.view.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 转盘区占据剩余空间并垂直居中 */
.view[aria-label="转盘抽奖"] {
  flex: 1;
  display: none;
}
.view[aria-label="转盘抽奖"].is-active { display: flex; }
.play-single {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  flex: 1;
}
.play-single .wheel-card { width: 100%; max-width: 560px; }
/* 后台中奖记录：颜色点与奖项名并排 */
#historyTableBody .cell-color {
  display: inline-block; vertical-align: middle;
  width: 14px; height: 14px; margin-right: 8px;
}

/* ===================== 球星主视觉 ===================== */
.hero {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin-bottom: 0;
  min-height: clamp(96px, 16vh, 170px);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.hero-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 30%;
}
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(42,18,6,.9) 0%, rgba(42,18,6,.55) 45%, rgba(42,18,6,.2) 100%);
}
.hero-content { position: relative; padding: clamp(14px, 3vw, 34px); max-width: 640px; }
.hero-title {
  font-size: clamp(22px, 4.5vw, 38px);
  font-weight: 900;
  letter-spacing: 1px;
  text-shadow: 0 4px 18px rgba(0,0,0,.5);
  background: linear-gradient(90deg, var(--gold), var(--primary));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub {
  margin-top: 6px;
  font-size: clamp(14px, 2.4vw, 19px);
  color: #fff6ea;
  font-weight: 800;
  text-shadow: 0 2px 10px rgba(0,0,0,.7);
}
.hero-note {
  margin-top: 6px;
  font-size: clamp(11px, 1.8vw, 14px);
  color: #ffe3bd;
  font-weight: 600;
  text-shadow: 0 2px 8px rgba(0,0,0,.7);
}

/* 体育元素装饰条 */
.sports-strip {
  border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line);
  margin-bottom: 0;
  line-height: 0;
  background: var(--surface);
  flex-shrink: 0;
}
.sports-strip img { width: 100%; height: clamp(40px, 7vh, 72px); object-fit: cover; display: block; }

/* 剩余次数提示 */
.quota-tip {
  text-align: center; margin-top: 14px;
  font-size: 14px; font-weight: 700;
  color: var(--primary-600);
  background: rgba(255,165,0,.12);
  border: 1px solid rgba(255,165,0,.35);
  border-radius: 999px; padding: 8px 16px;
  display: inline-block; width: 100%;
}
.quota-tip.is-out { color: var(--danger); background: rgba(239,70,88,.12); border-color: rgba(239,70,88,.4); }

/* ===================== 转盘卡片 ===================== */
.wheel-card, .history-card, .admin-card {
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 30px);
}

.wheel-stage {
  position: relative;
  width: min(74vw, 44vh, 420px);
  aspect-ratio: 1;
  margin: 0 auto;
}
.wheel-wrap {
  position: absolute; inset: 0;
  border-radius: 50%;
  padding: 12px;
  background: linear-gradient(145deg, var(--gold), #b8860b);
  box-shadow: 0 0 0 6px rgba(255,255,255,.06), var(--shadow);
}
#wheel {
  width: 100%; height: 100%;
  display: block; border-radius: 50%;
  background: var(--surface);
  transition: transform 5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 指针 */
.wheel-pointer {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0; z-index: 6;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-top: 38px solid var(--danger);
  filter: drop-shadow(0 4px 5px rgba(0,0,0,.4));
}

/* 中心按钮 */
.spin-center {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 24%; aspect-ratio: 1; border-radius: 50%;
  border: 5px solid #fff;
  background: radial-gradient(circle at 35% 30%, #ffb066, var(--primary) 60%, var(--primary-600));
  color: #2a1400; font-weight: 900; font-size: clamp(13px, 2.4vw, 17px);
  cursor: pointer; z-index: 7;
  box-shadow: 0 6px 16px rgba(0,0,0,.4);
  transition: transform .15s;
}
.spin-center:hover { transform: translate(-50%, -50%) scale(1.05); }
.spin-center:active { transform: translate(-50%, -50%) scale(0.96); }
.spin-center:disabled { cursor: not-allowed; filter: grayscale(.4) brightness(.9); }
.spin-center-text { line-height: 1.15; }

.wheel-tip { text-align: center; color: var(--text-soft); margin-top: 12px; font-size: 14px; }

/* ===================== 历史记录 ===================== */
.history-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.history-head h2 { font-size: 18px; }
.history-list { list-style: none; display: flex; flex-direction: column; gap: 10px; max-height: 460px; overflow-y: auto; }
.history-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 14px;
  animation: fade .3s ease;
}
.history-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.history-main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.history-name { font-weight: 700; }
.history-acct { color: var(--text-soft); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-time { color: var(--text-soft); font-size: 12px; flex-shrink: 0; }
.history-empty { color: var(--text-soft); text-align: center; padding: 30px 10px; font-size: 14px; }

/* ===================== 登录卡片 ===================== */
.login-card {
  max-width: 400px;
  margin: clamp(20px, 6vh, 64px) auto 0;
  text-align: center;
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(26px, 4vw, 40px);
}
.login-icon {
  width: 64px; height: 64px; margin: 0 auto 14px;
  border-radius: 50%; display: grid; place-items: center; font-size: 28px;
  background: radial-gradient(circle at 35% 30%, #ffb066, var(--primary) 60%, var(--primary-600));
  box-shadow: 0 6px 16px rgba(255,122,26,.4);
}
.login-card h2 { font-size: 22px; }
.login-form { display: flex; flex-direction: column; gap: 16px; margin-top: 22px; text-align: left; }
.login-error { color: var(--danger); font-size: 13px; font-weight: 600; margin: -4px 0 0; }
.login-submit { margin-top: 4px; }
.login-back {
  display: inline-block; margin-top: 18px;
  color: var(--text-soft); font-size: 14px; text-decoration: none;
}
.login-back:hover { color: var(--text); }

/* ===================== 后台配置 ===================== */
.admin-head { margin-bottom: 20px; }
.admin-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.admin-head h2 { font-size: 20px; }
.admin-sub { color: var(--text-soft); font-size: 14px; margin-top: 6px; }

.prize-form {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px; margin-bottom: 22px;
}
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 160px; }
.field-sm { min-width: 90px; flex: 0 0 auto; }
.field label { font-size: 13px; color: var(--text-soft); font-weight: 600; }
.field input {
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font-size: 15px; width: 100%;
}
.field input[type="color"] { padding: 4px; height: 42px; cursor: pointer; }
.field input:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; }

/* 开关字段 & 保存提示 */
.switch-field {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 600; color: var(--text);
  cursor: pointer; align-self: center; min-width: 220px;
}
.switch-field input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--primary); cursor: pointer; }
.save-hint { align-self: center; color: var(--accent); font-weight: 700; font-size: 14px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
.prize-table { width: 100%; border-collapse: collapse; min-width: 460px; }
.prize-table th, .prize-table td {
  text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px;
}
.prize-table th { color: var(--text-soft); font-weight: 700; }
.cell-color { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); }
.prob-bar { display: flex; align-items: center; gap: 8px; }
.prob-track { flex: 1; height: 7px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; min-width: 60px; }
.prob-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.weight-input {
  width: 72px; background: var(--bg-soft); border: 1px solid var(--line);
  color: var(--text); border-radius: 8px; padding: 6px 8px; font-size: 14px;
}
.admin-actions { margin-top: 20px; }

/* ===================== 按钮 ===================== */
.btn {
  border: none; border-radius: 10px; padding: 11px 20px; font-size: 15px;
  font-weight: 700; cursor: pointer; transition: all .18s; font-family: inherit;
}
.btn-primary { background: var(--primary); color: #2a1400; }
.btn-primary:hover { background: var(--primary-600); }
.btn-ghost { background: transparent; color: var(--text-soft); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-soft); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-del { background: transparent; color: var(--danger); border: 1px solid var(--danger); padding: 6px 12px; font-size: 13px; border-radius: 8px; cursor: pointer; font-weight: 700; }
.btn-del:hover { background: var(--danger); color: #fff; }

/* 账号超期标注 */
.acct-expired {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: rgba(239,70,88,.12); color: var(--danger);
  font-size: 12px; font-weight: 800; border: 1px solid rgba(239,70,88,.4);
}
.acct-normal {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: rgba(47,158,68,.12); color: #2f9e44;
  font-size: 12px; font-weight: 700; border: 1px solid rgba(47,158,68,.35);
}
tr.row-expired { background: rgba(239,70,88,.06); }

/* ===================== 中奖弹窗 ===================== */
.modal { position: fixed; inset: 0; z-index: 100; display: none; }
.modal.is-open { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.modal-box {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(90vw, 380px); text-align: center;
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  border: 1px solid var(--line); border-radius: 20px; padding: 34px 28px;
  box-shadow: var(--shadow); animation: pop .4s cubic-bezier(.18,1.2,.4,1);
}
@keyframes pop { from { transform: translate(-50%, -50%) scale(.7); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.modal-trophy {
  width: 70px; height: 70px; margin: 0 auto 14px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff0c2, var(--gold) 60%, #d99a00);
  display: grid; place-items: center; box-shadow: 0 6px 16px rgba(255,206,77,.5);
  position: relative;
}
.modal-trophy::after {
  content: "🏆"; font-size: 34px;
}
#winTitle { font-size: 22px; margin-bottom: 8px; }
.modal-prize { font-size: 26px; font-weight: 900; color: var(--gold); margin-bottom: 22px; }
.modal-ok { width: 100%; }

/* 账号输入弹窗 */
.modal-account-icon {
  width: 70px; height: 70px; margin: 0 auto 14px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffd8a8, var(--primary) 60%, var(--primary-600));
  display: grid; place-items: center; box-shadow: 0 6px 16px rgba(255,122,26,.45);
}
.modal-account-icon::after { content: "@"; font-size: 34px; font-weight: 900; color: #fff; }
#accountTitle { font-size: 22px; margin-bottom: 6px; }
.modal-account-sub { color: var(--text-soft); font-size: 14px; margin-bottom: 20px; }
.account-form { display: flex; flex-direction: column; gap: 12px; }
.account-input {
  width: 100%; padding: 12px 14px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); color: var(--text);
}
.account-input:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; }
.account-error { color: var(--danger); font-size: 13px; font-weight: 600; margin: -4px 0 0; }
.account-actions { display: flex; gap: 10px; margin-top: 6px; }
.account-actions .btn { flex: 1; }
