/**
 * styles.css - LuckyPick 样式（柔和中性风格）
 *
 * 设计原则：
 *   - 暖色基调（赤陶/橙珊瑚），不用冷色不用黑白灰
 *   - 柔和圆角 + 浅阴影，避免生硬
 *   - 宽松间距，呼吸感
 *   - 移动优先（手机友好）
 *   - 不要玄学感太重（避免"算命"刻板印象）
 */

:root {
  /* 颜色 */
  --bg:           #FAF8F5;   /* 暖白底 */
  --bg-deep:      #F5F1EB;
  --card:         #FFFFFF;
  --text:         #2D2A26;   /* 深棕灰，比纯黑柔和 */
  --text-soft:    #6B6660;
  --muted:        #9B958C;
  --line:         #ECE9DD;

  /* 主色（赤陶色系） */
  --accent:       #D97757;
  --accent-soft:  #FBE8DE;
  --accent-deep:  #B85F42;

  /* 球色 */
  --ball-front:   #E8F0FF;
  --ball-front-c: #185FA5;
  --ball-back:    #FBE8DE;
  --ball-back-c:  #B85F42;
  --ball-qxc:     #F0EBE3;
  --ball-qxc-c:   #2D2A26;

  /* 状态色 */
  --success:      #5A8A6E;
  --success-soft: #E8F0E8;
  --warn:         #C8845F;

  /* 形状 */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;

  /* 阴影 */
  --shadow-sm: 0 1px 3px rgba(45, 42, 38, 0.04), 0 1px 2px rgba(45, 42, 38, 0.06);
  --shadow:    0 4px 12px rgba(45, 42, 38, 0.06), 0 2px 4px rgba(45, 42, 38, 0.04);
  --shadow-lg: 0 10px 24px rgba(45, 42, 38, 0.08);

  /* 字体 */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
          "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========== 布局 ========== */
.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

header.hero {
  padding: 24px 0 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

header.hero h1 {
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

header.hero h1 .logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 18px;
}

header.hero .tagline-intent {
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  font-style: italic;
  margin: 4px 0 2px;
  text-align: center;
}

header.hero .tagline {
  color: var(--text-soft);
  font-size: 13px;
  margin: 0;
}

/* 版本号徽章（右上角小 pill） */
header.hero h1 .version-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-deep);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 100px;
  letter-spacing: 0.5px;
  cursor: help;
  user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* 刷新整个 app 按钮（header 顶部，挨着版本号） */
header.hero h1 .refresh-app-btn {
  background: transparent;
  border: 1px solid var(--accent-soft);
  color: var(--accent);
  border-radius: 100px;
  width: 32px;
  height: 28px;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin-left: 4px;
  transition: all 0.2s ease;
}
header.hero h1 .refresh-app-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
header.hero h1 .refresh-app-btn:active {
  transform: scale(0.92);
}
header.hero h1 .refresh-app-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ========== Tabs ========== */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  padding: 4px;
  background: var(--bg-deep);
  border-radius: var(--radius);
}

/* Tabs inside Recent Draws card: tighter spacing */
.recent-content .tabs {
  margin-bottom: 14px;
  margin-top: 0;
}

.tab {
  flex: 1;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-soft);
  font-family: inherit;
  transition: all 0.2s ease;
}

.tab.active {
  background: var(--card);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.tab:hover:not(.active) {
  color: var(--text);
}

/* Disabled / "coming soon" tab (EU + UK while fetcher unavailable) */
.tab.tab-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: transparent;
  box-shadow: none;
}
.tab.tab-disabled:hover {
  color: var(--text-soft);
  background: transparent;
  box-shadow: none;
}
.tab.tab-disabled.active {
  /* shouldn't happen, but just in case */
  background: var(--bg-deep);
  color: var(--text-soft);
  font-weight: 500;
}
.tab .soon-pill {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent-deep);
  padding: 2px 6px;
  border-radius: 100px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ========== 卡片 ========== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}

.card h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h2 .num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.card h2 .hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
  margin-left: auto;
}

