/* ===== 幸运选号屋 专属样式 ===== */
/* 基于 shared/theme.css，局部覆盖为彩票主题色 */

/* ---------- CSS 变量 ---------- */
:root {
  --l-red:      #C8102E;
  --l-red-dark: #9a0c22;
  --l-red-light:#f5e6e9;
  --l-gold:     #D4AF37;
  --l-gold-lt:  #f9e79f;
  --ball-red-1: #E53935;
  --ball-red-2: #B71C1C;
  --ball-blue-1:#1E88E5;
  --ball-blue-2:#0D47A1;
  --ball-digit-1:#7c3aed;
  --ball-digit-2:#4c1d95;
  --bg-page:    #F5F6FA;
  --bg-card:    #fff;
  --text-main:  #212121;
  --text-sub:   #757575;
  --border:     #e8eaf0;
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --shadow-sm:  0 2px 8px rgba(0,0,0,.07);
  --shadow-md:  0 4px 20px rgba(0,0,0,.11);
  --shadow-lg:  0 8px 40px rgba(0,0,0,.16);
}

body.theme-dark {
  --l-red:      #e05265;
  --l-red-dark: #b0304a;
  --l-red-light:#3d1520;
  --l-gold:     #f0c060;
  --bg-page:    #0f1118;
  --bg-card:    #1a1d2b;
  --text-main:  #e8eaf0;
  --text-sub:   #8b95a8;
  --border:     #2a2d3d;
  --shadow-sm:  0 2px 8px rgba(0,0,0,.3);
  --shadow-md:  0 4px 20px rgba(0,0,0,.4);
}

/* ---------- 整体覆盖 ---------- */
.app-shell {
  min-height: 100vh;
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
}

.app-header {
  background: linear-gradient(135deg, var(--l-red-dark) 0%, var(--l-red) 55%, #e04040 100%) !important;
  position: relative;
  overflow: hidden;
}
.app-header::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
  pointer-events: none;
}

.app-body { flex: 1; padding: 1rem; max-width: 1100px; margin: 0 auto; width: 100%; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
  overflow: hidden;
}
.card-header {
  background: linear-gradient(to right, var(--l-red-light), var(--bg-card));
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.1rem;
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex; align-items: center; gap: .5rem;
}
.card-body { padding: 1rem 1.1rem; }

