:root, [data-theme="dark"] {
  --bg: #0b1020; --bg2: #11182c; --card: #151d33; --card2: #1b2540; --line: #26304d;
  --text: #e6e9f2; --muted: #8b95b1; --accent: #6366f1; --accent2: #22d3ee;
  --red: #f43f5e; --blue: #3b82f6; --green: #10b981; --amber: #f59e0b;
  --pos: #34d399; --neg: #fb7185; --shadow: 0 8px 24px rgba(0,0,0,.35);
}
[data-theme="light"] {
  --bg: #f4f6fb; --bg2: #ffffff; --card: #ffffff; --card2: #f7f8fc; --line: #e4e7f0;
  --text: #141a2e; --muted: #67708a; --accent: #4f46e5; --accent2: #0891b2;
  --pos: #059669; --neg: #e11d48; --shadow: 0 6px 18px rgba(20,26,46,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; background: var(--bg);
  color: var(--text); display: flex; font-size: 14px; -webkit-font-smoothing: antialiased; }
a { color: var(--accent2); text-decoration: none; }
.muted { color: var(--muted); }
.pos { color: var(--pos); font-weight: 600; } .neg { color: var(--neg); font-weight: 600; }

/* sidebar */
#sidebar { width: 228px; flex: none; background: var(--bg2); border-right: 1px solid var(--line); display: flex;
  flex-direction: column; height: 100vh; position: sticky; top: 0; z-index: 20; transition: transform .25s; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 18px 14px; }
.brand small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.logo { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); }
#nav { flex: 1; overflow-y: auto; padding: 6px 10px; }
#nav .grp { font-size: 11px; color: var(--muted); padding: 14px 10px 6px; letter-spacing: .08em; }
#nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--text);
  opacity: .82; margin: 2px 0; font-size: 13.5px; }
#nav a:hover { background: var(--card2); opacity: 1; }
#nav a.active { background: linear-gradient(90deg, rgba(99,102,241,.22), rgba(34,211,238,.08)); opacity: 1;
  box-shadow: inset 3px 0 0 var(--accent); font-weight: 600; }
#nav a i { font-style: normal; width: 18px; text-align: center; }
.side-foot { padding: 14px; border-top: 1px solid var(--line); }
.disc { font-size: 11px; color: var(--muted); line-height: 1.6; }

/* main */
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#topbar { display: flex; align-items: center; gap: 14px; padding: 14px 26px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 10; }
#topbar h1 { margin: 0; font-size: 19px; }
#pageSub { font-size: 12px; margin-top: 2px; }
.top-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.icon-btn { background: var(--card); border: 1px solid var(--line); color: var(--text); width: 36px; height: 36px;
  border-radius: 9px; cursor: pointer; font-size: 16px; }
.icon-btn:hover { border-color: var(--accent); }
#menuBtn { display: none; }
.badge { font-size: 12px; padding: 5px 10px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); color: var(--muted); }
#view { padding: 22px 26px 60px; max-width: 1480px; width: 100%; }

