/* ===========================
   Design Tokens & Reset
   =========================== */
:root {
  --color-primary: #016815;
  --color-primary-dark: #014211;
  --color-primary-light: #0a8a2a;
  --color-accent: #f5b800;
  --color-accent-dark: #d99a00;
  --color-success: #16a34a;
  --color-danger: #dc2626;
  --color-text: #1f2937;
  --color-text-light: #6b7280;
  --color-text-muted: #9ca3af;
  --color-bg: #f4f6fb;
  --color-card: #ffffff;
  --color-border: #e5e7eb;
  --color-input-bg: #f9fafb;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(1, 104, 21, 0.06);
  --shadow-md: 0 4px 12px rgba(1, 104, 21, 0.08);
  --shadow-lg: 0 10px 30px rgba(1, 104, 21, 0.12);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;

  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: 16px; /* prevent iOS zoom */
}

img { max-width: 100%; display: block; }

/* ===========================
   Layout
   =========================== */
body {
  min-height: 100vh;
  padding-top: calc(60px + var(--safe-top));
  padding-bottom: calc(20px + var(--safe-bottom));
}

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: #fff;
  padding: calc(8px + var(--safe-top)) 16px 0;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  padding: 8px 0;
}

.brand-icon { font-size: 22px; }

.brand-text {
  font-size: 15px;
  white-space: nowrap;
  letter-spacing: 0;
}

.btn-clear-header {
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-clear-header:active { background: rgba(255,255,255,0.25); }

.app-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

.view { display: none; animation: fadeIn 0.25s ease; }
.view.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===========================
   Hero
   =========================== */
.hero {
  text-align: center;
  padding: 8px 0 20px;
}

.hero-title {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  margin: 8px 0 0;
  color: var(--color-primary);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===========================
   Card
   =========================== */
.card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
}

.form-card { padding: 24px 20px; }

.info-card {
  background: linear-gradient(135deg, #fffbf0 0%, #fff 100%);
  border: 1px solid rgba(245, 184, 0, 0.2);
}

.info-title {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--color-accent-dark);
}

.info-list {
  margin: 0;
  padding-left: 20px;
  color: var(--color-text-light);
  font-size: 14px;
  line-height: 1.8;
}

/* ===========================
   活动说明 - Tab 切换
   =========================== */
.info-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(245, 184, 0, 0.25);
}

.info-tab {
  flex: 1;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -1px;
}

.info-tab:hover { color: var(--color-accent-dark); }

.info-tab.active {
  color: var(--color-accent-dark);
  border-bottom-color: var(--color-accent);
  background: rgba(245, 184, 0, 0.05);
}

.info-pane { display: none; }
.info-pane.active { display: block; }

/* ===========================
   活动说明 - 列表（有序，数字序号）
   =========================== */
.info-card .info-list { padding-left: 22px; }
.info-card .info-list li { margin-bottom: 8px; }
.info-card .info-list li:last-child { margin-bottom: 0; }
.info-card .info-list strong { color: var(--color-text); font-weight: 600; }

/* ===========================
   活动说明 - 表格
   =========================== */
.info-table-wrap {
  margin-top: 18px;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(245, 184, 0, 0.2);
  background: #fff;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  table-layout: fixed;
  word-break: break-word;
}
.info-table colgroup col:nth-child(1) { width: 22%; }
.info-table colgroup col:nth-child(2) { width: 26%; }
.info-table colgroup col:nth-child(3) { width: 26%; }
.info-table colgroup col:nth-child(4) { width: 26%; }

.info-table thead th {
  padding: 10px 4px;
  background: linear-gradient(180deg, #fff7e0 0%, #fff 100%);
  color: var(--color-accent-dark);
  font-weight: 700;
  text-align: center;
  font-size: 12.5px;
  border-bottom: 2px solid var(--color-accent);
  border-right: 1px solid #f0f0f0;
}
.info-table thead th:last-child { border-right: none; }

.info-table tbody th {
  padding: 8px 6px;
  text-align: left;
  font-weight: 600;
  color: var(--color-text);
  background: #fafbfc;
  border-bottom: 1px solid #f0f0f0;
  border-right: 1px solid #f0f0f0;
  vertical-align: middle;
  line-height: 1.5;
}

.info-table tbody td {
  padding: 8px 4px;
  text-align: center;
  color: var(--color-text-light);
  border-bottom: 1px solid #f0f0f0;
  border-right: 1px solid #f0f0f0;
  line-height: 1.5;
  vertical-align: middle;
}

.info-table tbody td:last-child,
.info-table tbody th:last-child { border-right: none; }

.info-table tbody tr:last-child th,
.info-table tbody tr:last-child td { border-bottom: none; }

/* ===========================
   活动说明 - 占位卡片（待定）
   =========================== */
.info-placeholder {
  padding: 40px 16px;
  text-align: center;
  background: #fafbfc;
  border: 1px dashed rgba(245, 184, 0, 0.4);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
}

.info-placeholder-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.info-placeholder-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}

