/* ===== 基础与背景 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #0a1f14;
  color: #fff;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* 斜向光线扫过效果 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(115deg, transparent 30%, rgba(74, 222, 128, .07) 45%, transparent 60%),
    radial-gradient(circle at 15% 10%, rgba(34, 197, 94, .12), transparent 45%),
    radial-gradient(circle at 85% 90%, rgba(34, 197, 94, .10), transparent 45%);
  pointer-events: none;
}

.page {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
}

/* ===== 顶部标题 ===== */
.header { text-align: center; padding: 10px 0 4px; }

.header-chip {
  display: inline-block;
  font-size: 13px;
  letter-spacing: 2px;
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, .45);
  border-radius: 999px;
  padding: 4px 14px;
  background: rgba(34, 197, 94, .08);
}

.header-title {
  margin-top: 10px;
  font-size: 21px;
  font-weight: 800;
  text-shadow: 0 0 18px rgba(34, 197, 94, .35);
}

/* ===== 球队对阵区 ===== */
.matchup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 22px 6px 14px;
}

.team { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; }

.logo-wrap {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 35%, #16351f, #0b2413 70%);
  animation: logoGlow 3s ease-in-out infinite;
}

.logo-wrap img { width: 82%; height: 82%; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .5)); }

.logo-home { box-shadow: 0 0 0 2px rgba(37, 99, 235, .55), 0 0 22px rgba(37, 99, 235, .35); }
.logo-away { box-shadow: 0 0 0 2px rgba(220, 38, 38, .55), 0 0 22px rgba(220, 38, 38, .35); }