/* ---------- 彩种 Tabs ---------- */
.lottery-tabs {
  display: flex; gap: .5rem; flex-wrap: wrap;
  padding: .25rem 0;
}
.lottery-tab {
  display: flex; align-items: center; gap: .4rem;
  padding: .45rem .9rem; border-radius: 50px;
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main); font-size: .875rem; font-weight: 500;
  cursor: pointer; transition: all .2s; white-space: nowrap;
}
.lottery-tab:hover { border-color: var(--l-red); color: var(--l-red); }
.lottery-tab.active { border-color: var(--l-red); background: var(--l-red); color: #fff; }
.tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%; font-size: .65rem; font-weight: 700;
}
.tab-badge.fc { background: #ff6b35; color: #fff; }
.tab-badge.tc { background: #2196f3; color: #fff; }
.lottery-tab.active .tab-badge.fc,
.lottery-tab.active .tab-badge.tc { background: rgba(255,255,255,.28); }

/* ---------- 分类筛选 ---------- */
.category-filter {
  display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .9rem;
  padding-bottom: .9rem; border-bottom: 1px solid var(--border);
}
.cat-chip {
  padding: .25rem .7rem; border-radius: 50px; font-size: .75rem; font-weight: 500;
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-sub);
  cursor: pointer; transition: all .18s;
  display: flex; align-items: center; gap: .3rem;
}
.cat-chip:hover { border-color: var(--l-gold); color: var(--l-gold); }
.cat-chip.active { border-color: var(--l-gold); background: var(--l-gold); color: #1a1a1a; font-weight: 600; }
.cat-chip i { font-size: .7rem; }

/* ---------- 选号方式卡片 ---------- */
.method-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .7rem;
}
.method-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: .85rem; cursor: pointer;
  display: flex; align-items: flex-start; gap: .7rem;
  transition: all .2s; position: relative; outline: none;
  min-height: 72px;
}
.method-card:hover, .method-card:focus-visible {
  border-color: var(--l-red); transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.method-card.selected {
  border-color: var(--l-red); background: var(--l-red-light);
  box-shadow: 0 0 0 2px rgba(200,16,46,.15);
}
.mc-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--l-red), var(--l-red-dark));
  color: #fff; font-size: 1rem;
}
.method-card.selected .mc-icon {
  background: linear-gradient(135deg, var(--l-gold), #b8860b);
}
.mc-body { flex: 1; min-width: 0; }
.mc-name { font-size: .875rem; font-weight: 600; color: var(--text-main); margin-bottom: .15rem; line-height: 1.2; }
.mc-desc { font-size: .72rem; color: var(--text-sub); line-height: 1.3; }
.mc-tag {
  font-size: .6rem; font-weight: 700; padding: .1rem .35rem;
  border-radius: 4px; position: absolute; top: .5rem; right: .5rem;
}
.mc-tag.p0 { background: #fee2e2; color: #dc2626; }
.mc-tag.p1 { background: #fef9c3; color: #ca8a04; }
.mc-tag.p2 { background: #e0f2fe; color: #0284c7; }
body.theme-dark .mc-tag.p0 { background: #450a0a; color: #fca5a5; }
body.theme-dark .mc-tag.p1 { background: #422006; color: #fde047; }
body.theme-dark .mc-tag.p2 { background: #082f49; color: #7dd3fc; }

/* ---------- 表单 ---------- */
.method-form-card { display: none; }
.form-fields-grid { display: grid; grid-template-columns: 1fr; gap: .85rem; }
.form-field { display: flex; flex-direction: column; gap: .3rem; }
.form-label { font-size: .82rem; font-weight: 500; color: var(--text-main); }
.form-label .req { color: var(--l-red); margin-left: .15rem; }
.form-control {
  padding: .5rem .75rem; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--bg-page);
  color: var(--text-main); font-size: .875rem; transition: border-color .2s;
  width: 100%; box-sizing: border-box;
}
.form-control:focus { outline: none; border-color: var(--l-red); background: var(--bg-card); }
.form-hint { font-size: .8rem; color: var(--text-sub); margin-bottom: .75rem; }
.form-actions { display: flex; gap: .6rem; margin-top: 1rem; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1.2rem; border-radius: 50px; border: none; cursor: pointer;
  font-size: .875rem; font-weight: 600; transition: all .2s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--l-red), var(--l-red-dark));
  color: #fff; box-shadow: 0 3px 10px rgba(200,16,46,.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(200,16,46,.4); }
.btn-secondary { background: var(--border); color: var(--text-main); }
.btn-secondary:hover { background: #d0d3e0; }
body.theme-dark .btn-secondary:hover { background: #3a3d50; }

.generate-btn { width: 100%; justify-content: center; padding: .75rem; font-size: .95rem; }

.btn-sm {
  width: 28px; height: 28px; border-radius: 50%; border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-page); color: var(--text-sub); font-size: .75rem; transition: all .18s;
}
.btn-sm:hover { background: var(--l-red); color: #fff; }
.btn-fav.active { background: var(--l-gold); color: #fff; }
.btn-del:hover { background: #ef4444; color: #fff; }

/* ---------- 结果区 ---------- */
.result-card { display: none; }
.result-card .card-header { background: linear-gradient(to right, var(--l-red), var(--l-red-dark)); color: #fff; }
.result-title { font-size: .95rem; font-weight: 600; }
.num-str-bar {
  background: var(--bg-page); border-radius: var(--radius-sm);
  padding: .5rem .9rem; margin: .6rem 0;
  font-family: 'Courier New', monospace; font-size: 1.1rem; font-weight: 700;
  color: var(--l-red); letter-spacing: .15em; text-align: center;
  border: 1px dashed var(--l-red);
}

/* ---------- 号码球 ---------- */
.balls-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: .45rem;
  padding: .5rem 0;
}
.digits-row { justify-content: center; }
.balls-sep {
  font-size: 1.4rem; font-weight: 700; color: var(--text-sub);
  margin: 0 .2rem; line-height: 1;
}
.ball {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem; font-weight: 800; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.3);
  box-shadow: 0 4px 10px rgba(0,0,0,.22), inset 0 2px 4px rgba(255,255,255,.35);
  position: relative; user-select: none;
}
.ball::after {
  content: ''; position: absolute;
  top: 5px; left: 5px; width: 12px; height: 8px;
  background: rgba(255,255,255,.45); border-radius: 50%;
  transform: rotate(-30deg);
}
.ball-red {
  background: radial-gradient(circle at 35% 35%, #ff6b6b, var(--ball-red-1) 40%, var(--ball-red-2) 100%);
}
.ball-blue {
  background: radial-gradient(circle at 35% 35%, #64b5f6, var(--ball-blue-1) 40%, var(--ball-blue-2) 100%);
}
.ball-digit {
  background: radial-gradient(circle at 35% 35%, #c084fc, var(--ball-digit-1) 40%, var(--ball-digit-2) 100%);
}

/* 号码球入场动画 */
@keyframes ballDrop {
  0%   { opacity:0; transform:scale(0.3) translateY(-30px); }
  60%  { opacity:1; transform:scale(1.15) translateY(4px); }
  80%  { transform:scale(0.95) translateY(-2px); }
  100% { transform:scale(1) translateY(0); }
}
.ball { animation: ballDrop .5s cubic-bezier(.34,1.56,.64,1) both; }

/* ---------- 趣味信息 ---------- */
.fun-info {
  background: var(--bg-page); border-radius: var(--radius-md);
  padding: .9rem; margin: .5rem 0; border: 1px solid var(--border);
}
.fun-title { font-size: .82rem; font-weight: 700; color: var(--l-red); margin-bottom: .5rem; text-transform: uppercase; letter-spacing: .05em; }
.fun-row { display: flex; justify-content: space-between; align-items: center; padding: .22rem 0; border-bottom: 1px dashed var(--border); }
.fun-row:last-child { border-bottom: none; }
.fun-k { font-size: .8rem; color: var(--text-sub); flex-shrink:0; margin-right:.5rem; }
.fun-v { font-size: .82rem; font-weight: 600; color: var(--text-main); text-align: right; }
.fun-chars { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.fun-char {
  display: flex; flex-direction: column; align-items: center;
  padding: .3rem .5rem; border-radius: .4rem;
  background: var(--bg-card); border: 1px solid var(--border); font-size: 1rem;
}
.fun-char small { font-size: .6rem; color: var(--text-sub); }
.fun-vowel { background: #fef3c7; border-color: var(--l-gold); }

/* 颜色选号色块 */
.color-swatch {
  width: 100%; height: 40px; border-radius: var(--radius-sm);
  margin-bottom: .5rem; border: 1px solid var(--border);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}

/* 塔罗牌 */
.tarot-row { display: flex; gap: .5rem; }
.tarot-card { flex: 1; text-align: center; padding: .5rem .3rem; border-radius: var(--radius-sm); background: var(--bg-card); border: 1px solid var(--border); }
.tarot-label { font-size: .65rem; color: var(--text-sub); text-transform: uppercase; }
.tarot-name { font-size: .9rem; font-weight: 700; color: var(--l-red); margin: .2rem 0; }
.tarot-num { font-size: .65rem; color: var(--l-gold); font-weight: 600; }
.tarot-key { font-size: .65rem; color: var(--text-sub); line-height: 1.2; }

/* 混搭权重条 */
.mix-bar { display: flex; align-items: center; gap: .5rem; margin: .3rem 0; }
.mix-label { font-size: .75rem; color: var(--text-sub); width: 60px; flex-shrink: 0; }
.mix-track { flex: 1; height: 10px; background: var(--border); border-radius: 5px; overflow: hidden; }
.mix-fill { height: 100%; background: linear-gradient(to right, var(--l-red), var(--l-gold)); border-radius: 5px; transition: width .4s; }
.mix-val { font-size: .75rem; font-weight: 600; color: var(--l-red); width: 36px; text-align: right; }

/* ---------- 操作栏 ---------- */
.action-bar { display: flex; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }
.action-bar .btn { font-size: .8rem; padding: .4rem .9rem; }
.btn-fav.active { background: var(--l-gold); color: #fff; box-shadow: 0 3px 10px rgba(212,175,55,.4); }

/* ---------- 历史/收藏 ---------- */
.history-section .card-header, .fav-section .card-header { display: flex; justify-content: space-between; align-items: center; }
.history-list, .fav-list { display: flex; flex-direction: column; gap: .6rem; max-height: 520px; overflow-y: auto; }
.history-item, .fav-item {
  background: var(--bg-page); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: .7rem .9rem; transition: box-shadow .2s;
}
.history-item:hover { box-shadow: var(--shadow-sm); }
.hi-top { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .4rem; }
.hi-method { font-size: .8rem; font-weight: 600; color: var(--text-main); display: flex; align-items: center; gap: .3rem; }
.hi-lottery { font-size: .68rem; background: var(--l-red-light); color: var(--l-red); padding: .1rem .45rem; border-radius: 50px; font-weight: 600; }
.hi-time { font-size: .68rem; color: var(--text-sub); margin-left: auto; }
.hi-balls .ball { width: 28px; height: 28px; font-size: .6rem; }
.hi-balls .ball::after { top: 3px; left: 3px; width: 8px; height: 5px; }
.hi-numstr { font-size: .72rem; color: var(--text-sub); margin: .3rem 0; font-family: monospace; }
.hi-actions { display: flex; gap: .35rem; margin-top: .3rem; }
.empty-state { text-align: center; padding: 2rem 1rem; color: var(--text-sub); }
.empty-state i { font-size: 2rem; margin-bottom: .5rem; display: block; opacity: .4; }
.empty-state p { font-size: .85rem; }

/* ---------- 免责声明 ---------- */
.notice {
  background: #fff8e1; border-left: 4px solid #ffa000;
  color: #5d4037; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .78rem; padding: .65rem 1rem; line-height: 1.6;
  margin-bottom: 1rem;
}
.notice i { color: #f57c00; margin-right: .3rem; }
body.theme-dark .notice { background: #1c1505; border-color: #b26a00; color: #ffd54f; }
body.theme-dark .notice i { color: #ffa726; }

/* ---------- Toast ---------- */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: .5rem; }
.toast {
  background: var(--bg-card); color: var(--text-main);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .6rem 1rem; font-size: .85rem; box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: .5rem;
  opacity: 0; transform: translateX(100%); transition: all .3s cubic-bezier(.4,0,.2,1);
  min-width: 220px;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-success i { color: #22c55e; }
.toast-info i { color: #3b82f6; }
.toast-warn i { color: #f59e0b; }
.toast-error i { color: #ef4444; }

/* ---------- Footer ---------- */
.app-footer {
  background: var(--bg-card); border-top: 1px solid var(--border);
  padding: .9rem 1.2rem; text-align: center; font-size: .75rem; color: var(--text-sub);
}
.app-footer a { color: var(--l-red); text-decoration: none; }
.app-footer a:hover { text-decoration: underline; }
.footer-links { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .3rem; }
.footer-links a { display: flex; align-items: center; gap: .3rem; }
.gongan { height: 14px; vertical-align: middle; }

/* ---------- 收藏折叠 ---------- */
.fav-panel { display: none; }
#favToggle { font-size: .78rem; padding: .25rem .7rem; }

/* ---------- 响应式 ---------- */
@media (max-width: 600px) {
  .app-body { padding: .75rem .5rem; }
  .method-grid { grid-template-columns: repeat(2, 1fr); gap: .5rem; }
  .ball { width: 36px; height: 36px; font-size: .8rem; }
  .lottery-tabs { gap: .35rem; }
  .lottery-tab { padding: .4rem .65rem; font-size: .8rem; }
  .cat-chip { font-size: .7rem; padding: .2rem .55rem; }
  .method-card { padding: .65rem .6rem; min-height: 60px; }
  .mc-name { font-size: .8rem; }
  .mc-desc { display: none; }
  .tarot-row { flex-direction: column; }
  .toast-container { left: .75rem; right: .75rem; bottom: 1rem; }
}
@media (min-width: 601px) and (max-width: 900px) {
  .method-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 901px) {
  .method-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- 减少动画 ---------- */
@media (prefers-reduced-motion: reduce) {
  .ball { animation: none; }
  .toast { transition: opacity .2s; transform: none; }
}

/* ---------- 滚动条 ---------- */
.history-list::-webkit-scrollbar { width: 4px; }
.history-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.history-list::-webkit-scrollbar-thumb:hover { background: var(--l-red); }