.info-placeholder-text {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* ===========================
   线上领券玩法 - 文本强调 / 折扣券 Badge
   =========================== */
.info-strong {
  color: #dc2626;
  font-weight: 700;
}

.info-highlight {
  color: #dc2626;
  font-weight: 700;
  background: #fef3c7;
  padding: 1px 6px;
  border-radius: 4px;
}

.discount-5, .discount-6, .discount-7 {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  vertical-align: 1px;
  white-space: nowrap;
}
.discount-5 { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }   /* 红色 - 最大折扣 */
.discount-6 { background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); }   /* 橙色 */
.discount-7 { background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%); }   /* 黄色 */

/* ===========================
   Form
   =========================== */
.form-group { margin-bottom: 18px; }
.form-group:last-of-type { margin-bottom: 24px; }

/* Slot 区域下方的提示(已选X/N支) - 现在作为副标题 */
.slot-hint {
  margin: 8px 0 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 12px;
  text-align: center;
  line-height: 1.5;
}
.slot-hint span {
  color: #16a34a;
  font-weight: 700;
  font-size: 13px;
}
.slot-hint strong {
  color: var(--color-primary);
  font-weight: 700;
}

/* 规则说明(总决赛) - 左对齐 + 无外框 */
.form-rule-hint {
  margin: 8px 0 12px;
  color: var(--color-text-light);
  font-size: 12.5px;
  line-height: 1.6;
  text-align: left;
}
.form-rule-hint strong {
  color: var(--color-primary);
  font-weight: 700;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.label-icon { font-size: 16px; }

.form-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-input-bg);
  color: var(--color-text);
  transition: all 0.2s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus {
  border-color: var(--color-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(1, 104, 21, 0.1);
}

.form-input.error {
  border-color: var(--color-danger);
  background: #fef2f2;
}

.form-textarea {
  height: auto;
  min-height: 64px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.5;
}

.form-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--color-text-muted);
}

.form-hint.error { color: var(--color-danger); }