@keyframes logoGlow {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.team-name { font-size: 24px; font-weight: 800; }

.team-tag { font-size: 12px; color: #9ca3af; letter-spacing: 1px; }

/* VS 徽章 */
.vs-badge {
  flex: none;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  font-style: italic;
  color: #0a1f14;
  background: linear-gradient(135deg, #fbbf24, #facc15);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(251, 191, 36, .5);
}

/* ===== 投票按钮区 ===== */
.vote-area { margin-top: auto; }

.vote-buttons {
  display: flex;
  gap: 10px;
}

.vote-btn {
  flex: 1;
  border: none;
  cursor: pointer;
  padding: 14px 4px 12px;
  color: #fff;
  font-family: inherit;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: transform .12s ease, filter .2s ease;
}

.vote-btn:active { transform: scale(.96); }

.btn-home { background: linear-gradient(160deg, #2563eb, #1e3a8a); }
.btn-draw { background: linear-gradient(160deg, #475569, #1e293b); }
.btn-away { background: linear-gradient(160deg, #22c55e, #15803d); }

.btn-label { font-size: 17px; font-weight: 800; letter-spacing: 1px; }
.btn-pct { font-size: 13px; font-weight: 600; opacity: .85; font-variant-numeric: tabular-nums; }

/* 选中态（金色描边发光） */
.vote-btn.chosen {
  outline: 3px solid #fbbf24;
  outline-offset: -1px;
  box-shadow: 0 0 18px rgba(251, 191, 36, .55);
  filter: brightness(1.12);
}

/* 已投票后按钮禁用 */
.voted .vote-btn { pointer-events: none; filter: saturate(.85); }
.voted .vote-btn.chosen { filter: brightness(1.12); }

/* ===== 百分比进度条 ===== */
.bars {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.bar-col { flex: 1; }

.bar {
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .10);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  transition: width .6s cubic-bezier(.22, 1, .36, 1);
}

.bar-home i { background: linear-gradient(90deg, #2563eb, #60a5fa); }
.bar-draw i { background: linear-gradient(90deg, #475569, #94a3b8); }
.bar-away i { background: linear-gradient(90deg, #15803d, #4ade80); }

/* ===== 汇总信息 ===== */
.vote-summary {
  text-align: center;
  margin-top: 14px;
  font-size: 13px;
  color: #9ca3af;
}

.vote-summary b { color: #fff; font-size: 15px; margin: 0 2px; }

.my-vote {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #fde68a;
  background: rgba(251, 191, 36, .12);
  border: 1px solid rgba(251, 191, 36, .45);
}

.hidden { display: none !important; }

/* ===== 底部球场装饰 ===== */
.field {
  margin-top: 18px;
  height: 52px;
  border-radius: 10px 10px 50% 50% / 10px 10px 22% 22%;
  background:
    repeating-linear-gradient(90deg, #14532d 0 24px, #166534 24px 48px),
    linear-gradient(180deg, rgba(74, 222, 128, .18), transparent 60%);
  background-blend-mode: overlay;
  box-shadow: inset 0 8px 18px rgba(0, 0, 0, .45);
  opacity: .85;
}

/* ===== 确认弹窗 ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(4, 18, 10, .72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  padding-top: calc(32px + env(safe-area-inset-top));
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
  z-index: 20;
  animation: fadeIn .18s ease;
}

.modal {
  width: 100%;
  max-width: 320px;
  border-radius: 16px;
  padding: 22px 20px 18px;
  text-align: center;
  background: linear-gradient(170deg, #12331d, #0b2413);
  border: 1px solid rgba(74, 222, 128, .35);
  box-shadow: 0 0 30px rgba(34, 197, 94, .22), 0 18px 40px rgba(0, 0, 0, .5);
  animation: popIn .2s ease;
}

.modal-title { font-size: 14px; color: #4ade80; letter-spacing: 2px; margin-bottom: 12px; }

.modal-msg { font-size: 19px; font-weight: 800; line-height: 1.5; }

.modal-msg .hl { color: #fbbf24; text-shadow: 0 0 12px rgba(251, 191, 36, .4); }

.modal-btns { display: flex; gap: 12px; margin-top: 20px; }

.modal-btn {
  flex: 1;
  padding: 11px 0;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform .12s ease, filter .2s ease;
}

.modal-btn:active { transform: scale(.95); }

.btn-cancel {
  color: #cbd5e1;
  background: rgba(148, 163, 184, .10);
  border: 1px solid rgba(148, 163, 184, .45);
}

.btn-ok {
  color: #052e16;
  border: none;
  background: linear-gradient(135deg, #4ade80, #22c55e);
  box-shadow: 0 0 14px rgba(34, 197, 94, .4);
}

@keyframes fadeIn { from { opacity: 0; } }

@keyframes popIn { from { opacity: 0; transform: scale(.88); } }

/* ===== 轻提示 Toast ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px);
  padding: 10px 22px;
  border-radius: 999px;
  background: rgba(34, 197, 94, .95);
  color: #052e16;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 10;
}

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

.toast.error { background: rgba(239, 68, 68, .95); color: #fff; }

/* ===== 顶部用户栏 ===== */
.user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.user-chip {
  font-size: 13px;
  color: #d1fae5;
  background: rgba(34, 197, 94, .10);
  border: 1px solid rgba(74, 222, 128, .3);
  border-radius: 999px;
  padding: 4px 12px;
}

.logout-link {
  font-size: 13px;
  color: #9ca3af;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, .35);
}

.logout-link:active { transform: scale(.95); }

/* ===== 登录页 / 说明页 ===== */
.center-body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  padding-top: calc(24px + env(safe-area-inset-top));
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

.auth-card {
  width: 100%;
  max-width: 360px;
  border-radius: 18px;
  padding: 28px 22px 24px;
  text-align: center;
  background: linear-gradient(170deg, #12331d, #0b2413);
  border: 1px solid rgba(74, 222, 128, .35);
  box-shadow: 0 0 30px rgba(34, 197, 94, .18), 0 18px 40px rgba(0, 0, 0, .5);
}

.auth-logo { font-size: 40px; line-height: 1; }

.auth-title {
  margin-top: 10px;
  font-size: 24px;
  font-weight: 800;
  text-shadow: 0 0 18px rgba(34, 197, 94, .35);
}

.auth-sub { margin-top: 6px; font-size: 13px; color: #9ca3af; }

.auth-error {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  color: #fecaca;
  background: rgba(239, 68, 68, .12);
  border: 1px solid rgba(239, 68, 68, .45);
  word-break: break-all;
}

.field { display: block; margin-top: 14px; text-align: left; }

.field-label { display: block; font-size: 13px; color: #c2d4c8; margin-bottom: 6px; }

.field-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 16px; /* >=16px 防止 iOS 聚焦自动放大 */
  color: #fff;
  background: #07160d; /* 比卡片更深的实色，形成内嵌凹槽 */
  border: 1.5px solid rgba(94, 214, 148, .55); /* 加粗抵消视口缩放造成的亚像素边框 */
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .45), inset 0 -1px 0 rgba(255, 255, 255, .07);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.field-input::placeholder { color: #8ba292; opacity: 1; }

.field-input:focus {
  border-color: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, .25), inset 0 2px 6px rgba(0, 0, 0, .45);
}

.auth-btn {
  width: 100%;
  margin-top: 22px;
  padding: 13px 0;
  border: none;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 800;
  font-family: inherit;
  letter-spacing: 2px;
  color: #052e16;
  cursor: pointer;
  background: linear-gradient(135deg, #4ade80, #22c55e);
  box-shadow: 0 0 16px rgba(34, 197, 94, .4);
  transition: transform .12s ease;
}

.auth-btn:active { transform: scale(.97); }

/* ===== 说明页正文 ===== */
.rules-card { text-align: left; }

.rules-card .auth-logo,
.rules-card .auth-title,
.rules-card .auth-sub { text-align: center; }

.rules-body {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
  border: 1px dashed rgba(148, 163, 184, .4);
}

.rules-body p {
  font-size: 15px;
  line-height: 1.9;
  color: #e5e7eb;
}

.rules-card .modal-btns { margin-top: 20px; }

.rules-card .modal-btn { text-align: center; text-decoration: none; }

/* ===== 管理页 ===== */
.admin-page {
  max-width: 760px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 20px 16px 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.admin-header h1 { font-size: 20px; font-weight: 800; }

.admin-sub { font-size: 13px; color: #9ca3af; }

.admin-stats {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.stat-card {
  flex: 1;
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(148, 163, 184, .25);
}

.stat-label { font-size: 13px; color: #9ca3af; }

.stat-count { margin-top: 4px; font-size: 20px; font-weight: 800; }

.stat-pct { margin-top: 2px; font-size: 12px; color: #4ade80; }

.table-wrap {
  margin-top: 16px;
  border-radius: 12px;
  overflow-x: auto;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(148, 163, 184, .25);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 480px;
}

.admin-table th, .admin-table td {
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
}

.admin-table th {
  color: #9ca3af;
  font-weight: 600;
  border-bottom: 1px solid rgba(148, 163, 184, .3);
}

.admin-table tr:not(:last-child) td { border-bottom: 1px solid rgba(148, 163, 184, .12); }

.choice-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.choice-home { color: #93c5fd; background: rgba(37, 99, 235, .18); }
.choice-draw { color: #cbd5e1; background: rgba(148, 163, 184, .18); }
.choice-away { color: #86efac; background: rgba(34, 197, 94, .18); }

.admin-empty { margin-top: 24px; text-align: center; color: #9ca3af; font-size: 14px; }

/* ===== 页脚：统一固定在网页最底部（内容上、页脚下）===== */
.site-footer {
  margin-top: auto; /* 在 flex 容器中把页脚推到底部 */
  width: 100%;
  text-align: center;
  padding: 18px 12px calc(14px + env(safe-area-inset-bottom));
  font-size: 12px;
  color: #6b7f72;
}

/* ===== 多场比赛卡片 ===== */
.match-card {
  margin-top: 18px;
  border-radius: 16px;
  padding: 16px 14px 14px;
  background: linear-gradient(170deg, #102b19, #0a2011);
  border: 1px solid rgba(74, 222, 128, .22);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

.match-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.match-no { font-size: 12px; color: #9ca3af; }

.badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.badge-open { color: #86efac; background: rgba(34, 197, 94, .15); border: 1px solid rgba(74, 222, 128, .45); }

.badge-closed { color: #fca5a5; background: rgba(239, 68, 68, .12); border: 1px solid rgba(239, 68, 68, .4); }

.match-card .matchup { padding: 10px 0 6px; }

.match-card .team-name { font-size: 20px; }

.logo-fallback {
  width: 82%;
  height: 82%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 900;
  color: #e2e8f0;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .5);
}

.fb-home { background: linear-gradient(135deg, #1d4ed8, #1e3a8a); }
.fb-away { background: linear-gradient(135deg, #16a34a, #15803d); }

.no-match { margin-top: 40px; text-align: center; color: #9ca3af; font-size: 14px; }

/* ===== 已投票横幅 ===== */
.voted-banner {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  color: #fde68a;
  background: rgba(251, 191, 36, .08);
  border: 1px solid rgba(251, 191, 36, .4);
}

.voted-banner b { color: #fbbf24; }

/* ===== 结束后的统计结果 ===== */
.results { margin-top: 8px; }

.result-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.result-label {
  flex: none;
  width: 92px;
  font-size: 13px;
  color: #d1fae5;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-row .bar { flex: 1; }

.result-num {
  flex: none;
  width: 96px;
  font-size: 12px;
  color: #9ca3af;
  font-variant-numeric: tabular-nums;
}

.result-row.lead .result-label,
.result-row.lead .result-num { color: #4ade80; font-weight: 700; }

.result-row.lead .bar i { filter: brightness(1.25); }

/* ===== 管理后台：比赛卡片 ===== */
.create-match {
  margin-top: 18px;
  border-radius: 14px;
  padding: 16px 14px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(148, 163, 184, .25);
}

.section-title { font-size: 15px; font-weight: 700; color: #4ade80; }

.create-form {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.create-vs { font-weight: 900; font-style: italic; color: #fbbf24; }

.create-btn { grid-column: 1 / -1; margin-top: 4px; padding: 10px 0; }

.admin-match-card {
  margin-top: 18px;
  border-radius: 14px;
  padding: 16px 14px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(148, 163, 184, .25);
}

.amc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.amc-title { font-size: 16px; font-weight: 800; }

.amc-meta { margin-top: 4px; font-size: 12px; color: #9ca3af; }

.amc-stats { margin-top: 6px; }

.amc-actions { display: flex; gap: 10px; margin-top: 14px; }

.amc-actions form { flex: 1; }

.admin-btn {
  width: 100%;
  padding: 10px 0;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  color: #052e16;
  border: none;
  background: linear-gradient(135deg, #4ade80, #22c55e);
}

.btn-danger {
  color: #fecaca;
  background: rgba(239, 68, 68, .12);
  border: 1px solid rgba(239, 68, 68, .5);
}

.btn-danger-solid {
  color: #fff;
  border: none;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 0 14px rgba(239, 68, 68, .4);
}

.admin-page + .site-footer { max-width: 760px; margin: 0 auto; }

/* ===== 队伍下拉选择 ===== */
.team-select { color-scheme: dark; cursor: pointer; padding: 11px 14px; }

.team-select option { background: #0b2413; color: #e5e7eb; }

/* ===== 登录页：卡片居中，页脚沉底 ===== */
.auth-wrap { margin: auto; }