/* ========== 因素列表 ========== */
.factor-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  min-height: 40px;
  align-items: center;
}

.factor-list:empty::before {
  content: '点击下方按钮添加你的幸运因素';
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
}

.factor-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  animation: chipIn 0.3s ease;
}

.factor-chip.avoid {
  background: var(--bg-deep);
  color: var(--text-soft);
}

.factor-chip .icon {
  font-size: 14px;
}

.factor-chip .remove {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  padding: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  opacity: 0.6;
  margin-left: 2px;
}

.factor-chip .remove:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.06);
}

@keyframes chipIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

/* ========== 添加因素按钮组 ========== */
.factor-add {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.add-btn {
  padding: 6px 12px;
  background: var(--bg-deep);
  color: var(--text-soft);
  border: 0;
  border-radius: 100px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  transition: all 0.15s ease;
}

.add-btn:hover {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

/* ========== 号码输入 ========== */
.numbers-input {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.numbers-input input {
  flex: 1;
  min-width: 140px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
}

.numbers-input input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--card);
}

.numbers-input button {
  padding: 8px 14px;
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
}

.numbers-input button:hover {
  background: var(--accent-deep);
}

/* ========== 弹出面板（添加因素） ========== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(45, 42, 38, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}

.modal-mask.show {
  display: flex;
}

.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 400px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal h3 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
}

.modal label {
  display: block;
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 6px;
  font-weight: 500;
}

.modal input, .modal select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 14px;
}

.modal input:focus, .modal select:focus {
  outline: none;
  border-color: var(--accent);
}

.modal .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

.modal .actions button {
  padding: 9px 18px;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
}

.modal .actions .cancel {
  background: var(--bg-deep);
  color: var(--text-soft);
}

.modal .actions .ok {
  background: var(--accent);
  color: white;
}

/* ========== 权重滑块 ========== */
.weight-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.weight-row label {
  flex: 0 0 90px;
  font-size: 13px;
  color: var(--text-soft);
  font-weight: 500;
}

.weight-row input[type=range] {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  outline: none;
}

.weight-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--card);
  box-shadow: var(--shadow-sm);
}

.weight-row input[type=range]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--card);
  box-shadow: var(--shadow-sm);
}

.weight-row .val {
  flex: 0 0 36px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

/* ========== 大按钮 ========== */
.btn-primary {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: white;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(217, 119, 87, 0.3);
  transition: transform 0.1s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(217, 119, 87, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

/* ========== 号码展示 ========== */
.balls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.ball {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--ball-qxc);
  color: var(--ball-qxc-c);
  transition: transform 0.3s ease;
}

.ball.front {
  background: var(--ball-front);
  color: var(--ball-front-c);
}

.ball.back {
  background: var(--ball-back);
  color: var(--ball-back-c);
}

.ball.divider {
  background: transparent;
  color: var(--muted);
  width: auto;
  font-size: 14px;
  font-weight: 400;
}

/* ========== 生成结果卡片 ========== */
.result-card {
  background: linear-gradient(135deg, var(--bg-deep) 0%, var(--card) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  position: relative;
}

.result-card .scheme-tag {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 11px;
  padding: 3px 10px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-radius: 100px;
  font-weight: 500;
}

.result-card .meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

/* ========== 历史频率展示 ========== */
.freq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.freq-cell {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--bg);
}

.freq-cell .label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.freq-cell .nums {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-deep);
  font-variant-numeric: tabular-nums;
}

.freq-cell.cold .nums {
  color: var(--text-soft);
}


/* ========== Recent Draws 可折叠卡片 ========== */
.recent-card {
  padding: 0;
  overflow: hidden;
}

.recent-card summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}

.recent-card summary::-webkit-details-marker {
  display: none;
}

.recent-card[open] summary {
  border-bottom: 1px solid var(--line);
  background: var(--bg-deep);
}

.recent-card summary .num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.recent-card summary .hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
  margin-left: auto;
}

.recent-content {
  padding: 16px 20px;
}