/* 字符计数: 右对齐, 接近上限时变红 */
.form-counter {
  text-align: right;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s;
}
.form-counter.is-warn { color: var(--color-warning, #d97706); }
.form-counter.is-full { color: var(--color-danger, #dc2626); font-weight: 600; }

/* ===========================
   Phone Row (with query button)
   =========================== */
.phone-row {
  display: flex;
  gap: 8px;
}

.phone-row .form-input {
  flex: 1;
}

.btn-query {
  height: 48px;
  padding: 0 16px;
  font-size: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===========================
   Dual Score Input
   =========================== */
.score-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.score-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.score-input {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  font-family: "Courier New", monospace;
}

.score-colon {
  font-size: 24px;
  font-weight: 800;
  color: var(--color-text-light);
  line-height: 48px;
  flex-shrink: 0;
}

.score-label {
  font-size: 11px;
  color: var(--color-text-muted);
}

/* ===========================
   Wrong Guess Box
   =========================== */
.wrong-guess-box {
  margin: 0 0 16px;
  padding: 12px 16px;
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  border-radius: var(--radius-md);
}

.wrong-guess-title {
  font-size: 13px;
  font-weight: 700;
  color: #dc2626;
  margin-bottom: 6px;
}

.wrong-guess-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wrong-guess-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 999px;
  font-size: 12px;
  color: #991b1b;
  font-weight: 500;
  text-decoration: line-through;
  white-space: nowrap;
}

.wrong-guess-tag .flag { font-size: 14px; }

/* ===========================
   Main Tabs (参赛队伍 | 我要竞猜 | 竞猜记录)
   =========================== */
.main-tabs {
  display: flex;
  margin-bottom: 16px;
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: 4px;
  box-shadow: var(--shadow-sm);
}

.main-tab {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-light);
  background: transparent;
  cursor: pointer;
  transition: color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.main-tab.active {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(1,104,21,0.25);
}

/* ===========================
   Round Tabs
   =========================== */
.round-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.round-tabs::-webkit-scrollbar { display: none; }

.round-tab {
  position: relative;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-light);
  background: var(--color-card);
  border: 1.5px solid var(--color-border);
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
  /* 只过渡颜色/边框/背景,避免 layout 抖动 */
  transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  transform: translateZ(0); /* 开启 GPU 合成 */
  will-change: background-color;
}

.round-tab.active {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 2px 6px rgba(1, 104, 21, 0.3);
}

.round-tab.has-guess {
  /* 让绿点保持在按钮内 */
  padding-right: 22px;
}

.round-tab.has-guess::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 0 2px var(--color-card);
}

.round-tab.active.has-guess::after {
  box-shadow: 0 0 0 2px var(--color-primary);
}

.round-tab.disabled {
  /* 保持可点击 — 仅降调视觉,不显示禁用光标 */
  opacity: 0.7;
  cursor: pointer;
  color: var(--color-text-light);
  background: var(--color-card);
  border-color: var(--color-border);
  border-style: dashed;
}

.round-tab.disabled:hover {
  opacity: 1;
  border-style: solid;
}

.round-tab.disabled.active {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: #fff;
  border-color: var(--color-primary);
  border-style: solid;
  box-shadow: 0 2px 6px rgba(1, 104, 21, 0.3);
}

/* 轮次锁定（未按顺序解锁）— 仍允许点击查看提示 */
.round-tab.locked {
  opacity: 0.7;
  cursor: pointer;
  color: var(--color-text-light);
  background: var(--color-card);
  border-color: var(--color-border);
  border-style: dashed;
}

.round-tab.locked:hover {
  opacity: 1;
  border-style: solid;
}

.round-tab.locked.active {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: #fff;
  border-color: var(--color-primary);
  border-style: solid;
  box-shadow: 0 2px 6px rgba(1, 104, 21, 0.3);
}

/* 轮次已完成 */
.round-tab.done {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.round-tab.done::after {
  content: ' ✓';
  font-size: 11px;
  color: var(--color-success);
  font-weight: 700;
}

/* 当前可竞猜轮次 — 用静态高亮替代脉冲动效(避免频闪/出框) */
.round-tab.current {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fdba74;
  box-shadow: inset 0 0 0 1px #fdba74;
}

.round-tab.current.active {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 2px 6px rgba(1, 104, 21, 0.3);
}

/* ===========================
   Poster Advance Row
   =========================== */
.poster-advance-row {
  font-size: 14px;
  color: rgba(255,255,255,0.85);
  padding: 10px 0;
}

.poster-advance-teams {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(255,255,255,0.15);
  border: 1.5px solid var(--color-accent);
  border-radius: 12px;
  color: var(--color-accent);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.6;
}

/* ===========================
   Teams List (Tabbed by Continent)
   =========================== */
.teams-card { padding: 20px; }

.teams-title {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-primary);
  text-align: center;
}

.teams-list {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;   /* 多行时顶部对齐,不垂直分散 */
  gap: 6px;
  min-height: 120px;
  padding: 4px 0;
}

.team-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 10px;
  background: #f0f4ff;
  border: 1px solid #d0dcff;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  color: var(--color-text);
  font-weight: 500;
  white-space: nowrap;
  height: 28px;            /* 统一高度,长度(宽度)跟随内容 */
  box-sizing: border-box;
}

.team-tag .flag {
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

/* ===========================
   Continent Tabs (参赛队伍页 / 抽屉页 共用)
   =========================== */
.continent-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 6大洲 → 2排×3列 */
  gap: 6px;
  margin-bottom: 14px;
  padding: 2px;
}
/* 5大洲及以下 → 1排, 4列 */
.continent-tabs.cols-auto {
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
}

.continent-tab {
  padding: 8px 4px;
  background: var(--color-input-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-light);
  text-align: center;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.18s, background-color 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.continent-tab:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.continent-tab.active {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 2px 6px rgba(1, 104, 21, 0.25);
}

.continent-tab-count {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  background: rgba(255, 255, 255, 0.5);
  color: inherit;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 500;
  vertical-align: 1px;
}

.continent-tab.active .continent-tab-count {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* ===========================
   Slot Grid (晋级模式: 48进16 / 8进4)
   =========================== */
.slot-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 4px 0;
  padding: 4px 0;
}

/* 单个slot居中(总决赛冠军选择) */
.slot-grid-single {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  grid-template-columns: none;
}
.slot-grid-single .select-slot {
  width: 90px;  /* 略宽于默认, 居中显示 */
}
@media (max-width: 360px) {
  .slot-grid { grid-template-columns: repeat(3, 1fr); }
}

.select-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px 2px;
  background: transparent;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.slot-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(22, 163, 74, 0.06);
  transition: transform 0.12s, background-color 0.18s, border-color 0.18s;
}
@media (min-width: 420px) {
  .slot-circle { width: 62px; height: 62px; }
}

.select-slot:active .slot-circle { transform: scale(0.92); }

.slot-icon {
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
  color: #16a34a;
}

.slot-flag {
  font-size: 26px;
  line-height: 1;
}
@media (min-width: 420px) {
  .slot-flag { font-size: 30px; }
}

.slot-label {
  font-size: 12px;
  color: var(--color-text-light);
  font-weight: 500;
  text-align: center;
  word-break: break-word;
  line-height: 1.25;
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.select-slot.filled .slot-circle {
  background: #dcfce7;
  border-color: #16a34a;
  border-style: solid;
}

.select-slot.filled .slot-label {
  color: var(--color-text);
  font-weight: 600;
}

/* ===========================
   Team Drawer (队伍选择抽屉)
   =========================== */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.drawer[hidden] { display: none !important; }

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  animation: fadeIn 0.2s ease;
}

.drawer-content {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  background: #fff;
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  padding-bottom: var(--safe-bottom);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.drawer-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--color-primary);
}

