/* ============================================================
   500.dog — 喜庆大红 + 鎏金爆款门户设计系统
   风格：国民爆款彩票平台（中国大红主视觉 + 鎏金尊享转化 + 暖白高可读卡片
   + 立体光泽开奖球 + 可视化选球盘 + 桌面/手机端双适配）
   ============================================================ */
:root {
  --red: #d91c2b;
  --red-dark: #a8101c;
  --red-deep: #7f0a14;
  --red-soft: #fff1f2;
  --blue: #1d4ed8;
  --blue-dark: #1e3a8a;
  --blue-soft: #eff6ff;
  --gold: #d97706;
  --gold-bright: #f59e0b;
  --gold-light: #fde68a;
  --gold-soft: #fffbeb;
  --vip-bg: #7f0a14;
  --vip-bg-2: #450a0a;
  --ink: #1a1112;
  --ink-2: #3b2b2d;
  --muted: #6e5c5e;
  --line: #eddcdc;
  --line-2: #faf2f2;
  --bg: #fbf7f7;
  --card: #ffffff;
  --green: #15803d;
  --green-soft: #f0fdf4;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(127, 10, 20, .06), 0 1px 2px rgba(127, 10, 20, .04);
  --shadow-md: 0 6px 20px rgba(217, 28, 43, .10);
  --shadow-lg: 0 14px 36px rgba(168, 16, 28, .22);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  font-size: 15px;
  overflow-x: clip;
}
button, a, .pball, .zbtn, .zbtn-dan, .match-pick { touch-action: manipulation; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #3b82f6; outline-offset: 2px; }

.wrap { max-width: 1260px; margin: 0 auto; padding: 0 clamp(14px, 3vw, 28px); }

/* ---------- Header & Navigation ---------- */
.site-header {
  background: linear-gradient(90deg, #b91c1c 0%, #e11d2e 50%, #c81020 100%);
  border-bottom: 2px solid #991b1b;
  position: sticky;
  top: 0;
  z-index: 60;
  box-shadow: 0 4px 16px rgba(185, 28, 28, .22);
}
.header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  padding-block: 11px;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-size: 25px;
  font-weight: 850;
  color: #ffffff;
  letter-spacing: -.04em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand span { color: var(--gold-light); }
.brand small {
  font-size: 12px;
  font-weight: 600;
  color: #fff5f5;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .25);
  padding: 2px 9px;
  border-radius: 999px;
  letter-spacing: 0;
}
.main-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 14.5px;
  font-weight: 600;
}
.main-nav a {
  color: rgba(255, 255, 255, .94);
  padding: 7px 12px;
  border-radius: 8px;
  transition: background .15s, color .15s;
}
.main-nav a:hover { color: #fff; background: rgba(255, 255, 255, .18); text-decoration: none; }
.main-nav .nav-vip {
  background: linear-gradient(135deg, #fef08a 0%, #f59e0b 100%);
  color: #450a0a;
  padding: 7px 15px;
  border-radius: 999px;
  font-weight: 800;
  box-shadow: 0 3px 10px rgba(69, 10, 10, .25);
}
.main-nav .nav-vip:hover {
  background: linear-gradient(135deg, #fef9c3 0%, #fbbf24 100%);
  color: #450a0a;
}
.main-nav .nav-user {
  color: #fff;
  background: rgba(0, 0, 0, .22);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13.5px;
}
.main-nav .nav-login {
  border: 1px solid rgba(255, 255, 255, .75);
  color: #fff;
  background: rgba(255, 255, 255, .12);
  padding: 6px 14px;
  border-radius: 999px;
}
.main-nav .nav-login:hover { background: #fff; color: var(--red-dark); }

.lottery-nav {
  border-top: 1px solid rgba(255, 255, 255, .16);
  padding-block: 7px;
  background: #fffafa;
  border-bottom: 1px solid var(--line);
}
.lottery-nav nav {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.lottery-nav nav::-webkit-scrollbar { display: none; }
.lottery-nav a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  transition: all .15s;
}
.lottery-nav a:hover { border-color: var(--red); color: var(--red); text-decoration: none; }
.lottery-nav .nav-sep { width: 1px; height: 16px; background: var(--line); flex: none; margin-inline: 4px; }
.lottery-nav .nav-hot { border-color: #fecdd3; background: var(--red-soft); color: var(--red-dark); }
.lottery-nav .nav-sport { border-color: #bfdbfe; background: var(--blue-soft); color: var(--blue-dark); }

/* ---------- Badges & Tags ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}
.tag-welfare { background: var(--red-soft); color: var(--red-dark); }
.tag-sports { background: var(--blue-soft); color: var(--blue-dark); }
.tag-hot { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.tag-vip { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }
.tag-free { background: var(--green-soft); color: var(--green); }

/* ---------- Main / Typography ---------- */
main.wrap { padding-block: clamp(18px, 3.5vw, 32px) 56px; }
h1 { font-size: clamp(26px, 4vw, 36px); line-height: 1.25; margin: 8px 0 12px; letter-spacing: -.025em; }
h2 { font-size: clamp(19px, 2.5vw, 24px); margin: 28px 0 12px; line-height: 1.35; }
h3 { font-size: 16.5px; margin: 14px 0 8px; }
.lede { color: var(--muted); font-size: 15.5px; max-width: 760px; margin-top: 0; }
.muted { color: var(--muted); font-size: 13.5px; }
section { margin-bottom: 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--red);
  color: #fff;
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 14.5px;
  font-weight: 650;
  cursor: pointer;
  line-height: 1.35;
  transition: all .15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--red-dark); border-color: var(--red-dark); text-decoration: none; transform: translateY(-1px); }
.btn.blue { background: var(--blue); border-color: var(--blue); }
.btn.blue:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn.gold { background: linear-gradient(135deg, #f59e0b, #d97706); border-color: #d97706; color: #fff; box-shadow: 0 4px 14px rgba(217, 119, 6, .28); }
.btn.gold:hover { filter: brightness(1.06); }
.btn.ghost { background: #fff; color: var(--ink-2); border-color: #cbd5e1; }
.btn.ghost:hover { background: var(--line-2); border-color: #94a3b8; color: var(--ink); }
.btn.danger { background: #fff; color: #b91c1c; border-color: #fca5a5; }
.btn.danger:hover { background: #fef2f2; }
.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 7px; }
.btn-block { display: flex; width: 100%; padding: 12px 18px; font-size: 15.5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Hero Portal (Modern Commercial Landing) ---------- */
.portal-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
  background: radial-gradient(circle at 88% 12%, rgba(251, 191, 36, .28), transparent 46%), linear-gradient(135deg, #e11d2e 0%, #b91c1c 56%, #7f0a14 100%);
  color: #fff;
  border: 1px solid rgba(253, 230, 138, .28);
  border-radius: 22px;
  padding: clamp(22px, 4vw, 40px);
  margin-bottom: 24px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.portal-hero::after {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, rgba(254, 240, 138, .24), transparent 65%);
  pointer-events: none;
}
.hero-copy { display: flex; flex-direction: column; justify-content: center; position: relative; z-index: 1; }
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  background: rgba(254, 243, 199, .15);
  border: 1px solid rgba(253, 230, 138, .4);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12.5px;
  color: #fef08a;
  font-weight: 700;
  margin-bottom: 14px;
}
.hero-copy h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: -.03em;
  color: #fff;
  text-shadow: 0 2px 10px rgba(69, 10, 10, .25);
}
.hero-copy .lede { color: #ffe4e6; margin-bottom: 20px; font-size: 15.5px; }
.portal-hero .btn { background: #fff; color: var(--red-dark); border-color: #fff; box-shadow: 0 4px 14px rgba(69, 10, 10, .2); }
.portal-hero .btn:hover { background: #fff1f2; border-color: #fff1f2; }
.portal-hero .btn.gold { background: linear-gradient(135deg, #fef08a 0%, #f59e0b 100%); border-color: #fbbf24; color: #450a0a; font-weight: 800; }
.portal-hero .btn.ghost { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .55); box-shadow: none; }
.portal-hero .btn.ghost:hover { background: rgba(255, 255, 255, .24); }
.hero-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, .2);
  font-size: 13px;
  color: #ffe4e6;
}
.hero-metrics strong { color: #fef08a; font-size: 16px; margin-right: 4px; }

.hero-toolbox {
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(8px);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}
.hero-toolbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.hero-toolbox-head h2 { margin: 0; font-size: 15.5px; color: #fff; border: 0; padding: 0; }
.hero-toolbox-head a { color: #fde68a; font-size: 13px; font-weight: 600; }
.quick-tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.quick-tool-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: rgba(255, 255, 255, .96);
  color: var(--ink);
  border-radius: 12px;
  padding: 11px 12px;
  transition: transform .15s, box-shadow .15s;
}
.quick-tool-item:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 0, 0, .2); text-decoration: none; }
.quick-tool-item strong { font-size: 14px; color: var(--ink); display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.quick-tool-item span { font-size: 12px; color: var(--muted); }

/* ---------- Section Heading & Filter Tabs ---------- */
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 28px 0 14px;
}
.section-heading h2 {
  margin: 0;
  border-left: 4px solid var(--red);
  padding-left: 12px;
  font-size: clamp(20px, 2.6vw, 25px);
}
.filter-pills {
  display: inline-flex;
  background: #e2e8f0;
  padding: 3px;
  border-radius: 10px;
  gap: 3px;
}
.filter-pill {
  border: 0;
  background: transparent;
  padding: 6px 14px;
  border-radius: 8px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink-2);
  cursor: pointer;
}
.filter-pill.is-active, .filter-pill[aria-pressed="true"] {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
}

/* ---------- Lottery Draw Cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
  gap: 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #cbd5e1; }
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-title { display: flex; align-items: center; gap: 8px; }
.card-title h3 { margin: 0; font-size: 18px; }
.card-title h3 a { color: var(--ink); }
.card-title h3 a:hover { color: var(--red); }
.issue { color: var(--muted); font-size: 13px; margin: 0; font-variant-numeric: tabular-nums; }
.meta { font-size: 13px; color: var(--ink-2); background: var(--line-2); padding: 6px 10px; border-radius: 8px; margin: 0; font-variant-numeric: tabular-nums; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 4px; }

/* ---------- Balls ---------- */
.balls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 2px 0; }
.balls.big .ball { width: 42px; height: 42px; font-size: 19px; }
.ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fb7185, var(--red) 58%, var(--red-dark));
  color: #fff;
  font-weight: 750;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .18), 0 2px 4px rgba(217, 32, 56, .24);
}
.ball.extra {
  background: radial-gradient(circle at 32% 28%, #60a5fa, var(--blue) 58%, var(--blue-dark));
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .18), 0 2px 4px rgba(29, 78, 216, .24);
}
.card[data-cat="sports"] .ball:not(.extra) {
  background: radial-gradient(circle at 32% 28%, #60a5fa, #2563eb 58%, #1e40af);
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .18), 0 2px 4px rgba(37, 99, 235, .24);
}
.card[data-cat="sports"] .ball.extra {
  background: radial-gradient(circle at 32% 28%, #fbbf24, #d97706 58%, #b45309);
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .18), 0 2px 4px rgba(217, 119, 6, .24);
}
.ball-sep { color: var(--muted); font-weight: 700; margin: 0 2px; }

/* ---------- Tool Matrix & Entries ---------- */
.entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 14px;
}
.entry {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.entry:hover { transform: translateY(-2px); border-color: #cbd5e1; box-shadow: var(--shadow-md); }
.entry-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.entry h3 { margin: 0; font-size: 16.5px; }
.entry h3 a { color: var(--ink); }
.entry h3 a:hover { color: var(--red); }
.entry p { margin: 0; color: var(--muted); font-size: 13.5px; }

.portal-tools-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.tool-hub-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.tool-hub-panel.welfare { border-top: 4px solid var(--red); }
.tool-hub-panel.sports { border-top: 4px solid var(--blue); }
.tool-hub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.tool-hub-head h3 { margin: 0; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.tool-mini-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tool-mini-card {
  display: block;
  padding: 12px 13px;
  border: 1px solid var(--line-2);
  background: #f8fafc;
  border-radius: 12px;
  color: var(--ink);
  transition: all .15s;
}
.tool-mini-card:hover { background: #fff; border-color: var(--red); box-shadow: var(--shadow); text-decoration: none; }
.tool-hub-panel.sports .tool-mini-card:hover { border-color: var(--blue); }
.tool-mini-card strong { display: flex; align-items: center; justify-content: space-between; font-size: 14px; margin-bottom: 3px; }
.tool-mini-card span { display: block; font-size: 12px; color: var(--muted); }

@media (max-width: 860px) {
  .portal-hero { grid-template-columns: 1fr; }
  .portal-tools-split { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .tool-mini-list, .quick-tools-grid { grid-template-columns: 1fr; }
}

/* ---------- VIP Commercial Funnel & Pricing ---------- */
.vip-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 24px;
  background: radial-gradient(circle at 90% 15%, rgba(251, 191, 36, .26), transparent 50%), linear-gradient(135deg, #991b1b 0%, #7f0a14 55%, #450a0a 100%);
  border: 1px solid rgba(251, 191, 36, .4);
  color: #fff;
  border-radius: 20px;
  padding: clamp(20px, 3.5vw, 32px);
  margin-block: 28px;
  box-shadow: var(--shadow-lg);
}
.vip-banner h2 { border: 0; padding: 0; margin: 0 0 6px; color: #fef08a; font-size: clamp(20px, 2.8vw, 26px); }
.vip-banner p { margin: 0; color: #ffe4e6; max-width: 680px; font-size: 14.5px; }
.vip-banner-perks { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 10px; font-size: 13px; color: #fef3c7; }

.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
  gap: 18px;
  margin: 18px 0;
}
.plan {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  box-shadow: var(--shadow);
}
.plan.is-featured {
  border-color: var(--gold);
  box-shadow: 0 10px 28px rgba(217, 119, 6, .14);
  background: linear-gradient(180deg, #fffdf7 0%, #ffffff 35%);
}
.plan-badge {
  position: absolute;
  top: -12px;
  right: 18px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 999px;
}
.plan h3 { margin: 0; font-size: 19px; }
.plan-price-row { display: flex; align-items: baseline; gap: 8px; }
.plan .plan-price { color: var(--red-dark); font-size: 34px; font-weight: 850; font-variant-numeric: tabular-nums; margin: 0; }
.plan-unit { color: var(--muted); font-size: 13px; }
.plan-perks { list-style: none; padding: 0; margin: 6px 0 12px; display: grid; gap: 6px; font-size: 13.5px; color: var(--ink-2); }
.plan-perks li::before { content: "✓ "; color: var(--green); font-weight: 800; }
.plan .btn { margin-top: auto; }

.lock {
  background: linear-gradient(135deg, #fffbeb 0%, #fff7ed 100%);
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 22px 24px;
  margin: 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.lock h2 { border-left: 4px solid var(--gold); padding-left: 10px; margin: 0 0 6px; font-size: 19px; }
.lock p { margin: 0; color: var(--ink-2); max-width: 680px; }

/* ---------- Interactive Ball Picker (可视化选球盘) ---------- */
.picker-shell {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 12px 0;
}
.picker-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 10px;
}
.picker-title { font-size: 14px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.picker-quick { display: flex; flex-wrap: wrap; gap: 5px; }
.picker-quick button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  border-radius: 6px;
  padding: 3px 9px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.picker-quick button:hover { border-color: var(--red); color: var(--red); }
.picker-balls {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.pball {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform .1s, background .12s, border-color .12s, color .12s;
  user-select: none;
}
.pball:hover { transform: scale(1.06); border-color: var(--red); }
.pball.is-selected {
  background: radial-gradient(circle at 32% 28%, #fb7185, var(--red) 60%, var(--red-dark));
  border-color: var(--red-dark);
  color: #fff;
  box-shadow: 0 2px 6px rgba(217, 32, 56, .3);
}
.picker-shell.is-extra .pball:hover { border-color: var(--blue); }
.picker-shell.is-extra .pball.is-selected {
  background: radial-gradient(circle at 32% 28%, #60a5fa, var(--blue) 60%, var(--blue-dark));
  border-color: var(--blue-dark);
  color: #fff;
  box-shadow: 0 2px 6px rgba(29, 78, 216, .3);
}
.pball.is-dan {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #b45309;
  color: #fff;
  box-shadow: 0 2px 6px rgba(217, 119, 6, .35);
}
.pball.is-dan::after {
  content: "胆";
  position: absolute;
  top: -5px;
  right: -5px;
  background: #111827;
  color: #fde68a;
  font-size: 9px;
  line-height: 14px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}
.pball.is-kill {
  background: #334155;
  border-color: #1e293b;
  color: #94a3b8;
  text-decoration: line-through;
}
.picker-mode-tabs {
  display: inline-flex;
  background: #e2e8f0;
  padding: 2px;
  border-radius: 8px;
  gap: 2px;
}
.picker-mode-tabs button {
  border: 0;
  background: transparent;
  padding: 3px 10px;
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-2);
  cursor: pointer;
}
.picker-mode-tabs button.is-active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

/* ---------- Sports Parlay & Zucai Interactive Panels ---------- */
.match-row {
  display: grid;
  grid-template-columns: minmax(90px, 140px) repeat(3, minmax(0, 1fr)) auto;
  gap: 8px;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.match-pick {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 5px 8px;
  cursor: pointer;
}
.match-pick.is-on { border-color: var(--blue); background: var(--blue-soft); }
.match-pick span { font-size: 13px; font-weight: 700; min-width: 20px; }
.match-pick input { width: 100%; border: 0; background: transparent; padding: 2px 4px; margin: 0; font-size: 13.5px; font-variant-numeric: tabular-nums; min-height: 28px; }
.match-pick input:focus { box-shadow: none; outline: none; }

.zucai-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 10px;
  margin: 14px 0;
}
.zucai-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
}
.zucai-idx { font-weight: 750; font-size: 13.5px; color: var(--ink-2); min-width: 44px; }
.zucai-btns { display: flex; gap: 5px; }
.zbtn {
  width: 34px;
  height: 32px;
  border-radius: 7px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}
.zbtn.is-on { background: var(--blue); border-color: var(--blue); color: #fff; }
.zbtn-dan {
  padding: 0 8px;
  height: 32px;
  border-radius: 7px;
  border: 1px dashed #cbd5e1;
  background: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.zbtn-dan.is-on { background: var(--gold); border-color: var(--gold); border-style: solid; color: #fff; }

@media (max-width: 720px) {
  .match-row { grid-template-columns: 1fr; }
}

/* ---------- Tables ---------- */
.table-scroll { max-width: 100%; overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 14px;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
th, td { border-bottom: 1px solid var(--line-2); padding: 9px 10px; text-align: center; }
thead th { background: #f8fafc; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: 0; }
td { word-break: break-word; }
.balls-cell { white-space: nowrap; }
.balls-cell .ball { width: 25px; height: 25px; font-size: 12px; }
.facts { max-width: 580px; }
.facts th { text-align: left; width: 104px; background: #f8fafc; }
.facts td { text-align: left; }

/* ---------- Draw Page & Trend Chart ---------- */
.draw-page { --draw-accent: var(--red); --draw-rule: var(--line); }
.draw-crumb { display: flex; gap: 8px; color: var(--muted); font-size: 13.5px; margin-bottom: 12px; align-items: center; }
.draw-crumb a { color: var(--ink-2); font-weight: 600; }
.draw-hero {
  display: grid;
  grid-template-columns: minmax(225px, 1fr) minmax(0, 1.65fr);
  gap: 24px;
  align-items: center;
  padding: clamp(20px, 3vw, 34px);
  border-radius: 20px;
  background: radial-gradient(circle at 90% 10%, rgba(251, 191, 36, .24), transparent 46%), linear-gradient(135deg, #dc2626 0%, #b91c1c 56%, #7f0a14 100%);
  border: 1px solid rgba(253, 230, 138, .25);
  color: #fff;
  margin-bottom: 20px;
  box-shadow: var(--shadow-lg);
}
.draw-intro h1 { font-size: clamp(28px, 4.5vw, 48px); letter-spacing: -.04em; margin: 0 0 14px; color: #fff; }
.draw-intro h1 small { display: block; font-size: clamp(14px, 2vw, 18px); font-weight: 500; letter-spacing: .04em; margin-top: 4px; color: #fda4af; }
.draw-jumps { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.draw-jumps a { color: #f8fafc; border-bottom: 1px solid rgba(255, 255, 255, .45); font-size: 13.5px; font-weight: 600; }
.draw-more { margin-top: 9px; }
.draw-current {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 16px;
  padding: clamp(14px, 2.2vw, 22px);
  background: rgba(255, 255, 255, .07);
  margin: 0;
}
.draw-current-head { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.draw-current h2 { border: 0; padding: 0; margin: 0; font-size: 17px; color: #fff; }
.draw-current time { color: #cbd5e1; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.draw-current .balls { margin-block: 14px; }
.draw-current .ball-sep { color: #cbd5e1; }
.draw-facts { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .15); }
.draw-facts > div { display: flex; align-items: baseline; gap: 6px; }
.draw-facts dt { font-size: 12.5px; color: #cbd5e1; }
.draw-facts dd { margin: 0; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.draw-detail { display: inline-block; margin-top: 9px; font-size: 13.5px; color: #fde68a; font-weight: 600; }
.draw-section {
  background: #fff;
  border: 1px solid var(--draw-rule);
  border-radius: var(--radius);
  padding: clamp(16px, 2.6vw, 24px);
  margin: 0 0 16px;
  min-width: 0;
  box-shadow: var(--shadow);
}
.draw-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 10px; }
.draw-section h2 { border: 0; padding: 0; margin: 0; font-size: clamp(19px, 2.6vw, 23px); }
.draw-section h2 small { margin-inline-start: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.draw-window { display: flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: 10px; background: var(--line-2); }
.draw-window a { padding: 5px 11px; border-radius: 7px; font-size: 13.5px; color: var(--ink-2); font-weight: 600; }
.draw-window a[aria-current] { background: #fff; color: var(--red); box-shadow: var(--shadow); font-weight: 700; }
.draw-statistics { align-items: start; }
.draw-statistics .table-scroll { max-height: 420px; overflow: auto; }

.trend-panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: clamp(14px, 2.5vw, 24px); }
.draw-page .trend-panel { border: 0; padding: 0; margin-top: 8px; }
.trend-stats { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0 0 12px; }
.trend-stats > div { display: flex; align-items: baseline; gap: 7px; }
.trend-stats dt { font-size: 13.5px; color: var(--muted); }
.trend-stats dd { margin: 0; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.trend-stats > div:first-child dd { color: var(--red-dark); }
.trend-legend { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: 13.5px; }
.trend-legend span { display: inline-flex; align-items: center; gap: 7px; }
.trend-legend span::before { content: ''; width: 16px; border-top: 2px solid var(--red); }
.trend-legend .trend-mean-key::before { border-top: 2px dashed #64748b; }
.trend-plot { display: block; width: 100%; height: auto; margin-block: 4px 12px; overflow: visible; }
.trend-grid { stroke: #e2e8f0; stroke-width: 1; }
.trend-axis { fill: #64748b; font-size: 16px; font-variant-numeric: tabular-nums; }
.trend-area { fill: url(#trend-fill); }
.trend-plot stop { stop-color: var(--red); }
.trend-mean { stroke: #64748b; stroke-width: 1; stroke-dasharray: 5 5; }
.trend-line { fill: none; stroke: var(--red); stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.trend-dot { fill: var(--red); }
.trend-active { fill: var(--red); stroke: #fff; stroke-width: 2; }
.trend-crosshair { stroke: var(--red); stroke-width: 1; stroke-dasharray: 3 4; }
.trend-target { cursor: crosshair; }
.trend-inspect:not([hidden]) { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.trend-inspect label { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.trend-inspect input { width: clamp(100px, 22vw, 260px); accent-color: var(--red); }
.trend-inspect output { color: var(--red-dark); font-weight: 700; font-variant-numeric: tabular-nums; }
.trend-data { margin-bottom: 0; }
@media (max-width: 680px) {
  .draw-hero { grid-template-columns: 1fr; gap: 14px; padding: 18px; }
  .trend-axis { font-size: 32px; }
  .trend-axis-extra { display: none; }
  .trend-line { stroke-width: 4; }
}

/* ---------- Forms, Workbench & Shrink Workspace ---------- */
.half { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 860px) { .half { grid-template-columns: 1fr; } }

.archive-form {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0;
  box-shadow: var(--shadow);
}
.archive-form label { display: grid; gap: 5px; flex: 1 1 160px; min-width: 0; font-size: 13.5px; font-weight: 650; color: var(--ink-2); }
.archive-form input, .archive-form select {
  min-width: 0;
  width: 100%;
  min-height: 40px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  padding: 6px 10px;
}

form label { display: block; margin: 12px 0; font-size: 14px; font-weight: 650; color: var(--ink-2); }
form input, form select, form textarea {
  display: block;
  width: 100%;
  max-width: 480px;
  padding: 9px 12px;
  margin-top: 5px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-family: var(--font);
  background: #fff;
  color: var(--ink);
}
form input:focus, form select:focus, form textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(217, 32, 56, .12); }
form textarea { resize: vertical; line-height: 1.55; }
.field-hint { display: block; margin-top: 4px; font-size: 12.5px; font-weight: 400; color: var(--muted); }
label.agree { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; font-size: 13.5px; cursor: pointer; }
label.agree input { width: auto; max-width: none; margin: 3px 0 0; }
.pw-field { display: flex; align-items: stretch; max-width: 480px; }
.pw-field input { flex: 1; max-width: none; margin-top: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.pw-toggle { flex: none; border: 1px solid #cbd5e1; border-left: 0; background: #f8fafc; color: var(--ink-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 0 14px; font-size: 13.5px; cursor: pointer; margin-top: 5px; }

.shrink-page { --tool-accent: var(--red); }
.shrink-hero {
  margin: 10px 0 20px;
  border-radius: 20px;
  padding: clamp(22px, 4vw, 38px);
  color: #fff;
  background: radial-gradient(circle at 90% 12%, rgba(251, 191, 36, .24), transparent 46%), linear-gradient(135deg, #e11d2e 0%, #b91c1c 58%, #7f0a14 100%);
  border: 1px solid rgba(253, 230, 138, .28);
  box-shadow: var(--shadow-lg);
}
.shrink-hero.is-sports { background: radial-gradient(circle at 90% 12%, rgba(251, 191, 36, .22), transparent 46%), linear-gradient(135deg, #c81020 0%, #991b1b 50%, #1e3a8a 100%); }
.shrink-hero h1 { margin: 0 0 8px; font-size: clamp(24px, 4vw, 38px); color: #fff; }
.shrink-hero p { margin: 0; max-width: 52em; color: #ffe4e6; }

.shrink-workspace { display: grid; grid-template-columns: minmax(0, 2.15fr) minmax(290px, 1fr); gap: 20px; align-items: start; }
.shrink-editor { display: grid; gap: 16px; min-width: 0; }
.shrink-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(16px, 2.5vw, 24px);
  margin: 0;
  box-shadow: var(--shadow);
}
.shrink-card h2 { border: 0; padding: 0; margin: 0 0 12px; font-size: 19px; }
.shrink-card h3 { margin: 18px 0 8px; font-size: 15px; }
.shrink-card .tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.shrink-card .tool-grid label, .shrink-paste { display: grid; align-content: start; gap: 5px; font-weight: 650; font-size: 13.5px; min-width: 0; margin: 0; }
.shrink-paste { border-top: 1px solid var(--line-2); padding-top: 14px; margin-top: 14px; }
.shrink-card input:not([type=radio]):not([type=checkbox]), .shrink-card select, .shrink-card textarea {
  max-width: none;
  width: 100%;
  min-height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 7px 10px;
  background: #f8fafc;
  font: inherit;
  font-weight: 400;
}
.shrink-card textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; }
.shrink-card input:focus, .shrink-card textarea:focus, .shrink-card select:focus { background: #fff; border-color: var(--red); }

.tool-lottery { display: flex; flex-wrap: wrap; gap: 6px; background: var(--line-2); padding: 4px; border-radius: 12px; width: fit-content; margin-bottom: 10px; }
.tool-lottery-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  margin: 0;
  color: var(--ink-2);
}
.tool-lottery-btn input { width: auto; margin: 0; accent-color: var(--red); }
.tool-lottery-btn:has(input:checked) { background: #fff; border-color: var(--line); color: var(--red); box-shadow: var(--shadow); }

.shrink-results { position: sticky; top: 88px; min-width: 0; }
.shrink-summary { border-radius: 11px; background: var(--red-soft); color: var(--red-dark); padding: 14px; font-size: 14px; font-weight: 600; min-height: 64px; margin: 0 0 12px; }
.shrink-actions { display: flex; gap: 8px; margin: 10px 0; }
.shrink-actions .btn:first-child { flex: 1; }
.tool-results {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.75;
  max-height: 40vh;
  overflow: auto;
  white-space: pre;
  margin: 10px 0;
}
.range-pair { display: flex; align-items: center; gap: 6px; }
.range-pair input { flex: 1; min-width: 0; }
.shrink-note { margin: 12px 4px; color: var(--muted); font-size: 13px; }

.workbench-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
  padding: 20px 24px;
  margin: 10px 0 14px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--red);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}
.workbench-title.is-sports { border-top-color: var(--blue); }
.workbench-title h1 { font-size: clamp(22px, 3vw, 32px); margin: 0; }
.workbench-title p { color: var(--muted); margin: 4px 0 0; }
.workbench-games { display: flex; flex-wrap: wrap; gap: 6px 8px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.workbench-games a { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); padding: 9px 14px; font-size: 14px; font-weight: 600; }
.workbench-games a[aria-current] { color: var(--red); font-weight: 750; box-shadow: inset 0 -3px var(--red); }
.workbench { display: grid; grid-template-columns: minmax(170px, 210px) minmax(0, 1fr); align-items: start; gap: 18px; }
.workbench-nav { display: grid; gap: 4px; padding: 8px; border: 1px solid var(--line); background: #fff; border-radius: 14px; box-shadow: var(--shadow); }
.workbench-nav a { display: block; color: var(--ink-2); padding: 9px 12px; font-size: 14px; font-weight: 600; border-radius: 8px; }
.workbench-nav a[aria-current], .workbench-nav a:hover { color: var(--red-dark); background: var(--red-soft); text-decoration: none; }
.workbench-main { min-width: 0; }
.welfare-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 10px; }
.welfare-form label { display: grid; align-content: start; min-width: 0; gap: 5px; font-weight: 650; margin: 0; }
.welfare-wide { grid-column: 1 / -1; }
.welfare-output { margin-top: 16px; }
.workbench-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.workbench-stats div { padding: 10px 14px; background: var(--red-soft); border-radius: 10px; }
.workbench-stats dt { font-size: 12.5px; color: var(--red-dark); font-weight: 600; }
.workbench-stats dd { font-weight: 800; font-size: 20px; margin: 2px 0 0; font-variant-numeric: tabular-nums; }

@media (max-width: 880px) {
  .shrink-workspace { grid-template-columns: 1fr; }
  .shrink-results { position: static; }
  .shrink-card .tool-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .workbench { grid-template-columns: 1fr; gap: 12px; }
  .workbench-nav { display: flex; overflow-x: auto; }
  .workbench-nav a { white-space: nowrap; }
  .welfare-form, .shrink-card .tool-grid { grid-template-columns: 1fr; }
}

/* ---------- Auth / Member / Articles / FAQ / Matrix Charts ---------- */
.auth-wrap { display: flex; justify-content: center; padding: 16px 0; }
.auth-card { width: 100%; max-width: 460px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 30px; box-shadow: var(--shadow-lg); }
.auth-head { text-align: center; margin-bottom: 8px; }
.auth-head h1 { font-size: 24px; margin: 0 0 6px; }
.auth-radio { position: absolute; opacity: 0; pointer-events: none; }
.auth-tabs { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 4px; margin: 16px 0 8px; }
.auth-tabs label { flex: 1; text-align: center; padding: 9px 0; border-radius: 7px; font-size: 15px; font-weight: 700; color: var(--muted); cursor: pointer; margin: 0; }
#tab-login:checked ~ .auth-tabs label[for="tab-login"],
#tab-register:checked ~ .auth-tabs label[for="tab-register"] { background: #fff; color: var(--red); box-shadow: var(--shadow); }
.auth-panel { display: none; }
#tab-login:checked ~ .auth-panels .panel-login { display: block; }
#tab-register:checked ~ .auth-panels .panel-register { display: block; }
.auth-card form input, .auth-card .pw-field { max-width: none; }
.auth-note { text-align: center; color: var(--muted); font-size: 13px; margin: 16px 0 0; border-top: 1px solid var(--line-2); padding-top: 14px; }
.captcha-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.captcha-img { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; display: block; }

.msg { background: var(--green-soft); border: 1px solid #86efac; color: var(--green); border-radius: var(--radius-sm); padding: 11px 15px; font-size: 14.5px; }
.msg.err { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }
.announce { background: var(--blue-soft); border: 1px solid #bfdbfe; border-radius: var(--radius); padding: 14px 18px; margin: 16px 0; }
.announce h2 { margin: 0 0 8px; font-size: 17px; }
.announce ul { margin: 0; padding-left: 18px; }
.article-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; margin: 12px 0; }
.article-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.article-card h3 { margin: 0 0 4px; font-size: 17px; }
.article-card h3 a { color: var(--ink); }
.article-meta { color: var(--muted); font-size: 12.5px; }
.article { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.article-summary { background: var(--bg); border-left: 4px solid var(--blue); padding: 12px 16px; border-radius: 0 8px 8px 0; }
.member-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }

.answer { font-size: 17px; background: #fff; border-left: 4px solid var(--red); border-radius: 0 10px 10px 0; padding: 14px 18px; box-shadow: var(--shadow); }
.crumbs { color: var(--muted); font-size: 13.5px; margin: 4px 0 8px; }
.pager { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 20px 0; }
.range-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.range-nav .btn[aria-current] { background: var(--red); border-color: var(--red); color: #fff; }
.method-list dt { font-weight: 700; margin-top: 12px; }
.method-list dd { margin-inline-start: 0; color: var(--ink-2); }
.guide { display: grid; gap: 12px; max-width: 840px; margin-top: 16px; }
.guide section { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.guide h2 { margin-top: 0; }
.note { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; margin-top: 24px; }

details { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 16px; margin: 10px 0; box-shadow: var(--shadow); }
details summary { cursor: pointer; font-weight: 650; font-size: 15px; }
details p { margin: 8px 0 2px; color: var(--ink-2); }

.distribution-scroll { max-height: 560px; }
.distribution-table { width: max-content; min-width: 100%; overflow: visible; margin: 0; border-collapse: separate; border-spacing: 0; }
.distribution-table th, .distribution-table td { padding: 6px 8px; min-width: 34px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.distribution-table thead th { position: sticky; top: 0; z-index: 2; }
.distribution-table tr > th:first-child { position: sticky; left: 0; background: #f8fafc; z-index: 1; }
.distribution-table thead tr > th:first-child { z-index: 3; }
.distribution-table .chart-hit { color: var(--red-dark); background: var(--red-soft); font-weight: 750; }
.distribution-table .chart-miss { color: var(--muted); }
.board-table thead tr:nth-child(2) th { position: static; }
.board-table .board-token { display: inline-block; color: var(--red-dark); background: var(--red-soft); border-radius: 6px; padding-inline: 5px; }
.board-table .board-collision { text-decoration: line-through; color: var(--muted); background: #f1f5f9; }
.metric-trend { display: block; width: 100%; max-width: 900px; color: var(--red); margin: 12px auto; }
.metric-frequency { display: grid; gap: 8px; padding: 0; max-width: 680px; list-style: none; }
.metric-frequency li { display: grid; grid-template-columns: minmax(3.5rem, auto) minmax(50px, 1fr) auto; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
.metric-frequency meter { width: 100%; }
.metric-frequency meter::-webkit-meter-optimum-value { background: var(--red); }

.matrix-scroll { max-height: min(68vh, 760px); }
.matrix-sheet { position: relative; width: max-content; min-width: 100%; }
.matrix-table { background: #fff; }
.matrix-table th, .matrix-table td { min-width: 29px; height: 30px; padding: 3px 5px; }
.matrix-table thead th { background: #f8fafc; z-index: 4; }
.matrix-table thead tr:nth-child(2) th { top: 30px; left: auto; z-index: 4; }
.matrix-table tbody th:first-child { z-index: 3; }
.matrix-table thead tr:first-child th:first-child { z-index: 5; }
.matrix-divider { border-inline-start: 1px solid #cbd5e1; }
.matrix-result { font-weight: 750; color: var(--red-dark); }
.matrix-omission { color: #94a3b8; font-size: 12px; }
.matrix-hit { position: relative; z-index: 2; display: inline-grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; color: #fff; background: var(--red); font-weight: 700; }
.matrix-hit sup { position: absolute; top: -4px; right: -9px; color: var(--red-dark); background: #fff; font-size: 9px; }
.matrix-zone-0 .matrix-hit { background: #0f766e; }
.matrix-zone-2 .matrix-hit { background: #3730a3; }
.matrix-zone-3 .matrix-hit { background: #b45309; }
.matrix-zone-4 .matrix-hit { background: #6d28d9; }
.matrix-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.matrix-lines polyline { fill: none; stroke-width: 1.6; stroke-linejoin: round; opacity: .66; }
.matrix-line-0 { stroke: #0f766e; }
.matrix-line-1 { stroke: var(--red); }
.matrix-line-2 { stroke: #3730a3; }
.matrix-line-3 { stroke: #b45309; }
.matrix-line-4 { stroke: #6d28d9; }
.matrix-hide-omissions .matrix-omission { visibility: hidden; }
.matrix-hide-lines .matrix-lines { display: none; }
.matrix-toggles label { min-height: 34px; display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; margin: 0; }
.matrix-toggles input { width: auto; accent-color: var(--red); margin: 0; }
[data-simulation] input { width: 100%; min-width: 52px; max-width: 125px; border: 1px solid var(--line); border-radius: 7px; padding: 7px; font: inherit; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 28px 0 36px;
  font-size: 13.5px;
  color: var(--muted);
}
.foot-nav { margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.foot-nav a { color: var(--ink-2); font-weight: 600; }
.site-footer p { margin: 5px 0; }
.admin-actions { white-space: nowrap; }
.admin-actions .btn { margin: 2px; }

/* ---------- Site-wide Pinned Notice Bar ---------- */
.site-notice-bar {
  background: #fff7ed;
  border-bottom: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 13.5px;
  padding-block: 8px;
}
.site-notice-bar.level-info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }
.site-notice-bar.level-urgent { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.notice-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.notice-body { color: inherit; opacity: .9; }
.notice-cta { font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.notice-all { margin-left: auto; font-size: 12.5px; color: var(--muted); }

/* ---------- Mobile Bottom Tabbar & Responsive Ergonomics ---------- */
.mobile-tabbar { display: none; }

@media (max-width: 768px) {
  body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .site-header { position: static; }
  .header-top { padding-block: 9px; gap: 8px; }
  .brand { font-size: 21px; }
  .brand small { display: none; }
  .main-nav {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 4px;
    padding-bottom: 2px;
  }
  .main-nav::-webkit-scrollbar { display: none; }
  .main-nav a { white-space: nowrap; flex-shrink: 0; padding: 6px 10px; font-size: 13.5px; }
  .portal-hero, .shrink-hero, .draw-hero { padding: 18px 16px; border-radius: 16px; }
  .hero-copy h1 { font-size: 24px; }
  .hero-metrics { gap: 10px 16px; margin-top: 14px; padding-top: 14px; }
  .cards { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .card { padding: 15px; }
  .btn { min-height: 40px; }
  /* Prevent iOS Safari zoom on input focus */
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px !important; }
  .shrink-card .tool-lottery { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shrink-card .tool-lottery-btn { justify-content: center; min-height: 42px; font-size: 13.5px; }
  .picker-balls { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
  .pball { width: 100%; height: auto; aspect-ratio: 1; max-width: 44px; margin: 0 auto; font-size: 14px; }
  .picker-quick button { min-height: 34px; padding: 4px 10px; font-size: 12.5px; }
  .match-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 6px;
  }
  .match-row [data-match-name] { grid-column: 1 / 3; }
  .match-row [data-remove-match] { grid-column: 3 / 4; justify-self: end; }
  .match-pick { padding: 6px; flex-direction: column; align-items: stretch; gap: 3px; text-align: center; }
  .match-pick input[type="number"] { text-align: center; min-height: 30px; }
  .zucai-grid { grid-template-columns: minmax(0, 1fr); }
  .zbtn, .zbtn-dan { min-height: 38px; min-width: 38px; }
  .notice-inner { font-size: 12.5px; }
  .notice-all { margin-left: 0; }
  .site-footer { padding: 22px 0 28px; }
  .mobile-tabbar {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px rgba(15, 23, 42, .06);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .mobile-tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: 5px 2px;
    font-size: 11px;
    font-weight: 650;
    color: var(--muted);
    text-decoration: none;
    border-radius: 8px;
  }
  .mobile-tabbar .mtab-ico { font-size: 18px; line-height: 1.15; }
  .mobile-tabbar a[aria-current="page"] { color: var(--red); background: var(--red-soft); }
  .ai-fab-wrap { bottom: calc(70px + env(safe-area-inset-bottom)) !important; right: 12px !important; }
  .ai-drawer { width: calc(100vw - 24px) !important; max-height: 70vh !important; }
  .ai-shrink-row { flex-direction: column; }
}

/* ---------- AI Components (Shrink Prompt / Advice / Floating Chat) ---------- */
.ai-shrink-box {
  background: linear-gradient(135deg, #fffdf7 0%, #fff5f5 100%);
  border: 1.5px solid #fed7aa;
}
.ai-shrink-row { display: flex; gap: 8px; margin-top: 8px; }
.ai-shrink-row input { flex: 1; margin: 0 !important; }
.ai-advice-card {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--ink);
}
.ai-advice-card strong { display: block; margin-bottom: 6px; color: #92400e; }
.ai-advice-card p { margin: 0; line-height: 1.6; }

.ai-fab-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 90; }
.ai-fab {
  background: linear-gradient(135deg, #d91c2b 0%, #991b1b 100%);
  color: #fef08a;
  border: 1.5px solid rgba(254, 240, 138, .65);
  border-radius: 999px;
  padding: 11px 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(153, 27, 27, .35);
}
.ai-fab:hover { transform: translateY(-2px); }
.ai-drawer {
  position: absolute;
  right: 0;
  bottom: 54px;
  width: 360px;
  max-height: 520px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ai-drawer-head {
  background: linear-gradient(90deg, #b91c1c, #dc2626);
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
}
.ai-close { background: transparent; border: 0; color: #fff; font-size: 16px; cursor: pointer; padding: 2px 6px; }
.ai-messages {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 200px;
  max-height: 300px;
  background: #fdfafa;
}
.ai-messages-tall { min-height: 320px; max-height: 440px; border: 1px solid var(--line); border-radius: 12px; }
.ai-msg {
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.55;
  max-width: 88%;
  white-space: pre-wrap;
  word-break: break-word;
}
.ai-msg-bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); color: var(--ink); }
.ai-msg-user { align-self: flex-end; background: var(--red); color: #fff; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--line-2); }
.ai-chips button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.ai-chips button:hover { border-color: var(--red); color: var(--red); }
.ai-form { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); background: #fff; }
.ai-form input { flex: 1; margin: 0 !important; min-height: 38px; padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; }

/* ---------- Modern Admin Shell (Left Sidebar + Categorized Workspace) ---------- */
.admin-login-body {
  background: radial-gradient(circle at 80% 10%, rgba(251, 191, 36, .18), transparent 45%), linear-gradient(135deg, #450a0a 0%, #7f0a14 50%, #1a1112 100%);
}
.admin-body { background: #f4f1f1; padding-bottom: 0 !important; }
.admin-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}
.admin-sidebar {
  background: linear-gradient(180deg, #1f1214 0%, #2d1216 100%);
  color: #f5e6e8;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, .08);
  z-index: 95;
}
.admin-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.admin-brand a { font-size: 22px; font-weight: 850; color: #fff; letter-spacing: -.03em; }
.admin-brand a span { color: var(--gold-light); }
.admin-brand a:hover { text-decoration: none; }
.admin-brand small {
  font-size: 11px;
  background: rgba(254, 240, 138, .16);
  color: #fde68a;
  padding: 2px 7px;
  border-radius: 999px;
}
.admin-nav { padding: 12px 10px; display: grid; gap: 3px; flex: 1; align-content: start; }
.admin-nav-group {
  font-size: 11px;
  font-weight: 700;
  color: #b79a9e;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 10px 10px 4px;
}
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #f3e8ea;
  font-size: 14px;
  font-weight: 600;
  transition: background .15s, color .15s;
}
.admin-nav-item:hover { background: rgba(255, 255, 255, .09); color: #fff; text-decoration: none; }
.admin-nav-item.is-active {
  background: linear-gradient(90deg, #e11d2e 0%, #b91c1c 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(225, 29, 46, .35);
}
.admin-nav-ico { font-size: 16px; width: 20px; text-align: center; }
.admin-nav-badge {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  color: #fde68a;
}
.admin-nav-item.is-active .admin-nav-badge { background: rgba(0, 0, 0, .25); color: #fff; }
.admin-sidebar-foot {
  padding: 14px 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, .1);
  display: grid;
  gap: 8px;
  font-size: 13px;
}
.admin-sidebar-foot a { color: #e2cfd2; padding: 6px 8px; border-radius: 8px; }
.admin-sidebar-foot a:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }

.admin-main { min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 12px clamp(16px, 3vw, 28px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 40;
}
.admin-topbar-left { display: flex; align-items: center; gap: 10px; }
.admin-topbar h1 { margin: 0; font-size: 20px; }
.admin-menu-btn { display: none; }
.admin-content { padding: clamp(16px, 3vw, 26px); max-width: 1180px; width: 100%; }

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.admin-kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 3px solid var(--red);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-kpi span { font-size: 13px; color: var(--muted); font-weight: 600; }
.admin-kpi strong { font-size: 24px; color: var(--ink); font-variant-numeric: tabular-nums; }
.admin-kpi strong small { font-size: 14px; color: var(--red-dark); font-weight: 700; }
.admin-kpi a { font-size: 13px; font-weight: 650; margin-top: 4px; }

@media (max-width: 860px) {
  .admin-shell { grid-template-columns: minmax(0, 1fr); }
  .admin-menu-btn { display: inline-flex; }
  .admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 256px;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  .admin-shell.is-open .admin-sidebar { transform: translateX(0); }
  .admin-backdrop:not([hidden]) {
    display: block !important;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 90;
  }
}