/* ========== Install hero ========== */
.install-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 20px;
  padding: 4px 0 4px 0;
}

.install-hero-text {
  flex: 1 1 50%;
  min-width: 0;
}

.install-hero-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
  line-height: 1.25;
  letter-spacing: -0.3px;
}

.install-hero-sub {
  font-size: 13px;
  color: var(--text-soft);
  margin: 0 0 16px;
  line-height: 1.5;
}

.install-hero-cta {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 10px 20px;
  border-radius: 100px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(217, 119, 87, 0.25);
}

.install-hero-cta:hover {
  background: var(--accent-deep);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(217, 119, 87, 0.35);
}

.install-hero-image {
  flex: 0 0 45%;
  max-width: 360px;
}

.install-hero-image svg {
  width: 100%;
  height: auto;
  display: block;
}

.install-intro {
  margin: 16px 0 16px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.6;
}

/* Mobile: stack vertically */
@media (max-width: 600px) {
  .install-hero {
    flex-direction: column-reverse;
    gap: 16px;
  }
  .install-hero-text {
    flex: 1 1 100%;
    text-align: center;
  }
  .install-hero-image {
    flex: 0 0 auto;
    max-width: 280px;
    margin: 0 auto;
  }
  .install-hero-title {
    font-size: 20px;
  }
}

/* Demo data 标记（橙色更显眼） */
.recent-content .meta-note.demo-source {
  color: var(--accent-deep);
  background: var(--accent-soft);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

/* ========== 使用指引 / PWA 卡片 ========== */
.guide-card, .pwa-card {
  padding: 0;
  overflow: hidden;
}

.guide-card summary, .pwa-card summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
  user-select: none;
}

.guide-card summary::-webkit-details-marker,
.pwa-card summary::-webkit-details-marker {
  display: none;
}

.guide-card[open] summary, .pwa-card[open] summary {
  border-bottom: 1px solid var(--line);
  background: var(--bg-deep);
}

.guide-content {
  padding: 16px 20px;
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.7;
}

.guide-content p {
  margin: 0 0 12px;
}

.guide-content .small {
  font-size: 12px;
  margin-top: 12px;
}

.step {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  align-items: flex-start;
}

.step-num {
  flex: 0 0 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.step-body {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
}

/* ========== 免责声明 ========== */
.disclaimer {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin-top: 32px;
  padding: 16px;
  border-top: 1px solid var(--line);
  line-height: 1.6;
}

/* ========== 转盘 ========== */
.wheel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 0;
}

.wheel {
  width: 240px;
  height: 240px;
  position: relative;
  margin-bottom: 20px;
}

.wheel-canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: var(--shadow-lg);
  transition: transform 4s cubic-bezier(0.17, 0.67, 0.21, 0.99);
}

.wheel-pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 20px solid var(--accent-deep);
  z-index: 2;
}

/* ========== 响应式 ========== */
@media (max-width: 480px) {
  .app { padding: 16px 12px 60px; }
  .card { padding: 16px; }
  header.hero h1 { font-size: 22px; }
  .ball { width: 32px; height: 32px; font-size: 13px; }
  .freq-grid { grid-template-columns: 1fr 1fr; }
}

/* ========== 动画 ========== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease; }


/* ========== 清缓存按钮 ========== */
.cache-btn {
  margin-left: auto;
  padding: 4px 10px;
  background: var(--bg-deep);
  color: var(--text-soft);
  border: 0;
  border-radius: 100px;
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
}

.cache-btn:hover {
  background: var(--accent-soft);
  color: var(--accent-deep);
}


/* ========== 历史冷热 - 最近开奖 ========== */
.recent-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  margin: 16px 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid var(--line);
}