.drawer-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  color: var(--color-text-light);
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.drawer-close:active { background: #e5e7eb; transform: scale(0.92); }

.drawer-summary {
  padding: 12px 20px;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-bottom: 1px solid #bbf7d0;
  font-size: 15px;
  font-weight: 700;
  color: #166534;
  text-align: center;
  flex-shrink: 0;
}
.drawer-count-num {
  display: inline-block;
  min-width: 22px;
  padding: 0 6px;
  background: #16a34a;
  color: #fff;
  border-radius: 999px;
  font-size: 14px;
  margin: 0 2px;
}
.drawer-count-total {
  font-weight: 700;
  color: #166534;
}

.drawer-body {
  padding: 0;
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Tab 区域 - 白色背景 + 底部分隔线 (固定,不滚动) */
.drawer-tabs-section {
  flex-shrink: 0;
  background: #fff;
  padding: 12px 16px 10px;
  border-bottom: 1px solid #e5e7eb;
}

/* 队伍区域 - 轻微灰底,与tab区视觉区隔; 内部可滚动 */
.drawer-team-section {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 16px 16px;
  background: #f8f9fb;
  -webkit-overflow-scrolling: touch;
}

/* 分区小标签 */
.drawer-section-label {
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.continent-tabs-drawer {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 0;
  gap: 5px;
}
.continent-tabs-drawer .continent-tab {
  padding: 6px 4px;
  font-size: 12px;
}

.drawer-team-list {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;   /* 顶部对齐,避免空区域时垂直分散 */
  gap: 6px;
  min-height: 80px;
}

.drawer-team-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 7px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  background: var(--color-input-bg);
  color: var(--color-text);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.drawer-team-btn:active { transform: scale(0.96); }

.drawer-team-btn.selected {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(1, 104, 21, 0.2);
}

.drawer-team-btn .flag { font-size: 16px; }

.drawer-footer {
  display: flex;
  gap: 10px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--color-border);
  background: #fafbfc;
  flex-shrink: 0;
}
.drawer-footer .btn { flex: 1; }

/* ===========================
   Button
   =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 20px;
  height: 48px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; pointer-events: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(1, 104, 21, 0.3);
}

.btn-secondary {
  background: #fff;
  color: var(--color-primary);
  border: 1.5px solid var(--color-border);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}

.btn-block { width: 100%; }

.btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn.loading .btn-text { opacity: 0; }
.btn.loading .btn-spinner {
  display: block;
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -8px 0 0 -8px;
}

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

/* ===========================
   Records View
   =========================== */
.records-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 4px;
}

.view-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: var(--color-primary);
}

.readonly-badge {
  padding: 4px 10px;
  background: #f0f4ff;
  color: var(--color-primary);
  border: 1px solid #d0dcff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.records-list { display: flex; flex-direction: column; gap: 12px; }

.record-card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-md);
  position: relative;
}

.record-card::before {
  content: '';
  position: absolute;
  left: 0; top: 16px; bottom: 16px;
  width: 4px;
  background: linear-gradient(180deg, var(--color-accent), var(--color-accent-dark));
  border-radius: 0 4px 4px 0;
}

.record-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
}

.record-row .label {
  color: var(--color-text-light);
  font-weight: 500;
}

.record-row .value {
  color: var(--color-text);
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

.record-team {
  font-size: 16px;
  color: var(--color-primary);
}

.record-score {
  display: inline-block;
  padding: 2px 10px;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
  color: #fff;
  border-radius: 999px;
  font-weight: 700;
}

.record-custom {
  margin-top: 8px;
  padding: 10px 12px;
  background: #f9fafb;
  border-left: 3px solid var(--color-accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px;
  color: var(--color-text-light);
  font-style: italic;
}

.record-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--color-border);
}

.record-actions .btn { flex: 1; height: 40px; font-size: 13px; }

/* ===========================
   Empty State
   =========================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.empty-icon { font-size: 60px; margin-bottom: 12px; opacity: 0.6; }
.empty-text { color: var(--color-text-light); margin: 0 0 20px; }

/* ===========================
   等待结果页面: 已选队伍展示
   =========================== */
.waiting-detail { margin-bottom: 16px; }