/* layout helpers */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card h3 .sp { margin-left: auto; font-weight: 400; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.kpi .k { color: var(--muted); font-size: 12px; } .kpi .v { font-size: 26px; font-weight: 750; margin: 6px 0 4px; letter-spacing: -.02em; }
.kpi .s { color: var(--muted); font-size: 12px; }
.kpi.accent { background: linear-gradient(135deg, rgba(99,102,241,.25), rgba(34,211,238,.10)); }
.banner { border-radius: 14px; padding: 14px 18px; line-height: 1.7; border: 1px solid; margin-bottom: 16px; display: flex; gap: 12px; }
.banner.warn { background: rgba(245,158,11,.10); border-color: rgba(245,158,11,.45); }
.banner.info { background: rgba(99,102,241,.10); border-color: rgba(99,102,241,.4); }
.banner.ok { background: rgba(16,185,129,.10); border-color: rgba(16,185,129,.4); }
.banner .ic { font-size: 20px; }
.chart { width: 100%; height: 320px; }
.chart.sm { height: 220px; } .chart.lg { height: 420px; }
.section-title { font-size: 16px; margin: 26px 0 12px; font-weight: 700; }

/* balls */
.balls { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; }
.ball { flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 22px; font-weight: 800;
  background: radial-gradient(circle at 30% 30%, #94a3b8, #475569); box-shadow: inset -4px -6px 10px rgba(0,0,0,.25); }
.ball.sm { width: 26px; height: 26px; font-size: 12px; box-shadow: none; }
.ball.r { background: radial-gradient(circle at 30% 30%, #fb7185, #be123c); }
.ball.b { background: radial-gradient(circle at 30% 30%, #60a5fa, #1d4ed8); }
.ball.g { background: radial-gradient(circle at 30% 30%, #34d399, #047857); }
.ball.big { width: 64px; height: 64px; font-size: 28px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; background: var(--card2); border: 1px solid var(--line); margin: 1px 2px; white-space: nowrap; }
.tag.r { color: #fff; background: var(--red); border-color: transparent; } .tag.b { color: #fff; background: var(--blue); border-color: transparent; }
.tag.g { color: #fff; background: var(--green); border-color: transparent; } .tag.a { color: #111; background: var(--amber); border-color: transparent; }
.tag.v { color: #fff; background: var(--accent); border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 112px; cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.chip .q { font-size: 11px; color: var(--muted); } .chip .n { display: flex; gap: 4px; align-items: center; margin-top: 4px; }

/* table */
.tbl-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 7px 9px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th { background: var(--card2); color: var(--muted); font-weight: 600; position: sticky; top: 0; cursor: default; text-align: center; }
th.sortable { cursor: pointer; } th.sortable:hover { color: var(--text); }
td.l, th.l { text-align: left; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
tbody tr.click { cursor: pointer; }
.heat { border-radius: 4px; padding: 2px 6px; }

/* forms */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
input, select { background: var(--card2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  font-size: 13px; min-width: 96px; outline: none; font-family: inherit; }
input:focus, select:focus { border-color: var(--accent); }
.btn { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 9px 16px; cursor: pointer; font-size: 13px; font-weight: 600; }
.btn:hover { filter: brightness(1.1); } .btn.ghost { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
.btn:disabled { opacity: .5; cursor: wait; }
.seg { display: inline-flex; background: var(--card2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { background: none; border: none; color: var(--muted); padding: 6px 12px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.seg button.on { background: var(--accent); color: #fff; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }

/* road */
.road { display: flex; gap: 3px; overflow-x: auto; padding: 8px 10px 14px; min-height: 175px; align-items: flex-start; }
.road .col { display: flex; flex-direction: column; gap: 3px; flex: none; }
.road .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; color: #fff; font-weight: 700; }

/* prediction bars */
.pbar { display: grid; grid-template-columns: 70px 1fr 120px; gap: 10px; align-items: center; margin: 8px 0; font-size: 13px; }
.pbar .track { height: 12px; background: var(--card2); border-radius: 99px; position: relative; overflow: hidden; border: 1px solid var(--line); }
.pbar .fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 99px; }
.pbar .mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--amber); }
.verdict { font-size: 12.5px; padding: 8px 10px; border-radius: 8px; margin-top: 10px; line-height: 1.6; }
.verdict.no { background: rgba(244,63,94,.10); color: var(--neg); } .verdict.yes { background: rgba(16,185,129,.12); color: var(--pos); }
.action { font-size: 13px; padding: 10px 12px; border-radius: 10px; background: var(--card2); border: 1px solid var(--line); margin-top: 8px; line-height: 1.6; }

/* upload */
.drop { border: 2px dashed var(--line); border-radius: 14px; padding: 34px; text-align: center; color: var(--muted); cursor: pointer; transition: .2s; }
.drop.over, .drop:hover { border-color: var(--accent); background: rgba(99,102,241,.06); }

/* drawer & toast */
.drawer { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; z-index: 50; }
.drawer.open { display: block; }
.drawer-body { position: absolute; right: 0; top: 0; bottom: 0; width: min(440px, 92vw); background: var(--bg2); border-left: 1px solid var(--line);
  padding: 22px; overflow-y: auto; animation: slide .2s; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--card); border: 1px solid var(--line);
  padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow); display: none; z-index: 60; }
.loading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 80px; color: var(--muted); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
details.card summary { cursor: pointer; font-weight: 600; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 13px; }
.kv div:nth-child(odd) { color: var(--muted); }
ul.clean { padding-left: 18px; line-height: 1.9; margin: 6px 0; }
code { background: var(--card2); padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }
pre { background: var(--card2); padding: 12px; border-radius: 10px; overflow-x: auto; font-size: 12.5px; line-height: 1.6; }

@media (max-width: 1100px) { .g4, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) {
  #sidebar { position: fixed; transform: translateX(-100%); } #sidebar.open { transform: none; box-shadow: var(--shadow); }
  #menuBtn { display: inline-block; } .g2, .g3, .g4, .g5 { grid-template-columns: 1fr; } .span2, .span3 { grid-column: auto; }
  #view { padding: 16px; } .pbar { grid-template-columns: 56px 1fr 92px; }
}

/* ---------- v3：滚动条、紧凑表格、换行列 ---------- */
:root, [data-theme="dark"] { color-scheme: dark; } [data-theme="light"] { color-scheme: light; }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; } ::-webkit-scrollbar-thumb:hover { background: var(--muted); }
table.compact th, table.compact td { padding: 5px 6px; font-size: 12px; }
td.wrap { white-space: normal; min-width: 160px; text-align: left; }
.card > .tbl-wrap { max-width: 100%; }
.tbl-wrap { -webkit-overflow-scrolling: touch; }

/* 状态徽标 */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--card2); border: 1px solid var(--line); }
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.st.running::before { background: var(--accent2); animation: pulse 1s infinite; } .st.success::before { background: var(--green); }
.st.failed::before { background: var(--red); } .st.queued::before { background: var(--amber); } .st.cancelled::before { background: var(--muted); }
@keyframes pulse { 50% { opacity: .3; } }
.log { background: #05070f; color: #cbd5e1; font-family: ui-monospace, Menlo, monospace; font-size: 12px; line-height: 1.55; padding: 12px;
  border-radius: 10px; height: 52vh; overflow: auto; white-space: pre-wrap; word-break: break-all; border: 1px solid var(--line); }
[data-theme="light"] .log { background: #0f172a; }
.jobcard { display: flex; flex-direction: column; gap: 6px; }
.jobcard .d { color: var(--muted); font-size: 12px; flex: 1; line-height: 1.5; }
.btn.sm { padding: 6px 10px; font-size: 12px; } .btn.danger { background: var(--red); } .btn.ok { background: var(--green); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.switch { position: relative; display: inline-block; vertical-align: middle; width: 40px; min-width: 40px; height: 22px; flex: none; } .switch input { opacity: 0; width: 0; height: 0; min-width: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--accent); } .switch input:checked + span::before { transform: translateX(18px); }
.login-box { max-width: 380px; margin: 8vh auto; } .login-box .field { margin-bottom: 14px; } .login-box input { width: 100%; }
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-tabs a { padding: 7px 12px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); color: var(--text); font-size: 13px; }
.admin-tabs a.on { background: var(--accent); color: #fff; border-color: transparent; }
.userbox { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.notice { font-size: 12.5px; padding: 8px 14px; background: rgba(99,102,241,.10); border-bottom: 1px solid var(--line); color: var(--muted); }

/* 底部导航（手机） */
#bottomNav { display: none; }
@media (max-width: 760px) {
  body { font-size: 13.5px; }
  #topbar { padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); }
  #topbar h1 { font-size: 17px; } #pageSub { display: none; } #dataBadge { display: none; }
  #view { padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); }
  #bottomNav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--bg2); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom); }
  #bottomNav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; color: var(--muted); font-size: 11px; }
  #bottomNav a i { font-style: normal; font-size: 18px; line-height: 1.1; } #bottomNav a.active { color: var(--accent2); }
  .card { padding: 13px; border-radius: 12px; } .kpi .v { font-size: 21px; }
  .grid { gap: 10px; } .chart { height: 260px; } .chart.lg { height: 320px; } .chart.sm { height: 190px; }
  .ball { width: 40px; height: 40px; font-size: 17px; } .ball.big { width: 48px; height: 48px; font-size: 21px; }
  .balls { gap: 6px; font-size: 16px; }
  .toolbar { gap: 8px; } .toolbar .field { flex: 1 1 calc(50% - 8px); } .toolbar .field input, .toolbar .field select { width: 100%; min-width: 0; }
  .toolbar .btn { flex: 1 1 auto; }
  .seg { width: 100%; overflow-x: auto; flex-wrap: nowrap; } .seg button { flex: none; padding: 6px 10px; }
  .card h3 .sp { margin-left: 0; width: 100%; }
  input, select { font-size: 16px; } /* 防止 iOS 聚焦缩放 */
  .banner { padding: 11px 12px; font-size: 13px; }
  /* 表格 → 卡片 */
  .tbl-wrap.cards { border: none; overflow: visible; max-height: none !important; }
  .tbl-wrap.cards table, .tbl-wrap.cards tbody, .tbl-wrap.cards tr, .tbl-wrap.cards td { display: block; width: 100%; }
  .tbl-wrap.cards thead { display: none; }
  .tbl-wrap.cards tr { background: var(--card2); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; padding: 6px 10px; }
  .tbl-wrap.cards td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: none; padding: 5px 0;
    white-space: normal; text-align: right !important; min-width: 0; }
  .tbl-wrap.cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; max-width: 45%; }
  .tbl-wrap.cards td.wrap { display: block; } .tbl-wrap.cards td.wrap::before { display: block; margin-bottom: 2px; }
  .pager { flex-wrap: wrap; justify-content: center; }
  .drawer-body { width: 100vw; padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); }
  .log { height: 46vh; font-size: 11px; }
  .admin-tabs { flex-wrap: nowrap; overflow-x: auto; } .admin-tabs a { flex: none; }
}
@media (min-width: 761px) and (max-width: 1100px) { #sidebar { width: 196px; } #view { padding: 18px; } }

/* ---------- v3.1 手机端修复 ---------- */
.tagwrap { display: inline-flex; flex-wrap: wrap; gap: 3px; } .tagwrap .tag { margin: 0; }
.pbar > span:last-child { white-space: nowrap; }
@media (max-width: 760px) {
  #sidebar { z-index: 40; padding-bottom: env(safe-area-inset-bottom); }
  .tbl-wrap.cards td { flex-wrap: wrap; }
  .tbl-wrap.cards td .tagwrap { justify-content: flex-end; flex: 1 1 auto; min-width: 0; }
  .seg button { min-height: 38px; padding: 8px 12px; }
  .userbox .badge, #userBox .badge { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px; }
  .pbar { grid-template-columns: 52px 1fr auto; } .pbar > span:last-child { font-size: 12px; }
  .icon-btn { width: 40px; height: 40px; }
}

.road { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 28px); mask-image: linear-gradient(to right, transparent 0, #000 28px); }

/* 实时指示 */
.badge.live { display: inline-flex; align-items: center; gap: 6px; }
.badge.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.badge.live.on { color: var(--pos); border-color: rgba(16,185,129,.4); } .badge.live.on i { background: var(--green); animation: pulse 1.6s infinite; }
.badge.live.off { color: var(--neg); } .badge.live.off i { background: var(--red); }
@media (max-width: 760px) { #liveBadge { font-size: 11px; padding: 4px 8px; } }

/* ---------- v4.2 手机端顶栏/抽屉/提示修复 ---------- */
@media (max-width: 760px) {
  #topbar { padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top)); gap: 8px; }
  #topbar > div:nth-child(2) { min-width: 0; flex: 1; }
  #topbar h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #menuBtn, #themeBtn { flex: none; min-width: 40px; width: 40px; height: 40px; }
  #userBox { display: none; }
  #toast { bottom: calc(64px + env(safe-area-inset-bottom)); max-width: calc(100vw - 24px); text-align: center; }
  #sidebar .brand { padding: 12px 14px 8px; }
  #sidebar #nav .grp { padding: 8px 10px 3px; }
  #sidebar #nav a { padding: 6px 10px; font-size: 13px; }
  #sidebar .side-foot { padding: 8px 14px; }
}

/* v4.1 */
.balls { flex-wrap: wrap; justify-content: center; }
.ball.big { width: clamp(42px, 3.6vw, 60px); height: clamp(42px, 3.6vw, 60px); font-size: clamp(18px, 1.7vw, 26px); }
#topbar > div:nth-child(2) { min-width: 0; flex: 1; }
#pageSub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { flex: none; }
@media (max-width: 1280px) { #dataBadge { display: none; } }

/* ---------- v6：全局等宽数字、三彩种条、Keno核验网格、命令面板、三端适配 ---------- */
.kpi .v, table, .pbar, #cd, .badge, .balls, .keno-ball, .chip .q { font-variant-numeric: tabular-nums; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
.card.click { cursor: pointer; transition: transform .15s, border-color .15s; }
.card.click:hover { border-color: var(--accent); transform: translateY(-1px); }

.games-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.gmini { padding: 12px 14px; }
.gmini .ghead { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.gmini .grow { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.gmini .balls { justify-content: flex-start; }

.keno-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 10px 0; }
.keno-ball { background: var(--card2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 4px; text-align: center;
  display: flex; flex-direction: column; gap: 2px; border-top-width: 3px; }
.keno-ball small { font-size: 10px; color: var(--muted); }
.keno-ball b { font-size: 14px; }
.keno-ball.z1, .kzone.z1 { border-top-color: #6366f1; border-left-color: #6366f1; }
.keno-ball.z2, .kzone.z2 { border-top-color: #06b6d4; border-left-color: #06b6d4; }
.keno-ball.z3, .kzone.z3 { border-top-color: #f59e0b; border-left-color: #f59e0b; }
.keno-zones { display: grid; gap: 6px; margin-top: 10px; }
.kzone { background: var(--card2); border: 1px solid var(--line); border-left-width: 3px; border-radius: 8px; padding: 8px 10px; font-size: 12px; }
.kzone .k { margin-bottom: 2px; font-weight: 600; }

.code-box { position: relative; }
.code-box pre { padding-right: 68px; white-space: pre-wrap; word-break: break-all; margin: 0; }
.copy-btn { position: absolute; top: 8px; right: 8px; z-index: 2; }

.side-backdrop { display: none; }
.side-user { display: none; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(4px); display: none; z-index: 70;
  align-items: flex-start; justify-content: center; padding: 10vh 12px 16px; }
.modal.open { display: flex; }
.modal-body { width: min(560px, 100%); background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column; max-height: 76vh; }
.cmd-input { width: 100%; border: none; border-bottom: 1px solid var(--line); border-radius: 0; padding: 14px 16px; font-size: 15px; background: transparent; color: var(--text); }
.cmd-list { overflow-y: auto; padding: 6px; }
.cmd-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.cmd-item:hover, .cmd-item.on { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.cmd-foot { display: flex; gap: 14px; font-size: 11px; padding: 8px 14px; border-top: 1px solid var(--line); background: var(--card2); }

#toast { z-index: 80; }

.kv > div { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
code { overflow-wrap: anywhere; word-break: break-all; }
.chart.xs { height: 156px; }
.split-bar { display: flex; height: 26px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); font-size: 11.5px; font-weight: 600; color: #fff; margin: 10px 0 6px; }
.split-bar > div { display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; padding: 0 6px; transition: width .2s; }
.sb-tr { background: #6366f1; } .sb-va { background: #06b6d4; } .sb-ho { background: #10b981; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }

@media (min-width: 761px) and (max-width: 1100px) {
  #topbar { padding: 12px 16px; }
  .games-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span2 { grid-column: span 2; }
}
@media (min-width: 761px) and (max-width: 980px) {
  .g2, .g3 { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: auto; }
}
@media (max-width: 760px) {
  .side-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.48); z-index: 35; backdrop-filter: blur(2px); }
  .side-user { display: flex; padding: 4px 14px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
  .side-user .badge { width: 100%; justify-content: center; min-height: 36px; display: inline-flex; align-items: center; }
  #cmdBtn { flex: none; min-width: 40px; width: 40px; height: 40px; }
  .btn, .btn.sm, a.btn, a.btn.sm { min-height: 38px; padding: 7px 12px; display: inline-flex; align-items: center; justify-content: center; }
  .games-strip { grid-template-columns: 1fr; gap: 8px; }
  .keno-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .modal { padding-top: calc(14px + env(safe-area-inset-top)); }
  .cmd-input { font-size: 16px; }
  .cmd-item { min-height: 40px; }
  .kv { grid-template-columns: 92px 1fr; }
  .chart.xs { height: 148px; }
}