.recent-issue {
  flex: 0 0 96px;
  font-weight: 600;
  color: var(--accent-deep);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.recent-date {
  flex: 0 0 90px;
  font-size: 12px;
}

.recent-balls {
  flex: 1;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.mini-ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.mini-ball.front {
  background: var(--ball-front);
  color: var(--ball-front-c);
}

.mini-ball.back {
  background: var(--ball-back);
  color: var(--ball-back-c);
}

.mini-ball.qxc {
  background: var(--ball-qxc);
  color: var(--ball-qxc-c);
}

.mini-ball.divider {
  background: transparent;
  color: var(--muted);
  width: auto;
  font-size: 12px;
}


/* ========== 调试区块 ========== */
.debug-card {
  background: var(--bg-deep);
  font-family: ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;
}

.debug-content {
  padding: 12px 16px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-soft);
}

.debug-content .row {
  padding: 2px 0;
  display: flex;
  gap: 8px;
}

.debug-content .key {
  color: var(--muted);
  flex: 0 0 120px;
}

.debug-content .val {
  color: var(--text);
  font-weight: 600;
}

.debug-content .val.ok { color: var(--success); }
.debug-content .val.bad { color: var(--accent-deep); }



/* ========== 使用说明 / 安装步骤 ========== */
.install-card {
  background: linear-gradient(135deg, #FFF8F3 0%, #FFFFFF 100%);
  border-color: #FBE8DE;
}
.install-steps {
  margin: 8px 0 0;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-soft);
}
.install-steps li {
  margin-bottom: 4px;
}



/* ========== Update Toast ========== */
.update-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: white;
  padding: 12px 20px;
  border-radius: 100px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s ease;
  z-index: 1000;
}
.update-toast.show {
  transform: translateX(-50%) translateY(0);
}
.update-toast button {
  padding: 4px 12px;
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: 100px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
}

/* ========== Update Bar ========== */
.update-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-soft);
}
.update-info {
  flex: 1;
}
.refresh-btn {
  padding: 6px 12px;
  background: var(--card);
  color: var(--accent);
  border: 1px solid var(--accent-soft);
  border-radius: 100px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  white-space: nowrap;
}
.refresh-btn:hover {
  background: var(--accent-soft);
}
.refresh-btn:active {
  transform: scale(0.96);
}

/* ========== PayPal Tip Card ========== */
.tip-card {
  background: linear-gradient(135deg, #FFF8F3 0%, #FFFFFF 100%);
  border-color: #FBE8DE;
}
.tip-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.paypal-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: #0070BA;
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s ease;
}
.paypal-btn:hover {
  background: #003087;
  color: white;
}

/* ========== English-style Balls ========== */
.ball.main {
  background: #E8F0FF;
  color: #185FA5;
}
.ball.extra {
  background: #FFE8E0;
  color: #C13816;
}

/* ========== 工具类 ========== */
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }

.result-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.action-btn {
  padding: 6px 14px;
  font-size: 13px;
  background: #fff;
  color: #D97757;
  border: 1.5px solid #D97757;
  border-radius: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
}
.action-btn:hover {
  background: #D97757;
  color: #fff;
  transform: translateY(-1px);
}
.action-btn:active { transform: translateY(0); }

.lp-toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(34, 34, 34, 0.92);
  color: #fff;
  padding: 10px 20px;
  border-radius: 22px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9999;
  max-width: 90vw;
}
.lp-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.modal textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1.5px solid #E0DCD4;
  border-radius: 8px;
  font-family: inherit;
  resize: vertical;
  min-height: 70px;
  box-sizing: border-box;
}
.modal textarea:focus {
  outline: none;
  border-color: #D97757;
}

.result-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: #fff;
  border-radius: 14px;
  border: 1.5px dashed #E0DCD4;
}
.toolbar-btn {
  padding: 8px 16px;
  font-size: 14px;
  background: #fff;
  color: #D97757;
  border: 1.5px solid #D97757;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s ease;
}
.toolbar-btn:hover {
  background: #D97757;
  color: #fff;
  transform: translateY(-1px);
}
.toolbar-btn.primary {
  background: #D97757;
  color: #fff;
}
.toolbar-btn.primary:hover {
  background: #C13816;
  border-color: #C13816;
}
.set-count-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding-left: 10px;
  border-left: 1px solid #E0DCD4;
}
.set-count-label {
  font-size: 13px;
  color: #888;
  font-weight: 500;
}
.set-count-btn {
  padding: 4px 12px;
  font-size: 13px;
  background: #fff;
  color: #888;
  border: 1.5px solid #E0DCD4;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 600;
  min-width: 36px;
}
.set-count-btn:hover {
  border-color: #D97757;
  color: #D97757;
}
.set-count-btn.active {
  background: #D97757;
  color: #fff;
  border-color: #D97757;
}