/* 48进16 / 8进4: 队伍chip列表 */
.team-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 10px 0 6px;
}
.team-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: #f8f9fb;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  font-size: 12px;
  color: var(--color-text);
  line-height: 1.2;
  white-space: nowrap;
}
.team-chip-flag {
  font-size: 14px;
  line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.team-chip-name { font-weight: 500; }

/* 总决赛: 大卡片 */
.final-pick-card {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #f6fbf7 0%, #ffffff 100%);
  border: 2px solid var(--color-primary);
  border-radius: 10px;
  margin: 12px 0 6px;
  box-shadow: 0 2px 8px rgba(1, 104, 21, 0.12);
}
.final-pick-flag {
  font-size: 40px;
  line-height: 1;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.final-pick-body { text-align: center; }
.final-pick-team {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
  text-align: center;
}
.final-pick-score {
  font-size: 24px;
  font-weight: 800;
  color: var(--color-primary);
  margin-top: 4px;
  letter-spacing: 2px;
  text-align: center;
}

.submitted-meta {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 8px;
}

/* ===========================
   Modal
   =========================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

/* 关键: 覆盖 [hidden] 默认样式,否则 display:flex 会使弹窗始终显示 */
.modal[hidden] { display: none !important; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  animation: fadeIn 0.2s ease;
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 580px;        /* 加宽以容纳 540px 海报 + 20px 边距 */
  max-height: 92vh;
  background: #fff;
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  padding-bottom: var(--safe-bottom);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.modal-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--color-primary);
}

.modal-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
  color: var(--color-text-light);
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.modal-close:hover { background: #e5e7eb; color: var(--color-text); }
.modal-close:active { background: #d1d5db; transform: scale(0.92); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  gap: 10px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--color-border);
  background: #fafbfc;
}

.modal-footer .btn { flex: 1; }

/* ===========================
   Poster
   =========================== */
.poster-stage {
  margin: 16px 0 4px;
  display: flex;
  justify-content: center;
  /* 移动端窄屏时通过 scale 缩放, 保持海报内部坐标不变 */
  width: 100%;
  overflow: hidden;
  position: relative;
  padding: 8px 0;
}

.poster-scale-wrap {
  /* 包裹层: 负责按 modal 宽度对海报做等比缩放
     海报内部坐标系: 1080x1920, 视觉缩放由 transform: scale() 控制 */
  width: 1080px;       /* 内部坐标宽度 (与 .poster 一致) */
  height: 1920px;      /* 内部坐标高度 */
  position: relative;
  flex-shrink: 0;
  transform-origin: top center;
  transform: scale(var(--poster-scale, 0.5));
  margin-bottom: calc((var(--poster-scale, 0.5) - 1) * 1920px);
}

.poster-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(245, 184, 0, 0.4) 0%, transparent 50%),
    radial-gradient(circle at 80% 90%, rgba(245, 184, 0, 0.3) 0%, transparent 50%),
    linear-gradient(135deg, #016815 0%, #0a8a2a 50%, #016815 100%);
}

.poster-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(45deg, transparent 0, transparent 20px, rgba(255,255,255,0.03) 20px, rgba(255,255,255,0.03) 40px);
}

.poster-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.poster-trophy {
  font-size: 64px;
  line-height: 1;
  text-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

.poster-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--color-accent);
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.poster-subtitle {
  font-size: 12px;
  letter-spacing: 4px;
  color: rgba(255,255,255,0.7);
  margin-top: 2px;
}

.poster-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 16px 0;
}

.poster-line {
  font-size: 16px;
  color: rgba(255,255,255,0.9);
  font-weight: 500;
}

.poster-team {
  display: inline-block;
  margin-left: 6px;
  padding: 4px 12px;
  background: var(--color-accent);
  color: var(--color-primary);
  border-radius: 999px;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(245, 184, 0, 0.4);
}

.poster-score-row {
  font-size: 15px;
  color: rgba(255,255,255,0.85);
}

.poster-score {
  display: inline-block;
  margin: 0 4px;
  padding: 6px 16px;
  background: rgba(255,255,255,0.15);
  border: 2px solid var(--color-accent);
  border-radius: 12px;
  color: #fff;
  font-weight: 800;
  font-size: 22px;
  font-family: "Courier New", monospace;
}

.poster-bottom {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.2);
}

.poster-custom {
  font-size: 13px;
  color: var(--color-accent);
  font-weight: 600;
  min-height: 18px;
  word-break: break-word;
}

.poster-custom:empty::before,
.poster-custom.empty::before {
  content: '写下您的竞猜宣言';
  color: rgba(255,255,255,0.4);
  font-style: italic;
  font-weight: 400;
}

.poster-meta {
  display: flex;
  justify-content: center;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  padding: 0 4px;
}

/* ===========================
   Poster Modal - Server-Rendered Hint
   海报由后端渲染, 不再展示前端预览
   =========================== */
.poster-server-hint {
  margin: 16px 0 4px;
  padding: 12px 14px;
  background: #f0f7f1;
  border: 1px dashed #016815;
  border-radius: 10px;
  color: #016815;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

/* ===========================
   Toast
   =========================== */
.toast {
  position: fixed;
  bottom: calc(40px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.95);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  z-index: 2000;
  max-width: 80%;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
}

.toast.success { background: var(--color-success); }
.toast.error { background: var(--color-danger); }

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ===========================
   Loading Overlay
   =========================== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #fff;
}

/* 关键: 覆盖 [hidden] 默认样式,否则 display:flex 会使遮罩始终显示 */
.loading-overlay[hidden] { display: none !important; }

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.2);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text { margin: 0; font-size: 14px; }
.loading-tip { margin: 0; font-size: 12px; opacity: 0.7; }

/* ===========================
   Responsive (tablet & up)
   =========================== */
@media (min-width: 768px) {
  body { padding-top: calc(72px + var(--safe-top)); }
  .app-main { padding: 24px; }
  .hero-title { font-size: 32px; }
  .form-card { padding: 32px; }
  .poster { max-width: 380px; }
}

@media (min-width: 1024px) {
  .app-main { max-width: 720px; }
  .poster { max-width: 420px; }
}

/* ===========================
   Reduced motion
   =========================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===========================
   Result Card (竞猜结果卡片)
   =========================== */
.result-card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.result-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

