:root {
  --ink: #142334;
  --ink-soft: #536274;
  --muted: #8591a0;
  --line: #e4e9ef;
  --line-strong: #d4dce5;
  --canvas: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --brand: #0c7c8c;
  --brand-deep: #075d6b;
  --brand-soft: #e8f5f6;
  --signal: #f39a3d;
  --signal-soft: #fff3e3;
  --success: #1f9d74;
  --success-soft: #e8f7f1;
  --danger: #d15c58;
  --danger-soft: #fceceb;
  --shadow-sm: 0 1px 2px rgba(20, 35, 52, 0.03), 0 8px 24px rgba(20, 35, 52, 0.035);
  --shadow-md: 0 14px 40px rgba(20, 35, 52, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.icon {
  width: 17px;
  height: 17px;
  display: inline-block;
  vertical-align: middle;
  flex: 0 0 auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell { min-height: 100vh; }

/* Public site */
.public-topbar {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 0 clamp(20px, 4vw, 64px);
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
}

.brand-lockup { display: inline-flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: var(--brand);
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.04em;
  box-shadow: 0 6px 14px rgba(12,124,140,.18);
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-copy { min-width: 0; }
.brand-name { display: block; max-width: 220px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; font-weight: 760; letter-spacing: -.02em; }
.brand-domain { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }

.public-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.public-nav a { color: var(--ink-soft); padding: 9px 12px; border-radius: 8px; font-size: 13px; transition: .18s ease; }
.public-nav a:hover, .public-nav a.active { color: var(--brand-deep); background: var(--brand-soft); }
.public-actions { display: flex; align-items: center; gap: 10px; }

.button {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  transition: .18s ease;
  font-weight: 650;
}
.button-primary { color: white; background: var(--brand); box-shadow: 0 5px 12px rgba(12,124,140,.15); }
.button-primary:hover { background: var(--brand-deep); transform: translateY(-1px); }
.button-secondary { color: var(--ink); background: white; border-color: var(--line-strong); }
.button-secondary:hover { border-color: var(--brand); color: var(--brand-deep); background: #fbffff; }
.button-quiet { color: var(--ink-soft); background: transparent; }
.button-quiet:hover { color: var(--brand-deep); background: var(--surface-soft); }
.button-danger { color: var(--danger); background: var(--danger-soft); border-color: #f4d3d1; }
.button-sm { min-height: 32px; padding: 0 10px; font-size: 12px; }
.button-icon { width: 34px; height: 34px; padding: 0; }

.public-main { max-width: 1440px; margin: 0 auto; padding: 26px clamp(20px, 4vw, 64px) 56px; }
.public-hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, .85fr); gap: 28px; align-items: stretch; margin: 12px 0 22px; }
.hero-copy { padding: 25px 4px 18px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--brand-deep); font-size: 11px; font-weight: 760; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 4px var(--signal-soft); }
.hero-copy h1 { max-width: 700px; margin: 18px 0 14px; font-size: clamp(34px, 4.4vw, 60px); line-height: 1.08; letter-spacing: -.065em; font-weight: 780; }
.hero-copy p { max-width: 565px; margin: 0; color: var(--ink-soft); font-size: 16px; line-height: 1.8; }
.hero-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.meta-item { display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; color: var(--ink-soft); background: rgba(255,255,255,.66); border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.meta-item .icon { width: 14px; height: 14px; color: var(--brand); }

.draw-panel { position: relative; overflow: hidden; color: white; background: #173b49; border-radius: 16px; padding: 25px; min-height: 294px; box-shadow: var(--shadow-md); }
.draw-panel::before { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, rgba(42,160,158,.35), transparent 42%, rgba(243,154,61,.18)); pointer-events: none; }
.draw-panel-content { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; }
.draw-panel-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dark-kicker { color: #b9ced3; font-size: 12px; }
.draw-period { margin-top: 5px; font-size: 13px; font-weight: 700; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; color: #a4f0d0; background: rgba(28, 154, 113, .18); border: 1px solid rgba(133, 239, 200, .2); border-radius: 99px; padding: 6px 9px; font-size: 10px; font-weight: 780; letter-spacing: .07em; }
.live-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #76e6b8; box-shadow: 0 0 0 4px rgba(118,230,184,.12); }
.draw-number { display: flex; align-items: center; gap: 10px; margin: auto 0 19px; }
.draw-ball { width: 58px; height: 58px; display: grid; place-items: center; color: var(--ink); background: #fff; border-radius: 50%; font-size: 23px; font-weight: 780; box-shadow: 0 8px 16px rgba(0,0,0,.12); }
.draw-plus { color: #a5bec4; font-size: 20px; }
.draw-result-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.draw-sum-label { color: #b9ced3; font-size: 12px; }
.draw-sum { margin-top: 2px; font-size: 30px; line-height: 1; font-weight: 780; letter-spacing: -.04em; }
.result-tags { display: flex; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.result-tag { padding: 6px 9px; border-radius: 6px; color: #d8f5f3; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.1); font-size: 11px; font-weight: 650; }

.ad-strip { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; padding: 15px 18px; margin-bottom: 22px; background: #fff; border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow-sm); }
.ad-strip-label { color: var(--signal); font-size: 10px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.ad-strip-title { margin-top: 4px; font-size: 14px; font-weight: 720; }
.ad-strip-note { margin-top: 3px; color: var(--muted); font-size: 12px; }
.ad-strip a { color: var(--brand-deep); font-weight: 700; font-size: 12px; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 34px 0 13px; }
.section-heading h2 { margin: 0; font-size: 19px; letter-spacing: -.035em; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.section-link { display: inline-flex; align-items: center; gap: 5px; color: var(--brand-deep); font-size: 12px; font-weight: 700; }

.overview-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 20px; align-items: start; }
.surface { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.history-surface { overflow: hidden; }
.surface-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.surface-header h3 { margin: 0; font-size: 14px; }
.surface-header span { color: var(--muted); font-size: 12px; }
.history-table { width: 100%; border-collapse: collapse; }
.history-table th { padding: 12px 17px; color: var(--muted); background: var(--surface-soft); font-size: 11px; text-align: left; font-weight: 650; }
.history-table td { padding: 13px 17px; border-top: 1px solid var(--line); font-size: 12px; vertical-align: middle; }
.history-table tr:hover td { background: #fcfefe; }
.period-cell { color: var(--ink); font-weight: 700; }
.period-cell small { display: block; color: var(--muted); font-weight: 500; margin-top: 3px; }
.mini-balls { display: flex; align-items: center; gap: 5px; }
.mini-ball { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; color: var(--ink); background: #eef2f4; font-size: 10px; font-weight: 760; }
.mini-ball.accent { color: #fff; background: var(--brand); }
.sum-value { font-weight: 780; font-size: 14px; }
.table-tag { display: inline-flex; align-items: center; padding: 5px 7px; border-radius: 5px; font-size: 11px; font-weight: 650; }
.table-tag.large { color: #a36516; background: var(--signal-soft); }
.table-tag.small { color: #33717b; background: var(--brand-soft); }
.table-tag.odd { color: #9a5b21; background: #fff5e9; }
.table-tag.even { color: #366c78; background: #edf7f7; }

.side-stack { display: grid; gap: 16px; }
.side-panel { padding: 18px; }
.side-panel h3 { margin: 0; font-size: 14px; }
.side-panel-subtitle { margin: 5px 0 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.countdown-box { padding: 14px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 9px; }
.countdown-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.countdown-time { margin: 9px 0 12px; font-size: 28px; line-height: 1; font-weight: 780; letter-spacing: -.05em; }
.progress-track { height: 6px; overflow: hidden; background: #e6ecef; border-radius: 99px; }
.progress-value { width: 72%; height: 100%; background: var(--signal); border-radius: inherit; }
.tg-panel { color: #fff; background: #17636e; border: 0; }
.tg-panel .side-panel-subtitle { color: #b9d9d9; }
.tg-link { display: flex; align-items: center; justify-content: space-between; padding: 11px 12px; color: #fff; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12); border-radius: 8px; font-size: 12px; }
.tg-link strong { font-size: 12px; }
.tg-link span { color: #b9d9d9; }
.notice-list { display: grid; gap: 12px; }
.notice-item { display: grid; grid-template-columns: 8px 1fr; gap: 9px; }
.notice-bullet { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--signal); }
.notice-item p { margin: 0; font-size: 12px; line-height: 1.55; }
.notice-item time { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }

.site-footer { display: flex; justify-content: space-between; gap: 18px; padding-top: 40px; color: var(--muted); font-size: 11px; }

/* Admin */
.admin-shell { display: grid; grid-template-columns: 232px minmax(0,1fr); min-height: 100vh; background: var(--canvas); }
.admin-sidebar { color: #d8e6eb; background: #132f3b; padding: 22px 14px 18px; display: flex; flex-direction: column; }
.admin-brand { display: flex; align-items: center; gap: 10px; padding: 3px 10px 24px; }
.admin-brand .brand-mark { width: 32px; height: 32px; border-radius: 9px; box-shadow: none; background: #2a8e99; }
.admin-brand .brand-name { color: #fff; font-size: 13px; }
.admin-brand .brand-domain { color: #96b2bb; }
.admin-nav-label { padding: 18px 11px 7px; color: #7896a0; font-size: 10px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.admin-nav { display: grid; gap: 3px; }
.admin-nav button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 11px; border: 0; border-radius: 7px; color: #b7ccd1; background: transparent; text-align: left; font-size: 12px; transition: .18s ease; }
.admin-nav button:hover { color: #fff; background: rgba(255,255,255,.07); }
.admin-nav button.active { color: #fff; background: #225563; box-shadow: inset 3px 0 0 #74d5ce; }
.admin-nav button .icon { width: 15px; height: 15px; opacity: .84; }
.admin-sidebar-bottom { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid rgba(255,255,255,.1); }
.admin-sync { display: flex; align-items: center; gap: 8px; color: #a4c6c7; font-size: 11px; }
.admin-sync-dot { width: 7px; height: 7px; border-radius: 50%; background: #7ce2b4; box-shadow: 0 0 0 4px rgba(124,226,180,.12); }
.admin-main { min-width: 0; }
.admin-topbar { height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 clamp(20px, 3vw, 42px); background: rgba(255,255,255,.86); border-bottom: 1px solid var(--line); }
.admin-topbar-left { display: flex; align-items: center; gap: 13px; min-width: 0; }
.admin-topbar h1 { margin: 0; font-size: 18px; letter-spacing: -.04em; }
.admin-topbar p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.admin-topbar-actions { display: flex; align-items: center; gap: 10px; }
.admin-avatar { width: 33px; height: 33px; display: grid; place-items: center; color: var(--brand-deep); background: var(--brand-soft); border-radius: 50%; font-size: 12px; font-weight: 800; }
.admin-content { max-width: 1500px; margin: 0 auto; padding: 30px clamp(20px, 3vw, 42px) 52px; }
.content-title-row { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.content-title-row h2 { margin: 0; font-size: 24px; letter-spacing: -.05em; }
.content-title-row p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.content-title-actions { display: flex; gap: 9px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { min-width: 0; padding: 17px; background: #fff; border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow-sm); }
.metric-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; }
.metric-icon { width: 30px; height: 30px; display: grid; place-items: center; color: var(--brand); background: var(--brand-soft); border-radius: 7px; }
.metric-value { overflow: hidden; margin-top: 14px; font-size: 25px; line-height: 1; font-weight: 780; letter-spacing: -.055em; text-overflow: ellipsis; white-space: nowrap; }
.metric-foot { display: flex; align-items: center; gap: 7px; margin-top: 11px; color: var(--muted); font-size: 11px; }
.trend-up { color: var(--success); font-weight: 700; }
.trend-neutral { color: var(--brand); font-weight: 700; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.22fr) minmax(300px, .78fr); gap: 17px; margin-top: 17px; }
.admin-grid.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-panel { min-width: 0; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow-sm); }
.admin-panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.admin-panel-header h3 { margin: 0; font-size: 13px; }
.admin-panel-header span { color: var(--muted); font-size: 11px; }
.chart-area { padding: 20px 18px 15px; }
.chart-grid { height: 188px; display: flex; align-items: end; gap: 10px; padding: 0 3px; border-bottom: 1px solid var(--line); background-image: linear-gradient(to bottom, transparent 24%, #edf1f4 25%, transparent 25%, transparent 49%, #edf1f4 50%, transparent 50%, transparent 74%, #edf1f4 75%, transparent 75%); }
.chart-column { height: 100%; flex: 1; display: flex; align-items: end; justify-content: center; gap: 3px; position: relative; }
.chart-bar { width: 12px; min-height: 10px; border-radius: 4px 4px 0 0; background: #9dd9d6; transition: height .3s ease; }
.chart-bar.highlight { background: var(--brand); }
.chart-bar.alt { background: #f5c37f; }
.chart-labels { display: flex; justify-content: space-between; gap: 10px; padding: 9px 2px 0; color: var(--muted); font-size: 10px; }
.chart-legend { display: flex; gap: 17px; margin-top: 14px; color: var(--muted); font-size: 11px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.legend-dot.alt { background: #f5c37f; }
.activity-list { padding: 6px 18px 12px; }
.activity-item { display: grid; grid-template-columns: 9px 1fr auto; gap: 10px; align-items: start; padding: 13px 0; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; }
.activity-dot { width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: var(--brand); }
.activity-dot.orange { background: var(--signal); }
.activity-dot.green { background: var(--success); }
.activity-text { margin: 0; color: var(--ink); font-size: 12px; line-height: 1.45; }
.activity-text strong { font-weight: 720; }
.activity-time { color: var(--muted); font-size: 10px; white-space: nowrap; }
.health-list { padding: 11px 18px 15px; }
.health-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.health-row:last-child { border-bottom: 0; }
.health-name { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.health-status { display: inline-flex; align-items: center; gap: 5px; color: var(--success); font-size: 11px; font-weight: 700; }
.health-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Admin content modules */
.filter-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.segmented { display: inline-flex; padding: 3px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; }
.segmented button { border: 0; padding: 6px 10px; color: var(--muted); background: transparent; border-radius: 5px; font-size: 11px; }
.segmented button.active { color: var(--brand-deep); background: white; box-shadow: 0 1px 3px rgba(20,35,52,.09); font-weight: 700; }
.admin-table-wrap { overflow: auto; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.admin-table th { padding: 12px 17px; color: var(--muted); background: var(--surface-soft); font-size: 10px; font-weight: 700; text-align: left; letter-spacing: .03em; }
.admin-table td { padding: 14px 17px; border-top: 1px solid var(--line); font-size: 12px; }
.ad-identity { display: flex; align-items: center; gap: 10px; }
.ad-thumb { width: 55px; height: 33px; overflow: hidden; display: grid; place-items: center; color: #fff; background: #235d66; border-radius: 5px; font-size: 10px; font-weight: 700; }
.ad-thumb.orange { background: #eaa358; }
.ad-thumb.teal { background: #38979a; }
.ad-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ad-name { font-weight: 700; }
.ad-sub { margin-top: 3px; color: var(--muted); font-size: 10px; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 7px; border-radius: 5px; font-size: 10px; font-weight: 700; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-on { color: var(--success); background: var(--success-soft); }
.status-off { color: var(--muted); background: #f0f2f4; }
.row-actions { display: flex; justify-content: flex-end; gap: 3px; }
.row-actions button { display: inline-flex; align-items: center; justify-content: center; width: 29px; height: 29px; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 6px; }
.row-actions button:hover { color: var(--brand); background: var(--brand-soft); }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(260px, .9fr); gap: 17px; }
.form-panel { padding: 20px; }
.form-panel h3 { margin: 0; font-size: 15px; letter-spacing: -.02em; }
.form-intro { margin: 6px 0 20px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 15px 14px; }
.field { min-width: 0; }
.field.full { grid-column: 1/-1; }
.field label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.field label span { color: var(--muted); font-weight: 500; }
.field input, .field select, .field textarea { width: 100%; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: 7px; outline: none; padding: 10px 11px; font-size: 12px; transition: .15s ease; }
.field input, .field select { height: 39px; }
.field textarea { min-height: 92px; resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(12,124,140,.1); }
.form-actions { display: flex; gap: 8px; margin-top: 21px; padding-top: 17px; border-top: 1px solid var(--line); }
.toggle-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.toggle-copy strong { display: block; font-size: 12px; }
.toggle-copy span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.switch { position: relative; width: 38px; height: 22px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track { position: absolute; inset: 0; background: #cbd4da; border-radius: 99px; transition: .18s; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: white; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.18); transition: .18s; }
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.preview-panel { padding: 20px; background: #edf5f5; border: 1px solid #d7e8e8; }
.preview-panel h3 { margin: 0; font-size: 13px; }
.preview-window { margin-top: 15px; overflow: hidden; background: white; border: 1px solid #dce8ea; border-radius: 9px; box-shadow: 0 7px 17px rgba(27,74,81,.08); }
.preview-window-top { display: flex; align-items: center; gap: 7px; padding: 8px 10px; background: #f8fbfb; border-bottom: 1px solid #e4eeee; }
.preview-dot { width: 6px; height: 6px; border-radius: 50%; background: #e8ae74; }
.preview-dot:nth-child(2) { background: #71b8af; }
.preview-dot:nth-child(3) { background: #c7d3d5; }
.preview-body { padding: 19px 16px 23px; text-align: center; }
.preview-logo { width: 43px; height: 43px; display: grid; place-items: center; margin: 0 auto 10px; overflow: hidden; color: white; background: var(--brand); border-radius: 12px; font-size: 12px; font-weight: 800; }
.preview-logo img { width: 100%; height: 100%; object-fit: cover; }
.preview-body h4 { max-width: 210px; margin: 0 auto 6px; font-size: 14px; }
.preview-body p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.domain-note { display: flex; align-items: flex-start; gap: 8px; margin-top: 18px; padding: 11px; color: #587378; background: rgba(255,255,255,.55); border: 1px solid #d7e8e8; border-radius: 7px; font-size: 10px; line-height: 1.6; }
.domain-note .icon { width: 14px; height: 14px; color: var(--brand); }
.analytics-summary { display: grid; grid-template-columns: 1.35fr .65fr; gap: 17px; }
.analytics-bars { height: 226px; display: flex; align-items: end; gap: 10px; padding: 22px 20px 0; border-bottom: 1px solid var(--line); }
.analytics-bar-col { flex: 1; display: flex; flex-direction: column; justify-content: end; align-items: center; gap: 8px; height: 100%; }
.analytics-bar { width: 100%; max-width: 27px; min-height: 12px; border-radius: 6px 6px 0 0; background: #b7dedd; }
.analytics-bar.current { background: var(--brand); }
.analytics-bar-col span { color: var(--muted); font-size: 10px; }
.source-list { padding: 12px 18px 15px; }
.source-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.source-item:last-child { border-bottom: 0; }
.source-name { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.source-rank { width: 20px; height: 20px; display: grid; place-items: center; color: var(--muted); background: var(--surface-soft); border-radius: 5px; font-size: 10px; font-weight: 750; }
.source-value { text-align: right; font-size: 12px; font-weight: 720; }
.source-value span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 500; }
.device-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 18px; }
.device-card { padding: 14px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; }
.device-card-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.device-number { margin-top: 10px; font-size: 20px; font-weight: 780; letter-spacing: -.04em; }
.device-bar { height: 5px; margin-top: 10px; overflow: hidden; background: #e1e7ea; border-radius: 99px; }
.device-bar span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.empty-state { padding: 42px 22px; text-align: center; color: var(--muted); }

/* Toast and responsive */
#toast-region { position: fixed; right: 24px; bottom: 24px; z-index: 100; display: grid; gap: 9px; }
.toast { display: flex; align-items: center; gap: 9px; min-width: 250px; padding: 12px 14px; color: #fff; background: #1d3b46; border-radius: 8px; box-shadow: var(--shadow-md); font-size: 12px; animation: toast-in .22s ease both; }
.toast.success { background: #1f8067; }
.toast.error { background: #9d4544; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1100px) {
  .public-hero { grid-template-columns: 1fr; }
  .draw-panel { min-height: 255px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .analytics-summary { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .public-topbar { height: 62px; padding: 0 18px; gap: 12px; }
  .brand-domain, .public-nav { display: none; }
  .public-actions .button-secondary { display: none; }
  .public-main { padding: 20px 18px 42px; }
  .hero-copy { padding-top: 8px; }
  .hero-copy h1 { font-size: 39px; }
  .overview-grid, .admin-grid, .admin-grid.equal, .editor-layout { grid-template-columns: 1fr; }
  .history-table { min-width: 660px; }
  .history-surface { overflow-x: auto; }
  .site-footer { flex-direction: column; padding-top: 28px; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: sticky; top: 0; z-index: 30; display: block; padding: 10px 14px; }
  .admin-brand { padding: 0 4px; }
  .admin-brand .brand-domain, .admin-nav-label, .admin-sidebar-bottom { display: none; }
  .admin-nav { display: flex; overflow-x: auto; gap: 3px; margin-top: 9px; padding-bottom: 1px; }
  .admin-nav button { width: auto; flex: 0 0 auto; padding: 8px 10px; white-space: nowrap; }
  .admin-nav button.active { box-shadow: inset 0 -3px 0 #74d5ce; }
  .admin-topbar { height: 62px; padding: 0 18px; }
  .admin-content { padding: 23px 18px 42px; }
  .content-title-row { align-items: flex-start; flex-direction: column; margin-bottom: 18px; }
  .content-title-actions { width: 100%; }
  .content-title-actions .button { flex: 1; }
}

@media (max-width: 540px) {
  .draw-panel { padding: 20px; }
  .draw-ball { width: 49px; height: 49px; font-size: 19px; }
  .draw-number { gap: 7px; }
  .result-tags { justify-content: flex-start; }
  .draw-result-row { align-items: flex-end; flex-direction: column; }
  .ad-strip { grid-template-columns: 1fr; gap: 11px; }
  .ad-strip a { justify-self: start; }
  .metric-grid { gap: 9px; }
  .metric-card { padding: 13px; }
  .metric-value { font-size: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .device-grid { grid-template-columns: 1fr; }
  .admin-topbar-actions .button { display: none; }
  .toast { min-width: 0; max-width: calc(100vw - 36px); }
  #toast-region { right: 18px; bottom: 18px; }
}

/* Public data site alignment */
.public-shell {
  --public-primary: #2d72bd;
  --public-primary-soft: #eaf3ff;
  --public-border: #e1e7ee;
  --public-muted: #6f7b89;
  background: #f8fafc;
}
.public-topbar {
  height: 64px;
  padding: 0 max(18px, calc((100vw - 1120px) / 2));
  background: rgba(255,255,255,.97);
  border-bottom-color: var(--public-border);
  box-shadow: 0 1px 6px rgba(28, 54, 78, .035);
}
.public-topbar .brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #2e73bd;
  background: #edf5ff;
  border: 1px solid #d5e6fb;
  box-shadow: none;
  font-size: 12px;
}
.public-topbar .brand-name { color: #1c2d40; font-size: 16px; }
.public-topbar .brand-domain { color: #8a96a4; }
.public-nav { margin-left: 16px; gap: 2px; }
.public-nav a, .public-nav button { border: 0; color: #5e6c7b; background: transparent; padding: 8px 10px; font-size: 12px; font-weight: 560; }
.public-nav a:hover, .public-nav a.active, .public-nav button:hover { color: var(--public-primary); background: var(--public-primary-soft); }
.public-nav a, .public-nav button { display: inline-flex; align-items: center; gap: 5px; border-radius: 7px; }
.public-nav .icon { width: 13px; height: 13px; color: #738191; }
.public-nav .nav-chevron { color: #98a3ae; font-size: 13px; line-height: 1; }
.public-actions { gap: 7px; }
.public-search { height: 32px; display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; color: #7d8997; background: #f8fafc; border: 1px solid var(--public-border); border-radius: 7px; font-size: 11px; }
.public-search .icon { width: 13px; height: 13px; }
.public-search kbd { padding: 2px 4px; color: #8995a3; background: white; border: 1px solid #e2e7ec; border-radius: 4px; font-size: 9px; }
.public-topbar .button-primary { background: var(--public-primary); box-shadow: 0 4px 10px rgba(45,114,189,.16); }
.public-topbar .button-primary:hover { background: #245f9f; }
.theme-button { border: 1px solid var(--public-border); }
.public-admin-link { display: none; }
.public-main { max-width: 1120px; padding: 12px 0 42px; }
.ad-banner-list { display: flex; flex-direction: column; gap: 8px; }
.ad-banner { min-height: 78px; display: flex; align-items: center; gap: 16px; overflow: hidden; padding: 12px 18px; color: #fff; border: 1px solid rgba(255,255,255,.26); border-radius: 12px; box-shadow: 0 3px 10px rgba(26, 46, 72, .12); position: relative; transition: transform .18s ease, filter .18s ease; }
.ad-banner::after { content: ""; position: absolute; width: 220px; height: 220px; right: 5%; top: -95px; background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.13); border-radius: 50%; transform: rotate(-13deg); }
.ad-banner:hover { filter: brightness(1.03); transform: translateY(-1px); }
.ad-banner.teal { background: linear-gradient(105deg, #125b9a 0%, #2d83c8 54%, #6aa9dc 100%); }
.ad-banner.orange { background: linear-gradient(105deg, #774315 0%, #bd7626 50%, #e0a046 100%); }
.ad-banner-mark { width: 52px; height: 52px; display: grid; place-items: center; flex: 0 0 auto; overflow: hidden; color: currentColor; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.32); border-radius: 12px; font-size: 16px; font-weight: 850; letter-spacing: -.08em; z-index: 1; }
.ad-banner-mark img { width: 100%; height: 100%; object-fit: cover; }
.ad-banner-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; z-index: 1; }
.ad-banner-copy strong { overflow: hidden; font-size: 15px; font-weight: 760; text-overflow: ellipsis; white-space: nowrap; }
.ad-banner-copy small { overflow: hidden; color: rgba(255,255,255,.78); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.ad-banner-action { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; flex: 0 0 auto; padding: 7px 10px; color: rgba(255,255,255,.94); background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.24); border-radius: 7px; font-size: 11px; font-weight: 700; z-index: 1; }
.ad-banner-action .icon { width: 13px; height: 13px; }
.draw-banner-panels { display: grid; grid-template-columns: minmax(208px, .72fr) minmax(0, 1.28fr); gap: 12px; align-items: stretch; margin-top: 12px; }
.countdown-wrapper, .draw-result-panel, .hist-panel, .public-info-card { background: #fff; border: 1px solid var(--public-border); border-radius: 12px; box-shadow: 0 2px 7px rgba(29, 53, 78, .035); }
.countdown-wrapper { min-height: 184px; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; padding: 15px 16px; border-color: #bfd9f6; }
.countdown-heading, .countdown-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--public-muted); font-size: 11px; }
.countdown-heading span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.countdown-heading .icon { width: 14px; height: 14px; color: var(--public-primary); }
.countdown-face { flex: 1; display: flex; align-items: center; }
.countdown-face strong { color: #263548; font-size: 39px; line-height: 1; letter-spacing: -.07em; font-weight: 680; font-variant-numeric: tabular-nums; }
.countdown-face strong span { margin: 0 4px; color: #7f8a96; font-size: 14px; font-weight: 560; letter-spacing: 0; }
.countdown-meta { font-size: 10px; }
.countdown-bar { height: 6px; overflow: hidden; background: #edf1f5; border-radius: 99px; }
.countdown-bar span { display: block; width: 53%; height: 100%; background: var(--public-primary); border-radius: inherit; }
.draw-result-panel { min-width: 0; min-height: 184px; display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 12px; }
.draw-result-header { min-height: 29px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.draw-result-header h2 { min-width: 0; margin: 0; overflow: hidden; color: #273446; font-size: 15px; font-weight: 680; letter-spacing: -.025em; text-overflow: ellipsis; white-space: nowrap; }
.draw-result-header h2 strong { margin-left: 4px; font-weight: 700; }
.draw-result-header h2 span { margin-left: 8px; color: var(--public-muted); font-size: 11px; font-weight: 450; }
.draw-result-actions { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.result-setting-button, .result-mipai-button { height: 30px; display: inline-flex; align-items: center; gap: 5px; padding: 0 9px; color: #647180; background: #fff; border: 1px solid var(--public-border); border-radius: 7px; font-size: 11px; }
.result-setting-button:hover, .result-mipai-button:hover, .result-mipai-button.active { color: var(--public-primary); background: var(--public-primary-soft); border-color: #bdd8f4; }
.result-setting-button .icon, .result-mipai-button .icon { width: 13px; height: 13px; }
.draw-scratch-host { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2px 0; }
.scratch-surface { position: relative; display: flex; width: 100%; min-width: 0; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 11px 12px; border: 1px solid #dce5ed; border-radius: 12px; background: #f8fbfd; }
.draw-scratch-card { display: inline-flex; align-items: center; justify-content: center; max-width: 100%; }
.draw-result-strip { display: flex; align-items: center; justify-content: center; max-width: 100%; gap: 6px; }
.draw-result-op { color: #a6afb8; font-size: 21px; font-weight: 450; }
.draw-result-op.draw-result-eq { margin-left: 3px; }
.draw-result-cell { width: 59px; height: 59px; display: grid; place-items: center; position: relative; padding: 0; color: #29394c; background: #f4f7fa; border: 1px solid #e1e8ee; border-radius: 50%; font-size: 25px; font-weight: 690; box-shadow: inset 0 1px 0 rgba(255,255,255,.8); transition: .18s ease; }
.draw-result-cell.draw-result-sum { width: 66px; height: 66px; color: #fff; background: var(--public-primary); border-color: var(--public-primary); box-shadow: 0 6px 12px rgba(45,114,189,.15); }
.draw-result-classification { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 34px; }
.draw-result-classification:empty { display: none; }
.draw-result-type { min-width: 38px; height: 34px; padding: 0 8px; display: inline-grid; place-items: center; flex: 0 0 auto; color: #fff; border-radius: 7px; font-size: 17px; font-weight: 760; }
.draw-result-type.type-red { background: #e53935; }
.draw-result-type.type-blue { background: #1e88e5; }
.draw-combination-cell.trait-大单 { background: #e53935; }
.draw-combination-cell.trait-大双 { background: #ef6c00; }
.draw-combination-cell.trait-小单 { background: #1e88e5; }
.draw-combination-cell.trait-小双 { background: #2e7d32; }
.draw-result-cell:hover { transform: translateY(-1px); border-color: #b9d2eb; }
.draw-result-cell.covered { color: #4e83b8; background: linear-gradient(135deg, #e8f2fc 25%, #f9fbfe 25%, #f9fbfe 50%, #e8f2fc 50%, #e8f2fc 75%, #f9fbfe 75%); background-size: 9px 9px; border-style: dashed; cursor: pointer; }
.draw-result-cell.covered .draw-result-glyph { transform: translateY(-5px); font-size: 21px; }
.scratch-label { position: absolute; bottom: 11px; color: #5484b4; font-size: 9px; font-weight: 620; }
.scratch-canvas { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; border-radius: inherit; cursor: crosshair; touch-action: none; }
.scratch-canvas.scratch-revealed { opacity: 0; transform: scale(1.03); transition: opacity .35s ease, transform .35s ease; }
.draw-result-traits { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.result-trait, .history-tag { display: inline-flex; align-items: center; padding: 4px 7px; border-radius: 5px; font-size: 10px; font-weight: 700; }
.trait-large, .history-tag.large { color: #c62828; background: #ffebee; }
.trait-small, .history-tag.small { color: #1565c0; background: #e3f2fd; }
.trait-odd, .history-tag.odd { color: #1565c0; background: #e3f2fd; }
.trait-even, .history-tag.even { color: #c62828; background: #ffebee; }
.trait-大单 { color: #b71c1c; background: #ffe5e7; }
.trait-大双 { color: #aa4e0a; background: #fff0dc; }
.trait-小单 { color: #1556a8; background: #e4efff; }
.trait-小双 { color: #24713e; background: #e2f5e9; }
.trait-杂六 { color: #2e7d32; background: #e8f5e9; }
.trait-对子 { color: #ef6c00; background: #fff3e0; }
.trait-顺子 { color: #8e24aa; background: #f3e5f5; }
.trait-豹子 { color: #c62828; background: #ffebee; }
.trait-龙 { color: #c62828; background: #ffebee; }
.trait-虎 { color: #1565c0; background: #e3f2fd; }
.trait-合 { color: #8e24aa; background: #f3e5f5; }
.trait-location, .trait-extreme, .trait-road { color: #607d8b; background: #eceff1; }
.draw-display-settings { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 10px; color: #5f6f7d; background: #f7fafc; border: 1px solid var(--public-border); border-radius: 7px; font-size: 11px; }
.draw-display-settings label { display: inline-flex; align-items: center; gap: 4px; }
.draw-display-settings .draw-ad-setting { margin-left: auto; padding-left: 8px; border-left: 1px solid var(--public-border); font-weight: 700; }
.scratch-help { color: #8b98a5; font-size: 10px; text-align: center; letter-spacing: .02em; }
.draw-result-footer { display: flex; align-items: center; justify-content: center; gap: 9px; color: var(--public-muted); font-size: 11px; }
.draw-result-footer span { display: inline-flex; align-items: center; gap: 6px; }
.draw-result-footer span + span::before { content: "·"; color: #b3bdc6; }
.source-status { display: inline-flex; align-items: center; gap: 4px; }
.source-status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.source-status.live { color: #2b9773; }
.source-status.stale { color: #c98222; }
.source-status.demo { color: #9aa5ae; }
.insight-panel { margin-top: 12px; padding: 17px; background: #fff; border: 1px solid var(--public-border); border-radius: 12px; box-shadow: 0 2px 7px rgba(29, 53, 78, .035); }
.insight-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.insight-heading h2 { margin: 0; color: #273446; font-size: 15px; font-weight: 680; }
.insight-heading p { margin: 5px 0 0; color: var(--public-muted); font-size: 10px; }
.insight-source { display: inline-flex; align-items: center; gap: 5px; color: #2b9773; font-size: 10px; }
.insight-source::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.insight-tabs, .omission-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 15px; padding-bottom: 10px; border-bottom: 1px solid var(--public-border); }
.insight-tabs button, .omission-tabs button { min-height: 28px; padding: 0 9px; color: #6c7987; background: transparent; border: 1px solid transparent; border-radius: 6px; font-size: 11px; font-weight: 620; }
.insight-tabs button:hover, .omission-tabs button:hover { background: #f3f7fb; }
.insight-tabs button.active, .omission-tabs button.active { color: #fff; background: var(--public-primary); box-shadow: 0 3px 7px rgba(45,114,189,.14); }
.insight-body { padding-top: 14px; }
.insight-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.insight-kpis > div { min-width: 0; padding: 11px 12px; background: #f8fafc; border: 1px solid #e8edf2; border-radius: 8px; }
.insight-kpis span, .insight-kpis small { display: block; color: #8b98a5; font-size: 10px; }
.insight-kpis strong { display: block; margin: 6px 0 3px; color: #2f4052; font-size: 18px; font-weight: 720; }
.insight-kpis strong small { display: inline; margin-left: 2px; font-size: 10px; font-weight: 600; }
.insight-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(250px, .75fr); gap: 10px; margin-top: 10px; }
.insight-card { min-width: 0; padding: 13px; background: #fbfcfd; border: 1px solid #e8edf2; border-radius: 8px; }
.insight-card h3 { margin: 0 0 11px; color: #526172; font-size: 11px; font-weight: 700; }
.insight-card p, .insight-subnote { margin: 10px 0 0; color: #8995a2; font-size: 10px; line-height: 1.65; }
.trend-line { width: 100%; height: 103px; display: block; overflow: visible; background: linear-gradient(to bottom, transparent 49.5%, #e8edf2 50%, transparent 50.5%); }
.trend-line line { stroke: #dce5ed; stroke-width: .6; }
.trend-bars { height: 34px; display: flex; align-items: flex-end; gap: 2px; margin-top: 5px; }
.trend-bars span { min-width: 2px; flex: 1; border-radius: 2px 2px 0 0; opacity: .84; }
.trend-bars span.large { background: #e53935; }
.trend-bars span.small { background: #1e88e5; }
.distribution-row { display: grid; grid-template-columns: 27px minmax(0, 1fr) 94px; align-items: center; gap: 7px; margin: 12px 0; color: #758392; font-size: 10px; }
.distribution-row > div { height: 7px; overflow: hidden; background: #e6edf3; border-radius: 99px; }
.distribution-row i { display: block; height: 100%; background: #e53935; border-radius: inherit; }
.distribution-row:nth-of-type(3) i { background: #1e88e5; }
.distribution-row b { color: #536274; font-size: 10px; font-weight: 650; }
.rank-grid { display: grid; gap: 8px; margin-bottom: 15px; }
.rank-item { display: grid; grid-template-columns: 48px minmax(0, 1fr) 94px; align-items: center; gap: 7px; }
.rank-item > div { height: 6px; overflow: hidden; background: #e8edf2; border-radius: 99px; }
.rank-item i { display: block; height: 100%; background: #ef6c00; border-radius: inherit; }
.rank-item b { color: #778492; font-size: 9px; font-weight: 600; }
.combo-rank { display: flex; flex-wrap: wrap; gap: 6px; }
.combo-rank span:not(.result-trait) { padding: 5px 7px; color: #657382; background: #f1f5f8; border-radius: 5px; font-size: 10px; }
.combo-rank b { color: #33485c; font-weight: 700; }
.frequency-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px 13px; }
.frequency-item { display: grid; grid-template-columns: 21px minmax(0, 1fr); align-items: center; gap: 6px; }
.frequency-item > b { color: #526172; font-size: 10px; }
.frequency-item > span { grid-column: 2; color: #8d99a5; font-size: 9px; }
.frequency-track { height: 6px; position: relative; overflow: visible; background: #e8edf2; border-radius: 99px; }
.frequency-track i { display: block; height: 100%; background: #347dbf; border-radius: inherit; }
.frequency-track em { width: 2px; height: 10px; position: absolute; top: -2px; background: #6d7b87; border-radius: 2px; }
.omission-tabs { margin-top: 0; padding-bottom: 10px; }
.omission-group { margin-top: 14px; }
.omission-group h3, .omission-positions h3 { margin: 0 0 8px; color: #657382; font-size: 11px; }
.omission-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.omission-cell { min-width: 0; padding: 8px 4px; color: #697786; background: #f2f6f8; border: 1px solid #e8edf2; border-radius: 6px; text-align: center; }
.omission-cell b, .omission-cell span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.omission-cell b { color: #425466; font-size: 11px; }
.omission-cell span { margin-top: 3px; color: #8d99a5; font-size: 9px; }
.omission-cell.hot { color: #2b9773; background: #e8f7f1; border-color: #cde9de; }
.omission-cell.cold { color: #b86b16; background: #fff4e6; border-color: #f4dfc5; }
.omission-positions { display: grid; gap: 15px; }
.cycle-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 9px 0; color: #6d7b87; border-top: 1px solid #edf0f3; font-size: 10px; }
.cycle-row:first-of-type { border-top: 0; }
.cycle-row b { color: #405468; }
.dragon-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dragon-card h3 { margin: 0; }
.dragon-card strong { color: #347dbf; font-size: 20px; }
.dragon-card span { color: #8794a0; font-size: 10px; }
.insight-note { margin-top: 13px; color: #9aa5ae; font-size: 9px; }
.hist-panel { margin-top: 12px; overflow: hidden; }
.hist-panel-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--public-border); }
.hist-panel-modes { display: inline-flex; align-items: center; gap: 4px; }
.hist-panel-modes button { min-height: 31px; padding: 0 11px; color: #697685; background: transparent; border: 1px solid transparent; border-radius: 7px; font-size: 12px; font-weight: 600; }
.hist-panel-modes button:hover { background: #f3f7fb; }
.hist-panel-modes button.active { color: #fff; background: var(--public-primary); box-shadow: 0 3px 7px rgba(45,114,189,.16); }
.history-toolbar-right { display: flex; align-items: center; gap: 6px; }
.history-search { width: 205px; height: 31px; display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; color: #8c98a4; background: #fff; border: 1px solid var(--public-border); border-radius: 7px; }
.history-search .icon { width: 13px; height: 13px; }
.history-search input { width: 100%; min-width: 0; padding: 0; color: #425163; background: transparent; border: 0; outline: 0; font-size: 11px; }
.history-search input::placeholder { color: #9aa5af; }
.history-pager { height: 31px; padding: 0 8px; color: #a8b0b8; background: #f8fafc; border: 1px solid var(--public-border); border-radius: 7px; font-size: 10px; }
.history-table-wrap { overflow-x: auto; }
.reference-table { min-width: 920px; border-collapse: collapse; }
.reference-table th { padding: 10px 12px; color: #8995a2; background: #fbfcfd; border-bottom: 1px solid var(--public-border); font-size: 10px; font-weight: 600; text-align: left; white-space: nowrap; }
.reference-table td { padding: 12px; color: #53606e; border-top: 1px solid #edf0f3; font-size: 11px; white-space: nowrap; }
.reference-table tbody tr:hover td { background: #fbfdff; }
.reference-table .period-cell { color: #314256; font-size: 12px; font-weight: 690; }
.history-equation { display: inline-flex; align-items: center; gap: 5px; color: #526172; }
.history-equation strong { color: #2f4052; font-size: 13px; }
.history-equation b { color: #abb4bd; font-weight: 450; }
.history-tag { display: inline-flex; padding: 4px 6px; border-radius: 5px; font-size: 10px; font-weight: 650; }
.reference-table td .history-tag + .history-tag, .reference-table td .history-tag + .result-trait { margin-left: 3px; }
.history-tag.large { color: #c62828; background: #ffebee; }
.history-tag.small { color: #1565c0; background: #e3f2fd; }
.history-tag.odd { color: #1565c0; background: #e3f2fd; }
.history-tag.even { color: #c62828; background: #ffebee; }
.status-dot { display: inline-flex; align-items: center; gap: 5px; color: #2b9773; font-size: 10px; }
.status-dot::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.keno-placeholder { color: #99a6b1; font-size: 10px; }
.keno-numbers { display: inline-flex; flex-wrap: wrap; gap: 3px; max-width: 440px; }
.keno-numbers i { min-width: 20px; padding: 3px 4px; color: #526172; background: #f0f4f7; border-radius: 4px; font-size: 10px; font-style: normal; text-align: center; }
.history-empty { padding: 28px !important; color: #9aa5ae !important; text-align: center; }
.public-bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.public-info-card { min-height: 105px; padding: 16px; color: #596777; }
.public-info-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #2e4052; font-size: 13px; font-weight: 700; }
.public-info-heading .icon { width: 14px; height: 14px; color: var(--public-primary); }
.public-info-card p { margin: 10px 0 7px; color: #667483; font-size: 11px; line-height: 1.65; }
.public-info-card > span { color: #9aa5ae; font-size: 10px; }
.tg-info-card { color: inherit; transition: .18s ease; }
.tg-info-card:hover { border-color: #bcd7f3; background: #fbfdff; }
.site-footer { max-width: none; padding-top: 26px; color: #9aa5ae; font-size: 10px; }

html[data-theme="dark"] body { color: #d8e2eb; background: #101820; }
html[data-theme="dark"] .public-shell { --public-border: #263542; --public-muted: #94a5b4; background: #101820; }
html[data-theme="dark"] .public-topbar, html[data-theme="dark"] .countdown-wrapper, html[data-theme="dark"] .draw-result-panel, html[data-theme="dark"] .hist-panel, html[data-theme="dark"] .public-info-card { background: #17232d; border-color: #2b3a47; }
html[data-theme="dark"] .public-topbar .brand-name, html[data-theme="dark"] .draw-result-header h2, html[data-theme="dark"] .public-info-heading { color: #edf5fb; }
html[data-theme="dark"] .public-nav a, html[data-theme="dark"] .public-nav button, html[data-theme="dark"] .reference-table td { color: #b8c7d3; }
html[data-theme="dark"] .public-search, html[data-theme="dark"] .history-search, html[data-theme="dark"] .result-setting-button, html[data-theme="dark"] .result-mipai-button { color: #b8c7d3; background: #1d2b36; border-color: #344652; }
html[data-theme="dark"] .history-search input { color: #e5edf3; }
html[data-theme="dark"] .reference-table th { color: #93a5b4; background: #14202a; border-color: #2b3a47; }
html[data-theme="dark"] .reference-table td { border-color: #253440; }
html[data-theme="dark"] .reference-table tbody tr:hover td { background: #1c2b36; }
html[data-theme="dark"] .scratch-surface, html[data-theme="dark"] .draw-display-settings { background: #1c2b36; border-color: #344652; }
html[data-theme="dark"] .draw-result-cell.draw-result-ball { color: #e8f0f5; background: #263744; border-color: #3d5260; }
html[data-theme="dark"] .draw-result-footer, html[data-theme="dark"] .public-info-card p { color: #9fb0bd; }
html[data-theme="dark"] .insight-panel { background: #17232d; border-color: #2b3a47; }
html[data-theme="dark"] .insight-heading h2 { color: #edf5fb; }
html[data-theme="dark"] .insight-kpis > div, html[data-theme="dark"] .insight-card { background: #1c2b36; border-color: #344652; }
html[data-theme="dark"] .insight-kpis strong, html[data-theme="dark"] .insight-card h3, html[data-theme="dark"] .rank-item b, html[data-theme="dark"] .distribution-row b, html[data-theme="dark"] .omission-cell b { color: #dce8f0; }
html[data-theme="dark"] .omission-cell, html[data-theme="dark"] .combo-rank span:not(.result-trait) { background: #263744; border-color: #344652; color: #aebdca; }
html[data-theme="dark"] .frequency-track, html[data-theme="dark"] .rank-item > div, html[data-theme="dark"] .distribution-row > div { background: #334652; }

@media (max-width: 820px) {
  .public-main { padding: 10px 12px 35px; }
  .public-nav { display: none; }
  .public-topbar { padding: 0 12px; }
  .public-search { display: none; }
  .public-login { display: none; }
  .public-actions .public-admin-link { display: inline-flex; }
  .draw-banner-panels { grid-template-columns: 1fr; }
  .countdown-wrapper, .draw-result-panel { min-height: 185px; }
  .countdown-face strong { font-size: 34px; }
  .hist-panel-toolbar { align-items: flex-start; flex-direction: column; }
  .history-toolbar-right { width: 100%; }
  .history-search { flex: 1; width: auto; }
  .public-bottom-grid { grid-template-columns: 1fr; }
  .insight-grid { grid-template-columns: 1fr; }
  .frequency-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .omission-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 540px) {
  .brand-copy .brand-domain { display: none; }
  .public-topbar .brand-name { max-width: 150px; font-size: 14px; }
  .ad-banner { min-height: 67px; gap: 10px; padding: 9px 11px; }
  .ad-banner-mark { width: 42px; height: 42px; border-radius: 9px; font-size: 13px; }
  .ad-banner-copy strong { font-size: 12px; }
  .ad-banner-copy small { font-size: 10px; }
  .ad-banner-action { padding: 5px 7px; font-size: 9px; }
  .ad-banner-action .icon { display: none; }
  .draw-result-panel { padding: 12px 10px; }
  .draw-result-header h2 { font-size: 13px; }
  .draw-result-header h2 span { display: none; }
  .draw-result-actions { gap: 4px; }
  .result-setting-button { width: 30px; padding: 0; justify-content: center; font-size: 0; }
  .result-setting-button .icon { width: 14px; height: 14px; }
  .result-mipai-button { padding: 0 7px; font-size: 10px; }
  .draw-result-strip { gap: 4px; }
  .draw-result-cell { width: 48px; height: 48px; font-size: 20px; }
  .draw-result-cell.draw-result-sum { width: 54px; height: 54px; }
  .draw-result-op { font-size: 16px; }
  .scratch-label { bottom: 7px; font-size: 8px; }
  .draw-result-footer { font-size: 10px; }
  .history-pager { display: none; }
  .site-footer { gap: 5px; }
  .insight-panel { padding: 12px; }
  .insight-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .omission-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .draw-result-actions .result-setting-button[data-action="toggle-voice"] { width: 30px; padding: 0; justify-content: center; font-size: 0; }
}

.mobile-result-history { display: none; }
.mobile-bottom-nav { display: none; }
.draw-result-cell { border-radius: 12px; }
.draw-result-cell.draw-result-sum { border-radius: 11px; }
.draw-pattern-cell { min-width: 54px; font-size: 15px; }
.draw-pattern-cell.trait-对子 { color: #fff; background: #ef6c00; }
.draw-pattern-cell.trait-杂六 { color: #fff; background: #2e7d32; }
.draw-pattern-cell.trait-顺子 { color: #fff; background: #8e24aa; }
.draw-pattern-cell.trait-豹子 { color: #fff; background: #e53935; }
.reference-table .history-tag.large, .reference-table .history-tag.even { color: #fff; background: #e53935; }
.reference-table .history-tag.small, .reference-table .history-tag.odd { color: #fff; background: #1e88e5; }
.history-covered-cell { padding: 0 12px !important; color: #f4f5f6 !important; background: #4a4a4a !important; font-size: 12px !important; font-weight: 650; text-align: center; }
.countdown-wrapper.is-expiring { border-color: #e5a3a3; box-shadow: 0 2px 8px rgba(204, 74, 74, .09); }
.countdown-wrapper.is-expiring .countdown-heading, .countdown-wrapper.is-expiring .countdown-face strong { color: #c75252; }
.countdown-wrapper.is-expiring .countdown-heading .icon { color: #c75252; }

@media (max-width: 600px) {
  body { background: #f5f7fa; }
  .public-topbar { height: 60px; padding: 0 10px; gap: 5px; }
  .public-topbar .brand-lockup { gap: 6px; }
  .public-topbar .brand-mark { width: 32px; height: 32px; }
  .public-topbar .brand-name { max-width: 84px; font-size: 13px; }
  .public-topbar .public-nav { display: flex; flex: 0 1 auto; gap: 4px; margin-left: auto; }
  .public-topbar .public-nav > * { display: none; }
  .public-topbar .public-nav .mobile-tool-nav, .public-topbar .public-nav .mobile-api-nav { display: inline-flex; align-items: center; gap: 3px; height: 32px; padding: 0 5px; background: #fff; border: 1px solid var(--public-border); border-radius: 7px; color: #536779; font-size: 10px; white-space: nowrap; }
  .public-topbar .public-nav .icon { width: 12px; height: 12px; }
  .public-actions { gap: 0; }
  .public-actions .theme-button { width: 34px; height: 34px; }
  .public-actions .public-admin-link { display: none; }
  .public-main { width: 100%; padding: 10px 12px calc(82px + env(safe-area-inset-bottom)); }
  .ad-banner-list { gap: 7px; }
  .draw-banner-panels { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
  .countdown-wrapper { width: 100%; min-height: 100px; align-self: stretch; padding: 11px 12px 9px; gap: 5px; border-radius: 12px; }
  .countdown-face { justify-content: center; }
  .countdown-face strong { font-size: 31px; }
  .countdown-meta { font-size: 10px; }
  .draw-result-panel { min-height: 0; padding: 11px; gap: 6px; border-radius: 12px; }
  .draw-result-header { align-items: flex-start; min-height: 34px; }
  .draw-result-header h2 { display: flex; align-items: baseline; gap: 3px; padding-top: 7px; font-size: 12px; }
  .draw-result-header h2 strong { margin-left: 0; }
  .draw-result-header h2 span { display: none; }
  .draw-result-actions { gap: 4px; }
  .draw-result-actions .result-setting-button, .draw-result-actions .result-mipai-button { height: 34px; }
  .draw-result-actions .result-setting-button { width: 34px; padding: 0; justify-content: center; font-size: 0; }
  .draw-result-actions .result-mipai-button { padding: 0 8px; font-size: 11px; }
  .draw-result-actions .icon { width: 14px; height: 14px; }
  .draw-scratch-host { padding: 3px 0 0; }
  .scratch-surface { width: 100%; min-width: 0; min-height: 92px; padding: 10px 6px; border-radius: 11px; gap: 5px; }
  .draw-result-strip { max-width: 100%; gap: 3px; flex-wrap: nowrap; }
  .draw-result-cell { width: 42px; height: 42px; flex: 0 0 auto; font-size: 21px; }
  .draw-result-cell.draw-result-sum { width: 46px; height: 46px; }
  .draw-result-op { font-size: 13px; }
  .draw-result-op.draw-result-eq { margin-left: 0; }
  .draw-result-classification { gap: 4px; min-height: 29px; }
  .draw-result-type { min-width: 34px; height: 29px; padding: 0 7px; font-size: 14px; border-radius: 6px; }
  .draw-pattern-cell { min-width: 47px; font-size: 13px; }
  .draw-result-traits { gap: 3px; }
  .result-trait { padding: 3px 5px; font-size: 9px; }
  .scratch-help { margin-top: 1px; font-size: 10px; }
  .draw-result-footer { flex-wrap: wrap; gap: 4px 8px; font-size: 10px; }
  .hist-panel { margin-top: 10px; border-radius: 12px; }
  .hist-panel-toolbar { flex-direction: row; align-items: center; padding: 10px 9px; gap: 4px; }
  .hist-panel-modes { width: auto; gap: 3px; }
  .hist-panel-modes button { flex: 0 0 auto; min-height: 32px; padding: 0 8px; font-size: 11px; }
  .history-toolbar-right { flex: 1; width: auto; min-width: 0; gap: 4px; }
  .history-search { flex: 1; width: auto; min-width: 0; height: 32px; }
  .history-pager { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 32px; padding: 0; font-size: 0; }
  .history-pager:first-of-type::before { content: "⌃"; font-size: 16px; }
  .history-pager:last-of-type::before { content: "⌄"; font-size: 16px; }
  .desktop-result-history { display: none; }
  .mobile-result-history { display: block; overflow: hidden; }
  .mobile-result-history .reference-table { width: 100%; min-width: 0 !important; table-layout: fixed; }
  .mobile-result-history .reference-table th, .mobile-result-history .reference-table td { padding: 9px 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-result-history .reference-table th { font-size: 10px; }
  .mobile-result-history .reference-table td { font-size: 11px; }
  .mobile-result-history .reference-table th:nth-child(1), .mobile-result-history .reference-table td:nth-child(1) { width: 24%; }
  .mobile-result-history .reference-table th:nth-child(2), .mobile-result-history .reference-table td:nth-child(2) { width: 18%; }
  .mobile-result-history .reference-table th:nth-child(3), .mobile-result-history .reference-table td:nth-child(3) { width: 29%; }
  .mobile-result-history .reference-table th:nth-child(4), .mobile-result-history .reference-table td:nth-child(4) { width: 17%; }
  .mobile-result-history .reference-table th:nth-child(5), .mobile-result-history .reference-table td:nth-child(5) { width: 12%; }
  .mobile-result-history .history-equation { gap: 3px; font-size: 10px; }
  .mobile-result-history .history-equation strong { font-size: 12px; }
  .mobile-result-history .history-combination { overflow: visible; }
  .mobile-result-history .history-tag { padding: 4px 5px; font-size: 10px; }
  .mobile-result-history .history-combination .history-tag + .history-tag { margin-left: 2px; }
  .mobile-result-history .result-trait { padding: 4px 5px; font-size: 10px; }
  .mobile-result-history .history-covered-cell { padding: 0 7px !important; font-size: 11px !important; }
  .insight-panel, .public-bottom-grid, .site-footer { margin-bottom: 0; }
  .mobile-bottom-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 50; display: grid; grid-template-columns: repeat(4, 1fr); padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .96); border-top: 1px solid var(--public-border); box-shadow: 0 -3px 12px rgba(29, 53, 78, .06); backdrop-filter: blur(15px); }
  .mobile-bottom-nav button { display: grid; justify-items: center; gap: 3px; padding: 2px 0; color: #7e8b99; background: transparent; border: 0; font-size: 10px; }
  .mobile-bottom-nav button .icon { width: 20px; height: 20px; }
  .mobile-bottom-nav button.active { color: var(--public-primary); }
}

@media (max-width: 350px) {
  .public-topbar .public-nav .mobile-api-nav { display: none; }
  .public-topbar .brand-name { max-width: 96px; }
  .draw-result-strip { gap: 2px; }
  .draw-result-op { font-size: 11px; }
  .draw-result-cell { width: 32px; height: 32px; font-size: 18px; }
  .draw-result-cell.draw-result-sum { width: 36px; height: 36px; }
  .draw-result-type { min-width: 31px; height: 28px; padding: 0 5px; font-size: 13px; }
  .draw-pattern-cell { min-width: 43px; font-size: 12px; }
}