/* ========== Save Library ========== */
.save-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.save-counter {
  font-size: 14px;
  color: #5b5b5b;
  padding: 6px 12px;
  background: #FAF8F5;
  border-radius: 16px;
}
.save-counter.pro {
  background: #fff3eb;
  color: #D97757;
}
.save-counter.exhausted {
  background: #fdf0ee;
  color: #c13816;
}
.upgrade-btn {
  padding: 6px 14px;
  font-size: 13px;
  background: linear-gradient(135deg, #D97757, #C13816);
  color: #fff;
  border: none;
  border-radius: 18px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(217, 119, 87, 0.25);
  transition: all 0.15s ease;
}
.upgrade-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(217, 119, 87, 0.35);
}

.saved-card {
  background: #fff;
  border: 1.5px solid #E0DCD4;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  transition: all 0.15s ease;
}
.saved-card:hover {
  border-color: #D97757;
  box-shadow: 0 2px 8px rgba(217, 119, 87, 0.1);
}
.saved-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
}
.saved-date {
  color: #888;
}
.saved-factors {
  margin-top: 6px;
  font-style: italic;
}
.saved-empty {
  padding: 18px 12px;
  border: 1.5px dashed #E0DCD4;
  border-radius: 12px;
  background: #FAF8F5;
}

.action-btn.success {
  background: #E8F5E8;
  color: #2D7D32;
  border-color: #2D7D32;
  cursor: default;
}
.action-btn.danger {
  color: #c13816;
  border-color: #c13816;
}
.action-btn.danger:hover {
  background: #c13816;
  color: #fff;
}

/* Pro pricing modal */
.pro-pricing {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}
.pro-tier {
  flex: 1;
  padding: 10px 8px;
  text-align: center;
  border: 1.5px solid #E0DCD4;
  border-radius: 10px;
  font-size: 13px;
}
.pro-tier.featured {
  border-color: #D97757;
  background: #fff3eb;
}
.pro-tier b {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
  color: #5b5b5b;
}

/* ========== Factor Help Details ========== */
.factor-help {
  margin-top: 14px;
  padding: 12px 14px;
  background: #FAF8F5;
  border: 1px solid #E8E2D8;
  border-radius: 12px;
  font-size: 13px;
}
.factor-help summary {
  cursor: pointer;
  font-weight: 600;
  color: #5b5b5b;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.factor-help summary::-webkit-details-marker { display: none; }
.factor-help summary::before {
  content: '▼';
  font-size: 10px;
  color: #999;
  transition: transform 0.15s ease;
  display: inline-block;
}
.factor-help:not([open]) summary::before {
  transform: rotate(-90deg);
}
.factor-help-content {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #E8E2D8;
}
.factor-help-list {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 14px;
}
.factor-help-list dt {
  font-weight: 600;
  color: #D97757;
  white-space: nowrap;
}
.factor-help-list dd {
  margin: 0;
  color: #5b5b5b;
  line-height: 1.5;
}

/* ===== 设计思路 callout（在 factor-help 卡底部） ===== */
.factor-design-note {
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
}

.factor-design-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-deep);
}

.factor-design-lead {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--text-soft);
  font-style: italic;
}

.factor-design-list {
  margin: 0 0 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
}

.factor-design-list dt {
  font-weight: 600;
  color: var(--accent-deep);
  white-space: nowrap;
}

.factor-design-list dd {
  margin: 0;
  color: var(--text);
}