.result-round-icon { font-size: 24px; }
.result-round-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-primary);
}
.winner-badge {
  display: inline-block;
  padding: 2px 10px;
  background: linear-gradient(135deg, #f5b800, #e6a800);
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: 0 2px 6px rgba(245,184,0,0.4);
  animation: badgePulse 2s ease-in-out infinite;
}
@keyframes badgePulse {
  0%, 100% { box-shadow: 0 2px 6px rgba(245,184,0,0.4); }
  50% { box-shadow: 0 2px 14px rgba(245,184,0,0.7); }
}

/* 统计数字 */
.result-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

/* 总决赛专用: 单个排名卡片(突出显示) */
.result-rank-card {
  text-align: center;
  padding: 16px 12px;
  background: linear-gradient(135deg, #f6fbf7 0%, #ffffff 100%);
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}
.result-rank-value {
  font-size: 36px;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1.1;
  letter-spacing: 1px;
}
.result-rank-label {
  font-size: 12px;
  color: var(--color-text-light);
  margin-top: 4px;
  letter-spacing: 1px;
}

.result-stat {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
  border-radius: var(--radius-md);
  border: 1px solid #d0dcff;
}

.result-stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1.2;
}

.result-stat-label {
  font-size: 12px;
  color: var(--color-text-light);
  margin-top: 4px;
}

/* 结果分区 */
.result-section {
  margin-bottom: 14px;
}

.result-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-light);
  margin-bottom: 8px;
}

.result-team-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.result-team-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.result-team-tag.hit {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.result-team-tag.miss {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  text-decoration: line-through;
}

.result-team-tag.winner {
  background: #f0f4ff;
  color: var(--color-primary);
  border: 1px solid #d0dcff;
}

.result-no-hit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #b91c1c;
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  font-style: normal;
}
.result-no-hit::before {
  content: '✕';
  display: inline-block;
  width: 16px;
  height: 16px;
  background: #ef4444;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.result-rule-note {
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.55;
  margin: 0 0 12px 0;
}
.result-rule-note strong {
  color: #c2410c;
  font-weight: 700;
}

.result-meta {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--color-border);
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: right;
}

/* 比分对比 */
.score-compare {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 16px;
}

.score-compare-col {
  flex: 1;
  text-align: center;
  padding: 16px 12px;
  background: #f9fafb;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
}

.score-compare-label {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 8px;
}

.score-compare-team {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 6px;
}

.score-compare-score {
  font-size: 22px;
  font-weight: 800;
  font-family: "Courier New", monospace;
  color: var(--color-text);
}

.score-compare-vs {
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* 比分颜色标识 */
.score-hit {
  color: #166534 !important;
  background: #dcfce7;
  border-radius: 8px;
  padding: 2px 8px;
}

.score-miss {
  color: #dc2626 !important;
  background: #fef2f2;
  border-radius: 8px;
  padding: 2px 8px;
}

.score-pending {
  color: var(--color-text-muted) !important;
}

.score-result-summary {
  text-align: center;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.score-all-hit {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.score-partial {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}

/* 未竞猜 — 入围队伍展示 */
.winner-list {
  padding: 0;
}

.winner-list-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-light);
  margin-bottom: 8px;
}

.winner-list-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.winner-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 10px;
  background: #f0f4ff;
  border: 1px solid #d0dcff;
  border-radius: 999px;
  font-size: 12px;
  color: var(--color-primary);
  font-weight: 500;
  white-space: nowrap;
}

/* ===========================
   Poster Image Preview Overlay (微信长按保存)
   =========================== */
.poster-img-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-top: calc(16px + var(--safe-top));
  padding-bottom: calc(16px + var(--safe-bottom));
}

.poster-img-overlay[hidden] { display: none !important; }

.poster-img-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 420px;
  margin-bottom: 12px;
}

.poster-img-tip {
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  font-weight: 500;
}

.poster-img-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.poster-img-wrap {
  max-width: 420px;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.poster-img-wrap img {
  width: 100%;
  height: auto;
  display: block;
  /* 禁止iOS长按弹出菜单干扰 */
  -webkit-touch-callout: default;
}

/* ===========================
   总决赛结果卡片
   =========================== */
.sf-match-card {
  background: #f8faff;
  border: 1px solid #d0dcff;
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
}

.sf-match-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 10px;
  text-align: center;
}

.sf-score-dual {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  justify-content: center;
}

.sf-score-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.sf-team-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
  text-align: center;
  min-height: 20px;
  word-break: break-word;
}

.sf-score-vs {
  font-size: 16px;
  font-weight: 800;
  color: var(--color-text-muted);
  padding-bottom: 6px;
  flex-shrink: 0;
}

.sf-score-num {
  width: 100%;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  font-family: "Courier New", monospace;
  height: 48px;
}

.sf-prize-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #fff7ed 0%, #fff1f2 100%);
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: #c2410c;
}

.sf-prize-icon {
  font-size: 16px;
}

/* 比赛结果展示 */
.sf-match-row {
  background: #f8faff;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
}

.sf-match-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 8px;
}

.sf-match-compare {
  display: flex;
  gap: 8px;
}

.sf-match-col {
  flex: 1;
  text-align: center;
}

