/* Canonical lottery UI. Shared tokens and themes come from public-ui.css. */
:root {
  --bg: #eaf1ff;
  --page-bg: #eaf1ff;
  --panel: rgba(255, 255, 255, 0.76);
  --card: rgba(255, 255, 255, 0.72);
  --primary: #2f7bff;
  --primary-strong: #1f6bff;
  --accent: #62b7ff;
  --text: #0f1e3a;
  --muted: #4b6288;
  --line: rgba(47, 123, 255, 0.16);
  --success: #16a37a;
  --warning: #d97706;
  --danger: #e34b64;
  --shadow: 0 14px 32px rgba(37, 79, 152, 0.14);
  --soft-shadow: 0 8px 20px rgba(37, 79, 152, 0.09);
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  font-family: "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.55;
  background:
    radial-gradient(900px 520px at -12% -10%, rgba(56, 189, 248, 0.22), transparent 62%),
    radial-gradient(820px 460px at 112% 4%, rgba(37, 99, 235, 0.2), transparent 62%),
    linear-gradient(160deg, var(--page-bg), #edf3ff 58%, #e7f0ff);
  -webkit-tap-highlight-color: transparent;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.24;
  background-image:
    linear-gradient(rgba(47, 123, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 123, 255, 0.12) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}
button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.lottery-shell { width: min(1240px, 100%); min-height: 100vh; margin: 0 auto; padding: 10px 20px 24px; }
.site-header {
  position: sticky;
  top: 8px;
  z-index: 20;
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(235, 245, 255, 0.93), rgba(216, 233, 252, 0.9));
  box-shadow: 0 16px 38px rgba(26, 69, 138, 0.16);
  backdrop-filter: blur(20px) saturate(1.15);
}
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(31, 111, 235, 0.12), transparent 60%);
}
.brand-row { position: relative; display: flex; min-height: 66px; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 18px; }
.brand { display: flex; min-width: 0; align-items: center; gap: 12px; }
.brand img { width: auto; max-width: 146px; height: 40px; object-fit: contain; filter: drop-shadow(0 8px 16px rgba(31, 111, 235, 0.16)); }
.brand span { display: grid; min-width: 0; }
.brand strong { overflow: hidden; font-size: 18px; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.brand small { color: var(--muted); font-size: 12px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.source-badge, .back-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.source-badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.11); }
.source-badge.ok i { background: var(--success); box-shadow: 0 0 0 4px rgba(22, 163, 122, 0.12); }
.source-badge.stale i { background: var(--warning); }
.back-link { color: var(--primary-strong); }
.main-nav {
  position: relative;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 12px;
  border-top: 1px solid rgba(47, 123, 255, 0.1);
  background: linear-gradient(110deg, var(--primary-strong), var(--accent));
  scrollbar-width: none;
}
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a { flex: 0 0 auto; padding: 7px 13px; border: 0; border-radius: 10px; color: rgba(255, 255, 255, 0.88); font-size: 14px; font-weight: 800; background: transparent; }
.main-nav a:hover, .main-nav a.active { color: #fff; background: rgba(255, 255, 255, 0.18); box-shadow: inset 0 1px rgba(255,255,255,.24); }
.data-note { display: flex; align-items: center; gap: 14px; margin: 10px 0; padding: 9px 16px; border: 1px solid rgba(245, 158, 11, 0.15); border-radius: 13px; background: rgba(255, 248, 235, 0.85); color: #76531a; font-size: 13px; box-shadow: var(--soft-shadow); }
.data-note strong { flex: 0 0 auto; color: #e87525; }
.app-main { min-height: 620px; outline: 0; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 18px 0 12px; }
.eyebrow { margin: 0 0 3px; color: var(--primary); font-size: 12px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; }
.page-head h1 { margin: 0; font-size: clamp(25px, 3vw, 34px); line-height: 1.2; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.head-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.button, .period-button, .segmented button {
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card);
  color: var(--muted);
  font-weight: 800;
  box-shadow: inset 0 1px rgba(255,255,255,.6);
}
.button.primary, .period-button.active, .segmented button.active { color: #fff; border-color: transparent; background: linear-gradient(110deg, var(--primary-strong), var(--accent)); box-shadow: 0 8px 18px rgba(47, 123, 255, 0.22); }
.button:focus-visible, .main-nav a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(47, 123, 255, 0.24); outline-offset: 2px; }

.panel, .draw-card, .stat-card {
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 20px;
  background: linear-gradient(180deg, var(--panel), rgba(247, 251, 255, 0.68));
  box-shadow: inset 0 1px rgba(255,255,255,.84), var(--shadow);
  backdrop-filter: blur(14px) saturate(1.08);
}
.panel { overflow: hidden; margin-bottom: 14px; }
.panel-head { display: flex; min-height: 56px; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-head span { color: var(--muted); font-size: 12px; }
.panel-body { padding: 16px; }

.draw-card { padding: 18px 20px; }
.draw-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.draw-heading { font-size: 17px; font-weight: 900; }
.draw-issue { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 900; }
.status-pill, .tag { display: inline-flex; min-height: 25px; align-items: center; padding: 3px 8px; border: 1px solid rgba(22, 163, 122, 0.12); border-radius: 999px; background: rgba(22, 163, 122, 0.09); color: var(--success); font-size: 11px; font-weight: 900; }
.draw-actions { display: flex; gap: 8px; }
.lottery-shell .sound-toggle.active, .lottery-shell .scratch-toggle.active { color: #fff; border-color: transparent; background: linear-gradient(110deg, var(--primary-strong), var(--accent)); box-shadow: 0 8px 18px rgba(47, 123, 255, 0.2); }
.draw-issue { padding-top: 14px; }
.draw-main { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.65fr); gap: 22px; padding-top: 18px; }
.draw-scratch-zone { position: relative; width: fit-content; max-width: 100%; min-height: 90px; margin-inline: auto; padding-inline: 16px; overflow: hidden; border-radius: 15px; box-sizing: border-box; }
.scratch-canvas { position: absolute; inset: 0; z-index: 5; display: block; width: 100%; height: 100%; border-radius: inherit; touch-action: none; cursor: crosshair; opacity: 1; transition: opacity .24s ease, transform .24s ease; }
.scratch-canvas.is-cleared { opacity: 0; transform: scale(.985); pointer-events: none; }
.number-expression { display: flex; min-height: 90px; align-items: center; justify-content: center; gap: 12px; }
.draw-ball, .sum-ball { display: grid; width: 58px; height: 58px; flex: 0 0 auto; place-items: center; border: 2px solid rgba(255,255,255,.78); border-radius: 50%; color: #fff; font-size: 22px; font-weight: 950; box-shadow: inset 0 2px 8px rgba(255,255,255,.34), 0 9px 18px rgba(31, 107, 255, 0.24); }
.draw-ball.ball-a { background: linear-gradient(145deg, #67bfff, #1767ee); }
.draw-ball.ball-b { background: linear-gradient(145deg, #75ddae, #21a777); }
.draw-ball.ball-c { background: linear-gradient(145deg, #ffb86d, #ed7a35); }
.sum-ball { background: linear-gradient(145deg, #ff7188, #d62d50); }
.operator { color: var(--muted); font-size: 21px; font-weight: 950; }
.result-strip { display: flex; align-items: baseline; justify-content: center; gap: 14px; margin-top: 3px; }
.result-main { padding: 5px 16px; border-radius: 12px; background: rgba(22, 163, 122, 0.11); color: #138467; font-size: 25px; font-weight: 950; }
.countdown { font-size: 18px; font-weight: 950; }
.countdown strong { font-variant-numeric: tabular-nums; }
.tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 12px; }
.tag { border-color: var(--line); background: rgba(47,123,255,.06); color: var(--muted); }
.meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.meta-box { min-width: 0; min-height: 70px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.52); }
.meta-box span { display: block; color: var(--muted); font-size: 11px; }
.meta-box strong { overflow: hidden; display: block; margin-top: 4px; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.keno-trace { margin-top: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(47,123,255,.045); }
.keno-trace > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.keno-trace strong { font-size: 12px; }
.keno-trace span, .keno-concealed { color: var(--muted); font-size: 10px; }
.keno-number-list { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 5px; margin-top: 8px; }
.keno-number-list i { display: grid; min-height: 25px; place-items: center; border: 1px solid rgba(47,123,255,.1); border-radius: 8px; background: rgba(47,123,255,.08); color: var(--primary-strong); font-size: 10px; font-style: normal; font-weight: 900; }
.keno-concealed { display: grid; min-height: 32px; margin-top: 8px; place-items: center; border-radius: 9px; background: rgba(47,123,255,.06); }
.engine-panel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.engine-panel article { display: grid; min-width: 0; gap: 3px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: var(--soft-shadow); }
.engine-panel span, .engine-panel small { color: var(--muted); font-size: 10px; }
.engine-panel strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.stat-card { display: grid; gap: 3px; min-height: 92px; padding: 14px; }
.stat-card span { color: var(--muted); font-size: 12px; }
.stat-card strong { font-size: 23px; }
.stat-card small { color: var(--muted); font-size: 11px; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; min-width: 820px; border-collapse: collapse; }
th, td { padding: 11px 12px; border-bottom: 1px solid rgba(47, 123, 255, 0.1); text-align: left; white-space: nowrap; }
th { color: var(--muted); background: rgba(47,123,255,.04); font-size: 12px; }
td { font-size: 13px; }
tbody tr:hover { background: rgba(47,123,255,.04); }
.mini-balls { display: inline-flex; align-items: center; gap: 4px; }
.mini-ball { display: inline-grid; width: 25px; height: 25px; place-items: center; border-radius: 50%; background: #eef4ff; color: var(--primary-strong); font-size: 11px; font-weight: 900; }
.result-chip { display: inline-flex; padding: 3px 8px; border-radius: 999px; background: rgba(47,123,255,.08); color: var(--primary-strong); font-weight: 900; }
.empty-state { padding: 46px 20px; color: var(--muted); text-align: center; }

.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field label { color: var(--muted); font-size: 11px; font-weight: 800; }
.field input, .field select { width: 100%; min-height: 40px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: rgba(255,255,255,.68); color: var(--text); }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 16px; color: var(--muted); font-size: 12px; }

.chart-shell { min-height: 360px; padding: 12px; }
#trendCanvas { display: block; width: 100%; height: 330px; }
.distribution-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.bar-list { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 54px minmax(0,1fr) 34px; align-items: center; gap: 9px; font-size: 12px; }
.bar-track { height: 9px; overflow: hidden; border-radius: 999px; background: rgba(47,123,255,.08); }
.bar-track i { display: block; width: var(--bar-width); height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary-strong), var(--accent)); }

.omission-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.omission-item { display: grid; min-height: 72px; place-items: center; align-content: center; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.55); }
.omission-item span { color: var(--muted); font-size: 12px; }
.omission-item strong { font-size: 18px; }
.omission-item.hot { border-color: rgba(227,75,100,.19); background: rgba(227,75,100,.06); }
.omission-item.hot strong { color: var(--danger); }
.ball-groups { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }

.robot-prediction-page { display: grid; gap: 14px; }
.robot-lab-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(120deg, rgba(47,123,255,.1), rgba(255,255,255,.72));
  box-shadow: var(--soft-shadow);
}
.robot-lab-title { display: flex; align-items: center; gap: 9px; }
.robot-lab-title strong { font-size: 21px; }
.robot-lab-title span { padding: 3px 8px; border-radius: 999px; background: rgba(47,123,255,.12); color: var(--primary-strong); font-size: 11px; font-weight: 900; }
.robot-lab-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.robot-lab-stats { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.robot-lab-stats span { display: grid; min-width: 92px; padding: 7px 10px; border: 1px solid rgba(47,123,255,.1); border-radius: 11px; background: rgba(255,255,255,.7); color: var(--muted); font-size: 10px; text-align: center; }
.robot-lab-stats b { color: var(--text); font-size: 14px; }
.robot-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.robot-section-head div { display: flex; align-items: center; gap: 9px; }
.robot-section-head strong { font-size: 18px; }
.robot-section-head span { padding: 2px 7px; border-radius: 999px; background: rgba(47,123,255,.08); color: var(--primary-strong); font-size: 10px; font-weight: 800; }
.robot-section-head small { color: var(--muted); }
.robot-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.robot-card { display: grid; grid-template-columns: 44px minmax(0,1fr) auto; grid-template-areas: "avatar identity pick" "record record record"; gap: 9px; align-items: center; min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.76); color: var(--text); font: inherit; text-align: left; box-shadow: var(--soft-shadow); transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.robot-card:hover { border-color: rgba(47,123,255,.38); box-shadow: 0 12px 26px rgba(47,123,255,.13); transform: translateY(-2px); }
.robot-card:focus-visible { outline: 3px solid rgba(47,123,255,.24); outline-offset: 2px; }
.robot-avatar { position: relative; grid-area: avatar; display: grid; width: 44px; height: 44px; place-items: center; border-radius: 50%; background: linear-gradient(145deg, hsl(var(--robot-hue) 76% 68%), hsl(var(--robot-hue) 70% 48%)); color: #fff; font-size: 17px; font-weight: 950; box-shadow: inset 0 1px rgba(255,255,255,.5); }
.robot-avatar i { position: absolute; right: 0; bottom: 1px; width: 10px; height: 10px; border: 2px solid #fff; border-radius: 50%; background: #16a37a; }
.robot-identity { grid-area: identity; display: grid; min-width: 0; }
.robot-identity > strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.robot-identity > span { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.robot-identity span b { margin-right: 4px; color: var(--primary-strong); }
.robot-pick { grid-area: pick; display: grid; min-width: 58px; justify-items: end; }
.robot-pick span { color: var(--muted); font-size: 9px; }
.robot-pick strong { color: var(--primary-strong); font-size: 18px; white-space: nowrap; }
.robot-record { grid-area: record; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding-top: 7px; border-top: 1px solid rgba(47,123,255,.08); color: var(--muted); font-size: 9px; white-space: nowrap; }
.robot-record b { color: var(--text); }
.robot-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 4px 0 10px; }
.robot-pagination span { min-width: 100px; color: var(--muted); font-size: 12px; text-align: center; }

.robot-modal-layer { position: absolute; right: 0; left: 0; z-index: 120; display: grid; min-height: 480px; place-items: center; padding: 14px; }
.robot-modal-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: rgba(15,30,58,.48); backdrop-filter: blur(5px); cursor: default; }
.robot-modal { position: relative; z-index: 1; width: min(820px, 100%); max-height: 100%; overflow: auto; border: 1px solid rgba(255,255,255,.78); border-radius: 20px; background: #f7f9fc; box-shadow: 0 28px 70px rgba(15,30,58,.28); }
.robot-modal-head { position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: 48px minmax(0,1fr) 36px; gap: 11px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(14px); }
.robot-modal-head .robot-avatar { grid-area: auto; width: 48px; height: 48px; }
.robot-modal-head > div:nth-child(2) { display: grid; min-width: 0; }
.robot-modal-head > div:nth-child(2) > div { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; min-width: 0; }
.robot-modal-head > div:nth-child(2) strong { min-width: 0; overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.robot-modal-head > div:nth-child(2) span { justify-self: start; padding: 2px 7px; border-radius: 999px; background: rgba(47,123,255,.1); color: var(--primary-strong); font-size: 10px; font-weight: 900; white-space: nowrap; }
.robot-modal-head small { min-width: 0; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.robot-modal-close { position: relative; display: grid; width: 34px; height: 34px; place-items: center; align-self: center; justify-self: end; padding: 0; border: 0; border-radius: 10px; background: #eef3ff; color: #667085; font-size: 0; line-height: 0; }
.robot-modal-close::before, .robot-modal-close::after { content: ''; position: absolute; top: 50%; left: 50%; width: 14px; height: 2px; border-radius: 999px; background: currentColor; pointer-events: none; transform-origin: center; }
.robot-modal-close::before { transform: translate(-50%,-50%) rotate(45deg); }
.robot-modal-close::after { transform: translate(-50%,-50%) rotate(-45deg); }
.robot-modal-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; padding: 12px 14px 0; }
.robot-modal-stats span { display: grid; gap: 3px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--muted); font-size: 10px; }
.robot-modal-stats strong { overflow: hidden; color: var(--text); font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.robot-history-chart, .robot-history-table { margin: 12px 14px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.robot-history-table { margin-bottom: 14px; }
.robot-history-chart > div, .robot-history-table > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.robot-history-chart > div span, .robot-history-table > div:first-child span { color: var(--muted); font-size: 10px; }
#robotHistoryChart { display: block; width: 100%; height: 190px; padding: 6px 8px 0; }
.robot-history-table table { min-width: 580px; }
.robot-rule-note { margin: 12px 14px 0; padding: 9px 11px; border: 1px solid rgba(47,123,255,.16); border-radius: 11px; background: rgba(47,123,255,.07); color: var(--muted); font-size: 11px; line-height: 1.6; }
.robot-rule-note strong { color: var(--primary-strong); }
.robot-draw-result { display: grid; gap: 5px; min-width: 150px; }
.robot-draw-result .mini-balls { justify-content: flex-start; }
.robot-draw-result small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.robot-miss { display: inline-flex; min-height: 25px; align-items: center; padding: 3px 8px; border-radius: 999px; background: rgba(227,75,100,.08); color: var(--danger); font-size: 11px; font-weight: 900; }

.segmented { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.5); }
.segmented button { min-height: 31px; padding: 4px 10px; border-radius: 9px; box-shadow: none; font-size: 12px; }
.sequence { display: inline-flex; max-width: 320px; gap: 4px; overflow: hidden; }
.sequence i { min-width: 25px; padding: 2px 6px; border-radius: 7px; background: rgba(47,123,255,.07); color: var(--muted); font-style: normal; text-align: center; }

.error-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0; padding: 12px 14px; border: 1px solid rgba(227,75,100,.15); border-radius: 12px; background: rgba(255,241,244,.82); color: #a22942; font-size: 13px; }
.site-footer { display: grid; min-height: 0; justify-items: center; gap: 3px; margin: 6px 0 0; padding: 7px 12px max(9px, env(safe-area-inset-bottom)); border: 0; border-radius: 0; color: var(--muted); background: transparent; box-shadow: none; font-size: 11px; text-align: center; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 40; max-width: min(360px, calc(100vw - 40px)); padding: 11px 15px; border-radius: 12px; background: rgba(15,30,58,.9); color: #fff; font-size: 12px; box-shadow: 0 16px 34px rgba(15,30,58,.2); opacity: 0; pointer-events: none; transform: translateY(8px); transition: .22s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.skeleton-card { padding: 24px; border-radius: 20px; background: rgba(255,255,255,.5); box-shadow: var(--shadow); }
.skeleton { overflow: hidden; border-radius: 9px; background: linear-gradient(90deg, rgba(210,225,246,.6), rgba(245,250,255,.88), rgba(210,225,246,.6)); background-size: 220% 100%; animation: shimmer 1.5s infinite; }
.skeleton.title { width: 34%; height: 30px; }
.skeleton.hero { height: 260px; margin: 18px 0; }
.skeleton.line { width: 70%; height: 16px; }
@keyframes shimmer { to { background-position: -220% 0; } }

@media (max-width: 980px) {
  .draw-main { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .omission-grid { grid-template-columns: repeat(5, minmax(0,1fr)); }
  .robot-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 720px) {
  .lottery-shell { padding: 0 10px 18px; }
  .site-header { top: 0; margin: 0 -10px; border-radius: 0 0 18px 18px; }
  .brand-row { min-height: 58px; padding: 8px 12px; }
  .brand img { max-width: 106px; height: 31px; }
  .brand strong { font-size: 15px; }
  .brand small, .source-badge { display: none; }
  .back-link { min-height: 31px; padding: 5px 9px; }
  .main-nav { padding: 7px 8px; }
  .main-nav a { padding: 6px 10px; font-size: 13px; }
  .data-note { align-items: flex-start; gap: 8px; margin: 8px 0; padding: 8px 10px; }
  .data-note span { font-size: 11px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .head-controls { width: 100%; justify-content: flex-start; }
  .draw-card { padding: 14px 12px; border-radius: 16px; }
  .draw-top { align-items: flex-start; }
  .draw-actions .button { min-height: 34px; padding: 5px 9px; font-size: 12px; }
  .number-expression { gap: 6px; }
  .draw-ball, .sum-ball { width: 46px; height: 46px; font-size: 18px; }
  .operator { font-size: 17px; }
  .result-strip { align-items: center; flex-direction: column; gap: 6px; }
  .result-main { font-size: 21px; }
  .meta-grid { gap: 7px; }
  .meta-box { min-height: 62px; padding: 8px; }
  .engine-panel { grid-template-columns: 1fr; gap: 7px; }
  .engine-panel article { padding: 10px 12px; }
  .keno-number-list { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .summary-grid { gap: 8px; }
  .stat-card { min-height: 80px; padding: 11px; border-radius: 15px; }
  .stat-card strong { font-size: 20px; }
  .distribution-grid, .ball-groups { grid-template-columns: 1fr; }
  .omission-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .panel-body { padding: 12px; }
  .robot-lab-head { align-items: flex-start; flex-direction: column; padding: 13px; }
  .robot-lab-stats { width: 100%; justify-content: flex-start; }
  .robot-lab-stats span { flex: 1 1 82px; min-width: 0; }
  .robot-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
  .robot-card { grid-template-columns: 38px minmax(0,1fr); grid-template-areas: "avatar identity" "pick pick" "record record"; padding: 9px; }
  .robot-avatar { width: 38px; height: 38px; font-size: 15px; }
  .robot-pick { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; border-radius: 9px; background: rgba(47,123,255,.06); }
  .robot-pick strong { font-size: 16px; }
  .robot-record { align-items: flex-start; flex-direction: column; }
  .robot-modal-layer { padding: 8px; }
  .robot-modal { border-radius: 16px; }
  .robot-modal-stats { grid-template-columns: 1fr; }
  .robot-modal-head { grid-template-columns: 42px minmax(0,1fr) 34px; grid-template-areas: "modal-avatar modal-identity modal-close"; padding: 11px; }
  .robot-modal-head .robot-avatar { grid-area: modal-avatar; width: 42px; height: 42px; }
  .robot-modal-head > div:nth-child(2) { grid-area: modal-identity; }
  .robot-modal-close { grid-area: modal-close; }
}
@media (max-width: 460px) {
  .summary-grid, .filters { grid-template-columns: 1fr; }
  .omission-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .draw-issue { align-items: flex-start; flex-direction: column; gap: 5px; }
  .number-expression { transform: scale(.92); transform-origin: center; }
  .robot-section-head { align-items: flex-start; flex-direction: column; }
  .robot-modal-head { grid-template-columns: 38px minmax(0,1fr) 32px; gap: 8px; padding: 10px; }
  .robot-modal-head .robot-avatar { width: 38px; height: 38px; }
  .robot-modal-head > div:nth-child(2) > div { gap: 5px; }
  .robot-modal-head > div:nth-child(2) strong { font-size: 15px; }
  .robot-modal-head > div:nth-child(2) span { padding: 1px 6px; font-size: 9px; }
  .robot-modal-head small { font-size: 10px; }
  .robot-modal-close { width: 32px; height: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Structural consistency layer for the embedded lottery application. */
:root {
  --lottery-space-1: 4px;
  --lottery-space-2: 8px;
  --lottery-space-3: 12px;
  --lottery-space-4: 16px;
  --lottery-space-5: 20px;
  --lottery-control-sm: 36px;
  --lottery-control-md: 42px;
  --lottery-radius-sm: 10px;
  --lottery-radius-md: 14px;
  --lottery-radius-lg: 18px;
  --lottery-motion-fast: 160ms;
  --lottery-ease: cubic-bezier(.2,.8,.2,1);
  --lottery-inline-gutter: var(--ui-section-inner, 20px);
  --lottery-category-rail-height: 40px;
  --lottery-category-control-height: 32px;
}

.lottery-shell,
.lottery-shell * { box-sizing: border-box; }

.lottery-shell,
.lottery-shell :where(.brand-row, .app-main, .panel, .panel-head, .panel-body, .draw-main, .summary-grid, .filters, .robot-grid, .robot-card) {
  min-width: 0;
}

.lottery-shell :where(button, input, select, a, [role="button"]):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary-strong, #2f7bff) 30%, transparent);
  outline-offset: 2px;
}

.lottery-shell :where(button, input, select):disabled,
.lottery-shell :where(button, [role="button"])[aria-disabled="true"] {
  cursor: not-allowed;
  filter: saturate(.55);
  opacity: .55;
  pointer-events: none;
  transform: none !important;
}

.lottery-shell :where(.button, .period-button, .segmented button, .back-link) {
  min-height: var(--lottery-control-sm);
  padding-inline: var(--lottery-space-3);
  transition-duration: var(--lottery-motion-fast);
  transition-timing-function: var(--lottery-ease);
}

.main-nav {
  gap: var(--lottery-space-2);
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}

.main-nav::-webkit-scrollbar { display: none; }

.main-nav a {
  min-height: var(--lottery-control-md);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding-inline: var(--lottery-space-3);
}

/* The category rail is intentionally open on the page background. Remove the
   legacy header bottom stroke and animated energy line beneath it. */
html body .lottery-shell .site-header {
  border-bottom-color: transparent !important;
}

html body .lottery-shell .site-header::after {
  content: none !important;
  display: none !important;
  height: 0 !important;
  background: none !important;
  box-shadow: none !important;
  animation: none !important;
}

/* Embedded lottery categories follow the same rail dimensions and page
   gutter as the public trial vendor selector. */
html.lottery-embed .lottery-shell .site-header {
  display: contents !important;
}

html.lottery-embed .lottery-shell .site-header::before,
html.lottery-embed .lottery-shell .site-header::after {
  display: none !important;
  content: none !important;
}

html.lottery-embed .lottery-shell .lottery-category-shell {
  width: calc(100% - (var(--lottery-inline-gutter) * 2)) !important;
  margin: 0 var(--lottery-inline-gutter) var(--lottery-space-3) !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

html.lottery-embed,
html.lottery-embed body,
html.lottery-embed .lottery-shell,
html.lottery-embed .lottery-category-track {
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}

html.lottery-embed body::before,
html.lottery-embed body::after,
html.lottery-embed .lottery-category-shell::before,
html.lottery-embed .lottery-category-shell::after {
  display: none !important;
  content: none !important;
}

html.lottery-embed .lottery-shell .app-main {
  padding: 0;
}

html.lottery-embed .lottery-shell :where(.panel, .draw-card, .stat-card, .robot-card) {
  border-color: var(--ng-line, var(--line));
  border-radius: 15px;
  background: color-mix(in srgb, var(--ng-panel-solid, var(--card)) 94%, transparent);
  box-shadow: 0 8px 22px rgba(16, 24, 40, .065);
}

html.lottery-embed .lottery-shell .panel {
  margin-bottom: var(--lottery-space-3);
}

html.lottery-embed .lottery-shell .draw-card {
  padding: var(--lottery-space-4);
}

html.lottery-embed .lottery-shell :where(.meta-box, .engine-panel article) {
  border-color: var(--ng-line, var(--line));
  background: color-mix(in srgb, var(--ng-panel-solid, var(--card)) 76%, transparent);
  box-shadow: none;
}

html.lottery-embed .lottery-shell > .site-footer {
  margin-top: 6px;
  min-height: 0;
  padding: 7px 12px max(9px, env(safe-area-inset-bottom));
  border: 0;
  background: transparent;
  box-shadow: none;
}

/* The themed toast animation must never surface the empty toast node as a
   white pill beneath the embedded page. */
html.lottery-embed .toast:not(.show),
html.lottery-embed .toast:empty {
  display: none !important;
  animation: none !important;
}

:where(.panel, .draw-card, .stat-card, .robot-card) {
  border-radius: var(--lottery-radius-lg);
}

.panel-head {
  min-height: 60px;
  padding: var(--lottery-space-3) var(--lottery-space-4);
}

.panel-body {
  padding: var(--lottery-space-4);
}

.filters {
  gap: var(--lottery-space-3);
}

.field input,
.field select {
  min-height: var(--lottery-control-md);
  border-radius: var(--lottery-radius-sm);
}

.pagination,
.robot-pagination {
  min-width: 0;
  flex-wrap: wrap;
  gap: var(--lottery-space-2);
}

.empty-state {
  min-height: 160px;
  display: grid;
  place-content: center;
  padding: var(--lottery-space-5);
}

.robot-modal-layer {
  min-height: 100%;
  padding: max(var(--lottery-space-4), env(safe-area-inset-top)) max(var(--lottery-space-4), env(safe-area-inset-right)) max(var(--lottery-space-4), env(safe-area-inset-bottom)) max(var(--lottery-space-4), env(safe-area-inset-left));
}

.robot-modal {
  display: flex;
  width: min(820px, 100%);
  max-height: min(88dvh, 820px);
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px;
}

.robot-modal-head {
  flex: 0 0 auto;
}

.robot-modal-body {
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.robot-modal-close {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
}

.toast {
  max-width: min(380px, calc(100vw - 32px));
}

@media (min-width: 721px) {
  html body .lottery-shell .lottery-category-track {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    width: 100%;
    gap: var(--lottery-space-2) !important;
    padding: 2px 0 !important;
    overflow: visible !important;
  }

  html body .lottery-shell .lottery-category-item {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: none !important;
  }
}

@media (max-width: 720px) {
  :root {
    --lottery-control-sm: 40px;
    --lottery-control-md: 44px;
  }

  .main-nav a {
    min-height: 44px;
  }

  html.lottery-embed .lottery-shell .main-nav {
    min-height: var(--lottery-category-rail-height);
    padding: 4px 6px;
  }

  html.lottery-embed .lottery-shell .main-nav a {
    min-height: var(--lottery-category-control-height);
    height: var(--lottery-category-control-height);
    padding: 4px 9px;
    font-size: 11px;
  }

  .panel-head {
    min-height: 54px;
    padding: var(--lottery-space-3);
  }

  .panel-body {
    padding: var(--lottery-space-3);
  }

  html.lottery-embed .lottery-shell .draw-card {
    padding: var(--lottery-space-3);
  }

  .robot-modal-layer {
    align-items: end;
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  }

  .robot-modal {
    width: 100%;
    max-height: 90dvh;
    border-radius: 18px;
  }

  .robot-modal-body {
    scrollbar-gutter: auto;
  }

  .robot-modal-close {
    width: 44px !important;
    height: 44px !important;
  }

  .toast {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
    max-width: none;
  }
}

@media (max-width: 430px) {
  .number-expression {
    max-width: 100%;
  }

  .draw-top {
    gap: 10px;
  }

  .draw-heading {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .draw-actions {
    width: auto;
    margin-left: auto;
    flex-wrap: nowrap;
  }

  .draw-actions .button {
    min-width: 68px;
    min-height: 40px;
    flex: 0 0 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lottery-shell *,
  .lottery-shell *::before,
  .lottery-shell *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