.factor-design-foot {
  margin: 0;
  padding-top: 8px;
  border-top: 1px dashed rgba(217, 119, 87, 0.3);
  font-size: 12px;
  font-style: italic;
}

@media (max-width: 480px) {
  .factor-design-list {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .factor-design-list dt {
    margin-top: 6px;
  }
  .factor-design-list dt:first-child {
    margin-top: 0;
  }
}

/* ========== Generate Counter ========== */
.gen-counter {
  font-size: 14px;
  color: #5b5b5b;
  padding: 8px 14px;
  background: #FAF8F5;
  border-radius: 16px;
  margin-bottom: 12px;
  text-align: center;
  display: inline-block;
}
.gen-counter.pro {
  background: #fff3eb;
  color: #D97757;
}
.gen-counter.dev {
  background: #f0ebff;
  color: #6b46c1;
  border: 1px dashed #6b46c1;
}
.gen-counter.exhausted {
  background: #fdf0ee;
  color: #c13816;
}

/* ========== Game Tabs (with flags) ========== */
.tab .flag {
  margin-right: 4px;
  font-size: 14px;
}

/* ========== USDT / Crypto Tip ========== */
.crypto-btn {
  display: inline-block;
  padding: 10px 16px;
  font-size: 14px;
  background: #fff;
  color: #1f8a70;
  border: 1.5px solid #1f8a70;
  border-radius: 22px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}
.crypto-btn:hover {
  background: #1f8a70;
  color: #fff;
  transform: translateY(-1px);
}
.crypto-panel {
  margin-top: 12px;
  padding: 14px;
  background: #f0f9f5;
  border: 1px solid #1f8a70;
  border-radius: 12px;
}
.crypto-address {
  display: block;
  padding: 10px;
  margin: 8px 0;
  background: #fff;
  border: 1px dashed #1f8a70;
  border-radius: 8px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 13px;
  word-break: break-all;
  text-align: center;
  color: #1f8a70;
  cursor: pointer;
  user-select: all;
}
.copy-btn {
  padding: 6px 12px;
  background: #1f8a70;
  color: #fff;
  border: none;
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s ease;
}
.copy-btn:hover {
  background: #176554;
}

/* PayPal 打赏二维码 */
.tip-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 12px 0 4px;
}
.tip-qr img {
  border-radius: 10px;
  border: 2px solid var(--border);
  background: #fff;
  padding: 6px;
}

/* ============================================================
   Frequency Stats（频率统计：热/温/冷）
   ============================================================ */
.freq-stats {
  margin-top: 14px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
}
.freq-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
  flex-wrap: wrap;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  background: var(--bg-deep);
}
.seg button {
  border: none;
  background: transparent;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
}
.seg button.active {
  background: var(--accent);
  color: #fff;
}
.freq-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
  margin: 12px 0 6px;
}
.freq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  gap: 4px;
}
.freq-cell {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 4px 5px;
}
.freq-cell .top {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  line-height: 1.4;
}
.freq-cell .cnt { opacity: .7; font-weight: 500; }
.hot  { color: var(--accent-deep); font-weight: 700; }
.cold { color: var(--success); font-weight: 700; }
.warm { color: var(--text); font-weight: 600; }
.barbg {
  height: 4px;
  background: var(--bg-deep);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}
.barfill { height: 100%; border-radius: 2px; }
.barfill.hot  { background: var(--accent-deep); }
.barfill.warm { background: var(--warn); }
.barfill.cold { background: var(--success); }

/* ============================================================
   Manual Pick（自选号码）
   ============================================================ */
.manual-count-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.manual-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  align-items: center;
}
.manual-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
  min-width: 44px;
  white-space: nowrap;
}
.manual-row input {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 14px;
  background: var(--card);
  color: var(--text);
}
.manual-row input:focus {
  outline: none;
  border-color: var(--accent);
}
.manual-main { flex: 1; min-width: 0; }
.manual-extra { width: 78px; flex-shrink: 0; }
.manual-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}
#manual-msg.error { color: var(--warn); }
#manual-msg.ok { color: var(--success); }