.sf-match-label {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.sf-match-value {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
}

.sf-match-actual {
  background: #f0fdf4;
  border-radius: 8px;
  padding: 4px;
}

.sf-hit { color: #166534; background: #dcfce7; }
.sf-miss { color: #dc2626; background: #fef2f2; }

.sf-matches {
  margin-top: 8px;
}

/* ===========================
   比赛结果 — 左右双卡片
   =========================== */
.sf-matches-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.sf-result-card {
  background: #f8faff;
  border: 1.5px solid #d0dcff;
  border-radius: var(--radius-md);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sf-result-card.sf-card-hit {
  background: #f0fdf4;
  border-color: #86efac;
}

.sf-result-card.sf-card-partial {
  background: #fff7ed;
  border-color: #fdba74;
}

.sf-result-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
  text-align: center;
  padding-bottom: 6px;
  border-bottom: 1px dashed #d0dcff;
}

.sf-result-matchup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 4px 0;
}

.sf-result-team {
  flex: 1;
  text-align: center;
  min-width: 0;
}

.sf-result-team-label {
  font-size: 10px;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

.sf-result-team-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  word-break: break-word;
  line-height: 1.3;
}

.sf-result-vs {
  font-size: 11px;
  font-weight: 800;
  color: var(--color-accent-dark);
  flex-shrink: 0;
}

.sf-result-pick {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid #e5e7eb;
  padding-top: 6px;
}

.sf-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  gap: 4px;
}

.sf-result-row-label {
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.sf-result-row-value {
  font-weight: 700;
  color: var(--color-text);
  text-align: right;
  word-break: break-word;
}

.sf-result-actual .sf-result-row-value {
  color: var(--color-primary);
}

@media (max-width: 380px) {
  .sf-matches-grid { grid-template-columns: 1fr; }
}

/* ===========================
   Cross-platform Poster Safe
   =========================== */
/* 使用系统字体栈确保跨平台兼容 */
/* ★ 海报坐标系: 1080x1920 (与背景图 1781193162679_d.jpg 1:1)
   所有 top/left/width/height 全部基于图片绝对像素坐标
   (0,0) = 图片最左上角, 视觉缩放由 .poster-scale-wrap 的 transform: scale() 处理 */
.poster {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Microsoft YaHei", "Helvetica Neue", "Noto Sans SC", Arial, sans-serif;
  width: 1080px;
  height: 1920px;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  flex-shrink: 0;
  /* 容器透明 —— 展示区由图片自身设计决定 (已有"竞猜宣言"和"预测结果"两个绿色框) */
  background: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* 背景图铺满海报容器 —— 坐标系 (0,0) = 图片左上角, 尺寸 1080x1920 */
.poster-image {
  position: absolute;
  top: 0; left: 0;
  width: 1080px;
  height: 1920px;
  display: block;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
  object-fit: fill;
}

/* 竞猜宣言文本框 —— 1080x1920 图片坐标系, (0,0) = 图片左上角
   区域: 标题"竞猜宣言"底(y=495) → 绿框底(y=890), 在此区域内垂直水平居中
   区域中心: y=692, 高度 395px */
.poster-declare-area {
  position: absolute;
  top: 493px;            /* 上移再加 8px (485+8) */
  left: 66px;            /* 左右各缩小 16px (50+16) */
  width: 948px;          /* 980-16-16 */
  height: 379px;         /* 上下各减 8px (395-16) */
  display: flex;
  align-items: center;   /* 垂直居中 */
  justify-content: center;  /* 水平居中 */
  overflow: hidden;
  box-sizing: border-box;
}
.poster-declare-text {
  width: 100%;
  height: 100%;  /* 关键: 始终占满父容器高度, 配合 flex 居中让文字垂直居中 */
  /* 关键: border-box 让 width/height:100% 包含 padding,
     避免 100% + 18px*2 = 984px 超出父元素 948px 导致 autoFitText 误判
     (否则 scrollWidth 会把 padding 也算进去, 误以为文字放不下) */
  box-sizing: border-box;
  /* 关键: min-width/min-height:0 覆盖 flex 子项默认的 min-width/min-height:auto,
     避免长内容(无空格时)让元素扩展超出父容器尺寸 */
  min-width: 0;
  min-height: 0;
  display: flex;          /* flex 布局让内联文字垂直水平居中 */
  align-items: center;    /* 垂直居中 */
  justify-content: center;/* 水平居中 */
  padding: 0 18px;
  color: #fff7d6;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  word-break: break-all;
  line-break: anywhere;
  white-space: pre-wrap;
  /* 字号由 JS 自动设置 */
  font-size: var(--poster-font-size, 22px);
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
  letter-spacing: 1px;
  /* 不使用 transition 过渡动画，避免与 JS 防抖叠加产生闪烁 */
}

/* 预测结果文本框 —— 1080x1920 图片坐标系
   区域: 标题"预测结果"底(y=1020) → 绿框底(y=1430), 在此区域内垂直水平居中
   区域中心: y=1225, 高度 410px */
.poster-result-area {
  position: absolute;
  top: 1020px;           /* 标题"预测结果"底部 y=1020 */
  left: 58px;            /* 左右各缩小 16px 后再各增加 8px (50+16-8) */
  width: 964px;          /* 980-32+16 */
  height: 410px;         /* 到绿框底 y=1430 */
  display: flex;
  align-items: center;   /* 垂直居中 */
  justify-content: center;  /* 水平居中 */
  overflow: hidden;
  box-sizing: border-box;
  border-radius: 32px;
}
/* 16 强预测结果区域: 距绿框 (y=1430) 上方 8px, 高度 = 1430-8-1028 = 394px */
.poster-result-area.is-r16 {
  top: 1028px;
  height: 424px;             /* 容器下边到 y=1452, 距绿框底 8px (高度 +30, 顶部对齐向下扩展) */
}
.poster-result-text {
  width: 100%;
  height: 100%;  /* 关键: 始终占满父容器高度, 配合 flex 居中让文字垂直居中 */
  /* 关键: border-box 让 width/height:100% 包含 padding, 避免 autoFitText 误判 */
  box-sizing: border-box;
  /* 关键: min-width/min-height:0 覆盖 flex 子项默认值, 允许子项缩小 */
  min-width: 0;
  min-height: 0;
  display: flex;          /* flex 列方向, 让 .result-team 垂直堆叠 */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  color: #fff;
  font-weight: 600;
  text-align: center;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  word-break: break-all;
  line-break: anywhere;
  white-space: pre-wrap;
  font-size: var(--poster-font-size, 18px);
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
  /* 不使用 transition 过渡动画，避免与 JS 防抖叠加产生闪烁 */
}
/* 预测结果行：使用 <div class="result-row"> 替代 <span> (新结构)
   - 队伍行: 居中, 字号继承自 .poster-result-text
   - 尾标行: 顶部间距, 略小字号, 金黄色高亮 */
.poster-result-text .result-row {
  display: block;
  text-align: center;
  line-height: 1.4;
  word-break: break-all;
  overflow-wrap: anywhere;
}
.poster-result-text .result-team {
  display: block;            /* 每队独占一行, 垂直堆叠 */
  font-size: inherit;        /* 继承父容器的字号 (16强40px, 4强56px, 决赛80px) */
  color: #fff;
  font-weight: 600;
  /* 关键: 单队一行, "国旗 + 国家名" 不可拆分换行 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  line-height: 1.2;           /* 紧凑行高 (40×1.2=48, 56×1.2=67, 80×1.2=96) */
  margin-bottom: 20px;        /* 行距 20px, 与下一队/尾标间隔 20px */
}
.poster-result-text .result-team:last-child {
  margin-bottom: 0;           /* 最后一队不需底部间距, 避免与容器底部重叠 */
}
.poster-result-text .result-tail {
  display: block;            /* 强制独占第二行, 决赛"以 X:X 夺冠！"换行 */
  margin-top: 20px;          /* 决赛第 1 行国家与第 2 行尾标间距 20px */
  color: #ffe78a;
  font-weight: 700;
  font-size: 0.92em;
  letter-spacing: 1px;
  line-height: 1.2;
}

/* 16 队时使用 2 列布局, 4 队时单列 */
.poster-result-text .result-grid {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  margin-bottom: 6px;
  font-size: inherit;  /* 继承 .poster-result-text 的字号 */
}
.poster-result-text .result-col {
  flex: 1;
  text-align: center;
  line-height: 1.4;
  font-size: inherit;  /* 继承 .poster-result-text 的字号 */
  /* 关键: nowrap 子元素需要的最小宽度布局 */
  min-width: 0;
  overflow: hidden;
}

/* 16 强专用: 列内各国行距 10px (覆盖默认 20px, 紧凑展示 16 队) */
.poster-result-text .result-col .result-team {
  margin-bottom: 10px;        /* 16 强列内行距 10px */
}
.poster-result-text .result-col .result-team:last-child {
  margin-bottom: 0;           /* 列内最后一队不需底部间距 */
}

/* 兼容旧结构 (内联使用) - 旧 <span> 仍然能继承基本样式 */
.poster-result-text .result-score {
  display: inline-block;
  margin: 0 4px;
  padding: 1px 18px;
  background: #fff7d6;
  color: #016815;
  border-radius: 32px;
  font-weight: 800;
  font-family: "Courier New", "Consolas", monospace;
}

.poster-top { gap: 4px; }
.poster-trophy { font-size: 56px; }
.poster-body { gap: 18px; padding: 16px 0; flex: 1; display: flex; flex-direction: column; justify-content: center; }

.poster-team {
  display: inline-block;
  margin: 6px 0 0;
  padding: 4px 14px;
  background: var(--color-accent);
  color: var(--color-primary);
  border-radius: 999px;
  font-weight: 800;
  font-size: 16px;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(245, 184, 0, 0.4);
  max-width: 100%;
  word-break: break-word;
}

.poster-advance-row { padding: 6px 0; }

/* 海报双场比分样式（已移除半决赛，保留用于扩展） */
.poster-sf-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
}

.poster-sf-match {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  padding: 6px 12px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  line-height: 1.5;
  word-break: break-word;
}

@media (max-width: 374px) {
  .poster { width: 300px; height: 534px; }
  .poster-inner { padding: 22px 16px 20px; }
  .poster-trophy { font-size: 44px; }
  .poster-team { font-size: 14px; }
  .poster-title { font-size: 15px; }
  .poster-sf-match { font-size: 12px; }
}
